Files
Z3D/include/opengl/shading/shader_metadata_language.hpp
2025-03-22 17:40:08 +01:00

70 lines
2.4 KiB
C++

#pragma once
#include <cinttypes>
#include <limits>
#include "util/string_lookup.hpp"
#include "model_geometry.hpp"
#include "shader_stage.hpp"
#include "features/mesh_features.hpp"
#include "features/point_cloud_features.hpp"
namespace zgl::shading::shader_metadata_language
{
enum class declaration_type : std::size_t
{
stage = 0,
geometry = 1,
features = 2,
static_enable = 3,
dynamic_enable = 4,
invalid = std::numeric_limits<std::size_t>::max()
};
inline constexpr auto declaration_prefix = std::string_view("\n#pragma ");
inline constexpr auto title_separator = ':';
inline constexpr auto value_separator = ' ';
inline auto declaration_lookup = ztu::string_lookup<declaration_type>{
{ "STAGE", declaration_type::stage },
{ "GEOMETRY", declaration_type::geometry },
{ "FEATURES", declaration_type::features },
{ "STATIC_ENABLE", declaration_type::static_enable },
{ "DYNAMIC_ENABLE", declaration_type::dynamic_enable }
};
inline auto stage_lookup = ztu::string_lookup<stage::types>{
{ "VERTEX", stage::types::vertex },
{ "TESSELATION_CONTROL", stage::types::tesselation_control },
{ "TESSELATION_EVALUATION", stage::types::tesselation_evaluation },
{ "GEOMETRY", stage::types::geometry },
{ "FRAGMENT", stage::types::fragment },
};
inline auto geometry_lookup = ztu::string_lookup<model_geometry::types>{
{ "MESH", model_geometry::types::mesh },
{ "POINT_CLOUD", model_geometry::types::point_cloud }
};
inline auto mesh_feature_lookup = ztu::string_lookup<features::mesh::flags>{
{ "FACE", features::mesh::flags::face },
{ "LINE", features::mesh::flags::line },
{ "POINT", features::mesh::flags::point },
{ "V_L", features::mesh::flags::luminance },
{ "V_RGB", features::mesh::flags::color },
{ "V_A", features::mesh::flags::alpha },
{ "LIGHTING", features::mesh::flags::lighting },
{ "TEXTURE", features::mesh::flags::texture },
{ "U_RGBA", features::mesh::flags::uniform_color }
};
inline auto point_cloud_feature_lookup = ztu::string_lookup<features::point_cloud::flags>{
{ "SQUARE", features::point_cloud::flags::square },
{ "LIGHTING", features::point_cloud::flags::lighting },
{ "V_L", features::point_cloud::flags::luminance },
{ "V_RGB", features::point_cloud::flags::color },
{ "V_A", features::point_cloud::flags::alpha },
{ "U_RGBA", features::point_cloud::flags::uniform_color },
{ "RAINBOW", features::point_cloud::flags::rainbow }
};
};