Ark Server API (ASA) - Wiki
Loading...
Searching...
No Matches
UnrealMathDirectX.h File Reference
#include <DirectXMath.h>
#include <DirectXPackedVector.h>
#include "Math/UnrealMathVectorConstants.h"
+ Include dependency graph for UnrealMathDirectX.h:

Go to the source code of this file.

Macros

#define DECLARE_VECTOR_REGISTER(X, Y, Z, W)   { X, Y, Z, W }
 
#define VectorZero()   DirectX::XMVectorZero()
 
#define VectorOne()   DirectX::g_XMOne.v
 
#define VectorLoad(Ptr)   DirectX::XMLoadFloat4( (const DirectX::XMFLOAT4*)(Ptr) )
 
#define VectorLoadFloat3(Ptr)   MakeVectorRegister( ((const float*)(Ptr))[0], ((const float*)(Ptr))[1], ((const float*)(Ptr))[2], 0.0f )
 
#define VectorLoadFloat3_W0(Ptr)   MakeVectorRegister( ((const float*)(Ptr))[0], ((const float*)(Ptr))[1], ((const float*)(Ptr))[2], 0.0f )
 
#define VectorLoadFloat3_W1(Ptr)   MakeVectorRegister( ((const float*)(Ptr))[0], ((const float*)(Ptr))[1], ((const float*)(Ptr))[2], 1.0f )
 
#define VectorLoadAligned(Ptr)   DirectX::XMLoadFloat4A( (const DirectX::XMFLOAT4A*)(Ptr) )
 
#define VectorLoadFloat1(Ptr)   DirectX::XMVectorReplicatePtr( (const float*)(Ptr) )
 
#define VectorLoadFloat2(Ptr)   MakeVectorRegister( ((const float*)(Ptr))[0], ((const float*)(Ptr))[1], ((const float*)(Ptr))[0], ((const float*)(Ptr))[1] )
 
#define VectorSetFloat3(X, Y, Z)   MakeVectorRegister( X, Y, Z, 0.0f )
 
#define VectorSetFloat1(X)   MakeVectorRegister( X, X, X, X )
 
#define VectorSet(X, Y, Z, W)   MakeVectorRegister( X, Y, Z, W )
 
#define VectorStoreAligned(Vec, Ptr)   DirectX::XMStoreFloat4A((DirectX::XMFLOAT4A*)(Ptr), Vec )
 
#define VectorStoreAlignedStreamed(Vec, Ptr)   XM_STREAM_PS( (float*)(Ptr), Vec )
 
#define VectorStore(Vec, Ptr)   DirectX::XMStoreFloat4((DirectX::XMFLOAT4*)(Ptr), Vec )
 
#define VectorStoreFloat3(Vec, Ptr)   DirectX::XMStoreFloat3((DirectX::XMFLOAT3*)(Ptr), Vec )
 
#define VectorStoreFloat1(Vec, Ptr)   DirectX::XMStoreFloat((float*)(Ptr), Vec )
 
#define VectorReplicate(Vec, ElementIndex)   DirectX::XMVectorSwizzle<ElementIndex,ElementIndex,ElementIndex,ElementIndex>(Vec)
 
#define VectorAbs(Vec)   DirectX::XMVectorAbs( Vec )
 
#define VectorNegate(Vec)   DirectX::XMVectorNegate( Vec )
 
#define VectorAdd(Vec1, Vec2)   DirectX::XMVectorAdd( Vec1, Vec2 )
 
#define VectorSubtract(Vec1, Vec2)   DirectX::XMVectorSubtract( Vec1, Vec2 )
 
#define VectorMultiply(Vec1, Vec2)   DirectX::XMVectorMultiply( Vec1, Vec2 )
 
#define VectorDivide(Vec1, Vec2)   DirectX::XMVectorDivide( Vec1, Vec2 )
 
#define VectorMultiplyAdd(Vec1, Vec2, Vec3)   DirectX::XMVectorMultiplyAdd( Vec1, Vec2, Vec3 )
 
#define VectorNegateMultiplyAdd(Vec1, Vec2, Vec3)   DirectX::XMVectorNegativeMultiplySubtract( Vec1, Vec2, Vec3 )
 
#define VectorDot3(Vec1, Vec2)   DirectX::XMVector3Dot( Vec1, Vec2 )
 
#define VectorDot4(Vec1, Vec2)   DirectX::XMVector4Dot( Vec1, Vec2 )
 
#define VectorCompareEQ(Vec1, Vec2)   DirectX::XMVectorEqual( Vec1, Vec2 )
 
#define VectorCompareNE(Vec1, Vec2)   DirectX::XMVectorNotEqual( Vec1, Vec2 )
 
#define VectorCompareGT(Vec1, Vec2)   DirectX::XMVectorGreater( Vec1, Vec2 )
 
#define VectorCompareGE(Vec1, Vec2)   DirectX::XMVectorGreaterOrEqual( Vec1, Vec2 )
 
#define VectorCompareLT(Vec1, Vec2)   _mm_cmplt_ps( Vec1, Vec2 )
 
#define VectorCompareLE(Vec1, Vec2)   _mm_cmple_ps( Vec1, Vec2 )
 
#define VectorSelect(Mask, Vec1, Vec2)   DirectX::XMVectorSelect( Vec2, Vec1, Mask )
 
#define VectorBitwiseOr(Vec1, Vec2)   DirectX::XMVectorOrInt( Vec1, Vec2 )
 
#define VectorBitwiseAnd(Vec1, Vec2)   DirectX::XMVectorAndInt( Vec1, Vec2 )
 
#define VectorBitwiseXor(Vec1, Vec2)   DirectX::XMVectorXorInt( Vec1, Vec2 )
 
#define VectorMaskBits(VecMask)   _mm_movemask_ps( VecMask )
 
#define VectorCross(Vec1, Vec2)   DirectX::XMVector3Cross( Vec1, Vec2 )
 
#define VectorPow(Vec1, Vec2)   DirectX::XMVectorPow( Vec1, Vec2 )
 
#define VectorReciprocalSqrt(Vec)   DirectX::XMVectorReciprocalSqrtEst( Vec )
 
#define VectorReciprocal(Vec)   DirectX::XMVectorReciprocalEst( Vec )
 
#define VectorReciprocalLen(Vec)   DirectX::XMVector4ReciprocalLengthEst( Vec )
 
#define VectorReciprocalSqrtAccurate(Vec)   DirectX::XMVectorReciprocalSqrt( Vec )
 
#define VectorReciprocalAccurate(Vec)   DirectX::XMVectorReciprocal( Vec )
 
#define VectorNormalize(Vec)   DirectX::XMVector4NormalizeEst( Vec )
 
#define VectorSet_W0(Vec)   DirectX::XMVectorAndInt( Vec , DirectX::g_XMMask3 )
 
#define VectorSet_W1(Vec)   DirectX::XMVectorPermute<0,1,2,7>( Vec, VectorOne() )
 
#define VectorMin(Vec1, Vec2)   DirectX::XMVectorMin( Vec1, Vec2 )
 
#define VectorMax(Vec1, Vec2)   DirectX::XMVectorMax( Vec1, Vec2 )
 
#define VectorSwizzle(Vec, X, Y, Z, W)   DirectX::XMVectorSwizzle<X,Y,Z,W>( Vec )
 
#define VectorShuffle(Vec1, Vec2, X, Y, Z, W)   DirectX::XMVectorPermute<X,Y,Z+4,W+4>( Vec1, Vec2 )
 
#define VectorMask_LT(Vec1, Vec2)   _mm_cmplt_ps( Vec1, Vec2 )
 
#define VectorMask_LE(Vec1, Vec2)   _mm_cmple_ps( Vec1, Vec2 )
 
#define VectorMask_GT(Vec1, Vec2)   DirectX::XMVectorGreater( Vec1, Vec2 )
 
#define VectorMask_GE(Vec1, Vec2)   DirectX::XMVectorGreaterOrEqual( Vec1, Vec2 )
 
#define VectorMask_EQ(Vec1, Vec2)   DirectX::XMVectorEqual( Vec1, Vec2 )
 
#define VectorMask_NE(Vec1, Vec2)   DirectX::XMVectorNotEqual( Vec1, Vec2 )
 
#define VectorLoadByte4(Ptr)   DirectX::PackedVector::XMLoadUByte4((const DirectX::PackedVector::XMUBYTE4*)(Ptr) )
 
#define VectorLoadSignedByte4(Ptr)   DirectX::PackedVector::XMLoadByte4((const DirectX::PackedVector::XMBYTE4*)(Ptr) )
 
