diff options
Diffstat (limited to 'Matrix.h')
-rw-r--r-- | Matrix.h | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/Matrix.h b/Matrix.h deleted file mode 100644 index f8c178f..0000000 --- a/Matrix.h +++ /dev/null @@ -1,45 +0,0 @@ -#ifndef _MATRIX_H_ -#define _MATRIX_H_ - -#include "gl.h" -#include "Vector.h" -#include "Vertex.h" - -class Matrix -{ - public: - Matrix(GLenum pname = GL_MODELVIEW_MATRIX) { - store(pname); - } - - Matrix(float in[16]) { - for(int i = 0; i < 16; ++i) - f[i] = in[i]; - } - - Vertex operator*(const Vertex &v) const { - Vector r(v.getX()*m[0][0] + v.getY()*m[1][0] + v.getZ()*m[2][0] + m[3][0], - v.getX()*m[0][1] + v.getY()*m[1][1] + v.getZ()*m[2][1] + m[3][1], - v.getX()*m[0][2] + v.getY()*m[1][2] + v.getZ()*m[2][2] + m[3][2]); - float w = v.getX()*m[0][3] + v.getY()*m[1][3] + v.getZ()*m[2][3] + m[3][3]; - - return r/w; - } - - void load() { - glLoadMatrixf(f); - } - - void store(GLenum pname = GL_MODELVIEW_MATRIX) { - glGetFloatv(pname, f); - } - - private: - union { - float f[16]; - float m[4][4]; - }; -}; - -#endif /*_MATRIX_H_*/ - |