Coin
4.0.3
Coin3D core library
|
The SoRenderManager class is used for controlling the rendering of a scene graph. More...
#include <Inventor/SoRenderManager.h>
Classes | |
class | Superimposition |
Public Types | |
enum | AutoClippingStrategy { NO_AUTO_CLIPPING , FIXED_NEAR_PLANE , VARIABLE_NEAR_PLANE } |
enum | BufferType { BUFFER_SINGLE , BUFFER_DOUBLE } |
enum | RenderMode { AS_IS , WIREFRAME , POINTS , WIREFRAME_OVERLAY , HIDDEN_LINE , BOUNDING_BOX } |
enum | StereoMode { MONO , ANAGLYPH , SEPARATE_OUTPUT , QUAD_BUFFER = SEPARATE_OUTPUT , INTERLEAVED_ROWS , INTERLEAVED_COLUMNS } |
Static Public Member Functions | |
static void | enableRealTimeUpdate (const SbBool flag) |
static uint32_t | getDefaultRedrawPriority (void) |
static SbBool | isRealTimeUpdateEnabled (void) |
Protected Member Functions | |
void | actuallyRender (SoGLRenderAction *action, const SbBool initmatrices=TRUE, const SbBool clearwindow=TRUE, const SbBool clearzbuffer=TRUE) |
void | clearBuffers (SbBool color, SbBool depth) |
void | initStencilBufferForInterleavedStereo (void) |
int | isActive (void) const |
void | redraw (void) |
void | renderScene (SoGLRenderAction *action, SoNode *scene, uint32_t clearmask) |
void | renderSingle (SoGLRenderAction *action, SbBool initmatrices, SbBool clearwindow, SbBool clearzbuffer) |
Render once in correct draw style. | |
void | renderStereo (SoGLRenderAction *action, SbBool initmatrices, SbBool clearwindow, SbBool clearzbuffer) |
Render scene according to current stereo mode. | |
The SoRenderManager class is used for controlling the rendering of a scene graph.
You can use this class to configure things like clipping planes, rendering mode, stereo rendering and the background color. In earlier versions of Coin/Inventor, this was set up in the GUI toolkits, making it quite hard to make a new Coin viewer for another GUI toolkit. With this new class all that is needed is to create one SoRenderManager instance per viewer/view.
This class does not handle events for the scene graph/viewer. To do that you can use the SoEventManager class.
Strategy for adjusting camera near/far clipping plane
Sets how rendering of primitives is done.
Manages how to render stereoscopic images.
SoRenderManager::SoRenderManager | ( | void | ) |
Constructor.
|
virtual |
Destructor.
Activate rendering and event handling. Default is off
.
|
protected |
Convenience function for SoRenderManager::renderScene
[in] | action | Renders with a user supplied action. |
[in] | initmatrices | If set to TRUE , the projection and modelview matrices are reset to identity. |
[in] | clearwindow | If set to TRUE , clear the rendering buffer before drawing. |
[in] | clearzbuffer | If set to TRUE , clear the depth buffer values before rendering. |
Adds a function to be called after rendering is complete
[in] | cb | function to be called |
[in] | data | User specified data to supply to callback function |
Adds a function to be called before rendering starts
[in] | cb | function to be called |
[in] | data | User specified data to supply to callback function |
SoRenderManager::Superimposition * SoRenderManager::addSuperimposition | ( | SoNode * | scene, |
uint32_t | flags = Superimposition::AUTOREDRAW | Superimposition::ZBUFFERON | Superimposition::CLEARZBUFFER ) |
Add a superimposition for this scene graph. A superimposition can either be a scene rendered in the background, or a scene rendered in the front of the actual scene graph.
This is useful, for instance, if you want to add a gradient or an image in the background, and for having some HUD info in the foreground.
Please note that if you use superimpositions, multipass antialiasing have to be handled in the render manager, and not in SoGLRenderAction, so the pass update features in SoGLRenderAction will be disabled.
|
protected |
Clears buffers with the background color set correctly
[in] | color | Set to TRUE if color buffer should be cleared |
[in] | depth | Set to TRUE if depth buffer should be cleared |
Set whether or not for SoRenderManager instances to "touch" the global realTime
field after a redraw. If this is not done, redrawing when animating the scene will only happen as fast as the realTime
interval goes (which defaults to 12 times a second).
void SoRenderManager::getAntialiasing | ( | SbBool & | smoothing, |
int & | numpasses ) const |
Returns rendering pass information.
SoAudioRenderAction * SoRenderManager::getAudioRenderAction | ( | void | ) | const |
Returns pointer to audio render action.
SoRenderManager::AutoClippingStrategy SoRenderManager::getAutoClipping | ( | void | ) | const |
This method returns the current auto clipping strategy.
Returns color used for clearing the rendering area before rendering the scene.
int SoRenderManager::getBackgroundIndex | ( | void | ) | const |
Returns index of color map for background filling.
|
static |
Returns the default priority of the redraw sensor.
SoGLRenderAction * SoRenderManager::getGLRenderAction | ( | void | ) | const |
Returns pointer to render action.
float SoRenderManager::getNearPlaneValue | ( | void | ) | const |
This method returns the near plane distance value that will be used when the SoRenderManager::FIXED_NEAR_PLANE auto clipping strategy is used.
Default value is 0.6.
Returns origin of rendering area viewport.
uint32_t SoRenderManager::getRedrawPriority | ( | void | ) | const |
Returns value of priority on the redraw sensor.
SoRenderManager::RenderMode SoRenderManager::getRenderMode | ( | void | ) | const |
Returns the current render mode.
Returns the pointer to root of scene graph.
SoRenderManager::StereoMode SoRenderManager::getStereoMode | ( | void | ) | const |
Returns the current stereo mode.
float SoRenderManager::getStereoOffset | ( | void | ) | const |
Returns the current stereo offset.
const SbViewportRegion & SoRenderManager::getViewportRegion | ( | void | ) | const |
Returns current viewport region used by the render action and the event handling.
Returns the current render action window size.
Initializes stencil buffers for interleaved stereo
|
protected |
Returns the active flag.
SbBool SoRenderManager::isAutoRedraw | ( | void | ) | const |
Returns TRUE
if the SoRenderManager automatically redraws the scene upon detecting changes in the scene graph.
The automatic redraw is turned on and off by setting either a valid callback function with setRenderCallback(), or by passing NULL
.
SbBool SoRenderManager::isDoubleBuffer | ( | void | ) | const |
returns if the scene manager is double buffered
|
static |
Returns whether or not we automatically notify everything connected to the realTime
field after a redraw.
SbBool SoRenderManager::isRGBMode | ( | void | ) | const |
Returns the "truecolor or colorindex" mode flag.
SbBool SoRenderManager::isTexturesEnabled | ( | void | ) | const |
Returns whether textures are enabled or not.
Do an immediate redraw by calling the redraw callback function.
Reinitialize after parameters affecting the OpenGL context have changed.
Removes a post render callback.
[in] | cb | function to be called |
[in] | data | User specified data to supply to callback function |
Removes a pre render callback.
[in] | cb | function to be called |
[in] | data | User specified data to supply to callback function |
void SoRenderManager::removeSuperimposition | ( | Superimposition * | s | ) |
Removes a superimposition.
|
virtual |
Render the scene graph.
All SbBool arguments should normally be TRUE
, but they can be set to FALSE
to optimize for special cases (e.g. when doing wireframe rendering one doesn't need a depth buffer).
[in] | clearwindow | If set to TRUE , clear the rendering buffer before drawing. |
[in] | clearzbuffer | If set to TRUE , clear the depth buffer values before rendering. |
|
virtual |
Render the scene graph.
All SbBool arguments should normally be TRUE
, but they can be set to FALSE
to optimize for special cases (e.g. when doing wireframe rendering one doesn't need a depth buffer).
[in] | clearwindow | If set to TRUE , clear the rendering buffer before drawing. |
[in] | clearzbuffer | If set to TRUE , clear the depth buffer values before rendering. |
[in] | initmatrices | If set to TRUE , the projection and modelview matrices are reset to identity. |
[in] | action | Renders with a user supplied action. |
|
protected |
Renders a scene and applies clear state as given by this renderManager
[in] | action | Action to apply |
[in] | scene | Scene to render |
[in] | clearmask | mask to pass to glClear |
|
protected |
Render once in correct draw style.
Convenience function for SoRenderManager::renderScene
[in] | action | Renders with a user supplied action. |
[in] | initmatrices | If set to TRUE , the projection and modelview matrices are reset to identity. |
[in] | clearwindow | If set to TRUE , clear the rendering buffer before drawing. |
[in] | clearzbuffer | If set to TRUE , clear the depth buffer values before rendering. |
|
protected |
Render scene according to current stereo mode.
Convenience function for SoRenderManager::renderScene
[in] | action | Renders with a user supplied action. |
[in] | initmatrices | If set to TRUE , the projection and modelview matrices are reset to identity. |
[in] | clearwindow | If set to TRUE , clear the rendering buffer before drawing. |
[in] | clearzbuffer | If set to TRUE , clear the depth buffer values before rendering. |
Redraw at first opportunity as system becomes idle.
Multiple calls to this method before an actual redraw have taken place will only result in a single redraw of the scene.
Turn antialiased rendering on or off.
See documentation for SoGLRenderAction::setSmoothing() and SoGLRenderAction::setNumPasses().
void SoRenderManager::setAudioRenderAction | ( | SoAudioRenderAction *const | action | ) |
Set the action to use for rendering audio. Overrides the default action made in the constructor.
void SoRenderManager::setAutoClipping | ( | AutoClippingStrategy | autoclipping | ) |
Sets strategy for adjusting camera clipping plane
Set index of background color in the color lookup table if rendering in color index mode.
Note: color index mode is not supported yet in Coin.
Tell the scene manager that double buffering is used
void SoRenderManager::setGLRenderAction | ( | SoGLRenderAction *const | action | ) |
Set the action to use for rendering. Overrides the default action made in the constructor.
void SoRenderManager::setNearPlaneValue | ( | float | value | ) |
When the SoRenderManager::FIXED_NEAR_PLANE auto clipping strategy is used, you set the value of the near plane distance with this method.
Set only the origin of the viewport region within the rendering window.
Set up the redraw priority for the SoOneShotSensor used to trigger redraws. By setting this lower than for your own sensors, you can make sure some code is always run before redraw happens.
void SoRenderManager::setRenderCallback | ( | SoRenderManagerRenderCB * | f, |
void *const | userdata = NULL ) |
Set the callback function f to invoke when rendering the scene. userdata will be passed as the first argument of the function.
void SoRenderManager::setRenderMode | ( | const RenderMode | mode | ) |
Sets the render mode.
Turn RGB true color mode on or off. If you turn true color mode off, color index mode will be used instead.
Set the node which is top of the scene graph we're managing. The sceneroot node reference count will be increased by 1, and any previously set scene graph top node will have its reference count decreased by 1.
Set size of rendering area for the viewport within the current window.
void SoRenderManager::setStereoMode | ( | const StereoMode | mode | ) |
Sets the stereo mode.
Sets the stereo offset used when doing stereo rendering.
Enable/disable textures when rendering. Defaults to TRUE.
void SoRenderManager::setViewportRegion | ( | const SbViewportRegion & | newregion | ) |
Update our SoGLRenderAction's viewport settings.
This will change both the information about window dimensions and the actual viewport size and origin.
Update window size of our SoGLRenderAction's viewport settings.
Note that this will only change the information about window dimensions, the actual viewport size and origin (i.e. the rectangle which redraws are confined to) will stay the same.