Vulkan Schnee 0.0.1
High-performance rendering engine
Loading...
Searching...
No Matches
Engine::Assets::Loaders::GltfLoader::GltfMaterialData Struct Reference

Stores the material data which is relevant for our current set of shaders. More...

#include <GltfLoader.h>

Collaboration diagram for Engine::Assets::Loaders::GltfLoader::GltfMaterialData:

Public Member Functions

 GltfMaterialData ()=default
 GltfMaterialData (const tinygltf::Model &model, const tinygltf::Material &material, const StaticMeshExtensions &meshSettings)
bool hasTexture () const
 Checks whether the material references a base color texture.
uint32_t getTextureIndex () const
 Gets the engine texture index for the base color texture.
bool hasVulkanSchneeExtension () const
 Checks whether the material has a Vulkan Schnee material extension.
const VulkanSchneeMaterialExtensiongetVulkanSchneeExtension () const
 Gets the parsed Vulkan Schnee material extension.
std::string getShaderName () const
 Gets the shader name selected for this material.
const Materials::MaterialDatagetMaterialData () const
 Gets immutable engine material data generated from glTF and extension data.
Materials::MaterialDatagetMaterialDataRef ()
 Gets mutable engine material data generated from glTF and extension data.
uint32_t getNormalTextureIndex () const
 Gets the engine normal texture index.
uint32_t getRoughnessMetallicTextureIndex () const
 Gets the engine metallic-roughness texture index.
uint32_t getEmissiveTextureIndex () const
 Gets the engine emissive texture index.
float getRoughnessFactor () const
 Gets the glTF roughness factor.
float getMetallicFactor () const
 Gets the glTF metallic factor.
float getNormalScale () const
 Gets the normal map scale.
glm::vec3 getEmissiveFactor () const
 Gets the emissive factor.
bool hasNormalTexture () const
 Checks whether the glTF material references a normal texture.
bool hasMetallicRoughnessTexture () const
 Checks whether the glTF material references a metallic-roughness texture.
bool hasEmissiveTexture () const
 Checks whether the glTF material references an emissive texture.
int32_t getGltfNormalTextureIndex () const
 Gets the original glTF normal texture index.
int32_t getGltfMetallicRoughnessTextureIndex () const
 Gets the original glTF metallic-roughness texture index.
int32_t getGltfEmissiveTextureIndex () const
 Gets the original glTF emissive texture index.
bool hasLightmapTexture () const
 Checks whether this material uses a lightmap texture path.
const std::filesystem::path & getLightmapPath () const
 Gets the lightmap texture path from the engine extension.

Private Member Functions

void setupMaterialData ()
void parsePbrData (const tinygltf::Model &model, const tinygltf::Material &material)

Private Attributes

Materials::MaterialData materialData
std::optional< MaterialExtensionsmaterialExtensions
glm::vec4 baseColorFactor = glm::vec4( 0.0f, 0.0f, 0.0f, 0.0f )
uint32_t textureIndex = std::numeric_limits<uint32_t>::max()
uint32_t normalTextureIndex = 0xFFFFFFFF
uint32_t roughnessMetallicTextureIndex = 0xFFFFFFFF
uint32_t emissiveTextureIndex = 0xFFFFFFFF
float roughnessFactor = 1.0f
float metallicFactor = 0.0f
float normalScale = 1.0f
glm::vec3 emissiveFactor = glm::vec3( 0.0f )
int32_t gltfNormalTextureIndex = -1
int32_t gltfMetallicRoughnessTextureIndex = -1
int32_t gltfEmissiveTextureIndex = -1
std::filesystem::path lightmapPath

Detailed Description

Stores the material data which is relevant for our current set of shaders.

Extended with PBR texture indices and material factors for physically-based rendering.

Date
2025-05-31 (original), 2026-01-21 (PBR extension)
Author
Konstantin Passig

Definition at line 504 of file GltfLoader.h.

Constructor & Destructor Documentation

◆ GltfMaterialData() [1/2]

Engine::Assets::Loaders::GltfLoader::GltfMaterialData::GltfMaterialData ( )
default

