Labyrinth
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends
matrix.hpp
1 //////////////////////////////
2 //
3 // File: lxs/coregraphics/matrix.hpp
4 // Author: Maciej Kaminski
5 // E-mail: maciej.a.kaminski@gmail.com
6 // Website: maciejkaminski.pl
7 //
8 // File creation date: Nov 27 2012
9 // This file is part of Project Labyrinth
10 // This file is going to be released under terms of GNU GPL in near future
11 //
12 //////////////////////////////
13 
14 #ifndef __LXS_MATRIX__
15 #define __LXS_MATRIX__
16 #define BOOST_UBLAS_SHALLOW_ARRAY_ADAPTOR
17 #define BOOST_ARRAY_ADAPTOR
18 // must be defined before inclusion of boost for saa to be used
19 #include <boost/numeric/ublas/matrix.hpp>
20 
21 namespace LxS
22 {
23  //! typical OpenGL matrix encalsulated as an UBLAS object
24  typedef
25  boost::numeric::ublas::matrix<
26  GLfloat, boost::numeric::ublas::column_major,
27  boost::numeric::ublas::array_adaptor<GLfloat> >
29  //! matrix processing helper - converts opengl float array into UBLAS object
30  Matrix ToMatrix(GLfloat * ptr, int size)
31  {
32  using namespace boost::numeric::ublas;
33  return Matrix(size, size,
34  array_adaptor<GLfloat>
35  (size*size, ptr));
36  }
37 }
38 
39 #endif