Vulkan Schnee 0.0.1
High-performance rendering engine
Loading...
Searching...
No Matches
EngineCore::MaterialAsset 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 EngineCore::MaterialAsset:
Collaboration diagram for EngineCore::MaterialAsset:

Public Member Functions

 MaterialAsset (const Asset::Path &assetPath, bool initWithDefaultData=false)
template<typename T>
T & getData ()
 Method to get the material data from the ecs with the corresponding type.
void unload () override
 Unload data.
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
const std::filesystem::path & getMetallicRoughnessTexturePath () const
const std::filesystem::path & getEmissiveTexturePath () const
const std::filesystem::path & getLightmapTexturePath () const
void setNormalTexturePath (const std::filesystem::path &path)
void setMetallicRoughnessTexturePath (const std::filesystem::path &path)
void setEmissiveTexturePath (const std::filesystem::path &path)
void setLightmapTexturePath (const std::filesystem::path &path)
AlbedoTextureHandle getBaseColorTextureHandle () const
 Get the type-safe base color texture handle.
NormalTextureHandle getNormalTextureHandle () const
 Get the type-safe normal texture handle.
MetallicRoughnessTextureHandle getMetallicRoughnessTextureHandle () const
 Get the type-safe metallic-roughness texture handle.
EmissiveTextureHandle getEmissiveTextureHandle () const
 Get the type-safe emissive texture handle.
LightmapTextureHandle getLightmapTextureHandle () const
 Get the type-safe lightmap texture handle.
void setBaseColorTextureHandle (AlbedoTextureHandle h)
 Set the base color texture handle (type-safe)
void setNormalTextureHandle (NormalTextureHandle h)
 Set the normal texture handle (type-safe)
void setMetallicRoughnessTextureHandle (MetallicRoughnessTextureHandle h)
 Set the metallic-roughness texture handle (type-safe)
void setEmissiveTextureHandle (EmissiveTextureHandle h)
 Set the emissive texture handle (type-safe)
void setLightmapTextureHandle (LightmapTextureHandle h)
 Set the lightmap texture handle (type-safe)
Public Member Functions inherited from Asset::AssetBase
 AssetBase (bool initializeDefaultEntity=false)
virtual ~AssetBase ()
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

PipelineNames type = NORMALS_SHADER
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.
AlbedoTextureHandle baseColorTextureHandle_
NormalTextureHandle normalTextureHandle_
MetallicRoughnessTextureHandle metallicRoughnessTextureHandle_
EmissiveTextureHandle emissiveTextureHandle_
LightmapTextureHandle lightmapTextureHandle_
Protected Attributes inherited from Asset::AssetBase
CpuLoadingState loadingState = UNLOADED
entt::registry & mainRegistry
entt::entity data

Friends

class Ecs::ModelAssetPipeline

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

Author
Konstantin Passig
Date
03.12.2025

Definition at line 20 of file MaterialAsset.h.

Constructor & Destructor Documentation

◆ MaterialAsset()

EngineCore::MaterialAsset::MaterialAsset ( const Asset::Path & assetPath,
bool initWithDefaultData = false )
explicit

Definition at line 6 of file MaterialAsset.cpp.

References Asset::AssetBase::AssetBase().

Here is the call graph for this function:

Member Function Documentation

◆ getBaseColorTextureHandle()

AlbedoTextureHandle EngineCore::MaterialAsset::getBaseColorTextureHandle ( ) const
inlinenodiscard

Get the type-safe base color texture handle.

Returns
Handle that can only be used for base color texture slots
Author
Konstantin Passig
Date
2026-01-22

Definition at line 87 of file MaterialAsset.h.

References baseColorTextureHandle_.

Referenced by EngineCore::RenderingDataManager::uploadMaterialBuffers().

Here is the caller graph for this function:

◆ getBaseColorTexturePath()

const std::filesystem::path & EngineCore::MaterialAsset::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
Author
Konstantin Passig
Date
19.12.2025

