Loads 3D models via Assimp and populates the global Asset registries.
More...
#include <AssetLoader.hpp>
|
| static bool | loadMesh (MeshIdInt id, const aiMesh &asimpMeshResult) |
| | Import a single Assimp mesh into the global Asset::meshes_ registry.
|
| static const aiScene * | loadAsset (Assimp::Importer &importer, const std::string &fileName, const bool flipUVs) |
| | Read a file from disk through Assimp and return the parsed scene.
|
| static glm::mat4 | glmFromAiTransform (const aiMatrix4x4 &transformAi) |
| | Convert an Assimp 4x4 matrix to a glm::mat4.
|
| static void | pushAiNodeMeshesToModelElements (const std::string &meshNameSpace, const aiNode &nodeAi, const aiScene &sceneAi, const ModelIdInt k_modelId, const uint32_t modelIndexNode) |
| | Recursively extract meshes from an Assimp node and add them as ModelElements.
|
Loads 3D models via Assimp and populates the global Asset registries.
◆ glmFromAiTransform()
| glm::mat4 AssetLoader::glmFromAiTransform |
( |
const aiMatrix4x4 & | transformAi | ) |
|
|
staticprivate |
Convert an Assimp 4x4 matrix to a glm::mat4.
- Parameters
-
| transformAi | The Assimp transform matrix. |
- Returns
- The equivalent glm::mat4.
◆ loadAsset()
| const aiScene * AssetLoader::loadAsset |
( |
Assimp::Importer & | importer, |
|
|
const std::string & | fileName, |
|
|
const bool | flipUVs ) |
|
staticprivate |
Read a file from disk through Assimp and return the parsed scene.
- Parameters
-
| importer | Assimp importer instance (owns the scene lifetime). |
| fileName | Path to the asset file. |
| flipUVs | |
- Returns
- Pointer to the loaded scene, or nullptr on failure.
◆ loadMesh()
| bool AssetLoader::loadMesh |
( |
MeshIdInt | id, |
|
|
const aiMesh & | asimpMeshResult ) |
|
staticprivate |
Import a single Assimp mesh into the global Asset::meshes_ registry.
- Parameters
-
| id | Unique mesh identifier. |
| asimpMeshResult | The Assimp mesh to import. |
- Returns
- True on success.
◆ loadModel()
| bool AssetLoader::loadModel |
( |
const ModelIdInt | id, |
|
|
const std::string & | modelFileName, |
|
|
const std::vector< std::string > & | texFileNames, |
|
|
const bool | k_flatten, |
|
|
const bool | flipUVs ) |
|
static |
Load a single model from file and register it in Asset::models_.
- Parameters
-
| id | Unique model identifier. |
| modelFileName | Path to the model file. |
| texFileNames | Paths to associated texture files. |
| k_flatten | If true, flatten the scene hierarchy via Assimp pre-transform. |
| flipUVs | |
- Returns
- True on success.
FLATTEN AISCENE
◆ pushAiNodeMeshesToModelElements()
| void AssetLoader::pushAiNodeMeshesToModelElements |
( |
const std::string & | meshNameSpace, |
|
|
const aiNode & | nodeAi, |
|
|
const aiScene & | sceneAi, |
|
|
const ModelIdInt | k_modelId, |
|
|
const uint32_t | modelIndexNode ) |
|
staticprivate |
Recursively extract meshes from an Assimp node and add them as ModelElements.
- Parameters
-
| meshNameSpace | Namespace prefix for generating unique mesh IDs. |
| nodeAi | The current Assimp scene node. |
| sceneAi | The full Assimp scene. |
| k_modelId | The model ID to attach extracted elements to. |
| modelIndexNode | |
◆ updateModelTransformCache()
| void AssetLoader::updateModelTransformCache |
( |
const ModelIdInt | id | ) |
|
|
static |
The documentation for this class was generated from the following files: