"L. Spiro Engine"

F:/My Projects/LSEngine/Modules/LSMathLib/Src/Matrix/LSMMatrix4x4.h

00001 
00016 #ifndef __LSM_MATRIX4X4_H__
00017 #define __LSM_MATRIX4X4_H__
00018 
00019 #include "../LSMMathLib.h"
00020 #include "../Vector/LSMVector3.h"
00021 #include "../Vector/LSMVector4.h"
00022 #include "LSMMatrix3x3.h"
00023 #include "LSMMatrix4x4Base.h"
00024 
00025 namespace lsm {
00026 
00033         class CMatrix4x4 : public CMatrix4x4Base<LSREAL, CVector3, CVector4> {
00034                 // All is public.  This class has no secrets.
00035         public :
00036                 // == Various constructors.
00037                 LSE_CALLCTOR                                                                            CMatrix4x4();
00038                 LSE_CALLCTOR                                                                            CMatrix4x4( const CMatrix4x4 &_mOther );
00039                 LSE_CALLCTOR                                                                            CMatrix4x4( LSREAL _t11, LSREAL _t12, LSREAL _13, LSREAL _14,
00040                         LSREAL _t21, LSREAL _t22, LSREAL _23, LSREAL _24,
00041                         LSREAL _t31, LSREAL _t32, LSREAL _33, LSREAL _34,
00042                         LSREAL _t41, LSREAL _t42, LSREAL _43, LSREAL _44 );
00043                 LSE_CALLCTOR                                                                            CMatrix4x4( const CMatrix4x4Base<LSREAL, CVector3, CVector4> &_mOther );
00044                 LSE_CALLCTOR                                                                            CMatrix4x4( const CMatrix4x4 &_mOther, LSBOOL _bTranspose );
00045                 explicit LSE_CALLCTOR                                                           CMatrix4x4( const LSREAL * _pfArray );
00046 
00047 
00048                 // == Operators.
00049 #if (LSM_BASETYPE == LSM_FLOAT)
00050 
00056                 LSE_INLINE CMatrix4x4 & LSE_FCALL                                       operator = ( const CMatrix4x4 &_mOther );
00057 #endif  // #if (LSM_BASETYPE == LSM_FLOAT)
00058 
00059 
00060                 // == Functions.
00066                 LSE_INLINE CMatrix3x3 LSE_CALL                                          Get3x3Matrix() const;
00067 
00073                 LSE_INLINE CMatrix3x3 LSE_CALL                                          Get3x3MatrixTranspose() const;
00074 
00075 #if defined( LSE_X86 ) && (LSM_BASETYPE == LSM_FLOAT)
00076 #if LSM_PERFORMANCE <= 0
00077 
00085                 static LSVOID LSE_FCALL                                                         MultiplyVec3Batch( const CMatrix4x4 &_mMat,
00086                         const CVector3 * _pvIn, LSUINT32 _ui32Total,
00087                         CVector3 * _pvOut );
00088 #endif  // #if LSM_PERFORMANCE <= 0
00089 
00098                 static LSVOID LSE_FCALL                                                         MultiplyVec4Batch( const CMatrix4x4 &_mMat,
00099                         const CVector4 * _pvIn, LSUINT32 _ui32Total,
00100                         CVector4 * _pvOut );
00101 #endif  // #if defined( LSE_X86 ) && (LSM_BASETYPE == LSM_FLOAT)
00102 
00103 
00104                 // == Members.
00108                 static const CMatrix4x4                                                         m_mIdentity;
00109 
00110         private :
00111                 typedef CMatrix4x4Base<LSREAL, CVector3, CVector4>      Parent;
00112         };
00113 
00114 
00115         // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
00116         // DEFINITIONS
00117         // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
00118         // == Various constructors.
00119         LSE_INLINE LSE_CALLCTOR CMatrix4x4::CMatrix4x4( const CMatrix4x4Base<LSREAL, CVector3, CVector4> &_mOther ) :
00120                 Parent( _mOther ) {
00121         }
00122         LSE_INLINE LSE_CALLCTOR CMatrix4x4::CMatrix4x4( LSREAL _t11, LSREAL _t12, LSREAL _t13, LSREAL _t14,
00123                 LSREAL _t21, LSREAL _t22, LSREAL _t23, LSREAL _t24,
00124                 LSREAL _t31, LSREAL _t32, LSREAL _t33, LSREAL _t34,
00125                 LSREAL _t41, LSREAL _t42, LSREAL _t43, LSREAL _t44 ) :
00126                 Parent( _t11, _t12, _t13, _t14,
00127                         _t21, _t22, _t23, _t24,
00128                         _t31, _t32, _t33, _t34,
00129                         _t41, _t42, _t43, _t44 ) {
00130         }
00131 
00132         // == Operators.
00133 #if (LSM_BASETYPE == LSM_FLOAT)
00134 
00140         LSE_INLINE CMatrix4x4 & LSE_FCALL CMatrix4x4::operator = ( const CMatrix4x4 &_mOther ) {
00141                 // Copy in pairs.
00142                 LSUINT64 * pui64This = reinterpret_cast<LSUINT64 *>(this);
00143                 const LSUINT64 * pui64That = reinterpret_cast<const LSUINT64 *>(&_mOther);
00144                 (*pui64This++) = (*pui64That++);
00145                 (*pui64This++) = (*pui64That++);
00146 
00147                 (*pui64This++) = (*pui64That++);
00148                 (*pui64This++) = (*pui64That++);
00149 
00150                 (*pui64This++) = (*pui64That++);
00151                 (*pui64This++) = (*pui64That++);
00152 
00153                 (*pui64This++) = (*pui64That++);
00154                 (*pui64This) = (*pui64That);
00155                 return (*this);
00156         }
00157 #endif  // #if (LSM_BASETYPE == LSM_FLOAT)
00158 
00159         // == Functions.
00165         LSE_INLINE CMatrix3x3 LSE_CALL CMatrix4x4::Get3x3Matrix() const {
00166                 CMatrix3x3 mRet;
00167                 mRet._11 = _11;
00168                 mRet._12 = _12;
00169                 mRet._13 = _13;
00170 
00171                 mRet._21 = _21;
00172                 mRet._22 = _22;
00173                 mRet._23 = _23;
00174 
00175                 mRet._31 = _31;
00176                 mRet._32 = _32;
00177                 mRet._33 = _33;
00178 
00179                 return mRet;
00180         }
00181 
00187         LSE_INLINE CMatrix3x3 LSE_CALL CMatrix4x4::Get3x3MatrixTranspose() const {
00188                 CMatrix3x3 mRet;
00189                 mRet._11 = _11;
00190                 mRet._12 = _21;
00191                 mRet._13 = _31;
00192 
00193                 mRet._21 = _12;
00194                 mRet._22 = _22;
00195                 mRet._23 = _32;
00196 
00197                 mRet._31 = _13;
00198                 mRet._32 = _23;
00199                 mRet._33 = _33;
00200 
00201                 return mRet;
00202         }
00203 
00204 #if defined( LSE_X86 ) && (LSM_BASETYPE == LSM_FLOAT)
00205 #if LSM_PERFORMANCE <= 0
00206 
00214         LSE_INLINE LSVOID LSE_FCALL CMatrix4x4::MultiplyVec3Batch( const CMatrix4x4 &_mMat,
00215                 const CVector3 * _pvIn, LSUINT32 _ui32Total,
00216                 CVector3 * _pvOut ) {
00217                 // When using LSM_PERFORMANCE at 0, the CVector3 class actually has 4 members, making it a CVector4 for alignment
00218                 //      purposes.
00219                 MultiplyVec4Batch( _mMat, reinterpret_cast<const CVector4 *>(_pvIn), _ui32Total, reinterpret_cast<CVector4 *>(_pvOut) );
00220         }
00221 #endif  // #if LSM_PERFORMANCE <= 0
00222 #endif  // #if defined( LSE_X86 ) && (LSM_BASETYPE == LSM_FLOAT)
00223 
00224 }       // namespace lsm
00225 
00226 #endif  // __LSM_MATRIX4X4_H__
00227 
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator