SoSceneManager Class Reference
[General]

Manages scene graph rendering and event handling. More...

#include <Inventor/SoSceneManager.h>

List of all members.

Public Types

enum  AntialiasingMode {
  AUTO,
  FXAA,
  SMAA,
  FSAA,
  SUPERSAMPLING,
  ACCUM_BUFFERS = SUPERSAMPLING,
  NO_ANTIALIASING
}

Public Member Functions

 SoSceneManager (int nb=1)
virtual ~SoSceneManager ()
virtual void render ()
virtual SbBool processEvent (const SoEvent *event)
void reinitialize ()
void scheduleRedraw ()
virtual void setSceneGraph (SoNode *newScene)
virtual SoNodegetSceneGraph () const
void setWindowSize (const SbVec2s &newSize, const float &newScale=1.0)
const SbVec2sgetWindowSize () const
void setSize (const SbVec2s &newSize, const float &newScale=1.0)
const SbVec2sgetSize () const
void setOrigin (const SbVec2s &newOrigin)
const SbVec2sgetOrigin () const
void setViewportRegion (const SbViewportRegion &newRegion)
const SbViewportRegiongetViewportRegion () const
void setBackgroundColor (const SbColor &c)
SbColor getBackgroundColor () const
void setBackgroundColorRGBA (const SbColorRGBA &color)
SbColorRGBA getBackgroundColorRGBA () const
void setBackgroundIndex (int index)
int getBackgroundIndex () const
void setRGBMode (SbBool onOrOff)
SbBool isRGBMode () const
void setClearDepth (float depth)
float getClearDepth () const
virtual void activate ()
virtual void deactivate ()
void setAutoInteractiveMode (SbBool flag)
SbBool isAutoInteractiveMode () const
void setInteractive (SbBool flag)
void setRenderCallback (SoSceneManagerRenderCB *f, void *userData=NULL)
SbBool isAutoRedraw () const
void setRedrawPriority (uint32_t priority)
uint32_t getRedrawPriority () const
void setShareContext (SbGLShareContext sc, SbBool issc=TRUE)
void setStillSuperSampling (float quality, float delay)
float getStillSuperSamplingQuality ()
float getStillSuperSamplingDelay ()
void setAntialiasing (const float quality, const AntialiasingMode mode=AUTO)
void setAntialiasing (SoAntialiasingParameters *advancedParameters)
float getAntialiasingQuality () const
SoAntialiasingParametersgetAntialiasingParameters () const
AntialiasingMode getAntialiasingMode () const
void setAntialiasingEventListener (SiAntialiasingEventListener *listener)
SiAntialiasingEventListenergetAntialiasingEventListener () const
void setHandleEventAction (SoHandleEventAction *hea)
SoHandleEventActiongetHandleEventAction () const
void setGLRenderAction (SoGLRenderAction *ra)
SoGLRenderActiongetGLRenderAction () const
void setAbortRenderCallback (SoAbortRenderCB *callback, void *userData=NULL)

Static Public Member Functions

static uint32_t getDefaultRedrawPriority ()
static void enableRealTimeUpdate (SbBool flag)
static SbBool isRealTimeUpdateEnabled ()

Friends

class SoGuiRenderArea
class SoRenderAreaCoreImpl

Deprecated



virtual SoDEPRECATED void render (SbBool clearWindow, SbBool clearZbuffer=TRUE)
SoDEPRECATED void setAntialiasing (SbBool smoothing, int numPasses)
SoDEPRECATED void getAntialiasing (SbBool &smoothing, int &numPasses) const

Detailed Description

Manages scene graph rendering and event handling.

SoSceneManager provides Open Inventor rendering and event handling inside a window provided by the caller. The scene manager is able to render in only a portion of a window if desired. The SoWinRenderArea class employs an SoSceneManager, and handles most all the details for setting up a window, converting Windows messages to Open Inventor events, automatically redrawing the scene when necessary, and so on. It is simplest to use a render area when rendering in an entire window. The SoSceneManager class is available for programmers not using the SoXt / SoWin or SoQt libraries.

SEE ALSO

SoWinRenderArea, SoGLRenderAction, SoHandleEventAction


Member Enumeration Documentation

Enum which indicates the desired antialiasing algorithm.

This is used by the antialiasing API.

See also:
setAntialiasing()
Enumerator:
AUTO 

This is the default mode for antialiasing.

The different algorithms are tested in the following order and the first available is used: SMAA, FSAA, SUPERSAMPLING.

FXAA 

FXAA is a screen space antialiasing algorithm which uses shaders and is applied after the rendering.

The main advantages of this technique are reduced memory footprint and cost.

SMAA 

SMAA is a screen space antialiasing algorithm which uses shaders and is applied after the rendering.

The main advantages of this technique are reduced memory footprint and cost with better quality result than FXAA algorithm.

FSAA 

FSAA is a full-screen antialiasing algorithm based on super-sampling.

The main advantage is the quality of the antialiasing but the memory and speed cost can be huge.
Note: Use the SoFullSceneAntialiasing node to control FSAA during render traversal.
Limitations:

  • Transparency:
    This mode is not compatible with SORTED_PIXEL transparency mode (see SoGLRenderAction::TransparencyType). Use SUPERSAMPLING, FXAA or SMAA instead if you need high quality transparency.
SUPERSAMPLING 

The advantage of this algorithm is it gives high quality images even on lines.

However multiple rendering passes are required, which reduces performance. (Old name was ACCUM_BUFFERS.)

ACCUM_BUFFERS 

Deprecated name of SUPERSAMPLING.

Deprecated:

Deprecated since Open Inventor 9500
It corresponds to the SUPERSAMPLING antialiasing type.
NO_ANTIALIASING 

Turn off antialiasing.


Constructor & Destructor Documentation

SoSceneManager::SoSceneManager ( int  nb = 1  ) 

Constructor.

virtual SoSceneManager::~SoSceneManager (  )  [virtual]

Destructor.


Member Function Documentation

virtual void SoSceneManager::activate (  )  [virtual]

Activates the scene manager.

The scene manager will only employ sensors for automatic redraw while it is active. Typically, the scene manager should be activated whenever its window is visible on the screen, and deactivated when its window is closed or iconified.

virtual void SoSceneManager::deactivate (  )  [virtual]

Deactivates the scene manager.

The scene manager will only employ sensors for automatic redraw while it is active. Typically, the scene manager should be activated whenever its window is visible on the screen, and deactivated when its window is closed or iconified.

static void SoSceneManager::enableRealTimeUpdate ( SbBool  flag  )  [static]

Enables the realTime global field update which normally happen right after a redraw.

SoDEPRECATED void SoSceneManager::getAntialiasing ( SbBool smoothing,
int &  numPasses 
) const
SiAntialiasingEventListener* SoSceneManager::getAntialiasingEventListener (  )  const
See also:
setAntialiasingEventListener().
Returns:
A pointer on the current antialiasing event listener, NULL if there is no listener.
AntialiasingMode SoSceneManager::getAntialiasingMode (  )  const

Returns the antialiasing mode set using the setAntialiasing(float,AntialiasingMode) method.

Returns AUTO by default. Parameters set using the setAntialiasing(SoAntialiasingParameters*) method may change the antialiasing mode, but do not affect the value returned by this method. Therefore this method does not necessarily return the current actual antialiasing mode.

SoAntialiasingParameters* SoSceneManager::getAntialiasingParameters (  )  const

Returns the antialiasing parameters set using the setAntialiasing(SoAntialiasingParameters*) method.

Returns null by default. A quality value set using the setAntialiasing(float,AntialiasingMode) method may modify internal parameters, but does not affect the value returned by this method. Therefore this method does not necessarily return the current actual antialiasing parameters.

float SoSceneManager::getAntialiasingQuality (  )  const

Returns the antialiasing quality set using the setAntialiasing(float,AntialiasingMode) method.

Returns 0.0 by default. Parameters set using the setAntialiasing(SoAntialiasingParameters*) method override internal parameters, but do not affect the value returned by this method. Therefore this method does not necessarily return the current actual antialiasing quality.

SbColor SoSceneManager::getBackgroundColor (  )  const
SbColorRGBA SoSceneManager::getBackgroundColorRGBA (  )  const
int SoSceneManager::getBackgroundIndex (  )  const
float SoSceneManager::getClearDepth (  )  const
See also:
setClearDepth().
static uint32_t SoSceneManager::getDefaultRedrawPriority (  )  [inline, static]

Gets the default priority of the redraw sensor.

