6#include <unordered_map>
9#include "assimp/postprocess.h"
10#include "assimp/scene.h"
11#include "hellfire/graphics/Vertex.h"
12#include "hellfire/graphics/material/Material.h"
17 using EntityID = uint32_t;
25 static EntityID
load_model(
Scene *scene,
const std::filesystem::path &filepath,
unsigned int import_flags = 0);
79 static EntityID
process_node(
Scene *scene, aiNode *node,
const aiScene *ai_scene,
const std::string &filepath,
80 EntityID parent_id = 0);
86 std::vector<
unsigned int> &indices);
88 static std::shared_ptr<
Mesh>
process_mesh(aiMesh *mesh,
const aiScene *scene,
const std::string &filepath);
94 const std::string &filepath);
99 const std::string &filepath);
111 Material &material,
const std::string &property_name);
115 const std::string &property_name);
120 static std::string
create_mesh_key(aiMesh *mesh,
const std::string &filepath);
122 static std::string
create_material_key(
const aiMaterial *ai_material,
const std::string &filepath,
123 unsigned int material_index);
127 static void debug_scene_info(
const aiScene *scene,
const std::string &filepath);
#define MODEL_LOADER_DEBUG
static std::shared_ptr< Texture > load_cached_texture(const std::string &path, TextureType type)
static void print_cache_stats()
static void process_mesh_vertices(aiMesh *mesh, std::vector< Vertex > &vertices, std::vector< unsigned int > &indices)
static bool is_identity_transform(const aiMatrix4x4 &matrix)
static std::shared_ptr< Mesh > process_mesh(aiMesh *mesh, const aiScene *scene, const std::string &filepath)
static EntityID process_node(Scene *scene, aiNode *node, const aiScene *ai_scene, const std::string &filepath, EntityID parent_id=0)
static std::string create_material_key(const aiMaterial *ai_material, const std::string &filepath, unsigned int material_index)
static void load_material_textures(const aiMaterial *ai_material, Material &material, const aiScene *scene, const std::string &filepath)
static std::vector< std::string > get_texture_search_paths(const std::string &filepath)
static std::string create_mesh_key(aiMesh *mesh, const std::string &filepath)
static std::unordered_map< std::string, std::shared_ptr< Texture > > texture_cache
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_unified(const std::string &path_str, const aiScene *scene, 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 std::shared_ptr< Material > create_material(const aiMaterial *ai_material, const aiScene *scene, const std::string &filepath)
static std::unordered_map< std::string, std::shared_ptr< Mesh > > mesh_cache
static void clear_cache()
static std::string capitalize_first(const std::string &str)
static std::unordered_map< std::string, std::shared_ptr< Material > > material_cache
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 void debug_scene_info(const aiScene *scene, const std::string &filepath)
static EntityID load_model(Scene *scene, const std::filesystem::path &filepath, unsigned int import_flags=0)
static void load_essential_material_properties(const aiMaterial *ai_material, Material &material)
static void preprocess_materials(const aiScene *scene, const std::string &filepath)
TransformComponent * transform()
void set_roughness(float roughness)
void set_metallic(float metallic)
void set_opacity(float opacity)
void set_shininess(float shininess)
Manages a collection of entities and their hierarchical relationships.
void set_parent(EntityID child_id, EntityID parent_id)
Sets the parent of an entity.
void update_world_matrices()
Updates world transformation matrices for all entities Propagates transformations through the entity ...
Entity * get_entity(EntityID id)
Retrieves an entity by its ID.
EntityID create_entity(const std::string &name="GameObject")
Creates a new entity in the scene.
glm::mat4 aiMatrix4x4ToGlm(const aiMatrix4x4 &from)
static constexpr unsigned int PREVIEW
static constexpr unsigned int OPTIMIZED
static constexpr unsigned int HIGH_QUALITY
static constexpr unsigned int RUNTIME