Made assets::data_stores thread safe.
This commit is contained in:
@@ -4,16 +4,19 @@
|
||||
|
||||
namespace assets::detail {
|
||||
|
||||
template<typename T>
|
||||
template<typename C, typename T>
|
||||
class component_set {};
|
||||
|
||||
|
||||
template<typename... Ts>
|
||||
class component_set<z3d::structure<Ts...>>
|
||||
template<typename C, typename... Ts>
|
||||
class component_set<C, z3d::structure<Ts...>>
|
||||
{
|
||||
public:
|
||||
component_set() = default;
|
||||
|
||||
C component_flags{};
|
||||
z3d::structure<z3d::optional<Ts...>> components{};
|
||||
|
||||
protected:
|
||||
void clear_components()
|
||||
{
|
||||
@@ -25,8 +28,6 @@ protected:
|
||||
components
|
||||
);
|
||||
}
|
||||
|
||||
z3d::structure<z3d::optional<Ts...>> components{};
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -6,8 +6,10 @@
|
||||
namespace assets
|
||||
{
|
||||
|
||||
struct material_data : detail::component_set<material_components::all>
|
||||
{
|
||||
struct material_data : public detail::component_set<
|
||||
material_components::flags,
|
||||
material_components::all
|
||||
> {
|
||||
|
||||
material_data() = default;
|
||||
|
||||
@@ -16,9 +18,9 @@ struct material_data : detail::component_set<material_components::all>
|
||||
[[nodiscard]] inline z3d::optional<material_components::specular_filter>& specular_filter();
|
||||
[[nodiscard]] inline z3d::optional<material_components::shininess>& shininess();
|
||||
[[nodiscard]] inline z3d::optional<material_components::alpha>& alpha();
|
||||
[[nodiscard]] inline z3d::optional<material_components::ambient_filter_texture>& specular_filter_texture_id();
|
||||
[[nodiscard]] inline z3d::optional<material_components::diffuse_filter_texture>& diffuse_filter_texture_id();
|
||||
[[nodiscard]] inline z3d::optional<material_components::ambient_filter_texture>& ambient_filter_texture_id();
|
||||
[[nodiscard]] inline z3d::optional<material_components::specular_filter_texture>& specular_filter_texture_id();
|
||||
[[nodiscard]] inline z3d::optional<material_components::diffuse_filter_texture>& diffuse_filter_texture_id();
|
||||
[[nodiscard]] inline z3d::optional<material_components::shininess_texture>& shininess_texture_id();
|
||||
[[nodiscard]] inline z3d::optional<material_components::alpha_texture>& alpha_texture_id();
|
||||
[[nodiscard]] inline z3d::optional<material_components::bump_texture>& bump_texture_id();
|
||||
@@ -28,10 +30,9 @@ struct material_data : detail::component_set<material_components::all>
|
||||
[[nodiscard]] inline const z3d::optional<material_components::specular_filter>& specular_filter() const;
|
||||
[[nodiscard]] inline const z3d::optional<material_components::shininess>& shininess() const;
|
||||
[[nodiscard]] inline const z3d::optional<material_components::alpha>& alpha() const;
|
||||
[[nodiscard]] inline const z3d::optional<material_components::alpha>& transparency() const;
|
||||
[[nodiscard]] inline const z3d::optional<material_components::ambient_filter_texture>& specular_filter_texture_id() const;
|
||||
[[nodiscard]] inline const z3d::optional<material_components::diffuse_filter_texture>& diffuse_filter_texture_id() const;
|
||||
[[nodiscard]] inline const z3d::optional<material_components::ambient_filter_texture>& ambient_filter_texture_id() const;
|
||||
[[nodiscard]] inline const z3d::optional<material_components::specular_filter_texture>& specular_filter_texture_id() const;
|
||||
[[nodiscard]] inline const z3d::optional<material_components::diffuse_filter_texture>& diffuse_filter_texture_id() const;
|
||||
[[nodiscard]] inline const z3d::optional<material_components::shininess_texture>& shininess_texture_id() const;
|
||||
[[nodiscard]] inline const z3d::optional<material_components::alpha_texture>& alpha_texture_id() const;
|
||||
[[nodiscard]] inline const z3d::optional<material_components::bump_texture>& bump_texture_id() const;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
namespace assets
|
||||
{
|
||||
|
||||
class mesh_data : detail::component_array_set<
|
||||
class mesh_data : public detail::component_array_set<
|
||||
mesh_vertex_components::flags,
|
||||
mesh_vertex_components::all
|
||||
> {
|
||||
@@ -19,7 +19,7 @@ public:
|
||||
[[nodiscard]] inline z3d::vector<mesh_vertex_components::color>& colors();
|
||||
[[nodiscard]] inline z3d::vector<mesh_vertex_components::reflectance>& reflectances();
|
||||
[[nodiscard]] inline z3d::vector<z3d::index_triangle>& triangles();
|
||||
[[nodiscard]] inline auto& material();
|
||||
[[nodiscard]] inline material_id& material();
|
||||
|
||||
[[nodiscard]] inline const z3d::vector<mesh_vertex_components::position>& positions() const;
|
||||
[[nodiscard]] inline const z3d::vector<mesh_vertex_components::normal>& normals() const;
|
||||
@@ -27,7 +27,7 @@ public:
|
||||
[[nodiscard]] inline const z3d::vector<mesh_vertex_components::color>& colors() const;
|
||||
[[nodiscard]] inline const z3d::vector<mesh_vertex_components::reflectance>& reflectances() const;
|
||||
[[nodiscard]] inline const z3d::vector<z3d::index_triangle>& triangles() const;
|
||||
[[nodiscard]] inline const auto& material() const;
|
||||
[[nodiscard]] inline const material_id& material() const;
|
||||
|
||||
inline void clear();
|
||||
|
||||
|
||||
@@ -18,6 +18,8 @@ struct shader_source_data
|
||||
shader_components::flags components{};
|
||||
shader_components::flags static_enable{};
|
||||
shader_components::flags dynamic_enable{};
|
||||
|
||||
bool operator==(const metadata& meta) const = default;
|
||||
} meta;
|
||||
|
||||
void clear()
|
||||
|
||||
Reference in New Issue
Block a user