SoGLRenderAction* SoSceneManager::getGLRenderAction (  )  const
SoHandleEventAction* SoSceneManager::getHandleEventAction (  )  const
const SbVec2s& SoSceneManager::getOrigin (  )  const
See also:
setOrigin().
uint32_t SoSceneManager::getRedrawPriority (  )  const
virtual SoNode* SoSceneManager::getSceneGraph (  )  const [virtual]
See also:
setSceneGraph().
const SbVec2s& SoSceneManager::getSize (  )  const
See also:
setSize().
float SoSceneManager::getStillSuperSamplingDelay (  ) 
float SoSceneManager::getStillSuperSamplingQuality (  ) 
const SbViewportRegion& SoSceneManager::getViewportRegion (  )  const
const SbVec2s& SoSceneManager::getWindowSize (  )  const
See also:
setWindowSize().
SbBool SoSceneManager::isAutoInteractiveMode (  )  const
SbBool SoSceneManager::isAutoRedraw (  )  const

Returns TRUE if there is currently a render callback registered.

static SbBool SoSceneManager::isRealTimeUpdateEnabled (  )  [static]
SbBool SoSceneManager::isRGBMode (  )  const
See also:
setRGBMode().
virtual SbBool SoSceneManager::processEvent ( const SoEvent event  )  [virtual]

Processes the passed event by applying an SoHandleEventAction to the scene graph managed here.

Returns TRUE if the event was handled by a node.

void SoSceneManager::reinitialize (  ) 

Reinitializes graphics.

This should be called, for instance, when there is a new window.

virtual SoDEPRECATED void SoSceneManager::render ( SbBool  clearWindow,
SbBool  clearZbuffer = TRUE 
) [virtual]
See also:
render().
Deprecated:

Deprecated since Open Inventor 10100
No longer used and the parameters are ignored. Use render() instead.
virtual void SoSceneManager::render (  )  [virtual]

Applies an SoGLRenderAction to the scene graph managed here.

Note that this method just applies an SoGLRenderAction that traverses the scene graph and makes the necessary rendering calls for each node. It is not the same as calling the render method on an Open Inventor render area or viewer object. The viewer's render method will typically do pre-rendering operations like adjusting the near/far clip planes, as well as post-rendering operations like calling "swap buffers" to make the rendered content visible. Also it is possible to call a viewer's render method without explicitly making an OpenGL render context current (the viewer takes care of that).

When calling this method, the application is responsible for providing a current OpenGL render context that is known to Open Inventor through an SoGLContext object. If there is no current OpenGL render context, Open Inventor may throw an exception or crash, depending on the API language and system environment.

  • If the application is using an Open Inventor render area or viewer and wants to render in that window, there may not be an OpenGL render context current. However the viewer's render context can be made current by calling the viewer's bindNormalContext() method. Call the viewer's unbindNormalContext() method after calling render().
     viewer->bindNormalContext();
     viewer->getSceneManager()->render();
     viewer->unbindNormalContext();
  • This method is more likely to be used in cases where there is no Open Inventor render area or viewer. For example when integrating Open Inventor rendering in an OpenGL application. If the application has its own OpenGL render context that is already current, you can call the static SoGLContext method getCurrent(true) to get an SoGLContext object that wraps the current context. Then call bind and unbind on the returned object. (Note that this method will return null if there is no current context.)
     SoGLContext* ctx = SoGLContext::getCurrent( true );
     ctx->bind();
     viewer->getSceneManager()->render();
     ctx->unbind();
void SoSceneManager::scheduleRedraw (  ) 

Schedules a redraw for some time in the near future.

If there is no render callback set, or this is not active, no redraw will be scheduled.

void SoSceneManager::setAbortRenderCallback ( SoAbortRenderCB callback,
void *  userData = NULL 
)

Setup a callback that returns TRUE if rendering should be aborted.

It allows some Open Inventor nodes to stop their work, if requested, in order to keep reasonable interactivity.

When using Open Inventor standard GUI classes, the callback is setup by default to return TRUE if MousePress events are pending during a STILL frame.

Since Open Inventor 9.5

SoDEPRECATED void SoSceneManager::setAntialiasing ( SbBool  smoothing,
int  numPasses 
)

Enables smoothing and/or multi-pass antialiasing for rendering.


