118 lines
4.4 KiB
C++
118 lines
4.4 KiB
C++
#pragma once
|
|
|
|
#include "opengl/shader_program_variable.hpp"
|
|
#include <array>
|
|
|
|
namespace shader_program::uniforms::mesh
|
|
{
|
|
|
|
enum class flags : int
|
|
{
|
|
none = 0,
|
|
mvp = 1 << 0,
|
|
model_matrix = 1 << 1,
|
|
point_size = 1 << 2,
|
|
color = 1 << 3,
|
|
tex = 1 << 4,
|
|
view_pos = 1 << 5,
|
|
point_light_direction = 1 << 6,
|
|
point_light_color = 1 << 7,
|
|
ambient_light_color = 1 << 8,
|
|
ambient_filter = 1 << 9,
|
|
diffuse_filter = 1 << 10,
|
|
specular_filter = 1 << 11,
|
|
shininess = 1 << 12,
|
|
alpha = 1 << 13
|
|
};
|
|
|
|
constexpr inline auto mvp = zgl::shader_program_variable({ GL_FLOAT_MAT4, 0 }, "mvp_matrix");
|
|
constexpr inline auto model_matrix = zgl::shader_program_variable({ GL_FLOAT_MAT4, 1 }, "model_matrix");
|
|
constexpr inline auto point_size = zgl::shader_program_variable({ GL_FLOAT, 2 }, "point_size");
|
|
constexpr inline auto color = zgl::shader_program_variable({ GL_FLOAT_VEC4, 3 }, "color");
|
|
constexpr inline auto tex = zgl::shader_program_variable({ GL_SAMPLER_2D, 3 }, "tex");
|
|
constexpr inline auto view_pos = zgl::shader_program_variable({ GL_FLOAT_VEC3, 4 }, "view_pos");
|
|
constexpr inline auto point_light_direction = zgl::shader_program_variable({ GL_FLOAT_VEC3, 5 }, "point_light_direction");
|
|
constexpr inline auto point_light_color = zgl::shader_program_variable({ GL_FLOAT_VEC3, 6 }, "point_light_color");
|
|
constexpr inline auto ambient_light_color = zgl::shader_program_variable({ GL_FLOAT_VEC3, 7 }, "ambient_light_color");
|
|
constexpr inline auto ambient_filter = zgl::shader_program_variable({ GL_FLOAT_VEC3, 8 }, "ambient_filter");
|
|
constexpr inline auto diffuse_filter = zgl::shader_program_variable({ GL_FLOAT_VEC3, 9 }, "diffuse_filter");
|
|
constexpr inline auto specular_filter = zgl::shader_program_variable({ GL_FLOAT_VEC3, 10 }, "specular_filter");
|
|
constexpr inline auto shininess = zgl::shader_program_variable({ GL_FLOAT, 11 }, "shininess");
|
|
constexpr inline auto alpha = zgl::shader_program_variable({ GL_FLOAT, 12 }, "alpha");
|
|
|
|
constexpr inline auto all = std::array{
|
|
mvp,
|
|
model_matrix,
|
|
point_size,
|
|
color,
|
|
tex,
|
|
view_pos,
|
|
point_light_direction,
|
|
point_light_color,
|
|
ambient_light_color,
|
|
ambient_filter,
|
|
diffuse_filter,
|
|
specular_filter,
|
|
shininess,
|
|
alpha
|
|
};
|
|
}
|
|
|
|
[[nodiscard]] constexpr shader_program::uniforms::mesh::flags operator|(
|
|
const shader_program::uniforms::mesh::flags& a, const shader_program::uniforms::mesh::flags& b
|
|
) {
|
|
return static_cast<shader_program::uniforms::mesh::flags>(static_cast<int>(a) | static_cast<int>(b));
|
|
}
|
|
|
|
[[nodiscard]] constexpr shader_program::uniforms::mesh::flags operator&(
|
|
const shader_program::uniforms::mesh::flags& a, const shader_program::uniforms::mesh::flags& b
|
|
) {
|
|
return static_cast<shader_program::uniforms::mesh::flags>(static_cast<int>(a) & static_cast<int>(b));
|
|
}
|
|
|
|
[[nodiscard]] constexpr shader_program::uniforms::mesh::flags operator^(
|
|
const shader_program::uniforms::mesh::flags& a, const shader_program::uniforms::mesh::flags& b
|
|
) {
|
|
return static_cast<shader_program::uniforms::mesh::flags>(static_cast<int>(a) ^ static_cast<int>(b));
|
|
}
|
|
|
|
[[nodiscard]] constexpr shader_program::uniforms::mesh::flags operator~(const shader_program::uniforms::mesh::flags& a) {
|
|
return static_cast<shader_program::uniforms::mesh::flags>(~static_cast<int>(a));
|
|
}
|
|
|
|
constexpr shader_program::uniforms::mesh::flags& operator|=(shader_program::uniforms::mesh::flags& a, const shader_program::uniforms::mesh::flags& b) {
|
|
return a = a | b;
|
|
}
|
|
|
|
constexpr shader_program::uniforms::mesh::flags& operator&=(shader_program::uniforms::mesh::flags& a, const shader_program::uniforms::mesh::flags& b) {
|
|
return a = a & b;
|
|
}
|
|
|
|
constexpr shader_program::uniforms::mesh::flags& operator^=(shader_program::uniforms::mesh::flags& a, const shader_program::uniforms::mesh::flags& b) {
|
|
return a = a ^ b;
|
|
}
|
|
|
|
[[nodiscard]] constexpr bool operator<(
|
|
shader_program::uniforms::mesh::flags lhs, shader_program::uniforms::mesh::flags rhs
|
|
) {
|
|
return static_cast<int>(lhs) < static_cast<int>(rhs);
|
|
}
|
|
|
|
[[nodiscard]] constexpr bool operator<=(
|
|
shader_program::uniforms::mesh::flags lhs, shader_program::uniforms::mesh::flags rhs
|
|
) {
|
|
return static_cast<int>(lhs) <= static_cast<int>(rhs);
|
|
}
|
|
|
|
[[nodiscard]] constexpr bool operator>(
|
|
shader_program::uniforms::mesh::flags lhs, shader_program::uniforms::mesh::flags rhs
|
|
) {
|
|
return static_cast<int>(lhs) > static_cast<int>(rhs);
|
|
}
|
|
|
|
[[nodiscard]] constexpr bool operator>=(
|
|
shader_program::uniforms::mesh::flags lhs, shader_program::uniforms::mesh::flags rhs
|
|
) {
|
|
return static_cast<int>(lhs) >= static_cast<int>(rhs);
|
|
}
|