#define VectorStoreByte4(Vec, Ptr)   DirectX::PackedVector::XMStoreUByte4( (DirectX::PackedVector::XMUBYTE4*)(Ptr), Vec )
 
#define VectorStoreSignedByte4(Vec, Ptr)   DirectX::PackedVector::XMStoreByte4( (DirectX::PackedVector::XMBYTE4*)(Ptr), Vec )
 
#define VectorLoadURGB10A2N(Ptr)   DirectX::PackedVector::XMLoadUDecN4( (const DirectX::PackedVector::XMUDECN4*)(Ptr) )
 
#define VectorStoreURGB10A2N(Vec, Ptr)   DirectX::PackedVector::XMStoreUDecN4( (const DirectX::PackedVector::XMUDECN4*)(Ptr), Vec )
 
#define VectorLoadURGBA16N(Ptr)   DirectX::PackedVector::XMLoadUShortN4( (const DirectX::PackedVector::XMUSHORTN4*)(Ptr) )
 
#define VectorLoadSRGBA16N(Ptr)   DirectX::PackedVector::XMLoadShortN4( (const DirectX::PackedVector::XMSHORTN4*)(Ptr) )
 
#define VectorStoreURGBA16N(Vec, Ptr)   DirectX::PackedVector::XMStoreUShortN4( (const DirectX::PackedVector::XMUSHORTN4*)(Ptr), Vec )
 
#define VectorResetFloatRegisters()
 
#define VectorGetControlRegister()   _mm_getcsr()
 
#define VectorSetControlRegister(ControlStatus)   _mm_setcsr( ControlStatus )
 
#define VECTOR_ROUND_TOWARD_ZERO   _MM_ROUND_TOWARD_ZERO
 
#define VectorIntAnd(A, B)   _mm_and_si128(A, B)
 
#define VectorIntOr(A, B)   _mm_or_si128(A, B)
 
#define VectorIntXor(A, B)   _mm_xor_si128(A, B)
 
#define VectorIntAndNot(A, B)   _mm_andnot_si128(A, B)
 
#define VectorIntNot(A)   _mm_xor_si128(A, GlobalVectorConstants::IntAllMask)
 
#define VectorIntCompareEQ(A, B)   _mm_cmpeq_epi32(A,B)
 
#define VectorIntCompareNEQ(A, B)   VectorIntNot(_mm_cmpeq_epi32(A,B))
 
#define VectorIntCompareGT(A, B)   _mm_cmpgt_epi32(A,B)
 
#define VectorIntCompareLT(A, B)   _mm_cmplt_epi32(A,B)
 
#define VectorIntCompareGE(A, B)   VectorIntNot(VectorIntCompareLT(A,B))
 
#define VectorIntCompareLE(A, B)   VectorIntNot(VectorIntCompareGT(A,B))
 
#define VectorIntAdd(A, B)   _mm_add_epi32(A, B)
 
#define VectorIntSubtract(A, B)   _mm_sub_epi32(A, B)
 
#define VectorIntNegate(A)   VectorIntSubtract( GlobalVectorConstants::IntZero, A)
 
#define VectorIntSign(A)   VectorIntSelect( VectorIntCompareGE(A, GlobalVectorConstants::IntZero), GlobalVectorConstants::IntOne, GlobalVectorConstants::IntMinusOne )
 
#define VectorIntToFloat(A)   _mm_cvtepi32_ps(A)
 
#define VectorFloatToInt(A)   _mm_cvttps_epi32(A)
 
#define VectorIntStore(Vec, Ptr)   _mm_storeu_si128( (VectorRegister4Int*)(Ptr), Vec )
 
#define VectorIntLoad(Ptr)   _mm_loadu_si128( (VectorRegister4Int*)(Ptr) )
 
#define VectorIntStoreAligned(Vec, Ptr)   _mm_store_si128( (VectorRegister4Int*)(Ptr), Vec )
 
#define VectorIntLoadAligned(Ptr)   _mm_load_si128( (VectorRegister4Int*)(Ptr) )
 
#define VectorIntLoad1(Ptr)   _mm_shuffle_epi32(_mm_loadu_si128((VectorRegister4Int*)(Ptr)),_MM_SHUFFLE(0,0,0,0))
 

Typedefs

typedef DirectX::XMVECTOR VectorRegister
 
typedef __m128i VectorRegister4Int
 

Functions

FORCEINLINE VectorRegister MakeVectorRegister (uint32 X, uint32 Y, uint32 Z, uint32 W)
 
FORCEINLINE VectorRegister MakeVectorRegister (float X, float Y, float Z, float W)
 
FORCEINLINE VectorRegister4Int MakeVectorRegisterInt (int32 X, int32 Y, int32 Z, int32 W)
 
FORCEINLINE constexpr VectorRegister4Int MakeVectorRegisterIntConstant (int32 X, int32 Y, int32 Z, int32 W)
 
FORCEINLINE constexpr VectorRegister4Float MakeVectorRegisterFloatConstant (float X, float Y, float Z, float W)
 
FORCEINLINE constexpr VectorRegister2Double MakeVectorRegister2DoubleConstant (double X, double Y)
 
FORCEINLINE VectorRegister VectorLoadTwoPairsFloat (const float *Ptr1, const float *Ptr2)
 
FORCEINLINE float VectorGetComponent (VectorRegister Vec, uint32 ComponentIndex)
 
FORCEINLINE void VectorMatrixMultiply (FMatrix *Result, const FMatrix *Matrix1, const FMatrix *Matrix2)
 
FORCEINLINE void VectorMatrixInverse (FMatrix *DstMatrix, const FMatrix *SrcMatrix)
 
FORCEINLINE VectorRegister VectorTransformVector (const VectorRegister &VecP, const FMatrix *MatrixM)
 
FORCEINLINE VectorRegister VectorCombineHigh (const VectorRegister &Vec1, const VectorRegister &Vec2)
 
FORCEINLINE VectorRegister VectorCombineLow (const VectorRegister &Vec1, const VectorRegister &Vec2)
 
FORCEINLINE void VectorDeinterleave (VectorRegister &OutEvens, VectorRegister &OutOdds, const VectorRegister &Lo, const VectorRegister &Hi)
 
FORCEINLINE VectorRegister VectorMergeVecXYZ_VecW (const VectorRegister &VecXYZ, const VectorRegister &VecW)
 
FORCEINLINE VectorRegister VectorLoadByte4Reverse (const uint8 *Ptr)
 
FORCEINLINE uint32 VectorAnyGreaterThan (const VectorRegister &Vec1, const VectorRegister &Vec2)
 
FORCEINLINE VectorRegister VectorQuaternionMultiply2 (const VectorRegister &Quat1, const VectorRegister &Quat2)
 
FORCEINLINE void VectorQuaternionMultiply (FQuat *Result, const FQuat *Quat1, const FQuat *Quat2)
 
FORCEINLINE void VectorQuaternionMultiply (VectorRegister *VResult, const VectorRegister *VQuat1, const VectorRegister *VQuat2)
 
FORCEINLINE void VectorQuaternionVector3Rotate (FVector *Result, const FVector *Vec, const FQuat *Quat)
 
FORCEINLINE void VectorQuaternionVector3InverseRotate (FVector *Result, const FVector *Vec, const FQuat *Quat)
 
FORCEINLINE void VectorSinCos (VectorRegister *RESTRICT VSinAngles, VectorRegister *RESTRICT VCosAngles, const VectorRegister *RESTRICT VAngles)
 
FORCEINLINE bool VectorContainsNaNOrInfinite (const VectorRegister &Vec)
 
FORCEINLINE VectorRegister VectorExp (const VectorRegister &X)
 
FORCEINLINE VectorRegister VectorExp2 (const VectorRegister &X)
 
FORCEINLINE VectorRegister VectorLog (const VectorRegister &X)
 
FORCEINLINE VectorRegister VectorLog2 (const VectorRegister &X)
 
FORCEINLINE VectorRegister VectorSin (const VectorRegister &X)
 
FORCEINLINE VectorRegister VectorCos (const VectorRegister &X)
 
FORCEINLINE VectorRegister VectorTan (const VectorRegister &X)
 
FORCEINLINE VectorRegister VectorASin (const VectorRegister &X)
 
FORCEINLINE VectorRegister VectorACos (const VectorRegister &X)
 
FORCEINLINE VectorRegister VectorATan (const VectorRegister &X)
 
FORCEINLINE VectorRegister VectorATan2 (const VectorRegister &X, const VectorRegister &Y)
 
FORCEINLINE VectorRegister VectorCeil (const VectorRegister &X)
 
