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

Material data extracted from a glTF material and engine extensions. More...

#include <GltfLoader.h>

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

Public Member Functions

 GltfMaterialData ()=default
 Creates default material data with no parsed source material.
 GltfMaterialData (const tinygltf::Model &model, const tinygltf::Material &material, const StaticMeshExtensions &meshSettings)
 Parses material data from glTF and engine extension metadata.
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 VulkanSchneeMaterialExtension & getVulkanSchneeExtension () const
 Gets the parsed Vulkan Schnee material extension.
std::string getShaderName () const
 Gets the shader name selected for this material.
const Materials::MaterialData & getMaterialData () const
 Gets immutable engine material data generated from glTF and extension data.
Materials::MaterialData & getMaterialDataRef ()
 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< MaterialExtensions > materialExtensions
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

Material data extracted from a glTF material and engine extensions.

The object stores standard glTF PBR factors and texture indices, optional Vulkan Schnee material extension data, and the renderer-facing Materials::MaterialData built from those inputs.

Definition at line 831 of file GltfLoader.h.

Constructor & Destructor Documentation

◆ GltfMaterialData() [1/2]

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

Creates default material data with no parsed source material.

◆ GltfMaterialData() [2/2]

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

Parses material data from glTF and engine extension metadata.

Parameters
modelSource glTF model that owns texture records referenced by the material.
materialglTF material to parse.
meshSettingsParsed node or mesh extension data used for lightmap material handling.
Exceptions
std::runtime_errorWhen baseColorFactor is present but does not contain RGBA data.

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 958 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 922 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 1012 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 1003 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 994 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 1030 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 886 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 895 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 940 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 949 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 904 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 931 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 913 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.
Exceptions
std::runtime_errorWhen this material has no parsed Vulkan Schnee material extension.

◆ 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 985 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 1021 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 976 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 967 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 1042 of file GltfLoader.h.

◆ emissiveFactor

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

Definition at line 1054 of file GltfLoader.h.

Referenced by getEmissiveFactor().

◆ emissiveTextureIndex

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

Definition at line 1048 of file GltfLoader.h.

Referenced by getEmissiveTextureIndex().

◆ gltfEmissiveTextureIndex

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

Definition at line 1059 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 1057 of file GltfLoader.h.

Referenced by getGltfNormalTextureIndex(), and hasNormalTexture().

◆ lightmapPath

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

Definition at line 1062 of file GltfLoader.h.

Referenced by getLightmapPath(), and hasLightmapTexture().

◆ materialData

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

Definition at line 1039 of file GltfLoader.h.

Referenced by getMaterialData(), and getMaterialDataRef().

◆ materialExtensions

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

Definition at line 1041 of file GltfLoader.h.

◆ metallicFactor

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

Definition at line 1052 of file GltfLoader.h.

Referenced by getMetallicFactor().

◆ normalScale

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

Definition at line 1053 of file GltfLoader.h.

Referenced by getNormalScale().

◆ normalTextureIndex

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

Definition at line 1046 of file GltfLoader.h.

Referenced by getNormalTextureIndex().

◆ roughnessFactor

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

Definition at line 1051 of file GltfLoader.h.

Referenced by getRoughnessFactor().

◆ roughnessMetallicTextureIndex

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

Definition at line 1047 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 1043 of file GltfLoader.h.


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