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 
31 class SbViewportRegion;
32 class SoEvent;
33 class SoGLRenderAction;
35 class SoNode;
36 class SoCamera;
37 class SoNodeSensor;
38 class SoOneShotSensor;
39 class SoSensor;
40 class SoRenderManagerP;
41 
42 typedef void SoRenderManagerRenderCB(void * userdata, class SoRenderManager * mgr);
43 
44 class COIN_DLL_API SoRenderManager {
45 public:
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 
72  enum RenderMode {
78  BOUNDING_BOX
79  };
80 
81  enum StereoMode {
85  QUAD_BUFFER = SEPARATE_OUTPUT,
87  INTERLEAVED_COLUMNS
88  };
89 
90  enum BufferType {
92  BUFFER_DOUBLE
93  };
94 
98  VARIABLE_NEAR_PLANE
99  };
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 
192 protected:
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 
218 private:
219  SoRenderManagerP * pimpl;
220  friend class SoRenderManagerP;
221  friend class SoSceneManager;
222  friend class Superimposition;
223 
224 }; // SoRenderManager
225 
226 #endif // !COIN_SORENDERMANAGER_H
Definition: SoRenderManager.h:96
StereoMode
Definition: SoRenderManager.h:81
The SoCamera class is the abstract base class for camera definition nodes.To be able to view a scene...
Definition: SoCamera.h:54
Definition: SoRenderManager.h:74
The SbColor4f class contains the red, green, blue and alpha components which make up a color value...
Definition: SbColor4f.h:33
Definition: SoRenderManager.h:86
The SoNode class is the base class for nodes used in scene graphs.Coin is a retained mode 3D visualiz...
Definition: SoNode.h:47
AutoClippingStrategy
Definition: SoRenderManager.h:95
The SoNodeSensor class detects changes to nodes.Attach a node to a sensor of this type to put it unde...
Definition: SoNodeSensor.h:29
Definition: SoRenderManager.h:84
Definition: SoRenderManager.h:97
BufferType
Definition: SoRenderManager.h:90
The SoSensor class is the abstract base class for all sensors.Sensors is a mechanism in Coin for sche...
Definition: SoSensor.h:34
Definition: SoRenderManager.h:44
Definition: SoRenderManager.h:75
TransparencyType
Definition: SoGLRenderAction.h:52
The SoAudioRenderAction class renders the aural parts of the scene graph.Applying this method at a ro...
Definition: SoAudioRenderAction.h:33
Definition: SoRenderManager.h:82
The SoOneShotSensor class is a sensor which will trigger once.Since SoOneShotSensor is a subclass of ...
Definition: SoOneShotSensor.h:29
Definition: SoRenderManager.h:83
Definition: SoRenderManager.h:76
Definition: SoRenderManager.h:73
The SoEvent class is the base class for all Coin events.Coin contains its own set of event classes...
Definition: SoEvent.h:34
The SoSceneManager class provides the main interface between the scene graph and the GUI toolkit...
Definition: SoSceneManager.h:44
RenderMode
Definition: SoRenderManager.h:72
The SbViewportRegion class is a viewport within a full window.The SbViewportRegion class contains inf...
Definition: SbViewportRegion.h:31
Definition: SoRenderManager.h:77
Definition: SoRenderManager.h:91
The SbVec2s class is a 2 dimensional vector with short integer coordinates.This vector class is used ...
Definition: SbVec2s.h:41
The SoGLRenderAction class renders the scene graph with OpenGL calls.Applying this method at a root n...
Definition: SoGLRenderAction.h:41

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

Generated on Fri Sep 9 2016 for Coin by Doxygen 1.8.5.