Vulkan Schnee 0.0.1
High-performance rendering engine
Loading...
Searching...
No Matches
MaterialAsset.h
Go to the documentation of this file.
1#pragma once
2#include "Engine/Core/Asset.h"
6
7namespace Ecs {
9}
10
11namespace EngineCore {
22 public:
23 explicit MaterialAsset(const Asset::Path &assetPath, bool initWithDefaultData = false);
24
32 template<typename T>
33 T& getData();
34
38 void unload() override;
39
47 [[nodiscard]] PipelineNames getType() const { return type; }
48
56 [[nodiscard]] const std::filesystem::path& getBaseColorTexturePath() const { return baseColorTexturePath; }
57
65 void setBaseColorTexturePath(const std::filesystem::path& path) { baseColorTexturePath = path; }
66
67 // PBR texture path accessors
68 [[nodiscard]] const std::filesystem::path& getNormalTexturePath() const { return normalTexturePath; }
69 [[nodiscard]] const std::filesystem::path& getMetallicRoughnessTexturePath() const { return metallicRoughnessTexturePath; }
70 [[nodiscard]] const std::filesystem::path& getEmissiveTexturePath() const { return emissiveTexturePath; }
71 [[nodiscard]] const std::filesystem::path& getLightmapTexturePath() const { return lightmapTexturePath; }
72
73 void setNormalTexturePath(const std::filesystem::path& path) { normalTexturePath = path; }
74 void setMetallicRoughnessTexturePath(const std::filesystem::path& path) { metallicRoughnessTexturePath = path; }
75 void setEmissiveTexturePath(const std::filesystem::path& path) { emissiveTexturePath = path; }
76 void setLightmapTexturePath(const std::filesystem::path& path) { lightmapTexturePath = path; }
77
78 // Type-safe handle accessors (compile-time type enforcement)
79
88
97
106
115
124
130
136
142
148
154
155 protected:
162 void updateLoadingState() override;
163
165 std::filesystem::path baseColorTexturePath;
166 std::filesystem::path normalTexturePath;
167 std::filesystem::path metallicRoughnessTexturePath;
168 std::filesystem::path emissiveTexturePath;
169 std::filesystem::path lightmapTexturePath;
170
171 // Type-safe texture handles for O(1) descriptor index lookup
177 };
178
179 template<typename T>
181 return mainRegistry.get<T>(data);
182 }
183
184 class MaterialAssetManager : public Asset::AssetManager<Asset::Path, MaterialAsset> {
185 public:
187 };
188}
Base class for asset wrappers. The data is stored in the private member variable 'data' in form of en...
Definition Asset.h:50
entt::entity data
Definition Asset.h:98
entt::registry & mainRegistry
Definition Asset.h:97
A manager which is used to look up existing assets and their loading state.
Definition Asset.h:141
The model asset pipeline loads a gltf scene and loads and loads the mesh and material data....
std::filesystem::path emissiveTexturePath
Path to emissive texture from glTF.
MaterialAsset(const Asset::Path &assetPath, bool initWithDefaultData=false)
void setLightmapTexturePath(const std::filesystem::path &path)
const std::filesystem::path & getBaseColorTexturePath() const
Gets the base color texture path for this material.
void setLightmapTextureHandle(LightmapTextureHandle h)
Set the lightmap texture handle (type-safe)
MetallicRoughnessTextureHandle getMetallicRoughnessTextureHandle() const
Get the type-safe metallic-roughness texture handle.
void setMetallicRoughnessTextureHandle(MetallicRoughnessTextureHandle h)
Set the metallic-roughness texture handle (type-safe)
EmissiveTextureHandle getEmissiveTextureHandle() const
Get the type-safe emissive texture handle.
const std::filesystem::path & getMetallicRoughnessTexturePath() const
NormalTextureHandle normalTextureHandle_
LightmapTextureHandle getLightmapTextureHandle() const
Get the type-safe lightmap texture handle.
NormalTextureHandle getNormalTextureHandle() const
Get the type-safe normal texture handle.
void setMetallicRoughnessTexturePath(const std::filesystem::path &path)
std::filesystem::path metallicRoughnessTexturePath
Path to metallic-roughness texture from glTF.
std::filesystem::path baseColorTexturePath
Path to base color texture from glTF.
LightmapTextureHandle lightmapTextureHandle_
void setEmissiveTextureHandle(EmissiveTextureHandle h)
Set the emissive texture handle (type-safe)
const std::filesystem::path & getLightmapTexturePath() const
void setEmissiveTexturePath(const std::filesystem::path &path)
void unload() override
Unload data.
std::filesystem::path lightmapTexturePath
Path to lightmap texture from VulkanSchnee extension.
const std::filesystem::path & getEmissiveTexturePath() const
EmissiveTextureHandle emissiveTextureHandle_
void setBaseColorTextureHandle(AlbedoTextureHandle h)
Set the base color texture handle (type-safe)
T & getData()
Method to get the material data from the ecs with the corresponding type.
void setNormalTexturePath(const std::filesystem::path &path)
MetallicRoughnessTextureHandle metallicRoughnessTextureHandle_
const std::filesystem::path & getNormalTexturePath() const
std::filesystem::path normalTexturePath
Path to normal map texture from glTF.
AlbedoTextureHandle getBaseColorTextureHandle() const
Get the type-safe base color texture handle.
AlbedoTextureHandle baseColorTextureHandle_
void setNormalTextureHandle(NormalTextureHandle h)
Set the normal texture handle (type-safe)
PipelineNames getType() const
Gets the material type for pipeline lookup.
void updateLoadingState() override
Updates the loading state based on presence of material ECS components.
void setBaseColorTexturePath(const std::filesystem::path &path)
Sets the base color texture path for this material.
Data structs for the Entity Component System.
Log category system implementation.
TypedTextureHandle< TextureType::MetallicRoughness > MetallicRoughnessTextureHandle
TypedTextureHandle< TextureType::Lightmap > LightmapTextureHandle
TypedTextureHandle< TextureType::Emissive > EmissiveTextureHandle
TypedTextureHandle< TextureType::Normal > NormalTextureHandle
TypedTextureHandle< TextureType::BaseColor > AlbedoTextureHandle