Tizen 2.1 base
[platform/upstream/libbullet.git] / Extras / vectormathlibrary / include / vectormath / spu / c / vectormath_soa.h
1 /*
2    Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
3    All rights reserved.
4
5    Redistribution and use in source and binary forms,
6    with or without modification, are permitted provided that the
7    following conditions are met:
8     * Redistributions of source code must retain the above copyright
9       notice, this list of conditions and the following disclaimer.
10     * Redistributions in binary form must reproduce the above copyright
11       notice, this list of conditions and the following disclaimer in the
12       documentation and/or other materials provided with the distribution.
13     * Neither the name of the Sony Computer Entertainment Inc nor the names
14       of its contributors may be used to endorse or promote products derived
15       from this software without specific prior written permission.
16
17    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18    AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20    ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21    LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22    CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23    SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24    INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25    CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26    ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27    POSSIBILITY OF SUCH DAMAGE.
28 */
29
30 #ifndef _VECTORMATH_SOA_C_SPU_H
31 #define _VECTORMATH_SOA_C_SPU_H
32
33 #include <math.h>
34 #include <spu_intrinsics.h>
35 #include "vectormath_aos.h"
36
37 #ifdef _VECTORMATH_DEBUG
38 #endif
39
40 #ifdef __cplusplus
41 extern "C" {
42 #endif /* __cplusplus */
43
44 #ifndef _VECTORMATH_SOA_C_TYPES_H
45 #define _VECTORMATH_SOA_C_TYPES_H
46
47 /* A set of four 3-D vectors in structure-of-arrays format
48  */
49 typedef struct _VmathSoaVector3
50 {
51     vec_float4 x;
52     vec_float4 y;
53     vec_float4 z;
54 } VmathSoaVector3;
55
56 /* A set of four 4-D vectors in structure-of-arrays format
57  */
58 typedef struct _VmathSoaVector4
59 {
60     vec_float4 x;
61     vec_float4 y;
62     vec_float4 z;
63     vec_float4 w;
64 } VmathSoaVector4;
65
66 /* A set of four 3-D points in structure-of-arrays format
67  */
68 typedef struct _VmathSoaPoint3
69 {
70     vec_float4 x;
71     vec_float4 y;
72     vec_float4 z;
73 } VmathSoaPoint3;
74
75 /* A set of four quaternions in structure-of-arrays format
76  */
77 typedef struct _VmathSoaQuat
78 {
79     vec_float4 x;
80     vec_float4 y;
81     vec_float4 z;
82     vec_float4 w;
83 } VmathSoaQuat;
84
85 /* A set of four 3x3 matrices in structure-of-arrays format
86  */
87 typedef struct _VmathSoaMatrix3
88 {
89     VmathSoaVector3 col0;
90     VmathSoaVector3 col1;
91     VmathSoaVector3 col2;
92 } VmathSoaMatrix3;
93
94 /* A set of four 4x4 matrices in structure-of-arrays format
95  */
96 typedef struct _VmathSoaMatrix4
97 {
98     VmathSoaVector4 col0;
99     VmathSoaVector4 col1;
100     VmathSoaVector4 col2;
101     VmathSoaVector4 col3;
102 } VmathSoaMatrix4;
103
104 /* A set of four 3x4 transformation matrices in structure-of-arrays format
105  */
106 typedef struct _VmathSoaTransform3
107 {
108     VmathSoaVector3 col0;
109     VmathSoaVector3 col1;
110     VmathSoaVector3 col2;
111     VmathSoaVector3 col3;
112 } VmathSoaTransform3;
113
114 #endif
115
116 /*
117  * Copy a 3-D vector
118  */
119 static inline void vmathSoaV3Copy( VmathSoaVector3 *result, const VmathSoaVector3 *vec );
120
121 /*
122  * Construct a 3-D vector from x, y, and z elements
123  */
124 static inline void vmathSoaV3MakeFromElems( VmathSoaVector3 *result, vec_float4 x, vec_float4 y, vec_float4 z );
125
126 /*
127  * Copy elements from a 3-D point into a 3-D vector
128  */
129 static inline void vmathSoaV3MakeFromP3( VmathSoaVector3 *result, const VmathSoaPoint3 *pnt );
130
131 /*
132  * Set all elements of a 3-D vector to the same scalar value
133  */
134 static inline void vmathSoaV3MakeFromScalar( VmathSoaVector3 *result, vec_float4 scalar );
135
136 /*
137  * Replicate an AoS 3-D vector
138  */
139 static inline void vmathSoaV3MakeFromAos( VmathSoaVector3 *result, const VmathVector3 *vec );
140
141 /*
142  * Insert four AoS 3-D vectors
143  */
144 static inline void vmathSoaV3MakeFrom4Aos( VmathSoaVector3 *result, const VmathVector3 *vec0, const VmathVector3 *vec1, const VmathVector3 *vec2, const VmathVector3 *vec3 );
145
146 /*
147  * Extract four AoS 3-D vectors
148  */
149 static inline void vmathSoaV3Get4Aos( const VmathSoaVector3 *vec, VmathVector3 *result0, VmathVector3 *result1, VmathVector3 *result2, VmathVector3 *result3 );
150
151 /*
152  * Set the x element of a 3-D vector
153  */
154 static inline void vmathSoaV3SetX( VmathSoaVector3 *result, vec_float4 x );
155
156 /*
157  * Set the y element of a 3-D vector
158  */
159 static inline void vmathSoaV3SetY( VmathSoaVector3 *result, vec_float4 y );
160
161 /*
162  * Set the z element of a 3-D vector
163  */
164 static inline void vmathSoaV3SetZ( VmathSoaVector3 *result, vec_float4 z );
165
166 /*
167  * Get the x element of a 3-D vector
168  */
169 static inline vec_float4 vmathSoaV3GetX( const VmathSoaVector3 *vec );
170
171 /*
172  * Get the y element of a 3-D vector
173  */
174 static inline vec_float4 vmathSoaV3GetY( const VmathSoaVector3 *vec );
175
176 /*
177  * Get the z element of a 3-D vector
178  */
179 static inline vec_float4 vmathSoaV3GetZ( const VmathSoaVector3 *vec );
180
181 /*
182  * Set an x, y, or z element of a 3-D vector by index
183  */
184 static inline void vmathSoaV3SetElem( VmathSoaVector3 *result, int idx, vec_float4 value );
185
186 /*
187  * Get an x, y, or z element of a 3-D vector by index
188  */
189 static inline vec_float4 vmathSoaV3GetElem( const VmathSoaVector3 *vec, int idx );
190
191 /*
192  * Add two 3-D vectors
193  */
194 static inline void vmathSoaV3Add( VmathSoaVector3 *result, const VmathSoaVector3 *vec0, const VmathSoaVector3 *vec1 );
195
196 /*
197  * Subtract a 3-D vector from another 3-D vector
198  */
199 static inline void vmathSoaV3Sub( VmathSoaVector3 *result, const VmathSoaVector3 *vec0, const VmathSoaVector3 *vec1 );
200
201 /*
202  * Add a 3-D vector to a 3-D point
203  */
204 static inline void vmathSoaV3AddP3( VmathSoaPoint3 *result, const VmathSoaVector3 *vec, const VmathSoaPoint3 *pnt );
205
206 /*
207  * Multiply a 3-D vector by a scalar
208  */
209 static inline void vmathSoaV3ScalarMul( VmathSoaVector3 *result, const VmathSoaVector3 *vec, vec_float4 scalar );
210
211 /*
212  * Divide a 3-D vector by a scalar
213  */
214 static inline void vmathSoaV3ScalarDiv( VmathSoaVector3 *result, const VmathSoaVector3 *vec, vec_float4 scalar );
215
216 /*
217  * Negate all elements of a 3-D vector
218  */
219 static inline void vmathSoaV3Neg( VmathSoaVector3 *result, const VmathSoaVector3 *vec );
220
221 /*
222  * Construct x axis
223  */
224 static inline void vmathSoaV3MakeXAxis( VmathSoaVector3 *result );
225
226 /*
227  * Construct y axis
228  */
229 static inline void vmathSoaV3MakeYAxis( VmathSoaVector3 *result );
230
231 /*
232  * Construct z axis
233  */
234 static inline void vmathSoaV3MakeZAxis( VmathSoaVector3 *result );
235
236 /*
237  * Multiply two 3-D vectors per element
238  */
239 static inline void vmathSoaV3MulPerElem( VmathSoaVector3 *result, const VmathSoaVector3 *vec0, const VmathSoaVector3 *vec1 );
240
241 /*
242  * Divide two 3-D vectors per element
243  * NOTE: 
244  * Floating-point behavior matches standard library function divf4.
245  */
246 static inline void vmathSoaV3DivPerElem( VmathSoaVector3 *result, const VmathSoaVector3 *vec0, const VmathSoaVector3 *vec1 );
247
248 /*
249  * Compute the reciprocal of a 3-D vector per element
250  * NOTE: 
251  * Floating-point behavior matches standard library function recipf4.
252  */
253 static inline void vmathSoaV3RecipPerElem( VmathSoaVector3 *result, const VmathSoaVector3 *vec );
254
255 /*
256  * Compute the square root of a 3-D vector per element
257  * NOTE: 
258  * Floating-point behavior matches standard library function sqrtf4.
259  */
260 static inline void vmathSoaV3SqrtPerElem( VmathSoaVector3 *result, const VmathSoaVector3 *vec );
261
262 /*
263  * Compute the reciprocal square root of a 3-D vector per element
264  * NOTE: 
265  * Floating-point behavior matches standard library function rsqrtf4.
266  */
267 static inline void vmathSoaV3RsqrtPerElem( VmathSoaVector3 *result, const VmathSoaVector3 *vec );
268
269 /*
270  * Compute the absolute value of a 3-D vector per element
271  */
272 static inline void vmathSoaV3AbsPerElem( VmathSoaVector3 *result, const VmathSoaVector3 *vec );
273
274 /*
275  * Copy sign from one 3-D vector to another, per element
276  */
277 static inline void vmathSoaV3CopySignPerElem( VmathSoaVector3 *result, const VmathSoaVector3 *vec0, const VmathSoaVector3 *vec1 );
278
279 /*
280  * Maximum of two 3-D vectors per element
281  */
282 static inline void vmathSoaV3MaxPerElem( VmathSoaVector3 *result, const VmathSoaVector3 *vec0, const VmathSoaVector3 *vec1 );
283
284 /*
285  * Minimum of two 3-D vectors per element
286  */
287 static inline void vmathSoaV3MinPerElem( VmathSoaVector3 *result, const VmathSoaVector3 *vec0, const VmathSoaVector3 *vec1 );
288
289 /*
290  * Maximum element of a 3-D vector
291  */
292 static inline vec_float4 vmathSoaV3MaxElem( const VmathSoaVector3 *vec );
293
294 /*
295  * Minimum element of a 3-D vector
296  */
297 static inline vec_float4 vmathSoaV3MinElem( const VmathSoaVector3 *vec );
298
299 /*
300  * Compute the sum of all elements of a 3-D vector
301  */
302 static inline vec_float4 vmathSoaV3Sum( const VmathSoaVector3 *vec );
303
304 /*
305  * Compute the dot product of two 3-D vectors
306  */
307 static inline vec_float4 vmathSoaV3Dot( const VmathSoaVector3 *vec0, const VmathSoaVector3 *vec1 );
308
309 /*
310  * Compute the square of the length of a 3-D vector
311  */
312 static inline vec_float4 vmathSoaV3LengthSqr( const VmathSoaVector3 *vec );
313
314 /*
315  * Compute the length of a 3-D vector
316  */
317 static inline vec_float4 vmathSoaV3Length( const VmathSoaVector3 *vec );
318
319 /*
320  * Normalize a 3-D vector
321  * NOTE: 
322  * The result is unpredictable when all elements of vec are at or near zero.
323  */
324 static inline void vmathSoaV3Normalize( VmathSoaVector3 *result, const VmathSoaVector3 *vec );
325
326 /*
327  * Compute cross product of two 3-D vectors
328  */
329 static inline void vmathSoaV3Cross( VmathSoaVector3 *result, const VmathSoaVector3 *vec0, const VmathSoaVector3 *vec1 );
330
331 /*
332  * Outer product of two 3-D vectors
333  */
334 static inline void vmathSoaV3Outer( VmathSoaMatrix3 *result, const VmathSoaVector3 *vec0, const VmathSoaVector3 *vec1 );
335
336 /*
337  * Pre-multiply a row vector by a 3x3 matrix
338  */
339 static inline void vmathSoaV3RowMul( VmathSoaVector3 *result, const VmathSoaVector3 *vec, const VmathSoaMatrix3 *mat );
340
341 /*
342  * Cross-product matrix of a 3-D vector
343  */
344 static inline void vmathSoaV3CrossMatrix( VmathSoaMatrix3 *result, const VmathSoaVector3 *vec );
345
346 /*
347  * Create cross-product matrix and multiply
348  * NOTE: 
349  * Faster than separately creating a cross-product matrix and multiplying.
350  */
351 static inline void vmathSoaV3CrossMatrixMul( VmathSoaMatrix3 *result, const VmathSoaVector3 *vec, const VmathSoaMatrix3 *mat );
352
353 /*
354  * Linear interpolation between two 3-D vectors
355  * NOTE: 
356  * Does not clamp t between 0 and 1.
357  */
358 static inline void vmathSoaV3Lerp( VmathSoaVector3 *result, vec_float4 t, const VmathSoaVector3 *vec0, const VmathSoaVector3 *vec1 );
359
360 /*
361  * Spherical linear interpolation between two 3-D vectors
362  * NOTE: 
363  * The result is unpredictable if the vectors point in opposite directions.
364  * Does not clamp t between 0 and 1.
365  */
366 static inline void vmathSoaV3Slerp( VmathSoaVector3 *result, vec_float4 t, const VmathSoaVector3 *unitVec0, const VmathSoaVector3 *unitVec1 );
367
368 /*
369  * Conditionally select between two 3-D vectors
370  * NOTE: 
371  * This function uses a conditional select instruction to avoid a branch.
372  */
373 static inline void vmathSoaV3Select( VmathSoaVector3 *result, const VmathSoaVector3 *vec0, const VmathSoaVector3 *vec1, vec_uint4 select1 );
374
375 /*
376  * Load four three-float 3-D vectors, stored in three quadwords
377  */
378 static inline void vmathSoaV3LoadXYZArray( VmathSoaVector3 *vec, const vec_float4 *threeQuads );
379
380 /*
381  * Store four slots of an SoA 3-D vector in three quadwords
382  */
383 static inline void vmathSoaV3StoreXYZArray( const VmathSoaVector3 *vec, vec_float4 *threeQuads );
384
385 /*
386  * Store eight slots of two SoA 3-D vectors as half-floats
387  */
388 static inline void vmathSoaV3StoreHalfFloats( const VmathSoaVector3 *vec0, const VmathSoaVector3 *vec1, vec_ushort8 *threeQuads );
389
390 #ifdef _VECTORMATH_DEBUG
391
392 /*
393  * Print a 3-D vector
394  * NOTE: 
395  * Function is only defined when _VECTORMATH_DEBUG is defined.
396  */
397 static inline void vmathSoaV3Print( const VmathSoaVector3 *vec );
398
399 /*
400  * Print a 3-D vector and an associated string identifier
401  * NOTE: 
402  * Function is only defined when _VECTORMATH_DEBUG is defined.
403  */
404 static inline void vmathSoaV3Prints( const VmathSoaVector3 *vec, const char *name );
405
406 #endif
407
408 /*
409  * Copy a 4-D vector
410  */
411 static inline void vmathSoaV4Copy( VmathSoaVector4 *result, const VmathSoaVector4 *vec );
412
413 /*
414  * Construct a 4-D vector from x, y, z, and w elements
415  */
416 static inline void vmathSoaV4MakeFromElems( VmathSoaVector4 *result, vec_float4 x, vec_float4 y, vec_float4 z, vec_float4 w );
417
418 /*
419  * Construct a 4-D vector from a 3-D vector and a scalar
420  */
421 static inline void vmathSoaV4MakeFromV3Scalar( VmathSoaVector4 *result, const VmathSoaVector3 *xyz, vec_float4 w );
422
423 /*
424  * Copy x, y, and z from a 3-D vector into a 4-D vector, and set w to 0
425  */
426 static inline void vmathSoaV4MakeFromV3( VmathSoaVector4 *result, const VmathSoaVector3 *vec );
427
428 /*
429  * Copy x, y, and z from a 3-D point into a 4-D vector, and set w to 1
430  */
431 static inline void vmathSoaV4MakeFromP3( VmathSoaVector4 *result, const VmathSoaPoint3 *pnt );
432
433 /*
434  * Copy elements from a quaternion into a 4-D vector
435  */
436 static inline void vmathSoaV4MakeFromQ( VmathSoaVector4 *result, const VmathSoaQuat *quat );
437
438 /*
439  * Set all elements of a 4-D vector to the same scalar value
440  */
441 static inline void vmathSoaV4MakeFromScalar( VmathSoaVector4 *result, vec_float4 scalar );
442
443 /*
444  * Replicate an AoS 4-D vector
445  */
446 static inline void vmathSoaV4MakeFromAos( VmathSoaVector4 *result, const VmathVector4 *vec );
447
448 /*
449  * Insert four AoS 4-D vectors
450  */
451 static inline void vmathSoaV4MakeFrom4Aos( VmathSoaVector4 *result, const VmathVector4 *vec0, const VmathVector4 *vec1, const VmathVector4 *vec2, const VmathVector4 *vec3 );
452
453 /*
454  * Extract four AoS 4-D vectors
455  */
456 static inline void vmathSoaV4Get4Aos( const VmathSoaVector4 *vec, VmathVector4 *result0, VmathVector4 *result1, VmathVector4 *result2, VmathVector4 *result3 );
457
458 /*
459  * Set the x, y, and z elements of a 4-D vector
460  * NOTE: 
461  * This function does not change the w element.
462  */
463 static inline void vmathSoaV4SetXYZ( VmathSoaVector4 *result, const VmathSoaVector3 *vec );
464
465 /*
466  * Get the x, y, and z elements of a 4-D vector
467  */
468 static inline void vmathSoaV4GetXYZ( VmathSoaVector3 *result, const VmathSoaVector4 *vec );
469
470 /*
471  * Set the x element of a 4-D vector
472  */
473 static inline void vmathSoaV4SetX( VmathSoaVector4 *result, vec_float4 x );
474
475 /*
476  * Set the y element of a 4-D vector
477  */
478 static inline void vmathSoaV4SetY( VmathSoaVector4 *result, vec_float4 y );
479
480 /*
481  * Set the z element of a 4-D vector
482  */
483 static inline void vmathSoaV4SetZ( VmathSoaVector4 *result, vec_float4 z );
484
485 /*
486  * Set the w element of a 4-D vector
487  */
488 static inline void vmathSoaV4SetW( VmathSoaVector4 *result, vec_float4 w );
489
490 /*
491  * Get the x element of a 4-D vector
492  */
493 static inline vec_float4 vmathSoaV4GetX( const VmathSoaVector4 *vec );
494
495 /*
496  * Get the y element of a 4-D vector
497  */
498 static inline vec_float4 vmathSoaV4GetY( const VmathSoaVector4 *vec );
499
500 /*
501  * Get the z element of a 4-D vector
502  */
503 static inline vec_float4 vmathSoaV4GetZ( const VmathSoaVector4 *vec );
504
505 /*
506  * Get the w element of a 4-D vector
507  */
508 static inline vec_float4 vmathSoaV4GetW( const VmathSoaVector4 *vec );
509
510 /*
511  * Set an x, y, z, or w element of a 4-D vector by index
512  */
513 static inline void vmathSoaV4SetElem( VmathSoaVector4 *result, int idx, vec_float4 value );
514
515 /*
516  * Get an x, y, z, or w element of a 4-D vector by index
517  */
518 static inline vec_float4 vmathSoaV4GetElem( const VmathSoaVector4 *vec, int idx );
519
520 /*
521  * Add two 4-D vectors
522  */
523 static inline void vmathSoaV4Add( VmathSoaVector4 *result, const VmathSoaVector4 *vec0, const VmathSoaVector4 *vec1 );
524
525 /*
526  * Subtract a 4-D vector from another 4-D vector
527  */
528 static inline void vmathSoaV4Sub( VmathSoaVector4 *result, const VmathSoaVector4 *vec0, const VmathSoaVector4 *vec1 );
529
530 /*
531  * Multiply a 4-D vector by a scalar
532  */
533 static inline void vmathSoaV4ScalarMul( VmathSoaVector4 *result, const VmathSoaVector4 *vec, vec_float4 scalar );
534
535 /*
536  * Divide a 4-D vector by a scalar
537  */
538 static inline void vmathSoaV4ScalarDiv( VmathSoaVector4 *result, const VmathSoaVector4 *vec, vec_float4 scalar );
539
540 /*
541  * Negate all elements of a 4-D vector
542  */
543 static inline void vmathSoaV4Neg( VmathSoaVector4 *result, const VmathSoaVector4 *vec );
544
545 /*
546  * Construct x axis
547  */
548 static inline void vmathSoaV4MakeXAxis( VmathSoaVector4 *result );
549
550 /*
551  * Construct y axis
552  */
553 static inline void vmathSoaV4MakeYAxis( VmathSoaVector4 *result );
554
555 /*
556  * Construct z axis
557  */
558 static inline void vmathSoaV4MakeZAxis( VmathSoaVector4 *result );
559
560 /*
561  * Construct w axis
562  */
563 static inline void vmathSoaV4MakeWAxis( VmathSoaVector4 *result );
564
565 /*
566  * Multiply two 4-D vectors per element
567  */
568 static inline void vmathSoaV4MulPerElem( VmathSoaVector4 *result, const VmathSoaVector4 *vec0, const VmathSoaVector4 *vec1 );
569
570 /*
571  * Divide two 4-D vectors per element
572  * NOTE: 
573  * Floating-point behavior matches standard library function divf4.
574  */
575 static inline void vmathSoaV4DivPerElem( VmathSoaVector4 *result, const VmathSoaVector4 *vec0, const VmathSoaVector4 *vec1 );
576
577 /*
578  * Compute the reciprocal of a 4-D vector per element
579  * NOTE: 
580  * Floating-point behavior matches standard library function recipf4.
581  */
582 static inline void vmathSoaV4RecipPerElem( VmathSoaVector4 *result, const VmathSoaVector4 *vec );
583
584 /*
585  * Compute the square root of a 4-D vector per element
586  * NOTE: 
587  * Floating-point behavior matches standard library function sqrtf4.
588  */
589 static inline void vmathSoaV4SqrtPerElem( VmathSoaVector4 *result, const VmathSoaVector4 *vec );
590
591 /*
592  * Compute the reciprocal square root of a 4-D vector per element
593  * NOTE: 
594  * Floating-point behavior matches standard library function rsqrtf4.
595  */
596 static inline void vmathSoaV4RsqrtPerElem( VmathSoaVector4 *result, const VmathSoaVector4 *vec );
597
598 /*
599  * Compute the absolute value of a 4-D vector per element
600  */
601 static inline void vmathSoaV4AbsPerElem( VmathSoaVector4 *result, const VmathSoaVector4 *vec );
602
603 /*
604  * Copy sign from one 4-D vector to another, per element
605  */
606 static inline void vmathSoaV4CopySignPerElem( VmathSoaVector4 *result, const VmathSoaVector4 *vec0, const VmathSoaVector4 *vec1 );
607
608 /*
609  * Maximum of two 4-D vectors per element
610  */
611 static inline void vmathSoaV4MaxPerElem( VmathSoaVector4 *result, const VmathSoaVector4 *vec0, const VmathSoaVector4 *vec1 );
612
613 /*
614  * Minimum of two 4-D vectors per element
615  */
616 static inline void vmathSoaV4MinPerElem( VmathSoaVector4 *result, const VmathSoaVector4 *vec0, const VmathSoaVector4 *vec1 );
617
618 /*
619  * Maximum element of a 4-D vector
620  */
621 static inline vec_float4 vmathSoaV4MaxElem( const VmathSoaVector4 *vec );
622
623 /*
624  * Minimum element of a 4-D vector
625  */
626 static inline vec_float4 vmathSoaV4MinElem( const VmathSoaVector4 *vec );
627
628 /*
629  * Compute the sum of all elements of a 4-D vector
630  */
631 static inline vec_float4 vmathSoaV4Sum( const VmathSoaVector4 *vec );
632
633 /*
634  * Compute the dot product of two 4-D vectors
635  */
636 static inline vec_float4 vmathSoaV4Dot( const VmathSoaVector4 *vec0, const VmathSoaVector4 *vec1 );
637
638 /*
639  * Compute the square of the length of a 4-D vector
640  */
641 static inline vec_float4 vmathSoaV4LengthSqr( const VmathSoaVector4 *vec );
642
643 /*
644  * Compute the length of a 4-D vector
645  */
646 static inline vec_float4 vmathSoaV4Length( const VmathSoaVector4 *vec );
647
648 /*
649  * Normalize a 4-D vector
650  * NOTE: 
651  * The result is unpredictable when all elements of vec are at or near zero.
652  */
653 static inline void vmathSoaV4Normalize( VmathSoaVector4 *result, const VmathSoaVector4 *vec );
654
655 /*
656  * Outer product of two 4-D vectors
657  */
658 static inline void vmathSoaV4Outer( VmathSoaMatrix4 *result, const VmathSoaVector4 *vec0, const VmathSoaVector4 *vec1 );
659
660 /*
661  * Linear interpolation between two 4-D vectors
662  * NOTE: 
663  * Does not clamp t between 0 and 1.
664  */
665 static inline void vmathSoaV4Lerp( VmathSoaVector4 *result, vec_float4 t, const VmathSoaVector4 *vec0, const VmathSoaVector4 *vec1 );
666
667 /*
668  * Spherical linear interpolation between two 4-D vectors
669  * NOTE: 
670  * The result is unpredictable if the vectors point in opposite directions.
671  * Does not clamp t between 0 and 1.
672  */
673 static inline void vmathSoaV4Slerp( VmathSoaVector4 *result, vec_float4 t, const VmathSoaVector4 *unitVec0, const VmathSoaVector4 *unitVec1 );
674
675 /*
676  * Conditionally select between two 4-D vectors
677  * NOTE: 
678  * This function uses a conditional select instruction to avoid a branch.
679  */
680 static inline void vmathSoaV4Select( VmathSoaVector4 *result, const VmathSoaVector4 *vec0, const VmathSoaVector4 *vec1, vec_uint4 select1 );
681
682 /*
683  * Store four slots of an SoA 4-D vector as half-floats
684  */
685 static inline void vmathSoaV4StoreHalfFloats( const VmathSoaVector4 *vec, vec_ushort8 *twoQuads );
686
687 #ifdef _VECTORMATH_DEBUG
688
689 /*
690  * Print a 4-D vector
691  * NOTE: 
692  * Function is only defined when _VECTORMATH_DEBUG is defined.
693  */
694 static inline void vmathSoaV4Print( const VmathSoaVector4 *vec );
695
696 /*
697  * Print a 4-D vector and an associated string identifier
698  * NOTE: 
699  * Function is only defined when _VECTORMATH_DEBUG is defined.
700  */
701 static inline void vmathSoaV4Prints( const VmathSoaVector4 *vec, const char *name );
702
703 #endif
704
705 /*
706  * Copy a 3-D point
707  */
708 static inline void vmathSoaP3Copy( VmathSoaPoint3 *result, const VmathSoaPoint3 *pnt );
709
710 /*
711  * Construct a 3-D point from x, y, and z elements
712  */
713 static inline void vmathSoaP3MakeFromElems( VmathSoaPoint3 *result, vec_float4 x, vec_float4 y, vec_float4 z );
714
715 /*
716  * Copy elements from a 3-D vector into a 3-D point
717  */
718 static inline void vmathSoaP3MakeFromV3( VmathSoaPoint3 *result, const VmathSoaVector3 *vec );
719
720 /*
721  * Set all elements of a 3-D point to the same scalar value
722  */
723 static inline void vmathSoaP3MakeFromScalar( VmathSoaPoint3 *result, vec_float4 scalar );
724
725 /*
726  * Replicate an AoS 3-D point
727  */
728 static inline void vmathSoaP3MakeFromAos( VmathSoaPoint3 *result, const VmathPoint3 *pnt );
729
730 /*
731  * Insert four AoS 3-D points
732  */
733 static inline void vmathSoaP3MakeFrom4Aos( VmathSoaPoint3 *result, const VmathPoint3 *pnt0, const VmathPoint3 *pnt1, const VmathPoint3 *pnt2, const VmathPoint3 *pnt3 );
734
735 /*
736  * Extract four AoS 3-D points
737  */
738 static inline void vmathSoaP3Get4Aos( const VmathSoaPoint3 *pnt, VmathPoint3 *result0, VmathPoint3 *result1, VmathPoint3 *result2, VmathPoint3 *result3 );
739
740 /*
741  * Set the x element of a 3-D point
742  */
743 static inline void vmathSoaP3SetX( VmathSoaPoint3 *result, vec_float4 x );
744
745 /*
746  * Set the y element of a 3-D point
747  */
748 static inline void vmathSoaP3SetY( VmathSoaPoint3 *result, vec_float4 y );
749
750 /*
751  * Set the z element of a 3-D point
752  */
753 static inline void vmathSoaP3SetZ( VmathSoaPoint3 *result, vec_float4 z );
754
755 /*
756  * Get the x element of a 3-D point
757  */
758 static inline vec_float4 vmathSoaP3GetX( const VmathSoaPoint3 *pnt );
759
760 /*
761  * Get the y element of a 3-D point
762  */
763 static inline vec_float4 vmathSoaP3GetY( const VmathSoaPoint3 *pnt );
764
765 /*
766  * Get the z element of a 3-D point
767  */
768 static inline vec_float4 vmathSoaP3GetZ( const VmathSoaPoint3 *pnt );
769
770 /*
771  * Set an x, y, or z element of a 3-D point by index
772  */
773 static inline void vmathSoaP3SetElem( VmathSoaPoint3 *result, int idx, vec_float4 value );
774
775 /*
776  * Get an x, y, or z element of a 3-D point by index
777  */
778 static inline vec_float4 vmathSoaP3GetElem( const VmathSoaPoint3 *pnt, int idx );
779
780 /*
781  * Subtract a 3-D point from another 3-D point
782  */
783 static inline void vmathSoaP3Sub( VmathSoaVector3 *result, const VmathSoaPoint3 *pnt0, const VmathSoaPoint3 *pnt1 );
784
785 /*
786  * Add a 3-D point to a 3-D vector
787  */
788 static inline void vmathSoaP3AddV3( VmathSoaPoint3 *result, const VmathSoaPoint3 *pnt, const VmathSoaVector3 *vec );
789
790 /*
791  * Subtract a 3-D vector from a 3-D point
792  */
793 static inline void vmathSoaP3SubV3( VmathSoaPoint3 *result, const VmathSoaPoint3 *pnt, const VmathSoaVector3 *vec );
794
795 /*
796  * Multiply two 3-D points per element
797  */
798 static inline void vmathSoaP3MulPerElem( VmathSoaPoint3 *result, const VmathSoaPoint3 *pnt0, const VmathSoaPoint3 *pnt1 );
799
800 /*
801  * Divide two 3-D points per element
802  * NOTE: 
803  * Floating-point behavior matches standard library function divf4.
804  */
805 static inline void vmathSoaP3DivPerElem( VmathSoaPoint3 *result, const VmathSoaPoint3 *pnt0, const VmathSoaPoint3 *pnt1 );
806
807 /*
808  * Compute the reciprocal of a 3-D point per element
809  * NOTE: 
810  * Floating-point behavior matches standard library function recipf4.
811  */
812 static inline void vmathSoaP3RecipPerElem( VmathSoaPoint3 *result, const VmathSoaPoint3 *pnt );
813
814 /*
815  * Compute the square root of a 3-D point per element
816  * NOTE: 
817  * Floating-point behavior matches standard library function sqrtf4.
818  */
819 static inline void vmathSoaP3SqrtPerElem( VmathSoaPoint3 *result, const VmathSoaPoint3 *pnt );
820
821 /*
822  * Compute the reciprocal square root of a 3-D point per element
823  * NOTE: 
824  * Floating-point behavior matches standard library function rsqrtf4.
825  */
826 static inline void vmathSoaP3RsqrtPerElem( VmathSoaPoint3 *result, const VmathSoaPoint3 *pnt );
827
828 /*
829  * Compute the absolute value of a 3-D point per element
830  */
831 static inline void vmathSoaP3AbsPerElem( VmathSoaPoint3 *result, const VmathSoaPoint3 *pnt );
832
833 /*
834  * Copy sign from one 3-D point to another, per element
835  */
836 static inline void vmathSoaP3CopySignPerElem( VmathSoaPoint3 *result, const VmathSoaPoint3 *pnt0, const VmathSoaPoint3 *pnt1 );
837
838 /*
839  * Maximum of two 3-D points per element
840  */
841 static inline void vmathSoaP3MaxPerElem( VmathSoaPoint3 *result, const VmathSoaPoint3 *pnt0, const VmathSoaPoint3 *pnt1 );
842
843 /*
844  * Minimum of two 3-D points per element
845  */
846 static inline void vmathSoaP3MinPerElem( VmathSoaPoint3 *result, const VmathSoaPoint3 *pnt0, const VmathSoaPoint3 *pnt1 );
847
848 /*
849  * Maximum element of a 3-D point
850  */
851 static inline vec_float4 vmathSoaP3MaxElem( const VmathSoaPoint3 *pnt );
852
853 /*
854  * Minimum element of a 3-D point
855  */
856 static inline vec_float4 vmathSoaP3MinElem( const VmathSoaPoint3 *pnt );
857
858 /*
859  * Compute the sum of all elements of a 3-D point
860  */
861 static inline vec_float4 vmathSoaP3Sum( const VmathSoaPoint3 *pnt );
862
863 /*
864  * Apply uniform scale to a 3-D point
865  */
866 static inline void vmathSoaP3Scale( VmathSoaPoint3 *result, const VmathSoaPoint3 *pnt, vec_float4 scaleVal );
867
868 /*
869  * Apply non-uniform scale to a 3-D point
870  */
871 static inline void vmathSoaP3NonUniformScale( VmathSoaPoint3 *result, const VmathSoaPoint3 *pnt, const VmathSoaVector3 *scaleVec );
872
873 /*
874  * Scalar projection of a 3-D point on a unit-length 3-D vector
875  */
876 static inline vec_float4 vmathSoaP3Projection( const VmathSoaPoint3 *pnt, const VmathSoaVector3 *unitVec );
877
878 /*
879  * Compute the square of the distance of a 3-D point from the coordinate-system origin
880  */
881 static inline vec_float4 vmathSoaP3DistSqrFromOrigin( const VmathSoaPoint3 *pnt );
882
883 /*
884  * Compute the distance of a 3-D point from the coordinate-system origin
885  */
886 static inline vec_float4 vmathSoaP3DistFromOrigin( const VmathSoaPoint3 *pnt );
887
888 /*
889  * Compute the square of the distance between two 3-D points
890  */
891 static inline vec_float4 vmathSoaP3DistSqr( const VmathSoaPoint3 *pnt0, const VmathSoaPoint3 *pnt1 );
892
893 /*
894  * Compute the distance between two 3-D points
895  */
896 static inline vec_float4 vmathSoaP3Dist( const VmathSoaPoint3 *pnt0, const VmathSoaPoint3 *pnt1 );
897
898 /*
899  * Linear interpolation between two 3-D points
900  * NOTE: 
901  * Does not clamp t between 0 and 1.
902  */
903 static inline void vmathSoaP3Lerp( VmathSoaPoint3 *result, vec_float4 t, const VmathSoaPoint3 *pnt0, const VmathSoaPoint3 *pnt1 );
904
905 /*
906  * Conditionally select between two 3-D points
907  * NOTE: 
908  * This function uses a conditional select instruction to avoid a branch.
909  */
910 static inline void vmathSoaP3Select( VmathSoaPoint3 *result, const VmathSoaPoint3 *pnt0, const VmathSoaPoint3 *pnt1, vec_uint4 select1 );
911
912 /*
913  * Load four three-float 3-D points, stored in three quadwords
914  */
915 static inline void vmathSoaP3LoadXYZArray( VmathSoaPoint3 *pnt, const vec_float4 *threeQuads );
916
917 /*
918  * Store four slots of an SoA 3-D point in three quadwords
919  */
920 static inline void vmathSoaP3StoreXYZArray( const VmathSoaPoint3 *pnt, vec_float4 *threeQuads );
921
922 /*
923  * Store eight slots of two SoA 3-D points as half-floats
924  */
925 static inline void vmathSoaP3StoreHalfFloats( const VmathSoaPoint3 *pnt0, const VmathSoaPoint3 *pnt1, vec_ushort8 *threeQuads );
926
927 #ifdef _VECTORMATH_DEBUG
928
929 /*
930  * Print a 3-D point
931  * NOTE: 
932  * Function is only defined when _VECTORMATH_DEBUG is defined.
933  */
934 static inline void vmathSoaP3Print( const VmathSoaPoint3 *pnt );
935
936 /*
937  * Print a 3-D point and an associated string identifier
938  * NOTE: 
939  * Function is only defined when _VECTORMATH_DEBUG is defined.
940  */
941 static inline void vmathSoaP3Prints( const VmathSoaPoint3 *pnt, const char *name );
942
943 #endif
944
945 /*
946  * Copy a quaternion
947  */
948 static inline void vmathSoaQCopy( VmathSoaQuat *result, const VmathSoaQuat *quat );
949
950 /*
951  * Construct a quaternion from x, y, z, and w elements
952  */
953 static inline void vmathSoaQMakeFromElems( VmathSoaQuat *result, vec_float4 x, vec_float4 y, vec_float4 z, vec_float4 w );
954
955 /*
956  * Construct a quaternion from a 3-D vector and a scalar
957  */
958 static inline void vmathSoaQMakeFromV3Scalar( VmathSoaQuat *result, const VmathSoaVector3 *xyz, vec_float4 w );
959
960 /*
961  * Copy elements from a 4-D vector into a quaternion
962  */
963 static inline void vmathSoaQMakeFromV4( VmathSoaQuat *result, const VmathSoaVector4 *vec );
964
965 /*
966  * Convert a rotation matrix to a unit-length quaternion
967  */
968 static inline void vmathSoaQMakeFromM3( VmathSoaQuat *result, const VmathSoaMatrix3 *rotMat );
969
970 /*
971  * Set all elements of a quaternion to the same scalar value
972  */
973 static inline void vmathSoaQMakeFromScalar( VmathSoaQuat *result, vec_float4 scalar );
974
975 /*
976  * Replicate an AoS quaternion
977  */
978 static inline void vmathSoaQMakeFromAos( VmathSoaQuat *result, const VmathQuat *quat );
979
980 /*
981  * Insert four AoS quaternions
982  */
983 static inline void vmathSoaQMakeFrom4Aos( VmathSoaQuat *result, const VmathQuat *quat0, const VmathQuat *quat1, const VmathQuat *quat2, const VmathQuat *quat3 );
984
985 /*
986  * Extract four AoS quaternions
987  */
988 static inline void vmathSoaQGet4Aos( const VmathSoaQuat *quat, VmathQuat *result0, VmathQuat *result1, VmathQuat *result2, VmathQuat *result3 );
989
990 /*
991  * Set the x, y, and z elements of a quaternion
992  * NOTE: 
993  * This function does not change the w element.
994  */
995 static inline void vmathSoaQSetXYZ( VmathSoaQuat *result, const VmathSoaVector3 *vec );
996
997 /*
998  * Get the x, y, and z elements of a quaternion
999  */
1000 static inline void vmathSoaQGetXYZ( VmathSoaVector3 *result, const VmathSoaQuat *quat );
1001
1002 /*
1003  * Set the x element of a quaternion
1004  */
1005 static inline void vmathSoaQSetX( VmathSoaQuat *result, vec_float4 x );
1006
1007 /*
1008  * Set the y element of a quaternion
1009  */
1010 static inline void vmathSoaQSetY( VmathSoaQuat *result, vec_float4 y );
1011
1012 /*
1013  * Set the z element of a quaternion
1014  */
1015 static inline void vmathSoaQSetZ( VmathSoaQuat *result, vec_float4 z );
1016
1017 /*
1018  * Set the w element of a quaternion
1019  */
1020 static inline void vmathSoaQSetW( VmathSoaQuat *result, vec_float4 w );
1021
1022 /*
1023  * Get the x element of a quaternion
1024  */
1025 static inline vec_float4 vmathSoaQGetX( const VmathSoaQuat *quat );
1026
1027 /*
1028  * Get the y element of a quaternion
1029  */
1030 static inline vec_float4 vmathSoaQGetY( const VmathSoaQuat *quat );
1031
1032 /*
1033  * Get the z element of a quaternion
1034  */
1035 static inline vec_float4 vmathSoaQGetZ( const VmathSoaQuat *quat );
1036
1037 /*
1038  * Get the w element of a quaternion
1039  */
1040 static inline vec_float4 vmathSoaQGetW( const VmathSoaQuat *quat );
1041
1042 /*
1043  * Set an x, y, z, or w element of a quaternion by index
1044  */
1045 static inline void vmathSoaQSetElem( VmathSoaQuat *result, int idx, vec_float4 value );
1046
1047 /*
1048  * Get an x, y, z, or w element of a quaternion by index
1049  */
1050 static inline vec_float4 vmathSoaQGetElem( const VmathSoaQuat *quat, int idx );
1051
1052 /*
1053  * Add two quaternions
1054  */
1055 static inline void vmathSoaQAdd( VmathSoaQuat *result, const VmathSoaQuat *quat0, const VmathSoaQuat *quat1 );
1056
1057 /*
1058  * Subtract a quaternion from another quaternion
1059  */
1060 static inline void vmathSoaQSub( VmathSoaQuat *result, const VmathSoaQuat *quat0, const VmathSoaQuat *quat1 );
1061
1062 /*
1063  * Multiply two quaternions
1064  */
1065 static inline void vmathSoaQMul( VmathSoaQuat *result, const VmathSoaQuat *quat0, const VmathSoaQuat *quat1 );
1066
1067 /*
1068  * Multiply a quaternion by a scalar
1069  */
1070 static inline void vmathSoaQScalarMul( VmathSoaQuat *result, const VmathSoaQuat *quat, vec_float4 scalar );
1071
1072 /*
1073  * Divide a quaternion by a scalar
1074  */
1075 static inline void vmathSoaQScalarDiv( VmathSoaQuat *result, const VmathSoaQuat *quat, vec_float4 scalar );
1076
1077 /*
1078  * Negate all elements of a quaternion
1079  */
1080 static inline void vmathSoaQNeg( VmathSoaQuat *result, const VmathSoaQuat *quat );
1081
1082 /*
1083  * Construct an identity quaternion
1084  */
1085 static inline void vmathSoaQMakeIdentity( VmathSoaQuat *result );
1086
1087 /*
1088  * Construct a quaternion to rotate between two unit-length 3-D vectors
1089  * NOTE: 
1090  * The result is unpredictable if unitVec0 and unitVec1 point in opposite directions.
1091  */
1092 static inline void vmathSoaQMakeRotationArc( VmathSoaQuat *result, const VmathSoaVector3 *unitVec0, const VmathSoaVector3 *unitVec1 );
1093
1094 /*
1095  * Construct a quaternion to rotate around a unit-length 3-D vector
1096  */
1097 static inline void vmathSoaQMakeRotationAxis( VmathSoaQuat *result, vec_float4 radians, const VmathSoaVector3 *unitVec );
1098
1099 /*
1100  * Construct a quaternion to rotate around the x axis
1101  */
1102 static inline void vmathSoaQMakeRotationX( VmathSoaQuat *result, vec_float4 radians );
1103
1104 /*
1105  * Construct a quaternion to rotate around the y axis
1106  */
1107 static inline void vmathSoaQMakeRotationY( VmathSoaQuat *result, vec_float4 radians );
1108
1109 /*
1110  * Construct a quaternion to rotate around the z axis
1111  */
1112 static inline void vmathSoaQMakeRotationZ( VmathSoaQuat *result, vec_float4 radians );
1113
1114 /*
1115  * Compute the conjugate of a quaternion
1116  */
1117 static inline void vmathSoaQConj( VmathSoaQuat *result, const VmathSoaQuat *quat );
1118
1119 /*
1120  * Use a unit-length quaternion to rotate a 3-D vector
1121  */
1122 static inline void vmathSoaQRotate( VmathSoaVector3 *result, const VmathSoaQuat *unitQuat, const VmathSoaVector3 *vec );
1123
1124 /*
1125  * Compute the dot product of two quaternions
1126  */
1127 static inline vec_float4 vmathSoaQDot( const VmathSoaQuat *quat0, const VmathSoaQuat *quat1 );
1128
1129 /*
1130  * Compute the norm of a quaternion
1131  */
1132 static inline vec_float4 vmathSoaQNorm( const VmathSoaQuat *quat );
1133
1134 /*
1135  * Compute the length of a quaternion
1136  */
1137 static inline vec_float4 vmathSoaQLength( const VmathSoaQuat *quat );
1138
1139 /*
1140  * Normalize a quaternion
1141  * NOTE: 
1142  * The result is unpredictable when all elements of quat are at or near zero.
1143  */
1144 static inline void vmathSoaQNormalize( VmathSoaQuat *result, const VmathSoaQuat *quat );
1145
1146 /*
1147  * Linear interpolation between two quaternions
1148  * NOTE: 
1149  * Does not clamp t between 0 and 1.
1150  */
1151 static inline void vmathSoaQLerp( VmathSoaQuat *result, vec_float4 t, const VmathSoaQuat *quat0, const VmathSoaQuat *quat1 );
1152
1153 /*
1154  * Spherical linear interpolation between two quaternions
1155  * NOTE: 
1156  * Interpolates along the shortest path between orientations.
1157  * Does not clamp t between 0 and 1.
1158  */
1159 static inline void vmathSoaQSlerp( VmathSoaQuat *result, vec_float4 t, const VmathSoaQuat *unitQuat0, const VmathSoaQuat *unitQuat1 );
1160
1161 /*
1162  * Spherical quadrangle interpolation
1163  */
1164 static inline void vmathSoaQSquad( VmathSoaQuat *result, vec_float4 t, const VmathSoaQuat *unitQuat0, const VmathSoaQuat *unitQuat1, const VmathSoaQuat *unitQuat2, const VmathSoaQuat *unitQuat3 );
1165
1166 /*
1167  * Conditionally select between two quaternions
1168  * NOTE: 
1169  * This function uses a conditional select instruction to avoid a branch.
1170  */
1171 static inline void vmathSoaQSelect( VmathSoaQuat *result, const VmathSoaQuat *quat0, const VmathSoaQuat *quat1, vec_uint4 select1 );
1172
1173 #ifdef _VECTORMATH_DEBUG
1174
1175 /*
1176  * Print a quaternion
1177  * NOTE: 
1178  * Function is only defined when _VECTORMATH_DEBUG is defined.
1179  */
1180 static inline void vmathSoaQPrint( const VmathSoaQuat *quat );
1181
1182 /*
1183  * Print a quaternion and an associated string identifier
1184  * NOTE: 
1185  * Function is only defined when _VECTORMATH_DEBUG is defined.
1186  */
1187 static inline void vmathSoaQPrints( const VmathSoaQuat *quat, const char *name );
1188
1189 #endif
1190
1191 /*
1192  * Copy a 3x3 matrix
1193  */
1194 static inline void vmathSoaM3Copy( VmathSoaMatrix3 *result, const VmathSoaMatrix3 *mat );
1195
1196 /*
1197  * Construct a 3x3 matrix containing the specified columns
1198  */
1199 static inline void vmathSoaM3MakeFromCols( VmathSoaMatrix3 *result, const VmathSoaVector3 *col0, const VmathSoaVector3 *col1, const VmathSoaVector3 *col2 );
1200
1201 /*
1202  * Construct a 3x3 rotation matrix from a unit-length quaternion
1203  */
1204 static inline void vmathSoaM3MakeFromQ( VmathSoaMatrix3 *result, const VmathSoaQuat *unitQuat );
1205
1206 /*
1207  * Set all elements of a 3x3 matrix to the same scalar value
1208  */
1209 static inline void vmathSoaM3MakeFromScalar( VmathSoaMatrix3 *result, vec_float4 scalar );
1210
1211 /*
1212  * Replicate an AoS 3x3 matrix
1213  */
1214 static inline void vmathSoaM3MakeFromAos( VmathSoaMatrix3 *result, const VmathMatrix3 *mat );
1215
1216 /*
1217  * Insert four AoS 3x3 matrices
1218  */
1219 static inline void vmathSoaM3MakeFrom4Aos( VmathSoaMatrix3 *result, const VmathMatrix3 *mat0, const VmathMatrix3 *mat1, const VmathMatrix3 *mat2, const VmathMatrix3 *mat3 );
1220
1221 /*
1222  * Extract four AoS 3x3 matrices
1223  */
1224 static inline void vmathSoaM3Get4Aos( const VmathSoaMatrix3 *mat, VmathMatrix3 *result0, VmathMatrix3 *result1, VmathMatrix3 *result2, VmathMatrix3 *result3 );
1225
1226 /*
1227  * Set column 0 of a 3x3 matrix
1228  */
1229 static inline void vmathSoaM3SetCol0( VmathSoaMatrix3 *result, const VmathSoaVector3 *col0 );
1230
1231 /*
1232  * Set column 1 of a 3x3 matrix
1233  */
1234 static inline void vmathSoaM3SetCol1( VmathSoaMatrix3 *result, const VmathSoaVector3 *col1 );
1235
1236 /*
1237  * Set column 2 of a 3x3 matrix
1238  */
1239 static inline void vmathSoaM3SetCol2( VmathSoaMatrix3 *result, const VmathSoaVector3 *col2 );
1240
1241 /*
1242  * Get column 0 of a 3x3 matrix
1243  */
1244 static inline void vmathSoaM3GetCol0( VmathSoaVector3 *result, const VmathSoaMatrix3 *mat );
1245
1246 /*
1247  * Get column 1 of a 3x3 matrix
1248  */
1249 static inline void vmathSoaM3GetCol1( VmathSoaVector3 *result, const VmathSoaMatrix3 *mat );
1250
1251 /*
1252  * Get column 2 of a 3x3 matrix
1253  */
1254 static inline void vmathSoaM3GetCol2( VmathSoaVector3 *result, const VmathSoaMatrix3 *mat );
1255
1256 /*
1257  * Set the column of a 3x3 matrix referred to by the specified index
1258  */
1259 static inline void vmathSoaM3SetCol( VmathSoaMatrix3 *result, int col, const VmathSoaVector3 *vec );
1260
1261 /*
1262  * Set the row of a 3x3 matrix referred to by the specified index
1263  */
1264 static inline void vmathSoaM3SetRow( VmathSoaMatrix3 *result, int row, const VmathSoaVector3 *vec );
1265
1266 /*
1267  * Get the column of a 3x3 matrix referred to by the specified index
1268  */
1269 static inline void vmathSoaM3GetCol( VmathSoaVector3 *result, const VmathSoaMatrix3 *mat, int col );
1270
1271 /*
1272  * Get the row of a 3x3 matrix referred to by the specified index
1273  */
1274 static inline void vmathSoaM3GetRow( VmathSoaVector3 *result, const VmathSoaMatrix3 *mat, int row );
1275
1276 /*
1277  * Set the element of a 3x3 matrix referred to by column and row indices
1278  */
1279 static inline void vmathSoaM3SetElem( VmathSoaMatrix3 *result, int col, int row, vec_float4 val );
1280
1281 /*
1282  * Get the element of a 3x3 matrix referred to by column and row indices
1283  */
1284 static inline vec_float4 vmathSoaM3GetElem( const VmathSoaMatrix3 *mat, int col, int row );
1285
1286 /*
1287  * Add two 3x3 matrices
1288  */
1289 static inline void vmathSoaM3Add( VmathSoaMatrix3 *result, const VmathSoaMatrix3 *mat0, const VmathSoaMatrix3 *mat1 );
1290
1291 /*
1292  * Subtract a 3x3 matrix from another 3x3 matrix
1293  */
1294 static inline void vmathSoaM3Sub( VmathSoaMatrix3 *result, const VmathSoaMatrix3 *mat0, const VmathSoaMatrix3 *mat1 );
1295
1296 /*
1297  * Negate all elements of a 3x3 matrix
1298  */
1299 static inline void vmathSoaM3Neg( VmathSoaMatrix3 *result, const VmathSoaMatrix3 *mat );
1300
1301 /*
1302  * Multiply a 3x3 matrix by a scalar
1303  */
1304 static inline void vmathSoaM3ScalarMul( VmathSoaMatrix3 *result, const VmathSoaMatrix3 *mat, vec_float4 scalar );
1305
1306 /*
1307  * Multiply a 3x3 matrix by a 3-D vector
1308  */
1309 static inline void vmathSoaM3MulV3( VmathSoaVector3 *result, const VmathSoaMatrix3 *mat, const VmathSoaVector3 *vec );
1310
1311 /*
1312  * Multiply two 3x3 matrices
1313  */
1314 static inline void vmathSoaM3Mul( VmathSoaMatrix3 *result, const VmathSoaMatrix3 *mat0, const VmathSoaMatrix3 *mat1 );
1315
1316 /*
1317  * Construct an identity 3x3 matrix
1318  */
1319 static inline void vmathSoaM3MakeIdentity( VmathSoaMatrix3 *result );
1320
1321 /*
1322  * Construct a 3x3 matrix to rotate around the x axis
1323  */
1324 static inline void vmathSoaM3MakeRotationX( VmathSoaMatrix3 *result, vec_float4 radians );
1325
1326 /*
1327  * Construct a 3x3 matrix to rotate around the y axis
1328  */
1329 static inline void vmathSoaM3MakeRotationY( VmathSoaMatrix3 *result, vec_float4 radians );
1330
1331 /*
1332  * Construct a 3x3 matrix to rotate around the z axis
1333  */
1334 static inline void vmathSoaM3MakeRotationZ( VmathSoaMatrix3 *result, vec_float4 radians );
1335
1336 /*
1337  * Construct a 3x3 matrix to rotate around the x, y, and z axes
1338  */
1339 static inline void vmathSoaM3MakeRotationZYX( VmathSoaMatrix3 *result, const VmathSoaVector3 *radiansXYZ );
1340
1341 /*
1342  * Construct a 3x3 matrix to rotate around a unit-length 3-D vector
1343  */
1344 static inline void vmathSoaM3MakeRotationAxis( VmathSoaMatrix3 *result, vec_float4 radians, const VmathSoaVector3 *unitVec );
1345
1346 /*
1347  * Construct a rotation matrix from a unit-length quaternion
1348  */
1349 static inline void vmathSoaM3MakeRotationQ( VmathSoaMatrix3 *result, const VmathSoaQuat *unitQuat );
1350
1351 /*
1352  * Construct a 3x3 matrix to perform scaling
1353  */
1354 static inline void vmathSoaM3MakeScale( VmathSoaMatrix3 *result, const VmathSoaVector3 *scaleVec );
1355
1356 /*
1357  * Append (post-multiply) a scale transformation to a 3x3 matrix
1358  * NOTE: 
1359  * Faster than creating and multiplying a scale transformation matrix.
1360  */
1361 static inline void vmathSoaM3AppendScale( VmathSoaMatrix3 *result, const VmathSoaMatrix3 *mat, const VmathSoaVector3 *scaleVec );
1362
1363 /*
1364  * Prepend (pre-multiply) a scale transformation to a 3x3 matrix
1365  * NOTE: 
1366  * Faster than creating and multiplying a scale transformation matrix.
1367  */
1368 static inline void vmathSoaM3PrependScale( VmathSoaMatrix3 *result, const VmathSoaVector3 *scaleVec, const VmathSoaMatrix3 *mat );
1369
1370 /*
1371  * Multiply two 3x3 matrices per element
1372  */
1373 static inline void vmathSoaM3MulPerElem( VmathSoaMatrix3 *result, const VmathSoaMatrix3 *mat0, const VmathSoaMatrix3 *mat1 );
1374
1375 /*
1376  * Compute the absolute value of a 3x3 matrix per element
1377  */
1378 static inline void vmathSoaM3AbsPerElem( VmathSoaMatrix3 *result, const VmathSoaMatrix3 *mat );
1379
1380 /*
1381  * Transpose of a 3x3 matrix
1382  */
1383 static inline void vmathSoaM3Transpose( VmathSoaMatrix3 *result, const VmathSoaMatrix3 *mat );
1384
1385 /*
1386  * Compute the inverse of a 3x3 matrix
1387  * NOTE: 
1388  * Result is unpredictable when the determinant of mat is equal to or near 0.
1389  */
1390 static inline void vmathSoaM3Inverse( VmathSoaMatrix3 *result, const VmathSoaMatrix3 *mat );
1391
1392 /*
1393  * Determinant of a 3x3 matrix
1394  */
1395 static inline vec_float4 vmathSoaM3Determinant( const VmathSoaMatrix3 *mat );
1396
1397 /*
1398  * Conditionally select between two 3x3 matrices
1399  * NOTE: 
1400  * This function uses a conditional select instruction to avoid a branch.
1401  */
1402 static inline void vmathSoaM3Select( VmathSoaMatrix3 *result, const VmathSoaMatrix3 *mat0, const VmathSoaMatrix3 *mat1, vec_uint4 select1 );
1403
1404 #ifdef _VECTORMATH_DEBUG
1405
1406 /*
1407  * Print a 3x3 matrix
1408  * NOTE: 
1409  * Function is only defined when _VECTORMATH_DEBUG is defined.
1410  */
1411 static inline void vmathSoaM3Print( const VmathSoaMatrix3 *mat );
1412
1413 /*
1414  * Print a 3x3 matrix and an associated string identifier
1415  * NOTE: 
1416  * Function is only defined when _VECTORMATH_DEBUG is defined.
1417  */
1418 static inline void vmathSoaM3Prints( const VmathSoaMatrix3 *mat, const char *name );
1419
1420 #endif
1421
1422 /*
1423  * Copy a 4x4 matrix
1424  */
1425 static inline void vmathSoaM4Copy( VmathSoaMatrix4 *result, const VmathSoaMatrix4 *mat );
1426
1427 /*
1428  * Construct a 4x4 matrix containing the specified columns
1429  */
1430 static inline void vmathSoaM4MakeFromCols( VmathSoaMatrix4 *result, const VmathSoaVector4 *col0, const VmathSoaVector4 *col1, const VmathSoaVector4 *col2, const VmathSoaVector4 *col3 );
1431
1432 /*
1433  * Construct a 4x4 matrix from a 3x4 transformation matrix
1434  */
1435 static inline void vmathSoaM4MakeFromT3( VmathSoaMatrix4 *result, const VmathSoaTransform3 *mat );
1436
1437 /*
1438  * Construct a 4x4 matrix from a 3x3 matrix and a 3-D vector
1439  */
1440 static inline void vmathSoaM4MakeFromM3V3( VmathSoaMatrix4 *result, const VmathSoaMatrix3 *mat, const VmathSoaVector3 *translateVec );
1441
1442 /*
1443  * Construct a 4x4 matrix from a unit-length quaternion and a 3-D vector
1444  */
1445 static inline void vmathSoaM4MakeFromQV3( VmathSoaMatrix4 *result, const VmathSoaQuat *unitQuat, const VmathSoaVector3 *translateVec );
1446
1447 /*
1448  * Set all elements of a 4x4 matrix to the same scalar value
1449  */
1450 static inline void vmathSoaM4MakeFromScalar( VmathSoaMatrix4 *result, vec_float4 scalar );
1451
1452 /*
1453  * Replicate an AoS 4x4 matrix
1454  */
1455 static inline void vmathSoaM4MakeFromAos( VmathSoaMatrix4 *result, const VmathMatrix4 *mat );
1456
1457 /*
1458  * Insert four AoS 4x4 matrices
1459  */
1460 static inline void vmathSoaM4MakeFrom4Aos( VmathSoaMatrix4 *result, const VmathMatrix4 *mat0, const VmathMatrix4 *mat1, const VmathMatrix4 *mat2, const VmathMatrix4 *mat3 );
1461
1462 /*
1463  * Extract four AoS 4x4 matrices
1464  */
1465 static inline void vmathSoaM4Get4Aos( const VmathSoaMatrix4 *mat, VmathMatrix4 *result0, VmathMatrix4 *result1, VmathMatrix4 *result2, VmathMatrix4 *result3 );
1466
1467 /*
1468  * Set the upper-left 3x3 submatrix
1469  * NOTE: 
1470  * This function does not change the bottom row elements.
1471  */
1472 static inline void vmathSoaM4SetUpper3x3( VmathSoaMatrix4 *result, const VmathSoaMatrix3 *mat3 );
1473
1474 /*
1475  * Get the upper-left 3x3 submatrix of a 4x4 matrix
1476  */
1477 static inline void vmathSoaM4GetUpper3x3( VmathSoaMatrix3 *result, const VmathSoaMatrix4 *mat );
1478
1479 /*
1480  * Set translation component
1481  * NOTE: 
1482  * This function does not change the bottom row elements.
1483  */
1484 static inline void vmathSoaM4SetTranslation( VmathSoaMatrix4 *result, const VmathSoaVector3 *translateVec );
1485
1486 /*
1487  * Get the translation component of a 4x4 matrix
1488  */
1489 static inline void vmathSoaM4GetTranslation( VmathSoaVector3 *result, const VmathSoaMatrix4 *mat );
1490
1491 /*
1492  * Set column 0 of a 4x4 matrix
1493  */
1494 static inline void vmathSoaM4SetCol0( VmathSoaMatrix4 *result, const VmathSoaVector4 *col0 );
1495
1496 /*
1497  * Set column 1 of a 4x4 matrix
1498  */
1499 static inline void vmathSoaM4SetCol1( VmathSoaMatrix4 *result, const VmathSoaVector4 *col1 );
1500
1501 /*
1502  * Set column 2 of a 4x4 matrix
1503  */
1504 static inline void vmathSoaM4SetCol2( VmathSoaMatrix4 *result, const VmathSoaVector4 *col2 );
1505
1506 /*
1507  * Set column 3 of a 4x4 matrix
1508  */
1509 static inline void vmathSoaM4SetCol3( VmathSoaMatrix4 *result, const VmathSoaVector4 *col3 );
1510
1511 /*
1512  * Get column 0 of a 4x4 matrix
1513  */
1514 static inline void vmathSoaM4GetCol0( VmathSoaVector4 *result, const VmathSoaMatrix4 *mat );
1515
1516 /*
1517  * Get column 1 of a 4x4 matrix
1518  */
1519 static inline void vmathSoaM4GetCol1( VmathSoaVector4 *result, const VmathSoaMatrix4 *mat );
1520
1521 /*
1522  * Get column 2 of a 4x4 matrix
1523  */
1524 static inline void vmathSoaM4GetCol2( VmathSoaVector4 *result, const VmathSoaMatrix4 *mat );
1525
1526 /*
1527  * Get column 3 of a 4x4 matrix
1528  */
1529 static inline void vmathSoaM4GetCol3( VmathSoaVector4 *result, const VmathSoaMatrix4 *mat );
1530
1531 /*
1532  * Set the column of a 4x4 matrix referred to by the specified index
1533  */
1534 static inline void vmathSoaM4SetCol( VmathSoaMatrix4 *result, int col, const VmathSoaVector4 *vec );
1535
1536 /*
1537  * Set the row of a 4x4 matrix referred to by the specified index
1538  */
1539 static inline void vmathSoaM4SetRow( VmathSoaMatrix4 *result, int row, const VmathSoaVector4 *vec );
1540
1541 /*
1542  * Get the column of a 4x4 matrix referred to by the specified index
1543  */
1544 static inline void vmathSoaM4GetCol( VmathSoaVector4 *result, const VmathSoaMatrix4 *mat, int col );
1545
1546 /*
1547  * Get the row of a 4x4 matrix referred to by the specified index
1548  */
1549 static inline void vmathSoaM4GetRow( VmathSoaVector4 *result, const VmathSoaMatrix4 *mat, int row );
1550
1551 /*
1552  * Set the element of a 4x4 matrix referred to by column and row indices
1553  */
1554 static inline void vmathSoaM4SetElem( VmathSoaMatrix4 *result, int col, int row, vec_float4 val );
1555
1556 /*
1557  * Get the element of a 4x4 matrix referred to by column and row indices
1558  */
1559 static inline vec_float4 vmathSoaM4GetElem( const VmathSoaMatrix4 *mat, int col, int row );
1560
1561 /*
1562  * Add two 4x4 matrices
1563  */
1564 static inline void vmathSoaM4Add( VmathSoaMatrix4 *result, const VmathSoaMatrix4 *mat0, const VmathSoaMatrix4 *mat1 );
1565
1566 /*
1567  * Subtract a 4x4 matrix from another 4x4 matrix
1568  */
1569 static inline void vmathSoaM4Sub( VmathSoaMatrix4 *result, const VmathSoaMatrix4 *mat0, const VmathSoaMatrix4 *mat1 );
1570
1571 /*
1572  * Negate all elements of a 4x4 matrix
1573  */
1574 static inline void vmathSoaM4Neg( VmathSoaMatrix4 *result, const VmathSoaMatrix4 *mat );
1575
1576 /*
1577  * Multiply a 4x4 matrix by a scalar
1578  */
1579 static inline void vmathSoaM4ScalarMul( VmathSoaMatrix4 *result, const VmathSoaMatrix4 *mat, vec_float4 scalar );
1580
1581 /*
1582  * Multiply a 4x4 matrix by a 4-D vector
1583  */
1584 static inline void vmathSoaM4MulV4( VmathSoaVector4 *result, const VmathSoaMatrix4 *mat, const VmathSoaVector4 *vec );
1585
1586 /*
1587  * Multiply a 4x4 matrix by a 3-D vector
1588  */
1589 static inline void vmathSoaM4MulV3( VmathSoaVector4 *result, const VmathSoaMatrix4 *mat, const VmathSoaVector3 *vec );
1590
1591 /*
1592  * Multiply a 4x4 matrix by a 3-D point
1593  */
1594 static inline void vmathSoaM4MulP3( VmathSoaVector4 *result, const VmathSoaMatrix4 *mat, const VmathSoaPoint3 *pnt );
1595
1596 /*
1597  * Multiply two 4x4 matrices
1598  */
1599 static inline void vmathSoaM4Mul( VmathSoaMatrix4 *result, const VmathSoaMatrix4 *mat0, const VmathSoaMatrix4 *mat1 );
1600
1601 /*
1602  * Multiply a 4x4 matrix by a 3x4 transformation matrix
1603  */
1604 static inline void vmathSoaM4MulT3( VmathSoaMatrix4 *result, const VmathSoaMatrix4 *mat, const VmathSoaTransform3 *tfrm );
1605
1606 /*
1607  * Construct an identity 4x4 matrix
1608  */
1609 static inline void vmathSoaM4MakeIdentity( VmathSoaMatrix4 *result );
1610
1611 /*
1612  * Construct a 4x4 matrix to rotate around the x axis
1613  */
1614 static inline void vmathSoaM4MakeRotationX( VmathSoaMatrix4 *result, vec_float4 radians );
1615
1616 /*
1617  * Construct a 4x4 matrix to rotate around the y axis
1618  */
1619 static inline void vmathSoaM4MakeRotationY( VmathSoaMatrix4 *result, vec_float4 radians );
1620
1621 /*
1622  * Construct a 4x4 matrix to rotate around the z axis
1623  */
1624 static inline void vmathSoaM4MakeRotationZ( VmathSoaMatrix4 *result, vec_float4 radians );
1625
1626 /*
1627  * Construct a 4x4 matrix to rotate around the x, y, and z axes
1628  */
1629 static inline void vmathSoaM4MakeRotationZYX( VmathSoaMatrix4 *result, const VmathSoaVector3 *radiansXYZ );
1630
1631 /*
1632  * Construct a 4x4 matrix to rotate around a unit-length 3-D vector
1633  */
1634 static inline void vmathSoaM4MakeRotationAxis( VmathSoaMatrix4 *result, vec_float4 radians, const VmathSoaVector3 *unitVec );
1635
1636 /*
1637  * Construct a rotation matrix from a unit-length quaternion
1638  */
1639 static inline void vmathSoaM4MakeRotationQ( VmathSoaMatrix4 *result, const VmathSoaQuat *unitQuat );
1640
1641 /*
1642  * Construct a 4x4 matrix to perform scaling
1643  */
1644 static inline void vmathSoaM4MakeScale( VmathSoaMatrix4 *result, const VmathSoaVector3 *scaleVec );
1645
1646 /*
1647  * Construct a 4x4 matrix to perform translation
1648  */
1649 static inline void vmathSoaM4MakeTranslation( VmathSoaMatrix4 *result, const VmathSoaVector3 *translateVec );
1650
1651 /*
1652  * Construct viewing matrix based on eye position, position looked at, and up direction
1653  */
1654 static inline void vmathSoaM4MakeLookAt( VmathSoaMatrix4 *result, const VmathSoaPoint3 *eyePos, const VmathSoaPoint3 *lookAtPos, const VmathSoaVector3 *upVec );
1655
1656 /*
1657  * Construct a perspective projection matrix
1658  */
1659 static inline void vmathSoaM4MakePerspective( VmathSoaMatrix4 *result, vec_float4 fovyRadians, vec_float4 aspect, vec_float4 zNear, vec_float4 zFar );
1660
1661 /*
1662  * Construct a perspective projection matrix based on frustum
1663  */
1664 static inline void vmathSoaM4MakeFrustum( VmathSoaMatrix4 *result, vec_float4 left, vec_float4 right, vec_float4 bottom, vec_float4 top, vec_float4 zNear, vec_float4 zFar );
1665
1666 /*
1667  * Construct an orthographic projection matrix
1668  */
1669 static inline void vmathSoaM4MakeOrthographic( VmathSoaMatrix4 *result, vec_float4 left, vec_float4 right, vec_float4 bottom, vec_float4 top, vec_float4 zNear, vec_float4 zFar );
1670
1671 /*
1672  * Append (post-multiply) a scale transformation to a 4x4 matrix
1673  * NOTE: 
1674  * Faster than creating and multiplying a scale transformation matrix.
1675  */
1676 static inline void vmathSoaM4AppendScale( VmathSoaMatrix4 *result, const VmathSoaMatrix4 *mat, const VmathSoaVector3 *scaleVec );
1677
1678 /*
1679  * Prepend (pre-multiply) a scale transformation to a 4x4 matrix
1680  * NOTE: 
1681  * Faster than creating and multiplying a scale transformation matrix.
1682  */
1683 static inline void vmathSoaM4PrependScale( VmathSoaMatrix4 *result, const VmathSoaVector3 *scaleVec, const VmathSoaMatrix4 *mat );
1684
1685 /*
1686  * Multiply two 4x4 matrices per element
1687  */
1688 static inline void vmathSoaM4MulPerElem( VmathSoaMatrix4 *result, const VmathSoaMatrix4 *mat0, const VmathSoaMatrix4 *mat1 );
1689
1690 /*
1691  * Compute the absolute value of a 4x4 matrix per element
1692  */
1693 static inline void vmathSoaM4AbsPerElem( VmathSoaMatrix4 *result, const VmathSoaMatrix4 *mat );
1694
1695 /*
1696  * Transpose of a 4x4 matrix
1697  */
1698 static inline void vmathSoaM4Transpose( VmathSoaMatrix4 *result, const VmathSoaMatrix4 *mat );
1699
1700 /*
1701  * Compute the inverse of a 4x4 matrix
1702  * NOTE: 
1703  * Result is unpredictable when the determinant of mat is equal to or near 0.
1704  */
1705 static inline void vmathSoaM4Inverse( VmathSoaMatrix4 *result, const VmathSoaMatrix4 *mat );
1706
1707 /*
1708  * Compute the inverse of a 4x4 matrix, which is expected to be an affine matrix
1709  * NOTE: 
1710  * This can be used to achieve better performance than a general inverse when the specified 4x4 matrix meets the given restrictions.  The result is unpredictable when the determinant of mat is equal to or near 0.
1711  */
1712 static inline void vmathSoaM4AffineInverse( VmathSoaMatrix4 *result, const VmathSoaMatrix4 *mat );
1713
1714 /*
1715  * Compute the inverse of a 4x4 matrix, which is expected to be an affine matrix with an orthogonal upper-left 3x3 submatrix
1716  * NOTE: 
1717  * This can be used to achieve better performance than a general inverse when the specified 4x4 matrix meets the given restrictions.
1718  */
1719 static inline void vmathSoaM4OrthoInverse( VmathSoaMatrix4 *result, const VmathSoaMatrix4 *mat );
1720
1721 /*
1722  * Determinant of a 4x4 matrix
1723  */
1724 static inline vec_float4 vmathSoaM4Determinant( const VmathSoaMatrix4 *mat );
1725
1726 /*
1727  * Conditionally select between two 4x4 matrices
1728  * NOTE: 
1729  * This function uses a conditional select instruction to avoid a branch.
1730  */
1731 static inline void vmathSoaM4Select( VmathSoaMatrix4 *result, const VmathSoaMatrix4 *mat0, const VmathSoaMatrix4 *mat1, vec_uint4 select1 );
1732
1733 #ifdef _VECTORMATH_DEBUG
1734
1735 /*
1736  * Print a 4x4 matrix
1737  * NOTE: 
1738  * Function is only defined when _VECTORMATH_DEBUG is defined.
1739  */
1740 static inline void vmathSoaM4Print( const VmathSoaMatrix4 *mat );
1741
1742 /*
1743  * Print a 4x4 matrix and an associated string identifier
1744  * NOTE: 
1745  * Function is only defined when _VECTORMATH_DEBUG is defined.
1746  */
1747 static inline void vmathSoaM4Prints( const VmathSoaMatrix4 *mat, const char *name );
1748
1749 #endif
1750
1751 /*
1752  * Copy a 3x4 transformation matrix
1753  */
1754 static inline void vmathSoaT3Copy( VmathSoaTransform3 *result, const VmathSoaTransform3 *tfrm );
1755
1756 /*
1757  * Construct a 3x4 transformation matrix containing the specified columns
1758  */
1759 static inline void vmathSoaT3MakeFromCols( VmathSoaTransform3 *result, const VmathSoaVector3 *col0, const VmathSoaVector3 *col1, const VmathSoaVector3 *col2, const VmathSoaVector3 *col3 );
1760
1761 /*
1762  * Construct a 3x4 transformation matrix from a 3x3 matrix and a 3-D vector
1763  */
1764 static inline void vmathSoaT3MakeFromM3V3( VmathSoaTransform3 *result, const VmathSoaMatrix3 *tfrm, const VmathSoaVector3 *translateVec );
1765
1766 /*
1767  * Construct a 3x4 transformation matrix from a unit-length quaternion and a 3-D vector
1768  */
1769 static inline void vmathSoaT3MakeFromQV3( VmathSoaTransform3 *result, const VmathSoaQuat *unitQuat, const VmathSoaVector3 *translateVec );
1770
1771 /*
1772  * Set all elements of a 3x4 transformation matrix to the same scalar value
1773  */
1774 static inline void vmathSoaT3MakeFromScalar( VmathSoaTransform3 *result, vec_float4 scalar );
1775
1776 /*
1777  * Replicate an AoS 3x4 transformation matrix
1778  */
1779 static inline void vmathSoaT3MakeFromAos( VmathSoaTransform3 *result, const VmathTransform3 *tfrm );
1780
1781 /*
1782  * Insert four AoS 3x4 transformation matrices
1783  */
1784 static inline void vmathSoaT3MakeFrom4Aos( VmathSoaTransform3 *result, const VmathTransform3 *tfrm0, const VmathTransform3 *tfrm1, const VmathTransform3 *tfrm2, const VmathTransform3 *tfrm3 );
1785
1786 /*
1787  * Extract four AoS 3x4 transformation matrices
1788  */
1789 static inline void vmathSoaT3Get4Aos( const VmathSoaTransform3 *tfrm, VmathTransform3 *result0, VmathTransform3 *result1, VmathTransform3 *result2, VmathTransform3 *result3 );
1790
1791 /*
1792  * Set the upper-left 3x3 submatrix
1793  */
1794 static inline void vmathSoaT3SetUpper3x3( VmathSoaTransform3 *result, const VmathSoaMatrix3 *mat3 );
1795
1796 /*
1797  * Get the upper-left 3x3 submatrix of a 3x4 transformation matrix
1798  */
1799 static inline void vmathSoaT3GetUpper3x3( VmathSoaMatrix3 *result, const VmathSoaTransform3 *tfrm );
1800
1801 /*
1802  * Set translation component
1803  */
1804 static inline void vmathSoaT3SetTranslation( VmathSoaTransform3 *result, const VmathSoaVector3 *translateVec );
1805
1806 /*
1807  * Get the translation component of a 3x4 transformation matrix
1808  */
1809 static inline void vmathSoaT3GetTranslation( VmathSoaVector3 *result, const VmathSoaTransform3 *tfrm );
1810
1811 /*
1812  * Set column 0 of a 3x4 transformation matrix
1813  */
1814 static inline void vmathSoaT3SetCol0( VmathSoaTransform3 *result, const VmathSoaVector3 *col0 );
1815
1816 /*
1817  * Set column 1 of a 3x4 transformation matrix
1818  */
1819 static inline void vmathSoaT3SetCol1( VmathSoaTransform3 *result, const VmathSoaVector3 *col1 );
1820
1821 /*
1822  * Set column 2 of a 3x4 transformation matrix
1823  */
1824 static inline void vmathSoaT3SetCol2( VmathSoaTransform3 *result, const VmathSoaVector3 *col2 );
1825
1826 /*
1827  * Set column 3 of a 3x4 transformation matrix
1828  */
1829 static inline void vmathSoaT3SetCol3( VmathSoaTransform3 *result, const VmathSoaVector3 *col3 );
1830
1831 /*
1832  * Get column 0 of a 3x4 transformation matrix
1833  */
1834 static inline void vmathSoaT3GetCol0( VmathSoaVector3 *result, const VmathSoaTransform3 *tfrm );
1835
1836 /*
1837  * Get column 1 of a 3x4 transformation matrix
1838  */
1839 static inline void vmathSoaT3GetCol1( VmathSoaVector3 *result, const VmathSoaTransform3 *tfrm );
1840
1841 /*
1842  * Get column 2 of a 3x4 transformation matrix
1843  */
1844 static inline void vmathSoaT3GetCol2( VmathSoaVector3 *result, const VmathSoaTransform3 *tfrm );
1845
1846 /*
1847  * Get column 3 of a 3x4 transformation matrix
1848  */
1849 static inline void vmathSoaT3GetCol3( VmathSoaVector3 *result, const VmathSoaTransform3 *tfrm );
1850
1851 /*
1852  * Set the column of a 3x4 transformation matrix referred to by the specified index
1853  */
1854 static inline void vmathSoaT3SetCol( VmathSoaTransform3 *result, int col, const VmathSoaVector3 *vec );
1855
1856 /*
1857  * Set the row of a 3x4 transformation matrix referred to by the specified index
1858  */
1859 static inline void vmathSoaT3SetRow( VmathSoaTransform3 *result, int row, const VmathSoaVector4 *vec );
1860
1861 /*
1862  * Get the column of a 3x4 transformation matrix referred to by the specified index
1863  */
1864 static inline void vmathSoaT3GetCol( VmathSoaVector3 *result, const VmathSoaTransform3 *tfrm, int col );
1865
1866 /*
1867  * Get the row of a 3x4 transformation matrix referred to by the specified index
1868  */
1869 static inline void vmathSoaT3GetRow( VmathSoaVector4 *result, const VmathSoaTransform3 *tfrm, int row );
1870
1871 /*
1872  * Set the element of a 3x4 transformation matrix referred to by column and row indices
1873  */
1874 static inline void vmathSoaT3SetElem( VmathSoaTransform3 *result, int col, int row, vec_float4 val );
1875
1876 /*
1877  * Get the element of a 3x4 transformation matrix referred to by column and row indices
1878  */
1879 static inline vec_float4 vmathSoaT3GetElem( const VmathSoaTransform3 *tfrm, int col, int row );
1880
1881 /*
1882  * Multiply a 3x4 transformation matrix by a 3-D vector
1883  */
1884 static inline void vmathSoaT3MulV3( VmathSoaVector3 *result, const VmathSoaTransform3 *tfrm, const VmathSoaVector3 *vec );
1885
1886 /*
1887  * Multiply a 3x4 transformation matrix by a 3-D point
1888  */
1889 static inline void vmathSoaT3MulP3( VmathSoaPoint3 *result, const VmathSoaTransform3 *tfrm, const VmathSoaPoint3 *pnt );
1890
1891 /*
1892  * Multiply two 3x4 transformation matrices
1893  */
1894 static inline void vmathSoaT3Mul( VmathSoaTransform3 *result, const VmathSoaTransform3 *tfrm0, const VmathSoaTransform3 *tfrm1 );
1895
1896 /*
1897  * Construct an identity 3x4 transformation matrix
1898  */
1899 static inline void vmathSoaT3MakeIdentity( VmathSoaTransform3 *result );
1900
1901 /*
1902  * Construct a 3x4 transformation matrix to rotate around the x axis
1903  */
1904 static inline void vmathSoaT3MakeRotationX( VmathSoaTransform3 *result, vec_float4 radians );
1905
1906 /*
1907  * Construct a 3x4 transformation matrix to rotate around the y axis
1908  */
1909 static inline void vmathSoaT3MakeRotationY( VmathSoaTransform3 *result, vec_float4 radians );
1910
1911 /*
1912  * Construct a 3x4 transformation matrix to rotate around the z axis
1913  */
1914 static inline void vmathSoaT3MakeRotationZ( VmathSoaTransform3 *result, vec_float4 radians );
1915
1916 /*
1917  * Construct a 3x4 transformation matrix to rotate around the x, y, and z axes
1918  */
1919 static inline void vmathSoaT3MakeRotationZYX( VmathSoaTransform3 *result, const VmathSoaVector3 *radiansXYZ );
1920
1921 /*
1922  * Construct a 3x4 transformation matrix to rotate around a unit-length 3-D vector
1923  */
1924 static inline void vmathSoaT3MakeRotationAxis( VmathSoaTransform3 *result, vec_float4 radians, const VmathSoaVector3 *unitVec );
1925
1926 /*
1927  * Construct a rotation matrix from a unit-length quaternion
1928  */
1929 static inline void vmathSoaT3MakeRotationQ( VmathSoaTransform3 *result, const VmathSoaQuat *unitQuat );
1930
1931 /*
1932  * Construct a 3x4 transformation matrix to perform scaling
1933  */
1934 static inline void vmathSoaT3MakeScale( VmathSoaTransform3 *result, const VmathSoaVector3 *scaleVec );
1935
1936 /*
1937  * Construct a 3x4 transformation matrix to perform translation
1938  */
1939 static inline void vmathSoaT3MakeTranslation( VmathSoaTransform3 *result, const VmathSoaVector3 *translateVec );
1940
1941 /*
1942  * Append (post-multiply) a scale transformation to a 3x4 transformation matrix
1943  * NOTE: 
1944  * Faster than creating and multiplying a scale transformation matrix.
1945  */
1946 static inline void vmathSoaT3AppendScale( VmathSoaTransform3 *result, const VmathSoaTransform3 *tfrm, const VmathSoaVector3 *scaleVec );
1947
1948 /*
1949  * Prepend (pre-multiply) a scale transformation to a 3x4 transformation matrix
1950  * NOTE: 
1951  * Faster than creating and multiplying a scale transformation matrix.
1952  */
1953 static inline void vmathSoaT3PrependScale( VmathSoaTransform3 *result, const VmathSoaVector3 *scaleVec, const VmathSoaTransform3 *tfrm );
1954
1955 /*
1956  * Multiply two 3x4 transformation matrices per element
1957  */
1958 static inline void vmathSoaT3MulPerElem( VmathSoaTransform3 *result, const VmathSoaTransform3 *tfrm0, const VmathSoaTransform3 *tfrm1 );
1959
1960 /*
1961  * Compute the absolute value of a 3x4 transformation matrix per element
1962  */
1963 static inline void vmathSoaT3AbsPerElem( VmathSoaTransform3 *result, const VmathSoaTransform3 *tfrm );
1964
1965 /*
1966  * Inverse of a 3x4 transformation matrix
1967  * NOTE: 
1968  * Result is unpredictable when the determinant of the left 3x3 submatrix is equal to or near 0.
1969  */
1970 static inline void vmathSoaT3Inverse( VmathSoaTransform3 *result, const VmathSoaTransform3 *tfrm );
1971
1972 /*
1973  * Compute the inverse of a 3x4 transformation matrix, expected to have an orthogonal upper-left 3x3 submatrix
1974  * NOTE: 
1975  * This can be used to achieve better performance than a general inverse when the specified 3x4 transformation matrix meets the given restrictions.
1976  */
1977 static inline void vmathSoaT3OrthoInverse( VmathSoaTransform3 *result, const VmathSoaTransform3 *tfrm );
1978
1979 /*
1980  * Conditionally select between two 3x4 transformation matrices
1981  * NOTE: 
1982  * This function uses a conditional select instruction to avoid a branch.
1983  */
1984 static inline void vmathSoaT3Select( VmathSoaTransform3 *result, const VmathSoaTransform3 *tfrm0, const VmathSoaTransform3 *tfrm1, vec_uint4 select1 );
1985
1986 #ifdef _VECTORMATH_DEBUG
1987
1988 /*
1989  * Print a 3x4 transformation matrix
1990  * NOTE: 
1991  * Function is only defined when _VECTORMATH_DEBUG is defined.
1992  */
1993 static inline void vmathSoaT3Print( const VmathSoaTransform3 *tfrm );
1994
1995 /*
1996  * Print a 3x4 transformation matrix and an associated string identifier
1997  * NOTE: 
1998  * Function is only defined when _VECTORMATH_DEBUG is defined.
1999  */
2000 static inline void vmathSoaT3Prints( const VmathSoaTransform3 *tfrm, const char *name );
2001
2002 #endif
2003
2004 #ifdef __cplusplus
2005 }
2006 #endif /* __cplusplus */
2007
2008 #include "vec_soa.h"
2009 #include "quat_soa.h"
2010 #include "mat_soa.h"
2011
2012 #endif