123 lines
4.3 KiB
C++
123 lines
4.3 KiB
C++
#pragma once
|
|
|
|
#include "assets/components/point_cloud_vertex_components.hpp"
|
|
#include "shader_program/capabilities/point_cloud_capabilities.hpp"
|
|
|
|
#include <array>
|
|
|
|
namespace rendering::requirements::point_cloud
|
|
{
|
|
|
|
struct type
|
|
{
|
|
shader_program::capabilities::point_cloud::indices::type shader_program_requirement_index{};
|
|
components::point_cloud_vertex::flags vertex_requirements{
|
|
components::point_cloud_vertex::flags::none
|
|
};
|
|
};
|
|
|
|
|
|
enum class flags : int
|
|
{
|
|
none = 0,
|
|
position = 1 << 0,
|
|
vertex_color = 1 << 1,
|
|
uniform_color = 1 << 2,
|
|
normal = 1 << 3,
|
|
reflectance = 1 << 4,
|
|
rainbow = 1 << 5
|
|
};
|
|
|
|
|
|
constexpr inline auto position = type{
|
|
.shader_program_requirement_index = shader_program::capabilities::point_cloud::indices::position,
|
|
.vertex_requirements = components::point_cloud_vertex::flags::position
|
|
};
|
|
|
|
constexpr inline auto rainbow = type{
|
|
.shader_program_requirement_index = shader_program::capabilities::point_cloud::indices::rainbow
|
|
};
|
|
|
|
constexpr inline auto vertex_color = type{
|
|
.shader_program_requirement_index = shader_program::capabilities::point_cloud::indices::vertex_color,
|
|
.vertex_requirements = components::point_cloud_vertex::flags::color
|
|
};
|
|
|
|
constexpr inline auto uniform_color = type{
|
|
.shader_program_requirement_index = shader_program::capabilities::point_cloud::indices::uniform_color
|
|
};
|
|
|
|
constexpr inline auto normal = type{
|
|
.shader_program_requirement_index = shader_program::capabilities::point_cloud::indices::normal,
|
|
.vertex_requirements = components::point_cloud_vertex::flags::normal
|
|
};
|
|
|
|
constexpr inline auto reflectance = type{
|
|
.shader_program_requirement_index = shader_program::capabilities::point_cloud::indices::reflectance,
|
|
.vertex_requirements = components::point_cloud_vertex::flags::reflectance
|
|
};
|
|
|
|
constexpr inline auto all = std::array{
|
|
position, vertex_color, uniform_color, normal, reflectance, rainbow
|
|
};
|
|
}
|
|
|
|
|
|
[[nodiscard]] constexpr rendering::requirements::point_cloud::flags operator|(
|
|
const rendering::requirements::point_cloud::flags& a, const rendering::requirements::point_cloud::flags& b
|
|
) {
|
|
return static_cast<rendering::requirements::point_cloud::flags>(static_cast<int>(a) | static_cast<int>(b));
|
|
}
|
|
|
|
[[nodiscard]] constexpr rendering::requirements::point_cloud::flags operator&(
|
|
const rendering::requirements::point_cloud::flags& a, const rendering::requirements::point_cloud::flags& b
|
|
) {
|
|
return static_cast<rendering::requirements::point_cloud::flags>(static_cast<int>(a) & static_cast<int>(b));
|
|
}
|
|
|
|
[[nodiscard]] constexpr rendering::requirements::point_cloud::flags operator^(
|
|
const rendering::requirements::point_cloud::flags& a, const rendering::requirements::point_cloud::flags& b
|
|
) {
|
|
return static_cast<rendering::requirements::point_cloud::flags>(static_cast<int>(a) ^ static_cast<int>(b));
|
|
}
|
|
|
|
[[nodiscard]] constexpr rendering::requirements::point_cloud::flags operator~(const rendering::requirements::point_cloud::flags& a) {
|
|
return static_cast<rendering::requirements::point_cloud::flags>(~static_cast<int>(a));
|
|
}
|
|
|
|
constexpr rendering::requirements::point_cloud::flags& operator|=(rendering::requirements::point_cloud::flags& a, const rendering::requirements::point_cloud::flags& b) {
|
|
return a = a | b;
|
|
}
|
|
|
|
constexpr rendering::requirements::point_cloud::flags& operator&=(rendering::requirements::point_cloud::flags& a, const rendering::requirements::point_cloud::flags& b) {
|
|
return a = a & b;
|
|
}
|
|
|
|
constexpr rendering::requirements::point_cloud::flags& operator^=(rendering::requirements::point_cloud::flags& a, const rendering::requirements::point_cloud::flags& b) {
|
|
return a = a ^ b;
|
|
}
|
|
|
|
[[nodiscard]] constexpr bool operator<(
|
|
rendering::requirements::point_cloud::flags lhs, rendering::requirements::point_cloud::flags rhs
|
|
) {
|
|
return static_cast<int>(lhs) < static_cast<int>(rhs);
|
|
}
|
|
|
|
[[nodiscard]] constexpr bool operator<=(
|
|
rendering::requirements::point_cloud::flags lhs, rendering::requirements::point_cloud::flags rhs
|
|
) {
|
|
return static_cast<int>(lhs) <= static_cast<int>(rhs);
|
|
}
|
|
|
|
[[nodiscard]] constexpr bool operator>(
|
|
rendering::requirements::point_cloud::flags lhs, rendering::requirements::point_cloud::flags rhs
|
|
) {
|
|
return static_cast<int>(lhs) > static_cast<int>(rhs);
|
|
}
|
|
|
|
[[nodiscard]] constexpr bool operator>=(
|
|
rendering::requirements::point_cloud::flags lhs, rendering::requirements::point_cloud::flags rhs
|
|
) {
|
|
return static_cast<int>(lhs) >= static_cast<int>(rhs);
|
|
}
|