BoundingFrustum CreateFromMatrix option for RH coordinates
This commit is contained in:
Родитель
cc101d2cdf
Коммит
8d53a95437
|
@ -258,7 +258,7 @@ namespace DirectX
|
|||
: Origin(_Origin), Orientation(_Orientation),
|
||||
RightSlope(_RightSlope), LeftSlope(_LeftSlope), TopSlope(_TopSlope), BottomSlope(_BottomSlope),
|
||||
Near(_Near), Far(_Far) {}
|
||||
BoundingFrustum(_In_ CXMMATRIX Projection) noexcept;
|
||||
BoundingFrustum(_In_ CXMMATRIX Projection, bool rhcoords = false) noexcept;
|
||||
|
||||
// Methods
|
||||
void XM_CALLCONV Transform(_Out_ BoundingFrustum& Out, _In_ FXMMATRIX M) const noexcept;
|
||||
|
@ -298,7 +298,7 @@ namespace DirectX
|
|||
// Create 6 Planes representation of Frustum
|
||||
|
||||
// Static methods
|
||||
static void XM_CALLCONV CreateFromMatrix(_Out_ BoundingFrustum& Out, _In_ FXMMATRIX Projection) noexcept;
|
||||
static void XM_CALLCONV CreateFromMatrix(_Out_ BoundingFrustum& Out, _In_ FXMMATRIX Projection, bool rhcoords = false) noexcept;
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
|
@ -2818,9 +2818,9 @@ inline void BoundingOrientedBox::CreateFromPoints(BoundingOrientedBox& Out, size
|
|||
****************************************************************************/
|
||||
|
||||
_Use_decl_annotations_
|
||||
inline BoundingFrustum::BoundingFrustum(CXMMATRIX Projection) noexcept
|
||||
inline BoundingFrustum::BoundingFrustum(CXMMATRIX Projection, bool rhcoords) noexcept
|
||||
{
|
||||
CreateFromMatrix(*this, Projection);
|
||||
CreateFromMatrix(*this, Projection, rhcoords);
|
||||
}
|
||||
|
||||
|
||||
|
@ -4252,7 +4252,7 @@ inline void BoundingFrustum::GetPlanes(XMVECTOR* NearPlane, XMVECTOR* FarPlane,
|
|||
// constructed frustum to be incorrect.
|
||||
//-----------------------------------------------------------------------------
|
||||
_Use_decl_annotations_
|
||||
inline void XM_CALLCONV BoundingFrustum::CreateFromMatrix(BoundingFrustum& Out, FXMMATRIX Projection) noexcept
|
||||
inline void XM_CALLCONV BoundingFrustum::CreateFromMatrix(BoundingFrustum& Out, FXMMATRIX Projection, bool rhcoords) noexcept
|
||||
{
|
||||
// Corners of the projection frustum in homogenous space.
|
||||
static XMVECTORF32 HomogenousPoints[6] =
|
||||
|
@ -4296,8 +4296,16 @@ inline void XM_CALLCONV BoundingFrustum::CreateFromMatrix(BoundingFrustum& Out,
|
|||
Points[4] = XMVectorMultiply(Points[4], XMVectorReciprocal(XMVectorSplatW(Points[4])));
|
||||
Points[5] = XMVectorMultiply(Points[5], XMVectorReciprocal(XMVectorSplatW(Points[5])));
|
||||
|
||||
Out.Near = XMVectorGetZ(Points[4]);
|
||||
Out.Far = XMVectorGetZ(Points[5]);
|
||||
if (rhcoords)
|
||||
{
|
||||
Out.Near = XMVectorGetZ(Points[5]);
|
||||
Out.Far = XMVectorGetZ(Points[4]);
|
||||
}
|
||||
else
|
||||
{
|
||||
Out.Near = XMVectorGetZ(Points[4]);
|
||||
Out.Far = XMVectorGetZ(Points[5]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче