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

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

#include <GltfLoader.h>

Collaboration diagram for EngineCore::GltfLoader::GltfMaterialData:

Public Member Functions

 GltfMaterialData ()=default
 GltfMaterialData (const tinygltf::Model &model, const tinygltf::Material &material, const StaticMeshExtensions &meshSettings)
tinygltf::Material getMaterial () const
bool hasTexture () const
uint32_t getTextureIndex () const
GltfTextureData getTextureData () const
bool hasVulkanSchneeExtension () const
const VulkanSchneeMaterialExtensiongetVulkanSchneeExtension () const
std::string getShaderName () const
template<typename T>
getMaterialData () const
std::variant< NormalMaterialData, DiffuseFlatColorMaterialData, DiffuseShaderMaterialData, MovableDiffuseShaderMaterialData, L0ShaderMaterialData, L1ShaderMaterialData, L2ShaderMaterialData, DynamicTexturesMaterialData, StaticLightmapMaterialDatagetMaterialDataRaw () const
uint32_t getNormalTextureIndex () const
uint32_t getRoughnessMetallicTextureIndex () const
uint32_t getEmissiveTextureIndex () const
float getRoughnessFactor () const
float getMetallicFactor () const
float getNormalScale () const
glm::vec3 getEmissiveFactor () const
bool hasNormalTexture () const
bool hasMetallicRoughnessTexture () const
bool hasEmissiveTexture () const
const GltfTextureDatagetNormalTextureData () const
const GltfTextureDatagetMetallicRoughnessTextureData () const
const GltfTextureDatagetEmissiveTextureData () const
int32_t getGltfNormalTextureIndex () const
int32_t getGltfMetallicRoughnessTextureIndex () const
int32_t getGltfEmissiveTextureIndex () const
bool hasLightmapTexture () const
const std::filesystem::path & getLightmapPath () const
const GltfTextureDatagetLightmapTextureData () const

Private Member Functions

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

Private Attributes

std::variant< NormalMaterialData, DiffuseFlatColorMaterialData, DiffuseShaderMaterialData, MovableDiffuseShaderMaterialData, L0ShaderMaterialData, L1ShaderMaterialData, L2ShaderMaterialData, DynamicTexturesMaterialData, StaticLightmapMaterialDatamaterialData
std::optional< MaterialExtensionsmaterialExtensions
tinygltf::Material material = tinygltf::Material()
glm::vec4 baseColorFactor = glm::vec4(0.0f, 0.0f, 0.0f, 0.0f)
uint32_t textureIndex = std::numeric_limits<uint32_t>::max()
GltfTextureData textureData = GltfTextureData()
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)
GltfTextureData normalTextureData
GltfTextureData metallicRoughnessTextureData
GltfTextureData emissiveTextureData
int32_t gltfNormalTextureIndex = -1
int32_t gltfMetallicRoughnessTextureIndex = -1
int32_t gltfEmissiveTextureIndex = -1
std::filesystem::path lightmapPath
GltfTextureData lightmapTextureData

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 232 of file GltfLoader.h.

Constructor & Destructor Documentation

◆ GltfMaterialData() [1/2]

EngineCore::GltfLoader::GltfMaterialData::GltfMaterialData ( )
default

References material.

◆ GltfMaterialData() [2/2]

EngineCore::GltfLoader::GltfMaterialData::GltfMaterialData ( const tinygltf::Model & model,
const tinygltf::Material & material,
const StaticMeshExtensions & meshSettings )

Definition at line 343 of file GltfLoader.cpp.

References baseColorFactor, lightmapPath, lightmapTextureData, EngineCore::ExrLoader::load(), material, materialExtensions, parsePbrData(), setupMaterialData(), textureData, textureIndex, TRACY_ZONE_SCOPED_NAMED, and EngineCore::GltfLoader::StaticMeshExtensions::vulkanSchneeExtension.

Here is the call graph for this function:

Member Function Documentation

◆ getEmissiveFactor()

glm::vec3 EngineCore::GltfLoader::GltfMaterialData::getEmissiveFactor ( ) const
inlinenodiscard

Definition at line 276 of file GltfLoader.h.

References emissiveFactor.

◆ getEmissiveTextureData()

