Files
b_engine/src/AssetRegistry.h

39 lines
912 B
C
Raw Normal View History

2026-05-15 15:13:02 -05:00
//
// 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);
2026-05-15 15:13:02 -05:00
static std::vector<AssetRecord*> get_records();
static AssetRecord* get_record(uuids::uuid uuid);
2026-05-15 15:13:02 -05:00
private:
static std::unordered_map<uuids::uuid, std::unique_ptr<AssetRecord>> _registry;
2026-05-15 15:13:02 -05:00
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(AssetRecord* asset);
2026-05-15 15:13:02 -05:00
};
#endif //B_ENGINE_ASSETREGISTRY_H