Skip to content

Commit

Permalink
update tracy + editor improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
jmorton06 committed Oct 28, 2023
1 parent 0b9af22 commit 5ddb16b
Show file tree
Hide file tree
Showing 510 changed files with 253,343 additions and 203,120 deletions.
19 changes: 16 additions & 3 deletions Editor/Source/ApplicationInfoPanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <Lumos/Core/OS/Window.h>
#include <Lumos/Graphics/Renderers/RenderPasses.h>
#include <Lumos/ImGui/ImGuiUtilities.h>
#include <Lumos/Utilities/StringUtilities.h>
#include <imgui/imgui.h>
#include <imgui/Plugins/implot/implot.h>

Expand Down Expand Up @@ -128,15 +129,27 @@ namespace Lumos
auto editor = m_Editor;
Application::Get().QueueEvent([VSync, editor]
{
Application::Get().GetWindow()->SetVSync(VSync);
Application::Get().GetWindow()->GetSwapChain()->SetVSync(VSync);
Graphics::Renderer::GetRenderer()->OnResize(Application::Get().GetWindow()->GetWidth(), Application::Get().GetWindow()->GetHeight()); });
Application::Get().GetWindow()->SetVSync(VSync);
Application::Get().GetWindow()->GetSwapChain()->SetVSync(VSync);
Graphics::Renderer::GetRenderer()->OnResize(Application::Get().GetWindow()->GetWidth(), Application::Get().GetWindow()->GetHeight()); });
}
ImGui::Columns(1);
ImGui::Text("FPS : %5.2i", Engine::Get().Statistics().FramesPerSecond);
ImGui::Text("UPS : %5.2i", Engine::Get().Statistics().UpdatesPerSecond);
ImGui::Text("Frame Time : %5.2f ms", Engine::Get().Statistics().FrameTime);
ImGui::Text("Arena Count : %i", GetArenaCount());

uint64_t totalAllocated = 0;
for(int i = 0; i < GetArenaCount(); i++)
{
auto arena = GetArena(i);
totalAllocated += arena->Size;
float percentageFull = (float)arena->Position / (float)arena->Size;
ImGui::ProgressBar(((float)arena->Position - (float)arena->Size) / (float)arena->Size);
Lumos::ImGuiUtilities::Tooltip((Lumos::StringUtilities::BytesToString(arena->Position) + " / " + Lumos::StringUtilities::BytesToString(arena->Size)).c_str());
}

ImGui::Text("Total %s", Lumos::StringUtilities::BytesToString(totalAllocated).c_str());
ImGui::NewLine();
ImGui::Text("Scene : %s", Application::Get().GetSceneManager()->GetCurrentScene()->GetSceneName().c_str());
ImGui::TreePop();
Expand Down
65 changes: 2 additions & 63 deletions Editor/Source/Editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
#include <Lumos/Graphics/Renderers/DebugRenderer.h>
#include <Lumos/Graphics/Model.h>
#include <Lumos/Graphics/Environment.h>
#include <Lumos/Scene/EntityFactory.h>
#include <Lumos/ImGui/IconsMaterialDesignIcons.h>
#include <Lumos/Embedded/EmbedAsset.h>
#include <Lumos/Scene/Component/ModelComponent.h>
Expand Down Expand Up @@ -438,7 +437,7 @@ namespace Lumos
ImVec2 pos = tab.Window->Pos;
pos.x = pos.x + tab.Offset + ImGui::GetStyle().FramePadding.x;
pos.y = pos.y + ImGui::GetStyle().ItemSpacing.y;
ImRect bb(pos, { pos.x + tab.ContentWidth, pos.y });
ImRect bb(pos, { pos.x + tab.Width, pos.y });

tab.Window->DrawList->AddLine(bb.Min, bb.Max, (!tab_bar_focused) ? ImGui::GetColorU32(ImGuiCol_SliderGrabActive) : ImGui::GetColorU32(ImGuiCol_Text), 2.0f);
}
Expand Down Expand Up @@ -724,65 +723,6 @@ namespace Lumos
ImGui::EndMenu();
}

if(ImGui::BeginMenu("Entity"))
{
auto scene = Application::Get().GetSceneManager()->GetCurrentScene();

if(ImGui::MenuItem("CreateEmpty"))
{
scene->CreateEntity();
}

if(ImGui::MenuItem("Cube"))
{
auto entity = scene->CreateEntity("Cube");
entity.AddComponent<Graphics::ModelComponent>(Graphics::PrimitiveType::Cube);
}

if(ImGui::MenuItem("Sphere"))
{
auto entity = scene->CreateEntity("Sphere");
entity.AddComponent<Graphics::ModelComponent>(Graphics::PrimitiveType::Sphere);
}

if(ImGui::MenuItem("Pyramid"))
{
auto entity = scene->CreateEntity("Pyramid");
entity.AddComponent<Graphics::ModelComponent>(Graphics::PrimitiveType::Pyramid);
}

if(ImGui::MenuItem("Plane"))
{
auto entity = scene->CreateEntity("Plane");
entity.AddComponent<Graphics::ModelComponent>(Graphics::PrimitiveType::Plane);
}

if(ImGui::MenuItem("Cylinder"))
{
auto entity = scene->CreateEntity("Cylinder");
entity.AddComponent<Graphics::ModelComponent>(Graphics::PrimitiveType::Cylinder);
}

if(ImGui::MenuItem("Capsule"))
{
auto entity = scene->CreateEntity("Capsule");
entity.AddComponent<Graphics::ModelComponent>(Graphics::PrimitiveType::Capsule);
}

if(ImGui::MenuItem("Terrain"))
{
auto entity = scene->CreateEntity("Terrain");
entity.AddComponent<Graphics::ModelComponent>(Graphics::PrimitiveType::Terrain);
}

if(ImGui::MenuItem("Light Cube"))
{
EntityFactory::AddLightCube(Application::Get().GetSceneManager()->GetCurrentScene(), glm::vec3(0.0f), glm::vec3(0.0f));
}

ImGui::EndMenu();
}

if(ImGui::BeginMenu("Graphics"))
{
if(ImGui::MenuItem("Compile Shaders"))
Expand All @@ -792,8 +732,7 @@ namespace Lumos
if(ImGui::MenuItem("Embed Shaders"))
{
std::string coreDataPath;
FileSystem::Get().ResolvePhysicalPath("//CoreShaders", coreDataPath, true);
auto shaderPath = std::filesystem::path(coreDataPath + "/CompiledSPV/");
auto shaderPath = std::filesystem::path(m_ProjectSettings.m_EngineAssetPath + "Shaders/CompiledSPV/");
int shaderCount = 0;
if(std::filesystem::is_directory(shaderPath))
{
Expand Down
6 changes: 3 additions & 3 deletions Editor/Source/EditorSettingsPanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,19 +61,19 @@ namespace Lumos
// Call this to fix alignment with columns
ImGui::AlignTextToFramePadding();

if(Lumos::ImGuiUtilities::PorpertyTransform("Position", position, itemWidth))
if(Lumos::ImGuiUtilities::PropertyTransform("Position", position, itemWidth))
transform.SetLocalPosition(position);

ImGui::SameLine();
if(Lumos::ImGuiUtilities::PorpertyTransform("Rotation", rotation, itemWidth))
if(Lumos::ImGuiUtilities::PropertyTransform("Rotation", rotation, itemWidth))
{
float pitch = Lumos::Maths::Min(rotation.x, 89.9f);
pitch = Lumos::Maths::Max(pitch, -89.9f);
transform.SetLocalOrientation(glm::quat(glm::radians(glm::vec3(pitch, rotation.y, rotation.z))));
}

ImGui::SameLine();
if(Lumos::ImGuiUtilities::PorpertyTransform("Scale", scale, itemWidth))
if(Lumos::ImGuiUtilities::PropertyTransform("Scale", scale, itemWidth))
{
transform.SetLocalScale(scale);
}
Expand Down
2 changes: 1 addition & 1 deletion Editor/Source/FileBrowserPanel.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "FileBrowserPanel.h"
#include "Editor.h"
#include <Lumos/Core/StringUtilities.h>
#include <Lumos/Utilities/StringUtilities.h>
#include <Lumos/Core/OS/FileSystem.h>
#include <Lumos/ImGui/IconsMaterialDesignIcons.h>
#include <imgui/imgui.h>
Expand Down
2 changes: 1 addition & 1 deletion Editor/Source/GameViewPanel.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <Lumos/Maths/Frustum.h>
#include <Lumos/Maths/Transform.h>
#include <Lumos/Graphics/Camera/Camera.h>
#include <Lumos/Core/StringUtilities.h>
#include <Lumos/Utilities/StringUtilities.h>
#include <Lumos/ImGui/ImGuiUtilities.h>
#include <Lumos/Graphics/Renderers/RenderPasses.h>
#include <imgui/imgui.h>
Expand Down
Loading

0 comments on commit 5ddb16b

Please sign in to comment.