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