Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | Related Pages

node.h

Go to the documentation of this file.
00001 /***************************************************************************
00002                    node.h  -  Base node class with SRT data
00003                              -------------------
00004     begin                : Tue Oct 30 2001
00005     copyright            : (C) 2001 by Reality Rift Studios
00006     email                : mattias@realityrift.com
00007  ***************************************************************************
00008 
00009  The contents of this file are subject to the Mozilla Public License Version
00010  1.1 (the "License"); you may not use this file except in compliance with
00011  the License. You may obtain a copy of the License at 
00012  http://www.mozilla.org/MPL/
00013 
00014  Software distributed under the License is distributed on an "AS IS" basis,
00015  WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00016  for the specific language governing rights and limitations under the
00017  License.
00018 
00019  The Original Code is the NeoEngine, node.h
00020 
00021  The Initial Developer of the Original Code is Mattias Jansson.
00022  Portions created by Mattias Jansson are Copyright (C) 2001
00023  Reality Rift Studios. All Rights Reserved.
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

Generated on Wed Jan 21 14:21:07 2004 for NeoEngine by doxygen 1.3.5