Vulkan Schnee 0.0.1
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::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.
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
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

Rendering::PipelineNames type = DEFAULT_MATERIAL_PIPELINE
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

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::Path & assetPath,
bool initWithDefaultData = false )
explicit

Member Function Documentation

◆ getBaseColorTextureHandle()

AlbedoTextureHandle 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 78 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 53 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 156 of file MaterialAsset.h.

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

◆ getEmissiveTextureHandle()

EmissiveTextureHandle 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 96 of file MaterialAsset.h.

References emissiveTextureHandle_.

◆ getEmissiveTexturePath()

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

Definition at line 64 of file MaterialAsset.h.

References emissiveTexturePath.

◆ getLightmapTextureHandle()

LightmapTextureHandle 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 102 of file MaterialAsset.h.

References lightmapTextureHandle_.

◆ getLightmapTexturePath()

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

Definition at line 65 of file MaterialAsset.h.

References lightmapTexturePath.

◆ getMetallicRoughnessTextureHandle()

MetallicRoughnessTextureHandle 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 90 of file MaterialAsset.h.

References metallicRoughnessTextureHandle_.

◆ getMetallicRoughnessTexturePath()

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

Definition at line 63 of file MaterialAsset.h.

References metallicRoughnessTexturePath.

◆ getNormalTextureHandle()

NormalTextureHandle 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 84 of file MaterialAsset.h.

References normalTextureHandle_.

◆ getNormalTexturePath()

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

Definition at line 62 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 47 of file MaterialAsset.h.

References type.

◆ setBaseColorTextureHandle()

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

Set the base color texture handle (type-safe)

Parameters
hHandle of type AlbedoTextureHandle

Definition at line 108 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 59 of file MaterialAsset.h.

References baseColorTexturePath.

◆ setEmissiveTextureHandle()

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

Set the emissive texture handle (type-safe)

Parameters
hHandle of type EmissiveTextureHandle

Definition at line 126 of file MaterialAsset.h.

References emissiveTextureHandle_.

◆ setEmissiveTexturePath()

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

Definition at line 69 of file MaterialAsset.h.

References emissiveTexturePath.

◆ setLightmapTextureHandle()

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

Set the lightmap texture handle (type-safe)

Parameters
hHandle of type LightmapTextureHandle

Definition at line 132 of file MaterialAsset.h.

References lightmapTextureHandle_.

◆ setLightmapTexturePath()

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

Definition at line 70 of file MaterialAsset.h.

References lightmapTexturePath.

◆ setMetallicRoughnessTextureHandle()

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

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

Parameters
hHandle of type MetallicRoughnessTextureHandle

Definition at line 120 of file MaterialAsset.h.

References metallicRoughnessTextureHandle_.

◆ setMetallicRoughnessTexturePath()

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

Definition at line 68 of file MaterialAsset.h.

References metallicRoughnessTexturePath.

◆ setNormalTextureHandle()

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

Set the normal texture handle (type-safe)

Parameters
hHandle of type NormalTextureHandle

Definition at line 114 of file MaterialAsset.h.

References normalTextureHandle_.

◆ setNormalTexturePath()

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

Definition at line 67 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_

AlbedoTextureHandle Engine::Assets::Material::baseColorTextureHandle_
protected

Definition at line 148 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 141 of file MaterialAsset.h.

Referenced by getBaseColorTexturePath(), and setBaseColorTexturePath().

◆ emissiveTextureHandle_

EmissiveTextureHandle Engine::Assets::Material::emissiveTextureHandle_
protected

Definition at line 151 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 144 of file MaterialAsset.h.

Referenced by getEmissiveTexturePath(), and setEmissiveTexturePath().

◆ lightmapTextureHandle_

LightmapTextureHandle Engine::Assets::Material::lightmapTextureHandle_
protected

Definition at line 152 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 145 of file MaterialAsset.h.

Referenced by getLightmapTexturePath(), and setLightmapTexturePath().

◆ metallicRoughnessTextureHandle_

MetallicRoughnessTextureHandle Engine::Assets::Material::metallicRoughnessTextureHandle_
protected

◆ metallicRoughnessTexturePath

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

Path to metallic-roughness texture from glTF.

Definition at line 143 of file MaterialAsset.h.

Referenced by getMetallicRoughnessTexturePath(), and setMetallicRoughnessTexturePath().

◆ normalTextureHandle_

NormalTextureHandle Engine::Assets::Material::normalTextureHandle_
protected

Definition at line 149 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 142 of file MaterialAsset.h.

Referenced by getNormalTexturePath(), and setNormalTexturePath().

◆ type

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

Definition at line 140 of file MaterialAsset.h.

Referenced by getType().


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