From affcf8128f0ef9e575fae20e342842736a367b53 Mon Sep 17 00:00:00 2001 From: Joe Morton Date: Thu, 3 Aug 2023 21:37:23 +0100 Subject: [PATCH] Prefabs, DebugText, Vulkan labels --- Editor/Source/ApplicationInfoPanel.cpp | 2 +- Editor/Source/Editor.cpp | 43 +- Editor/Source/Editor.h | 2 + Editor/Source/GameViewPanel.cpp | 4 + Editor/Source/HierarchyPanel.cpp | 55 +- Editor/Source/InspectorPanel.cpp | 90 +- Editor/Source/ResourcePanel.cpp | 97 +- Editor/Source/ResourcePanel.h | 4 +- Editor/Source/SceneSettingsPanel.cpp | 2 +- Editor/Source/SceneViewPanel.cpp | 10 +- .../Assets/Meshes/Materials/Material0##0.lmat | 26 + ExampleProject/PrefabTest.lprefab | 4581 +++++++++++++++++ Lumos/External/GLFWpremake5.lua | 2 - Lumos/External/box2dpremake5.lua | 1 - Lumos/External/spdlog/include/spdlog/logger.h | 2 +- Lumos/Source/Lumos/AI/PathEdge.cpp | 2 +- Lumos/Source/Lumos/AI/PathNode.cpp | 2 +- Lumos/Source/Lumos/Core/Application.cpp | 51 + Lumos/Source/Lumos/Core/Application.h | 7 + Lumos/Source/Lumos/Core/Core.h | 96 +- Lumos/Source/Lumos/Core/JobSystem.cpp | 4 +- Lumos/Source/Lumos/Core/OS/Memory.cpp | 123 +- Lumos/Source/Lumos/Core/OS/Memory.h | 132 + Lumos/Source/Lumos/Core/OS/Window.h | 8 +- Lumos/Source/Lumos/Core/Profiler.h | 16 + Lumos/Source/Lumos/Core/Version.h | 2 +- .../Lumos/Graphics/Animation/Animation.h | 2 +- .../Lumos/Graphics/Animation/Skeleton.h | 2 +- Lumos/Source/Lumos/Graphics/Font.cpp | 6 +- Lumos/Source/Lumos/Graphics/Material.h | 4 + Lumos/Source/Lumos/Graphics/Mesh.cpp | 2 +- .../Lumos/Graphics/ModelLoader/GLTFLoader.cpp | 4 +- Lumos/Source/Lumos/Graphics/RHI/Definitions.h | 1 + Lumos/Source/Lumos/Graphics/RHI/GPUProfile.h | 8 +- Lumos/Source/Lumos/Graphics/RHI/Pipeline.cpp | 2 +- Lumos/Source/Lumos/Graphics/RHI/Pipeline.h | 2 + Lumos/Source/Lumos/Graphics/RHI/Renderer.cpp | 4 + Lumos/Source/Lumos/Graphics/RHI/Texture.cpp | 1 + .../Graphics/Renderers/DebugRenderer.cpp | 234 + .../Lumos/Graphics/Renderers/DebugRenderer.h | 66 + .../Lumos/Graphics/Renderers/RenderPasses.cpp | 725 ++- .../Lumos/Graphics/Renderers/RenderPasses.h | 8 +- Lumos/Source/Lumos/ImGui/ImConfig.h | 8 +- Lumos/Source/Lumos/ImGui/ImGuiUtilities.cpp | 4 +- Lumos/Source/Lumos/Maths/Frustum.cpp | 42 +- Lumos/Source/Lumos/Maths/Transform.cpp | 22 +- .../LumosPhysicsEngine/LumosPhysicsEngine.cpp | 6 +- .../Narrowphase/CollisionDetection.cpp | 1 - .../Narrowphase/Manifold.cpp | 12 +- .../LumosPhysicsEngine/RigidBody3D.cpp | 13 +- .../Physics/LumosPhysicsEngine/RigidBody3D.h | 9 +- .../Source/Lumos/Platform/GLFW/GLFWWindow.cpp | 76 +- Lumos/Source/Lumos/Platform/GLFW/GLFWWindow.h | 2 +- .../Lumos/Platform/Headless/HeadlessWindow.h | 2 +- Lumos/Source/Lumos/Platform/MacOS/MacOSOS.mm | 13 +- .../Lumos/Platform/OpenGL/GLContext.cpp | 6 +- Lumos/Source/Lumos/Platform/Unix/UnixOS.cpp | 45 +- Lumos/Source/Lumos/Platform/Vulkan/VK.h | 6 +- .../Lumos/Platform/Vulkan/VKCommandBuffer.cpp | 30 +- .../Lumos/Platform/Vulkan/VKContext.cpp | 2 + .../Source/Lumos/Platform/Vulkan/VKDevice.cpp | 39 +- Lumos/Source/Lumos/Platform/Vulkan/VKDevice.h | 19 +- .../Lumos/Platform/Vulkan/VKIMGUIRenderer.cpp | 6 +- .../Lumos/Platform/Vulkan/VKPipeline.cpp | 16 +- .../Lumos/Platform/Vulkan/VKRenderPass.cpp | 29 +- .../Lumos/Platform/Vulkan/VKRenderPass.h | 1 + .../Lumos/Platform/Vulkan/VKRenderer.cpp | 16 +- .../Source/Lumos/Platform/Vulkan/VKShader.cpp | 25 +- Lumos/Source/Lumos/Platform/Vulkan/VKShader.h | 4 - .../Lumos/Platform/Vulkan/VKSwapChain.cpp | 5 +- .../Lumos/Platform/Vulkan/VKTexture.cpp | 4 +- .../Lumos/Platform/Vulkan/VKUtilities.cpp | 28 + .../Lumos/Platform/Vulkan/VKUtilities.h | 3 + .../Lumos/Platform/Windows/WindowsWindow.cpp | 56 +- .../Lumos/Platform/Windows/WindowsWindow.h | 2 +- Lumos/Source/Lumos/Platform/iOS/iOSWindow.h | 2 +- .../Source/Lumos/Scene/Component/Components.h | 15 + Lumos/Source/Lumos/Scene/EntityManager.cpp | 6 +- Lumos/Source/Lumos/Scene/EntityManager.h | 23 +- Lumos/Source/Lumos/Scene/Scene.cpp | 188 +- Lumos/Source/Lumos/Scene/Scene.h | 3 + Lumos/Source/Lumos/Scene/SystemManager.h | 2 +- Lumos/Source/Lumos/Scripting/Lua/ImGuiLua.cpp | 16 +- Lumos/Source/Lumos/Scripting/Lua/MathsLua.cpp | 25 +- Lumos/Source/Lumos/Utilities/AssetManager.cpp | 1 - Lumos/Source/Lumos/Utilities/CombineHash.h | 2 +- 86 files changed, 6841 insertions(+), 429 deletions(-) create mode 100644 ExampleProject/Assets/Meshes/Materials/Material0##0.lmat create mode 100644 ExampleProject/PrefabTest.lprefab diff --git a/Editor/Source/ApplicationInfoPanel.cpp b/Editor/Source/ApplicationInfoPanel.cpp index ff860406c..d85cd4c0c 100644 --- a/Editor/Source/ApplicationInfoPanel.cpp +++ b/Editor/Source/ApplicationInfoPanel.cpp @@ -72,7 +72,7 @@ namespace Lumos // if (frame > (int)(ImGui::GetIO().Framerate / 60)) { rdata.AddPoint(t, ImGui::GetIO().Framerate); - rdata1.AddPoint(t, Lumos::Engine::GetTimeStep().GetMillis()); // 1000.0f / ImGui::GetIO().Framerate); + rdata1.AddPoint(t, (float)Lumos::Engine::GetTimeStep().GetMillis()); // 1000.0f / ImGui::GetIO().Framerate); } static ImPlotAxisFlags rt_axis = ImPlotAxisFlags_NoTickLabels; diff --git a/Editor/Source/Editor.cpp b/Editor/Source/Editor.cpp index 269a673bc..c61ef8e37 100644 --- a/Editor/Source/Editor.cpp +++ b/Editor/Source/Editor.cpp @@ -362,6 +362,17 @@ namespace Lumos return false; } + bool IsPrefab(const std::string& filePath) + { + LUMOS_PROFILE_FUNCTION(); + std::string extension = StringUtilities::GetFilePathExtension(filePath); + extension = StringUtilities::ToLower(extension); + if(extension == "lprefab") + return true; + + return false; + } + void Editor::OnImGui() { LUMOS_PROFILE_FUNCTION(); @@ -808,9 +819,12 @@ namespace Lumos ImGui::Separator(); ImGui::TextUnformatted("Third-Party"); - ImGui::Text("ImGui - Version : %s, Revision - %d", IMGUI_VERSION, IMGUI_VERSION_NUM); - ImGui::Text("Entt - Version %s", ENTT_VERSION); - ImGui::Text("Cereal - Version %d.&d.%d", CEREAL_VERSION_MAJOR, CEREAL_VERSION_MINOR, CEREAL_VERSION_PATCH); + if(ImGui::MenuItem(fmt::format("ImGui - Version : {0}, Revision - {1}", IMGUI_VERSION, IMGUI_VERSION_NUM).c_str())) + Lumos::OS::Instance()->OpenURL("https://github.com/ocornut/imgui"); + if(ImGui::MenuItem(fmt::format("Entt - Version : {0}", ENTT_VERSION).c_str())) + Lumos::OS::Instance()->OpenURL("https://github.com/skypjack/entt"); + if(ImGui::MenuItem(fmt::format("Cereal - Version : {0}.{1}.{2}", CEREAL_VERSION_MAJOR, CEREAL_VERSION_MINOR, CEREAL_VERSION_PATCH).c_str())) + Lumos::OS::Instance()->OpenURL("https://github.com/USCiLab/cereal"); ImGui::EndMenu(); } @@ -1357,8 +1371,6 @@ namespace Lumos glm::mat4 medianPointMatrix = glm::translate(glm::mat4(1.0f), medianPointLocation) * glm::scale(glm::mat4(1.0f), medianPointScale); - glm::mat4 projectionMatrix, viewMatrix; - ImGuizmo::SetDrawlist(); ImGuizmo::SetOrthographic(m_CurrentCamera->IsOrthographic()); @@ -1811,7 +1823,7 @@ namespace Lumos autoSaveTimer = 0; } - autoSaveTimer += ts.GetMillis(); + autoSaveTimer += (float)ts.GetMillis(); } if(m_EditorState == EditorState::Play) @@ -1853,7 +1865,7 @@ namespace Lumos m_EditorCameraController.HandleKeyboard(m_EditorCameraTransform, (float)ts.GetSeconds()); m_EditorCameraTransform.SetWorldMatrix(glm::mat4(1.0f)); - if(Input::Get().GetKeyPressed(InputCode::Key::F)) + if(!m_SelectedEntities.empty() && Input::Get().GetKeyPressed(InputCode::Key::F)) { if(registry.valid(m_SelectedEntities.front())) { @@ -2076,6 +2088,19 @@ namespace Lumos } } + if(m_Settings.m_DebugDrawFlags & EditorDebugFlags::EntityNames) + { + auto transform = registry.view(); + + for(auto entity : transform) + { + Entity e = { entity, GetCurrentScene() }; + { + DebugRenderer::DrawTextWsNDT(e.GetTransform().GetWorldPosition(), 20.0f, glm::vec4(1.0f), e.GetName()); + } + } + } + for(auto m_SelectedEntity : m_SelectedEntities) if(registry.valid(m_SelectedEntity)) // && Application::Get().GetEditorState() == EditorState::Preview) { @@ -2487,6 +2512,10 @@ namespace Lumos SharedPtr texture = SharedPtr(Graphics::Texture2D::CreateFromFile(path, path)); sprite.SetTexture(texture); } + else if(IsPrefab(path)) + { + m_SceneManager->GetCurrentScene()->InstantiatePrefab(path); + } } void Editor::FileEmbedCallback(const std::string& filePath) diff --git a/Editor/Source/Editor.h b/Editor/Source/Editor.h index 16f9dff85..14d818d4a 100644 --- a/Editor/Source/Editor.h +++ b/Editor/Source/Editor.h @@ -45,6 +45,8 @@ namespace Lumos CameraFrustum = 8, MeshBoundingBoxes = 16, SpriteBoxes = 32, + EntityNames = 64, + }; class Editor : public Application diff --git a/Editor/Source/GameViewPanel.cpp b/Editor/Source/GameViewPanel.cpp index 78fa06776..dfa1bdeba 100644 --- a/Editor/Source/GameViewPanel.cpp +++ b/Editor/Source/GameViewPanel.cpp @@ -37,6 +37,7 @@ namespace Lumos m_RenderPasses = CreateUniquePtr(m_Width, m_Height); m_RenderPasses->GetSettings().DebugPass = false; + m_RenderPasses->m_DebugRenderEnabled = false; } static std::string AspectToString(float aspect) @@ -172,6 +173,9 @@ namespace Lumos sceneViewSize.x -= static_cast(sceneViewSize.x) % 2 != 0 ? 1.0f : 0.0f; sceneViewSize.y -= static_cast(sceneViewSize.y) % 2 != 0 ? 1.0f : 0.0f; + sceneViewSize.x = Maths::Max(sceneViewSize.x, 2); + sceneViewSize.y = Maths::Max(sceneViewSize.y, 2); + Resize(static_cast(sceneViewSize.x), static_cast(sceneViewSize.y)); if(m_Editor->GetSettings().m_HalfRes) diff --git a/Editor/Source/HierarchyPanel.cpp b/Editor/Source/HierarchyPanel.cpp index bdd5672b0..63f58bf3c 100644 --- a/Editor/Source/HierarchyPanel.cpp +++ b/Editor/Source/HierarchyPanel.cpp @@ -39,6 +39,8 @@ namespace Lumos if(!registry.valid(node)) return; + Entity nodeEntity = { node, Application::Get().GetSceneManager()->GetCurrentScene() }; + static const char* defaultName = "Entity"; const NameComponent* nameComponent = registry.try_get(node); const char* name = nameComponent ? nameComponent->name.c_str() : defaultName; // StringUtilities::ToString(entt::to_integral(node)); @@ -156,7 +158,33 @@ namespace Lumos ImGui::PopStyleColor(); ImGui::SameLine(); if(!doubleClicked) + { + bool isPrefab = false; + if(registry.any_of(node)) + isPrefab = true; + else + { + auto Parent = nodeEntity.GetParent(); + while(Parent && Parent.Valid()) + { + if(Parent.HasComponent()) + { + isPrefab = true; + Parent = {}; + } + else + { + Parent = Parent.GetParent(); + } + } + } + + if(isPrefab) + ImGui::PushStyleColor(ImGuiCol_Text, ImGui::GetStyleColorVec4(ImGuiCol_CheckMark)); ImGui::TextUnformatted(name); + if(isPrefab) + ImGui::PopStyleColor(); + } // ImGui::EndGroup(); if(doubleClicked) @@ -328,7 +356,7 @@ namespace Lumos if(m_SelectUp) { - if(m_Editor->GetSelected().front() == node && registry.valid(m_CurrentPrevious)) + if(!m_Editor->GetSelected().empty() && m_Editor->GetSelected().front() == node && registry.valid(m_CurrentPrevious)) { m_SelectUp = false; m_Editor->SetSelected(m_CurrentPrevious); @@ -337,7 +365,7 @@ namespace Lumos if(m_SelectDown) { - if(registry.valid(m_CurrentPrevious) && m_CurrentPrevious == m_Editor->GetSelected().front()) + if(!m_Editor->GetSelected().empty() && registry.valid(m_CurrentPrevious) && m_CurrentPrevious == m_Editor->GetSelected().front()) { m_SelectDown = false; m_Editor->SetSelected(node); @@ -377,7 +405,7 @@ namespace Lumos entt::entity child = hierarchyComponent->First(); while(child != entt::null && registry.valid(child)) { - float HorizontalTreeLineSize = 16.0f * Application::Get().GetWindowDPI(); // chosen arbitrarily + float HorizontalTreeLineSize = 20.0f * Application::Get().GetWindowDPI(); // chosen arbitrarily auto currentPos = ImGui::GetCursorScreenPos(); ImGui::Indent(10.0f); @@ -388,7 +416,7 @@ namespace Lumos entt::entity firstChild = childHerarchyComponent->First(); if(firstChild != entt::null && registry.valid(firstChild)) { - HorizontalTreeLineSize *= 0.5f; + HorizontalTreeLineSize *= 0.1f; } } DrawNode(child, registry); @@ -627,15 +655,16 @@ namespace Lumos // ImGuiUtilities::AlternatingRowsBackground(ImGui::GetFontSize() + ImGui::GetStyle().FramePadding.y); - registry.each([&](auto entity) - { - if(registry.valid(entity)) - { - auto hierarchyComponent = registry.try_get(entity); - - if(!hierarchyComponent || hierarchyComponent->Parent() == entt::null) - DrawNode(entity, registry); - } }); + for(auto [entity] : registry.storage().each()) + { + if(registry.valid(entity)) + { + auto hierarchyComponent = registry.try_get(entity); + + if(!hierarchyComponent || hierarchyComponent->Parent() == entt::null) + DrawNode(entity, registry); + } + } // Only supports one scene ImVec2 min_space = ImGui::GetWindowContentRegionMin(); diff --git a/Editor/Source/InspectorPanel.cpp b/Editor/Source/InspectorPanel.cpp index 629b592dd..833ebe573 100644 --- a/Editor/Source/InspectorPanel.cpp +++ b/Editor/Source/InspectorPanel.cpp @@ -34,6 +34,10 @@ #include #include +#include +#include +#include + // #include #include @@ -1954,6 +1958,21 @@ end { using namespace Lumos; ImGui::Indent(); + if(ImGui::Button("Save to file")) + { + std::string filePath = "//Meshes"; // Materials/" + matName + ".lmat"; + std::string physicalPath; + if(VFS::Get().ResolvePhysicalPath(filePath, physicalPath)) + { + physicalPath += "/Materials/" + matName + ".lmat"; + std::stringstream storage; + + cereal::JSONOutputArchive output { storage }; + material->save(output); + + FileSystem::WriteTextFile(physicalPath, storage.str()); + } + } bool flipImage = Graphics::Renderer::GetGraphicsContext()->FlipImGUITexture(); bool twoSided = material->GetFlag(Lumos::Graphics::Material::RenderFlags::TWOSIDED); @@ -2326,7 +2345,9 @@ namespace Lumos { ImGuiUtilities::PushID(); - if(!Application::Get().GetSceneManager()->GetCurrentScene()) + Scene* currentScene = Application::Get().GetSceneManager()->GetCurrentScene(); + + if(!currentScene) { m_Editor->SetSelected(entt::null); ImGuiUtilities::PopID(); @@ -2334,7 +2355,7 @@ namespace Lumos return; } - auto& registry = Application::Get().GetSceneManager()->GetCurrentScene()->GetRegistry(); + auto& registry = currentScene->GetRegistry(); if(selectedEntities.size() != 1 || !registry.valid(selectedEntities.front())) { m_Editor->SetSelected(entt::null); @@ -2343,7 +2364,8 @@ namespace Lumos return; } - auto selected = selectedEntities.front(); + auto selected = selectedEntities.front(); + Entity SelectedEntity = { selected, currentScene }; // active checkbox auto activeComponent = registry.try_get(selected); @@ -2379,7 +2401,7 @@ namespace Lumos } ImGui::SameLine(); - ImGui::PushItemWidth(ImGui::GetContentRegionAvail().x - ImGui::GetFontSize() * 2.0f); + ImGui::PushItemWidth(ImGui::GetContentRegionAvail().x - ImGui::GetFontSize() * 4.0f); { ImGuiUtilities::ScopedFont boldFont(ImGui::GetIO().Fonts->Fonts[1]); if(ImGuiUtilities::InputText(name)) @@ -2389,12 +2411,29 @@ namespace Lumos ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.7f, 0.7f, 0.7f, 0.0f)); + if(ImGui::Button(ICON_MDI_FLOPPY)) + ImGui::OpenPopup("SavePrefab"); + + ImGuiUtilities::Tooltip("Save Entity As Prefab"); + + ImGui::SameLine(); if(ImGui::Button(ICON_MDI_TUNE)) ImGui::OpenPopup("SetDebugMode"); ImGui::PopStyleColor(); if(ImGui::BeginPopup("SetDebugMode", 3)) { + if(SelectedEntity.HasComponent() && ImGui::Button("Revert To Prefab")) + { + auto path = SelectedEntity.GetComponent().Path; + m_Editor->UnSelect(selected); + SelectedEntity.Destroy(); + + SelectedEntity = Application::Get().GetSceneManager()->GetCurrentScene()->InstantiatePrefab(path); + selected = SelectedEntity.GetHandle(); + m_Editor->SetSelected(selected); + } + if(ImGui::Selectable("Debug Mode", m_DebugMode)) { m_DebugMode = !m_DebugMode; @@ -2402,6 +2441,40 @@ namespace Lumos ImGui::EndPopup(); } + if(ImGui::BeginPopupModal("SavePrefab", NULL, ImGuiWindowFlags_AlwaysAutoResize)) + { + ImGui::Text("Save Current Entity as a Prefab?\n\n"); + ImGui::Separator(); + + static std::string prefabName = SelectedEntity.GetName(); + ImGui::AlignTextToFramePadding(); + ImGui::TextUnformatted("Name : "); + ImGui::SameLine(); + ImGuiUtilities::InputText(prefabName); + + static std::string prefabNamePath = "//Assets/Prefabs/"; + ImGui::AlignTextToFramePadding(); + ImGui::TextUnformatted("Path : "); + ImGui::SameLine(); + ImGuiUtilities::InputText(prefabNamePath); + + if(ImGui::Button("OK", ImVec2(120, 0))) + { + std::string physicalPath; + VFS::Get().ResolvePhysicalPath(prefabNamePath, physicalPath, true); + std::string FullPath = physicalPath + prefabName + std::string(".lprefab"); + Application::Get().GetSceneManager()->GetCurrentScene()->SavePrefab({ selected, Application::Get().GetSceneManager()->GetCurrentScene() }, FullPath); + ImGui::CloseCurrentPopup(); + } + ImGui::SetItemDefaultFocus(); + ImGui::SameLine(); + if(ImGui::Button("Cancel", ImVec2(120, 0))) + { + ImGui::CloseCurrentPopup(); + } + ImGui::EndPopup(); + } + ImGui::Separator(); if(m_DebugMode) @@ -2447,6 +2520,15 @@ namespace Lumos ImGui::Separator(); } + if(registry.try_get(selected)) + { + ImGui::PushStyleColor(ImGuiCol_Text, ImGui::GetStyleColorVec4(ImGuiCol_CheckMark)); + ImGui::Separator(); + ImGui::Text("Prefab %s", registry.get(selected).Path.c_str()); + ImGui::Separator(); + ImGui::PopStyleColor(); + } + ImGui::BeginChild("Components", ImVec2(0.0f, 0.0f), false, ImGuiWindowFlags_None); m_EnttEditor.RenderImGui(registry, selected); ImGui::EndChild(); diff --git a/Editor/Source/ResourcePanel.cpp b/Editor/Source/ResourcePanel.cpp index 9b1ca90af..2a1cdc47b 100644 --- a/Editor/Source/ResourcePanel.cpp +++ b/Editor/Source/ResourcePanel.cpp @@ -38,7 +38,7 @@ namespace Lumos static const std::unordered_map s_FileTypes = { { ".lsn", FileType::Scene }, - { ".prefab", FileType::Prefab }, + { ".lprefab", FileType::Prefab }, { ".cs", FileType::Script }, { ".lua", FileType::Script }, { ".glsl", FileType::Shader }, @@ -161,6 +161,22 @@ namespace Lumos m_Directories.erase(m_Directories.find(directory->FilePath.string())); } + bool IsHidden(const std::filesystem::path& filePath) + { + std::filesystem::status(filePath); + try + { + std::filesystem::file_status status = std::filesystem::status(filePath); + return (status.permissions() & std::filesystem::perms::owner_read) == std::filesystem::perms::none; + } + catch(const std::filesystem::filesystem_error& ex) + { + std::cerr << "Error accessing file: " << ex.what() << std::endl; + } + + return false; // Return false by default if any error occurs + } + std::string ResourcePanel::ProcessDirectory(const std::filesystem::path& directoryPath, const SharedPtr& parent) { const auto& directory = m_Directories[directoryPath.string()]; @@ -175,13 +191,16 @@ namespace Lumos else directoryInfo->FilePath = std::filesystem::relative(directoryPath, m_BasePath); + directoryInfo->FullPath = directoryPath; + directoryInfo->FileTypeID = GetParsedAssetID(StringUtilities::GetFilePathExtension(directoryInfo->FilePath.string())); + if(std::filesystem::is_directory(directoryPath)) { directoryInfo->IsFile = false; directoryInfo->Name = directoryPath.filename().string(); - for(auto entry : std::filesystem::directory_iterator(directoryPath)) + for(auto& entry : std::filesystem::directory_iterator(directoryPath)) { - if(!m_ShowHiddenFiles && Lumos::StringUtilities::IsHiddenFile(entry.path().string())) + if(!m_ShowHiddenFiles && IsHidden(entry.path())) { continue; } @@ -255,10 +274,10 @@ namespace Lumos nodeFlags |= ImGuiTreeNodeFlags_OpenOnArrow | ImGuiTreeNodeFlags_AllowOverlap | ImGuiTreeNodeFlags_SpanAvailWidth; bool isOpen = ImGui::TreeNodeEx((void*)(intptr_t)(dirInfo.get()), nodeFlags, ""); - if (ImGui::IsItemClicked()) + if(ImGui::IsItemClicked()) { - m_PreviousDirectory = m_CurrentDir; - m_CurrentDir = dirInfo; + m_PreviousDirectory = m_CurrentDir; + m_CurrentDir = dirInfo; m_UpdateNavigationPath = true; } @@ -272,8 +291,6 @@ namespace Lumos ImVec2 verticalLineStart = ImGui::GetCursorScreenPos(); - - if(isOpen && containsFolder) { verticalLineStart.x += SmallOffsetX; // to nicely line up with the arrow symbol @@ -428,7 +445,7 @@ namespace Lumos if(ImGui::Selectable("New folder")) { - std::filesystem::create_directory(std::filesystem::path(m_BasePath + "/" + m_CurrentDir->FilePath.string() + "/NewFolder")); + std::filesystem::create_directory(std::filesystem::path(m_CurrentDir->FullPath / "NewFolder")); Refresh(); } @@ -655,12 +672,12 @@ namespace Lumos if(m_CutFile) { const std::filesystem::path& fullPath = m_CopiedPath; - std::string filename = fullPath.stem().string(); - std::string extension = fullPath.extension().string(); + std::string filename = fullPath.stem().string(); + std::string extension = fullPath.extension().string(); std::filesystem::path destinationPath = m_BasePath / m_CurrentDir->FilePath / (filename + extension); - + { - while (std::filesystem::exists(destinationPath)) + while(std::filesystem::exists(destinationPath)) { filename += "_copy"; destinationPath = destinationPath.parent_path() / (filename + extension); @@ -671,12 +688,12 @@ namespace Lumos else { const std::filesystem::path& fullPath = m_CopiedPath; - std::string filename = fullPath.stem().string(); - std::string extension = fullPath.extension().string(); + std::string filename = fullPath.stem().string(); + std::string extension = fullPath.extension().string(); std::filesystem::path destinationPath = m_BasePath / m_CurrentDir->FilePath / (filename + extension); - + { - while (std::filesystem::exists(destinationPath)) + while(std::filesystem::exists(destinationPath)) { filename += "_copy"; destinationPath = destinationPath.parent_path() / (filename + extension); @@ -685,10 +702,10 @@ namespace Lumos std::filesystem::copy(fullPath, destinationPath); } m_CopiedPath = ""; - m_CutFile = false; + m_CutFile = false; Refresh(); } - + if(ImGui::Selectable("Open Location")) { auto fullPath = m_BasePath + "/" + m_CurrentDir->FilePath.string(); @@ -792,7 +809,6 @@ namespace Lumos bool ResourcePanel::RenderFile(int dirIndex, bool folder, int shownIndex, bool gridView) { LUMOS_PROFILE_FUNCTION(); - auto fileID = GetParsedAssetID(StringUtilities::GetFilePathExtension(m_CurrentDir->Children[dirIndex]->FilePath.string())); constexpr float padding = 4.0f; const float scaledThumbnailSize = m_GridSize * ImGui::GetIO().FontGlobalScale; const float scaledThumbnailSizeX = scaledThumbnailSize * 0.55f; @@ -829,7 +845,7 @@ namespace Lumos else if(!textureCreated) { textureCreated = true; - CurrentEnty->Thumbnail = m_TextureLibrary.GetResource(m_BasePath + "/" + CurrentEnty->FilePath.string()); + CurrentEnty->Thumbnail = m_TextureLibrary.GetResource(CurrentEnty->FullPath.string()); textureId = CurrentEnty->Thumbnail ? CurrentEnty->Thumbnail->GetHandle() : m_FileIcon->GetHandle(); } else @@ -882,37 +898,36 @@ namespace Lumos if(ImGui::BeginPopupContextItem()) { m_CurrentSelected = m_CurrentDir->Children[dirIndex]; - + if(ImGui::Selectable("Cut")) { m_CopiedPath = (m_BasePath / m_CurrentDir->Children[dirIndex]->FilePath).string(); - m_CutFile = true; + m_CutFile = true; } - + if(ImGui::Selectable("Copy")) { m_CopiedPath = (m_BasePath / m_CurrentDir->Children[dirIndex]->FilePath).string(); - m_CutFile = false; + m_CutFile = false; } if(ImGui::Selectable("Delete")) { - auto fullPath = (m_BasePath / m_CurrentDir->Children[dirIndex]->FilePath).string(); - + auto& fullPath = m_CurrentDir->Children[dirIndex]->FullPath; std::filesystem::remove_all(fullPath); Refresh(); } if(ImGui::Selectable("Duplicate")) { - std::filesystem::path fullPath = m_BasePath + "/" + m_CurrentDir->Children[dirIndex]->FilePath.string(); + std::filesystem::path fullPath = m_BasePath + "/" + m_CurrentDir->Children[dirIndex]->FilePath.string(); std::filesystem::path destinationPath = fullPath; - + { - std::string filename = fullPath.stem().string(); + std::string filename = fullPath.stem().string(); std::string extension = fullPath.extension().string(); - - while (std::filesystem::exists(destinationPath)) + + while(std::filesystem::exists(destinationPath)) { filename += "_copy"; destinationPath = destinationPath.parent_path() / (filename + extension); @@ -924,19 +939,13 @@ namespace Lumos if(ImGui::Selectable("Open Location")) { - auto base = std::filesystem::path(m_BasePath); - base.make_preferred(); - auto fullPath = base / m_CurrentDir->Children[dirIndex]->FilePath; - + auto& fullPath = m_CurrentDir->Children[dirIndex]->FullPath; Lumos::OS::Instance()->OpenFileLocation(fullPath); } if(m_CurrentDir->Children[dirIndex]->IsFile && ImGui::Selectable("Open External")) { - auto base = std::filesystem::path(m_BasePath); - base.make_preferred(); - auto fullPath = base / m_CurrentDir->Children[dirIndex]->FilePath; - + auto& fullPath = m_CurrentDir->Children[dirIndex]->FullPath; Lumos::OS::Instance()->OpenFileExternal(fullPath); } @@ -969,13 +978,13 @@ namespace Lumos { ImGui::BeginTooltip(); ImGui::PushTextWrapPos(ImGui::GetFontSize() * 35.0f); - ImGui::TextUnformatted((m_BasePath + "/" + m_CurrentDir->Children[dirIndex]->FilePath.filename().string()).c_str()); + ImGui::TextUnformatted((m_CurrentDir->Children[dirIndex]->FullPath.string()).c_str()); ImGui::PopTextWrapPos(); ImGui::Image(m_CurrentDir->Children[dirIndex]->Thumbnail->GetHandle(), { 512, 512 }, ImVec2(0.0f, flipImage ? 1.0f : 0.0f), ImVec2(1.0f, flipImage ? 0.0f : 1.0f)); ImGui::EndTooltip(); } else - ImGuiUtilities::Tooltip((m_BasePath + "/" + m_CurrentDir->Children[dirIndex]->FilePath.filename().string()).c_str()); + ImGuiUtilities::Tooltip((const char*)(m_CurrentDir->Children[dirIndex]->FullPath.string()).c_str()); if(ImGui::BeginDragDropSource(ImGuiDragDropFlags_SourceAllowNullID)) { @@ -1037,7 +1046,7 @@ namespace Lumos } } - ImGuiUtilities::Tooltip(m_CurrentDir->Children[dirIndex]->FilePath.filename().string().c_str()); + ImGuiUtilities::Tooltip((const char*)m_CurrentDir->Children[dirIndex]->FilePath.filename().string().c_str()); if(ImGui::BeginDragDropSource(ImGuiDragDropFlags_SourceAllowNullID)) { @@ -1192,7 +1201,7 @@ namespace Lumos m_BasePath = Application::Get().GetProjectSettings().m_ProjectRoot + "Assets"; - auto currentPath = m_CurrentDir->FilePath; + auto& currentPath = m_CurrentDir->FilePath; m_UpdateNavigationPath = true; diff --git a/Editor/Source/ResourcePanel.h b/Editor/Source/ResourcePanel.h index fca709b85..5f496e897 100644 --- a/Editor/Source/ResourcePanel.h +++ b/Editor/Source/ResourcePanel.h @@ -34,6 +34,7 @@ namespace Lumos std::vector> Children; std::filesystem::path FilePath; + std::filesystem::path FullPath; bool IsFile; std::string Name; @@ -45,6 +46,7 @@ namespace Lumos FileType Type; std::string_view FileTypeString; std::string FileSize; + int FileTypeID; public: DirectoryInformation(const std::filesystem::path& fname, bool isF) @@ -165,7 +167,7 @@ namespace Lumos SharedPtr m_CurrentSelected; Lumos::TextureLibrary m_TextureLibrary; - + std::filesystem::path m_CopiedPath; bool m_CutFile = false; }; diff --git a/Editor/Source/SceneSettingsPanel.cpp b/Editor/Source/SceneSettingsPanel.cpp index 2a5632d56..135bc15fb 100644 --- a/Editor/Source/SceneSettingsPanel.cpp +++ b/Editor/Source/SceneSettingsPanel.cpp @@ -114,7 +114,7 @@ namespace Lumos ImGuiUtilities::Property("Saturation", sceneSettings.RenderSettings.Saturation, 0.0f, 1.0f, 0.01f); auto& registry = m_CurrentScene->GetRegistry(); - int entityCount = (int)registry.size(); + int entityCount = (int)registry.storage().size(); ImGuiUtilities::Property("Entity Count", entityCount, 0, 0, ImGuiUtilities::PropertyFlag::ReadOnly); static const char* debugModes[7] = { diff --git a/Editor/Source/SceneViewPanel.cpp b/Editor/Source/SceneViewPanel.cpp index c971ae4c1..954b34b0f 100644 --- a/Editor/Source/SceneViewPanel.cpp +++ b/Editor/Source/SceneViewPanel.cpp @@ -327,7 +327,15 @@ namespace Lumos ImGui::Separator(); - uint32_t flags = m_Editor->GetSettings().m_DebugDrawFlags; + uint32_t flags = m_Editor->GetSettings().m_DebugDrawFlags; + bool showEntityNames = flags & EditorDebugFlags::EntityNames; + if(ImGui::Checkbox("Entity Names", &showEntityNames)) + { + if(showEntityNames) + flags += EditorDebugFlags::EntityNames; + else + flags -= EditorDebugFlags::EntityNames; + } bool showAABB = flags & EditorDebugFlags::MeshBoundingBoxes; if(ImGui::Checkbox("Mesh AABB", &showAABB)) diff --git a/ExampleProject/Assets/Meshes/Materials/Material0##0.lmat b/ExampleProject/Assets/Meshes/Materials/Material0##0.lmat new file mode 100644 index 000000000..476a1d7b7 --- /dev/null +++ b/ExampleProject/Assets/Meshes/Materials/Material0##0.lmat @@ -0,0 +1,26 @@ +{ + "Albedo": "NULL", + "Normal": "NULL", + "Metallic": "NULL", + "Roughness": "", + "Ao": "", + "Emissive": "", + "albedoColour": { + "value0": 0.5879999995231628, + "value1": 0.5879999995231628, + "value2": 0.5879999995231628, + "value3": 1.0 + }, + "roughnessValue": 0.699999988079071, + "metallicValue": 0.699999988079071, + "emissiveValue": 0.0, + "albedoMapFactor": 1.0, + "metallicMapFactor": 1.0, + "roughnessMapFactor": 0.0, + "normalMapFactor": 1.0, + "aoMapFactor": 0.0, + "emissiveMapFactor": 0.0, + "alphaCutOff": 0.4000000059604645, + "workflow": 1.0, + "shader": "//CoreShaders/ForwardPBR.shader", + "Reflectance": 0.30000001192092898 \ No newline at end of file diff --git a/ExampleProject/PrefabTest.lprefab b/ExampleProject/PrefabTest.lprefab new file mode 100644 index 000000000..8a4a85d71 --- /dev/null +++ b/ExampleProject/PrefabTest.lprefab @@ -0,0 +1,4581 @@ +{ + "value0": 58, + "value1": 58, + "value2": 1048576, + "value3": 1, + "value4": 2097154, + "value5": 2097155, + "value6": 4, + "value7": 5, + "value8": 6, + "value9": 7, + "value10": 8, + "value11": 9, + "value12": 10, + "value13": 11, + "value14": 12, + "value15": 13, + "value16": 14, + "value17": 15, + "value18": 16, + "value19": 17, + "value20": 18, + "value21": 19, + "value22": 20, + "value23": 21, + "value24": 22, + "value25": 23, + "value26": 24, + "value27": 25, + "value28": 26, + "value29": 2097179, + "value30": 28, + "value31": 3145757, + "value32": 30, + "value33": 1048607, + "value34": 1048608, + "value35": 33, + "value36": 1048610, + "value37": 35, + "value38": 36, + "value39": 37, + "value40": 38, + "value41": 39, + "value42": 40, + "value43": 41, + "value44": 42, + "value45": 43, + "value46": 44, + "value47": 45, + "value48": 46, + "value49": 47, + "value50": 48, + "value51": 49, + "value52": 50, + "value53": 51, + "value54": 52, + "value55": 53, + "value56": 54, + "value57": 55, + "value58": 56, + "value59": 57, + "value60": 52, + "value61": 49, + "value62": { + "Position": { + "value0": -4.09690523147583, + "value1": 17.351110458374025, + "value2": 0.0 + }, + "Rotation": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0, + "value3": 0.9999998807907105 + }, + "Scale": { + "value0": 0.699999988079071, + "value1": 0.699999988079071, + "value2": 0.699999988079071 + } + }, + "value63": 50, + "value64": { + "Position": { + "value0": -1.5656273365020753, + "value1": 17.825361251831056, + "value2": 0.0 + }, + "Rotation": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0, + "value3": 0.9999998807907105 + }, + "Scale": { + "value0": 0.699999988079071, + "value1": 0.699999988079071, + "value2": 0.699999988079071 + } + }, + "value65": 51, + "value66": { + "Position": { + "value0": -1.5656355619430543, + "value1": 16.815269470214845, + "value2": 0.0 + }, + "Rotation": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0, + "value3": 0.9999998807907105 + }, + "Scale": { + "value0": 0.699999988079071, + "value1": 0.699999988079071, + "value2": 0.699999988079071 + } + }, + "value67": 52, + "value68": { + "Position": { + "value0": 3.067514419555664, + "value1": 19.870115280151368, + "value2": 0.0 + }, + "Rotation": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0, + "value3": 0.9999998807907105 + }, + "Scale": { + "value0": 0.699999988079071, + "value1": 0.699999988079071, + "value2": 0.699999988079071 + } + }, + "value69": 53, + "value70": { + "Position": { + "value0": -0.300402969121933, + "value1": 19.016862869262697, + "value2": 0.0 + }, + "Rotation": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0, + "value3": 0.9999998807907105 + }, + "Scale": { + "value0": 0.699999988079071, + "value1": 0.699999988079071, + "value2": 0.699999988079071 + } + }, + "value71": 54, + "value72": { + "Position": { + "value0": 8.74654483795166, + "value1": 19.018550872802736, + "value2": 0.0 + }, + "Rotation": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0, + "value3": 0.9999998807907105 + }, + "Scale": { + "value0": 0.699999988079071, + "value1": 0.699999988079071, + "value2": 0.699999988079071 + } + }, + "value73": 22, + "value74": { + "Position": { + "value0": 8.0, + "value1": 18.0, + "value2": 0.0 + }, + "Rotation": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0, + "value3": 1.0 + }, + "Scale": { + "value0": 1.0, + "value1": 1.0, + "value2": 1.0 + } + }, + "value75": 21, + "value76": { + "Position": { + "value0": 7.0, + "value1": 18.0, + "value2": 0.0 + }, + "Rotation": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0, + "value3": 1.0 + }, + "Scale": { + "value0": 1.0, + "value1": 1.0, + "value2": 1.0 + } + }, + "value77": 20, + "value78": { + "Position": { + "value0": 6.0, + "value1": 18.0, + "value2": 0.0 + }, + "Rotation": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0, + "value3": 1.0 + }, + "Scale": { + "value0": 1.0, + "value1": 1.0, + "value2": 1.0 + } + }, + "value79": 19, + "value80": { + "Position": { + "value0": 5.0, + "value1": 18.0, + "value2": 0.0 + }, + "Rotation": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0, + "value3": 1.0 + }, + "Scale": { + "value0": 1.0, + "value1": 1.0, + "value2": 1.0 + } + }, + "value81": 18, + "value82": { + "Position": { + "value0": 4.0, + "value1": 18.0, + "value2": 0.0 + }, + "Rotation": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0, + "value3": 1.0 + }, + "Scale": { + "value0": 1.0, + "value1": 1.0, + "value2": 1.0 + } + }, + "value83": 17, + "value84": { + "Position": { + "value0": 3.0, + "value1": 18.0, + "value2": 0.0 + }, + "Rotation": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0, + "value3": 1.0 + }, + "Scale": { + "value0": 1.0, + "value1": 1.0, + "value2": 1.0 + } + }, + "value85": 16, + "value86": { + "Position": { + "value0": 2.0, + "value1": 18.0, + "value2": 0.0 + }, + "Rotation": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0, + "value3": 1.0 + }, + "Scale": { + "value0": 1.0, + "value1": 1.0, + "value2": 1.0 + } + }, + "value87": 15, + "value88": { + "Position": { + "value0": 1.0, + "value1": 18.0, + "value2": 0.0 + }, + "Rotation": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0, + "value3": 1.0 + }, + "Scale": { + "value0": 1.0, + "value1": 1.0, + "value2": 1.0 + } + }, + "value89": 14, + "value90": { + "Position": { + "value0": 0.0, + "value1": 18.0, + "value2": 0.0 + }, + "Rotation": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0, + "value3": 1.0 + }, + "Scale": { + "value0": 1.0, + "value1": 1.0, + "value2": 1.0 + } + }, + "value91": 13, + "value92": { + "Position": { + "value0": 9.0, + "value1": 17.0, + "value2": 0.0 + }, + "Rotation": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0, + "value3": 1.0 + }, + "Scale": { + "value0": 1.0, + "value1": 1.0, + "value2": 1.0 + } + }, + "value93": 12, + "value94": { + "Position": { + "value0": 8.0, + "value1": 17.0, + "value2": 0.0 + }, + "Rotation": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0, + "value3": 1.0 + }, + "Scale": { + "value0": 1.0, + "value1": 1.0, + "value2": 1.0 + } + }, + "value95": 11, + "value96": { + "Position": { + "value0": 7.0, + "value1": 17.0, + "value2": 0.0 + }, + "Rotation": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0, + "value3": 1.0 + }, + "Scale": { + "value0": 1.0, + "value1": 1.0, + "value2": 1.0 + } + }, + "value97": 10, + "value98": { + "Position": { + "value0": 6.0, + "value1": 17.0, + "value2": 0.0 + }, + "Rotation": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0, + "value3": 1.0 + }, + "Scale": { + "value0": 1.0, + "value1": 1.0, + "value2": 1.0 + } + }, + "value99": 9, + "value100": { + "Position": { + "value0": 5.0, + "value1": 17.0, + "value2": 0.0 + }, + "Rotation": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0, + "value3": 1.0 + }, + "Scale": { + "value0": 1.0, + "value1": 1.0, + "value2": 1.0 + } + }, + "value101": 8, + "value102": { + "Position": { + "value0": 4.0, + "value1": 17.0, + "value2": 0.0 + }, + "Rotation": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0, + "value3": 1.0 + }, + "Scale": { + "value0": 1.0, + "value1": 1.0, + "value2": 1.0 + } + }, + "value103": 7, + "value104": { + "Position": { + "value0": 3.0, + "value1": 17.0, + "value2": 0.0 + }, + "Rotation": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0, + "value3": 1.0 + }, + "Scale": { + "value0": 1.0, + "value1": 1.0, + "value2": 1.0 + } + }, + "value105": 6, + "value106": { + "Position": { + "value0": 2.0, + "value1": 17.0, + "value2": 0.0 + }, + "Rotation": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0, + "value3": 1.0 + }, + "Scale": { + "value0": 1.0, + "value1": 1.0, + "value2": 1.0 + } + }, + "value107": 5, + "value108": { + "Position": { + "value0": 1.017281413078308, + "value1": 17.0, + "value2": 0.00005555157258640975 + }, + "Rotation": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0, + "value3": 1.0 + }, + "Scale": { + "value0": 0.9999999403953552, + "value1": 0.9999999403953552, + "value2": 0.9999999403953552 + } + }, + "value109": 4, + "value110": { + "Position": { + "value0": 0.0, + "value1": 17.0, + "value2": 0.0 + }, + "Rotation": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0, + "value3": 1.0 + }, + "Scale": { + "value0": 1.0, + "value1": 1.0, + "value2": 1.0 + } + }, + "value111": 2097155, + "value112": { + "Position": { + "value0": -0.29128527641296389, + "value1": 4.3156633377075199, + "value2": 99.78291320800781 + }, + "Rotation": { + "value0": 0.0, + "value1": 0.7094271779060364, + "value2": 0.0, + "value3": 0.7047786712646484 + }, + "Scale": { + "value0": 6.0, + "value1": 14.199999809265137, + "value2": 200.0 + } + }, + "value113": 2097154, + "value114": { + "Position": { + "value0": 0.01968160644173622, + "value1": 4.281795501708984, + "value2": -99.7276840209961 + }, + "Rotation": { + "value0": 0.0, + "value1": 0.7071067690849304, + "value2": 0.0, + "value3": 0.7071067690849304 + }, + "Scale": { + "value0": 6.000001907348633, + "value1": 14.199992179870606, + "value2": 199.99998474121095 + } + }, + "value115": 1, + "value116": { + "Position": { + "value0": 0.0, + "value1": -1.5239448547363282, + "value2": 0.0 + }, + "Rotation": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0, + "value3": 1.0 + }, + "Scale": { + "value0": 200.0, + "value1": 1.0, + "value2": 200.0 + } + }, + "value117": 1048576, + "value118": { + "Position": { + "value0": 9.0, + "value1": 18.0, + "value2": 0.0 + }, + "Rotation": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0, + "value3": 1.0 + }, + "Scale": { + "value0": 1.0, + "value1": 1.0, + "value2": 1.0 + } + }, + "value119": 38, + "value120": { + "Position": { + "value0": 98.88309478759766, + "value1": 4.266810894012451, + "value2": 0.0 + }, + "Rotation": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0, + "value3": 1.0000001192092896 + }, + "Scale": { + "value0": 6.0, + "value1": 14.199999809265137, + "value2": 200.0 + } + }, + "value121": 39, + "value122": { + "Position": { + "value0": 74.57472229003906, + "value1": -0.869247317314148, + "value2": -0.005169916898012161 + }, + "Rotation": { + "value0": 0.0, + "value1": 0.0, + "value2": -0.36880773305892947, + "value3": 0.9295057058334351 + }, + "Scale": { + "value0": 6.0, + "value1": 28.0, + "value2": 200.0 + } + }, + "value123": 40, + "value124": { + "Position": { + "value0": -15.478693962097168, + "value1": 0.0, + "value2": 0.02301521971821785 + }, + "Rotation": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0, + "value3": 1.0 + }, + "Scale": { + "value0": 0.9999998807907105, + "value1": 0.9999998807907105, + "value2": 0.9999998807907105 + } + }, + "value125": 41, + "value126": { + "Position": { + "value0": -29.563642501831056, + "value1": 0.0, + "value2": -0.000012192476788186469 + }, + "Rotation": { + "value0": 0.0, + "value1": 0.020245814695954324, + "value2": 0.0, + "value3": 0.9997950196266174 + }, + "Scale": { + "value0": 1.0000109672546387, + "value1": 0.9999998807907105, + "value2": 1.0000109672546387 + } + }, + "value127": 42, + "value128": { + "Position": { + "value0": -14.91064453125, + "value1": 0.0, + "value2": 0.0 + }, + "Rotation": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0, + "value3": 1.0 + }, + "Scale": { + "value0": 0.9999999403953552, + "value1": 0.9999999403953552, + "value2": 0.9999999403953552 + } + }, + "value129": 43, + "value130": { + "Position": { + "value0": -25.742326736450197, + "value1": 0.0, + "value2": 0.0 + }, + "Rotation": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0, + "value3": 1.0 + }, + "Scale": { + "value0": 0.9999999403953552, + "value1": 0.9999999403953552, + "value2": 0.9999999403953552 + } + }, + "value131": 44, + "value132": { + "Position": { + "value0": 0.0, + "value1": 1.0257916450500489, + "value2": 0.0 + }, + "Rotation": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0, + "value3": 0.9999998807907105 + }, + "Scale": { + "value0": 1.0000207424163819, + "value1": 1.0000123977661133, + "value2": 0.9999999403953552 + } + }, + "value133": 45, + "value134": { + "Position": { + "value0": 16.0, + "value1": 0.6939997673034668, + "value2": 2.0 + }, + "Rotation": { + "value0": -0.7192198038101196, + "value1": 0.0, + "value2": 0.0, + "value3": 0.6947826743125916 + }, + "Scale": { + "value0": 1.0000207424163819, + "value1": 1.000012755393982, + "value2": 1.0000007152557374 + } + }, + "value135": 46, + "value136": { + "Position": { + "value0": 13.0, + "value1": 0.6939997673034668, + "value2": 2.0 + }, + "Rotation": { + "value0": -0.7192209959030151, + "value1": -0.0, + "value2": 0.0, + "value3": 0.6947813630104065 + }, + "Scale": { + "value0": 1.0000207424163819, + "value1": 1.000012755393982, + "value2": 1.0000007152557374 + } + }, + "value137": 47, + "value138": { + "Position": { + "value0": -2.8255271911621095, + "value1": 9.712101936340332, + "value2": 0.0 + }, + "Rotation": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0, + "value3": 1.0 + }, + "Scale": { + "value0": 1.0, + "value1": 1.0, + "value2": 1.0 + } + }, + "value139": 48, + "value140": { + "Position": { + "value0": -36.306640625, + "value1": 4.499866485595703, + "value2": 0.0 + }, + "Rotation": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0, + "value3": 1.0 + }, + "Scale": { + "value0": 1.0, + "value1": 1.0, + "value2": 1.0 + } + }, + "value141": 37, + "value142": { + "Position": { + "value0": -36.72534942626953, + "value1": 16.028718948364259, + "value2": 22.700944900512697 + }, + "Rotation": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0, + "value3": 1.0 + }, + "Scale": { + "value0": 0.9999998807907105, + "value1": 0.9999998211860657, + "value2": 0.9999997615814209 + } + }, + "value143": 25, + "value144": { + "Position": { + "value0": 26.0, + "value1": 22.0, + "value2": 48.5 + }, + "Rotation": { + "value0": -0.18377967178821565, + "value1": 0.2487904578447342, + "value2": 0.044185034930706027, + "value3": 0.9499346613883972 + }, + "Scale": { + "value0": 1.0000001192092896, + "value1": 0.9999997615814209, + "value2": 1.0000001192092896 + } + }, + "value145": 36, + "value146": { + "Position": { + "value0": 0.0, + "value1": 2.349538803100586, + "value2": -0.00330352783203125 + }, + "Rotation": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0, + "value3": 1.0 + }, + "Scale": { + "value0": 1.0, + "value1": 1.0, + "value2": 1.0 + } + }, + "value147": 26, + "value148": { + "Position": { + "value0": 0.002742767333984375, + "value1": 2.338712692260742, + "value2": 3.177652359008789 + }, + "Rotation": { + "value0": -0.26047149300575259, + "value1": 0.0, + "value2": 0.0, + "value3": 0.9654815196990967 + }, + "Scale": { + "value0": 0.999993085861206, + "value1": 0.9999967813491821, + "value2": 0.9999943971633911 + } + }, + "value149": 35, + "value150": { + "Position": { + "value0": 0.0, + "value1": -0.8354345560073853, + "value2": 76.22335815429688 + }, + "Rotation": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0, + "value3": 0.9999999403953552 + }, + "Scale": { + "value0": 0.9999998211860657, + "value1": 0.9999998211860657, + "value2": 0.9999998211860657 + } + }, + "value151": 30, + "value152": { + "Position": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0 + }, + "Rotation": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0, + "value3": 1.0 + }, + "Scale": { + "value0": 0.9999999403953552, + "value1": 0.9999999403953552, + "value2": 0.9999999403953552 + } + }, + "value153": 28, + "value154": { + "Position": { + "value0": 34.3039436340332, + "value1": 15.190068244934082, + "value2": 28.320514678955079 + }, + "Rotation": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0, + "value3": 1.0 + }, + "Scale": { + "value0": 0.9999999403953552, + "value1": 0.9999999403953552, + "value2": 0.9999999403953552 + } + }, + "value155": 33, + "value156": { + "Position": { + "value0": 35.72151184082031, + "value1": 22.028072357177736, + "value2": -40.00749969482422 + }, + "Rotation": { + "value0": -0.19185781478881837, + "value1": 0.657464861869812, + "value2": 0.7072034478187561, + "value3": 0.17548270523548127 + }, + "Scale": { + "value0": 0.9999915361404419, + "value1": 1.000016689300537, + "value2": 1.0000039339065552 + } + }, + "value157": 1048607, + "value158": { + "Position": { + "value0": -4.290985107421875, + "value1": 5.07811164855957, + "value2": 0.0 + }, + "Rotation": { + "value0": 0.004163129720836878, + "value1": 0.1351698637008667, + "value2": 0.0068052951246500019, + "value3": 0.9907903075218201 + }, + "Scale": { + "value0": 2.137307643890381, + "value1": 2.1373095512390138, + "value2": 2.1373074054718019 + } + }, + "value159": 3145757, + "value160": { + "Position": { + "value0": -100.96780395507813, + "value1": 4.210052490234375, + "value2": 0.0 + }, + "Rotation": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0, + "value3": 1.0 + }, + "Scale": { + "value0": 6.000002384185791, + "value1": 14.199999809265137, + "value2": 200.000244140625 + } + }, + "value161": 2097179, + "value162": { + "Position": { + "value0": 89.11954498291016, + "value1": 8.354837417602539, + "value2": 0.04714982211589813 + }, + "Rotation": { + "value0": -0.0010500962380319834, + "value1": -0.001050095073878765, + "value2": 0.7071059942245483, + "value3": 0.7071059942245483 + }, + "Scale": { + "value0": 6.0, + "value1": 14.199999809265137, + "value2": 200.0 + } + }, + "value163": 23, + "value164": { + "Position": { + "value0": 5.0, + "value1": 1.6939997673034669, + "value2": 2.0 + }, + "Rotation": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0, + "value3": 1.0 + }, + "Scale": { + "value0": 1.0000207424163819, + "value1": 1.0000123977661133, + "value2": 1.0 + } + }, + "value165": 46, + "value166": 30, + "value167": { + "Name": "Spheres" + }, + "value168": 1, + "value169": { + "Name": "Ground" + }, + "value170": 28, + "value171": { + "Name": "Cat" + }, + "value172": 4, + "value173": { + "Name": "Sphere0" + }, + "value174": 5, + "value175": { + "Name": "Sphere1" + }, + "value176": 6, + "value177": { + "Name": "Sphere2" + }, + "value178": 7, + "value179": { + "Name": "Sphere3" + }, + "value180": 8, + "value181": { + "Name": "Sphere4" + }, + "value182": 9, + "value183": { + "Name": "Sphere5" + }, + "value184": 10, + "value185": { + "Name": "Sphere6" + }, + "value186": 11, + "value187": { + "Name": "Sphere7" + }, + "value188": 12, + "value189": { + "Name": "Sphere8" + }, + "value190": 13, + "value191": { + "Name": "Sphere9" + }, + "value192": 14, + "value193": { + "Name": "Sphere10" + }, + "value194": 15, + "value195": { + "Name": "Sphere11" + }, + "value196": 16, + "value197": { + "Name": "Sphere12" + }, + "value198": 17, + "value199": { + "Name": "Sphere13" + }, + "value200": 18, + "value201": { + "Name": "Sphere14" + }, + "value202": 19, + "value203": { + "Name": "Sphere15" + }, + "value204": 20, + "value205": { + "Name": "Sphere16" + }, + "value206": 21, + "value207": { + "Name": "Sphere17" + }, + "value208": 22, + "value209": { + "Name": "Sphere18" + }, + "value210": 23, + "value211": { + "Name": "Capsule" + }, + "value212": 24, + "value213": { + "Name": "Environment" + }, + "value214": 25, + "value215": { + "Name": "Light" + }, + "value216": 26, + "value217": { + "Name": "Camera" + }, + "value218": 1048608, + "value219": { + "Name": "Projectile" + }, + "value220": 1048576, + "value221": { + "Name": "Sphere19" + }, + "value222": 35, + "value223": { + "Name": "Bonfire" + }, + "value224": 36, + "value225": { + "Name": "Light" + }, + "value226": 37, + "value227": { + "Name": "Player" + }, + "value228": 40, + "value229": { + "Name": "Cube" + }, + "value230": 41, + "value231": { + "Name": "Cube" + }, + "value232": 42, + "value233": { + "Name": "Cube" + }, + "value234": 43, + "value235": { + "Name": "Sphere" + }, + "value236": 44, + "value237": { + "Name": "Capsule" + }, + "value238": 45, + "value239": { + "Name": "Capsule" + }, + "value240": 46, + "value241": { + "Name": "Capsule" + }, + "value242": 47, + "value243": { + "Name": "light Cube" + }, + "value244": 48, + "value245": { + "Name": "light Cube" + }, + "value246": 1048607, + "value247": { + "Name": "DamagedHelmet" + }, + "value248": 55, + "value249": { + "Name": "Sky" + }, + "value250": 56, + "value251": { + "Name": "TestArea" + }, + "value252": 33, + "value253": { + "Name": "TestGLTFModel" + }, + "value254": 1048610, + "value255": { + "Name": "TestAudio" + }, + "value256": 57, + "value257": { + "Name": "Capsules" + }, + "value258": 4, + "value259": 41, + "value260": { + "Active": true + }, + "value261": 40, + "value262": { + "Active": true + }, + "value263": 42, + "value264": { + "Active": true + }, + "value265": 3145757, + "value266": { + "Active": true + }, + "value267": 51, + "value268": 1048576, + "value269": { + "First": 1048575, + "Next": 49, + "Previous": 4, + "Parent": 30 + }, + "value270": 30, + "value271": { + "First": 22, + "Next": 1048575, + "Previous": 1048575, + "Parent": 1048575 + }, + "value272": 22, + "value273": { + "First": 1048575, + "Next": 21, + "Previous": 1048575, + "Parent": 30 + }, + "value274": 21, + "value275": { + "First": 1048575, + "Next": 20, + "Previous": 22, + "Parent": 30 + }, + "value276": 20, + "value277": { + "First": 1048575, + "Next": 19, + "Previous": 21, + "Parent": 30 + }, + "value278": 19, + "value279": { + "First": 1048575, + "Next": 18, + "Previous": 20, + "Parent": 30 + }, + "value280": 18, + "value281": { + "First": 1048575, + "Next": 17, + "Previous": 19, + "Parent": 30 + }, + "value282": 17, + "value283": { + "First": 1048575, + "Next": 16, + "Previous": 18, + "Parent": 30 + }, + "value284": 16, + "value285": { + "First": 1048575, + "Next": 14, + "Previous": 17, + "Parent": 30 + }, + "value286": 1048608, + "value287": { + "First": 1048575, + "Next": 1048575, + "Previous": 26, + "Parent": 37 + }, + "value288": 14, + "value289": { + "First": 1048575, + "Next": 13, + "Previous": 16, + "Parent": 30 + }, + "value290": 13, + "value291": { + "First": 1048575, + "Next": 12, + "Previous": 14, + "Parent": 30 + }, + "value292": 12, + "value293": { + "First": 1048575, + "Next": 11, + "Previous": 13, + "Parent": 30 + }, + "value294": 11, + "value295": { + "First": 1048575, + "Next": 10, + "Previous": 12, + "Parent": 30 + }, + "value296": 10, + "value297": { + "First": 1048575, + "Next": 9, + "Previous": 11, + "Parent": 30 + }, + "value298": 9, + "value299": { + "First": 1048575, + "Next": 8, + "Previous": 10, + "Parent": 30 + }, + "value300": 8, + "value301": { + "First": 1048575, + "Next": 7, + "Previous": 9, + "Parent": 30 + }, + "value302": 7, + "value303": { + "First": 1048575, + "Next": 6, + "Previous": 8, + "Parent": 30 + }, + "value304": 6, + "value305": { + "First": 1048575, + "Next": 5, + "Previous": 7, + "Parent": 30 + }, + "value306": 5, + "value307": { + "First": 1048575, + "Next": 4, + "Previous": 6, + "Parent": 30 + }, + "value308": 4, + "value309": { + "First": 1048575, + "Next": 1048576, + "Previous": 5, + "Parent": 30 + }, + "value310": 36, + "value311": { + "First": 1048575, + "Next": 1048575, + "Previous": 1048575, + "Parent": 35 + }, + "value312": 35, + "value313": { + "First": 36, + "Next": 1048575, + "Previous": 1048575, + "Parent": 1048575 + }, + "value314": 26, + "value315": { + "First": 1048575, + "Next": 1048608, + "Previous": 1048575, + "Parent": 37 + }, + "value316": 37, + "value317": { + "First": 26, + "Next": 1048575, + "Previous": 1048575, + "Parent": 1048575 + }, + "value318": 40, + "value319": { + "First": 42, + "Next": 1048575, + "Previous": 1048575, + "Parent": 41 + }, + "value320": 41, + "value321": { + "First": 40, + "Next": 1048575, + "Previous": 1048575, + "Parent": 1048575 + }, + "value322": 42, + "value323": { + "First": 1048575, + "Next": 1048575, + "Previous": 1048575, + "Parent": 40 + }, + "value324": 49, + "value325": { + "First": 1048575, + "Next": 50, + "Previous": 1048576, + "Parent": 30 + }, + "value326": 50, + "value327": { + "First": 1048575, + "Next": 51, + "Previous": 49, + "Parent": 30 + }, + "value328": 51, + "value329": { + "First": 1048575, + "Next": 52, + "Previous": 50, + "Parent": 30 + }, + "value330": 52, + "value331": { + "First": 1048575, + "Next": 53, + "Previous": 51, + "Parent": 30 + }, + "value332": 53, + "value333": { + "First": 1048575, + "Next": 54, + "Previous": 52, + "Parent": 30 + }, + "value334": 54, + "value335": { + "First": 1048575, + "Next": 15, + "Previous": 53, + "Parent": 30 + }, + "value336": 25, + "value337": { + "First": 1048575, + "Next": 1048575, + "Previous": 24, + "Parent": 55 + }, + "value338": 24, + "value339": { + "First": 1048575, + "Next": 25, + "Previous": 1048575, + "Parent": 55 + }, + "value340": 55, + "value341": { + "First": 24, + "Next": 1048575, + "Previous": 1048575, + "Parent": 1048575 + }, + "value342": 1, + "value343": { + "First": 1048575, + "Next": 2097154, + "Previous": 1048575, + "Parent": 56 + }, + "value344": 56, + "value345": { + "First": 1, + "Next": 1048575, + "Previous": 1048575, + "Parent": 1048575 + }, + "value346": 2097154, + "value347": { + "First": 1048575, + "Next": 39, + "Previous": 1, + "Parent": 56 + }, + "value348": 39, + "value349": { + "First": 1048575, + "Next": 38, + "Previous": 2097154, + "Parent": 56 + }, + "value350": 38, + "value351": { + "First": 1048575, + "Next": 3145757, + "Previous": 39, + "Parent": 56 + }, + "value352": 3145757, + "value353": { + "First": 1048575, + "Next": 2097155, + "Previous": 38, + "Parent": 56 + }, + "value354": 2097155, + "value355": { + "First": 1048575, + "Next": 2097179, + "Previous": 3145757, + "Parent": 56 + }, + "value356": 2097179, + "value357": { + "First": 1048575, + "Next": 1048575, + "Previous": 2097155, + "Parent": 56 + }, + "value358": 15, + "value359": { + "First": 1048575, + "Next": 1048575, + "Previous": 54, + "Parent": 30 + }, + "value360": 23, + "value361": { + "First": 1048575, + "Next": 44, + "Previous": 1048575, + "Parent": 57 + }, + "value362": 57, + "value363": { + "First": 23, + "Next": 1048575, + "Previous": 1048575, + "Parent": 1048575 + }, + "value364": 44, + "value365": { + "First": 1048575, + "Next": 45, + "Previous": 23, + "Parent": 57 + }, + "value366": 45, + "value367": { + "First": 1048575, + "Next": 46, + "Previous": 44, + "Parent": 57 + }, + "value368": 46, + "value369": { + "First": 1048575, + "Next": 1048575, + "Previous": 45, + "Parent": 57 + }, + "value370": 1, + "value371": 26, + "value372": { + "Scale": 1.0, + "Aspect": 0.8679245114326477, + "FOV": 60.0, + "Near": 0.10000000149011612, + "Far": 1000.0, + "Aperture": 50.0, + "ShutterSpeed": 0.01666666753590107, + "Sensitivity": 400.0 + }, + "value373": 3, + "value374": 1048608, + "value375": { + "FilePath": "//Scripts/Projectile.lua" + }, + "value376": 36, + "value377": { + "FilePath": "//Scripts/Script.lua" + }, + "value378": 37, + "value379": { + "FilePath": "//Scripts/Script(1).lua" + }, + "value380": 0, + "value381": 4, + "value382": 25, + "value383": { + "value0": { + "value0": 26.0, + "value1": 22.0, + "value2": 48.5, + "value3": 1.0 + }, + "value1": { + "value0": 0.9992192983627319, + "value1": 1.0, + "value2": 0.7291066646575928, + "value3": 1.0 + }, + "value2": 0.0, + "value3": 0.0, + "value4": { + "value0": 0.45642879605293276, + "value1": 0.3711429536342621, + "value2": 0.8086566925048828, + "value3": 1.0 + }, + "value5": 120000.0, + "value6": 1.0 + }, + "value384": 36, + "value385": { + "value0": { + "value0": 0.0, + "value1": 1.5141037702560425, + "value2": 76.22005462646485, + "value3": 1.0 + }, + "value1": { + "value0": 0.7747126221656799, + "value1": 0.4114605188369751, + "value2": 0.19590432941913606, + "value3": 1.0 + }, + "value2": 2.0, + "value3": 0.0, + "value4": { + "value0": 0.0, + "value1": 0.0, + "value2": 1.0, + "value3": 1.0 + }, + "value5": 500000.0, + "value6": 10.0 + }, + "value386": 47, + "value387": { + "value0": { + "value0": -2.8255271911621095, + "value1": 9.712101936340332, + "value2": 0.0, + "value3": 1.0 + }, + "value1": { + "value0": 0.05196789652109146, + "value1": 0.9297934174537659, + "value2": 0.12700922787189485, + "value3": 1.0 + }, + "value2": 2.0, + "value3": 0.0, + "value4": { + "value0": 0.0, + "value1": 0.0, + "value2": 1.0, + "value3": 1.0 + }, + "value5": 120000.0, + "value6": 17.015546798706056 + }, + "value388": 48, + "value389": { + "value0": { + "value0": -36.306640625, + "value1": 4.499866485595703, + "value2": 0.0, + "value3": 1.0 + }, + "value1": { + "value0": 0.5697340965270996, + "value1": 0.8126801252365112, + "value2": 0.1522311419248581, + "value3": 1.0 + }, + "value2": 2.0, + "value3": 0.0, + "value4": { + "value0": 0.0, + "value1": 0.0, + "value2": 1.0, + "value3": 1.0 + }, + "value5": 120000.0, + "value6": 28.037296295166017 + }, + "value390": 14, + "value391": 1, + "value392": { + "value0": { + "Version": 1, + "Position": { + "value0": -0.09662866592407227, + "value1": -1.5239448547363282, + "value2": 0.0 + }, + "Orientation": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0, + "value3": 1.0 + }, + "LinearVelocity": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0 + }, + "Force": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0 + }, + "Mass": 1.0, + "AngularVelocity": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0 + }, + "Torque": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0 + }, + "Static": true, + "Friction": 0.800000011920929, + "Elasticity": 0.8999999761581421, + "CollisionShape": { + "polymorphic_id": 2147483649, + "polymorphic_name": "Lumos::CuboidCollisionShape", + "ptr_wrapper": { + "valid": 1, + "data": { + "value0": { + "value0": 100.0, + "value1": 0.5, + "value2": 100.0 + } + } + } + }, + "Trigger": false, + "AngularFactor": 1.0 + } + }, + "value393": 3145757, + "value394": { + "value0": { + "Version": 1, + "Position": { + "value0": -100.96780395507813, + "value1": 4.210052490234375, + "value2": 0.0 + }, + "Orientation": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0, + "value3": 1.0 + }, + "LinearVelocity": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0 + }, + "Force": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0 + }, + "Mass": 1.0, + "AngularVelocity": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0 + }, + "Torque": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0 + }, + "Static": true, + "Friction": 0.800000011920929, + "Elasticity": 0.8999999761581421, + "CollisionShape": { + "polymorphic_id": 1, + "ptr_wrapper": { + "valid": 1, + "data": { + "value0": { + "value0": 3.0, + "value1": 7.099999904632568, + "value2": 100.0 + } + } + } + }, + "Trigger": false, + "AngularFactor": 1.0 + } + }, + "value395": 2097179, + "value396": { + "value0": { + "Version": 1, + "Position": { + "value0": 89.11954498291016, + "value1": 8.354837417602539, + "value2": 0.04714982211589813 + }, + "Orientation": { + "value0": -0.0010500962380319834, + "value1": -0.001050095073878765, + "value2": 0.7071059942245483, + "value3": 0.7071059942245483 + }, + "LinearVelocity": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0 + }, + "Force": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0 + }, + "Mass": 1.0, + "AngularVelocity": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0 + }, + "Torque": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0 + }, + "Static": true, + "Friction": 0.800000011920929, + "Elasticity": 0.8999999761581421, + "CollisionShape": { + "polymorphic_id": 1, + "ptr_wrapper": { + "valid": 1, + "data": { + "value0": { + "value0": 3.0, + "value1": 7.099999904632568, + "value2": 100.0 + } + } + } + }, + "Trigger": false, + "AngularFactor": 1.0 + } + }, + "value397": 2097154, + "value398": { + "value0": { + "Version": 1, + "Position": { + "value0": 0.01968160644173622, + "value1": 4.281795501708984, + "value2": -99.7276840209961 + }, + "Orientation": { + "value0": 0.0, + "value1": 0.7071067690849304, + "value2": 0.0, + "value3": 0.7071067690849304 + }, + "LinearVelocity": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0 + }, + "Force": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0 + }, + "Mass": 1.0, + "AngularVelocity": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0 + }, + "Torque": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0 + }, + "Static": true, + "Friction": 0.800000011920929, + "Elasticity": 0.8999999761581421, + "CollisionShape": { + "polymorphic_id": 1, + "ptr_wrapper": { + "valid": 1, + "data": { + "value0": { + "value0": 3.0, + "value1": 7.099999904632568, + "value2": 100.0 + } + } + } + }, + "Trigger": false, + "AngularFactor": 1.0 + } + }, + "value399": 2097155, + "value400": { + "value0": { + "Version": 1, + "Position": { + "value0": -0.29128527641296389, + "value1": 4.3156633377075199, + "value2": 99.78291320800781 + }, + "Orientation": { + "value0": 0.0, + "value1": 0.7094271779060364, + "value2": 0.0, + "value3": 0.7047786712646484 + }, + "LinearVelocity": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0 + }, + "Force": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0 + }, + "Mass": 1.0, + "AngularVelocity": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0 + }, + "Torque": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0 + }, + "Static": true, + "Friction": 0.800000011920929, + "Elasticity": 0.8999999761581421, + "CollisionShape": { + "polymorphic_id": 1, + "ptr_wrapper": { + "valid": 1, + "data": { + "value0": { + "value0": 3.0, + "value1": 7.099999904632568, + "value2": 100.0 + } + } + } + }, + "Trigger": false, + "AngularFactor": 1.0 + } + }, + "value401": 23, + "value402": { + "value0": { + "Version": 1, + "Position": { + "value0": 5.0, + "value1": 1.6939997673034669, + "value2": 2.0 + }, + "Orientation": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0, + "value3": 1.0 + }, + "LinearVelocity": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0 + }, + "Force": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0 + }, + "Mass": 1.0, + "AngularVelocity": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0 + }, + "Torque": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0 + }, + "Static": true, + "Friction": 0.800000011920929, + "Elasticity": 0.8999999761581421, + "CollisionShape": { + "polymorphic_id": 2147483650, + "polymorphic_name": "Lumos::CapsuleCollisionShape", + "ptr_wrapper": { + "valid": 1, + "data": { + "value0": 0.5, + "value1": 2.0 + } + } + }, + "Trigger": false, + "AngularFactor": 1.0 + } + }, + "value403": 37, + "value404": { + "value0": { + "Version": 1, + "Position": { + "value0": -36.72534942626953, + "value1": 16.028718948364259, + "value2": 22.700944900512697 + }, + "Orientation": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0, + "value3": 1.0 + }, + "LinearVelocity": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0 + }, + "Force": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0 + }, + "Mass": 1.0, + "AngularVelocity": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0 + }, + "Torque": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0 + }, + "Static": false, + "Friction": 2.0, + "Elasticity": 0.0, + "CollisionShape": { + "polymorphic_id": 2, + "ptr_wrapper": { + "valid": 1, + "data": { + "value0": 0.5, + "value1": 2.0 + } + } + }, + "Trigger": false, + "AngularFactor": 0.0 + } + }, + "value405": 38, + "value406": { + "value0": { + "Version": 1, + "Position": { + "value0": 98.88309478759766, + "value1": 4.266810894012451, + "value2": 0.0 + }, + "Orientation": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0, + "value3": 1.0000001192092896 + }, + "LinearVelocity": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0 + }, + "Force": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0 + }, + "Mass": 1.0, + "AngularVelocity": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0 + }, + "Torque": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0 + }, + "Static": true, + "Friction": 0.800000011920929, + "Elasticity": 0.8999999761581421, + "CollisionShape": { + "polymorphic_id": 1, + "ptr_wrapper": { + "valid": 1, + "data": { + "value0": { + "value0": 3.0, + "value1": 7.099999904632568, + "value2": 100.0 + } + } + } + }, + "Trigger": false, + "AngularFactor": 1.0 + } + }, + "value407": 39, + "value408": { + "value0": { + "Version": 1, + "Position": { + "value0": 74.57472229003906, + "value1": -0.869247317314148, + "value2": -0.005169916898012161 + }, + "Orientation": { + "value0": 0.0, + "value1": 0.0, + "value2": -0.36880773305892947, + "value3": 0.9295057058334351 + }, + "LinearVelocity": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0 + }, + "Force": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0 + }, + "Mass": 1.0, + "AngularVelocity": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0 + }, + "Torque": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0 + }, + "Static": true, + "Friction": 0.0, + "Elasticity": 0.0, + "CollisionShape": { + "polymorphic_id": 1, + "ptr_wrapper": { + "valid": 1, + "data": { + "value0": { + "value0": 3.0, + "value1": 14.0, + "value2": 100.0 + } + } + } + }, + "Trigger": false, + "AngularFactor": 1.0 + } + }, + "value409": 44, + "value410": { + "value0": { + "Version": 1, + "Position": { + "value0": 0.0, + "value1": 1.0257916450500489, + "value2": 0.0 + }, + "Orientation": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0, + "value3": 1.0 + }, + "LinearVelocity": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0 + }, + "Force": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0 + }, + "Mass": 1.0, + "AngularVelocity": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0 + }, + "Torque": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0 + }, + "Static": true, + "Friction": 0.800000011920929, + "Elasticity": 0.8999999761581421, + "CollisionShape": { + "polymorphic_id": 2, + "ptr_wrapper": { + "valid": 1, + "data": { + "value0": 1.0, + "value1": 2.0 + } + } + }, + "Trigger": false, + "AngularFactor": 1.0 + } + }, + "value411": 45, + "value412": { + "value0": { + "Version": 1, + "Position": { + "value0": 16.0, + "value1": 0.6939997673034668, + "value2": 2.0 + }, + "Orientation": { + "value0": -0.7192209959030151, + "value1": -0.0, + "value2": 0.0, + "value3": 0.6947813630104065 + }, + "LinearVelocity": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0 + }, + "Force": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0 + }, + "Mass": 1.0, + "AngularVelocity": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0 + }, + "Torque": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0 + }, + "Static": true, + "Friction": 0.800000011920929, + "Elasticity": 0.8999999761581421, + "CollisionShape": { + "polymorphic_id": 2, + "ptr_wrapper": { + "valid": 1, + "data": { + "value0": 0.5, + "value1": 2.0 + } + } + }, + "Trigger": false, + "AngularFactor": 1.0 + } + }, + "value413": 46, + "value414": { + "value0": { + "Version": 1, + "Position": { + "value0": 13.0, + "value1": 0.6939997673034668, + "value2": 2.0 + }, + "Orientation": { + "value0": -0.7192209959030151, + "value1": -0.0, + "value2": 0.0, + "value3": 0.6947813630104065 + }, + "LinearVelocity": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0 + }, + "Force": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0 + }, + "Mass": 1.0, + "AngularVelocity": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0 + }, + "Torque": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0 + }, + "Static": false, + "Friction": 0.800000011920929, + "Elasticity": 0.8999999761581421, + "CollisionShape": { + "polymorphic_id": 2, + "ptr_wrapper": { + "valid": 1, + "data": { + "value0": 0.5, + "value1": 2.0 + } + } + }, + "Trigger": false, + "AngularFactor": 0.0 + } + }, + "value415": 47, + "value416": { + "value0": { + "Version": 1, + "Position": { + "value0": -2.8255271911621095, + "value1": 9.712101936340332, + "value2": 0.0 + }, + "Orientation": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0, + "value3": 1.0 + }, + "LinearVelocity": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0 + }, + "Force": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0 + }, + "Mass": 1.0, + "AngularVelocity": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0 + }, + "Torque": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0 + }, + "Static": false, + "Friction": 1.0, + "Elasticity": 1.0, + "CollisionShape": { + "polymorphic_id": 1, + "ptr_wrapper": { + "valid": 1, + "data": { + "value0": { + "value0": 0.5, + "value1": 0.5, + "value2": 0.5 + } + } + } + }, + "Trigger": false, + "AngularFactor": 1.0 + } + }, + "value417": 48, + "value418": { + "value0": { + "Version": 1, + "Position": { + "value0": -36.306640625, + "value1": 4.499866485595703, + "value2": 0.0 + }, + "Orientation": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0, + "value3": 1.0 + }, + "LinearVelocity": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0 + }, + "Force": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0 + }, + "Mass": 1.0, + "AngularVelocity": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0 + }, + "Torque": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0 + }, + "Static": false, + "Friction": 1.0, + "Elasticity": 1.0, + "CollisionShape": { + "polymorphic_id": 1, + "ptr_wrapper": { + "valid": 1, + "data": { + "value0": { + "value0": 0.5, + "value1": 0.5, + "value2": 0.5 + } + } + } + }, + "Trigger": false, + "AngularFactor": 1.0 + } + }, + "value419": 1, + "value420": 24, + "value421": { + "value0": "//Textures/cubemap/noga", + "value1": 11, + "value2": 3072, + "value3": 4096, + "value4": ".hdr", + "value5": 0.03125, + "value6": 0, + "value7": { + "value0": 2.430000066757202, + "value1": 4.199999809265137, + "value2": 1.059999942779541, + "value3": 0.0 + } + }, + "value422": 0, + "value423": 0, + "value424": 1, + "value425": 26, + "value426": { + "ControllerType": 1 + }, + "value427": 1, + "value428": 28, + "value429": { + "TexturePath": "//Textures/cat.png", + "Position": { + "value0": 0.0, + "value1": 0.0 + }, + "Scale": { + "value0": 32.0, + "value1": 32.0 + }, + "Colour": { + "value0": 1.0, + "value1": 1.0, + "value2": 1.0, + "value3": 1.0 + }, + "AnimationFrames": [ + { + "key": "Run", + "value": { + "PlayMode": 0, + "Frames": [ + { + "value0": 0.0, + "value1": 0.0 + }, + { + "value0": 32.0, + "value1": 0.0 + }, + { + "value0": 64.0, + "value1": 0.0 + }, + { + "value0": 96.0, + "value1": 0.0 + } + ], + "FrameDuration": 0.10000000149011612 + } + }, + { + "key": "RunUp", + "value": { + "PlayMode": 0, + "Frames": [ + { + "value0": 0.0, + "value1": 64.0 + }, + { + "value0": 32.0, + "value1": 64.0 + }, + { + "value0": 64.0, + "value1": 64.0 + }, + { + "value0": 96.0, + "value1": 64.0 + } + ], + "FrameDuration": 0.10000000149011612 + } + }, + { + "key": "RunLeft", + "value": { + "PlayMode": 0, + "Frames": [ + { + "value0": 0.0, + "value1": 96.0 + }, + { + "value0": 32.0, + "value1": 96.0 + }, + { + "value0": 64.0, + "value1": 96.0 + }, + { + "value0": 96.0, + "value1": 96.0 + } + ], + "FrameDuration": 0.10000000149011612 + } + }, + { + "key": "RunRight", + "value": { + "PlayMode": 0, + "Frames": [ + { + "value0": 0.0, + "value1": 32.0 + }, + { + "value0": 32.0, + "value1": 32.0 + }, + { + "value0": 64.0, + "value1": 32.0 + }, + { + "value0": 96.0, + "value1": 32.0 + } + ], + "FrameDuration": 0.10000000149011612 + } + }, + { + "key": "Sleep", + "value": { + "PlayMode": 0, + "Frames": [ + { + "value0": 0.0, + "value1": 192.0 + }, + { + "value0": 32.0, + "value1": 192.0 + }, + { + "value0": 64.0, + "value1": 192.0 + }, + { + "value0": 96.0, + "value1": 192.0 + } + ], + "FrameDuration": 0.10000000149011612 + } + } + ], + "State": "RunRight" + }, + "value430": 2, + "value431": 35, + "value432": { + "value0": { + "Position": { + "value0": 0.0, + "value1": 0.0, + "value2": 76.22335815429688 + }, + "Radius": 20.0, + "Pitch": 1.0, + "Volume": 1.0, + "Velocity": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0 + }, + "Looping": true, + "Paused": false, + "ReferenceDistance": 10.0, + "Global": false, + "TimeLeft": 16849.388671875, + "Stationary": false, + "SoundNodePath": "//Assets/Sounds/fire.ogg", + "RollOffFactor": 6.0 + } + }, + "value433": 1048610, + "value434": { + "value0": { + "Position": { + "value0": 0.10000000149011612, + "value1": 10.0, + "value2": 10.0 + }, + "Radius": 30.0, + "Pitch": 1.0, + "Volume": 1.0, + "Velocity": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0 + }, + "Looping": true, + "Paused": false, + "ReferenceDistance": 20.0, + "Global": false, + "TimeLeft": 120000.0, + "Stationary": false, + "SoundNodePath": "//Sounds/ambientguitar.ogg", + "RollOffFactor": 6.0 + } + }, + "value435": 1, + "value436": 26, + "value437": { + "enabled": true + }, + "value438": 58, + "value439": 36, + "value440": { + "value0": 7142670811742260938 + }, + "value441": 35, + "value442": { + "value0": 11107416043673070741 + }, + "value443": 1048610, + "value444": { + "value0": 11900723286469007770 + }, + "value445": 33, + "value446": { + "value0": 7359062324725864355 + }, + "value447": 1048608, + "value448": { + "value0": 7055554476232666375 + }, + "value449": 1048607, + "value450": { + "value0": 17970324625984215606 + }, + "value451": 30, + "value452": { + "value0": 8167269343774118827 + }, + "value453": 3145757, + "value454": { + "value0": 17779826851189947480 + }, + "value455": 28, + "value456": { + "value0": 14937591263949305246 + }, + "value457": 2097179, + "value458": { + "value0": 7640771210261002049 + }, + "value459": 26, + "value460": { + "value0": 2839679583992163695 + }, + "value461": 25, + "value462": { + "value0": 15488722931219541607 + }, + "value463": 24, + "value464": { + "value0": 6226202769161346132 + }, + "value465": 23, + "value466": { + "value0": 7098989048976045174 + }, + "value467": 22, + "value468": { + "value0": 3439171724646251554 + }, + "value469": 21, + "value470": { + "value0": 16956239776263133194 + }, + "value471": 20, + "value472": { + "value0": 1990762703427919633 + }, + "value473": 19, + "value474": { + "value0": 423835867410576946 + }, + "value475": 18, + "value476": { + "value0": 11891685876785498577 + }, + "value477": 17, + "value478": { + "value0": 7067971027685025311 + }, + "value479": 16, + "value480": { + "value0": 233959796952139788 + }, + "value481": 15, + "value482": { + "value0": 14159927372598275186 + }, + "value483": 14, + "value484": { + "value0": 4435898066759924372 + }, + "value485": 13, + "value486": { + "value0": 3179284270372788909 + }, + "value487": 12, + "value488": { + "value0": 4586489471220893352 + }, + "value489": 11, + "value490": { + "value0": 12681453495343578024 + }, + "value491": 10, + "value492": { + "value0": 18014480495500914400 + }, + "value493": 9, + "value494": { + "value0": 9295814637906071280 + }, + "value495": 8, + "value496": { + "value0": 2152489098297605661 + }, + "value497": 7, + "value498": { + "value0": 4327025743306843849 + }, + "value499": 6, + "value500": { + "value0": 11046028634673225913 + }, + "value501": 5, + "value502": { + "value0": 7714213696942504533 + }, + "value503": 4, + "value504": { + "value0": 8008364231059824527 + }, + "value505": 2097155, + "value506": { + "value0": 18193252195915204467 + }, + "value507": 2097154, + "value508": { + "value0": 6603296929366748979 + }, + "value509": 1, + "value510": { + "value0": 9645706349408193021 + }, + "value511": 1048576, + "value512": { + "value0": 13961618126954569495 + }, + "value513": 37, + "value514": { + "value0": 12672391254482586722 + }, + "value515": 38, + "value516": { + "value0": 3185688625544513382 + }, + "value517": 39, + "value518": { + "value0": 478815009451712139 + }, + "value519": 40, + "value520": { + "value0": 16680644448984634936 + }, + "value521": 41, + "value522": { + "value0": 4838390566280914159 + }, + "value523": 42, + "value524": { + "value0": 16722696764297374778 + }, + "value525": 43, + "value526": { + "value0": 8076439804870629473 + }, + "value527": 44, + "value528": { + "value0": 2922988186484868607 + }, + "value529": 45, + "value530": { + "value0": 17620835260008345330 + }, + "value531": 46, + "value532": { + "value0": 16262140283655929216 + }, + "value533": 47, + "value534": { + "value0": 17900231230883469521 + }, + "value535": 48, + "value536": { + "value0": 6273149985837589589 + }, + "value537": 49, + "value538": { + "value0": 17413202261215926371 + }, + "value539": 50, + "value540": { + "value0": 24088390834734939 + }, + "value541": 51, + "value542": { + "value0": 4055617899937532868 + }, + "value543": 52, + "value544": { + "value0": 11267442642228032682 + }, + "value545": 53, + "value546": { + "value0": 1271265202659808170 + }, + "value547": 54, + "value548": { + "value0": 1493189173168838353 + }, + "value549": 55, + "value550": { + "value0": 4838382540867006819 + }, + "value551": 56, + "value552": { + "value0": 9875205724687178906 + }, + "value553": 57, + "value554": { + "value0": 14459952198224781056 + }, + "value555": 40, + "value556": 35, + "value557": { + "PrimitiveType": 8, + "FilePath": "//Assets/Meshes/lowpoly_bonfire/scene.gltf", + "Material": { + "ptr_wrapper": { + "valid": 1, + "data": { + "Albedo": "NULL", + "Normal": "NULL", + "Metallic": "NULL", + "Roughness": "", + "Ao": "", + "Emissive": "NULL", + "albedoColour": { + "value0": 1.0, + "value1": 1.0, + "value2": 1.0, + "value3": 1.0 + }, + "roughnessValue": 0.699999988079071, + "metallicValue": 0.699999988079071, + "emissiveValue": 0.0, + "albedoMapFactor": 1.0, + "metallicMapFactor": 1.0, + "roughnessMapFactor": 0.0, + "normalMapFactor": 1.0, + "aoMapFactor": 0.0, + "emissiveMapFactor": 1.0, + "alphaCutOff": 0.4000000059604645, + "workflow": 1.0, + "shader": "//CoreShaders/ForwardPBR.shader", + "Reflectance": 0.30000001192092898 + } + } + } + }, + "value558": 33, + "value559": { + "PrimitiveType": 8, + "FilePath": "//Meshes/Scene/scene.gltf", + "Material": { + "ptr_wrapper": { + "valid": 1, + "data": { + "Albedo": "NULL", + "Normal": "", + "Metallic": "", + "Roughness": "", + "Ao": "", + "Emissive": "NULL", + "albedoColour": { + "value0": 1.0, + "value1": 1.0, + "value2": 1.0, + "value3": 1.0 + }, + "roughnessValue": 1.0, + "metallicValue": 0.699999988079071, + "emissiveValue": 0.0, + "albedoMapFactor": 1.0, + "metallicMapFactor": 0.0, + "roughnessMapFactor": 0.0, + "normalMapFactor": 0.0, + "aoMapFactor": 0.0, + "emissiveMapFactor": 1.0, + "alphaCutOff": 0.4000000059604645, + "workflow": 0.0, + "shader": "//CoreShaders/ForwardPBR.shader", + "Reflectance": 0.30000001192092898 + } + } + } + }, + "value560": 1048607, + "value561": { + "PrimitiveType": 8, + "FilePath": "//Meshes/DamagedHelmet/glTF/DamagedHelmet.gltf", + "Material": { + "ptr_wrapper": { + "valid": 1, + "data": { + "Albedo": "NULL", + "Normal": "NULL", + "Metallic": "NULL", + "Roughness": "", + "Ao": "NULL", + "Emissive": "NULL", + "albedoColour": { + "value0": 1.0, + "value1": 1.0, + "value2": 1.0, + "value3": 1.0 + }, + "roughnessValue": 0.699999988079071, + "metallicValue": 0.699999988079071, + "emissiveValue": 0.0, + "albedoMapFactor": 1.0, + "metallicMapFactor": 1.0, + "roughnessMapFactor": 0.0, + "normalMapFactor": 1.0, + "aoMapFactor": 1.0, + "emissiveMapFactor": 1.0, + "alphaCutOff": 0.4000000059604645, + "workflow": 1.0, + "shader": "//CoreShaders/ForwardPBR.shader", + "Reflectance": 0.30000001192092898 + } + } + } + }, + "value562": 3145757, + "value563": { + "PrimitiveType": 2, + "FilePath": "Primitive", + "Material": { + "ptr_wrapper": { + "valid": 1, + "data": { + "Albedo": "//Textures/checkerboard.tga", + "Normal": "", + "Metallic": "", + "Roughness": "", + "Ao": "", + "Emissive": "", + "albedoColour": { + "value0": 0.6000000238418579, + "value1": 0.10000000149011612, + "value2": 0.10000000149011612, + "value3": 1.0 + }, + "roughnessValue": 0.6000000238418579, + "metallicValue": 0.15000000596046449, + "emissiveValue": 0.0, + "albedoMapFactor": 0.5, + "metallicMapFactor": 0.0, + "roughnessMapFactor": 0.0, + "normalMapFactor": 0.0, + "aoMapFactor": 0.0, + "emissiveMapFactor": 0.0, + "alphaCutOff": 0.4000000059604645, + "workflow": 0.0, + "shader": "//CoreShaders/ForwardPBR.shader", + "Reflectance": 0.30000001192092898 + } + } + } + }, + "value564": 2097179, + "value565": { + "PrimitiveType": 2, + "FilePath": "Primitive", + "Material": { + "ptr_wrapper": { + "valid": 1, + "data": { + "Albedo": "//Textures/checkerboard.tga", + "Normal": "", + "Metallic": "", + "Roughness": "", + "Ao": "", + "Emissive": "", + "albedoColour": { + "value0": 0.6000000238418579, + "value1": 0.10000000149011612, + "value2": 0.10000000149011612, + "value3": 1.0 + }, + "roughnessValue": 0.6000000238418579, + "metallicValue": 0.15000000596046449, + "emissiveValue": 0.0, + "albedoMapFactor": 0.5, + "metallicMapFactor": 0.0, + "roughnessMapFactor": 0.0, + "normalMapFactor": 0.0, + "aoMapFactor": 0.0, + "emissiveMapFactor": 0.0, + "alphaCutOff": 0.4000000059604645, + "workflow": 0.0, + "shader": "//CoreShaders/ForwardPBR.shader", + "Reflectance": 0.30000001192092898 + } + } + } + }, + "value566": 23, + "value567": { + "PrimitiveType": 5, + "FilePath": "Primitive", + "Material": { + "ptr_wrapper": { + "valid": 1, + "data": { + "Albedo": "", + "Normal": "", + "Metallic": "", + "Roughness": "", + "Ao": "", + "Emissive": "", + "albedoColour": { + "value0": 0.8731988668441773, + "value1": 0.15098541975021363, + "value2": 0.15098541975021363, + "value3": 1.0 + }, + "roughnessValue": 0.30000001192092898, + "metallicValue": 0.800000011920929, + "emissiveValue": 0.0, + "albedoMapFactor": 0.0, + "metallicMapFactor": 0.0, + "roughnessMapFactor": 0.0, + "normalMapFactor": 0.0, + "aoMapFactor": 0.0, + "emissiveMapFactor": 0.0, + "alphaCutOff": 0.4000000059604645, + "workflow": 0.0, + "shader": "//CoreShaders/ForwardPBR.shader", + "Reflectance": 0.30000001192092898 + } + } + } + }, + "value568": 22, + "value569": { + "PrimitiveType": 4, + "FilePath": "Primitive", + "Material": { + "ptr_wrapper": { + "valid": 1, + "data": { + "Albedo": "", + "Normal": "", + "Metallic": "", + "Roughness": "", + "Ao": "", + "Emissive": "", + "albedoColour": { + "value0": 0.8999999761581421, + "value1": 0.8999999761581421, + "value2": 0.8999999761581421, + "value3": 0.8999999761581421 + }, + "roughnessValue": 0.800000011920929, + "metallicValue": 0.8999999761581421, + "emissiveValue": 0.0, + "albedoMapFactor": 0.0, + "metallicMapFactor": 0.0, + "roughnessMapFactor": 0.0, + "normalMapFactor": 0.0, + "aoMapFactor": 0.0, + "emissiveMapFactor": 0.0, + "alphaCutOff": 0.4000000059604645, + "workflow": 0.0, + "shader": "//CoreShaders/ForwardPBR.shader", + "Reflectance": 0.30000001192092898 + } + } + } + }, + "value570": 21, + "value571": { + "PrimitiveType": 4, + "FilePath": "Primitive", + "Material": { + "ptr_wrapper": { + "valid": 1, + "data": { + "Albedo": "", + "Normal": "", + "Metallic": "", + "Roughness": "", + "Ao": "", + "Emissive": "", + "albedoColour": { + "value0": 0.8999999761581421, + "value1": 0.8999999761581421, + "value2": 0.8999999761581421, + "value3": 0.8999999761581421 + }, + "roughnessValue": 0.699999988079071, + "metallicValue": 0.8999999761581421, + "emissiveValue": 0.0, + "albedoMapFactor": 0.0, + "metallicMapFactor": 0.0, + "roughnessMapFactor": 0.0, + "normalMapFactor": 0.0, + "aoMapFactor": 0.0, + "emissiveMapFactor": 0.0, + "alphaCutOff": 0.4000000059604645, + "workflow": 0.0, + "shader": "//CoreShaders/ForwardPBR.shader", + "Reflectance": 0.30000001192092898 + } + } + } + }, + "value572": 20, + "value573": { + "PrimitiveType": 4, + "FilePath": "Primitive", + "Material": { + "ptr_wrapper": { + "valid": 1, + "data": { + "Albedo": "", + "Normal": "", + "Metallic": "", + "Roughness": "", + "Ao": "", + "Emissive": "", + "albedoColour": { + "value0": 0.8999999761581421, + "value1": 0.8999999761581421, + "value2": 0.8999999761581421, + "value3": 0.8999999761581421 + }, + "roughnessValue": 0.6000000238418579, + "metallicValue": 0.8999999761581421, + "emissiveValue": 0.0, + "albedoMapFactor": 0.0, + "metallicMapFactor": 0.0, + "roughnessMapFactor": 0.0, + "normalMapFactor": 0.0, + "aoMapFactor": 0.0, + "emissiveMapFactor": 0.0, + "alphaCutOff": 0.4000000059604645, + "workflow": 0.0, + "shader": "//CoreShaders/ForwardPBR.shader", + "Reflectance": 0.30000001192092898 + } + } + } + }, + "value574": 19, + "value575": { + "PrimitiveType": 4, + "FilePath": "Primitive", + "Material": { + "ptr_wrapper": { + "valid": 1, + "data": { + "Albedo": "", + "Normal": "", + "Metallic": "", + "Roughness": "", + "Ao": "", + "Emissive": "", + "albedoColour": { + "value0": 0.8999999761581421, + "value1": 0.8999999761581421, + "value2": 0.8999999761581421, + "value3": 0.8999999761581421 + }, + "roughnessValue": 0.5, + "metallicValue": 0.8999999761581421, + "emissiveValue": 0.0, + "albedoMapFactor": 0.0, + "metallicMapFactor": 0.0, + "roughnessMapFactor": 0.0, + "normalMapFactor": 0.0, + "aoMapFactor": 0.0, + "emissiveMapFactor": 0.0, + "alphaCutOff": 0.4000000059604645, + "workflow": 0.0, + "shader": "//CoreShaders/ForwardPBR.shader", + "Reflectance": 0.30000001192092898 + } + } + } + }, + "value576": 18, + "value577": { + "PrimitiveType": 4, + "FilePath": "Primitive", + "Material": { + "ptr_wrapper": { + "valid": 1, + "data": { + "Albedo": "", + "Normal": "", + "Metallic": "", + "Roughness": "", + "Ao": "", + "Emissive": "", + "albedoColour": { + "value0": 0.8999999761581421, + "value1": 0.8999999761581421, + "value2": 0.8999999761581421, + "value3": 0.8999999761581421 + }, + "roughnessValue": 0.4000000059604645, + "metallicValue": 0.8999999761581421, + "emissiveValue": 0.0, + "albedoMapFactor": 0.0, + "metallicMapFactor": 0.0, + "roughnessMapFactor": 0.0, + "normalMapFactor": 0.0, + "aoMapFactor": 0.0, + "emissiveMapFactor": 0.0, + "alphaCutOff": 0.4000000059604645, + "workflow": 0.0, + "shader": "//CoreShaders/ForwardPBR.shader", + "Reflectance": 0.30000001192092898 + } + } + } + }, + "value578": 17, + "value579": { + "PrimitiveType": 4, + "FilePath": "Primitive", + "Material": { + "ptr_wrapper": { + "valid": 1, + "data": { + "Albedo": "", + "Normal": "", + "Metallic": "", + "Roughness": "", + "Ao": "", + "Emissive": "", + "albedoColour": { + "value0": 0.8999999761581421, + "value1": 0.8999999761581421, + "value2": 0.8999999761581421, + "value3": 0.8999999761581421 + }, + "roughnessValue": 0.30000001192092898, + "metallicValue": 0.8999999761581421, + "emissiveValue": 0.0, + "albedoMapFactor": 0.0, + "metallicMapFactor": 0.0, + "roughnessMapFactor": 0.0, + "normalMapFactor": 0.0, + "aoMapFactor": 0.0, + "emissiveMapFactor": 0.0, + "alphaCutOff": 0.4000000059604645, + "workflow": 0.0, + "shader": "//CoreShaders/ForwardPBR.shader", + "Reflectance": 0.30000001192092898 + } + } + } + }, + "value580": 16, + "value581": { + "PrimitiveType": 4, + "FilePath": "Primitive", + "Material": { + "ptr_wrapper": { + "valid": 1, + "data": { + "Albedo": "", + "Normal": "", + "Metallic": "", + "Roughness": "", + "Ao": "", + "Emissive": "", + "albedoColour": { + "value0": 0.8999999761581421, + "value1": 0.8999999761581421, + "value2": 0.8999999761581421, + "value3": 0.8999999761581421 + }, + "roughnessValue": 0.20000000298023225, + "metallicValue": 0.8999999761581421, + "emissiveValue": 0.0, + "albedoMapFactor": 0.0, + "metallicMapFactor": 0.0, + "roughnessMapFactor": 0.0, + "normalMapFactor": 0.0, + "aoMapFactor": 0.0, + "emissiveMapFactor": 0.0, + "alphaCutOff": 0.4000000059604645, + "workflow": 0.0, + "shader": "//CoreShaders/ForwardPBR.shader", + "Reflectance": 0.30000001192092898 + } + } + } + }, + "value582": 15, + "value583": { + "PrimitiveType": 4, + "FilePath": "Primitive", + "Material": { + "ptr_wrapper": { + "valid": 1, + "data": { + "Albedo": "", + "Normal": "", + "Metallic": "", + "Roughness": "", + "Ao": "", + "Emissive": "", + "albedoColour": { + "value0": 0.8999999761581421, + "value1": 0.8999999761581421, + "value2": 0.8999999761581421, + "value3": 0.8999999761581421 + }, + "roughnessValue": 0.10000000149011612, + "metallicValue": 0.8999999761581421, + "emissiveValue": 0.0, + "albedoMapFactor": 0.0, + "metallicMapFactor": 0.0, + "roughnessMapFactor": 0.0, + "normalMapFactor": 0.0, + "aoMapFactor": 0.0, + "emissiveMapFactor": 0.0, + "alphaCutOff": 0.4000000059604645, + "workflow": 0.0, + "shader": "//CoreShaders/ForwardPBR.shader", + "Reflectance": 0.30000001192092898 + } + } + } + }, + "value584": 14, + "value585": { + "PrimitiveType": 4, + "FilePath": "Primitive", + "Material": { + "ptr_wrapper": { + "valid": 1, + "data": { + "Albedo": "", + "Normal": "", + "Metallic": "", + "Roughness": "", + "Ao": "", + "Emissive": "", + "albedoColour": { + "value0": 1.0, + "value1": 1.0, + "value2": 1.0, + "value3": 0.8999999761581421 + }, + "roughnessValue": 0.0, + "metallicValue": 1.0, + "emissiveValue": 0.0, + "albedoMapFactor": 0.0, + "metallicMapFactor": 0.0, + "roughnessMapFactor": 0.0, + "normalMapFactor": 0.0, + "aoMapFactor": 0.0, + "emissiveMapFactor": 0.0, + "alphaCutOff": 0.4000000059604645, + "workflow": 0.0, + "shader": "//CoreShaders/ForwardPBR.shader", + "Reflectance": 0.30000001192092898 + } + } + } + }, + "value586": 13, + "value587": { + "PrimitiveType": 4, + "FilePath": "Primitive", + "Material": { + "ptr_wrapper": { + "valid": 1, + "data": { + "Albedo": "", + "Normal": "", + "Metallic": "", + "Roughness": "", + "Ao": "", + "Emissive": "", + "albedoColour": { + "value0": 0.8999999761581421, + "value1": 0.8999999761581421, + "value2": 0.8999999761581421, + "value3": 0.8999999761581421 + }, + "roughnessValue": 0.9000000357627869, + "metallicValue": 0.23999999463558198, + "emissiveValue": 0.0, + "albedoMapFactor": 0.0, + "metallicMapFactor": 0.0, + "roughnessMapFactor": 0.0, + "normalMapFactor": 0.0, + "aoMapFactor": 0.0, + "emissiveMapFactor": 0.0, + "alphaCutOff": 0.4000000059604645, + "workflow": 0.0, + "shader": "//CoreShaders/ForwardPBR.shader", + "Reflectance": 0.30000001192092898 + } + } + } + }, + "value588": 12, + "value589": { + "PrimitiveType": 4, + "FilePath": "Primitive", + "Material": { + "ptr_wrapper": { + "valid": 1, + "data": { + "Albedo": "", + "Normal": "", + "Metallic": "", + "Roughness": "", + "Ao": "", + "Emissive": "", + "albedoColour": { + "value0": 0.8999999761581421, + "value1": 0.8999999761581421, + "value2": 0.8999999761581421, + "value3": 0.8999999761581421 + }, + "roughnessValue": 0.800000011920929, + "metallicValue": 0.23999999463558198, + "emissiveValue": 0.0, + "albedoMapFactor": 0.0, + "metallicMapFactor": 0.0, + "roughnessMapFactor": 0.0, + "normalMapFactor": 0.0, + "aoMapFactor": 0.0, + "emissiveMapFactor": 0.0, + "alphaCutOff": 0.4000000059604645, + "workflow": 0.0, + "shader": "//CoreShaders/ForwardPBR.shader", + "Reflectance": 0.30000001192092898 + } + } + } + }, + "value590": 11, + "value591": { + "PrimitiveType": 4, + "FilePath": "Primitive", + "Material": { + "ptr_wrapper": { + "valid": 1, + "data": { + "Albedo": "", + "Normal": "", + "Metallic": "", + "Roughness": "", + "Ao": "", + "Emissive": "", + "albedoColour": { + "value0": 0.8999999761581421, + "value1": 0.8999999761581421, + "value2": 0.8999999761581421, + "value3": 0.8999999761581421 + }, + "roughnessValue": 0.699999988079071, + "metallicValue": 0.23999999463558198, + "emissiveValue": 0.0, + "albedoMapFactor": 0.0, + "metallicMapFactor": 0.0, + "roughnessMapFactor": 0.0, + "normalMapFactor": 0.0, + "aoMapFactor": 0.0, + "emissiveMapFactor": 0.0, + "alphaCutOff": 0.4000000059604645, + "workflow": 0.0, + "shader": "//CoreShaders/ForwardPBR.shader", + "Reflectance": 0.30000001192092898 + } + } + } + }, + "value592": 10, + "value593": { + "PrimitiveType": 4, + "FilePath": "Primitive", + "Material": { + "ptr_wrapper": { + "valid": 1, + "data": { + "Albedo": "", + "Normal": "", + "Metallic": "", + "Roughness": "", + "Ao": "", + "Emissive": "", + "albedoColour": { + "value0": 0.8999999761581421, + "value1": 0.8999999761581421, + "value2": 0.8999999761581421, + "value3": 0.8999999761581421 + }, + "roughnessValue": 0.6000000238418579, + "metallicValue": 0.23999999463558198, + "emissiveValue": 0.0, + "albedoMapFactor": 0.0, + "metallicMapFactor": 0.0, + "roughnessMapFactor": 0.0, + "normalMapFactor": 0.0, + "aoMapFactor": 0.0, + "emissiveMapFactor": 0.0, + "alphaCutOff": 0.4000000059604645, + "workflow": 0.0, + "shader": "//CoreShaders/ForwardPBR.shader", + "Reflectance": 0.30000001192092898 + } + } + } + }, + "value594": 9, + "value595": { + "PrimitiveType": 4, + "FilePath": "Primitive", + "Material": { + "ptr_wrapper": { + "valid": 1, + "data": { + "Albedo": "", + "Normal": "", + "Metallic": "", + "Roughness": "", + "Ao": "", + "Emissive": "", + "albedoColour": { + "value0": 0.8999999761581421, + "value1": 0.8999999761581421, + "value2": 0.8999999761581421, + "value3": 0.8999999761581421 + }, + "roughnessValue": 0.5, + "metallicValue": 0.23999999463558198, + "emissiveValue": 0.0, + "albedoMapFactor": 0.0, + "metallicMapFactor": 0.0, + "roughnessMapFactor": 0.0, + "normalMapFactor": 0.0, + "aoMapFactor": 0.0, + "emissiveMapFactor": 0.0, + "alphaCutOff": 0.4000000059604645, + "workflow": 0.0, + "shader": "//CoreShaders/ForwardPBR.shader", + "Reflectance": 0.30000001192092898 + } + } + } + }, + "value596": 8, + "value597": { + "PrimitiveType": 4, + "FilePath": "Primitive", + "Material": { + "ptr_wrapper": { + "valid": 1, + "data": { + "Albedo": "", + "Normal": "", + "Metallic": "", + "Roughness": "", + "Ao": "", + "Emissive": "", + "albedoColour": { + "value0": 0.8999999761581421, + "value1": 0.8999999761581421, + "value2": 0.8999999761581421, + "value3": 0.8999999761581421 + }, + "roughnessValue": 0.4000000059604645, + "metallicValue": 0.23999999463558198, + "emissiveValue": 0.0, + "albedoMapFactor": 0.0, + "metallicMapFactor": 0.0, + "roughnessMapFactor": 0.0, + "normalMapFactor": 0.0, + "aoMapFactor": 0.0, + "emissiveMapFactor": 0.0, + "alphaCutOff": 0.4000000059604645, + "workflow": 0.0, + "shader": "//CoreShaders/ForwardPBR.shader", + "Reflectance": 0.30000001192092898 + } + } + } + }, + "value598": 7, + "value599": { + "PrimitiveType": 4, + "FilePath": "Primitive", + "Material": { + "ptr_wrapper": { + "valid": 1, + "data": { + "Albedo": "", + "Normal": "", + "Metallic": "", + "Roughness": "", + "Ao": "", + "Emissive": "", + "albedoColour": { + "value0": 0.8999999761581421, + "value1": 0.8999999761581421, + "value2": 0.8999999761581421, + "value3": 0.8999999761581421 + }, + "roughnessValue": 0.30000001192092898, + "metallicValue": 0.23999999463558198, + "emissiveValue": 0.0, + "albedoMapFactor": 0.0, + "metallicMapFactor": 0.0, + "roughnessMapFactor": 0.0, + "normalMapFactor": 0.0, + "aoMapFactor": 0.0, + "emissiveMapFactor": 0.0, + "alphaCutOff": 0.4000000059604645, + "workflow": 0.0, + "shader": "//CoreShaders/ForwardPBR.shader", + "Reflectance": 0.30000001192092898 + } + } + } + }, + "value600": 6, + "value601": { + "PrimitiveType": 4, + "FilePath": "Primitive", + "Material": { + "ptr_wrapper": { + "valid": 1, + "data": { + "Albedo": "", + "Normal": "", + "Metallic": "", + "Roughness": "", + "Ao": "", + "Emissive": "", + "albedoColour": { + "value0": 0.8999999761581421, + "value1": 0.8999999761581421, + "value2": 0.8999999761581421, + "value3": 0.8999999761581421 + }, + "roughnessValue": 0.20000000298023225, + "metallicValue": 0.23999999463558198, + "emissiveValue": 0.0, + "albedoMapFactor": 0.0, + "metallicMapFactor": 0.0, + "roughnessMapFactor": 0.0, + "normalMapFactor": 0.0, + "aoMapFactor": 0.0, + "emissiveMapFactor": 0.0, + "alphaCutOff": 0.4000000059604645, + "workflow": 0.0, + "shader": "//CoreShaders/ForwardPBR.shader", + "Reflectance": 0.30000001192092898 + } + } + } + }, + "value602": 5, + "value603": { + "PrimitiveType": 4, + "FilePath": "Primitive", + "Material": { + "ptr_wrapper": { + "valid": 1, + "data": { + "Albedo": "", + "Normal": "", + "Metallic": "", + "Roughness": "", + "Ao": "", + "Emissive": "", + "albedoColour": { + "value0": 0.8999999761581421, + "value1": 0.8999999761581421, + "value2": 0.8999999761581421, + "value3": 0.8999999761581421 + }, + "roughnessValue": 0.10000000149011612, + "metallicValue": 0.23999999463558198, + "emissiveValue": 0.0, + "albedoMapFactor": 0.0, + "metallicMapFactor": 0.0, + "roughnessMapFactor": 0.0, + "normalMapFactor": 0.0, + "aoMapFactor": 0.0, + "emissiveMapFactor": 0.0, + "alphaCutOff": 0.4000000059604645, + "workflow": 0.0, + "shader": "//CoreShaders/ForwardPBR.shader", + "Reflectance": 0.30000001192092898 + } + } + } + }, + "value604": 4, + "value605": { + "PrimitiveType": 4, + "FilePath": "Primitive", + "Material": { + "ptr_wrapper": { + "valid": 1, + "data": { + "Albedo": "", + "Normal": "", + "Metallic": "", + "Roughness": "", + "Ao": "", + "Emissive": "", + "albedoColour": { + "value0": 0.8999999761581421, + "value1": 0.8999999761581421, + "value2": 0.8999999761581421, + "value3": 0.8999999761581421 + }, + "roughnessValue": 0.0, + "metallicValue": 0.23999999463558198, + "emissiveValue": 0.0, + "albedoMapFactor": 0.0, + "metallicMapFactor": 0.0, + "roughnessMapFactor": 0.0, + "normalMapFactor": 0.0, + "aoMapFactor": 0.0, + "emissiveMapFactor": 0.0, + "alphaCutOff": 0.4000000059604645, + "workflow": 0.0, + "shader": "//CoreShaders/ForwardPBR.shader", + "Reflectance": 0.30000001192092898 + } + } + } + }, + "value606": 2097155, + "value607": { + "PrimitiveType": 2, + "FilePath": "Primitive", + "Material": { + "ptr_wrapper": { + "valid": 1, + "data": { + "Albedo": "//Textures/checkerboard.tga", + "Normal": "", + "Metallic": "", + "Roughness": "", + "Ao": "", + "Emissive": "", + "albedoColour": { + "value0": 0.6000000238418579, + "value1": 0.10000000149011612, + "value2": 0.10000000149011612, + "value3": 1.0 + }, + "roughnessValue": 0.6000000238418579, + "metallicValue": 0.15000000596046449, + "emissiveValue": 0.0, + "albedoMapFactor": 0.5, + "metallicMapFactor": 0.0, + "roughnessMapFactor": 0.0, + "normalMapFactor": 0.0, + "aoMapFactor": 0.0, + "emissiveMapFactor": 0.0, + "alphaCutOff": 0.4000000059604645, + "workflow": 0.0, + "shader": "//CoreShaders/ForwardPBR.shader", + "Reflectance": 0.30000001192092898 + } + } + } + }, + "value608": 2097154, + "value609": { + "PrimitiveType": 2, + "FilePath": "Primitive", + "Material": { + "ptr_wrapper": { + "valid": 1, + "data": { + "Albedo": "//Textures/checkerboard.tga", + "Normal": "", + "Metallic": "", + "Roughness": "", + "Ao": "", + "Emissive": "", + "albedoColour": { + "value0": 0.6000000238418579, + "value1": 0.10000000149011612, + "value2": 0.10000000149011612, + "value3": 1.0 + }, + "roughnessValue": 0.6000000238418579, + "metallicValue": 0.15000000596046449, + "emissiveValue": 0.0, + "albedoMapFactor": 0.5, + "metallicMapFactor": 0.0, + "roughnessMapFactor": 0.0, + "normalMapFactor": 0.0, + "aoMapFactor": 0.0, + "emissiveMapFactor": 0.0, + "alphaCutOff": 0.4000000059604645, + "workflow": 0.0, + "shader": "//CoreShaders/ForwardPBR.shader", + "Reflectance": 0.30000001192092898 + } + } + } + }, + "value610": 1, + "value611": { + "PrimitiveType": 2, + "FilePath": "Primitive", + "Material": { + "ptr_wrapper": { + "valid": 1, + "data": { + "Albedo": "//Textures/checkerboard.tga", + "Normal": "", + "Metallic": "", + "Roughness": "", + "Ao": "", + "Emissive": "", + "albedoColour": { + "value0": 0.6000000238418579, + "value1": 0.10000000149011612, + "value2": 0.10000000149011612, + "value3": 1.0 + }, + "roughnessValue": 0.6000000238418579, + "metallicValue": 0.15000000596046449, + "emissiveValue": 0.0, + "albedoMapFactor": 0.5, + "metallicMapFactor": 0.0, + "roughnessMapFactor": 0.0, + "normalMapFactor": 0.0, + "aoMapFactor": 0.0, + "emissiveMapFactor": 0.0, + "alphaCutOff": 0.4000000059604645, + "workflow": 0.0, + "shader": "//CoreShaders/ForwardPBR.shader", + "Reflectance": 0.30000001192092898 + } + } + } + }, + "value612": 1048576, + "value613": { + "PrimitiveType": 4, + "FilePath": "Primitive", + "Material": { + "ptr_wrapper": { + "valid": 1, + "data": { + "Albedo": "", + "Normal": "", + "Metallic": "", + "Roughness": "", + "Ao": "", + "Emissive": "", + "albedoColour": { + "value0": 0.8999999761581421, + "value1": 0.8999999761581421, + "value2": 0.8999999761581421, + "value3": 0.8999999761581421 + }, + "roughnessValue": 0.9000000357627869, + "metallicValue": 0.8999999761581421, + "emissiveValue": 0.0, + "albedoMapFactor": 0.0, + "metallicMapFactor": 0.0, + "roughnessMapFactor": 0.0, + "normalMapFactor": 0.0, + "aoMapFactor": 0.0, + "emissiveMapFactor": 0.0, + "alphaCutOff": 0.4000000059604645, + "workflow": 0.0, + "shader": "//CoreShaders/ForwardPBR.shader", + "Reflectance": 0.30000001192092898 + } + } + } + }, + "value614": 38, + "value615": { + "PrimitiveType": 2, + "FilePath": "Primitive", + "Material": { + "ptr_wrapper": { + "valid": 1, + "data": { + "Albedo": "//Textures/checkerboard.tga", + "Normal": "", + "Metallic": "", + "Roughness": "", + "Ao": "", + "Emissive": "", + "albedoColour": { + "value0": 0.6000000238418579, + "value1": 0.10000000149011612, + "value2": 0.10000000149011612, + "value3": 1.0 + }, + "roughnessValue": 0.6000000238418579, + "metallicValue": 0.15000000596046449, + "emissiveValue": 0.0, + "albedoMapFactor": 0.5, + "metallicMapFactor": 0.0, + "roughnessMapFactor": 0.0, + "normalMapFactor": 0.0, + "aoMapFactor": 0.0, + "emissiveMapFactor": 0.0, + "alphaCutOff": 0.4000000059604645, + "workflow": 0.0, + "shader": "//CoreShaders/ForwardPBR.shader", + "Reflectance": 0.30000001192092898 + } + } + } + }, + "value616": 39, + "value617": { + "PrimitiveType": 2, + "FilePath": "Primitive", + "Material": { + "ptr_wrapper": { + "valid": 1, + "data": { + "Albedo": "//Textures/checkerboard.tga", + "Normal": "", + "Metallic": "", + "Roughness": "", + "Ao": "", + "Emissive": "", + "albedoColour": { + "value0": 0.4297460615634918, + "value1": 0.6977397203445435, + "value2": 0.9335038661956787, + "value3": 1.0 + }, + "roughnessValue": 0.616368293762207, + "metallicValue": 0.9207161068916321, + "emissiveValue": 9.999999974752428e-7, + "albedoMapFactor": 0.0, + "metallicMapFactor": 0.0, + "roughnessMapFactor": 0.0, + "normalMapFactor": 0.0, + "aoMapFactor": 0.0, + "emissiveMapFactor": 0.0, + "alphaCutOff": 0.4000000059604645, + "workflow": 0.0, + "shader": "//CoreShaders/ForwardPBR.shader", + "Reflectance": 0.30000001192092898 + } + } + } + }, + "value618": 40, + "value619": { + "PrimitiveType": 2, + "FilePath": "Primitive", + "Material": { + "ptr_wrapper": { + "valid": 1, + "data": { + "Albedo": "", + "Normal": "", + "Metallic": "", + "Roughness": "", + "Ao": "", + "Emissive": "", + "albedoColour": { + "value0": 1.0, + "value1": 1.0, + "value2": 1.0, + "value3": 1.0 + }, + "roughnessValue": 1.0, + "metallicValue": 1.0, + "emissiveValue": 0.0, + "albedoMapFactor": 0.0, + "metallicMapFactor": 0.0, + "roughnessMapFactor": 0.0, + "normalMapFactor": 0.0, + "aoMapFactor": 0.0, + "emissiveMapFactor": 0.0, + "alphaCutOff": 0.4000000059604645, + "workflow": 0.0, + "shader": "//CoreShaders/ForwardPBR.shader", + "Reflectance": 0.30000001192092898 + } + } + } + }, + "value620": 41, + "value621": { + "PrimitiveType": 2, + "FilePath": "Primitive", + "Material": { + "ptr_wrapper": { + "valid": 1, + "data": { + "Albedo": "", + "Normal": "", + "Metallic": "", + "Roughness": "", + "Ao": "", + "Emissive": "", + "albedoColour": { + "value0": 1.0, + "value1": 1.0, + "value2": 1.0, + "value3": 1.0 + }, + "roughnessValue": 1.0, + "metallicValue": 1.0, + "emissiveValue": 0.0, + "albedoMapFactor": 0.0, + "metallicMapFactor": 0.0, + "roughnessMapFactor": 0.0, + "normalMapFactor": 0.0, + "aoMapFactor": 0.0, + "emissiveMapFactor": 0.0, + "alphaCutOff": 0.4000000059604645, + "workflow": 0.0, + "shader": "//CoreShaders/ForwardPBR.shader", + "Reflectance": 0.30000001192092898 + } + } + } + }, + "value622": 42, + "value623": { + "PrimitiveType": 2, + "FilePath": "Primitive", + "Material": { + "ptr_wrapper": { + "valid": 1, + "data": { + "Albedo": "", + "Normal": "", + "Metallic": "", + "Roughness": "", + "Ao": "", + "Emissive": "", + "albedoColour": { + "value0": 1.0, + "value1": 1.0, + "value2": 1.0, + "value3": 1.0 + }, + "roughnessValue": 1.0, + "metallicValue": 1.0, + "emissiveValue": 0.0, + "albedoMapFactor": 0.0, + "metallicMapFactor": 0.0, + "roughnessMapFactor": 0.0, + "normalMapFactor": 0.0, + "aoMapFactor": 0.0, + "emissiveMapFactor": 0.0, + "alphaCutOff": 0.4000000059604645, + "workflow": 0.0, + "shader": "//CoreShaders/ForwardPBR.shader", + "Reflectance": 0.30000001192092898 + } + } + } + }, + "value624": 43, + "value625": { + "PrimitiveType": 4, + "FilePath": "Primitive", + "Material": { + "ptr_wrapper": { + "valid": 1, + "data": { + "Albedo": "", + "Normal": "", + "Metallic": "", + "Roughness": "", + "Ao": "", + "Emissive": "", + "albedoColour": { + "value0": 1.0, + "value1": 1.0, + "value2": 1.0, + "value3": 1.0 + }, + "roughnessValue": 1.0, + "metallicValue": 1.0, + "emissiveValue": 0.0, + "albedoMapFactor": 0.0, + "metallicMapFactor": 0.0, + "roughnessMapFactor": 0.0, + "normalMapFactor": 0.0, + "aoMapFactor": 0.0, + "emissiveMapFactor": 0.0, + "alphaCutOff": 0.4000000059604645, + "workflow": 0.0, + "shader": "//CoreShaders/ForwardPBR.shader", + "Reflectance": 0.30000001192092898 + } + } + } + }, + "value626": 44, + "value627": { + "PrimitiveType": 5, + "FilePath": "Primitive", + "Material": { + "ptr_wrapper": { + "valid": 1, + "data": { + "Albedo": "", + "Normal": "", + "Metallic": "", + "Roughness": "", + "Ao": "", + "Emissive": "", + "albedoColour": { + "value0": 0.00553114851936698, + "value1": 0.19561977684497834, + "value2": 0.639769434928894, + "value3": 1.0 + }, + "roughnessValue": 0.30000001192092898, + "metallicValue": 0.800000011920929, + "emissiveValue": 0.0, + "albedoMapFactor": 0.0, + "metallicMapFactor": 0.0, + "roughnessMapFactor": 0.0, + "normalMapFactor": 0.0, + "aoMapFactor": 0.0, + "emissiveMapFactor": 0.0, + "alphaCutOff": 0.4000000059604645, + "workflow": 0.0, + "shader": "//CoreShaders/ForwardPBR.shader", + "Reflectance": 0.30000001192092898 + } + } + } + }, + "value628": 45, + "value629": { + "PrimitiveType": 5, + "FilePath": "Primitive", + "Material": { + "ptr_wrapper": { + "valid": 1, + "data": { + "Albedo": "", + "Normal": "", + "Metallic": "", + "Roughness": "", + "Ao": "", + "Emissive": "", + "albedoColour": { + "value0": 0.6507357954978943, + "value1": 0.09966032207012177, + "value2": 0.8645533323287964, + "value3": 1.0 + }, + "roughnessValue": 0.20000000298023225, + "metallicValue": 1.0, + "emissiveValue": 0.0, + "albedoMapFactor": 0.0, + "metallicMapFactor": 0.0, + "roughnessMapFactor": 0.0, + "normalMapFactor": 0.0, + "aoMapFactor": 0.0, + "emissiveMapFactor": 0.0, + "alphaCutOff": 0.4000000059604645, + "workflow": 0.0, + "shader": "//CoreShaders/ForwardPBR.shader", + "Reflectance": 0.30000001192092898 + } + } + } + }, + "value630": 46, + "value631": { + "PrimitiveType": 5, + "FilePath": "Primitive", + "Material": { + "ptr_wrapper": { + "valid": 1, + "data": { + "Albedo": "", + "Normal": "", + "Metallic": "", + "Roughness": "", + "Ao": "", + "Emissive": "", + "albedoColour": { + "value0": 0.023860372602939607, + "value1": 0.6368876099586487, + "value2": 0.06979317218065262, + "value3": 1.0 + }, + "roughnessValue": 0.10000000149011612, + "metallicValue": 0.8999999761581421, + "emissiveValue": 0.0, + "albedoMapFactor": 0.0, + "metallicMapFactor": 0.0, + "roughnessMapFactor": 0.0, + "normalMapFactor": 0.0, + "aoMapFactor": 0.0, + "emissiveMapFactor": 0.0, + "alphaCutOff": 0.4000000059604645, + "workflow": 0.0, + "shader": "//CoreShaders/ForwardPBR.shader", + "Reflectance": 0.30000001192092898 + } + } + } + }, + "value632": 47, + "value633": { + "PrimitiveType": 2, + "FilePath": "Primitive", + "Material": { + "ptr_wrapper": { + "valid": 1, + "data": { + "Albedo": "", + "Normal": "", + "Metallic": "", + "Roughness": "", + "Ao": "", + "Emissive": "", + "albedoColour": { + "value0": 0.05196789652109146, + "value1": 0.9297934174537659, + "value2": 0.12700922787189485, + "value3": 1.0 + }, + "roughnessValue": 0.9384711980819702, + "metallicValue": 0.1437719166278839, + "emissiveValue": 2.4000000953674318, + "albedoMapFactor": 0.0, + "metallicMapFactor": 0.0, + "roughnessMapFactor": 0.0, + "normalMapFactor": 0.0, + "aoMapFactor": 0.0, + "emissiveMapFactor": 0.0, + "alphaCutOff": 0.4000000059604645, + "workflow": 0.0, + "shader": "//CoreShaders/ForwardPBR.shader", + "Reflectance": 0.30000001192092898 + } + } + } + }, + "value634": 48, + "value635": { + "PrimitiveType": 2, + "FilePath": "Primitive", + "Material": { + "ptr_wrapper": { + "valid": 1, + "data": { + "Albedo": "", + "Normal": "", + "Metallic": "", + "Roughness": "", + "Ao": "", + "Emissive": "", + "albedoColour": { + "value0": 0.6321501731872559, + "value1": 1.0, + "value2": 0.0, + "value3": 1.0 + }, + "roughnessValue": 0.7327036261558533, + "metallicValue": 0.1365143060684204, + "emissiveValue": 2.0, + "albedoMapFactor": 0.0, + "metallicMapFactor": 0.0, + "roughnessMapFactor": 0.0, + "normalMapFactor": 0.0, + "aoMapFactor": 0.0, + "emissiveMapFactor": 0.0, + "alphaCutOff": 0.4000000059604645, + "workflow": 0.0, + "shader": "//CoreShaders/ForwardPBR.shader", + "Reflectance": 0.30000001192092898 + } + } + } + }, + "value636": 0, + "value637": 6, + "value638": 49, + "value639": { + "TextString": "Metallic", + "Path": "RobotoRegular", + "Colour": { + "value0": 1.0, + "value1": 1.0, + "value2": 1.0, + "value3": 1.0 + }, + "LineSpacing": 0.0, + "Kerning": 0.0, + "MaxWidth": 10.0, + "OutlineColour": { + "value0": 1.0, + "value1": 1.0, + "value2": 1.0, + "value3": 1.0 + }, + "OutlineWidth": 0.0 + }, + "value640": 50, + "value641": { + "TextString": "0.9", + "Path": "RobotoRegular", + "Colour": { + "value0": 1.0, + "value1": 1.0, + "value2": 1.0, + "value3": 1.0 + }, + "LineSpacing": 0.0, + "Kerning": 0.0, + "MaxWidth": 10.0, + "OutlineColour": { + "value0": 1.0, + "value1": 1.0, + "value2": 1.0, + "value3": 1.0 + }, + "OutlineWidth": 0.0 + }, + "value642": 51, + "value643": { + "TextString": "0.2", + "Path": "RobotoRegular", + "Colour": { + "value0": 1.0, + "value1": 1.0, + "value2": 1.0, + "value3": 1.0 + }, + "LineSpacing": 0.0, + "Kerning": 0.0, + "MaxWidth": 10.0, + "OutlineColour": { + "value0": 1.0, + "value1": 1.0, + "value2": 1.0, + "value3": 1.0 + }, + "OutlineWidth": 0.0 + }, + "value644": 52, + "value645": { + "TextString": "Roughness", + "Path": "RobotoRegular", + "Colour": { + "value0": 1.0, + "value1": 1.0, + "value2": 1.0, + "value3": 1.0 + }, + "LineSpacing": 0.0, + "Kerning": 0.0, + "MaxWidth": 10.0, + "OutlineColour": { + "value0": 1.0, + "value1": 1.0, + "value2": 1.0, + "value3": 1.0 + }, + "OutlineWidth": 0.0 + }, + "value646": 53, + "value647": { + "TextString": "0.0", + "Path": "RobotoRegular", + "Colour": { + "value0": 1.0, + "value1": 1.0, + "value2": 1.0, + "value3": 1.0 + }, + "LineSpacing": 0.0, + "Kerning": 0.0, + "MaxWidth": 10.0, + "OutlineColour": { + "value0": 1.0, + "value1": 1.0, + "value2": 1.0, + "value3": 1.0 + }, + "OutlineWidth": 0.0 + }, + "value648": 54, + "value649": { + "TextString": "1.0", + "Path": "RobotoRegular", + "Colour": { + "value0": 1.0, + "value1": 1.0, + "value2": 1.0, + "value3": 1.0 + }, + "LineSpacing": 0.0, + "Kerning": 0.0, + "MaxWidth": 10.0, + "OutlineColour": { + "value0": 1.0, + "value1": 1.0, + "value2": 1.0, + "value3": 1.0 + }, + "OutlineWidth": 0.0 + } +} \ No newline at end of file diff --git a/Lumos/External/GLFWpremake5.lua b/Lumos/External/GLFWpremake5.lua index 5f943f178..17166182a 100644 --- a/Lumos/External/GLFWpremake5.lua +++ b/Lumos/External/GLFWpremake5.lua @@ -65,8 +65,6 @@ project "glfw" staticruntime "Off" - buildoptions { "/MP" } - files { "glfw/src/win32_platform.h", "glfw/src/win32_joystick.h", diff --git a/Lumos/External/box2dpremake5.lua b/Lumos/External/box2dpremake5.lua index f1f5f35ff..e0ba579d2 100644 --- a/Lumos/External/box2dpremake5.lua +++ b/Lumos/External/box2dpremake5.lua @@ -10,7 +10,6 @@ project 'box2d' filter "system:windows" systemversion "latest" - buildoptions { "/MP" } filter "system:linux" buildoptions { "-fPIC" } diff --git a/Lumos/External/spdlog/include/spdlog/logger.h b/Lumos/External/spdlog/include/spdlog/logger.h index 06173327a..a69148b4d 100644 --- a/Lumos/External/spdlog/include/spdlog/logger.h +++ b/Lumos/External/spdlog/include/spdlog/logger.h @@ -115,7 +115,7 @@ class SPDLOG_API logger log_it_(log_msg, log_enabled, traceback_enabled); } - void log(source_loc loc, level::level_enum lvl, string_view_t msg) + void log(source_loc loc, level::level_enum lvl, string_view_t msg = "") { bool log_enabled = should_log(lvl); bool traceback_enabled = tracer_.enabled(); diff --git a/Lumos/Source/Lumos/AI/PathEdge.cpp b/Lumos/Source/Lumos/AI/PathEdge.cpp index 2c80d9678..6c007f20d 100644 --- a/Lumos/Source/Lumos/AI/PathEdge.cpp +++ b/Lumos/Source/Lumos/AI/PathEdge.cpp @@ -33,7 +33,7 @@ namespace Lumos float PathEdge::StaticCost() const { - return (m_NodeA->GetWorldSpaceTransform()[3] - m_NodeB->GetWorldSpaceTransform()[3]).length(); + return glm::length(m_NodeA->GetWorldSpaceTransform()[3] - m_NodeB->GetWorldSpaceTransform()[3]); } void PathEdge::SetTraversable(bool traversable) diff --git a/Lumos/Source/Lumos/AI/PathNode.cpp b/Lumos/Source/Lumos/AI/PathNode.cpp index 5f3deb79e..4566a9500 100644 --- a/Lumos/Source/Lumos/AI/PathNode.cpp +++ b/Lumos/Source/Lumos/AI/PathNode.cpp @@ -22,7 +22,7 @@ namespace Lumos float PathNode::HeuristicValue(const PathNode& other) const { - return (GetWorldSpaceTransform()[3] - other.GetWorldSpaceTransform()[3]).length(); + return glm::length(GetWorldSpaceTransform()[3] - other.GetWorldSpaceTransform()[3]); } } \ No newline at end of file diff --git a/Lumos/Source/Lumos/Core/Application.cpp b/Lumos/Source/Lumos/Core/Application.cpp index 3eb42e0b4..212b45ae2 100644 --- a/Lumos/Source/Lumos/Core/Application.cpp +++ b/Lumos/Source/Lumos/Core/Application.cpp @@ -57,6 +57,7 @@ namespace Lumos { LUMOS_PROFILE_FUNCTION(); LUMOS_ASSERT(!s_Instance, "Application already exists!"); + s_Instance = this; } @@ -78,6 +79,12 @@ namespace Lumos m_ProjectSettings.m_ProjectRoot = projectRoot; #endif + if(!FileSystem::FolderExists(m_ProjectSettings.m_ProjectRoot + "Assets/Prefabs")) + std::filesystem::create_directory(m_ProjectSettings.m_ProjectRoot + "Assets/Prefabs"); + + if(!FileSystem::FolderExists(m_ProjectSettings.m_ProjectRoot + "Assets/Materials")) + std::filesystem::create_directory(m_ProjectSettings.m_ProjectRoot + "Assets/Materials"); + m_SceneManager = CreateUniquePtr(); Deserialise(); @@ -137,6 +144,12 @@ namespace Lumos if(!FileSystem::FolderExists(m_ProjectSettings.m_ProjectRoot + "Assets/Sounds")) std::filesystem::create_directory(m_ProjectSettings.m_ProjectRoot + "Assets/Sounds"); + if(!FileSystem::FolderExists(m_ProjectSettings.m_ProjectRoot + "Assets/Prefabs")) + std::filesystem::create_directory(m_ProjectSettings.m_ProjectRoot + "Assets/Prefabs"); + + if(!FileSystem::FolderExists(m_ProjectSettings.m_ProjectRoot + "Assets/Materials")) + std::filesystem::create_directory(m_ProjectSettings.m_ProjectRoot + "Assets/Materials"); + MountVFSPaths(); m_SceneManager->EnqueueScene(new Scene("Empty Scene")); @@ -163,6 +176,8 @@ namespace Lumos VFS::Get().Mount("Scripts", m_ProjectSettings.m_ProjectRoot + std::string("Assets/Scripts"), true); VFS::Get().Mount("Scenes", m_ProjectSettings.m_ProjectRoot + std::string("Assets/Scenes"), true); VFS::Get().Mount("Assets", m_ProjectSettings.m_ProjectRoot + std::string("Assets"), true); + VFS::Get().Mount("Prefabs", m_ProjectSettings.m_ProjectRoot + std::string("Assets/Prefabs"), true); + VFS::Get().Mount("Materials", m_ProjectSettings.m_ProjectRoot + std::string("Assets/Materials"), true); } Scene* Application::GetCurrentScene() const @@ -177,6 +192,8 @@ namespace Lumos m_SceneManager = CreateUniquePtr(); Deserialise(); + m_FrameArena = ArenaAlloc(Megabytes(64)); + Engine::Get(); LuaManager::Get().OnInit(); LuaManager::Get().OnNewProject(m_ProjectSettings.m_ProjectRoot); @@ -195,6 +212,11 @@ namespace Lumos windowDesc.Title = m_ProjectSettings.Title; windowDesc.VSync = m_ProjectSettings.VSync; + if(m_ProjectSettings.DefaultIcon) + { + windowDesc.IconPaths = { "//Textures/icon.png", "//Textures/icon32.png" }; + } + // Initialise the Window m_Window = UniquePtr(Window::Create(windowDesc)); if(!m_Window->HasInitialised()) @@ -282,6 +304,9 @@ namespace Lumos { LUMOS_PROFILE_FUNCTION(); Serialise(); + + ArenaRelease(m_FrameArena); + Graphics::Material::ReleaseDefaultTexture(); Graphics::Font::ShutdownDefaultFont(); Engine::Release(); @@ -322,6 +347,8 @@ namespace Lumos bool Application::OnFrame() { LUMOS_PROFILE_FUNCTION(); + ArenaClear(m_FrameArena); + if(m_SceneManager->GetSwitchingScene()) { LUMOS_PROFILE_SCOPE("Application::SceneSwitch"); @@ -699,6 +726,30 @@ namespace Lumos return; } + if(!FileSystem::FolderExists(m_ProjectSettings.m_ProjectRoot + "Assets")) + std::filesystem::create_directory(m_ProjectSettings.m_ProjectRoot + "Assets"); + + if(!FileSystem::FolderExists(m_ProjectSettings.m_ProjectRoot + "Assets/Scripts")) + std::filesystem::create_directory(m_ProjectSettings.m_ProjectRoot + "Assets/Scripts"); + + if(!FileSystem::FolderExists(m_ProjectSettings.m_ProjectRoot + "Assets/Scenes")) + std::filesystem::create_directory(m_ProjectSettings.m_ProjectRoot + "Assets/Scenes"); + + if(!FileSystem::FolderExists(m_ProjectSettings.m_ProjectRoot + "Assets/Textures")) + std::filesystem::create_directory(m_ProjectSettings.m_ProjectRoot + "Assets/Textures"); + + if(!FileSystem::FolderExists(m_ProjectSettings.m_ProjectRoot + "Assets/Meshes")) + std::filesystem::create_directory(m_ProjectSettings.m_ProjectRoot + "Assets/Meshes"); + + if(!FileSystem::FolderExists(m_ProjectSettings.m_ProjectRoot + "Assets/Sounds")) + std::filesystem::create_directory(m_ProjectSettings.m_ProjectRoot + "Assets/Sounds"); + + if(!FileSystem::FolderExists(m_ProjectSettings.m_ProjectRoot + "Assets/Prefabs")) + std::filesystem::create_directory(m_ProjectSettings.m_ProjectRoot + "Assets/Prefabs"); + + if(!FileSystem::FolderExists(m_ProjectSettings.m_ProjectRoot + "Assets/Materials")) + std::filesystem::create_directory(m_ProjectSettings.m_ProjectRoot + "Assets/Materials"); + m_ProjectLoaded = true; std::string data = FileSystem::ReadTextFile(filePath); diff --git a/Lumos/Source/Lumos/Core/Application.h b/Lumos/Source/Lumos/Core/Application.h index 63bc3f118..2a02157ef 100644 --- a/Lumos/Source/Lumos/Core/Application.h +++ b/Lumos/Source/Lumos/Core/Application.h @@ -275,6 +275,9 @@ namespace Lumos int RenderAPI; int ProjectVersion; int8_t DesiredGPUIndex = -1; + std::string IconPath; + bool DefaultIcon = true; + bool HideTitleBar = false; }; struct RenderConfig @@ -286,6 +289,8 @@ namespace Lumos ProjectSettings& GetProjectSettings() { return m_ProjectSettings; } RenderConfig& GetRenderConfigSettings() { return m_RenderConfig; } + Arena* GetFrameArena() const { return m_FrameArena; } + protected: ProjectSettings m_ProjectSettings; RenderConfig m_RenderConfig; @@ -332,6 +337,8 @@ namespace Lumos std::vector> m_MainThreadQueue; std::mutex m_MainThreadQueueMutex; + Arena* m_FrameArena; + NONCOPYABLE(Application) }; diff --git a/Lumos/Source/Lumos/Core/Core.h b/Lumos/Source/Lumos/Core/Core.h index bd446619a..ea24ae742 100644 --- a/Lumos/Source/Lumos/Core/Core.h +++ b/Lumos/Source/Lumos/Core/Core.h @@ -75,9 +75,9 @@ #define STRINGIZE(s) STRINGIZE2(s) #if LUMOS_PLATFORM_WINDOWS -#define LUMOS_BREAK() __debugbreak(); +#define LUMOS_BREAK() __debugbreak() #else -#define LUMOS_BREAK() raise(SIGTRAP); +#define LUMOS_BREAK() raise(SIGTRAP) #endif #ifdef LUMOS_DEBUG @@ -87,40 +87,30 @@ #define HEX2CHR(m_hex) \ ((m_hex >= '0' && m_hex <= '9') ? (m_hex - '0') : ((m_hex >= 'A' && m_hex <= 'F') ? (10 + m_hex - 'A') : ((m_hex >= 'a' && m_hex <= 'f') ? (10 + m_hex - 'a') : 0))) -#ifdef LUMOS_ENABLE_ASSERTS - -#define LUMOS_ASSERT_NO_MESSAGE(condition) \ - { \ - if(!(condition)) \ - { \ - LUMOS_LOG_ERROR("Assertion Failed!"); \ - LUMOS_BREAK(); \ - } \ - } - -#define LUMOS_ASSERT_MESSAGE(condition, ...) \ - { \ - if(!(condition)) \ - { \ - LUMOS_LOG_ERROR("Assertion Failed"); \ - LUMOS_LOG_ERROR(__VA_ARGS__); \ - LUMOS_BREAK(); \ - } \ - } - -#define LUMOS_CLIENT_ASSERT LUMOS_ASSERT_MESSAGE -#define LUMOS_CORE_ASSERT LUMOS_ASSERT_MESSAGE +#ifndef LUMOS_ENABLE_ASSERTS +#define LUMOS_ASSERT(...) ((void)0) #else -#define LUMOS_CLIENT_ASSERT(...) -#define LUMOS_CORE_ASSERT(...) -#define LUMOS_ASSERT_NO_MESSAGE(...) -#define LUMOS_ASSERT_MESSAGE(condition) -#endif - -#ifdef LUMOS_ENGINE -#define LUMOS_ASSERT LUMOS_CORE_ASSERT +#ifdef LUMOS_PLATFORM_UNIX +#define LUMOS_ASSERT(condition, ...) \ + do { \ + if(!(condition)) \ + { \ + LUMOS_LOG_ERROR("Assertion failed: {0}, file {1}, line {2}", #condition, __FILE__, __LINE__); \ + (::Lumos::Debug::Log::GetCoreLogger())->log(spdlog::source_loc { __FILE__, __LINE__, SPDLOG_FUNCTION }, spdlog::level::level_enum::err, ##__VA_ARGS__); \ + LUMOS_BREAK(); \ + } \ + } while(0) #else -#define LUMOS_ASSERT LUMOS_CLIENT_ASSERT +#define LUMOS_ASSERT(condition, ...) \ + do { \ + if(!(condition)) \ + { \ + LUMOS_LOG_ERROR("Assertion failed: {0}, file {1}, line {2}", #condition, __FILE__, __LINE__); \ + (::Lumos::Debug::Log::GetCoreLogger())->log(spdlog::source_loc { __FILE__, __LINE__, SPDLOG_FUNCTION }, spdlog::level::level_enum::err, __VA_ARGS__); \ + LUMOS_BREAK(); \ + } \ + } while(0) +#endif #endif #define UNIMPLEMENTED \ @@ -129,9 +119,15 @@ LUMOS_BREAK(); \ } -#define NONCOPYABLE(type_identifier) \ - type_identifier(const type_identifier&) = delete; \ - type_identifier& operator=(const type_identifier&) = delete; +#define NONCOPYABLE(class_name) \ + class_name(const class_name&) = delete; \ + class_name& operator=(const class_name&) = delete; + +#define NONCOPYABLEANDMOVE(class_name) \ + class_name(const class_name&) = delete; \ + class_name& operator=(const class_name&) = delete; \ + class_name(class_name&&) = delete; \ + class_name& operator=(class_name&&) = delete; #if defined(_MSC_VER) #define DISABLE_WARNING_PUSH __pragma(warning(push)) @@ -165,6 +161,26 @@ CEREAL_CLASS_VERSION(x, version); \ CEREAL_REGISTER_TYPE_WITH_NAME(x, #x); -// #define VMA_DEBUG_LOG LUMOS_LOG_WARN -// Vulkan Only -// #define LUMOS_PROFILE_GPU_ENABLED +#define Bytes(n) (n) +#define Kilobytes(n) (n << 10) +#define Megabytes(n) (n << 20) +#define Gigabytes(n) (((uint64_t)n) << 30) +#define Terabytes(n) (((uint64_t)n) << 40) + +#define ArrayCount(a) (sizeof(a) / sizeof((a)[0])) +#define IntFromPtr(p) (uint64_t)(((uint8_t*)p) - 0) +#define PtrFromInt(i) (void*)(((uint8_t*)0) + i) +#define MemberOf(type, member_name) ((type*)0)->member_name +#define OffsetOf(type, member_name) IntFromPtr(&MemberOf(type, member_name)) +#define BaseFromMember(type, member_name, ptr) (type*)((uint8_t*)(ptr)-OffsetOf(type, member_name)) + +#define LUMOS_UNUSED(x) (void)(x) +#define LUMOS_STRINGIFY(x) #x + +#if defined(__GNUC__) || defined(__clang__) +#define LUMOS_DEPRECATED(msg) __attribute__((deprecated(msg))) +#elif defined(_MSC_VER) +#define LUMOS_DEPRECATED(msg) __declspec(deprecated(msg)) +#else +#define LUMOS_DEPRECATED(msg) +#endif diff --git a/Lumos/Source/Lumos/Core/JobSystem.cpp b/Lumos/Source/Lumos/Core/JobSystem.cpp index fa5ab4577..2fdd978b9 100644 --- a/Lumos/Source/Lumos/Core/JobSystem.cpp +++ b/Lumos/Source/Lumos/Core/JobSystem.cpp @@ -215,7 +215,7 @@ namespace Lumos // Put each thread on to dedicated core DWORD_PTR affinityMask = 1ull << threadID; DWORD_PTR affinity_result = SetThreadAffinityMask(handle, affinityMask); - LUMOS_ASSERT(affinity_result > 0, ""); + LUMOS_ASSERT(affinity_result > 0); // Increase thread priority: // BOOL priority_result = SetThreadPriority(handle, THREAD_PRIORITY_HIGHEST); @@ -225,7 +225,7 @@ namespace Lumos std::wstring wthreadname = L"JobSystem_" + std::to_wstring(threadID); HRESULT hr = SetThreadDescription(handle, wthreadname.c_str()); - LUMOS_ASSERT(SUCCEEDED(hr), ""); + LUMOS_ASSERT(SUCCEEDED(hr)); #elif LUMOS_PLATFORM_LINUX diff --git a/Lumos/Source/Lumos/Core/OS/Memory.cpp b/Lumos/Source/Lumos/Core/OS/Memory.cpp index 56886ee8b..69f51b149 100644 --- a/Lumos/Source/Lumos/Core/OS/Memory.cpp +++ b/Lumos/Source/Lumos/Core/OS/Memory.cpp @@ -51,6 +51,121 @@ namespace Lumos if(MemoryAllocator) return MemoryAllocator->Print(); } + + // Arenas + Arena* ArenaAlloc(uint64_t size) + { + Arena* arena = (Arena*)malloc(sizeof(Arena) + size); + arena->Position = sizeof(Arena); + arena->CommitPosition = sizeof(Arena); + arena->Align = alignof(std::max_align_t); + arena->Size = size; + arena->Ptr = arena; + return arena; + } + + Arena* ArenaAllocDefault() + { + return ArenaAlloc(4096); + } + + void ArenaRelease(Arena* arena) + { + if(arena) + { + free(arena); + } + } + + void* ArenaPushNoZero(Arena* arena, uint64_t size) + { + assert(arena != nullptr); + uint64_t alignedSize = (size + arena->Align - 1) & ~(arena->Align - 1); + uint64_t newPos = arena->Position + alignedSize; + + if(newPos > arena->Size) + { + return nullptr; // Not enough space in the arena + } + + void* ptr = reinterpret_cast(reinterpret_cast(arena->Ptr) + arena->Position); + arena->Position = newPos; + return ptr; + } + + void* ArenaPushAligner(Arena* arena, uint64_t alignment) + { + assert(arena != nullptr); + assert((alignment & (alignment - 1)) == 0); // Ensure alignment is a power of 2 + + uint64_t currentAddr = reinterpret_cast(arena->Ptr) + arena->Position; + uint64_t alignedAddr = (currentAddr + alignment - 1) & ~(alignment - 1); + uint64_t alignmentPadding = alignedAddr - currentAddr; + uint64_t newPos = arena->Position + alignmentPadding; + + if(newPos > arena->Size) + { + return nullptr; // Not enough space in the arena + } + + void* ptr = reinterpret_cast(reinterpret_cast(arena->Ptr) + newPos); + arena->Position = newPos; + return ptr; + } + + void* ArenaPush(Arena* arena, uint64_t size) + { + void* ptr = ArenaPushNoZero(arena, size); + if(ptr) + { + memset(ptr, 0, size); // Zero initialize the memory + } + return ptr; + } + + void ArenaPopTo(Arena* arena, uint64_t pos) + { + assert(arena != nullptr); + assert(pos <= arena->Position); + arena->Position = pos; + } + + void ArenaSetAutoAlign(Arena* arena, uint64_t align) + { + assert(arena != nullptr); + arena->Align = align; + } + + void ArenaPop(Arena* arena, uint64_t size) + { + assert(arena != nullptr); + assert(size <= arena->Position); + arena->Position -= size; + } + + void ArenaClear(Arena* arena) + { + assert(arena != nullptr); + arena->Position = sizeof(Arena); + } + + uint64_t ArenaPos(Arena* arena) + { + assert(arena != nullptr); + return arena->Position; + } + + ArenaTemp ArenaTempBegin(Arena* arena) + { + assert(arena != nullptr); + return { arena, arena->Position }; + } + + void ArenaTempEnd(ArenaTemp temp) + { + assert(temp.arena != nullptr); + ArenaPopTo(temp.arena, temp.pos); + } } #ifdef CUSTOM_MEMORY_ALLOCATOR @@ -62,7 +177,7 @@ void* operator new(std::size_t size) { throw std::bad_alloc(); } -#if defined(LUMOS_PROFILE) && defined(TRACY_ENABLE) +#if defined(LUMOS_PROFILE) && defined(TRACY_ENABLE) && LUMOS_TRACK_MEMORY TracyAlloc(result, size); #endif return result; @@ -75,7 +190,7 @@ void* operator new[](std::size_t size) { throw std::bad_alloc(); } -#if defined(LUMOS_PROFILE) && defined(TRACY_ENABLE) +#if defined(LUMOS_PROFILE) && defined(TRACY_ENABLE) && LUMOS_TRACK_MEMORY TracyAlloc(result, size); #endif return result; @@ -83,7 +198,7 @@ void* operator new[](std::size_t size) void operator delete(void* p) throw() { -#if defined(LUMOS_PROFILE) && defined(TRACY_ENABLE) +#if defined(LUMOS_PROFILE) && defined(TRACY_ENABLE) && LUMOS_TRACK_MEMORY TracyFree(p); #endif Lumos::Memory::DeleteFunc(p); @@ -91,7 +206,7 @@ void operator delete(void* p) throw() void operator delete[](void* p) throw() { -#if defined(LUMOS_PROFILE) && defined(TRACY_ENABLE) +#if defined(LUMOS_PROFILE) && defined(TRACY_ENABLE) && LUMOS_TRACK_MEMORY TracyFree(p); #endif Lumos::Memory::DeleteFunc(p); diff --git a/Lumos/Source/Lumos/Core/OS/Memory.h b/Lumos/Source/Lumos/Core/OS/Memory.h index f499a8efe..dfd035531 100644 --- a/Lumos/Source/Lumos/Core/OS/Memory.h +++ b/Lumos/Source/Lumos/Core/OS/Memory.h @@ -1,7 +1,12 @@ #pragma once +#include "Core/Core.h" #include "Allocators/Allocator.h" +#include +#include +#include + namespace Lumos { class Memory @@ -16,6 +21,133 @@ namespace Lumos static Allocator* const MemoryAllocator; }; + + struct Arena + { + uint64_t Position; + uint64_t CommitPosition; + uint64_t Align; + uint64_t Size; + Arena* Ptr; + uint64_t _unused_[3]; + }; + + struct ArenaTemp + { + Arena* arena; + uint64_t pos; + }; + + Arena* ArenaAlloc(uint64_t size); + Arena* ArenaAllocDefault(); + void ArenaRelease(Arena* arena); + void* ArenaPushNoZero(Arena* arena, uint64_t size); + void* ArenaPushAligner(Arena* arena, uint64_t alignment); + void* ArenaPush(Arena* arena, uint64_t size); + void ArenaPopTo(Arena* arena, uint64_t pos); + void ArenaSetAutoAlign(Arena* arena, uint64_t align); + void ArenaPop(Arena* arena, uint64_t size); + void ArenaClear(Arena* arena); + uint64_t ArenaPos(Arena* arena); + ArenaTemp ArenaTempBegin(Arena* arena); + void ArenaTempEnd(ArenaTemp temp); + +#define ArenaTempBlock(arena, name) \ + ArenaTemp name = { 0 }; \ + DeferLoop(name = ArenaTempBegin(arena), ArenaTempEnd(name)) + + // Pool Allocator + template + class PoolAllocator + { + public: + explicit PoolAllocator(Arena* arena = nullptr, size_t poolSize = 4096) + : m_Arena(arena) + , m_PoolSize(poolSize) + , m_NextAvailable(nullptr) + { + assert(m_Arena); + assert(m_PoolSize >= sizeof(Node)); + + if(!arena) + { + m_ArenaOwned = true; + m_Arena = ArenaAlloc(Megabytes(50)); + } + + m_AlignSize = (sizeof(T) + alignof(T) - 1) & ~(alignof(T) - 1); + + // Calculate the number of elements that fit in a pool + m_ElementsPerPool = (m_PoolSize - sizeof(Node)) / m_AlignSize; + + AllocateNewPool(); + } + + ~PoolAllocator() + { + while(m_HeadPool) + { + Node* nextPool = m_HeadPool->next; + m_Arena->Position = reinterpret_cast(m_HeadPool); + m_HeadPool = nextPool; + } + + if(m_ArenaOwned) + ArenaRelease(m_Arena); + } + + T* Allocate() + { + if(!m_NextAvailable) + { + AllocateNewPool(); + } + + Node* node = m_NextAvailable; + m_NextAvailable = m_NextAvailable->next; + + return reinterpret_cast(node); + } + + void Deallocate(T* ptr) + { + Node* node = reinterpret_cast(ptr); + node->next = m_NextAvailable; + m_NextAvailable = node; + } + + private: + struct Node + { + Node* next; + }; + + Arena* m_Arena; + size_t m_PoolSize; + size_t m_AlignSize; + size_t m_ElementsPerPool; + Node* m_HeadPool; + Node* m_NextAvailable; + bool m_ArenaOwned = false; + + void AllocateNewPool() + { + void* poolMemory = ArenaPush(m_Arena, m_PoolSize); + Node* pool = reinterpret_cast(poolMemory); + m_HeadPool = pool; + + // Create the linked list of available nodes in the pool + for(size_t i = 0; i < m_ElementsPerPool - 1; ++i) + { + pool->next = reinterpret_cast(reinterpret_cast(pool) + m_AlignSize); + pool = pool->next; + } + + pool->next = nullptr; + m_NextAvailable = m_HeadPool; + } + }; + } #define CUSTOM_MEMORY_ALLOCATOR diff --git a/Lumos/Source/Lumos/Core/OS/Window.h b/Lumos/Source/Lumos/Core/OS/Window.h index de1d5a55e..5b4b69181 100644 --- a/Lumos/Source/Lumos/Core/OS/Window.h +++ b/Lumos/Source/Lumos/Core/OS/Window.h @@ -30,6 +30,8 @@ namespace Lumos std::string Title; int RenderAPI; std::string FilePath; + std::vector IconPaths; + std::vector> IconData; }; class LUMOS_EXPORT Window @@ -71,9 +73,9 @@ namespace Lumos virtual float GetScreenRatio() const = 0; virtual void HideMouse(bool hide) {}; virtual void SetMousePosition(const glm::vec2& pos) {}; - virtual void SetEventCallback(const EventCallbackFn& callback) = 0; - virtual void UpdateCursorImGui() = 0; - virtual void SetIcon(const std::string& filePath, const std::string& smallIconFilePath = "") = 0; + virtual void SetEventCallback(const EventCallbackFn& callback) = 0; + virtual void UpdateCursorImGui() = 0; + virtual void SetIcon(const WindowDesc& desc) = 0; virtual void Maximise() {}; virtual std::string GetTitle() const = 0; virtual uint32_t GetWidth() const = 0; diff --git a/Lumos/Source/Lumos/Core/Profiler.h b/Lumos/Source/Lumos/Core/Profiler.h index 5a453c7ad..d1aa1e5e6 100644 --- a/Lumos/Source/Lumos/Core/Profiler.h +++ b/Lumos/Source/Lumos/Core/Profiler.h @@ -4,6 +4,11 @@ #ifdef LUMOS_PLATFORM_WINDOWS #define TRACY_CALLSTACK 1 #endif + +#define LUMOS_TRACK_MEMORY 0 +#define LUMOS_PROFILE_LOW 0 +#define LUMOS_PROFILE_GPU_TIMINGS 0 + #include #define LUMOS_PROFILE_SCOPE(name) ZoneScopedN(name) #define LUMOS_PROFILE_FUNCTION() ZoneScoped @@ -11,6 +16,15 @@ #define LUMOS_PROFILE_LOCK(type, var, name) TracyLockableN(type, var, name) #define LUMOS_PROFILE_LOCKMARKER(var) LockMark(var) #define LUMOS_PROFILE_SETTHREADNAME(name) tracy::SetThreadName(name) + +#if LUMOS_PROFILE_LOW +#define LUMOS_PROFILE_FUNCTION_LOW() ZoneScoped +#define LUMOS_PROFILE_SCOPE_LOW(name) ZoneScopedN(name) +#else +#define LUMOS_PROFILE_FUNCTION_LOW() +#define LUMOS_PROFILE_SCOPE_LOW(name) +#endif + #else #define LUMOS_PROFILE_SCOPE(name) #define LUMOS_PROFILE_FUNCTION() @@ -18,5 +32,7 @@ #define LUMOS_PROFILE_LOCK(type, var, name) type var #define LUMOS_PROFILE_LOCKMARKER(var) #define LUMOS_PROFILE_SETTHREADNAME(name) +#define LUMOS_PROFILE_FUNCTION_LOW() +#define LUMOS_PROFILE_SCOPE_LOW(name) #endif diff --git a/Lumos/Source/Lumos/Core/Version.h b/Lumos/Source/Lumos/Core/Version.h index 52b6587df..65958afad 100644 --- a/Lumos/Source/Lumos/Core/Version.h +++ b/Lumos/Source/Lumos/Core/Version.h @@ -6,7 +6,7 @@ namespace Lumos { int major = 0; int minor = 3; - int patch = 7; + int patch = 8; }; constexpr Version const LumosVersion = Version(); diff --git a/Lumos/Source/Lumos/Graphics/Animation/Animation.h b/Lumos/Source/Lumos/Graphics/Animation/Animation.h index 86418d979..fe383e3c7 100644 --- a/Lumos/Source/Lumos/Graphics/Animation/Animation.h +++ b/Lumos/Source/Lumos/Graphics/Animation/Animation.h @@ -44,4 +44,4 @@ namespace Lumos std::string m_AnimationName; ozz::unique_ptr m_Animation; }; -} \ No newline at end of file +} diff --git a/Lumos/Source/Lumos/Graphics/Animation/Skeleton.h b/Lumos/Source/Lumos/Graphics/Animation/Skeleton.h index 4b6e595b5..28d375b89 100644 --- a/Lumos/Source/Lumos/Graphics/Animation/Skeleton.h +++ b/Lumos/Source/Lumos/Graphics/Animation/Skeleton.h @@ -40,4 +40,4 @@ namespace Lumos std::string m_FilePath; ozz::unique_ptr m_Skeleton; }; -} \ No newline at end of file +} diff --git a/Lumos/Source/Lumos/Graphics/Font.cpp b/Lumos/Source/Lumos/Graphics/Font.cpp index 19cfca6d5..2da726ce5 100644 --- a/Lumos/Source/Lumos/Graphics/Font.cpp +++ b/Lumos/Source/Lumos/Graphics/Font.cpp @@ -20,7 +20,7 @@ #if FONT_DEBUG_LOG #define FONT_LOG(...) LUMOS_LOG_INFO("Font", __VA_ARGS__) #else -#define FONT_LOG(...) +#define FONT_LOG(...) ((void)0) #endif using namespace msdf_atlas; @@ -334,7 +334,7 @@ namespace Lumos break; } - LUMOS_ASSERT(glyphsLoaded >= 0, ""); + LUMOS_ASSERT(glyphsLoaded >= 0); FONT_LOG("Font: Loaded geometry of {0} out of {1} glyphs", glyphsLoaded, (int)charset.size()); // List missing glyphs if(glyphsLoaded < (int)charset.size()) @@ -367,7 +367,7 @@ namespace Lumos LUMOS_LOG_ERROR("Font: Could not fit {0} out of {1} glyphs into the atlas.", remaining, (int)m_MSDFData->Glyphs.size()); } atlasPacker.getDimensions(config.width, config.height); - LUMOS_CORE_ASSERT(config.width > 0 && config.height > 0, ""); + LUMOS_ASSERT(config.width > 0 && config.height > 0); config.emSize = atlasPacker.getScale(); config.pxRange = atlasPacker.getPixelRange(); if(!fixedScale) diff --git a/Lumos/Source/Lumos/Graphics/Material.h b/Lumos/Source/Lumos/Graphics/Material.h index dcc9336de..3c85bc7b8 100644 --- a/Lumos/Source/Lumos/Graphics/Material.h +++ b/Lumos/Source/Lumos/Graphics/Material.h @@ -241,6 +241,8 @@ namespace Lumos }; static SharedPtr GetDefaultTexture() { return s_DefaultTexture; } + const std::string& GetMaterialPath() const { return m_MaterialPath; } + void SetMaterialPath(const std::string& path) { m_MaterialPath = path; } private: PBRMataterialTextures m_PBRMaterialTextures; @@ -252,6 +254,8 @@ namespace Lumos bool m_TexturesUpdated = false; uint32_t m_Flags; + std::string m_MaterialPath; + static SharedPtr s_DefaultTexture; }; } diff --git a/Lumos/Source/Lumos/Graphics/Mesh.cpp b/Lumos/Source/Lumos/Graphics/Mesh.cpp index 09a959cdf..abc5fbe8d 100644 --- a/Lumos/Source/Lumos/Graphics/Mesh.cpp +++ b/Lumos/Source/Lumos/Graphics/Mesh.cpp @@ -124,7 +124,7 @@ namespace Lumos void Mesh::GenerateTangentsAndBitangents(Vertex* vertices, uint32_t vertexCount, uint32_t* indices, uint32_t numIndices) { - for(int i = 0; i < vertexCount; i++) + for(uint32_t i = 0; i < vertexCount; i++) { vertices[i].Tangent = glm::vec3(0.0f); vertices[i].Bitangent = glm::vec3(0.0f); diff --git a/Lumos/Source/Lumos/Graphics/ModelLoader/GLTFLoader.cpp b/Lumos/Source/Lumos/Graphics/ModelLoader/GLTFLoader.cpp index ab521e696..bd068990b 100644 --- a/Lumos/Source/Lumos/Graphics/ModelLoader/GLTFLoader.cpp +++ b/Lumos/Source/Lumos/Graphics/ModelLoader/GLTFLoader.cpp @@ -275,8 +275,10 @@ namespace Lumos::Graphics std::vector indices; std::vector vertices; + uint32_t vertexCount = primitive.attributes.empty() ? 0 : model.accessors.at(primitive.attributes["POSITION"]).count; + indices.resize(indicesAccessor.count); - vertices.resize(indicesAccessor.count); + vertices.resize(vertexCount); bool hasTangents = false; bool hasBitangents = false; diff --git a/Lumos/Source/Lumos/Graphics/RHI/Definitions.h b/Lumos/Source/Lumos/Graphics/RHI/Definitions.h index aa37b1862..6c2816518 100644 --- a/Lumos/Source/Lumos/Graphics/RHI/Definitions.h +++ b/Lumos/Source/Lumos/Graphics/RHI/Definitions.h @@ -330,6 +330,7 @@ namespace Lumos bool swapchainTarget = false; int cubeMapIndex = -1; int mipIndex = 0; + std::string DebugName; }; struct TextureDesc diff --git a/Lumos/Source/Lumos/Graphics/RHI/GPUProfile.h b/Lumos/Source/Lumos/Graphics/RHI/GPUProfile.h index 1e5e724bf..a6933dc8c 100644 --- a/Lumos/Source/Lumos/Graphics/RHI/GPUProfile.h +++ b/Lumos/Source/Lumos/Graphics/RHI/GPUProfile.h @@ -6,8 +6,10 @@ #include "Platform/Vulkan/VKCommandBuffer.h" #endif -#if defined(LUMOS_PROFILE_GPU_ENABLED) && defined(LUMOS_RENDER_API_VULKAN) && defined(LUMOS_PROFILE) && defined(TRACY_ENABLE) -#define LUMOS_PROFILE_GPU(name) TracyVkZone(Lumos::Graphics::VKDevice::Get().GetTracyContext(), static_cast(Renderer::GetMainSwapChain()->GetCurrentCommandBuffer())->GetHandle(), name) +#if LUMOS_PROFILE_GPU_TIMINGS && defined(LUMOS_RENDER_API_VULKAN) && defined(LUMOS_PROFILE) && defined(TRACY_ENABLE) +#define LUMOS_PROFILE_GPU(name) \ + TracyVkZone(Lumos::Graphics::VKDevice::Get().GetTracyContext(), static_cast(Renderer::GetMainSwapChain()->GetCurrentCommandBuffer())->GetHandle(), name); \ + Lumos::Graphics::VKGPUMarker GPUMarker(name) #else -#define LUMOS_PROFILE_GPU(name) +#define LUMOS_PROFILE_GPU(name) Lumos::Graphics::VKGPUMarker GPUMarker(name) #endif diff --git a/Lumos/Source/Lumos/Graphics/RHI/Pipeline.cpp b/Lumos/Source/Lumos/Graphics/RHI/Pipeline.cpp index df40eca75..3dfd98955 100644 --- a/Lumos/Source/Lumos/Graphics/RHI/Pipeline.cpp +++ b/Lumos/Source/Lumos/Graphics/RHI/Pipeline.cpp @@ -39,7 +39,7 @@ namespace Lumos SharedPtr Pipeline::Get(const PipelineDesc& pipelineDesc) { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); uint64_t hash = 0; HashCombine(hash, pipelineDesc.shader.get(), pipelineDesc.cullMode, pipelineDesc.depthBiasEnabled, (uint32_t)pipelineDesc.drawType, (uint32_t)pipelineDesc.polygonMode, pipelineDesc.transparencyEnabled); diff --git a/Lumos/Source/Lumos/Graphics/RHI/Pipeline.h b/Lumos/Source/Lumos/Graphics/RHI/Pipeline.h index f9c431c76..544085361 100644 --- a/Lumos/Source/Lumos/Graphics/RHI/Pipeline.h +++ b/Lumos/Source/Lumos/Graphics/RHI/Pipeline.h @@ -32,6 +32,8 @@ namespace Lumos float depthBiasSlopeFactor = 0.0f; int cubeMapIndex = 0; int mipIndex = 0; + + std::string DebugName; }; class LUMOS_EXPORT Pipeline diff --git a/Lumos/Source/Lumos/Graphics/RHI/Renderer.cpp b/Lumos/Source/Lumos/Graphics/RHI/Renderer.cpp index bb4353f91..4288db9ae 100644 --- a/Lumos/Source/Lumos/Graphics/RHI/Renderer.cpp +++ b/Lumos/Source/Lumos/Graphics/RHI/Renderer.cpp @@ -48,6 +48,8 @@ #include "CompiledSPV/Headers/Textfragspv.hpp" #include "CompiledSPV/Headers/DepthOfFieldfragspv.hpp" #include "CompiledSPV/Headers/Sharpenfragspv.hpp" +#include "CompiledSPV/Headers/SSAOfragspv.hpp" +#include "CompiledSPV/Headers/SSAOBlurfragspv.hpp" namespace Lumos { @@ -107,6 +109,8 @@ namespace Lumos shaderLibrary->AddResource("Text", SharedPtr(Graphics::Shader::CreateFromEmbeddedArray(spirv_Textvertspv.data(), spirv_Textvertspv_size, spirv_Textfragspv.data(), spirv_Textfragspv_size))); shaderLibrary->AddResource("DepthOfField", SharedPtr(Graphics::Shader::CreateFromEmbeddedArray(spirv_ScreenPassvertspv.data(), spirv_ScreenPassvertspv_size, spirv_DepthOfFieldfragspv.data(), spirv_DepthOfFieldfragspv_size))); shaderLibrary->AddResource("Sharpen", SharedPtr(Graphics::Shader::CreateFromEmbeddedArray(spirv_ScreenPassvertspv.data(), spirv_ScreenPassvertspv_size, spirv_Sharpenfragspv.data(), spirv_Sharpenfragspv_size))); + shaderLibrary->AddResource("SSAO", SharedPtr(Graphics::Shader::CreateFromEmbeddedArray(spirv_ScreenPassvertspv.data(), spirv_ScreenPassvertspv_size, spirv_SSAOfragspv.data(), spirv_SSAOfragspv_size))); + shaderLibrary->AddResource("SSAOBlur", SharedPtr(Graphics::Shader::CreateFromEmbeddedArray(spirv_ScreenPassvertspv.data(), spirv_ScreenPassvertspv_size, spirv_SSAOBlurfragspv.data(), spirv_SSAOBlurfragspv_size))); } else { diff --git a/Lumos/Source/Lumos/Graphics/RHI/Texture.cpp b/Lumos/Source/Lumos/Graphics/RHI/Texture.cpp index b9d061abb..7cda6f06d 100644 --- a/Lumos/Source/Lumos/Graphics/RHI/Texture.cpp +++ b/Lumos/Source/Lumos/Graphics/RHI/Texture.cpp @@ -90,6 +90,7 @@ namespace Lumos return RHIFormat::R32G32B32A32_Float; default: LUMOS_ASSERT(false, "[Texture] Unsupported image bit-depth! ({0})", bits); + return RHIFormat::R8G8B8A8_Unorm; } } diff --git a/Lumos/Source/Lumos/Graphics/Renderers/DebugRenderer.cpp b/Lumos/Source/Lumos/Graphics/Renderers/DebugRenderer.cpp index cf0a45651..fb661d747 100644 --- a/Lumos/Source/Lumos/Graphics/Renderers/DebugRenderer.cpp +++ b/Lumos/Source/Lumos/Graphics/Renderers/DebugRenderer.cpp @@ -28,6 +28,7 @@ #include "Maths/Ray.h" #include "Maths/Maths.h" #include "Audio/SoundNode.h" +#include namespace Lumos { @@ -42,6 +43,22 @@ namespace Lumos #define RENDERER_LINE_SIZE RENDERER2DLINE_VERTEX_SIZE * 4 #define RENDERER_BUFFER_SIZE RENDERER_LINE_SIZE* MaxLineVertices +#ifdef LUMOS_PLATFORM_WINDOWS +#define VSNPRINTF(_DstBuf, _DstSize, _MaxCount, _Format, _ArgList) vsnprintf_s(_DstBuf, _DstSize, _MaxCount, _Format, _ArgList) +#elif LUMOS_PLATFORM_MACOS +#define VSNPRINTF(_DstBuf, _DstSize, _MaxCount, _Format, _ArgList) vsnprintf_l(_DstBuf, _DstSize, _MaxCount, _Format, _ArgList) +#elif LUMOS_PLATFORM_LINUX +#define VSNPRINTF(_DstBuf, _DstSize, _MaxCount, _Format, _ArgList) vsnprintf(_DstBuf, _DstSize, _Format, _ArgList) +#elif LUMOS_PLATFORM_MOBILE +#define VSNPRINTF(_DstBuf, _DstSize, _MaxCount, _Format, _ArgList) 0 +#else +#define VSNPRINTF(_DstBuf, _DstSize, _MaxCount, _Format, _ArgList) 0 +#endif + +#ifndef LUMOS_PLATFORM_WINDOWS +#define _TRUNCATE 0 +#endif + void DebugRenderer::Init() { if(s_Instance) @@ -69,10 +86,42 @@ namespace Lumos s_Instance->m_DrawListNDT.m_DebugLines.clear(); s_Instance->m_DrawListNDT.m_DebugThickLines.clear(); s_Instance->m_DrawListNDT.m_DebugPoints.clear(); + + s_Instance->m_TextList.clear(); + s_Instance->m_TextListNDT.clear(); + s_Instance->m_TextListCS.clear(); + s_Instance->m_NumStatusEntries = 0; + s_Instance->m_MaxStatusEntryWidth = 0.0f; + } + + void DebugRenderer::ClearLogEntries() + { + s_Instance->m_vLogEntries.clear(); + s_Instance->m_LogEntriesOffset = 0; + } + + void DebugRenderer::SortLists() + { + float cs_size_x = LOG_TEXT_SIZE / s_Instance->m_Width * 2.0f; + float cs_size_y = LOG_TEXT_SIZE / s_Instance->m_Height * 2.0f; + size_t log_len = s_Instance->m_vLogEntries.size(); + + float max_x = 0.0f; + for(size_t i = 0; i < log_len; ++i) + { + max_x = Maths::Max(max_x, s_Instance->m_vLogEntries[i].text.length() * cs_size_x * 0.6f); + + size_t idx = (i + s_Instance->m_LogEntriesOffset) % MAX_LOG_SIZE; + float alpha = 1.0f - ((float)log_len - (float)i) / (float)log_len; + s_Instance->m_vLogEntries[idx].colour.w = alpha; + DrawTextCs(glm::vec4(-1.0f + cs_size_x * 0.5f, -1.0f + ((log_len - i - 1) * cs_size_y) + cs_size_y, 0.0f, 1.0f), LOG_TEXT_SIZE, s_Instance->m_vLogEntries[idx].text, s_Instance->m_vLogEntries[idx].colour); + } } DebugRenderer::DebugRenderer() { + m_vLogEntries.clear(); + m_LogEntriesOffset = 0; } DebugRenderer::~DebugRenderer() @@ -239,6 +288,191 @@ namespace Lumos } } + void DebugRenderer::DrawTextCs(const glm::vec4& cs_pos, const float font_size, const std::string& text, const glm::vec4& colour) + { + glm::vec3 cs_size = glm::vec3(font_size / GetInstance()->m_Width, font_size / GetInstance()->m_Height, 0.0f); + cs_size = cs_size * cs_pos.w; + + // Work out the starting position of text based off desired alignment + float x_offset = 0.0f; + const auto text_len = static_cast(text.length()); + + DebugText& dText = GetInstance()->m_TextListCS.emplace_back(); + dText.text = text; + dText.Position = cs_pos; + dText.colour = colour; + dText.Size = font_size; + + // Add each characters to the draw list individually + // for (int i = 0; i < text_len; ++i) + //{ + // glm::vec4 char_pos = glm::vec4(cs_pos.x + x_offset, cs_pos.y, cs_pos.z, cs_pos.w); + // glm::vec4 char_data = glm::vec4(cs_size.x, cs_size.y, static_cast(text[i]), 0.0f); + + // GetInstance()->m_vChars.push_back(char_pos); + // GetInstance()->m_vChars.push_back(char_data); + // GetInstance()->m_vChars.push_back(colour); + // GetInstance()->m_vChars.push_back(colour); //We dont really need this, but we need the padding to match the same vertex format as all the other debug drawables + + // x_offset += cs_size.x * 1.2f; + //} + } + + // Draw Text WorldSpace + void DebugRenderer::DrawTextWs(const glm::vec3& pos, const float font_size, const glm::vec4& colour, const std::string text, ...) + { + va_list args; + va_start(args, text); + + char buf[1024]; + + int needed = VSNPRINTF(buf, 1023, _TRUNCATE, text.c_str(), args); + + va_end(args); + + int length = (needed < 0) ? 1024 : needed; + + std::string formatted_text = std::string(buf, static_cast(length)); + + // glm::vec4 cs_pos = GetInstance()->m_ProjViewMtx * glm::vec4(pos, 1.0f); + // DrawTextCs(cs_pos, font_size, formatted_text, colour); + + DebugText& dText = GetInstance()->m_TextList.emplace_back(); + dText.text = text; + dText.Position = glm::vec4(pos, 1.0f); + dText.colour = colour; + dText.Size = font_size; + } + + void DebugRenderer::DrawTextWsNDT(const glm::vec3& pos, const float font_size, const glm::vec4& colour, const std::string text, ...) + { + va_list args; + va_start(args, text); + + char buf[1024]; + + int needed = VSNPRINTF(buf, 1023, _TRUNCATE, text.c_str(), args); + + va_end(args); + + int length = (needed < 0) ? 1024 : needed; + + std::string formatted_text = std::string(buf, static_cast(length)); + + // glm::vec4 cs_pos = GetInstance()->m_ProjViewMtx * glm::vec4(pos, 1.0f); + // cs_pos.z = (1.0f * cs_pos.w); + // DrawTextCs(cs_pos, font_size, formatted_text, colour); + + DebugText& dText = GetInstance()->m_TextListNDT.emplace_back(); + dText.text = text; + dText.Position = glm::vec4(pos, 1.0f); + dText.colour = colour; + dText.Size = font_size; + } + + // Status Entry + void DebugRenderer::AddStatusEntry(const glm::vec4& colour, const std::string text, ...) + { + float cs_size_x = STATUS_TEXT_SIZE / GetInstance()->m_Width * 2.0f; + float cs_size_y = STATUS_TEXT_SIZE / GetInstance()->m_Height * 2.0f; + + va_list args; + va_start(args, text); + + char buf[1024]; + + int needed = VSNPRINTF(buf, 1023, _TRUNCATE, text.c_str(), args); + + va_end(args); + + int length = (needed < 0) ? 1024 : needed; + + std::string formatted_text = std::string(buf, static_cast(length)); + + DrawTextCs(glm::vec4(-1.0f + cs_size_x * 0.5f, 1.0f - (GetInstance()->m_NumStatusEntries * cs_size_y) + cs_size_y, -1.0f, 1.0f), STATUS_TEXT_SIZE, formatted_text, colour); + GetInstance()->m_NumStatusEntries++; + GetInstance()->m_MaxStatusEntryWidth = Maths::Max(GetInstance()->m_MaxStatusEntryWidth, cs_size_x * 0.6f * length); + } + + // Log + + void DebugRenderer::AddLogEntry(const glm::vec3& colour, const std::string& text) + { + /* time_t now = time(0); + tm ltm; + localtime_s(<m, &now);*/ + + // std::stringstream ss; + // ss << "[" << ltm.tm_hour << ":" << ltm.tm_min << ":" << ltm.tm_sec << "] "; + + LogEntry le; + le.text = /*ss.str() + */ text; // +"\n"; + le.colour = glm::vec4(colour.x, colour.y, colour.z, 1.0f); + + if(GetInstance()->m_vLogEntries.size() < MAX_LOG_SIZE) + GetInstance()->m_vLogEntries.push_back(le); + else + { + GetInstance()->m_vLogEntries[GetInstance()->m_LogEntriesOffset] = le; + GetInstance()->m_LogEntriesOffset = (GetInstance()->m_LogEntriesOffset + 1) % MAX_LOG_SIZE; + } + + LUMOS_LOG_WARN(text); + } + + void DebugRenderer::Log(const glm::vec3& colour, const std::string text, ...) + { + va_list args; + va_start(args, text); + + char buf[1024]; + + int needed = VSNPRINTF(buf, 1023, _TRUNCATE, text.c_str(), args); + + va_end(args); + + int length = (needed < 0) ? 1024 : needed; + AddLogEntry(colour, std::string(buf, static_cast(length))); + } + + void DebugRenderer::Log(const std::string text, ...) + { + va_list args; + va_start(args, text); + + char buf[1024]; + + int needed = VSNPRINTF(buf, 1023, _TRUNCATE, text.c_str(), args); + + va_end(args); + + int length = (needed < 0) ? 1024 : needed; + AddLogEntry(glm::vec3(0.4f, 1.0f, 0.6f), std::string(buf, static_cast(length))); + } + + void DebugRenderer::LogE(const char* filename, int linenumber, const std::string text, ...) + { + // Error Format: + // + // -> : + + va_list args; + va_start(args, text); + + char buf[1024]; + + int needed = VSNPRINTF(buf, 1023, _TRUNCATE, text.c_str(), args); + + va_end(args); + + int length = (needed < 0) ? 1024 : needed; + + Log(glm::vec3(1.0f, 0.25f, 0.25f), "[ERROR] %s:%d", filename, linenumber); + AddLogEntry(glm::vec3(1.0f, 0.5f, 0.5f), "\t \x01 \"" + std::string(buf, static_cast(length)) + "\""); + + std::cout << std::endl; + } + void DebugRenderer::DebugDraw(const Maths::BoundingBox& box, const glm::vec4& edgeColour, bool cornersOnly, float width) { LUMOS_PROFILE_FUNCTION(); diff --git a/Lumos/Source/Lumos/Graphics/Renderers/DebugRenderer.h b/Lumos/Source/Lumos/Graphics/Renderers/DebugRenderer.h index 971e9bb38..85bdad961 100644 --- a/Lumos/Source/Lumos/Graphics/Renderers/DebugRenderer.h +++ b/Lumos/Source/Lumos/Graphics/Renderers/DebugRenderer.h @@ -2,9 +2,27 @@ #include #include #include +#include namespace Lumos { +#define MAX_LOG_SIZE 25 +#define LOG_TEXT_SIZE 14.0f +#define STATUS_TEXT_SIZE 16.0f + + struct LogEntry + { + glm::vec4 colour; + std::string text; + }; + + struct DebugText + { + glm::vec4 colour; + std::string text; + float Size; + glm::vec4 Position; + }; namespace Graphics { @@ -132,6 +150,24 @@ namespace Lumos static void DrawPolygon(int n_verts, const glm::vec3* verts, const glm::vec4& colour = glm::vec4(1.0f, 1.0f, 1.0f, 1.0f)); static void DrawPolygonNDT(int n_verts, const glm::vec3* verts, const glm::vec4& colour = glm::vec4(1.0f, 1.0f, 1.0f, 1.0f)); + // Draw Text WorldSpace (pos given here in worldspace) + static void DrawTextWs(const glm::vec3& pos, const float font_size, const glm::vec4& colour, const std::string text, ...); /// See "printf" for usage manual + static void DrawTextWsNDT(const glm::vec3& pos, const float font_size, const glm::vec4& colour, const std::string text, ...); /// See "printf" for usage manual + + // Draw Text (pos is assumed to be pre-multiplied by projMtx * viewMtx at this point) + static void DrawTextCs(const glm::vec4& pos, const float font_size, const std::string& text, const glm::vec4& colour = glm::vec4(1.0f, 1.0f, 1.0f, 1.0f)); + + // Add a status entry at the top left of the screen (Cleared each frame) + static void AddStatusEntry(const glm::vec4& colour, const std::string text, ...); /// See "printf" for usuage manual + + // Add a log entry at the bottom left - persistent until scene reset + static void Log(const glm::vec3& colour, const std::string text, ...); /// See "printf" for usuage manual + static void Log(const std::string text, ...); // Default Text Colour + static void LogE(const char* filename, int linenumber, const std::string text, ...); + + static void SortLists(); + static void ClearLogEntries(); + static void DebugDraw(const Maths::BoundingBox& box, const glm::vec4& edgeColour, bool cornersOnly = false, float width = 0.02f); static void DebugDraw(const Maths::BoundingSphere& sphere, const glm::vec4& colour); static void DebugDraw(Maths::Frustum& frustum, const glm::vec4& colour); @@ -148,6 +184,20 @@ namespace Lumos const std::vector& GetThickLines(bool depthTested = false) const { return depthTested ? m_DrawList.m_DebugThickLines : m_DrawListNDT.m_DebugThickLines; } const std::vector& GetPoints(bool depthTested = false) const { return depthTested ? m_DrawList.m_DebugPoints : m_DrawListNDT.m_DebugPoints; } + const std::vector& GetLogEntries() const { return m_vLogEntries; } + const std::vector& GetDebugText() const { return m_TextList; } + const std::vector& GetDebugTextNDT() const { return m_TextListNDT; } + const std::vector& GetDebugTextCS() const { return m_TextListCS; } + + // const std::vector& GetTextChars() const { return m_vChars; } + + void SetDimensions(uint32_t width, uint32_t height) + { + m_Width = width; + m_Height = height; + } + void SetProjView(const glm::mat4& projView) { m_ProjViewMtx = projView; } + static DebugRenderer* GetInstance() { return s_Instance; @@ -159,6 +209,7 @@ namespace Lumos static void GenDrawThickLine(bool ndt, const glm::vec3& start, const glm::vec3& end, float line_width, const glm::vec4& colour); static void GenDrawHairLine(bool ndt, const glm::vec3& start, const glm::vec3& end, const glm::vec4& colour); static void GenDrawTriangle(bool ndt, const glm::vec3& v0, const glm::vec3& v1, const glm::vec3& v2, const glm::vec4& colour); + static void AddLogEntry(const glm::vec3& colour, const std::string& text); private: void ClearInternal(); @@ -173,7 +224,22 @@ namespace Lumos std::vector m_DebugThickLines; }; + int m_NumStatusEntries; + float m_MaxStatusEntryWidth; + std::vector m_vLogEntries; + int m_LogEntriesOffset; + + std::vector m_TextList; + std::vector m_TextListNDT; + std::vector m_TextListCS; + + // std::vector m_vChars; + size_t m_OffsetChars; DebugDrawList m_DrawList; DebugDrawList m_DrawListNDT; + + glm::mat4 m_ProjViewMtx = glm::mat4(1.0f); + uint32_t m_Width; + uint32_t m_Height; }; } diff --git a/Lumos/Source/Lumos/Graphics/Renderers/RenderPasses.cpp b/Lumos/Source/Lumos/Graphics/Renderers/RenderPasses.cpp index d9d263f7c..c30273ad6 100644 --- a/Lumos/Source/Lumos/Graphics/Renderers/RenderPasses.cpp +++ b/Lumos/Source/Lumos/Graphics/Renderers/RenderPasses.cpp @@ -365,6 +365,7 @@ namespace Lumos::Graphics TextVertexBufferBase.push_back(new TextVertexData[m_TextRendererData.m_Limits.MaxQuads * 4]); m_LineBufferBase.push_back(new LineVertexData[m_DebugDrawData.m_Renderer2DData.m_Limits.MaxQuads * 4]); m_PointBufferBase.push_back(new PointVertexData[m_DebugDrawData.m_Renderer2DData.m_Limits.MaxQuads * 4]); + DebugTextVertexBufferBase.push_back(new TextVertexData[m_DebugTextRendererData.m_Limits.MaxQuads * 4]); } delete[] indices; @@ -514,6 +515,71 @@ namespace Lumos::Graphics delete[] indices; m_DebugDrawData.m_Renderer2DData.m_CurrentDescriptorSets.resize(2); + + // Setup debug text pass + m_DebugTextRendererData.m_IndexCount = 0; + // m_TextBuffer = nullptr; + m_DebugTextRendererData.m_RenderToDepthTexture = true; + m_DebugTextRendererData.m_TriangleIndicies = false; + m_DebugTextRendererData.m_Limits.SetMaxQuads(10000); + m_DebugTextRendererData.m_Limits.MaxTextures = 16; // Renderer::GetCapabilities().MaxTextureUnits; + + DebugTextVertexBufferPtr = DebugTextVertexBufferBase[0]; + + m_DebugTextRendererData.m_Shader = Application::Get().GetShaderLibrary()->GetResource("Text"); + + m_DebugTextRendererData.m_TransformationStack.emplace_back(glm::mat4(1.0f)); + m_DebugTextRendererData.m_TransformationBack = &m_DebugTextRendererData.m_TransformationStack.back(); + + descriptorDesc.layoutIndex = 0; + descriptorDesc.shader = m_Renderer2DData.m_Shader.get(); + m_DebugTextRendererData.m_DescriptorSet.resize(m_DebugTextRendererData.m_Limits.MaxBatchDrawCalls); + m_DebugTextRendererData.m_PreviousFrameTextureCount.resize(m_DebugTextRendererData.m_Limits.MaxBatchDrawCalls); + + for(uint32_t i = 0; i < m_DebugTextRendererData.m_Limits.MaxBatchDrawCalls; i++) + { + m_DebugTextRendererData.m_PreviousFrameTextureCount[i] = 0; + m_DebugTextRendererData.m_DescriptorSet[i].resize(2); + // if (i == 0) + { + descriptorDesc.layoutIndex = 0; + m_DebugTextRendererData.m_DescriptorSet[i][0] = SharedPtr(Graphics::DescriptorSet::Create(descriptorDesc)); + } + descriptorDesc.layoutIndex = 1; + m_DebugTextRendererData.m_DescriptorSet[i][1] = nullptr; // SharedPtr(Graphics::DescriptorSet::Create(descriptorDesc)); + } + + m_DebugTextRendererData.m_VertexBuffers.resize(Renderer::GetMainSwapChain()->GetSwapChainBufferCount()); + indices = new uint32_t[m_DebugTextRendererData.m_Limits.IndiciesSize]; + + if(m_DebugTextRendererData.m_TriangleIndicies) + { + for(uint32_t i = 0; i < m_DebugTextRendererData.m_Limits.IndiciesSize; i++) + { + indices[i] = i; + } + } + else + { + uint32_t offset = 0; + for(uint32_t i = 0; i < m_DebugTextRendererData.m_Limits.IndiciesSize; i += 6) + { + indices[i] = offset + 0; + indices[i + 1] = offset + 1; + indices[i + 2] = offset + 2; + + indices[i + 3] = offset + 2; + indices[i + 4] = offset + 3; + indices[i + 5] = offset + 0; + + offset += 4; + } + } + m_DebugTextRendererData.m_IndexBuffer = IndexBuffer::Create(indices, m_DebugTextRendererData.m_Limits.IndiciesSize); + + delete[] indices; + + m_DebugTextRendererData.m_CurrentDescriptorSets.resize(2); } RenderPasses::~RenderPasses() @@ -536,12 +602,15 @@ namespace Lumos::Graphics delete m_Renderer2DData.m_IndexBuffer; delete m_TextRendererData.m_IndexBuffer; + delete m_DebugTextRendererData.m_IndexBuffer; delete m_DebugDrawData.m_Renderer2DData.m_IndexBuffer; delete m_DebugDrawData.m_LineIndexBuffer; delete m_DebugDrawData.m_PointIndexBuffer; for(auto data : TextVertexBufferBase) delete[] data; + for(auto data : DebugTextVertexBufferBase) + delete[] data; for(auto data : m_LineBufferBase) delete[] data; @@ -562,6 +631,11 @@ namespace Lumos::Graphics delete m_TextRendererData.m_VertexBuffers[j][i]; } + for(uint32_t i = 0; i < m_DebugTextRendererData.m_VertexBuffers[j].size(); i++) + { + delete m_DebugTextRendererData.m_VertexBuffers[j][i]; + } + for(size_t i = 0; i < m_DebugDrawData.m_Renderer2DData.m_VertexBuffers[j].size(); i++) { delete m_DebugDrawData.m_Renderer2DData.m_VertexBuffers[j][i]; @@ -605,7 +679,9 @@ namespace Lumos::Graphics void RenderPasses::EnableDebugRenderer(bool enable) { - if(enable) + m_DebugRenderEnabled = enable; + + if(m_DebugRenderEnabled) DebugRenderer::Init(); else DebugRenderer::Release(); @@ -622,8 +698,9 @@ namespace Lumos::Graphics m_Stats.NumShadowObjects = 0; m_Stats.UpdatesPerSecond = 0; - m_Renderer2DData.m_BatchDrawCallIndex = 0; - m_TextRendererData.m_BatchDrawCallIndex = 0; + m_Renderer2DData.m_BatchDrawCallIndex = 0; + m_TextRendererData.m_BatchDrawCallIndex = 0; + m_DebugTextRendererData.m_BatchDrawCallIndex = 0; if(m_OverrideCamera) { @@ -650,6 +727,12 @@ namespace Lumos::Graphics auto proj = m_Camera->GetProjectionMatrix(); auto projView = proj * view; + if(m_DebugRenderEnabled) + { + DebugRenderer::GetInstance()->SetDimensions(m_MainTexture->GetWidth(), m_MainTexture->GetHeight()); + DebugRenderer::GetInstance()->SetProjView(projView); + } + Scene::SceneRenderSettings& renderSettings = scene->GetSettings().RenderSettings; if(renderSettings.Renderer3DEnabled) @@ -724,6 +807,9 @@ namespace Lumos::Graphics if(!Entity(lightEntity, scene).Active()) continue; + if(numLights >= 64) + break; + const auto& [light, trans] = group.get(lightEntity); light.Position = glm::vec4(trans.GetWorldPosition(), 1.0f); glm::vec3 forward = glm::vec3(0.0f, 0.0f, 1.0f); @@ -890,6 +976,8 @@ namespace Lumos::Graphics pipelineDesc.depthTarget = m_ForwardData.m_DepthTexture; } + pipelineDesc.DebugName = fmt::format("Forward PBR {0} {1}", pipelineDesc.transparencyEnabled ? "Transparent" : "", pipelineDesc.depthTarget ? "DepthTested" : ""); + command.pipeline = Graphics::Pipeline::Get(pipelineDesc); m_ForwardData.m_CommandQueue.push_back(command); @@ -1197,7 +1285,7 @@ namespace Lumos::Graphics int roundedValue = static_cast(std::ceil(value / 5.0)); // Multiply the rounded value by 5 to get the nearest multiple of 5 - float result = roundedValue * 5.0; + float result = roundedValue * 5.0f; return result; } @@ -1343,6 +1431,7 @@ namespace Lumos::Graphics pipelineDesc.cullMode = Graphics::CullMode::BACK; pipelineDesc.transparencyEnabled = false; pipelineDesc.colourTargets[0] = m_ForwardData.m_BRDFLUT.get(); + pipelineDesc.DebugName = "BRDF Generation"; auto commandBuffer = Renderer::GetMainSwapChain()->GetCurrentCommandBuffer(); auto pipeline = Graphics::Pipeline::Get(pipelineDesc); @@ -1379,6 +1468,7 @@ namespace Lumos::Graphics pipelineDesc.depthBiasEnabled = false; pipelineDesc.depthBiasConstantFactor = 0.0f; pipelineDesc.depthBiasSlopeFactor = 0.0f; + pipelineDesc.DebugName = "Shadow"; auto pipeline = Graphics::Pipeline::Get(pipelineDesc); auto commandBuffer = Renderer::GetMainSwapChain()->GetCurrentCommandBuffer(); @@ -1432,6 +1522,7 @@ namespace Lumos::Graphics pipelineDesc.transparencyEnabled = false; pipelineDesc.depthTarget = m_ForwardData.m_DepthTexture; pipelineDesc.colourTargets[0] = m_NormalTexture; + pipelineDesc.DebugName = "Depth Prepass"; auto pipeline = Graphics::Pipeline::Get(pipelineDesc); commandBuffer->BindPipeline(pipeline); @@ -1475,6 +1566,7 @@ namespace Lumos::Graphics pipelineDesc.shader = m_SSAOShader; pipelineDesc.colourTargets[0] = m_SSAOTexture; pipelineDesc.clearTargets = true; + pipelineDesc.DebugName = "SSAO"; auto projection = m_Camera->GetProjectionMatrix(); auto invProj = glm::inverse(m_Camera->GetProjectionMatrix()); @@ -1484,7 +1576,6 @@ namespace Lumos::Graphics float farC = m_Camera->GetFar(); static glm::vec4 samples[64]; - float radius; static bool init = false; if(!init) @@ -1542,6 +1633,7 @@ namespace Lumos::Graphics pipelineDesc.shader = m_SSAOBlurShader; pipelineDesc.colourTargets[0] = m_SSAOTexture1; pipelineDesc.clearTargets = true; + pipelineDesc.DebugName = "SSAO Blur"; glm::vec2 ssaoTexelOffset = glm::vec2(0.0f, 2.0f / m_SSAOTexture->GetHeight()); @@ -1657,6 +1749,7 @@ namespace Lumos::Graphics } pipelineDesc.colourTargets[0] = m_MainTexture; + pipelineDesc.DebugName = "Skybox"; auto commandBuffer = Renderer::GetMainSwapChain()->GetCurrentCommandBuffer(); auto pipeline = Graphics::Pipeline::Get(pipelineDesc); @@ -1701,9 +1794,9 @@ namespace Lumos::Graphics pipelineDesc.cullMode = Graphics::CullMode::BACK; pipelineDesc.transparencyEnabled = false; pipelineDesc.colourTargets[0] = m_PostProcessTexture1; - - auto commandBuffer = Renderer::GetMainSwapChain()->GetCurrentCommandBuffer(); - auto pipeline = Graphics::Pipeline::Get(pipelineDesc); + pipelineDesc.DebugName = "DepthofField"; + auto commandBuffer = Renderer::GetMainSwapChain()->GetCurrentCommandBuffer(); + auto pipeline = Graphics::Pipeline::Get(pipelineDesc); pipeline->Bind(commandBuffer); auto set = m_DepthOfFieldPassDescriptorSet.get(); @@ -1735,9 +1828,9 @@ namespace Lumos::Graphics pipelineDesc.cullMode = Graphics::CullMode::BACK; pipelineDesc.transparencyEnabled = false; pipelineDesc.colourTargets[0] = m_PostProcessTexture1; - - auto commandBuffer = Renderer::GetMainSwapChain()->GetCurrentCommandBuffer(); - auto pipeline = Graphics::Pipeline::Get(pipelineDesc); + pipelineDesc.DebugName = "Sharpen"; + auto commandBuffer = Renderer::GetMainSwapChain()->GetCurrentCommandBuffer(); + auto pipeline = Graphics::Pipeline::Get(pipelineDesc); pipeline->Bind(commandBuffer); auto set = m_SharpenPassDescriptorSet.get(); @@ -1776,9 +1869,9 @@ namespace Lumos::Graphics pipelineDesc.cullMode = Graphics::CullMode::BACK; pipelineDesc.transparencyEnabled = false; pipelineDesc.colourTargets[0] = m_PostProcessTexture1; - - auto commandBuffer = Renderer::GetMainSwapChain()->GetCurrentCommandBuffer(); - auto pipeline = Graphics::Pipeline::Get(pipelineDesc); + pipelineDesc.DebugName = "ToneMapping"; + auto commandBuffer = Renderer::GetMainSwapChain()->GetCurrentCommandBuffer(); + auto pipeline = Graphics::Pipeline::Get(pipelineDesc); pipeline->Bind(commandBuffer); auto set = m_ToneMappingPassDescriptorSet.get(); @@ -1835,7 +1928,7 @@ namespace Lumos::Graphics pipelineDesc.polygonMode = Graphics::PolygonMode::FILL; pipelineDesc.cullMode = Graphics::CullMode::BACK; pipelineDesc.transparencyEnabled = false; - + pipelineDesc.DebugName = "Final Pass"; if(m_ForwardData.m_RenderTexture) pipelineDesc.colourTargets[0] = m_ForwardData.m_RenderTexture; else @@ -1916,7 +2009,7 @@ namespace Lumos::Graphics pipelineDesc.cullMode = Graphics::CullMode::BACK; pipelineDesc.transparencyEnabled = false; pipelineDesc.mipIndex = 0; - + pipelineDesc.DebugName = "Bloom-Prefilter"; if(!m_SupportCompute) pipelineDesc.colourTargets[0] = m_BloomTexture; @@ -1981,7 +2074,8 @@ namespace Lumos::Graphics for(uint32_t i = 1; i < mips; i++) { { - pipelineDesc.mipIndex = i; + pipelineDesc.mipIndex = i; + pipelineDesc.DebugName = fmt::format("Bloom-Downsample{0}", i); if(!m_SupportCompute) pipelineDesc.colourTargets[0] = m_BloomTexture1; bloomComputePushConstants.Params2.z = (float)m_BloomTexture1->GetWidth(i); @@ -2089,7 +2183,8 @@ namespace Lumos::Graphics bloomComputePushConstants.Params2.z = (float)m_BloomTexture2->GetWidth(mips - 2); bloomComputePushConstants.Params2.w = (float)m_BloomTexture2->GetHeight(mips - 2); - pipelineDesc.mipIndex = mips - 2; + pipelineDesc.mipIndex = mips - 2; + pipelineDesc.DebugName = fmt::format("Bloom-Upsample{0}", mips - 2); if(!m_SupportCompute) pipelineDesc.colourTargets[0] = m_BloomTexture2; @@ -2148,7 +2243,8 @@ namespace Lumos::Graphics bloomComputePushConstants.Params2.z = (float)m_BloomTexture2->GetWidth(mip); bloomComputePushConstants.Params2.w = (float)m_BloomTexture2->GetHeight(mip); - pipelineDesc.mipIndex = mip; + pipelineDesc.mipIndex = mip; + pipelineDesc.DebugName = fmt::format("Bloom-Upsample{0}", mip); if(evenMip) { @@ -2230,6 +2326,7 @@ namespace Lumos::Graphics pipelineDesc.shader = m_FXAAShader; pipelineDesc.transparencyEnabled = false; pipelineDesc.clearTargets = false; + pipelineDesc.DebugName = "FXAA"; if(!m_SupportCompute) pipelineDesc.colourTargets[0] = m_PostProcessTexture1; @@ -2276,6 +2373,7 @@ namespace Lumos::Graphics pipelineDesc.transparencyEnabled = false; pipelineDesc.clearTargets = true; pipelineDesc.colourTargets[0] = m_PostProcessTexture1; + pipelineDesc.DebugName = "Debanding"; auto commandBuffer = Renderer::GetMainSwapChain()->GetCurrentCommandBuffer(); auto pipeline = Graphics::Pipeline::Get(pipelineDesc); @@ -2307,6 +2405,7 @@ namespace Lumos::Graphics pipelineDesc.transparencyEnabled = false; pipelineDesc.clearTargets = true; pipelineDesc.colourTargets[0] = m_PostProcessTexture1; + pipelineDesc.DebugName = "FilmicGrain"; auto commandBuffer = Renderer::GetMainSwapChain()->GetCurrentCommandBuffer(); auto pipeline = Graphics::Pipeline::Get(pipelineDesc); @@ -2349,6 +2448,7 @@ namespace Lumos::Graphics pipelineDesc.transparencyEnabled = false; pipelineDesc.clearTargets = true; pipelineDesc.colourTargets[0] = m_PostProcessTexture1; + pipelineDesc.DebugName = "Outline"; auto commandBuffer = Renderer::GetMainSwapChain()->GetCurrentCommandBuffer(); auto pipeline = Graphics::Pipeline::Get(pipelineDesc); @@ -2386,6 +2486,7 @@ namespace Lumos::Graphics pipelineDesc.transparencyEnabled = false; pipelineDesc.clearTargets = true; pipelineDesc.colourTargets[0] = m_PostProcessTexture1; + pipelineDesc.DebugName = "ChromaticAberation"; auto commandBuffer = Renderer::GetMainSwapChain()->GetCurrentCommandBuffer(); auto pipeline = Graphics::Pipeline::Get(pipelineDesc); @@ -2449,6 +2550,7 @@ namespace Lumos::Graphics pipelineDesc.clearTargets = false; pipelineDesc.depthTarget = reinterpret_cast(m_ForwardData.m_DepthTexture); pipelineDesc.colourTargets[0] = m_MainTexture; + pipelineDesc.DebugName = "2D"; m_Renderer2DData.m_Pipeline = Graphics::Pipeline::Get(pipelineDesc); @@ -2614,12 +2716,12 @@ namespace Lumos::Graphics // m_Renderer2DData.m_Buffer = m_Renderer2DData.m_VertexBuffers[currentFrame][m_Renderer2DData.m_BatchDrawCallIndex]->GetPointer(); } - void RenderPasses::TextFlush() + void RenderPasses::TextFlush(Renderer2DData& textRenderData, std::vector& textVertexBufferBase, TextVertexData*& textVertexBufferPtr) { LUMOS_PROFILE_FUNCTION(); uint32_t currentFrame = Renderer::GetMainSwapChain()->GetCurrentBufferIndex(); - if(m_TextRendererData.m_DescriptorSet[m_TextRendererData.m_BatchDrawCallIndex][1] == nullptr) + if(textRenderData.m_DescriptorSet[textRenderData.m_BatchDrawCallIndex][1] == nullptr) { /* || m_Renderer2DData.m_TextureCount != m_Renderer2DData.m_PreviousFrameTextureCount[m_Renderer2DData.m_BatchDrawCallIndex]) @@ -2628,63 +2730,63 @@ namespace Lumos::Graphics May not be needed anymore */ Graphics::DescriptorDesc descriptorDesc {}; - descriptorDesc.layoutIndex = 1; - descriptorDesc.shader = m_TextRendererData.m_Shader.get(); - m_TextRendererData.m_DescriptorSet[m_TextRendererData.m_BatchDrawCallIndex][1] = SharedPtr(Graphics::DescriptorSet::Create(descriptorDesc)); + descriptorDesc.layoutIndex = 1; + descriptorDesc.shader = textRenderData.m_Shader.get(); + textRenderData.m_DescriptorSet[textRenderData.m_BatchDrawCallIndex][1] = SharedPtr(Graphics::DescriptorSet::Create(descriptorDesc)); } - if(m_TextRendererData.m_TextureCount > 1) - m_TextRendererData.m_DescriptorSet[m_TextRendererData.m_BatchDrawCallIndex][1]->SetTexture("textures", m_TextRendererData.m_Textures, m_TextRendererData.m_TextureCount); - else if(m_TextRendererData.m_TextureCount == 0) - m_TextRendererData.m_DescriptorSet[m_TextRendererData.m_BatchDrawCallIndex][1]->SetTexture("textures", Material::GetDefaultTexture()); + if(textRenderData.m_TextureCount > 1) + textRenderData.m_DescriptorSet[textRenderData.m_BatchDrawCallIndex][1]->SetTexture("textures", textRenderData.m_Textures, textRenderData.m_TextureCount); + else if(textRenderData.m_TextureCount == 0) + textRenderData.m_DescriptorSet[textRenderData.m_BatchDrawCallIndex][1]->SetTexture("textures", Material::GetDefaultTexture()); else - m_TextRendererData.m_DescriptorSet[m_TextRendererData.m_BatchDrawCallIndex][1]->SetTexture("textures", m_TextRendererData.m_Textures[0]); + textRenderData.m_DescriptorSet[textRenderData.m_BatchDrawCallIndex][1]->SetTexture("textures", textRenderData.m_Textures[0]); - m_TextRendererData.m_DescriptorSet[m_TextRendererData.m_BatchDrawCallIndex][1]->Update(); + textRenderData.m_DescriptorSet[textRenderData.m_BatchDrawCallIndex][1]->Update(); - m_TextRendererData.m_PreviousFrameTextureCount[m_TextRendererData.m_BatchDrawCallIndex] = m_TextRendererData.m_TextureCount; + textRenderData.m_PreviousFrameTextureCount[textRenderData.m_BatchDrawCallIndex] = textRenderData.m_TextureCount; Graphics::CommandBuffer* commandBuffer = Renderer::GetMainSwapChain()->GetCurrentCommandBuffer(); - m_TextRendererData.m_Pipeline->Bind(commandBuffer); + textRenderData.m_Pipeline->Bind(commandBuffer); - m_TextRendererData.m_CurrentDescriptorSets[0] = m_TextRendererData.m_DescriptorSet[0][0].get(); - m_TextRendererData.m_CurrentDescriptorSets[1] = m_TextRendererData.m_DescriptorSet[m_TextRendererData.m_BatchDrawCallIndex][1].get(); + textRenderData.m_CurrentDescriptorSets[0] = textRenderData.m_DescriptorSet[textRenderData.m_BatchDrawCallIndex][0].get(); + textRenderData.m_CurrentDescriptorSets[1] = textRenderData.m_DescriptorSet[textRenderData.m_BatchDrawCallIndex][1].get(); - m_TextRendererData.m_IndexBuffer->SetCount(m_TextRendererData.m_IndexCount); - m_TextRendererData.m_IndexBuffer->Bind(commandBuffer); + textRenderData.m_IndexBuffer->SetCount(textRenderData.m_IndexCount); + textRenderData.m_IndexBuffer->Bind(commandBuffer); - if((int)m_TextRendererData.m_VertexBuffers[currentFrame].size() - 1 < (int)m_TextRendererData.m_BatchDrawCallIndex) + if((int)textRenderData.m_VertexBuffers[currentFrame].size() - 1 < (int)textRenderData.m_BatchDrawCallIndex) { - auto& vertexBuffer = m_TextRendererData.m_VertexBuffers[currentFrame].emplace_back(Graphics::VertexBuffer::Create(BufferUsage::DYNAMIC)); + auto& vertexBuffer = textRenderData.m_VertexBuffers[currentFrame].emplace_back(Graphics::VertexBuffer::Create(BufferUsage::DYNAMIC)); vertexBuffer->Resize(RENDERER_LINE_BUFFER_SIZE); } - uint32_t dataSize = (uint32_t)((uint8_t*)TextVertexBufferPtr - (uint8_t*)TextVertexBufferBase[currentFrame]); - m_TextRendererData.m_VertexBuffers[currentFrame][m_TextRendererData.m_BatchDrawCallIndex]->SetData(dataSize, (void*)TextVertexBufferBase[currentFrame]); + uint32_t dataSize = (uint32_t)((uint8_t*)textVertexBufferPtr - (uint8_t*)textVertexBufferBase[currentFrame]); + textRenderData.m_VertexBuffers[currentFrame][textRenderData.m_BatchDrawCallIndex]->SetData(dataSize, (void*)textVertexBufferBase[currentFrame]); // m_TextRendererData.m_VertexBuffers[currentFrame][m_TextRendererData.m_BatchDrawCallIndex]->ReleasePointer(); - Renderer::BindDescriptorSets(m_TextRendererData.m_Pipeline.get(), commandBuffer, 0, m_TextRendererData.m_CurrentDescriptorSets.data(), 2); - Renderer::DrawIndexed(commandBuffer, DrawType::TRIANGLE, m_TextRendererData.m_IndexCount); + Renderer::BindDescriptorSets(textRenderData.m_Pipeline.get(), commandBuffer, 0, textRenderData.m_CurrentDescriptorSets.data(), 2); + Renderer::DrawIndexed(commandBuffer, DrawType::TRIANGLE, textRenderData.m_IndexCount); - m_TextRendererData.m_VertexBuffers[currentFrame][m_TextRendererData.m_BatchDrawCallIndex]->Unbind(); - m_TextRendererData.m_IndexBuffer->Unbind(); + textRenderData.m_VertexBuffers[currentFrame][textRenderData.m_BatchDrawCallIndex]->Unbind(); + textRenderData.m_IndexBuffer->Unbind(); - m_TextRendererData.m_Pipeline->End(commandBuffer); + textRenderData.m_Pipeline->End(commandBuffer); - TextVertexBufferPtr = TextVertexBufferBase[currentFrame]; - m_TextRendererData.m_IndexCount = 0; - m_TextRendererData.m_BatchDrawCallIndex++; + textVertexBufferPtr = textVertexBufferBase[currentFrame]; + textRenderData.m_IndexCount = 0; + textRenderData.m_BatchDrawCallIndex++; - if((int)m_TextRendererData.m_VertexBuffers[currentFrame].size() - 1 < (int)m_TextRendererData.m_BatchDrawCallIndex) + if((int)textRenderData.m_VertexBuffers[currentFrame].size() - 1 < (int)textRenderData.m_BatchDrawCallIndex) { - auto& vertexBuffer = m_TextRendererData.m_VertexBuffers[currentFrame].emplace_back(Graphics::VertexBuffer::Create(BufferUsage::DYNAMIC)); + auto& vertexBuffer = textRenderData.m_VertexBuffers[currentFrame].emplace_back(Graphics::VertexBuffer::Create(BufferUsage::DYNAMIC)); vertexBuffer->Resize(RENDERER_LINE_BUFFER_SIZE); } - m_TextRendererData.m_TextureCount = 0; - m_TextRendererData.m_VertexBuffers[currentFrame][m_TextRendererData.m_BatchDrawCallIndex]->Bind(Renderer::GetMainSwapChain()->GetCurrentCommandBuffer(), m_TextRendererData.m_Pipeline.get()); + textRenderData.m_TextureCount = 0; + textRenderData.m_VertexBuffers[currentFrame][textRenderData.m_BatchDrawCallIndex]->Bind(Renderer::GetMainSwapChain()->GetCurrentCommandBuffer(), textRenderData.m_Pipeline.get()); // m_TextBuffer = m_TextRendererData.m_VertexBuffers[currentFrame][m_TextRendererData.m_BatchDrawCallIndex]->GetPointer(); } @@ -2708,6 +2810,7 @@ namespace Lumos::Graphics pipelineDesc.blendMode = BlendMode::SrcAlphaOneMinusSrcAlpha; pipelineDesc.clearTargets = false; pipelineDesc.colourTargets[0] = m_MainTexture; + pipelineDesc.DebugName = "Text"; m_TextRendererData.m_Pipeline = Graphics::Pipeline::Get(pipelineDesc); @@ -2736,7 +2839,7 @@ namespace Lumos::Graphics m_Stats.NumRenderedObjects++; if(m_TextRendererData.m_IndexCount >= m_TextRendererData.m_Limits.IndiciesSize) - TextFlush(); + TextFlush(m_TextRendererData, TextVertexBufferBase, TextVertexBufferPtr); int textureIndex = -1; auto& string = textComp.TextString; @@ -2865,7 +2968,7 @@ namespace Lumos::Graphics return; } - TextFlush(); + TextFlush(m_TextRendererData, TextVertexBufferBase, TextVertexBufferPtr); // m_TextRendererData.m_VertexBuffers[currentFrame][m_TextRendererData.m_BatchDrawCallIndex]->ReleasePointer(); } @@ -2906,6 +3009,7 @@ namespace Lumos::Graphics pipelineDesc.clearTargets = false; pipelineDesc.drawType = DrawType::LINES; pipelineDesc.colourTargets[0] = m_MainTexture; + pipelineDesc.DebugName = "Debug-Lines"; if(depthTest) pipelineDesc.depthTarget = m_ForwardData.m_DepthTexture; @@ -2983,6 +3087,7 @@ namespace Lumos::Graphics pipelineDesc.drawType = DrawType::LINES; pipelineDesc.colourTargets[0] = m_MainTexture; pipelineDesc.lineWidth = 2.0f; + pipelineDesc.DebugName = "Debug-ThickLines"; if(depthTest) pipelineDesc.depthTarget = m_ForwardData.m_DepthTexture; @@ -3058,6 +3163,8 @@ namespace Lumos::Graphics pipelineDesc.drawType = DrawType::TRIANGLE; pipelineDesc.blendMode = BlendMode::SrcAlphaOneMinusSrcAlpha; pipelineDesc.colourTargets[0] = m_MainTexture; + pipelineDesc.DebugName = "Debug-Points"; + if(depthTest) pipelineDesc.depthTarget = m_ForwardData.m_DepthTexture; @@ -3146,6 +3253,7 @@ namespace Lumos::Graphics pipelineDesc.depthBiasEnabled = true; pipelineDesc.depthBiasConstantFactor = -1.25f; pipelineDesc.depthBiasSlopeFactor = -1.75f; + pipelineDesc.DebugName = "Debug-Triangles"; if(depthTest) pipelineDesc.depthTarget = m_ForwardData.m_DepthTexture; @@ -3219,6 +3327,511 @@ namespace Lumos::Graphics m_DebugDrawData.m_PointBatchDrawCallIndex = 0; m_DebugDrawData.m_LineBatchDrawCallIndex = 0; + + // Text Pass + auto& dtDebugText = DebugRenderer::GetInstance()->GetDebugText(); + if(!dtDebugText.empty()) + { + Graphics::PipelineDesc pipelineDesc; + pipelineDesc.shader = m_DebugTextRendererData.m_Shader; + pipelineDesc.polygonMode = Graphics::PolygonMode::FILL; + pipelineDesc.cullMode = Graphics::CullMode::BACK; + pipelineDesc.transparencyEnabled = true; + pipelineDesc.blendMode = BlendMode::SrcAlphaOneMinusSrcAlpha; + pipelineDesc.clearTargets = false; + pipelineDesc.colourTargets[0] = m_MainTexture; + pipelineDesc.DebugName = "Debug-TextDT"; + pipelineDesc.depthTarget = m_ForwardData.m_DepthTexture; + m_DebugTextRendererData.m_Pipeline = Graphics::Pipeline::Get(pipelineDesc); + + uint32_t currentFrame = Renderer::GetMainSwapChain()->GetCurrentBufferIndex(); + + while((int)m_DebugTextRendererData.m_VertexBuffers[currentFrame].size() - 1 < (int)m_DebugTextRendererData.m_BatchDrawCallIndex) + { + auto& vertexBuffer = m_DebugTextRendererData.m_VertexBuffers[currentFrame].emplace_back(Graphics::VertexBuffer::Create(BufferUsage::DYNAMIC)); + vertexBuffer->Resize(RENDERER_LINE_BUFFER_SIZE); + } + + m_DebugTextRendererData.m_VertexBuffers[currentFrame][m_DebugTextRendererData.m_BatchDrawCallIndex]->Bind(Renderer::GetMainSwapChain()->GetCurrentCommandBuffer(), m_DebugTextRendererData.m_Pipeline.get()); + DebugTextVertexBufferPtr = DebugTextVertexBufferBase[currentFrame]; + auto projView = m_Camera->GetProjectionMatrix() * glm::inverse(m_CameraTransform->GetWorldMatrix()); + DebugRenderer::GetInstance()->SetProjView(projView); + DebugRenderer::SortLists(); + + m_DebugTextRendererData.m_DescriptorSet[m_DebugTextRendererData.m_BatchDrawCallIndex][0]->SetUniform("UBO", "projView", &projView); + m_DebugTextRendererData.m_DescriptorSet[m_DebugTextRendererData.m_BatchDrawCallIndex][0]->Update(); + + m_DebugTextRendererData.m_TextureCount = 0; + m_Stats.NumRenderedObjects++; + + if(m_DebugTextRendererData.m_IndexCount >= m_DebugTextRendererData.m_Limits.IndiciesSize) + TextFlush(m_DebugTextRendererData, DebugTextVertexBufferBase, DebugTextVertexBufferPtr); + + int textureIndex = -1; + // auto& string = textComp.TextString; + auto font = Font::GetDefaultFont(); + float lineHeightOffset = 0.0f; + float kerningOffset = 0.0f; + float outlineWidth = 0.0f; + + SharedPtr fontAtlas = font->GetFontAtlas(); + if(!fontAtlas) + return; // TODO + + for(uint32_t i = 0; i < m_DebugTextRendererData.m_TextureCount; i++) + { + if(m_DebugTextRendererData.m_Textures[i] == fontAtlas.get()) + { + textureIndex = int(i); + break; + } + } + + if(textureIndex == -1) + { + textureIndex = (int)m_DebugTextRendererData.m_TextureCount; + m_DebugTextRendererData.m_Textures[m_DebugTextRendererData.m_TextureCount] = fontAtlas.get(); + m_DebugTextRendererData.m_TextureCount++; + } + + auto& fontGeometry = font->GetMSDFData()->FontGeometry; + const auto& metrics = fontGeometry.getMetrics(); + + for(auto& text : dtDebugText) + { + double x = 0.0; + double fsScale = 1 / (metrics.ascenderY - metrics.descenderY); + double y = 0.0; + for(int i = 0; i < text.text.size(); i++) + { + char32_t character = (char32_t)text.text[i]; + glm::vec4 pos = text.Position; + glm::vec4 colour = text.colour; + glm::vec4 outlineColour = text.colour; + float size = text.Size; + + if(character == '\r') + continue; + + if(character == '\n') + { + x = 0; + y -= fsScale * metrics.lineHeight + lineHeightOffset; + continue; + } + + if(character == '\t') + { + auto glyph = fontGeometry.getGlyph('a'); + double advance = glyph->getAdvance(); + x += 4 * fsScale * advance + kerningOffset; + continue; + } + + auto glyph = fontGeometry.getGlyph(character); + if(!glyph) + glyph = fontGeometry.getGlyph('?'); + if(!glyph) + continue; + + double l, b, r, t; + glyph->getQuadAtlasBounds(l, b, r, t); + + double pl, pb, pr, pt; + glyph->getQuadPlaneBounds(pl, pb, pr, pt); + + pl *= fsScale, pb *= fsScale, pr *= fsScale, pt *= fsScale; + pl += x, pb += y, pr += x, pt += y; + + double texelWidth = 1. / fontAtlas->GetWidth(); + double texelHeight = 1. / fontAtlas->GetHeight(); + l *= texelWidth, b *= texelHeight, r *= texelWidth, t *= texelHeight; + + glm::mat4 transform = glm::translate(glm::mat4(1.0f), glm::vec3(pos)) * glm::scale(glm::mat4(1.0), glm::vec3(size / 10.0f)); + + { + LUMOS_PROFILE_SCOPE("Set text buffer data"); + DebugTextVertexBufferPtr->vertex = transform * glm::vec4(pl, pb, 0.0f, 1.0f); + DebugTextVertexBufferPtr->colour = colour; + DebugTextVertexBufferPtr->uv = { l, b }; + DebugTextVertexBufferPtr->tid = glm::vec2(textureIndex, outlineWidth); + DebugTextVertexBufferPtr->outlineColour = outlineColour; + DebugTextVertexBufferPtr++; + + DebugTextVertexBufferPtr->vertex = transform * glm::vec4(pr, pb, 0.0f, 1.0f); + DebugTextVertexBufferPtr->colour = colour; + DebugTextVertexBufferPtr->uv = { r, b }; + DebugTextVertexBufferPtr->tid = glm::vec2(textureIndex, outlineWidth); + DebugTextVertexBufferPtr->outlineColour = outlineColour; + DebugTextVertexBufferPtr++; + + DebugTextVertexBufferPtr->vertex = transform * glm::vec4(pr, pt, 0.0f, 1.0f); + DebugTextVertexBufferPtr->colour = colour; + DebugTextVertexBufferPtr->uv = { r, t }; + DebugTextVertexBufferPtr->tid = glm::vec2(textureIndex, outlineWidth); + DebugTextVertexBufferPtr->outlineColour = outlineColour; + DebugTextVertexBufferPtr++; + + DebugTextVertexBufferPtr->vertex = transform * glm::vec4(pl, pt, 0.0f, 1.0f); + DebugTextVertexBufferPtr->colour = colour; + DebugTextVertexBufferPtr->uv = { l, t }; + DebugTextVertexBufferPtr->tid = glm::vec2(textureIndex, outlineWidth); + DebugTextVertexBufferPtr->outlineColour = outlineColour; + DebugTextVertexBufferPtr++; + } + + m_DebugTextRendererData.m_IndexCount += 6; + + double advance = glyph->getAdvance(); + + fontGeometry.getAdvance(advance, character, text.text[i + 1]); + x += fsScale * advance + kerningOffset; + } + } + + if(m_DebugTextRendererData.m_IndexCount == 0) + { + // m_DebugTextRendererData.m_VertexBuffers[currentFrame][m_DebugTextRendererData.m_BatchDrawCallIndex]->ReleasePointer(); + return; + } + + TextFlush(m_DebugTextRendererData, DebugTextVertexBufferBase, DebugTextVertexBufferPtr); + } + + auto& ndtDebugText = DebugRenderer::GetInstance()->GetDebugTextNDT(); + if(!ndtDebugText.empty()) + { + Graphics::PipelineDesc pipelineDesc; + pipelineDesc.shader = m_DebugTextRendererData.m_Shader; + pipelineDesc.polygonMode = Graphics::PolygonMode::FILL; + pipelineDesc.cullMode = Graphics::CullMode::BACK; + pipelineDesc.transparencyEnabled = true; + pipelineDesc.blendMode = BlendMode::SrcAlphaOneMinusSrcAlpha; + pipelineDesc.clearTargets = false; + pipelineDesc.colourTargets[0] = m_MainTexture; + pipelineDesc.DebugName = "Debug-TextNDT"; + m_DebugTextRendererData.m_Pipeline = Graphics::Pipeline::Get(pipelineDesc); + + uint32_t currentFrame = Renderer::GetMainSwapChain()->GetCurrentBufferIndex(); + + while((int)m_DebugTextRendererData.m_VertexBuffers[currentFrame].size() - 1 < (int)m_DebugTextRendererData.m_BatchDrawCallIndex) + { + auto& vertexBuffer = m_DebugTextRendererData.m_VertexBuffers[currentFrame].emplace_back(Graphics::VertexBuffer::Create(BufferUsage::DYNAMIC)); + vertexBuffer->Resize(RENDERER_LINE_BUFFER_SIZE); + } + + m_DebugTextRendererData.m_VertexBuffers[currentFrame][m_DebugTextRendererData.m_BatchDrawCallIndex]->Bind(Renderer::GetMainSwapChain()->GetCurrentCommandBuffer(), m_DebugTextRendererData.m_Pipeline.get()); + DebugTextVertexBufferPtr = DebugTextVertexBufferBase[currentFrame]; + auto projView = m_Camera->GetProjectionMatrix() * glm::inverse(m_CameraTransform->GetWorldMatrix()); + DebugRenderer::GetInstance()->SetProjView(projView); + DebugRenderer::SortLists(); + + m_DebugTextRendererData.m_DescriptorSet[m_DebugTextRendererData.m_BatchDrawCallIndex][0]->SetUniform("UBO", "projView", &projView); + m_DebugTextRendererData.m_DescriptorSet[m_DebugTextRendererData.m_BatchDrawCallIndex][0]->Update(); + + m_DebugTextRendererData.m_TextureCount = 0; + m_Stats.NumRenderedObjects++; + + if(m_DebugTextRendererData.m_IndexCount >= m_DebugTextRendererData.m_Limits.IndiciesSize) + TextFlush(m_DebugTextRendererData, DebugTextVertexBufferBase, DebugTextVertexBufferPtr); + + int textureIndex = -1; + // auto& string = textComp.TextString; + auto font = Font::GetDefaultFont(); + float lineHeightOffset = 0.0f; + float kerningOffset = 0.0f; + float outlineWidth = 0.0f; + + SharedPtr fontAtlas = font->GetFontAtlas(); + if(!fontAtlas) + return; // TODO + + for(uint32_t i = 0; i < m_DebugTextRendererData.m_TextureCount; i++) + { + if(m_DebugTextRendererData.m_Textures[i] == fontAtlas.get()) + { + textureIndex = int(i); + break; + } + } + + if(textureIndex == -1) + { + textureIndex = (int)m_DebugTextRendererData.m_TextureCount; + m_DebugTextRendererData.m_Textures[m_DebugTextRendererData.m_TextureCount] = fontAtlas.get(); + m_DebugTextRendererData.m_TextureCount++; + } + + auto& fontGeometry = font->GetMSDFData()->FontGeometry; + const auto& metrics = fontGeometry.getMetrics(); + + for(auto& text : ndtDebugText) + { + double x = 0.0; + double fsScale = 1 / (metrics.ascenderY - metrics.descenderY); + double y = 0.0; + for(int i = 0; i < text.text.size(); i++) + { + char32_t character = (char32_t)text.text[i]; + glm::vec4 pos = text.Position; + glm::vec4 colour = text.colour; + glm::vec4 outlineColour = text.colour; + float size = text.Size; + if(character == '\r') + continue; + + if(character == '\n') + { + x = 0; + y -= fsScale * metrics.lineHeight + lineHeightOffset; + continue; + } + + if(character == '\t') + { + auto glyph = fontGeometry.getGlyph('a'); + double advance = glyph->getAdvance(); + x += 4 * fsScale * advance + kerningOffset; + continue; + } + + auto glyph = fontGeometry.getGlyph(character); + if(!glyph) + glyph = fontGeometry.getGlyph('?'); + if(!glyph) + continue; + + double l, b, r, t; + glyph->getQuadAtlasBounds(l, b, r, t); + + double pl, pb, pr, pt; + glyph->getQuadPlaneBounds(pl, pb, pr, pt); + + pl *= fsScale, pb *= fsScale, pr *= fsScale, pt *= fsScale; + pl += x, pb += y, pr += x, pt += y; + + double texelWidth = 1. / fontAtlas->GetWidth(); + double texelHeight = 1. / fontAtlas->GetHeight(); + l *= texelWidth, b *= texelHeight, r *= texelWidth, t *= texelHeight; + + glm::mat4 transform = glm::translate(glm::mat4(1.0f), glm::vec3(pos)) * glm::scale(glm::mat4(1.0), glm::vec3(size / 10.0f)); + + { + LUMOS_PROFILE_SCOPE("Set text buffer data"); + DebugTextVertexBufferPtr->vertex = transform * glm::vec4(pl, pb, 0.0f, 1.0f); + DebugTextVertexBufferPtr->colour = colour; + DebugTextVertexBufferPtr->uv = { l, b }; + DebugTextVertexBufferPtr->tid = glm::vec2(textureIndex, outlineWidth); + DebugTextVertexBufferPtr->outlineColour = outlineColour; + DebugTextVertexBufferPtr++; + + DebugTextVertexBufferPtr->vertex = transform * glm::vec4(pr, pb, 0.0f, 1.0f); + DebugTextVertexBufferPtr->colour = colour; + DebugTextVertexBufferPtr->uv = { r, b }; + DebugTextVertexBufferPtr->tid = glm::vec2(textureIndex, outlineWidth); + DebugTextVertexBufferPtr->outlineColour = outlineColour; + DebugTextVertexBufferPtr++; + + DebugTextVertexBufferPtr->vertex = transform * glm::vec4(pr, pt, 0.0f, 1.0f); + DebugTextVertexBufferPtr->colour = colour; + DebugTextVertexBufferPtr->uv = { r, t }; + DebugTextVertexBufferPtr->tid = glm::vec2(textureIndex, outlineWidth); + DebugTextVertexBufferPtr->outlineColour = outlineColour; + DebugTextVertexBufferPtr++; + + DebugTextVertexBufferPtr->vertex = transform * glm::vec4(pl, pt, 0.0f, 1.0f); + DebugTextVertexBufferPtr->colour = colour; + DebugTextVertexBufferPtr->uv = { l, t }; + DebugTextVertexBufferPtr->tid = glm::vec2(textureIndex, outlineWidth); + DebugTextVertexBufferPtr->outlineColour = outlineColour; + DebugTextVertexBufferPtr++; + } + + m_DebugTextRendererData.m_IndexCount += 6; + + double advance = glyph->getAdvance(); + + fontGeometry.getAdvance(advance, character, text.text[i + 1]); + x += fsScale * advance + kerningOffset; + } + } + + if(m_DebugTextRendererData.m_IndexCount == 0) + { + // m_DebugTextRendererData.m_VertexBuffers[currentFrame][m_DebugTextRendererData.m_BatchDrawCallIndex]->ReleasePointer(); + return; + } + + TextFlush(m_DebugTextRendererData, DebugTextVertexBufferBase, DebugTextVertexBufferPtr); + } + + auto& csDebugText = DebugRenderer::GetInstance()->GetDebugTextCS(); + if(!csDebugText.empty()) + { + Graphics::PipelineDesc pipelineDesc; + pipelineDesc.shader = m_DebugTextRendererData.m_Shader; + pipelineDesc.polygonMode = Graphics::PolygonMode::FILL; + pipelineDesc.cullMode = Graphics::CullMode::BACK; + pipelineDesc.transparencyEnabled = true; + pipelineDesc.blendMode = BlendMode::SrcAlphaOneMinusSrcAlpha; + pipelineDesc.clearTargets = false; + pipelineDesc.colourTargets[0] = m_MainTexture; + pipelineDesc.DebugName = "Debug-TextCS"; + m_DebugTextRendererData.m_Pipeline = Graphics::Pipeline::Get(pipelineDesc); + + uint32_t currentFrame = Renderer::GetMainSwapChain()->GetCurrentBufferIndex(); + + while((int)m_DebugTextRendererData.m_VertexBuffers[currentFrame].size() - 1 < (int)m_DebugTextRendererData.m_BatchDrawCallIndex) + { + auto& vertexBuffer = m_DebugTextRendererData.m_VertexBuffers[currentFrame].emplace_back(Graphics::VertexBuffer::Create(BufferUsage::DYNAMIC)); + vertexBuffer->Resize(RENDERER_LINE_BUFFER_SIZE); + } + + m_DebugTextRendererData.m_VertexBuffers[currentFrame][m_DebugTextRendererData.m_BatchDrawCallIndex]->Bind(Renderer::GetMainSwapChain()->GetCurrentCommandBuffer(), m_DebugTextRendererData.m_Pipeline.get()); + DebugTextVertexBufferPtr = DebugTextVertexBufferBase[currentFrame]; + glm::mat4 csProjection = glm::ortho(0.0f, (float)m_MainTexture->GetWidth(), 0.0f, (float)m_MainTexture->GetHeight(), -100.0f, 100.0f); + auto projView = glm::mat4(1.0f); // csProjection;// *glm::inverse(m_CameraTransform->GetWorldMatrix()); + DebugRenderer::GetInstance()->SetProjView(projView); + DebugRenderer::SortLists(); + + m_DebugTextRendererData.m_DescriptorSet[m_DebugTextRendererData.m_BatchDrawCallIndex][0]->SetUniform("UBO", "projView", &projView); + m_DebugTextRendererData.m_DescriptorSet[m_DebugTextRendererData.m_BatchDrawCallIndex][0]->Update(); + + m_DebugTextRendererData.m_TextureCount = 0; + m_Stats.NumRenderedObjects++; + + if(m_DebugTextRendererData.m_IndexCount >= m_DebugTextRendererData.m_Limits.IndiciesSize) + TextFlush(m_DebugTextRendererData, DebugTextVertexBufferBase, DebugTextVertexBufferPtr); + + int textureIndex = -1; + // auto& string = textComp.TextString; + auto font = Font::GetDefaultFont(); + float lineHeightOffset = 0.0f; + float kerningOffset = 0.0f; + float outlineWidth = 0.0f; + + SharedPtr fontAtlas = font->GetFontAtlas(); + if(!fontAtlas) + return; // TODO + + for(uint32_t i = 0; i < m_DebugTextRendererData.m_TextureCount; i++) + { + if(m_DebugTextRendererData.m_Textures[i] == fontAtlas.get()) + { + textureIndex = int(i); + break; + } + } + + if(textureIndex == -1) + { + textureIndex = (int)m_DebugTextRendererData.m_TextureCount; + m_DebugTextRendererData.m_Textures[m_DebugTextRendererData.m_TextureCount] = fontAtlas.get(); + m_DebugTextRendererData.m_TextureCount++; + } + + auto& fontGeometry = font->GetMSDFData()->FontGeometry; + const auto& metrics = fontGeometry.getMetrics(); + + for(auto& text : csDebugText) + { + double x = 0.0; + double fsScale = 1 / (metrics.ascenderY - metrics.descenderY); + double y = 0.0; + for(int i = 0; i < text.text.size(); i++) + { + char32_t character = (char32_t)text.text[i]; + glm::vec4 pos = text.Position; + glm::vec4 colour = text.colour; + glm::vec4 outlineColour = text.colour; + + if(character == '\r') + continue; + + if(character == '\n') + { + x = 0; + y -= fsScale * metrics.lineHeight + lineHeightOffset; + continue; + } + + if(character == '\t') + { + auto glyph = fontGeometry.getGlyph('a'); + double advance = glyph->getAdvance(); + x += 4 * fsScale * advance + kerningOffset; + continue; + } + + auto glyph = fontGeometry.getGlyph(character); + if(!glyph) + glyph = fontGeometry.getGlyph('?'); + if(!glyph) + continue; + + double l, b, r, t; + glyph->getQuadAtlasBounds(l, b, r, t); + + double pl, pb, pr, pt; + glyph->getQuadPlaneBounds(pl, pb, pr, pt); + + pl *= fsScale, pb *= fsScale, pr *= fsScale, pt *= fsScale; + pl += x, pb += y, pr += x, pt += y; + + double texelWidth = 1. / fontAtlas->GetWidth(); + double texelHeight = 1. / fontAtlas->GetHeight(); + l *= texelWidth, b *= texelHeight, r *= texelWidth, t *= texelHeight; + + glm::mat4 transform = glm::translate(glm::mat4(1.0f), glm::vec3(pos)) * glm::scale(glm::mat4(1.0), glm::vec3(0.05f, 0.05f, 0.05f)); + + { + LUMOS_PROFILE_SCOPE("Set text buffer data"); + DebugTextVertexBufferPtr->vertex = transform * glm::vec4(pl, pb, 0.0f, 1.0f); + DebugTextVertexBufferPtr->colour = colour; + DebugTextVertexBufferPtr->uv = { l, b }; + DebugTextVertexBufferPtr->tid = glm::vec2(textureIndex, outlineWidth); + DebugTextVertexBufferPtr->outlineColour = outlineColour; + DebugTextVertexBufferPtr++; + + DebugTextVertexBufferPtr->vertex = transform * glm::vec4(pr, pb, 0.0f, 1.0f); + DebugTextVertexBufferPtr->colour = colour; + DebugTextVertexBufferPtr->uv = { r, b }; + DebugTextVertexBufferPtr->tid = glm::vec2(textureIndex, outlineWidth); + DebugTextVertexBufferPtr->outlineColour = outlineColour; + DebugTextVertexBufferPtr++; + + DebugTextVertexBufferPtr->vertex = transform * glm::vec4(pr, pt, 0.0f, 1.0f); + DebugTextVertexBufferPtr->colour = colour; + DebugTextVertexBufferPtr->uv = { r, t }; + DebugTextVertexBufferPtr->tid = glm::vec2(textureIndex, outlineWidth); + DebugTextVertexBufferPtr->outlineColour = outlineColour; + DebugTextVertexBufferPtr++; + + DebugTextVertexBufferPtr->vertex = transform * glm::vec4(pl, pt, 0.0f, 1.0f); + DebugTextVertexBufferPtr->colour = colour; + DebugTextVertexBufferPtr->uv = { l, t }; + DebugTextVertexBufferPtr->tid = glm::vec2(textureIndex, outlineWidth); + DebugTextVertexBufferPtr->outlineColour = outlineColour; + DebugTextVertexBufferPtr++; + } + + m_DebugTextRendererData.m_IndexCount += 6; + + double advance = glyph->getAdvance(); + + fontGeometry.getAdvance(advance, character, text.text[i + 1]); + x += fsScale * advance + kerningOffset; + } + } + + if(m_DebugTextRendererData.m_IndexCount == 0) + { + // m_DebugTextRendererData.m_VertexBuffers[currentFrame][m_DebugTextRendererData.m_BatchDrawCallIndex]->ReleasePointer(); + return; + } + + TextFlush(m_DebugTextRendererData, DebugTextVertexBufferBase, DebugTextVertexBufferPtr); + } } void RenderPasses::CreateCubeMap(const std::string& filePath, const glm::vec4& params, SharedPtr& outEnv, SharedPtr& outIrr) @@ -3265,6 +3878,7 @@ namespace Lumos::Graphics pipelineDesc.cullMode = Graphics::CullMode::BACK; pipelineDesc.transparencyEnabled = false; pipelineDesc.cubeMapTarget = environmentMap; + pipelineDesc.DebugName = "Create Cubemap"; for(uint32_t i = 0; i < 6; i++) { @@ -3304,7 +3918,7 @@ namespace Lumos::Graphics const float deltaRoughness = 1.0f / Maths::Max((float)environmentMapFiltered->GetMipMapLevels() - 1.0f, 1.0f); - for(int mip = 0; mip < environmentMapFiltered->GetMipMapLevels(); mip++) + for(uint32_t mip = 0; mip < environmentMapFiltered->GetMipMapLevels(); mip++) { Graphics::PipelineDesc pipelineDesc {}; pipelineDesc.shader = shader; @@ -3312,6 +3926,7 @@ namespace Lumos::Graphics pipelineDesc.cullMode = Graphics::CullMode::BACK; pipelineDesc.transparencyEnabled = false; pipelineDesc.cubeMapTarget = environmentMapFiltered; + pipelineDesc.DebugName = "Mip Generation"; for(uint32_t i = 0; i < 6; i++) { diff --git a/Lumos/Source/Lumos/Graphics/Renderers/RenderPasses.h b/Lumos/Source/Lumos/Graphics/Renderers/RenderPasses.h index b9382997f..a1d982796 100644 --- a/Lumos/Source/Lumos/Graphics/Renderers/RenderPasses.h +++ b/Lumos/Source/Lumos/Graphics/Renderers/RenderPasses.h @@ -104,7 +104,6 @@ namespace Lumos void DebugPass(); void FinalPass(); void TextPass(); - void TextFlush(); // Post Process void ToneMappingPass(); @@ -121,6 +120,8 @@ namespace Lumos float SubmitTexture(Texture* texture); void UpdateCascades(Scene* scene, Light* light); + bool m_DebugRenderEnabled = false; + struct LUMOS_EXPORT RenderCommand2D { Renderable2D* renderable = nullptr; @@ -287,6 +288,7 @@ namespace Lumos Renderer2DData m_Renderer2DData; Renderer2DData m_TextRendererData; DebugDrawData m_DebugDrawData; + Renderer2DData m_DebugTextRendererData; TextVertexData* TextVertexBufferPtr = nullptr; @@ -295,6 +297,8 @@ namespace Lumos std::vector m_PointBufferBase; std::vector m_QuadBufferBase; std::vector TextVertexBufferBase; + std::vector DebugTextVertexBufferBase; + TextVertexData* DebugTextVertexBufferPtr = nullptr; glm::vec4 m_ClearColour; @@ -373,6 +377,8 @@ namespace Lumos // Outline pass Graphics::Model* m_SelectedModel = nullptr; Maths::Transform* m_SelectedModelTransform = nullptr; + + void TextFlush(Renderer2DData& textRenderData, std::vector& textVertexBufferBase, TextVertexData*& textVertexBufferPtr); }; } } diff --git a/Lumos/Source/Lumos/ImGui/ImConfig.h b/Lumos/Source/Lumos/ImGui/ImConfig.h index c2fae4172..7bb4363fe 100644 --- a/Lumos/Source/Lumos/ImGui/ImConfig.h +++ b/Lumos/Source/Lumos/ImGui/ImConfig.h @@ -20,9 +20,11 @@ //---- Define assertion handler. Defaults to calling assert(). // If your macro uses multiple statements, make sure is enclosed in a 'do { .. } while (0)' block so it can be used as a single statement. -#define IM_ASSERT(_EXPR) LUMOS_ASSERT_NO_MESSAGE(_EXPR) -// #define IM_ASSERT(_EXPR) ((void)(_EXPR)) // Disable asserts - +#ifndef LUMOS_PRODUCTION +#define IM_ASSERT(_EXPR) LUMOS_ASSERT(_EXPR) +#else +#define IM_ASSERT(_EXPR) ((void)(_EXPR)) // Disable asserts +#endif //---- Define attributes of all API symbols declarations, e.g. for DLL under Windows // Using dear imgui via a shared library is not recommended, because of function call overhead and because we don't guarantee backward nor forward ABI compatibility. // #define IMGUI_API __declspec( dllexport ) diff --git a/Lumos/Source/Lumos/ImGui/ImGuiUtilities.cpp b/Lumos/Source/Lumos/ImGui/ImGuiUtilities.cpp index 396ae3c16..1dd770133 100644 --- a/Lumos/Source/Lumos/ImGui/ImGuiUtilities.cpp +++ b/Lumos/Source/Lumos/ImGui/ImGuiUtilities.cpp @@ -1299,14 +1299,14 @@ namespace Lumos char buffer[256]; memset(buffer, 0, 256); memcpy(buffer, currentText.c_str(), currentText.length()); - + ImGui::PushID(currentText.c_str()); bool updated = ImGui::InputText("##SceneName", buffer, 256); ImGuiUtilities::DrawItemActivityOutline(2.0f, false); if(updated) currentText = std::string(buffer); - + ImGui::PopID(); return updated; } diff --git a/Lumos/Source/Lumos/Maths/Frustum.cpp b/Lumos/Source/Lumos/Maths/Frustum.cpp index edeacd8c7..bd123f144 100644 --- a/Lumos/Source/Lumos/Maths/Frustum.cpp +++ b/Lumos/Source/Lumos/Maths/Frustum.cpp @@ -33,14 +33,14 @@ namespace Lumos void Frustum::Define(const glm::mat4& projection, const glm::mat4& view) { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); glm::mat4 m = projection * view; Define(m); } void Frustum::Transform(const glm::mat4& transform) { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); for(int i = 0; i < 6; i++) { m_Planes[i].Transform(transform); @@ -56,7 +56,7 @@ namespace Lumos void Frustum::Define(const glm::mat4& transform) { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); auto& m = transform; m_Planes[PLANE_LEFT] = Plane(m[0][3] + m[0][0], m[1][3] + m[1][0], m[2][3] + m[2][0], m[3][3] + m[3][0]); m_Planes[PLANE_RIGHT] = Plane(m[0][3] - m[0][0], m[1][3] - m[1][0], m[2][3] - m[2][0], m[3][3] - m[3][0]); @@ -75,14 +75,14 @@ namespace Lumos void Frustum::DefineOrtho(float scale, float aspectRatio, float near, float far, const glm::mat4& viewMatrix) { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); glm::mat4 m = glm::ortho(-scale * aspectRatio, scale * aspectRatio, -scale, scale, near, far); m = m * viewMatrix; Define(m); } void Frustum::Define(float fov, float aspectRatio, float near, float far, const glm::mat4& viewMatrix) { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); float tangent = tan(fov * 0.5f); float height = near * tangent; float width = height * aspectRatio; @@ -94,7 +94,7 @@ namespace Lumos bool Frustum::IsInside(const glm::vec3& point) const { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); for(int i = 0; i < 6; i++) { if(m_Planes[i].Distance(point) < 0.0f) @@ -108,7 +108,7 @@ namespace Lumos bool Frustum::IsInside(const BoundingSphere& sphere) const { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); for(int i = 0; i < 6; i++) { if(m_Planes[i].Distance(sphere.GetCenter()) < -sphere.GetRadius()) @@ -122,7 +122,7 @@ namespace Lumos bool Frustum::IsInside(const BoundingBox& box) const { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); for(int i = 0; i < 6; i++) { glm::vec3 p = box.Min(), n = box.Max(); @@ -153,7 +153,7 @@ namespace Lumos bool Frustum::IsInside(const Rect& rect) const { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); for(int i = 0; i < 6; i++) { glm::vec3 N = m_Planes[i].Normal(); @@ -178,7 +178,7 @@ namespace Lumos bool Frustum::IsInside(const Ray& ray) const { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); for(int i = 0; i < 6; i++) { if(m_Planes[i].Distance(ray.Origin) < 0.0f) @@ -192,7 +192,7 @@ namespace Lumos bool Frustum::IsInside(const Plane& plane) const { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); for(int i = 0; i < 6; i++) { if(m_Planes[i].Distance(plane.Normal()) < 0.0f) @@ -206,26 +206,28 @@ namespace Lumos const Plane& Frustum::GetPlane(FrustumPlane plane) const { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); return m_Planes[plane]; } glm::vec3* Frustum::GetVerticies() { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); return m_Verticies; } void Frustum::CalculateVertices(const glm::mat4& transform) { - LUMOS_PROFILE_FUNCTION(); - bool zerotoOne = false; - bool leftHand = true; + LUMOS_PROFILE_FUNCTION_LOW(); + static const bool zerotoOne = false; + static const bool leftHand = true; + glm::mat4 transformInv = glm::inverse(transform); - m_Verticies[0] = glm::vec4(-1.0f, -1.0f, zerotoOne ? 0.0f : -1.0f, 1.0f); - m_Verticies[1] = glm::vec4(1.0f, -1.0f, zerotoOne ? 0.0f : -1.0f, 1.0f); - m_Verticies[2] = glm::vec4(1.0f, 1.0f, zerotoOne ? 0.0f : -1.0f, 1.0f); - m_Verticies[3] = glm::vec4(-1.0f, 1.0f, zerotoOne ? 0.0f : -1.0f, 1.0f); + + m_Verticies[0] = glm::vec4(-1.0f, -1.0f, zerotoOne ? 0.0f : -1.0f, 1.0f); + m_Verticies[1] = glm::vec4(1.0f, -1.0f, zerotoOne ? 0.0f : -1.0f, 1.0f); + m_Verticies[2] = glm::vec4(1.0f, 1.0f, zerotoOne ? 0.0f : -1.0f, 1.0f); + m_Verticies[3] = glm::vec4(-1.0f, 1.0f, zerotoOne ? 0.0f : -1.0f, 1.0f); m_Verticies[4] = glm::vec4(-1.0f, -1.0f, 1.0f, 1.0f); m_Verticies[5] = glm::vec4(1.0f, -1.0f, 1.0f, 1.0f); diff --git a/Lumos/Source/Lumos/Maths/Transform.cpp b/Lumos/Source/Lumos/Maths/Transform.cpp index 38d77ea20..f73cf76fb 100644 --- a/Lumos/Source/Lumos/Maths/Transform.cpp +++ b/Lumos/Source/Lumos/Maths/Transform.cpp @@ -9,7 +9,7 @@ namespace Lumos { Transform::Transform() { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); m_LocalPosition = glm::vec3(0.0f, 0.0f, 0.0f); m_LocalOrientation = glm::quat(glm::vec3(0.0f, 0.0f, 0.0f)); m_LocalScale = glm::vec3(1.0f, 1.0f, 1.0f); @@ -20,7 +20,7 @@ namespace Lumos Transform::Transform(const glm::mat4& matrix) { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); glm::vec3 skew; glm::vec4 perspective; glm::decompose(matrix, m_LocalScale, m_LocalOrientation, m_LocalPosition, skew, perspective); @@ -32,7 +32,7 @@ namespace Lumos Transform::Transform(const glm::vec3& position) { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); m_LocalPosition = position; m_LocalOrientation = glm::quat(glm::vec3(0.0f, 0.0f, 0.0f)); m_LocalScale = glm::vec3(1.0f, 1.0f, 1.0f); @@ -52,15 +52,15 @@ namespace Lumos void Transform::ApplyTransform() { - LUMOS_PROFILE_FUNCTION(); - glm::vec3 skew; - glm::vec4 perspective; - // glm::decompose(m_LocalMatrix, m_LocalScale, m_LocalOrientation, m_LocalPosition, skew, perspective); + LUMOS_PROFILE_FUNCTION_LOW(); + // glm::vec3 skew; + // glm::vec4 perspective; + // glm::decompose(m_LocalMatrix, m_LocalScale, m_LocalOrientation, m_LocalPosition, skew, perspective); } void Transform::SetWorldMatrix(const glm::mat4& mat) { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); // if(m_Dirty) // UpdateMatrices(); // m_ParentMatrix = mat; @@ -69,7 +69,7 @@ namespace Lumos void Transform::SetLocalTransform(const glm::mat4& localMat) { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); // m_LocalMatrix = localMat; // m_HasUpdated = true; @@ -102,7 +102,7 @@ namespace Lumos const glm::mat4& Transform::GetWorldMatrix() { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); // if(m_Dirty) UpdateMatrices(); @@ -111,7 +111,7 @@ namespace Lumos glm::mat4 Transform::GetLocalMatrix() { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); // if(m_Dirty) // UpdateMatrices(); diff --git a/Lumos/Source/Lumos/Physics/LumosPhysicsEngine/LumosPhysicsEngine.cpp b/Lumos/Source/Lumos/Physics/LumosPhysicsEngine/LumosPhysicsEngine.cpp index 7403856f3..2f3894248 100644 --- a/Lumos/Source/Lumos/Physics/LumosPhysicsEngine/LumosPhysicsEngine.cpp +++ b/Lumos/Source/Lumos/Physics/LumosPhysicsEngine/LumosPhysicsEngine.cpp @@ -135,7 +135,7 @@ namespace Lumos { LUMOS_PROFILE_SCOPE("Physics::UpdatePhysics"); - m_UpdateAccum += timeStep.GetSeconds(); + m_UpdateAccum += (float)timeStep.GetSeconds(); for(uint32_t i = 0; (m_UpdateAccum >= s_UpdateTimestep) && i < m_MaxUpdatesPerFrame; ++i) { m_UpdateAccum -= s_UpdateTimestep; @@ -216,7 +216,7 @@ namespace Lumos void LumosPhysicsEngine::UpdateRigidBody(RigidBody3D* obj) const { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); if(!obj->GetIsStatic() && obj->IsAwake()) { @@ -626,7 +626,7 @@ namespace Lumos void LumosPhysicsEngine::OnDebugDraw() { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); if(m_DebugDrawFlags & PhysicsDebugFlags::MANIFOLD) { for(Manifold& m : m_Manifolds) diff --git a/Lumos/Source/Lumos/Physics/LumosPhysicsEngine/Narrowphase/CollisionDetection.cpp b/Lumos/Source/Lumos/Physics/LumosPhysicsEngine/Narrowphase/CollisionDetection.cpp index 5e7a7add2..1fbcd5177 100644 --- a/Lumos/Source/Lumos/Physics/LumosPhysicsEngine/Narrowphase/CollisionDetection.cpp +++ b/Lumos/Source/Lumos/Physics/LumosPhysicsEngine/Narrowphase/CollisionDetection.cpp @@ -243,7 +243,6 @@ namespace Lumos CapsuleCollisionShape* capsuleShape1 = static_cast(shape1); CapsuleCollisionShape* capsuleShape2 = static_cast(shape2); - CollisionData cur_colData; CollisionData best_colData; best_colData.penetration = -FLT_MAX; diff --git a/Lumos/Source/Lumos/Physics/LumosPhysicsEngine/Narrowphase/Manifold.cpp b/Lumos/Source/Lumos/Physics/LumosPhysicsEngine/Narrowphase/Manifold.cpp index 47d0ea3c9..6b69be9f6 100644 --- a/Lumos/Source/Lumos/Physics/LumosPhysicsEngine/Narrowphase/Manifold.cpp +++ b/Lumos/Source/Lumos/Physics/LumosPhysicsEngine/Narrowphase/Manifold.cpp @@ -30,7 +30,7 @@ namespace Lumos void Manifold::ApplyImpulse() { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); for(uint32_t i = 0; i < m_ContactCount; i++) { SolveContactPoint(m_vContacts[i]); @@ -39,7 +39,7 @@ namespace Lumos void Manifold::SolveContactPoint(ContactPoint& c) const { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); if(m_pNodeA->GetInverseMass() + m_pNodeB->GetInverseMass() == 0.0f) return; @@ -132,7 +132,7 @@ namespace Lumos void Manifold::PreSolverStep(float dt) { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); for(uint32_t i = 0; i < m_ContactCount; i++) { @@ -142,7 +142,7 @@ namespace Lumos void Manifold::UpdateConstraint(ContactPoint& contact) { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); // Reset total impulse forces computed this physics timestep contact.sumImpulseContact = 0.0f; @@ -183,7 +183,7 @@ namespace Lumos void Manifold::AddContact(const glm::vec3& globalOnA, const glm::vec3& globalOnB, const glm::vec3& _normal, const float& _penetration) { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); // Get relative offsets from each object centre of mass // Used to compute rotational velocity at the point of contact. glm::vec3 r1 = (globalOnA - m_pNodeA->GetPosition()); @@ -232,7 +232,7 @@ namespace Lumos void Manifold::DebugDraw() const { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); if(m_ContactCount > 0) { diff --git a/Lumos/Source/Lumos/Physics/LumosPhysicsEngine/RigidBody3D.cpp b/Lumos/Source/Lumos/Physics/LumosPhysicsEngine/RigidBody3D.cpp index 37277d3c7..0f33a547e 100644 --- a/Lumos/Source/Lumos/Physics/LumosPhysicsEngine/RigidBody3D.cpp +++ b/Lumos/Source/Lumos/Physics/LumosPhysicsEngine/RigidBody3D.cpp @@ -33,6 +33,7 @@ namespace Lumos m_AtRest = properties.AtRest; m_Elasticity = properties.Elasticity; m_Friction = properties.Friction; + m_UUID = UUID(); } RigidBody3D::~RigidBody3D() @@ -41,7 +42,7 @@ namespace Lumos const Maths::BoundingBox& RigidBody3D::GetWorldSpaceAABB() { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); if(m_wsAabbInvalidated) { LUMOS_PROFILE_SCOPE("Calculate BoundingBox"); @@ -64,7 +65,7 @@ namespace Lumos const glm::mat4& RigidBody3D::GetWorldSpaceTransform() const { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); if(m_wsTransformInvalidated) { m_wsTransform = glm::translate(glm::mat4(1.0), m_Position) * glm::toMat4(m_Orientation); @@ -77,7 +78,7 @@ namespace Lumos void RigidBody3D::AutoResizeBoundingBox() { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); m_localBoundingBox.Clear(); const glm::vec3 xAxis(1.0f, 0.0f, 0.0f); @@ -106,7 +107,7 @@ namespace Lumos void RigidBody3D::RestTest() { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); // Negative threshold disables test, don't bother calculating average or performing test if(m_RestVelocityThresholdSquared <= 0.0f) return; @@ -124,7 +125,7 @@ namespace Lumos void RigidBody3D::DebugDraw(uint64_t flags) const { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); glm::vec4 colour(0.4f, 0.3f, 0.7f, 1.0f); if(flags & PhysicsDebugFlags::AABB) @@ -146,7 +147,7 @@ namespace Lumos void RigidBody3D::SetCollisionShape(CollisionShapeType type) { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); switch(type) { case CollisionShapeType::CollisionCuboid: diff --git a/Lumos/Source/Lumos/Physics/LumosPhysicsEngine/RigidBody3D.h b/Lumos/Source/Lumos/Physics/LumosPhysicsEngine/RigidBody3D.h index af4e191bf..2f454514e 100644 --- a/Lumos/Source/Lumos/Physics/LumosPhysicsEngine/RigidBody3D.h +++ b/Lumos/Source/Lumos/Physics/LumosPhysicsEngine/RigidBody3D.h @@ -225,12 +225,11 @@ namespace Lumos { auto shape = std::unique_ptr(m_CollisionShape.get()); - const int Version = 1; + const int Version = 2; archive(cereal::make_nvp("Version", Version)); - archive(cereal::make_nvp("Position", m_Position), cereal::make_nvp("Orientation", m_Orientation), cereal::make_nvp("LinearVelocity", m_LinearVelocity), cereal::make_nvp("Force", m_Force), cereal::make_nvp("Mass", 1.0f / m_InvMass), cereal::make_nvp("AngularVelocity", m_AngularVelocity), cereal::make_nvp("Torque", m_Torque), cereal::make_nvp("Static", m_Static), cereal::make_nvp("Friction", m_Friction), cereal::make_nvp("Elasticity", m_Elasticity), cereal::make_nvp("CollisionShape", shape), cereal::make_nvp("Trigger", m_Trigger), cereal::make_nvp("AngularFactor", m_AngularFactor)); - + archive(cereal::make_nvp("UUID", (uint64_t)m_UUID)); shape.release(); } @@ -241,12 +240,14 @@ namespace Lumos int Version; archive(cereal::make_nvp("Version", Version)); - archive(cereal::make_nvp("Position", m_Position), cereal::make_nvp("Orientation", m_Orientation), cereal::make_nvp("LinearVelocity", m_LinearVelocity), cereal::make_nvp("Force", m_Force), cereal::make_nvp("Mass", 1.0f / m_InvMass), cereal::make_nvp("AngularVelocity", m_AngularVelocity), cereal::make_nvp("Torque", m_Torque), cereal::make_nvp("Static", m_Static), cereal::make_nvp("Friction", m_Friction), cereal::make_nvp("Elasticity", m_Elasticity), cereal::make_nvp("CollisionShape", shape), cereal::make_nvp("Trigger", m_Trigger), cereal::make_nvp("AngularFactor", m_AngularFactor)); m_CollisionShape = SharedPtr(shape.get()); CollisionShapeUpdated(); shape.release(); + + if(Version > 1) + archive(cereal::make_nvp("UUID", (uint64_t)m_UUID)); } bool GetIsStatic() const { return m_Static; } diff --git a/Lumos/Source/Lumos/Platform/GLFW/GLFWWindow.cpp b/Lumos/Source/Lumos/Platform/GLFW/GLFWWindow.cpp index 062343730..f619c40f1 100644 --- a/Lumos/Source/Lumos/Platform/GLFW/GLFWWindow.cpp +++ b/Lumos/Source/Lumos/Platform/GLFW/GLFWWindow.cpp @@ -184,11 +184,10 @@ namespace Lumos if(glfwRawMouseMotionSupported()) glfwSetInputMode(m_Handle, GLFW_RAW_MOUSE_MOTION, GLFW_TRUE); -#ifdef LUMOS_PLATFORM_WINDOWS - SetIcon("//Textures/icon.png", "//Textures/icon32.png"); -#elif LUMOS_PLATFORM_LINUX - SetIcon("//Textures/icon.png", "//Textures/icon32.png"); -#endif + // #ifndef LUMOS_PLATFORM_MACOS + SetIcon(properties); + // #endif + // glfwSetWindowPos(m_Handle, mode->width / 2 - m_Data.Width / 2, mode->height / 2 - m_Data.Height / 2); glfwSetInputMode(m_Handle, GLFW_STICKY_KEYS, true); @@ -334,47 +333,58 @@ namespace Lumos return true; } - void GLFWWindow::SetIcon(const std::string& file, const std::string& smallIconFilePath) + void GLFWWindow::SetIcon(const WindowDesc& desc) { - uint32_t width, height; - std::vector images; - GLFWimage image; - - uint8_t* pixels = nullptr; - uint8_t* pixelsSmall = nullptr; - if(smallIconFilePath != "") + if(!desc.IconData.empty() && desc.IconData[0].second != nullptr) { - pixelsSmall = Lumos::LoadImageFromFile(smallIconFilePath, &width, &height, nullptr, nullptr, false); - - if(!pixelsSmall) + for(auto& data : desc.IconData) { - LUMOS_LOG_WARN("Failed to load app icon {0}", smallIconFilePath); + GLFWimage image; + + uint8_t* pixels = nullptr; + + image.height = data.first; + image.width = data.first; + image.pixels = static_cast(data.second); + images.push_back(image); } - image.height = height; - image.width = width; - image.pixels = static_cast(pixelsSmall); - images.push_back(image); + glfwSetWindowIcon(m_Handle, int(images.size()), images.data()); } + else + { + for(auto& path : desc.IconPaths) + { + uint32_t width, height; + GLFWimage image; - pixels = Lumos::LoadImageFromFile(file, &width, &height, nullptr, nullptr, true); + uint8_t* pixels = nullptr; - if(!pixels) - { - LUMOS_LOG_WARN("Failed to load app icon {0}", file); - } + if(path != "") + { + pixels = Lumos::LoadImageFromFile(path, &width, &height, nullptr, nullptr, false); - image.height = height; - image.width = width; - image.pixels = static_cast(pixels); - images.push_back(image); + if(!pixels) + { + LUMOS_LOG_WARN("Failed to load app icon {0}", path); + } - glfwSetWindowIcon(m_Handle, int(images.size()), images.data()); + image.height = height; + image.width = width; + image.pixels = static_cast(pixels); + images.push_back(image); + } + } + + glfwSetWindowIcon(m_Handle, int(images.size()), images.data()); - delete[] pixels; - delete[] pixelsSmall; + for(int i = 0; i < (int)images.size(); i++) + { + delete[] images[i].pixels; + } + } } void GLFWWindow::SetWindowTitle(const std::string& title) diff --git a/Lumos/Source/Lumos/Platform/GLFW/GLFWWindow.h b/Lumos/Source/Lumos/Platform/GLFW/GLFWWindow.h index a20c15655..089708621 100644 --- a/Lumos/Source/Lumos/Platform/GLFW/GLFWWindow.h +++ b/Lumos/Source/Lumos/Platform/GLFW/GLFWWindow.h @@ -73,7 +73,7 @@ namespace Lumos m_Data.EventCallback = callback; } - void SetIcon(const std::string& file, const std::string& smallIconFilePath = "") override; + void SetIcon(const WindowDesc& desc) override; static void MakeDefault(); diff --git a/Lumos/Source/Lumos/Platform/Headless/HeadlessWindow.h b/Lumos/Source/Lumos/Platform/Headless/HeadlessWindow.h index 875aa490a..4e1ded97e 100644 --- a/Lumos/Source/Lumos/Platform/Headless/HeadlessWindow.h +++ b/Lumos/Source/Lumos/Platform/Headless/HeadlessWindow.h @@ -55,7 +55,7 @@ namespace Lumos m_Data.EventCallback = callback; } - void SetIcon(const std::string& file, const std::string& smallIconFilePath = "") override; + void SetIcon(const WindowDesc& desc) override; static void MakeDefault(); diff --git a/Lumos/Source/Lumos/Platform/MacOS/MacOSOS.mm b/Lumos/Source/Lumos/Platform/MacOS/MacOSOS.mm index 454241794..9f8dc8f4e 100644 --- a/Lumos/Source/Lumos/Platform/MacOS/MacOSOS.mm +++ b/Lumos/Source/Lumos/Platform/MacOS/MacOSOS.mm @@ -3,6 +3,7 @@ #include "Platform/GLFW/GLFWWindow.h" #include "Core/CoreSystem.h" #include "Core/Application.h" +#include "Core/OS/MemoryManager.h" #include @@ -27,8 +28,18 @@ hours = minutes / 60; minutes = minutes % 60; - LUMOS_LOG_INFO("Battery Info - {0}% , Time Left {1}h : {2}m , State : {3}", percentage, hours, minutes, PowerStateToString(state)); + LUMOS_LOG_INFO("--------------------"); + LUMOS_LOG_INFO(" System Information "); + LUMOS_LOG_INFO("--------------------"); + if(state != PowerState::POWERSTATE_NO_BATTERY) + LUMOS_LOG_INFO("Battery Info - Percentage : {0} , Time Left {1}s , State : {2}", percentage, secondsLeft, PowerStateToString(state)); + else + LUMOS_LOG_INFO("Power - Outlet"); + + auto systemInfo = MemoryManager::Get()->GetSystemInfo(); + systemInfo.Log(); + auto& app = Lumos::Application::Get(); app.Init(); diff --git a/Lumos/Source/Lumos/Platform/OpenGL/GLContext.cpp b/Lumos/Source/Lumos/Platform/OpenGL/GLContext.cpp index cbc570ada..8fc10d1a7 100644 --- a/Lumos/Source/Lumos/Platform/OpenGL/GLContext.cpp +++ b/Lumos/Source/Lumos/Platform/OpenGL/GLContext.cpp @@ -87,13 +87,13 @@ namespace Lumos switch(severity) { case GL_DEBUG_SEVERITY_HIGH: - LUMOS_ASSERT(0, ""); + LUMOS_ASSERT(0); return "High"; case GL_DEBUG_SEVERITY_MEDIUM: - LUMOS_ASSERT(0, ""); + LUMOS_ASSERT(0); return "Medium"; case GL_DEBUG_SEVERITY_LOW: - LUMOS_ASSERT(0, ""); + LUMOS_ASSERT(0); return "Low"; case GL_DEBUG_SEVERITY_NOTIFICATION: return "Notification"; diff --git a/Lumos/Source/Lumos/Platform/Unix/UnixOS.cpp b/Lumos/Source/Lumos/Platform/Unix/UnixOS.cpp index 53df7c60c..c1cb0850e 100644 --- a/Lumos/Source/Lumos/Platform/Unix/UnixOS.cpp +++ b/Lumos/Source/Lumos/Platform/Unix/UnixOS.cpp @@ -4,8 +4,10 @@ #include "Core/CoreSystem.h" #include "Core/OS/MemoryManager.h" #include "Core/Application.h" - +#include +#include #include +#include extern Lumos::Application* Lumos::CreateApplication(); @@ -14,6 +16,14 @@ namespace Lumos void UnixOS::Run() { auto& app = Lumos::Application::Get(); + + LUMOS_LOG_INFO("--------------------"); + LUMOS_LOG_INFO(" System Information "); + LUMOS_LOG_INFO("--------------------"); + + auto systemInfo = MemoryManager::Get()->GetSystemInfo(); + systemInfo.Log(); + app.Init(); app.Run(); app.Release(); @@ -26,7 +36,32 @@ namespace Lumos SystemMemoryInfo MemoryManager::GetSystemInfo() { - return SystemMemoryInfo(); + SystemMemoryInfo result = { 0 }; + result.totalVirtualMemory = 0; // Unix does not have an exact equivalent for total virtual memory. + result.availableVirtualMemory = 0; // Unix does not have an exact equivalent for available virtual memory. + + size_t len; + + // Get total physical memory + int64_t phys_mem; + len = sizeof(phys_mem); + if(sysctlbyname("hw.memsize", &phys_mem, &len, NULL, 0) != 0) + { + return result; + } + result.totalPhysicalMemory = phys_mem; + + // Get available physical memory + int64_t avail_phys_mem; + len = sizeof(avail_phys_mem); + if(sysctlbyname("vm.stats.vm.v_free_count", &avail_phys_mem, &len, NULL, 0) != 0) + { + return result; + } + + result.availablePhysicalMemory = avail_phys_mem * PAGE_SIZE; + + return result; } void UnixOS::Delay(uint32_t usec) @@ -42,19 +77,25 @@ namespace Lumos void UnixOS::OpenFileLocation(const std::filesystem::path& path) { +#ifndef LUMOS_PLATFORM_MOBILE std::string command = "open -R " + path.string(); std::system(command.c_str()); +#endif } void UnixOS::OpenFileExternal(const std::filesystem::path& path) { +#ifndef LUMOS_PLATFORM_MOBILE std::string command = "open " + path.string(); std::system(command.c_str()); +#endif } void UnixOS::OpenURL(const std::string& url) { +#ifndef LUMOS_PLATFORM_MOBILE std::string command = "open " + url; system(command.c_str()); +#endif } } diff --git a/Lumos/Source/Lumos/Platform/Vulkan/VK.h b/Lumos/Source/Lumos/Platform/Vulkan/VK.h index 5b0f5b28a..ff019c806 100644 --- a/Lumos/Source/Lumos/Platform/Vulkan/VK.h +++ b/Lumos/Source/Lumos/Platform/Vulkan/VK.h @@ -5,4 +5,8 @@ #include #else #include -#endif \ No newline at end of file +#endif + +inline PFN_vkCmdBeginDebugUtilsLabelEXT fpCmdBeginDebugUtilsLabelEXT; +inline PFN_vkCmdEndDebugUtilsLabelEXT fpCmdEndDebugUtilsLabelEXT; +inline PFN_vkSetDebugUtilsObjectNameEXT fpSetDebugUtilsObjectNameEXT; diff --git a/Lumos/Source/Lumos/Platform/Vulkan/VKCommandBuffer.cpp b/Lumos/Source/Lumos/Platform/Vulkan/VKCommandBuffer.cpp index 6704db40f..73adcbd15 100644 --- a/Lumos/Source/Lumos/Platform/Vulkan/VKCommandBuffer.cpp +++ b/Lumos/Source/Lumos/Platform/Vulkan/VKCommandBuffer.cpp @@ -39,7 +39,7 @@ namespace Lumos bool VKCommandBuffer::Init(bool primary) { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); m_Primary = primary; m_CommandPool = VKDevice::Get().GetCommandPool()->GetHandle(); @@ -58,7 +58,7 @@ namespace Lumos bool VKCommandBuffer::Init(bool primary, VkCommandPool commandPool) { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); m_Primary = primary; m_CommandPool = commandPool; @@ -79,7 +79,7 @@ namespace Lumos void VKCommandBuffer::Unload() { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); VKUtilities::WaitIdle(); if(m_State == CommandBufferState::Submitted) @@ -92,7 +92,7 @@ namespace Lumos void VKCommandBuffer::BeginRecording() { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); LUMOS_ASSERT(m_Primary, "BeginRecording() called from a secondary command buffer!"); m_State = CommandBufferState::Recording; @@ -103,7 +103,7 @@ namespace Lumos void VKCommandBuffer::BeginRecordingSecondary(RenderPass* renderPass, Framebuffer* framebuffer) { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); LUMOS_ASSERT(!m_Primary, "BeginRecordingSecondary() called from a primary command buffer!"); m_State = CommandBufferState::Recording; @@ -121,7 +121,7 @@ namespace Lumos void VKCommandBuffer::EndRecording() { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); LUMOS_ASSERT(m_State == CommandBufferState::Recording, "CommandBuffer ended before started recording"); if(m_BoundPipeline) @@ -136,7 +136,7 @@ namespace Lumos void VKCommandBuffer::Execute(VkPipelineStageFlags flags, VkSemaphore waitSemaphore, bool waitFence) { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); LUMOS_ASSERT(m_Primary, "Used Execute on secondary command buffer!"); LUMOS_ASSERT(m_State == CommandBufferState::Ended, "CommandBuffer executed before ended recording"); uint32_t waitSemaphoreCount = waitSemaphore ? 1 : 0, signalSemaphoreCount = m_Semaphore ? 1 : 0; @@ -162,7 +162,7 @@ namespace Lumos void VKCommandBuffer::ExecuteSecondary(CommandBuffer* primaryCmdBuffer) { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); LUMOS_ASSERT(!m_Primary, "Used ExecuteSecondary on primary command buffer!"); m_State = CommandBufferState::Submitted; @@ -171,6 +171,7 @@ namespace Lumos void VKCommandBuffer::BindPipeline(Pipeline* pipeline) { + LUMOS_PROFILE_FUNCTION_LOW(); if(pipeline != m_BoundPipeline) { if(m_BoundPipeline) @@ -183,6 +184,7 @@ namespace Lumos void VKCommandBuffer::UnBindPipeline() { + LUMOS_PROFILE_FUNCTION_LOW(); if(m_BoundPipeline) m_BoundPipeline->End(this); m_BoundPipeline = nullptr; @@ -190,7 +192,7 @@ namespace Lumos void VKCommandBuffer::UpdateViewport(uint32_t width, uint32_t height, bool flipViewport) { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); VkViewport viewport = {}; viewport.x = 0.0f; viewport.y = 0.0f; @@ -217,13 +219,13 @@ namespace Lumos void VKCommandBuffer::Reset() { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); VK_CHECK_RESULT(vkResetCommandBuffer(m_CommandBuffer, 0)); } bool VKCommandBuffer::Flush() { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); if(m_State == CommandBufferState::Idle) return true; @@ -237,8 +239,8 @@ namespace Lumos bool VKCommandBuffer::Wait() { - LUMOS_PROFILE_FUNCTION(); - LUMOS_ASSERT(m_State == CommandBufferState::Submitted, ""); + LUMOS_PROFILE_FUNCTION_LOW(); + LUMOS_ASSERT(m_State == CommandBufferState::Submitted); m_Fence->WaitAndReset(); m_State = CommandBufferState::Idle; @@ -248,7 +250,7 @@ namespace Lumos void VKCommandBuffer::Submit() { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); Execute(VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT, nullptr, false); } diff --git a/Lumos/Source/Lumos/Platform/Vulkan/VKContext.cpp b/Lumos/Source/Lumos/Platform/Vulkan/VKContext.cpp index b60effae6..47d0fae09 100644 --- a/Lumos/Source/Lumos/Platform/Vulkan/VKContext.cpp +++ b/Lumos/Source/Lumos/Platform/Vulkan/VKContext.cpp @@ -4,6 +4,7 @@ #include "VKCommandPool.h" #include "VKCommandBuffer.h" #include "VKRenderer.h" +#include "VKUtilities.h" #include "Core/Version.h" #include "Core/StringUtilities.h" @@ -361,6 +362,7 @@ namespace Lumos #ifndef LUMOS_PLATFORM_IOS volkLoadInstance(s_VkInstance); #endif + VKUtilities::Init(); } void VKContext::SetupDebugCallback() diff --git a/Lumos/Source/Lumos/Platform/Vulkan/VKDevice.cpp b/Lumos/Source/Lumos/Platform/Vulkan/VKDevice.cpp index cf7201a77..0d4edc86e 100644 --- a/Lumos/Source/Lumos/Platform/Vulkan/VKDevice.cpp +++ b/Lumos/Source/Lumos/Platform/Vulkan/VKDevice.cpp @@ -105,7 +105,7 @@ namespace Lumos uint32_t queueFamilyCount; vkGetPhysicalDeviceQueueFamilyProperties(m_Handle, &queueFamilyCount, nullptr); - LUMOS_ASSERT(queueFamilyCount > 0, ""); + LUMOS_ASSERT(queueFamilyCount > 0); m_QueueFamilyProperties.resize(queueFamilyCount); vkGetPhysicalDeviceQueueFamilyProperties(m_Handle, &queueFamilyCount, m_QueueFamilyProperties.data()); @@ -313,8 +313,9 @@ namespace Lumos vmaDestroyAllocator(m_Allocator); #endif #if defined(LUMOS_PROFILE) && defined(TRACY_ENABLE) - for(int i = 0; i < 3; i++) + for(int i = 0; i < 4; i++) TracyVkDestroy(m_TracyContext[i]); + TracyVkDestroy(m_PresentTracyContext); #endif vkDestroyDevice(m_Device, VK_NULL_HANDLE); @@ -453,6 +454,7 @@ namespace Lumos void VKDevice::CreateTracyContext() { +#if defined(LUMOS_PROFILE) && defined(TRACY_ENABLE) VkCommandBufferAllocateInfo allocInfo = {}; allocInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO; allocInfo.level = VK_COMMAND_BUFFER_LEVEL_PRIMARY; @@ -462,23 +464,42 @@ namespace Lumos VkCommandBuffer tracyBuffer; vkAllocateCommandBuffers(m_Device, &allocInfo, &tracyBuffer); -#if defined(LUMOS_PROFILE) && defined(TRACY_ENABLE) - m_TracyContext.resize(3); - for(int i = 0; i < 3; i++) + m_TracyContext.resize(4); + for(int i = 0; i < 4; i++) m_TracyContext[i] = TracyVkContext(m_PhysicalDevice->GetHandle(), m_Device, m_GraphicsQueue, tracyBuffer); - // m_TracyContext = TracyVkContextCalibrated(m_PhysicalDevice->GetHandle(), m_Device, m_GraphicsQueue, tracyBuffer, vkGetPhysicalDeviceCalibrateableTimeDomainsEXT, vkGetCalibratedTimestampsEXT); -#endif + m_PresentTracyContext = TracyVkContext(m_PhysicalDevice->GetHandle(), m_Device, m_PresentQueue, tracyBuffer); + + // m_TracyContext = TracyVkContextCalibrated(m_PhysicalDevice->GetHandle(), m_Device, m_GraphicsQueue, tracyBuffer, vkGetPhysicalDeviceCalibrateableTimeDomainsEXT, vkGetCalibratedTimestampsEXT); vkQueueWaitIdle(m_GraphicsQueue); vkFreeCommandBuffers(m_Device, m_CommandPool->GetHandle(), 1, &tracyBuffer); +#endif } #if defined(LUMOS_PROFILE) && defined(TRACY_ENABLE) - tracy::VkCtx* VKDevice::GetTracyContext() + tracy::VkCtx* VKDevice::GetTracyContext(bool present) { - return m_TracyContext[VKRenderer::GetMainSwapChain()->GetCurrentBufferIndex()]; + if(present) + return m_PresentTracyContext; + + return m_TracyContext[VKRenderer::GetMainSwapChain()->GetCurrentBufferIndex() + 1]; } #endif + + void VKGPUMarker::Begin(const char* name) + { + VkCommandBuffer commandBuffer = static_cast(Renderer::GetMainSwapChain()->GetCurrentCommandBuffer())->GetHandle(); + VkDebugUtilsLabelEXT debugLabel {}; + debugLabel.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT; + debugLabel.pLabelName = name; + fpCmdBeginDebugUtilsLabelEXT(commandBuffer, &debugLabel); + } + + void VKGPUMarker::End() + { + VkCommandBuffer commandBuffer = static_cast(Renderer::GetMainSwapChain()->GetCurrentCommandBuffer())->GetHandle(); + fpCmdEndDebugUtilsLabelEXT(commandBuffer); + } } } diff --git a/Lumos/Source/Lumos/Platform/Vulkan/VKDevice.h b/Lumos/Source/Lumos/Platform/Vulkan/VKDevice.h index 7f31b2ecd..c28a6889a 100644 --- a/Lumos/Source/Lumos/Platform/Vulkan/VKDevice.h +++ b/Lumos/Source/Lumos/Platform/Vulkan/VKDevice.h @@ -220,7 +220,7 @@ namespace Lumos } #if defined(LUMOS_PROFILE) && defined(TRACY_ENABLE) - tracy::VkCtx* GetTracyContext(); + tracy::VkCtx* GetTracyContext(bool present = false); #endif #ifdef USE_VMA_ALLOCATOR @@ -264,11 +264,28 @@ namespace Lumos #if defined(LUMOS_PROFILE) && defined(TRACY_ENABLE) std::vector m_TracyContext; + tracy::VkCtx* m_PresentTracyContext; #endif #ifdef USE_VMA_ALLOCATOR VmaAllocator m_Allocator {}; #endif }; + + class VKGPUMarker + { + public: + VKGPUMarker(const char* name) + { + Begin(name); + } + + ~VKGPUMarker() + { + End(); + } + void Begin(const char* name); + void End(); + }; } } diff --git a/Lumos/Source/Lumos/Platform/Vulkan/VKIMGUIRenderer.cpp b/Lumos/Source/Lumos/Platform/Vulkan/VKIMGUIRenderer.cpp index efef19dc6..dde4d6af5 100644 --- a/Lumos/Source/Lumos/Platform/Vulkan/VKIMGUIRenderer.cpp +++ b/Lumos/Source/Lumos/Platform/Vulkan/VKIMGUIRenderer.cpp @@ -126,9 +126,9 @@ namespace Lumos renderPassDesc.clear = m_ClearScreen; renderPassDesc.attachments = textures; renderPassDesc.swapchainTarget = true; - - m_Renderpass = new VKRenderPass(renderPassDesc); - wd->RenderPass = m_Renderpass->GetHandle(); + renderPassDesc.DebugName = "ImGui"; + m_Renderpass = new VKRenderPass(renderPassDesc); + wd->RenderPass = m_Renderpass->GetHandle(); wd->Frames = (ImGui_ImplVulkanH_Frame*)IM_ALLOC(sizeof(ImGui_ImplVulkanH_Frame) * wd->ImageCount); // wd->FrameSemaphores = (ImGui_ImplVulkanH_FrameSemaphores*)IM_ALLOC(sizeof(ImGui_ImplVulkanH_FrameSemaphores) * wd->ImageCount); diff --git a/Lumos/Source/Lumos/Platform/Vulkan/VKPipeline.cpp b/Lumos/Source/Lumos/Platform/Vulkan/VKPipeline.cpp index 120599ba4..74d4f37a9 100644 --- a/Lumos/Source/Lumos/Platform/Vulkan/VKPipeline.cpp +++ b/Lumos/Source/Lumos/Platform/Vulkan/VKPipeline.cpp @@ -22,7 +22,7 @@ namespace Lumos VKPipeline::~VKPipeline() { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); VKContext::DeletionQueue& deletionQueue = VKRenderer::GetCurrentDeletionQueue(); auto pipeline = m_Pipeline; @@ -33,7 +33,7 @@ namespace Lumos bool VKPipeline::Init(const PipelineDesc& pipelineDesc) { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); m_Description = pipelineDesc; m_Shader = m_Description.shader; m_PipelineLayout = m_Shader.As()->GetPipelineLayout(); @@ -251,12 +251,15 @@ namespace Lumos VK_CHECK_RESULT(vkCreateGraphicsPipelines(VKDevice::Get().GetDevice(), VKDevice::Get().GetPipelineCache(), 1, &graphicsPipelineCreateInfo, VK_NULL_HANDLE, &m_Pipeline)); } + if(!pipelineDesc.DebugName.empty()) + VKUtilities::SetDebugUtilsObjectName(VKDevice::Get().GetDevice(), VK_OBJECT_TYPE_PIPELINE, pipelineDesc.DebugName, m_Pipeline); + return true; } void VKPipeline::Bind(CommandBuffer* commandBuffer, uint32_t layer) { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); VKFramebuffer* framebuffer; @@ -299,7 +302,7 @@ namespace Lumos void VKPipeline::CreateFramebuffers() { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); std::vector attachmentTypes; std::vector attachments; @@ -346,6 +349,7 @@ namespace Lumos renderPassDesc.clear = m_Description.clearTargets; renderPassDesc.cubeMapIndex = m_Description.cubeMapIndex; renderPassDesc.mipIndex = m_Description.mipIndex; + renderPassDesc.DebugName = m_Description.DebugName; m_RenderPass = Graphics::RenderPass::Get(renderPassDesc); @@ -413,7 +417,7 @@ namespace Lumos void VKPipeline::ClearRenderTargets(CommandBuffer* commandBuffer) { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); if(m_Description.swapchainTarget) { for(uint32_t i = 0; i < Renderer::GetMainSwapChain()->GetSwapChainBufferCount(); i++) @@ -445,7 +449,7 @@ namespace Lumos void VKPipeline::TransitionAttachments() { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); auto commandBuffer = Renderer::GetMainSwapChain()->GetCurrentCommandBuffer(); if(m_Description.swapchainTarget) diff --git a/Lumos/Source/Lumos/Platform/Vulkan/VKRenderPass.cpp b/Lumos/Source/Lumos/Platform/Vulkan/VKRenderPass.cpp index fad8162e0..f1daebc2c 100644 --- a/Lumos/Source/Lumos/Platform/Vulkan/VKRenderPass.cpp +++ b/Lumos/Source/Lumos/Platform/Vulkan/VKRenderPass.cpp @@ -27,7 +27,7 @@ namespace Lumos VKRenderPass::~VKRenderPass() { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); delete[] m_ClearValue; VKContext::DeletionQueue& deletionQueue = VKRenderer::GetCurrentDeletionQueue(); @@ -39,7 +39,7 @@ namespace Lumos VkAttachmentDescription GetAttachmentDescription(TextureType type, Texture* texture, bool clear = true) { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); VkAttachmentDescription attachment = {}; if(type == TextureType::COLOUR) { @@ -95,7 +95,7 @@ namespace Lumos bool VKRenderPass::Init(const RenderPassDesc& renderPassDesc) { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); std::vector attachments; std::vector colourAttachmentReferences; @@ -103,6 +103,7 @@ namespace Lumos m_DepthOnly = true; m_ClearDepth = false; + m_DebugName = renderPassDesc.DebugName; for(uint32_t i = 0; i < renderPassDesc.attachmentCount; i++) { @@ -166,6 +167,9 @@ namespace Lumos VK_CHECK_RESULT(vkCreateRenderPass(VKDevice::Get().GetDevice(), &renderPassCreateInfo, VK_NULL_HANDLE, &m_RenderPass)); + if(!renderPassDesc.DebugName.empty()) + VKUtilities::SetDebugUtilsObjectName(VKDevice::Get().GetDevice(), VK_OBJECT_TYPE_RENDER_PASS, renderPassDesc.DebugName, m_RenderPass); + m_ClearValue = new VkClearValue[renderPassDesc.attachmentCount]; m_ClearCount = renderPassDesc.attachmentCount; m_SwapchainTarget = renderPassDesc.swapchainTarget; @@ -175,7 +179,7 @@ namespace Lumos VkSubpassContents SubPassContentsToVK(SubPassContents contents) { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); switch(contents) { case INLINE: @@ -189,7 +193,7 @@ namespace Lumos void VKRenderPass::BeginRenderpass(CommandBuffer* commandBuffer, float* clearColour, Framebuffer* frame, SubPassContents contents, uint32_t width, uint32_t height) const { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); if(!m_DepthOnly) { for(int i = 0; i < m_ClearCount; i++) @@ -218,14 +222,27 @@ namespace Lumos rpBegin.clearValueCount = uint32_t(m_ClearCount); rpBegin.pClearValues = m_ClearValue; + if(!m_DebugName.empty()) + { + VkDebugUtilsLabelEXT debugLabel {}; + debugLabel.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT; + debugLabel.pLabelName = m_DebugName.c_str(); + fpCmdBeginDebugUtilsLabelEXT(static_cast(commandBuffer)->GetHandle(), &debugLabel); + } + vkCmdBeginRenderPass(static_cast(commandBuffer)->GetHandle(), &rpBegin, SubPassContentsToVK(contents)); commandBuffer->UpdateViewport(width, height, m_SwapchainTarget); } void VKRenderPass::EndRenderpass(CommandBuffer* commandBuffer) { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); vkCmdEndRenderPass(static_cast(commandBuffer)->GetHandle()); + + if(!m_DebugName.empty()) + { + fpCmdEndDebugUtilsLabelEXT(static_cast(commandBuffer)->GetHandle()); + } } void VKRenderPass::MakeDefault() diff --git a/Lumos/Source/Lumos/Platform/Vulkan/VKRenderPass.h b/Lumos/Source/Lumos/Platform/Vulkan/VKRenderPass.h index ac5cfd8b7..f70226f6e 100644 --- a/Lumos/Source/Lumos/Platform/Vulkan/VKRenderPass.h +++ b/Lumos/Source/Lumos/Platform/Vulkan/VKRenderPass.h @@ -34,6 +34,7 @@ namespace Lumos bool m_DepthOnly; bool m_ClearDepth; bool m_SwapchainTarget; + std::string m_DebugName; }; } } diff --git a/Lumos/Source/Lumos/Platform/Vulkan/VKRenderer.cpp b/Lumos/Source/Lumos/Platform/Vulkan/VKRenderer.cpp index 77e03fb6b..d0f1668a1 100644 --- a/Lumos/Source/Lumos/Platform/Vulkan/VKRenderer.cpp +++ b/Lumos/Source/Lumos/Platform/Vulkan/VKRenderer.cpp @@ -115,7 +115,7 @@ namespace Lumos void VKRenderer::ClearSwapChainImage() const { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); auto m_SwapChain = Application::Get().GetWindow()->GetSwapChain(); for(int i = 0; i < m_SwapChain->GetSwapChainBufferCount(); i++) @@ -138,7 +138,7 @@ namespace Lumos void VKRenderer::OnResize(uint32_t width, uint32_t height) { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); if(width == 0 || height == 0) return; @@ -150,7 +150,7 @@ namespace Lumos void VKRenderer::Begin() { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); s_DeletionQueueIndex++; s_DeletionQueueIndex = s_DeletionQueueIndex % int(s_DeletionQueue.size()); s_DeletionQueue[s_DeletionQueueIndex].Flush(); @@ -161,7 +161,7 @@ namespace Lumos void VKRenderer::PresentInternal() { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); SharedPtr swapChain = Application::Get().GetWindow()->GetSwapChain().As(); swapChain->End(); @@ -413,7 +413,7 @@ file.close(); void VKRenderer::BindDescriptorSetsInternal(Graphics::Pipeline* pipeline, Graphics::CommandBuffer* commandBuffer, uint32_t dynamicOffset, Graphics::DescriptorSet** descriptorSets, uint32_t descriptorCount) { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); uint32_t numDynamicDescriptorSets = 0; uint32_t numDesciptorSets = 0; @@ -437,14 +437,14 @@ file.close(); void VKRenderer::DrawIndexedInternal(CommandBuffer* commandBuffer, DrawType type, uint32_t count, uint32_t start) const { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); Engine::Get().Statistics().NumDrawCalls++; vkCmdDrawIndexed(static_cast(commandBuffer)->GetHandle(), count, 1, 0, 0, 0); } void VKRenderer::DrawInternal(CommandBuffer* commandBuffer, DrawType type, uint32_t count, DataType datayType, void* indices) const { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); Engine::Get().Statistics().NumDrawCalls++; vkCmdDraw(static_cast(commandBuffer)->GetHandle(), count, 1, 0, 0); } @@ -486,6 +486,7 @@ file.close(); void VKRenderer::DrawSplashScreen(Texture* texture) { + LUMOS_PROFILE_FUNCTION(); std::vector attachmentTypes; std::vector attachments; @@ -500,6 +501,7 @@ file.close(); renderPassDesc.attachmentTypes = attachmentTypes.data(); renderPassDesc.attachments = attachments.data(); renderPassDesc.clear = true; + renderPassDesc.DebugName = "Splash Screen Pass"; float clearColour[4] = { 040.0f / 256.0f, 42.0f / 256.0f, 54.0f / 256.0f, 1.0f }; diff --git a/Lumos/Source/Lumos/Platform/Vulkan/VKShader.cpp b/Lumos/Source/Lumos/Platform/Vulkan/VKShader.cpp index 0b559021d..04ffdb4b1 100644 --- a/Lumos/Source/Lumos/Platform/Vulkan/VKShader.cpp +++ b/Lumos/Source/Lumos/Platform/Vulkan/VKShader.cpp @@ -446,7 +446,7 @@ namespace Lumos bool VKShader::Init() { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); m_StageCount = 0; std::map files; @@ -494,6 +494,7 @@ namespace Lumos void VKShader::CreatePipelineLayout() { + LUMOS_PROFILE_FUNCTION_LOW(); std::vector> layouts; for(auto& descriptorLayout : GetDescriptorLayout()) @@ -567,8 +568,24 @@ namespace Lumos VK_CHECK_RESULT(vkCreatePipelineLayout(VKDevice::Get().GetDevice(), &pipelineLayoutCreateInfo, VK_NULL_HANDLE, &m_PipelineLayout)); } + static const char* ShaderStageToString(const VkShaderStageFlagBits stage) + { + switch(stage) + { + case VK_SHADER_STAGE_VERTEX_BIT: + return "vert"; + case VK_SHADER_STAGE_FRAGMENT_BIT: + return "frag"; + case VK_SHADER_STAGE_COMPUTE_BIT: + return "comp"; + } + LUMOS_ASSERT(false); + return "UNKNOWN"; + } + void VKShader::LoadFromData(const uint32_t* source, uint32_t fileSize, ShaderType shaderType, int currentShaderStage) { + LUMOS_PROFILE_FUNCTION_LOW(); VkShaderModuleCreateInfo shaderCreateInfo = {}; shaderCreateInfo.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO; shaderCreateInfo.codeSize = fileSize; @@ -734,6 +751,7 @@ namespace Lumos m_ShaderStages[currentShaderStage].pNext = VK_NULL_HANDLE; VkResult result = vkCreateShaderModule(VKDevice::Get().GetDevice(), &shaderCreateInfo, nullptr, &m_ShaderStages[currentShaderStage].module); + VKUtilities::SetDebugUtilsObjectName(VKDevice::Get().GetDevice(), VK_OBJECT_TYPE_SHADER_MODULE, fmt::format("{}:{}", m_Name, ShaderStageToString(m_ShaderStages[currentShaderStage].stage)), m_ShaderStages[currentShaderStage].module); if(result == VK_SUCCESS) { @@ -745,7 +763,7 @@ namespace Lumos void VKShader::Unload() { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); for(uint32_t i = 0; i < m_StageCount; i++) vkDestroyShaderModule(VKDevice::Get().GetDevice(), m_ShaderStages[i].module, nullptr); @@ -765,7 +783,7 @@ namespace Lumos void VKShader::BindPushConstants(Graphics::CommandBuffer* commandBuffer, Graphics::Pipeline* pipeline) { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); uint32_t index = 0; for(auto& pc : m_PushConstants) { @@ -792,6 +810,7 @@ namespace Lumos void VKShader::ReadShaderFile(const std::vector& lines, std::map* shaders) { + LUMOS_PROFILE_FUNCTION_LOW(); for(uint32_t i = 0; i < lines.size(); i++) { std::string str = std::string(lines[i]); diff --git a/Lumos/Source/Lumos/Platform/Vulkan/VKShader.h b/Lumos/Source/Lumos/Platform/Vulkan/VKShader.h index a49794eba..94cff7cb9 100644 --- a/Lumos/Source/Lumos/Platform/Vulkan/VKShader.h +++ b/Lumos/Source/Lumos/Platform/Vulkan/VKShader.h @@ -60,10 +60,6 @@ namespace Lumos std::vector& GetPushConstants() override { -#ifndef LUMOS_PRODUCTION - if(m_PushConstants.empty()) - LUMOS_LOG_WARN("No push constants found in shader"); -#endif return m_PushConstants; } VkDescriptorSetLayout* GetDescriptorLayout(int id) diff --git a/Lumos/Source/Lumos/Platform/Vulkan/VKSwapChain.cpp b/Lumos/Source/Lumos/Platform/Vulkan/VKSwapChain.cpp index 6edfdeac1..ca47c2f44 100644 --- a/Lumos/Source/Lumos/Platform/Vulkan/VKSwapChain.cpp +++ b/Lumos/Source/Lumos/Platform/Vulkan/VKSwapChain.cpp @@ -236,6 +236,7 @@ namespace Lumos m_Frames[i].MainCommandBuffer = CreateSharedPtr(); m_Frames[i].MainCommandBuffer->Init(true, m_Frames[i].CommandPool->GetHandle()); + VKUtilities::SetDebugUtilsObjectName(VKDevice::Get().GetDevice(), VK_OBJECT_TYPE_COMMAND_BUFFER, fmt::format("Commandbuffer (frame in flight: {})", i), m_Frames[i].MainCommandBuffer->GetHandle()); } } } @@ -333,12 +334,14 @@ namespace Lumos commandBuffer->Reset(); VKRenderer::GetDeletionQueue(m_CurrentBuffer).Flush(); AcquireNextImage(); + commandBuffer->BeginRecording(); } void VKSwapChain::End() { LUMOS_PROFILE_FUNCTION(); + GetCurrentCommandBuffer()->EndRecording(); } @@ -391,7 +394,7 @@ namespace Lumos // Get list of supported surface formats uint32_t formatCount; VK_CHECK_RESULT(vkGetPhysicalDeviceSurfaceFormatsKHR(physicalDevice, m_Surface, &formatCount, NULL)); - LUMOS_ASSERT(formatCount > 0, ""); + LUMOS_ASSERT(formatCount > 0); std::vector surfaceFormats(formatCount); VK_CHECK_RESULT(vkGetPhysicalDeviceSurfaceFormatsKHR(physicalDevice, m_Surface, &formatCount, surfaceFormats.data())); diff --git a/Lumos/Source/Lumos/Platform/Vulkan/VKTexture.cpp b/Lumos/Source/Lumos/Platform/Vulkan/VKTexture.cpp index c9cbb3a09..faf74d34b 100644 --- a/Lumos/Source/Lumos/Platform/Vulkan/VKTexture.cpp +++ b/Lumos/Source/Lumos/Platform/Vulkan/VKTexture.cpp @@ -274,6 +274,8 @@ namespace Lumos delete m_StagingBuffer; m_StagingBuffer = nullptr; + + m_ImageLayout = VK_IMAGE_LAYOUT_UNDEFINED; } void VKTexture2D::Resize(uint32_t width, uint32_t height) @@ -513,7 +515,7 @@ namespace Lumos void VKTexture2D::TransitionImage(VkImageLayout newLayout, VKCommandBuffer* commandBuffer) { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); if(newLayout != m_ImageLayout) VKUtilities::TransitionImageLayout(m_TextureImage, m_VKFormat, m_ImageLayout, newLayout, m_MipLevels, 1, commandBuffer ? commandBuffer->GetHandle() : nullptr); m_ImageLayout = newLayout; diff --git a/Lumos/Source/Lumos/Platform/Vulkan/VKUtilities.cpp b/Lumos/Source/Lumos/Platform/Vulkan/VKUtilities.cpp index e6cb8dd22..525d18f15 100644 --- a/Lumos/Source/Lumos/Platform/Vulkan/VKUtilities.cpp +++ b/Lumos/Source/Lumos/Platform/Vulkan/VKUtilities.cpp @@ -14,6 +14,22 @@ namespace Lumos { namespace Graphics { + void VKUtilities::Init() + { + fpSetDebugUtilsObjectNameEXT = (PFN_vkSetDebugUtilsObjectNameEXT)(vkGetInstanceProcAddr(VKContext::GetVKInstance(), "vkSetDebugUtilsObjectNameEXT")); + if(fpSetDebugUtilsObjectNameEXT == nullptr) + fpSetDebugUtilsObjectNameEXT = [](VkDevice device, const VkDebugUtilsObjectNameInfoEXT* pNameInfo) + { return VK_SUCCESS; }; + + fpCmdBeginDebugUtilsLabelEXT = (PFN_vkCmdBeginDebugUtilsLabelEXT)(vkGetInstanceProcAddr(VKContext::GetVKInstance(), "vkCmdBeginDebugUtilsLabelEXT")); + if(fpCmdBeginDebugUtilsLabelEXT == nullptr) + fpCmdBeginDebugUtilsLabelEXT = [](VkCommandBuffer commandBuffer, const VkDebugUtilsLabelEXT* pLabelInfo) {}; + + fpCmdEndDebugUtilsLabelEXT = (PFN_vkCmdEndDebugUtilsLabelEXT)(vkGetInstanceProcAddr(VKContext::GetVKInstance(), "vkCmdEndDebugUtilsLabelEXT")); + if(fpCmdEndDebugUtilsLabelEXT == nullptr) + fpCmdEndDebugUtilsLabelEXT = [](VkCommandBuffer commandBuffer) {}; + } + uint32_t VKUtilities::FindMemoryType(uint32_t typeFilter, VkMemoryPropertyFlags properties) { VkPhysicalDeviceMemoryProperties memProperties; @@ -841,5 +857,17 @@ namespace Lumos LUMOS_PROFILE_FUNCTION(); vkDeviceWaitIdle(VKDevice::GetHandle()); } + + void VKUtilities::SetDebugUtilsObjectName(const VkDevice device, const VkObjectType objectType, const std::string& name, const void* handle) + { + VkDebugUtilsObjectNameInfoEXT nameInfo; + nameInfo.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT; + nameInfo.objectType = objectType; + nameInfo.pObjectName = name.c_str(); + nameInfo.objectHandle = (uint64_t)handle; + nameInfo.pNext = VK_NULL_HANDLE; + + VK_CHECK_RESULT(fpSetDebugUtilsObjectNameEXT(device, &nameInfo)); + } } } diff --git a/Lumos/Source/Lumos/Platform/Vulkan/VKUtilities.h b/Lumos/Source/Lumos/Platform/Vulkan/VKUtilities.h index e06832266..5b323b244 100644 --- a/Lumos/Source/Lumos/Platform/Vulkan/VKUtilities.h +++ b/Lumos/Source/Lumos/Platform/Vulkan/VKUtilities.h @@ -18,6 +18,7 @@ namespace Lumos { namespace VKUtilities { + void Init(); void CreateBuffer(VkDeviceSize size, VkBufferUsageFlags usage, VkMemoryPropertyFlags properties, VkBuffer& buffer, VkDeviceMemory& bufferMemory, VmaAllocator allocator = nullptr, VmaAllocation allocation = nullptr); @@ -64,6 +65,8 @@ namespace Lumos VkShaderStageFlagBits ShaderTypeToVK(const ShaderType& shaderName); VkPolygonMode PolygonModeToVk(Lumos::Graphics::PolygonMode mode); VkPrimitiveTopology DrawTypeToVk(Lumos::Graphics::DrawType type); + + void SetDebugUtilsObjectName(const VkDevice device, const VkObjectType objectType, const std::string& name, const void* handle); } } } diff --git a/Lumos/Source/Lumos/Platform/Windows/WindowsWindow.cpp b/Lumos/Source/Lumos/Platform/Windows/WindowsWindow.cpp index 3bca444ff..127cc7131 100644 --- a/Lumos/Source/Lumos/Platform/Windows/WindowsWindow.cpp +++ b/Lumos/Source/Lumos/Platform/Windows/WindowsWindow.cpp @@ -246,7 +246,7 @@ namespace Lumos return false; } - SetIcon("/Textures/icon.png", "/Textures/icon32.png"); + SetIcon(properties); ShowWindow(hWnd, SW_SHOW); SetFocus(hWnd); @@ -679,43 +679,43 @@ namespace Lumos } } - void WindowsWindow::SetIcon(const std::string& filePath, const std::string& smallIconFilePath) + void WindowsWindow::SetIcon(const WindowDesc& desc) { - HICON bigIcon = NULL; - HICON smallIcon = NULL; + // HICON bigIcon = NULL; + // HICON smallIcon = NULL; - if(filePath != "") - { - uint32_t width, height; - uint8_t* pixels = Lumos::LoadImageFromFile(filePath, &width, &height, nullptr, nullptr, true); + // if(filePath != "") + // { + // uint32_t width, height; + // uint8_t* pixels = Lumos::LoadImageFromFile(filePath, &width, &height, nullptr, nullptr, true); - bigIcon = createIcon(pixels, int(width), int(height), 0, 0, true); - delete[] pixels; - } + // bigIcon = createIcon(pixels, int(width), int(height), 0, 0, true); + // delete[] pixels; + // } - if(smallIconFilePath != "") - { - uint32_t width, height; - uint8_t* pixels = Lumos::LoadImageFromFile(smallIconFilePath, &width, &height, nullptr, nullptr, true); + // if(smallIconFilePath != "") + // { + // uint32_t width, height; + // uint8_t* pixels = Lumos::LoadImageFromFile(smallIconFilePath, &width, &height, nullptr, nullptr, true); - auto smallIcon = createIcon(pixels, int(width), int(height), 0, 0, true); - delete[] pixels; - } + // auto smallIcon = createIcon(pixels, int(width), int(height), 0, 0, true); + // delete[] pixels; + // } - if(!smallIcon) - smallIcon = bigIcon; + // if(!smallIcon) + // smallIcon = bigIcon; - SendMessage(hWnd, WM_SETICON, ICON_BIG, (LPARAM)bigIcon); - SendMessage(hWnd, WM_SETICON, ICON_SMALL, (LPARAM)smallIcon); + // SendMessage(hWnd, WM_SETICON, ICON_BIG, (LPARAM)bigIcon); + // SendMessage(hWnd, WM_SETICON, ICON_SMALL, (LPARAM)smallIcon); - if(m_BigIcon) - DestroyIcon(m_BigIcon); + // if(m_BigIcon) + // DestroyIcon(m_BigIcon); - if(m_SmallIcon) - DestroyIcon(m_SmallIcon); + // if(m_SmallIcon) + // DestroyIcon(m_SmallIcon); - m_BigIcon = bigIcon; - m_SmallIcon = smallIcon; + // m_BigIcon = bigIcon; + // m_SmallIcon = smallIcon; } void WindowsWindow::MakeDefault() diff --git a/Lumos/Source/Lumos/Platform/Windows/WindowsWindow.h b/Lumos/Source/Lumos/Platform/Windows/WindowsWindow.h index 950dbec8d..b25dc57e2 100644 --- a/Lumos/Source/Lumos/Platform/Windows/WindowsWindow.h +++ b/Lumos/Source/Lumos/Platform/Windows/WindowsWindow.h @@ -26,7 +26,7 @@ namespace Lumos void HideMouse(bool hide) override {}; void SetMousePosition(const glm::vec2& pos) override {}; void UpdateCursorImGui() override; - void SetIcon(const std::string& filePath, const std::string& smallIconFilePath = "") override; + void SetIcon(const WindowDesc& desc) override; bool Init(const WindowDesc& properties); diff --git a/Lumos/Source/Lumos/Platform/iOS/iOSWindow.h b/Lumos/Source/Lumos/Platform/iOS/iOSWindow.h index 50ccd774a..426eb19f1 100644 --- a/Lumos/Source/Lumos/Platform/iOS/iOSWindow.h +++ b/Lumos/Source/Lumos/Platform/iOS/iOSWindow.h @@ -58,7 +58,7 @@ namespace Lumos m_Data.EventCallback = callback; }; - void SetIcon(const std::string& filePath, const std::string& smallIconFilePath) override {}; + void SetIcon(const WindowDesc& desc) override {}; void UpdateCursorImGui() override {}; void OnKeyEvent(Lumos::InputCode::Key key, bool down); diff --git a/Lumos/Source/Lumos/Scene/Component/Components.h b/Lumos/Source/Lumos/Scene/Component/Components.h index 67ad88e8c..40d70f665 100644 --- a/Lumos/Source/Lumos/Scene/Component/Components.h +++ b/Lumos/Source/Lumos/Scene/Component/Components.h @@ -65,4 +65,19 @@ namespace Lumos } } }; + + struct PrefabComponent + { + PrefabComponent(const std::string& path) + { + Path = path; + } + + std::string Path; + template + void serialize(Archive& archive) + { + archive(Path); + } + }; } diff --git a/Lumos/Source/Lumos/Scene/EntityManager.cpp b/Lumos/Source/Lumos/Scene/EntityManager.cpp index 367b69871..f5c2db913 100644 --- a/Lumos/Source/Lumos/Scene/EntityManager.cpp +++ b/Lumos/Source/Lumos/Scene/EntityManager.cpp @@ -25,8 +25,10 @@ namespace Lumos void EntityManager::Clear() { LUMOS_PROFILE_FUNCTION(); - m_Registry.each([&](auto entity) - { m_Registry.destroy(entity); }); + for(auto [entity] : m_Registry.storage().each()) + { + m_Registry.destroy(entity); + } m_Registry.clear(); } diff --git a/Lumos/Source/Lumos/Scene/EntityManager.h b/Lumos/Source/Lumos/Scene/EntityManager.h index a15d6d57e..691361de5 100644 --- a/Lumos/Source/Lumos/Scene/EntityManager.h +++ b/Lumos/Source/Lumos/Scene/EntityManager.h @@ -35,9 +35,15 @@ namespace Lumos iterator begin(); iterator end(); - class iterator : public std::iterator + class iterator { public: + using iterator_category = std::output_iterator_tag; + using value_type = Entity; + using difference_type = std::ptrdiff_t; + using pointer = Entity*; + using reference = Entity&; + explicit iterator(EntityView& view, size_t index = 0) : view(view) , nIndex(index) @@ -48,15 +54,20 @@ namespace Lumos { return view[int(nIndex)]; } + iterator& operator++() { nIndex++; return *this; } + iterator operator++(int) { - return ++(*this); + iterator temp = *this; + ++(*this); + return temp; } + bool operator!=(const iterator& rhs) const { return nIndex != rhs.nIndex; @@ -96,8 +107,12 @@ namespace Lumos // public: // EntityGroup(Scene* scene) // : m_Scene(scene) - // , m_Group(scene->GetRegistry().group()) // { + // // Expand the component types into a tuple + // std::tuple enttGroupTypes = std::make_tuple(entt::type_id()...); + // + // // Create the entt::group using std::apply to expand the tuple + // m_Group = scene->GetRegistry().group(std::apply([](auto&&... args) { return entt::get...>; }, enttGroupTypes)); // } // // Entity operator[](int i) @@ -117,7 +132,7 @@ namespace Lumos // // private: // Scene* m_Scene; - // entt::group m_Group; + // entt::group& m_Group; // }; template diff --git a/Lumos/Source/Lumos/Scene/Scene.cpp b/Lumos/Source/Lumos/Scene/Scene.cpp index bba88311e..4d67d26de 100644 --- a/Lumos/Source/Lumos/Scene/Scene.cpp +++ b/Lumos/Source/Lumos/Scene/Scene.cpp @@ -333,7 +333,8 @@ namespace Lumos #define ALL_COMPONENTSV7 ALL_COMPONENTSV6, AxisConstraintComponent #define ALL_COMPONENTSV8 ALL_COMPONENTSV7, TextComponent -#define ALL_COMPONENTSV9(input) get(input).get(input).get(input).get(input).get(input).get(input).get(input).get(input).get(input).get(input).get(input).get(input).get(input).get(input).get(input).get(input).get(input).get(input).get(input).get(input) +#define ALL_COMPONENTSLISTV8 ALL_COMPONENTSV8 +#define ALL_COMPONENTSENTTV8(input) get(input).get(input).get(input).get(input).get(input).get(input).get(input).get(input).get(input).get(input).get(input).get(input).get(input).get(input).get(input).get(input).get(input).get(input).get(input).get(input) void Scene::Serialise(const std::string& filePath, bool binary) { @@ -354,7 +355,7 @@ namespace Lumos // output finishes flushing its contents when it goes out of scope cereal::BinaryOutputArchive output { file }; output(*this); - entt::snapshot { m_EntityManager->GetRegistry() }.get(output).ALL_COMPONENTSV9(output); + entt::snapshot { m_EntityManager->GetRegistry() }.get(output).ALL_COMPONENTSENTTV8(output); } file.close(); } @@ -367,7 +368,7 @@ namespace Lumos // output finishes flushing its contents when it goes out of scope cereal::JSONOutputArchive output { storage }; output(*this); - entt::snapshot { m_EntityManager->GetRegistry() }.get(output).ALL_COMPONENTSV9(output); + entt::snapshot { m_EntityManager->GetRegistry() }.get(output).ALL_COMPONENTSENTTV8(output); } FileSystem::WriteTextFile(path, storage.str()); } @@ -411,27 +412,32 @@ namespace Lumos else if(m_SceneSerialisationVersion >= 8 && m_SceneSerialisationVersion < 14) entt::basic_snapshot_loader_legacy { m_EntityManager->GetRegistry() }.entities(input).component(input); else if(m_SceneSerialisationVersion >= 14 && m_SceneSerialisationVersion < 21) - entt::basic_snapshot_loader_legacy { m_EntityManager->GetRegistry() }.entities(input).component(input); + entt::basic_snapshot_loader_legacy { m_EntityManager->GetRegistry() }.entities(input).component(input); else if(m_SceneSerialisationVersion >= 21) - entt::snapshot_loader { m_EntityManager->GetRegistry() }.get(input).ALL_COMPONENTSV9(input); + entt::snapshot_loader { m_EntityManager->GetRegistry() }.get(input).ALL_COMPONENTSENTTV8(input); if(m_SceneSerialisationVersion < 6) { - m_EntityManager->GetRegistry().each([&](auto entity) - { m_EntityManager->GetRegistry().emplace(entity, Random64::Rand(0, std::numeric_limits::max())); }); + // m_EntityManager->GetRegistry().each([&](auto entity) + for(auto [entity] : m_EntityManager->GetRegistry().storage().each()) + { + m_EntityManager->GetRegistry().emplace(entity, Random64::Rand(0, std::numeric_limits::max())); + } } if(m_SceneSerialisationVersion < 7) { - m_EntityManager->GetRegistry().each([&](auto entity) - { - Graphics::Model* model; - if(model = m_EntityManager->GetRegistry().try_get(entity)) - { - Graphics::Model* modelCopy = new Graphics::Model(*model); - m_EntityManager->GetRegistry().emplace(entity, SharedPtr(modelCopy)); - m_EntityManager->GetRegistry().remove(entity); - } }); + // m_EntityManager->GetRegistry().each([&](auto entity) + for(auto [entity] : m_EntityManager->GetRegistry().storage().each()) + { + Graphics::Model* model; + if(model = m_EntityManager->GetRegistry().try_get(entity)) + { + Graphics::Model* modelCopy = new Graphics::Model(*model); + m_EntityManager->GetRegistry().emplace(entity, SharedPtr(modelCopy)); + m_EntityManager->GetRegistry().remove(entity); + } + } } } catch(...) @@ -471,27 +477,32 @@ namespace Lumos else if(m_SceneSerialisationVersion >= 8 && m_SceneSerialisationVersion < 14) entt::basic_snapshot_loader_legacy { m_EntityManager->GetRegistry() }.entities(input).component(input); else if(m_SceneSerialisationVersion >= 14 && m_SceneSerialisationVersion < 21) - entt::basic_snapshot_loader_legacy { m_EntityManager->GetRegistry() }.entities(input).component(input); + entt::basic_snapshot_loader_legacy { m_EntityManager->GetRegistry() }.entities(input).component(input); else if(m_SceneSerialisationVersion >= 21) - entt::snapshot_loader { m_EntityManager->GetRegistry() }.get(input).ALL_COMPONENTSV9(input); + entt::snapshot_loader { m_EntityManager->GetRegistry() }.get(input).ALL_COMPONENTSENTTV8(input); if(m_SceneSerialisationVersion < 6) { - m_EntityManager->GetRegistry().each([&](auto entity) - { m_EntityManager->GetRegistry().emplace(entity, Random64::Rand(0, std::numeric_limits::max())); }); + // m_EntityManager->GetRegistry().each([&](auto entity) + for(auto [entity] : m_EntityManager->GetRegistry().storage().each()) + { + m_EntityManager->GetRegistry().emplace(entity, Random64::Rand(0, std::numeric_limits::max())); + } } if(m_SceneSerialisationVersion < 7) { - m_EntityManager->GetRegistry().each([&](auto entity) - { - Graphics::Model* model; - if(model = m_EntityManager->GetRegistry().try_get(entity)) - { - Graphics::Model* modelCopy = new Graphics::Model(*model); - m_EntityManager->GetRegistry().emplace(entity, SharedPtr(modelCopy)); - m_EntityManager->GetRegistry().remove(entity); - } }); + // m_EntityManager->GetRegistry().each([&](auto entity) + for(auto [entity] : m_EntityManager->GetRegistry().storage().each()) + { + Graphics::Model* model; + if(model = m_EntityManager->GetRegistry().try_get(entity)) + { + Graphics::Model* modelCopy = new Graphics::Model(*model); + m_EntityManager->GetRegistry().emplace(entity, SharedPtr(modelCopy)); + m_EntityManager->GetRegistry().remove(entity); + } + } } } catch(...) @@ -556,7 +567,7 @@ namespace Lumos Entity newEntity = m_EntityManager->Create(); - CopyEntity(newEntity.GetHandle(), entity.GetHandle(), m_EntityManager->GetRegistry()); + CopyEntity(newEntity.GetHandle(), entity.GetHandle(), m_EntityManager->GetRegistry()); newEntity.GetComponent().ID = UUID(); auto hierarchyComponent = newEntity.TryGetComponent(); @@ -581,4 +592,121 @@ namespace Lumos m_SceneGraph->DisableOnConstruct(false, m_EntityManager->GetRegistry()); } + + static int PrefabVersion = 2; + + template + static void DeserialiseComponentIfExists(Entity entity, cereal::JSONInputArchive& archive) + { + LUMOS_PROFILE_FUNCTION(); + bool hasComponent; + archive(hasComponent); + if(hasComponent) + archive(entity.GetOrAddComponent()); + } + + template + static void DeserialiseEntity(Entity entity, cereal::JSONInputArchive& archive) + { + (DeserialiseComponentIfExists(entity, archive), ...); + } + + void DeserializeEntityHierarchy(Entity entity, cereal::JSONInputArchive& archive, int version) + { + // Serialize the current entity + if(version == 2) + DeserialiseEntity(entity, archive); + entity.ClearChildren(); + + // Serialize the children recursively + int children; // = entity.GetChildren(); + archive(children); + + for(int i = 0; i < children; i++) + { + auto child = entity.GetScene()->GetEntityManager()->Create(); + DeserializeEntityHierarchy(child, archive, version); + child.SetParent(entity); + } + } + + Entity Scene::InstantiatePrefab(const std::string& path) + { + std::string prefabData = VFS::Get().ReadTextFile(path); + std::stringstream storage(prefabData); + cereal::JSONInputArchive input(storage); + + int version; + int SceneVersion; + input(cereal::make_nvp("Version", version)); + input(cereal::make_nvp("Scene Version", SceneVersion)); + + int cachedSceneVersion = Serialisation::CurrentSceneVersion; + Serialisation::CurrentSceneVersion = SceneVersion; + + Entity entity = m_EntityManager->Create(); + DeserializeEntityHierarchy(entity, input, version); + + std::string relativePath; + if(VFS::Get().AbsoulePathToVFS(path, relativePath)) + entity.AddComponent(relativePath); + else + entity.AddComponent(path); + + Serialisation::CurrentSceneVersion = cachedSceneVersion; + + return entity; + } + + template + static void SerialiseComponentIfExists(Entity entity, cereal::JSONOutputArchive& archive) + { + LUMOS_PROFILE_FUNCTION(); + bool hasComponent = entity.HasComponent(); + archive(hasComponent); + if(hasComponent) + archive(entity.GetComponent()); + } + + template + static void SerialiseEntity(Entity entity, cereal::JSONOutputArchive& archive) + { + (SerialiseComponentIfExists(entity, archive), ...); + } + + void SerializeEntityHierarchy(Entity entity, cereal::JSONOutputArchive& archive) + { + // Serialize the current entity + SerialiseEntity(entity, archive); + + // Serialize the children recursively + auto children = entity.GetChildren(); + archive((int)children.size()); + + for(auto child : children) + { + SerializeEntityHierarchy(child, archive); + } + } + + void Scene::SavePrefab(Entity entity, const std::string& path) + { + std::stringstream storage; + + { + // output finishes flushing its contents when it goes out of scope + cereal::JSONOutputArchive output { storage }; + + output(cereal::make_nvp("Version", PrefabVersion)); + output(cereal::make_nvp("Scene Version", SceneSerialisationVersion)); + + // Serialize a single entity + SerializeEntityHierarchy(entity, output); + } + + FileSystem::WriteTextFile(path, storage.str()); + std::string relativePath; + if(VFS::Get().AbsoulePathToVFS(path, relativePath)) + entity.AddComponent(relativePath); + } } diff --git a/Lumos/Source/Lumos/Scene/Scene.h b/Lumos/Source/Lumos/Scene/Scene.h index 8147ca693..7aa213589 100644 --- a/Lumos/Source/Lumos/Scene/Scene.h +++ b/Lumos/Source/Lumos/Scene/Scene.h @@ -100,6 +100,8 @@ namespace Lumos Entity CreateEntity(); Entity CreateEntity(const std::string& name); Entity GetEntityByUUID(uint64_t id); + Entity InstantiatePrefab(const std::string& path); + void SavePrefab(Entity entity, const std::string& path); EntityManager* GetEntityManager() { return m_EntityManager.get(); } @@ -256,6 +258,7 @@ namespace Lumos { return m_Settings; } + int GetSceneVersion() const { return m_SceneSerialisationVersion; diff --git a/Lumos/Source/Lumos/Scene/SystemManager.h b/Lumos/Source/Lumos/Scene/SystemManager.h index 1122f3994..cf7566d4d 100644 --- a/Lumos/Source/Lumos/Scene/SystemManager.h +++ b/Lumos/Source/Lumos/Scene/SystemManager.h @@ -11,7 +11,7 @@ namespace Lumos { auto typeName = typeid(T).hash_code(); - LUMOS_ASSERT(m_Systems.find(typeName) == m_Systems.end(), "Registering system more than once."); + LUMOS_ASSERT((m_Systems.find(typeName) == m_Systems.end()), "Registering system more than once."); // Create a pointer to the system and return it so it can be used externally SharedPtr system = CreateSharedPtr(std::forward(args)...); diff --git a/Lumos/Source/Lumos/Scripting/Lua/ImGuiLua.cpp b/Lumos/Source/Lumos/Scripting/Lua/ImGuiLua.cpp index 58bb04991..11f245dcc 100644 --- a/Lumos/Source/Lumos/Scripting/Lua/ImGuiLua.cpp +++ b/Lumos/Source/Lumos/Scripting/Lua/ImGuiLua.cpp @@ -843,14 +843,14 @@ namespace Lumos imgui["getFontSize"] = ImGui::GetFontSize; imgui["getFontTexUvWhitePixel"] = ImGui::GetFontTexUvWhitePixel; - imgui["pushItemWidth"] = ImGui::PushItemWidth; - imgui["popItemWidth"] = ImGui::PopItemWidth; - imgui["calcItemWidth"] = ImGui::CalcItemWidth; - imgui["pushTextWrapPos"] = sol::overload(ImGui::PushTextWrapPos, []() - { ImGui::PushTextWrapPos(); }); - imgui["popTextWrapPos"] = ImGui::PopTextWrapPos; - imgui["pushButtonRepeat"] = ImGui::PushButtonRepeat; - imgui["popButtonRepeat"] = ImGui::PopButtonRepeat; + imgui["pushItemWidth"] = ImGui::PushItemWidth; + imgui["popItemWidth"] = ImGui::PopItemWidth; + imgui["calcItemWidth"] = ImGui::CalcItemWidth; + imgui["pushTextWrapPos"] = sol::overload(ImGui::PushTextWrapPos, []() + { ImGui::PushTextWrapPos(); }); + imgui["popTextWrapPos"] = ImGui::PopTextWrapPos; + imgui["pushButtonRepeat"] = ImGui::PushButtonRepeat; + imgui["popButtonRepeat"] = ImGui::PopButtonRepeat; imgui["separator"] = ImGui::Separator; imgui["sameLine"] = sol::overload( diff --git a/Lumos/Source/Lumos/Scripting/Lua/MathsLua.cpp b/Lumos/Source/Lumos/Scripting/Lua/MathsLua.cpp index aab2fa560..27173edc2 100644 --- a/Lumos/Source/Lumos/Scripting/Lua/MathsLua.cpp +++ b/Lumos/Source/Lumos/Scripting/Lua/MathsLua.cpp @@ -24,7 +24,13 @@ namespace Lumos sol::meta_function::division, [](const glm::vec2& a, const glm::vec2& b) { return a / b; }, sol::meta_function::equal_to, [](const glm::vec2& a, const glm::vec2& b) - { return a == b; }); + { return a == b; }, + "Length", [](const glm::vec2& v) + { return glm::length(v); }, + "Distance", [](const glm::vec2& a, const glm::vec2& b) + { return glm::distance(a, b); }, + "Distance2", [](const glm::vec2& a, const glm::vec2& b) + { return glm::distance2(a, b); }); auto mult_overloads = sol::overload( [](const glm::vec3& v1, const glm::vec3& v2) -> glm::vec3 @@ -40,7 +46,6 @@ namespace Lumos "x", &glm::vec3::x, "y", &glm::vec3::y, "z", &glm::vec3::z, - "Length", &glm::vec3::length, sol::meta_function::addition, [](const glm::vec3& a, const glm::vec3& b) { return a + b; }, sol::meta_function::multiplication, mult_overloads, @@ -53,7 +58,13 @@ namespace Lumos sol::meta_function::equal_to, [](const glm::vec3& a, const glm::vec3& b) { return a == b; }, "Normalise", [](glm::vec3& v) - { return glm::normalize(v); }); + { return glm::normalize(v); }, + "Length", [](const glm::vec3& v) + { return glm::length(v); }, + "Distance", [](const glm::vec3& a, const glm::vec3& b) + { return glm::distance(a, b); }, + "Distance2", [](const glm::vec3& a, const glm::vec3& b) + { return glm::distance2(a, b); }); state.new_usertype( "Vector4", @@ -81,7 +92,13 @@ namespace Lumos sol::meta_function::equal_to, [](const glm::vec4& a, const glm::vec4& b) { return a == b; }, "Normalise", [](glm::vec4& v) - { return glm::normalize(v); }); + { return glm::normalize(v); }, + "Length", [](const glm::vec4& v) + { return glm::length(v); }, + "Distance", [](const glm::vec4& a, const glm::vec4& b) + { return glm::distance(a, b); }, + "Distance2", [](const glm::vec4& a, const glm::vec4& b) + { return glm::distance2(a, b); }); state.new_usertype( "Quaternion", diff --git a/Lumos/Source/Lumos/Utilities/AssetManager.cpp b/Lumos/Source/Lumos/Utilities/AssetManager.cpp index 03daa0527..da937d650 100644 --- a/Lumos/Source/Lumos/Utilities/AssetManager.cpp +++ b/Lumos/Source/Lumos/Utilities/AssetManager.cpp @@ -1,4 +1,3 @@ -#pragma once #include "Precompiled.h" #include "AssetManager.h" #include "Core/Application.h" diff --git a/Lumos/Source/Lumos/Utilities/CombineHash.h b/Lumos/Source/Lumos/Utilities/CombineHash.h index 673d4e9ec..6302b4a6d 100644 --- a/Lumos/Source/Lumos/Utilities/CombineHash.h +++ b/Lumos/Source/Lumos/Utilities/CombineHash.h @@ -8,7 +8,7 @@ namespace Lumos template inline void HashCombine(uint64_t& seed, const T& v, Rest... rest) { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); std::hash hasher; seed ^= hasher(v) + 0x9e3779b9 + (seed << 6) + (seed >> 2); HashCombine(seed, rest...);