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 Matrix34POD mul( const Matrix34POD& )const; 00118 Matrix34POD& mulAssign( const Matrix34POD& ); 00119 00120 00121 //============================================================ 00123 00124 const Matrix34POD operator*( const Matrix34POD& )const; 00125 Matrix34POD& operator*=( const Matrix34POD& ); 00126 00127 00128 //============================================================ 00130 00131 const Matrix44POD toMatrix44()const; 00132 00133 00134 //============================================================ 00136 00137 void dump()const; 00139 }; 00140 00142 class Matrix34 : public Matrix34POD 00143 { 00144 public: 00145 //============================================================ 00147 00148 Matrix34(); 00149 00150 Matrix34( f32 r0c0 , f32 r0c1 , f32 r0c2 , f32 r0c3 00151 , f32 r1c0 , f32 r1c1 , f32 r1c2 , f32 r1c3 00152 , f32 r2c0 , f32 r2c1 , f32 r2c2 , f32 r2c3 00153 ); 00154 Matrix34( const Vector3POD& aX , const Vector3POD& aY , const Vector3POD& aZ , const Vector3POD& aW ); 00155 Matrix34( const Matrix34POD& ); 00156 00157 }; 00159 } 00160 //------------------------------------------------------------ 00161 #endif 00162 // EOF