diff --git a/.gitmodules b/.gitmodules index 52a5b4d3..24ab4c6e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -19,3 +19,6 @@ [submodule "Nuake/dependencies/soloud"] path = Nuake/dependencies/soloud url = https://github.com/antopilo/soloud.git +[submodule "Nuake/dependencies/optick"] + path = Nuake/dependencies/optick + url = https://github.com/bombomby/optick.git diff --git a/Editor/resources/Fonts/FiraMono-Bold.ttf b/Editor/resources/Fonts/FiraMono-Bold.ttf new file mode 100644 index 00000000..23bc30f6 Binary files /dev/null and b/Editor/resources/Fonts/FiraMono-Bold.ttf differ diff --git a/Editor/resources/Fonts/FiraMono-Regular.ttf b/Editor/resources/Fonts/FiraMono-Regular.ttf new file mode 100644 index 00000000..67bbd428 Binary files /dev/null and b/Editor/resources/Fonts/FiraMono-Regular.ttf differ diff --git a/Editor/resources/Fonts/Poppins-Regular.ttf b/Editor/resources/Fonts/Poppins-Regular.ttf new file mode 100644 index 00000000..9f0c71b7 Binary files /dev/null and b/Editor/resources/Fonts/Poppins-Regular.ttf differ diff --git a/Editor/resources/Gizmos/bone.png b/Editor/resources/Gizmos/bone.png new file mode 100644 index 00000000..c412d370 Binary files /dev/null and b/Editor/resources/Gizmos/bone.png differ diff --git a/Editor/resources/Gizmos/camera.png b/Editor/resources/Gizmos/camera.png new file mode 100644 index 00000000..0512d9e2 Binary files /dev/null and b/Editor/resources/Gizmos/camera.png differ diff --git a/Editor/resources/Gizmos/light.png b/Editor/resources/Gizmos/light.png new file mode 100644 index 00000000..43a970d4 Binary files /dev/null and b/Editor/resources/Gizmos/light.png differ diff --git a/Editor/resources/Gizmos/player.png b/Editor/resources/Gizmos/player.png new file mode 100644 index 00000000..847aecc6 Binary files /dev/null and b/Editor/resources/Gizmos/player.png differ diff --git a/Editor/src/Misc/InterfaceFonts.cpp b/Editor/src/Misc/InterfaceFonts.cpp index 85699d3d..4b26d2e8 100644 --- a/Editor/src/Misc/InterfaceFonts.cpp +++ b/Editor/src/Misc/InterfaceFonts.cpp @@ -12,10 +12,10 @@ void FontManager::LoadFonts() ImFontConfig icons_config; icons_config.MergeMode = true; icons_config.PixelSnapH = true; mFonts[Normal] = io.Fonts->AddFontFromFileTTF("resources/Fonts/fa-solid-900.ttf", 11.0f, &icons_config, icons_ranges); - mFonts[Bold] = io.Fonts->AddFontFromFileTTF("resources/Fonts/OpenSans-Bold.ttf", 16.0); - mFonts[LargeBold] = io.Fonts->AddFontFromFileTTF("resources/Fonts/OpenSans-Regular.ttf", 32); - mFonts[Title] = io.Fonts->AddFontFromFileTTF("resources/Fonts/OpenSans-Bold.ttf", 50.0); - mFonts[SubTitle] = io.Fonts->AddFontFromFileTTF("resources/Fonts/OpenSans-Regular.ttf", 24.0); + mFonts[Bold] = io.Fonts->AddFontFromFileTTF("resources/Fonts/FiraMono-Bold.ttf", 16.0); + mFonts[LargeBold] = io.Fonts->AddFontFromFileTTF("resources/Fonts/FiraMono-Regular.ttf", 32); + mFonts[Title] = io.Fonts->AddFontFromFileTTF("resources/Fonts/FiraMono-Bold.ttf", 50.0); + mFonts[SubTitle] = io.Fonts->AddFontFromFileTTF("resources/Fonts/FiraMono-Regular.ttf", 24.0); ImGui::GetIO().Fonts->AddFontDefault(); icons_config.MergeMode = true; mFonts[BigIcon] = io.Fonts->AddFontFromFileTTF("resources/Fonts/fa-solid-900.ttf", 42.0f, &icons_config, icons_ranges); diff --git a/Editor/src/Windows/EditorSelectionPanel.cpp b/Editor/src/Windows/EditorSelectionPanel.cpp index addbb26a..af20949f 100644 --- a/Editor/src/Windows/EditorSelectionPanel.cpp +++ b/Editor/src/Windows/EditorSelectionPanel.cpp @@ -430,8 +430,14 @@ void EditorSelectionPanel::DrawProjectPanel(Ref project) if (ImGui::Button("Locate")) { + const std::string& locationPath = Nuake::FileDialog::OpenFile("TrenchBroom (.exe)\0TrenchBroom.exe\0"); + if (!locationPath.empty()) + { + project->TrenchbroomPath = locationPath; + } } + ImGui::SameLine(); ImGui::InputText("Trenchbroom Path", &project->TrenchbroomPath); } diff --git a/Editor/src/Windows/FileSystemUI.cpp b/Editor/src/Windows/FileSystemUI.cpp index 778e9293..daebb70b 100644 --- a/Editor/src/Windows/FileSystemUI.cpp +++ b/Editor/src/Windows/FileSystemUI.cpp @@ -62,7 +62,6 @@ namespace Nuake void FileSystemUI::DrawDirectory(Ref directory, uint32_t drawId) { ImGui::PushFont(FontManager::GetFont(Icons)); - ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 4.0f); const char* icon = ICON_FA_FOLDER; const std::string id = ICON_FA_FOLDER + std::string("##") + directory->name; if (ImGui::Button(id.c_str(), ImVec2(100, 100))) @@ -213,6 +212,10 @@ namespace Nuake { Editor->Selection = EditorSelection(file); } + if (ImGui::IsItemHovered() && ImGui::IsMouseDoubleClicked(0)) + { + OS::OpenTrenchbroomMap(file->GetAbsolutePath()); + } } ImGui::PopStyleVar(); if (ImGui::BeginDragDropSource()) @@ -734,7 +737,6 @@ namespace Nuake ImGui::EndTable(); } - } ImGui::EndChild(); } diff --git a/Editor/src/Windows/ProjectInterface.cpp b/Editor/src/Windows/ProjectInterface.cpp index 5d2a88c0..f899a190 100644 --- a/Editor/src/Windows/ProjectInterface.cpp +++ b/Editor/src/Windows/ProjectInterface.cpp @@ -8,7 +8,6 @@ namespace Nuake { { if (ImGui::Begin("Project settings")) { - char buffer[256]; memset(buffer, 0, sizeof(buffer)); std::strncpy(buffer, Engine::GetProject()->Name.c_str(), sizeof(buffer)); diff --git a/Nuake/dependencies/optick b/Nuake/dependencies/optick new file mode 160000 index 00000000..8abd28de --- /dev/null +++ b/Nuake/dependencies/optick @@ -0,0 +1 @@ +Subproject commit 8abd28dee1a4034c973a3d32cd1777118e72df7e diff --git a/Nuake/src/Core/OS.cpp b/Nuake/src/Core/OS.cpp index a4d1636c..823b1634 100644 --- a/Nuake/src/Core/OS.cpp +++ b/Nuake/src/Core/OS.cpp @@ -1,5 +1,6 @@ #include "OS.h" #include "src/Window.h" +#include "Engine.h" #define GLFW_EXPOSE_NATIVE_WIN32 #include "GLFW/glfw3.h" @@ -69,6 +70,11 @@ void OS::ShowInFileExplorer(const std::string& filePath) ShellExecuteA(nullptr, "open", "explorer.exe", ("/select," + std::string(filePath)).c_str(), nullptr, SW_SHOWDEFAULT); } +void OS::OpenTrenchbroomMap(const std::string& filePath) +{ + ShellExecuteA(nullptr, nullptr, Engine::GetProject()->TrenchbroomPath.c_str(), filePath.c_str(), nullptr, SW_SHOW); +} + void OS::OpenURL(const std::string& url) { ShellExecute(nullptr, nullptr, std::wstring(url.begin(), url.end()).c_str(), 0, 0, SW_SHOW); diff --git a/Nuake/src/Core/OS.h b/Nuake/src/Core/OS.h index fb96e018..a2e4c3b4 100644 --- a/Nuake/src/Core/OS.h +++ b/Nuake/src/Core/OS.h @@ -12,9 +12,10 @@ namespace Nuake static std::string GetFromClipboard(); static int GetTime(); static void OpenIn(const std::string& filePath); - static int OS::RenameFile(const Ref& file, const std::string& newName); - static int OS::RenameDirectory(const Ref& dir, const std::string& newName); + static int RenameFile(const Ref& file, const std::string& newName); + static int RenameDirectory(const Ref& dir, const std::string& newName); static void ShowInFileExplorer(const std::string& filePath); + static void OpenTrenchbroomMap(const std::string& filePath); static void OpenURL(const std::string& url); }; } diff --git a/Nuake/src/Rendering/SceneRenderer.cpp b/Nuake/src/Rendering/SceneRenderer.cpp index 5d816107..386d1064 100644 --- a/Nuake/src/Rendering/SceneRenderer.cpp +++ b/Nuake/src/Rendering/SceneRenderer.cpp @@ -279,6 +279,7 @@ namespace Nuake gBufferShader->SetUniformMat4f("u_View", mView); // Models + glDisable(GL_CULL_FACE); auto view = scene.m_Registry.view(); for (auto e : view) { @@ -292,10 +293,10 @@ namespace Nuake } } } - - glCullFace(GL_FRONT); + Renderer::Flush(gBufferShader, false); + // Quake BSPs auto quakeView = scene.m_Registry.view(); for (auto e : quakeView) @@ -310,6 +311,7 @@ namespace Nuake Renderer::SubmitMesh(b, transform.GetGlobalTransform(), (uint32_t)e); } } + Renderer::Flush(gBufferShader, false); RenderCommand::Disable(RendererEnum::FACE_CULL); diff --git a/Nuake/src/Scene/Components/SpriteComponent.cpp b/Nuake/src/Scene/Components/SpriteComponent.cpp index 9a696646..bedb5b77 100644 --- a/Nuake/src/Scene/Components/SpriteComponent.cpp +++ b/Nuake/src/Scene/Components/SpriteComponent.cpp @@ -19,9 +19,10 @@ namespace Nuake { std::vector quadVertices = { - { Vector3(-1.0f, -1.0f, 0.0f), Vector2(0, 0), Vector3(0, 0, -1) }, - { Vector3(1.0f, 1.0f, 0.0f), Vector2(1.0f, 1.0f), Vector3(0, 0, -1) }, { Vector3(-1.0f, 1.0f, 0.0f), Vector2(0.0f, 1.0f), Vector3(0, 0, -1) }, + { Vector3(1.0f, 1.0f, 0.0f), Vector2(1.0f, 1.0f), Vector3(0, 0, -1) }, + { Vector3(-1.0f, -1.0f, 0.0f), Vector2(0, 0), Vector3(0, 0, -1) }, + { Vector3(1.0f, -1.0f, 0.0f), Vector2(1.0f, 0.0f), Vector3(0, 0, -1) }, { Vector3(-1.0f, -1.0f, 0.0f), Vector2(0.0f, 0.0f), Vector3(0, 0, -1) }, { Vector3(1.0f, 1.0f, 0.0f), Vector2(1.0f, 1.0f), Vector3(0, 0, -1) } diff --git a/Nuake/src/Scene/Lighting/Environment.cpp b/Nuake/src/Scene/Lighting/Environment.cpp index 282d4795..87b3126a 100644 --- a/Nuake/src/Scene/Lighting/Environment.cpp +++ b/Nuake/src/Scene/Lighting/Environment.cpp @@ -52,6 +52,7 @@ namespace Nuake { { BEGIN_SERIALIZE(); SERIALIZE_VAL(CurrentSkyType); + SERIALIZE_VEC4(AmbientColor); SERIALIZE_VAL(VolumetricFog); SERIALIZE_VAL(VolumetricStepCount); SERIALIZE_VEC4(AmbientColor); @@ -63,6 +64,8 @@ namespace Nuake { { if (j.contains("CurrentSkyType")) CurrentSkyType = j["CurrentSkyType"]; + if (j.contains("AmbientColor")) + DESERIALIZE_VEC4(j["AmbientColor"], AmbientColor); if (j.contains("VolumetricFog")) VolumetricFog = j["VolumetricFog"]; if (j.contains("VolumetricStepCount")) diff --git a/Nuake/src/Scene/Scene.cpp b/Nuake/src/Scene/Scene.cpp index 5d79271b..6fcf724d 100644 --- a/Nuake/src/Scene/Scene.cpp +++ b/Nuake/src/Scene/Scene.cpp @@ -101,8 +101,7 @@ namespace Nuake } Logger::Log("Entity not found with id: " + std::to_string(id), "scene", CRITICAL); - - assert("Entity not found"); + return Entity{ (entt::entity)0, this }; } bool Scene::OnInit() @@ -388,7 +387,6 @@ namespace Nuake sceneCopy->Path = Path; json serializedScene = Serialize(); - sceneCopy->Deserialize(serializedScene); return sceneCopy; } @@ -485,7 +483,7 @@ namespace Nuake Entity skeletonRootEntity = CreateEntity(skeletonRoot.Name); skeletonRootEntity.AddComponent().Name = skeletonRoot.Name; - skeletonRoot.EntityHandle = skeletonRootEntity.GetHandle(); + skeletonRoot.EntityHandle = skeletonRootEntity.GetID(); entity.AddChild(skeletonRootEntity); Vector3 bonePosition; @@ -510,7 +508,7 @@ namespace Nuake boneEntity.AddComponent(); entity.AddChild(boneEntity); - c.EntityHandle = boneEntity.GetHandle(); + c.EntityHandle = boneEntity.GetID(); Vector3 bonePosition; Quat boneRotation; diff --git a/Nuake/src/Scene/Systems/AnimationSystem.cpp b/Nuake/src/Scene/Systems/AnimationSystem.cpp index 75e8a4a2..9aa7fdd2 100644 --- a/Nuake/src/Scene/Systems/AnimationSystem.cpp +++ b/Nuake/src/Scene/Systems/AnimationSystem.cpp @@ -50,9 +50,9 @@ namespace Nuake auto& animationTrack = animation->GetTrack(boneName); Entity& boneEntity = m_Scene->GetEntity(boneName); - Entity& boneEnt = Entity{ (entt::entity)bone.EntityHandle, m_Scene }; + Entity& boneEnt = m_Scene->GetEntityByID(bone.EntityHandle); ///assert(boneEnt.GetHandle() == boneEntity.GetHandle()); - if (boneEnt.GetHandle() != 0) + if (boneEnt.IsValid()) { auto& transformComponent = boneEnt.GetComponent(); bone.FinalTransform = transformComponent.GetGlobalTransform() * bone.Offset; diff --git a/Nuake/src/Window.cpp b/Nuake/src/Window.cpp index 07af332e..f47d5424 100644 --- a/Nuake/src/Window.cpp +++ b/Nuake/src/Window.cpp @@ -260,7 +260,7 @@ namespace Nuake { ImGui::CreateContext(); ImGuiIO& io = ImGui::GetIO(); (void)io; - io.Fonts->AddFontFromFileTTF("resources/Fonts/OpenSans-Regular.ttf", 16.0); + io.Fonts->AddFontFromFileTTF("resources/Fonts/Poppins-Regular.ttf", 16.0); io.ConfigFlags |= ImGuiConfigFlags_DockingEnable; ImGui::StyleColorsDark();