const GltfTextureData & EngineCore::GltfLoader::GltfMaterialData::getEmissiveTextureData ( ) const
inlinenodiscard

Definition at line 284 of file GltfLoader.h.

References emissiveTextureData.

◆ getEmissiveTextureIndex()

uint32_t EngineCore::GltfLoader::GltfMaterialData::getEmissiveTextureIndex ( ) const
inlinenodiscard

Definition at line 270 of file GltfLoader.h.

References emissiveTextureIndex.

◆ getGltfEmissiveTextureIndex()

int32_t EngineCore::GltfLoader::GltfMaterialData::getGltfEmissiveTextureIndex ( ) const
inlinenodiscard

Definition at line 287 of file GltfLoader.h.

References gltfEmissiveTextureIndex.

◆ getGltfMetallicRoughnessTextureIndex()

int32_t EngineCore::GltfLoader::GltfMaterialData::getGltfMetallicRoughnessTextureIndex ( ) const
inlinenodiscard

Definition at line 286 of file GltfLoader.h.

References gltfMetallicRoughnessTextureIndex.

◆ getGltfNormalTextureIndex()

int32_t EngineCore::GltfLoader::GltfMaterialData::getGltfNormalTextureIndex ( ) const
inlinenodiscard

Definition at line 285 of file GltfLoader.h.

References gltfNormalTextureIndex.

◆ getLightmapPath()

const std::filesystem::path & EngineCore::GltfLoader::GltfMaterialData::getLightmapPath ( ) const
inlinenodiscard

Definition at line 291 of file GltfLoader.h.

References lightmapPath.

◆ getLightmapTextureData()

const GltfTextureData & EngineCore::GltfLoader::GltfMaterialData::getLightmapTextureData ( ) const
inlinenodiscard

Definition at line 292 of file GltfLoader.h.

References lightmapTextureData.

◆ getMaterial()

tinygltf::Material EngineCore::GltfLoader::GltfMaterialData::getMaterial ( ) const
inlinenodiscard

Definition at line 238 of file GltfLoader.h.

References material.

◆ getMaterialData()

template<typename T>
T EngineCore::GltfLoader::GltfMaterialData::getMaterialData ( ) const

Definition at line 475 of file GltfLoader.h.

References materialData.

◆ getMaterialDataRaw()

◆ getMetallicFactor()

float EngineCore::GltfLoader::GltfMaterialData::getMetallicFactor ( ) const
inlinenodiscard

Definition at line 274 of file GltfLoader.h.

References metallicFactor.

◆ getMetallicRoughnessTextureData()

const GltfTextureData & EngineCore::GltfLoader::GltfMaterialData::getMetallicRoughnessTextureData ( ) const
inlinenodiscard

Definition at line 283 of file GltfLoader.h.

References metallicRoughnessTextureData.

◆ getNormalScale()

float EngineCore::GltfLoader::GltfMaterialData::getNormalScale ( ) const
inlinenodiscard

Definition at line 275 of file GltfLoader.h.

References normalScale.

◆ getNormalTextureData()

const GltfTextureData & EngineCore::GltfLoader::GltfMaterialData::getNormalTextureData ( ) const
inlinenodiscard

Definition at line 282 of file GltfLoader.h.

References normalTextureData.

◆ getNormalTextureIndex()

uint32_t EngineCore::GltfLoader::GltfMaterialData::getNormalTextureIndex ( ) const
inlinenodiscard

Definition at line 268 of file GltfLoader.h.

References normalTextureIndex.

◆ getRoughnessFactor()

float EngineCore::GltfLoader::GltfMaterialData::getRoughnessFactor ( ) const
inlinenodiscard

Definition at line 273 of file GltfLoader.h.

References roughnessFactor.

◆ getRoughnessMetallicTextureIndex()

uint32_t EngineCore::GltfLoader::GltfMaterialData::getRoughnessMetallicTextureIndex ( ) const
inlinenodiscard

Definition at line 269 of file GltfLoader.h.

References roughnessMetallicTextureIndex.

◆ getShaderName()

std::string EngineCore::GltfLoader::GltfMaterialData::getShaderName ( ) const
nodiscard

Definition at line 503 of file GltfLoader.cpp.

References getVulkanSchneeExtension(), and hasVulkanSchneeExtension().

Here is the call graph for this function:

