1 /***************************************************************************
2 * This file is part of Tecorrec. *
3 * Copyright 2008 James Hogan <james@albanarts.com> *
5 * Tecorrec is free software: you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation, either version 2 of the License, or *
8 * (at your option) any later version. *
10 * Tecorrec is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with Tecorrec. If not, write to the Free Software Foundation, *
17 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
18 ***************************************************************************/
23 * Inline function helpers for maths::gl::vec<n><t> classes (from maths library)
24 * These are overloaded to take multiple data types
25 * Header for basic data types is glBasic.h
29 #ifndef _maths_glMatrix_h
30 #define _maths_glMatrix_h
39 // Make use of maths library vector classes
40 typedef maths::Matrix
<2,float> mat2f
;
41 typedef maths::Matrix
<3,float> mat3f
;
42 typedef maths::Matrix
<4,float> mat4f
;
43 typedef maths::Matrix
<2,double> mat2d
;
44 typedef maths::Matrix
<3,double> mat3d
;
45 typedef maths::Matrix
<4,double> mat4d
;
49 typedef maths::gl::mat2f GLmat2f
;
50 typedef maths::gl::mat3f GLmat3f
;
51 typedef maths::gl::mat4f GLmat4f
;
52 typedef maths::gl::mat2d GLmat2d
;
53 typedef maths::gl::mat3d GLmat3d
;
54 typedef maths::gl::mat4d GLmat4d
;
56 inline void glMultMatrix(const maths::gl::mat3f
& matrix
)
58 maths::gl::mat4f
m(matrix
);
59 glMultMatrixf(&m
.col
[0][0]);
61 inline void glMultMatrix(const maths::gl::mat3d
& matrix
)
63 maths::gl::mat4d
m(matrix
);
64 glMultMatrixd(&m
.col
[0][0]);
66 inline void glMultMatrix(const maths::gl::mat4f
& matrix
)
68 glMultMatrixf(&matrix
.col
[0][0]);
70 inline void glMultMatrix(const maths::gl::mat4d
& matrix
)
72 glMultMatrixd(&matrix
.col
[0][0]);
75 inline void glGetv(GLenum pname
, maths::gl::mat4f
* matrix
)
77 glGetFloatv(pname
, (GLfloat
*)(*matrix
));
79 inline void glGetv(GLenum pname
, maths::gl::mat4d
* matrix
)
81 glGetDoublev(pname
, (GLdouble
*)(*matrix
));