summaryrefslogtreecommitdiff
path: root/Runtime/mecanim/graph/quaternionnode.h
blob: 19f1f8672f79571d454d04c640d4a94872e9f60a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
/*
 Copyright (c) 7244339 Canada Inc. (Mecanim)
 All Rights Reserved.
*/
#pragma once

#include "Runtime/mecanim/defs.h"
#include "Runtime/mecanim/memory.h"
#include "Runtime/mecanim/types.h"
#include "Runtime/mecanim/object.h"

#include "Runtime/Math/Simd/math.h" 

#include "Runtime/mecanim/graph/plug.h"
#include "Runtime/mecanim/graph/node.h"

#include "Runtime/mecanim/graph/unarynode.h"

namespace mecanim
{

namespace graph
{
	class quatIdentityOp
	{
	public:
		template<typename RESULT> static math::float4 Operation(){ return math::quatIdentity(); } 
	};

	class quatIdentity : public ResultNode<math::float4, quatIdentityOp> 
	{
	public: 
		static const eNodeType mId = quatIdentityId; 
		virtual eNodeType NodeType(){return mId;}
	};

	template<typename TYPE, typename RESULT> class quatConjOp
	{
	public:
		static math::float4 Operation( math::float4 const& l){ return math::quatConj(l); } 
	};

	class quatConj : public UnaryNode<math::float4, math::float4, quatConjOp<math::float4, math::float4> > 
	{
	public: 
		static const eNodeType mId = quatConjId; 
		virtual eNodeType NodeType(){return mId;}
	};

	class quatMulOp
	{
	public:
		template<typename TYPE1, typename TYPE2, typename RESULT> static math::float4 Operation( math::float4 const& l, math::float4 const& r){ return math::quatMul(l, r); } 
	};

	class quatMul : public BinaryNode<math::float4, math::float4, math::float4, quatMulOp> 
	{
	public: 
		static const eNodeType mId = quatMulId; 
		virtual eNodeType NodeType(){return mId;}
	};

	class quatMulVecOp
	{
	public:
		template<typename TYPE1, typename TYPE2, typename RESULT> static math::float4 Operation( math::float4 const& l, math::float4 const& r){ return math::quatMulVec(l, r); } 
	};

	class quatMulVec : public BinaryNode<math::float4, math::float4, math::float4, quatMulVecOp> 
	{
	public: 
		static const eNodeType mId = quatMulVecId; 
		virtual eNodeType NodeType(){return mId;}
	};

	class quatLerpOp
	{
	public:
		template<typename TYPE1, typename TYPE2, typename TYPE3, typename RESULT> static math::float4 Operation( math::float4 const& a, math::float4 const& b, float c){ return math::quatLerp(a, b, math::float1(c)); } 
	};

	class quatLerp : public TernaryNode<math::float4, math::float4, float, math::float4, quatLerpOp> 
	{
	public: 
		static const eNodeType mId = quatLerpId; 
		virtual eNodeType NodeType(){return mId;}
	};

	class quatArcRotateOp
	{
	public:
		template<typename TYPE1, typename TYPE2, typename RESULT> static math::float4 Operation( math::float4 const& l, math::float4 const& r){ return math::quatArcRotate(l, r); } 
	};

	class quatArcRotate : public BinaryNode<math::float4, math::float4, math::float4, quatArcRotateOp> 
	{
	public: 
		static const eNodeType mId = quatArcRotateId; 
		virtual eNodeType NodeType(){return mId;}
	};

	template<typename TYPE1, typename RESULT> class quatArcRotateXOp
	{
	public:
		static math::float4 Operation( math::float4 const& l){ return math::quatArcRotateX(l); } 
	};

	class quatArcRotateX : public UnaryNode<math::float4, math::float4, quatArcRotateXOp<math::float4, math::float4> > 
	{
	public: 
		static const eNodeType mId = quatArcRotateXId; 
		virtual eNodeType NodeType(){return mId;}
	};

	template<typename TYPE1, typename RESULT> class quatXcosOp
	{
	public:
		static math::float4 Operation( math::float4 const& l){ return math::quatXcos(l); } 
	};

	class quatXcos : public UnaryNode<math::float4, math::float4, quatXcosOp<math::float4, math::float4> > 
	{
	public: 
		static const eNodeType mId = quatXcosId; 
		virtual eNodeType NodeType(){return mId;}
	};

	template<typename TYPE1, typename RESULT> class quatYcosOp
	{
	public:
		static math::float4 Operation( math::float4 const& l){ return math::quatYcos(l); } 
	};

	class quatYcos : public UnaryNode<math::float4, math::float4, quatYcosOp<math::float4, math::float4> > 
	{
	public: 
		static const eNodeType mId = quatYcosId; 
		virtual eNodeType NodeType(){return mId;}
	};

	template<typename TYPE1, typename RESULT> class quatZcosOp
	{
	public:
		static math::float4 Operation( math::float4 const& l){ return math::quatZcos(l); } 
	};

	class quatZcos : public UnaryNode<math::float4, math::float4, quatZcosOp<math::float4, math::float4> > 
	{
	public: 
		static const eNodeType mId = quatZcosId; 
		virtual eNodeType NodeType(){return mId;}
	};

	template<typename TYPE1, typename RESULT> class quatEulerToQuatOp
	{
	public:
		static math::float4 Operation( math::float4 const& l){ return math::quatEulerToQuat(l); } 
	};

	class quatEulerToQuat : public UnaryNode<math::float4, math::float4, quatEulerToQuatOp<math::float4, math::float4> > 
	{
	public: 
		static const eNodeType mId = quatEulerToQuatId; 
		virtual eNodeType NodeType(){return mId;}
	};
	template<typename TYPE1, typename RESULT> class quatQuatToEulerOp
	{
	public:
		static math::float4 Operation( math::float4 const& l){ return math::quatQuatToEuler(l); } 
	};

	class quatQuatToEuler : public UnaryNode<math::float4, math::float4, quatQuatToEulerOp<math::float4, math::float4> > 
	{
	public: 
		static const eNodeType mId = quatQuatToEulerId; 
		virtual eNodeType NodeType(){return mId;}
	};

	template<typename TYPE1, typename RESULT> class quatProjOnYPlaneOp
	{
	public:
		static math::float4 Operation( math::float4 const& l){ return math::quatProjOnYPlane(l); } 
	};

	class quatProjOnYPlane : public UnaryNode<math::float4, math::float4, quatProjOnYPlaneOp<math::float4, math::float4> > 
	{
	public: 
		static const eNodeType mId = quatProjOnYPlaneId; 
		virtual eNodeType NodeType(){return mId;}
	};

	template<typename TYPE1, typename RESULT> class quat2QtanOp
	{
	public:
		static math::float4 Operation( math::float4 const& l){ return math::quat2Qtan(l); } 
	};

	class quat2Qtan : public UnaryNode<math::float4, math::float4, quat2QtanOp<math::float4, math::float4> > 
	{
	public: 
		static const eNodeType mId = quat2QtanId; 
		virtual eNodeType NodeType(){return mId;}
	};

	template<typename TYPE1, typename RESULT> class qtan2QuatOp
	{
	public:
		static math::float4 Operation( math::float4 const& l){ return math::qtan2Quat(l); } 
	};

	class qtan2Quat : public UnaryNode<math::float4, math::float4, qtan2QuatOp<math::float4, math::float4> > 
	{
	public: 
		static const eNodeType mId = qtan2QuatId; 
		virtual eNodeType NodeType(){return mId;}
	};

	template<typename TYPE1, typename RESULT> class ZYRoll2QuatOp
	{
	public:
		static math::float4 Operation( math::float4 const& l){ return math::ZYRoll2Quat(l); } 
	};

	class ZYRoll2Quat : public UnaryNode<math::float4, math::float4, ZYRoll2QuatOp<math::float4, math::float4> > 
	{
	public: 
		static const eNodeType mId = ZYRoll2QuatId; 
		virtual eNodeType NodeType(){return mId;}
	};

	template<typename TYPE1, typename RESULT> class quat2ZYRollOp
	{
	public:
		static math::float4 Operation( math::float4 const& l){ return math::quat2ZYRoll(l); } 
	};

	class quat2ZYRoll : public UnaryNode<math::float4, math::float4, quat2ZYRollOp<math::float4, math::float4> > 
	{
	public: 
		static const eNodeType mId = quat2ZYRollId; 
		virtual eNodeType NodeType(){return mId;}
	};

	template<typename TYPE1, typename RESULT> class RollZY2QuatOp
	{
	public:
		static math::float4 Operation( math::float4 const& l){ return math::RollZY2Quat(l); } 
	};

	class RollZY2Quat : public UnaryNode<math::float4, math::float4, RollZY2QuatOp<math::float4, math::float4> > 
	{
	public: 
		static const eNodeType mId = RollZY2QuatId; 
		virtual eNodeType NodeType(){return mId;}
	};

	template<typename TYPE1, typename RESULT> class quat2RollZYOp
	{
	public:
		static math::float4 Operation( math::float4 const& l){ return math::quat2RollZY(l); } 
	};

	class quat2RollZY : public UnaryNode<math::float4, math::float4, quat2RollZYOp<math::float4, math::float4> > 
	{
	public: 
		static const eNodeType mId = quat2RollZYId; 
		virtual eNodeType NodeType(){return mId;}
	};

	class quatWeightOp
	{
	public:
		template<typename TYPE1, typename TYPE2, typename RESULT> static math::float4 Operation( math::float4 const& l, float r){ return math::quatWeight(l, math::float1(r)); } 
	};

	class quatWeight : public BinaryNode<math::float4, float, math::float4, quatWeightOp> 
	{
	public: 
		static const eNodeType mId = quatWeightId; 
		virtual eNodeType NodeType(){return mId;}
	};	
}
}