diff --git a/.idea/editor.xml b/.idea/editor.xml
index a5f440a..4487b68 100644
--- a/.idea/editor.xml
+++ b/.idea/editor.xml
@@ -99,5 +99,483 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index a8443ba..0b76fe5 100755
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -1,10 +1,5 @@
-
-
-
-
-
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ab5ac53..baa03aa 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -14,7 +14,7 @@ add_executable(z3d main.cpp
include/assets/data/material_data.hpp
include/assets/data/mesh_data.hpp
include/assets/data/point_cloud_data.hpp
- include/assets/file_parsers/kitti_loader.hpp
+ include/assets/file_parsers/kitti_parser.hpp
include/assets/file_parsers/obj_loader.hpp
include/assets/file_parsers/stl_loader.hpp
include/assets/file_parsers/uos_loader.hpp
@@ -54,7 +54,7 @@ add_executable(z3d main.cpp
source/opengl/handles/mesh_handle.ipp
source/opengl/handles/point_cloud_handle.ipp
source/opengl/handles/texture_handle.ipp
- include/assets/data/surface_properties.hpp
+ include/assets/data/uniform_surface_properties.hpp
include/util/unroll_bool_template.hpp
include/rendering/batch_renderers/point_cloud_batch_renderer.hpp
source/rendering/batches/mesh_batch.ipp
@@ -62,7 +62,7 @@ add_executable(z3d main.cpp
include/opengl/shading/uniform.hpp
include/opengl/type_utils.hpp
include/util/binary_ifstream.hpp
- source/assets/file_parsers/kitti_loader.cpp
+ source/assets/file_parsers/kitti_parser.cpp
include/assets/file_parsers/generic/generic_3dtk_loader.hpp
include/assets/file_parsers/uosr_loader.hpp
include/assets/file_parsers/uos_normal_loader.hpp
@@ -86,9 +86,9 @@ add_executable(z3d main.cpp
source/viewer/instance.cpp
include/viewer/asset_loader.hpp
source/viewer/asset_loader.cpp
- include/assets/file_parsers/glsl_loader.hpp
+ include/assets/file_parsers/glsl_parser.hpp
include/assets/data/shader_source_data.hpp
- source/assets/file_parsers/glsl_loader.cpp
+ source/assets/file_parsers/glsl_parser.cpp
include/viewer/settings.hpp
include/opengl/data/shader_data.hpp
source/opengl/data/shader_data.ipp
@@ -149,11 +149,11 @@ add_executable(z3d main.cpp
include/assets/prefetch_lookups/texture_prefetch_lookup.hpp
include/assets/prefetch_lookups/pose_prefetch_lookup.hpp
include/assets/data_stores/pose_store.hpp
- include/assets/file_parsers/kitti_pose_loader.hpp
+ include/assets/file_parsers/kitti_pose_parser.hpp
include/assets/file_parsers/threedtk_pose_loader.hpp
source/assets/file_parsers/threedtk_pose_loader.cpp
include/assets/data/pose_data.hpp
- source/assets/file_parsers/kitti_pose_loader.cpp
+ source/assets/file_parsers/kitti_pose_parser.cpp
include/assets/prefetch_queue.hpp
include/util/string_list.hpp
include/assets/data_stores/material_library_store.hpp
@@ -178,13 +178,11 @@ add_executable(z3d main.cpp
include/opengl/shading/shader_metadata_language.hpp
include/opengl/shading/features/generic_features.hpp
include/opengl/shading/features/combined_features.hpp
- include/opengl/shading/requirements/shader_source_requirements.hpp
include/opengl/metadata/preprocessed_shader_source_metadata.hpp
include/opengl/shading/requirements/shader_requirements.hpp
include/opengl/metadata/shader_metadata.hpp
include/opengl/metadata/shader_set_metadata.hpp
include/opengl/handles/shader_handle_set.hpp
- include/opengl/shading/requirements/shader_set_requirements.hpp
include/opengl/data_managers/shader_program_manager.hpp
include/opengl/metadata/shader_program_metadata.hpp
source/opengl/data_managers/shader_program_manager.cpp
@@ -235,8 +233,20 @@ add_executable(z3d main.cpp
include/config/primitives.hpp
include/assets/data/generic/component_set.hpp
include/assets/data_views/generic/generic_mesh_view.hpp
- include/assets/data_views/generic/generic_point_cloud_viwe.hpp
+ include/assets/data_views/generic/generic_point_cloud_view.hpp
include/assets/identifiers.hpp
+ include/assets/fallback_data/fallback_texture.hpp
+ source/assets/fallback_data/default_texture_data.cpp
+ include/assets/fallback_data/fallback_material.hpp
+ source/assets/fallback_data/fallback_material.cpp
+ include/assets/components/mesh_shader_components.hpp
+ include/assets/components/shader_components.hpp
+ include/assets/model_geometry.hpp
+ include/assets/path_id_lookups.hpp
+ include/util/file_id_lookup.hpp
+ include/assets/data/pose_list_data.hpp
+ include/assets/data_stores/pose_list_store.hpp
+ include/assets/data_views/pose_list_view.hpp
)
target_include_directories(z3d PRIVATE include)
diff --git a/include/assets/components/material_components.hpp b/include/assets/components/material_components.hpp
index 645b002..40df84c 100644
--- a/include/assets/components/material_components.hpp
+++ b/include/assets/components/material_components.hpp
@@ -5,51 +5,67 @@
#include "config/primitives.hpp"
#include "assets/identifiers.hpp"
#include "assets/data_stores/texture_store.hpp"
-#include "assets/data/surface_properties.hpp"
+#include "assets/data/uniform_surface_properties.hpp"
#include "util/enum_bitfield_operators.hpp"
namespace assets::material_components
{
-using surface_properties = surface_properties;
-using transparency = z3d::f32;
-using ambient_color_texture = texture_id;
-using diffuse_color_texture = texture_id;
-using specular_color_texture = texture_id;
+
+using ambient_filter = z3d::vec3;
+using diffuse_filter = z3d::vec3;
+using specular_filter = z3d::vec3;
+using shininess = z3d::f32;
+using alpha = z3d::f32;
+using ambient_filter_texture = texture_id;
+using diffuse_filter_texture = texture_id;
+using specular_filter_texture = texture_id;
using shininess_texture = texture_id;
using alpha_texture = texture_id;
using bump_texture = texture_id;
namespace indices
{
-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 : z3d::size
+{
+ ambient_filter,
+ diffuse_filter,
+ specular_filter,
+ shininess,
+ alpha,
+ ambient_filter_texture,
+ diffuse_filter_texture,
+ specular_filter_texture,
+ shininess_texture,
+ alpha_texture,
+ bump_texture
+};
}
enum class flags : z3d::u8
{
none = 0,
- surface_properties = 1 << indices::surface_properties,
- transparency = 1 << indices::transparency,
- ambient_filter_texture = 1 << indices::ambient_color_texture,
- diffuse_filter_texture = 1 << indices::diffuse_color_texture,
- specular_filter_texture = 1 << indices::specular_color_texture,
+ ambient_filter = 1 << indices::ambient_filter,
+ diffuse_filter = 1 << indices::diffuse_filter,
+ specular_filter = 1 << indices::specular_filter,
+ shininess = 1 << indices::shininess,
+ alpha = 1 << indices::alpha,
+ ambient_filter_texture = 1 << indices::ambient_filter_texture,
+ diffuse_filter_texture = 1 << indices::diffuse_filter_texture,
+ specular_filter_texture = 1 << indices::specular_filter_texture,
shininess_texture = 1 << indices::shininess_texture,
alpha_texture = 1 << indices::alpha_texture,
bump_texture = 1 << indices::bump_texture
};
using all = z3d::structure<
- surface_properties,
- transparency,
- ambient_color_texture,
- diffuse_color_texture,
- specular_color_texture,
+ ambient_filter,
+ diffuse_filter,
+ specular_filter,
+ shininess,
+ alpha,
+ ambient_filter_texture,
+ diffuse_filter_texture,
+ specular_filter_texture,
shininess_texture,
alpha_texture,
bump_texture
diff --git a/include/assets/components/mesh_shader_components.hpp b/include/assets/components/mesh_shader_components.hpp
new file mode 100644
index 0000000..dc31a9b
--- /dev/null
+++ b/include/assets/components/mesh_shader_components.hpp
@@ -0,0 +1,58 @@
+#pragma once
+
+#include "config/primitives.hpp"
+#include "util/enum_bitfield_operators.hpp"
+#include
+#include
+
+namespace assets::mesh_shader_components
+{
+
+namespace indices
+{
+enum : z3d::size
+{
+ face,
+ line,
+ point,
+ luminance,
+ color,
+ alpha,
+ color_texture,
+ uniform_lighting,
+ textured_lighting,
+ 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,
+ color_texture = 1 << indices::color_texture,
+ uniform_lighting = 1 << indices::uniform_lighting,
+ textured_lighting = 1 << indices::textured_lighting,
+ uniform_color = 1 << indices::uniform_color
+};
+
+constexpr inline auto names = std::array{
+ "face",
+ "line",
+ "point",
+ "luminance",
+ "color",
+ "alpha",
+ "color_texture",
+ "uniform_lighting",
+ "textured_lighting",
+ "uniform_color"
+};
+
+}
+
+DEFINE_ENUM_BITFIELD_OPERATORS(assets::mesh_shader_components::flags)
diff --git a/include/assets/components/mesh_vertex_components.hpp b/include/assets/components/mesh_vertex_components.hpp
index e09c39d..1f1fcdf 100755
--- a/include/assets/components/mesh_vertex_components.hpp
+++ b/include/assets/components/mesh_vertex_components.hpp
@@ -16,11 +16,14 @@ using reflectance = z3d::f32;
namespace indices
{
-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 : z3d::size
+{
+ position,
+ normal,
+ tex_coord,
+ color,
+ reflectance
+};
}
enum class flags : z3d::u8
diff --git a/include/assets/components/point_cloud_shader_components.hpp b/include/assets/components/point_cloud_shader_components.hpp
new file mode 100644
index 0000000..13484ed
--- /dev/null
+++ b/include/assets/components/point_cloud_shader_components.hpp
@@ -0,0 +1,46 @@
+#pragma once
+
+#include "config/primitives.hpp"
+#include "util/enum_bitfield_operators.hpp"
+#include
+#include
+
+namespace assets::point_cloud_shader_components
+{
+
+enum indices : z3d::size
+{
+ square,
+ lighting,
+ luminance,
+ color,
+ alpha,
+ uniform_color,
+ rainbow
+};
+
+enum class flags : std::uint16_t
+{
+ none = 0,
+ square = 1 << indices::square,
+ lighting = 1 << indices::lighting,
+ luminance = 1 << indices::luminance,
+ color = 1 << indices::color,
+ alpha = 1 << indices::alpha,
+ uniform_color = 1 << indices::uniform_color,
+ rainbow = 1 << indices::rainbow
+};
+
+constexpr inline auto names = std::array{
+ "square",
+ "lighting",
+ "luminance",
+ "color",
+ "alpha",
+ "uniform_color",
+ "rainbow"
+};
+
+}
+
+DEFINE_ENUM_BITFIELD_OPERATORS(assets::point_cloud_shader_components::flags)
diff --git a/include/assets/components/point_cloud_vertex_components.hpp b/include/assets/components/point_cloud_vertex_components.hpp
index e383267..4546146 100755
--- a/include/assets/components/point_cloud_vertex_components.hpp
+++ b/include/assets/components/point_cloud_vertex_components.hpp
@@ -15,10 +15,13 @@ using reflectance = z3d::f32;
namespace indices
{
-inline constexpr z3d::size position = 0;
-inline constexpr z3d::size normal = 1;
-inline constexpr z3d::size color = 2;
-inline constexpr z3d::size reflectance = 3;
+enum : z3d::size
+{
+ position,
+ normal,
+ color,
+ reflectance
+};
} // namespace indices
enum class flags : z3d::u8
diff --git a/include/assets/components/shader_components.hpp b/include/assets/components/shader_components.hpp
new file mode 100644
index 0000000..4644e9a
--- /dev/null
+++ b/include/assets/components/shader_components.hpp
@@ -0,0 +1,35 @@
+#pragma once
+
+#include
+#include "mesh_shader_components.hpp"
+#include "point_cloud_shader_components.hpp"
+
+namespace assets::shader_components
+{
+
+enum class stage : z3d::u8
+{
+ vertex = 0,
+ tesselation_control = 1,
+ tesselation_evaluation = 2,
+ geometry = 3,
+ fragment = 4
+};
+
+inline constexpr std::size_t count = 5;
+
+inline constexpr auto stage_names = std::array{
+ "vertex",
+ "tesselation_control",
+ "tesselation_evaluation",
+ "geometry",
+ "fragment"
+};
+
+
+using flags = std::make_unsigned_t,
+ std::underlying_type_t
+>>;
+
+}
diff --git a/include/assets/data/generic/component_array_set.hpp b/include/assets/data/generic/component_array_set.hpp
index 2f5fb23..a486c50 100644
--- a/include/assets/data/generic/component_array_set.hpp
+++ b/include/assets/data/generic/component_array_set.hpp
@@ -11,8 +11,12 @@ class component_array_set {};
template
class component_array_set>
{
+public:
component_array_set() = default;
+ C component_flags;
+ z3d::structure...> component_arrays{};
+
protected:
void clear_component_arrays()
{
@@ -24,10 +28,6 @@ protected:
component_arrays
);
}
-
- C component_flags;
- z3d::structure...> component_arrays{};
-
};
}
diff --git a/include/assets/data/material_data.hpp b/include/assets/data/material_data.hpp
index 6a0a2c5..ae4ddbc 100755
--- a/include/assets/data/material_data.hpp
+++ b/include/assets/data/material_data.hpp
@@ -1,7 +1,5 @@
#pragma once
-#include
-
#include "assets/components/material_components.hpp"
#include "generic/component_set.hpp"
@@ -13,22 +11,27 @@ struct material_data : detail::component_set
material_data() = default;
- material_components::surface_properties& initialized_surface_properties();
-
- [[nodiscard]] inline z3d::optional& surface_properties();
- [[nodiscard]] inline z3d::optional& transparency();
- [[nodiscard]] inline z3d::optional& ambient_color_texture_id();
- [[nodiscard]] inline z3d::optional& diffuse_color_texture_id();
- [[nodiscard]] inline z3d::optional& specular_color_texture_id();
+ [[nodiscard]] inline z3d::optional& ambient_filter();
+ [[nodiscard]] inline z3d::optional& diffuse_filter();
+ [[nodiscard]] inline z3d::optional& specular_filter();
+ [[nodiscard]] inline z3d::optional& shininess();
+ [[nodiscard]] inline z3d::optional& alpha();
+ [[nodiscard]] inline z3d::optional& specular_filter_texture_id();
+ [[nodiscard]] inline z3d::optional& diffuse_filter_texture_id();
+ [[nodiscard]] inline z3d::optional& specular_filter_texture_id();
[[nodiscard]] inline z3d::optional& shininess_texture_id();
[[nodiscard]] inline z3d::optional& alpha_texture_id();
[[nodiscard]] inline z3d::optional& bump_texture_id();
- [[nodiscard]] inline const z3d::optional& surface_properties() const;
- [[nodiscard]] inline const z3d::optional& transparency() const;
- [[nodiscard]] inline const z3d::optional& ambient_color_texture_id() const;
- [[nodiscard]] inline const z3d::optional& diffuse_color_texture_id() const;
- [[nodiscard]] inline const z3d::optional& specular_color_texture_id() const;
+ [[nodiscard]] inline const z3d::optional& ambient_filter() const;
+ [[nodiscard]] inline const z3d::optional& diffuse_filter() const;
+ [[nodiscard]] inline const z3d::optional& specular_filter() const;
+ [[nodiscard]] inline const z3d::optional& shininess() const;
+ [[nodiscard]] inline const z3d::optional& alpha() const;
+ [[nodiscard]] inline const z3d::optional& transparency() const;
+ [[nodiscard]] inline const z3d::optional& specular_filter_texture_id() const;
+ [[nodiscard]] inline const z3d::optional& diffuse_filter_texture_id() const;
+ [[nodiscard]] inline const z3d::optional& specular_filter_texture_id() const;
[[nodiscard]] inline const z3d::optional& shininess_texture_id() const;
[[nodiscard]] inline const z3d::optional& alpha_texture_id() const;
[[nodiscard]] inline const z3d::optional& bump_texture_id() const;
@@ -38,6 +41,6 @@ struct material_data : detail::component_set
}
-#define INCLUDE_DYNAMIC_MATERIAL_DATA_IMPLEMENTATION
+#define INCLUDE_MATERIAL_DATA_IMPLEMENTATION
#include "assets/data/material_data.ipp"
-#undef INCLUDE_DYNAMIC_MATERIAL_DATA_IMPLEMENTATION
+#undef INCLUDE_MATERIAL_DATA_IMPLEMENTATION
diff --git a/include/assets/data/point_cloud_data.hpp b/include/assets/data/point_cloud_data.hpp
index 9580b73..2e78552 100644
--- a/include/assets/data/point_cloud_data.hpp
+++ b/include/assets/data/point_cloud_data.hpp
@@ -9,11 +9,16 @@
namespace assets
{
-class point_cloud_data : detail::component_array_set<
+class point_cloud_data : public detail::component_array_set<
point_cloud_vertex_components::flags,
point_cloud_vertex_components::all
> {
public:
+ using detail::component_array_set<
+ point_cloud_vertex_components::flags,
+ point_cloud_vertex_components::all
+ >::component_array_set;
+
[[nodiscard]] inline std::vector& positions();
[[nodiscard]] inline std::vector& normals();
[[nodiscard]] inline std::vector& colors();
diff --git a/include/assets/data/pose_list_data.hpp b/include/assets/data/pose_list_data.hpp
new file mode 100644
index 0000000..bba25bb
--- /dev/null
+++ b/include/assets/data/pose_list_data.hpp
@@ -0,0 +1,11 @@
+#pragma once
+
+#include "pose_data.hpp"
+
+
+namespace assets
+{
+
+using pose_list_data = std::vector;
+
+}
diff --git a/include/assets/data/shader_source_data.hpp b/include/assets/data/shader_source_data.hpp
index 3597852..40f3898 100644
--- a/include/assets/data/shader_source_data.hpp
+++ b/include/assets/data/shader_source_data.hpp
@@ -1,6 +1,8 @@
#pragma once
#include "config/primitives.hpp"
+#include "assets/components/shader_components.hpp"
+#include "assets/model_geometry.hpp"
namespace assets
{
@@ -9,9 +11,20 @@ struct shader_source_data
{
z3d::vector source{};
+ struct metadata
+ {
+ model_geometry::types geometry_type;
+ shader_components::stage stage{};
+ shader_components::flags components{};
+ shader_components::flags static_enable{};
+ shader_components::flags dynamic_enable{};
+ } meta;
+
void clear()
{
source.clear();
+ meta.stage = {};
+ meta.components = {};
}
};
diff --git a/include/assets/data/surface_properties.hpp b/include/assets/data/surface_properties.hpp
deleted file mode 100644
index efa1db8..0000000
--- a/include/assets/data/surface_properties.hpp
+++ /dev/null
@@ -1,16 +0,0 @@
-#pragma once
-
-#include "config/primitives.hpp"
-
-namespace assets
-{
-
-struct surface_properties
-{
- z3d::vec3 ambient_filter{ 0.7f, 0.7f, 0.7f };
- z3d::vec3 diffuse_filter{ 0.466f, 0.466f, 0.7922f };
- z3d::vec3 specular_filter{ 0.5974f, 0.2084f, 0.2084f };
- z3d::f32 shininess{ 100.2237f };
-};
-
-}
diff --git a/include/assets/data/uniform_surface_properties.hpp b/include/assets/data/uniform_surface_properties.hpp
new file mode 100644
index 0000000..7239f50
--- /dev/null
+++ b/include/assets/data/uniform_surface_properties.hpp
@@ -0,0 +1,9 @@
+#pragma once
+
+#include "config/primitives.hpp"
+
+namespace assets
+{
+
+
+}
diff --git a/include/assets/data_loaders/point_cloud_loader.hpp b/include/assets/data_loaders/point_cloud_loader.hpp
index 8f90738..758969d 100644
--- a/include/assets/data_loaders/point_cloud_loader.hpp
+++ b/include/assets/data_loaders/point_cloud_loader.hpp
@@ -10,7 +10,7 @@
#include "assets/prefetch_lookups/point_cloud_prefetch_lookup.hpp"
#include "util/string_list.hpp"
-#include "assets/file_parsers/kitti_loader.hpp"
+#include "assets/file_parsers/kitti_parser.hpp"
#include "assets/file_parsers/uos_loader.hpp"
#include "assets/file_parsers/uos_normal_loader.hpp"
#include "assets/file_parsers/uos_rgb_loader.hpp"
@@ -21,7 +21,7 @@ namespace assets
class point_cloud_loader : public base_dynamic_loader<
point_cloud_vertex_components::flags,
- kitti_loader,
+ kitti_parser,
uos_loader,
uos_normal_loader,
uos_rgb_loader,
diff --git a/include/assets/data_stores.hpp b/include/assets/data_stores.hpp
index 05a9bda..5f71190 100644
--- a/include/assets/data_stores.hpp
+++ b/include/assets/data_stores.hpp
@@ -4,6 +4,7 @@
#include "data_stores/material_store.hpp"
#include "data_stores/mesh_store.hpp"
#include "data_stores/point_cloud_store.hpp"
+#include "data_stores/pose_list_store.hpp"
#include "data_stores/pose_store.hpp"
#include "data_stores/shader_source_store.hpp"
#include "data_stores/texture_store.hpp"
@@ -18,6 +19,7 @@ struct data_stores
mesh_store meshes;
point_cloud_store point_clouds;
pose_store poses;
+ pose_list_store pose_lists;
shader_source_store shader_sources;
texture_store textures;
};
diff --git a/include/assets/data_stores/generic/generic_point_cloud_store.hpp b/include/assets/data_stores/generic/generic_point_cloud_store.hpp
index c521ba2..7531f0a 100644
--- a/include/assets/data_stores/generic/generic_point_cloud_store.hpp
+++ b/include/assets/data_stores/generic/generic_point_cloud_store.hpp
@@ -105,13 +105,12 @@ public:
using count_type = ztu::u32;
using component_flag_type = point_cloud_vertex_components::flags;
+ using data_type = point_cloud_data;
using iterator_type = generic_point_cloud_store_iterator;
using const_iterator = generic_point_cloud_store_iterator...>;
- using view_type = std::ranges::subrange;
- using const_view_type = std::ranges::subrange;
using id_type = point_cloud_id;
- id_type add(const point_cloud_data& point_cloud);
+ id_type add(id_type id, const data_type& point_cloud);
[[nodiscard]] std::pair find(id_type id);
@@ -133,10 +132,6 @@ public:
const_iterator cend() const;
- view_type view();
-
- const_view_type view() const;
-
protected:
std::tuple...> component_iterators();
diff --git a/include/assets/data_stores/material_store.hpp b/include/assets/data_stores/material_store.hpp
index 18d7fe7..608ce51 100644
--- a/include/assets/data_stores/material_store.hpp
+++ b/include/assets/data_stores/material_store.hpp
@@ -7,7 +7,7 @@ namespace assets
using material_store = detail::generic_material_store<
material_components::surface_properties,
- material_components::transparency,
+ material_components::alpha,
texture_store::id_type,
texture_store::id_type,
texture_store::id_type,
diff --git a/include/assets/data_stores/pose_list_store.hpp b/include/assets/data_stores/pose_list_store.hpp
new file mode 100644
index 0000000..402d6e5
--- /dev/null
+++ b/include/assets/data_stores/pose_list_store.hpp
@@ -0,0 +1,137 @@
+#pragma once
+
+#include "generic/generic_basic_store.hpp"
+#include "assets/identifiers.hpp"
+#include "assets/data/pose_list_data.hpp"
+#include "assets/data_views/pose_list_view.hpp"
+
+namespace assets
+{
+
+class pose_list_store;
+
+template
+class pose_list_store_iterator
+{
+public:
+ using size_type = std::size_t;
+ using length_type = ztu::u32;
+ using id_type = pose_list_id;
+ using value_type = std::pair;
+
+ using id_iterator_type = id_type const*;
+ using pose_iterator_type = Char*;
+ using length_iterator_type = const length_type*;
+
+ using offset_type = size_type;
+ using difference_type = std::ptrdiff_t;
+ using pointer = value_type*;
+ using reference = value_type;
+ using iterator_category = std::random_access_iterator_tag;
+
+private:
+ friend pose_list_store;
+
+ pose_list_store_iterator(
+ id_iterator_type ids,
+ pose_iterator_type poses,
+ length_iterator_type lengths,
+ std::size_t index,
+ const offset_type& offset
+ );
+
+public:
+ constexpr pose_list_store_iterator() noexcept = default;
+
+ constexpr pose_list_store_iterator(const pose_list_store_iterator&) noexcept = default;
+ constexpr pose_list_store_iterator(pose_list_store_iterator&&) noexcept = default;
+
+ constexpr pose_list_store_iterator& operator=(const pose_list_store_iterator&) noexcept = default;
+ constexpr pose_list_store_iterator& operator=(pose_list_store_iterator&&) noexcept = default;
+
+ reference operator*() const;
+
+ pose_list_store_iterator& operator++();
+ pose_list_store_iterator operator++(int);
+ pose_list_store_iterator& operator--();
+ pose_list_store_iterator operator--(int);
+
+ pose_list_store_iterator& operator+=(difference_type n);
+ pose_list_store_iterator& operator-=(difference_type n);
+ pose_list_store_iterator operator+(difference_type n) const;
+ pose_list_store_iterator operator-(difference_type n) const;
+ difference_type operator-(const pose_list_store_iterator& other) const;
+
+ reference operator[](difference_type n) const;
+
+ bool operator==(const pose_list_store_iterator& other) const;
+ bool operator!=(const pose_list_store_iterator& other) const;
+ bool operator<(const pose_list_store_iterator& other) const;
+ bool operator<=(const pose_list_store_iterator& other) const;
+ bool operator>(const pose_list_store_iterator& other) const;
+ bool operator>=(const pose_list_store_iterator& other) const;
+
+protected:
+
+ void calc_offset(difference_type n);
+
+ reference dereference() const;
+
+private:
+ id_iterator_type m_ids{};
+ pose_iterator_type m_poses{};
+ length_iterator_type m_lengths{};
+ size_type m_index{};
+ offset_type m_offset{};
+};
+
+
+class pose_list_store
+{
+public:
+ using size_type = std::size_t;
+ using count_type = ztu::u32;
+
+ using iterator_type = pose_list_store_iterator;
+ using const_iterator = pose_list_store_iterator;
+ using data_type = pose_list_data;
+ using id_type = pose_list_id;
+
+ // TODO not storing metadata
+ inline id_type add(
+ id_type id,
+ const data_type& pose_list
+ );
+
+ [[nodiscard]] inline std::pair find(id_type id);
+
+ [[nodiscard]] inline std::pair find(id_type id) const;
+
+ inline void remove(const iterator_type& it);
+
+ inline void clear();
+
+ [[nodiscard]] inline iterator_type begin();
+
+ [[nodiscard]] inline iterator_type end();
+
+ [[nodiscard]] inline const_iterator begin() const;
+
+ [[nodiscard]] inline const_iterator end() const;
+
+ [[nodiscard]] inline const_iterator cbegin() const;
+
+ [[nodiscard]] inline const_iterator cend() const;
+
+
+private:
+ std::vector m_ids;
+ std::vector m_poses;
+ std::vector m_lengths;
+};
+
+}
+
+#define INCLUDE_POSE_LIST_STORE_IMPLEMENTATION
+#include "assets/data_stores/pose_list_store.ipp"
+#undef INCLUDE_POSE_LIST_STORE_IMPLEMENTATION
diff --git a/include/assets/data_stores/shader_source_store.hpp b/include/assets/data_stores/shader_source_store.hpp
index a2c9735..d944298 100644
--- a/include/assets/data_stores/shader_source_store.hpp
+++ b/include/assets/data_stores/shader_source_store.hpp
@@ -15,12 +15,14 @@ class shader_source_store_iterator
public:
using size_type = std::size_t;
using length_type = ztu::u32;
- using id_type = ztu::id_type_for;
+ using id_type = shader_source_id;
+ using metadata_type = shader_source_data::metadata;
using value_type = std::pair;
using id_iterator_type = id_type const*;
using string_iterator_type = Char*;
using length_iterator_type = const length_type*;
+ using metadata_iterator_type = const metadata_type*;
using offset_type = size_type;
using difference_type = std::ptrdiff_t;
@@ -35,6 +37,7 @@ private:
id_iterator_type ids,
string_iterator_type strings,
length_iterator_type lengths,
+ metadata_iterator_type metadata,
std::size_t index,
const offset_type& offset
);
@@ -80,6 +83,7 @@ private:
id_iterator_type m_ids{};
string_iterator_type m_strings{};
length_iterator_type m_lengths{};
+ metadata_iterator_type m_metadata{};
size_type m_index{};
offset_type m_offset{};
};
@@ -95,9 +99,13 @@ public:
using const_iterator = shader_source_store_iterator;
using view_type = std::ranges::subrange;
using const_view_type = std::ranges::subrange;
- using id_type = ztu::id_type_for;
+ using id_type = shader_source_id;
- inline id_type add(const shader_source_data& shader_source);
+ // TODO not storing metadata
+ inline id_type add(
+ shader_source_id id,
+ const shader_source_data& shader_source
+ );
[[nodiscard]] inline std::pair find(id_type id);
@@ -119,15 +127,12 @@ public:
[[nodiscard]] inline const_iterator cend() const;
- [[nodiscard]] inline view_type view();
-
- [[nodiscard]] inline const_view_type view() const;
private:
std::vector m_ids;
std::vector m_strings;
std::vector m_lengths;
- id_type m_next_data_id{ 1 };
+ std::vector m_metadata;
};
}
diff --git a/include/assets/data_views/generic/generic_point_cloud_viwe.hpp b/include/assets/data_views/generic/generic_point_cloud_view.hpp
similarity index 100%
rename from include/assets/data_views/generic/generic_point_cloud_viwe.hpp
rename to include/assets/data_views/generic/generic_point_cloud_view.hpp
diff --git a/include/assets/data_views/point_cloud_view.hpp b/include/assets/data_views/point_cloud_view.hpp
index 3a7859b..c0ce9e8 100644
--- a/include/assets/data_views/point_cloud_view.hpp
+++ b/include/assets/data_views/point_cloud_view.hpp
@@ -1,6 +1,6 @@
#pragma once
-#include "generic/generic_point_cloud_viwe.hpp"
+#include "generic/generic_point_cloud_view.hpp"
namespace assets
{
diff --git a/include/assets/data_views/pose_list_view.hpp b/include/assets/data_views/pose_list_view.hpp
new file mode 100644
index 0000000..5e00e76
--- /dev/null
+++ b/include/assets/data_views/pose_list_view.hpp
@@ -0,0 +1,11 @@
+#pragma once
+
+#include "assets/data/pose_data.hpp"
+
+
+namespace assets
+{
+
+using pose_list_view = std::span;
+
+}
diff --git a/include/assets/data_views/shader_source_view.hpp b/include/assets/data_views/shader_source_view.hpp
index 954ac59..fa112d1 100644
--- a/include/assets/data_views/shader_source_view.hpp
+++ b/include/assets/data_views/shader_source_view.hpp
@@ -1,5 +1,20 @@
#pragma once
-#include "config/primitives.hpp"
+#include
+#include "assets/model_geometry.hpp"
+#include "assets/components/shader_components.hpp"
-using shader_source_view = z3d::string_view;
+namespace assets
+{
+
+struct shader_source_view
+{
+ std::string_view source;
+ model_geometry::types geometry_type;
+ shader_components::stage stage;
+ shader_components::flags components{};
+ shader_components::flags static_enable{};
+ shader_components::flags dynamic_enable{};
+};
+
+}
diff --git a/include/assets/fallback_data/fallback_material.hpp b/include/assets/fallback_data/fallback_material.hpp
new file mode 100644
index 0000000..ae92a99
--- /dev/null
+++ b/include/assets/fallback_data/fallback_material.hpp
@@ -0,0 +1,10 @@
+#pragma once
+
+#include "assets/data/material_data.hpp"
+
+namespace assets
+{
+
+material_data generate_fallback_material();
+
+}
diff --git a/include/assets/fallback_data/fallback_texture.hpp b/include/assets/fallback_data/fallback_texture.hpp
new file mode 100644
index 0000000..2cc8c69
--- /dev/null
+++ b/include/assets/fallback_data/fallback_texture.hpp
@@ -0,0 +1,28 @@
+#pragma once
+
+#include "assets/components/texture_components.hpp"
+#include "assets/data/texture_data.hpp"
+
+namespace assets
+{
+
+struct fallback_color
+{
+ static constexpr auto components = (
+ texture_components::flags::red |
+ texture_components::flags::green |
+ texture_components::flags::blue
+ );
+ texture_data::value_type r, g, b;
+};
+
+texture_data generate_fallback_texture(
+ int width = 4,
+ int height = 4,
+ std::span colors = std::array{
+ fallback_color{ .r = 255, .g = 0, b = 255 },
+ fallback_color{ .r = 0, .g = 0, b = 0 }
+ }
+);
+
+}
diff --git a/include/assets/file_parsers/glsl_loader.hpp b/include/assets/file_parsers/glsl_loader.hpp
deleted file mode 100644
index f66bed1..0000000
--- a/include/assets/file_parsers/glsl_loader.hpp
+++ /dev/null
@@ -1,35 +0,0 @@
-#pragma once
-
-#include
-#include
-#include
-
-#include "assets/data_stores.hpp"
-#include "assets/prefetch_lookup.hpp"
-#include "assets/prefetch_queue.hpp"
-#include "assets/prefetch_lookups/mesh_prefetch_lookup.hpp"
-#include "assets/data/shader_source_data.hpp"
-#include "util/string_list.hpp"
-
-namespace assets
-{
-
-struct glsl_loader
-{
- static constexpr auto name = std::string_view("glsl");
-
- [[nodiscard]] static std::error_code prefetch(
- const file_dir_list& paths,
- prefetch_queue& queue
- );
-
- [[nodiscard]] static std::error_code load(
- shader_source_data& buffer,
- const file_dir_list& paths,
- prefetch_lookup& id_lookup,
- shader_source_store& store,
- bool pedantic = false
- );
-};
-
-}
diff --git a/include/assets/file_parsers/glsl_parser.hpp b/include/assets/file_parsers/glsl_parser.hpp
new file mode 100644
index 0000000..0e2c9bf
--- /dev/null
+++ b/include/assets/file_parsers/glsl_parser.hpp
@@ -0,0 +1,122 @@
+#pragma once
+
+#include
+
+#include "assets/path_id_lookups.hpp"
+#include "assets/data_stores/shader_source_store.hpp"
+#include "assets/data/shader_source_data.hpp"
+
+namespace assets
+{
+
+struct glsl_parser
+{
+ static constexpr auto name = std::string_view("glsl");
+ using data_type = shader_source_data;
+ using store_type = shader_source_store;
+ using lookup_type = shader_source_id_lookup;
+
+ [[nodiscard]] std::error_code prefetch(
+ path_id_lookups& lookups
+ );
+
+ [[nodiscard]] std::error_code load(
+ const path_id_lookups& lookups,
+ store_type& store,
+ bool pedantic = false
+ );
+
+protected:
+ class parser_context
+ {
+ public:
+ parser_context(
+ store_type& m_store,
+ std::mutex& m_store_mutex
+ );
+
+ void operator()(lookup_type::const_pointer entry) noexcept;
+
+ protected:
+ void reset();
+
+ void tokenize_declarations();
+
+ [[nodiscard]] bool parse_metadata_from_tokens();
+
+ void remove_metadata_declarations();
+
+ private:
+ store_type* m_store;
+ std::mutex* m_store_mutex;
+ shader_source_data m_buffer{};
+ std::vector m_value_buffer{};
+ std::vector m_declaration_value_count_buffer{};
+ std::array m_declaration_type_index_buffer{};
+ };
+
+ [[nodiscard]] static std::error_code read_file(
+ const std::filesystem::path& filename,
+ std::vector& source
+ );
+
+ static void tokenize_declarations(
+ std::string_view source,
+ std::vector& value_buffer,
+ std::vector& declaration_value_count_buffer,
+ std::array& declaration_type_index_buffer
+ );
+
+ static [[nodiscard]] bool parse_metadata_from_tokens(
+ const std::vector& value_buffer,
+ const std::vector& declaration_value_count_buffer,
+ const std::array& declaration_type_index_buffer,
+ shader_source_data& buffer
+ );
+
+ static void remove_metadata_declarations(
+ const std::vector& value_buffer,
+ const std::vector& declaration_value_count_buffer,
+ const std::array& declaration_type_index_buffer,
+ std::vector& source
+ );
+
+ [[nodiscard]] static bool parse_geometry_declaration(
+ std::span values,
+ model_geometry::types& geometry_type
+ );
+
+ [[nodiscard]] static bool parse_stage_declaration(
+ std::span values,
+ shader_components::stage& stage
+ );
+
+ [[nodiscard]] static bool parse_components_declaration(
+ std::span values,
+ shader_source_data& buffer
+ );
+
+ [[nodiscard]] static bool parse_static_enable_declaration(
+ std::span values,
+ shader_source_data& buffer
+ );
+
+ [[nodiscard]] static bool parse_dynamic_enable_declaration(
+ std::span values,
+ shader_source_data& buffer
+ );
+
+ [[nodiscard]] static bool parse_component_tokens(
+ std::span values,
+ model_geometry::types geometry_type,
+ shader_components::flags& components
+ );
+
+private:
+ std::vector m_value_token_buffer;
+ std::vector m_declaration_token_count_buffer;
+ std::array m_declaration_type_index_buffer;
+ std::vector m_path_buffer;
+};
+
+}
diff --git a/include/assets/file_parsers/interface.txt b/include/assets/file_parsers/interface.txt
deleted file mode 100644
index cc855bd..0000000
--- a/include/assets/file_parsers/interface.txt
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-struct X {
-
-[[nodiscard]] static std::error_code prefetch(
- const file_dir_list& paths,
- prefetch_queue& queue
-);
-
-[[nodiscard]] static std::error_code load(
- // space stuff that has to persist
- dynamic_X_buffer& buffer,
- const file_dir_list& paths,
- dynamic_X_store& store,
- prefetch_lookup& id_lookup,
- bool pedantic = false
-);
-
-}
\ No newline at end of file
diff --git a/include/assets/file_parsers/kitti_loader.hpp b/include/assets/file_parsers/kitti_loader.hpp
deleted file mode 100644
index 5cdb4ff..0000000
--- a/include/assets/file_parsers/kitti_loader.hpp
+++ /dev/null
@@ -1,59 +0,0 @@
-#pragma once
-
-#include
-#include
-#include
-
-#include "assets/data_stores.hpp"
-#include "assets/components/point_cloud_vertex_components.hpp"
-#include "assets/data/point_cloud_data.hpp"
-#include "assets/data_stores/point_cloud_store.hpp"
-#include "assets/prefetch_lookup.hpp"
-#include "assets/prefetch_queue.hpp"
-#include "glm/mat4x4.hpp"
-#include "util/result.hpp"
-
-namespace assets
-{
-
-struct kitti_loader
-{
- static constexpr auto name = std::string_view("kitti");
-
- [[nodiscard]] static std::error_code prefetch(
- const file_dir_list& paths,
- prefetch_queue& queue
- );
-
- [[nodiscard]] static std::error_code load(
- point_cloud_data& buffer,
- const file_dir_list& paths,
- prefetch_lookup& id_lookup,
- shader_source_store& store,
- bool pedantic = false
- );
-
-private:
- inline static constexpr auto frame_folder = "frames";
-
- [[nodiscard]] static ztu::result frame_id_from_filename(
- std::string_view filename
- );
-
- [[nodiscard]] static std::error_code load_point_file(
- const std::filesystem::path& filename,
- dynamic_point_cloud_buffer& point_cloud
- );
-
- static void transform_point_cloud(
- std::span points,
- const glm::mat4& pose
- );
-
- [[nodiscard]] static ztu::result parent_directory(std::string_view path);
-
-
-};
-
-}
-
diff --git a/include/assets/file_parsers/kitti_parser.hpp b/include/assets/file_parsers/kitti_parser.hpp
new file mode 100644
index 0000000..24c0b64
--- /dev/null
+++ b/include/assets/file_parsers/kitti_parser.hpp
@@ -0,0 +1,98 @@
+#pragma once
+
+#include
+
+#include "assets/data_stores.hpp"
+#include "assets/path_id_lookups.hpp"
+#include "assets/components/point_cloud_vertex_components.hpp"
+#include "assets/data/point_cloud_data.hpp"
+#include "assets/data/pose_data.hpp"
+#include "assets/data_stores/point_cloud_store.hpp"
+#include "assets/data_stores/pose_list_store.hpp"
+#include "assets/data_views/pose_list_view.hpp"
+#include "util/result.hpp"
+
+namespace assets
+{
+
+struct kitti_parser
+{
+ static constexpr auto name = std::string_view("kitti");
+ using data_type = point_cloud_data;
+ using store_type = point_cloud_store;
+ using lookup_type = point_cloud_id_lookup;
+
+ [[nodiscard]] std::error_code prefetch(
+ path_id_lookups& lookups
+ );
+
+ [[nodiscard]] std::error_code load(
+ path_id_lookups& lookups,
+ data_stores& stores,
+ bool pedantic = false
+ );
+
+protected:
+ static constexpr auto frame_folder = "frames";
+
+ class parser_context
+ {
+ public:
+ parser_context(
+ const pose_list_id_lookup& pose_list_lookup,
+ const pose_list_store& pose_list_store,
+ store_type& m_store,
+ std::mutex& m_store_mutex
+ );
+
+ void operator()(lookup_type::const_pointer entry) noexcept;
+
+ protected:
+ void reset();
+
+ void tokenize_declarations();
+
+ [[nodiscard]] bool parse_metadata_from_tokens();
+
+ void remove_metadata_declarations();
+
+ private:
+ pose_list_id_lookup const* m_pose_list_lookup;
+ pose_list_store const* m_pose_list_store;
+ store_type* m_store;
+ std::mutex* m_store_mutex;
+ data_type m_buffer{};
+ std::filesystem::path m_last_pose_path{};
+ pose_list_view m_last_pose_list{};
+ };
+
+
+ [[nodiscard]] static ztu::result frame_id_from_filename(
+ std::string_view filename
+ );
+
+ [[nodiscard]] static std::error_code load_point_file(
+ const std::filesystem::path& filename,
+ data_type& point_cloud
+ );
+
+ static void transform_point_cloud(
+ z3d::array_view points,
+ const pose_data& pose
+ );
+
+ [[nodiscard]] static ztu::result parent_directory(
+ const std::filesystem::path& path
+ );
+#
+
+ [[nodiscard]] static ztu::result get_pose_path(
+ const std::filesystem::path& path
+ );
+
+private:
+ std::vector m_path_buffer;
+};
+
+}
+
diff --git a/include/assets/file_parsers/kitti_pose_loader.hpp b/include/assets/file_parsers/kitti_pose_loader.hpp
deleted file mode 100644
index b286ae1..0000000
--- a/include/assets/file_parsers/kitti_pose_loader.hpp
+++ /dev/null
@@ -1,37 +0,0 @@
-#pragma once
-
-#include
-
-#include "assets/data_stores.hpp"
-#include "assets/prefetch_lookup.hpp"
-#include "assets/prefetch_queue.hpp"
-#include "util/string_list.hpp"
-#include "../data_stores"
-#include "assets/data"
-#include "assets/prefetch_lookups/pose_prefetch_lookup.hpp"
-
-struct kitti_pose_loader
-{
- static constexpr auto name = std::string_view("kitti_pose");
-
- [[nodiscard]] static std::error_code prefetch(
- const file_dir_list& paths,
- prefetch_queue& queue
- );
-
- [[nodiscard]] static std::error_code load(
- dynamic_pose_buffer& buffer,
- const file_dir_list& paths,
- prefetch_lookup& id_lookup,
- shader_source_store& store,
- bool pedantic = false
- );
-
-private:
- static constexpr auto pose_filename = std::string_view{ "pose.txt" };
-
- static std::error_code parse_pose(
- std::ifstream& in,
- dynamic_pose_buffer& pose
- );
-};
\ No newline at end of file
diff --git a/include/assets/file_parsers/kitti_pose_parser.hpp b/include/assets/file_parsers/kitti_pose_parser.hpp
new file mode 100644
index 0000000..7640f46
--- /dev/null
+++ b/include/assets/file_parsers/kitti_pose_parser.hpp
@@ -0,0 +1,66 @@
+#pragma once
+
+#include
+
+#include "assets/path_id_lookups.hpp"
+#include "assets/data_stores/pose_list_store.hpp"
+#include "assets/data/pose_list_data.hpp"
+
+
+namespace assets
+{
+
+struct kitti_pose_parser
+{
+ static constexpr auto name = std::string_view("kitti_pose");
+ using data_type = pose_list_data;
+ using store_type = pose_list_store;
+ using lookup_type = pose_list_id_lookup;
+
+ [[nodiscard]] std::error_code prefetch(
+ path_id_lookups& lookups
+ );
+
+ [[nodiscard]] std::error_code parse(
+ const path_id_lookups& lookups,
+ store_type& store,
+ bool pedantic = false
+ );
+
+private:
+ static constexpr auto pose_filename = std::string_view{ "pose.txt" };
+
+ class parser_context
+ {
+ public:
+ parser_context(
+ store_type& m_store,
+ std::mutex& m_store_mutex
+ );
+
+ void operator()(lookup_type::const_pointer entry) noexcept;
+
+ protected:
+ void reset();
+
+ private:
+ store_type* m_store;
+ std::mutex* m_store_mutex;
+ data_type m_buffer{};
+ };
+
+ static std::error_code parse_file(
+ const std::filesystem::path& filename,
+ data_type &poses
+ );
+
+ static std::error_code parse_pose(
+ std::ifstream& in,
+ pose_data& pose
+ );
+
+private:
+ std::vector m_path_buffer;
+};
+
+}
diff --git a/include/assets/file_parsers/mtl_loader.hpp b/include/assets/file_parsers/mtl_loader.hpp
index 4384dd0..5a3b644 100644
--- a/include/assets/file_parsers/mtl_loader.hpp
+++ b/include/assets/file_parsers/mtl_loader.hpp
@@ -3,15 +3,17 @@
#include
#include
-#include "assets/data_stores.hpp"
#include "assets/prefetch_lookup.hpp"
#include "assets/prefetch_queue.hpp"
-#include "assets/data"
-#include "../data_stores"
-#include "../data_stores"
-#include "util/string_lookup.hpp"
+#include "assets/data/material_data.hpp"
+#include "assets/data/material_library_data.hpp"
+#include "assets/data_stores/material_store.hpp"
+#include "assets/data_stores/material_library_store.hpp"
#include "util/result.hpp"
+namespace assets
+{
+
namespace mtl_loader_error
{
enum class codes {
@@ -54,3 +56,5 @@ protected:
ztu::string_list& texture_filenames
);
};
+
+}
diff --git a/include/assets/file_parsers/threedtk_pose_loader.hpp b/include/assets/file_parsers/threedtk_pose_loader.hpp
index 8184e3d..8eaee5b 100644
--- a/include/assets/file_parsers/threedtk_pose_loader.hpp
+++ b/include/assets/file_parsers/threedtk_pose_loader.hpp
@@ -2,14 +2,15 @@
#include
-#include "assets/data_stores.hpp"
#include "assets/prefetch_lookup.hpp"
#include "assets/prefetch_queue.hpp"
-#include "assets/data"
-#include "util/string_list.hpp"
+#include "assets/data/pose_data.hpp"
#include "util/result.hpp"
#include "assets/prefetch_lookups/pose_prefetch_lookup.hpp"
+namespace assets
+{
+
struct threedtk_pose_loader
{
static constexpr auto name = std::string_view("3dtk_pose");
@@ -20,7 +21,7 @@ struct threedtk_pose_loader
);
[[nodiscard]] static std::error_code load(
- dynamic_pose_buffer& buffer,
+ pose_data& buffer,
const file_dir_list& paths,
prefetch_lookup& id_lookup,
shader_source_store& store,
@@ -38,3 +39,5 @@ protected:
std::string_view filename
);
};
+
+}
diff --git a/include/assets/identifiers.hpp b/include/assets/identifiers.hpp
index 326b993..3ddf539 100644
--- a/include/assets/identifiers.hpp
+++ b/include/assets/identifiers.hpp
@@ -5,12 +5,27 @@
namespace assets
{
-using material_id = z3d::identifier<0>;
-using material_library_id = z3d::identifier<1>;
-using mesh_id = z3d::identifier<2>;
-using point_cloud_id = z3d::identifier<3>;
-using pose_id = z3d::identifier<4>;
-using shader_source_id = z3d::identifier<5>;
-using texture_id = z3d::identifier<6>;
+namespace identifier_uuids
+{
+ enum : int {
+ material,
+ material_library,
+ mesh,
+ point_cloud,
+ pose,
+ pose_list,
+ shader_source,
+ texture
+ };
+}
+
+using material_id = z3d::identifier;
+using material_library_id = z3d::identifier;
+using mesh_id = z3d::identifier;
+using point_cloud_id = z3d::identifier;
+using pose_id = z3d::identifier;
+using pose_list_id = z3d::identifier;
+using shader_source_id = z3d::identifier;
+using texture_id = z3d::identifier;
}
diff --git a/include/assets/model_geometry.hpp b/include/assets/model_geometry.hpp
new file mode 100644
index 0000000..08ad25b
--- /dev/null
+++ b/include/assets/model_geometry.hpp
@@ -0,0 +1,22 @@
+#pragma once
+
+#include "config/primitives.hpp"
+
+namespace assets::model_geometry
+{
+
+enum class types : z3d::u8
+{
+ mesh = 0,
+ point_cloud = 1
+};
+
+inline constexpr z3d::size count = 2;
+
+inline constexpr auto names = z3d::array{
+ "mesh",
+ "point_cloud"
+};
+
+}
+
diff --git a/include/assets/path_id_lookups.hpp b/include/assets/path_id_lookups.hpp
new file mode 100644
index 0000000..2b197c7
--- /dev/null
+++ b/include/assets/path_id_lookups.hpp
@@ -0,0 +1,30 @@
+#pragma once
+
+#include "identifiers.hpp"
+#include "util/file_id_lookup.hpp"
+
+namespace assets
+{
+
+using material_id_lookup = file_id_lookup;
+using material_library_id_lookup = file_id_lookup;
+using mesh_id_lookup = file_id_lookup;
+using point_cloud_id_lookup = file_id_lookup;
+using pose_id_lookup = file_id_lookup;
+using pose_list_id_lookup = file_id_lookup;
+using shader_source_id_lookup = file_id_lookup;
+using texture_id_lookup = file_id_lookup;
+
+struct path_id_lookups
+{
+ material_id_lookup materials;
+ material_library_id_lookup material_libraries;
+ mesh_id_lookup meshes;
+ point_cloud_id_lookup point_clouds;
+ pose_id_lookup poses;
+ pose_list_id_lookup pose_lists;
+ shader_source_id_lookup shader_sources;
+ texture_id_lookup textures;
+};
+
+}
diff --git a/include/config/primitives.hpp b/include/config/primitives.hpp
index 6a7dfdf..afffae7 100644
--- a/include/config/primitives.hpp
+++ b/include/config/primitives.hpp
@@ -2,7 +2,14 @@
#include
#include
-#include "glm/gtc/type_aligned.hpp"
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include "glm/glm.hpp"
#include "util/id_type.hpp"
namespace z3d
@@ -53,10 +60,15 @@ using structure = std::tuple;
using string_view = std::string_view;
+template
+using result = std::expected;
+
using vertex_index = u32;
using index_triangle = array;
template
using identifier = ztu::id_type;
+
+
}
diff --git a/include/opengl/data/material_data.hpp b/include/opengl/data/material_data.hpp
index 9d2c319..d84a3fc 100644
--- a/include/opengl/data/material_data.hpp
+++ b/include/opengl/data/material_data.hpp
@@ -1,7 +1,7 @@
#pragma once
#include "assets/data/texture.hpp"
-#include "assets/data/surface_properties.hpp"
+#include "assets/data/uniform_surface_properties.hpp"
#include "assets/components/material_components.hpp"
#include "opengl/handles/material_handle.hpp"
diff --git a/include/opengl/data_managers/shader_manager.hpp b/include/opengl/data_managers/shader_manager.hpp
index 632915b..73e8af4 100644
--- a/include/opengl/data_managers/shader_manager.hpp
+++ b/include/opengl/data_managers/shader_manager.hpp
@@ -17,7 +17,7 @@
#include "opengl/handles/shader_handle_set.hpp"
#include "opengl/shading/requirements/shader_requirements.hpp"
#include "opengl/metadata/shader_set_metadata.hpp"
-#include "opengl/shading/requirements/shader_set_requirements.hpp"
+#include "opengl/shading/requirements/shader_program_requirements.hpp"
namespace zgl
{
@@ -33,9 +33,9 @@ public:
void process(const store_type& shader_sources);
- void get_handles(
+ void fetch(
const assets::shader_source_store& shader_sources,
- std::span requirements,
+ std::span requirements,
std::span metadata,
std::span shader_sets
);
@@ -56,7 +56,7 @@ protected:
std::vector m_shader_lookup{};
private:
- std::vector m_source_requirement_buffer{};
+ std::vector m_source_requirement_buffer{};
std::vector m_preprocessed_shader_source_metadata_buffer{};
std::vector m_source_strings_buffer{};
};
diff --git a/include/opengl/data_managers/shader_program_manager.hpp b/include/opengl/data_managers/shader_program_manager.hpp
index f422cb2..69bb5e4 100644
--- a/include/opengl/data_managers/shader_program_manager.hpp
+++ b/include/opengl/data_managers/shader_program_manager.hpp
@@ -21,7 +21,7 @@ public:
void process(const store_type& shader_sources);
- void get_handles(
+ void fetch(
const assets::shader_source_store& shader_sources,
std::span requirements,
std::span metadata,
@@ -41,7 +41,7 @@ protected:
std::vector m_shader_program_lookup;
private:
- std::vector m_shader_requirements_buffer;
+ std::vector m_shader_requirements_buffer;
std::vector m_shader_metadata_buffer;
std::vector shader_set_buffer;
};
diff --git a/include/opengl/data_managers/shader_source_manager.hpp b/include/opengl/data_managers/shader_source_manager.hpp
index 6e145f5..7c91ace 100644
--- a/include/opengl/data_managers/shader_source_manager.hpp
+++ b/include/opengl/data_managers/shader_source_manager.hpp
@@ -9,7 +9,7 @@
#include "util/string_lookup.hpp"
#include "opengl/metadata/shader_source_metadata.hpp"
-#include "opengl/shading/requirements/shader_source_requirements.hpp"
+#include "opengl/shading/requirements/shader_requirements.hpp"
#include "opengl/metadata/preprocessed_shader_source_metadata.hpp"
#include "assets/data_stores/shader_source_store.hpp"
@@ -30,64 +30,21 @@ public:
void process(const store_type& shader_sources);
- void get_shader_sources(
+ void fetch(
const assets::shader_source_store& shader_sources,
- std::span requirements,
+ std::span requirements,
std::span metadata,
std::vector& shader_strings
);
protected:
-
- void tokenize_declarations(std::string_view source);
-
- std::optional parse_metadata_from_tokens();
-
- [[nodiscard]] static bool parse_stage_declaration(
- std::span values,
- shader_source_metadata& metadata
- );
-
- [[nodiscard]] static bool parse_geometry_declaration(
- std::span tokens,
- shader_source_metadata& metadata
- );
-
- [[nodiscard]] static bool parse_features_declaration(
- std::span values,
- shader_source_metadata& metadata
- );
-
- [[nodiscard]] static bool parse_static_enable_declaration(
- std::span values,
- shader_source_metadata& metadata
- );
-
- [[nodiscard]] static bool parse_dynamic_enable_declaration(
- std::span values,
- shader_source_metadata& metadata
- );
-
- template
- static void parse_feature_tokens(
- std::span values,
- const ztu::string_lookup& feature_lookup,
- T& features
- );
-
static void get_define_strings(
- shading::model_geometry::types geometry,
- shading::features::generic::type features,
- shading::features::generic::type& feature_count,
+ assets::model_geometry::types geometry_type,
+ assets::shader_components::flags components,
+ assets::shader_components::flags& component_count,
std::vector& defines
);
-
std::vector m_shader_source_lookup;
-
-private:
- std::vector m_value_token_buffer;
- std::vector m_declaration_token_count_buffer;
- std::array m_declaration_type_index_buffer;
};
}
diff --git a/include/opengl/handles/shader_program_handle.hpp b/include/opengl/handles/shader_program_handle.hpp
index d0b2dec..80e6840 100644
--- a/include/opengl/handles/shader_program_handle.hpp
+++ b/include/opengl/handles/shader_program_handle.hpp
@@ -1,9 +1,7 @@
#pragma once
#include "GL/glew.h"
-#include "opengl/shader_uniform.hpp"
-
-#include "opengl/shader_uniform.hpp"
+#include "opengl/shading/uniform.hpp"
#include "util/uix.hpp"
#include
@@ -17,12 +15,12 @@ struct shader_program_handle
inline void bind() const;
static void unbind();
- template
+ template
void set_uniform(const T& value) const;
- [[nodiscard]] attribute_support_type check_attribute_support(std::span attributes) const;
+ /*[[nodiscard]] attribute_support_type check_attribute_support(std::span attributes) const;
- [[nodiscard]] uniform_support_type check_uniform_support(std::span uniforms) const;
+ [[nodiscard]] uniform_support_type check_uniform_support(std::span uniforms) const;*/
[[nodiscard]] bool valid() const;
diff --git a/include/opengl/metadata/material_metadata.hpp b/include/opengl/metadata/material_metadata.hpp
index c2dc08a..12e0a69 100644
--- a/include/opengl/metadata/material_metadata.hpp
+++ b/include/opengl/metadata/material_metadata.hpp
@@ -7,9 +7,9 @@ namespace zgl
struct material_metadata
{
- texture_handle ambient_color_texture_handle;
- texture_handle diffuse_color_texture_handle;
- texture_handle specular_color_texture_handle;
+ texture_handle specular_filter_texture_handle;
+ texture_handle diffuse_filter_texture_handle;
+ texture_handle specular_filter_texture_handle;
texture_handle shininess_texture_handle;
texture_handle alpha_texture_handle;
texture_handle bump_texture_handle;
diff --git a/include/opengl/metadata/preprocessed_shader_source_metadata.hpp b/include/opengl/metadata/preprocessed_shader_source_metadata.hpp
index c9faf90..c440d1a 100644
--- a/include/opengl/metadata/preprocessed_shader_source_metadata.hpp
+++ b/include/opengl/metadata/preprocessed_shader_source_metadata.hpp
@@ -1,13 +1,15 @@
#pragma once
-#include "opengl/shading/features/generic_features.hpp"
+#include "assets/components/shader_components.hpp"
namespace zgl
{
struct preprocessed_shader_source_metadata
{
- shading::features::generic::type static_enabled{};
- shading::features::generic::type dynamic_enable{};
- shading::features::generic::type string_count{};
+ assets::shader_components::flags static_enabled{};
+ assets::shader_components::flags dynamic_enable{};
+ // Use same integer type as it guarantees good alignment.
+ // (even an unsigned byte should hold the maximum number of defines.)
+ assets::shader_components::flags string_count{};
};
}
diff --git a/include/opengl/metadata/shader_metadata.hpp b/include/opengl/metadata/shader_metadata.hpp
index c4f3151..1a38631 100644
--- a/include/opengl/metadata/shader_metadata.hpp
+++ b/include/opengl/metadata/shader_metadata.hpp
@@ -1,16 +1,17 @@
#pragma once
-#include "opengl/shading/model_geometry.hpp"
-#include "opengl/shading/shader_stage.hpp"
-#include "opengl/shading/features/generic_features.hpp"
+#include "assets/model_geometry.hpp"
+#include "assets/components/shader_components.hpp"
namespace zgl
{
+
struct shader_metadata
{
- shading::model_geometry::types geometry;
- shading::stage::types stage;
- shading::features::generic::type static_enabled{};
- shading::features::generic::type dynamic_enable{};
+ assets::model_geometry::types geometry_type;
+ assets::shader_components::stage stage;
+ assets::shader_components::flags static_enabled{};
+ assets::shader_components::flags dynamic_enable{};
};
+
}
diff --git a/include/opengl/metadata/shader_program_metadata.hpp b/include/opengl/metadata/shader_program_metadata.hpp
index c0e4d96..5795eb3 100644
--- a/include/opengl/metadata/shader_program_metadata.hpp
+++ b/include/opengl/metadata/shader_program_metadata.hpp
@@ -1,15 +1,16 @@
#pragma once
-#include "opengl/shading/model_geometry.hpp"
-#include "opengl/shading/features/generic_features.hpp"
+#include "assets/model_geometry.hpp"
+#include "assets/components/shader_components.hpp"
-namespace zgl {
+namespace zgl
+{
struct shader_program_metadata
{
- shading::model_geometry::types geometry;
- shading::features::generic::type static_enabled{};
- shading::features::generic::type dynamic_enable{};
+ assets::model_geometry::types geometry_type;
+ assets::shader_components::stage static_enabled{};
+ assets::shader_components::stage dynamic_enable{};
};
}
diff --git a/include/opengl/metadata/shader_set_metadata.hpp b/include/opengl/metadata/shader_set_metadata.hpp
index 6f9bb52..7b977a1 100644
--- a/include/opengl/metadata/shader_set_metadata.hpp
+++ b/include/opengl/metadata/shader_set_metadata.hpp
@@ -1,12 +1,12 @@
#pragma once
-#include "opengl/shading/features/generic_features.hpp"
+#include "assets/components/shader_components.hpp"
namespace zgl
{
struct shader_set_metadata
{
- shading::features::generic::type static_enabled{};
- shading::features::generic::type dynamic_enable{};
+ assets::shader_components::flags static_enabled{};
+ assets::shader_components::flags dynamic_enable{};
};
}
diff --git a/include/opengl/metadata/shader_source_metadata.hpp b/include/opengl/metadata/shader_source_metadata.hpp
index f3c4c6f..6ec2d11 100644
--- a/include/opengl/metadata/shader_source_metadata.hpp
+++ b/include/opengl/metadata/shader_source_metadata.hpp
@@ -1,91 +1,18 @@
#pragma once
-#include
-#include
+#include "assets/model_geometry.hpp"
+#include "assets/components/shader_components.hpp"
-#include "../shading/model_geometry.hpp"
-#include "../shading/shader_stage.hpp"
-#include "../shading/features/mesh_features.hpp"
-#include "../shading/features/point_cloud_features.hpp"
-#include "../shading/features/generic_features.hpp"
-#include
-
-// TODO move implementation to .ipp file
namespace zgl
{
-template
-struct shader_features_set
-{
- T features, static_enable, dynamic_enable;
-
- template
- [[nodiscard]] shader_features_set cast() const noexcept
- {
- return {
- .features = static_cast(features),
- .static_enable = static_cast(static_enable),
- .dynamic_enable = static_cast(dynamic_enable)
- };
- }
-
- // TODO this may not compile
- [[nodiscard]] bool operator==(const shader_features_set& other) const noexcept = default;
-};
-
-
struct shader_source_metadata
{
- union combined_feature_set_type {
- shader_features_set mesh;
- shader_features_set point_cloud;
- };
-
- using generic_feature_set_type = shader_features_set;
-
- shading::model_geometry::types geometry;
- combined_feature_set_type feature_set;
- shading::stage::types stage;
-
- [[nodiscard]] generic_feature_set_type generic_feature_set() const noexcept
- {
- switch (geometry)
- {
- case shading::model_geometry::types::mesh:
- return feature_set.mesh.cast();
- case shading::model_geometry::types::point_cloud:
- return feature_set.point_cloud.cast();
- default:
- std::unreachable();
- }
- }
-
- void from_generic_feature_set(const generic_feature_set_type& generic_feature_set) noexcept
- {
- switch (geometry)
- {
- case shading::model_geometry::types::mesh:
- feature_set.mesh = generic_feature_set.cast();
- case shading::model_geometry::types::point_cloud:
- feature_set.point_cloud = generic_feature_set.cast();
- }
- std::unreachable();
- }
-
- bool operator==(const shader_source_metadata& other) const noexcept
- {
- if (this->stage != other.stage)
- {
- return false;
- }
-
- if (this->geometry != other.geometry)
- {
- return false;
- }
-
- return this->generic_feature_set() == other.generic_feature_set();
- }
+ assets::model_geometry::types geometry_type;
+ assets::shader_components::stage stage;
+ assets::shader_components::flags components{};
+ assets::shader_components::flags static_enable{};
+ assets::shader_components::flags dynamic_enable{};
};
}
diff --git a/include/opengl/shading/features/mesh_features.hpp b/include/opengl/shading/features/mesh_features.hpp
index 8981896..ba30267 100644
--- a/include/opengl/shading/features/mesh_features.hpp
+++ b/include/opengl/shading/features/mesh_features.hpp
@@ -21,16 +21,18 @@ struct type
namespace indices
{
-using type = ztu::u8;
-constexpr inline type face = 0;
-constexpr inline type line = 1;
-constexpr inline type point = 2;
-constexpr inline type luminance = 3;
-constexpr inline type color = 4;
-constexpr inline type alpha = 5;
-constexpr inline type lighting = 6;
-constexpr inline type texture = 7;
-constexpr inline type uniform_color = 8;
+enum : z3d::size
+{
+ face,
+ line,
+ point,
+ luminance,
+ color,
+ alpha,
+ lighting,
+ texture,
+ uniform_color
+};
}
enum class flags : std::uint16_t
diff --git a/include/opengl/shading/features/point_cloud_features.hpp b/include/opengl/shading/features/point_cloud_features.hpp
index 9bd01dc..9582569 100644
--- a/include/opengl/shading/features/point_cloud_features.hpp
+++ b/include/opengl/shading/features/point_cloud_features.hpp
@@ -23,14 +23,16 @@ struct type
namespace indices
{
-using type = ztu::u8;
-constexpr inline type square = 0;
-constexpr inline type lighting = 1;
-constexpr inline type luminance = 2;
-constexpr inline type color = 3;
-constexpr inline type alpha = 4;
-constexpr inline type uniform_color = 5;
-constexpr inline type rainbow = 6;
+enum : z3d::size
+{
+ square,
+ lighting,
+ luminance,
+ color,
+ alpha,
+ uniform_color,
+ rainbow
+};
}
enum class flags : std::uint8_t
diff --git a/include/opengl/shading/requirements/shader_program_requirements.hpp b/include/opengl/shading/requirements/shader_program_requirements.hpp
index 4f58640..d2f1817 100644
--- a/include/opengl/shading/requirements/shader_program_requirements.hpp
+++ b/include/opengl/shading/requirements/shader_program_requirements.hpp
@@ -1,57 +1,14 @@
#pragma once
-#include "opengl/shading/model_geometry.hpp"
-#include "opengl/shading/features/generic_features.hpp"
+#include "assets/model_geometry.hpp"
+#include "assets/components/shader_components.hpp"
namespace zgl::shading
{
+
struct shader_program_requirements
{
- model_geometry::types geometry;
- features::generic::type features;
+ assets::model_geometry::types geometry_type;
+ assets::shader_components::flags components{};
};
}
-/*
-struct shader_program_metadata
-{
- using generic_feature_type = std::common_type_t<
- std::underlying_type_t,
- std::underlying_type_t
- >;
-
- static constexpr auto geometry_bits = static_cast(std::bit_width(geometry::names.size()));
- static constexpr auto feature_bits = sizeof(generic_feature_type) * 8 - geometry_bits;
-
- explicit shader_program_metadata(const features::mesh::flags static_enabled, const features::mesh::flags dynamic_enable) :
- shader_program_metadata(
- geometry::types::mesh,
- static_cast(static_enabled),
- static_cast(dynamic_enable)
- ) {}
-
- explicit shader_program_metadata(const features::point_cloud::flags static_enabled, const features::point_cloud::flags dynamic_enable) :
- shader_program_metadata(
- geometry::types::point_cloud,
- static_cast(static_enabled),
- static_cast(dynamic_enable)
- ) {}
-
- shader_program_metadata(const geometry::types geometry_type, const generic_feature_type static_enabled, generic_feature_type dynamic_enable) :
- m_geometry_type{ geometry_type }, m_static_enabled{ static_enabled }, m_dynamic_enable{ dynamic_enable } {}
-
-
- [[nodiscard]] auto operator<=>(const shader_program_metadata& other) const noexcept
- {
- return (
- std::tie(this->m_geometry_type, std::popcount(this->m_static_enabled), std::popcount(this->m_dynamic_enable)) <=>
- std::tie(other.m_geometry_type, std::popcount(other.m_static_enabled), std::popcount(other.m_dynamic_enable))
- );
- }
-
- [[nodiscard]] bool operator==(const shader_program_metadata& other) const noexcept = default;
-
- geometry::types m_geometry_type : geometry_bits;
- generic_feature_type m_static_enabled : feature_bits;
- generic_feature_type m_dynamic_enable;
-};*/
-
diff --git a/include/opengl/shading/requirements/shader_requirements.hpp b/include/opengl/shading/requirements/shader_requirements.hpp
index fe9a586..58e654e 100644
--- a/include/opengl/shading/requirements/shader_requirements.hpp
+++ b/include/opengl/shading/requirements/shader_requirements.hpp
@@ -1,8 +1,16 @@
#pragma once
-#include "shader_source_requirements.hpp"
+#include "assets/model_geometry.hpp"
+#include "assets/components/shader_components.hpp"
namespace zgl::shading
{
-using shader_requirements = shader_source_requirements;
+
+struct shader_requirements
+{
+ assets::model_geometry::types geometry_type;
+ assets::shader_components::stage stage;
+ assets::shader_components::flags components{};
+};
+
}
diff --git a/include/opengl/shading/requirements/shader_set_requirements.hpp b/include/opengl/shading/requirements/shader_set_requirements.hpp
deleted file mode 100644
index e85794c..0000000
--- a/include/opengl/shading/requirements/shader_set_requirements.hpp
+++ /dev/null
@@ -1,13 +0,0 @@
-#pragma once
-#include "opengl/shading/features/generic_features.hpp"
-
-namespace zgl::shading
-{
-
-struct shader_set_requirements
-{
- model_geometry::types geometry;
- features::generic::type features;
-};
-
-}
diff --git a/include/opengl/shading/requirements/shader_source_requirements.hpp b/include/opengl/shading/requirements/shader_source_requirements.hpp
deleted file mode 100644
index 187ed14..0000000
--- a/include/opengl/shading/requirements/shader_source_requirements.hpp
+++ /dev/null
@@ -1,16 +0,0 @@
-#pragma once
-
-#include "opengl/shading/model_geometry.hpp"
-#include "opengl/shading/shader_stage.hpp"
-#include "opengl/shading/features/generic_features.hpp"
-
-
-namespace zgl::shading
-{
- struct shader_source_requirements
- {
- model_geometry::types geometry;
- stage::types stage;
- features::generic::type features;
- };
-}
diff --git a/include/opengl/shading/sampler_uniforms/mesh_samplers_uniforms.hpp b/include/opengl/shading/sampler_uniforms/mesh_samplers_uniforms.hpp
index 7baa5a3..31735b2 100644
--- a/include/opengl/shading/sampler_uniforms/mesh_samplers_uniforms.hpp
+++ b/include/opengl/shading/sampler_uniforms/mesh_samplers_uniforms.hpp
@@ -11,34 +11,34 @@ namespace zgl::shading::mesh_sampler_uniforms
enum class flags : std::uint16_t
{
none = 0,
- ambient_color_texture = 1 << 0,
- diffuse_color_texture = 1 << 1,
- specular_color_texture = 1 << 2,
+ specular_filter_texture = 1 << 0,
+ diffuse_filter_texture = 1 << 1,
+ specular_filter_texture = 1 << 2,
shininess_texture = 1 << 3,
alpha_texture = 1 << 4,
bump_texture = 1 << 5
};
-constexpr inline auto ambient_color_texture = sampler_uniform{ 0 };
-constexpr inline auto diffuse_color_texture = sampler_uniform{ 1 };
-constexpr inline auto specular_color_texture = sampler_uniform{ 2 };
+constexpr inline auto specular_filter_texture = sampler_uniform{ 0 };
+constexpr inline auto diffuse_filter_texture = sampler_uniform{ 1 };
+constexpr inline auto specular_filter_texture = sampler_uniform{ 2 };
constexpr inline auto shininess_texture = sampler_uniform{ 3 };
constexpr inline auto alpha_texture = sampler_uniform{ 4 };
constexpr inline auto bump_texture = sampler_uniform{ 5 };
constexpr inline auto all = std::array{
- ambient_color_texture,
- diffuse_color_texture,
- specular_color_texture,
+ specular_filter_texture,
+ diffuse_filter_texture,
+ specular_filter_texture,
shininess_texture,
alpha_texture,
bump_texture
};
constexpr inline auto names = std::array{
- "ambient_color_texture",
- "diffuse_color_texture",
- "specular_color_texture",
+ "specular_filter_texture",
+ "diffuse_filter_texture",
+ "specular_filter_texture",
"shininess_texture",
"alpha_texture",
"bump_texture"
diff --git a/include/util/file_id_lookup.hpp b/include/util/file_id_lookup.hpp
new file mode 100644
index 0000000..f004799
--- /dev/null
+++ b/include/util/file_id_lookup.hpp
@@ -0,0 +1,104 @@
+#pragma once
+
+#include
+#include
+#include
+#include
+
+template
+class file_id_lookup
+{
+public:
+ using container_type = std::unordered_map;
+ using key_type = typename container_type::key_type;
+ using mapped_type = typename container_type::mapped_type;
+ using value_type = typename container_type::value_type;
+ using size_type = typename container_type::size_type;
+ using difference_type = typename container_type::difference_type;
+ using hasher = typename container_type::hasher;
+ using key_equal = typename container_type::key_equal;
+ using allocator_type = typename container_type::allocator_type;
+ using reference = typename container_type::reference;
+ using const_reference = typename container_type::const_reference;
+ using pointer = typename container_type::pointer;
+ using const_pointer = typename container_type::const_pointer;
+ using iterator = typename container_type::iterator;
+ using const_iterator = typename container_type::const_iterator;
+ using local_iterator = typename container_type::local_iterator;
+ using const_local_iterator = typename container_type::const_local_iterator;
+ using node_type = typename container_type::node_type;
+ using insert_return_type = typename container_type::insert_return_type;
+
+ [[nodiscard]] iterator begin() noexcept { return m_container.begin(); }
+ [[nodiscard]] const_iterator begin() const noexcept { return m_container.begin(); }
+ [[nodiscard]] const_iterator cbegin() const noexcept { return m_container.cbegin(); }
+ [[nodiscard]] iterator end() noexcept { return m_container.end(); }
+ [[nodiscard]] const_iterator end() const noexcept { return m_container.end(); }
+ [[nodiscard]] const_iterator cend() const noexcept { return m_container.cend(); }
+ [[nodiscard]] bool empty() const noexcept { return m_container.empty(); }
+ [[nodiscard]] size_type size() const noexcept { return m_container.size(); }
+ [[nodiscard]] size_type max_size() const noexcept { return m_container.max_size(); }
+
+ void by_extension(
+ const std::string_view extension,
+ std::vector& dst
+ ) const {
+ std::ranges::copy(
+ m_container |
+ std::views::filter(
+ [&](const value_type& entry)
+ {
+ return entry.first.extension() == extension;
+ }
+ ) |
+ std::views::transform(
+ [&](const value_type& entry)
+ {
+ return &entry;
+ }
+ ),
+ std::back_inserter(dst)
+ );
+ }
+
+
+ std::pair try_emplace(const key_type& path)
+ {
+ auto it = m_container.find(path);
+
+ const auto is_new = it == m_container.end();
+
+ if (not is_new)
+ {
+ it = m_container.emplace_hint(it, path, ID::next());
+ }
+
+ return { it, is_new };
+ }
+
+ [[nodiscard]] bool contains(const key_type& key) const { return m_container.contains(key); }
+ [[nodiscard]] size_type count(const key_type& key) const { return m_container.count(key); }
+ [[nodiscard]] iterator find(const key_type& key) { return m_container.find(key); }
+ [[nodiscard]] const_iterator find(const key_type& key) const { return m_container.find(key); }
+
+ iterator erase(iterator pos) { return m_container.erase(pos); }
+ iterator erase(const_iterator pos) { return m_container.erase(pos); }
+ iterator erase(const_iterator first, const_iterator last) { return m_container.erase(first, last); }
+ size_type erase(const key_type& key) { return m_container.erase(key); }
+ void clear() noexcept { m_container.clear(); }
+
+
+
+private:
+ static auto extension_filter(const std::string_view& extension)
+ {
+ return std::views::filter(
+ [extension](const key_type& path)
+ {
+ return path.extension() == extension;
+ }
+ );
+ }
+
+ container_type m_container;
+};
\ No newline at end of file
diff --git a/shaders/fragment_mesh_face.glsl b/shaders/fragment_mesh_face.glsl
index 9502a6b..4141b74 100644
--- a/shaders/fragment_mesh_face.glsl
+++ b/shaders/fragment_mesh_face.glsl
@@ -39,9 +39,9 @@ layout (std140, binding = 1) uniform Lighting
layout (location = 8) uniform vec3 ambient_light_color;
};
-uniform sampler2D ambient_color_texture;
-uniform sampler2D diffuse_color_texture;
-uniform sampler2D specular_color_texture;
+uniform sampler2D specular_filter_texture;
+uniform sampler2D diffuse_filter_texture;
+uniform sampler2D specular_filter_texture;
uniform sampler2D shininess_texture;
uniform sampler2D alpha_texture;
uniform sampler2D bump_texture;
diff --git a/source/assets/data/material_data.ipp b/source/assets/data/material_data.ipp
index b7b7289..bb1276e 100644
--- a/source/assets/data/material_data.ipp
+++ b/source/assets/data/material_data.ipp
@@ -1,27 +1,39 @@
-#ifndef INCLUDE_DYNAMIC_MATERIAL_DATA_IMPLEMENTATION
-# error Never include this file directly include 'dynamic_material_buffer.hpp'
+#ifndef INCLUDE_MATERIAL_DATA_IMPLEMENTATION
+# error Never include this file directly include 'material_data.hpp'
#endif
+inline std::optional& assets::material_data::specular_filter()
+{
+ return std::get(components);
+}
+inline std::optional& assets::material_data::diffuse_filter()
+{
+ return std::get(components);
+}
+inline std::optional& assets::material_data::specular_filter()
+{
+ return std::get(components);
+}
+inline std::optional& assets::material_data::shininess()
+{
+ return std::get(components);
+}
+inline std::optional& assets::material_data::alpha()
+{
+ return std::get(components);
+}
-inline std::optional& assets::material_data::surface_properties()
+inline std::optional& assets::material_data::specular_filter_texture_id()
{
- return std::get(components);
+ return std::get(components);
}
-inline std::optional& assets::material_data::transparency()
+inline std::optional& assets::material_data::diffuse_filter_texture_id()
{
- return std::get(components);
+ return std::get(components);
}
-inline std::optional& assets::material_data::ambient_color_texture_id()
+inline std::optional& assets::material_data::specular_filter_texture_id()
{
- return std::get