40 lines
1.2 KiB
C++
40 lines
1.2 KiB
C++
#ifndef AssetDatabase_h__
|
|
#define AssetDatabase_h__
|
|
|
|
#include <string>
|
|
#include <memory>
|
|
#include <vector>
|
|
|
|
#include "AssetMetadata.h"
|
|
#include "AssetImporter.h"
|
|
#include "AssetFile.h"
|
|
|
|
|
|
class AssetDatabase{
|
|
public:
|
|
static AssetDatabase& get() {
|
|
static AssetDatabase instance;
|
|
return instance;
|
|
}
|
|
static std::wstring asset_to_meta_path(const std::wstring& asset_path);
|
|
Guid file_to_guid(const std::wstring& path) const;
|
|
std::shared_ptr<AssetFile> open_asset_file(const std::wstring& path);
|
|
void setRootPath(const std::wstring& path);
|
|
static void register_importer(std::shared_ptr<AssetImporter> importer);
|
|
std::shared_ptr<AssetImporter> find_importer(const std::wstring& asset_path) const;
|
|
|
|
std::shared_ptr<Object> LoadReference(const AssetFileLink& link);
|
|
std::shared_ptr<AssetFile> OpenArchive(Guid guid);
|
|
std::shared_ptr<Object> LoadObject(AssetFileLink link);
|
|
|
|
std::vector<std::shared_ptr<Object>> load_all_objects(std::shared_ptr<AssetFile> asset);
|
|
|
|
std::wstring getFullAssetPath(const std::string& localPath);
|
|
private:
|
|
std::vector<std::shared_ptr<AssetFile>> open_archives;
|
|
AssetDatabase();
|
|
std::vector<std::shared_ptr<AssetImporter>> _importers;
|
|
std::wstring _rootAssetsPath;
|
|
};
|
|
#endif // AssetDatabase_h__
|