59 lines
1.6 KiB
C++
59 lines
1.6 KiB
C++
#pragma once
|
|
|
|
#include "assets/data/texture.hpp"
|
|
#include "assets/data/uniform_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,
|
|
material_components::flags components
|
|
);
|
|
|
|
public:
|
|
material_data() = default;
|
|
|
|
[[nodiscard]] static std::error_code build_from(
|
|
const std::optional<material_texture_components>& texture_opt,
|
|
const std::optional<material_components::surface_properties>& surface_properties_opt,
|
|
const std::optional<material_components::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
|