#pragma once #include "opengl/shader_program_variable.hpp" #include namespace shader_program::attributes::mesh { enum class flags : int { none = 0, position = 1 << 0, normal = 1 << 1, tex_coord = 1 << 2 }; constexpr inline auto position = zgl::shader_program_variable({ GL_FLOAT_VEC3, 0 }, "vertex_position"); constexpr inline auto normal = zgl::shader_program_variable({ GL_FLOAT_VEC3, 1 }, "vertex_normal"); constexpr inline auto tex_coord = zgl::shader_program_variable({ GL_FLOAT_VEC2, 2 }, "vertex_tex_coord"); constexpr inline auto all = std::array{ position, normal, tex_coord }; } [[nodiscard]] constexpr shader_program::attributes::mesh::flags operator|( const shader_program::attributes::mesh::flags& a, const shader_program::attributes::mesh::flags& b ) { return static_cast(static_cast(a) | static_cast(b)); } [[nodiscard]] constexpr shader_program::attributes::mesh::flags operator&( const shader_program::attributes::mesh::flags& a, const shader_program::attributes::mesh::flags& b ) { return static_cast(static_cast(a) & static_cast(b)); } [[nodiscard]] constexpr shader_program::attributes::mesh::flags operator^( const shader_program::attributes::mesh::flags& a, const shader_program::attributes::mesh::flags& b ) { return static_cast(static_cast(a) ^ static_cast(b)); } [[nodiscard]] constexpr shader_program::attributes::mesh::flags operator~(const shader_program::attributes::mesh::flags& a) { return static_cast(~static_cast(a)); } constexpr shader_program::attributes::mesh::flags& operator|=(shader_program::attributes::mesh::flags& a, const shader_program::attributes::mesh::flags& b) { return a = a | b; } constexpr shader_program::attributes::mesh::flags& operator&=(shader_program::attributes::mesh::flags& a, const shader_program::attributes::mesh::flags& b) { return a = a & b; } constexpr shader_program::attributes::mesh::flags& operator^=(shader_program::attributes::mesh::flags& a, const shader_program::attributes::mesh::flags& b) { return a = a ^ b; } [[nodiscard]] constexpr bool operator<( shader_program::attributes::mesh::flags lhs, shader_program::attributes::mesh::flags rhs ) { return static_cast(lhs) < static_cast(rhs); } [[nodiscard]] constexpr bool operator<=( shader_program::attributes::mesh::flags lhs, shader_program::attributes::mesh::flags rhs ) { return static_cast(lhs) <= static_cast(rhs); } [[nodiscard]] constexpr bool operator>( shader_program::attributes::mesh::flags lhs, shader_program::attributes::mesh::flags rhs ) { return static_cast(lhs) > static_cast(rhs); } [[nodiscard]] constexpr bool operator>=( shader_program::attributes::mesh::flags lhs, shader_program::attributes::mesh::flags rhs ) { return static_cast(lhs) >= static_cast(rhs); }