diff --git a/Example/03-ResourceManagement/main.cpp b/Example/03-ResourceManagement/main.cpp index f3c2cb9..c33d210 100644 --- a/Example/03-ResourceManagement/main.cpp +++ b/Example/03-ResourceManagement/main.cpp @@ -1,7 +1,7 @@ #include #include -#include +#include using namespace MAGE; @@ -9,13 +9,6 @@ int main(int argC, char** argV) { Config::InitializeConfig(argC, argV); - RenderContext::Get().GenerateContext(); - - while (!Context::GetMainWindow()->IsClosed()) - { - RenderContext::Get().PrepareFrame(); - RenderContext::Get().SubmitFrame(); - } - - Context::GetMainDevice()->WaitForIdle(); + Guid guid = Guid::GenerateID(); + Resource* test = ResourceFactory::Get().GetResourceObject(guid); } diff --git a/Source/Engine/Data/DayTime.cpp b/Source/Engine/Data/DayTime.cpp index acdc0a3..d126412 100644 --- a/Source/Engine/Data/DayTime.cpp +++ b/Source/Engine/Data/DayTime.cpp @@ -9,6 +9,10 @@ namespace MAGE { const array monthsInString = { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" }; + DayTime::DayTime(const string& val) + { + } + string DayTime::GetMonthName() const { return monthsInString[m_month - 1]; diff --git a/Source/Engine/Data/DayTime.h b/Source/Engine/Data/DayTime.h index 94baf69..424af1b 100644 --- a/Source/Engine/Data/DayTime.h +++ b/Source/Engine/Data/DayTime.h @@ -16,6 +16,7 @@ namespace MAGE { public: DayTime() = default; + DayTime(const string& val); ~DayTime() = default; DayTime operator=(const DayTime& other) diff --git a/Source/Engine/Resource/Core/Resource.cpp b/Source/Engine/Resource/Core/Resource.cpp index 7c3d650..0c2b8cb 100644 --- a/Source/Engine/Resource/Core/Resource.cpp +++ b/Source/Engine/Resource/Core/Resource.cpp @@ -1,25 +1,8 @@ #include "Resource.h" -#include "Engine/Resource/Helpers/ResourceHelper.h" -#include -#include - namespace MAGE { - Resource::Resource(const ResourceProps& desc) : m_resProps(desc) - { - } - - void Serialize(const path& absPath) + Resource::Resource(const json& desc) : m_props(desc) { - /*nlohmann::json json = {}; - json["ResourceProperties"]["Guid"] = m_resProps.guid.ToString().c_str(); - json["ResourceProperties"]["SizeInBytes"] = m_resProps.sizeInBytes; - json["ResourceProperties"]["MetaPath"] = m_resProps.relativePath; - json["ResourceProperties"]["ResourceName"] = m_resProps.resourceName; - json["ResourceProperties"]["ResourceType"] = m_resProps.type; - json["ResourceProperties"]["LastModified"] = m_resProps.lastModified.ToString().c_str();*/ - - // Write data from m_props.data into the binary file } } diff --git a/Source/Engine/Resource/Core/Resource.h b/Source/Engine/Resource/Core/Resource.h index 536118c..8e38d26 100644 --- a/Source/Engine/Resource/Core/Resource.h +++ b/Source/Engine/Resource/Core/Resource.h @@ -9,44 +9,31 @@ #pragma once #include "Engine/Core/Core.h" -#include "Engine/Data/Guid.h" -#include "Engine/Data/DayTime.h" #include "Engine/Objects/IObject.h" -#include "Engine/Memory/OwnedBuffer.h" + +#include +using json = nlohmann::json; namespace MAGE { - enum class ResourceType - { - Unknown, - Texture, - Mesh, - Shader, - Font, - Audio, - Script - }; - - struct ResourceProps - { - Guid guid; - string resourceName; - string relativePath; - usize sizeInBytes; - ResourceType type; - DayTime lastModified; - OwnedBuffer data; - }; - class Resource : public IObject { public: - Resource(const ResourceProps& desc); - virtual ~Resource(); + Resource(const json& desc); + virtual ~Resource() = default; + + string GetResourceName() const { return m_props["Properties"]["Name"].get(); } + string GetGuid() const { return m_props["Properties"]["ID"].get(); } + string GetLastModified() const { return m_props["Properties"]["LastModified"].get(); } + string GetPath() const { return m_props["Properties"]["Path"].get(); } + string GetType() const { return m_props["Properties"]["Type"].get(); } + + virtual void Serialize() = 0; + virtual void Deserialize() = 0; virtual void Destroy() override = 0; protected: - ResourceProps m_resProps; + json m_props; }; } diff --git a/Source/Engine/Resource/Factory/ResourceFactory.cpp b/Source/Engine/Resource/Factory/ResourceFactory.cpp new file mode 100644 index 0000000..e69de29 diff --git a/Source/Engine/Resource/Factory/ResourceFactory.h b/Source/Engine/Resource/Factory/ResourceFactory.h new file mode 100644 index 0000000..da78d2e --- /dev/null +++ b/Source/Engine/Resource/Factory/ResourceFactory.h @@ -0,0 +1,52 @@ +/* + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * Copyright (c) 2024 Metehan Tuncbilek + */ + +#pragma once + +#include "Engine/Core/Core.h" +#include "Engine/Objects/Singleton.h" +#include "Engine/Data/Guid.h" +#include "Engine/Resource/Core/Resource.h" + +namespace MAGE +{ + class ResourceFactory final : public Singleton + { + friend class ResourceHandler; + + public: + ResourceFactory() = default; + ~ResourceFactory() = default; + + template && (std::is_same_v || std::is_same_v)>> + auto GetResourceObject(const Key& key) -> typename std::conditional::value, Resource*, T*>::type + { + if constexpr (std::is_same_v) + { + auto it = m_auxillary.find(key); + if (it != m_auxillary.end()) + return dynamic_cast(&*m_resources[it->second]); + } + else + return dynamic_cast(&*m_resources[key]); + + return nullptr; + } + + protected: + void RegisterResource(const Shared& obj) + { + m_resources[obj->GetGuid()] = obj; + m_auxillary.emplace(obj->GetPath() + obj->GetResourceName() + "." + obj->GetType(), obj->GetGuid()); + } + + private: + hashmap, GuidHash> m_resources; + map m_auxillary; + }; +} diff --git a/Source/Engine/Resource/Helpers/ResourceHelper.cpp b/Source/Engine/Resource/Helpers/ResourceHelper.cpp deleted file mode 100644 index c2fa2d4..0000000 --- a/Source/Engine/Resource/Helpers/ResourceHelper.cpp +++ /dev/null @@ -1,80 +0,0 @@ -#include "ResourceHelper.h" - -#include "Engine/Configuration/ConfigCreator.h" -#include "Engine/Platform/PlatformFile.h" - -#include - -namespace MAGE -{ - - const map resourceMap = - { - {".png", ResourceType::Texture}, - {".tga", ResourceType::Texture}, - {".dds", ResourceType::Texture}, - - {".gltf", ResourceType::Mesh}, - {".fbx", ResourceType::Mesh}, - - {".vert", ResourceType::Shader}, - {".frag", ResourceType::Shader}, - {".comp", ResourceType::Shader}, - {".geom", ResourceType::Shader}, - {".tesc", ResourceType::Shader}, - {".tese", ResourceType::Shader}, - {".rgen", ResourceType::Shader}, - {".rint", ResourceType::Shader}, - {".rahit", ResourceType::Shader}, - {".rchit", ResourceType::Shader}, - {".rmiss", ResourceType::Shader}, - {".rcall", ResourceType::Shader}, - {".task", ResourceType::Shader}, - {".mesh", ResourceType::Shader}, - - {".ttf", ResourceType::Font}, - {".otf", ResourceType::Font}, - - {".wav", ResourceType::Audio}, - {".flac", ResourceType::Audio}, - - {".cpp", ResourceType::Script}, - {".h", ResourceType::Script}, - }; - - static ResourceType GetResourceType(const path& ext) - { - auto it = resourceMap.find(ext.extension().string()); - if (it != resourceMap.end()) - return it->second; - - spdlog::critical("Unknown resource type: {}", ext.extension().string()); - return ResourceType::Unknown; - } - - void ResourceHandler::ReadFileFromDisk(const string& aPath, const string& relExtPath, ResourceProps& props) - { - path newPath = aPath; - props.resourceName = newPath.stem().string(); - props.relativePath = (Config::GetAppConfig().projectPath / relExtPath).string(); - props.guid = Guid::GenerateID(); - props.lastModified = DayTime::GetCurrentDayTime(); - props.type = GetResourceType(newPath); - props.sizeInBytes = std::filesystem::file_size(newPath); - } - - void ResourceHandler::ReadTextureDisk(const string& fPath, Imagery& buffer) - { - // TODO: Need better reader. - int width, height, channels; - stbi_uc* data = stbi_load(fPath.c_str(), &width, &height, &channels, STBI_rgb_alpha); - - buffer.channelCount = channels; - buffer.imageSize = { static_cast(width), static_cast(height) }; - buffer.buffer = OwnedBuffer(data, static_cast(width * height * buffer.depthBit * channels)); - } - - void ResourceHandler::ReadGeometryDisk(const string& fPath, Geometry& buffer) - { - } -} diff --git a/Source/Engine/Resource/Helpers/ResourceHelper.h b/Source/Engine/Resource/Helpers/ResourceHelper.h deleted file mode 100644 index c2703d0..0000000 --- a/Source/Engine/Resource/Helpers/ResourceHelper.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * Copyright (c) 2024 Metehan Tuncbilek - */ - -#pragma once - -#include "Engine/Core/Core.h" -#include "Engine/Memory/OwnedBuffer.h" -#include "Engine/Resource/Data/Geometry.h" -#include "Engine/Resource/Data/Imagery.h" -#include "Engine/Resource/Core/Resource.h" - -namespace MAGE -{ - class ResourceHandler - { - public: - static void ReadFileFromDisk(const string& aPath, const string& relExtPath, ResourceProps& props); - static void ReadGeometryDisk(const string& fPath, Geometry& buffer); - static void ReadTextureDisk(const string& fPath, Imagery& buffer); - }; -} diff --git a/Source/Engine/Resource/Mesh/Mesh.cpp b/Source/Engine/Resource/Mesh/Mesh.cpp index e69de29..3d4fec3 100644 --- a/Source/Engine/Resource/Mesh/Mesh.cpp +++ b/Source/Engine/Resource/Mesh/Mesh.cpp @@ -0,0 +1,24 @@ +#include "Mesh.h" + +namespace MAGE +{ + Mesh::Mesh(const json& desc) : Resource(desc) + { + } + + Mesh::~Mesh() + { + } + + void Mesh::Serialize() + { + } + + void Mesh::Deserialize() + { + } + + void Mesh::Destroy() + { + } +} diff --git a/Source/Engine/Resource/Mesh/Mesh.h b/Source/Engine/Resource/Mesh/Mesh.h index e69de29..cb5ce01 100644 --- a/Source/Engine/Resource/Mesh/Mesh.h +++ b/Source/Engine/Resource/Mesh/Mesh.h @@ -0,0 +1,31 @@ +/* + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * Copyright (c) 2024 Metehan Tuncbilek + */ + +#pragma once + +#include "Engine/Core/Core.h" +#include "Engine/Resource/Core/Resource.h" + +#include "Engine/Vulkan/Buffer/VBuffer.h" + +namespace MAGE +{ + class Mesh : public Resource + { + public: + Mesh(const json& desc); + virtual ~Mesh() override; + + void Serialize() override final; + void Deserialize() override final; + void Destroy() override final; + + protected: + Owned m_geoBuffer; + }; +} diff --git a/Source/Engine/Resource/MetaGenerator/MetaGenerator.cpp b/Source/Engine/Resource/MetaGenerator/MetaGenerator.cpp new file mode 100644 index 0000000..a13897b --- /dev/null +++ b/Source/Engine/Resource/MetaGenerator/MetaGenerator.cpp @@ -0,0 +1,205 @@ +#include "MetaGenerator.h" + +#include "Engine/Data/DayTime.h" +#include "Engine/Data/Guid.h" +#include "Engine/Platform/PlatformFile.h" +#include "Engine/Configuration/ConfigCreator.h" + +#include "Engine/Resource/Data/Geometry.h" +#include "Engine/Resource/Core/Resource.h" + +#include "Engine/Resource/Mesh/Mesh.h" +#include "Engine/Resource/Texture/Texture.h" + +#include "Engine/Resource/Factory/ResourceFactory.h" + +#include +#include + +#include +#include +#include + +namespace MAGE +{ + static json GenerateTextureMeta(const path& srcPath, const path& dstPath) + { + int width, height, channels; + stbi_uc* data = stbi_load(srcPath.string().c_str(), &width, &height, &channels, STBI_rgb_alpha); + + if (!data) + spdlog::critical("Failed to read image file: {}", stbi_failure_reason()); + + PlatformFile::Write(Config::GetAppConfig().projectPath.string() + dstPath.string() + srcPath.stem().string() + ".bin", { data, static_cast(width * height * channels) }); + stbi_image_free(data); + + json jFile; + jFile["Properties"]["ID"] = Guid::GenerateID().ToString(); + jFile["Properties"]["Name"] = srcPath.stem().string(); + jFile["Properties"]["Path"] = dstPath.string(); + jFile["Properties"]["LastModified"] = DayTime::GetCurrentDayTime().ToString(); + jFile["Properties"]["Size"] = static_cast(width * height * channels); + jFile["Properties"]["Type"] = "Texture"; + jFile["Details"]["Dimensions"][0] = width; + jFile["Details"]["Dimensions"][1] = height; + jFile["Details"]["ChannelCount"] = channels; + jFile["Details"]["ColorDepth"] = 8; + jFile["Details"]["SubType"] = "2D"; + PlatformFile::Write(Config::GetAppConfig().projectPath.string() + dstPath.string() + srcPath.stem().string() + ".mage", jFile.dump(4)); + + return jFile; + } + + static json GenerateMeshMeta(const path& srcPath, const path& dstPath) + { + Geometry geometry; + + Assimp::Importer importer; + const aiScene* scene = importer.ReadFile(srcPath.string(), + aiProcess_Triangulate | aiProcess_GenSmoothNormals | aiProcess_CalcTangentSpace | + aiProcess_JoinIdenticalVertices | aiProcess_OptimizeMeshes | aiProcess_SortByPType); + + if (!scene || !scene->HasMeshes()) + spdlog::critical("Failed to read mesh file: {}", importer.GetErrorString()); + + aiMesh* mesh{}; + if (scene && scene->mNumMeshes > 0) + { + mesh = scene->mMeshes[0]; + geometry.vertices.reserve(mesh->mNumVertices); + geometry.indices.reserve(mesh->mNumFaces * 3); + + for (u32 i = 0; i < mesh->mNumVertices; ++i) + { + Vertex vertex = {}; + vertex.position = { mesh->mVertices[i].x, mesh->mVertices[i].y , mesh->mVertices[i].z }; + + if (mesh->HasNormals()) + vertex.normal = { mesh->mNormals[i].x, mesh->mNormals[i].y, mesh->mNormals[i].z }; + else + vertex.normal = { 0.0f, 0.0f, 0.0f }; + + if (mesh->HasTangentsAndBitangents()) + { + vertex.tangent = { mesh->mTangents[i].x, mesh->mTangents[i].y, mesh->mTangents[i].z }; + vertex.bitangent = { mesh->mBitangents[i].x, mesh->mBitangents[i].y, mesh->mBitangents[i].z }; + } + else + { + vertex.tangent = { 0.0f, 0.0f, 0.0f }; + vertex.bitangent = { 0.0f, 0.0f, 0.0f }; + } + + if (mesh->HasVertexColors(0)) + vertex.color = { mesh->mColors[0][i].r, mesh->mColors[0][i].g, mesh->mColors[0][i].b, mesh->mColors[0][i].a }; + else + vertex.color = { 0.0f, 0.0f, 0.0f, 0.0f }; + + if (mesh->HasTextureCoords(0)) + vertex.uv = { mesh->mTextureCoords[0][i].x, mesh->mTextureCoords[0][i].y }; + else + vertex.uv = { 0.0f, 0.0f }; + + geometry.vertices.push_back(vertex); + } + + for (unsigned int i = 0; i < mesh->mNumFaces; ++i) + { + aiFace& face = mesh->mFaces[i]; + if (face.mNumIndices == 3) + { + geometry.indices.push_back(static_cast(face.mIndices[0])); + geometry.indices.push_back(static_cast(face.mIndices[1])); + geometry.indices.push_back(static_cast(face.mIndices[2])); + } + } + } + + usize actualSize = sizeof(Geometry); + actualSize += geometry.vertices.capacity() * sizeof(Vertex); + actualSize += geometry.indices.capacity() * sizeof(u32); + + PlatformFile::Write(Config::GetAppConfig().projectPath.string() + dstPath.string() + srcPath.stem().string() + ".bin", { &geometry, actualSize }); + + json jFile; + jFile["Properties"]["ID"] = Guid::GenerateID().ToString(); + jFile["Properties"]["Name"] = srcPath.stem().string(); + jFile["Properties"]["Path"] = dstPath.string(); + jFile["Properties"]["LastModified"] = DayTime::GetCurrentDayTime().ToString(); + jFile["Properties"]["Size"] = actualSize; + jFile["Properties"]["Type"] = "Mesh"; + jFile["Details"]["IndexCount"] = geometry.indices.size(); + jFile["Details"]["VertexCount"] = geometry.vertices.size(); + jFile["Details"]["SubType"] = "Static"; + PlatformFile::Write(Config::GetAppConfig().projectPath.string() + dstPath.string() + srcPath.stem().string() + ".mage", jFile.dump(4)); + + return jFile; + } + + map> GenerateMetaMaps() + { + map> result; + + result.emplace(".png", &GenerateTextureMeta); + result.emplace(".tga", &GenerateTextureMeta); + result.emplace(".tiff", &GenerateTextureMeta); + + result.emplace(".fbx", &GenerateMeshMeta); + result.emplace(".gltf", &GenerateMeshMeta); + + return result; + } + + const map> metaMaps = GenerateMetaMaps(); + + json MetaHandler::GetResourceMeta(const path& srcPath, const path& dstPath) + { + auto meta = metaMaps.find(srcPath.extension().string()); + if (meta == metaMaps.end()) [[unlikely]] + { + spdlog::critical("Extension {} is not being supported.", srcPath.extension().string()); + exit(-1); + } + + return meta->second(srcPath, dstPath); + } + + static Shared GenerateTextureResource(const path& srcPath, const path& dstPath) + { + return MakeShared(MetaHandler::GetResourceMeta(srcPath, dstPath)); + } + + static Shared GenerateMeshResource(const path& srcPath, const path& dstPath) + { + return MakeShared(MetaHandler::GetResourceMeta(srcPath, dstPath)); + } + + map(const path&, const path&)>> GenerateResourceMaps() + { + map(const path&, const path&)>> result; + + result.emplace(".png", &GenerateTextureResource); + result.emplace(".tga", &GenerateTextureResource); + result.emplace(".tiff", &GenerateTextureResource); + + result.emplace(".fbx", &GenerateMeshResource); + result.emplace(".gltf", &GenerateMeshResource); + + return result; + } + + const map(const path&, const path&)>> resourceMaps = GenerateResourceMaps(); + + Shared ResourceHandler::GetResourceData(const path& srcPath, const path& dstPath) + { + auto res = resourceMaps.find(srcPath.extension().string()); + if (res == resourceMaps.end()) [[unlikely]] + { + spdlog::critical("Extension {} is not being supported.", srcPath.extension().string()); + exit(-1); + } + auto ctx = res->second(srcPath, dstPath); + ResourceFactory::Get().RegisterResource(ctx); + return ctx; + } +} diff --git a/Source/Engine/Resource/Data/Imagery.h b/Source/Engine/Resource/MetaGenerator/MetaGenerator.h similarity index 50% rename from Source/Engine/Resource/Data/Imagery.h rename to Source/Engine/Resource/MetaGenerator/MetaGenerator.h index c84c56e..61c6b68 100644 --- a/Source/Engine/Resource/Data/Imagery.h +++ b/Source/Engine/Resource/MetaGenerator/MetaGenerator.h @@ -9,15 +9,23 @@ #pragma once #include "Engine/Core/Core.h" -#include "Engine/Memory/OwnedBuffer.h" + +#include +using json = nlohmann::json; namespace MAGE { - struct Imagery final + class Resource; + + class MetaHandler final + { + public: + static json GetResourceMeta(const path& srcPath, const path& dstPath); + }; + + class ResourceHandler final { - Math::Vec2u imageSize; - u32 channelCount = 4; - u32 depthBit = 8; - OwnedBuffer buffer; + public: + static Shared GetResourceData(const path& srcPath, const path& dstPath); }; } diff --git a/Source/Engine/Resource/Texture/Texture.cpp b/Source/Engine/Resource/Texture/Texture.cpp index 3bf72f0..e50a7f8 100644 --- a/Source/Engine/Resource/Texture/Texture.cpp +++ b/Source/Engine/Resource/Texture/Texture.cpp @@ -5,22 +5,30 @@ namespace MAGE { - Texture::Texture(const ResourceProps& resDesc) : Resource(resDesc) + Texture::Texture(const json& desc) : Resource(desc) { } - void Texture::GenerateTexture() + Texture::~Texture() = default; + + void Texture::GenerateBuffer() { - BufferProps stageProp = + /*BufferProps stageProp = { .sizeInBytes = static_cast(m_texProps.texSize.x * m_texProps.texSize.y * m_texProps.texSize.z * m_texProps.channelCount), .usageFlags = VK_BUFFER_USAGE_TRANSFER_SRC_BIT }; m_stage = MakeOwned(stageProp, Context::GetMainDevice()); - m_stage->BindMemory(Context::GetMainAllocator()->GetAvailableMemory(AllocProps(m_stage->GetRequestedSize(), VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT))); + m_stage->BindMemory(Context::GetMainAllocator()->GetAvailableMemory(AllocProps(m_stage->GetRequestedSize(), VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT)));*/ + //m_stage->Update(m_resProps.data, 0); + } + + void Texture::Serialize() + { + } - //ResourceHandler::ReadResourceFile(m_resProps.relativePath, m_resProps.data); - m_stage->Update(m_resProps.data, 0); + void Texture::Deserialize() + { } void Texture::Destroy() diff --git a/Source/Engine/Resource/Texture/Texture.h b/Source/Engine/Resource/Texture/Texture.h index f67c861..0358dea 100644 --- a/Source/Engine/Resource/Texture/Texture.h +++ b/Source/Engine/Resource/Texture/Texture.h @@ -29,16 +29,16 @@ namespace MAGE friend class TextureSerializer; public: - Texture(const ResourceProps& resDesc); + Texture(const json& desc); virtual ~Texture() override; - virtual void GenerateTexture(); + virtual void GenerateBuffer(); + void Serialize() override final; + void Deserialize() override final; void Destroy() override final; - private: - TextureProps m_texProps; - + protected: Owned m_stage; Owned m_image; Owned m_view; diff --git a/Source/Engine/Resource/Texture/TextureSerializer.cpp b/Source/Engine/Resource/Texture/TextureSerializer.cpp deleted file mode 100644 index 6718f67..0000000 --- a/Source/Engine/Resource/Texture/TextureSerializer.cpp +++ /dev/null @@ -1,5 +0,0 @@ -#include "TextureSerializer.h" - -namespace MAGE -{ -} diff --git a/Source/Engine/Resource/Texture/TextureSerializer.h b/Source/Engine/Resource/Texture/TextureSerializer.h deleted file mode 100644 index 990d9e0..0000000 --- a/Source/Engine/Resource/Texture/TextureSerializer.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * Copyright (c) 2024 Metehan Tuncbilek - */ - -#pragma once - -#include "Engine/Core/Core.h" -#include "Engine/Objects/Singleton.h" -#include "Engine/Resource/Core/Resource.h" -#include "Engine/Resource/Texture/Texture.h" - -namespace MAGE -{ - class TextureSerializer final : public Singleton - { - public: - template>> - Shared SerializeTexture(const ResourceProps& desc) - { - // Read texture file such as .png, .tga, .tiff then make it mage object - Shared tex = MakeShared(desc); - - return Shared(); - } - - //Shared DeserializeTexture(const path& absPath); - }; -}