1 /*---------------------------------------------------------------------------*
2 Project: Horizon
3 File: math_Types.h
4
5 Copyright (C)2009-2010 Nintendo Co., Ltd. All rights reserved.
6
7 These coded instructions, statements, and computer programs contain
8 proprietary information of Nintendo of America Inc. and/or Nintendo
9 Company Ltd., and are protected by Federal copyright law. They may
10 not be disclosed to third parties or copied or duplicated in any form,
11 in whole or in part, without the prior written consent of Nintendo.
12
13 $Revision: 23346 $
14 *---------------------------------------------------------------------------*/
15
16 #ifndef NN_MATH_TYPES_H_
17 #define NN_MATH_TYPES_H_
18
19 #include <nn/types.h>
20 #include <nn/math/math_Config.h>
21 #include <nn/math/math_Triangular.h>
22 #include <nn/math/math_Vector2.h>
23 #include <nn/math/math_Vector3.h>
24 #include <nn/math/math_Vector4.h>
25 #include <nn/math/math_Quaternion.h>
26 #include <nn/math/math_Matrix22.h>
27 #include <nn/math/math_Matrix23.h>
28 #include <nn/math/math_Matrix33.h>
29 #include <nn/math/math_Matrix34.h>
30 #include <nn/math/math_Matrix44.h>
31 #include <nn/math/math_Matrix43.h>
32 #include <nn/math/math_Transform.h>
33
34 #include <nn/math/ARMv6/math_Types.h>
35
36 #include <cstring>
37
38 namespace nn {
39 namespace math {
40
41 /* =======================================================================
42 Class definitions
43 ======================================================================== */
44 struct VEC2;
45 struct VEC3;
46 struct VEC4;
47 struct QUAT;
48
49 /* ------------------------------------------------------------------------
50 MatrixUtility
51 ------------------------------------------------------------------------ */
52
53 NN_MATH_INLINE MTX33* MTX34ToMTX33(MTX33* pOut, const MTX34* pM);
54 NN_MATH_INLINE MTX34* MTX33ToMTX34(MTX34* pOut, const MTX33* pM);
55
56 NN_MATH_INLINE MTX34* MTX43Transpose(MTX34* pOut, const MTX43* p);
57 NN_MATH_INLINE MTX43* MTX34Transpose(MTX43* pOut, const MTX34* p);
58
59 NN_FORCE_INLINE MTX33* MTX34ToMTX33(MTX33* pOut, const MTX34* pM);
60 NN_FORCE_INLINE MTX33* MTX34ToMTX33(MTX33* pOut, const MTX34* pM);
61 NN_FORCE_INLINE QUAT* MTX34ToQUAT(QUAT* pOut, const MTX34* pMtx);
62 NN_FORCE_INLINE MTX43* MTX34Transpose(MTX43* pOut, const MTX34* p);
63 NN_FORCE_INLINE MTX34* MTX43Transpose(MTX34* pOut, const MTX43* p);
64
65 /* Please see man pages for details
66
67
68 */
69
70 /*
71
72
73
74
75
76
77 */
78 NN_FORCE_INLINE MTX34*
MTX33ToMTX34(MTX34 * pOut,const MTX33 * pM)79 MTX33ToMTX34(MTX34* pOut, const MTX33* pM)
80 {
81 #if defined( NN_HARDWARE_CTR )
82 #if (MTX33TOMTX34_CONFIG == D_ORG)
83 return ARMv6::MTX33ToMTX34C(pOut, pM);
84 #elif (MTX33TOMTX34_CONFIG == D_FAST_C)
85 return ARMv6::MTX33ToMTX34C_FAST(pOut, pM);
86 #elif (MTX33TOMTX34_CONFIG == D_FAST_ASM)
87 #elif (MTX33TOMTX34_CONFIG == D_FAST_C_ALGO)
88 #elif (MTX33TOMTX34_CONFIG == D_FAST_ASM_ALGO)
89 #endif
90 #else
91 #endif
92 }
93
94 /*
95
96
97
98
99
100
101 */
102 NN_FORCE_INLINE MTX33*
MTX34ToMTX33(MTX33 * pOut,const MTX34 * pM)103 MTX34ToMTX33(MTX33* pOut, const MTX34* pM)
104 {
105 #if defined( NN_HARDWARE_CTR )
106 #if (MTX34TOMTX33_CONFIG == D_ORG)
107 return ARMv6::MTX34ToMTX33C(pOut, pM);
108 #elif (MTX34TOMTX33_CONFIG == D_FAST_C)
109 #elif (MTX34TOMTX33_CONFIG == D_FAST_ASM)
110 return ARMv6::MTX34ToMTX33Asm(pOut, pM);
111 #elif (MTX34TOMTX33_CONFIG == D_FAST_C_ALGO)
112 #elif (MTX34TOMTX33_CONFIG == D_FAST_ASM_ALGO)
113 #endif
114 #else
115 #endif
116 }
117
118 /*
119
120
121
122
123
124
125 */
126 NN_FORCE_INLINE QUAT*
MTX34ToQUAT(QUAT * pOut,const MTX34 * pMtx)127 MTX34ToQUAT(QUAT* pOut, const MTX34* pMtx)
128 {
129 #if defined( NN_HARDWARE_CTR )
130 #if (MTX34TOQUAT_CONFIG == D_ORG)
131 return ARMv6::MTX34ToQUATC(pOut, pMtx);
132 #elif (MTX34TOQUAT_CONFIG == D_FAST_C)
133 return ARMv6::MTX34ToQUATC_FAST(pOut, pMtx);
134 #elif (MTX34TOQUAT_CONFIG == D_FAST_ASM)
135 #elif (MTX34TOQUAT_CONFIG == D_FAST_C_ALGO)
136 #elif (MTX34TOQUAT_CONFIG == D_FAST_ASM_ALGO)
137 #endif
138 #else
139 #endif
140 }
141
142 /*
143
144 */
145
146 /* Please see man pages for details
147
148
149 */
150
151 /*
152
153
154
155
156
157
158 */
159 NN_FORCE_INLINE MTX43*
MTX34Transpose(MTX43 * pOut,const MTX34 * p)160 MTX34Transpose(MTX43* pOut, const MTX34* p)
161 {
162 #if defined( NN_HARDWARE_CTR )
163 #if (MTX34TRANSPOSE_34TO43_CONFIG == D_ORG)
164 return ARMv6::MTX34TransposeC(pOut, p);
165 #elif (MTX34TRANSPOSE_34TO43_CONFIG == D_FAST_C)
166 #elif (MTX34TRANSPOSE_34TO43_CONFIG == D_FAST_ASM)
167 return ARMv6::MTX34TransposeAsm(pOut, p);
168 #elif (MTX34TRANSPOSE_34TO43_CONFIG == D_FAST_C_ALGO)
169 #elif (MTX34TRANSPOSE_34TO43_CONFIG == D_FAST_ASM_ALGO)
170 #endif
171 #else
172 #endif
173 }
174
175 /*
176
177
178
179
180
181
182 */
183 NN_FORCE_INLINE MTX34*
MTX43Transpose(MTX34 * pOut,const MTX43 * p)184 MTX43Transpose(MTX34* pOut, const MTX43* p)
185 {
186 #if defined( NN_HARDWARE_CTR )
187 #if (MTX43TRANSPOSE_CONFIG == D_ORG)
188 return ARMv6::MTX43TransposeC(pOut, p);
189 #elif (MTX43TRANSPOSE_CONFIG == D_FAST_C)
190 #elif (MTX43TRANSPOSE_CONFIG == D_FAST_ASM)
191 return ARMv6::MTX43TransposeAsm(pOut, p);
192 #elif (MTX43TRANSPOSE_CONFIG == D_FAST_C_ALGO)
193 #elif (MTX43TRANSPOSE_CONFIG == D_FAST_ASM_ALGO)
194 #endif
195 #else
196 #endif
197
198 }
199
200 /*
201
202 */
203 } // namespace math
204 } // namespace nn
205
206
207 #if defined(NN_MATH_AS_INLINE)
208 #include <nn/math/inline/math_Types.ipp>
209 #include <nn/math/ARMv6/inline/math_Types.ipp>
210 #endif
211
212 namespace nn {
213 namespace math {
214
215 //-- Overloads that reference const type arguments
MTX43Transpose(MTX34 * pOut,const MTX43 & m)216 inline MTX34* MTX43Transpose(MTX34* pOut, const MTX43& m) { return MTX43Transpose( pOut, &m ); }
MTX34Transpose(MTX43 * pOut,const MTX34 & m)217 inline MTX43* MTX34Transpose(MTX43* pOut, const MTX34& m) { return MTX34Transpose( pOut, &m ); }
218
219
220 } // namespace math
221 } // namespace nn
222
223 #endif
224
225
226