Removing debug code (put in #if 0 for now)

Added a very simple camera system.
This commit is contained in:
2026-08-05 19:12:34 -04:00
parent f122533f92
commit 6c7b7c0124
9 changed files with 104 additions and 5 deletions
+21 -3
View File
@@ -44,6 +44,8 @@
#endif
static bool ShowMemoryDebugger = false;
#if 0
static bool animateCubes = true;
static bool animateLights = true;
static bool animateCamera = true;
@@ -70,6 +72,7 @@ static float globalAmbientIntensity = 0.2f;
static float blueLightRadius = 15.0f;
static float blueLightIntensity = 8.0f;
static float blueLightColor[3] = { 0.2f, 0.2f, 1.0f };
#endif
// TODO : Replace with message box from framework + call main and not winmain + subsystem
// TODO : Think how to do the draw pipeline.
@@ -96,8 +99,11 @@ namespace
const char* GameFunctionTable[] = { "GameShutdown", "GameUpdate" };
#if 0
LightID RedLightID = 0;
LightID BlueLightID = 0;
#endif
} // namespace
void JulietApplication::Init(NonNullPtr<Arena>)
@@ -137,6 +143,7 @@ void JulietApplication::Init(NonNullPtr<Arena>)
Running = false;
}
#if 0
constexpr int kGridSize = 10;
constexpr float kSpacing = 2.5f;
constexpr float kOffset = (kGridSize - 1) * kSpacing * 0.5f;
@@ -169,6 +176,7 @@ void JulietApplication::Init(NonNullPtr<Arena>)
blueLight.Color = { blueLightColor[0], blueLightColor[1], blueLightColor[2] };
blueLight.Intensity = blueLightIntensity;
BlueLightID = AddPointLight(blueLight);
#endif
}
GameCode.Functions = reinterpret_cast<void**>(&Game);
@@ -251,7 +259,10 @@ void JulietApplication::Update()
bool reloadShaders = false;
static bool reloadShadersDebounce = false;
#if 0
static bool f1Debounce = false;
#endif
SystemEvent evt;
while (GetEvent(evt))
@@ -277,6 +288,7 @@ void JulietApplication::Update()
}
}
#if 0
static bool firstFreeFrame = false;
if (IsKeyDown(ScanCode::F1))
@@ -478,13 +490,14 @@ void JulietApplication::Update()
SetMeshTransform(cube, MatrixTranslation(x, y, z) * rotation * scale);
}
}
DebugDisplay_DrawSphere(blueLightPos, 0.5f, { 0.0f, 0.0f, 1.0f, 1.0f }, true);
DebugDisplay_DrawSphere(redLightPos, 0.5f, { 1.0f, 0.0f, 0.0f, 1.0f }, true);
#endif
DebugDisplay_DrawLine({ 0.0f, 0.0f, 0.0f }, { 1.0f, 0.0f, 0.0f }, { 1.0f, 0.0f, 0.0f, 1.0f }, false);
DebugDisplay_DrawLine({ 0.0f, 0.0f, 0.0f }, { 0.0f, 1.0f, 0.0f }, { 0.0f, 1.0f, 0.0f, 1.0f }, true);
DebugDisplay_DrawLine({ 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 1.0f }, { 0.0f, 0.0f, 1.0f, 1.0f }, true);
DebugDisplay_DrawSphere({ 0.0f, 0.0f, 0.0f }, 0.5f, { 1.0f, 1.0f, 0.0f, 1.0f }, true);
DebugDisplay_DrawSphere(blueLightPos, 0.5f, { 0.0f, 0.0f, 1.0f, 1.0f }, true);
DebugDisplay_DrawSphere(redLightPos, 0.5f, { 1.0f, 0.0f, 0.0f, 1.0f }, true);
Game.Update(&Data, 0.0f);
@@ -540,9 +553,11 @@ void JulietApplication::OnPreRender(CommandList* /*cmd*/) {}
void JulietApplication::OnRender(RenderPass* pass, CommandList* cmd)
{
Camera cam = {};
PushData pushData = {};
pushData.ViewProjection = Camera_GetViewProjectionMatrix(GetDebugCamera());
pushData.ViewProjection = Camera_GetViewProjectionMatrix(cam);
#if 0
if (enableGlobalLight)
{
pushData.GlobalLightDirection = Normalize({ globalLightDir[0], globalLightDir[1], globalLightDir[2] });
@@ -550,6 +565,7 @@ void JulietApplication::OnRender(RenderPass* pass, CommandList* cmd)
pushData.GlobalAmbientIntensity = globalAmbientIntensity;
}
else
#endif
{
pushData.GlobalLightDirection = { 0.0f, -1.0f, 0.0f };
pushData.GlobalLightColor = { 0.0f, 0.0f, 0.0f };
@@ -580,6 +596,7 @@ DepthStencilTargetInfo* JulietApplication::GetDepthTargetInfo()
return &info;
}
#if 0
Camera JulietApplication::GetDebugCamera()
{
if (freeCameraMode)
@@ -636,6 +653,7 @@ Camera JulietApplication::GetDebugCamera()
return cam;
}
#endif
bool JulietApplication::IsRunning()
{
+3
View File
@@ -31,7 +31,10 @@ class JulietApplication : public Juliet::IApplication
void OnRender(Juliet::RenderPass* pass, Juliet::CommandList* cmd) override;
Juliet::ColorTargetInfo GetColorTargetInfo(Juliet::Texture* swapchainTexture) override;
Juliet::DepthStencilTargetInfo* GetDepthTargetInfo() override;
#if 0
Juliet::Camera GetDebugCamera() override;
#endif
public:
void SetAutoCloseFrameCount(int count) { AutoCloseFrameCount = count; }