Loading...
Searching...
No Matches
hellfire::ModelImporter Class Reference

Converts external model formats (FBX, GLTF, OBJ) into internal assets this runs once during asset import, NOT at runtime! More...

#include <ModelImporter.h>

Collaboration diagram for hellfire::ModelImporter:

Public Member Functions

 ModelImporter (AssetRegistry &registry, const std::filesystem::path &output_dir)
 
ImportResult import (const std::filesystem::path &source_path, const ImportSettings &settings={})
 

Private Member Functions

unsigned int build_import_flags (const ImportSettings &settings) const
 
void process_node_hierarchy (const aiNode *node, ImportResult &result, size_t parent_index=SIZE_MAX)
 
ImportedNode convert_node (const aiNode *node) const
 
AssetID process_mesh (const aiMesh *mesh, size_t mesh_index)
 
AssetID process_material (const aiMaterial *ai_mat, size_t material_index)
 
AssetID process_texture (const std::string &texture_path, TextureType type)
 
std::optional< std::filesystem::path > resolve_texture_path (const std::string &texture_ref) const
 
bool is_embedded_texture (const std::string &path) const
 
std::filesystem::path extract_embedded_texture (size_t index)
 
std::string make_unique_name (const std::string &base, const std::string &suffix, size_t index) const
 

Static Private Member Functions

static glm::mat4 convert_matrix (const aiMatrix4x4 &m)
 
static bool is_identity (const aiMatrix4x4 &m)
 

Private Attributes

AssetRegistryregistry_
 
std::filesystem::path output_dir_
 
const aiScene * ai_scene_ = nullptr
 
std::filesystem::path source_path_
 
std::filesystem::path source_dir_
 
std::string base_name_
 

Detailed Description

Converts external model formats (FBX, GLTF, OBJ) into internal assets this runs once during asset import, NOT at runtime!

Definition at line 28 of file ModelImporter.h.

Constructor & Destructor Documentation

◆ ModelImporter()

hellfire::ModelImporter::ModelImporter ( AssetRegistry registry,
const std::filesystem::path &  output_dir 
)

Definition at line 23 of file ModelImporter.cpp.

Member Function Documentation

◆ build_import_flags()

unsigned int hellfire::ModelImporter::build_import_flags ( const ImportSettings settings) const
private

Definition at line 53 of file ModelImporter.cpp.

◆ convert_matrix()

glm::mat4 hellfire::ModelImporter::convert_matrix ( const aiMatrix4x4 &  m)
staticprivate

Definition at line 363 of file ModelImporter.cpp.

◆ convert_node()

ImportedNode hellfire::ModelImporter::convert_node ( const aiNode *  node) const
private

Definition at line 119 of file ModelImporter.cpp.

◆ extract_embedded_texture()

std::filesystem::path hellfire::ModelImporter::extract_embedded_texture ( size_t  index)
private

Definition at line 330 of file ModelImporter.cpp.

◆ import()

ImportResult hellfire::ModelImporter::import ( const std::filesystem::path &  source_path,
const ImportSettings settings = {} 
)

Definition at line 29 of file ModelImporter.cpp.

◆ is_embedded_texture()

bool hellfire::ModelImporter::is_embedded_texture ( const std::string &  path) const
private

Definition at line 326 of file ModelImporter.cpp.

◆ is_identity()

bool hellfire::ModelImporter::is_identity ( const aiMatrix4x4 &  m)
staticprivate

Definition at line 372 of file ModelImporter.cpp.

◆ make_unique_name()

std::string hellfire::ModelImporter::make_unique_name ( const std::string &  base,
const std::string &  suffix,
size_t  index 
) const
private

Definition at line 382 of file ModelImporter.cpp.

◆ process_material()

AssetID hellfire::ModelImporter::process_material ( const aiMaterial *  ai_mat,
size_t  material_index 
)
private

Definition at line 215 of file ModelImporter.cpp.

◆ process_mesh()

AssetID hellfire::ModelImporter::process_mesh ( const aiMesh *  mesh,
size_t  mesh_index 
)
private

Definition at line 135 of file ModelImporter.cpp.

◆ process_node_hierarchy()

void hellfire::ModelImporter::process_node_hierarchy ( const aiNode *  node,
ImportResult result,
size_t  parent_index = SIZE_MAX 
)
private

Definition at line 73 of file ModelImporter.cpp.

◆ process_texture()

AssetID hellfire::ModelImporter::process_texture ( const std::string &  texture_path,
TextureType  type 
)
private

Definition at line 281 of file ModelImporter.cpp.

◆ resolve_texture_path()

std::optional< std::filesystem::path > hellfire::ModelImporter::resolve_texture_path ( const std::string &  texture_ref) const
private

Definition at line 305 of file ModelImporter.cpp.

Member Data Documentation

◆ ai_scene_

const aiScene* hellfire::ModelImporter::ai_scene_ = nullptr
private

Definition at line 39 of file ModelImporter.h.

◆ base_name_

std::string hellfire::ModelImporter::base_name_
private

Definition at line 42 of file ModelImporter.h.

◆ output_dir_

std::filesystem::path hellfire::ModelImporter::output_dir_
private

Definition at line 36 of file ModelImporter.h.

◆ registry_

AssetRegistry& hellfire::ModelImporter::registry_
private

Definition at line 35 of file ModelImporter.h.

◆ source_dir_

std::filesystem::path hellfire::ModelImporter::source_dir_
private

Definition at line 41 of file ModelImporter.h.

◆ source_path_

std::filesystem::path hellfire::ModelImporter::source_path_
private

Definition at line 40 of file ModelImporter.h.


The documentation for this class was generated from the following files: