|
Vulkan Schnee 0.0.1 (22840dc8)
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 |
| Material data extracted from a glTF material and engine extensions. More... | |
| struct | GltfMeshData |
| Mesh data extracted from a glTF mesh node. More... | |
| struct | GltfMeshPrimitiveData |
| Geometry, material, and optional skinning data parsed from one glTF primitive. 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 |
| Parsed material extension bundle for one glTF material. More... | |
| struct | StaticMeshExtensions |
| Parsed extension bundle for one mesh or node. More... | |
| struct | StaticMeshSettings |
| Static mesh settings parsed from legacy glTF extras. More... | |
| struct | VulkanSchneeExtension |
| Parsed VULKAN_SCHNEE_engine_properties extension data. More... | |
| struct | VulkanSchneeMaterialExtension |
| Parsed VULKAN_SCHNEE_materials material extension data. 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 mesh nodes 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 glTF metadata without loading buffer data. | |
Static Public Member Functions | |
| static Assets::Skin | loadSkinData (const tinygltf::Model &model, int skinIndex) |
| Loads skin data from a glTF model. | |
| static Animation | loadAnimationData (const tinygltf::Model &model, int animIndex, const Assets::Skin &skin) |
| Loads 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 38 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 mesh nodes from a glTF file.
Nodes without meshes are skipped. Parsed mesh data is appended to meshes.
| path | Path to the glTF file. Prefer engine-relative asset paths for runtime assets. |
| meshes | Output vector that receives parsed mesh data. |
| std::runtime_error | When loadModel() fails to parse the file. |
|
static |
Loads animation data from a glTF model.
Extracts translation, rotation, and scale keyframe tracks, maps target nodes to joint indices through the provided skin, and computes total duration.
| model | Loaded glTF model. |
| animIndex | Index into model.animations. |
| skin | Skin asset used to map glTF 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 glTF metadata without loading buffer data.
Parses nodes, names, transforms, and extensions. Use this for actor spawning and metadata inspection before full mesh data is loaded.
| path | Path to the glTF or 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 |
Loads skin data from a glTF model.
Extracts joint hierarchy, inverse bind matrices, rest-pose transforms, and joint names from the specified glTF skin.
| model | Loaded glTF model. |
| skinIndex | Index into model.skins. |
|
private |
Definition at line 1296 of file GltfLoader.h.
Referenced by GltfLoader().