FORCEINLINE VectorRegister VectorFloor (const VectorRegister &X)
 
FORCEINLINE VectorRegister VectorTruncate (const VectorRegister &X)
 
FORCEINLINE VectorRegister VectorFractional (const VectorRegister &X)
 
FORCEINLINE VectorRegister VectorMod (const VectorRegister &X, const VectorRegister &Y)
 
FORCEINLINE VectorRegister VectorSign (const VectorRegister &X)
 
FORCEINLINE VectorRegister VectorStep (const VectorRegister &X)
 
FORCEINLINE VectorRegister4Int VectorIntSelect (const VectorRegister4Int &Mask, const VectorRegister4Int &Vec1, const VectorRegister4Int &Vec2)
 
FORCEINLINE VectorRegister4Int VectorIntMultiply (const VectorRegister4Int &A, const VectorRegister4Int &B)
 
FORCEINLINE VectorRegister4Int VectorIntMin (const VectorRegister4Int &A, const VectorRegister4Int &B)
 
FORCEINLINE VectorRegister4Int VectorIntMax (const VectorRegister4Int &A, const VectorRegister4Int &B)
 
FORCEINLINE VectorRegister4Int VectorIntAbs (const VectorRegister4Int &A)
 
FORCEINLINE VectorRegister4Int VectorRoundToIntHalfToEven (const VectorRegister4Float &Vec)
 

Macro Definition Documentation

◆ DECLARE_VECTOR_REGISTER

#define DECLARE_VECTOR_REGISTER ( X,
Y,
Z,
W )   { X, Y, Z, W }

Definition at line 30 of file UnrealMathDirectX.h.

◆ VECTOR_ROUND_TOWARD_ZERO

#define VECTOR_ROUND_TOWARD_ZERO   _MM_ROUND_TOWARD_ZERO

Control status bit to round all floating point math results towards zero.

Definition at line 864 of file UnrealMathDirectX.h.

◆ VectorAbs

#define VectorAbs ( Vec)    DirectX::XMVectorAbs( Vec )

Returns the absolute value (component-wise).

Parameters
VecSource vector
Returns
VectorRegister( abs(Vec.x), abs(Vec.y), abs(Vec.z), abs(Vec.w) )

Definition at line 303 of file UnrealMathDirectX.h.

◆ VectorAdd

#define VectorAdd ( Vec1,
Vec2 )   DirectX::XMVectorAdd( Vec1, Vec2 )

Adds two vectors (component-wise) and returns the result.

Parameters
Vec11st vector
Vec22nd vector
Returns
VectorRegister( Vec1.x+Vec2.x, Vec1.y+Vec2.y, Vec1.z+Vec2.z, Vec1.w+Vec2.w )

Definition at line 320 of file UnrealMathDirectX.h.

◆ VectorBitwiseAnd

#define VectorBitwiseAnd ( Vec1,
Vec2 )   DirectX::XMVectorAndInt( Vec1, Vec2 )

Combines two vectors using bitwise AND (treating each vector as a 128 bit field)

Parameters
Vec11st vector
Vec22nd vector
Returns
VectorRegister( for each bit i: Vec1[i] & Vec2[i] )

Definition at line 470 of file UnrealMathDirectX.h.

◆ VectorBitwiseOr

#define VectorBitwiseOr ( Vec1,
Vec2 )   DirectX::XMVectorOrInt( Vec1, Vec2 )

Combines two vectors using bitwise OR (treating each vector as a 128 bit field)

Parameters
Vec11st vector
Vec22nd vector
Returns
VectorRegister( for each bit i: Vec1[i] | Vec2[i] )

Definition at line 461 of file UnrealMathDirectX.h.

◆ VectorBitwiseXor

#define VectorBitwiseXor ( Vec1,
Vec2 )   DirectX::XMVectorXorInt( Vec1, Vec2 )

Combines two vectors using bitwise XOR (treating each vector as a 128 bit field)

Parameters
Vec11st vector
Vec22nd vector
Returns
VectorRegister( for each bit i: Vec1[i] ^ Vec2[i] )

Definition at line 479 of file UnrealMathDirectX.h.

◆ VectorCompareEQ

#define VectorCompareEQ ( Vec1,
Vec2 )   DirectX::XMVectorEqual( Vec1, Vec2 )

Creates a four-part mask based on component-wise == compares of the input vectors

Parameters
Vec11st vector
Vec22nd vector
Returns
VectorRegister( Vec1.x == Vec2.x ? 0xFFFFFFFF : 0, same for yzw )

Definition at line 396 of file UnrealMathDirectX.h.

◆ VectorCompareGE

#define VectorCompareGE ( Vec1,
Vec2 )   DirectX::XMVectorGreaterOrEqual( Vec1, Vec2 )

Creates a four-part mask based on component-wise >= compares of the input vectors

Parameters
Vec11st vector
Vec22nd vector
Returns
VectorRegister( Vec1.x >= Vec2.x ? 0xFFFFFFFF : 0, same for yzw )

Definition at line 423 of file UnrealMathDirectX.h.

◆ VectorCompareGT

#define VectorCompareGT ( Vec1,
Vec2 )   DirectX::XMVectorGreater( Vec1, Vec2 )

Creates a four-part mask based on component-wise > compares of the input vectors

Parameters
Vec11st vector
Vec22nd vector
Returns
VectorRegister( Vec1.x > Vec2.x ? 0xFFFFFFFF : 0, same for yzw )

Definition at line 414 of file UnrealMathDirectX.h.

◆ VectorCompareLE

#define VectorCompareLE ( Vec1,
Vec2 )   _mm_cmple_ps( Vec1, Vec2 )

Creates a four-part mask based on component-wise <= compares of the input vectors

Parameters
Vec11st vector
Vec22nd vector
Returns
VectorRegister( Vec1.x <= Vec2.x ? 0xFFFFFFFF : 0, same for yzw )

Definition at line 441 of file UnrealMathDirectX.h.

◆ VectorCompareLT

#define VectorCompareLT ( Vec1,
Vec2 )   _mm_cmplt_ps( Vec1, Vec2 )

Creates a four-part mask based on component-wise < compares of the input vectors

Parameters
Vec11st vector
Vec22nd vector
Returns
VectorRegister( Vec1.x < Vec2.x ? 0xFFFFFFFF : 0, same for yzw )

Definition at line 432 of file UnrealMathDirectX.h.

◆ VectorCompareNE

#define VectorCompareNE ( Vec1,
Vec2 )   DirectX::XMVectorNotEqual( Vec1, Vec2 )

Creates a four-part mask based on component-wise != compares of the input vectors

Parameters
Vec11st vector
Vec22nd vector
Returns
VectorRegister( Vec1.x != Vec2.x ? 0xFFFFFFFF : 0, same for yzw )

Definition at line 405 of file UnrealMathDirectX.h.

◆ VectorCross

#define VectorCross ( Vec1,
Vec2 )   DirectX::XMVector3Cross( Vec1, Vec2 )

Calculates the cross product of two vectors (XYZ components). W is set to 0.

Parameters
Vec11st vector
Vec22nd vector
Returns
cross(Vec1.xyz, Vec2.xyz). W is set to 0.

Definition at line 498 of file UnrealMathDirectX.h.

◆ VectorDivide

#define VectorDivide ( Vec1,
Vec2 )   DirectX::XMVectorDivide( Vec1, Vec2 )

Divides two vectors (component-wise) and returns the result.

Parameters
Vec11st vector
Vec22nd vector
Returns
VectorRegister( Vec1.x/Vec2.x, Vec1.y/Vec2.y, Vec1.z/Vec2.z, Vec1.w/Vec2.w )

Definition at line 347 of file UnrealMathDirectX.h.

◆ VectorDot3

#define VectorDot3 ( Vec1,
Vec2 )   DirectX::XMVector3Dot( Vec1, Vec2 )

Calculates the dot3 product of two vectors and returns a vector with the result in all 4 components. Only really efficient on Xbox 360.

Parameters
Vec11st vector
Vec22nd vector
Returns
d = dot3(Vec1.xyz, Vec2.xyz), VectorRegister( d, d, d, d )

Definition at line 377 of file UnrealMathDirectX.h.

◆ VectorDot4

#define VectorDot4 ( Vec1,
Vec2 )   DirectX::XMVector4Dot( Vec1, Vec2 )

Calculates the dot4 product of two vectors and returns a vector with the result in all 4 components. Only really efficient on Xbox 360.

Parameters
Vec11st vector
Vec22nd vector
Returns
d = dot4(Vec1.xyzw, Vec2.xyzw), VectorRegister( d, d, d, d )

