Removing named namespace from code base.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
#include <Controller/DebugCameraController.h>
|
||||
#include <Controller/DebugCameraController.h>
|
||||
|
||||
#include <Controller/ControllerUtils.h>
|
||||
#include <Core/Common/CoreUtils.h>
|
||||
@@ -24,10 +24,10 @@ void ActivateDebugController()
|
||||
{
|
||||
Assert(gIsDebugCameraActive == false);
|
||||
|
||||
Juliet::Camera* currentCam = Juliet::GetCurrentCamera();
|
||||
Camera* currentCam = GetCurrentCamera();
|
||||
gPreviousCameraIndex = currentCam->Index;
|
||||
|
||||
Juliet::SetCurrentCamera(kDebugCamera);
|
||||
SetCurrentCamera(kDebugCamera);
|
||||
|
||||
gIsDebugCameraActive = true;
|
||||
gFirstUpdate = true;
|
||||
@@ -41,7 +41,7 @@ void DeactivateDebugController()
|
||||
|
||||
gIsDebugCameraActive = false;
|
||||
|
||||
Juliet::SetCurrentCamera(gPreviousCameraIndex);
|
||||
SetCurrentCamera(gPreviousCameraIndex);
|
||||
}
|
||||
|
||||
bool IsDebugControllerActive()
|
||||
@@ -51,26 +51,26 @@ bool IsDebugControllerActive()
|
||||
|
||||
void UpdateDebugController(float dt)
|
||||
{
|
||||
Juliet::Camera* currentCam = Juliet::GetCurrentCamera();
|
||||
Camera* currentCam = GetCurrentCamera();
|
||||
|
||||
if (gFirstUpdate)
|
||||
{
|
||||
Juliet::Vector3 dir = Juliet::Vector3{ 0.0f, 0.0f, 0.0f } - currentCam->Position;
|
||||
dir = Juliet::Normalize(dir);
|
||||
Vector3 dir = Vector3{ 0.0f, 0.0f, 0.0f } - currentCam->Position;
|
||||
dir = Normalize(dir);
|
||||
gPitch = asinf(dir.z);
|
||||
gYaw = atan2f(dir.y, dir.x);
|
||||
gFirstUpdate = false;
|
||||
|
||||
Juliet::Vector3 forward;
|
||||
Vector3 forward;
|
||||
forward.x = cosf(gPitch) * cosf(gYaw);
|
||||
forward.y = cosf(gPitch) * sinf(gYaw);
|
||||
forward.z = sinf(gPitch);
|
||||
Juliet::Vector3 right = Juliet::Normalize(Juliet::Cross(Juliet::Vector3{ 0.0f, 0.0f, 1.0f }, forward));
|
||||
Vector3 right = Normalize(Cross(Vector3{ 0.0f, 0.0f, 1.0f }, forward));
|
||||
currentCam->Target = currentCam->Position + forward;
|
||||
currentCam->Up = Juliet::Cross(forward, right);
|
||||
currentCam->Up = Cross(forward, right);
|
||||
}
|
||||
|
||||
bool isRightMouseButtonDown = Juliet::IsMouseButtonDown(Juliet::MouseButton::Right);
|
||||
bool isRightMouseButtonDown = IsMouseButtonDown(MouseButton::Right);
|
||||
if (isRightMouseButtonDown && !gWasRightMouseButtonDown)
|
||||
{
|
||||
gIsFpsModeActive = !gIsFpsModeActive;
|
||||
@@ -82,7 +82,7 @@ void UpdateDebugController(float dt)
|
||||
return;
|
||||
}
|
||||
|
||||
Juliet::MousePosition mouseDelta = Juliet::GetMouseDelta();
|
||||
MousePosition mouseDelta = GetMouseDelta();
|
||||
|
||||
float sensitivity = 0.005f;
|
||||
gYaw += mouseDelta.X * sensitivity;
|
||||
@@ -91,52 +91,52 @@ void UpdateDebugController(float dt)
|
||||
gPitch = std::min(gPitch, 1.5f);
|
||||
gPitch = std::max(gPitch, -1.5f);
|
||||
|
||||
if (Juliet::IsKeyDown(Juliet::ScanCode::Q))
|
||||
if (IsKeyDown(ScanCode::Q))
|
||||
{
|
||||
gYaw -= 2.0f * dt;
|
||||
}
|
||||
if (Juliet::IsKeyDown(Juliet::ScanCode::E))
|
||||
if (IsKeyDown(ScanCode::E))
|
||||
{
|
||||
gYaw += 2.0f * dt;
|
||||
}
|
||||
|
||||
Juliet::Vector3 forward;
|
||||
Vector3 forward;
|
||||
forward.x = cosf(gPitch) * cosf(gYaw);
|
||||
forward.y = cosf(gPitch) * sinf(gYaw);
|
||||
forward.z = sinf(gPitch);
|
||||
|
||||
Juliet::Vector3 right = Juliet::Normalize(Juliet::Cross(Juliet::Vector3{ 0.0f, 0.0f, 1.0f }, forward));
|
||||
Juliet::Vector3 defaultUp = Juliet::Cross(forward, right);
|
||||
Vector3 right = Normalize(Cross(Vector3{ 0.0f, 0.0f, 1.0f }, forward));
|
||||
Vector3 defaultUp = Cross(forward, right);
|
||||
|
||||
static const float kMovementPerFrame = 10.f; // 10m/s
|
||||
|
||||
float speedPerFrame = kMovementPerFrame;
|
||||
if (Juliet::IsKeyDown(Juliet::ScanCode::LeftShift))
|
||||
if (IsKeyDown(ScanCode::LeftShift))
|
||||
{
|
||||
speedPerFrame *= 10.f; // 100m/s
|
||||
}
|
||||
|
||||
if (Juliet::IsKeyDown(Juliet::ScanCode::W))
|
||||
if (IsKeyDown(ScanCode::W))
|
||||
{
|
||||
currentCam->Position = currentCam->Position + forward * (speedPerFrame * dt);
|
||||
}
|
||||
if (Juliet::IsKeyDown(Juliet::ScanCode::S))
|
||||
if (IsKeyDown(ScanCode::S))
|
||||
{
|
||||
currentCam->Position = currentCam->Position - forward * (speedPerFrame * dt);
|
||||
}
|
||||
if (Juliet::IsKeyDown(Juliet::ScanCode::D))
|
||||
if (IsKeyDown(ScanCode::D))
|
||||
{
|
||||
currentCam->Position = currentCam->Position + right * (speedPerFrame * dt);
|
||||
}
|
||||
if (Juliet::IsKeyDown(Juliet::ScanCode::A))
|
||||
if (IsKeyDown(ScanCode::A))
|
||||
{
|
||||
currentCam->Position = currentCam->Position - right * (speedPerFrame * dt);
|
||||
}
|
||||
if (Juliet::IsKeyDown(Juliet::ScanCode::Space))
|
||||
if (IsKeyDown(ScanCode::Space))
|
||||
{
|
||||
currentCam->Position = currentCam->Position + defaultUp * (speedPerFrame * dt);
|
||||
}
|
||||
if (Juliet::IsKeyDown(Juliet::ScanCode::LeftControl))
|
||||
if (IsKeyDown(ScanCode::LeftControl))
|
||||
{
|
||||
currentCam->Position = currentCam->Position - defaultUp * (speedPerFrame * dt);
|
||||
}
|
||||
@@ -148,7 +148,7 @@ void UpdateDebugController(float dt)
|
||||
#if JULIET_DEBUG
|
||||
void RenderImGuiDebugController(float dt)
|
||||
{
|
||||
Juliet::Camera* currentCam = Juliet::GetCurrentCamera();
|
||||
Camera* currentCam = GetCurrentCamera();
|
||||
|
||||
ImGui::Text("Delta time: %f", dt);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user