Vulkan Schnee 0.0.1 (22840dc8)
High-performance rendering engine
Loading...
Searching...
No Matches
Engine::Assets::Material Class Reference

the material asset is another wrapper for asset data which is stored in entt. It has the EngineCore::MaterialAsset::type member variable which corresponds to the component used to store the material data More...

#include <MaterialAsset.h>

Inheritance diagram for Engine::Assets::Material:
Collaboration diagram for Engine::Assets::Material:

Public Member Functions

 Material (const Asset::MeshPath &assetPath, bool initWithDefaultData=false)
 Creates a material asset for a source mesh path.
template<typename T>
T & getData ()
 Method to get the material data from the ecs with the corresponding type.
void unload () override
 Unload data.
Rendering::PipelineNames getType () const
 Gets the material type for pipeline lookup.
const std::filesystem::path & getBaseColorTexturePath () const
 Gets the base color texture path for this material.
void setBaseColorTexturePath (const std::filesystem::path &path)
 Sets the base color texture path for this material.
const std::filesystem::path & getNormalTexturePath () const
 Gets the normal map texture path for this material.
const std::filesystem::path & getMetallicRoughnessTexturePath () const
 Gets the metallic-roughness texture path for this material.
const std::filesystem::path & getEmissiveTexturePath () const
 Gets the emissive texture path for this material.
const std::filesystem::path & getLightmapTexturePath () const
 Gets the lightmap texture path for this material.
void setNormalTexturePath (const std::filesystem::path &path)
 Sets the normal map texture path for this material.
void setMetallicRoughnessTexturePath (const std::filesystem::path &path)
 Sets the metallic-roughness texture path for this material.
void setEmissiveTexturePath (const std::filesystem::path &path)
 Sets the emissive texture path for this material.
void setLightmapTexturePath (const std::filesystem::path &path)
 Sets the lightmap texture path for this material.
Texture2DHandle getBaseColorTextureHandle () const
 Get the type-safe base color texture handle.
Texture2DHandle getNormalTextureHandle () const
 Get the type-safe normal texture handle.
Texture2DHandle getMetallicRoughnessTextureHandle () const
 Get the type-safe metallic-roughness texture handle.
Texture2DHandle getEmissiveTextureHandle () const
 Get the type-safe emissive texture handle.
Texture2DHandle getLightmapTextureHandle () const
 Get the type-safe lightmap texture handle.
void setBaseColorTextureHandle (Texture2DHandle h)
 Set the base color texture handle (type-safe)
void setNormalTextureHandle (Texture2DHandle h)
 Set the normal texture handle (type-safe)
void setMetallicRoughnessTextureHandle (Texture2DHandle h)
 Set the metallic-roughness texture handle (type-safe)
void setEmissiveTextureHandle (Texture2DHandle h)
 Set the emissive texture handle (type-safe)
void setLightmapTextureHandle (Texture2DHandle h)
 Set the lightmap texture handle (type-safe)
Public Member Functions inherited from Asset::AssetBase
 AssetBase (bool initializeDefaultEntity=false)
 Creates a base asset and optionally allocates its default ECS entity.
virtual ~AssetBase ()
 Releases base asset resources.
CpuLoadingState getLoadingState ()
 Gets the loading state of this asset.
void requestLoad ()
 If this asset is in the UNLOADED state it will get added to the assets to load.
entt::entity getEntity () const
 Getter for data.

Protected Member Functions

void updateLoadingState () override
 Updates the loading state based on presence of material ECS components.

Protected Attributes

Rendering::PipelineNames type = DEFAULT_MATERIAL_PIPELINE
 Pipeline used to render this material.
std::filesystem::path baseColorTexturePath
 Path to base color texture from glTF.
std::filesystem::path normalTexturePath
 Path to normal map texture from glTF.
std::filesystem::path metallicRoughnessTexturePath
 Path to metallic-roughness texture from glTF.
std::filesystem::path emissiveTexturePath
 Path to emissive texture from glTF.
std::filesystem::path lightmapTexturePath
 Path to lightmap texture from VulkanSchnee extension.
