1 /*---------------------------------------------------------------------------* 2 Project: Matrix Vector Library 3 File: mtx44ext.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: mtx44ext.h,v $ 15 Revision 1.2 2006/02/04 11:56:47 hashida 16 (none) 17 18 Revision 1.1.1.1 2005/12/29 06:53:28 hiratsu 19 Initial import. 20 21 Revision 1.1.1.1 2005/05/12 02:41:07 yasuh-to 22 Ported from dolphin source tree. 23 24 25 4 2002/04/11 13:08 Hirose 26 const type specifier support. (worked by hiratsu@IRD) 27 28 3 2001/08/30 10:37p Hirose 29 Added MTX44Inverse. 30 31 2 2001/07/30 10:17p Hirose 32 Added model matrix and matrix-vector stuff. 33 34 1 2001/07/24 5:58p Hirose 35 Initial check in. This file will contain function prototypes for 4x4 36 matrix extensions. 37 38 $NoKeywords: $ 39 40 *---------------------------------------------------------------------------*/ 41 42 43 /*---------------------------------------------------------------------------* 44 Matrix-Vector Library : 4x4 matrix extension 45 *---------------------------------------------------------------------------*/ 46 47 #ifndef __MTX44EXT_H__ 48 #define __MTX44EXT_H__ 49 50 51 #include <revolution/mtx.h> 52 53 54 #ifdef __cplusplus 55 extern "C" { 56 #endif 57 58 /*---------------------------------------------------------------------------* 59 Default function binding configuration 60 *---------------------------------------------------------------------------*/ 61 /* 62 (Defined in mtx.h) 63 64 // [Binding Rule] 65 // 66 // "MTX_USE_PS" -> When this flag is specified, it uses PS* (Paired-Single 67 // assembler code) functions for non-prefixed function calls. 68 // "MTX_USE_C " -> When this flag is specified, it uses C_* (C code) functions 69 // for non-prefixed function calls. 70 // 71 // If both are specified, it will be treated as MTX_USE_PS. 72 // If nothing is specified, NDEBUG build refers PS* functions and 73 // DEBUG build uses C_* functions. 74 75 // For non-Gekko HW (e.g. emulator) 76 #ifndef GEKKO 77 #define MTX_USE_C 78 #undef MTX_USE_PS 79 #endif 80 81 #if ( !defined(MTX_USE_PS) && !defined(MTX_USE_C) ) 82 #ifndef _DEBUG 83 #define MTX_USE_PS 84 #endif 85 #endif 86 */ 87 88 /*---------------------------------------------------------------------------* 89 4x4 GENERAL MATRIX SECTION 90 *---------------------------------------------------------------------------*/ 91 // C version 92 void C_MTX44Identity ( Mtx44 m ); 93 void C_MTX44Copy ( const Mtx44 src, Mtx44 dst ); 94 void C_MTX44Concat ( const Mtx44 a, const Mtx44 b, Mtx44 ab ); 95 void C_MTX44Transpose ( const Mtx44 src, Mtx44 xPose ); 96 u32 C_MTX44Inverse ( const Mtx44 src, Mtx44 inv ); 97 98 // PS assembler version 99 #ifdef GEKKO 100 void PSMTX44Identity ( Mtx44 m ); 101 void PSMTX44Copy ( const Mtx44 src, Mtx44 dst ); 102 void PSMTX44Concat ( const Mtx44 a, const Mtx44 b, Mtx44 ab ); 103 void PSMTX44Transpose ( const Mtx44 src, Mtx44 xPose ); 104 #endif 105 106 // Bindings 107 #ifdef MTX_USE_PS 108 #define MTX44Identity PSMTX44Identity 109 #define MTX44Copy PSMTX44Copy 110 #define MTX44Concat PSMTX44Concat 111 #define MTX44Transpose PSMTX44Transpose 112 #else // MTX_USE_C 113 #define MTX44Identity C_MTX44Identity 114 #define MTX44Copy C_MTX44Copy 115 #define MTX44Concat C_MTX44Concat 116 #define MTX44Transpose C_MTX44Transpose 117 #endif 118 119 #define MTX44Inverse C_MTX44Inverse 120 121 /*---------------------------------------------------------------------------* 122 MODEL MATRIX SECTION 123 *---------------------------------------------------------------------------*/ 124 // C version 125 void C_MTX44Trans ( Mtx44 m, f32 xT, f32 yT, f32 zT ); 126 void C_MTX44TransApply ( const Mtx44 src, Mtx44 dst, f32 xT, f32 yT, f32 zT ); 127 void C_MTX44Scale ( Mtx44 m, f32 xS, f32 yS, f32 zS ); 128 void C_MTX44ScaleApply ( const Mtx44 src, Mtx44 dst, f32 xS, f32 yS, f32 zS ); 129 130 void C_MTX44RotRad ( Mtx44 m, char axis, f32 rad ); 131 void C_MTX44RotTrig ( Mtx44 m, char axis, f32 sinA, f32 cosA ); 132 void C_MTX44RotAxisRad ( Mtx44 m, const Vec *axis, f32 rad); 133 134 // PS assembler version 135 #ifdef GEKKO 136 void PSMTX44Trans ( Mtx44 m, f32 xT, f32 yT, f32 zT ); 137 void PSMTX44TransApply ( const Mtx44 src, Mtx44 dst, f32 xT, f32 yT, f32 zT ); 138 void PSMTX44Scale ( Mtx44 m, f32 xS, f32 yS, f32 zS ); 139 void PSMTX44ScaleApply ( const Mtx44 src, Mtx44 dst, f32 xS, f32 yS, f32 zS ); 140 141 void PSMTX44RotRad ( Mtx44 m, char axis, f32 rad ); 142 void PSMTX44RotTrig ( Mtx44 m, char axis, f32 sinA, f32 cosA ); 143 void PSMTX44RotAxisRad ( Mtx44 m, const Vec *axis, f32 rad); 144 #endif 145 146 // Bindings 147 #ifdef MTX_USE_PS 148 #define MTX44Trans PSMTX44Trans 149 #define MTX44TransApply PSMTX44TransApply 150 #define MTX44Scale PSMTX44Scale 151 #define MTX44ScaleApply PSMTX44ScaleApply 152 153 #define MTX44RotRad PSMTX44RotRad 154 #define MTX44RotTrig PSMTX44RotTrig 155 #define MTX44RotAxisRad PSMTX44RotAxisRad 156 157 #else // MTX_USE_C 158 #define MTX44Trans C_MTX44Trans 159 #define MTX44TransApply C_MTX44TransApply 160 #define MTX44Scale C_MTX44Scale 161 #define MTX44ScaleApply C_MTX44ScaleApply 162 163 #define MTX44RotRad C_MTX44RotRad 164 #define MTX44RotTrig C_MTX44RotTrig 165 #define MTX44RotAxisRad C_MTX44RotAxisRad 166 #endif 167 168 /*---------------------------------------------------------------------------* 169 MATRIX-VECTOR SECTION 170 *---------------------------------------------------------------------------*/ 171 // C version 172 void C_MTX44MultVec ( const Mtx44 m, const Vec *src, Vec *dst ); 173 void C_MTX44MultVecArray ( const Mtx44 m, const Vec *srcBase, Vec *dstBase, u32 count ); 174 void C_MTX44MultVecSR ( const Mtx44 m, const Vec *src, Vec *dst ); 175 void C_MTX44MultVecArraySR ( const Mtx44 m, const Vec *srcBase, Vec *dstBase, u32 count ); 176 177 // PS assembler version 178 #ifdef GEKKO 179 void PSMTX44MultVec ( const Mtx44 m, const Vec *src, Vec *dst ); 180 void PSMTX44MultVecArray ( const Mtx44 m, const Vec *srcBase, Vec *dstBase, u32 count ); 181 void PSMTX44MultVecSR ( const Mtx44 m, const Vec *src, Vec *dst ); 182 void PSMTX44MultVecArraySR ( const Mtx44 m, const Vec *srcBase, Vec *dstBase, u32 count ); 183 #endif 184 185 // Bindings 186 #ifdef MTX_USE_PS 187 #define MTX44MultVec PSMTX44MultVec 188 #define MTX44MultVecArray PSMTX44MultVecArray 189 #define MTX44MultVecSR PSMTX44MultVecSR 190 #define MTX44MultVecArraySR PSMTX44MultVecArraySR 191 #else // MTX_USE_C 192 #define MTX44MultVec C_MTX44MultVec 193 #define MTX44MultVecArray C_MTX44MultVecArray 194 #define MTX44MultVecSR C_MTX44MultVecSR 195 #define MTX44MultVecArraySR C_MTX44MultVecArraySR 196 #endif 197 198 199 /*---------------------------------------------------------------------------*/ 200 201 202 #ifdef __cplusplus 203 } 204 #endif 205 206 #endif // __MTX44EXT_H__ 207 208 /*===========================================================================*/ 209 210