19#if defined(JPH_USE_SSE4_1)
20 mValue = _mm_blend_ps(inRHS.
mValue, _mm_set1_ps(inW), 8);
21#elif defined(JPH_USE_NEON)
24 for (
int i = 0; i < 3; i++)
32#if defined(JPH_USE_SSE)
33 mValue = _mm_set_ps(inW, inZ, inY, inX);
34#elif defined(JPH_USE_NEON)
37 mValue = vreinterpretq_f32_u32(vcombine_u32(xy, zw));
46template<u
int32 SwizzleX, u
int32 SwizzleY, u
int32 SwizzleZ, u
int32 SwizzleW>
49 static_assert(SwizzleX <= 3,
"SwizzleX template parameter out of range");
50 static_assert(SwizzleY <= 3,
"SwizzleY template parameter out of range");
51 static_assert(SwizzleZ <= 3,
"SwizzleZ template parameter out of range");
52 static_assert(SwizzleW <= 3,
"SwizzleW template parameter out of range");
54#if defined(JPH_USE_SSE)
55 return _mm_shuffle_ps(
mValue,
mValue, _MM_SHUFFLE(SwizzleW, SwizzleZ, SwizzleY, SwizzleX));
56#elif defined(JPH_USE_NEON)
57 return JPH_NEON_SHUFFLE_F32x4(
mValue,
mValue, SwizzleX, SwizzleY, SwizzleZ, SwizzleW);
65#if defined(JPH_USE_SSE)
66 return _mm_setzero_ps();
67#elif defined(JPH_USE_NEON)
68 return vdupq_n_f32(0);
70 return Vec4(0, 0, 0, 0);
76#if defined(JPH_USE_SSE)
77 return _mm_set1_ps(inV);
78#elif defined(JPH_USE_NEON)
79 return vdupq_n_f32(inV);
81 return Vec4(inV, inV, inV, inV);
92 return sReplicate(numeric_limits<float>::quiet_NaN());
97#if defined(JPH_USE_SSE)
98 return _mm_loadu_ps(&inV->
x);
99#elif defined(JPH_USE_NEON)
100 return vld1q_f32(&inV->
x);
102 return Vec4(inV->
x, inV->
y, inV->
z, inV->
w);
108#if defined(JPH_USE_SSE)
109 return _mm_load_ps(&inV->
x);
110#elif defined(JPH_USE_NEON)
111 return vld1q_f32(&inV->
x);
113 return Vec4(inV->
x, inV->
y, inV->
z, inV->
w);
117template <const
int Scale>
120#if defined(JPH_USE_SSE)
122 return _mm_i32gather_ps(inBase, inOffsets.
mValue, Scale);
124 const uint8 *base =
reinterpret_cast<const uint8 *
>(inBase);
125 Type x = _mm_load_ss(
reinterpret_cast<const float *
>(base + inOffsets.
GetX() * Scale));
126 Type y = _mm_load_ss(
reinterpret_cast<const float *
>(base + inOffsets.
GetY() * Scale));
127 Type xy = _mm_unpacklo_ps(x, y);
128 Type z = _mm_load_ss(
reinterpret_cast<const float *
>(base + inOffsets.
GetZ() * Scale));
129 Type w = _mm_load_ss(
reinterpret_cast<const float *
>(base + inOffsets.
GetW() * Scale));
130 Type zw = _mm_unpacklo_ps(z, w);
131 return _mm_movelh_ps(xy, zw);
134 const uint8 *base =
reinterpret_cast<const uint8 *
>(inBase);
135 float x = *
reinterpret_cast<const float *
>(base + inOffsets.
GetX() * Scale);
136 float y = *
reinterpret_cast<const float *
>(base + inOffsets.
GetY() * Scale);
137 float z = *
reinterpret_cast<const float *
>(base + inOffsets.
GetZ() * Scale);
138 float w = *
reinterpret_cast<const float *
>(base + inOffsets.
GetW() * Scale);
139 return Vec4(x, y, z, w);
145#if defined(JPH_USE_SSE)
147#elif defined(JPH_USE_NEON)
159#if defined(JPH_USE_SSE)
161#elif defined(JPH_USE_NEON)
173 return sMax(
sMin(inV, inMax), inMin);
178#if defined(JPH_USE_SSE)
179 return _mm_castps_si128(_mm_cmpeq_ps(inV1.
mValue, inV2.
mValue));
180#elif defined(JPH_USE_NEON)
184 inV1.
mF32[1] == inV2.
mF32[1]? 0xffffffffu : 0,
185 inV1.
mF32[2] == inV2.
mF32[2]? 0xffffffffu : 0,
186 inV1.
mF32[3] == inV2.
mF32[3]? 0xffffffffu : 0);
192#if defined(JPH_USE_SSE)
193 return _mm_castps_si128(_mm_cmplt_ps(inV1.
mValue, inV2.
mValue));
194#elif defined(JPH_USE_NEON)
198 inV1.
mF32[1] < inV2.
mF32[1]? 0xffffffffu : 0,
199 inV1.
mF32[2] < inV2.
mF32[2]? 0xffffffffu : 0,
200 inV1.
mF32[3] < inV2.
mF32[3]? 0xffffffffu : 0);
206#if defined(JPH_USE_SSE)
207 return _mm_castps_si128(_mm_cmple_ps(inV1.
mValue, inV2.
mValue));
208#elif defined(JPH_USE_NEON)
212 inV1.
mF32[1] <= inV2.
mF32[1]? 0xffffffffu : 0,
213 inV1.
mF32[2] <= inV2.
mF32[2]? 0xffffffffu : 0,
214 inV1.
mF32[3] <= inV2.
mF32[3]? 0xffffffffu : 0);
220#if defined(JPH_USE_SSE)
221 return _mm_castps_si128(_mm_cmpgt_ps(inV1.
mValue, inV2.
mValue));
222#elif defined(JPH_USE_NEON)
226 inV1.
mF32[1] > inV2.
mF32[1]? 0xffffffffu : 0,
227 inV1.
mF32[2] > inV2.
mF32[2]? 0xffffffffu : 0,
228 inV1.
mF32[3] > inV2.
mF32[3]? 0xffffffffu : 0);
234#if defined(JPH_USE_SSE)
235 return _mm_castps_si128(_mm_cmpge_ps(inV1.
mValue, inV2.
mValue));
236#elif defined(JPH_USE_NEON)
240 inV1.
mF32[1] >= inV2.
mF32[1]? 0xffffffffu : 0,
241 inV1.
mF32[2] >= inV2.
mF32[2]? 0xffffffffu : 0,
242 inV1.
mF32[3] >= inV2.
mF32[3]? 0xffffffffu : 0);
248#if defined(JPH_USE_SSE)
254#elif defined(JPH_USE_NEON)
266#if defined(JPH_USE_SSE4_1) && !defined(JPH_PLATFORM_WASM)
267 return _mm_blendv_ps(inNotSet.
mValue, inSet.
mValue, _mm_castsi128_ps(inControl.
mValue));
268#elif defined(JPH_USE_SSE)
269 __m128 is_set = _mm_castsi128_ps(_mm_srai_epi32(inControl.
mValue, 31));
270 return _mm_or_ps(_mm_and_ps(is_set, inSet.
mValue), _mm_andnot_ps(is_set, inNotSet.
mValue));
271#elif defined(JPH_USE_NEON)
272 return vbslq_f32(vreinterpretq_u32_s32(vshrq_n_s32(vreinterpretq_s32_u32(inControl.
mValue), 31)), inSet.
mValue, inNotSet.
mValue);
275 for (
int i = 0; i < 4; i++)
276 result.
mF32[i] = (inControl.
mU32[i] & 0x80000000u) ? inSet.
mF32[i] : inNotSet.
mF32[i];
283#if defined(JPH_USE_SSE)
285#elif defined(JPH_USE_NEON)
286 return vreinterpretq_f32_u32(vorrq_u32(vreinterpretq_u32_f32(inV1.
mValue), vreinterpretq_u32_f32(inV2.
mValue)));
294#if defined(JPH_USE_SSE)
296#elif defined(JPH_USE_NEON)
297 return vreinterpretq_f32_u32(veorq_u32(vreinterpretq_u32_f32(inV1.
mValue), vreinterpretq_u32_f32(inV2.
mValue)));
305#if defined(JPH_USE_SSE)
307#elif defined(JPH_USE_NEON)
308 return vreinterpretq_f32_u32(vandq_u32(vreinterpretq_u32_f32(inV1.
mValue), vreinterpretq_u32_f32(inV2.
mValue)));
320 ioValue =
sSelect(ioValue, v1, c1);
327 ioValue =
sSelect(ioValue, v2, c2);
334 ioValue =
sSelect(ioValue, v3, c3);
344 ioValue =
sSelect(ioValue, v1, c1);
351 ioValue =
sSelect(ioValue, v2, c2);
358 ioValue =
sSelect(ioValue, v3, c3);
369 return (inV2 - *
this).LengthSq() <= inMaxDistSq;
379 return abs(
LengthSq() - 1.0f) <= inTolerance;
384#if defined(JPH_USE_AVX512)
385 return _mm_fpclass_ps_mask(
mValue, 0b10000001) != 0;
386#elif defined(JPH_USE_SSE)
387 return _mm_movemask_ps(_mm_cmpunord_ps(
mValue,
mValue)) != 0;
388#elif defined(JPH_USE_NEON)
390 return vaddvq_u32(vshrq_n_u32(is_equal, 31)) != 4;
392 return isnan(
mF32[0]) || isnan(
mF32[1]) || isnan(
mF32[2]) || isnan(
mF32[3]);
398#if defined(JPH_USE_SSE)
400#elif defined(JPH_USE_NEON)
412#if defined(JPH_USE_SSE)
413 return _mm_mul_ps(
mValue, _mm_set1_ps(inV2));
414#elif defined(JPH_USE_NEON)
415 return vmulq_n_f32(
mValue, inV2);
424#if defined(JPH_USE_SSE)
425 return _mm_mul_ps(_mm_set1_ps(inV1), inV2.
mValue);
426#elif defined(JPH_USE_NEON)
427 return vmulq_n_f32(inV2.
mValue, inV1);
432 inV1 * inV2.
mF32[3]);
438#if defined(JPH_USE_SSE)
439 return _mm_div_ps(
mValue, _mm_set1_ps(inV2));
440#elif defined(JPH_USE_NEON)
441 return vdivq_f32(
mValue, vdupq_n_f32(inV2));
449#if defined(JPH_USE_SSE)
451#elif defined(JPH_USE_NEON)
454 for (
int i = 0; i < 4; ++i)
462#if defined(JPH_USE_SSE)
464#elif defined(JPH_USE_NEON)
467 for (
int i = 0; i < 4; ++i)
475#if defined(JPH_USE_SSE)
477#elif defined(JPH_USE_NEON)
480 for (
int i = 0; i < 4; ++i)
488#if defined(JPH_USE_SSE)
490#elif defined(JPH_USE_NEON)
502#if defined(JPH_USE_SSE)
504#elif defined(JPH_USE_NEON)
507 for (
int i = 0; i < 4; ++i)
515#if defined(JPH_USE_SSE)
516 return _mm_sub_ps(_mm_setzero_ps(),
mValue);
517#elif defined(JPH_USE_NEON)
518 #ifdef JPH_CROSS_PLATFORM_DETERMINISTIC
519 return vsubq_f32(vdupq_n_f32(0),
mValue);
524 #ifdef JPH_CROSS_PLATFORM_DETERMINISTIC
534#if defined(JPH_USE_SSE)
536#elif defined(JPH_USE_NEON)
548#if defined(JPH_USE_SSE)
550#elif defined(JPH_USE_NEON)
553 for (
int i = 0; i < 4; ++i)
561#if defined(JPH_USE_SSE)
563#elif defined(JPH_USE_NEON)
575#if defined(JPH_USE_SSE)
576 return _mm_shuffle_ps(
mValue,
mValue, _MM_SHUFFLE(0, 0, 0, 0));
577#elif defined(JPH_USE_NEON)
578 return vdupq_laneq_f32(
mValue, 0);
586#if defined(JPH_USE_SSE)
587 return _mm_shuffle_ps(
mValue,
mValue, _MM_SHUFFLE(1, 1, 1, 1));
588#elif defined(JPH_USE_NEON)
589 return vdupq_laneq_f32(
mValue, 1);
597#if defined(JPH_USE_SSE)
598 return _mm_shuffle_ps(
mValue,
mValue, _MM_SHUFFLE(2, 2, 2, 2));
599#elif defined(JPH_USE_NEON)
600 return vdupq_laneq_f32(
mValue, 2);
608#if defined(JPH_USE_SSE)
609 return _mm_shuffle_ps(
mValue,
mValue, _MM_SHUFFLE(3, 3, 3, 3));
610#elif defined(JPH_USE_NEON)
611 return vdupq_laneq_f32(
mValue, 3);
619#if defined(JPH_USE_SSE)
620 return _mm_shuffle_ps(
mValue,
mValue, _MM_SHUFFLE(0, 0, 0, 0));
621#elif defined(JPH_USE_NEON)
622 return vdupq_laneq_f32(
mValue, 0);
630#if defined(JPH_USE_SSE)
631 return _mm_shuffle_ps(
mValue,
mValue, _MM_SHUFFLE(1, 1, 1, 1));
632#elif defined(JPH_USE_NEON)
633 return vdupq_laneq_f32(
mValue, 1);
641#if defined(JPH_USE_SSE)
642 return _mm_shuffle_ps(
mValue,
mValue, _MM_SHUFFLE(2, 2, 2, 2));
643#elif defined(JPH_USE_NEON)
644 return vdupq_laneq_f32(
mValue, 2);
652#if defined(JPH_USE_SSE)
653 return _mm_shuffle_ps(
mValue,
mValue, _MM_SHUFFLE(3, 3, 3, 3));
654#elif defined(JPH_USE_NEON)
655 return vdupq_laneq_f32(
mValue, 3);
683#if defined(JPH_USE_AVX512)
685#elif defined(JPH_USE_SSE)
686 return _mm_max_ps(_mm_sub_ps(_mm_setzero_ps(),
mValue),
mValue);
687#elif defined(JPH_USE_NEON)
701#if defined(JPH_USE_SSE4_1)
703#elif defined(JPH_USE_NEON)
705 return vdupq_n_f32(vaddvq_f32(mul));
714#if defined(JPH_USE_SSE4_1)
715 return _mm_cvtss_f32(_mm_dp_ps(
mValue, inV2.
mValue, 0xff));
716#elif defined(JPH_USE_NEON)
718 return vaddvq_f32(mul);
727#if defined(JPH_USE_SSE4_1)
729#elif defined(JPH_USE_NEON)
731 return vaddvq_f32(mul);
740#if defined(JPH_USE_SSE4_1)
741 return _mm_cvtss_f32(_mm_sqrt_ss(_mm_dp_ps(
mValue,
mValue, 0xff)));
742#elif defined(JPH_USE_NEON)
744 float32x2_t sum = vdup_n_f32(vaddvq_f32(mul));
745 return vget_lane_f32(vsqrt_f32(sum), 0);
754#if defined(JPH_USE_SSE)
755 return _mm_sqrt_ps(
mValue);
756#elif defined(JPH_USE_NEON)
757 return vsqrtq_f32(
mValue);
766#if defined(JPH_USE_AVX512)
767 return _mm_fixupimm_ps(
mValue,
mValue, _mm_set1_epi32(0xA9A90A00), 0);
768#elif defined(JPH_USE_SSE)
769 Type minus_one = _mm_set1_ps(-1.0f);
770 Type one = _mm_set1_ps(1.0f);
771 return _mm_or_ps(_mm_and_ps(
mValue, minus_one), one);
772#elif defined(JPH_USE_NEON)
773 Type minus_one = vdupq_n_f32(-1.0f);
774 Type one = vdupq_n_f32(1.0f);
775 return vreinterpretq_f32_u32(vorrq_u32(vandq_u32(vreinterpretq_u32_f32(
mValue), vreinterpretq_u32_f32(minus_one)), vreinterpretq_u32_f32(one)));
777 return Vec4(std::signbit(
mF32[0])? -1.0f : 1.0f,
778 std::signbit(
mF32[1])? -1.0f : 1.0f,
779 std::signbit(
mF32[2])? -1.0f : 1.0f,
780 std::signbit(
mF32[3])? -1.0f : 1.0f);
784template <
int X,
int Y,
int Z,
int W>
787 static_assert(X == 1 || X == -1,
"X must be 1 or -1");
788 static_assert(Y == 1 || Y == -1,
"Y must be 1 or -1");
789 static_assert(Z == 1 || Z == -1,
"Z must be 1 or -1");
790 static_assert(W == 1 || W == -1,
"W must be 1 or -1");
791 return Vec4::sXor(*
this,
Vec4(X > 0? 0.0f : -0.0f, Y > 0? 0.0f : -0.0f, Z > 0? 0.0f : -0.0f, W > 0? 0.0f : -0.0f));
796#if defined(JPH_USE_SSE4_1)
798#elif defined(JPH_USE_NEON)
800 float32x4_t sum = vdupq_n_f32(vaddvq_f32(mul));
801 return vdivq_f32(
mValue, vsqrtq_f32(sum));
809#if defined(JPH_USE_SSE)
810 _mm_storeu_ps(&outV->
x,
mValue);
811#elif defined(JPH_USE_NEON)
814 for (
int i = 0; i < 4; ++i)
815 (&outV->
x)[i] =
mF32[i];
821#if defined(JPH_USE_SSE)
822 return _mm_cvttps_epi32(
mValue);
823#elif defined(JPH_USE_NEON)
824 return vcvtq_u32_f32(
mValue);
832#if defined(JPH_USE_SSE)
834#elif defined(JPH_USE_NEON)
835 return vreinterpretq_u32_f32(
mValue);
837 return *
reinterpret_cast<const UVec4 *
>(
this);
843#if defined(JPH_USE_SSE)
844 return _mm_movemask_ps(
mValue);
845#elif defined(JPH_USE_NEON)
846 int32x4_t shift = JPH_NEON_INT32x4(0, 1, 2, 3);
847 return vaddvq_u32(vshlq_u32(vshrq_n_u32(vreinterpretq_u32_f32(
mValue), 31), shift));
849 return (std::signbit(
mF32[0])? 1 : 0) | (std::signbit(
mF32[1])? 2 : 0) | (std::signbit(
mF32[2])? 4 : 0) | (std::signbit(
mF32[3])? 8 : 0);
890 x = ((x - float_quadrant * 1.5703125f) - float_quadrant * 0.0004837512969970703125f) - float_quadrant * 7.549789948768648e-8f;
943 x = ((x - float_quadrant * 1.5703125f) - float_quadrant * 0.0004837512969970703125f) - float_quadrant * 7.549789948768648e-8f;
1053 Vec4 atan = (numerator / denominator).
ATan();
1072 constexpr float cOneOverSqrt2 = 0.70710678f;
1073 constexpr uint cNumBits = 9;
1074 constexpr uint cMask = (1 << cNumBits) - 1;
1080 if (v[max_element] < 0.0f)
1082 value = 0x80000000u;
1087 value |= max_element << 29;
1091 switch (max_element)
1106 value |= compressed.
GetX();
1107 value |= compressed.
GetY() << cNumBits;
1108 value |= compressed.
GetZ() << 2 * cNumBits;
1114 constexpr float cOneOverSqrt2 = 0.70710678f;
1115 constexpr uint cNumBits = 9;
1116 constexpr uint cMask = (1u << cNumBits) - 1;
1119 Vec4 v =
Vec4(
UVec4(inValue & cMask, (inValue >> cNumBits) & cMask, (inValue >> (2 * cNumBits)) & cMask, 0).ToFloat()) * (2.0f * cOneOverSqrt2 / float(cMask)) -
Vec4(cOneOverSqrt2, cOneOverSqrt2, cOneOverSqrt2, 0.0f);
1126 if ((inValue & 0x80000000u) != 0)
1130 switch ((inValue >> 29) & 3)
std::uint8_t uint8
Definition Core.h:493
std::uint64_t uint64
Definition Core.h:496
unsigned int uint
Definition Core.h:492
#define JPH_NAMESPACE_END
Definition Core.h:419
std::uint32_t uint32
Definition Core.h:495
#define JPH_IF_FLOATING_POINT_EXCEPTIONS_ENABLED(...)
Definition Core.h:560
#define JPH_NAMESPACE_BEGIN
Definition Core.h:413
#define JPH_ASSERT(...)
Definition IssueReporting.h:33
uint CountTrailingZeros(uint32 inValue)
Compute number of trailing zero bits (how many low bits are zero)
Definition Math.h:98
JPH_INLINE To BitCast(const From &inValue)
Definition Math.h:192
@ SWIZZLE_Z
Use the Z component.
Definition Swizzle.h:14
@ SWIZZLE_W
Use the W component.
Definition Swizzle.h:15
@ SWIZZLE_X
Use the X component.
Definition Swizzle.h:12
@ SWIZZLE_UNUSED
We always use the Z component when we don't specifically want to initialize a value,...
Definition Swizzle.h:16
@ SWIZZLE_Y
Use the Y component.
Definition Swizzle.h:13
Vec4 operator*(float inV1, Vec4Arg inV2)
Multiply vector with float.
Definition Vec4.inl:422
Class that holds 4 float values. Convert to Vec4 to perform calculations.
Definition Float4.h:11
float x
Definition Float4.h:26
float y
Definition Float4.h:27
float z
Definition Float4.h:28
float w
Definition Float4.h:29
JPH_INLINE UVec4 Swizzle() const
Swizzle the elements in inV.
JPH_INLINE uint32 GetZ() const
Definition UVec4.h:104
JPH_INLINE UVec4 LogicalShiftLeft() const
Shift all components by Count bits to the left (filling with zeros from the left)
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 ...
Definition UVec4.inl:157
JPH_INLINE uint32 GetY() const
Definition UVec4.h:103
static JPH_INLINE UVec4 sReplicate(uint32 inV)
Replicate int inV across all components.
Definition UVec4.inl:56
JPH_INLINE bool TestAllTrue() const
Test if all components are true (true is when highest bit of component is set)
Definition UVec4.inl:463
static JPH_INLINE UVec4 sAnd(UVec4Arg inV1, UVec4Arg inV2)
Logical and (component wise)
Definition UVec4.inl:202
static JPH_INLINE UVec4 sOr(UVec4Arg inV1, UVec4Arg inV2)
Logical or (component wise)
Definition UVec4.inl:174
JPH_INLINE uint32 GetW() const
Definition UVec4.h:105
Type mValue
Definition UVec4.h:223
JPH_INLINE uint32 GetX() const
Get individual components.
Definition UVec4.h:102
static JPH_INLINE UVec4 sXor(UVec4Arg inV1, UVec4Arg inV2)
Logical xor (component wise)
Definition UVec4.inl:188
JPH_INLINE UVec4 ArithmeticShiftRight() const
Shift all components by Count bits to the right (shifting in the value of the highest bit)
JPH_INLINE Vec4 ToFloat() const
Convert each component from an int to a float.
Definition UVec4.inl:356
JPH_INLINE Vec4 ReinterpretAsFloat() const
Reinterpret UVec4 as a Vec4 (doesn't change the bits)
Definition UVec4.inl:367
uint32 mU32[4]
Definition UVec4.h:224
Type mValue
Definition Vec3.h:299
float mF32[4]
Definition Vec3.h:300
JPH_INLINE bool IsNearZero(float inMaxDistSq=1.0e-12f) const
Test if vector is near zero.
Definition Vec4.inl:372
JPH_INLINE Vec4 SplatX() const
Replicate the X component to all components.
Definition Vec4.inl:573
static JPH_INLINE void sSort4(Vec4 &ioValue, UVec4 &ioIndex)
Definition Vec4.inl:314
Vec4 ATan() const
Calculate the arc tangent for each element of this vector (returns value in the range [-PI / 2,...
Definition Vec4.inl:1003
static JPH_INLINE UVec4 sGreater(Vec4Arg inV1, Vec4Arg inV2)
Greater than (component wise)
Definition Vec4.inl:218
float mF32[4]
Definition Vec4.h:312
JPH_INLINE Vec3 SplatW3() const
Replicate the W component to all components.
Definition Vec4.inl:650
JPH_INLINE Vec4 operator-() const
Negate.
Definition Vec4.inl:513
Vec4()=default
Constructor.
static JPH_INLINE Vec4 sAnd(Vec4Arg inV1, Vec4Arg inV2)
Logical and (component wise)
Definition Vec4.inl:303
static JPH_INLINE Vec4 sLoadFloat4Aligned(const Float4 *inV)
Load 4 floats from memory, 16 bytes aligned.
Definition Vec4.inl:106
static Vec4 sATan2(Vec4Arg inY, Vec4Arg inX)
Calculate the arc tangent of y / x using the signs of the arguments to determine the correct quadrant...
Definition Vec4.inl:1037
JPH_INLINE void SetW(float inW)
Definition Vec4.h:129
JPH_INLINE Vec4 GetSign() const
Get vector that contains the sign of each element (returns 1.0f if positive, -1.0f if negative)
Definition Vec4.inl:764
Vec4 ASin() const
Definition Vec4.inl:962
JPH_INLINE Vec4 FlipSign() const
Flips the signs of the components, e.g. FlipSign<-1, 1, -1, 1>() will flip the signs of the X and Z c...
Definition Vec4.inl:785
static JPH_INLINE Vec4 sXor(Vec4Arg inV1, Vec4Arg inV2)
Logical xor (component wise)
Definition Vec4.inl:292
JPH_INLINE Vec4 Abs() const
Return the absolute value of each of the components.
Definition Vec4.inl:681
JPH_INLINE Vec4 operator/(float inV2) const
Divide vector by float.
Definition Vec4.inl:436
Vec4 Tan() const
Calculate the tangent for each element of this vector (input in radians)
Definition Vec4.inl:929
JPH_INLINE float GetW() const
Definition Vec4.h:122
JPH_INLINE UVec4 ToInt() const
Convert each component from a float to an int.
Definition Vec4.inl:819
JPH_INLINE Vec4 & operator+=(Vec4Arg inV2)
Add two float vectors (component wise)
Definition Vec4.inl:500
static JPH_INLINE UVec4 sLessOrEqual(Vec4Arg inV1, Vec4Arg inV2)
Less than or equal (component wise)
Definition Vec4.inl:204
static JPH_INLINE UVec4 sLess(Vec4Arg inV1, Vec4Arg inV2)
Less than (component wise)
Definition Vec4.inl:190
JPH_INLINE int GetLowestComponentIndex() const
Get index of component with lowest value.
Definition Vec4.inl:661
JPH_INLINE float Length() const
Length of vector.
Definition Vec4.inl:738
static JPH_INLINE void sSort4Reverse(Vec4 &ioValue, UVec4 &ioIndex)
Definition Vec4.inl:338
static JPH_INLINE Vec4 sOne()
Vector with all ones.
Definition Vec4.inl:85
static JPH_INLINE Vec4 sFusedMultiplyAdd(Vec4Arg inMul1, Vec4Arg inMul2, Vec4Arg inAdd)
Calculates inMul1 * inMul2 + inAdd.
Definition Vec4.inl:246
JPH_INLINE Vec4 Normalized() const
Normalize vector.
Definition Vec4.inl:794
static JPH_INLINE UVec4 sEquals(Vec4Arg inV1, Vec4Arg inV2)
Equals (component wise)
Definition Vec4.inl:176
JPH_INLINE float ReduceMax() const
Get the maximum of X, Y, Z and W.
Definition Vec4.inl:860
JPH_INLINE Vec4 Reciprocal() const
Reciprocal vector (1 / value) for each of the components.
Definition Vec4.inl:694
JPH_INLINE Vec4 SplatY() const
Replicate the Y component to all components.
Definition Vec4.inl:584
JPH_INLINE UVec4 ReinterpretAsInt() const
Reinterpret Vec4 as a UVec4 (doesn't change the bits)
Definition Vec4.inl:830
static JPH_INLINE UVec4 sGreaterOrEqual(Vec4Arg inV1, Vec4Arg inV2)
Greater than or equal (component wise)
Definition Vec4.inl:232
static JPH_INLINE Vec4 sMin(Vec4Arg inV1, Vec4Arg inV2)
Return the minimum value of each of the components.
Definition Vec4.inl:143
JPH_INLINE Vec4 SplatZ() const
Replicate the Z component to all components.
Definition Vec4.inl:595
JPH_INLINE Vec4 Sqrt() const
Component wise square root.
Definition Vec4.inl:752
JPH_INLINE Vec4 & operator*=(float inV2)
Multiply vector with float.
Definition Vec4.inl:447
static JPH_INLINE Vec4 sGatherFloat4(const float *inBase, UVec4Arg inOffsets)
Gather 4 floats from memory at inBase + inOffsets[i] * Scale.
JPH_INLINE Vec4 operator+(Vec4Arg inV2) const
Add two float vectors (component wise)
Definition Vec4.inl:486
JPH_INLINE Vec4 & operator/=(float inV2)
Divide vector by float.
Definition Vec4.inl:473
JPH_INLINE bool IsNormalized(float inTolerance=1.0e-6f) const
Test if vector is normalized.
Definition Vec4.inl:377
JPH_INLINE bool operator==(Vec4Arg inV2) const
Comparison.
Definition Vec4.inl:362
JPH_INLINE Vec4 SplatW() const
Replicate the W component to all components.
Definition Vec4.inl:606
JPH_INLINE Vec4 DotV(Vec4Arg inV2) const
Dot product, returns the dot product in X, Y, Z and W components.
Definition Vec4.inl:699
JPH_INLINE bool IsClose(Vec4Arg inV2, float inMaxDistSq=1.0e-12f) const
Test if two vectors are close.
Definition Vec4.inl:367
JPH_INLINE float GetX() const
Get individual components.
Definition Vec4.h:119
static JPH_INLINE Vec4 sLoadFloat4(const Float4 *inV)
Load 4 floats from memory.
Definition Vec4.inl:95
static JPH_INLINE Vec4 sZero()
Vector with all zeros.
Definition Vec4.inl:63
JPH_INLINE Vec4 Swizzle() const
Swizzle the elements in inV.
struct { float mData[4];} Type
Definition Vec4.h:24
static JPH_INLINE Vec4 sOr(Vec4Arg inV1, Vec4Arg inV2)
Logical or (component wise)
Definition Vec4.inl:281
JPH_INLINE float ReduceMin() const
Get the minimum of X, Y, Z and W.
Definition Vec4.inl:853
Type mValue
Definition Vec4.h:311
static JPH_INLINE Vec4 sDecompressUnitVector(uint32 inValue)
Decompress a unit vector from a 32 bit value.
Definition Vec4.inl:1112
JPH_INLINE uint32 CompressUnitVector() const
Compress a unit vector to a 32 bit value, precision is around 0.5 * 10^-3.
Definition Vec4.inl:1070
JPH_INLINE Vec4 & operator-=(Vec4Arg inV2)
Subtract two float vectors (component wise)
Definition Vec4.inl:546
JPH_INLINE float LengthSq() const
Squared length of vector.
Definition Vec4.inl:725
static JPH_INLINE Vec4 sMax(Vec4Arg inV1, Vec4Arg inV2)
Return the maximum of each of the components.
Definition Vec4.inl:157
JPH_INLINE float Dot(Vec4Arg inV2) const
Dot product.
Definition Vec4.inl:712
JPH_INLINE Vec3 SplatZ3() const
Replicate the Z component to all components.
Definition Vec4.inl:639
JPH_INLINE bool IsNaN() const
Test if vector contains NaN elements.
Definition Vec4.inl:382
JPH_INLINE Vec3 SplatX3() const
Replicate the X component to all components.
Definition Vec4.inl:617
static JPH_INLINE Vec4 sNaN()
Vector with all NaN's.
Definition Vec4.inl:90
Vec4 ACos() const
Definition Vec4.inl:997
static JPH_INLINE Vec4 sSelect(Vec4Arg inNotSet, Vec4Arg inSet, UVec4Arg inControl)
Component wise select, returns inNotSet when highest bit of inControl = 0 and inSet when highest bit ...
Definition Vec4.inl:264
JPH_INLINE int GetSignBits() const
Store if X is negative in bit 0, Y in bit 1, Z in bit 2 and W in bit 3.
Definition Vec4.inl:841
JPH_INLINE int GetHighestComponentIndex() const
Get index of component with highest value.
Definition Vec4.inl:671
static JPH_INLINE Vec4 sReplicate(float inV)
Replicate inV across all components.
Definition Vec4.inl:74
JPH_INLINE Vec3 SplatY3() const
Replicate the Y component to all components.
Definition Vec4.inl:628
void SinCos(Vec4 &outSin, Vec4 &outCos) const
Calculate the sine and cosine for each element of this vector (input in radians)
Definition Vec4.inl:867
JPH_INLINE void StoreFloat4(Float4 *outV) const
Store 4 floats to memory.
Definition Vec4.inl:807
static JPH_INLINE Vec4 sClamp(Vec4Arg inV, Vec4Arg inMin, Vec4Arg inMax)
Clamp a vector between min and max (component wise)
Definition Vec4.inl:171
friend JPH_INLINE Vec4 operator*(float inV1, Vec4Arg inV2)
Multiply vector with float.
Definition Vec4.inl:422