Skip to content

Commit 8fa0f2b

Browse files
committed
Fixed orthographic frustum construction
1 parent 15b475b commit 8fa0f2b

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

MiniEngine/Core/Math/Frustum.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,12 @@ void Frustum::ConstructOrthographicFrustum( float Left, float Right, float Top,
6161
m_FrustumCorners[ kFarUpperRight ] = Vector3(Right, Top, -Back); // Far upper right
6262

6363
// Define the bounding planes
64-
m_FrustumPlanes[kNearPlane] = BoundingPlane( 0.0f, 0.0f, -1.0f, -Front );
65-
m_FrustumPlanes[kFarPlane] = BoundingPlane( 0.0f, 0.0f, 1.0f, Back );
66-
m_FrustumPlanes[kLeftPlane] = BoundingPlane( 1.0f, 0.0f, 0.0f, -Left );
67-
m_FrustumPlanes[kRightPlane] = BoundingPlane( -1.0f, 0.0f, 0.0f, Right );
68-
m_FrustumPlanes[kTopPlane] = BoundingPlane( 0.0f, -1.0f, 0.0f, Bottom );
69-
m_FrustumPlanes[kBottomPlane] = BoundingPlane( 0.0f, 1.0f, 0.0f, -Top );
64+
m_FrustumPlanes[kNearPlane] = BoundingPlane( 0.0f, 0.0f, 1.0f, -Front );
65+
m_FrustumPlanes[kFarPlane] = BoundingPlane( 0.0f, 0.0f, -1.0f, Back );
66+
m_FrustumPlanes[kLeftPlane] = BoundingPlane( 1.0f, 0.0f, 0.0f, -Left );
67+
m_FrustumPlanes[kRightPlane] = BoundingPlane( -1.0f, 0.0f, 0.0f, Right );
68+
m_FrustumPlanes[kBottomPlane] = BoundingPlane( 0.0f, 1.0f, 0.0f, -Bottom );
69+
m_FrustumPlanes[kTopPlane] = BoundingPlane( 0.0f, -1.0f, 0.0f, Top );
7070
}
7171

7272

@@ -82,11 +82,11 @@ Frustum::Frustum( const Matrix4& ProjMat )
8282
if (ProjMatF[3] == 0.0f && ProjMatF[7] == 0.0f && ProjMatF[11] == 0.0f && ProjMatF[15] == 1.0f)
8383
{
8484
// Orthographic
85-
float Left = (-1.0f - ProjMatF[12]) * RcpXX;
86-
float Right = ( 1.0f - ProjMatF[12]) * RcpXX;
87-
float Top = ( 1.0f - ProjMatF[13]) * RcpYY;
85+
float Left = (-1.0f - ProjMatF[12]) * RcpXX;
86+
float Right = ( 1.0f - ProjMatF[12]) * RcpXX;
87+
float Top = ( 1.0f - ProjMatF[13]) * RcpYY;
8888
float Bottom = (-1.0f - ProjMatF[13]) * RcpYY;
89-
float Front = ( 0.0f - ProjMatF[14]) * RcpZZ;
89+
float Front = ( 0.0f - ProjMatF[14]) * RcpZZ;
9090
float Back = ( 1.0f - ProjMatF[14]) * RcpZZ;
9191

9292
// Check for reverse Z here. The bounding planes need to point into the frustum.

0 commit comments

Comments
 (0)