16class [[nodiscard]] alignas(JPH_VECTOR_ALIGNMENT) 
Vec3 
   22#if defined(JPH_USE_SSE) 
   24#elif defined(JPH_USE_NEON) 
   25    using Type = float32x4_t;
 
   36    Vec3 &                      operator = (
const Vec3 &inRHS) = 
default;
 
   38    JPH_INLINE                  
Vec3(
Type inRHS) : mValue(inRHS)                { CheckW(); }
 
   44    JPH_INLINE                  
Vec3(
float inX, 
float inY, 
float inZ);
 
   47    static JPH_INLINE 
Vec3      sZero();
 
   50    static JPH_INLINE 
Vec3      sOne();
 
   53    static JPH_INLINE 
Vec3      sNaN();
 
   61    static JPH_INLINE 
Vec3      sReplicate(
float inV);
 
   64    static JPH_INLINE 
Vec3      sLoadFloat3Unsafe(
const Float3 &inV);
 
  108    static JPH_INLINE 
Vec3      sUnitSpherical(
float inTheta, 
float inPhi);
 
  114    template <
class Random>
 
  115    static inline Vec3          sRandom(Random &inRandom);
 
  118#if defined(JPH_USE_SSE) 
  119    JPH_INLINE 
float            GetX()
 const                                    { 
return _mm_cvtss_f32(mValue); }
 
  120    JPH_INLINE 
float            GetY()
 const                                    { 
return mF32[1]; }
 
  121    JPH_INLINE 
float            GetZ()
 const                                    { 
return mF32[2]; }
 
  122#elif defined(JPH_USE_NEON) 
  123    JPH_INLINE 
float            GetX()
 const                                    { 
return vgetq_lane_f32(mValue, 0); }
 
  124    JPH_INLINE 
float            GetY()
 const                                    { 
return vgetq_lane_f32(mValue, 1); }
 
  125    JPH_INLINE 
float            GetZ()
 const                                    { 
return vgetq_lane_f32(mValue, 2); }
 
  127    JPH_INLINE 
float            GetX()
 const                                    { 
return mF32[0]; }
 
  128    JPH_INLINE 
float            GetY()
 const                                    { 
return mF32[1]; }
 
  129    JPH_INLINE 
float            GetZ()
 const                                    { 
return mF32[2]; }
 
  133    JPH_INLINE 
void             SetX(
float inX)                                 { mF32[0] = inX; }
 
  134    JPH_INLINE 
void             SetY(
float inY)                                 { mF32[1] = inY; }
 
  135    JPH_INLINE 
void             SetZ(
float inZ)                                 { mF32[2] = mF32[3] = inZ; } 
 
  138    JPH_INLINE 
void             Set(
float inX, 
float inY, 
float inZ)            { *
this = 
Vec3(inX, inY, inZ); }
 
  141    JPH_INLINE 
float            operator [] (
uint inCoordinate)
 const           { 
JPH_ASSERT(inCoordinate < 3); 
return mF32[inCoordinate]; }
 
  144    JPH_INLINE 
void             SetComponent(
uint inCoordinate, 
float inValue)  { 
JPH_ASSERT(inCoordinate < 3); mF32[inCoordinate] = inValue; mValue = sFixW(mValue); } 
 
  147    JPH_INLINE 
bool             operator == (
Vec3Arg inV2) 
const;
 
  148    JPH_INLINE 
bool             operator != (
Vec3Arg inV2)
 const                { 
return !(*
this == inV2); }
 
  151    JPH_INLINE 
bool             IsClose(
Vec3Arg inV2, 
float inMaxDistSq = 1.0e-12f) 
const;
 
  154    JPH_INLINE 
bool             IsNearZero(
float inMaxDistSq = 1.0e-12f) 
const;
 
  157    JPH_INLINE 
bool             IsNormalized(
float inTolerance = 1.0e-6f) 
const;
 
  160    JPH_INLINE 
bool             IsNaN() 
const;
 
  172    JPH_INLINE 
Vec3             operator / (
float inV2) 
const;
 
  175    JPH_INLINE 
Vec3 &           operator *= (
float inV2);
 
  181    JPH_INLINE 
Vec3 &           operator /= (
float inV2);
 
  190    JPH_INLINE 
Vec3             operator - () 
const;
 
  202    template<u
int32 SwizzleX, u
int32 SwizzleY, u
int32 SwizzleZ>
 
  206    JPH_INLINE 
