|
Vulkan Schnee 0.0.1
High-performance rendering engine
|
Loads glTF files and converts tinygltf data into engine asset data. More...
#include <GltfLoader.h>
Classes | |
| struct | GltfBufferDataView |
| View into a glTF accessor's backing buffer data. More... | |
| struct | GltfMaterialData |
| Stores the material data which is relevant for our current set of shaders. More... | |
| struct | GltfMeshData |
| Mesh data extracted from a glTF mesh node. More... | |
| struct | GltfMeshPrimitiveData |
| Stores intermediate data from loading the asset from disk. These are the vertices, indices and material data. More... | |
| struct | GltfTextureData |
| Optional image payload extracted from tinygltf. More... | |
| struct | GltfVertexData |
| Resolved vertex attribute and index views for a glTF primitive. More... | |
| 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 |
| Static mesh settings parsed from legacy glTF extras. More... | |
| 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) | |
| Creates a loader that can use an optional thread pool for deferred work. | |
| ~GltfLoader () | |
| Waits for queued work on the supplied thread pool before destruction. | |
| std::vector< Vertex > | getPrimitiveVertices (const tinygltf::Primitive &primitive) |
| Legacy primitive vertex extraction entry point. | |
| Ecs::PrimitiveData | loadPrimitiveData (GltfVertexData vertexData) |
| Converts resolved glTF vertex and index views into engine primitive data. | |
| 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 |
| Loads a full ASCII glTF model through tinygltf. | |
| tinygltf::Model | loadAsync (const std::filesystem::path &path) const |
| Loads a glTF model while skipping image payload loading. | |
| 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 | |
| NamedThreadPool * | threadPool = nullptr |
Loads glTF files and converts tinygltf data into engine asset data.
GltfLoader parses mesh primitives, material metadata, engine-specific glTF extensions, skins, animations, and lightweight metadata. Texture pixel data is handed off to the texture asset pipeline instead of being owned by the loader.
Definition at line 37 of file GltfLoader.h.
| Engine::Assets::Loaders::GltfLoader::GltfLoader | ( | NamedThreadPool * | threadPool = nullptr | ) |
Creates a loader that can use an optional thread pool for deferred work.
| threadPool | Optional named thread pool. The loader does not own this pointer. |
References threadPool.
| Engine::Assets::Loaders::GltfLoader::~GltfLoader | ( | ) |
Waits for queued work on the supplied thread pool before destruction.
| std::vector< Vertex > Engine::Assets::Loaders::GltfLoader::getPrimitiveVertices | ( | const tinygltf::Primitive & | primitive | ) |
Legacy primitive vertex extraction entry point.
| primitive | glTF primitive to read. |
| std::logic_error | This method is not implemented. |
| 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.
| path | Where to load the asset from (preferably a relative path like: "assets/Engine/geometry/LightDemo/LightDemo.gltf" for engine assets) |
| meshes | The loaded meshes from the file |
|
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.
| model | The loaded glTF model |
| animIndex | Index into model.animations[] |
| skin | The SkinAsset to map node indices to joint indices |
| tinygltf::Model Engine::Assets::Loaders::GltfLoader::loadAsync | ( | const std::filesystem::path & | path | ) | const |
Loads a glTF model while skipping image payload loading.
This parses JSON, buffers, images metadata, extras, and extensions, but leaves image bytes unloaded for deferred texture processing.
| path | Path to the glTF file. |
| 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).
| path | Path to the GLTF/GLB file |
| std::optional< tinygltf::Model > Engine::Assets::Loaders::GltfLoader::loadModel | ( | const std::filesystem::path & | path | ) | const |
Loads a full ASCII glTF model through tinygltf.
KTX and KTX2 image payloads are skipped because the engine loads them through Ktx2Loader. Other image formats use tinygltf's default image loader.
| path | Path to the glTF file. |
| std::runtime_error | When tinygltf fails to load the file. |
| Ecs::PrimitiveData Engine::Assets::Loaders::GltfLoader::loadPrimitiveData | ( | GltfVertexData | vertexData | ) |
Converts resolved glTF vertex and index views into engine primitive data.
| vertexData | Resolved primitive attributes and index data. |
|
static |
Load skin (skeleton) data from a glTF model.
Extracts joint hierarchy, inverse bind matrices, and joint names from the specified glTF skin.
| model | The loaded glTF model |
| skinIndex | Index into model.skins[] |
|
private |
Definition at line 968 of file GltfLoader.h.
Referenced by GltfLoader().