Skip to content

Commit

Permalink
Fixed bad Frustum::WorldMatrix(). Alter Frustum::ProjectionMatrix() t…
Browse files Browse the repository at this point in the history
…o return right-handed projection matrices in either D3D or OGL format depending on which we're running against.
  • Loading branch information
juj committed Jun 18, 2012
1 parent 8ff1eec commit bfd0a26
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Geometry/Frustum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ float3x4 Frustum::WorldMatrix() const
assume(up.IsNormalized());
assume(front.IsNormalized());
float3x4 m;
m.SetCol(0, up.Cross(front).Normalized());
m.SetCol(0, front.Cross(up).Normalized());
m.SetCol(1, up);
m.SetCol(2, front);
m.SetCol(2, -front);
m.SetCol(3, pos);
assume(!m.HasNegativeScale());
return m;
Expand All @@ -131,7 +131,11 @@ float4x4 Frustum::ProjectionMatrix() const
assume(type == PerspectiveFrustum || type == OrthographicFrustum);
if (type == PerspectiveFrustum)
{
#if USE_D3D11
return float4x4::D3DPerspProjRH(nearPlaneDistance, farPlaneDistance, horizontalFov, verticalFov);
#else
return float4x4::OpenGLPerspProjRH(nearPlaneDistance, farPlaneDistance, horizontalFov, verticalFov);
#endif
}
else
{
Expand Down

0 comments on commit bfd0a26

Please sign in to comment.