diff --git a/Editor/Editor.cpp b/Editor/Editor.cpp index db9a8176..8f12d1d0 100644 --- a/Editor/Editor.cpp +++ b/Editor/Editor.cpp @@ -1,3 +1,5 @@ +#include + #include #include @@ -28,6 +30,9 @@ #include "src/Windows/FileSystemUI.h" #include +#include + + const std::string WindowTitle = "Nuake Editor"; @@ -184,9 +189,24 @@ int main(int argc, char* argv[]) camera = currentScene->m_EditorCamera; } - if (currentScene && !Nuake::Engine::IsPlayMode() && editor.ShouldDrawAxis()) + if (currentScene && !Nuake::Engine::IsPlayMode()) { - gizmoDrawer.DrawGizmos(currentScene); + auto& gBuffer = currentScene->mSceneRenderer->GetGBuffer(); + auto& depthTexture = gBuffer.GetTexture(GL_DEPTH_ATTACHMENT); + + float nearZ = 0.1f; + float farZ = 1000.0f; + gizmoDrawer.GetLineShader().SetUniformTex("u_Depth", depthTexture.get(), 3); + gizmoDrawer.GetLineShader().SetUniformVec2("u_Resolution", depthTexture->GetSize()); + if (editor.ShouldDrawAxis()) + { + gizmoDrawer.DrawAxis(currentScene); + } + + if (editor.ShouldDrawCollision()) + { + gizmoDrawer.DrawGizmos(currentScene); + } } } sceneFramebuffer->Unbind(); diff --git a/Editor/src/Windows/EditorInterface.h b/Editor/src/Windows/EditorInterface.h index 8a50f5c3..57f5ac94 100644 --- a/Editor/src/Windows/EditorInterface.h +++ b/Editor/src/Windows/EditorInterface.h @@ -23,7 +23,7 @@ namespace Nuake bool m_DrawGrid = false; bool m_DrawAxis = true; bool m_ShowImGuiDemo = false; - bool m_DebugCollisions = false; + bool m_DebugCollisions = true; bool m_ShowOverlay = true; bool m_IsHoveringViewport = false; Vector2 m_ViewportPos = {0, 0}; @@ -59,5 +59,6 @@ namespace Nuake void Overlay(); bool ShouldDrawAxis() const { return m_DrawAxis; } + bool ShouldDrawCollision() const { return m_DebugCollisions; } }; }