There are two kinds of antialiasing available: smoothing and multipass antialiasing. If smoothing is set to TRUE, smoothing is enabled. Smoothing uses OpenGL's line- and point-smoothing features to provide cheap antialiasing of lines and points. The value of numPasses controls multipass antialiasing. Each time a render action is applied, Open Inventor renders the scene numPasses times from slightly different camera positions, averaging the results. numPasses can be from one to 255, inclusive. Setting numPasses to one disables multipass antialiasing. You can use either, both, or neither of these antialiasing techniques. By default, both smoothing and multipass antialiasing are disabled.

Deprecated:

Deprecated since Open Inventor 9100
To enable smoothing and/or multi-pass antialiasing for rendering use the setAntialiasing(float,AntialiasingMode) method with mode SUPERSAMPLING or use the setAntialiasing(SoAntialiasingParameters*) method with an SoAccumulationAntialiasingParameters object.
void SoSceneManager::setAntialiasing ( SoAntialiasingParameters advancedParameters  ) 

Enable (or disable) antialiasing with specific parameters.

Use one of the subclasses of SoAntialiasingParameters. The antialiasing mode is determined by which subclass is used to set the parameters. For example, passing an SoFXAAParameters object automatically sets FXAA mode. Note that the parameters are overridden if a quality and mode are subsequently set using the setAntialiasing(float,AntialiasingMode) method.

NOTES

    • The caller is responsible for allocation and destruction of the advancedParameters object. SoSceneManager makes a copy of the parameter values, so the object can be destroyed after calling this method.
    Parameters:
    advancedParameters Provides specific parameters for an antialiasing mode.
    Use a null parameter to turn off antialiasing or use one of the subclasses of SoAntialiasingParameters.
void SoSceneManager::setAntialiasing ( const float  quality,
const AntialiasingMode  mode = AUTO 
)

Enable (or disable) antialiasing with specified quality and mode.

Specific antialiasing parameters will be set automatically based on the quality value. Note that the quality and mode settings are overridden if specific antialiasing parameters are subsequently set using the setAntialiasing(SoAntialiasingParameters*) method.

The default mode is AUTO but this may be overridden by setting the environment variable OIV_ANTIALIASING_DEFAULT_MODE (see SoPreferences).

Parameters:
quality The quality is a factor in the range [0.0,1.0].
Use the value 0.0 to turn off antialiasing. 0.5 is a typical value.
mode The antialiasing algorithm. Default is AUTO, which means use the best for the current hardware.
Use the value NO_ANTIALIASING to turn off antialiasing.
void SoSceneManager::setAntialiasingEventListener ( SiAntialiasingEventListener listener  ) 

Sets an event listener which is called when the antialiasing configuration is modified.

It is useful to define this listener because the scene manager is not responsible for the pixelformat changes required for the FSAA and accumulation algorithms. The Open Inventor viewer classes use the listener to automatically switch the pixel format (not necessary for application to handle this when using a viewer class).

Parameters:
listener The listener object.
void SoSceneManager::setAutoInteractiveMode ( SbBool  flag  ) 

Defines the auto interactive mode.

Default is FALSE.

When this mode is activated, the sceneManager will decide depending on scenegraph changes to switch to interactive mode or not.

Default value can be changed through OIV_AUTO_INTERACTIVE_MODE envvar.

Since Open Inventor 9.2

void SoSceneManager::setBackgroundColor ( const SbColor c  ) 

Defines the window background color when in RGB mode.

This is the color the scene manager viewport is cleared to when render() is called. Default is black (0,0,0). See also setBackgroundColorRGBA().

Setting the background color will automatically call the scheduleRedraw() method.

The default value can be set using the environment variable OIV_BACKGROUND_COLOR. Specify three floats (R, G, B) in the range 0. to 1., separated by spaces.

void SoSceneManager::setBackgroundColorRGBA ( const SbColorRGBA color  ) 

Defines the window background color when in RGBA mode.

This is the color the scene manager viewport is cleared to when render() is called. Default is transparent black (0,0,0,0).

The default RGB color (but NOT alpha) can be set using the environment variable OIV_BACKGROUND_COLOR or by calling setBackgroundColor().

Parameters:
color RGBA background color
void SoSceneManager::setBackgroundIndex ( int  index  ) 

Defines the window background color when in color index mode.

This is the color the scene manager viewport is cleared to when render() is called. Default is black (index 0).

void SoSceneManager::setClearDepth ( float  depth  ) 

Defines the depth value used when the depth buffer is cleared.

The default value is 1. This is the value used to clear the depth buffer when render() is called.

