@@ -2818,9 +2818,9 @@ inline void BoundingOrientedBox::CreateFromPoints(BoundingOrientedBox& Out, size
28182818 ****************************************************************************/
28192819
28202820_Use_decl_annotations_
2821- inline BoundingFrustum::BoundingFrustum (CXMMATRIX Projection) noexcept
2821+ inline BoundingFrustum::BoundingFrustum (CXMMATRIX Projection, bool rhcoords ) noexcept
28222822{
2823- CreateFromMatrix (*this , Projection);
2823+ CreateFromMatrix (*this , Projection, rhcoords );
28242824}
28252825
28262826
@@ -4252,7 +4252,7 @@ inline void BoundingFrustum::GetPlanes(XMVECTOR* NearPlane, XMVECTOR* FarPlane,
42524252// constructed frustum to be incorrect.
42534253// -----------------------------------------------------------------------------
42544254_Use_decl_annotations_
4255- inline void XM_CALLCONV BoundingFrustum::CreateFromMatrix (BoundingFrustum& Out, FXMMATRIX Projection) noexcept
4255+ inline void XM_CALLCONV BoundingFrustum::CreateFromMatrix (BoundingFrustum& Out, FXMMATRIX Projection, bool rhcoords ) noexcept
42564256{
42574257 // Corners of the projection frustum in homogenous space.
42584258 static XMVECTORF32 HomogenousPoints[6 ] =
@@ -4296,8 +4296,16 @@ inline void XM_CALLCONV BoundingFrustum::CreateFromMatrix(BoundingFrustum& Out,
42964296 Points[4 ] = XMVectorMultiply (Points[4 ], XMVectorReciprocal (XMVectorSplatW (Points[4 ])));
42974297 Points[5 ] = XMVectorMultiply (Points[5 ], XMVectorReciprocal (XMVectorSplatW (Points[5 ])));
42984298
4299- Out.Near = XMVectorGetZ (Points[4 ]);
4300- Out.Far = XMVectorGetZ (Points[5 ]);
4299+ if (rhcoords)
4300+ {
4301+ Out.Near = XMVectorGetZ (Points[5 ]);
4302+ Out.Far = XMVectorGetZ (Points[4 ]);
4303+ }
4304+ else
4305+ {
4306+ Out.Near = XMVectorGetZ (Points[4 ]);
4307+ Out.Far = XMVectorGetZ (Points[5 ]);
4308+ }
43014309}
43024310
43034311
0 commit comments