Definition at line 387 of file UnrealMathDirectX.h.

◆ VectorFloatToInt

#define VectorFloatToInt ( A)    _mm_cvttps_epi32(A)

Definition at line 1202 of file UnrealMathDirectX.h.

◆ VectorGetControlRegister

#define VectorGetControlRegister ( )    _mm_getcsr()

Returns the control register.

Returns
The uint32 control register

Definition at line 852 of file UnrealMathDirectX.h.

◆ VectorIntAdd

#define VectorIntAdd ( A,
B )   _mm_add_epi32(A, B)

Definition at line 1168 of file UnrealMathDirectX.h.

◆ VectorIntAnd

#define VectorIntAnd ( A,
B )   _mm_and_si128(A, B)

= a & b

Definition at line 1143 of file UnrealMathDirectX.h.

◆ VectorIntAndNot

#define VectorIntAndNot ( A,
B )   _mm_andnot_si128(A, B)

= (~a) & b

Definition at line 1149 of file UnrealMathDirectX.h.

◆ VectorIntCompareEQ

#define VectorIntCompareEQ ( A,
B )   _mm_cmpeq_epi32(A,B)

Definition at line 1154 of file UnrealMathDirectX.h.

◆ VectorIntCompareGE

#define VectorIntCompareGE ( A,
B )   VectorIntNot(VectorIntCompareLT(A,B))

Definition at line 1158 of file UnrealMathDirectX.h.

◆ VectorIntCompareGT

#define VectorIntCompareGT ( A,
B )   _mm_cmpgt_epi32(A,B)

Definition at line 1156 of file UnrealMathDirectX.h.

◆ VectorIntCompareLE

#define VectorIntCompareLE ( A,
B )   VectorIntNot(VectorIntCompareGT(A,B))

Definition at line 1159 of file UnrealMathDirectX.h.

◆ VectorIntCompareLT

#define VectorIntCompareLT ( A,
B )   _mm_cmplt_epi32(A,B)

Definition at line 1157 of file UnrealMathDirectX.h.

◆ VectorIntCompareNEQ

#define VectorIntCompareNEQ ( A,
B )   VectorIntNot(_mm_cmpeq_epi32(A,B))

Definition at line 1155 of file UnrealMathDirectX.h.

◆ VectorIntLoad

#define VectorIntLoad ( Ptr)    _mm_loadu_si128( (VectorRegister4Int*)(Ptr) )

Loads 4 int32s from unaligned memory.

Parameters
PtrUnaligned memory pointer to the 4 int32s
Returns
VectorRegister4Int(Ptr[0], Ptr[1], Ptr[2], Ptr[3])

Definition at line 1225 of file UnrealMathDirectX.h.

◆ VectorIntLoad1

#define VectorIntLoad1 ( Ptr)    _mm_shuffle_epi32(_mm_loadu_si128((VectorRegister4Int*)(Ptr)),_MM_SHUFFLE(0,0,0,0))

Loads 1 int32 from unaligned memory into all components of a vector register.

Parameters
PtrUnaligned memory pointer to the 4 int32s
Returns
VectorRegister4Int(*Ptr, *Ptr, *Ptr, *Ptr)

Definition at line 1249 of file UnrealMathDirectX.h.

◆ VectorIntLoadAligned

#define VectorIntLoadAligned ( Ptr)    _mm_load_si128( (VectorRegister4Int*)(Ptr) )

Loads 4 int32s from aligned memory.

Parameters
PtrAligned memory pointer to the 4 int32s
Returns
VectorRegister4Int(Ptr[0], Ptr[1], Ptr[2], Ptr[3])

Definition at line 1241 of file UnrealMathDirectX.h.

◆ VectorIntNegate

Definition at line 1179 of file UnrealMathDirectX.h.

◆ VectorIntNot

= ~a

Definition at line 1151 of file UnrealMathDirectX.h.

◆ VectorIntOr

#define VectorIntOr ( A,
B )   _mm_or_si128(A, B)

= a | b

Definition at line 1145 of file UnrealMathDirectX.h.

◆ VectorIntSign

◆ VectorIntStore

#define VectorIntStore ( Vec,
Ptr )   _mm_storeu_si128( (VectorRegister4Int*)(Ptr), Vec )

Stores a vector to memory (aligned or unaligned).

Parameters
VecVector to store
PtrMemory pointer

Definition at line 1217 of file UnrealMathDirectX.h.

◆ VectorIntStoreAligned

#define VectorIntStoreAligned ( Vec,
Ptr )   _mm_store_si128( (VectorRegister4Int*)(Ptr), Vec )

Stores a vector to memory (aligned).

Parameters
VecVector to store
PtrAligned Memory pointer

Definition at line 1233 of file UnrealMathDirectX.h.

◆ VectorIntSubtract

#define VectorIntSubtract ( A,
B )   _mm_sub_epi32(A, B)

Definition at line 1169 of file UnrealMathDirectX.h.

◆ VectorIntToFloat

#define VectorIntToFloat ( A)    _mm_cvtepi32_ps(A)

Definition at line 1201 of file UnrealMathDirectX.h.

◆ VectorIntXor

#define VectorIntXor ( A,
B )   _mm_xor_si128(A, B)

= a ^ b

Definition at line 1147 of file UnrealMathDirectX.h.

◆ VectorLoad

#define VectorLoad ( Ptr)    DirectX::XMLoadFloat4( (const DirectX::XMFLOAT4*)(Ptr) )

Loads 4 FLOATs from unaligned memory.

Parameters
PtrUnaligned memory pointer to the 4 FLOATs
Returns
VectorRegister(Ptr[0], Ptr[1], Ptr[2], Ptr[3])

Definition at line 125 of file UnrealMathDirectX.h.

◆ VectorLoadAligned

#define VectorLoadAligned ( Ptr)    DirectX::XMLoadFloat4A( (const DirectX::XMFLOAT4A*)(Ptr) )

Loads 4 FLOATs from aligned memory.

Parameters
PtrAligned memory pointer to the 4 FLOATs
Returns
VectorRegister(Ptr[0], Ptr[1], Ptr[2], Ptr[3])

Definition at line 159 of file UnrealMathDirectX.h.

◆ VectorLoadByte4

Loads 4 BYTEs from unaligned memory and converts them into 4 FLOATs. IMPORTANT: You need to call VectorResetFloatRegisters() before using scalar FLOATs after you've used this intrinsic!

Parameters
PtrUnaligned memory pointer to the 4 BYTEs.
Returns
VectorRegister( float(Ptr[0]), float(Ptr[1]), float(Ptr[2]), float(Ptr[3]) )

Definition at line 736 of file UnrealMathDirectX.h.

◆ VectorLoadFloat1

#define VectorLoadFloat1 ( Ptr)    DirectX::XMVectorReplicatePtr( (const float*)(Ptr) )

Loads 1 float from unaligned memory and replicates it to all 4 elements.

Parameters
PtrUnaligned memory pointer to the float
Returns
VectorRegister(Ptr[0], Ptr[0], Ptr[0], Ptr[0])

Definition at line 167 of file UnrealMathDirectX.h.

◆ VectorLoadFloat2

#define VectorLoadFloat2 ( Ptr)    MakeVectorRegister( ((const float*)(Ptr))[0], ((const float*)(Ptr))[1], ((const float*)(Ptr))[0], ((const float*)(Ptr))[1] )

Loads 2 floats from unaligned memory into X and Y and duplicates them in Z and W.

Parameters
PtrUnaligned memory pointer to the floats
Returns
VectorRegister(Ptr[0], Ptr[1], Ptr[0], Ptr[1])

Definition at line 175 of file UnrealMathDirectX.h.

◆ VectorLoadFloat3

#define VectorLoadFloat3 ( Ptr)    MakeVectorRegister( ((const float*)(Ptr))[0], ((const float*)(Ptr))[1], ((const float*)(Ptr))[2], 0.0f )

Loads 3 FLOATs from unaligned memory and leaves W undefined.

Parameters
PtrUnaligned memory pointer to the 3 FLOATs
Returns
VectorRegister(Ptr[0], Ptr[1], Ptr[2], undefined)

Definition at line 133 of file UnrealMathDirectX.h.

◆ VectorLoadFloat3_W0

#define VectorLoadFloat3_W0 ( Ptr)    MakeVectorRegister( ((const float*)(Ptr))[0], ((const float*)(Ptr))[1], ((const float*)(Ptr))[2], 0.0f )

Loads 3 FLOATs from unaligned memory and sets W=0.

