Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1 | pmbaty | 1 | ////////////////////////////////////////////////////////////////////////////// |
2 | // |
||
3 | // Copyright (C) Microsoft Corporation. All Rights Reserved. |
||
4 | // |
||
5 | // File: d3dx10math.inl |
||
6 | // Content: D3DX10 math inline functions |
||
7 | // |
||
8 | ////////////////////////////////////////////////////////////////////////////// |
||
9 | |||
10 | #ifndef __D3DXMATH_INL__ |
||
11 | #define __D3DXMATH_INL__ |
||
12 | |||
13 | |||
14 | //=========================================================================== |
||
15 | // |
||
16 | // Inline Class Methods |
||
17 | // |
||
18 | //=========================================================================== |
||
19 | |||
20 | #ifdef __cplusplus |
||
21 | |||
22 | //-------------------------- |
||
23 | // Float16 |
||
24 | //-------------------------- |
||
25 | |||
26 | D3DX10INLINE |
||
27 | D3DXFLOAT16::D3DXFLOAT16( FLOAT f ) |
||
28 | { |
||
29 | D3DXFloat32To16Array(this, &f, 1); |
||
30 | } |
||
31 | |||
32 | D3DX10INLINE |
||
33 | D3DXFLOAT16::D3DXFLOAT16( CONST D3DXFLOAT16& f ) |
||
34 | { |
||
35 | value = f.value; |
||
36 | } |
||
37 | |||
38 | // casting |
||
39 | D3DX10INLINE |
||
40 | D3DXFLOAT16::operator FLOAT () |
||
41 | { |
||
42 | FLOAT f; |
||
43 | D3DXFloat16To32Array(&f, this, 1); |
||
44 | return f; |
||
45 | } |
||
46 | |||
47 | // binary operators |
||
48 | D3DX10INLINE BOOL |
||
49 | D3DXFLOAT16::operator == ( CONST D3DXFLOAT16& f ) const |
||
50 | { |
||
51 | // At least one is NaN |
||
52 | if(((value & D3DX_16F_EXP_MASK) == D3DX_16F_EXP_MASK && (value & D3DX_16F_FRAC_MASK)) |
||
53 | || ((f.value & D3DX_16F_EXP_MASK) == D3DX_16F_EXP_MASK && (f.value & D3DX_16F_FRAC_MASK))) |
||
54 | return false; |
||
55 | // +/- Zero |
||
56 | else if((value & ~D3DX_16F_SIGN_MASK) == 0 && (f.value & ~D3DX_16F_SIGN_MASK) == 0) |
||
57 | return true; |
||
58 | else |
||
59 | return value == f.value; |
||
60 | } |
||
61 | |||
62 | D3DX10INLINE BOOL |
||
63 | D3DXFLOAT16::operator != ( CONST D3DXFLOAT16& f ) const |
||
64 | { |
||
65 | // At least one is NaN |
||
66 | if(((value & D3DX_16F_EXP_MASK) == D3DX_16F_EXP_MASK && (value & D3DX_16F_FRAC_MASK)) |
||
67 | || ((f.value & D3DX_16F_EXP_MASK) == D3DX_16F_EXP_MASK && (f.value & D3DX_16F_FRAC_MASK))) |
||
68 | return true; |
||
69 | // +/- Zero |
||
70 | else if((value & ~D3DX_16F_SIGN_MASK) == 0 && (f.value & ~D3DX_16F_SIGN_MASK) == 0) |
||
71 | return false; |
||
72 | else |
||
73 | return value != f.value; |
||
74 | } |
||
75 | |||
76 | |||
77 | //-------------------------- |
||
78 | // 2D Vector |
||
79 | //-------------------------- |
||
80 | |||
81 | D3DX10INLINE |
||
82 | D3DXVECTOR2::D3DXVECTOR2( CONST FLOAT *pf ) |
||
83 | { |
||
84 | #ifdef D3DX10_DEBUG |
||
85 | if(!pf) |
||
86 | return; |
||
87 | #endif |
||
88 | |||
89 | x = pf[0]; |
||
90 | y = pf[1]; |
||
91 | } |
||
92 | |||
93 | D3DX10INLINE |
||
94 | D3DXVECTOR2::D3DXVECTOR2( CONST D3DXFLOAT16 *pf ) |
||
95 | { |
||
96 | #ifdef D3DX10_DEBUG |
||
97 | if(!pf) |
||
98 | return; |
||
99 | #endif |
||
100 | |||
101 | D3DXFloat16To32Array(&x, pf, 2); |
||
102 | } |
||
103 | |||
104 | D3DX10INLINE |
||
105 | D3DXVECTOR2::D3DXVECTOR2( FLOAT fx, FLOAT fy ) |
||
106 | { |
||
107 | x = fx; |
||
108 | y = fy; |
||
109 | } |
||
110 | |||
111 | |||
112 | // casting |
||
113 | D3DX10INLINE |
||
114 | D3DXVECTOR2::operator FLOAT* () |
||
115 | { |
||
116 | return (FLOAT *) &x; |
||
117 | } |
||
118 | |||
119 | D3DX10INLINE |
||
120 | D3DXVECTOR2::operator CONST FLOAT* () const |
||
121 | { |
||
122 | return (CONST FLOAT *) &x; |
||
123 | } |
||
124 | |||
125 | |||
126 | // assignment operators |
||
127 | D3DX10INLINE D3DXVECTOR2& |
||
128 | D3DXVECTOR2::operator += ( CONST D3DXVECTOR2& v ) |
||
129 | { |
||
130 | x += v.x; |
||
131 | y += v.y; |
||
132 | return *this; |
||
133 | } |
||
134 | |||
135 | D3DX10INLINE D3DXVECTOR2& |
||
136 | D3DXVECTOR2::operator -= ( CONST D3DXVECTOR2& v ) |
||
137 | { |
||
138 | x -= v.x; |
||
139 | y -= v.y; |
||
140 | return *this; |
||
141 | } |
||
142 | |||
143 | D3DX10INLINE D3DXVECTOR2& |
||
144 | D3DXVECTOR2::operator *= ( FLOAT f ) |
||
145 | { |
||
146 | x *= f; |
||
147 | y *= f; |
||
148 | return *this; |
||
149 | } |
||
150 | |||
151 | D3DX10INLINE D3DXVECTOR2& |
||
152 | D3DXVECTOR2::operator /= ( FLOAT f ) |
||
153 | { |
||
154 | FLOAT fInv = 1.0f / f; |
||
155 | x *= fInv; |
||
156 | y *= fInv; |
||
157 | return *this; |
||
158 | } |
||
159 | |||
160 | |||
161 | // unary operators |
||
162 | D3DX10INLINE D3DXVECTOR2 |
||
163 | D3DXVECTOR2::operator + () const |
||
164 | { |
||
165 | return *this; |
||
166 | } |
||
167 | |||
168 | D3DX10INLINE D3DXVECTOR2 |
||
169 | D3DXVECTOR2::operator - () const |
||
170 | { |
||
171 | return D3DXVECTOR2(-x, -y); |
||
172 | } |
||
173 | |||
174 | |||
175 | // binary operators |
||
176 | D3DX10INLINE D3DXVECTOR2 |
||
177 | D3DXVECTOR2::operator + ( CONST D3DXVECTOR2& v ) const |
||
178 | { |
||
179 | return D3DXVECTOR2(x + v.x, y + v.y); |
||
180 | } |
||
181 | |||
182 | D3DX10INLINE D3DXVECTOR2 |
||
183 | D3DXVECTOR2::operator - ( CONST D3DXVECTOR2& v ) const |
||
184 | { |
||
185 | return D3DXVECTOR2(x - v.x, y - v.y); |
||
186 | } |
||
187 | |||
188 | D3DX10INLINE D3DXVECTOR2 |
||
189 | D3DXVECTOR2::operator * ( FLOAT f ) const |
||
190 | { |
||
191 | return D3DXVECTOR2(x * f, y * f); |
||
192 | } |
||
193 | |||
194 | D3DX10INLINE D3DXVECTOR2 |
||
195 | D3DXVECTOR2::operator / ( FLOAT f ) const |
||
196 | { |
||
197 | FLOAT fInv = 1.0f / f; |
||
198 | return D3DXVECTOR2(x * fInv, y * fInv); |
||
199 | } |
||
200 | |||
201 | D3DX10INLINE D3DXVECTOR2 |
||
202 | operator * ( FLOAT f, CONST D3DXVECTOR2& v ) |
||
203 | { |
||
204 | return D3DXVECTOR2(f * v.x, f * v.y); |
||
205 | } |
||
206 | |||
207 | D3DX10INLINE BOOL |
||
208 | D3DXVECTOR2::operator == ( CONST D3DXVECTOR2& v ) const |
||
209 | { |
||
210 | return x == v.x && y == v.y; |
||
211 | } |
||
212 | |||
213 | D3DX10INLINE BOOL |
||
214 | D3DXVECTOR2::operator != ( CONST D3DXVECTOR2& v ) const |
||
215 | { |
||
216 | return x != v.x || y != v.y; |
||
217 | } |
||
218 | |||
219 | |||
220 | |||
221 | //-------------------------- |
||
222 | // 2D Vector (16 bit) |
||
223 | //-------------------------- |
||
224 | |||
225 | D3DX10INLINE |
||
226 | D3DXVECTOR2_16F::D3DXVECTOR2_16F( CONST FLOAT *pf ) |
||
227 | { |
||
228 | #ifdef D3DX10_DEBUG |
||
229 | if(!pf) |
||
230 | return; |
||
231 | #endif |
||
232 | |||
233 | D3DXFloat32To16Array(&x, pf, 2); |
||
234 | } |
||
235 | |||
236 | D3DX10INLINE |
||
237 | D3DXVECTOR2_16F::D3DXVECTOR2_16F( CONST D3DXFLOAT16 *pf ) |
||
238 | { |
||
239 | #ifdef D3DX10_DEBUG |
||
240 | if(!pf) |
||
241 | return; |
||
242 | #endif |
||
243 | |||
244 | *((UINT *) &x) = *((UINT *) &pf[0]); |
||
245 | } |
||
246 | |||
247 | D3DX10INLINE |
||
248 | D3DXVECTOR2_16F::D3DXVECTOR2_16F( CONST D3DXFLOAT16 &fx, CONST D3DXFLOAT16 &fy ) |
||
249 | { |
||
250 | x = fx; |
||
251 | y = fy; |
||
252 | } |
||
253 | |||
254 | |||
255 | // casting |
||
256 | D3DX10INLINE |
||
257 | D3DXVECTOR2_16F::operator D3DXFLOAT16* () |
||
258 | { |
||
259 | return (D3DXFLOAT16*) &x; |
||
260 | } |
||
261 | |||
262 | D3DX10INLINE |
||
263 | D3DXVECTOR2_16F::operator CONST D3DXFLOAT16* () const |
||
264 | { |
||
265 | return (CONST D3DXFLOAT16*) &x; |
||
266 | } |
||
267 | |||
268 | |||
269 | // binary operators |
||
270 | D3DX10INLINE BOOL |
||
271 | D3DXVECTOR2_16F::operator == ( CONST D3DXVECTOR2_16F &v ) const |
||
272 | { |
||
273 | return x == v.x && y == v.y; |
||
274 | } |
||
275 | |||
276 | D3DX10INLINE BOOL |
||
277 | D3DXVECTOR2_16F::operator != ( CONST D3DXVECTOR2_16F &v ) const |
||
278 | { |
||
279 | return x != v.x || y != v.y; |
||
280 | } |
||
281 | |||
282 | |||
283 | //-------------------------- |
||
284 | // 3D Vector |
||
285 | //-------------------------- |
||
286 | D3DX10INLINE |
||
287 | D3DXVECTOR3::D3DXVECTOR3( CONST FLOAT *pf ) |
||
288 | { |
||
289 | #ifdef D3DX10_DEBUG |
||
290 | if(!pf) |
||
291 | return; |
||
292 | #endif |
||
293 | |||
294 | x = pf[0]; |
||
295 | y = pf[1]; |
||
296 | z = pf[2]; |
||
297 | } |
||
298 | |||
299 | D3DX10INLINE |
||
300 | D3DXVECTOR3::D3DXVECTOR3( CONST D3DVECTOR& v ) |
||
301 | { |
||
302 | x = v.x; |
||
303 | y = v.y; |
||
304 | z = v.z; |
||
305 | } |
||
306 | |||
307 | D3DX10INLINE |
||
308 | D3DXVECTOR3::D3DXVECTOR3( CONST D3DXFLOAT16 *pf ) |
||
309 | { |
||
310 | #ifdef D3DX10_DEBUG |
||
311 | if(!pf) |
||
312 | return; |
||
313 | #endif |
||
314 | |||
315 | D3DXFloat16To32Array(&x, pf, 3); |
||
316 | } |
||
317 | |||
318 | D3DX10INLINE |
||
319 | D3DXVECTOR3::D3DXVECTOR3( FLOAT fx, FLOAT fy, FLOAT fz ) |
||
320 | { |
||
321 | x = fx; |
||
322 | y = fy; |
||
323 | z = fz; |
||
324 | } |
||
325 | |||
326 | |||
327 | // casting |
||
328 | D3DX10INLINE |
||
329 | D3DXVECTOR3::operator FLOAT* () |
||
330 | { |
||
331 | return (FLOAT *) &x; |
||
332 | } |
||
333 | |||
334 | D3DX10INLINE |
||
335 | D3DXVECTOR3::operator CONST FLOAT* () const |
||
336 | { |
||
337 | return (CONST FLOAT *) &x; |
||
338 | } |
||
339 | |||
340 | |||
341 | // assignment operators |
||
342 | D3DX10INLINE D3DXVECTOR3& |
||
343 | D3DXVECTOR3::operator += ( CONST D3DXVECTOR3& v ) |
||
344 | { |
||
345 | x += v.x; |
||
346 | y += v.y; |
||
347 | z += v.z; |
||
348 | return *this; |
||
349 | } |
||
350 | |||
351 | D3DX10INLINE D3DXVECTOR3& |
||
352 | D3DXVECTOR3::operator -= ( CONST D3DXVECTOR3& v ) |
||
353 | { |
||
354 | x -= v.x; |
||
355 | y -= v.y; |
||
356 | z -= v.z; |
||
357 | return *this; |
||
358 | } |
||
359 | |||
360 | D3DX10INLINE D3DXVECTOR3& |
||
361 | D3DXVECTOR3::operator *= ( FLOAT f ) |
||
362 | { |
||
363 | x *= f; |
||
364 | y *= f; |
||
365 | z *= f; |
||
366 | return *this; |
||
367 | } |
||
368 | |||
369 | D3DX10INLINE D3DXVECTOR3& |
||
370 | D3DXVECTOR3::operator /= ( FLOAT f ) |
||
371 | { |
||
372 | FLOAT fInv = 1.0f / f; |
||
373 | x *= fInv; |
||
374 | y *= fInv; |
||
375 | z *= fInv; |
||
376 | return *this; |
||
377 | } |
||
378 | |||
379 | |||
380 | // unary operators |
||
381 | D3DX10INLINE D3DXVECTOR3 |
||
382 | D3DXVECTOR3::operator + () const |
||
383 | { |
||
384 | return *this; |
||
385 | } |
||
386 | |||
387 | D3DX10INLINE D3DXVECTOR3 |
||
388 | D3DXVECTOR3::operator - () const |
||
389 | { |
||
390 | return D3DXVECTOR3(-x, -y, -z); |
||
391 | } |
||
392 | |||
393 | |||
394 | // binary operators |
||
395 | D3DX10INLINE D3DXVECTOR3 |
||
396 | D3DXVECTOR3::operator + ( CONST D3DXVECTOR3& v ) const |
||
397 | { |
||
398 | return D3DXVECTOR3(x + v.x, y + v.y, z + v.z); |
||
399 | } |
||
400 | |||
401 | D3DX10INLINE D3DXVECTOR3 |
||
402 | D3DXVECTOR3::operator - ( CONST D3DXVECTOR3& v ) const |
||
403 | { |
||
404 | return D3DXVECTOR3(x - v.x, y - v.y, z - v.z); |
||
405 | } |
||
406 | |||
407 | D3DX10INLINE D3DXVECTOR3 |
||
408 | D3DXVECTOR3::operator * ( FLOAT f ) const |
||
409 | { |
||
410 | return D3DXVECTOR3(x * f, y * f, z * f); |
||
411 | } |
||
412 | |||
413 | D3DX10INLINE D3DXVECTOR3 |
||
414 | D3DXVECTOR3::operator / ( FLOAT f ) const |
||
415 | { |
||
416 | FLOAT fInv = 1.0f / f; |
||
417 | return D3DXVECTOR3(x * fInv, y * fInv, z * fInv); |
||
418 | } |
||
419 | |||
420 | |||
421 | D3DX10INLINE D3DXVECTOR3 |
||
422 | operator * ( FLOAT f, CONST struct D3DXVECTOR3& v ) |
||
423 | { |
||
424 | return D3DXVECTOR3(f * v.x, f * v.y, f * v.z); |
||
425 | } |
||
426 | |||
427 | |||
428 | D3DX10INLINE BOOL |
||
429 | D3DXVECTOR3::operator == ( CONST D3DXVECTOR3& v ) const |
||
430 | { |
||
431 | return x == v.x && y == v.y && z == v.z; |
||
432 | } |
||
433 | |||
434 | D3DX10INLINE BOOL |
||
435 | D3DXVECTOR3::operator != ( CONST D3DXVECTOR3& v ) const |
||
436 | { |
||
437 | return x != v.x || y != v.y || z != v.z; |
||
438 | } |
||
439 | |||
440 | |||
441 | |||
442 | //-------------------------- |
||
443 | // 3D Vector (16 bit) |
||
444 | //-------------------------- |
||
445 | |||
446 | D3DX10INLINE |
||
447 | D3DXVECTOR3_16F::D3DXVECTOR3_16F( CONST FLOAT *pf ) |
||
448 | { |
||
449 | #ifdef D3DX10_DEBUG |
||
450 | if(!pf) |
||
451 | return; |
||
452 | #endif |
||
453 | |||
454 | D3DXFloat32To16Array(&x, pf, 3); |
||
455 | } |
||
456 | |||
457 | D3DX10INLINE |
||
458 | D3DXVECTOR3_16F::D3DXVECTOR3_16F( CONST D3DVECTOR& v ) |
||
459 | { |
||
460 | D3DXFloat32To16Array(&x, &v.x, 1); |
||
461 | D3DXFloat32To16Array(&y, &v.y, 1); |
||
462 | D3DXFloat32To16Array(&z, &v.z, 1); |
||
463 | } |
||
464 | |||
465 | D3DX10INLINE |
||
466 | D3DXVECTOR3_16F::D3DXVECTOR3_16F( CONST D3DXFLOAT16 *pf ) |
||
467 | { |
||
468 | #ifdef D3DX10_DEBUG |
||
469 | if(!pf) |
||
470 | return; |
||
471 | #endif |
||
472 | |||
473 | *((UINT *) &x) = *((UINT *) &pf[0]); |
||
474 | *((WORD *) &z) = *((WORD *) &pf[2]); |
||
475 | } |
||
476 | |||
477 | D3DX10INLINE |
||
478 | D3DXVECTOR3_16F::D3DXVECTOR3_16F( CONST D3DXFLOAT16 &fx, CONST D3DXFLOAT16 &fy, CONST D3DXFLOAT16 &fz ) |
||
479 | { |
||
480 | x = fx; |
||
481 | y = fy; |
||
482 | z = fz; |
||
483 | } |
||
484 | |||
485 | |||
486 | // casting |
||
487 | D3DX10INLINE |
||
488 | D3DXVECTOR3_16F::operator D3DXFLOAT16* () |
||
489 | { |
||
490 | return (D3DXFLOAT16*) &x; |
||
491 | } |
||
492 | |||
493 | D3DX10INLINE |
||
494 | D3DXVECTOR3_16F::operator CONST D3DXFLOAT16* () const |
||
495 | { |
||
496 | return (CONST D3DXFLOAT16*) &x; |
||
497 | } |
||
498 | |||
499 | |||
500 | // binary operators |
||
501 | D3DX10INLINE BOOL |
||
502 | D3DXVECTOR3_16F::operator == ( CONST D3DXVECTOR3_16F &v ) const |
||
503 | { |
||
504 | return x == v.x && y == v.y && z == v.z; |
||
505 | } |
||
506 | |||
507 | D3DX10INLINE BOOL |
||
508 | D3DXVECTOR3_16F::operator != ( CONST D3DXVECTOR3_16F &v ) const |
||
509 | { |
||
510 | return x != v.x || y != v.y || z != v.z; |
||
511 | } |
||
512 | |||
513 | |||
514 | //-------------------------- |
||
515 | // 4D Vector |
||
516 | //-------------------------- |
||
517 | D3DX10INLINE |
||
518 | D3DXVECTOR4::D3DXVECTOR4( CONST FLOAT *pf ) |
||
519 | { |
||
520 | #ifdef D3DX10_DEBUG |
||
521 | if(!pf) |
||
522 | return; |
||
523 | #endif |
||
524 | |||
525 | x = pf[0]; |
||
526 | y = pf[1]; |
||
527 | z = pf[2]; |
||
528 | w = pf[3]; |
||
529 | } |
||
530 | |||
531 | D3DX10INLINE |
||
532 | D3DXVECTOR4::D3DXVECTOR4( CONST D3DXFLOAT16 *pf ) |
||
533 | { |
||
534 | #ifdef D3DX10_DEBUG |
||
535 | if(!pf) |
||
536 | return; |
||
537 | #endif |
||
538 | |||
539 | D3DXFloat16To32Array(&x, pf, 4); |
||
540 | } |
||
541 | |||
542 | D3DX10INLINE |
||
543 | D3DXVECTOR4::D3DXVECTOR4( CONST D3DVECTOR& v, FLOAT f ) |
||
544 | { |
||
545 | x = v.x; |
||
546 | y = v.y; |
||
547 | z = v.z; |
||
548 | w = f; |
||
549 | } |
||
550 | |||
551 | D3DX10INLINE |
||
552 | D3DXVECTOR4::D3DXVECTOR4( FLOAT fx, FLOAT fy, FLOAT fz, FLOAT fw ) |
||
553 | { |
||
554 | x = fx; |
||
555 | y = fy; |
||
556 | z = fz; |
||
557 | w = fw; |
||
558 | } |
||
559 | |||
560 | |||
561 | // casting |
||
562 | D3DX10INLINE |
||
563 | D3DXVECTOR4::operator FLOAT* () |
||
564 | { |
||
565 | return (FLOAT *) &x; |
||
566 | } |
||
567 | |||
568 | D3DX10INLINE |
||
569 | D3DXVECTOR4::operator CONST FLOAT* () const |
||
570 | { |
||
571 | return (CONST FLOAT *) &x; |
||
572 | } |
||
573 | |||
574 | |||
575 | // assignment operators |
||
576 | D3DX10INLINE D3DXVECTOR4& |
||
577 | D3DXVECTOR4::operator += ( CONST D3DXVECTOR4& v ) |
||
578 | { |
||
579 | x += v.x; |
||
580 | y += v.y; |
||
581 | z += v.z; |
||
582 | w += v.w; |
||
583 | return *this; |
||
584 | } |
||
585 | |||
586 | D3DX10INLINE D3DXVECTOR4& |
||
587 | D3DXVECTOR4::operator -= ( CONST D3DXVECTOR4& v ) |
||
588 | { |
||
589 | x -= v.x; |
||
590 | y -= v.y; |
||
591 | z -= v.z; |
||
592 | w -= v.w; |
||
593 | return *this; |
||
594 | } |
||
595 | |||
596 | D3DX10INLINE D3DXVECTOR4& |
||
597 | D3DXVECTOR4::operator *= ( FLOAT f ) |
||
598 | { |
||
599 | x *= f; |
||
600 | y *= f; |
||
601 | z *= f; |
||
602 | w *= f; |
||
603 | return *this; |
||
604 | } |
||
605 | |||
606 | D3DX10INLINE D3DXVECTOR4& |
||
607 | D3DXVECTOR4::operator /= ( FLOAT f ) |
||
608 | { |
||
609 | FLOAT fInv = 1.0f / f; |
||
610 | x *= fInv; |
||
611 | y *= fInv; |
||
612 | z *= fInv; |
||
613 | w *= fInv; |
||
614 | return *this; |
||
615 | } |
||
616 | |||
617 | |||
618 | // unary operators |
||
619 | D3DX10INLINE D3DXVECTOR4 |
||
620 | D3DXVECTOR4::operator + () const |
||
621 | { |
||
622 | return *this; |
||
623 | } |
||
624 | |||
625 | D3DX10INLINE D3DXVECTOR4 |
||
626 | D3DXVECTOR4::operator - () const |
||
627 | { |
||
628 | return D3DXVECTOR4(-x, -y, -z, -w); |
||
629 | } |
||
630 | |||
631 | |||
632 | // binary operators |
||
633 | D3DX10INLINE D3DXVECTOR4 |
||
634 | D3DXVECTOR4::operator + ( CONST D3DXVECTOR4& v ) const |
||
635 | { |
||
636 | return D3DXVECTOR4(x + v.x, y + v.y, z + v.z, w + v.w); |
||
637 | } |
||
638 | |||
639 | D3DX10INLINE D3DXVECTOR4 |
||
640 | D3DXVECTOR4::operator - ( CONST D3DXVECTOR4& v ) const |
||
641 | { |
||
642 | return D3DXVECTOR4(x - v.x, y - v.y, z - v.z, w - v.w); |
||
643 | } |
||
644 | |||
645 | D3DX10INLINE D3DXVECTOR4 |
||
646 | D3DXVECTOR4::operator * ( FLOAT f ) const |
||
647 | { |
||
648 | return D3DXVECTOR4(x * f, y * f, z * f, w * f); |
||
649 | } |
||
650 | |||
651 | D3DX10INLINE D3DXVECTOR4 |
||
652 | D3DXVECTOR4::operator / ( FLOAT f ) const |
||
653 | { |
||
654 | FLOAT fInv = 1.0f / f; |
||
655 | return D3DXVECTOR4(x * fInv, y * fInv, z * fInv, w * fInv); |
||
656 | } |
||
657 | |||
658 | D3DX10INLINE D3DXVECTOR4 |
||
659 | operator * ( FLOAT f, CONST D3DXVECTOR4& v ) |
||
660 | { |
||
661 | return D3DXVECTOR4(f * v.x, f * v.y, f * v.z, f * v.w); |
||
662 | } |
||
663 | |||
664 | |||
665 | D3DX10INLINE BOOL |
||
666 | D3DXVECTOR4::operator == ( CONST D3DXVECTOR4& v ) const |
||
667 | { |
||
668 | return x == v.x && y == v.y && z == v.z && w == v.w; |
||
669 | } |
||
670 | |||
671 | D3DX10INLINE BOOL |
||
672 | D3DXVECTOR4::operator != ( CONST D3DXVECTOR4& v ) const |
||
673 | { |
||
674 | return x != v.x || y != v.y || z != v.z || w != v.w; |
||
675 | } |
||
676 | |||
677 | |||
678 | |||
679 | //-------------------------- |
||
680 | // 4D Vector (16 bit) |
||
681 | //-------------------------- |
||
682 | |||
683 | D3DX10INLINE |
||
684 | D3DXVECTOR4_16F::D3DXVECTOR4_16F( CONST FLOAT *pf ) |
||
685 | { |
||
686 | #ifdef D3DX10_DEBUG |
||
687 | if(!pf) |
||
688 | return; |
||
689 | #endif |
||
690 | |||
691 | D3DXFloat32To16Array(&x, pf, 4); |
||
692 | } |
||
693 | |||
694 | D3DX10INLINE |
||
695 | D3DXVECTOR4_16F::D3DXVECTOR4_16F( CONST D3DXFLOAT16 *pf ) |
||
696 | { |
||
697 | #ifdef D3DX10_DEBUG |
||
698 | if(!pf) |
||
699 | return; |
||
700 | #endif |
||
701 | |||
702 | *((UINT *) &x) = *((UINT *) &pf[0]); |
||
703 | *((UINT *) &z) = *((UINT *) &pf[2]); |
||
704 | } |
||
705 | |||
706 | D3DX10INLINE |
||
707 | D3DXVECTOR4_16F::D3DXVECTOR4_16F( CONST D3DXVECTOR3_16F& v, CONST D3DXFLOAT16& f ) |
||
708 | { |
||
709 | x = v.x; |
||
710 | y = v.y; |
||
711 | z = v.z; |
||
712 | w = f; |
||
713 | } |
||
714 | |||
715 | D3DX10INLINE |
||
716 | D3DXVECTOR4_16F::D3DXVECTOR4_16F( CONST D3DXFLOAT16 &fx, CONST D3DXFLOAT16 &fy, CONST D3DXFLOAT16 &fz, CONST D3DXFLOAT16 &fw ) |
||
717 | { |
||
718 | x = fx; |
||
719 | y = fy; |
||
720 | z = fz; |
||
721 | w = fw; |
||
722 | } |
||
723 | |||
724 | |||
725 | // casting |
||
726 | D3DX10INLINE |
||
727 | D3DXVECTOR4_16F::operator D3DXFLOAT16* () |
||
728 | { |
||
729 | return (D3DXFLOAT16*) &x; |
||
730 | } |
||
731 | |||
732 | D3DX10INLINE |
||
733 | D3DXVECTOR4_16F::operator CONST D3DXFLOAT16* () const |
||
734 | { |
||
735 | return (CONST D3DXFLOAT16*) &x; |
||
736 | } |
||
737 | |||
738 | |||
739 | // binary operators |
||
740 | D3DX10INLINE BOOL |
||
741 | D3DXVECTOR4_16F::operator == ( CONST D3DXVECTOR4_16F &v ) const |
||
742 | { |
||
743 | return x == v.x && y == v.y && z == v.z && w == v.w; |
||
744 | } |
||
745 | |||
746 | D3DX10INLINE BOOL |
||
747 | D3DXVECTOR4_16F::operator != ( CONST D3DXVECTOR4_16F &v ) const |
||
748 | { |
||
749 | return x != v.x || y != v.y || z != v.z || w != v.w; |
||
750 | } |
||
751 | |||
752 | |||
753 | //-------------------------- |
||
754 | // Matrix |
||
755 | //-------------------------- |
||
756 | D3DX10INLINE |
||
757 | D3DXMATRIX::D3DXMATRIX( CONST FLOAT* pf ) |
||
758 | { |
||
759 | #ifdef D3DX10_DEBUG |
||
760 | if(!pf) |
||
761 | return; |
||
762 | #endif |
||
763 | |||
764 | memcpy(&_11, pf, sizeof(D3DXMATRIX)); |
||
765 | } |
||
766 | |||
767 | D3DX10INLINE |
||
768 | D3DXMATRIX::D3DXMATRIX( CONST D3DMATRIX& mat ) |
||
769 | { |
||
770 | memcpy(&_11, &mat, sizeof(D3DXMATRIX)); |
||
771 | } |
||
772 | |||
773 | D3DX10INLINE |
||
774 | D3DXMATRIX::D3DXMATRIX( CONST D3DXFLOAT16* pf ) |
||
775 | { |
||
776 | #ifdef D3DX10_DEBUG |
||
777 | if(!pf) |
||
778 | return; |
||
779 | #endif |
||
780 | |||
781 | D3DXFloat16To32Array(&_11, pf, 16); |
||
782 | } |
||
783 | |||
784 | D3DX10INLINE |
||
785 | D3DXMATRIX::D3DXMATRIX( FLOAT f11, FLOAT f12, FLOAT f13, FLOAT f14, |
||
786 | FLOAT f21, FLOAT f22, FLOAT f23, FLOAT f24, |
||
787 | FLOAT f31, FLOAT f32, FLOAT f33, FLOAT f34, |
||
788 | FLOAT f41, FLOAT f42, FLOAT f43, FLOAT f44 ) |
||
789 | { |
||
790 | _11 = f11; _12 = f12; _13 = f13; _14 = f14; |
||
791 | _21 = f21; _22 = f22; _23 = f23; _24 = f24; |
||
792 | _31 = f31; _32 = f32; _33 = f33; _34 = f34; |
||
793 | _41 = f41; _42 = f42; _43 = f43; _44 = f44; |
||
794 | } |
||
795 | |||
796 | |||
797 | |||
798 | // access grants |
||
799 | D3DX10INLINE FLOAT& |
||
800 | D3DXMATRIX::operator () ( UINT iRow, UINT iCol ) |
||
801 | { |
||
802 | return m[iRow][iCol]; |
||
803 | } |
||
804 | |||
805 | D3DX10INLINE FLOAT |
||
806 | D3DXMATRIX::operator () ( UINT iRow, UINT iCol ) const |
||
807 | { |
||
808 | return m[iRow][iCol]; |
||
809 | } |
||
810 | |||
811 | |||
812 | // casting operators |
||
813 | D3DX10INLINE |
||
814 | D3DXMATRIX::operator FLOAT* () |
||
815 | { |
||
816 | return (FLOAT *) &_11; |
||
817 | } |
||
818 | |||
819 | D3DX10INLINE |
||
820 | D3DXMATRIX::operator CONST FLOAT* () const |
||
821 | { |
||
822 | return (CONST FLOAT *) &_11; |
||
823 | } |
||
824 | |||
825 | |||
826 | // assignment operators |
||
827 | D3DX10INLINE D3DXMATRIX& |
||
828 | D3DXMATRIX::operator *= ( CONST D3DXMATRIX& mat ) |
||
829 | { |
||
830 | D3DXMatrixMultiply(this, this, &mat); |
||
831 | return *this; |
||
832 | } |
||
833 | |||
834 | D3DX10INLINE D3DXMATRIX& |
||
835 | D3DXMATRIX::operator += ( CONST D3DXMATRIX& mat ) |
||
836 | { |
||
837 | _11 += mat._11; _12 += mat._12; _13 += mat._13; _14 += mat._14; |
||
838 | _21 += mat._21; _22 += mat._22; _23 += mat._23; _24 += mat._24; |
||
839 | _31 += mat._31; _32 += mat._32; _33 += mat._33; _34 += mat._34; |
||
840 | _41 += mat._41; _42 += mat._42; _43 += mat._43; _44 += mat._44; |
||
841 | return *this; |
||
842 | } |
||
843 | |||
844 | D3DX10INLINE D3DXMATRIX& |
||
845 | D3DXMATRIX::operator -= ( CONST D3DXMATRIX& mat ) |
||
846 | { |
||
847 | _11 -= mat._11; _12 -= mat._12; _13 -= mat._13; _14 -= mat._14; |
||
848 | _21 -= mat._21; _22 -= mat._22; _23 -= mat._23; _24 -= mat._24; |
||
849 | _31 -= mat._31; _32 -= mat._32; _33 -= mat._33; _34 -= mat._34; |
||
850 | _41 -= mat._41; _42 -= mat._42; _43 -= mat._43; _44 -= mat._44; |
||
851 | return *this; |
||
852 | } |
||
853 | |||
854 | D3DX10INLINE D3DXMATRIX& |
||
855 | D3DXMATRIX::operator *= ( FLOAT f ) |
||
856 | { |
||
857 | _11 *= f; _12 *= f; _13 *= f; _14 *= f; |
||
858 | _21 *= f; _22 *= f; _23 *= f; _24 *= f; |
||
859 | _31 *= f; _32 *= f; _33 *= f; _34 *= f; |
||
860 | _41 *= f; _42 *= f; _43 *= f; _44 *= f; |
||
861 | return *this; |
||
862 | } |
||
863 | |||
864 | D3DX10INLINE D3DXMATRIX& |
||
865 | D3DXMATRIX::operator /= ( FLOAT f ) |
||
866 | { |
||
867 | FLOAT fInv = 1.0f / f; |
||
868 | _11 *= fInv; _12 *= fInv; _13 *= fInv; _14 *= fInv; |
||
869 | _21 *= fInv; _22 *= fInv; _23 *= fInv; _24 *= fInv; |
||
870 | _31 *= fInv; _32 *= fInv; _33 *= fInv; _34 *= fInv; |
||
871 | _41 *= fInv; _42 *= fInv; _43 *= fInv; _44 *= fInv; |
||
872 | return *this; |
||
873 | } |
||
874 | |||
875 | |||
876 | // unary operators |
||
877 | D3DX10INLINE D3DXMATRIX |
||
878 | D3DXMATRIX::operator + () const |
||
879 | { |
||
880 | return *this; |
||
881 | } |
||
882 | |||
883 | D3DX10INLINE D3DXMATRIX |
||
884 | D3DXMATRIX::operator - () const |
||
885 | { |
||
886 | return D3DXMATRIX(-_11, -_12, -_13, -_14, |
||
887 | -_21, -_22, -_23, -_24, |
||
888 | -_31, -_32, -_33, -_34, |
||
889 | -_41, -_42, -_43, -_44); |
||
890 | } |
||
891 | |||
892 | |||
893 | // binary operators |
||
894 | D3DX10INLINE D3DXMATRIX |
||
895 | D3DXMATRIX::operator * ( CONST D3DXMATRIX& mat ) const |
||
896 | { |
||
897 | D3DXMATRIX matT; |
||
898 | D3DXMatrixMultiply(&matT, this, &mat); |
||
899 | return matT; |
||
900 | } |
||
901 | |||
902 | D3DX10INLINE D3DXMATRIX |
||
903 | D3DXMATRIX::operator + ( CONST D3DXMATRIX& mat ) const |
||
904 | { |
||
905 | return D3DXMATRIX(_11 + mat._11, _12 + mat._12, _13 + mat._13, _14 + mat._14, |
||
906 | _21 + mat._21, _22 + mat._22, _23 + mat._23, _24 + mat._24, |
||
907 | _31 + mat._31, _32 + mat._32, _33 + mat._33, _34 + mat._34, |
||
908 | _41 + mat._41, _42 + mat._42, _43 + mat._43, _44 + mat._44); |
||
909 | } |
||
910 | |||
911 | D3DX10INLINE D3DXMATRIX |
||
912 | D3DXMATRIX::operator - ( CONST D3DXMATRIX& mat ) const |
||
913 | { |
||
914 | return D3DXMATRIX(_11 - mat._11, _12 - mat._12, _13 - mat._13, _14 - mat._14, |
||
915 | _21 - mat._21, _22 - mat._22, _23 - mat._23, _24 - mat._24, |
||
916 | _31 - mat._31, _32 - mat._32, _33 - mat._33, _34 - mat._34, |
||
917 | _41 - mat._41, _42 - mat._42, _43 - mat._43, _44 - mat._44); |
||
918 | } |
||
919 | |||
920 | D3DX10INLINE D3DXMATRIX |
||
921 | D3DXMATRIX::operator * ( FLOAT f ) const |
||
922 | { |
||
923 | return D3DXMATRIX(_11 * f, _12 * f, _13 * f, _14 * f, |
||
924 | _21 * f, _22 * f, _23 * f, _24 * f, |
||
925 | _31 * f, _32 * f, _33 * f, _34 * f, |
||
926 | _41 * f, _42 * f, _43 * f, _44 * f); |
||
927 | } |
||
928 | |||
929 | D3DX10INLINE D3DXMATRIX |
||
930 | D3DXMATRIX::operator / ( FLOAT f ) const |
||
931 | { |
||
932 | FLOAT fInv = 1.0f / f; |
||
933 | return D3DXMATRIX(_11 * fInv, _12 * fInv, _13 * fInv, _14 * fInv, |
||
934 | _21 * fInv, _22 * fInv, _23 * fInv, _24 * fInv, |
||
935 | _31 * fInv, _32 * fInv, _33 * fInv, _34 * fInv, |
||
936 | _41 * fInv, _42 * fInv, _43 * fInv, _44 * fInv); |
||
937 | } |
||
938 | |||
939 | |||
940 | D3DX10INLINE D3DXMATRIX |
||
941 | operator * ( FLOAT f, CONST D3DXMATRIX& mat ) |
||
942 | { |
||
943 | return D3DXMATRIX(f * mat._11, f * mat._12, f * mat._13, f * mat._14, |
||
944 | f * mat._21, f * mat._22, f * mat._23, f * mat._24, |
||
945 | f * mat._31, f * mat._32, f * mat._33, f * mat._34, |
||
946 | f * mat._41, f * mat._42, f * mat._43, f * mat._44); |
||
947 | } |
||
948 | |||
949 | |||
950 | D3DX10INLINE BOOL |
||
951 | D3DXMATRIX::operator == ( CONST D3DXMATRIX& mat ) const |
||
952 | { |
||
953 | return 0 == memcmp(this, &mat, sizeof(D3DXMATRIX)); |
||
954 | } |
||
955 | |||
956 | D3DX10INLINE BOOL |
||
957 | D3DXMATRIX::operator != ( CONST D3DXMATRIX& mat ) const |
||
958 | { |
||
959 | return 0 != memcmp(this, &mat, sizeof(D3DXMATRIX)); |
||
960 | } |
||
961 | |||
962 | |||
963 | |||
964 | //-------------------------- |
||
965 | // Aligned Matrices |
||
966 | //-------------------------- |
||
967 | |||
968 | D3DX10INLINE |
||
969 | _D3DXMATRIXA16::_D3DXMATRIXA16( CONST FLOAT* f ) : |
||
970 | D3DXMATRIX( f ) |
||
971 | { |
||
972 | } |
||
973 | |||
974 | D3DX10INLINE |
||
975 | _D3DXMATRIXA16::_D3DXMATRIXA16( CONST D3DMATRIX& m ) : |
||
976 | D3DXMATRIX( m ) |
||
977 | { |
||
978 | } |
||
979 | |||
980 | D3DX10INLINE |
||
981 | _D3DXMATRIXA16::_D3DXMATRIXA16( CONST D3DXFLOAT16* f ) : |
||
982 | D3DXMATRIX( f ) |
||
983 | { |
||
984 | } |
||
985 | |||
986 | D3DX10INLINE |
||
987 | _D3DXMATRIXA16::_D3DXMATRIXA16( FLOAT _11, FLOAT _12, FLOAT _13, FLOAT _14, |
||
988 | FLOAT _21, FLOAT _22, FLOAT _23, FLOAT _24, |
||
989 | FLOAT _31, FLOAT _32, FLOAT _33, FLOAT _34, |
||
990 | FLOAT _41, FLOAT _42, FLOAT _43, FLOAT _44 ) : |
||
991 | D3DXMATRIX(_11, _12, _13, _14, |
||
992 | _21, _22, _23, _24, |
||
993 | _31, _32, _33, _34, |
||
994 | _41, _42, _43, _44) |
||
995 | { |
||
996 | } |
||
997 | |||
998 | #ifndef SIZE_MAX |
||
999 | #define SIZE_MAX ((SIZE_T)-1) |
||
1000 | #endif |
||
1001 | |||
1002 | D3DX10INLINE void* |
||
1003 | _D3DXMATRIXA16::operator new( size_t s ) |
||
1004 | { |
||
1005 | if (s > (SIZE_MAX-16)) |
||
1006 | return NULL; |
||
1007 | LPBYTE p = ::new BYTE[s + 16]; |
||
1008 | if (p) |
||
1009 | { |
||
1010 | BYTE offset = (BYTE)(16 - ((UINT_PTR)p & 15)); |
||
1011 | p += offset; |
||
1012 | p[-1] = offset; |
||
1013 | } |
||
1014 | return p; |
||
1015 | } |
||
1016 | |||
1017 | D3DX10INLINE void* |
||
1018 | _D3DXMATRIXA16::operator new[]( size_t s ) |
||
1019 | { |
||
1020 | if (s > (SIZE_MAX-16)) |
||
1021 | return NULL; |
||
1022 | LPBYTE p = ::new BYTE[s + 16]; |
||
1023 | if (p) |
||
1024 | { |
||
1025 | BYTE offset = (BYTE)(16 - ((UINT_PTR)p & 15)); |
||
1026 | p += offset; |
||
1027 | p[-1] = offset; |
||
1028 | } |
||
1029 | return p; |
||
1030 | } |
||
1031 | |||
1032 | D3DX10INLINE void |
||
1033 | _D3DXMATRIXA16::operator delete(void* p) |
||
1034 | { |
||
1035 | if(p) |
||
1036 | { |
||
1037 | BYTE* pb = static_cast<BYTE*>(p); |
||
1038 | pb -= pb[-1]; |
||
1039 | ::delete [] pb; |
||
1040 | } |
||
1041 | } |
||
1042 | |||
1043 | D3DX10INLINE void |
||
1044 | _D3DXMATRIXA16::operator delete[](void* p) |
||
1045 | { |
||
1046 | if(p) |
||
1047 | { |
||
1048 | BYTE* pb = static_cast<BYTE*>(p); |
||
1049 | pb -= pb[-1]; |
||
1050 | ::delete [] pb; |
||
1051 | } |
||
1052 | } |
||
1053 | |||
1054 | D3DX10INLINE _D3DXMATRIXA16& |
||
1055 | _D3DXMATRIXA16::operator=(CONST D3DXMATRIX& rhs) |
||
1056 | { |
||
1057 | memcpy(&_11, &rhs, sizeof(D3DXMATRIX)); |
||
1058 | return *this; |
||
1059 | } |
||
1060 | |||
1061 | |||
1062 | //-------------------------- |
||
1063 | // Quaternion |
||
1064 | //-------------------------- |
||
1065 | |||
1066 | D3DX10INLINE |
||
1067 | D3DXQUATERNION::D3DXQUATERNION( CONST FLOAT* pf ) |
||
1068 | { |
||
1069 | #ifdef D3DX10_DEBUG |
||
1070 | if(!pf) |
||
1071 | return; |
||
1072 | #endif |
||
1073 | |||
1074 | x = pf[0]; |
||
1075 | y = pf[1]; |
||
1076 | z = pf[2]; |
||
1077 | w = pf[3]; |
||
1078 | } |
||
1079 | |||
1080 | D3DX10INLINE |
||
1081 | D3DXQUATERNION::D3DXQUATERNION( CONST D3DXFLOAT16* pf ) |
||
1082 | { |
||
1083 | #ifdef D3DX10_DEBUG |
||
1084 | if(!pf) |
||
1085 | return; |
||
1086 | #endif |
||
1087 | |||
1088 | D3DXFloat16To32Array(&x, pf, 4); |
||
1089 | } |
||
1090 | |||
1091 | D3DX10INLINE |
||
1092 | D3DXQUATERNION::D3DXQUATERNION( FLOAT fx, FLOAT fy, FLOAT fz, FLOAT fw ) |
||
1093 | { |
||
1094 | x = fx; |
||
1095 | y = fy; |
||
1096 | z = fz; |
||
1097 | w = fw; |
||
1098 | } |
||
1099 | |||
1100 | |||
1101 | // casting |
||
1102 | D3DX10INLINE |
||
1103 | D3DXQUATERNION::operator FLOAT* () |
||
1104 | { |
||
1105 | return (FLOAT *) &x; |
||
1106 | } |
||
1107 | |||
1108 | D3DX10INLINE |
||
1109 | D3DXQUATERNION::operator CONST FLOAT* () const |
||
1110 | { |
||
1111 | return (CONST FLOAT *) &x; |
||
1112 | } |
||
1113 | |||
1114 | |||
1115 | // assignment operators |
||
1116 | D3DX10INLINE D3DXQUATERNION& |
||
1117 | D3DXQUATERNION::operator += ( CONST D3DXQUATERNION& q ) |
||
1118 | { |
||
1119 | x += q.x; |
||
1120 | y += q.y; |
||
1121 | z += q.z; |
||
1122 | w += q.w; |
||
1123 | return *this; |
||
1124 | } |
||
1125 | |||
1126 | D3DX10INLINE D3DXQUATERNION& |
||
1127 | D3DXQUATERNION::operator -= ( CONST D3DXQUATERNION& q ) |
||
1128 | { |
||
1129 | x -= q.x; |
||
1130 | y -= q.y; |
||
1131 | z -= q.z; |
||
1132 | w -= q.w; |
||
1133 | return *this; |
||
1134 | } |
||
1135 | |||
1136 | D3DX10INLINE D3DXQUATERNION& |
||
1137 | D3DXQUATERNION::operator *= ( CONST D3DXQUATERNION& q ) |
||
1138 | { |
||
1139 | D3DXQuaternionMultiply(this, this, &q); |
||
1140 | return *this; |
||
1141 | } |
||
1142 | |||
1143 | D3DX10INLINE D3DXQUATERNION& |
||
1144 | D3DXQUATERNION::operator *= ( FLOAT f ) |
||
1145 | { |
||
1146 | x *= f; |
||
1147 | y *= f; |
||
1148 | z *= f; |
||
1149 | w *= f; |
||
1150 | return *this; |
||
1151 | } |
||
1152 | |||
1153 | D3DX10INLINE D3DXQUATERNION& |
||
1154 | D3DXQUATERNION::operator /= ( FLOAT f ) |
||
1155 | { |
||
1156 | FLOAT fInv = 1.0f / f; |
||
1157 | x *= fInv; |
||
1158 | y *= fInv; |
||
1159 | z *= fInv; |
||
1160 | w *= fInv; |
||
1161 | return *this; |
||
1162 | } |
||
1163 | |||
1164 | |||
1165 | // unary operators |
||
1166 | D3DX10INLINE D3DXQUATERNION |
||
1167 | D3DXQUATERNION::operator + () const |
||
1168 | { |
||
1169 | return *this; |
||
1170 | } |
||
1171 | |||
1172 | D3DX10INLINE D3DXQUATERNION |
||
1173 | D3DXQUATERNION::operator - () const |
||
1174 | { |
||
1175 | return D3DXQUATERNION(-x, -y, -z, -w); |
||
1176 | } |
||
1177 | |||
1178 | |||
1179 | // binary operators |
||
1180 | D3DX10INLINE D3DXQUATERNION |
||
1181 | D3DXQUATERNION::operator + ( CONST D3DXQUATERNION& q ) const |
||
1182 | { |
||
1183 | return D3DXQUATERNION(x + q.x, y + q.y, z + q.z, w + q.w); |
||
1184 | } |
||
1185 | |||
1186 | D3DX10INLINE D3DXQUATERNION |
||
1187 | D3DXQUATERNION::operator - ( CONST D3DXQUATERNION& q ) const |
||
1188 | { |
||
1189 | return D3DXQUATERNION(x - q.x, y - q.y, z - q.z, w - q.w); |
||
1190 | } |
||
1191 | |||
1192 | D3DX10INLINE D3DXQUATERNION |
||
1193 | D3DXQUATERNION::operator * ( CONST D3DXQUATERNION& q ) const |
||
1194 | { |
||
1195 | D3DXQUATERNION qT; |
||
1196 | D3DXQuaternionMultiply(&qT, this, &q); |
||
1197 | return qT; |
||
1198 | } |
||
1199 | |||
1200 | D3DX10INLINE D3DXQUATERNION |
||
1201 | D3DXQUATERNION::operator * ( FLOAT f ) const |
||
1202 | { |
||
1203 | return D3DXQUATERNION(x * f, y * f, z * f, w * f); |
||
1204 | } |
||
1205 | |||
1206 | D3DX10INLINE D3DXQUATERNION |
||
1207 | D3DXQUATERNION::operator / ( FLOAT f ) const |
||
1208 | { |
||
1209 | FLOAT fInv = 1.0f / f; |
||
1210 | return D3DXQUATERNION(x * fInv, y * fInv, z * fInv, w * fInv); |
||
1211 | } |
||
1212 | |||
1213 | |||
1214 | D3DX10INLINE D3DXQUATERNION |
||
1215 | operator * (FLOAT f, CONST D3DXQUATERNION& q ) |
||
1216 | { |
||
1217 | return D3DXQUATERNION(f * q.x, f * q.y, f * q.z, f * q.w); |
||
1218 | } |
||
1219 | |||
1220 | |||
1221 | D3DX10INLINE BOOL |
||
1222 | D3DXQUATERNION::operator == ( CONST D3DXQUATERNION& q ) const |
||
1223 | { |
||
1224 | return x == q.x && y == q.y && z == q.z && w == q.w; |
||
1225 | } |
||
1226 | |||
1227 | D3DX10INLINE BOOL |
||
1228 | D3DXQUATERNION::operator != ( CONST D3DXQUATERNION& q ) const |
||
1229 | { |
||
1230 | return x != q.x || y != q.y || z != q.z || w != q.w; |
||
1231 | } |
||
1232 | |||
1233 | |||
1234 | |||
1235 | //-------------------------- |
||
1236 | // Plane |
||
1237 | //-------------------------- |
||
1238 | |||
1239 | D3DX10INLINE |
||
1240 | D3DXPLANE::D3DXPLANE( CONST FLOAT* pf ) |
||
1241 | { |
||
1242 | #ifdef D3DX10_DEBUG |
||
1243 | if(!pf) |
||
1244 | return; |
||
1245 | #endif |
||
1246 | |||
1247 | a = pf[0]; |
||
1248 | b = pf[1]; |
||
1249 | c = pf[2]; |
||
1250 | d = pf[3]; |
||
1251 | } |
||
1252 | |||
1253 | D3DX10INLINE |
||
1254 | D3DXPLANE::D3DXPLANE( CONST D3DXFLOAT16* pf ) |
||
1255 | { |
||
1256 | #ifdef D3DX10_DEBUG |
||
1257 | if(!pf) |
||
1258 | return; |
||
1259 | #endif |
||
1260 | |||
1261 | D3DXFloat16To32Array(&a, pf, 4); |
||
1262 | } |
||
1263 | |||
1264 | D3DX10INLINE |
||
1265 | D3DXPLANE::D3DXPLANE( FLOAT fa, FLOAT fb, FLOAT fc, FLOAT fd ) |
||
1266 | { |
||
1267 | a = fa; |
||
1268 | b = fb; |
||
1269 | c = fc; |
||
1270 | d = fd; |
||
1271 | } |
||
1272 | |||
1273 | |||
1274 | // casting |
||
1275 | D3DX10INLINE |
||
1276 | D3DXPLANE::operator FLOAT* () |
||
1277 | { |
||
1278 | return (FLOAT *) &a; |
||
1279 | } |
||
1280 | |||
1281 | D3DX10INLINE |
||
1282 | D3DXPLANE::operator CONST FLOAT* () const |
||
1283 | { |
||
1284 | return (CONST FLOAT *) &a; |
||
1285 | } |
||
1286 | |||
1287 | |||
1288 | // assignment operators |
||
1289 | D3DX10INLINE D3DXPLANE& |
||
1290 | D3DXPLANE::operator *= ( FLOAT f ) |
||
1291 | { |
||
1292 | a *= f; |
||
1293 | b *= f; |
||
1294 | c *= f; |
||
1295 | d *= f; |
||
1296 | return *this; |
||
1297 | } |
||
1298 | |||
1299 | D3DX10INLINE D3DXPLANE& |
||
1300 | D3DXPLANE::operator /= ( FLOAT f ) |
||
1301 | { |
||
1302 | FLOAT fInv = 1.0f / f; |
||
1303 | a *= fInv; |
||
1304 | b *= fInv; |
||
1305 | c *= fInv; |
||
1306 | d *= fInv; |
||
1307 | return *this; |
||
1308 | } |
||
1309 | |||
1310 | |||
1311 | // unary operators |
||
1312 | D3DX10INLINE D3DXPLANE |
||
1313 | D3DXPLANE::operator + () const |
||
1314 | { |
||
1315 | return *this; |
||
1316 | } |
||
1317 | |||
1318 | D3DX10INLINE D3DXPLANE |
||
1319 | D3DXPLANE::operator - () const |
||
1320 | { |
||
1321 | return D3DXPLANE(-a, -b, -c, -d); |
||
1322 | } |
||
1323 | |||
1324 | |||
1325 | // binary operators |
||
1326 | D3DX10INLINE D3DXPLANE |
||
1327 | D3DXPLANE::operator * ( FLOAT f ) const |
||
1328 | { |
||
1329 | return D3DXPLANE(a * f, b * f, c * f, d * f); |
||
1330 | } |
||
1331 | |||
1332 | D3DX10INLINE D3DXPLANE |
||
1333 | D3DXPLANE::operator / ( FLOAT f ) const |
||
1334 | { |
||
1335 | FLOAT fInv = 1.0f / f; |
||
1336 | return D3DXPLANE(a * fInv, b * fInv, c * fInv, d * fInv); |
||
1337 | } |
||
1338 | |||
1339 | D3DX10INLINE D3DXPLANE |
||
1340 | operator * (FLOAT f, CONST D3DXPLANE& p ) |
||
1341 | { |
||
1342 | return D3DXPLANE(f * p.a, f * p.b, f * p.c, f * p.d); |
||
1343 | } |
||
1344 | |||
1345 | D3DX10INLINE BOOL |
||
1346 | D3DXPLANE::operator == ( CONST D3DXPLANE& p ) const |
||
1347 | { |
||
1348 | return a == p.a && b == p.b && c == p.c && d == p.d; |
||
1349 | } |
||
1350 | |||
1351 | D3DX10INLINE BOOL |
||
1352 | D3DXPLANE::operator != ( CONST D3DXPLANE& p ) const |
||
1353 | { |
||
1354 | return a != p.a || b != p.b || c != p.c || d != p.d; |
||
1355 | } |
||
1356 | |||
1357 | |||
1358 | |||
1359 | |||
1360 | //-------------------------- |
||
1361 | // Color |
||
1362 | //-------------------------- |
||
1363 | |||
1364 | D3DX10INLINE |
||
1365 | D3DXCOLOR::D3DXCOLOR( UINT dw ) |
||
1366 | { |
||
1367 | CONST FLOAT f = 1.0f / 255.0f; |
||
1368 | r = f * (FLOAT) (unsigned char) (dw >> 16); |
||
1369 | g = f * (FLOAT) (unsigned char) (dw >> 8); |
||
1370 | b = f * (FLOAT) (unsigned char) (dw >> 0); |
||
1371 | a = f * (FLOAT) (unsigned char) (dw >> 24); |
||
1372 | } |
||
1373 | |||
1374 | D3DX10INLINE |
||
1375 | D3DXCOLOR::D3DXCOLOR( CONST FLOAT* pf ) |
||
1376 | { |
||
1377 | #ifdef D3DX10_DEBUG |
||
1378 | if(!pf) |
||
1379 | return; |
||
1380 | #endif |
||
1381 | |||
1382 | r = pf[0]; |
||
1383 | g = pf[1]; |
||
1384 | b = pf[2]; |
||
1385 | a = pf[3]; |
||
1386 | } |
||
1387 | |||
1388 | D3DX10INLINE |
||
1389 | D3DXCOLOR::D3DXCOLOR( CONST D3DXFLOAT16* pf ) |
||
1390 | { |
||
1391 | #ifdef D3DX10_DEBUG |
||
1392 | if(!pf) |
||
1393 | return; |
||
1394 | #endif |
||
1395 | |||
1396 | D3DXFloat16To32Array(&r, pf, 4); |
||
1397 | } |
||
1398 | |||
1399 | D3DX10INLINE |
||
1400 | D3DXCOLOR::D3DXCOLOR( FLOAT fr, FLOAT fg, FLOAT fb, FLOAT fa ) |
||
1401 | { |
||
1402 | r = fr; |
||
1403 | g = fg; |
||
1404 | b = fb; |
||
1405 | a = fa; |
||
1406 | } |
||
1407 | |||
1408 | |||
1409 | // casting |
||
1410 | D3DX10INLINE |
||
1411 | D3DXCOLOR::operator UINT () const |
||
1412 | { |
||
1413 | UINT dwR = r >= 1.0f ? 0xff : r <= 0.0f ? 0x00 : (UINT) (r * 255.0f + 0.5f); |
||
1414 | UINT dwG = g >= 1.0f ? 0xff : g <= 0.0f ? 0x00 : (UINT) (g * 255.0f + 0.5f); |
||
1415 | UINT dwB = b >= 1.0f ? 0xff : b <= 0.0f ? 0x00 : (UINT) (b * 255.0f + 0.5f); |
||
1416 | UINT dwA = a >= 1.0f ? 0xff : a <= 0.0f ? 0x00 : (UINT) (a * 255.0f + 0.5f); |
||
1417 | |||
1418 | return (dwA << 24) | (dwR << 16) | (dwG << 8) | (dwB << 0); |
||
1419 | } |
||
1420 | |||
1421 | |||
1422 | D3DX10INLINE |
||
1423 | D3DXCOLOR::operator FLOAT * () |
||
1424 | { |
||
1425 | return (FLOAT *) &r; |
||
1426 | } |
||
1427 | |||
1428 | D3DX10INLINE |
||
1429 | D3DXCOLOR::operator CONST FLOAT * () const |
||
1430 | { |
||
1431 | return (CONST FLOAT *) &r; |
||
1432 | } |
||
1433 | |||
1434 | // assignment operators |
||
1435 | D3DX10INLINE D3DXCOLOR& |
||
1436 | D3DXCOLOR::operator += ( CONST D3DXCOLOR& c ) |
||
1437 | { |
||
1438 | r += c.r; |
||
1439 | g += c.g; |
||
1440 | b += c.b; |
||
1441 | a += c.a; |
||
1442 | return *this; |
||
1443 | } |
||
1444 | |||
1445 | D3DX10INLINE D3DXCOLOR& |
||
1446 | D3DXCOLOR::operator -= ( CONST D3DXCOLOR& c ) |
||
1447 | { |
||
1448 | r -= c.r; |
||
1449 | g -= c.g; |
||
1450 | b -= c.b; |
||
1451 | a -= c.a; |
||
1452 | return *this; |
||
1453 | } |
||
1454 | |||
1455 | D3DX10INLINE D3DXCOLOR& |
||
1456 | D3DXCOLOR::operator *= ( FLOAT f ) |
||
1457 | { |
||
1458 | r *= f; |
||
1459 | g *= f; |
||
1460 | b *= f; |
||
1461 | a *= f; |
||
1462 | return *this; |
||
1463 | } |
||
1464 | |||
1465 | D3DX10INLINE D3DXCOLOR& |
||
1466 | D3DXCOLOR::operator /= ( FLOAT f ) |
||
1467 | { |
||
1468 | FLOAT fInv = 1.0f / f; |
||
1469 | r *= fInv; |
||
1470 | g *= fInv; |
||
1471 | b *= fInv; |
||
1472 | a *= fInv; |
||
1473 | return *this; |
||
1474 | } |
||
1475 | |||
1476 | |||
1477 | // unary operators |
||
1478 | D3DX10INLINE D3DXCOLOR |
||
1479 | D3DXCOLOR::operator + () const |
||
1480 | { |
||
1481 | return *this; |
||
1482 | } |
||
1483 | |||
1484 | D3DX10INLINE D3DXCOLOR |
||
1485 | D3DXCOLOR::operator - () const |
||
1486 | { |
||
1487 | return D3DXCOLOR(-r, -g, -b, -a); |
||
1488 | } |
||
1489 | |||
1490 | |||
1491 | // binary operators |
||
1492 | D3DX10INLINE D3DXCOLOR |
||
1493 | D3DXCOLOR::operator + ( CONST D3DXCOLOR& c ) const |
||
1494 | { |
||
1495 | return D3DXCOLOR(r + c.r, g + c.g, b + c.b, a + c.a); |
||
1496 | } |
||
1497 | |||
1498 | D3DX10INLINE D3DXCOLOR |
||
1499 | D3DXCOLOR::operator - ( CONST D3DXCOLOR& c ) const |
||
1500 | { |
||
1501 | return D3DXCOLOR(r - c.r, g - c.g, b - c.b, a - c.a); |
||
1502 | } |
||
1503 | |||
1504 | D3DX10INLINE D3DXCOLOR |
||
1505 | D3DXCOLOR::operator * ( FLOAT f ) const |
||
1506 | { |
||
1507 | return D3DXCOLOR(r * f, g * f, b * f, a * f); |
||
1508 | } |
||
1509 | |||
1510 | D3DX10INLINE D3DXCOLOR |
||
1511 | D3DXCOLOR::operator / ( FLOAT f ) const |
||
1512 | { |
||
1513 | FLOAT fInv = 1.0f / f; |
||
1514 | return D3DXCOLOR(r * fInv, g * fInv, b * fInv, a * fInv); |
||
1515 | } |
||
1516 | |||
1517 | |||
1518 | D3DX10INLINE D3DXCOLOR |
||
1519 | operator * (FLOAT f, CONST D3DXCOLOR& c ) |
||
1520 | { |
||
1521 | return D3DXCOLOR(f * c.r, f * c.g, f * c.b, f * c.a); |
||
1522 | } |
||
1523 | |||
1524 | |||
1525 | D3DX10INLINE BOOL |
||
1526 | D3DXCOLOR::operator == ( CONST D3DXCOLOR& c ) const |
||
1527 | { |
||
1528 | return r == c.r && g == c.g && b == c.b && a == c.a; |
||
1529 | } |
||
1530 | |||
1531 | D3DX10INLINE BOOL |
||
1532 | D3DXCOLOR::operator != ( CONST D3DXCOLOR& c ) const |
||
1533 | { |
||
1534 | return r != c.r || g != c.g || b != c.b || a != c.a; |
||
1535 | } |
||
1536 | |||
1537 | |||
1538 | #endif //__cplusplus |
||
1539 | |||
1540 | |||
1541 | |||
1542 | //=========================================================================== |
||
1543 | // |
||
1544 | // Inline functions |
||
1545 | // |
||
1546 | //=========================================================================== |
||
1547 | |||
1548 | |||
1549 | //-------------------------- |
||
1550 | // 2D Vector |
||
1551 | //-------------------------- |
||
1552 | |||
1553 | D3DX10INLINE FLOAT D3DXVec2Length |
||
1554 | ( CONST D3DXVECTOR2 *pV ) |
||
1555 | { |
||
1556 | #ifdef D3DX10_DEBUG |
||
1557 | if(!pV) |
||
1558 | return 0.0f; |
||
1559 | #endif |
||
1560 | |||
1561 | #ifdef __cplusplus |
||
1562 | return sqrtf(pV->x * pV->x + pV->y * pV->y); |
||
1563 | #else |
||
1564 | return (FLOAT) sqrt(pV->x * pV->x + pV->y * pV->y); |
||
1565 | #endif |
||
1566 | } |
||
1567 | |||
1568 | D3DX10INLINE FLOAT D3DXVec2LengthSq |
||
1569 | ( CONST D3DXVECTOR2 *pV ) |
||
1570 | { |
||
1571 | #ifdef D3DX10_DEBUG |
||
1572 | if(!pV) |
||
1573 | return 0.0f; |
||
1574 | #endif |
||
1575 | |||
1576 | return pV->x * pV->x + pV->y * pV->y; |
||
1577 | } |
||
1578 | |||
1579 | D3DX10INLINE FLOAT D3DXVec2Dot |
||
1580 | ( CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ) |
||
1581 | { |
||
1582 | #ifdef D3DX10_DEBUG |
||
1583 | if(!pV1 || !pV2) |
||
1584 | return 0.0f; |
||
1585 | #endif |
||
1586 | |||
1587 | return pV1->x * pV2->x + pV1->y * pV2->y; |
||
1588 | } |
||
1589 | |||
1590 | D3DX10INLINE FLOAT D3DXVec2CCW |
||
1591 | ( CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ) |
||
1592 | { |
||
1593 | #ifdef D3DX10_DEBUG |
||
1594 | if(!pV1 || !pV2) |
||
1595 | return 0.0f; |
||
1596 | #endif |
||
1597 | |||
1598 | return pV1->x * pV2->y - pV1->y * pV2->x; |
||
1599 | } |
||
1600 | |||
1601 | D3DX10INLINE D3DXVECTOR2* D3DXVec2Add |
||
1602 | ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ) |
||
1603 | { |
||
1604 | #ifdef D3DX10_DEBUG |
||
1605 | if(!pOut || !pV1 || !pV2) |
||
1606 | return NULL; |
||
1607 | #endif |
||
1608 | |||
1609 | pOut->x = pV1->x + pV2->x; |
||
1610 | pOut->y = pV1->y + pV2->y; |
||
1611 | return pOut; |
||
1612 | } |
||
1613 | |||
1614 | D3DX10INLINE D3DXVECTOR2* D3DXVec2Subtract |
||
1615 | ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ) |
||
1616 | { |
||
1617 | #ifdef D3DX10_DEBUG |
||
1618 | if(!pOut || !pV1 || !pV2) |
||
1619 | return NULL; |
||
1620 | #endif |
||
1621 | |||
1622 | pOut->x = pV1->x - pV2->x; |
||
1623 | pOut->y = pV1->y - pV2->y; |
||
1624 | return pOut; |
||
1625 | } |
||
1626 | |||
1627 | D3DX10INLINE D3DXVECTOR2* D3DXVec2Minimize |
||
1628 | ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ) |
||
1629 | { |
||
1630 | #ifdef D3DX10_DEBUG |
||
1631 | if(!pOut || !pV1 || !pV2) |
||
1632 | return NULL; |
||
1633 | #endif |
||
1634 | |||
1635 | pOut->x = pV1->x < pV2->x ? pV1->x : pV2->x; |
||
1636 | pOut->y = pV1->y < pV2->y ? pV1->y : pV2->y; |
||
1637 | return pOut; |
||
1638 | } |
||
1639 | |||
1640 | D3DX10INLINE D3DXVECTOR2* D3DXVec2Maximize |
||
1641 | ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ) |
||
1642 | { |
||
1643 | #ifdef D3DX10_DEBUG |
||
1644 | if(!pOut || !pV1 || !pV2) |
||
1645 | return NULL; |
||
1646 | #endif |
||
1647 | |||
1648 | pOut->x = pV1->x > pV2->x ? pV1->x : pV2->x; |
||
1649 | pOut->y = pV1->y > pV2->y ? pV1->y : pV2->y; |
||
1650 | return pOut; |
||
1651 | } |
||
1652 | |||
1653 | D3DX10INLINE D3DXVECTOR2* D3DXVec2Scale |
||
1654 | ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV, FLOAT s ) |
||
1655 | { |
||
1656 | #ifdef D3DX10_DEBUG |
||
1657 | if(!pOut || !pV) |
||
1658 | return NULL; |
||
1659 | #endif |
||
1660 | |||
1661 | pOut->x = pV->x * s; |
||
1662 | pOut->y = pV->y * s; |
||
1663 | return pOut; |
||
1664 | } |
||
1665 | |||
1666 | D3DX10INLINE D3DXVECTOR2* D3DXVec2Lerp |
||
1667 | ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2, |
||
1668 | FLOAT s ) |
||
1669 | { |
||
1670 | #ifdef D3DX10_DEBUG |
||
1671 | if(!pOut || !pV1 || !pV2) |
||
1672 | return NULL; |
||
1673 | #endif |
||
1674 | |||
1675 | pOut->x = pV1->x + s * (pV2->x - pV1->x); |
||
1676 | pOut->y = pV1->y + s * (pV2->y - pV1->y); |
||
1677 | return pOut; |
||
1678 | } |
||
1679 | |||
1680 | |||
1681 | //-------------------------- |
||
1682 | // 3D Vector |
||
1683 | //-------------------------- |
||
1684 | |||
1685 | D3DX10INLINE FLOAT D3DXVec3Length |
||
1686 | ( CONST D3DXVECTOR3 *pV ) |
||
1687 | { |
||
1688 | #ifdef D3DX10_DEBUG |
||
1689 | if(!pV) |
||
1690 | return 0.0f; |
||
1691 | #endif |
||
1692 | |||
1693 | #ifdef __cplusplus |
||
1694 | return sqrtf(pV->x * pV->x + pV->y * pV->y + pV->z * pV->z); |
||
1695 | #else |
||
1696 | return (FLOAT) sqrt(pV->x * pV->x + pV->y * pV->y + pV->z * pV->z); |
||
1697 | #endif |
||
1698 | } |
||
1699 | |||
1700 | D3DX10INLINE FLOAT D3DXVec3LengthSq |
||
1701 | ( CONST D3DXVECTOR3 *pV ) |
||
1702 | { |
||
1703 | #ifdef D3DX10_DEBUG |
||
1704 | if(!pV) |
||
1705 | return 0.0f; |
||
1706 | #endif |
||
1707 | |||
1708 | return pV->x * pV->x + pV->y * pV->y + pV->z * pV->z; |
||
1709 | } |
||
1710 | |||
1711 | D3DX10INLINE FLOAT D3DXVec3Dot |
||
1712 | ( CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ) |
||
1713 | { |
||
1714 | #ifdef D3DX10_DEBUG |
||
1715 | if(!pV1 || !pV2) |
||
1716 | return 0.0f; |
||
1717 | #endif |
||
1718 | |||
1719 | return pV1->x * pV2->x + pV1->y * pV2->y + pV1->z * pV2->z; |
||
1720 | } |
||
1721 | |||
1722 | D3DX10INLINE D3DXVECTOR3* D3DXVec3Cross |
||
1723 | ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ) |
||
1724 | { |
||
1725 | D3DXVECTOR3 v; |
||
1726 | |||
1727 | #ifdef D3DX10_DEBUG |
||
1728 | if(!pOut || !pV1 || !pV2) |
||
1729 | return NULL; |
||
1730 | #endif |
||
1731 | |||
1732 | v.x = pV1->y * pV2->z - pV1->z * pV2->y; |
||
1733 | v.y = pV1->z * pV2->x - pV1->x * pV2->z; |
||
1734 | v.z = pV1->x * pV2->y - pV1->y * pV2->x; |
||
1735 | |||
1736 | *pOut = v; |
||
1737 | return pOut; |
||
1738 | } |
||
1739 | |||
1740 | D3DX10INLINE D3DXVECTOR3* D3DXVec3Add |
||
1741 | ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ) |
||
1742 | { |
||
1743 | #ifdef D3DX10_DEBUG |
||
1744 | if(!pOut || !pV1 || !pV2) |
||
1745 | return NULL; |
||
1746 | #endif |
||
1747 | |||
1748 | pOut->x = pV1->x + pV2->x; |
||
1749 | pOut->y = pV1->y + pV2->y; |
||
1750 | pOut->z = pV1->z + pV2->z; |
||
1751 | return pOut; |
||
1752 | } |
||
1753 | |||
1754 | D3DX10INLINE D3DXVECTOR3* D3DXVec3Subtract |
||
1755 | ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ) |
||
1756 | { |
||
1757 | #ifdef D3DX10_DEBUG |
||
1758 | if(!pOut || !pV1 || !pV2) |
||
1759 | return NULL; |
||
1760 | #endif |
||
1761 | |||
1762 | pOut->x = pV1->x - pV2->x; |
||
1763 | pOut->y = pV1->y - pV2->y; |
||
1764 | pOut->z = pV1->z - pV2->z; |
||
1765 | return pOut; |
||
1766 | } |
||
1767 | |||
1768 | D3DX10INLINE D3DXVECTOR3* D3DXVec3Minimize |
||
1769 | ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ) |
||
1770 | { |
||
1771 | #ifdef D3DX10_DEBUG |
||
1772 | if(!pOut || !pV1 || !pV2) |
||
1773 | return NULL; |
||
1774 | #endif |
||
1775 | |||
1776 | pOut->x = pV1->x < pV2->x ? pV1->x : pV2->x; |
||
1777 | pOut->y = pV1->y < pV2->y ? pV1->y : pV2->y; |
||
1778 | pOut->z = pV1->z < pV2->z ? pV1->z : pV2->z; |
||
1779 | return pOut; |
||
1780 | } |
||
1781 | |||
1782 | D3DX10INLINE D3DXVECTOR3* D3DXVec3Maximize |
||
1783 | ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ) |
||
1784 | { |
||
1785 | #ifdef D3DX10_DEBUG |
||
1786 | if(!pOut || !pV1 || !pV2) |
||
1787 | return NULL; |
||
1788 | #endif |
||
1789 | |||
1790 | pOut->x = pV1->x > pV2->x ? pV1->x : pV2->x; |
||
1791 | pOut->y = pV1->y > pV2->y ? pV1->y : pV2->y; |
||
1792 | pOut->z = pV1->z > pV2->z ? pV1->z : pV2->z; |
||
1793 | return pOut; |
||
1794 | } |
||
1795 | |||
1796 | D3DX10INLINE D3DXVECTOR3* D3DXVec3Scale |
||
1797 | ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV, FLOAT s) |
||
1798 | { |
||
1799 | #ifdef D3DX10_DEBUG |
||
1800 | if(!pOut || !pV) |
||
1801 | return NULL; |
||
1802 | #endif |
||
1803 | |||
1804 | pOut->x = pV->x * s; |
||
1805 | pOut->y = pV->y * s; |
||
1806 | pOut->z = pV->z * s; |
||
1807 | return pOut; |
||
1808 | } |
||
1809 | |||
1810 | D3DX10INLINE D3DXVECTOR3* D3DXVec3Lerp |
||
1811 | ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2, |
||
1812 | FLOAT s ) |
||
1813 | { |
||
1814 | #ifdef D3DX10_DEBUG |
||
1815 | if(!pOut || !pV1 || !pV2) |
||
1816 | return NULL; |
||
1817 | #endif |
||
1818 | |||
1819 | pOut->x = pV1->x + s * (pV2->x - pV1->x); |
||
1820 | pOut->y = pV1->y + s * (pV2->y - pV1->y); |
||
1821 | pOut->z = pV1->z + s * (pV2->z - pV1->z); |
||
1822 | return pOut; |
||
1823 | } |
||
1824 | |||
1825 | |||
1826 | //-------------------------- |
||
1827 | // 4D Vector |
||
1828 | //-------------------------- |
||
1829 | |||
1830 | D3DX10INLINE FLOAT D3DXVec4Length |
||
1831 | ( CONST D3DXVECTOR4 *pV ) |
||
1832 | { |
||
1833 | #ifdef D3DX10_DEBUG |
||
1834 | if(!pV) |
||
1835 | return 0.0f; |
||
1836 | #endif |
||
1837 | |||
1838 | #ifdef __cplusplus |
||
1839 | return sqrtf(pV->x * pV->x + pV->y * pV->y + pV->z * pV->z + pV->w * pV->w); |
||
1840 | #else |
||
1841 | return (FLOAT) sqrt(pV->x * pV->x + pV->y * pV->y + pV->z * pV->z + pV->w * pV->w); |
||
1842 | #endif |
||
1843 | } |
||
1844 | |||
1845 | D3DX10INLINE FLOAT D3DXVec4LengthSq |
||
1846 | ( CONST D3DXVECTOR4 *pV ) |
||
1847 | { |
||
1848 | #ifdef D3DX10_DEBUG |
||
1849 | if(!pV) |
||
1850 | return 0.0f; |
||
1851 | #endif |
||
1852 | |||
1853 | return pV->x * pV->x + pV->y * pV->y + pV->z * pV->z + pV->w * pV->w; |
||
1854 | } |
||
1855 | |||
1856 | D3DX10INLINE FLOAT D3DXVec4Dot |
||
1857 | ( CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2 ) |
||
1858 | { |
||
1859 | #ifdef D3DX10_DEBUG |
||
1860 | if(!pV1 || !pV2) |
||
1861 | return 0.0f; |
||
1862 | #endif |
||
1863 | |||
1864 | return pV1->x * pV2->x + pV1->y * pV2->y + pV1->z * pV2->z + pV1->w * pV2->w; |
||
1865 | } |
||
1866 | |||
1867 | D3DX10INLINE D3DXVECTOR4* D3DXVec4Add |
||
1868 | ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2) |
||
1869 | { |
||
1870 | #ifdef D3DX10_DEBUG |
||
1871 | if(!pOut || !pV1 || !pV2) |
||
1872 | return NULL; |
||
1873 | #endif |
||
1874 | |||
1875 | pOut->x = pV1->x + pV2->x; |
||
1876 | pOut->y = pV1->y + pV2->y; |
||
1877 | pOut->z = pV1->z + pV2->z; |
||
1878 | pOut->w = pV1->w + pV2->w; |
||
1879 | return pOut; |
||
1880 | } |
||
1881 | |||
1882 | D3DX10INLINE D3DXVECTOR4* D3DXVec4Subtract |
||
1883 | ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2) |
||
1884 | { |
||
1885 | #ifdef D3DX10_DEBUG |
||
1886 | if(!pOut || !pV1 || !pV2) |
||
1887 | return NULL; |
||
1888 | #endif |
||
1889 | |||
1890 | pOut->x = pV1->x - pV2->x; |
||
1891 | pOut->y = pV1->y - pV2->y; |
||
1892 | pOut->z = pV1->z - pV2->z; |
||
1893 | pOut->w = pV1->w - pV2->w; |
||
1894 | return pOut; |
||
1895 | } |
||
1896 | |||
1897 | D3DX10INLINE D3DXVECTOR4* D3DXVec4Minimize |
||
1898 | ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2) |
||
1899 | { |
||
1900 | #ifdef D3DX10_DEBUG |
||
1901 | if(!pOut || !pV1 || !pV2) |
||
1902 | return NULL; |
||
1903 | #endif |
||
1904 | |||
1905 | pOut->x = pV1->x < pV2->x ? pV1->x : pV2->x; |
||
1906 | pOut->y = pV1->y < pV2->y ? pV1->y : pV2->y; |
||
1907 | pOut->z = pV1->z < pV2->z ? pV1->z : pV2->z; |
||
1908 | pOut->w = pV1->w < pV2->w ? pV1->w : pV2->w; |
||
1909 | return pOut; |
||
1910 | } |
||
1911 | |||
1912 | D3DX10INLINE D3DXVECTOR4* D3DXVec4Maximize |
||
1913 | ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2) |
||
1914 | { |
||
1915 | #ifdef D3DX10_DEBUG |
||
1916 | if(!pOut || !pV1 || !pV2) |
||
1917 | return NULL; |
||
1918 | #endif |
||
1919 | |||
1920 | pOut->x = pV1->x > pV2->x ? pV1->x : pV2->x; |
||
1921 | pOut->y = pV1->y > pV2->y ? pV1->y : pV2->y; |
||
1922 | pOut->z = pV1->z > pV2->z ? pV1->z : pV2->z; |
||
1923 | pOut->w = pV1->w > pV2->w ? pV1->w : pV2->w; |
||
1924 | return pOut; |
||
1925 | } |
||
1926 | |||
1927 | D3DX10INLINE D3DXVECTOR4* D3DXVec4Scale |
||
1928 | ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV, FLOAT s) |
||
1929 | { |
||
1930 | #ifdef D3DX10_DEBUG |
||
1931 | if(!pOut || !pV) |
||
1932 | return NULL; |
||
1933 | #endif |
||
1934 | |||
1935 | pOut->x = pV->x * s; |
||
1936 | pOut->y = pV->y * s; |
||
1937 | pOut->z = pV->z * s; |
||
1938 | pOut->w = pV->w * s; |
||
1939 | return pOut; |
||
1940 | } |
||
1941 | |||
1942 | D3DX10INLINE D3DXVECTOR4* D3DXVec4Lerp |
||
1943 | ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2, |
||
1944 | FLOAT s ) |
||
1945 | { |
||
1946 | #ifdef D3DX10_DEBUG |
||
1947 | if(!pOut || !pV1 || !pV2) |
||
1948 | return NULL; |
||
1949 | #endif |
||
1950 | |||
1951 | pOut->x = pV1->x + s * (pV2->x - pV1->x); |
||
1952 | pOut->y = pV1->y + s * (pV2->y - pV1->y); |
||
1953 | pOut->z = pV1->z + s * (pV2->z - pV1->z); |
||
1954 | pOut->w = pV1->w + s * (pV2->w - pV1->w); |
||
1955 | return pOut; |
||
1956 | } |
||
1957 | |||
1958 | |||
1959 | //-------------------------- |
||
1960 | // 4D Matrix |
||
1961 | //-------------------------- |
||
1962 | |||
1963 | D3DX10INLINE D3DXMATRIX* D3DXMatrixIdentity |
||
1964 | ( D3DXMATRIX *pOut ) |
||
1965 | { |
||
1966 | #ifdef D3DX10_DEBUG |
||
1967 | if(!pOut) |
||
1968 | return NULL; |
||
1969 | #endif |
||
1970 | |||
1971 | pOut->m[0][1] = pOut->m[0][2] = pOut->m[0][3] = |
||
1972 | pOut->m[1][0] = pOut->m[1][2] = pOut->m[1][3] = |
||
1973 | pOut->m[2][0] = pOut->m[2][1] = pOut->m[2][3] = |
||
1974 | pOut->m[3][0] = pOut->m[3][1] = pOut->m[3][2] = 0.0f; |
||
1975 | |||
1976 | pOut->m[0][0] = pOut->m[1][1] = pOut->m[2][2] = pOut->m[3][3] = 1.0f; |
||
1977 | return pOut; |
||
1978 | } |
||
1979 | |||
1980 | |||
1981 | D3DX10INLINE BOOL D3DXMatrixIsIdentity |
||
1982 | ( CONST D3DXMATRIX *pM ) |
||
1983 | { |
||
1984 | #ifdef D3DX10_DEBUG |
||
1985 | if(!pM) |
||
1986 | return FALSE; |
||
1987 | #endif |
||
1988 | |||
1989 | return pM->m[0][0] == 1.0f && pM->m[0][1] == 0.0f && pM->m[0][2] == 0.0f && pM->m[0][3] == 0.0f && |
||
1990 | pM->m[1][0] == 0.0f && pM->m[1][1] == 1.0f && pM->m[1][2] == 0.0f && pM->m[1][3] == 0.0f && |
||
1991 | pM->m[2][0] == 0.0f && pM->m[2][1] == 0.0f && pM->m[2][2] == 1.0f && pM->m[2][3] == 0.0f && |
||
1992 | pM->m[3][0] == 0.0f && pM->m[3][1] == 0.0f && pM->m[3][2] == 0.0f && pM->m[3][3] == 1.0f; |
||
1993 | } |
||
1994 | |||
1995 | |||
1996 | //-------------------------- |
||
1997 | // Quaternion |
||
1998 | //-------------------------- |
||
1999 | |||
2000 | D3DX10INLINE FLOAT D3DXQuaternionLength |
||
2001 | ( CONST D3DXQUATERNION *pQ ) |
||
2002 | { |
||
2003 | #ifdef D3DX10_DEBUG |
||
2004 | if(!pQ) |
||
2005 | return 0.0f; |
||
2006 | #endif |
||
2007 | |||
2008 | #ifdef __cplusplus |
||
2009 | return sqrtf(pQ->x * pQ->x + pQ->y * pQ->y + pQ->z * pQ->z + pQ->w * pQ->w); |
||
2010 | #else |
||
2011 | return (FLOAT) sqrt(pQ->x * pQ->x + pQ->y * pQ->y + pQ->z * pQ->z + pQ->w * pQ->w); |
||
2012 | #endif |
||
2013 | } |
||
2014 | |||
2015 | D3DX10INLINE FLOAT D3DXQuaternionLengthSq |
||
2016 | ( CONST D3DXQUATERNION *pQ ) |
||
2017 | { |
||
2018 | #ifdef D3DX10_DEBUG |
||
2019 | if(!pQ) |
||
2020 | return 0.0f; |
||
2021 | #endif |
||
2022 | |||
2023 | return pQ->x * pQ->x + pQ->y * pQ->y + pQ->z * pQ->z + pQ->w * pQ->w; |
||
2024 | } |
||
2025 | |||
2026 | D3DX10INLINE FLOAT D3DXQuaternionDot |
||
2027 | ( CONST D3DXQUATERNION *pQ1, CONST D3DXQUATERNION *pQ2 ) |
||
2028 | { |
||
2029 | #ifdef D3DX10_DEBUG |
||
2030 | if(!pQ1 || !pQ2) |
||
2031 | return 0.0f; |
||
2032 | #endif |
||
2033 | |||
2034 | return pQ1->x * pQ2->x + pQ1->y * pQ2->y + pQ1->z * pQ2->z + pQ1->w * pQ2->w; |
||
2035 | } |
||
2036 | |||
2037 | |||
2038 | D3DX10INLINE D3DXQUATERNION* D3DXQuaternionIdentity |
||
2039 | ( D3DXQUATERNION *pOut ) |
||
2040 | { |
||
2041 | #ifdef D3DX10_DEBUG |
||
2042 | if(!pOut) |
||
2043 | return NULL; |
||
2044 | #endif |
||
2045 | |||
2046 | pOut->x = pOut->y = pOut->z = 0.0f; |
||
2047 | pOut->w = 1.0f; |
||
2048 | return pOut; |
||
2049 | } |
||
2050 | |||
2051 | D3DX10INLINE BOOL D3DXQuaternionIsIdentity |
||
2052 | ( CONST D3DXQUATERNION *pQ ) |
||
2053 | { |
||
2054 | #ifdef D3DX10_DEBUG |
||
2055 | if(!pQ) |
||
2056 | return FALSE; |
||
2057 | #endif |
||
2058 | |||
2059 | return pQ->x == 0.0f && pQ->y == 0.0f && pQ->z == 0.0f && pQ->w == 1.0f; |
||
2060 | } |
||
2061 | |||
2062 | |||
2063 | D3DX10INLINE D3DXQUATERNION* D3DXQuaternionConjugate |
||
2064 | ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ ) |
||
2065 | { |
||
2066 | #ifdef D3DX10_DEBUG |
||
2067 | if(!pOut || !pQ) |
||
2068 | return NULL; |
||
2069 | #endif |
||
2070 | |||
2071 | pOut->x = -pQ->x; |
||
2072 | pOut->y = -pQ->y; |
||
2073 | pOut->z = -pQ->z; |
||
2074 | pOut->w = pQ->w; |
||
2075 | return pOut; |
||
2076 | } |
||
2077 | |||
2078 | |||
2079 | //-------------------------- |
||
2080 | // Plane |
||
2081 | //-------------------------- |
||
2082 | |||
2083 | D3DX10INLINE FLOAT D3DXPlaneDot |
||
2084 | ( CONST D3DXPLANE *pP, CONST D3DXVECTOR4 *pV) |
||
2085 | { |
||
2086 | #ifdef D3DX10_DEBUG |
||
2087 | if(!pP || !pV) |
||
2088 | return 0.0f; |
||
2089 | #endif |
||
2090 | |||
2091 | return pP->a * pV->x + pP->b * pV->y + pP->c * pV->z + pP->d * pV->w; |
||
2092 | } |
||
2093 | |||
2094 | D3DX10INLINE FLOAT D3DXPlaneDotCoord |
||
2095 | ( CONST D3DXPLANE *pP, CONST D3DXVECTOR3 *pV) |
||
2096 | { |
||
2097 | #ifdef D3DX10_DEBUG |
||
2098 | if(!pP || !pV) |
||
2099 | return 0.0f; |
||
2100 | #endif |
||
2101 | |||
2102 | return pP->a * pV->x + pP->b * pV->y + pP->c * pV->z + pP->d; |
||
2103 | } |
||
2104 | |||
2105 | D3DX10INLINE FLOAT D3DXPlaneDotNormal |
||
2106 | ( CONST D3DXPLANE *pP, CONST D3DXVECTOR3 *pV) |
||
2107 | { |
||
2108 | #ifdef D3DX10_DEBUG |
||
2109 | if(!pP || !pV) |
||
2110 | return 0.0f; |
||
2111 | #endif |
||
2112 | |||
2113 | return pP->a * pV->x + pP->b * pV->y + pP->c * pV->z; |
||
2114 | } |
||
2115 | |||
2116 | D3DX10INLINE D3DXPLANE* D3DXPlaneScale |
||
2117 | (D3DXPLANE *pOut, CONST D3DXPLANE *pP, FLOAT s) |
||
2118 | { |
||
2119 | #ifdef D3DX10_DEBUG |
||
2120 | if(!pOut || !pP) |
||
2121 | return NULL; |
||
2122 | #endif |
||
2123 | |||
2124 | pOut->a = pP->a * s; |
||
2125 | pOut->b = pP->b * s; |
||
2126 | pOut->c = pP->c * s; |
||
2127 | pOut->d = pP->d * s; |
||
2128 | return pOut; |
||
2129 | } |
||
2130 | |||
2131 | |||
2132 | //-------------------------- |
||
2133 | // Color |
||
2134 | //-------------------------- |
||
2135 | |||
2136 | D3DX10INLINE D3DXCOLOR* D3DXColorNegative |
||
2137 | (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC) |
||
2138 | { |
||
2139 | #ifdef D3DX10_DEBUG |
||
2140 | if(!pOut || !pC) |
||
2141 | return NULL; |
||
2142 | #endif |
||
2143 | |||
2144 | pOut->r = 1.0f - pC->r; |
||
2145 | pOut->g = 1.0f - pC->g; |
||
2146 | pOut->b = 1.0f - pC->b; |
||
2147 | pOut->a = pC->a; |
||
2148 | return pOut; |
||
2149 | } |
||
2150 | |||
2151 | D3DX10INLINE D3DXCOLOR* D3DXColorAdd |
||
2152 | (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC1, CONST D3DXCOLOR *pC2) |
||
2153 | { |
||
2154 | #ifdef D3DX10_DEBUG |
||
2155 | if(!pOut || !pC1 || !pC2) |
||
2156 | return NULL; |
||
2157 | #endif |
||
2158 | |||
2159 | pOut->r = pC1->r + pC2->r; |
||
2160 | pOut->g = pC1->g + pC2->g; |
||
2161 | pOut->b = pC1->b + pC2->b; |
||
2162 | pOut->a = pC1->a + pC2->a; |
||
2163 | return pOut; |
||
2164 | } |
||
2165 | |||
2166 | D3DX10INLINE D3DXCOLOR* D3DXColorSubtract |
||
2167 | (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC1, CONST D3DXCOLOR *pC2) |
||
2168 | { |
||
2169 | #ifdef D3DX10_DEBUG |
||
2170 | if(!pOut || !pC1 || !pC2) |
||
2171 | return NULL; |
||
2172 | #endif |
||
2173 | |||
2174 | pOut->r = pC1->r - pC2->r; |
||
2175 | pOut->g = pC1->g - pC2->g; |
||
2176 | pOut->b = pC1->b - pC2->b; |
||
2177 | pOut->a = pC1->a - pC2->a; |
||
2178 | return pOut; |
||
2179 | } |
||
2180 | |||
2181 | D3DX10INLINE D3DXCOLOR* D3DXColorScale |
||
2182 | (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC, FLOAT s) |
||
2183 | { |
||
2184 | #ifdef D3DX10_DEBUG |
||
2185 | if(!pOut || !pC) |
||
2186 | return NULL; |
||
2187 | #endif |
||
2188 | |||
2189 | pOut->r = pC->r * s; |
||
2190 | pOut->g = pC->g * s; |
||
2191 | pOut->b = pC->b * s; |
||
2192 | pOut->a = pC->a * s; |
||
2193 | return pOut; |
||
2194 | } |
||
2195 | |||
2196 | D3DX10INLINE D3DXCOLOR* D3DXColorModulate |
||
2197 | (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC1, CONST D3DXCOLOR *pC2) |
||
2198 | { |
||
2199 | #ifdef D3DX10_DEBUG |
||
2200 | if(!pOut || !pC1 || !pC2) |
||
2201 | return NULL; |
||
2202 | #endif |
||
2203 | |||
2204 | pOut->r = pC1->r * pC2->r; |
||
2205 | pOut->g = pC1->g * pC2->g; |
||
2206 | pOut->b = pC1->b * pC2->b; |
||
2207 | pOut->a = pC1->a * pC2->a; |
||
2208 | return pOut; |
||
2209 | } |
||
2210 | |||
2211 | D3DX10INLINE D3DXCOLOR* D3DXColorLerp |
||
2212 | (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC1, CONST D3DXCOLOR *pC2, FLOAT s) |
||
2213 | { |
||
2214 | #ifdef D3DX10_DEBUG |
||
2215 | if(!pOut || !pC1 || !pC2) |
||
2216 | return NULL; |
||
2217 | #endif |
||
2218 | |||
2219 | pOut->r = pC1->r + s * (pC2->r - pC1->r); |
||
2220 | pOut->g = pC1->g + s * (pC2->g - pC1->g); |
||
2221 | pOut->b = pC1->b + s * (pC2->b - pC1->b); |
||
2222 | pOut->a = pC1->a + s * (pC2->a - pC1->a); |
||
2223 | return pOut; |
||
2224 | } |
||
2225 | |||
2226 | |||
2227 | #endif // __D3DXMATH_INL__ |
||
2228 |