Added draw collision setting

This commit is contained in:
Antoine Pilote
2023-07-15 23:05:33 -04:00
parent a63b2fc6b2
commit eef733aece
2 changed files with 24 additions and 3 deletions

View File

@@ -1,3 +1,5 @@
#include <dependencies/GLEW/include/GL/glew.h>
#include <Engine.h>
#include <src/Core/Input.h>
@@ -28,6 +30,9 @@
#include "src/Windows/FileSystemUI.h"
#include <src/Core/Maths.h>
#include <src/Rendering/SceneRenderer.h>
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();

View File

@@ -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; }
};
}