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 struct Matrix44POD; 00017 struct Vector3POD; 00018 struct Vector4POD; 00019 } 00020 00021 //------------------------------------------------------------ 00022 namespace XBase { 00024 00025 00036 struct Matrix34POD 00037 { 00038 //============================================================ 00040 00041 enum 00042 { 00043 Index00 = 0, 00044 Index10 = 1, 00045 Index20 = 2, 00046 Index01 = 3, 00047 Index11 = 4, 00048 Index21 = 5, 00049 Index02 = 6, 00050 Index12 = 7, 00051 Index22 = 8, 00052 Index03 = 9, 00053 Index13 = 10, 00054 Index23 = 11, 00055 IndexXX = Index00, 00056 IndexXY = Index10, 00057 IndexXZ = Index20, 00058 IndexYX = Index01, 00059 IndexYY = Index11, 00060 IndexYZ = Index21, 00061 IndexZX = Index02, 00062 IndexZY = Index12, 00063 IndexZZ = Index22, 00064 IndexWX = Index03, 00065 IndexWY = Index13, 00066 IndexWZ = Index23, 00067 }; 00069 00070 //============================================================ 00072 00073 static const Matrix34POD Identity(); 00074 static const Matrix34POD Translate( f32 aX , f32 aY , f32 aZ ); 00075 static const Matrix34POD Translate( const Vector3POD& aVec ); 00076 static const Matrix34POD Scale( f32 aX , f32 aY , f32 aZ ); 00077 static const Matrix34POD Scale( const Vector3POD& aVec ); 00078 static const Matrix34POD Rotate( const Angle& , f32 aAxisX , f32 aAxisY , f32 aAxisZ ); 00079 static const Matrix34POD Rotate( const Angle& , const Vector3POD& aAxis ); 00080 00088 static const Matrix34POD LookAt( const Vector3POD& aEyePos , const Vector3POD& aTargetPos , const Vector3POD& aUpVec ); 00090 00091 //============================================================ 00093 00094 union 00095 { 00096 f32 v[12]; 00097 f32 m[3][4]; 00098 }; 00100 00101 //============================================================ 00103 00104 const Vector3POD x()const; 00105 const Vector3POD y()const; 00106 const Vector3POD z()const; 00107 const Vector3POD w()const; 00108 void setX( const Vector3POD& ); 00109 void setY( const Vector3POD& ); 00110 void setZ( const Vector3POD& ); 00111 void setW( const Vector3POD& ); 00113 00114 //============================================================ 00116 00117 const Vector3POD mul( const Vector3POD& )const; 00118 const Matrix34POD mul( const Matrix34POD& )const; 00119 Matrix34POD& mulAssign( const Matrix34POD& ); 00120 00121 00122 //============================================================ 00124 00125 const Vector3POD operator*( const Vector3POD& )const; 00126 const Matrix34POD operator*( const Matrix34POD& )const; 00127 Matrix34POD& operator*=( const Matrix34POD& ); 00128 00129 00130 //============================================================ 00132 00133 const Matrix44POD toMatrix44()const; 00134 00135 00136 //============================================================ 00138 00139 void dump()const; 00141 }; 00142 00144 class Matrix34 : public Matrix34POD 00145 { 00146 public: 00147 //============================================================ 00149 00150 Matrix34(); 00151 00152 Matrix34( f32 r0c0 , f32 r0c1 , f32 r0c2 , f32 r0c3 00153 , f32 r1c0 , f32 r1c1 , f32 r1c2 , f32 r1c3 00154 , f32 r2c0 , f32 r2c1 , f32 r2c2 , f32 r2c3 00155 ); 00156 Matrix34( const Vector3POD& aX , const Vector3POD& aY , const Vector3POD& aZ , const Vector3POD& aW ); 00157 Matrix34( const Matrix34POD& ); 00158 00159 }; 00161 } 00162 //------------------------------------------------------------ 00163 #endif 00164 // EOF