18void Vec3::CheckW()
const
20#ifdef JPH_FLOATING_POINT_EXCEPTIONS_ENABLED
28#ifdef JPH_FLOATING_POINT_EXCEPTIONS_ENABLED
29 #if defined(JPH_USE_SSE)
31 #elif defined(JPH_USE_NEON)
47 mValue(sFixW(
inRHS.mValue))
53#if defined(JPH_USE_SSE)
59#elif defined(JPH_USE_NEON)
67 #ifdef JPH_FLOATING_POINT_EXCEPTIONS_ENABLED
75#if defined(JPH_USE_SSE)
77#elif defined(JPH_USE_NEON)
85 #ifdef JPH_FLOATING_POINT_EXCEPTIONS_ENABLED
91template<u
int32 SwizzleX, u
int32 SwizzleY, u
int32 SwizzleZ>
94 static_assert(
SwizzleX <= 3,
"SwizzleX template parameter out of range");
95 static_assert(
SwizzleY <= 3,
"SwizzleY template parameter out of range");
96 static_assert(
SwizzleZ <= 3,
"SwizzleZ template parameter out of range");
98#if defined(JPH_USE_SSE)
100#elif defined(JPH_USE_NEON)
109#if defined(JPH_USE_SSE)
111#elif defined(JPH_USE_NEON)
114 return Vec3(0, 0, 0);
120#if defined(JPH_USE_SSE)
122#elif defined(JPH_USE_NEON)
131 return sReplicate(numeric_limits<float>::quiet_NaN());
136#if defined(JPH_USE_SSE)
138#elif defined(JPH_USE_NEON)
148#if defined(JPH_USE_SSE)
150#elif defined(JPH_USE_NEON)
161#if defined(JPH_USE_SSE)
163#elif defined(JPH_USE_NEON)
179#if defined(JPH_USE_SSE)
181#elif defined(JPH_USE_NEON)
186 inV1.mF32[1] == inV2.
mF32[1]? 0xffffffffu : 0,
194#if defined(JPH_USE_SSE)
196#elif defined(JPH_USE_NEON)
201 inV1.mF32[1] < inV2.
mF32[1]? 0xffffffffu : 0,
209#if defined(JPH_USE_SSE)
211#elif defined(JPH_USE_NEON)
216 inV1.mF32[1] <= inV2.
mF32[1]? 0xffffffffu : 0,
224#if defined(JPH_USE_SSE)
226#elif defined(JPH_USE_NEON)
231 inV1.mF32[1] > inV2.
mF32[1]? 0xffffffffu : 0,
239#if defined(JPH_USE_SSE)
241#elif defined(JPH_USE_NEON)
246 inV1.mF32[1] >= inV2.
mF32[1]? 0xffffffffu : 0,
254#if defined(JPH_USE_SSE)
260#elif defined(JPH_USE_NEON)
271#if defined(JPH_USE_SSE4_1)
274#elif defined(JPH_USE_NEON)
279 for (
int i = 0;
i < 3;
i++)
281#ifdef JPH_FLOATING_POINT_EXCEPTIONS_ENABLED
290#if defined(JPH_USE_SSE)
292#elif defined(JPH_USE_NEON)
301#if defined(JPH_USE_SSE)
303#elif defined(JPH_USE_NEON)
312#if defined(JPH_USE_SSE)
314#elif defined(JPH_USE_NEON)
325 return Vec3(
s.GetX() *
c.GetY(),
s.GetX() *
s.GetY(),
c.GetX());
328template <
class Random>
331 std::uniform_real_distribution<float>
zero_to_one(0.0f, 1.0f);
354#if defined(JPH_USE_SSE)
356#elif defined(JPH_USE_NEON)
365#if defined(JPH_USE_SSE)
367#elif defined(JPH_USE_NEON)
376#if defined(JPH_USE_SSE)
378#elif defined(JPH_USE_NEON)
387#if defined(JPH_USE_SSE)
389#elif defined(JPH_USE_NEON)
398#if defined(JPH_USE_SSE)
400#elif defined(JPH_USE_NEON)
403 for (
int i = 0;
i < 3; ++
i)
405 #ifdef JPH_FLOATING_POINT_EXCEPTIONS_ENABLED
414#if defined(JPH_USE_SSE)
416#elif defined(JPH_USE_NEON)
419 for (
int i = 0;
i < 3; ++
i)
421 #ifdef JPH_FLOATING_POINT_EXCEPTIONS_ENABLED
430#if defined(JPH_USE_SSE)
432#elif defined(JPH_USE_NEON)
435 for (
int i = 0;
i < 3; ++
i)
437 #ifdef JPH_FLOATING_POINT_EXCEPTIONS_ENABLED
446#if defined(JPH_USE_SSE)
448#elif defined(JPH_USE_NEON)
457#if defined(JPH_USE_SSE)
459#elif defined(JPH_USE_NEON)
462 for (
int i = 0;
i < 3; ++
i)
464 #ifdef JPH_FLOATING_POINT_EXCEPTIONS_ENABLED
473#if defined(JPH_USE_SSE)
475#elif defined(JPH_USE_NEON)
484#if defined(JPH_USE_SSE)
486#elif defined(JPH_USE_NEON)
495#if defined(JPH_USE_SSE)
497#elif defined(JPH_USE_NEON)
500 for (
int i = 0;
i < 3; ++
i)
502 #ifdef JPH_FLOATING_POINT_EXCEPTIONS_ENABLED
512#if defined(JPH_USE_SSE)
514#elif defined(JPH_USE_NEON)
523#if defined(JPH_USE_SSE)
525#elif defined(JPH_USE_NEON)
534#if defined(JPH_USE_SSE)
536#elif defined(JPH_USE_NEON)
545#if defined(JPH_USE_SSE)
547#elif defined(JPH_USE_NEON)
566#if defined(JPH_USE_AVX512)
568#elif defined(JPH_USE_SSE)
570#elif defined(JPH_USE_NEON)
584#if defined(JPH_USE_SSE)
591#elif defined(JPH_USE_NEON)
607#if defined(JPH_USE_SSE4_1)
609#elif defined(JPH_USE_NEON)
615 for (
int i = 0;
i < 3;
i++)
623#if defined(JPH_USE_SSE4_1)
625#elif defined(JPH_USE_NEON)
631 for (
int i = 0;
i < 3;
i++)
639#if defined(JPH_USE_SSE4_1)
641#elif defined(JPH_USE_NEON)
647 for (
int i = 0;
i < 3;
i++)
655#if defined(JPH_USE_SSE4_1)
657#elif defined(JPH_USE_NEON)
663 for (
int i = 0;
i < 3;
i++)
671#if defined(JPH_USE_SSE4_1)
673#elif defined(JPH_USE_NEON)
685#if defined(JPH_USE_SSE)
687#elif defined(JPH_USE_NEON)
696#if defined(JPH_USE_SSE4_1)
698#elif defined(JPH_USE_NEON)
710#if defined(JPH_USE_SSE4_1)
713#ifdef JPH_FLOATING_POINT_EXCEPTIONS_ENABLED
721#elif defined(JPH_USE_NEON)
733 return *
this / sqrt(
len_sq);
744#if defined(JPH_USE_AVX512)
746#elif defined(JPH_USE_SSE)
748#elif defined(JPH_USE_NEON)
753 return isnan(
mF32[0]) || isnan(
mF32[1]) || isnan(
mF32[2]);
759#if defined(JPH_USE_SSE)
765#elif defined(JPH_USE_NEON)
778#if defined(JPH_USE_SSE)
780#elif defined(JPH_USE_NEON)
789#if defined(JPH_USE_SSE)
791#elif defined(JPH_USE_NEON)
794 return *
reinterpret_cast<const UVec4 *
>(
this);
828#if defined(JPH_USE_AVX512)
830#elif defined(JPH_USE_SSE)
834#elif defined(JPH_USE_NEON)
#define JPH_SUPPRESS_WARNINGS_STD_BEGIN
Definition Core.h:372
#define JPH_SUPPRESS_WARNINGS_STD_END
Definition Core.h:384
std::uint64_t uint64
Definition Core.h:443
#define JPH_NAMESPACE_END
Definition Core.h:367
std::uint32_t uint32
Definition Core.h:442
#define JPH_NAMESPACE_BEGIN
Definition Core.h:361
#define JPH_MAKE_HASHABLE(type,...)
Definition HashCombine.h:87
#define JPH_ASSERT(...)
Definition IssueReporting.h:33
AllocateFunction Allocate
Definition Memory.cpp:59
@ SWIZZLE_Z
Use the Z component.
Definition Swizzle.h:14
@ 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
Vec3 operator*(float inV1, Vec3Arg inV2)
Definition Vec3.inl:374
Class that holds 3 floats. Used as a storage class. Convert to Vec3 for calculations.
Definition Float3.h:13
static JPH_INLINE UVec4 sAnd(UVec4Arg inV1, UVec4Arg inV2)
Logical and (component wise)
Definition UVec4.inl:194
static JPH_INLINE UVec4 sOr(UVec4Arg inV1, UVec4Arg inV2)
Logical or (component wise)
Definition UVec4.inl:166
JPH_INLINE bool TestAllXYZTrue() const
Test if X, Y and Z components are true (true is when highest bit of component is set)
Definition UVec4.inl:405
static JPH_INLINE UVec4 sXor(UVec4Arg inV1, UVec4Arg inV2)
Logical xor (component wise)
Definition UVec4.inl:180
JPH_INLINE Vec4 ReinterpretAsFloat() const
Reinterpret UVec4 as a Vec4 (doesn't change the bits)
Definition UVec4.inl:332
JPH_INLINE bool IsClose(Vec3Arg inV2, float inMaxDistSq=1.0e-12f) const
Test if two vectors are close.
Definition Vec3.inl:342
static JPH_INLINE Vec3 sMax(Vec3Arg inV1, Vec3Arg inV2)
Return the maximum of each of the components.
Definition Vec3.inl:159
JPH_INLINE float Dot(Vec3Arg inV2) const
Dot product.
Definition Vec3.inl:637
JPH_INLINE Vec3 Normalized() const
Normalize vector.
Definition Vec3.inl:694
static JPH_INLINE Type sFixW(Type inValue)
Internal helper function that ensures that the Z component is replicated to the W component to preven...
Vec4::Type Type
Definition Vec3.h:26
JPH_INLINE bool operator==(Vec3Arg inV2) const
Comparison.
Definition Vec3.inl:337
JPH_INLINE Vec4 SplatX() const
Replicate the X component to all components.
Definition Vec3.inl:521
static JPH_INLINE Vec3 sMin(Vec3Arg inV1, Vec3Arg inV2)
Return the minimum value of each of the components.
Definition Vec3.inl:146
JPH_INLINE Vec3 Cross(Vec3Arg inV2) const
Cross product.
Definition Vec3.inl:582
JPH_INLINE Vec3 GetNormalizedPerpendicular() const
Get normalized vector that is perpendicular to this vector.
Definition Vec3.inl:812
static Vec3 sRandom(Random &inRandom)
Get random unit vector.
Definition Vec3.inl:329
JPH_INLINE float GetX() const
Get individual components.
Definition Vec3.h:123
JPH_INLINE bool IsNormalized(float inTolerance=1.0e-6f) const
Test if vector is normalized.
Definition Vec3.inl:737
static JPH_INLINE Vec3 sXor(Vec3Arg inV1, Vec3Arg inV2)
Logical xor (component wise)
Definition Vec3.inl:299
JPH_INLINE float Length() const
Length of vector.
Definition Vec3.inl:669
static JPH_INLINE UVec4 sGreaterOrEqual(Vec3Arg inV1, Vec3Arg inV2)
Greater than or equal (component wise)
Definition Vec3.inl:237
JPH_INLINE float ReduceMin() const
Get the minimum of X, Y and Z.
Definition Vec3.inl:798
JPH_INLINE Vec3 & operator-=(Vec3Arg inV2)
Add two float vectors (component wise)
Definition Vec3.inl:493
JPH_INLINE float ReduceMax() const
Get the maximum of X, Y and Z.
Definition Vec3.inl:805
static JPH_INLINE UVec4 sLessOrEqual(Vec3Arg inV1, Vec3Arg inV2)
Less than or equal (component wise)
Definition Vec3.inl:207
JPH_INLINE Vec3 operator/(float inV2) const
Divide vector by float.
Definition Vec3.inl:385
friend JPH_INLINE Vec3 operator*(float inV1, Vec3Arg inV2)
Multiply vector with float.
Definition Vec3.inl:374
JPH_INLINE int GetLowestComponentIndex() const
Get index of component with lowest value.
Definition Vec3.inl:554
JPH_INLINE Vec3 & operator/=(float inV2)
Divide vector by float.
Definition Vec3.inl:428
JPH_INLINE Vec4 DotV4(Vec3Arg inV2) const
Dot product, returns the dot product in X, Y, Z and W components.
Definition Vec3.inl:621
JPH_INLINE Vec3 Abs() const
Return the absolute value of each of the components.
Definition Vec3.inl:564
JPH_INLINE Vec3 Reciprocal() const
Reciprocal vector (1 / value) for each of the components.
Definition Vec3.inl:577
JPH_INLINE Vec3 NormalizedOr(Vec3Arg inZeroValue) const
Normalize vector or return inZeroValue if the length of the vector is zero.
Definition Vec3.inl:708
JPH_INLINE Vec3 operator+(Vec3Arg inV2) const
Add two float vectors (component wise)
Definition Vec3.inl:444
JPH_INLINE Vec4 SplatZ() const
Replicate the Z component to all components.
Definition Vec3.inl:543
static JPH_INLINE Vec3 sOr(Vec3Arg inV1, Vec3Arg inV2)
Logical or (component wise)
Definition Vec3.inl:288
static JPH_INLINE UVec4 sGreater(Vec3Arg inV1, Vec3Arg inV2)
Greater than (component wise)
Definition Vec3.inl:222
static JPH_INLINE Vec3 sAnd(Vec3Arg inV1, Vec3Arg inV2)
Logical and (component wise)
Definition Vec3.inl:310
JPH_INLINE void CheckW() const
Internal helper function that checks that W is equal to Z, so e.g. dividing by it should not generate...
static JPH_INLINE Vec3 sSelect(Vec3Arg inV1, Vec3Arg inV2, UVec4Arg inControl)
Component wise select, returns inV1 when highest bit of inControl = 0 and inV2 when highest bit of in...
Definition Vec3.inl:269
static JPH_INLINE Vec3 sUnitSpherical(float inTheta, float inPhi)
Definition Vec3.inl:321
JPH_INLINE UVec4 ToInt() const
Convert each component from a float to an int.
Definition Vec3.inl:776
Type mValue
Definition Vec3.h:285
JPH_INLINE float GetY() const
Definition Vec3.h:124
JPH_INLINE Vec4 SplatY() const
Replicate the Y component to all components.
Definition Vec3.inl:532
JPH_INLINE Vec3 operator-() const
Negate.
Definition Vec3.inl:471
JPH_INLINE void StoreFloat3(Float3 *outV) const
Store 3 floats to memory.
Definition Vec3.inl:757
JPH_INLINE float LengthSq() const
Squared length of vector.
Definition Vec3.inl:653
float mF32[4]
Definition Vec3.h:286
static JPH_INLINE UVec4 sEquals(Vec3Arg inV1, Vec3Arg inV2)
Equals (component wise)
Definition Vec3.inl:177
JPH_INLINE bool IsNearZero(float inMaxDistSq=1.0e-12f) const
Test if vector is near zero.
Definition Vec3.inl:347
static JPH_INLINE Vec3 sZero()
Vector with all zeros.
Definition Vec3.inl:107
static JPH_INLINE UVec4 sLess(Vec3Arg inV1, Vec3Arg inV2)
Less than (component wise)
Definition Vec3.inl:192
static JPH_INLINE Vec3 sReplicate(float inV)
Replicate inV across all components.
Definition Vec3.inl:118
static JPH_INLINE Vec3 sClamp(Vec3Arg inV, Vec3Arg inMin, Vec3Arg inMax)
Clamp a vector between min and max (component wise)
Definition Vec3.inl:172
JPH_INLINE Vec3 & operator*=(float inV2)
Multiply vector with float.
Definition Vec3.inl:396
JPH_INLINE Vec3 & operator+=(Vec3Arg inV2)
Add two float vectors (component wise)
Definition Vec3.inl:455
JPH_INLINE bool IsNaN() const
Test if vector contains NaN elements.
Definition Vec3.inl:742
JPH_INLINE Vec3 Sqrt() const
Component wise square root.
Definition Vec3.inl:683
JPH_INLINE UVec4 ReinterpretAsInt() const
Reinterpret Vec3 as a UVec4 (doesn't change the bits)
Definition Vec3.inl:787
JPH_INLINE Vec3 DotV(Vec3Arg inV2) const
Dot product, returns the dot product in X, Y and Z components.
Definition Vec3.inl:605
static JPH_INLINE Vec3 sLoadFloat3Unsafe(const Float3 &inV)
Load 3 floats from memory (reads 32 bits extra which it doesn't use)
Definition Vec3.inl:134
JPH_INLINE float GetZ() const
Definition Vec3.h:125
JPH_INLINE Vec3 GetSign() const
Get vector that contains the sign of each element (returns 1.0f if positive, -1.0f if negative)
Definition Vec3.inl:826
static JPH_INLINE Vec3 sNaN()
Vector with all NaN's.
Definition Vec3.inl:129
Vec3()=default
Constructor.
JPH_INLINE int GetHighestComponentIndex() const
Get index of component with highest value.
Definition Vec3.inl:559
static JPH_INLINE Vec3 sFusedMultiplyAdd(Vec3Arg inMul1, Vec3Arg inMul2, Vec3Arg inAdd)
Calculates inMul1 * inMul2 + inAdd.
Definition Vec3.inl:252
JPH_INLINE Vec3 Swizzle() const
Swizzle the elements in inV.
static JPH_INLINE Vec4 sReplicate(float inV)
Replicate inV across all components.
Definition Vec4.inl:74
void SinCos(Vec4 &outSin, Vec4 &outCos) const
Calculate the sine and cosine for each element of this vector (input in radians)
Definition Vec4.inl:767