![]() |
Jolt Physics
A multi core friendly Game Physics Engine
|
#include <UVec4.h>
Public Types | |
using | Type = { uint32 mData[4] |
Public Member Functions | |
UVec4 ()=default | |
Constructor. More... | |
UVec4 (const UVec4 &inRHS)=default | |
UVec4 & | operator= (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 uint32 & | operator[] (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 UVec4 & | operator+= (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 inNotSet, UVec4Arg inSet, UVec4Arg inControl) |
Component wise select, returns inNotSet when highest bit of inControl = 0 and inSet 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... | |
using UVec4::Type = { uint32 mData[4] |
|
default |
Constructor.
Intentionally not initialized for performance reasons
|
default |
|
inline |
JPH_NAMESPACE_BEGIN UVec4::UVec4 | ( | uint32 | inX, |
uint32 | inY, | ||
uint32 | inZ, | ||
uint32 | inW | ||
) |
Create a vector from 4 integer components.
Shift all components by Count bits to the right (shifting in the value of the highest bit)
int UVec4::CountTrues | ( | ) | const |
Count the number of components that are true (true is when highest bit of component is set)
UVec4 UVec4::Expand4Byte0 | ( | ) | const |
Takes byte 0 .. 3 and expands them to X, Y, Z and W.
UVec4 UVec4::Expand4Byte12 | ( | ) | const |
Takes byte 12 .. 15 and expands them to X, Y, Z and W.
UVec4 UVec4::Expand4Byte4 | ( | ) | const |
Takes byte 4 .. 7 and expands them to X, Y, Z and W.
UVec4 UVec4::Expand4Byte8 | ( | ) | const |
Takes byte 8 .. 11 and expands them to X, Y, Z and W.
UVec4 UVec4::Expand4Uint16Hi | ( | ) | const |
Takes the upper 4 16 bits and expands them to X, Y, Z and W.
UVec4 UVec4::Expand4Uint16Lo | ( | ) | const |
Takes the lower 4 16 bits and expands them to X, Y, Z and W.
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)
|
inline |
|
inline |
Get individual components.
|
inline |
|
inline |
Shift all components by Count bits to the left (filling with zeros from the left)
Shift all components by Count bits to the right (filling with zeros from the right)
|
inline |
Multiplies each of the 4 integer components with an integer (discards any overflow)
Adds an integer value to all integer components (discards any overflow)
bool UVec4::operator== | ( | UVec4Arg | inV2 | ) | const |
Comparison.
|
inline |
|
inline |
Set individual components.
|
inline |
|
inline |
|
static |
Gather 4 ints from memory at inBase + inOffsets[i] * Scale.
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)
Load 1 int from memory and place it in the X component, zeros Y, Z and W.
Load 4 ints from memory, aligned to 16 bytes.
Return the maximum of each of the components.
Return the minimum value of each of the components.
UVec4 UVec4::SplatW | ( | ) | const |
Replicate the W component to all components.
UVec4 UVec4::SplatX | ( | ) | const |
Replicate the X component to all components.
UVec4 UVec4::SplatY | ( | ) | const |
Replicate the Y component to all components.
UVec4 UVec4::SplatZ | ( | ) | const |
Replicate the Z component to all components.
Component wise select, returns inNotSet when highest bit of inControl = 0 and inSet when highest bit of inControl = 1.
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).
void UVec4::StoreInt4 | ( | uint32 * | outV | ) | const |
Store 4 ints to memory.
void UVec4::StoreInt4Aligned | ( | uint32 * | outV | ) | const |
Store 4 ints to memory, aligned to 16 bytes.
JPH_INLINE UVec4 UVec4::Swizzle | ( | ) | const |
Swizzle the elements in inV.
UVec4 UVec4::Swizzle | ( | ) | const |
bool UVec4::TestAllTrue | ( | ) | const |
Test if all components are true (true is when highest bit of component is set)
bool UVec4::TestAllXYZTrue | ( | ) | const |
Test if X, Y and Z components are true (true is when highest bit of component is set)
bool UVec4::TestAnyTrue | ( | ) | const |
Test if any of the components are true (true is when highest bit of component is set)
bool UVec4::TestAnyXYZTrue | ( | ) | const |
Test if any of X, Y or Z components are true (true is when highest bit of component is set)
Vec4 UVec4::ToFloat | ( | ) | const |
Convert each component from an int to a float.
|
friend |
To String.
union { ... } UVec4::@13 |
uint32 UVec4::mU32[4] |
Type UVec4::mValue |