Files
Seele/src/AssetViewer/main.cpp
T

62 lines
1.6 KiB
C++
Raw Normal View History

2023-02-13 14:56:13 +01:00
#include "Asset/Asset.h"
2024-06-09 12:20:04 +02:00
#include "Asset/AssetRegistry.h"
2023-02-13 14:56:13 +01:00
#include "Asset/FontAsset.h"
#include "Asset/MaterialAsset.h"
#include "Asset/MaterialInstanceAsset.h"
2024-06-09 12:20:04 +02:00
#include "Asset/MeshAsset.h"
#include "Asset/TextureAsset.h"
2024-01-16 19:24:49 +01:00
#include <fstream>
#include <iostream>
2023-02-13 14:56:13 +01:00
2024-06-09 12:20:04 +02:00
2023-02-13 14:56:13 +01:00
using namespace Seele;
2024-06-09 12:20:04 +02:00
AssetRegistry* _instance = new AssetRegistry();
2023-02-13 14:56:13 +01:00
2024-06-09 12:20:04 +02:00
int main(int, char**) {
// if(argc < 2)
2023-02-13 14:56:13 +01:00
//{
2024-06-09 12:20:04 +02:00
// 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;
2024-06-09 12:20:04 +02:00
switch (identifier) {
2023-02-13 14:56:13 +01:00
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();
}