Fixing debug display with depth test enabled
This commit is contained in:
@@ -6,7 +6,6 @@
|
|||||||
#include <Core/HAL/Mouse/Mouse.h>
|
#include <Core/HAL/Mouse/Mouse.h>
|
||||||
#include <Graphics/Camera.h>
|
#include <Graphics/Camera.h>
|
||||||
#include <imgui.h>
|
#include <imgui.h>
|
||||||
#include <math.h>
|
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
@@ -14,11 +13,11 @@ namespace
|
|||||||
bool gIsDebugCameraActive = false;
|
bool gIsDebugCameraActive = false;
|
||||||
index_t gPreviousCameraIndex = 0;
|
index_t gPreviousCameraIndex = 0;
|
||||||
|
|
||||||
float gPitch = 0.0f;
|
float gPitch = 0.0f;
|
||||||
float gYaw = 0.0f;
|
float gYaw = 0.0f;
|
||||||
bool gFirstUpdate = true;
|
bool gFirstUpdate = true;
|
||||||
bool gIsFpsModeActive = false;
|
bool gIsFpsModeActive = false;
|
||||||
bool gWasRightMouseButtonDown = false;
|
bool gWasRightMouseButtonDown = false;
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
void ActivateDebugController()
|
void ActivateDebugController()
|
||||||
@@ -63,9 +62,9 @@ void UpdateDebugController(float dt)
|
|||||||
gFirstUpdate = false;
|
gFirstUpdate = false;
|
||||||
|
|
||||||
Juliet::Vector3 forward;
|
Juliet::Vector3 forward;
|
||||||
forward.x = cosf(gPitch) * cosf(gYaw);
|
forward.x = cosf(gPitch) * cosf(gYaw);
|
||||||
forward.y = cosf(gPitch) * sinf(gYaw);
|
forward.y = cosf(gPitch) * sinf(gYaw);
|
||||||
forward.z = sinf(gPitch);
|
forward.z = sinf(gPitch);
|
||||||
Juliet::Vector3 right = Juliet::Normalize(Juliet::Cross(Juliet::Vector3{ 0.0f, 0.0f, 1.0f }, forward));
|
Juliet::Vector3 right = Juliet::Normalize(Juliet::Cross(Juliet::Vector3{ 0.0f, 0.0f, 1.0f }, forward));
|
||||||
currentCam->Target = currentCam->Position + forward;
|
currentCam->Target = currentCam->Position + forward;
|
||||||
currentCam->Up = Juliet::Cross(forward, right);
|
currentCam->Up = Juliet::Cross(forward, right);
|
||||||
@@ -89,14 +88,8 @@ void UpdateDebugController(float dt)
|
|||||||
gYaw += mouseDelta.X * sensitivity;
|
gYaw += mouseDelta.X * sensitivity;
|
||||||
gPitch -= mouseDelta.Y * sensitivity;
|
gPitch -= mouseDelta.Y * sensitivity;
|
||||||
|
|
||||||
if (gPitch > 1.5f)
|
gPitch = std::min(gPitch, 1.5f);
|
||||||
{
|
gPitch = std::max(gPitch, -1.5f);
|
||||||
gPitch = 1.5f;
|
|
||||||
}
|
|
||||||
if (gPitch < -1.5f)
|
|
||||||
{
|
|
||||||
gPitch = -1.5f;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Juliet::IsKeyDown(Juliet::ScanCode::Q))
|
if (Juliet::IsKeyDown(Juliet::ScanCode::Q))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -300,6 +300,8 @@ namespace Juliet
|
|||||||
// Render depth-tested primitives (vertices at offset 0 in buffer)
|
// Render depth-tested primitives (vertices at offset 0 in buffer)
|
||||||
if (g_DebugState.DepthTestedVertexCount > 0 && g_DebugState.DepthTestedPipeline && g_DebugState.VertexBuffer)
|
if (g_DebugState.DepthTestedVertexCount > 0 && g_DebugState.DepthTestedPipeline && g_DebugState.VertexBuffer)
|
||||||
{
|
{
|
||||||
|
BindGraphicsPipeline(renderPass, g_DebugState.DepthTestedPipeline);
|
||||||
|
|
||||||
// Pack VP matrix + buffer index into push constants
|
// Pack VP matrix + buffer index into push constants
|
||||||
PushData pushData = {};
|
PushData pushData = {};
|
||||||
pushData.ViewProjection = Camera_GetViewProjectionMatrix(camera);
|
pushData.ViewProjection = Camera_GetViewProjectionMatrix(camera);
|
||||||
|
|||||||
Reference in New Issue
Block a user