39 lines
918 B
C++
39 lines
918 B
C++
//
|
|
// Created by slinky on 5/14/26.
|
|
//
|
|
|
|
#ifndef B_ENGINE_ASSETREGISTRY_H
|
|
#define B_ENGINE_ASSETREGISTRY_H
|
|
|
|
#include <unordered_map>
|
|
#include <memory>
|
|
#include <vector>
|
|
#include <string_view>
|
|
#include <filesystem>
|
|
|
|
#include "AssetRecord.h"
|
|
#include "uuid.h"
|
|
|
|
namespace fs = std::filesystem;
|
|
|
|
using Directory = fs::recursive_directory_iterator;
|
|
using Path = fs::path;
|
|
|
|
class AssetRegistry {
|
|
public:
|
|
static void read_directory(const Path& path);
|
|
|
|
static std::vector<AssetRecord*> get_records();
|
|
static AssetRecord* get_record(uuids::uuid uuid);
|
|
private:
|
|
static std::unordered_map<uuids::uuid, std::unique_ptr<AssetRecord>> _registry;
|
|
|
|
static bool does_meta_exist(const Path& path);
|
|
static std::optional<AssetRecord> read_meta_file(const Path& path);
|
|
static bool generate_meta_file(const Path& path);
|
|
static void load_asset(const AssetRecord* asset);
|
|
};
|
|
|
|
|
|
#endif //B_ENGINE_ASSETREGISTRY_H
|