Refactor Mesh serialization and model system.

This commit is contained in:
antopilo
2022-06-28 19:56:16 -04:00
parent 6b827e9db7
commit 407ff89df7
21 changed files with 612 additions and 287 deletions

View File

@@ -823,9 +823,9 @@ namespace Nuake {
// m_SelectedEntity = scene->GetAllEntities().at(0);
//}
}
ImGui::EndChild();
ImGui::Separator();
// Draw a tree of entities.
ImGui::PushStyleColor(ImGuiCol_ChildBg, ImVec4(26.f / 255.0f, 26.f / 255.0f, 26.f / 255.0f, 1));
@@ -870,9 +870,10 @@ namespace Nuake {
}
}
ImGui::EndTable();
ImGui::EndTable();
}
ImGui::EndChild();
ImGui::EndChild();
ImGui::PopStyleColor();
if (ImGui::BeginDragDropTarget()) // Drag n drop new prefab file into scene tree
@@ -1410,6 +1411,10 @@ namespace Nuake {
if (ImGui::ImageButtonEx(ImGui::GetCurrentWindow()->GetID("#image4"), (void*)textureID, ImVec2(80, 80), ImVec2(0, 1), ImVec2(1, 0), ImVec2(2, 2), ImVec4(0, 0, 0, 1), ImVec4(1, 1, 1, 1)))
{
std::string texture = FileDialog::OpenFile("*.png | *.jpg");
if (texture != "")
{
m_SelectedMaterial->SetMetalness(TextureManager::Get()->GetTexture(texture));
}
}
ImGui::SameLine();
//ImGui::Checkbox("Use##4", &m_SelectedMaterial->data.u_HasMetalness);
@@ -1424,6 +1429,7 @@ namespace Nuake {
if (ImGui::ImageButtonEx(ImGui::GetCurrentWindow()->GetID("#image5"), (void*)textureID, ImVec2(80, 80), ImVec2(0, 1), ImVec2(1, 0), ImVec2(2, 2), ImVec4(0, 0, 0, 0), ImVec4(1, 1, 1, 1)))
{
std::string texture = FileDialog::OpenFile("*.png | *.jpg");
m_SelectedMaterial->SetRoughness(TextureManager::Get()->GetTexture(texture));
}
ImGui::SameLine();
//ImGui::Checkbox("Use##5", &m_SelectedMaterial->data.u_HasRoughness);

View File

@@ -199,14 +199,17 @@ namespace Nuake
auto project = Project::New();
auto projectFileData = FileSystem::ReadFile(projectPath, true);
if (!project->Deserialize(projectFileData))
try {
project->Deserialize(projectFileData);
project->FullPath = projectPath;
Engine::LoadProject(project);
}
catch (std::exception exception)
{
Logger::Log("Error loading project: " + projectPath, CRITICAL);
return;
Logger::Log(exception.what());
}
project->FullPath = projectPath;
Engine::LoadProject(project);
Engine::GetCurrentWindow()->SetTitle("Nuake Engine - Editing " + project->Name);
}