00001 //=================================================================================================// 00002 // filename: RmMatrix.h // 00003 // // 00004 // ATI Research, Inc. // 00005 // 3D Application Research Group // 00006 // // 00007 // Description: RenderMonkey's Matrix Definition // 00008 // // 00009 //=================================================================================================// 00010 // (C) 2004 ATI Research, Inc. All rights reserved. // 00011 //=================================================================================================// 00012 00013 #ifndef _RM_CORE_MATRIX_H_ 00014 #define _RM_CORE_MATRIX_H_ 00015 00016 #include <Core/RmTypes.h> 00017 #include <Core/RmDefines.h> 00018 #include <Core/RmEffect.h> 00019 00020 //============================================================================= 00026 //============================================================================= 00027 class RM_API RmMatrix4x4 00028 { 00029 public : 00030 //-------------------------------------------------------------------------- 00035 //-------------------------------------------------------------------------- 00036 RmMatrix4x4(); 00037 00038 //-------------------------------------------------------------------------- 00044 //-------------------------------------------------------------------------- 00045 RmMatrix4x4( const RmMatrix4x4 &src ); 00046 00047 //-------------------------------------------------------------------------- 00053 //-------------------------------------------------------------------------- 00054 RmMatrix4x4( const float src[16] ); 00055 00056 //-------------------------------------------------------------------------- 00061 //-------------------------------------------------------------------------- 00062 virtual ~RmMatrix4x4(); 00063 00064 //-------------------------------------------------------------------------- 00070 //-------------------------------------------------------------------------- 00071 float* GetElements() { return m_elements; }; 00072 00073 //-------------------------------------------------------------------------- 00079 //-------------------------------------------------------------------------- 00080 const float* GetElements() const { return m_elements; }; 00081 00082 //-------------------------------------------------------------------------- 00089 //-------------------------------------------------------------------------- 00090 void operator = ( const RmMatrix4x4 &src ); 00091 00092 //-------------------------------------------------------------------------- 00099 //-------------------------------------------------------------------------- 00100 float* operator[] ( int rowIndex ); 00101 00102 //-------------------------------------------------------------------------- 00109 //-------------------------------------------------------------------------- 00110 const float* operator[] ( int rowIndex ) const; 00111 00112 //-------------------------------------------------------------------------- 00119 //-------------------------------------------------------------------------- 00120 RmMatrix4x4 operator * ( const RmMatrix4x4 &rhs ) const; 00121 00122 //-------------------------------------------------------------------------- 00129 //-------------------------------------------------------------------------- 00130 void operator *= ( const RmMatrix4x4 &rhs ); 00131 00132 //-------------------------------------------------------------------------- 00139 //-------------------------------------------------------------------------- 00140 void SetEntries( float val ); 00141 00142 //-------------------------------------------------------------------------- 00149 //-------------------------------------------------------------------------- 00150 void SetEntries( const float src[16] ); 00151 00152 //-------------------------------------------------------------------------- 00158 //-------------------------------------------------------------------------- 00159 void Identity(); 00160 00161 //-------------------------------------------------------------------------- 00167 //-------------------------------------------------------------------------- 00168 void Transpose(); 00169 00170 //-------------------------------------------------------------------------- 00177 //-------------------------------------------------------------------------- 00178 bool Inverse(); 00179 00180 //-------------------------------------------------------------------------- 00191 //-------------------------------------------------------------------------- 00192 void Rotate( const float xAxis, 00193 const float yAxis, 00194 const float zAxis, 00195 const float angle, 00196 const RmAngleType angleType ); 00197 00198 //-------------------------------------------------------------------------- 00207 //-------------------------------------------------------------------------- 00208 void Translate( const float x, 00209 const float y, 00210 const float z ); 00211 00212 //-------------------------------------------------------------------------- 00221 //-------------------------------------------------------------------------- 00222 void Scale( const float x, 00223 const float y, 00224 const float z ); 00225 00226 //-------------------------------------------------------------------------- 00233 //-------------------------------------------------------------------------- 00234 void CopyTo( float dest[16] ) const; 00235 00236 //-------------------------------------------------------------------------- 00243 //-------------------------------------------------------------------------- 00244 void CopyToTranspose( float dest[16] ) const; 00245 00246 //-------------------------------------------------------------------------- 00253 //-------------------------------------------------------------------------- 00254 RmVector3D TransformPoint( const RmVector3D &v ) const; 00255 00256 //-------------------------------------------------------------------------- 00263 //-------------------------------------------------------------------------- 00264 RmVector3D TransformVector( const RmVector3D &v ) const; 00265 00266 private : 00267 float m_elements[4*4]; 00268 }; 00269 00270 #endif
1.3.6