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

scenenode.h

Go to the documentation of this file.
00001 /***************************************************************************
00002         scenenode.h  -  Base class for hierarchies in a scene graph
00003                              -------------------
00004     begin                : Sat Jan 25 2003
00005     copyright            : (C) 2003 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, scenenode.h
00020 
00021  The Initial Developer of the Original Code is Mattias Jansson.
00022  Portions created by Mattias Jansson are Copyright (C) 2003
00023  Reality Rift Studios. All Rights Reserved.
00024 
00025  ***************************************************************************/
00026 
00027 #ifndef __NESCENENODE_H
00028 #define __NESCENENODE_H
00029 
00030 
00037 #include "base.h"
00038 #include "hierarchynode.h"
00039 #include "updateentity.h"
00040 #include "renderentity.h"
00041 #include "boundingvolume.h"
00042 
00043 #include <vector>
00044 #include <string>
00045 
00046 
00047 namespace NeoEngine
00048 {
00049 
00050 
00051 // External classes
00052 class SceneEntity;
00053 class Room;
00054 
00055 
00056 #ifdef WIN32
00057 
00058 #  ifdef _MSC_VER
00059 #    pragma warning( disable : 4231 )
00060 #  endif
00061 
00062 #  ifndef __HAVE_VECTOR_NESCENENODE
00063      UDTVectorEXPIMP( class SceneNode* );
00064 #    define __HAVE_VECTOR_NESCENENODE
00065 #  endif
00066 
00067 #  ifdef _MSC_VER
00068 #    ifndef __HAVE_NEHIERARCHYNODE_NESCENENODE
00069        EXPIMP_TEMPLATE template class NEOENGINE_API HierarchyNode< class SceneNode >;
00070 #      define __HAVE_NEHIERARCHYNODE_NESCENENODE
00071 #    endif
00072 #  endif
00073 
00074 #endif
00075 
00076 
00093 class NEOENGINE_API SceneNode : public virtual UpdateEntity, public virtual RenderEntity, public HierarchyNode<SceneNode>
00094 {
00095     public:
00096 
00097         DefineVisitable();
00098 
00099     
00100     protected:
00101 
00103         SceneEntity                                  *m_pkEntity;
00104 
00106         BoundingVolume                               *m_pkBoundingVolume;
00107 
00109         bool                                          m_bNeedVolumeUpdate;
00110 
00112         bool                                          m_bIgnoreVolumeUpdate;
00113 
00114 
00119         virtual bool                                  UpdateWorld();
00120 
00125         virtual bool                                  UpdateVolume();
00126 
00131         inline virtual SceneNode                     *Get() { return this; }
00132 
00133 
00134     public:
00135 
00137         Room                                         *m_pkRoom;
00138 
00140         bool                                          m_bIgnoreVolume;
00141 
00142 
00150                                                       SceneNode( const HashString &rstrName = "", SceneNode *pkParent = 0, BoundingVolume::BOUNDINGVOLUMETYPE eVolume = BoundingVolume::BV_AABB );
00151 
00157                                                       SceneNode( SceneNode &rkNode, bool bDuplicateChildren = true );
00158 
00162         virtual                                      ~SceneNode();
00163 
00171         inline virtual void                           NotifyUpdate( bool bRecurse = true ) { HierarchyNode<SceneNode>::NotifyUpdate( bRecurse ); NotifyVolumeUpdate( bRecurse ); }
00172 
00179         inline virtual void                           NotifyVolumeUpdate( bool bRecurse = true ) { m_bNeedVolumeUpdate = true; if( !bRecurse || !m_pkParent || m_bIgnoreVolumeUpdate ) return; m_pkParent->NotifyVolumeUpdate( true ); }
00180 
00186         virtual void                                  Update( float fDeltaTime );
00187 
00194         virtual bool                                  Render( Frustum *pkFrustum = 0, bool bForce = false );
00195 
00200         inline BoundingVolume                        *GetBoundingVolume() { if( m_bWorldUpdate ) UpdateWorld(); if( m_bNeedVolumeUpdate ) UpdateVolume(); return m_pkBoundingVolume; }
00201 
00206         void                                          SetBoundingVolume( BoundingVolume *pkVolume );
00207 
00212         inline SceneEntity                           *GetEntity() { return m_pkEntity; }
00213 
00220         void                                          SetEntity( SceneEntity *pkEntity, bool bDeleteOld = true );
00221 
00226         void                                          PrintHierarchy( unsigned int uiLevel = 0 );
00227 
00232         virtual SceneNode                            *Duplicate();
00233 
00238         virtual void                                  TraverseNode( BaseVisitor &rkVisitor );
00239 
00246         virtual bool                                  Intersection( BoundingVolume *pkObj, ContactSet *pkContactSet = 0 );
00247 
00254         virtual bool                                  Intersection( const Ray &rkRay, ContactSet *pkContactSet = 0 );
00255 };
00256 
00257 
00258 };
00259 
00260 
00261 #endif

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