Added support for skyboxes using a new SkyBox resource and component

This commit is contained in:
antopilo
2024-11-06 20:40:38 -05:00
parent 9647cac48b
commit 89209dc7ba
25 changed files with 665 additions and 34725 deletions

View File

@@ -19,6 +19,7 @@
#include "../Misc/ThumbnailManager.h"
#include <Tracy.hpp>
#include <src/Resource/SkyResource.h>
namespace Nuake
{
@@ -328,6 +329,10 @@ namespace Nuake
{
dragType = "_UIFile";
}
else if (fileExtension == ".sky")
{
dragType = "_SkyFile";
}
ImGui::SetDragDropPayload(dragType.c_str(), (void*)(pathBuffer), sizeof(pathBuffer));
ImGui::Text(file->GetName().c_str());
@@ -674,6 +679,28 @@ namespace Nuake
RefreshFileBrowser();
}
}
if (ImGui::MenuItem("Sky"))
{
const std::string path = FileDialog::SaveFile("*.sky");
if (!path.empty())
{
std::string finalPath = path;
if (!String::EndsWith(path, ".sky"))
{
finalPath = path + ".sky";
}
Ref<SkyResource> sky = CreateRef<SkyResource>(FileSystem::AbsoluteToRelative(finalPath));
sky->IsEmbedded = false;
auto jsonData = sky->Serialize();
FileSystem::BeginWriteFile(finalPath, true);
FileSystem::WriteLine(jsonData.dump(4));
FileSystem::EndWriteFile();
RefreshFileBrowser();
}
}
ImGui::EndMenu();
}