CrossFramework Library
|
00001 00006 #if defined(XBASE_INCLUDED_MATRIX34_HPP) 00007 #else 00008 #define XBASE_INCLUDED_MATRIX34_HPP 00009 00010 //------------------------------------------------------------ 00011 #include <XBase/BuiltInTypes.hpp> 00012 00013 //------------------------------------------------------------ 00014 namespace XBase { 00015 class Angle; 00016 class Quaternion; 00017 struct Matrix44POD; 00018 struct Vector3POD; 00019 struct Vector4POD; 00020 } 00021 00022 //------------------------------------------------------------ 00023 namespace XBase { 00025 00026 00038 struct Matrix34POD 00039 { 00040 //============================================================ 00042 00043 enum 00044 { 00045 Index00 = 0, 00046 Index10 = 1, 00047 Index20 = 2, 00048 Index01 = 3, 00049 Index11 = 4, 00050 Index21 = 5, 00051 Index02 = 6, 00052 Index12 = 7, 00053 Index22 = 8, 00054 Index03 = 9, 00055 Index13 = 10, 00056 Index23 = 11, 00057 IndexXX = Index00, 00058 IndexXY = Index10, 00059 IndexXZ = Index20, 00060 IndexYX = Index01, 00061 IndexYY = Index11, 00062 IndexYZ = Index21, 00063 IndexZX = Index02, 00064 IndexZY = Index12, 00065 IndexZZ = Index22, 00066 IndexWX = Index03, 00067 IndexWY = Index13, 00068 IndexWZ = Index23, 00069 }; 00071 00072 //============================================================ 00074 00075 static const Matrix34POD Identity(); 00076 static const Matrix34POD Translate( f32 aX , f32 aY , f32 aZ ); 00077 static const Matrix34POD Translate( const Vector3POD& aVec ); 00078 static const Matrix34POD Scale( f32 aX , f32 aY , f32 aZ ); 00079 static const Matrix34POD Scale( const Vector3POD& aVec ); 00080 static const Matrix34POD Rotate( const Angle& , f32 aAxisX , f32 aAxisY , f32 aAxisZ ); 00081 static const Matrix34POD Rotate( const Angle& , const Vector3POD& aAxis ); 00082 00090 static const Matrix34POD LookAt( const Vector3POD& aEyePos , const Vector3POD& aTargetPos , const Vector3POD& aUpVec ); 00092 00093 //============================================================ 00095 00096 union 00097 { 00098 f32 v[12]; 00099 }; 00101 00102 //============================================================ 00104 00105 const Vector3POD x()const; 00106 const Vector3POD y()const; 00107 const Vector3POD z()const; 00108 const Vector3POD w()const; 00109 void setX( const Vector3POD& ); 00110 void setY( const Vector3POD& ); 00111 void setZ( const Vector3POD& ); 00112 void setW( const Vector3POD& ); 00114 00115 //============================================================ 00117 00118 const Vector3POD mul( const Vector3POD& )const; 00119 const Matrix34POD mul( const Matrix34POD& )const; 00120 Matrix34POD& mulAssign( const Matrix34POD& ); 00121 00122 00123 //============================================================ 00125 00126 const Vector3POD operator*( const Vector3POD& )const; 00127 const Matrix34POD operator*( const Matrix34POD& )const; 00128 Matrix34POD& operator*=( const Matrix34POD& ); 00129 00130 00131 //============================================================ 00133 00134 const Matrix34POD invert()const; 00135 const Quaternion toQuaternion()const; 00136 const Matrix44POD toMatrix44()const; 00137 00138 00139 //============================================================ 00141 00142 void dump()const; 00144 }; 00145 00147 class Matrix34 : public Matrix34POD 00148 { 00149 public: 00150 //============================================================ 00152 00153 Matrix34(); 00154 00155 Matrix34( f32 r0c0 , f32 r0c1 , f32 r0c2 , f32 r0c3 00156 , f32 r1c0 , f32 r1c1 , f32 r1c2 , f32 r1c3 00157 , f32 r2c0 , f32 r2c1 , f32 r2c2 , f32 r2c3 00158 ); 00159 Matrix34( const Vector3POD& aX , const Vector3POD& aY , const Vector3POD& aZ , const Vector3POD& aW ); 00160 Matrix34( const Matrix34POD& ); 00161 00162 }; 00163 00165 typedef Matrix34POD Mtx34; 00167 } 00168 //------------------------------------------------------------ 00169 #endif 00170 // EOF