#pragma once #include "opengl/shading/attributes/mesh_attributes.hpp" #include "opengl/shading/uniforms/mesh_uniforms.hpp" #include "util/enum_bitfield_operators.hpp" #include #include namespace zgl::shading::features::mesh { struct type { attributes::mesh::flags attributes{ attributes::mesh::flags::none }; uniforms::mesh::flags uniforms{ uniforms::mesh::flags::none }; }; namespace indices { enum : z3d::size { face, line, point, luminance, color, alpha, lighting, texture, uniform_color }; } enum class flags : std::uint16_t { none = 0, face = 1 << indices::face, line = 1 << indices::line, point = 1 << indices::point, luminance = 1 << indices::luminance, color = 1 << indices::color, alpha = 1 << indices::alpha, lighting = 1 << indices::lighting, texture = 1 << indices::texture, uniform_color = 1 << indices::uniform_color }; constexpr inline auto face = type{ .attributes = attributes::mesh::flags::position, .uniforms = uniforms::mesh::flags::mvp_matrix }; constexpr inline auto line = type{ .attributes = attributes::mesh::flags::position, .uniforms = uniforms::mesh::flags::mvp_matrix }; constexpr inline auto point = type{ .attributes = attributes::mesh::flags::position, .uniforms = ( uniforms::mesh::flags::mvp_matrix | uniforms::mesh::flags::point_size ) }; constexpr inline auto luminance = type{ .attributes = attributes::mesh::flags::luminance }; constexpr inline auto color = type{ .attributes = attributes::mesh::flags::color }; constexpr inline auto alpha = type{ .attributes = attributes::mesh::flags::alpha }; constexpr inline auto lighting = type{ .attributes = attributes::mesh::flags::normal, .uniforms = ( uniforms::mesh::flags::model_matrix | uniforms::mesh::flags::view_pos | uniforms::mesh::flags::point_light_direction | uniforms::mesh::flags::point_light_color | uniforms::mesh::flags::ambient_light_color | uniforms::mesh::flags::ambient_filter | uniforms::mesh::flags::diffuse_filter | uniforms::mesh::flags::specular_filter | uniforms::mesh::flags::shininess ) }; constexpr inline auto texture = type{ .attributes = attributes::mesh::flags::tex_coord, .uniforms = uniforms::mesh::flags::tex }; constexpr inline auto uniform_color = type{ .uniforms = uniforms::mesh::flags::color }; constexpr inline auto all = std::array{ face, line, point, luminance, color, alpha, lighting, texture, uniform_color }; constexpr inline auto names = std::array{ "face", "line", "point", "luminance", "color", "alpha", "lighting", "texture", "uniform_color" }; } DEFINE_ENUM_BITFIELD_OPERATORS(zgl::shading::features::mesh::flags)