Loading...
Searching...
No Matches
hellfire::Addons::ModelLoader Class Reference

#include <ModelLoader.h>

Collaboration diagram for hellfire::Addons::ModelLoader:

Classes

struct  ImportFlags
 

Static Public Member Functions

static EntityID load_model (Scene *scene, const std::filesystem::path &filepath, unsigned int import_flags=0)
 
static void clear_cache ()
 
static void print_cache_stats ()
 

Private Types

enum class  MaterialType { LAMBERT , PHONG , PBR }
 

Static Private Member Functions

static EntityID process_node (Scene *scene, aiNode *node, const aiScene *ai_scene, const std::string &filepath, EntityID parent_id=0)
 
static bool is_identity_transform (const aiMatrix4x4 &matrix)
 
static void process_mesh_vertices (aiMesh *mesh, std::vector< Vertex > &vertices, std::vector< unsigned int > &indices)
 
static std::shared_ptr< Meshprocess_mesh (aiMesh *mesh, const aiScene *scene, const std::string &filepath)
 
static void preprocess_materials (const aiScene *scene, const std::string &filepath)
 
static std::shared_ptr< Materialcreate_material (const aiMaterial *ai_material, const aiScene *scene, const std::string &filepath)
 
static void load_essential_material_properties (const aiMaterial *ai_material, Material &material)
 
static void load_material_textures (const aiMaterial *ai_material, Material &material, const aiScene *scene, const std::string &filepath)
 
static bool try_load_embedded_texture_unified (const std::string &path_str, const aiScene *scene, TextureType type, Material &material)
 
static bool try_load_external_texture_unified (const std::string &path_str, const std::string &filepath, TextureType type, Material &material)
 
static bool try_load_embedded_texture (const std::string &path_str, const aiScene *scene, TextureType dcr_type, Material &material, const std::string &property_name)
 
static bool try_load_external_texture (const std::string &path_str, const std::string &filepath, TextureType dcr_type, Material &material, const std::string &property_name)
 
static std::shared_ptr< Textureload_cached_texture (const std::string &path, TextureType type)
 
static std::string create_mesh_key (aiMesh *mesh, const std::string &filepath)
 
static std::string create_material_key (const aiMaterial *ai_material, const std::string &filepath, unsigned int material_index)
 
static std::string capitalize_first (const std::string &str)
 
static void debug_scene_info (const aiScene *scene, const std::string &filepath)
 
static std::vector< std::string > get_texture_search_paths (const std::string &filepath)
 

Static Private Attributes

static std::unordered_map< std::string, std::shared_ptr< Mesh > > mesh_cache
 
static std::unordered_map< std::string, std::shared_ptr< Material > > material_cache
 
static std::unordered_map< std::string, std::shared_ptr< Texture > > texture_cache
 

Detailed Description

Definition at line 22 of file ModelLoader.h.

Member Enumeration Documentation

◆ MaterialType

Enumerator
LAMBERT 
PHONG 
PBR 

Definition at line 72 of file ModelLoader.h.

Member Function Documentation

◆ capitalize_first()

std::string hellfire::Addons::ModelLoader::capitalize_first ( const std::string &  str)
staticprivate

Definition at line 552 of file ModelLoader.cpp.

◆ clear_cache()

void hellfire::Addons::ModelLoader::clear_cache ( )
static

Definition at line 559 of file ModelLoader.cpp.

◆ create_material()

std::shared_ptr< Material > hellfire::Addons::ModelLoader::create_material ( const aiMaterial *  ai_material,
const aiScene *  scene,
const std::string &  filepath 
)
staticprivate

Definition at line 320 of file ModelLoader.cpp.

◆ create_material_key()

std::string hellfire::Addons::ModelLoader::create_material_key ( const aiMaterial *  ai_material,
const std::string &  filepath,
unsigned int  material_index 
)
staticprivate

Definition at line 289 of file ModelLoader.cpp.

◆ create_mesh_key()

std::string hellfire::Addons::ModelLoader::create_mesh_key ( aiMesh *  mesh,
const std::string &  filepath 
)
staticprivate

Definition at line 285 of file ModelLoader.cpp.

◆ debug_scene_info()

void hellfire::Addons::ModelLoader::debug_scene_info ( const aiScene *  scene,
const std::string &  filepath 
)
staticprivate

Definition at line 64 of file ModelLoader.cpp.

◆ get_texture_search_paths()

