86 lines
2.1 KiB
C++
86 lines
2.1 KiB
C++
#pragma once
|
|
|
|
#include "assets/components/mesh_vertex_components.hpp"
|
|
#include "assets/components/point_cloud_vertex_components.hpp"
|
|
#include "assets/components/material_components.hpp"
|
|
#include "shader_program/attributes/mesh_attributes.hpp"
|
|
#include "shader_program/uniforms/mesh_uniforms.hpp"
|
|
|
|
namespace shader_program::capabilities::mesh
|
|
{
|
|
|
|
struct type
|
|
{
|
|
attributes::mesh::flags attributes{
|
|
attributes::mesh::flags::none
|
|
};
|
|
uniforms::mesh::flags uniforms{
|
|
uniforms::mesh::flags::none
|
|
};
|
|
};
|
|
|
|
namespace indices
|
|
{
|
|
using type = ztu::u8;
|
|
constexpr inline type position = 0;
|
|
constexpr inline type lit = 1;
|
|
constexpr inline type textured = 2;
|
|
constexpr inline type uniform_color = 3;
|
|
constexpr inline type uniform_alpha = 4;
|
|
constexpr inline type point = 5;
|
|
}
|
|
|
|
enum class flags : int
|
|
{
|
|
none = 0,
|
|
position = 1 << indices::position,
|
|
lit = 1 << indices::lit,
|
|
textured = 1 << indices::textured,
|
|
uniform_color = 1 << indices::uniform_color,
|
|
uniform_alpha = 1 << indices::uniform_alpha,
|
|
point = 1 << indices::point
|
|
};
|
|
|
|
constexpr inline auto position = type{
|
|
.attributes = attributes::mesh::flags::position,
|
|
.uniforms = uniforms::mesh::flags::mvp
|
|
};
|
|
|
|
constexpr inline auto lit = 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 point = type{
|
|
.uniforms = uniforms::mesh::flags::point_size
|
|
};
|
|
|
|
constexpr inline auto textured = 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 uniform_alpha = type{
|
|
.uniforms = uniforms::mesh::flags::alpha
|
|
};
|
|
|
|
constexpr inline auto all = std::array{
|
|
position, lit, textured, uniform_color, uniform_alpha, point
|
|
};
|
|
|
|
}
|