Back ported resolution for issue #71 for znear == 0 bug into branch 0.9.4
This commit is contained in:
parent
e5df5fb0b3
commit
f4f7a71964
@ -236,21 +236,19 @@ namespace glm
|
|||||||
valType const & zFar
|
valType const & zFar
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
assert(aspect != valType(0));
|
||||||
|
assert(zFar != zNear);
|
||||||
|
|
||||||
#ifdef GLM_FORCE_RADIANS
|
#ifdef GLM_FORCE_RADIANS
|
||||||
valType const rad = fovy;
|
valType const rad = fovy;
|
||||||
#else
|
#else
|
||||||
valType const rad = glm::radians(fovy);
|
valType const rad = glm::radians(fovy);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
valType range = tan(rad / valType(2)) * zNear;
|
|
||||||
valType left = -range * aspect;
|
|
||||||
valType right = range * aspect;
|
|
||||||
valType bottom = -range;
|
|
||||||
valType top = range;
|
|
||||||
|
|
||||||
|
valType tanHalfFovy = tan(rad / valType(2));
|
||||||
detail::tmat4x4<valType> Result(valType(0));
|
detail::tmat4x4<valType> Result(valType(0));
|
||||||
Result[0][0] = (valType(2) * zNear) / (right - left);
|
Result[0][0] = valType(1) / (aspect * tanHalfFovy);
|
||||||
Result[1][1] = (valType(2) * zNear) / (top - bottom);
|
Result[1][1] = valType(1) / (tanHalfFovy);
|
||||||
Result[2][2] = - (zFar + zNear) / (zFar - zNear);
|
Result[2][2] = - (zFar + zNear) / (zFar - zNear);
|
||||||
Result[2][3] = - valType(1);
|
Result[2][3] = - valType(1);
|
||||||
Result[3][2] = - (valType(2) * zFar * zNear) / (zFar - zNear);
|
Result[3][2] = - (valType(2) * zFar * zNear) / (zFar - zNear);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user