std::vector< std::string > hellfire::Addons::ModelLoader::get_texture_search_paths ( const std::string &  filepath)
staticprivate

Definition at line 379 of file ModelLoader.cpp.

◆ is_identity_transform()

bool hellfire::Addons::ModelLoader::is_identity_transform ( const aiMatrix4x4 &  matrix)
staticprivate

Definition at line 221 of file ModelLoader.cpp.

◆ load_cached_texture()

std::shared_ptr< Texture > hellfire::Addons::ModelLoader::load_cached_texture ( const std::string &  path,
TextureType  type 
)
staticprivate

Definition at line 532 of file ModelLoader.cpp.

◆ load_essential_material_properties()

void hellfire::Addons::ModelLoader::load_essential_material_properties ( const aiMaterial *  ai_material,
Material material 
)
staticprivate

Definition at line 340 of file ModelLoader.cpp.

◆ load_material_textures()

void hellfire::Addons::ModelLoader::load_material_textures ( const aiMaterial *  ai_material,
Material material,
const aiScene *  scene,
const std::string &  filepath 
)
staticprivate

Definition at line 395 of file ModelLoader.cpp.

◆ load_model()

EntityID hellfire::Addons::ModelLoader::load_model ( Scene scene,
const std::filesystem::path &  filepath,
unsigned int  import_flags = 0 
)
static

Definition at line 25 of file ModelLoader.cpp.

◆ preprocess_materials()

void hellfire::Addons::ModelLoader::preprocess_materials ( const aiScene *  scene,
const std::string &  filepath 
)
staticprivate

Definition at line 82 of file ModelLoader.cpp.

◆ print_cache_stats()

void hellfire::Addons::ModelLoader::print_cache_stats ( )
static

Definition at line 566 of file ModelLoader.cpp.

◆ process_mesh()

std::shared_ptr< Mesh > hellfire::Addons::ModelLoader::process_mesh ( aiMesh *  mesh,
const aiScene *  scene,
const std::string &  filepath 
)
staticprivate

Definition at line 297 of file ModelLoader.cpp.

◆ process_mesh_vertices()

void hellfire::Addons::ModelLoader::process_mesh_vertices ( aiMesh *  mesh,
std::vector< Vertex > &  vertices,
std::vector< unsigned int > &  indices 
)
staticprivate

Definition at line 231 of file ModelLoader.cpp.

◆ process_node()

EntityID hellfire::Addons::ModelLoader::process_node ( Scene scene,
aiNode *  node,
const aiScene *  ai_scene,
const std::string &  filepath,
EntityID  parent_id = 0 
)
staticprivate

Definition at line 126 of file ModelLoader.cpp.

◆ try_load_embedded_texture()

static bool hellfire::Addons::ModelLoader::try_load_embedded_texture ( const std::string &  path_str,
const aiScene *  scene,
TextureType  dcr_type,
Material material,
const std::string &  property_name 
)
staticprivate

◆ try_load_embedded_texture_unified()

bool hellfire::Addons::ModelLoader::try_load_embedded_texture_unified ( const std::string &  path_str,
const aiScene *  scene,
TextureType  type,
Material material 
)
staticprivate

Definition at line 428 of file ModelLoader.cpp.

◆ try_load_external_texture()

static bool hellfire::Addons::ModelLoader::try_load_external_texture ( const std::string &  path_str,
const std::string &  filepath,
TextureType  dcr_type,
Material material,
const std::string &  property_name 
)
staticprivate

◆ try_load_external_texture_unified()

bool hellfire::Addons::ModelLoader::try_load_external_texture_unified ( const std::string &  path_str,
const std::string &  filepath,
TextureType  type,
Material material 
)
staticprivate

Definition at line 498 of file ModelLoader.cpp.

Member Data Documentation

◆ material_cache

std::unordered_map< std::string, std::shared_ptr< Material > > hellfire::Addons::ModelLoader::material_cache
staticprivate

Definition at line 135 of file ModelLoader.h.

◆ mesh_cache

std::unordered_map< std::string, std::shared_ptr< Mesh > > hellfire::Addons::ModelLoader::mesh_cache
staticprivate

Definition at line 134 of file ModelLoader.h.

◆ texture_cache

std::unordered_map< std::string, std::shared_ptr< Texture > > hellfire::Addons::ModelLoader::texture_cache
staticprivate

Definition at line 136 of file ModelLoader.h.


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