Parameters:
depth value used to clear the depth buffer. Value is clamped to the range [0,1].
void SoSceneManager::setGLRenderAction ( SoGLRenderAction ra  ) 

User supplied render action.

Highlights fall into this category. SceneManager will never delete a render action passed to this method. return the renderAction 0.

Since Open Inventor 9.2

void SoSceneManager::setHandleEventAction ( SoHandleEventAction hea  ) 

User supplied handle event action.

This should not be done in the middle of event handling. Passing NULL turns event handling off. SceneManager will never delete a handle event action passed to this method.

Since Open Inventor 9.2

void SoSceneManager::setInteractive ( SbBool  flag  ) 

Indicates that the scene manager is in interactive mode or not.

This is usually called by Inventor viewer classes, but it is also usefull for custom application viewer.

It mainly setup SoInteractionElement for all used actions (preRenderAction and renderAction).

Since Open Inventor 9.2

void SoSceneManager::setOrigin ( const SbVec2s newOrigin  ) 

Defines the origin of the viewport within the window.

The origin (0,0) is the lower left corner of the window.

void SoSceneManager::setRedrawPriority ( uint32_t  priority  ) 

Sets the priority of the redraw sensor.

Sensors are processed based on priority, with priority values of 0 processed immediately. The default priority for the scene manager redraw sensor is 10000.

void SoSceneManager::setRenderCallback ( SoSceneManagerRenderCB f,
void *  userData = NULL 
)

The render callback provides a mechanism for automatically redrawing the scene in response to changes in the scene graph.

The scene manager employs a sensor to detect scene graph changes. When the sensor is triggered, the render callback registered here is invoked. If the callback is set to NULL (the default), auto-redraw is turned off.

If the application is not using an Open Inventor render area or viewer, the callback should make sure that an OpenGL render context is current, then call the scene manager render() method. See the render() method for more information.

If the application is using an Open Inventor render area or viewer, then the callback should call render() method on the render area or viewer object.

The callback should not modify any nodes in the scene graph before or after calling the render() method. The modification will be detected by the scene manager, which will schedule another call to the render callback, resulting in continuous calls to the render callback. If necessary the callback can temporarily disable notification by calling enableNotify() on the node that will be modified.

void SoSceneManager::setRGBMode ( SbBool  onOrOff  ) 

Defines the color mode (TRUE - RGB mode, FALSE - color map mode).

Default is RGB mode. Only a subset of Open Inventor nodes will render correctly in color map mode. Basically, when in color index mode, lighting should be turned off (the model field of SoLightModel should be set to BASE_COLOR ), and the SoColorIndex node should be used to specify colors.

virtual void SoSceneManager::setSceneGraph ( SoNode newScene  )  [virtual]

Defines the scene graph which is managed here.

This is the Open Inventor scene which will be traversed for rendering and event processing.

void SoSceneManager::setShareContext ( SbGLShareContext  sc,
SbBool  issc = TRUE 
)

Sets the OpenGL context to be shared by the scene manager.

This avoids the necessity to re-generate textures and display lists if they are already available in another OpenGL context (another viewer context, for instance).

void SoSceneManager::setSize ( const SbVec2s newSize,
const float &  newScale = 1.0 
)

Defines the size of the viewport within the window.

Default is to render the entire window region.

void SoSceneManager::setStillSuperSampling ( float  quality,
float  delay 
)

Set options for supersampling when "still" (not interacting).

When quality is greater than 0, still images will be automatically supersampled.

Parameters:
quality The quality is a factor in the range [0.0,1.0].
Use the value 0.0 to turn off still supersampling. 0.5 is a typical value.
delay The delay is in seconds.
If greater than 0, images will be supersampled after the specified delay
void SoSceneManager::setViewportRegion ( const SbViewportRegion newRegion  ) 

Defines current viewport region to use for rendering.

This can be used instead of setting the size and origin separately.

void SoSceneManager::setWindowSize ( const SbVec2s newSize,
const float &  newScale = 1.0 
)

Defines the size of the window in which the scene manager should render.

This size must be set before render() and processEvent() are called.


Friends And Related Function Documentation

friend class SoGuiRenderArea [friend]
friend class SoRenderAreaCoreImpl [friend]

The documentation for this class was generated from the following file:

Open Inventor Toolkit reference manual, generated on 16 Sep 2021
Copyright © Thermo Fisher Scientific All rights reserved.
http://www.openinventor.com/