00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef __NENODE_H
00028 #define __NENODE_H
00029
00030
00038 #include "base.h"
00039 #include "nemath.h"
00040
00041 #include <vector>
00042
00043
00044 namespace NeoEngine
00045 {
00046
00047
00048 #ifdef WIN32
00049 # ifdef _MSC_VER
00050 # pragma warning( disable : 4231 )
00051 # endif
00052 # ifndef __HAVE_VECTOR_NESRTNODE
00053 UDTVectorEXPIMP( class SRTNode* );
00054 # define __HAVE_VECTOR_NESRTNODE
00055 # endif
00056 #endif
00057
00058
00067 class NEOENGINE_API SRTNode
00068 {
00069 protected:
00070
00072 float m_fScaling;
00073
00075 Quaternion m_kRotation;
00076
00078 Vector3d m_kTranslation;
00079
00080
00081
00082
00083 public:
00084
00085
00088 SRTNode() : m_fScaling( 1.0f ) {}
00089
00095 SRTNode( float fScaling, const Quaternion &rkRotation, const Vector3d &rkTranslation ) : m_fScaling( 1.0f ), m_kRotation( rkRotation ), m_kTranslation( rkTranslation ) {}
00096
00100 SRTNode( const SRTNode &rkNode ) : m_fScaling( rkNode.m_fScaling ), m_kRotation( rkNode.m_kRotation ), m_kTranslation( rkNode.m_kTranslation ) {}
00101
00105 inline const Vector3d &GetTranslation() const { return m_kTranslation; }
00106
00110 inline const Quaternion &GetRotation() const { return m_kRotation; }
00111
00115 inline float GetScaling() const { return m_fScaling; }
00116
00124 inline void Translate( const Vector3d &rkTranslation, bool bNotifyUpdate = true ) { SetTranslation( m_kTranslation + ( m_kRotation * rkTranslation ), bNotifyUpdate ); }
00125
00133 inline void TranslateWorld( const Vector3d &rkTranslation, bool bNotifyUpdate = true ) { SetTranslation( rkTranslation + m_kTranslation, bNotifyUpdate ); }
00134
00142 inline void Rotate( const Quaternion &rkRotation, bool bNotifyUpdate = true ) { SetRotation( m_kRotation * rkRotation, bNotifyUpdate ); }
00143
00151 inline void RotateWorld( const Quaternion &rkRotation, bool bNotifyUpdate = true ) { SetRotation( rkRotation * m_kRotation, bNotifyUpdate ); }
00152
00160 inline void Scale( float fScaling, bool bNotifyUpdate = true ) { SetScaling( m_fScaling * fScaling, bNotifyUpdate ); }
00161
00169 inline virtual void SetTranslation( const Vector3d &rkTranslation, bool bNotifyUpdate = true ) { m_kTranslation = rkTranslation; }
00170
00178 inline virtual void SetRotation( const Quaternion &rkRotation, bool bNotifyUpdate = true ) { m_kRotation = rkRotation; }
00179
00187 inline virtual void SetScaling( float fScaling, bool bNotifyUpdate = true ) { m_fScaling = fScaling; }
00188 };
00189
00190
00191 };
00192
00193
00194 #endif