Texture2DHandle baseColorTextureHandle_
 Descriptor handle for the base color texture slot.
Texture2DHandle normalTextureHandle_
 Descriptor handle for the normal texture slot.
Texture2DHandle metallicRoughnessTextureHandle_
 Descriptor handle for the metallic-roughness texture slot.
Texture2DHandle emissiveTextureHandle_
 Descriptor handle for the emissive texture slot.
Texture2DHandle lightmapTextureHandle_
 Descriptor handle for the lightmap texture slot.
Protected Attributes inherited from Asset::AssetBase
CpuLoadingState loadingState = UNLOADED
 Current CPU loading state.
entt::registry & mainRegistry
 Registry that owns this asset's ECS data.
entt::entity data
 Entity containing the asset's component data.

Detailed Description

the material asset is another wrapper for asset data which is stored in entt. It has the EngineCore::MaterialAsset::type member variable which corresponds to the component used to store the material data

Definition at line 23 of file MaterialAsset.h.

Constructor & Destructor Documentation

◆ Material()

Engine::Assets::Material::Material ( const Asset::MeshPath & assetPath,
bool initWithDefaultData = false )
explicit

Creates a material asset for a source mesh path.

Parameters
assetPathSource mesh path used as the asset key.
initWithDefaultDataWhether to create backing ECS data immediately.

Member Function Documentation

◆ getBaseColorTextureHandle()

Texture2DHandle Engine::Assets::Material::getBaseColorTextureHandle ( ) const
inlinenodiscard

Get the type-safe base color texture handle.

Returns
Handle that can only be used for base color texture slots

Definition at line 117 of file MaterialAsset.h.

References baseColorTextureHandle_.

◆ getBaseColorTexturePath()

const std::filesystem::path & Engine::Assets::Material::getBaseColorTexturePath ( ) const
inlinenodiscard

Gets the base color texture path for this material.

Returns
The path to the base color texture, or empty path if none

Definition at line 58 of file MaterialAsset.h.

References baseColorTexturePath.

◆ getData()

template<typename T>
T & Engine::Assets::Material::getData ( )

Method to get the material data from the ecs with the corresponding type.

Returns
pointer to the data of the material
Template Parameters
Ttype of material data

Definition at line 195 of file MaterialAsset.h.

References Asset::AssetBase::data, and Asset::AssetBase::mainRegistry.

◆ getEmissiveTextureHandle()

Texture2DHandle Engine::Assets::Material::getEmissiveTextureHandle ( ) const
inlinenodiscard

Get the type-safe emissive texture handle.

Returns
Handle that can only be used for emissive texture slots

Definition at line 135 of file MaterialAsset.h.

References emissiveTextureHandle_.

◆ getEmissiveTexturePath()

const std::filesystem::path & Engine::Assets::Material::getEmissiveTexturePath ( ) const
inlinenodiscard

Gets the emissive texture path for this material.

Definition at line 80 of file MaterialAsset.h.

References emissiveTexturePath.

◆ getLightmapTextureHandle()

Texture2DHandle Engine::Assets::Material::getLightmapTextureHandle ( ) const
inlinenodiscard

Get the type-safe lightmap texture handle.

Returns
Handle that can only be used for lightmap texture slots

Definition at line 141 of file MaterialAsset.h.

References lightmapTextureHandle_.

◆ getLightmapTexturePath()

const std::filesystem::path & Engine::Assets::Material::getLightmapTexturePath ( ) const
inlinenodiscard

Gets the lightmap texture path for this material.

Definition at line 85 of file MaterialAsset.h.

References lightmapTexturePath.

◆ getMetallicRoughnessTextureHandle()

Texture2DHandle Engine::Assets::Material::getMetallicRoughnessTextureHandle ( ) const
inlinenodiscard

Get the type-safe metallic-roughness texture handle.

Returns
Handle that can only be used for metallic-roughness texture slots

Definition at line 129 of file MaterialAsset.h.

References metallicRoughnessTextureHandle_.

◆ getMetallicRoughnessTexturePath()

