ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

m_matrix.h
Go to the documentation of this file.
00001 /*
00002  * Mesa 3-D graphics library
00003  * Version:  6.3
00004  *
00005  * Copyright (C) 1999-2005  Brian Paul   All Rights Reserved.
00006  *
00007  * Permission is hereby granted, free of charge, to any person obtaining a
00008  * copy of this software and associated documentation files (the "Software"),
00009  * to deal in the Software without restriction, including without limitation
00010  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
00011  * and/or sell copies of the Software, and to permit persons to whom the
00012  * Software is furnished to do so, subject to the following conditions:
00013  *
00014  * The above copyright notice and this permission notice shall be included
00015  * in all copies or substantial portions of the Software.
00016  *
00017  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
00018  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00019  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
00020  * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
00021  * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
00022  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00023  */
00024 
00025 
00031 #ifndef _M_MATRIX_H
00032 #define _M_MATRIX_H
00033 
00034 
00035 
00042 #define MAT_SX 0
00043 #define MAT_SY 5
00044 #define MAT_SZ 10
00045 #define MAT_TX 12
00046 #define MAT_TY 13
00047 #define MAT_TZ 14
00048 
00055 enum GLmatrixtype {
00056    MATRIX_GENERAL,  
00057    MATRIX_IDENTITY, 
00058    MATRIX_3D_NO_ROT,    
00059    MATRIX_PERSPECTIVE,  
00060    MATRIX_2D,       
00061    MATRIX_2D_NO_ROT,    
00062    MATRIX_3D        
00063 } ;
00064 
00068 typedef struct {
00069    GLfloat *m;      
00070    GLfloat *inv;    
00071    GLuint flags;        
00074    enum GLmatrixtype type;
00075 } GLmatrix;
00076 
00077 
00078 
00079 
00080 extern void
00081 _math_matrix_ctr( GLmatrix *m );
00082 
00083 extern void
00084 _math_matrix_dtr( GLmatrix *m );
00085 
00086 extern void
00087 _math_matrix_alloc_inv( GLmatrix *m );
00088 
00089 extern void
00090 _math_matrix_mul_matrix( GLmatrix *dest, const GLmatrix *a, const GLmatrix *b );
00091 
00092 extern void
00093 _math_matrix_mul_floats( GLmatrix *dest, const GLfloat *b );
00094 
00095 extern void
00096 _math_matrix_loadf( GLmatrix *mat, const GLfloat *m );
00097 
00098 extern void
00099 _math_matrix_translate( GLmatrix *mat, GLfloat x, GLfloat y, GLfloat z );
00100 
00101 extern void
00102 _math_matrix_rotate( GLmatrix *m, GLfloat angle,
00103              GLfloat x, GLfloat y, GLfloat z );
00104 
00105 extern void
00106 _math_matrix_scale( GLmatrix *mat, GLfloat x, GLfloat y, GLfloat z );
00107 
00108 extern void
00109 _math_matrix_ortho( GLmatrix *mat,
00110             GLfloat left, GLfloat right,
00111             GLfloat bottom, GLfloat top,
00112             GLfloat nearval, GLfloat farval );
00113 
00114 extern void
00115 _math_matrix_frustum( GLmatrix *mat,
00116               GLfloat left, GLfloat right,
00117               GLfloat bottom, GLfloat top,
00118               GLfloat nearval, GLfloat farval );
00119 
00120 extern void
00121 _math_matrix_viewport(GLmatrix *m, GLint x, GLint y, GLint width, GLint height,
00122                       GLfloat zNear, GLfloat zFar, GLfloat depthMax);
00123 
00124 extern void
00125 _math_matrix_set_identity( GLmatrix *dest );
00126 
00127 extern void
00128 _math_matrix_copy( GLmatrix *to, const GLmatrix *from );
00129 
00130 extern void
00131 _math_matrix_analyse( GLmatrix *mat );
00132 
00133 extern void
00134 _math_matrix_print( const GLmatrix *m );
00135 
00136 extern GLboolean
00137 _math_matrix_is_length_preserving( const GLmatrix *m );
00138 
00139 extern GLboolean
00140 _math_matrix_has_rotation( const GLmatrix *m );
00141 
00142 extern GLboolean
00143 _math_matrix_is_general_scale( const GLmatrix *m );
00144 
00145 extern GLboolean
00146 _math_matrix_is_dirty( const GLmatrix *m );
00147 
00148 
00153 
00154 extern void
00155 _math_transposef( GLfloat to[16], const GLfloat from[16] );
00156 
00157 extern void
00158 _math_transposed( GLdouble to[16], const GLdouble from[16] );
00159 
00160 extern void
00161 _math_transposefd( GLfloat to[16], const GLdouble from[16] );
00162 
00163 
00164 /*
00165  * Transform a point (column vector) by a matrix:   Q = M * P
00166  */
00167 #define TRANSFORM_POINT( Q, M, P )                  \
00168    Q[0] = M[0] * P[0] + M[4] * P[1] + M[8] *  P[2] + M[12] * P[3];  \
00169    Q[1] = M[1] * P[0] + M[5] * P[1] + M[9] *  P[2] + M[13] * P[3];  \
00170    Q[2] = M[2] * P[0] + M[6] * P[1] + M[10] * P[2] + M[14] * P[3];  \
00171    Q[3] = M[3] * P[0] + M[7] * P[1] + M[11] * P[2] + M[15] * P[3];
00172 
00173 
00174 #define TRANSFORM_POINT3( Q, M, P )             \
00175    Q[0] = M[0] * P[0] + M[4] * P[1] + M[8] *  P[2] + M[12]; \
00176    Q[1] = M[1] * P[0] + M[5] * P[1] + M[9] *  P[2] + M[13]; \
00177    Q[2] = M[2] * P[0] + M[6] * P[1] + M[10] * P[2] + M[14]; \
00178    Q[3] = M[3] * P[0] + M[7] * P[1] + M[11] * P[2] + M[15];
00179 
00180 
00181 /*
00182  * Transform a normal (row vector) by a matrix:  [NX NY NZ] = N * MAT
00183  */
00184 #define TRANSFORM_NORMAL( TO, N, MAT )              \
00185 do {                                \
00186    TO[0] = N[0] * MAT[0] + N[1] * MAT[1] + N[2] * MAT[2];   \
00187    TO[1] = N[0] * MAT[4] + N[1] * MAT[5] + N[2] * MAT[6];   \
00188    TO[2] = N[0] * MAT[8] + N[1] * MAT[9] + N[2] * MAT[10];  \
00189 } while (0)
00190 
00191 
00195 #define TRANSFORM_DIRECTION( TO, DIR, MAT )         \
00196 do {                                \
00197    TO[0] = DIR[0] * MAT[0] + DIR[1] * MAT[4] + DIR[2] * MAT[8]; \
00198    TO[1] = DIR[0] * MAT[1] + DIR[1] * MAT[5] + DIR[2] * MAT[9]; \
00199    TO[2] = DIR[0] * MAT[2] + DIR[1] * MAT[6] + DIR[2] * MAT[10];\
00200 } while (0)
00201 
00202 
00203 
00207 #endif

Generated on Sun May 27 2012 04:20:32 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.