Scene.h

Go to the documentation of this file.
00001 
00002 //    Copyright 2004, SenseGraphics AB
00003 //
00004 //    This file is part of H3D API.
00005 //
00006 //    H3D API is free software; you can redistribute it and/or modify
00007 //    it under the terms of the GNU General Public License as published by
00008 //    the Free Software Foundation; either version 2 of the License, or
00009 //    (at your option) any later version.
00010 //
00011 //    H3D API is distributed in the hope that it will be useful,
00012 //    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 //    GNU General Public License for more details.
00015 //
00016 //    You should have received a copy of the GNU General Public License
00017 //    along with H3D API; if not, write to the Free Software
00018 //    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019 //
00020 //    A commercial license is also available. Please contact us at 
00021 //    www.sensegraphics.com for more information.
00022 //
00023 //
00027 //
00029 #ifndef __SCENE_H__
00030 #define __SCENE_H__
00031 
00032 #include "X3DChildNode.h"
00033 #include "H3DWindowNode.h"
00034 
00035 namespace H3D {
00036 
00045   class H3DAPI_API Scene : public Node {
00046   public:
00047 
00048     typedef TypedMFNode< H3DWindowNode > MFWindow;
00049     typedef TypedSFNode< X3DChildNode > SFChildNode;
00050 
00052     Scene( Inst< SFChildNode > _sceneRoot   = 0,
00053            Inst< MFWindow    > _window      = 0,
00054            Inst< SFFloat     > _frameRate   = 0 );
00055 
00057     ~Scene();
00058 
00061     void setActive( bool _active ) {
00062       active = _active;
00063     }
00064 
00066     bool isActive() {
00067       return active;
00068     }
00069 
00072     virtual void idle();
00073 
00077     static void mainLoop();
00078     
00082     auto_ptr< SFChildNode > sceneRoot;
00083 
00087     auto_ptr< MFWindow >  window;
00088 
00092     auto_ptr< SFFloat >  frameRate;
00093 
00097     static SFTime *time;
00098   
00100     static set< Scene* > scenes;
00101 
00103     static H3DNodeDatabase database;
00104 
00105   protected:
00109     class EventSink: public Field {
00110     public:
00112       EventSink() {
00113         setName( "Scene::eventSink" );
00114       }
00115     protected:
00116       virtual void update();
00117     };
00118   public:
00119     static EventSink *eventSink;
00120 
00121   private:
00122     bool active;
00123     // the time of the start of the last loop.
00124     TimeStamp last_time;
00125 #ifdef USE_HAPTICS
00126     // the TraverseInfo instance from the previous scenegraph loop.
00127     TraverseInfo *last_traverseinfo;
00128 #endif
00129   };
00130 }
00131 
00132 #endif

Generated on Thu Aug 24 12:38:34 2006 for H3D API by  doxygen 1.4.5