Open Inventor Reference
SoSceneManager.h
Go to the documentation of this file.
1/*
2 *
3 * Copyright (C) 2000 Silicon Graphics, Inc. All Rights Reserved.
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * Further, this software is distributed without any warranty that it is
16 * free of the rightful claim of any third person regarding infringement
17 * or the like. Any license provided herein, whether implied or
18 * otherwise, applies only to this software file. Patent licenses, if
19 * any, provided herein do not apply to combinations of this program with
20 * other software, or any other product whatsoever.
21 *
22 * You should have received a copy of the GNU Lesser General Public
23 * License along with this library; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 *
26 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
27 * Mountain View, CA 94043, or:
28 *
29 * http://www.sgi.com
30 *
31 * For further information regarding this notice, see:
32 *
33 * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
34 *
35 */
36
37
55
56#ifndef _SO_SCENE_MANAGER_
57#define _SO_SCENE_MANAGER_
58
59#include <Inventor/SbColor.h>
61
62class SoNodeSensor;
63class SoEvent;
65class SoNode;
66class SoSceneManager;
67class SoSensor;
68class SoSFTime;
69class SoOneShotSensor;
70
72typedef void SoSceneManagerRenderCB(void *userData, SoSceneManager *mgr);
73
74
77
96
98 public:
99
102
105
110 virtual void render(bool clearWindow = TRUE, bool clearZbuffer = TRUE);
114 virtual bool processEvent(const SoEvent *event);
118
123
127 virtual void setSceneGraph(SoNode *newScene);
129 virtual SoNode * getSceneGraph() const;
130
135 void setWindowSize(const SbVec2s &newSize);
137 const SbVec2s & getWindowSize() const;
138
141 void setSize(const SbVec2s &newSize);
143 const SbVec2s & getSize() const;
147 void setOrigin(const SbVec2s &newOrigin);
149 const SbVec2s & getOrigin() const;
150
153 void setViewportRegion(const SbViewportRegion &newRegion);
156
164 const SbColor & getBackgroundColor() const { return bkgColor; }
165
171 virtual void activate();
173 virtual void deactivate();
174
186 void *userData = NULL);
188 bool isAutoRedraw() const { return (renderCB != NULL); }
189
197
199 static uint32_t getDefaultRedrawPriority() { return 10000; }
200
203 static void enableRealTimeUpdate(bool flag);
206 static bool isRealTimeUpdateEnabled() { return updateRealTime; }
207
220 void setAntialiasing(bool smoothing, int numPasses);
222 void getAntialiasing(bool &smoothing, int &numPasses) const;
223
224 SoEXTENDER public:
228 SoGLRenderAction *getGLRenderAction() const { return renderAction; }
229
235 SoHandleEventAction *getHandleEventAction() const { return handleEventAction; }
236
237 protected:
240 bool isActive() const { return active; }
241
243 void redraw();
244
245 private:
246 bool raCreatedHere;
247 bool heaCreatedHere;
248 SoGLRenderAction *renderAction;
249 SoHandleEventAction *handleEventAction;
250 SoNode *scene;
251 SoNodeSensor *sceneSensor;
252 uint32_t redrawPriority;
253 bool active;
254 bool needToSendVP;
255
256 SbColor bkgColor;
257 bool graphicsInitNeeded;
258
260 static void antialiasingCallback(void *);
261 static void sceneSensorCallback(SoSceneManager *, SoSensor *);
262
264 static bool updateRealTime;
265 static SoSFTime *realTime;
266 static SoOneShotSensor *realTimeSensor;
267 static void realTimeSensorCB();
268};
269
270
271#endif // _SO_SCENE_MANAGER_
#define SoEXTENDER
Provide inline template functions for abs, swap, min, max, and clamp.
Definition SbBasic.h:154
#define TRUE
Definition SbBasic.h:76
#define INVENTOR_API
Disable some annoying warnings on MSVC 6.
Definition SbSystem.h:77
unsigned int uint32_t
Definition SbTypeDefs.h:44
void SoSceneManagerRenderCB(void *userData, SoSceneManager *mgr)
callback function prototypes
Color vector class.
Definition SbColor.h:84
2D vector class.
Definition SbLinear.h:354
Class for representing a viewport.
Base class for all events.
Definition SoEvent.h:84
Renders a scene graph using OpenGL.
Allows nodes in a graph to receive input events.
Sensor class that can be attached to Inventor nodes.
Abstract base class for all database nodes.
Definition SoNode.h:103
Sensor for one-time only callbacks.
Field containing an SbTime.
Definition SoSFTime.h:80
Manages scene graph rendering and event handling.
SoHandleEventAction * getHandleEventAction() const
void setWindowSize(const SbVec2s &newSize)
Set the size of the window in which the scene manager should render.
const SbVec2s & getOrigin() const
Get the origin of the viewport within the window.
void setAntialiasing(bool smoothing, int numPasses)
Set the antialiasing for rendering.
void redraw()
This tells the app it is time to redraw by invoking the renderCB.
const SbViewportRegion & getViewportRegion() const
Gets current viewport region to use for rendering.
virtual void setSceneGraph(SoNode *newScene)
Set the scene graph which is managed here.
bool isAutoRedraw() const
Returns TRUE if there is currently a render callback registered.
const SbVec2s & getWindowSize() const
Get the size of the window in which the scene manager should render.
void setRedrawPriority(uint32_t priority)
Set the priority of the redraw sensor.
virtual ~SoSceneManager()
Constructor and destructor.
void getAntialiasing(bool &smoothing, int &numPasses) const
Get the antialiasing for rendering.
static void enableRealTimeUpdate(bool flag)
Enable/Disable the realTime global field update which normally happen right after a redraw.
void setOrigin(const SbVec2s &newOrigin)
Set the origin of the viewport within the window.
void setSize(const SbVec2s &newSize)
Set the size of the viewport within the window.
virtual void render(bool clearWindow=TRUE, bool clearZbuffer=TRUE)
Apply an SoGLRenderAction to the scene graph managed here.
bool isActive() const
void setBackgroundColor(const SbColor &c)
Set the window background color when in RGB mode.
SoSceneManager()
Constructor and destructor.
void reinitialize()
Reinitialize graphics.
void scheduleRedraw()
Schedule a redraw for some time in the near future.
virtual void deactivate()
Deactivate the scene manager.
uint32_t getRedrawPriority() const
Get the priority of the redraw sensor.
SoSceneManagerRenderCB * renderCB
void setViewportRegion(const SbViewportRegion &newRegion)
Sets current viewport region to use for rendering.
virtual SoNode * getSceneGraph() const
Get the scene graph which is managed here.
const SbColor & getBackgroundColor() const
Get the window background color when in RGB mode.
void setHandleEventAction(SoHandleEventAction *hea)
User supplied handle event action.
virtual void activate()
Activate the scene manager.
static uint32_t getDefaultRedrawPriority()
Get the default priority of the redraw sensor.
virtual bool processEvent(const SoEvent *event)
Process the passed event by applying an SoHandleEventAction to the scene graph managed here.
SoGLRenderAction * getGLRenderAction() const
const SbVec2s & getSize() const
Get the size and origin of the viewport within the window.
void setGLRenderAction(SoGLRenderAction *ra)
User supplied render action.
void setRenderCallback(SoSceneManagerRenderCB *f, void *userData=NULL)
The render callback provides a mechanism for automatically redrawing the scene in response to changes...
static bool isRealTimeUpdateEnabled()
Enable/Disable the realTime global field update which normally happen right after a redraw.
Abstract base class for Inventor sensors.
Definition SoSensor.h:108