This commit is contained in:
ZY4N
2025-03-28 13:09:34 +01:00
parent 6f60cc11c8
commit d18b40a7fc
34 changed files with 393 additions and 272 deletions

View File

@@ -2,6 +2,8 @@
#include <tuple>
#include "config/primitives.hpp"
#include "assets/identifiers.hpp"
#include "assets/data_stores/texture_store.hpp"
#include "assets/data/surface_properties.hpp"
#include "util/enum_bitfield_operators.hpp"
@@ -9,28 +11,27 @@
namespace assets::material_components
{
using surface_properties = surface_properties;
using transparency = float;
using ambient_color_texture = texture_store::id_type;
using diffuse_color_texture = texture_store::id_type;
using specular_color_texture = texture_store::id_type;
using shininess_texture = texture_store::id_type;
using alpha_texture = texture_store::id_type;
using bump_texture = texture_store::id_type;
using transparency = z3d::f32;
using ambient_color_texture = texture_id;
using diffuse_color_texture = texture_id;
using specular_color_texture = texture_id;
using shininess_texture = texture_id;
using alpha_texture = texture_id;
using bump_texture = texture_id;
namespace indices
{
using type = std::size_t;
inline constexpr type surface_properties = 0;
inline constexpr type transparency = 1;
inline constexpr type ambient_color_texture = 2;
inline constexpr type diffuse_color_texture = 3;
inline constexpr type specular_color_texture = 4;
inline constexpr type shininess_texture = 5;
inline constexpr type alpha_texture = 6;
inline constexpr type bump_texture = 7;
inline constexpr z3d::size surface_properties = 0;
inline constexpr z3d::size transparency = 1;
inline constexpr z3d::size ambient_color_texture = 2;
inline constexpr z3d::size diffuse_color_texture = 3;
inline constexpr z3d::size specular_color_texture = 4;
inline constexpr z3d::size shininess_texture = 5;
inline constexpr z3d::size alpha_texture = 6;
inline constexpr z3d::size bump_texture = 7;
}
enum class flags : std::uint8_t
enum class flags : z3d::u8
{
none = 0,
surface_properties = 1 << indices::surface_properties,
@@ -43,7 +44,7 @@ enum class flags : std::uint8_t
bump_texture = 1 << indices::bump_texture
};
using all = std::tuple<
using all = z3d::structure<
surface_properties,
transparency,
ambient_color_texture,

View File

@@ -1,5 +1,6 @@
#pragma once
#include "config/primitives.hpp"
#include <array>
#include <tuple>
#include "util/enum_bitfield_operators.hpp"
@@ -7,23 +8,22 @@
namespace assets::mesh_vertex_components
{
using position = std::array<float, 3>;
using normal = std::array<float, 3>;
using tex_coord = std::array<float, 2>;
using color = std::array<float, 3>;
using reflectance = std::array<float, 1>;
using position = z3d::vec3;
using normal = z3d::vec3;
using tex_coord = z3d::vec2;
using color = z3d::vec3;
using reflectance = z3d::f32;
namespace indices
{
using type = std::size_t;
inline constexpr type position = 0;
inline constexpr type normal = 1;
inline constexpr type tex_coord = 2;
inline constexpr type color = 3;
inline constexpr type reflectance = 4;
inline constexpr z3d::size position = 0;
inline constexpr z3d::size normal = 1;
inline constexpr z3d::size tex_coord = 2;
inline constexpr z3d::size color = 3;
inline constexpr z3d::size reflectance = 4;
}
enum class flags : std::uint8_t
enum class flags : z3d::u8
{
none = 0,
position = 1 << indices::position,
@@ -33,7 +33,13 @@ enum class flags : std::uint8_t
reflectance = 1 << indices::reflectance
};
using all = std::tuple<position, normal, tex_coord, color, reflectance>;
using all = z3d::structure<
position,
normal,
tex_coord,
color,
reflectance
>;
constexpr inline auto count = std::tuple_size_v<all>;
} // namespace mesh_vertex_components

View File

@@ -1,5 +1,6 @@
#pragma once
#include "config/primitives.hpp"
#include <array>
#include <tuple>
#include "util/enum_bitfield_operators.hpp"
@@ -7,21 +8,20 @@
namespace assets::point_cloud_vertex_components
{
using position = std::array<float, 3>;
using normal = std::array<float, 3>;
using color = std::array<float, 3>;
using reflectance = std::array<float, 1>;
using position = z3d::vec3;
using normal = z3d::vec3;
using color = z3d::vec3;
using reflectance = z3d::f32;
namespace indices
{
using type = std::size_t;
inline constexpr type position = 0;
inline constexpr type normal = 1;
inline constexpr type color = 2;
inline constexpr type reflectance = 3;
inline constexpr z3d::size position = 0;
inline constexpr z3d::size normal = 1;
inline constexpr z3d::size color = 2;
inline constexpr z3d::size reflectance = 3;
} // namespace indices
enum class flags : std::uint8_t
enum class flags : z3d::u8
{
none = 0,
position = 1 << indices::position,
@@ -30,7 +30,12 @@ enum class flags : std::uint8_t
reflectance = 1 << indices::reflectance
};
using all = std::tuple<position, normal, color, reflectance>;
using all = z3d::structure<
position,
normal,
color,
reflectance
>;
constexpr inline auto count = std::tuple_size_v<all>;
} // namespace point_cloud_vertex_components

View File

@@ -1,5 +1,6 @@
#pragma once
#include "config/primitives.hpp"
#include <tuple>
#include <cinttypes>
#include "util/enum_bitfield_operators.hpp"
@@ -7,10 +8,11 @@
namespace assets::texture_components
{
using red = std::uint8_t;
using green = std::uint8_t;
using blue = std::uint8_t;
using luminance = std::uint8_t;
using red = z3d::u8;
using green = z3d::u8;
using blue = z3d::u8;
using alpha = z3d::u8;
using luminance = z3d::u8;
enum class flags : std::uint8_t
{
@@ -22,7 +24,12 @@ enum class flags : std::uint8_t
alpha = 1 << 5
};
using all = std::tuple<red, green, blue, luminance>;
using all = z3d::structure<
red,
green,
blue,
luminance
>;
constexpr inline auto count = std::tuple_size_v<all>;
} // namespace texture_components