Parameters
PtrUnaligned memory pointer to the 3 FLOATs
Returns
VectorRegister(Ptr[0], Ptr[1], Ptr[2], 0.0f)

Definition at line 142 of file UnrealMathDirectX.h.

◆ VectorLoadFloat3_W1

#define VectorLoadFloat3_W1 ( Ptr)    MakeVectorRegister( ((const float*)(Ptr))[0], ((const float*)(Ptr))[1], ((const float*)(Ptr))[2], 1.0f )

Loads 3 FLOATs from unaligned memory and sets W=1.

Parameters
PtrUnaligned memory pointer to the 3 FLOATs
Returns
VectorRegister(Ptr[0], Ptr[1], Ptr[2], 1.0f)

Definition at line 151 of file UnrealMathDirectX.h.

◆ VectorLoadSignedByte4

#define VectorLoadSignedByte4 ( Ptr)    DirectX::PackedVector::XMLoadByte4((const DirectX::PackedVector::XMBYTE4*)(Ptr) )

Loads 4 signed BYTEs from unaligned memory and converts them into 4 FLOATs. IMPORTANT: You need to call VectorResetFloatRegisters() before using scalar FLOATs after you've used this intrinsic!

Parameters
PtrUnaligned memory pointer to the 4 BYTEs.
Returns
VectorRegister( float(Ptr[0]), float(Ptr[1]), float(Ptr[2]), float(Ptr[3]) )

Definition at line 745 of file UnrealMathDirectX.h.

◆ VectorLoadSRGBA16N

Loads packed RGBA16(4 bytes) from unaligned memory and converts them into 4 FLOATs. IMPORTANT: You need to call VectorResetFloatRegisters() before using scalar FLOATs after you've used this intrinsic!

Parameters
PtrUnaligned memory pointer to the RGBA16(8 bytes).
Returns
VectorRegister with 4 FLOATs loaded from Ptr.

Definition at line 812 of file UnrealMathDirectX.h.

◆ VectorLoadURGB10A2N

Loads packed RGB10A2(4 bytes) from unaligned memory and converts them into 4 FLOATs. IMPORTANT: You need to call VectorResetFloatRegisters() before using scalar FLOATs after you've used this intrinsic!

Parameters
PtrUnaligned memory pointer to the RGB10A2(4 bytes).
Returns
VectorRegister with 4 FLOATs loaded from Ptr.

Definition at line 785 of file UnrealMathDirectX.h.

◆ VectorLoadURGBA16N

Loads packed RGBA16(4 bytes) from unaligned memory and converts them into 4 FLOATs. IMPORTANT: You need to call VectorResetFloatRegisters() before using scalar FLOATs after you've used this intrinsic!

Parameters
PtrUnaligned memory pointer to the RGBA16(8 bytes).
Returns
VectorRegister with 4 FLOATs loaded from Ptr.

Definition at line 803 of file UnrealMathDirectX.h.

◆ VectorMask_EQ

#define VectorMask_EQ ( Vec1,
Vec2 )   DirectX::XMVectorEqual( Vec1, Vec2 )

Definition at line 713 of file UnrealMathDirectX.h.

◆ VectorMask_GE

#define VectorMask_GE ( Vec1,
Vec2 )   DirectX::XMVectorGreaterOrEqual( Vec1, Vec2 )

Definition at line 712 of file UnrealMathDirectX.h.

◆ VectorMask_GT

#define VectorMask_GT ( Vec1,
Vec2 )   DirectX::XMVectorGreater( Vec1, Vec2 )

Definition at line 711 of file UnrealMathDirectX.h.

◆ VectorMask_LE

#define VectorMask_LE ( Vec1,
Vec2 )   _mm_cmple_ps( Vec1, Vec2 )

Definition at line 710 of file UnrealMathDirectX.h.

◆ VectorMask_LT

#define VectorMask_LT ( Vec1,
Vec2 )   _mm_cmplt_ps( Vec1, Vec2 )

These functions return a vector mask to indicate which components pass the comparison. Each component is 0xffffffff if it passes, 0x00000000 if it fails.

Parameters
Vec11st source vector
Vec22nd source vector
Returns
Vector with a mask for each component.

Definition at line 709 of file UnrealMathDirectX.h.

◆ VectorMask_NE

#define VectorMask_NE ( Vec1,
Vec2 )   DirectX::XMVectorNotEqual( Vec1, Vec2 )

Definition at line 714 of file UnrealMathDirectX.h.

◆ VectorMaskBits

#define VectorMaskBits ( VecMask)    _mm_movemask_ps( VecMask )

Returns an integer bit-mask (0x00 - 0x0f) based on the sign-bit for each component in a vector.

Parameters
VecMaskVector
Returns
Bit 0 = sign(VecMask.x), Bit 1 = sign(VecMask.y), Bit 2 = sign(VecMask.z), Bit 3 = sign(VecMask.w)

Definition at line 487 of file UnrealMathDirectX.h.

◆ VectorMax

#define VectorMax ( Vec1,
Vec2 )   DirectX::XMVectorMax( Vec1, Vec2 )

Returns the maximum values of two vectors (component-wise).

Parameters
Vec11st vector
Vec22nd vector
Returns
VectorRegister( max(Vec1.x,Vec2.x), max(Vec1.y,Vec2.y), max(Vec1.z,Vec2.z), max(Vec1.w,Vec2.w) )

Definition at line 634 of file UnrealMathDirectX.h.

◆ VectorMin

#define VectorMin ( Vec1,
Vec2 )   DirectX::XMVectorMin( Vec1, Vec2 )

Returns the minimum values of two vectors (component-wise).

Parameters
Vec11st vector
Vec22nd vector
Returns
VectorRegister( min(Vec1.x,Vec2.x), min(Vec1.y,Vec2.y), min(Vec1.z,Vec2.z), min(Vec1.w,Vec2.w) )

Definition at line 625 of file UnrealMathDirectX.h.

◆ VectorMultiply

#define VectorMultiply ( Vec1,
Vec2 )   DirectX::XMVectorMultiply( Vec1, Vec2 )

Multiplies two vectors (component-wise) and returns the result.

Parameters
Vec11st vector
Vec22nd vector
Returns
VectorRegister( Vec1.x*Vec2.x, Vec1.y*Vec2.y, Vec1.z*Vec2.z, Vec1.w*Vec2.w )

Definition at line 338 of file UnrealMathDirectX.h.

◆ VectorMultiplyAdd

#define VectorMultiplyAdd ( Vec1,
Vec2,
Vec3 )   DirectX::XMVectorMultiplyAdd( Vec1, Vec2, Vec3 )

Multiplies two vectors (component-wise), adds in the third vector and returns the result.

Parameters
Vec11st vector
Vec22nd vector
Vec33rd vector
Returns
VectorRegister( Vec1.x*Vec2.x + Vec3.x, Vec1.y*Vec2.y + Vec3.y, Vec1.z*Vec2.z + Vec3.z, Vec1.w*Vec2.w + Vec3.w )

Definition at line 357 of file UnrealMathDirectX.h.

◆ VectorNegate

#define VectorNegate ( Vec)    DirectX::XMVectorNegate( Vec )

Returns the negated value (component-wise).

Parameters
VecSource vector
Returns
VectorRegister( -Vec.x, -Vec.y, -Vec.z, -Vec.w )

Definition at line 311 of file UnrealMathDirectX.h.

◆ VectorNegateMultiplyAdd

#define VectorNegateMultiplyAdd ( Vec1,
Vec2,
Vec3 )   DirectX::XMVectorNegativeMultiplySubtract( Vec1, Vec2, Vec3 )

Multiplies two vectors (component-wise), negates the results and adds it to the third vector i.e. -AB + C = C - AB

Parameters
Vec11st vector
Vec22nd vector
Vec33rd vector
Returns
VectorRegister( Vec3.x - Vec1.x*Vec2.x, Vec3.y - Vec1.y*Vec2.y, Vec3.z - Vec1.z*Vec2.z, Vec3.w - Vec1.w*Vec2.w )

Definition at line 367 of file UnrealMathDirectX.h.

◆ VectorNormalize

#define VectorNormalize ( Vec)    DirectX::XMVector4NormalizeEst( Vec )

Normalize vector

Parameters
VectorVector to normalize
Returns
Normalized VectorRegister

Definition at line 556 of file UnrealMathDirectX.h.

◆ VectorOne

#define VectorOne ( void)    DirectX::g_XMOne.v

Returns a vector with all ones.

Returns
VectorRegister(1.0f, 1.0f, 1.0f, 1.0f)

Definition at line 117 of file UnrealMathDirectX.h.

