1 /*---------------------------------------------------------------------------*\
5 * Copyright (C) 2000-2002 by the OpenSG Forum *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
15 * This library is free software; you can redistribute it and/or modify it *
16 * under the terms of the GNU Library General Public License as published *
17 * by the Free Software Foundation, version 2. *
19 * This library is distributed in the hope that it will be useful, but *
20 * WITHOUT ANY WARRANTY; without even the implied warranty of *
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
22 * Library General Public License for more details. *
24 * You should have received a copy of the GNU Library General Public *
25 * License along with this library; if not, write to the Free Software *
26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
28 \*---------------------------------------------------------------------------*/
29 /*---------------------------------------------------------------------------*\
37 \*---------------------------------------------------------------------------*/
39 #ifndef _OSGSIMPLESCENEMANAGER_H_
40 #define _OSGSIMPLESCENEMANAGER_H_
45 #include "OSGConfig.h"
46 #include "OSGUtilDef.h"
48 #include "OSGBaseTypes.h"
50 #include "OSGRenderAction.h"
53 #include "OSGImageForeground.h"
54 #include "OSGTransform.h"
55 #include "OSGGeometry.h"
56 #include "OSGTypedGeoVectorProperty.h"
57 #include "OSGSimpleMaterial.h"
58 #include "OSGCamera.h"
59 #include "OSGDirectionalLight.h"
60 #include "OSGNavigator.h"
61 #include "OSGStatisticsForeground.h"
62 #include "OSGNavigationManager.h"
66 /*! \brief A helper class to simplify managing simple applications.
67 \ingroup GrpUtilNavigation
68 \ingroup GrpLibOSGUtil
71 class OSG_UTIL_DLLMAPPING SimpleSceneManager
: public NavigationManager
73 /*========================== PUBLIC =================================*/
77 OSG_GEN_INTERNAL_MEMOBJPTR(SimpleSceneManager
);
79 /*---------------------------------------------------------------------*/
80 /*! \name Constructors */
83 static ObjTransitPtr
create(void);
86 /*---------------------------------------------------------------------*/
90 virtual Node
*getRoot (void);
91 virtual Node
*getHighlight (void);
92 virtual RenderAction
*getRenderAction (void);
93 virtual bool getHeadlightState(void);
94 virtual DirectionalLight
*getHeadlight (void);
95 virtual Camera
*getCamera (void);
96 virtual Background
*getBackground (void);
97 virtual Node
*getInternalRoot (void);
100 /*---------------------------------------------------------------------*/
104 virtual void setAction (RenderAction
*action
);
106 virtual void setRoot (Node
*root
);
108 virtual void setHighlight (Node
*obj
);
109 virtual void setHeadlight (bool on
);
110 virtual void turnHeadlightOn (void );
111 virtual void turnHeadlightOff (void );
112 virtual void setCamera (Camera
*camera
);
113 virtual void setBackground (Background
*bg
);
115 virtual void setUseTraversalAction(bool s
);
116 virtual bool getUseTraversalAction(void );
118 virtual void showAll (void );
120 virtual void useOpenSGLogo (void );
122 virtual void setStatistics (bool on
);
123 bool getStatistics (void );
125 virtual void addForeground (Foreground
* const fg
);
126 virtual void removeForeground (Foreground
* const fg
);
129 /*---------------------------------------------------------------------*/
130 /*! \name Interaction handling */
133 Line
calcViewRay(Int16 x
, Int16 y
);
136 /*---------------------------------------------------------------------*/
140 virtual void update( void );
141 virtual void redraw( void );
144 /*---------------------------------------------------------------------*/
145 /*! \name Comparison */
148 bool operator < (const SimpleSceneManager
&other
) const;
150 //bool operator == (const SimpleSceneManager &other) const;
151 //bool operator != (const SimpleSceneManager &other) const;
154 /*========================= PROTECTED ===============================*/
158 typedef NavigationManager Inherited
;
160 /*---------------------------------------------------------------------*/
161 /*! \name Constructors */
164 SimpleSceneManager(void);
167 /*---------------------------------------------------------------------*/
168 /*! \name Destructor */
171 virtual ~SimpleSceneManager(void);
174 /*---------------------------------------------------------------------*/
178 void initialize (void);
179 virtual void highlightChanged(void);
180 virtual void updateHighlight (void);
183 /*---------------------------------------------------------------------*/
189 ImageForegroundRecPtr _foreground
;
190 StatisticsForegroundRecPtr _statforeground
;
193 NodeRecPtr _highlight
;
194 NodeRecPtr _highlightNode
;
195 //GeoPositions3fPtr _highlightPoints;
196 GeoPnt3fPropertyRecPtr _highlightPoints
;
198 NodeRecPtr _internalRoot
;
199 DirectionalLightRecPtr _headlight
;
201 /** The RenderAction to use if using render traversals. */
202 RenderActionRefPtr _rtaction
;
204 TransformRecPtr _cart
;
205 CameraRecPtr _camera
;
207 bool _traversalAction
;
209 SimpleMaterialRecPtr _highlightMaterial
;
212 /*========================== PRIVATE ================================*/
215 /* prohibit default function (move to 'public' if needed) */
217 SimpleSceneManager(const SimpleSceneManager
&source
);
218 void operator =(const SimpleSceneManager
&source
);
221 //---------------------------------------------------------------------------
223 //---------------------------------------------------------------------------
227 typedef SimpleSceneManager
*SimpleSceneManagerP
;
229 OSG_GEN_MEMOBJPTR(SimpleSceneManager
);
233 #include "OSGSimpleSceneManager.inl"
235 #endif /* _OSGSIMPLESCENEMANAGER_H_ */