Skip to content

Commit

Permalink
Update mViewProjectionMatrix after modiying mViewMatrix
Browse files Browse the repository at this point in the history
I added an ArcballCamera to google#428 and noticed that it wasn't working as
expected.

ArcballCamera wasn't updating mViewProjectionMatrix after modifying
mViewMatrix. This was causing the ArcballCamera to not work correctly
when combined with the classes introduced in google#426.
  • Loading branch information
footballhead authored and apazylbe committed Apr 17, 2024
1 parent c7a4e66 commit 859f682
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/ppx/camera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -299,8 +299,9 @@ ArcballCamera::ArcballCamera(

void ArcballCamera::UpdateCamera()
{
mViewMatrix = mTranslationMatrix * glm::mat4_cast(mRotationQuat) * mCenterTranslationMatrix;
mInverseViewMatrix = glm::inverse(mViewMatrix);
mViewMatrix = mTranslationMatrix * glm::mat4_cast(mRotationQuat) * mCenterTranslationMatrix;
mInverseViewMatrix = glm::inverse(mViewMatrix);
mViewProjectionMatrix = mProjectionMatrix * mViewMatrix;

// Transform the view space origin into world space for eye position
mEyePosition = mInverseViewMatrix * float4(0, 0, 0, 1);
Expand Down

0 comments on commit 859f682

Please sign in to comment.