Definition at line 56 of file MaterialAsset.h.

References baseColorTexturePath.

Referenced by EngineCore::RenderingDataManager::uploadMaterialBuffers().

Here is the caller graph for this function:

◆ getData()

template<typename T>
T & EngineCore::MaterialAsset::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 180 of file MaterialAsset.h.

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

Referenced by EngineCore::RenderingDataManager::uploadMaterialBuffers().

Here is the caller graph for this function:

◆ getEmissiveTextureHandle()

EmissiveTextureHandle EngineCore::MaterialAsset::getEmissiveTextureHandle ( ) const
inlinenodiscard

Get the type-safe emissive texture handle.

Returns
Handle that can only be used for emissive texture slots
Author
Konstantin Passig
Date
2026-01-22

Definition at line 114 of file MaterialAsset.h.

References emissiveTextureHandle_.

Referenced by EngineCore::RenderingDataManager::uploadMaterialBuffers().

Here is the caller graph for this function:

◆ getEmissiveTexturePath()

const std::filesystem::path & EngineCore::MaterialAsset::getEmissiveTexturePath ( ) const
inlinenodiscard

Definition at line 70 of file MaterialAsset.h.

References emissiveTexturePath.

Referenced by EngineCore::RenderingDataManager::uploadMaterialBuffers().

Here is the caller graph for this function:

◆ getLightmapTextureHandle()

LightmapTextureHandle EngineCore::MaterialAsset::getLightmapTextureHandle ( ) const
inlinenodiscard

Get the type-safe lightmap texture handle.

Returns
Handle that can only be used for lightmap texture slots
Author
Konstantin Passig
Date
2026-01-22

Definition at line 123 of file MaterialAsset.h.

References lightmapTextureHandle_.

Referenced by EngineCore::RenderingDataManager::uploadMaterialBuffers().

Here is the caller graph for this function:

◆ getLightmapTexturePath()

const std::filesystem::path & EngineCore::MaterialAsset::getLightmapTexturePath ( ) const
inlinenodiscard

Definition at line 71 of file MaterialAsset.h.

References lightmapTexturePath.

Referenced by EngineCore::RenderingDataManager::uploadMaterialBuffers().

Here is the caller graph for this function:

◆ getMetallicRoughnessTextureHandle()

MetallicRoughnessTextureHandle EngineCore::MaterialAsset::getMetallicRoughnessTextureHandle ( ) const
inlinenodiscard

Get the type-safe metallic-roughness texture handle.

Returns
Handle that can only be used for metallic-roughness texture slots
Author
Konstantin Passig
Date
2026-01-22

Definition at line 105 of file MaterialAsset.h.

References metallicRoughnessTextureHandle_.

Referenced by EngineCore::RenderingDataManager::uploadMaterialBuffers().

Here is the caller graph for this function:

◆ getMetallicRoughnessTexturePath()

const std::filesystem::path & EngineCore::MaterialAsset::getMetallicRoughnessTexturePath ( ) const
inlinenodiscard

Definition at line 69 of file MaterialAsset.h.

References metallicRoughnessTexturePath.

Referenced by EngineCore::RenderingDataManager::uploadMaterialBuffers().

Here is the caller graph for this function:

◆ getNormalTextureHandle()

NormalTextureHandle EngineCore::MaterialAsset::getNormalTextureHandle ( ) const
inlinenodiscard

Get the type-safe normal texture handle.

Returns
Handle that can only be used for normal map texture slots
Author
Konstantin Passig
Date
2026-01-22

Definition at line 96 of file MaterialAsset.h.

References normalTextureHandle_.

Referenced by EngineCore::RenderingDataManager::uploadMaterialBuffers().

Here is the caller graph for this function:

◆ getNormalTexturePath()

const std::filesystem::path & EngineCore::MaterialAsset::getNormalTexturePath ( ) const
inlinenodiscard

