Resource management refactor - added custom file resolver + RID

This commit is contained in:
antopilo
2025-01-18 17:51:49 -05:00
parent ab534fe929
commit 89ebc5d012
41 changed files with 1147 additions and 474 deletions

View File

@@ -718,18 +718,18 @@ namespace Nuake {
if (const ImGuiPayload* payload = ImGui::AcceptDragDropPayload("_Model"))
{
char* file = (char*)payload->Data;
std::string fullPath = std::string(file, 256);
fullPath = Nuake::FileSystem::AbsoluteToRelative(fullPath);
auto loader = ModelLoader();
auto modelResource = loader.LoadModel(fullPath);
auto entity = Engine::GetCurrentScene()->CreateEntity(FileSystem::GetFileNameFromPath(fullPath));
ModelComponent& modelComponent = entity.AddComponent<ModelComponent>();
modelComponent.ModelPath = fullPath;
modelComponent.ModelResource = modelResource;
entity.GetComponent<TransformComponent>().SetLocalPosition(dragnDropWorldPos);
//char* file = (char*)payload->Data;
//std::string fullPath = std::string(file, 256);
//fullPath = Nuake::FileSystem::AbsoluteToRelative(fullPath);
//
//auto loader = ModelLoader();
//auto modelResource = loader.LoadModel(fullPath);
//
//auto entity = Engine::GetCurrentScene()->CreateEntity(FileSystem::GetFileNameFromPath(fullPath));
//ModelComponent& modelComponent = entity.AddComponent<ModelComponent>();
//modelComponent.ModelPath = fullPath;
//modelComponent.ModelResource = modelResource;
//entity.GetComponent<TransformComponent>().SetLocalPosition(dragnDropWorldPos);
}
if (const ImGuiPayload* payload = ImGui::AcceptDragDropPayload("_Map"))