10#include "hellfire/assets/models/ImportResult.h"
14
15
16
17
20 static constexpr uint32_t
MAGIC = 0x4C444F4D;
23 static bool save(
const std::filesystem::path& filepath,
const ImportResult& result);
24 static std::optional<
ImportResult>
load(
const std::filesystem::path& filepath);
std::filesystem::path get_imported_path(const AssetMetadata &meta, const std::string &extension) const
std::filesystem::path get_import_output_dir() const
void import_all_pending()
Import all unprocessed assets in registry.
bool import_model(const AssetMetadata &meta)
bool needs_import(AssetID id) const
AssetImportManager(AssetRegistry ®istry, AssetManager &asset_manager, const std::filesystem::path &project_root)
bool import_asset(AssetID id)
void import_all_textures()
std::filesystem::path project_root_
bool has_imported_mesh(AssetID original_id) const
AssetManager & asset_manager_
bool import_model_threaded(const AssetMetadata &meta, std::mutex ®istry_mutex)
bool import_texture(const AssetMetadata &meta)
std::filesystem::path import_output_dir_
AssetRegistry & registry_
std::shared_ptr< Mesh > get_mesh(AssetID id)
Registry for storing assets.
std::filesystem::path get_absolute_path(AssetID uuid)
Converts external model formats (FBX, GLTF, OBJ) into internal assets this runs once during asset imp...
unsigned int build_import_flags(const ImportSettings &settings) const
std::filesystem::path output_dir_
std::filesystem::path source_path_
bool is_embedded_texture(const std::string &path) const
static glm::mat4 convert_matrix(const aiMatrix4x4 &m)
std::filesystem::path extract_embedded_texture(size_t index)
static bool is_identity(const aiMatrix4x4 &m)
AssetID process_texture(const std::string &texture_path, TextureType type)
std::optional< std::filesystem::path > resolve_texture_path(const std::string &texture_ref) const
std::string make_unique_name(const std::string &base, const std::string &suffix, size_t index) const
ImportedNode convert_node(const aiNode *node) const
const aiScene * ai_scene_
ModelImporter(AssetRegistry ®istry, const std::filesystem::path &output_dir)
std::filesystem::path source_dir_
ImportResult import(const std::filesystem::path &source_path, const ImportSettings &settings={})
AssetID process_mesh(const aiMesh *mesh, size_t mesh_index)
void process_node_hierarchy(const aiNode *node, ImportResult &result, size_t parent_index=SIZE_MAX)
AssetID process_material(const aiMaterial *ai_mat, size_t material_index)
AssetRegistry & registry_
Serializes the ImportResult to a .hfmodel file.
static std::optional< ImportResult > load_json(const std::filesystem::path &filepath)
static constexpr uint32_t VERSION
static bool save(const std::filesystem::path &filepath, const ImportResult &result)
static constexpr uint32_t MAGIC
static bool save_json(const std::filesystem::path &filepath, const ImportResult &result)
static std::optional< ImportResult > load(const std::filesystem::path &filepath)
static bool save_metadata(const std::filesystem::path &texture_path, const TextureMetadata &meta)
TextureType infer_texture_type(const std::string &name)
Complete result of importing a model file.
std::vector< AssetID > created_material_assets
std::string error_message
std::vector< AssetID > created_texture_assets
std::vector< ImportedNode > nodes
std::vector< ImportedMesh > meshes
std::vector< AssetID > created_mesh_assets
Represents an imported mesh with its material binding.
Represents a node in the imported model hierarchy.
std::vector< size_t > child_indices
Indices into ImportResult::nodes.
std::vector< size_t > mesh_indices
Indices into ImportResult::meshes.
Metadata for texture assets.