◆ getTextureData()

GltfLoader::GltfTextureData EngineCore::GltfLoader::GltfMaterialData::getTextureData ( ) const
nodiscard

Definition at line 487 of file GltfLoader.cpp.

References textureData.

Referenced by EngineCore::Texture::createTexturePath().

Here is the caller graph for this function:

◆ getTextureIndex()

uint32_t EngineCore::GltfLoader::GltfMaterialData::getTextureIndex ( ) const
nodiscard

Definition at line 483 of file GltfLoader.cpp.

References textureIndex.

Referenced by setupMaterialData().

Here is the caller graph for this function:

◆ getVulkanSchneeExtension()

const GltfLoader::VulkanSchneeMaterialExtension & EngineCore::GltfLoader::GltfMaterialData::getVulkanSchneeExtension ( ) const
nodiscard

Definition at line 496 of file GltfLoader.cpp.

References hasVulkanSchneeExtension(), and materialExtensions.

Referenced by getShaderName().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ hasEmissiveTexture()

bool EngineCore::GltfLoader::GltfMaterialData::hasEmissiveTexture ( ) const
inlinenodiscard

Definition at line 281 of file GltfLoader.h.

References gltfEmissiveTextureIndex.

◆ hasLightmapTexture()

bool EngineCore::GltfLoader::GltfMaterialData::hasLightmapTexture ( ) const
inlinenodiscard

Definition at line 290 of file GltfLoader.h.

References lightmapPath.

◆ hasMetallicRoughnessTexture()

bool EngineCore::GltfLoader::GltfMaterialData::hasMetallicRoughnessTexture ( ) const
inlinenodiscard

Definition at line 280 of file GltfLoader.h.

References gltfMetallicRoughnessTextureIndex.

◆ hasNormalTexture()

bool EngineCore::GltfLoader::GltfMaterialData::hasNormalTexture ( ) const
inlinenodiscard

Definition at line 279 of file GltfLoader.h.

References gltfNormalTextureIndex.

◆ hasTexture()

bool EngineCore::GltfLoader::GltfMaterialData::hasTexture ( ) const
nodiscard

Definition at line 479 of file GltfLoader.cpp.

References textureIndex.

Referenced by EngineCore::MeshPrimitive::MeshPrimitive().

Here is the caller graph for this function:

◆ hasVulkanSchneeExtension()

bool EngineCore::GltfLoader::GltfMaterialData::hasVulkanSchneeExtension ( ) const
nodiscard

Definition at line 491 of file GltfLoader.cpp.

References materialExtensions.

Referenced by getShaderName(), getVulkanSchneeExtension(), and EngineCore::MeshPrimitive::MeshPrimitive().

Here is the caller graph for this function:

◆ parsePbrData()

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

Definition at line 423 of file GltfLoader.cpp.

References emissiveFactor, emissiveTextureData, gltfEmissiveTextureIndex, gltfMetallicRoughnessTextureIndex, gltfNormalTextureIndex, material, metallicFactor, metallicRoughnessTextureData, normalScale, normalTextureData, and roughnessFactor.

Referenced by GltfMaterialData().

Here is the caller graph for this function:

◆ setupMaterialData()

void EngineCore::GltfLoader::GltfMaterialData::setupMaterialData ( )
private

Member Data Documentation

◆ baseColorFactor

glm::vec4 EngineCore::GltfLoader::GltfMaterialData::baseColorFactor = glm::vec4(0.0f, 0.0f, 0.0f, 0.0f)
private

Definition at line 312 of file GltfLoader.h.

Referenced by GltfMaterialData(), and setupMaterialData().

◆ emissiveFactor

glm::vec3 EngineCore::GltfLoader::GltfMaterialData::emissiveFactor = glm::vec3(0.0f)
private

Definition at line 325 of file GltfLoader.h.

Referenced by getEmissiveFactor(), parsePbrData(), and setupMaterialData().

◆ emissiveTextureData

GltfTextureData EngineCore::GltfLoader::GltfMaterialData::emissiveTextureData
private

Definition at line 330 of file GltfLoader.h.

Referenced by getEmissiveTextureData(), and parsePbrData().

◆ emissiveTextureIndex

uint32_t EngineCore::GltfLoader::GltfMaterialData::emissiveTextureIndex = 0xFFFFFFFF
private