Vec4             SplatX() 
const;
 
  209    JPH_INLINE 
Vec4             SplatY() 
const;
 
  212    JPH_INLINE 
Vec4             SplatZ() 
const;
 
  215    JPH_INLINE 
int              GetLowestComponentIndex() 
const;
 
  218    JPH_INLINE 
int              GetHighestComponentIndex() 
const;
 
  221    JPH_INLINE 
Vec3             Abs() 
const;
 
  224    JPH_INLINE 
Vec3             Reciprocal() 
const;
 
  236    JPH_INLINE 
float            Dot(
Vec3Arg inV2) 
const;
 
  239    JPH_INLINE 
float            LengthSq() 
const;
 
  242    JPH_INLINE 
float            Length() 
const;
 
  245    JPH_INLINE 
Vec3             Normalized() 
const;
 
  248    JPH_INLINE 
Vec3             NormalizedOr(
Vec3Arg inZeroValue) 
const;
 
  251    JPH_INLINE 
void             StoreFloat3(
Float3 *outV) 
const;
 
  254    JPH_INLINE 
UVec4            ToInt() 
const;
 
  257    JPH_INLINE 
UVec4            ReinterpretAsInt() 
const;
 
  260    JPH_INLINE 
float            ReduceMin() 
const;
 
  263    JPH_INLINE 
float            ReduceMax() 
const;
 
  266    JPH_INLINE 
Vec3             Sqrt() 
const;
 
  269    JPH_INLINE 
Vec3             GetNormalizedPerpendicular() 
const;
 
  272    JPH_INLINE 
Vec3             GetSign() 
const;
 
  275    friend ostream &            operator << (ostream &inStream, 
Vec3Arg inV)
 
  277        inStream << inV.
mF32[0] << 
", " << inV.
mF32[1] << 
", " << inV.
mF32[2];
 
  294static_assert(std::is_trivial<Vec3>(), 
"Is supposed to be a trivial type!");
 
#define JPH_EXPORT
Definition: Core.h:275
unsigned int uint
Definition: Core.h:487
#define JPH_NAMESPACE_END
Definition: Core.h:419
#define JPH_NAMESPACE_BEGIN
Definition: Core.h:413
DVec3 operator*(double inV1, DVec3Arg inV2)
Definition: DVec3.inl:456
#define JPH_ASSERT(...)
Definition: IssueReporting.h:33
const Vec3 Vec3Arg
Definition: MathTypes.h:19
#define JPH_OVERRIDE_NEW_DELETE
Macro to override the new and delete functions.
Definition: Memory.h:31
Class that holds 3 floats. Used as a storage class. Convert to Vec3 for calculations.
Definition: Float3.h:13
Simple variable length array backed by a fixed size buffer.
Definition: StaticArray.h:14
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:27
static JPH_INLINE Vec3 sAxisX()
Vectors with the principal axis.
Definition: Vec3.h:56
JPH_INLINE void SetComponent(uint inCoordinate, float inValue)
Set float component by index.
Definition: Vec3.h:144
Vec3(const Vec3 &inRHS)=default
static JPH_INLINE Vec3 sAxisY()
Definition: Vec3.h:57
JPH_INLINE float GetX() const
Get individual components.
Definition: Vec3.h:127
JPH_INLINE void SetY(float inY)
Definition: Vec3.h:134
JPH_INLINE Vec3(Type inRHS)
Definition: Vec3.h:38
JPH_INLINE void SetZ(float inZ)
Definition: Vec3.h:135
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 sAxisZ()
Definition: Vec3.h:58
JPH_INLINE void SetX(float inX)
Set individual components.
Definition: Vec3.h:133
Type mValue
Definition: Vec3.h:289
JPH_INLINE float GetY() const
Definition: Vec3.h:128
float mF32[4]
Definition: Vec3.h:290
JPH_INLINE void Set(float inX, float inY, float inZ)
Set all components.
Definition: Vec3.h:138
JPH_INLINE float GetZ() const
Definition: Vec3.h:129
Vec3()=default
Constructor.
static JPH_EXPORT const StaticArray< Vec3, 1026 > sUnitSphere
A set of vectors uniformly spanning the surface of a unit sphere, usable for debug purposes.
Definition: Vec3.h:111
JPH_INLINE Vec3 Swizzle() const
Swizzle the elements in inV.
{ float mData[4] Type
Definition: Vec4.h:24