◆ GltfMaterialData() [2/2]

Engine::Assets::Loaders::GltfLoader::GltfMaterialData::GltfMaterialData ( const tinygltf::Model & model,
const tinygltf::Material & material,
const StaticMeshExtensions & meshSettings )

Member Function Documentation

◆ getEmissiveFactor()

glm::vec3 Engine::Assets::Loaders::GltfLoader::GltfMaterialData::getEmissiveFactor ( ) const
inlinenodiscard

Gets the emissive factor.

Returns
RGB emissive factor from the glTF material.

Definition at line 620 of file GltfLoader.h.

References emissiveFactor.

◆ getEmissiveTextureIndex()

uint32_t Engine::Assets::Loaders::GltfLoader::GltfMaterialData::getEmissiveTextureIndex ( ) const
inlinenodiscard

Gets the engine emissive texture index.

Returns
Texture index, or 0xFFFFFFFF when no emissive texture is present.

Definition at line 584 of file GltfLoader.h.

References emissiveTextureIndex.

◆ getGltfEmissiveTextureIndex()

int32_t Engine::Assets::Loaders::GltfLoader::GltfMaterialData::getGltfEmissiveTextureIndex ( ) const
inlinenodiscard

Gets the original glTF emissive texture index.

Returns
glTF texture index, or -1 when no emissive texture is present.

Definition at line 674 of file GltfLoader.h.

References gltfEmissiveTextureIndex.

◆ getGltfMetallicRoughnessTextureIndex()

int32_t Engine::Assets::Loaders::GltfLoader::GltfMaterialData::getGltfMetallicRoughnessTextureIndex ( ) const
inlinenodiscard

Gets the original glTF metallic-roughness texture index.

Returns
glTF texture index, or -1 when no metallic-roughness texture is present.

Definition at line 665 of file GltfLoader.h.

References gltfMetallicRoughnessTextureIndex.

◆ getGltfNormalTextureIndex()

int32_t Engine::Assets::Loaders::GltfLoader::GltfMaterialData::getGltfNormalTextureIndex ( ) const
inlinenodiscard

Gets the original glTF normal texture index.

Returns
glTF texture index, or -1 when no normal texture is present.

Definition at line 656 of file GltfLoader.h.

References gltfNormalTextureIndex.

◆ getLightmapPath()

const std::filesystem::path & Engine::Assets::Loaders::GltfLoader::GltfMaterialData::getLightmapPath ( ) const
inlinenodiscard

Gets the lightmap texture path from the engine extension.

Returns
Lightmap path, or an empty path when no lightmap is present.

Definition at line 692 of file GltfLoader.h.

References lightmapPath.

◆ getMaterialData()

const Materials::MaterialData & Engine::Assets::Loaders::GltfLoader::GltfMaterialData::getMaterialData ( ) const
inlinenodiscard

Gets immutable engine material data generated from glTF and extension data.

Returns
Material data used by the renderer.

Definition at line 548 of file GltfLoader.h.

References materialData.

◆ getMaterialDataRef()

Materials::MaterialData & Engine::Assets::Loaders::GltfLoader::GltfMaterialData::getMaterialDataRef ( )
inlinenodiscard

Gets mutable engine material data generated from glTF and extension data.

Returns
Mutable material data used by the renderer.

Definition at line 557 of file GltfLoader.h.

References materialData.

◆ getMetallicFactor()

float Engine::Assets::Loaders::GltfLoader::GltfMaterialData::getMetallicFactor ( ) const
inlinenodiscard

Gets the glTF metallic factor.

Returns
Metallic factor from pbrMetallicRoughness.

Definition at line 602 of file GltfLoader.h.

References metallicFactor.

◆ getNormalScale()

float Engine::Assets::Loaders::GltfLoader::GltfMaterialData::getNormalScale ( ) const
inlinenodiscard

Gets the normal map scale.

Returns
Scale value from the glTF normal texture info.

Definition at line 611 of file GltfLoader.h.

References normalScale.

◆ getNormalTextureIndex()

uint32_t Engine::Assets::Loaders::GltfLoader::GltfMaterialData::getNormalTextureIndex ( ) const
inlinenodiscard