Definition at line 319 of file GltfLoader.h.

Referenced by getEmissiveTextureIndex().

◆ gltfEmissiveTextureIndex

int32_t EngineCore::GltfLoader::GltfMaterialData::gltfEmissiveTextureIndex = -1
private

Definition at line 335 of file GltfLoader.h.

Referenced by getGltfEmissiveTextureIndex(), hasEmissiveTexture(), and parsePbrData().

◆ gltfMetallicRoughnessTextureIndex

int32_t EngineCore::GltfLoader::GltfMaterialData::gltfMetallicRoughnessTextureIndex = -1
private

◆ gltfNormalTextureIndex

int32_t EngineCore::GltfLoader::GltfMaterialData::gltfNormalTextureIndex = -1
private

Definition at line 333 of file GltfLoader.h.

Referenced by getGltfNormalTextureIndex(), hasNormalTexture(), and parsePbrData().

◆ lightmapPath

std::filesystem::path EngineCore::GltfLoader::GltfMaterialData::lightmapPath
private

Definition at line 338 of file GltfLoader.h.

Referenced by getLightmapPath(), GltfMaterialData(), and hasLightmapTexture().

◆ lightmapTextureData

GltfTextureData EngineCore::GltfLoader::GltfMaterialData::lightmapTextureData
private

Definition at line 339 of file GltfLoader.h.

Referenced by getLightmapTextureData(), and GltfMaterialData().

◆ material

tinygltf::Material EngineCore::GltfLoader::GltfMaterialData::material = tinygltf::Material()
private

Definition at line 311 of file GltfLoader.h.

Referenced by getMaterial(), GltfMaterialData(), GltfMaterialData(), and parsePbrData().

◆ materialData

◆ materialExtensions

std::optional<MaterialExtensions> EngineCore::GltfLoader::GltfMaterialData::materialExtensions
private

◆ metallicFactor

float EngineCore::GltfLoader::GltfMaterialData::metallicFactor = 0.0f
private

Definition at line 323 of file GltfLoader.h.

Referenced by getMetallicFactor(), parsePbrData(), and setupMaterialData().

◆ metallicRoughnessTextureData

GltfTextureData EngineCore::GltfLoader::GltfMaterialData::metallicRoughnessTextureData
private

Definition at line 329 of file GltfLoader.h.

Referenced by getMetallicRoughnessTextureData(), and parsePbrData().

◆ normalScale

float EngineCore::GltfLoader::GltfMaterialData::normalScale = 1.0f
private

Definition at line 324 of file GltfLoader.h.

Referenced by getNormalScale(), parsePbrData(), and setupMaterialData().

◆ normalTextureData

GltfTextureData EngineCore::GltfLoader::GltfMaterialData::normalTextureData
private

Definition at line 328 of file GltfLoader.h.

Referenced by getNormalTextureData(), and parsePbrData().

◆ normalTextureIndex

uint32_t EngineCore::GltfLoader::GltfMaterialData::normalTextureIndex = 0xFFFFFFFF
private

Definition at line 317 of file GltfLoader.h.

Referenced by getNormalTextureIndex(), and setupMaterialData().

◆ roughnessFactor

float EngineCore::GltfLoader::GltfMaterialData::roughnessFactor = 1.0f
private

Definition at line 322 of file GltfLoader.h.

Referenced by getRoughnessFactor(), parsePbrData(), and setupMaterialData().

◆ roughnessMetallicTextureIndex

uint32_t EngineCore::GltfLoader::GltfMaterialData::roughnessMetallicTextureIndex = 0xFFFFFFFF
private

Definition at line 318 of file GltfLoader.h.

Referenced by getRoughnessMetallicTextureIndex().

◆ textureData

GltfTextureData EngineCore::GltfLoader::GltfMaterialData::textureData = GltfTextureData()
private

Definition at line 314 of file GltfLoader.h.

Referenced by getTextureData(), and GltfMaterialData().

◆ textureIndex

uint32_t EngineCore::GltfLoader::GltfMaterialData::textureIndex = std::numeric_limits<uint32_t>::max()
private

Definition at line 313 of file GltfLoader.h.

Referenced by getTextureIndex(), GltfMaterialData(), and hasTexture().


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