xref: /reactos/dll/opengl/mesa/xform.h (revision 5f2bebf7)
1 /* $Id: xform.h,v 1.4 1997/04/02 03:15:02 brianp Exp $ */
2 
3 /*
4  * Mesa 3-D graphics library
5  * Version:  2.0
6  * Copyright (C) 1995-1996  Brian Paul
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Library General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Library General Public License for more details.
17  *
18  * You should have received a copy of the GNU Library General Public
19  * License along with this library; if not, write to the Free
20  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21  */
22 
23 
24 /*
25  * $Log: xform.h,v $
26  * Revision 1.4  1997/04/02 03:15:02  brianp
27  * removed gl_xform_texcoords_4fv()
28  *
29  * Revision 1.3  1996/11/08 02:20:39  brianp
30  * added gl_xform_texcoords_4fv()
31  *
32  * Revision 1.2  1996/11/04 01:39:46  brianp
33  * removed MAP_X(), MAP_Y() and MAP_Z() macros
34  *
35  * Revision 1.1  1996/09/13 01:38:16  brianp
36  * Initial revision
37  *
38  */
39 
40 
41 #ifndef XFORM_H
42 #define XFORM_H
43 
44 
45 #include "types.h"
46 
47 
48 /*
49  * Transform a point (column vector) by a matrix:   Q = M * P
50  */
51 #define TRANSFORM_POINT( Q, M, P )					\
52    Q[0] = M[0] * P[0] + M[4] * P[1] + M[8] *  P[2] + M[12] * P[3];	\
53    Q[1] = M[1] * P[0] + M[5] * P[1] + M[9] *  P[2] + M[13] * P[3];	\
54    Q[2] = M[2] * P[0] + M[6] * P[1] + M[10] * P[2] + M[14] * P[3];	\
55    Q[3] = M[3] * P[0] + M[7] * P[1] + M[11] * P[2] + M[15] * P[3];
56 
57 
58 /*
59  * Transform a normal (row vector) by a matrix:  [NX NY NZ] = N * MAT
60  */
61 #define TRANSFORM_NORMAL( NX, NY, NZ, N, MAT )		\
62    NX = N[0] * MAT[0] + N[1] * MAT[1] + N[2] * MAT[2];	\
63    NY = N[0] * MAT[4] + N[1] * MAT[5] + N[2] * MAT[6];	\
64    NZ = N[0] * MAT[8] + N[1] * MAT[9] + N[2] * MAT[10];	\
65 
66 
67 
68 extern void gl_xform_points_4fv( GLuint n, GLfloat q[][4], const GLfloat m[16],
69                                  GLfloat p[][4] );
70 
71 
72 extern void gl_xform_points_3fv( GLuint n, GLfloat q[][4], const GLfloat m[16],
73                                  GLfloat p[][3] );
74 
75 
76 extern void gl_xform_normals_3fv( GLuint n, GLfloat v[][3],
77                                   const GLfloat m[16],
78                                   GLfloat u[][3], GLboolean normalize );
79 
80 
81 extern void gl_transform_vector( GLfloat u[4],
82 				 const GLfloat v[4], const GLfloat m[16] );
83 
84 
85 #endif
86