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

#include <GltfLoader.h>

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

Classes

struct  GltfBufferDataView
struct  GltfMaterialData
 Stores the material data which is relevant for our current set of shaders. More...
struct  GltfMeshData
struct  GltfMeshPrimitiveData
 Stores intermediate data from loading the asset from disk. These are the vertices, indices and material data. More...
struct  GltfTextureData
struct  GltfVertexData
struct  MaterialExtensions
 Stores all material extensions. So if another extension for some kind of specific material attribute is needed we can add it here. More...
struct  StaticMeshExtensions
 Parses all extensions and extracts recognized extensions. More...
struct  StaticMeshSettings
struct  VulkanSchneeExtension
 The vulkan schnee extension for gltf files stores all data related to the engines core functionality. More...
struct  VulkanSchneeMaterialExtension
 Extracts all material data from the gltf file. All data during runtime will be read from an object of this type. More...

Public Member Functions

 GltfLoader (NamedThreadPool *threadPool=nullptr)
 ~GltfLoader ()
std::vector< VertexgetPrimitiveVertices (const tinygltf::Primitive &primitive)
Ecs::PrimitiveData loadPrimitiveData (GltfVertexData vertexData)
void load (const std::filesystem::path &path, std::vector< GltfMeshData > &meshes) const
 Loads a vector of meshes from a gltf file.
std::optional< tinygltf::Model > loadModel (const std::filesystem::path &path) const
tinygltf::Model loadAsync (const std::filesystem::path &path) const
tinygltf::Model loadMetadataOnly (const std::filesystem::path &path) const
 Loads only the GLTF metadata (nodes, names, transforms) without loading buffer data.

Static Public Member Functions

static Assets::Skin loadSkinData (const tinygltf::Model &model, int skinIndex)
 Load skin (skeleton) data from a glTF model.
static Animation loadAnimationData (const tinygltf::Model &model, int animIndex, const Assets::Skin &skin)
 Load animation data from a glTF model.

Private Attributes

NamedThreadPoolthreadPool = nullptr

Detailed Description

Definition at line 31 of file GltfLoader.h.

Constructor & Destructor Documentation

◆ GltfLoader()

Engine::Assets::Loaders::GltfLoader::GltfLoader ( NamedThreadPool * threadPool = nullptr)

References threadPool.

◆ ~GltfLoader()

Engine::Assets::Loaders::GltfLoader::~GltfLoader ( )

Member Function Documentation

◆ getPrimitiveVertices()

std::vector< Vertex > Engine::Assets::Loaders::GltfLoader::getPrimitiveVertices ( const tinygltf::Primitive & primitive)

◆ load()

void Engine::Assets::Loaders::GltfLoader::load ( const std::filesystem::path & path,
std::vector< GltfMeshData > & meshes ) const

Loads a vector of meshes from a gltf file.

Parameters
pathWhere to load the asset from (preferably a relative path like: "assets/Engine/geometry/LightDemo/LightDemo.gltf" for engine assets)
meshesThe loaded meshes from the file
Note
Use relative paths or else you will get issues with assets not loading on different systems "assets/Engine/geometry/LightDemo/LightDemo.gltf" engine asset "assets/AirHockey/geometry/.../<asset>.gltf" game asset

◆ loadAnimationData()

Animation Engine::Assets::Loaders::GltfLoader::loadAnimationData ( const tinygltf::Model & model,
int animIndex,
const Assets::Skin & skin )
static

Load animation data from a glTF model.

Extracts keyframe tracks, maps target nodes to joint indices via the provided SkinAsset, and computes total duration.

Parameters
modelThe loaded glTF model
animIndexIndex into model.animations[]
skinThe SkinAsset to map node indices to joint indices
Returns
Populated AnimationAsset

◆ loadAsync()

tinygltf::Model Engine::Assets::Loaders::GltfLoader::loadAsync ( const std::filesystem::path & path) const

◆ loadMetadataOnly()

tinygltf::Model Engine::Assets::Loaders::GltfLoader::loadMetadataOnly ( const std::filesystem::path & path) const

Loads only the GLTF metadata (nodes, names, transforms) without loading buffer data.

This is a fast operation that parses only the JSON structure, skipping all binary buffer loading. Use this when you only need node names and transforms (e.g., for spawning actors before mesh data is fully loaded).

Parameters
pathPath to the GLTF/GLB file
Returns
Parsed model with node metadata (buffers will be empty)

◆ loadModel()

std::optional< tinygltf::Model > Engine::Assets::Loaders::GltfLoader::loadModel ( const std::filesystem::path & path) const

◆ loadPrimitiveData()

Ecs::PrimitiveData Engine::Assets::Loaders::GltfLoader::loadPrimitiveData ( GltfVertexData vertexData)

◆ loadSkinData()

Assets::Skin Engine::Assets::Loaders::GltfLoader::loadSkinData ( const tinygltf::Model & model,
int skinIndex )
static

Load skin (skeleton) data from a glTF model.

Extracts joint hierarchy, inverse bind matrices, and joint names from the specified glTF skin.

Parameters
modelThe loaded glTF model
skinIndexIndex into model.skins[]
Returns
Populated SkinAsset

Member Data Documentation

◆ threadPool

NamedThreadPool* Engine::Assets::Loaders::GltfLoader::threadPool = nullptr
private

Definition at line 532 of file GltfLoader.h.

Referenced by GltfLoader().


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