Gets the engine normal texture index.

Returns
Texture index, or 0xFFFFFFFF when no normal texture is present.

Definition at line 566 of file GltfLoader.h.

References normalTextureIndex.

◆ getRoughnessFactor()

float Engine::Assets::Loaders::GltfLoader::GltfMaterialData::getRoughnessFactor ( ) const
inlinenodiscard

Gets the glTF roughness factor.

Returns
Roughness factor from pbrMetallicRoughness.

Definition at line 593 of file GltfLoader.h.

References roughnessFactor.

◆ getRoughnessMetallicTextureIndex()

uint32_t Engine::Assets::Loaders::GltfLoader::GltfMaterialData::getRoughnessMetallicTextureIndex ( ) const
inlinenodiscard

Gets the engine metallic-roughness texture index.

Returns
Texture index, or 0xFFFFFFFF when no metallic-roughness texture is present.

Definition at line 575 of file GltfLoader.h.

References roughnessMetallicTextureIndex.

◆ getShaderName()

std::string Engine::Assets::Loaders::GltfLoader::GltfMaterialData::getShaderName ( ) const
nodiscard

Gets the shader name selected for this material.

Returns
Shader identifier used by the material pipeline.

◆ getTextureIndex()

uint32_t Engine::Assets::Loaders::GltfLoader::GltfMaterialData::getTextureIndex ( ) const
nodiscard

Gets the engine texture index for the base color texture.

Returns
Texture index, or std::numeric_limits<uint32_t>::max() when no texture is present.

◆ getVulkanSchneeExtension()

const VulkanSchneeMaterialExtension & Engine::Assets::Loaders::GltfLoader::GltfMaterialData::getVulkanSchneeExtension ( ) const
nodiscard

Gets the parsed Vulkan Schnee material extension.

Returns
Parsed extension data.

◆ hasEmissiveTexture()

bool Engine::Assets::Loaders::GltfLoader::GltfMaterialData::hasEmissiveTexture ( ) const
inlinenodiscard

Checks whether the glTF material references an emissive texture.

Returns
True when the original glTF emissive texture index is present.

Definition at line 647 of file GltfLoader.h.

References gltfEmissiveTextureIndex.

◆ hasLightmapTexture()

bool Engine::Assets::Loaders::GltfLoader::GltfMaterialData::hasLightmapTexture ( ) const
inlinenodiscard

Checks whether this material uses a lightmap texture path.

Returns
True when the lightmap path is non-empty.

Definition at line 683 of file GltfLoader.h.

References lightmapPath.

◆ hasMetallicRoughnessTexture()

bool Engine::Assets::Loaders::GltfLoader::GltfMaterialData::hasMetallicRoughnessTexture ( ) const
inlinenodiscard

Checks whether the glTF material references a metallic-roughness texture.

Returns
True when the original glTF metallic-roughness texture index is present.

Definition at line 638 of file GltfLoader.h.

References gltfMetallicRoughnessTextureIndex.

◆ hasNormalTexture()

bool Engine::Assets::Loaders::GltfLoader::GltfMaterialData::hasNormalTexture ( ) const
inlinenodiscard

Checks whether the glTF material references a normal texture.

Returns
True when the original glTF normal texture index is present.

Definition at line 629 of file GltfLoader.h.

References gltfNormalTextureIndex.

◆ hasTexture()

bool Engine::Assets::Loaders::GltfLoader::GltfMaterialData::hasTexture ( ) const
nodiscard

Checks whether the material references a base color texture.

Returns
True when a base color texture index is present.

◆ hasVulkanSchneeExtension()

bool Engine::Assets::Loaders::GltfLoader::GltfMaterialData::hasVulkanSchneeExtension ( ) const
nodiscard

Checks whether the material has a Vulkan Schnee material extension.

Returns
True when the extension was parsed successfully.

◆ parsePbrData()

void Engine::Assets::Loaders::GltfLoader::GltfMaterialData::parsePbrData ( const tinygltf::Model & model,
const tinygltf::Material & material )
private

◆ setupMaterialData()

