RavEngine
Loading...
Searching...
No Matches
PxVecMathAoSScalar.h
1// Redistribution and use in source and binary forms, with or without
2// modification, are permitted provided that the following conditions
3// are met:
4// * Redistributions of source code must retain the above copyright
5// notice, this list of conditions and the following disclaimer.
6// * Redistributions in binary form must reproduce the above copyright
7// notice, this list of conditions and the following disclaimer in the
8// documentation and/or other materials provided with the distribution.
9// * Neither the name of NVIDIA CORPORATION nor the names of its
10// contributors may be used to endorse or promote products derived
11// from this software without specific prior written permission.
12//
13// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
14// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
17// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24//
25// Copyright (c) 2008-2022 NVIDIA Corporation. All rights reserved.
26// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
27// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
28
29#ifndef PX_VEC_MATH_AOS_SCALAR_H
30#define PX_VEC_MATH_AOS_SCALAR_H
31
32#if COMPILE_VECTOR_INTRINSICS
33#error Scalar version should not be included when using vector intrinsics.
34#endif
35
36#if !PX_DOXYGEN
37namespace physx
38{
39#endif
40namespace aos
41{
42
43struct VecI16V;
44struct VecU16V;
45struct VecI32V;
46struct VecU32V;
47struct Vec4V;
48typedef Vec4V QuatV;
49
50PX_ALIGN_PREFIX(16)
51struct FloatV
52{
53 PxF32 x;
54 PxF32 pad[3];
55 FloatV()
56 {
57 }
58 FloatV(const PxF32 _x) : x(_x)
59 {
60 }
61} PX_ALIGN_SUFFIX(16);
62
63PX_ALIGN_PREFIX(16)
64struct Vec4V
65{
66 PxF32 x, y, z, w;
67 Vec4V()
68 {
69 }
70 Vec4V(const PxF32 _x, const PxF32 _y, const PxF32 _z, const PxF32 _w) : x(_x), y(_y), z(_z), w(_w)
71 {
72 }
73} PX_ALIGN_SUFFIX(16);
74
75PX_ALIGN_PREFIX(16)
76struct Vec3V
77{
78 PxF32 x, y, z;
79 PxF32 pad;
80 Vec3V()
81 {
82 }
83 Vec3V(const PxF32 _x, const PxF32 _y, const PxF32 _z) : x(_x), y(_y), z(_z), pad(0.0f)
84 {
85 }
86} PX_ALIGN_SUFFIX(16);
87
88PX_ALIGN_PREFIX(16)
89struct BoolV
90{
91 PxU32 ux, uy, uz, uw;
92 BoolV()
93 {
94 }
95 BoolV(const PxU32 _x, const PxU32 _y, const PxU32 _z, const PxU32 _w) : ux(_x), uy(_y), uz(_z), uw(_w)
96 {
97 }
98} PX_ALIGN_SUFFIX(16);
99
100struct Mat33V
101{
102 Mat33V()
103 {
104 }
105 Mat33V(const Vec3V& c0, const Vec3V& c1, const Vec3V& c2) : col0(c0), col1(c1), col2(c2)
106 {
107 }
108 Vec3V col0;
109 Vec3V col1;
110 Vec3V col2;
111};
112
113struct Mat34V
114{
115 Mat34V()
116 {
117 }
118 Mat34V(const Vec3V& c0, const Vec3V& c1, const Vec3V& c2, const Vec3V& c3) : col0(c0), col1(c1), col2(c2), col3(c3)
119 {
120 }
121 Vec3V col0;
122 Vec3V col1;
123 Vec3V col2;
124 Vec3V col3;
125};
126
127struct Mat43V
128{
129 Mat43V()
130 {
131 }
132 Mat43V(const Vec4V& c0, const Vec4V& c1, const Vec4V& c2) : col0(c0), col1(c1), col2(c2)
133 {
134 }
135 Vec4V col0;
136 Vec4V col1;
137 Vec4V col2;
138};
139
140struct Mat44V
141{
142 Mat44V()
143 {
144 }
145 Mat44V(const Vec4V& c0, const Vec4V& c1, const Vec4V& c2, const Vec4V& c3) : col0(c0), col1(c1), col2(c2), col3(c3)
146 {
147 }
148 Vec4V col0;
149 Vec4V col1;
150 Vec4V col2;
151 Vec4V col3;
152};
153
154PX_ALIGN_PREFIX(16)
156{
157 PxU32 u32[4];
159 {
160 }
161 PX_FORCE_INLINE VecU32V(PxU32 a, PxU32 b, PxU32 c, PxU32 d)
162 {
163 u32[0] = a;
164 u32[1] = b;
165 u32[2] = c;
166 u32[3] = d;
167 }
168} PX_ALIGN_SUFFIX(16);
169
170PX_ALIGN_PREFIX(16)
172{
173 PxI32 i32[4];
175 {
176 }
177 PX_FORCE_INLINE VecI32V(PxI32 a, PxI32 b, PxI32 c, PxI32 d)
178 {
179 i32[0] = a;
180 i32[1] = b;
181 i32[2] = c;
182 i32[3] = d;
183 }
184} PX_ALIGN_SUFFIX(16);
185
186PX_ALIGN_PREFIX(16)
188{
189 PxI16 i16[8];
191 {
192 }
193 PX_FORCE_INLINE VecI16V(PxI16 a, PxI16 b, PxI16 c, PxI16 d, PxI16 e, PxI16 f, PxI16 g, PxI16 h)
194 {
195 i16[0] = a;
196 i16[1] = b;
197 i16[2] = c;
198 i16[3] = d;
199 i16[4] = e;
200 i16[5] = f;
201 i16[6] = g;
202 i16[7] = h;
203 }
204} PX_ALIGN_SUFFIX(16);
205
206PX_ALIGN_PREFIX(16)
208{
209 union
210 {
211 PxU16 u16[8];
212 PxI16 i16[8];
213 };
215 {
216 }
217 PX_FORCE_INLINE VecU16V(PxU16 a, PxU16 b, PxU16 c, PxU16 d, PxU16 e, PxU16 f, PxU16 g, PxU16 h)
218 {
219 u16[0] = a;
220 u16[1] = b;
221 u16[2] = c;
222 u16[3] = d;
223 u16[4] = e;
224 u16[5] = f;
225 u16[6] = g;
226 u16[7] = h;
227 }
228} PX_ALIGN_SUFFIX(16);
229
230#define FloatVArg FloatV &
231#define Vec3VArg Vec3V &
232#define Vec4VArg Vec4V &
233#define BoolVArg BoolV &
234#define VecU32VArg VecU32V &
235#define VecI32VArg VecI32V &
236#define VecU16VArg VecU16V &
237#define VecI16VArg VecI16V &
238#define QuatVArg QuatV &
239
240#define VecCrossV Vec3V
241
242typedef VecI32V VecShiftV;
243#define VecShiftVArg VecShiftV &
244
245} // namespace aos
246#if !PX_DOXYGEN
247} // namespace physx
248#endif
249
250#endif
251
#define PX_FORCE_INLINE
Definition PxPreprocessor.h:335
Sorts an array of objects in ascending order, assuming that the predicate implements the < operator:
Definition PxBoxController.h:39
Definition PxVecMathAoSScalar.h:90
Definition PxVecMathAoSScalar.h:52
Definition PxVecMathAoSScalar.h:101
Definition PxVecMathAoSScalar.h:114
Definition PxVecMathAoSScalar.h:128
Definition PxVecMathAoSScalar.h:141
Definition PxVecMathAoSScalar.h:77
Definition PxVecMathAoSScalar.h:65
Definition PxVecMathAoSScalar.h:188
Definition PxVecMathAoSScalar.h:172
Definition PxUnixSse2AoS.h:121
Definition PxVecMathAoSScalar.h:208
Definition PxVecMathAoSScalar.h:156