const std::filesystem::path & Engine::Assets::Material::getMetallicRoughnessTexturePath ( ) const
inlinenodiscard

Gets the metallic-roughness texture path for this material.

Definition at line 75 of file MaterialAsset.h.

References metallicRoughnessTexturePath.

◆ getNormalTextureHandle()

Texture2DHandle Engine::Assets::Material::getNormalTextureHandle ( ) const
inlinenodiscard

Get the type-safe normal texture handle.

Returns
Handle that can only be used for normal map texture slots

Definition at line 123 of file MaterialAsset.h.

References normalTextureHandle_.

◆ getNormalTexturePath()

const std::filesystem::path & Engine::Assets::Material::getNormalTexturePath ( ) const
inlinenodiscard

Gets the normal map texture path for this material.

Definition at line 70 of file MaterialAsset.h.

References normalTexturePath.

◆ getType()

Rendering::PipelineNames Engine::Assets::Material::getType ( ) const
inlinenodiscard

Gets the material type for pipeline lookup.

Returns
The MaterialNames enum value for this material

Definition at line 52 of file MaterialAsset.h.

References type.

◆ setBaseColorTextureHandle()

void Engine::Assets::Material::setBaseColorTextureHandle ( Texture2DHandle h)
inline

Set the base color texture handle (type-safe)

Parameters
hHandle of type Texture2DHandle

Definition at line 147 of file MaterialAsset.h.

References baseColorTextureHandle_.

◆ setBaseColorTexturePath()

void Engine::Assets::Material::setBaseColorTexturePath ( const std::filesystem::path & path)
inline

Sets the base color texture path for this material.

Parameters
pathPath to the texture file

Definition at line 64 of file MaterialAsset.h.

References baseColorTexturePath.

◆ setEmissiveTextureHandle()

void Engine::Assets::Material::setEmissiveTextureHandle ( Texture2DHandle h)
inline

Set the emissive texture handle (type-safe)

Parameters
hHandle of type Texture2DHandle

Definition at line 165 of file MaterialAsset.h.

References emissiveTextureHandle_.

◆ setEmissiveTexturePath()

void Engine::Assets::Material::setEmissiveTexturePath ( const std::filesystem::path & path)
inline

Sets the emissive texture path for this material.

Parameters
pathPath to the texture file.

Definition at line 103 of file MaterialAsset.h.

References emissiveTexturePath.

◆ setLightmapTextureHandle()

void Engine::Assets::Material::setLightmapTextureHandle ( Texture2DHandle h)
inline

Set the lightmap texture handle (type-safe)

Parameters
hHandle of type Texture2DHandle

Definition at line 171 of file MaterialAsset.h.

References lightmapTextureHandle_.

◆ setLightmapTexturePath()

void Engine::Assets::Material::setLightmapTexturePath ( const std::filesystem::path & path)
inline

Sets the lightmap texture path for this material.

Parameters
pathPath to the texture file.

Definition at line 109 of file MaterialAsset.h.

References lightmapTexturePath.

◆ setMetallicRoughnessTextureHandle()

void Engine::Assets::Material::setMetallicRoughnessTextureHandle ( Texture2DHandle h)
inline

Set the metallic-roughness texture handle (type-safe)

Parameters
hHandle of type Texture2DHandle

Definition at line 159 of file MaterialAsset.h.

References metallicRoughnessTextureHandle_.

◆ setMetallicRoughnessTexturePath()

void Engine::Assets::Material::setMetallicRoughnessTexturePath ( const std::filesystem::path & path)
inline

Sets the metallic-roughness texture path for this material.

Parameters
pathPath to the texture file.

Definition at line 97 of file MaterialAsset.h.

References metallicRoughnessTexturePath.

◆ setNormalTextureHandle()

void Engine::Assets::Material::setNormalTextureHandle ( Texture2DHandle h)
inline

Set the normal texture handle (type-safe)

Parameters
hHandle of type Texture2DHandle

Definition at line 153 of file MaterialAsset.h.

References normalTextureHandle_.

◆ setNormalTexturePath()