void Engine::Assets::Loaders::GltfLoader::GltfMaterialData::setupMaterialData ( )
private

Member Data Documentation

◆ baseColorFactor

glm::vec4 Engine::Assets::Loaders::GltfLoader::GltfMaterialData::baseColorFactor = glm::vec4( 0.0f, 0.0f, 0.0f, 0.0f )
private

Definition at line 704 of file GltfLoader.h.

◆ emissiveFactor

glm::vec3 Engine::Assets::Loaders::GltfLoader::GltfMaterialData::emissiveFactor = glm::vec3( 0.0f )
private

Definition at line 716 of file GltfLoader.h.

Referenced by getEmissiveFactor().

◆ emissiveTextureIndex

uint32_t Engine::Assets::Loaders::GltfLoader::GltfMaterialData::emissiveTextureIndex = 0xFFFFFFFF
private

Definition at line 710 of file GltfLoader.h.

Referenced by getEmissiveTextureIndex().

◆ gltfEmissiveTextureIndex

int32_t Engine::Assets::Loaders::GltfLoader::GltfMaterialData::gltfEmissiveTextureIndex = -1
private

Definition at line 721 of file GltfLoader.h.

Referenced by getGltfEmissiveTextureIndex(), and hasEmissiveTexture().

◆ gltfMetallicRoughnessTextureIndex

int32_t Engine::Assets::Loaders::GltfLoader::GltfMaterialData::gltfMetallicRoughnessTextureIndex = -1
private

◆ gltfNormalTextureIndex

int32_t Engine::Assets::Loaders::GltfLoader::GltfMaterialData::gltfNormalTextureIndex = -1
private

Definition at line 719 of file GltfLoader.h.

Referenced by getGltfNormalTextureIndex(), and hasNormalTexture().

◆ lightmapPath

std::filesystem::path Engine::Assets::Loaders::GltfLoader::GltfMaterialData::lightmapPath
private

Definition at line 724 of file GltfLoader.h.

Referenced by getLightmapPath(), and hasLightmapTexture().

◆ materialData

Materials::MaterialData Engine::Assets::Loaders::GltfLoader::GltfMaterialData::materialData
private

Definition at line 701 of file GltfLoader.h.

Referenced by getMaterialData(), and getMaterialDataRef().

◆ materialExtensions

std::optional<MaterialExtensions> Engine::Assets::Loaders::GltfLoader::GltfMaterialData::materialExtensions
private

Definition at line 703 of file GltfLoader.h.

◆ metallicFactor

float Engine::Assets::Loaders::GltfLoader::GltfMaterialData::metallicFactor = 0.0f
private

Definition at line 714 of file GltfLoader.h.

Referenced by getMetallicFactor().

◆ normalScale

float Engine::Assets::Loaders::GltfLoader::GltfMaterialData::normalScale = 1.0f
private

Definition at line 715 of file GltfLoader.h.

Referenced by getNormalScale().

◆ normalTextureIndex

uint32_t Engine::Assets::Loaders::GltfLoader::GltfMaterialData::normalTextureIndex = 0xFFFFFFFF
private

Definition at line 708 of file GltfLoader.h.

Referenced by getNormalTextureIndex().

◆ roughnessFactor

float Engine::Assets::Loaders::GltfLoader::GltfMaterialData::roughnessFactor = 1.0f
private

Definition at line 713 of file GltfLoader.h.

Referenced by getRoughnessFactor().

◆ roughnessMetallicTextureIndex

uint32_t Engine::Assets::Loaders::GltfLoader::GltfMaterialData::roughnessMetallicTextureIndex = 0xFFFFFFFF
private

Definition at line 709 of file GltfLoader.h.

Referenced by getRoughnessMetallicTextureIndex().

◆ textureIndex

uint32_t Engine::Assets::Loaders::GltfLoader::GltfMaterialData::textureIndex = std::numeric_limits<uint32_t>::max()
private

Definition at line 705 of file GltfLoader.h.


The documentation for this struct was generated from the following file:
  • /home/magerbeton/Documents/gl3-vulkan/Engine/include/Engine/Mesh/GltfLoader.h