Started asset baker abstraction

This commit is contained in:
antopilo
2025-01-18 19:51:10 -05:00
parent 745c6a1f32
commit ebaf70dfbd
4 changed files with 71 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
#pragma once
#include "IAssetBaker.h"
#include <string>
#include <map>
namespace Nuake
{
class AssetBakerManager
{
private:
std::map<std::string, Ref<IAssetBaker>> Bakers;
public:
static AssetBakerManager& Get()
{
static AssetBakerManager instance;
return instance;
}
void RegisterBaker(Ref<IAssetBaker> baker)
{
Bakers[baker->GetExtension()] = baker;
}
};
}

View File

@@ -0,0 +1,9 @@
#include "GLTFBaker.h"
using namespace Nuake;
// Converts a GLTF file to a .nkmesh binary file
Ref<File> GLTFBaker::Bake(const Ref<File>& file)
{
}

View File

@@ -0,0 +1,12 @@
#include "IAssetBaker.h"
namespace Nuake
{
class GLTFBaker : public IAssetBaker
{
public:
GLTFBaker() : IAssetBaker(".glb") {}
Ref<File> Bake(const Ref<File>& file) override;
};
}

View File

@@ -0,0 +1,24 @@
#pragma once
#include "src/Core/Core.h"
#include "src/FileSystem/File.h"
#include <string>
namespace Nuake
{
class IAssetBaker
{
private:
std::string Extension;
public:
IAssetBaker(const std::string& extension) : Extension(extension) {}
virtual ~IAssetBaker() = default;
std::string GetExtension() const { return Extension; }
public:
virtual Ref<File> Bake(const Ref<File>& file) = 0;
};
}