◆ VectorPow

#define VectorPow ( Vec1,
Vec2 )   DirectX::XMVectorPow( Vec1, Vec2 )

Calculates x raised to the power of y (component-wise).

Parameters
BaseBase vector
ExponentExponent vector
Returns
VectorRegister( Base.x^Exponent.x, Base.y^Exponent.y, Base.z^Exponent.z, Base.w^Exponent.w )

Definition at line 507 of file UnrealMathDirectX.h.

◆ VectorReciprocal

#define VectorReciprocal ( Vec)    DirectX::XMVectorReciprocalEst( Vec )

Computes an estimate of the reciprocal of a vector (component-wise) and returns the result.

Parameters
Vec1st vector
Returns
VectorRegister( (Estimate) 1.0f / Vec.x, (Estimate) 1.0f / Vec.y, (Estimate) 1.0f / Vec.z, (Estimate) 1.0f / Vec.w )

Definition at line 524 of file UnrealMathDirectX.h.

◆ VectorReciprocalAccurate

#define VectorReciprocalAccurate ( Vec)    DirectX::XMVectorReciprocal( Vec )

Computes the reciprocal of a vector (component-wise) and returns the result.

Parameters
Vec1st vector
Returns
VectorRegister( 1.0f / Vec.x, 1.0f / Vec.y, 1.0f / Vec.z, 1.0f / Vec.w )

Definition at line 548 of file UnrealMathDirectX.h.

◆ VectorReciprocalLen

#define VectorReciprocalLen ( Vec)    DirectX::XMVector4ReciprocalLengthEst( Vec )

Return Reciprocal Length of the vector

Parameters
VectorVector
Returns
VectorRegister(rlen, rlen, rlen, rlen) when rlen = 1/sqrt(dot4(V))

Definition at line 532 of file UnrealMathDirectX.h.

◆ VectorReciprocalSqrt

#define VectorReciprocalSqrt ( Vec)    DirectX::XMVectorReciprocalSqrtEst( Vec )

Returns an estimate of 1/sqrt(c) for each component of the vector

Parameters
VectorVector
Returns
VectorRegister(1/sqrt(t), 1/sqrt(t), 1/sqrt(t), 1/sqrt(t))

Definition at line 516 of file UnrealMathDirectX.h.

◆ VectorReciprocalSqrtAccurate

#define VectorReciprocalSqrtAccurate ( Vec)    DirectX::XMVectorReciprocalSqrt( Vec )

Return the reciprocal of the square root of each component

Parameters
VectorVector
Returns
VectorRegister(1/sqrt(Vec.X), 1/sqrt(Vec.Y), 1/sqrt(Vec.Z), 1/sqrt(Vec.W))

Definition at line 540 of file UnrealMathDirectX.h.

◆ VectorReplicate

#define VectorReplicate ( Vec,
ElementIndex )   DirectX::XMVectorSwizzle<ElementIndex,ElementIndex,ElementIndex,ElementIndex>(Vec)

Replicates one element into all four elements and returns the new vector.

Parameters
VecSource vector
ElementIndexIndex (0-3) of the element to replicate
Returns
VectorRegister( Vec[ElementIndex], Vec[ElementIndex], Vec[ElementIndex], Vec[ElementIndex] )

Definition at line 295 of file UnrealMathDirectX.h.

◆ VectorResetFloatRegisters

#define VectorResetFloatRegisters ( )

Resets the floating point registers so that they can be used again. Some intrinsics use these for MMX purposes (e.g. VectorLoadByte4 and VectorStoreByte4).

Definition at line 845 of file UnrealMathDirectX.h.

◆ VectorSelect

#define VectorSelect ( Mask,
Vec1,
Vec2 )   DirectX::XMVectorSelect( Vec2, Vec1, Mask )

Does a bitwise vector selection based on a mask (e.g., created from VectorCompareXX)

Parameters
MaskMask (when 1: use the corresponding bit from Vec1 otherwise from Vec2)
Vec11st vector
Vec22nd vector
Returns
VectorRegister( for each bit i: Mask[i] ? Vec1[i] : Vec2[i] )

Definition at line 452 of file UnrealMathDirectX.h.

◆ VectorSet

#define VectorSet ( X,
Y,
Z,
W )   MakeVectorRegister( X, Y, Z, W )

Creates a vector out of four FLOATs.

Parameters
X1st float component
Y2nd float component
Z3rd float component
W4th float component
Returns
VectorRegister(X, Y, Z, W)

Definition at line 220 of file UnrealMathDirectX.h.

◆ VectorSet_W0

Loads XYZ and sets W=0

Parameters
VectorVectorRegister
Returns
VectorRegister(X, Y, Z, 0.0f)

Definition at line 564 of file UnrealMathDirectX.h.

◆ VectorSet_W1

#define VectorSet_W1 ( Vec)    DirectX::XMVectorPermute<0,1,2,7>( Vec, VectorOne() )

Loads XYZ and sets W=1

Parameters
VectorVectorRegister
Returns
VectorRegister(X, Y, Z, 1.0f)

Definition at line 572 of file UnrealMathDirectX.h.

◆ VectorSetControlRegister

#define VectorSetControlRegister ( ControlStatus)    _mm_setcsr( ControlStatus )

Sets the control register.

Parameters
ControlStatusThe uint32 control status value to set

Definition at line 859 of file UnrealMathDirectX.h.

◆ VectorSetFloat1

#define VectorSetFloat1 ( X)    MakeVectorRegister( X, X, X, X )

Propagates passed in float to all registers

Parameters
Xfloat to replicate to all registers
Returns
VectorRegister(X, X, X, X)

Definition at line 209 of file UnrealMathDirectX.h.

◆ VectorSetFloat3

#define VectorSetFloat3 ( X,
Y,
Z )   MakeVectorRegister( X, Y, Z, 0.0f )

Creates a vector out of three FLOATs and leaves W undefined.

Parameters
X1st float component
Y2nd float component
Z3rd float component
Returns
VectorRegister(X, Y, Z, undefined)

Definition at line 201 of file UnrealMathDirectX.h.

◆ VectorShuffle

#define VectorShuffle ( Vec1,
Vec2,
X,
Y,
Z,
W )   DirectX::XMVectorPermute<X,Y,Z+4,W+4>( Vec1, Vec2 )

Creates a vector through selecting two components from each vector via a shuffle mask.

Parameters
Vec1Source vector1
Vec2Source vector2
XIndex for which component of Vector1 to use for X (literal 0-3)
YIndex for which component to Vector1 to use for Y (literal 0-3)
ZIndex for which component to Vector2 to use for Z (literal 0-3)
WIndex for which component to Vector2 to use for W (literal 0-3)
Returns
The swizzled vector

Definition at line 659 of file UnrealMathDirectX.h.

◆ VectorStore

#define VectorStore ( Vec,
Ptr )   DirectX::XMStoreFloat4((DirectX::XMFLOAT4*)(Ptr), Vec )

Stores a vector to memory (aligned or unaligned).

Parameters
VecVector to store
PtrMemory pointer

Definition at line 244 of file UnrealMathDirectX.h.

◆ VectorStoreAligned

#define VectorStoreAligned ( Vec,
Ptr )   DirectX::XMStoreFloat4A((DirectX::XMFLOAT4A*)(Ptr), Vec )

Stores a vector to aligned memory.

Parameters
VecVector to store
PtrAligned memory pointer

Definition at line 228 of file UnrealMathDirectX.h.

◆ VectorStoreAlignedStreamed

#define VectorStoreAlignedStreamed ( Vec,
Ptr )   XM_STREAM_PS( (float*)(Ptr), Vec )

Performs non-temporal store of a vector to aligned memory without polluting the caches

Parameters
VecVector to store
PtrAligned memory pointer

Definition at line 236 of file UnrealMathDirectX.h.

◆ VectorStoreByte4

Converts the 4 FLOATs in the vector to 4 BYTEs, clamped to [0,255], and stores to unaligned memory. IMPORTANT: You need to call VectorResetFloatRegisters() before using scalar FLOATs after you've used this intrinsic!

Parameters
VecVector containing 4 FLOATs
PtrUnaligned memory pointer to store the 4 BYTEs.

Definition at line 767 of file UnrealMathDirectX.h.

◆ VectorStoreFloat1

#define VectorStoreFloat1 ( Vec,
Ptr )   DirectX::XMStoreFloat((float*)(Ptr), Vec )

Stores the X component of a vector to unaligned memory.

Parameters
VecVector to store X
PtrUnaligned memory pointer

Definition at line 260 of file UnrealMathDirectX.h.

