Jolt Physics
A multi core friendly Game Physics Engine
Loading...
Searching...
No Matches
UVec4 Class Reference

#include <UVec4.h>

Public Types

using Type = { uint32 mData[4]
 

Public Member Functions

 UVec4 ()=default
 Constructor. More...
 
 UVec4 (const UVec4 &inRHS)=default
 
UVec4operator= (const UVec4 &inRHS)=default
 
JPH_INLINE UVec4 (Type inRHS)
 
JPH_INLINE UVec4 (uint32 inX, uint32 inY, uint32 inZ, uint32 inW)
 Create a vector from 4 integer components. More...
 
JPH_INLINE bool operator== (UVec4Arg inV2) const
 Comparison. More...
 
JPH_INLINE bool operator!= (UVec4Arg inV2) const
 
template<uint32 SwizzleX, uint32 SwizzleY, uint32 SwizzleZ, uint32 SwizzleW>
JPH_INLINE UVec4 Swizzle () const
 Swizzle the elements in inV. More...
 
JPH_INLINE uint32 GetX () const
 Get individual components. More...
 
JPH_INLINE uint32 GetY () const
 
JPH_INLINE uint32 GetZ () const
 
JPH_INLINE uint32 GetW () const
 
JPH_INLINE void SetX (uint32 inX)
 Set individual components. More...
 
JPH_INLINE void SetY (uint32 inY)
 
JPH_INLINE void SetZ (uint32 inZ)
 
JPH_INLINE void SetW (uint32 inW)
 
JPH_INLINE uint32 operator[] (uint inCoordinate) const
 Get component by index. More...
 
JPH_INLINE uint32operator[] (uint inCoordinate)
 
JPH_INLINE UVec4 operator* (UVec4Arg inV2) const
 Multiplies each of the 4 integer components with an integer (discards any overflow) More...
 
JPH_INLINE UVec4 operator+ (UVec4Arg inV2)
 Adds an integer value to all integer components (discards any overflow) More...
 
JPH_INLINE UVec4operator+= (UVec4Arg inV2)
 Add two integer vectors (component wise) More...
 
JPH_INLINE UVec4 SplatX () const
 Replicate the X component to all components. More...
 
JPH_INLINE UVec4 SplatY () const
 Replicate the Y component to all components. More...
 
JPH_INLINE UVec4 SplatZ () const
 Replicate the Z component to all components. More...
 
JPH_INLINE UVec4 SplatW () const
 Replicate the W component to all components. More...
 
JPH_INLINE Vec4 ToFloat () const
 Convert each component from an int to a float. More...
 
JPH_INLINE Vec4 ReinterpretAsFloat () const
 Reinterpret UVec4 as a Vec4 (doesn't change the bits) More...
 
JPH_INLINE void StoreInt4 (uint32 *outV) const
 Store 4 ints to memory. More...
 
JPH_INLINE void StoreInt4Aligned (uint32 *outV) const
 Store 4 ints to memory, aligned to 16 bytes. More...
 
JPH_INLINE bool TestAnyTrue () const
 Test if any of the components are true (true is when highest bit of component is set) More...
 
JPH_INLINE bool TestAnyXYZTrue () const
 Test if any of X, Y or Z components are true (true is when highest bit of component is set) More...
 
JPH_INLINE bool TestAllTrue () const
 Test if all components are true (true is when highest bit of component is set) More...
 
JPH_INLINE bool TestAllXYZTrue () const
 Test if X, Y and Z components are true (true is when highest bit of component is set) More...
 
JPH_INLINE int CountTrues () const
 Count the number of components that are true (true is when highest bit of component is set) More...
 
JPH_INLINE int GetTrues () const
 Store if X is true in bit 0, Y in bit 1, Z in bit 2 and W in bit 3 (true is when highest bit of component is set) More...
 
template<const uint Count>
JPH_INLINE UVec4 LogicalShiftLeft () const
 Shift all components by Count bits to the left (filling with zeros from the left) More...
 
template<const uint Count>
JPH_INLINE UVec4 LogicalShiftRight () const
 Shift all components by Count bits to the right (filling with zeros from the right) More...
 
template<const uint Count>
JPH_INLINE UVec4 ArithmeticShiftRight () const
 Shift all components by Count bits to the right (shifting in the value of the highest bit) More...
 
JPH_INLINE UVec4 Expand4Uint16Lo () const
 Takes the lower 4 16 bits and expands them to X, Y, Z and W. More...
 
JPH_INLINE UVec4 Expand4Uint16Hi () const
 Takes the upper 4 16 bits and expands them to X, Y, Z and W. More...
 
JPH_INLINE UVec4 Expand4Byte0 () const
 Takes byte 0 .. 3 and expands them to X, Y, Z and W. More...
 
JPH_INLINE UVec4 Expand4Byte4 () const
 Takes byte 4 .. 7 and expands them to X, Y, Z and W. More...
 
JPH_INLINE UVec4 Expand4Byte8 () const
 Takes byte 8 .. 11 and expands them to X, Y, Z and W. More...
 
JPH_INLINE UVec4 Expand4Byte12 () const
 Takes byte 12 .. 15 and expands them to X, Y, Z and W. More...
 
JPH_INLINE UVec4 ShiftComponents4Minus (int inCount) const
 Shift vector components by 4 - Count floats to the left, so if Count = 1 the resulting vector is (W, 0, 0, 0), when Count = 3 the resulting vector is (Y, Z, W, 0) More...
 
template<uint32 SwizzleX, uint32 SwizzleY, uint32 SwizzleZ, uint32 SwizzleW>
UVec4 Swizzle () const
 
template<const int Scale>
UVec4 sGatherInt4 (const uint32 *inBase, UVec4Arg inOffsets)
 
template<const uint Count>
UVec4 LogicalShiftLeft () const
 
template<const uint Count>
UVec4 LogicalShiftRight () const
 
template<const uint Count>
UVec4 ArithmeticShiftRight () const
 

Static Public Member Functions

static JPH_INLINE UVec4 sZero ()
 Vector with all zeros. More...
 
static JPH_INLINE UVec4 sReplicate (uint32 inV)
 Replicate int inV across all components. More...
 
static JPH_INLINE UVec4 sLoadInt (const uint32 *inV)
 Load 1 int from memory and place it in the X component, zeros Y, Z and W. More...
 
static JPH_INLINE UVec4 sLoadInt4 (const uint32 *inV)
 Load 4 ints from memory. More...
 
static JPH_INLINE UVec4 sLoadInt4Aligned (const uint32 *inV)
 Load 4 ints from memory, aligned to 16 bytes. More...
 
template<const int Scale>
static JPH_INLINE UVec4 sGatherInt4 (const uint32 *inBase, UVec4Arg inOffsets)
 Gather 4 ints from memory at inBase + inOffsets[i] * Scale. More...
 
static JPH_INLINE UVec4 sMin (UVec4Arg inV1, UVec4Arg inV2)
 Return the minimum value of each of the components. More...
 
static JPH_INLINE UVec4 sMax (UVec4Arg inV1, UVec4Arg inV2)
 Return the maximum of each of the components. More...
 
static JPH_INLINE UVec4 sEquals (UVec4Arg inV1, UVec4Arg inV2)
 Equals (component wise) More...
 
static JPH_INLINE UVec4 sSelect (UVec4Arg inV1, UVec4Arg inV2, UVec4Arg inControl)
 Component wise select, returns inV1 when highest bit of inControl = 0 and inV2 when highest bit of inControl = 1. More...
 
static JPH_INLINE UVec4 sOr (UVec4Arg inV1, UVec4Arg inV2)
 Logical or (component wise) More...
 
static JPH_INLINE UVec4 sXor (UVec4Arg inV1, UVec4Arg inV2)
 Logical xor (component wise) More...
 
static JPH_INLINE UVec4 sAnd (UVec4Arg inV1, UVec4Arg inV2)
 Logical and (component wise) More...
 
static JPH_INLINE UVec4 sNot (UVec4Arg inV1)
 Logical not (component wise) More...
 
static JPH_INLINE UVec4 sSort4True (UVec4Arg inValue, UVec4Arg inIndex)
 

Public Attributes

union {
   Type   mValue
 
   uint32   mU32 [4]
 
}; 
 

Friends

ostream & operator<< (ostream &inStream, UVec4Arg inV)
 To String. More...
 

Member Typedef Documentation

◆ Type

using UVec4::Type = { uint32 mData[4]

Constructor & Destructor Documentation

◆ UVec4() [1/4]

UVec4::UVec4 ( )
default

Constructor.

Intentionally not initialized for performance reasons

◆ UVec4() [2/4]

UVec4::UVec4 ( const UVec4 inRHS)
default

◆ UVec4() [3/4]

JPH_INLINE UVec4::UVec4 ( Type  inRHS)
inline

◆ UVec4() [4/4]

JPH_NAMESPACE_BEGIN UVec4::UVec4 ( uint32  inX,
uint32  inY,
uint32  inZ,
uint32  inW 
)

Create a vector from 4 integer components.

Member Function Documentation

◆ ArithmeticShiftRight() [1/2]

template<const uint Count>
JPH_INLINE UVec4 UVec4::ArithmeticShiftRight ( ) const

Shift all components by Count bits to the right (shifting in the value of the highest bit)

◆ ArithmeticShiftRight() [2/2]

template<const uint Count>
UVec4 UVec4::ArithmeticShiftRight ( ) const

◆ CountTrues()

int UVec4::CountTrues ( ) const

Count the number of components that are true (true is when highest bit of component is set)

◆ Expand4Byte0()

UVec4 UVec4::Expand4Byte0 ( ) const

Takes byte 0 .. 3 and expands them to X, Y, Z and W.

◆ Expand4Byte12()

UVec4 UVec4::Expand4Byte12 ( ) const

Takes byte 12 .. 15 and expands them to X, Y, Z and W.

◆ Expand4Byte4()

UVec4 UVec4::Expand4Byte4 ( ) const

Takes byte 4 .. 7 and expands them to X, Y, Z and W.

◆ Expand4Byte8()

UVec4 UVec4::Expand4Byte8 ( ) const

Takes byte 8 .. 11 and expands them to X, Y, Z and W.

◆ Expand4Uint16Hi()

UVec4 UVec4::Expand4Uint16Hi ( ) const

Takes the upper 4 16 bits and expands them to X, Y, Z and W.

◆ Expand4Uint16Lo()

UVec4 UVec4::Expand4Uint16Lo ( ) const

Takes the lower 4 16 bits and expands them to X, Y, Z and W.

◆ GetTrues()

int UVec4::GetTrues ( ) const

Store if X is true in bit 0, Y in bit 1, Z in bit 2 and W in bit 3 (true is when highest bit of component is set)

◆ GetW()

JPH_INLINE uint32 UVec4::GetW ( ) const
inline

◆ GetX()

JPH_INLINE uint32 UVec4::GetX ( ) const
inline

Get individual components.

◆ GetY()

JPH_INLINE uint32 UVec4::GetY ( ) const
inline

◆ GetZ()

JPH_INLINE uint32 UVec4::GetZ ( ) const
inline

◆ LogicalShiftLeft() [1/2]

template<const uint Count>
JPH_INLINE UVec4 UVec4::LogicalShiftLeft ( ) const

Shift all components by Count bits to the left (filling with zeros from the left)

◆ LogicalShiftLeft() [2/2]

template<const uint Count>
UVec4 UVec4::LogicalShiftLeft ( ) const

◆ LogicalShiftRight() [1/2]

template<const uint Count>
JPH_INLINE UVec4 UVec4::LogicalShiftRight ( ) const

Shift all components by Count bits to the right (filling with zeros from the right)

◆ LogicalShiftRight() [2/2]

template<const uint Count>
UVec4 UVec4::LogicalShiftRight ( ) const

◆ operator!=()

JPH_INLINE bool UVec4::operator!= ( UVec4Arg  inV2) const
inline

◆ operator*()

UVec4 UVec4::operator* ( UVec4Arg  inV2) const

Multiplies each of the 4 integer components with an integer (discards any overflow)

◆ operator+()

UVec4 UVec4::operator+ ( UVec4Arg  inV2)

Adds an integer value to all integer components (discards any overflow)

◆ operator+=()

UVec4 & UVec4::operator+= ( UVec4Arg  inV2)

Add two integer vectors (component wise)

◆ operator=()

UVec4 & UVec4::operator= ( const UVec4 inRHS)
default

◆ operator==()

bool UVec4::operator== ( UVec4Arg  inV2) const

Comparison.

◆ operator[]() [1/2]

JPH_INLINE uint32 & UVec4::operator[] ( uint  inCoordinate)
inline

◆ operator[]() [2/2]

JPH_INLINE uint32 UVec4::operator[] ( uint  inCoordinate) const
inline

Get component by index.

◆ ReinterpretAsFloat()

Vec4 UVec4::ReinterpretAsFloat ( ) const

Reinterpret UVec4 as a Vec4 (doesn't change the bits)

◆ sAnd()

UVec4 UVec4::sAnd ( UVec4Arg  inV1,
UVec4Arg  inV2 
)
static

Logical and (component wise)

◆ sEquals()

UVec4 UVec4::sEquals ( UVec4Arg  inV1,
UVec4Arg  inV2 
)
static

Equals (component wise)

◆ SetW()

JPH_INLINE void UVec4::SetW ( uint32  inW)
inline

◆ SetX()

JPH_INLINE void UVec4::SetX ( uint32  inX)
inline

Set individual components.

◆ SetY()

JPH_INLINE void UVec4::SetY ( uint32  inY)
inline

◆ SetZ()

JPH_INLINE void UVec4::SetZ ( uint32  inZ)
inline

◆ sGatherInt4() [1/2]

template<const int Scale>
static JPH_INLINE UVec4 UVec4::sGatherInt4 ( const uint32 inBase,
UVec4Arg  inOffsets 
)
static

Gather 4 ints from memory at inBase + inOffsets[i] * Scale.

◆ sGatherInt4() [2/2]

template<const int Scale>
UVec4 UVec4::sGatherInt4 ( const uint32 inBase,
UVec4Arg  inOffsets 
)

◆ ShiftComponents4Minus()

UVec4 UVec4::ShiftComponents4Minus ( int  inCount) const

Shift vector components by 4 - Count floats to the left, so if Count = 1 the resulting vector is (W, 0, 0, 0), when Count = 3 the resulting vector is (Y, Z, W, 0)

◆ sLoadInt()

UVec4 UVec4::sLoadInt ( const uint32 inV)
static

Load 1 int from memory and place it in the X component, zeros Y, Z and W.

◆ sLoadInt4()

UVec4 UVec4::sLoadInt4 ( const uint32 inV)
static

Load 4 ints from memory.

◆ sLoadInt4Aligned()

UVec4 UVec4::sLoadInt4Aligned ( const uint32 inV)
static

Load 4 ints from memory, aligned to 16 bytes.

◆ sMax()

UVec4 UVec4::sMax ( UVec4Arg  inV1,
UVec4Arg  inV2 
)
static

Return the maximum of each of the components.

◆ sMin()

UVec4 UVec4::sMin ( UVec4Arg  inV1,
UVec4Arg  inV2 
)
static

Return the minimum value of each of the components.

◆ sNot()

UVec4 UVec4::sNot ( UVec4Arg  inV1)
static

Logical not (component wise)

◆ sOr()

UVec4 UVec4::sOr ( UVec4Arg  inV1,
UVec4Arg  inV2 
)
static

Logical or (component wise)

◆ SplatW()

UVec4 UVec4::SplatW ( ) const

Replicate the W component to all components.

◆ SplatX()

UVec4 UVec4::SplatX ( ) const

Replicate the X component to all components.

◆ SplatY()

UVec4 UVec4::SplatY ( ) const

Replicate the Y component to all components.

◆ SplatZ()

UVec4 UVec4::SplatZ ( ) const

Replicate the Z component to all components.

◆ sReplicate()

UVec4 UVec4::sReplicate ( uint32  inV)
static

Replicate int inV across all components.

◆ sSelect()

UVec4 UVec4::sSelect ( UVec4Arg  inV1,
UVec4Arg  inV2,
UVec4Arg  inControl 
)
static

Component wise select, returns inV1 when highest bit of inControl = 0 and inV2 when highest bit of inControl = 1.

◆ sSort4True()

UVec4 UVec4::sSort4True ( UVec4Arg  inValue,
UVec4Arg  inIndex 
)
static

Sorts the elements in inIndex so that the values that correspond to trues in inValue are the first elements. The remaining elements will be set to inValue.w. I.e. if inValue = (true, false, true, false) and inIndex = (1, 2, 3, 4) the function returns (1, 3, 4, 4).

◆ StoreInt4()

void UVec4::StoreInt4 ( uint32 outV) const

Store 4 ints to memory.

◆ StoreInt4Aligned()

void UVec4::StoreInt4Aligned ( uint32 outV) const

Store 4 ints to memory, aligned to 16 bytes.

◆ Swizzle() [1/2]

template<uint32 SwizzleX, uint32 SwizzleY, uint32 SwizzleZ, uint32 SwizzleW>
JPH_INLINE UVec4 UVec4::Swizzle ( ) const

Swizzle the elements in inV.

◆ Swizzle() [2/2]

template<uint32 SwizzleX, uint32 SwizzleY, uint32 SwizzleZ, uint32 SwizzleW>
UVec4 UVec4::Swizzle ( ) const

◆ sXor()

UVec4 UVec4::sXor ( UVec4Arg  inV1,
UVec4Arg  inV2 
)
static

Logical xor (component wise)

◆ sZero()

UVec4 UVec4::sZero ( )
static

Vector with all zeros.

◆ TestAllTrue()

bool UVec4::TestAllTrue ( ) const

Test if all components are true (true is when highest bit of component is set)

◆ TestAllXYZTrue()

bool UVec4::TestAllXYZTrue ( ) const

Test if X, Y and Z components are true (true is when highest bit of component is set)

◆ TestAnyTrue()

bool UVec4::TestAnyTrue ( ) const

Test if any of the components are true (true is when highest bit of component is set)

◆ TestAnyXYZTrue()

bool UVec4::TestAnyXYZTrue ( ) const

Test if any of X, Y or Z components are true (true is when highest bit of component is set)

◆ ToFloat()

Vec4 UVec4::ToFloat ( ) const

Convert each component from an int to a float.

Friends And Related Function Documentation

◆ operator<<

ostream & operator<< ( ostream &  inStream,
UVec4Arg  inV 
)
friend

To String.

Member Data Documentation

◆ 

union { ... } UVec4::@13

◆ mU32

uint32 UVec4::mU32[4]

◆ mValue

Type UVec4::mValue

The documentation for this class was generated from the following files: