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

#include <GltfLoader.h>

Collaboration diagram for EngineCore::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.

Private Attributes

NamedThreadPoolthreadPool = nullptr

Detailed Description

Definition at line 23 of file GltfLoader.h.

Constructor & Destructor Documentation

◆ GltfLoader()

EngineCore::GltfLoader::GltfLoader ( NamedThreadPool * threadPool = nullptr)

Definition at line 19 of file GltfLoader.cpp.

References threadPool.

◆ ~GltfLoader()

EngineCore::GltfLoader::~GltfLoader ( )

Definition at line 22 of file GltfLoader.cpp.

References threadPool.

Member Function Documentation

◆ getPrimitiveVertices()

std::vector< Vertex > EngineCore::GltfLoader::getPrimitiveVertices ( const tinygltf::Primitive & primitive)

Definition at line 58 of file GltfLoader.cpp.

◆ load()

void EngineCore::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
Date
2025-05-31
Author
Konstantin Passig
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/../*.gltf" game asset

Definition at line 801 of file GltfLoader.cpp.

References loadModel(), TRACY_LOCKABLE, TRACY_ZONE_SCOPED_NAMED, and EngineCore::UnpackOptional().

Here is the call graph for this function:

◆ loadAsync()

tinygltf::Model EngineCore::GltfLoader::loadAsync ( const std::filesystem::path & path) const

Definition at line 874 of file GltfLoader.cpp.

References TRACY_ZONE_SCOPED_NAMED.

◆ loadMetadataOnly()

tinygltf::Model EngineCore::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)

Definition at line 905 of file GltfLoader.cpp.

References TRACY_ZONE_SCOPED_NAMED.

Referenced by EngineCore::GltfSpawner::spawnAll().

Here is the caller graph for this function:

◆ loadModel()

std::optional< tinygltf::Model > EngineCore::GltfLoader::loadModel ( const std::filesystem::path & path) const

Definition at line 848 of file GltfLoader.cpp.

References TRACY_ZONE_SCOPED_NAMED.

Referenced by load().

Here is the caller graph for this function:

◆ loadPrimitiveData()

Member Data Documentation

◆ threadPool

NamedThreadPool* EngineCore::GltfLoader::threadPool = nullptr
private

Definition at line 471 of file GltfLoader.h.

Referenced by GltfLoader(), and ~GltfLoader().


The documentation for this class 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