00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef MATRIX_FOUR_H
00023 #define MATRIX_FOUR_H
00024
00026 class Matrix4 {
00027 public:
00028 Matrix4(void) { identity(); }
00029 Matrix4(float f) { constant(f); }
00030 Matrix4(const float *m);
00031 Matrix4(const Matrix4& m) { loadmatrix(m); }
00032 ~Matrix4(void) {}
00033 float mat[16];
00034
00036 void multpoint3d (const float[3], float[3]) const;
00037
00039 void multnorm3d (const float[3], float[3]) const;
00040
00042 void multpoint4d (const float[4], float[4]) const;
00043
00045 void identity(void);
00046
00048 void constant(float);
00049
00054 int inverse(void);
00055
00057 void transpose(void);
00058
00060 void loadmatrix(const Matrix4 &m);
00061 Matrix4& operator=(const Matrix4& m) {loadmatrix(m); return *this;}
00062
00064 void multmatrix(const Matrix4 &);
00065
00067 void rot(float, char);
00068
00070 void rotate_axis(const float axis[3], float angle);
00071
00073 void transvec(float x, float y, float z);
00074
00076 void transvecinv(float x, float y, float z);
00077
00079 void translate(float, float, float);
00080 void translate(float d[3]) { translate(d[0], d[1], d[2]); }
00081
00083 void scale(float, float, float);
00084 void scale(float f) { scale(f, f, f); }
00085
00087 void window(float, float, float, float, float, float);
00088
00090 void ortho(float, float, float, float, float, float);
00091
00093 void ortho2(float, float, float, float);
00094
00101 void lookat(float, float, float, float, float, float, short);
00102 };
00103
00105 void trans_from_rotate(const float mat3[9], Matrix4 *mat4);
00106
00108 void print_Matrix4(const Matrix4 *mat4);
00109
00110 #endif
00111