1 /*
2 Copyright (C) 1997-2001 Id Software, Inc.
3 
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License
6 as published by the Free Software Foundation; either version 2
7 of the License, or (at your option) any later version.
8 
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 
13 See the GNU General Public License for more details.
14 
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
18 
19 */
20 // r_math.h
21 typedef vec_t mat4x4_t[16];
22 
23 extern const mat4x4_t mat4x4_identity;
24 
25 void Matrix4_Identity( mat4x4_t m );
26 void Matrix4_Copy( const mat4x4_t m1, mat4x4_t m2 );
27 qboolean Matrix4_Compare( const mat4x4_t m1, const mat4x4_t m2 );
28 void Matrix4_Multiply( const mat4x4_t m1, const mat4x4_t m2, mat4x4_t out );
29 void Matrix4_MultiplyFast( const mat4x4_t m1, const mat4x4_t m2, mat4x4_t out );
30 void Matrix4_Rotate( mat4x4_t m, vec_t angle, vec_t x, vec_t y, vec_t z );
31 void Matrix4_Translate( mat4x4_t m, vec_t x, vec_t y, vec_t z );
32 void Matrix4_Scale( mat4x4_t m, vec_t x, vec_t y, vec_t z );
33 void Matrix4_Transpose( const mat4x4_t m, mat4x4_t out );
34 void Matrix4_Matrix( const mat4x4_t in, vec3_t out[3] );
35 void Matrix4_Multiply_Vector( const mat4x4_t m, const vec4_t v, vec4_t out );
36 
37 void Matrix4_Copy2D( const mat4x4_t m1, mat4x4_t m2 );
38 void Matrix4_Multiply2D( const mat4x4_t m1, const mat4x4_t m2, mat4x4_t out );
39 void Matrix4_Scale2D( mat4x4_t m, vec_t x, vec_t y );
40 void Matrix4_Translate2D( mat4x4_t m, vec_t x, vec_t y );
41 void Matrix4_Stretch2D( mat4x4_t m, vec_t s, vec_t t );
42 
43 #define nanmask (255<<23)
44 #define	IS_NAN(x) (((*(int *)&x)&nanmask)==nanmask)
45