Coin Logo http://www.sim.no/
http://www.coin3d.org/

SoRenderManager.h
1#ifndef COIN_SORENDERMANAGER_H
2#define COIN_SORENDERMANAGER_H
3
4/**************************************************************************\
5 *
6 * This file is part of the Coin 3D visualization library.
7 * Copyright (C) by Kongsberg Oil & Gas Technologies.
8 *
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * ("GPL") version 2 as published by the Free Software Foundation.
12 * See the file LICENSE.GPL at the root directory of this source
13 * distribution for additional information about the GNU GPL.
14 *
15 * For using Coin with software that can not be combined with the GNU
16 * GPL, and for taking advantage of the additional benefits of our
17 * support services, please contact Kongsberg Oil & Gas Technologies
18 * about acquiring a Coin Professional Edition License.
19 *
20 * See http://www.coin3d.org/ for more information.
21 *
22 * Kongsberg Oil & Gas Technologies, Bygdoy Alle 5, 0257 Oslo, NORWAY.
23 * http://www.sim.no/ sales@sim.no coin-support@coin3d.org
24 *
25\**************************************************************************/
26
27#include <Inventor/SbColor4f.h>
28#include <Inventor/SbVec2s.h>
29#include <Inventor/actions/SoGLRenderAction.h>
30
32class SoEvent;
35class SoNode;
36class SoCamera;
37class SoNodeSensor;
38class SoOneShotSensor;
39class SoSensor;
40class SoRenderManagerP;
41
42typedef void SoRenderManagerRenderCB(void * userdata, class SoRenderManager * mgr);
43
44class COIN_DLL_API SoRenderManager {
45public:
46
47 class COIN_DLL_API Superimposition {
48 public:
49 enum StateFlags {
50 ZBUFFERON = 0x0001,
51 CLEARZBUFFER = 0x0002,
52 AUTOREDRAW = 0x0004,
53 BACKGROUND = 0x0008
54 };
55
56 Superimposition(SoNode * scene,
57 SbBool enabled,
58 SoRenderManager * manager,
59 uint32_t flags);
60 ~Superimposition();
61
62 void render(SoGLRenderAction * action, SbBool clearcolorbuffer = FALSE);
63 void setEnabled(SbBool yes);
64 int getStateFlags(void) const;
65 void setTransparencyType(SoGLRenderAction::TransparencyType transparencytype);
66
67 private:
68 static void changeCB(void * data, SoSensor * sensor);
69 class SuperimpositionP * pimpl;
70 };
71
80
85 QUAD_BUFFER = SEPARATE_OUTPUT,
87 INTERLEAVED_COLUMNS
88 };
89
92 BUFFER_DOUBLE
93 };
94
100
101 SoRenderManager(void);
102 virtual ~SoRenderManager();
103
104 virtual void render(const SbBool clearwindow = TRUE,
105 const SbBool clearzbuffer = TRUE);
106
107 virtual void render(SoGLRenderAction * action,
108 const SbBool initmatrices = TRUE,
109 const SbBool clearwindow = TRUE,
110 const SbBool clearzbuffer = TRUE);
111
112 Superimposition * addSuperimposition(SoNode * scene,
113 uint32_t flags =
114 Superimposition::AUTOREDRAW |
115 Superimposition::ZBUFFERON |
116 Superimposition::CLEARZBUFFER);
117
118 void removeSuperimposition(Superimposition * s);
119
120 virtual void setSceneGraph(SoNode * const sceneroot);
121 virtual SoNode * getSceneGraph(void) const;
122
123 void setCamera(SoCamera * camera);
124 SoCamera * getCamera(void) const;
125
126 void setAutoClipping(AutoClippingStrategy autoclipping);
127 void attachRootSensor(SoNode * const sceneroot);
128 void attachClipSensor(SoNode * const sceneroot);
129 void detachRootSensor(void);
130 void detachClipSensor(void);
131
132 AutoClippingStrategy getAutoClipping(void) const;
133 void setNearPlaneValue(float value);
134 float getNearPlaneValue(void) const;
135 void setTexturesEnabled(const SbBool onoff);
136 SbBool isTexturesEnabled(void) const;
137 void setDoubleBuffer(const SbBool enable);
138 SbBool isDoubleBuffer(void) const;
139 void setRenderMode(const RenderMode mode);
140 RenderMode getRenderMode(void) const;
141 void setStereoMode(const StereoMode mode);
142 StereoMode getStereoMode(void) const;
143 void setStereoOffset(const float offset);
144 float getStereoOffset(void) const;
145
146 void setRenderCallback(SoRenderManagerRenderCB * f,
147 void * const userData = NULL);
148
149 SbBool isAutoRedraw(void) const;
150 void setRedrawPriority(const uint32_t priority);
151 uint32_t getRedrawPriority(void) const;
152
153 static void nodesensorCB(void * data, SoSensor *);
154 static void prerendercb(void * userdata, SoGLRenderAction * action);
155
156 void reinitialize(void);
157 void scheduleRedraw(void);
158 void setWindowSize(const SbVec2s & newsize);
159 const SbVec2s & getWindowSize(void) const;
160 void setSize(const SbVec2s & newsize);
161 const SbVec2s & getSize(void) const;
162 void setOrigin(const SbVec2s & newOrigin);
163 const SbVec2s & getOrigin(void) const;
164 void setViewportRegion(const SbViewportRegion & newRegion);
165 const SbViewportRegion & getViewportRegion(void) const;
166 void setBackgroundColor(const SbColor4f & color);
167 const SbColor4f & getBackgroundColor(void) const;
168 void setBackgroundIndex(const int index);
169 int getBackgroundIndex(void) const;
170 void setRGBMode(const SbBool onOrOff);
171 SbBool isRGBMode(void) const;
172 virtual void activate(void);
173 virtual void deactivate(void);
174
175 void setAntialiasing(const SbBool smoothing, const int numPasses);
176 void getAntialiasing(SbBool & smoothing, int & numPasses) const;
177 void setGLRenderAction(SoGLRenderAction * const action);
178 SoGLRenderAction * getGLRenderAction(void) const;
179 void setAudioRenderAction(SoAudioRenderAction * const action);
180 SoAudioRenderAction * getAudioRenderAction(void) const;
181
182 static void enableRealTimeUpdate(const SbBool flag);
183 static SbBool isRealTimeUpdateEnabled(void);
184 static uint32_t getDefaultRedrawPriority(void);
185
186 void addPreRenderCallback(SoRenderManagerRenderCB * cb, void * data);
187 void removePreRenderCallback(SoRenderManagerRenderCB * cb, void * data);
188
189 void addPostRenderCallback(SoRenderManagerRenderCB * cb, void * data);
190 void removePostRenderCallback(SoRenderManagerRenderCB * cb, void * data);
191
192protected:
193 int isActive(void) const;
194 void redraw(void);
195
196 void renderScene(SoGLRenderAction * action,
197 SoNode * scene,
198 uint32_t clearmask);
199
200 void actuallyRender(SoGLRenderAction * action,
201 const SbBool initmatrices = TRUE,
202 const SbBool clearwindow = TRUE,
203 const SbBool clearzbuffer = TRUE);
204
205 void renderSingle(SoGLRenderAction * action,
206 SbBool initmatrices,
207 SbBool clearwindow,
208 SbBool clearzbuffer);
209
210 void renderStereo(SoGLRenderAction * action,
211 SbBool initmatrices,
212 SbBool clearwindow,
213 SbBool clearzbuffer);
214
215 void initStencilBufferForInterleavedStereo(void);
216 void clearBuffers(SbBool color, SbBool depth);
217
218private:
219 SoRenderManagerP * pimpl;
220 friend class SoRenderManagerP;
221 friend class SoSceneManager;
222 friend class Superimposition;
223
224}; // SoRenderManager
225
226#endif // !COIN_SORENDERMANAGER_H
The SbColor4f class contains the red, green, blue and alpha components which make up a color value.
Definition SbColor4f.h:33
The SbVec2s class is a 2 dimensional vector with short integer coordinates.
Definition SbVec2s.h:41
The SbViewportRegion class is a viewport within a full window.
Definition SbViewportRegion.h:31
The SoAudioRenderAction class renders the aural parts of the scene graph.
Definition SoAudioRenderAction.h:33
The SoCamera class is the abstract base class for camera definition nodes.
Definition SoCamera.h:54
The SoEvent class is the base class for all Coin events.
Definition SoEvent.h:34
The SoGLRenderAction class renders the scene graph with OpenGL calls.
Definition SoGLRenderAction.h:41
TransparencyType
Definition SoGLRenderAction.h:52
The SoNodeSensor class detects changes to nodes.
Definition SoNodeSensor.h:29
The SoNode class is the base class for nodes used in scene graphs.
Definition SoNode.h:47
The SoOneShotSensor class is a sensor which will trigger once.
Definition SoOneShotSensor.h:29
Definition SoRenderManager.h:44
StereoMode
Definition SoRenderManager.h:81
@ ANAGLYPH
Definition SoRenderManager.h:83
@ SEPARATE_OUTPUT
Definition SoRenderManager.h:84
@ INTERLEAVED_ROWS
Definition SoRenderManager.h:86
@ MONO
Definition SoRenderManager.h:82
RenderMode
Definition SoRenderManager.h:72
@ WIREFRAME
Definition SoRenderManager.h:74
@ AS_IS
Definition SoRenderManager.h:73
@ HIDDEN_LINE
Definition SoRenderManager.h:77
@ WIREFRAME_OVERLAY
Definition SoRenderManager.h:76
@ POINTS
Definition SoRenderManager.h:75
AutoClippingStrategy
Definition SoRenderManager.h:95
@ FIXED_NEAR_PLANE
Definition SoRenderManager.h:97
@ NO_AUTO_CLIPPING
Definition SoRenderManager.h:96
BufferType
Definition SoRenderManager.h:90
@ BUFFER_SINGLE
Definition SoRenderManager.h:91
The SoSceneManager class provides the main interface between the scene graph and the GUI toolkit.
Definition SoSceneManager.h:44
The SoSensor class is the abstract base class for all sensors.
Definition SoSensor.h:34

Copyright © 1998-2010 by Kongsberg Oil & Gas Technologies. All rights reserved.

Generated on Wed Jul 17 2024 for Coin by Doxygen 1.12.0.