1 /*---------------------------------------------------------------------------* 2 Project: Matrix Vector Library 3 File: mtx.h 4 5 Copyright 1998 - 2001 Nintendo. 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 14 $Log: mtx.h,v $ 15 Revision 1.3 2007/08/30 10:45:04 hirose 16 Removed unsupported functions. 17 18 Revision 1.2 2006/02/04 11:56:44 hashida 19 (none) 20 21 Revision 1.1.1.1 2005/12/29 06:53:27 hiratsu 22 Initial import. 23 24 Revision 1.1.1.1 2005/05/12 02:41:07 yasuh-to 25 Ported from dolphin sheath tree. 26 27 28 20 2002/10/15 16:01 Hirose 29 Added one more const to C_QUATMakeClosest( ). 30 31 19 2002/06/20 11:18 Hirose 32 Added MTXConcatArray. 33 34 18 2002/04/11 13:09 Hirose 35 const type specifier support. (worked by hiratsu@IRD) 36 37 17 2001/08/27 3:54p Hirose 38 Added some PSQUAT functions. 39 40 16 2001/08/03 1:19a Hirose 41 Added quaternion functions. 42 43 15 2001/07/30 10:17p Hirose 44 Changes for function definitions. 45 46 14 2001/07/24 6:03p Hirose 47 48 13 2001/07/23 8:44p Hirose 49 Added some more PS functions again. 50 51 12 2001/07/09 11:15p Hirose 52 Added general 4x4 matrix functions. 53 54 11 2001/07/07 7:28p Hirose 55 Added some more PS matrix functions. 56 57 10 2001/03/29 3:06p Hirose 58 Added MTXInvXpose 59 60 9 2001/03/16 11:44p Hirose 61 Added PSMTXInverse 62 63 8 2001/02/22 11:45p Hirose 64 Added some more PS functions. Updated function binding rule. 65 66 7 2000/07/12 4:40p John 67 Substituted MTXConcat and MTXMultVecArray with their paired-singles 68 equivalent for Gekko non-debug builds. 69 70 6 2000/05/11 2:15p Hirose 71 Used macros instead of inline functions in order to avoid error on VC++ 72 build 73 74 5 2000/05/10 1:53p Hirose 75 Added radian-based rotation matrix functions 76 77 4 2000/04/10 11:56a Danm 78 Added 2 matrix skinning support. 79 80 3 2000/03/22 2:01p John 81 Added VECSquareDistance and VECDistance. 82 83 2 2000/01/27 4:54p Tian 84 Detabbed. Added optimized paired-singles matrix ops. 85 86 17 1999/11/10 4:39p Alligator 87 Added MTXReflect 88 89 16 1999/10/06 5:14p Yasu 90 Changed char* to void* 91 92 15 1999/10/06 12:27p Yasu 93 Appended MTXMultVecSR and MTXMultVecArraySR 94 95 14 1999/09/15 5:45p Mikepc 96 Changed MtxStack member declaration from 'int numMtx' to 'u32 numMtx' 97 98 13 1999/07/28 3:38p Ryan 99 100 12 1999/07/28 11:30a Ryan 101 Added Texture Projection functions 102 103 11 1999/07/02 12:55p Mikepc 104 Changed Mtx row/col 105 106 10 1999/06/29 10:59p Martho01 107 Changed MTXRowCol() macro argument names to r, c. Added comment. 108 109 9 1999/06/29 10:25p Martho01 110 Added 'old-style' MTXRowCol macro for referencing matrix elements. 111 'new-style' will come soon. 112 113 8 1999/06/24 12:51p Mikepc 114 Added $log keyword. 115 Changed file name from MTxVec.h to mtx.h in header section. 116 Changed __MTXVEC_H__ to __MTX_H__ for #ifndef. 117 118 119 120 Change History: 121 122 [1999/05/28] [Mike Ockenden] [ changed 'Point' and 'PointPtr' to 'Point3d' , Point3dPtr' 123 to avoid conflict with MacOS ] 124 125 [1999/05/27] [Mike Ockenden] [ 1st check-in to source safe. 126 changed file name from MtxVec.h to mtx.h ] 127 128 $NoKeywords: $ 129 130 131 *---------------------------------------------------------------------------*/ 132 133 134 /*---------------------------------------------------------------------------* 135 Matrix-Vector Library 136 *---------------------------------------------------------------------------*/ 137 138 #ifndef __MTX_H__ 139 #define __MTX_H__ 140 141 142 143 #include <revolution/os.h> 144 #include <revolution/mtx/GeoTypes.h> 145 146 147 #ifdef __cplusplus 148 extern "C" { 149 #endif 150 151 /*---------------------------------------------------------------------------* 152 Default function binding configuration 153 *---------------------------------------------------------------------------*/ 154 // [Binding Rule] 155 // 156 // "MTX_USE_PS" -> When this flag is specified, it uses PS* (Paired-Single 157 // assembler code) functions for non-prefixed function calls. 158 // "MTX_USE_C " -> When this flag is specified, it uses C_* (C code) functions 159 // for non-prefixed function calls. 160 // 161 // If both are specified, it will be treated as MTX_USE_PS. 162 // If nothing is specified, NDEBUG build refers PS* functions and 163 // DEBUG build uses C_* functions. 164 165 // For non-Gekko HW (e.g. emulator) 166 #ifndef GEKKO 167 #define MTX_USE_C 168 #undef MTX_USE_PS 169 #endif 170 171 #if ( !defined(MTX_USE_PS) && !defined(MTX_USE_C) ) 172 #ifndef _DEBUG 173 #define MTX_USE_PS 174 #endif 175 #endif 176 177 /*---------------------------------------------------------------------------* 178 Macro definitions 179 *---------------------------------------------------------------------------*/ 180 181 // MtxPtr offset to access next Mtx of an array 182 #define MTX_PTR_OFFSET 3 183 184 // Mtx44Ptr offset to access next Mtx44 of an array 185 #define MTX44_PTR_OFFSET 4 186 187 188 // Matrix stack 189 typedef struct 190 { 191 192 u32 numMtx; 193 MtxPtr stackBase; 194 MtxPtr stackPtr; 195 196 } MtxStack, *MtxStackPtr; 197 198 199 // Degree <--> radian conversion macros 200 #define MTXDegToRad(a) ( (a) * 0.01745329252f ) 201 #define MTXRadToDeg(a) ( (a) * 57.29577951f ) 202 203 204 // Matrix-element-referencing macro. 205 // Insulates user from changes from row-major to column-major and vice-versa. 206 // Fully documents which index is row, which index is column. 207 // XXX this version will change once matrices are transposed. 208 209 #define MTXRowCol(m,r,c) ((m)[(r)][(c)]) 210 211 212 /*---------------------------------------------------------------------------* 213 GENERAL MATRIX SECTION 214 *---------------------------------------------------------------------------*/ 215 // C version 216 void C_MTXIdentity ( Mtx m ); 217 void C_MTXCopy ( const Mtx src, Mtx dst ); 218 void C_MTXConcat ( const Mtx a, const Mtx b, Mtx ab ); 219 void C_MTXConcatArray ( const Mtx a, const Mtx* srcBase, Mtx* dstBase, u32 count ); 220 void C_MTXTranspose ( const Mtx src, Mtx xPose ); 221 u32 C_MTXInverse ( const Mtx src, Mtx inv ); 222 u32 C_MTXInvXpose ( const Mtx src, Mtx invX ); 223 224 // PS assembler version 225 #ifdef GEKKO 226 void PSMTXIdentity ( Mtx m ); 227 void PSMTXCopy ( const Mtx src, Mtx dst ); 228 void PSMTXConcat ( const Mtx a, const Mtx b, Mtx ab ); 229 void PSMTXConcatArray ( const Mtx a, const Mtx* srcBase, Mtx* dstBase, u32 count ); 230 void PSMTXTranspose ( const Mtx src, Mtx xPose ); 231 u32 PSMTXInverse ( const Mtx src, Mtx inv ); 232 u32 PSMTXInvXpose ( const Mtx src, Mtx invX ); 233 #endif 234 235 // Bindings 236 #ifdef MTX_USE_PS 237 #define MTXIdentity PSMTXIdentity 238 #define MTXCopy PSMTXCopy 239 #define MTXConcat PSMTXConcat 240 #define MTXConcatArray PSMTXConcatArray 241 #define MTXTranspose PSMTXTranspose 242 #define MTXInverse PSMTXInverse 243 #define MTXInvXpose PSMTXInvXpose 244 #else // MTX_USE_C 245 #define MTXIdentity C_MTXIdentity 246 #define MTXCopy C_MTXCopy 247 #define MTXConcat C_MTXConcat 248 #define MTXConcatArray C_MTXConcatArray 249 #define MTXTranspose C_MTXTranspose 250 #define MTXInverse C_MTXInverse 251 #define MTXInvXpose C_MTXInvXpose 252 #endif 253 254 255 /*---------------------------------------------------------------------------* 256 MATRIX-VECTOR SECTION 257 *---------------------------------------------------------------------------*/ 258 // C version 259 void C_MTXMultVec ( const Mtx m, const Vec *src, Vec *dst ); 260 void C_MTXMultVecArray ( const Mtx m, const Vec *srcBase, Vec *dstBase, u32 count ); 261 void C_MTXMultVecSR ( const Mtx m, const Vec *src, Vec *dst ); 262 void C_MTXMultVecArraySR ( const Mtx m, const Vec *srcBase, Vec *dstBase, u32 count ); 263 264 // PS assembler version 265 #ifdef GEKKO 266 void PSMTXMultVec ( const Mtx m, const Vec *src, Vec *dst ); 267 void PSMTXMultVecArray ( const Mtx m, const Vec *srcBase, Vec *dstBase, u32 count ); 268 void PSMTXMultVecSR ( const Mtx m, const Vec *src, Vec *dst ); 269 void PSMTXMultVecArraySR ( const Mtx m, const Vec *srcBase, Vec *dstBase, u32 count ); 270 #endif 271 272 // Bindings 273 #ifdef MTX_USE_PS 274 #define MTXMultVec PSMTXMultVec 275 #define MTXMultVecArray PSMTXMultVecArray 276 #define MTXMultVecSR PSMTXMultVecSR 277 #define MTXMultVecArraySR PSMTXMultVecArraySR 278 #else // MTX_USE_C 279 #define MTXMultVec C_MTXMultVec 280 #define MTXMultVecArray C_MTXMultVecArray 281 #define MTXMultVecSR C_MTXMultVecSR 282 #define MTXMultVecArraySR C_MTXMultVecArraySR 283 #endif 284 285 286 /*---------------------------------------------------------------------------* 287 MODEL MATRIX SECTION 288 *---------------------------------------------------------------------------*/ 289 // C version 290 void C_MTXQuat ( Mtx m, const Quaternion *q ); 291 void C_MTXReflect ( Mtx m, const Vec *p, const Vec *n ); 292 293 void C_MTXTrans ( Mtx m, f32 xT, f32 yT, f32 zT ); 294 void C_MTXTransApply ( const Mtx src, Mtx dst, f32 xT, f32 yT, f32 zT ); 295 void C_MTXScale ( Mtx m, f32 xS, f32 yS, f32 zS ); 296 void C_MTXScaleApply ( const Mtx src, Mtx dst, f32 xS, f32 yS, f32 zS ); 297 298 void C_MTXRotRad ( Mtx m, char axis, f32 rad ); 299 void C_MTXRotTrig ( Mtx m, char axis, f32 sinA, f32 cosA ); 300 void C_MTXRotAxisRad ( Mtx m, const Vec *axis, f32 rad ); 301 302 // PS assembler version 303 #ifdef GEKKO 304 void PSMTXQuat ( Mtx m, const Quaternion *q ); 305 void PSMTXReflect ( Mtx m, const Vec *p, const Vec *n ); 306 307 void PSMTXTrans ( Mtx m, f32 xT, f32 yT, f32 zT ); 308 void PSMTXTransApply ( const Mtx src, Mtx dst, f32 xT, f32 yT, f32 zT ); 309 void PSMTXScale ( Mtx m, f32 xS, f32 yS, f32 zS ); 310 void PSMTXScaleApply ( const Mtx src, Mtx dst, f32 xS, f32 yS, f32 zS ); 311 312 void PSMTXRotRad ( Mtx m, char axis, f32 rad ); 313 void PSMTXRotTrig ( Mtx m, char axis, f32 sinA, f32 cosA ); 314 void PSMTXRotAxisRad ( Mtx m, const Vec *axis, f32 rad ); 315 #endif 316 317 // Bindings 318 #ifdef MTX_USE_PS 319 #define MTXQuat PSMTXQuat 320 #define MTXReflect PSMTXReflect 321 #define MTXTrans PSMTXTrans 322 #define MTXTransApply PSMTXTransApply 323 #define MTXScale PSMTXScale 324 #define MTXScaleApply PSMTXScaleApply 325 #define MTXRotRad PSMTXRotRad 326 #define MTXRotTrig PSMTXRotTrig 327 #define MTXRotAxisRad PSMTXRotAxisRad 328 329 #define MTXRotDeg( m, axis, deg ) \ 330 PSMTXRotRad( m, axis, MTXDegToRad(deg) ) 331 #define MTXRotAxisDeg( m, axis, deg ) \ 332 PSMTXRotAxisRad( m, axis, MTXDegToRad(deg) ) 333 334 #else // MTX_USE_C 335 #define MTXQuat C_MTXQuat 336 #define MTXReflect C_MTXReflect 337 #define MTXTrans C_MTXTrans 338 #define MTXTransApply C_MTXTransApply 339 #define MTXScale C_MTXScale 340 #define MTXScaleApply C_MTXScaleApply 341 #define MTXRotRad C_MTXRotRad 342 #define MTXRotTrig C_MTXRotTrig 343 #define MTXRotAxisRad C_MTXRotAxisRad 344 345 #define MTXRotDeg( m, axis, deg ) \ 346 C_MTXRotRad( m, axis, MTXDegToRad(deg) ) 347 #define MTXRotAxisDeg( m, axis, deg ) \ 348 C_MTXRotAxisRad( m, axis, MTXDegToRad(deg) ) 349 350 #endif 351 352 353 // Obsolete. Don't use this if possible. 354 #define MTXRotAxis MTXRotAxisDeg 355 356 357 /*---------------------------------------------------------------------------* 358 VIEW MATRIX SECTION 359 *---------------------------------------------------------------------------*/ 360 // C version only so far 361 void C_MTXLookAt ( Mtx m, 362 const Point3d *camPos, 363 const Vec *camUp, 364 const Point3d *target ); 365 366 // Bindings 367 #define MTXLookAt C_MTXLookAt 368 369 370 /*---------------------------------------------------------------------------* 371 PROJECTION MATRIX SECTION 372 *---------------------------------------------------------------------------*/ 373 // C version only so far 374 void C_MTXFrustum ( Mtx44 m, f32 t, f32 b, f32 l, f32 r, f32 n, f32 f ); 375 void C_MTXPerspective ( Mtx44 m, f32 fovY, f32 aspect, f32 n, f32 f ); 376 void C_MTXOrtho ( Mtx44 m, f32 t, f32 b, f32 l, f32 r, f32 n, f32 f ); 377 378 // Bindings 379 #define MTXFrustum C_MTXFrustum 380 #define MTXPerspective C_MTXPerspective 381 #define MTXOrtho C_MTXOrtho 382 383 384 /*---------------------------------------------------------------------------* 385 TEXTURE PROJECTION MATRIX SECTION 386 *---------------------------------------------------------------------------*/ 387 // C version only so far 388 void C_MTXLightFrustum ( Mtx m, f32 t, f32 b, f32 l, f32 r, f32 n, 389 f32 scaleS, f32 scaleT, f32 transS, 390 f32 transT ); 391 392 void C_MTXLightPerspective ( Mtx m, f32 fovY, f32 aspect, f32 scaleS, 393 f32 scaleT, f32 transS, f32 transT ); 394 395 void C_MTXLightOrtho ( Mtx m, f32 t, f32 b, f32 l, f32 r, f32 scaleS, 396 f32 scaleT, f32 transS, f32 transT ); 397 398 // Bindings 399 #define MTXLightFrustum C_MTXLightFrustum 400 #define MTXLightPerspective C_MTXLightPerspective 401 #define MTXLightOrtho C_MTXLightOrtho 402 403 404 /*---------------------------------------------------------------------------* 405 VECTOR SECTION 406 *---------------------------------------------------------------------------*/ 407 // C version 408 void C_VECAdd ( const Vec *a, const Vec *b, Vec *ab ); 409 void C_VECSubtract ( const Vec *a, const Vec *b, Vec *a_b ); 410 void C_VECScale ( const Vec *src, Vec *dst, f32 scale ); 411 void C_VECNormalize ( const Vec *src, Vec *unit ); 412 f32 C_VECSquareMag ( const Vec *v ); 413 f32 C_VECMag ( const Vec *v ); 414 f32 C_VECDotProduct ( const Vec *a, const Vec *b ); 415 void C_VECCrossProduct ( const Vec *a, const Vec *b, Vec *axb ); 416 f32 C_VECSquareDistance ( const Vec *a, const Vec *b ); 417 f32 C_VECDistance ( const Vec *a, const Vec *b ); 418 void C_VECReflect ( const Vec *src, const Vec *normal, Vec *dst ); 419 void C_VECHalfAngle ( const Vec *a, const Vec *b, Vec *half ); 420 421 // PS assembler version 422 #ifdef GEKKO 423 void PSVECAdd ( const Vec *a, const Vec *b, Vec *ab ); 424 void PSVECSubtract ( const Vec *a, const Vec *b, Vec *a_b ); 425 void PSVECScale ( const Vec *src, Vec *dst, f32 scale ); 426 void PSVECNormalize ( const Vec *src, Vec *unit ); 427 f32 PSVECSquareMag ( const Vec *v ); 428 f32 PSVECMag ( const Vec *v ); 429 f32 PSVECDotProduct ( const Vec *a, const Vec *b ); 430 void PSVECCrossProduct ( const Vec *a, const Vec *b, Vec *axb ); 431 f32 PSVECSquareDistance ( const Vec *a, const Vec *b ); 432 f32 PSVECDistance ( const Vec *a, const Vec *b ); 433 #endif 434 435 // Bindings 436 #ifdef MTX_USE_PS 437 #define VECAdd PSVECAdd 438 #define VECSubtract PSVECSubtract 439 #define VECScale PSVECScale 440 #define VECNormalize PSVECNormalize 441 #define VECSquareMag PSVECSquareMag 442 #define VECMag PSVECMag 443 #define VECDotProduct PSVECDotProduct 444 #define VECCrossProduct PSVECCrossProduct 445 #define VECSquareDistance PSVECSquareDistance 446 #define VECDistance PSVECDistance 447 #else // MTX_USE_C 448 #define VECAdd C_VECAdd 449 #define VECSubtract C_VECSubtract 450 #define VECScale C_VECScale 451 #define VECNormalize C_VECNormalize 452 #define VECSquareMag C_VECSquareMag 453 #define VECMag C_VECMag 454 #define VECDotProduct C_VECDotProduct 455 #define VECCrossProduct C_VECCrossProduct 456 #define VECSquareDistance C_VECSquareDistance 457 #define VECDistance C_VECDistance 458 #endif 459 460 #define VECReflect C_VECReflect 461 #define VECHalfAngle C_VECHalfAngle 462 463 464 /*---------------------------------------------------------------------------* 465 QUATERNION SECTION 466 *---------------------------------------------------------------------------*/ 467 // C version 468 void C_QUATAdd ( const Quaternion *p, const Quaternion *q, Quaternion *r ); 469 void C_QUATSubtract ( const Quaternion *p, const Quaternion *q, Quaternion *r ); 470 void C_QUATMultiply ( const Quaternion *p, const Quaternion *q, Quaternion *pq ); 471 void C_QUATDivide ( const Quaternion *p, const Quaternion *q, Quaternion *r ); 472 void C_QUATScale ( const Quaternion *q, Quaternion *r, f32 scale ); 473 f32 C_QUATDotProduct ( const Quaternion *p, const Quaternion *q ); 474 void C_QUATNormalize ( const Quaternion *src, Quaternion *unit ); 475 void C_QUATInverse ( const Quaternion *src, Quaternion *inv ); 476 void C_QUATExp ( const Quaternion *q, Quaternion *r ); 477 void C_QUATLogN ( const Quaternion *q, Quaternion *r ); 478 479 void C_QUATMakeClosest ( const Quaternion *q, const Quaternion *qto, Quaternion *r ); 480 void C_QUATRotAxisRad ( Quaternion *r, const Vec *axis, f32 rad ); 481 void C_QUATMtx ( Quaternion *r, const Mtx m ); 482 483 void C_QUATLerp ( const Quaternion *p, const Quaternion *q, Quaternion *r, f32 t ); 484 void C_QUATSlerp ( const Quaternion *p, const Quaternion *q, Quaternion *r, f32 t ); 485 void C_QUATSquad ( const Quaternion *p, const Quaternion *a, const Quaternion *b, 486 const Quaternion *q, Quaternion *r, f32 t ); 487 void C_QUATCompA ( const Quaternion *qprev, const Quaternion *q, 488 const Quaternion *qnext, Quaternion *a ); 489 490 491 // PS assembler version 492 #ifdef GEKKO 493 void PSQUATAdd ( const Quaternion *p, const Quaternion *q, Quaternion *r ); 494 void PSQUATSubtract ( const Quaternion *p, const Quaternion *q, Quaternion *r ); 495 void PSQUATMultiply ( const Quaternion *p, const Quaternion *q, Quaternion *pq ); 496 void PSQUATDivide ( const Quaternion *p, const Quaternion *q, Quaternion *r ); 497 void PSQUATScale ( const Quaternion *q, Quaternion *r, f32 scale ); 498 f32 PSQUATDotProduct ( const Quaternion *p, const Quaternion *q ); 499 void PSQUATNormalize ( const Quaternion *src, Quaternion *unit ); 500 void PSQUATInverse ( const Quaternion *src, Quaternion *inv ); 501 #endif 502 503 504 // Bindings 505 #ifdef MTX_USE_PS 506 #define QUATAdd PSQUATAdd 507 #define QUATSubtract PSQUATSubtract 508 #define QUATMultiply PSQUATMultiply 509 #define QUATDivide PSQUATDivide 510 #define QUATScale PSQUATScale 511 #define QUATDotProduct PSQUATDotProduct 512 #define QUATNormalize PSQUATNormalize 513 #define QUATInverse PSQUATInverse 514 #else // MTX_USE_C 515 #define QUATAdd C_QUATAdd 516 #define QUATSubtract C_QUATSubtract 517 #define QUATMultiply C_QUATMultiply 518 #define QUATDivide C_QUATDivide 519 #define QUATScale C_QUATScale 520 #define QUATDotProduct C_QUATDotProduct 521 #define QUATNormalize C_QUATNormalize 522 #define QUATInverse C_QUATInverse 523 #endif 524 525 #define QUATExp C_QUATExp 526 #define QUATLogN C_QUATLogN 527 #define QUATMakeClosest C_QUATMakeClosest 528 #define QUATRotAxisRad C_QUATRotAxisRad 529 #define QUATMtx C_QUATMtx 530 #define QUATLerp C_QUATLerp 531 #define QUATSlerp C_QUATSlerp 532 #define QUATSquad C_QUATSquad 533 #define QUATCompA C_QUATCompA 534 535 536 /*---------------------------------------------------------------------------* 537 SPECIAL PURPOSE MATRIX SECTION 538 *---------------------------------------------------------------------------*/ 539 // Only PS assembler versions are available 540 #ifdef GEKKO 541 void PSMTXReorder ( const Mtx src, ROMtx dest ); 542 void PSMTXROMultVecArray ( const ROMtx m, const Vec *srcBase, Vec *dstBase, u32 count ); 543 #endif 544 545 546 /*---------------------------------------------------------------------------* 547 MATRIX STACK SECTION 548 *---------------------------------------------------------------------------*/ 549 void MTXInitStack ( MtxStack *sPtr, u32 numMtx ); 550 MtxPtr MTXPush ( MtxStack *sPtr, const Mtx m ); 551 MtxPtr MTXPushFwd ( MtxStack *sPtr, const Mtx m ); 552 MtxPtr MTXPushInv ( MtxStack *sPtr, const Mtx m ); 553 MtxPtr MTXPushInvXpose ( MtxStack *sPtr, const Mtx m ); 554 MtxPtr MTXPop ( MtxStack *sPtr ); 555 MtxPtr MTXGetStackPtr ( const MtxStack *sPtr ); 556 557 558 // Macro to create a matrix stack. 559 // The macro exposes the use of OSAlloc() for 560 // ease of replacement if desired. 561 #define MTXAllocStack( sPtr, numMtx ) ( ((MtxStackPtr)(sPtr))->stackBase = (MtxPtr)OSAlloc( ( (numMtx) * sizeof(Mtx) ) ) ) 562 563 // Macro to free a matrix stack 564 #define MTXFreeStack( sPtr ) ( OSFree( (void*)( ((MtxStackPtr)(sPtr))->stackBase ) ) ) 565 566 567 /*---------------------------------------------------------------------------*/ 568 569 570 #ifdef __cplusplus 571 } 572 #endif 573 574 #endif // __MTX_H__ 575 576 /*===========================================================================*/ 577 578