2023-02-13 14:56:13 +01:00
|
|
|
#include "Asset/Asset.h"
|
|
|
|
|
#include "Asset/MeshAsset.h"
|
|
|
|
|
#include "Asset/FontAsset.h"
|
|
|
|
|
#include "Asset/TextureAsset.h"
|
|
|
|
|
#include "Asset/MaterialAsset.h"
|
|
|
|
|
#include "Asset/MaterialInstanceAsset.h"
|
|
|
|
|
#include "Asset/AssetRegistry.h"
|
2024-01-16 19:24:49 +01:00
|
|
|
#include <fstream>
|
|
|
|
|
#include <iostream>
|
2023-02-13 14:56:13 +01:00
|
|
|
|
|
|
|
|
using namespace Seele;
|
|
|
|
|
|
2023-12-24 21:49:49 +01:00
|
|
|
AssetRegistry * _instance = new AssetRegistry();
|
2023-02-13 14:56:13 +01:00
|
|
|
|
2023-11-06 14:47:21 +01:00
|
|
|
int main(int, char**)
|
2023-02-13 14:56:13 +01:00
|
|
|
{
|
|
|
|
|
//if(argc < 2)
|
|
|
|
|
//{
|
|
|
|
|
// return -1;
|
|
|
|
|
//}
|
2024-01-16 19:24:49 +01:00
|
|
|
std::filesystem::path path = std::filesystem::path("C:\\Users\\Dynamitos\\TrackClear\\Assets\\Dirt.asset");
|
2023-02-13 14:56:13 +01:00
|
|
|
std::ifstream stream = std::ifstream(path, std::ios::binary);
|
|
|
|
|
|
|
|
|
|
ArchiveBuffer buffer;
|
|
|
|
|
buffer.readFromStream(stream);
|
|
|
|
|
|
|
|
|
|
// Read asset type
|
|
|
|
|
uint64 identifier;
|
|
|
|
|
Serialization::load(buffer, identifier);
|
|
|
|
|
|
|
|
|
|
// Read name
|
|
|
|
|
std::string name;
|
|
|
|
|
Serialization::load(buffer, name);
|
|
|
|
|
|
|
|
|
|
// Read folder
|
|
|
|
|
std::string folderPath;
|
|
|
|
|
Serialization::load(buffer, folderPath);
|
|
|
|
|
|
|
|
|
|
PAsset asset;
|
|
|
|
|
switch (identifier)
|
|
|
|
|
{
|
|
|
|
|
case TextureAsset::IDENTIFIER:
|
|
|
|
|
asset = new TextureAsset(folderPath, name);
|
|
|
|
|
break;
|
|
|
|
|
case MeshAsset::IDENTIFIER:
|
|
|
|
|
asset = new MeshAsset(folderPath, name);
|
|
|
|
|
break;
|
|
|
|
|
case MaterialAsset::IDENTIFIER:
|
|
|
|
|
asset = new MaterialAsset(folderPath, name);
|
|
|
|
|
break;
|
|
|
|
|
case MaterialInstanceAsset::IDENTIFIER:
|
|
|
|
|
asset = new MaterialInstanceAsset(folderPath, name);
|
|
|
|
|
// TODO
|
|
|
|
|
break;
|
|
|
|
|
case FontAsset::IDENTIFIER:
|
|
|
|
|
asset = new FontAsset(folderPath, name);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
throw new std::logic_error("Unknown Identifier");
|
|
|
|
|
}
|
|
|
|
|
asset->load(buffer);
|
|
|
|
|
std::cin.get();
|
|
|
|
|
}
|