Skip to content
This repository has been archived by the owner on May 6, 2024. It is now read-only.

Commit

Permalink
Fixed perspective matrix missing *2 term.
Browse files Browse the repository at this point in the history
See e.g. http://www.songho.ca/opengl/gl_projectionmatrix.html

Change-Id: I457fdb5bfd48bbb0e083e76ad090754b128eb421
Tested: on OS X.
  • Loading branch information
Wouter van Oortmerssen committed May 27, 2015
1 parent 6df8772 commit 4903ef1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion include/mathfu/matrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -1273,7 +1273,7 @@ inline Matrix<T, 4, 4> PerspectiveHelper(T fovy, T aspect, T znear, T zfar,
return Matrix<T, 4, 4>(x, 0, 0, 0,
0, y, 0, 0,
0, 0, zfar_per_zdist, -1 * handedness,
0, 0, znear * zfar_per_zdist * handedness, 0);
0, 0, 2.0f * znear * zfar_per_zdist * handedness, 0);
}
/// @endcond

Expand Down
2 changes: 1 addition & 1 deletion unit_tests/matrix_test/matrix_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@ void Perspective_Test(const T& precision) {
mathfu::Matrix<T, 4>(1, 0, 0, 0,
0, 1, 0, 0,
0, 0, -0.5, -1,
0, 0, 1, 0),
0, 0, 2, 0),
},
};
VerifyMatrixExpectations(
Expand Down

0 comments on commit 4903ef1

Please sign in to comment.