00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef __CMATRIX44_H__
00013 #define __CMATRIX44_H__
00014
00015
00016
00017
00018 #include <Definitions.h>
00019 #include "TVector3.h"
00020 #include "TVector4.h"
00021
00022
00023
00024
00025
00026
00027
00028
00029 #pragma pack(push, 1) //Ensures that the floats are tightly packed
00030 class CMatrix44
00031 {
00032
00033
00034
00035 public:
00036 CMatrix44() {};
00037 CMatrix44(const float &f);
00038 CMatrix44(const float &f11, const float &f12, const float &f13, const float &f14,
00039 const float &f21, const float &f22, const float &f23, const float &f24,
00040 const float &f31, const float &f32, const float &f33, const float &f34,
00041 const float &f41, const float &f42, const float &f43, const float &f44);
00042 CMatrix44(const CMatrix44 &other);
00043
00044 const CMatrix44 &operator=(const CMatrix44 &other);
00045 const CMatrix44 operator*(const CMatrix44 &other) const;
00046 const CMatrix44 &operator*=(const CMatrix44 &other);
00047
00048 const CVector3f operator*(const CVector3f &v) const;
00049
00050 bool operator==(const CMatrix44 &other) const;
00051 bool operator!=(const CMatrix44 &other) const;
00052
00053 void Set(const float &f);
00054 void Set(const float &f11, const float &f12, const float &f13, const float &f14,
00055 const float &f21, const float &f22, const float &f23, const float &f24,
00056 const float &f31, const float &f32, const float &f33, const float &f34,
00057 const float &f41, const float &f42, const float &f43, const float &f44);
00058
00059 float Determinant();
00060
00061 void Identity();
00062 void Invert();
00063 void Transpose();
00064 void TransposeFrom(const CMatrix44 &m);
00065
00066
00067
00068 void Multiply(const CMatrix44 &first, const CMatrix44 &second);
00069
00070 void Scaling(const float &fX, const float &fY, const float &fZ);
00071 void Scaling(const CVector3f &vScale);
00072 void Translation(const float &fX, const float &fY, const float &fZ);
00073 void Translation(const CVector3f &vTranslation);
00074 void RotationX(const float &fRad);
00075 void RotationY(const float &fRad);
00076 void RotationZ(const float &fRad);
00077
00078 void RotationZYX(const float &fX, const float &fY, const float &fZ);
00079 void RotationZYX(const CVector3f &vRotation);
00080 void RotationZXY(const float &fX, const float &fY, const float &fZ);
00081 void RotationZXY(const CVector3f &vRotation);
00082 const CVector3f GetZXYRotationVector();
00083 void Orthogonal(const float &fWidth, const float &fHeight, const float &fNearZ, const float &fFarZ);
00084 void Perspective(const float &fFov, const float &fAspectRatio, const float &fNearZ, const float &fFarZ);
00085
00086 void Log(word wTargetLog) const;
00087
00088
00089
00090
00091 protected:
00092
00093
00094
00095
00096 private:
00097
00098
00099
00100
00101 public:
00102
00103
00104 struct
00105 {
00106 float _11, _21, _31, _41;
00107 float _12, _22, _32, _42;
00108 float _13, _23, _33, _43;
00109 float _14, _24, _34, _44;
00110 };
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125 };
00126 #pragma pack(pop)
00127
00128 CVector4f operator*(const CVector4f &v, const CMatrix44 &m);
00129 CVector4f &operator*=(CVector4f &v, const CMatrix44 &m);
00130
00131 #endif