Jolt Physics
A multi core friendly Game Physics Engine
Loading...
Searching...
No Matches
Vec8.h
Go to the documentation of this file.
1// Jolt Physics Library (https://github.com/jrouwe/JoltPhysics)
2// SPDX-FileCopyrightText: 2021 Jorrit Rouwe
3// SPDX-License-Identifier: MIT
4
5#pragma once
6
8
10
11class [[nodiscard]] Vec8
12{
13public:
15
17 Vec8() = default;
18 Vec8(const Vec8 &inRHS) = default;
19 JPH_INLINE Vec8(__m256 inRHS) : mValue(inRHS) { }
20
22 JPH_INLINE Vec8(Vec4Arg inLo, Vec4Arg inHi);
23
25 static JPH_INLINE Vec8 sZero();
26
28 static JPH_INLINE Vec8 sReplicate(float inV);
29
31 static JPH_INLINE Vec8 sSplatX(Vec4Arg inV);
32
34 static JPH_INLINE Vec8 sSplatY(Vec4Arg inV);
35
37 static JPH_INLINE Vec8 sSplatZ(Vec4Arg inV);
38
40 static JPH_INLINE Vec8 sFusedMultiplyAdd(Vec8Arg inMul1, Vec8Arg inMul2, Vec8Arg inAdd);
41
43 static JPH_INLINE Vec8 sSelect(Vec8Arg inV1, Vec8Arg inV2, UVec8Arg inControl);
44
46 static JPH_INLINE Vec8 sMin(Vec8Arg inV1, Vec8Arg inV2);
47
49 static JPH_INLINE Vec8 sMax(Vec8Arg inV1, Vec8Arg inV2);
50
52 static JPH_INLINE UVec8 sLess(Vec8Arg inV1, Vec8Arg inV2);
53
55 static JPH_INLINE UVec8 sGreater(Vec8Arg inV1, Vec8Arg inV2);
56
58 static JPH_INLINE Vec8 sLoadFloat8(const float *inV);
59
61 static JPH_INLINE Vec8 sLoadFloat8Aligned(const float *inV);
62
64 JPH_INLINE float operator [] (uint inCoordinate) const { JPH_ASSERT(inCoordinate < 8); return mF32[inCoordinate]; }
65 JPH_INLINE float & operator [] (uint inCoordinate) { JPH_ASSERT(inCoordinate < 8); return mF32[inCoordinate]; }
66
68 JPH_INLINE Vec8 operator * (Vec8Arg inV2) const;
69
71 JPH_INLINE Vec8 operator * (float inV2) const;
72
74 JPH_INLINE Vec8 operator + (Vec8Arg inV2) const;
75
77 JPH_INLINE Vec8 operator - (Vec8Arg inV2) const;
78
80 JPH_INLINE Vec8 operator / (Vec8Arg inV2) const;
81
83 JPH_INLINE Vec8 Reciprocal() const;
84
86 template<uint32 SwizzleX, uint32 SwizzleY, uint32 SwizzleZ, uint32 SwizzleW>
87 JPH_INLINE Vec8 Swizzle() const;
88
90 JPH_INLINE Vec8 Abs() const;
91
93 JPH_INLINE Vec4 LowerVec4() const;
94
96 JPH_INLINE Vec4 UpperVec4() const;
97
99 JPH_INLINE float ReduceMin() const;
100
101 union
102 {
103 __m256 mValue;
104 float mF32[8];
105 };
106};
107
108static_assert(is_trivial<Vec8>(), "Is supposed to be a trivial type!");
109
111
112#include "Vec8.inl"
unsigned int uint
Definition: Core.h:452
#define JPH_NAMESPACE_END
Definition: Core.h:378
#define JPH_NAMESPACE_BEGIN
Definition: Core.h:372
DVec3 operator*(double inV1, DVec3Arg inV2)
Definition: DVec3.inl:451
#define JPH_ASSERT(...)
Definition: IssueReporting.h:33
#define JPH_OVERRIDE_NEW_DELETE
Macro to override the new and delete functions.
Definition: Memory.h:31
Definition: UVec8.h:12
Definition: Vec4.h:14
Definition: Vec8.h:12
Vec8(const Vec8 &inRHS)=default
JPH_INLINE Vec8(__m256 inRHS)
Definition: Vec8.h:19
JPH_OVERRIDE_NEW_DELETE Vec8()=default
Constructor.
__m256 mValue
Definition: Vec8.h:103
JPH_INLINE Vec8 Swizzle() const
256 bit variant of Vec::Swizzle (no cross 128 bit lane swizzle)