◆ VectorStoreFloat3

#define VectorStoreFloat3 ( Vec,
Ptr )   DirectX::XMStoreFloat3((DirectX::XMFLOAT3*)(Ptr), Vec )

Stores the XYZ components of a vector to unaligned memory.

Parameters
VecVector to store XYZ
PtrUnaligned memory pointer

Definition at line 252 of file UnrealMathDirectX.h.

◆ VectorStoreSignedByte4

#define VectorStoreSignedByte4 ( Vec,
Ptr )   DirectX::PackedVector::XMStoreByte4( (DirectX::PackedVector::XMBYTE4*)(Ptr), Vec )

Converts the 4 FLOATs in the vector to 4 BYTEs, clamped to [-127,127], and stores to unaligned memory. IMPORTANT: You need to call VectorResetFloatRegisters() before using scalar FLOATs after you've used this intrinsic!

Parameters
VecVector containing 4 FLOATs
PtrUnaligned memory pointer to store the 4 BYTEs.

Definition at line 776 of file UnrealMathDirectX.h.

◆ VectorStoreURGB10A2N

#define VectorStoreURGB10A2N ( Vec,
Ptr )   DirectX::PackedVector::XMStoreUDecN4( (const DirectX::PackedVector::XMUDECN4*)(Ptr), Vec )

Converts the 4 FLOATs in the vector RGB10A2, clamped to [0, 1023] and [0, 3], and stores to unaligned memory. IMPORTANT: You need to call VectorResetFloatRegisters() before using scalar FLOATs after you've used this intrinsic!

Parameters
VecVector containing 4 FLOATs
PtrUnaligned memory pointer to store the packed RGB10A2(4 bytes).

Definition at line 794 of file UnrealMathDirectX.h.

◆ VectorStoreURGBA16N

Converts the 4 FLOATs in the vector RGBA16, clamped to [0, 65535], and stores to unaligned memory. IMPORTANT: You need to call VectorResetFloatRegisters() before using scalar FLOATs after you've used this intrinsic!

Parameters
VecVector containing 4 FLOATs
PtrUnaligned memory pointer to store the packed RGBA16(8 bytes).

Definition at line 821 of file UnrealMathDirectX.h.

◆ VectorSubtract

#define VectorSubtract ( Vec1,
Vec2 )   DirectX::XMVectorSubtract( Vec1, Vec2 )

Subtracts a vector from another (component-wise) and returns the result.

Parameters
Vec11st vector
Vec22nd vector
Returns
VectorRegister( Vec1.x-Vec2.x, Vec1.y-Vec2.y, Vec1.z-Vec2.z, Vec1.w-Vec2.w )

Definition at line 329 of file UnrealMathDirectX.h.

◆ VectorSwizzle

#define VectorSwizzle ( Vec,
X,
Y,
Z,
W )   DirectX::XMVectorSwizzle<X,Y,Z,W>( Vec )

Swizzles the 4 components of a vector and returns the result.

Parameters
VecSource vector
XIndex for which component to use for X (literal 0-3)
YIndex for which component to use for Y (literal 0-3)
ZIndex for which component to use for Z (literal 0-3)
WIndex for which component to use for W (literal 0-3)
Returns
The swizzled vector

Definition at line 646 of file UnrealMathDirectX.h.

◆ VectorZero

#define VectorZero ( void)    DirectX::XMVectorZero()

Returns a vector with all zeros.

Returns
VectorRegister(0.0f, 0.0f, 0.0f, 0.0f)

Definition at line 110 of file UnrealMathDirectX.h.

Typedef Documentation

◆ VectorRegister

float4 vector register type, where the first float (X) is stored in the lowest 32 bits, and so on.

Definition at line 26 of file UnrealMathDirectX.h.

◆ VectorRegister4Int

typedef __m128i VectorRegister4Int

Definition at line 27 of file UnrealMathDirectX.h.

Function Documentation

◆ MakeVectorRegister() [1/2]

FORCEINLINE VectorRegister MakeVectorRegister ( float X,
float Y,
float Z,
float W )

Returns a vector based on 4 FLOATs.

Parameters
X1st float component
Y2nd float component
Z3rd float component
W4th float component
Returns
Vector of the 4 FLOATs

Definition at line 57 of file UnrealMathDirectX.h.

◆ MakeVectorRegister() [2/2]

FORCEINLINE VectorRegister MakeVectorRegister ( uint32 X,
uint32 Y,
uint32 Z,
uint32 W )

Returns a bitwise equivalent vector based on 4 DWORDs.

Parameters
X1st uint32 component
Y2nd uint32 component
Z3rd uint32 component
W4th uint32 component
Returns
Bitwise equivalent vector with 4 floats

Definition at line 42 of file UnrealMathDirectX.h.

◆ MakeVectorRegister2DoubleConstant()

FORCEINLINE constexpr VectorRegister2Double MakeVectorRegister2DoubleConstant ( double X,
double Y )
constexpr

Definition at line 89 of file UnrealMathDirectX.h.

◆ MakeVectorRegisterFloatConstant()

FORCEINLINE constexpr VectorRegister4Float MakeVectorRegisterFloatConstant ( float X,
float Y,
float Z,
float W )
constexpr

Definition at line 84 of file UnrealMathDirectX.h.

◆ MakeVectorRegisterInt()

FORCEINLINE VectorRegister4Int MakeVectorRegisterInt ( int32 X,
int32 Y,
int32 Z,
int32 W )

Returns a vector based on 4 int32.

Parameters
X1st int32 component
Y2nd int32 component
Z3rd int32 component
W4th int32 component
Returns
Vector of the 4 int32

Definition at line 71 of file UnrealMathDirectX.h.

◆ MakeVectorRegisterIntConstant()

FORCEINLINE constexpr VectorRegister4Int MakeVectorRegisterIntConstant ( int32 X,
int32 Y,
int32 Z,
int32 W )
constexpr

Definition at line 76 of file UnrealMathDirectX.h.

◆ VectorACos()

Definition at line 1075 of file UnrealMathDirectX.h.

◆ VectorAnyGreaterThan()

FORCEINLINE uint32 VectorAnyGreaterThan ( const VectorRegister & Vec1,
const VectorRegister & Vec2 )

Returns non-zero if any element in Vec1 is greater than the corresponding element in Vec2, otherwise 0.

Parameters
Vec11st source vector
Vec22nd source vector
Returns
Non-zero integer if (Vec1.x > Vec2.x) || (Vec1.y > Vec2.y) || (Vec1.z > Vec2.z) || (Vec1.w > Vec2.w)

Definition at line 830 of file UnrealMathDirectX.h.

+ Here is the caller graph for this function:

◆ VectorASin()

Definition at line 1070 of file UnrealMathDirectX.h.

◆ VectorATan()

Definition at line 1080 of file UnrealMathDirectX.h.

◆ VectorATan2()

Definition at line 1085 of file UnrealMathDirectX.h.

◆ VectorCeil()

Definition at line 1090 of file UnrealMathDirectX.h.

◆ VectorCombineHigh()

FORCEINLINE VectorRegister VectorCombineHigh ( const VectorRegister & Vec1,
const VectorRegister & Vec2 )

Creates a vector by combining two high components from each vector

Parameters
Vec1Source vector1
Vec2Source vector2
Returns
The combined vector

Definition at line 668 of file UnrealMathDirectX.h.

◆ VectorCombineLow()

FORCEINLINE VectorRegister VectorCombineLow ( const VectorRegister & Vec1,
const VectorRegister & Vec2 )

Creates a vector by combining two low components from each vector

Parameters
Vec1Source vector1
Vec2Source vector2
Returns
The combined vector

Definition at line 680 of file UnrealMathDirectX.h.

◆ VectorContainsNaNOrInfinite()

FORCEINLINE bool VectorContainsNaNOrInfinite ( const VectorRegister & Vec)

Definition at line 1021 of file UnrealMathDirectX.h.

◆ VectorCos()

Definition at line 1060 of file UnrealMathDirectX.h.

◆ VectorDeinterleave()

FORCEINLINE void VectorDeinterleave ( VectorRegister & OutEvens,
VectorRegister & OutOdds,
const VectorRegister & Lo,
const VectorRegister & Hi )

Deinterleaves the components of the two given vectors such that the even components are in one vector and the odds in another.

Parameters
Lo[Even0, Odd0, Even1, Odd1]
Hi[Even2, Odd2, Even3, Odd3]
OutEvens[Even0, Even1, Even2, Even3]
OutOdds[Odd0, Odd1, Odd2, Odd3]

