diff options
Diffstat (limited to 'sdl/math3d.c')
-rw-r--r-- | sdl/math3d.c | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/sdl/math3d.c b/sdl/math3d.c index 10167a5..998641b 100644 --- a/sdl/math3d.c +++ b/sdl/math3d.c @@ -1,13 +1,9 @@ -/* revision 6 */ +/* revision 7 */ /* @2010 Kamil Kaminski * * math3d.c * - * this code is not yet endian aware, and it won't be, screw powerpc - * the style of the syntax is original k&r except there's \n - * after the opening { and extra space after if statement, - * and for/while loops */ #include "math3d.h" @@ -142,7 +138,7 @@ void m3dRotationMatrix44f(M3DMatrix44f m, float angle, float x, float y, float z #undef M } -/* create a projection to "squish" an object into the plane. +/* create a projection to "squish" an object into the plane. * use m3dGetPlaneEquationf(planeEq, point1, point2, point3); to get a plane equation */ void m3dMakePlanarShadowMatrixf(M3DMatrix44f proj, const M3DVector4f planeEq, @@ -181,13 +177,14 @@ void m3dMakePlanarShadowMatrixf(M3DMatrix44f proj, const M3DVector4f planeEq, /* shadow matrix ready */ } -#define A(row,col) a[(col<<2)+row] -#define B(row,col) b[(col<<2)+row] -#define P(row,col) product[(col<<2)+row] - +/* hmm not sure if defines could reside outside of a function as they did */ void m3dMatrixMultiply44f(M3DMatrix44f product, const M3DMatrix44f a, const M3DMatrix44f b) { + #define A(row,col) a[(col<<2)+row] + #define B(row,col) b[(col<<2)+row] + #define P(row,col) product[(col<<2)+row] + int i; for (i = 0; i < 4; i++) { @@ -197,9 +194,9 @@ void m3dMatrixMultiply44f(M3DMatrix44f product, const M3DMatrix44f a, P(i, 2) = ai0 * B(0, 2) + ai1 * B(1, 2) + ai2 * B(2, 2) + ai3 * B(3, 2); P(i, 3) = ai0 * B(0, 3) + ai1 * B(1, 3) + ai2 * B(2, 3) + ai3 * B(3, 3); } + + #undef A + #undef B + #undef P } -#undef A -#undef B -#undef P - |