This commit is contained in:
ZY4N
2024-12-22 16:58:40 +01:00
parent 2704814de2
commit db8db8f9d7
161 changed files with 17102 additions and 0 deletions

View File

@@ -0,0 +1,83 @@
#pragma once
#include "opengl/shader_program_variable.hpp"
#include <array>
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<shader_program::attributes::mesh::flags>(static_cast<int>(a) | static_cast<int>(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<shader_program::attributes::mesh::flags>(static_cast<int>(a) & static_cast<int>(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<shader_program::attributes::mesh::flags>(static_cast<int>(a) ^ static_cast<int>(b));
}
[[nodiscard]] constexpr shader_program::attributes::mesh::flags operator~(const shader_program::attributes::mesh::flags& a) {
return static_cast<shader_program::attributes::mesh::flags>(~static_cast<int>(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<int>(lhs) < static_cast<int>(rhs);
}
[[nodiscard]] constexpr bool operator<=(
shader_program::attributes::mesh::flags lhs, shader_program::attributes::mesh::flags rhs
) {
return static_cast<int>(lhs) <= static_cast<int>(rhs);
}
[[nodiscard]] constexpr bool operator>(
shader_program::attributes::mesh::flags lhs, shader_program::attributes::mesh::flags rhs
) {
return static_cast<int>(lhs) > static_cast<int>(rhs);
}
[[nodiscard]] constexpr bool operator>=(
shader_program::attributes::mesh::flags lhs, shader_program::attributes::mesh::flags rhs
) {
return static_cast<int>(lhs) >= static_cast<int>(rhs);
}

View File

@@ -0,0 +1,84 @@
#pragma once
#include "opengl/shader_program_variable.hpp"
#include <array>
namespace shader_program::attributes::point_cloud
{
enum class flags : int {
none = 0,
position = 1 << 0,
normal = 1 << 1,
color = 1 << 2,
reflectance = 1 << 3
};
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 color = zgl::shader_program_variable({ GL_FLOAT_VEC3, 2 }, "vertex_color");
constexpr inline auto reflectance = zgl::shader_program_variable({ GL_FLOAT, 2 }, "vertex_reflectance");
constexpr inline auto all = std::array{
position, normal, color, reflectance
};
}
[[nodiscard]] constexpr shader_program::attributes::point_cloud::flags operator|(
const shader_program::attributes::point_cloud::flags& a, const shader_program::attributes::point_cloud::flags& b
) {
return static_cast<shader_program::attributes::point_cloud::flags>(static_cast<int>(a) | static_cast<int>(b));
}
[[nodiscard]] constexpr shader_program::attributes::point_cloud::flags operator&(
const shader_program::attributes::point_cloud::flags& a, const shader_program::attributes::point_cloud::flags& b
) {
return static_cast<shader_program::attributes::point_cloud::flags>(static_cast<int>(a) & static_cast<int>(b));
}
[[nodiscard]] constexpr shader_program::attributes::point_cloud::flags operator^(
const shader_program::attributes::point_cloud::flags& a, const shader_program::attributes::point_cloud::flags& b
) {
return static_cast<shader_program::attributes::point_cloud::flags>(static_cast<int>(a) ^ static_cast<int>(b));
}
[[nodiscard]] constexpr shader_program::attributes::point_cloud::flags operator~(const shader_program::attributes::point_cloud::flags& a) {
return static_cast<shader_program::attributes::point_cloud::flags>(~static_cast<int>(a));
}
constexpr shader_program::attributes::point_cloud::flags& operator|=(shader_program::attributes::point_cloud::flags& a, const shader_program::attributes::point_cloud::flags& b) {
return a = a | b;
}
constexpr shader_program::attributes::point_cloud::flags& operator&=(shader_program::attributes::point_cloud::flags& a, const shader_program::attributes::point_cloud::flags& b) {
return a = a & b;
}
constexpr shader_program::attributes::point_cloud::flags& operator^=(shader_program::attributes::point_cloud::flags& a, const shader_program::attributes::point_cloud::flags& b) {
return a = a ^ b;
}
[[nodiscard]] constexpr bool operator<(
shader_program::attributes::point_cloud::flags lhs, shader_program::attributes::point_cloud::flags rhs
) {
return static_cast<int>(lhs) < static_cast<int>(rhs);
}
[[nodiscard]] constexpr bool operator<=(
shader_program::attributes::point_cloud::flags lhs, shader_program::attributes::point_cloud::flags rhs
) {
return static_cast<int>(lhs) <= static_cast<int>(rhs);
}
[[nodiscard]] constexpr bool operator>(
shader_program::attributes::point_cloud::flags lhs, shader_program::attributes::point_cloud::flags rhs
) {
return static_cast<int>(lhs) > static_cast<int>(rhs);
}
[[nodiscard]] constexpr bool operator>=(
shader_program::attributes::point_cloud::flags lhs, shader_program::attributes::point_cloud::flags rhs
) {
return static_cast<int>(lhs) >= static_cast<int>(rhs);
}

View File

@@ -0,0 +1,85 @@
#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
};
}

View File

@@ -0,0 +1,77 @@
#pragma once
#include "shader_program/attributes/point_cloud_attributes.hpp"
#include "shader_program/uniforms/point_cloud_uniforms.hpp"
#include "assets/components/mesh_vertex_components.hpp"
#include "assets/components/point_cloud_vertex_components.hpp"
#include <array>
namespace shader_program::capabilities::point_cloud
{
struct type
{
attributes::point_cloud::flags attributes{
attributes::point_cloud::flags::none
};
uniforms::point_cloud::flags uniforms{
uniforms::point_cloud::flags::none
};
};
namespace indices
{
using type = ztu::u8;
constexpr inline type position = 0;
constexpr inline type vertex_color = 1;
constexpr inline type uniform_color = 2;
constexpr inline type normal = 3;
constexpr inline type reflectance = 4;
constexpr inline type rainbow = 5;
}
enum class flags : int
{
none = 0,
position = 1 << indices::position,
vertex_color = 1 << indices::vertex_color,
uniform_color = 1 << indices::uniform_color,
normal = 1 << indices::normal,
reflectance = 1 << indices::reflectance,
rainbow = 1 << indices::rainbow
};
constexpr inline auto position = type{
.attributes = attributes::point_cloud::flags::position,
.uniforms = uniforms::point_cloud::flags::mvp
};
constexpr inline auto rainbow = type{};
constexpr inline auto vertex_color = type{
.attributes = attributes::point_cloud::flags::color
};
constexpr inline auto uniform_color = type{
.uniforms = uniforms::point_cloud::flags::color
};
constexpr inline auto normal = type{
.attributes = attributes::point_cloud::flags::normal,
.uniforms = (
uniforms::point_cloud::flags::model |
uniforms::point_cloud::flags::camera_position
)
};
constexpr inline auto reflectance = type{
.attributes = attributes::point_cloud::flags::reflectance
};
constexpr inline auto all = std::array{
position, vertex_color, uniform_color, normal, reflectance, rainbow
};
}

View File

@@ -0,0 +1,117 @@
#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);
}

View File

@@ -0,0 +1,97 @@
#pragma once
#include "opengl/shader_program_variable.hpp"
#include <array>
namespace shader_program::uniforms::point_cloud
{
enum class flags : int
{
none = 0,
mvp = 1 << 0,
point_size = 1 << 1,
color = 1 << 2,
model = 1 << 3,
camera_position = 1 << 4,
rainbow_offset_y = 1 << 5,
rainbow_scale_y = 1 << 6,
};
constexpr inline auto mvp = zgl::shader_program_variable({ GL_FLOAT_MAT4, 0 }, "mvp");
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 model = zgl::shader_program_variable({ GL_FLOAT_MAT4, 4 }, "model");
constexpr inline auto camera_position = zgl::shader_program_variable({ GL_FLOAT_VEC3, 5 }, "camera_position");
constexpr inline auto rainbow_offset_y = zgl::shader_program_variable({ GL_FLOAT, 6 }, "rainbow_offset_y");
constexpr inline auto rainbow_scale_y = zgl::shader_program_variable({ GL_FLOAT, 7 }, "rainbow_scale_y");
constexpr inline auto all = std::array{
mvp,
point_size,
color,
model,
camera_position,
rainbow_offset_y,
rainbow_scale_y
};
}
[[nodiscard]] constexpr shader_program::uniforms::point_cloud::flags operator|(
const shader_program::uniforms::point_cloud::flags& a, const shader_program::uniforms::point_cloud::flags& b
) {
return static_cast<shader_program::uniforms::point_cloud::flags>(static_cast<int>(a) | static_cast<int>(b));
}
[[nodiscard]] constexpr shader_program::uniforms::point_cloud::flags operator&(
const shader_program::uniforms::point_cloud::flags& a, const shader_program::uniforms::point_cloud::flags& b
) {
return static_cast<shader_program::uniforms::point_cloud::flags>(static_cast<int>(a) & static_cast<int>(b));
}
[[nodiscard]] constexpr shader_program::uniforms::point_cloud::flags operator^(
const shader_program::uniforms::point_cloud::flags& a, const shader_program::uniforms::point_cloud::flags& b
) {
return static_cast<shader_program::uniforms::point_cloud::flags>(static_cast<int>(a) ^ static_cast<int>(b));
}
[[nodiscard]] constexpr shader_program::uniforms::point_cloud::flags operator~(const shader_program::uniforms::point_cloud::flags& a) {
return static_cast<shader_program::uniforms::point_cloud::flags>(~static_cast<int>(a));
}
constexpr shader_program::uniforms::point_cloud::flags& operator|=(shader_program::uniforms::point_cloud::flags& a, const shader_program::uniforms::point_cloud::flags& b) {
return a = a | b;
}
constexpr shader_program::uniforms::point_cloud::flags& operator&=(shader_program::uniforms::point_cloud::flags& a, const shader_program::uniforms::point_cloud::flags& b) {
return a = a & b;
}
constexpr shader_program::uniforms::point_cloud::flags& operator^=(shader_program::uniforms::point_cloud::flags& a, const shader_program::uniforms::point_cloud::flags& b) {
return a = a ^ b;
}
[[nodiscard]] constexpr bool operator<(
shader_program::uniforms::point_cloud::flags lhs, shader_program::uniforms::point_cloud::flags rhs
) {
return static_cast<int>(lhs) < static_cast<int>(rhs);
}
[[nodiscard]] constexpr bool operator<=(
shader_program::uniforms::point_cloud::flags lhs, shader_program::uniforms::point_cloud::flags rhs
) {
return static_cast<int>(lhs) <= static_cast<int>(rhs);
}
[[nodiscard]] constexpr bool operator>(
shader_program::uniforms::point_cloud::flags lhs, shader_program::uniforms::point_cloud::flags rhs
) {
return static_cast<int>(lhs) > static_cast<int>(rhs);
}
[[nodiscard]] constexpr bool operator>=(
shader_program::uniforms::point_cloud::flags lhs, shader_program::uniforms::point_cloud::flags rhs
) {
return static_cast<int>(lhs) >= static_cast<int>(rhs);
}