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,58 @@
#pragma once
#include "assets/data/texture.hpp"
#include "assets/data/surface_properties.hpp"
#include "assets/components/material_components.hpp"
#include "opengl/handles/material_handle.hpp"
#include "opengl/data/texture_data.hpp"
#include <system_error>
namespace zgl
{
struct material_data
{
private:
material_data(
const std::optional<texture_handle>& texture_handle,
const std::optional<surface_properties_handle>& surface_properties_handle,
const std::optional<alpha_handle>& alpha_handle,
std::optional<texture_data>&& texture_data,
components::material::flags components
);
public:
material_data() = default;
[[nodiscard]] static std::error_code build_from(
const std::optional<components::material::texture>& texture_opt,
const std::optional<components::material::surface_properties>& surface_properties_opt,
const std::optional<components::material::transparency>& transparency_opt,
material_component::flags components,
material_data& data
);
material_data(const material_data& other) = delete;
material_data& operator=(const material_data& other) = delete;
material_data(material_data&& other) noexcept;
material_data& operator=(material_data&& other) noexcept;
[[nodiscard]] material_handle handle() const;
[[nodiscard]] material_component::flags components() const;
private:
material_handle m_handle{};
std::optional<texture_data> m_texture_data{ std::nullopt };
material_component::flags m_component_types{
material_component::flags::none
};
};
}
#define INCLUDE_MATERIAL_DATA_IMPLEMENTATION
#include "opengl/data/material_data.ipp"
#undef INCLUDE_MATERIAL_DATA_IMPLEMENTATION