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

OSGSimpleSceneManager.h

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002  *                                OpenSG                                     *
00003  *                                                                           *
00004  *                                                                           *
00005  *             Copyright (C) 2000-2002 by the OpenSG Forum                   *
00006  *                                                                           *
00007  *                            www.opensg.org                                 *
00008  *                                                                           *
00009  *   contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de          *
00010  *                                                                           *
00011 \*---------------------------------------------------------------------------*/
00012 /*---------------------------------------------------------------------------*\
00013  *                                License                                    *
00014  *                                                                           *
00015  * This library is free software; you can redistribute it and/or modify it   *
00016  * under the terms of the GNU Library General Public License as published    *
00017  * by the Free Software Foundation, version 2.                               *
00018  *                                                                           *
00019  * This library is distributed in the hope that it will be useful, but       *
00020  * WITHOUT ANY WARRANTY; without even the implied warranty of                *
00021  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU         *
00022  * Library General Public License for more details.                          *
00023  *                                                                           *
00024  * You should have received a copy of the GNU Library General Public         *
00025  * License along with this library; if not, write to the Free Software       *
00026  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.                 *
00027  *                                                                           *
00028 \*---------------------------------------------------------------------------*/
00029 /*---------------------------------------------------------------------------*\
00030  *                                Changes                                    *
00031  *                                                                           *
00032  *                                                                           *
00033  *                                                                           *
00034  *                                                                           *
00035  *                                                                           *
00036  *                                                                           *
00037 \*---------------------------------------------------------------------------*/
00038 
00039 #ifndef _OSGSIMPLESCENEMANAGER_H_
00040 #define _OSGSIMPLESCENEMANAGER_H_
00041 #ifdef __sgi
00042 #pragma once
00043 #endif
00044 
00045 #include <OSGBaseTypes.h>
00046 #include <OSGWindow.h>          
00047 
00048 #include <OSGDrawAction.h>
00049 #include <OSGRenderAction.h>
00050 #include <OSGNode.h>
00051 #include <OSGWindow.h>
00052 #include <OSGImageForeground.h>
00053 #include <OSGTransform.h>
00054 #include <OSGGeometry.h>
00055 #include <OSGGeoPropPtrs.h>
00056 #include <OSGSimpleMaterial.h>
00057 #include <OSGPerspectiveCamera.h>
00058 #include <OSGDirectionalLight.h>
00059 #include <OSGNavigator.h>
00060 #include <OSGStatisticsForeground.h>
00061 
00062 OSG_BEGIN_NAMESPACE
00063 
00068 class OSG_SYSTEMLIB_DLLMAPPING SimpleSceneManager
00069 {
00070     /*==========================  PUBLIC  =================================*/
00071   public:
00072     /*---------------------------------------------------------------------*/
00076     enum {  MouseLeft   =  0,
00077             MouseMiddle =  1, 
00078             MouseRight  =  2,
00079             MouseUp     =  3,
00080             MouseDown   =  4,
00081             NoButton    =  -1
00082          };
00083          
00085     /*---------------------------------------------------------------------*/
00089     SimpleSceneManager(void);
00090     SimpleSceneManager *create( void );
00091 
00093     /*---------------------------------------------------------------------*/
00097     virtual ~SimpleSceneManager(void);
00098 
00100     /*---------------------------------------------------------------------*/
00104     virtual NodePtr              getRoot            ( void );
00105     virtual WindowPtr            getWindow          ( void );
00106     virtual NodePtr              getHighlight       ( void );
00107     virtual DrawActionBase      *getAction          ( void );
00108     virtual Navigator           *getNavigator       ( void );
00109     virtual bool                 getHeadlightState  ( void );
00110     virtual PerspectiveCameraPtr getCamera          ( void );
00111 
00113     /*---------------------------------------------------------------------*/
00117     virtual void  setAction        ( RenderAction *action );
00118     virtual void  setRoot          ( NodePtr root );
00119     virtual void  setWindow        ( WindowPtr win );
00120     virtual void  setHighlight     ( NodePtr obj );
00121     virtual void  setHeadlight     ( bool on );
00122     virtual void  turnHeadlightOn  ( void );
00123     virtual void  turnHeadlightOff ( void );
00124 
00125     virtual void  showAll          ( void );
00126 
00127     virtual void  useOpenSGLogo    ( void );
00128     
00129             void  setNavigationMode( Navigator::Mode new_mode );
00130     inline  bool  setClickCenter   ( bool mode );
00131 
00132     virtual void  setStatistics    ( bool on );
00133 
00135     /*---------------------------------------------------------------------*/
00139     virtual void resize(UInt16 width, UInt16 height);
00140     virtual void mouseMove(Int16 x, Int16 y);
00141     virtual void mouseButtonPress(UInt16 button, Int16 x, Int16 y);
00142     virtual void mouseButtonRelease(UInt16 button, Int16 x, Int16 y);
00143     virtual void key(UChar8 key, Int16 x, Int16 y);
00144 
00145             Line calcViewRay(Int16 x, Int16 y);
00146 
00148     /*---------------------------------------------------------------------*/
00152     virtual void redraw( void );
00153     virtual void idle( void );
00154 
00156     /*---------------------------------------------------------------------*/
00160     bool operator < (const SimpleSceneManager &other) const;
00161 
00162     //bool operator == (const SimpleSceneManager &other) const;
00163     //bool operator != (const SimpleSceneManager &other) const;
00164 
00166     /*=========================  PROTECTED  ===============================*/
00167   protected:
00168 
00169     /*---------------------------------------------------------------------*/
00173             void  initialize      (void);
00174     virtual void  highlightChanged(void);
00175     virtual void  updateHighlight (void);
00176 
00178     /*---------------------------------------------------------------------*/
00182     WindowPtr                    _win;
00183     NodePtr                      _root;
00184 
00185     ImageForegroundPtr           _foreground;
00186     StatisticsForegroundPtr      _statforeground;
00187     bool                         _statstate;
00188 
00189     NodePtr                      _highlight;
00190     NodePtr                      _highlightNode;
00191     GeoPositions3fPtr            _highlightPoints;
00192      
00193     NodePtr                      _internalRoot;
00194     DirectionalLightPtr          _headlight;
00195     RenderAction *               _action;
00196     RenderAction *               _ownAction;
00197     TransformPtr                 _cart;
00198     PerspectiveCameraPtr         _camera;
00199 
00200     Navigator                    _navigator;
00201 
00202     Int16                        _lastx;
00203     Int16                        _lasty;
00204     UInt16                       _mousebuttons;
00205 
00206     static  SimpleMaterialPtr    _highlightMaterial;
00207  
00209     /*==========================  PRIVATE  ================================*/
00210   private:
00211    
00212     /* prohibit default function (move to 'public' if needed) */
00213 
00214     SimpleSceneManager(const SimpleSceneManager &source);
00215     void operator =(const SimpleSceneManager &source);
00216 };
00217 
00218 //---------------------------------------------------------------------------
00219 //   Exported Types
00220 //---------------------------------------------------------------------------
00221 
00222 // class pointer
00223 
00224 typedef SimpleSceneManager *SimpleSceneManagerP;
00225 
00226 OSG_END_NAMESPACE
00227 
00228 #include "OSGSimpleSceneManager.inl"
00229 
00230 #define OSGSIMPLESCENEMANAGER_HEADER_CVSID "@(#)$Id: OSGSimpleSceneManager.h,v 1.11 2001/11/19 18:40:50 dirk Exp $"
00231 
00232 #endif /* _OSGSIMPLESCENEMANAGER_H_ */

Generated on Thu Aug 25 04:10:09 2005 for OpenSG by  doxygen 1.4.3