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
00031
00032 class FXAPI FXMat4d {
00033 protected:
00034 FXVec4d m[4];
00035 public:
00036
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
00046
00047 FXMat4d& operator=(const FXMat4d& other);
00048 FXMat4d& operator=(FXdouble w);
00049 FXMat4d& operator+=(const FXMat4d& w);
00050 FXMat4d& operator-=(const FXMat4d& w);
00051 FXMat4d& operator*=(FXdouble w);
00052 FXMat4d& operator*=(const FXMat4d& w);
00053 FXMat4d& operator/=(FXdouble w);
00054
00055
00056 FXVec4d& operator[](FXint i){return m[i];}
00057 const FXVec4d& operator[](FXint i) const {return m[i];}
00058
00059
00060 operator FXdouble*(){return m[0];}
00061 operator const FXdouble*() const {return m[0];}
00062
00063
00064 friend FXAPI FXMat4d operator+(const FXMat4d& a,const FXMat4d& b);
00065 friend FXAPI FXMat4d operator-(const FXMat4d& a,const FXMat4d& b);
00066 friend FXAPI FXMat4d operator-(const FXMat4d& a);
00067 friend FXAPI FXMat4d operator*(const FXMat4d& a,const FXMat4d& b);
00068 friend FXAPI FXMat4d operator*(FXdouble x,const FXMat4d& a);
00069 friend FXAPI FXMat4d operator*(const FXMat4d& a,FXdouble x);
00070 friend FXAPI FXMat4d operator/(const FXMat4d& a,FXdouble x);
00071 friend FXAPI FXMat4d operator/(FXdouble x,const FXMat4d& a);
00072
00073
00074 friend FXAPI FXVec4d operator*(const FXVec4d& v,const FXMat4d& m);
00075 friend FXAPI FXVec4d operator*(const FXMat4d& a,const FXVec4d& v);
00076
00077
00078 friend FXAPI FXVec3d operator*(const FXVec3d& v,const FXMat4d& m);
00079 friend FXAPI FXVec3d operator*(const FXMat4d& a,const FXVec3d& v);
00080
00081
00082 FXMat4d& eye();
00083
00084
00085 FXMat4d& ortho(FXdouble left,FXdouble right,FXdouble bottom,FXdouble top,FXdouble hither,FXdouble yon);
00086
00087
00088 FXMat4d& frustum(FXdouble left,FXdouble right,FXdouble bottom,FXdouble top,FXdouble hither,FXdouble yon);
00089
00090
00091 FXMat4d& left();
00092
00093
00094 FXMat4d& rot(const FXQuatd& q);
00095
00096
00097 FXMat4d& rot(const FXVec3d& v,FXdouble c,FXdouble s);
00098
00099
00100 FXMat4d& rot(const FXVec3d& v,FXdouble phi);
00101
00102
00103 FXMat4d& xrot(FXdouble c,FXdouble s);
00104 FXMat4d& xrot(FXdouble phi);
00105
00106
00107 FXMat4d& yrot(FXdouble c,FXdouble s);
00108 FXMat4d& yrot(FXdouble phi);
00109
00110
00111 FXMat4d& zrot(FXdouble c,FXdouble s);
00112 FXMat4d& zrot(FXdouble phi);
00113
00114
00115 FXMat4d& look(const FXVec3d& eye,const FXVec3d& cntr,const FXVec3d& vup);
00116
00117
00118 FXMat4d& trans(FXdouble tx,FXdouble ty,FXdouble tz);
00119 FXMat4d& trans(const FXVec3d& v);
00120
00121
00122 FXMat4d& scale(FXdouble sx,FXdouble sy,FXdouble sz);
00123 FXMat4d& scale(FXdouble s);
00124 FXMat4d& scale(const FXVec3d& v);
00125
00126
00127 friend FXAPI FXdouble det(const FXMat4d& m);
00128
00129
00130 friend FXAPI FXMat4d transpose(const FXMat4d& m);
00131
00132
00133 friend FXAPI FXMat4d invert(const FXMat4d& m);
00134
00135
00136 friend FXAPI FXStream& operator<<(FXStream& store,const FXMat4d& m);
00137
00138
00139 friend FXAPI FXStream& operator>>(FXStream& store,FXMat4d& m);
00140 };
00141
00142 }
00143
00144 #endif