1SoSceneManager(3IV)() SoSceneManager(3IV)()
2
3
4
6 SoSceneManager — manages scene graph rendering and event handling
7
9 SoSceneManager
10
12 #include <Inventor/SoSceneManager.h>
13
14 typedef void SoSceneManagerRenderCB(void *userData, SoSceneManager
15 *mgr)
16
17 Methods from class SoSceneManager:
18
19 SoSceneManager()
20 ~SoSceneManager()
21 virtual void render(SbBool clearWindow = TRUE, SbBool clearZbuffer
22 = TRUE)
23 virtual SbBool processEvent(const SoEvent *event)
24 void reinitialize()
25 void scheduleRedraw()
26 virtual void setSceneGraph(SoNode *newScene)
27 virtual SoNode * getSceneGraph() const
28 void setWindowSize(const SbVec2s &newSize)
29 const SbVec2s & getWindowSize() const
30 void setSize(const SbVec2s &newSize)
31 const SbVec2s & getSize() const
32 void setOrigin(const SbVec2s &newOrigin)
33 const SbVec2s & getOrigin() const
34 void setBackgroundColor(const SbColor &c)
35 const SbColor & getBackgroundColor() const
36 void setBackgroundIndex(int index)
37 int getBackgroundIndex() const
38 void setRGBMode(SbBool onOrOff)
39 SbBool isRGBMode() const
40 virtual void activate()
41 virtual void deactivate()
42 void setRenderCallback(SoSceneManagerRenderCB *f, void
43 *userData = NULL)
44 SbBool isAutoRedraw() const
45 void setRedrawPriority(uint32_t priority)
46 uint32_t getRedrawPriority() const
47 static uint32_t getDefaultRedrawPriority()
48 static void enableRealTimeUpdate(SbBool flag)
49 static SbBool isRealTimeUpdateEnabled()
50 void setAntialiasing(SbBool smoothing, int numPasses)
51 void getAntialiasing(SbBool &smoothing, int &numPasses)
52 const
53
54
56 SoSceneManager provides Inventor rendering and event handling inside a
57 window provided by the caller. The scene manager is able to render in
58 only a portion of a window if desired. The SoXtRenderArea class employs
59 a SoSceneManager, and handles most all the details for setting up a
60 window, converting X events to Inventor events, automatically redrawing
61 the scene when necessary, and so on. It is simplest to use a render
62 area when rendering in an entire window. The SoSceneManager class is
63 available for programmers not working with the Inventor Xt Component
64 and Utility Library.
65
67 SoSceneManager()
68 ~SoSceneManager()
69 Constructor and destructor.
70
71 virtual void render(SbBool clearWindow = TRUE, SbBool clearZbuffer
72 = TRUE)
73 Apply an SoGLRenderAction to the scene graph managed here. The call‐
74 er is responsible for setting up a window to render into. If clear‐
75 Window is TRUE, this clears the graphics window before rendering. If
76 clearZbuffer is TRUE, the z buffer will be cleared before rendering.
77
78 virtual SbBool processEvent(const SoEvent *event)
79 Process the passed event by applying an SoHandleEventAction to the
80 scene graph managed here. Returns TRUE if the event was handled by a
81 node.
82
83 void reinitialize()
84 Reinitialize graphics. This should be called, for instance, when
85 there is a new window.
86
87 void scheduleRedraw()
88 Schedule a redraw for some time in the near future. If there is no
89 render callback set, or this is not active, no redraw will be sched‐
90 uled.
91
92 virtual void setSceneGraph(SoNode *newScene)
93 virtual SoNode * getSceneGraph() const
94 Set and get the scene graph which is managed here. This is the
95 Inventor scene which will be traversed for rendering and event pro‐
96 cessing.
97
98 void setWindowSize(const SbVec2s &newSize)
99 const SbVec2s & getWindowSize() const
100 Set and get the size of the window in which the scene manager should
101 render. This size must be set before render() and processEvent()
102 are called.
103
104 void setSize(const SbVec2s &newSize)
105 const SbVec2s & getSize() const
106 void setOrigin(const SbVec2s &newOrigin)
107 const SbVec2s & getOrigin() const
108 Set and get the size and origin of the viewport within the window.
109 Default is to render the entire window region. The origin (0,0) is
110 the lower left corner of the window.
111
112 void setBackgroundColor(const SbColor &c)
113 const SbColor & getBackgroundColor() const
114 Set and get the window background color when in RGB mode. This is
115 the color the scene manager viewport is cleared to when render() is
116 called with clearWindow set to TRUE. Default is black (0,0,0).
117
118 void setBackgroundIndex(int index)
119 int getBackgroundIndex() const
120 Set and get the window background color when in color index mode.
121 This is the color the scene manager viewport is cleared to when ren‐
122 der() is called with clearWindow set to TRUE. Default is black
123 (index 0).
124
125 void setRGBMode(SbBool onOrOff)
126 SbBool isRGBMode() const
127 Set and get the color mode (TRUE — RGB mode, FALSE — color map
128 mode). Default is RGB mode. Only a subset of Inventor nodes will
129 render correctly in color map mode. Basically, when in color index
130 mode, lighting should be turned off (the model field of SoLightModel
131 should be set to BASE_COLOR), and the SoColorIndex node should be
132 used to specify colors.
133
134 virtual void activate()
135 virtual void deactivate()
136 Activate and deactivate the scene manager. The scene manager will
137 only employ sensors for automatic redraw while it is active. Typi‐
138 cally, the scene manager should be activated whenever its window is
139 visible on the screen, and deactivated when its window is closed or
140 iconified.
141
142 void setRenderCallback(SoSceneManagerRenderCB *f, void
143 *userData = NULL)
144 The render callback provides a mechanism for automatically redrawing
145 the scene in response to changes in the scene graph. The scene man‐
146 ager employs a sensor to monitor scene graph changes. When the sen‐
147 sor is triggered, the render callback registered here is invoked.
148 The callback should set up its graphics window, then call the scene
149 manager render() method. If the callback is set to NULL (the
150 default), auto-redraw is turned off.
151
152 SbBool isAutoRedraw() const
153 Returns TRUE if there is currently a render callback registered.
154
155 void setRedrawPriority(uint32_t priority)
156 uint32_t getRedrawPriority() const
157 static uint32_t getDefaultRedrawPriority()
158 Set and get the priority of the redraw sensor. Sensors are processed
159 based on priority, with priority values of 0 processed immediately.
160 The default priority for the scene manager redraw sensor is 10000.
161
162 static void enableRealTimeUpdate(SbBool flag)
163 static SbBool isRealTimeUpdateEnabled()
164 Enable/Disable the realTime global field update which normally hap‐
165 pen right after a redraw.
166
167 void setAntialiasing(SbBool smoothing, int numPasses)
168 void getAntialiasing(SbBool &smoothing, int &numPasses)
169 const
170 Set/get the antialiasing for rendering. There are two kinds of
171 antialiasing available: smoothing and multipass antialiasing. If
172 smoothing is set to TRUE, smoothing is enabled. Smoothing uses
173 OpenGL's line- and point-smoothing features to provide cheap
174 antialiasing of lines and points. The value of numPasses controls
175 multipass antialiasing. Each time a render action is applied, Inven‐
176 tor renders the scene numPasses times from slightly different camera
177 positions, averaging the results. numPasses can be from one to 255,
178 inclusive. Setting numPasses to one disables multipass antialiasing.
179 You can use either, both, or neither of these antialiasing tech‐
180 niques. By default, both smoothing and multipass antialiasing are
181 disabled.
182
183
185 SoXtRenderArea, SoGLRenderAction, SoHandleEventAction
186
187
188
189
190 SoSceneManager(3IV)()