Definition at line 694 of file UnrealMathDirectX.h.

◆ VectorExp()

Definition at line 1035 of file UnrealMathDirectX.h.

◆ VectorExp2()

Definition at line 1040 of file UnrealMathDirectX.h.

◆ VectorFloor()

Definition at line 1095 of file UnrealMathDirectX.h.

◆ VectorFractional()

Definition at line 1105 of file UnrealMathDirectX.h.

+ Here is the call graph for this function:

◆ VectorGetComponent()

FORCEINLINE float VectorGetComponent ( VectorRegister Vec,
uint32 ComponentIndex )

Returns an component from a vector.

Parameters
VecVector register
ComponentIndexWhich component to get, X=0, Y=1, Z=2, W=3
Returns
The component as a float

Definition at line 270 of file UnrealMathDirectX.h.

+ Here is the caller graph for this function:

◆ VectorIntAbs()

Definition at line 1193 of file UnrealMathDirectX.h.

+ Here is the call graph for this function:

◆ VectorIntMax()

Definition at line 1187 of file UnrealMathDirectX.h.

+ Here is the call graph for this function:

◆ VectorIntMin()

Definition at line 1181 of file UnrealMathDirectX.h.

+ Here is the call graph for this function:

◆ VectorIntMultiply()

Definition at line 1171 of file UnrealMathDirectX.h.

◆ VectorIntSelect()

Definition at line 1162 of file UnrealMathDirectX.h.

+ Here is the caller graph for this function:

◆ VectorLoadByte4Reverse()

FORCEINLINE VectorRegister VectorLoadByte4Reverse ( const uint8 * Ptr)

Loads 4 BYTEs from unaligned memory and converts them into 4 FLOATs in reversed order. IMPORTANT: You need to call VectorResetFloatRegisters() before using scalar FLOATs after you've used this intrinsic!

Parameters
PtrUnaligned memory pointer to the 4 BYTEs.
Returns
VectorRegister( float(Ptr[3]), float(Ptr[2]), float(Ptr[1]), float(Ptr[0]) )

Definition at line 754 of file UnrealMathDirectX.h.

◆ VectorLoadTwoPairsFloat()

FORCEINLINE VectorRegister VectorLoadTwoPairsFloat ( const float * Ptr1,
const float * Ptr2 )

Loads 4 unaligned floats - 2 from the first pointer, 2 from the second, and packs them in to 1 vector.

Parameters
Ptr1Unaligned memory pointer to the first 2 floats
Ptr2Unaligned memory pointer to the second 2 floats
Returns
VectorRegister(Ptr1[0], Ptr1[1], Ptr2[0], Ptr2[1])

Definition at line 185 of file UnrealMathDirectX.h.

◆ VectorLog()

Definition at line 1045 of file UnrealMathDirectX.h.

◆ VectorLog2()

Definition at line 1050 of file UnrealMathDirectX.h.

◆ VectorMatrixInverse()

FORCEINLINE void VectorMatrixInverse ( FMatrix * DstMatrix,
const FMatrix * SrcMatrix )

Calculate the inverse of an FMatrix.

Parameters
DstMatrixFMatrix pointer to where the result should be stored
SrcMatrixFMatrix pointer to the Matrix to be inversed

Definition at line 596 of file UnrealMathDirectX.h.

◆ VectorMatrixMultiply()

FORCEINLINE void VectorMatrixMultiply ( FMatrix * Result,
const FMatrix * Matrix1,
const FMatrix * Matrix2 )

Multiplies two 4x4 matrices.

Parameters
ResultPointer to where the result should be stored
Matrix1Pointer to the first matrix
Matrix2Pointer to the second matrix

Definition at line 581 of file UnrealMathDirectX.h.

◆ VectorMergeVecXYZ_VecW()

FORCEINLINE VectorRegister VectorMergeVecXYZ_VecW ( const VectorRegister & VecXYZ,
const VectorRegister & VecW )

Merges the XYZ components of one vector with the W component of another vector and returns the result.

Parameters
VecXYZSource vector for XYZ_
VecWSource register for ___W (note: the fourth component is used, not the first)
Returns
VectorRegister(VecXYZ.x, VecXYZ.y, VecXYZ.z, VecW.w)

Definition at line 723 of file UnrealMathDirectX.h.

◆ VectorMod()

Definition at line 1110 of file UnrealMathDirectX.h.

◆ VectorQuaternionMultiply() [1/2]

FORCEINLINE void VectorQuaternionMultiply ( FQuat * Result,
const FQuat * Quat1,
const FQuat * Quat2 )

Multiplies two quaternions; the order matters.

When composing quaternions: VectorQuaternionMultiply(C, A, B) will yield a quaternion C = A * B that logically first applies B then A to any subsequent transformation (right first, then left).

Parameters
ResultPointer to where the result Quat1 * Quat2 should be stored
Quat1Pointer to the first quaternion (must not be the destination)
Quat2Pointer to the second quaternion (must not be the destination)

Definition at line 899 of file UnrealMathDirectX.h.

+ Here is the call graph for this function:

◆ VectorQuaternionMultiply() [2/2]

FORCEINLINE void VectorQuaternionMultiply ( VectorRegister * VResult,
const VectorRegister * VQuat1,
const VectorRegister * VQuat2 )

Multiplies two quaternions; the order matters.

When composing quaternions: VectorQuaternionMultiply(C, A, B) will yield a quaternion C = A * B that logically first applies B then A to any subsequent transformation (right first, then left).

Parameters
ResultPointer to where the result Quat1 * Quat2 should be stored
Quat1Pointer to the first quaternion (must not be the destination)
Quat2Pointer to the second quaternion (must not be the destination)

Definition at line 918 of file UnrealMathDirectX.h.

+ Here is the call graph for this function:

◆ VectorQuaternionMultiply2()

FORCEINLINE VectorRegister VectorQuaternionMultiply2 ( const VectorRegister & Quat1,
const VectorRegister & Quat2 )

Multiplies two quaternions; the order matters.

Order matters when composing quaternions: C = VectorQuaternionMultiply2(A, B) will yield a quaternion C = A * B that logically first applies B then A to any subsequent transformation (right first, then left).

Parameters
Quat1Pointer to the first quaternion
Quat2Pointer to the second quaternion
Returns
Quat1 * Quat2

Definition at line 876 of file UnrealMathDirectX.h.

+ Here is the caller graph for this function:

◆ VectorQuaternionVector3InverseRotate()

FORCEINLINE void VectorQuaternionVector3InverseRotate ( FVector * Result,
const FVector * Vec,
const FQuat * Quat )

Definition at line 931 of file UnrealMathDirectX.h.

◆ VectorQuaternionVector3Rotate()

FORCEINLINE void VectorQuaternionVector3Rotate ( FVector * Result,
const FVector * Vec,
const FQuat * Quat )

Definition at line 923 of file UnrealMathDirectX.h.

◆ VectorRoundToIntHalfToEven()

FORCEINLINE VectorRegister4Int VectorRoundToIntHalfToEven ( const VectorRegister4Float & Vec)

Definition at line 1204 of file UnrealMathDirectX.h.

◆ VectorSign()

Definition at line 1119 of file UnrealMathDirectX.h.

+ Here is the call graph for this function:

◆ VectorSin()

Definition at line 1055 of file UnrealMathDirectX.h.

◆ VectorSinCos()

FORCEINLINE void VectorSinCos ( VectorRegister *RESTRICT VSinAngles,
VectorRegister *RESTRICT VCosAngles,
const VectorRegister *RESTRICT VAngles )

Computes the sine and cosine of each component of a Vector.

Parameters
VSinAnglesVectorRegister Pointer to where the Sin result should be stored
VCosAnglesVectorRegister Pointer to where the Cos result should be stored
VAnglesVectorRegister Pointer to the input angles

Definition at line 947 of file UnrealMathDirectX.h.

◆ VectorStep()

Definition at line 1129 of file UnrealMathDirectX.h.

+ Here is the call graph for this function:

◆ VectorTan()

Definition at line 1065 of file UnrealMathDirectX.h.

◆ VectorTransformVector()

FORCEINLINE VectorRegister VectorTransformVector ( const VectorRegister & VecP,
const FMatrix * MatrixM )

Calculate Homogeneous transform.

Parameters
VecPVectorRegister
MatrixMFMatrix pointer to the Matrix to apply transform
Returns
VectorRegister = VecP*MatrixM

Definition at line 611 of file UnrealMathDirectX.h.

◆ VectorTruncate()

Definition at line 1100 of file UnrealMathDirectX.h.

+ Here is the caller graph for this function: