Loading...
Searching...
No Matches
AssetImportManager.h
Go to the documentation of this file.
1//
2// Created by denzel on 09/12/2025.
3//
4
5#pragma once
6#include <mutex>
7
8#include "hellfire/assets/AssetManager.h"
9#include "hellfire/assets/AssetRegistry.h"
10
11namespace hellfire {
13 public:
14 AssetImportManager(AssetRegistry& registry, AssetManager& asset_manager, const std::filesystem::path& project_root);
15
16 /**
17 * @brief Import all unprocessed assets in registry
18 */
19 void import_all_pending();
20
21 void import_all_models();
23 bool import_asset(AssetID id);
24
25 // Check if asset needs import (no corresponding .hfmesh/.hfmat exists)
26 bool needs_import(AssetID id) const;
27
28 // Get import output directory
29 std::filesystem::path get_import_output_dir() const { return import_output_dir_; };
30private:
33 std::filesystem::path project_root_;
34 std::filesystem::path import_output_dir_;
35
36 bool import_model(const AssetMetadata& meta);
37
38 bool import_model_threaded(const AssetMetadata &meta, std::mutex &registry_mutex);
39
40 bool import_texture(const AssetMetadata& meta);
41
42 // Check if imported version exists
43 bool has_imported_mesh(AssetID original_id) const;
44 std::filesystem::path get_imported_path(const AssetMetadata& meta,
45 const std::string& extension) const;
46};
47
48} // hellfire
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 &registry, AssetManager &asset_manager, const std::filesystem::path &project_root)
std::filesystem::path project_root_
bool has_imported_mesh(AssetID original_id) const
bool import_model_threaded(const AssetMetadata &meta, std::mutex &registry_mutex)
bool import_texture(const AssetMetadata &meta)
std::filesystem::path import_output_dir_
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...
ImportResult import(const std::filesystem::path &source_path, const ImportSettings &settings={})
Serializes the ImportResult to a .hfmodel file.
static bool save(const std::filesystem::path &filepath, const ImportResult &result)
static bool save_metadata(const std::filesystem::path &texture_path, const TextureMetadata &meta)
TextureType infer_texture_type(const std::string &name)
TextureType
Definition Texture.h:13
std::filesystem::path filepath
Complete result of importing a model file.
std::string error_message
Metadata for texture assets.