Skip to content

Commit

Permalink
bug fix for camera cycling
Browse files Browse the repository at this point in the history
  • Loading branch information
hyperlogic committed Apr 9, 2024
1 parent 4203abf commit 4c24ffb
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,6 @@ bool App::Init()

glm::mat4 flyCamMat(1.0f);
glm::mat4 floorMat(1.0f);
cameraIndex = 0;
if (camerasConfig)
{
flyCamMat = camerasConfig->GetCameraVec()[cameraIndex];
Expand Down Expand Up @@ -621,7 +620,11 @@ bool App::Init()
{
if (down && camerasConfig)
{
cameraIndex = (cameraIndex + 1) % camerasConfig->GetNumCameras();
cameraIndex++;
if (cameraIndex >= (int)camerasConfig->GetNumCameras())
{
cameraIndex -= (int)camerasConfig->GetNumCameras();
}
flyCam->SetCameraMat(camerasConfig->GetCameraVec()[cameraIndex]);
}
});
Expand All @@ -630,7 +633,11 @@ bool App::Init()
{
if (down && camerasConfig)
{
cameraIndex = (cameraIndex - 1) % camerasConfig->GetNumCameras();
cameraIndex--;
if (cameraIndex < 0)
{
cameraIndex += (int)camerasConfig->GetNumCameras();
}
flyCam->SetCameraMat(camerasConfig->GetCameraVec()[cameraIndex]);
}
});
Expand Down

0 comments on commit 4c24ffb

Please sign in to comment.