Definition at line 68 of file MaterialAsset.h.

References normalTexturePath.

Referenced by EngineCore::RenderingDataManager::uploadMaterialBuffers().

Here is the caller graph for this function:

◆ getType()

PipelineNames EngineCore::MaterialAsset::getType ( ) const
inlinenodiscard

Gets the material type for pipeline lookup.

Returns
The MaterialNames enum value for this material
Author
Konstantin Passig
Date
2025-12-18

Definition at line 47 of file MaterialAsset.h.

References type.

Referenced by EngineCore::RenderingDataManager::uploadMaterialBuffers().

Here is the caller graph for this function:

◆ setBaseColorTextureHandle()

void EngineCore::MaterialAsset::setBaseColorTextureHandle ( AlbedoTextureHandle h)
inline

Set the base color texture handle (type-safe)

Parameters
hHandle of type AlbedoTextureHandle

Definition at line 129 of file MaterialAsset.h.

References baseColorTextureHandle_.

◆ setBaseColorTexturePath()

void EngineCore::MaterialAsset::setBaseColorTexturePath ( const std::filesystem::path & path)
inline

Sets the base color texture path for this material.

Parameters
pathPath to the texture file
Author
Konstantin Passig
Date
19.12.2025

Definition at line 65 of file MaterialAsset.h.

References baseColorTexturePath.

◆ setEmissiveTextureHandle()

void EngineCore::MaterialAsset::setEmissiveTextureHandle ( EmissiveTextureHandle h)
inline

Set the emissive texture handle (type-safe)

Parameters
hHandle of type EmissiveTextureHandle

Definition at line 147 of file MaterialAsset.h.

References emissiveTextureHandle_.

◆ setEmissiveTexturePath()

void EngineCore::MaterialAsset::setEmissiveTexturePath ( const std::filesystem::path & path)
inline

Definition at line 75 of file MaterialAsset.h.

References emissiveTexturePath.

◆ setLightmapTextureHandle()

void EngineCore::MaterialAsset::setLightmapTextureHandle ( LightmapTextureHandle h)
inline

Set the lightmap texture handle (type-safe)

Parameters
hHandle of type LightmapTextureHandle

Definition at line 153 of file MaterialAsset.h.

References lightmapTextureHandle_.

◆ setLightmapTexturePath()

void EngineCore::MaterialAsset::setLightmapTexturePath ( const std::filesystem::path & path)
inline

Definition at line 76 of file MaterialAsset.h.

References lightmapTexturePath.

◆ setMetallicRoughnessTextureHandle()

void EngineCore::MaterialAsset::setMetallicRoughnessTextureHandle ( MetallicRoughnessTextureHandle h)
inline

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

Parameters
hHandle of type MetallicRoughnessTextureHandle

Definition at line 141 of file MaterialAsset.h.

References metallicRoughnessTextureHandle_.

◆ setMetallicRoughnessTexturePath()

void EngineCore::MaterialAsset::setMetallicRoughnessTexturePath ( const std::filesystem::path & path)
inline

Definition at line 74 of file MaterialAsset.h.

References metallicRoughnessTexturePath.

◆ setNormalTextureHandle()

void EngineCore::MaterialAsset::setNormalTextureHandle ( NormalTextureHandle h)
inline

Set the normal texture handle (type-safe)

Parameters
hHandle of type NormalTextureHandle

Definition at line 135 of file MaterialAsset.h.

References normalTextureHandle_.

◆ setNormalTexturePath()

void EngineCore::MaterialAsset::setNormalTexturePath ( const std::filesystem::path & path)
inline

Definition at line 73 of file MaterialAsset.h.

References normalTexturePath.

◆ unload()

void EngineCore::MaterialAsset::unload ( )
overridevirtual

Unload data.

Reimplemented from Asset::AssetBase.

Definition at line 11 of file MaterialAsset.cpp.

References EngineCore::NORMALS_SHADER, and type.

◆ updateLoadingState()