void Engine::Assets::Material::setNormalTexturePath ( const std::filesystem::path & path)
inline

Sets the normal map texture path for this material.

Parameters
pathPath to the texture file.

Definition at line 91 of file MaterialAsset.h.

References normalTexturePath.

◆ unload()

void Engine::Assets::Material::unload ( )
overridevirtual

Unload data.

Reimplemented from Asset::AssetBase.

◆ updateLoadingState()

void Engine::Assets::Material::updateLoadingState ( )
overrideprotectedvirtual

Updates the loading state based on presence of material ECS components.

Reimplemented from Asset::AssetBase.

Member Data Documentation

◆ baseColorTextureHandle_

Texture2DHandle Engine::Assets::Material::baseColorTextureHandle_
protected

Descriptor handle for the base color texture slot.

Definition at line 187 of file MaterialAsset.h.

Referenced by getBaseColorTextureHandle(), and setBaseColorTextureHandle().

◆ baseColorTexturePath

std::filesystem::path Engine::Assets::Material::baseColorTexturePath
protected

Path to base color texture from glTF.

Definition at line 180 of file MaterialAsset.h.

Referenced by getBaseColorTexturePath(), and setBaseColorTexturePath().

◆ emissiveTextureHandle_

Texture2DHandle Engine::Assets::Material::emissiveTextureHandle_
protected

Descriptor handle for the emissive texture slot.

Definition at line 190 of file MaterialAsset.h.

Referenced by getEmissiveTextureHandle(), and setEmissiveTextureHandle().

◆ emissiveTexturePath

std::filesystem::path Engine::Assets::Material::emissiveTexturePath
protected

Path to emissive texture from glTF.

Definition at line 183 of file MaterialAsset.h.

Referenced by getEmissiveTexturePath(), and setEmissiveTexturePath().

◆ lightmapTextureHandle_

Texture2DHandle Engine::Assets::Material::lightmapTextureHandle_
protected

Descriptor handle for the lightmap texture slot.

Definition at line 191 of file MaterialAsset.h.

Referenced by getLightmapTextureHandle(), and setLightmapTextureHandle().

◆ lightmapTexturePath

std::filesystem::path Engine::Assets::Material::lightmapTexturePath
protected

Path to lightmap texture from VulkanSchnee extension.

Definition at line 184 of file MaterialAsset.h.

Referenced by getLightmapTexturePath(), and setLightmapTexturePath().

◆ metallicRoughnessTextureHandle_

Texture2DHandle Engine::Assets::Material::metallicRoughnessTextureHandle_
protected

Descriptor handle for the metallic-roughness texture slot.

Definition at line 189 of file MaterialAsset.h.

Referenced by getMetallicRoughnessTextureHandle(), and setMetallicRoughnessTextureHandle().

◆ metallicRoughnessTexturePath

std::filesystem::path Engine::Assets::Material::metallicRoughnessTexturePath
protected

Path to metallic-roughness texture from glTF.

Definition at line 182 of file MaterialAsset.h.

Referenced by getMetallicRoughnessTexturePath(), and setMetallicRoughnessTexturePath().

◆ normalTextureHandle_

Texture2DHandle Engine::Assets::Material::normalTextureHandle_
protected

Descriptor handle for the normal texture slot.

Definition at line 188 of file MaterialAsset.h.

Referenced by getNormalTextureHandle(), and setNormalTextureHandle().

◆ normalTexturePath

std::filesystem::path Engine::Assets::Material::normalTexturePath
protected

Path to normal map texture from glTF.

Definition at line 181 of file MaterialAsset.h.

Referenced by getNormalTexturePath(), and setNormalTexturePath().

◆ type

Rendering::PipelineNames Engine::Assets::Material::type = DEFAULT_MATERIAL_PIPELINE
protected

Pipeline used to render this material.

Definition at line 179 of file MaterialAsset.h.

Referenced by getType().


The documentation for this class was generated from the following file:
  • /workspace/magerbeton/gl3-vulkan/code/Engine/include/Engine/Material/MaterialAsset.h