00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef FXMAT4F_H
00025 #define FXMAT4F_H
00026
00027
00028 namespace FX {
00029
00030
00032 class FXAPI FXMat4f {
00033 protected:
00034 FXVec4f m[4];
00035 public:
00037 FXMat4f(){}
00038 FXMat4f(FXfloat w);
00039 FXMat4f(FXfloat a00,FXfloat a01,FXfloat a02,FXfloat a03,
00040 FXfloat a10,FXfloat a11,FXfloat a12,FXfloat a13,
00041 FXfloat a20,FXfloat a21,FXfloat a22,FXfloat a23,
00042 FXfloat a30,FXfloat a31,FXfloat a32,FXfloat a33);
00043 FXMat4f(const FXVec4f& a,const FXVec4f& b,const FXVec4f& c,const FXVec4f& d);
00044 FXMat4f(const FXMat4f& other);
00045
00047 FXMat4f& operator=(const FXMat4f& other);
00048 FXMat4f& operator=(FXfloat w);
00049
00051 FXMat4f& set(const FXMat4f& other);
00052
00054 FXMat4f& set(FXfloat w);
00055
00057 FXMat4f& set(FXfloat a00,FXfloat a01,FXfloat a02,FXfloat a03,
00058 FXfloat a10,FXfloat a11,FXfloat a12,FXfloat a13,
00059 FXfloat a20,FXfloat a21,FXfloat a22,FXfloat a23,
00060 FXfloat a30,FXfloat a31,FXfloat a32,FXfloat a33);
00061
00063 FXMat4f& set(const FXVec4f& a,const FXVec4f& b,const FXVec4f& c,const FXVec4f& d);
00064
00066 FXMat4f& operator+=(const FXMat4f& w);
00067 FXMat4f& operator-=(const FXMat4f& w);
00068 FXMat4f& operator*=(FXfloat w);
00069 FXMat4f& operator*=(const FXMat4f& w);
00070 FXMat4f& operator/=(FXfloat w);
00071
00073 FXVec4f& operator[](FXint i){return m[i];}
00074 const FXVec4f& operator[](FXint i) const {return m[i];}
00075
00077 operator FXfloat*(){return m[0];}
00078 operator const FXfloat*() const {return m[0];}
00079
00081 FXMat4f operator-() const;
00082
00084 FXMat4f operator+(const FXMat4f& w) const;
00085 FXMat4f operator-(const FXMat4f& w) const;
00086 FXMat4f operator*(const FXMat4f& w) const;
00087
00089 friend FXAPI FXMat4f operator*(FXfloat x,const FXMat4f& a);
00090 friend FXAPI FXMat4f operator*(const FXMat4f& a,FXfloat x);
00091 friend FXAPI FXMat4f operator/(const FXMat4f& a,FXfloat x);
00092 friend FXAPI FXMat4f operator/(FXfloat x,const FXMat4f& a);
00093
00095 FXVec4f operator*(const FXVec4f& v) const;
00096 FXVec3f operator*(const FXVec3f& v) const;
00097
00099 FXMat4f& eye();
00100
00102 FXMat4f& ortho(FXfloat left,FXfloat right,FXfloat bottom,FXfloat top,FXfloat hither,FXfloat yon);
00103
00105 FXMat4f& frustum(FXfloat left,FXfloat right,FXfloat bottom,FXfloat top,FXfloat hither,FXfloat yon);
00106
00108 FXMat4f& left();
00109
00111 FXMat4f& rot(const FXQuatf& q);
00112
00114 FXMat4f& rot(const FXVec3f& v,FXfloat c,FXfloat s);
00115
00117 FXMat4f& rot(const FXVec3f& v,FXfloat phi);
00118
00120 FXMat4f& xrot(FXfloat c,FXfloat s);
00121 FXMat4f& xrot(FXfloat phi);
00122
00124 FXMat4f& yrot(FXfloat c,FXfloat s);
00125 FXMat4f& yrot(FXfloat phi);
00126
00128 FXMat4f& zrot(FXfloat c,FXfloat s);
00129 FXMat4f& zrot(FXfloat phi);
00130
00132 FXMat4f& look(const FXVec3f& eye,const FXVec3f& cntr,const FXVec3f& vup);
00133
00135 FXMat4f& trans(FXfloat tx,FXfloat ty,FXfloat tz);
00136 FXMat4f& trans(const FXVec3f& v);
00137
00139 FXMat4f& scale(FXfloat sx,FXfloat sy,FXfloat sz);
00140 FXMat4f& scale(FXfloat s);
00141 FXMat4f& scale(const FXVec3f& v);
00142
00144 FXfloat det() const;
00145
00147 FXMat4f transpose() const;
00148
00150 FXMat4f invert() const;
00151
00153 friend FXAPI FXStream& operator<<(FXStream& store,const FXMat4f& m);
00154
00156 friend FXAPI FXStream& operator>>(FXStream& store,FXMat4f& m);
00157 };
00158
00159 extern FXAPI FXMat4f operator*(FXfloat x,const FXMat4f& a);
00160 extern FXAPI FXMat4f operator*(const FXMat4f& a,FXfloat x);
00161 extern FXAPI FXMat4f operator/(const FXMat4f& a,FXfloat x);
00162 extern FXAPI FXMat4f operator/(FXfloat x,const FXMat4f& a);
00163
00164 extern FXAPI FXStream& operator<<(FXStream& store,const FXMat4f& m);
00165 extern FXAPI FXStream& operator>>(FXStream& store,FXMat4f& m);
00166
00167 }
00168
00169 #endif