void EngineCore::MaterialAsset::updateLoadingState ( )
overrideprotectedvirtual

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

Author
Konstantin Passig
Date
13.01.2026

Reimplemented from Asset::AssetBase.

Definition at line 17 of file MaterialAsset.cpp.

References Asset::AssetBase::data, Asset::LOADED, Asset::LOADING, Asset::AssetBase::loadingState, Asset::AssetBase::mainRegistry, and Asset::UNLOADED.

◆ Ecs::ModelAssetPipeline

friend class Ecs::ModelAssetPipeline
friend

Definition at line 21 of file MaterialAsset.h.

Member Data Documentation

◆ baseColorTextureHandle_

AlbedoTextureHandle EngineCore::MaterialAsset::baseColorTextureHandle_
protected

Definition at line 172 of file MaterialAsset.h.

Referenced by getBaseColorTextureHandle(), and setBaseColorTextureHandle().

◆ baseColorTexturePath

std::filesystem::path EngineCore::MaterialAsset::baseColorTexturePath
protected

Path to base color texture from glTF.

Definition at line 165 of file MaterialAsset.h.

Referenced by getBaseColorTexturePath(), and setBaseColorTexturePath().

◆ emissiveTextureHandle_

EmissiveTextureHandle EngineCore::MaterialAsset::emissiveTextureHandle_
protected

Definition at line 175 of file MaterialAsset.h.

Referenced by getEmissiveTextureHandle(), and setEmissiveTextureHandle().

◆ emissiveTexturePath

std::filesystem::path EngineCore::MaterialAsset::emissiveTexturePath
protected

Path to emissive texture from glTF.

Definition at line 168 of file MaterialAsset.h.

Referenced by getEmissiveTexturePath(), and setEmissiveTexturePath().

◆ lightmapTextureHandle_

LightmapTextureHandle EngineCore::MaterialAsset::lightmapTextureHandle_
protected

Definition at line 176 of file MaterialAsset.h.

Referenced by getLightmapTextureHandle(), and setLightmapTextureHandle().

◆ lightmapTexturePath

std::filesystem::path EngineCore::MaterialAsset::lightmapTexturePath
protected

Path to lightmap texture from VulkanSchnee extension.

Definition at line 169 of file MaterialAsset.h.

Referenced by getLightmapTexturePath(), and setLightmapTexturePath().

◆ metallicRoughnessTextureHandle_

MetallicRoughnessTextureHandle EngineCore::MaterialAsset::metallicRoughnessTextureHandle_
protected

◆ metallicRoughnessTexturePath

std::filesystem::path EngineCore::MaterialAsset::metallicRoughnessTexturePath
protected

Path to metallic-roughness texture from glTF.

Definition at line 167 of file MaterialAsset.h.

Referenced by getMetallicRoughnessTexturePath(), and setMetallicRoughnessTexturePath().

◆ normalTextureHandle_

NormalTextureHandle EngineCore::MaterialAsset::normalTextureHandle_
protected

Definition at line 173 of file MaterialAsset.h.

Referenced by getNormalTextureHandle(), and setNormalTextureHandle().

◆ normalTexturePath

std::filesystem::path EngineCore::MaterialAsset::normalTexturePath
protected

Path to normal map texture from glTF.

Definition at line 166 of file MaterialAsset.h.

Referenced by getNormalTexturePath(), and setNormalTexturePath().

◆ type

PipelineNames EngineCore::MaterialAsset::type = NORMALS_SHADER
protected

Definition at line 164 of file MaterialAsset.h.

Referenced by getType(), Ecs::ModelAssetPipeline::processMaterial(), and unload().


The documentation for this class was generated from the following files:
  • /home/magerbeton/Documents/gl3-vulkan/Engine/include/Engine/Material/MaterialAsset.h
  • /home/magerbeton/Documents/gl3-vulkan/Engine/src/Engine/Materials/MaterialAsset.cpp