Skip to content

Commit

Permalink
Minor comment and parameter update to make it clear XMPlaneTransform(…
Browse files Browse the repository at this point in the history
…Stream) expects the inverse transpose
  • Loading branch information
walbourn committed Jan 17, 2022
1 parent 581534e commit 332fb99
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
10 changes: 7 additions & 3 deletions Inc/DirectXMath.h
Original file line number Diff line number Diff line change
Expand Up @@ -1559,11 +1559,15 @@ namespace DirectX
XMVECTOR XM_CALLCONV XMPlaneNormalize(FXMVECTOR P) noexcept;
XMVECTOR XM_CALLCONV XMPlaneIntersectLine(FXMVECTOR P, FXMVECTOR LinePoint1, FXMVECTOR LinePoint2) noexcept;
void XM_CALLCONV XMPlaneIntersectPlane(_Out_ XMVECTOR* pLinePoint1, _Out_ XMVECTOR* pLinePoint2, _In_ FXMVECTOR P1, _In_ FXMVECTOR P2) noexcept;
XMVECTOR XM_CALLCONV XMPlaneTransform(FXMVECTOR P, FXMMATRIX M) noexcept;
XMFLOAT4* XM_CALLCONV XMPlaneTransformStream(_Out_writes_bytes_(sizeof(XMFLOAT4) + OutputStride * (PlaneCount - 1)) XMFLOAT4* pOutputStream,

// Transforms a plane given an inverse transpose matrix
XMVECTOR XM_CALLCONV XMPlaneTransform(FXMVECTOR P, FXMMATRIX ITM) noexcept;

// Transforms an array of planes given an inverse transpose matrix
XMFLOAT4* XM_CALLCONV XMPlaneTransformStream(_Out_writes_bytes_(sizeof(XMFLOAT4) + OutputStride * (PlaneCount - 1)) XMFLOAT4* pOutputStream,
_In_ size_t OutputStride,
_In_reads_bytes_(sizeof(XMFLOAT4) + InputStride * (PlaneCount - 1)) const XMFLOAT4* pInputStream,
_In_ size_t InputStride, _In_ size_t PlaneCount, _In_ FXMMATRIX M) noexcept;
_In_ size_t InputStride, _In_ size_t PlaneCount, _In_ FXMMATRIX ITM) noexcept;

XMVECTOR XM_CALLCONV XMPlaneFromPointNormal(FXMVECTOR Point, FXMVECTOR Normal) noexcept;
XMVECTOR XM_CALLCONV XMPlaneFromPoints(FXMVECTOR Point1, FXMVECTOR Point2, FXMVECTOR Point3) noexcept;
Expand Down
16 changes: 8 additions & 8 deletions Inc/DirectXMathMisc.inl
Original file line number Diff line number Diff line change
Expand Up @@ -1217,39 +1217,39 @@ inline void XM_CALLCONV XMPlaneIntersectPlane
inline XMVECTOR XM_CALLCONV XMPlaneTransform
(
FXMVECTOR P,
FXMMATRIX M
FXMMATRIX ITM
) noexcept
{
XMVECTOR W = XMVectorSplatW(P);
XMVECTOR Z = XMVectorSplatZ(P);
XMVECTOR Y = XMVectorSplatY(P);
XMVECTOR X = XMVectorSplatX(P);

XMVECTOR Result = XMVectorMultiply(W, M.r[3]);
Result = XMVectorMultiplyAdd(Z, M.r[2], Result);
Result = XMVectorMultiplyAdd(Y, M.r[1], Result);
Result = XMVectorMultiplyAdd(X, M.r[0], Result);
XMVECTOR Result = XMVectorMultiply(W, ITM.r[3]);
Result = XMVectorMultiplyAdd(Z, ITM.r[2], Result);
Result = XMVectorMultiplyAdd(Y, ITM.r[1], Result);
Result = XMVectorMultiplyAdd(X, ITM.r[0], Result);
return Result;
}

//------------------------------------------------------------------------------
_Use_decl_annotations_
inline XMFLOAT4* XM_CALLCONV XMPlaneTransformStream
(
XMFLOAT4* pOutputStream,
XMFLOAT4* pOutputStream,
size_t OutputStride,
const XMFLOAT4* pInputStream,
size_t InputStride,
size_t PlaneCount,
FXMMATRIX M
FXMMATRIX ITM
) noexcept
{
return XMVector4TransformStream(pOutputStream,
OutputStride,
pInputStream,
InputStride,
PlaneCount,
M);
ITM);
}

//------------------------------------------------------------------------------
Expand Down

0 comments on commit 332fb99

Please sign in to comment.