128 lines
4.2 KiB
C++
128 lines
4.2 KiB
C++
#pragma once
|
|
|
|
#include "assets/components/material_components.hpp"
|
|
#include "assets/components/mesh_vertex_components.hpp"
|
|
#include "shader_program/features/mesh_features.hpp"
|
|
|
|
#include <array>
|
|
|
|
namespace rendering::requirements::mesh
|
|
{
|
|
|
|
struct type
|
|
{
|
|
shader_program::capabilities::mesh::indices::type shader_program_requirement_index{};
|
|
components::mesh_vertex::flags vertex_requirements{
|
|
components::mesh_vertex::flags::none
|
|
};
|
|
material_component::flags material_requirements{
|
|
material_component::flags::none
|
|
};
|
|
};
|
|
|
|
enum class flags : int
|
|
{
|
|
none = 0,
|
|
position = 1 << 0,
|
|
lit = 1 << 1,
|
|
textured = 1 << 2,
|
|
uniform_color = 1 << 3,
|
|
uniform_alpha = 1 << 4,
|
|
point = 1 << 5
|
|
};
|
|
|
|
constexpr inline auto position = type{
|
|
.shader_program_requirement_index = shader_program::capabilities::mesh::indices::position,
|
|
.vertex_requirements = components::mesh_vertex::flags::position
|
|
};
|
|
|
|
constexpr inline auto lit = type{
|
|
.shader_program_requirement_index = shader_program::capabilities::mesh::indices::lit,
|
|
.vertex_requirements = components::mesh_vertex::flags::normal,
|
|
.material_requirements = material_component::flags::surface_properties
|
|
};
|
|
|
|
constexpr inline auto point = type{
|
|
.shader_program_requirement_index = shader_program::capabilities::mesh::indices::point
|
|
};
|
|
|
|
constexpr inline auto textured = type{
|
|
.shader_program_requirement_index = shader_program::capabilities::mesh::indices::textured,
|
|
.vertex_requirements = components::mesh_vertex::flags::tex_coord,
|
|
.material_requirements = material_component::flags::texture,
|
|
};
|
|
|
|
constexpr inline auto uniform_color = type{
|
|
.shader_program_requirement_index = shader_program::capabilities::mesh::indices::uniform_color
|
|
};
|
|
|
|
constexpr inline auto uniform_alpha = type{
|
|
.shader_program_requirement_index = shader_program::capabilities::mesh::indices::uniform_alpha,
|
|
.material_requirements = material_component::flags::transparency
|
|
};
|
|
|
|
constexpr inline auto all = std::array{
|
|
position, lit, textured, uniform_color, uniform_alpha, point
|
|
};
|
|
|
|
}
|
|
|
|
|
|
[[nodiscard]] constexpr rendering::requirements::mesh::flags operator|(
|
|
const rendering::requirements::mesh::flags& a, const rendering::requirements::mesh::flags& b
|
|
) {
|
|
return static_cast<rendering::requirements::mesh::flags>(static_cast<int>(a) | static_cast<int>(b));
|
|
}
|
|
|
|
[[nodiscard]] constexpr rendering::requirements::mesh::flags operator&(
|
|
const rendering::requirements::mesh::flags& a, const rendering::requirements::mesh::flags& b
|
|
) {
|
|
return static_cast<rendering::requirements::mesh::flags>(static_cast<int>(a) & static_cast<int>(b));
|
|
}
|
|
|
|
[[nodiscard]] constexpr rendering::requirements::mesh::flags operator^(
|
|
const rendering::requirements::mesh::flags& a, const rendering::requirements::mesh::flags& b
|
|
) {
|
|
return static_cast<rendering::requirements::mesh::flags>(static_cast<int>(a) ^ static_cast<int>(b));
|
|
}
|
|
|
|
[[nodiscard]] constexpr rendering::requirements::mesh::flags operator~(const rendering::requirements::mesh::flags& a) {
|
|
return static_cast<rendering::requirements::mesh::flags>(~static_cast<int>(a));
|
|
}
|
|
|
|
constexpr rendering::requirements::mesh::flags& operator|=(rendering::requirements::mesh::flags& a, const rendering::requirements::mesh::flags& b) {
|
|
return a = a | b;
|
|
}
|
|
|
|
constexpr rendering::requirements::mesh::flags& operator&=(rendering::requirements::mesh::flags& a, const rendering::requirements::mesh::flags& b) {
|
|
return a = a & b;
|
|
}
|
|
|
|
constexpr rendering::requirements::mesh::flags& operator^=(rendering::requirements::mesh::flags& a, const rendering::requirements::mesh::flags& b) {
|
|
return a = a ^ b;
|
|
}
|
|
|
|
[[nodiscard]] constexpr bool operator<(
|
|
rendering::requirements::mesh::flags lhs, rendering::requirements::mesh::flags rhs
|
|
) {
|
|
return static_cast<int>(lhs) < static_cast<int>(rhs);
|
|
}
|
|
|
|
[[nodiscard]] constexpr bool operator<=(
|
|
rendering::requirements::mesh::flags lhs, rendering::requirements::mesh::flags rhs
|
|
) {
|
|
return static_cast<int>(lhs) <= static_cast<int>(rhs);
|
|
}
|
|
|
|
[[nodiscard]] constexpr bool operator>(
|
|
rendering::requirements::mesh::flags lhs, rendering::requirements::mesh::flags rhs
|
|
) {
|
|
return static_cast<int>(lhs) > static_cast<int>(rhs);
|
|
}
|
|
|
|
[[nodiscard]] constexpr bool operator>=(
|
|
rendering::requirements::mesh::flags lhs, rendering::requirements::mesh::flags rhs
|
|
) {
|
|
return static_cast<int>(lhs) >= static_cast<int>(rhs);
|
|
}
|