public class SoSceneManager extends Inventor
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 / SoQt or SoWx libraries.
See also:
SoWinRenderArea, SoGLRenderAction
, SoHandleEventAction
Modifier and Type | Class and Description |
---|---|
static interface |
SoSceneManager.AbortRenderTask |
static class |
SoSceneManager.AntialiasingModes
Enum which indicates the desired antialiasing algorithm.
|
Inventor.ConstructorCommand
Modifier and Type | Field and Description |
---|---|
static int |
ACCUM_BUFFERS
Deprecated.
Use
SoSceneManager.AntialiasingModes.ACCUM_BUFFERS instead. |
static int |
AUTO
Deprecated.
Use
SoSceneManager.AntialiasingModes.AUTO instead. |
static int |
FSAA
Deprecated.
Use
SoSceneManager.AntialiasingModes.FSAA instead. |
static int |
FXAA
Deprecated.
Use
SoSceneManager.AntialiasingModes.FXAA instead. |
static int |
NO_ANTIALIASING
Deprecated.
Use
SoSceneManager.AntialiasingModes.NO_ANTIALIASING instead. |
static int |
NUM_ANTIALIASING_MODE
Deprecated.
|
static int |
SMAA
Deprecated.
Use
SoSceneManager.AntialiasingModes.SMAA instead. |
static int |
SUPERSAMPLING
Deprecated.
Use
SoSceneManager.AntialiasingModes.SUPERSAMPLING instead. |
VERBOSE_LEVEL, ZeroHandle
Constructor and Description |
---|
SoSceneManager()
Calls SoSceneManager((int)1).
|
SoSceneManager(int nb)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
activate()
Activates the scene manager.
|
void |
allowRedraw(boolean allowRedraw)
Deprecated.
As of Open Inventor 9.1.
|
void |
deactivate()
Deactivates the scene manager.
|
static void |
enableRealTimeUpdate(boolean flag)
Enables the realTime global field update which normally happen right after a redraw.
|
SiAntialiasingEventListener |
getAntialiasingEventListener()
Returns the current antialiasing listener.
|
SoSceneManager.AntialiasingModes |
getAntialiasingMode()
Returns the antialiasing mode set using the
setAntialiasing(float,AntialiasingMode) method. |
SoAntialiasingParameters |
getAntialiasingParameters()
Returns the antialiasing parameters set using the
setAntialiasing(SoAntialiasingParameters*) method. |
float |
getAntialiasingQuality()
Returns the antialiasing quality set using the
setAntialiasing(float,AntialiasingMode) method. |
SbColor |
getBackgroundColor()
Gets the window background color when in RGB mode.
|
SbColorRGBA |
getBackgroundColorRGBA() |
int |
getBackgroundIndex()
Gets the window background color when in color index mode.
|
float |
getClearDepth() |
static int |
getDefaultRedrawPriority()
Gets the default priority of the redraw sensor.
|
int |
getFloatingPointRenderingPrecision()
Internal usage.
|
SoGLRenderAction |
getGLRenderAction()
Gets the GLRenderAction used for rendering.
|
SoHandleEventAction |
getHandleEventAction()
Gets the HandleEventAction used.
|
SbVec2s |
getOrigin()
Gets the origin of the viewport within the window.
|
int |
getRedrawPriority()
Gets the priority of the redraw sensor.
|
SoNode |
getSceneGraph()
Gets the scene graph which is managed here.
|
SbVec2s |
getSize()
Gets the size of the viewport within the window.
|
float |
getStillSuperSamplingDelay() |
float |
getStillSuperSamplingQuality() |
SbViewportRegion |
getViewportRegion()
Gets current viewport region used for rendering.
|
SbVec2s |
getWindowSize()
Gets the size of the window in which the scene manager should render.
|
boolean |
isAutoInteractiveMode()
Returns true if auto interactive mode is enabled.
|
boolean |
isAutoRedraw()
Returns true if there is currently a render callback registered.
|
static boolean |
isRealTimeUpdateEnabled()
Returns whether realTime global field updating is enabled.
|
boolean |
isRGBMode()
Gets the color mode (true - RGB mode, false - color map mode).
|
boolean |
processEvent(SoEvent event)
Processes the passed event by applying an
SoHandleEventAction to the scene graph managed here. |
void |
reinitialize()
Reinitializes graphics.
|
void |
render()
Calls render(true, true, (int)0, (boolean)false).
|
void |
render(boolean clearWindow)
Calls render(clearWindow, true, (int)0, (boolean)false).
|
void |
render(boolean clearWindow,
boolean clearZbuffer)
Calls render(clearWindow, clearZbuffer, (int)0, (boolean)false).
|
void |
render(boolean clearWindow,
boolean clearZbuffer,
int id)
Calls render(clearWindow, clearZbuffer, id, (boolean)false).
|
void |
render(boolean clearWindow,
boolean clearZbuffer,
int id,
boolean force)
Applies an
SoGLRenderAction to the scene graph managed here. |
void |
scheduleForcedRedraw()
Internal usage.
|
void |
scheduleRedraw()
Schedules a redraw for some time in the near future.
|
void |
setAbortRenderTask(SoSceneManager.AbortRenderTask task)
Setup a task that returns true if action should be aborted.
|
void |
setAntialiasing(boolean smoothing,
int numPasses)
Deprecated.
As of Open Inventor 9100 See documentation for more details
|
void |
setAntialiasing(float quality)
Calls setAntialiasing(quality, SoSceneManager.AntialiasingModes.valueOf( SoSceneManager.AntialiasingModes.AUTO.getValue() )).
|
void |
setAntialiasing(float quality,
SoSceneManager.AntialiasingModes mode)
Enable (or disable) antialiasing with specified quality and mode.
|
void |
setAntialiasing(SoAntialiasingParameters advancedParameters)
Enable (or disable) antialiasing with specific parameters.
|
void |
setAntialiasingEventListener(SiAntialiasingEventListener listener)
Sets an event listener which is called when the antialiasing configuration is modified.
|
void |
setAutoInteractiveMode(boolean flag)
Activate the auto interactive mode.
|
void |
setBackgroundColor(SbColor c)
Sets the window background color when in RGB mode.
|
void |
setBackgroundColorRGBA(SbColorRGBA color)
Defines the window background color when in RGBA mode.
|
void |
setBackgroundIndex(int index)
Defines the window background color when in color index mode.
|
void |
setClearDepth(float depth)
Defines the depth value used when the depth buffer is cleared.
|
void |
setFloatingColorBuffer(boolean enable,
int size)
Internal usage.
|
void |
setGLRenderAction(SoGLRenderAction ra)
User supplied render action.
|
void |
setHandleEventAction(SoHandleEventAction hea)
User supplied handle event action.
|
void |
setInteractive(boolean flag)
Indicates that the scene manager is in interactive mode or not.
|
void |
setOrigin(SbVec2s newOrigin)
Sets the origin of the viewport within the window.
|
void |
setRedrawPriority(int priority)
Sets the priority of the redraw sensor.
|
void |
setRenderTask(java.lang.Runnable renderTask)
The render task provides a mechanism for automatically redrawing the scene
in response to changes in the scene graph.
|
void |
setRGBMode(boolean onOrOff)
Sets the color mode (true - RGB mode, false - color map mode).
|
void |
setSceneGraph(SoNode newScene)
Sets the scene graph which is managed here.
|
void |
setShareContext(SbGLShareContext sc)
Calls setShareContext(sc, true).
|
void |
setShareContext(SbGLShareContext sc,
boolean issc)
Sets the OpenGL context to be shared by the scene manager.
|
void |
setSize(SbVec2s newSize)
Calls setSize(newSize, (float)1.0).
|
void |
setSize(SbVec2s newSize,
float newScale)
Sets the size of the viewport within the window.
|
void |
setStillSuperSampling(float quality,
float delay)
Set options for supersampling when "still" (not interacting).
|
void |
setViewportRegion(SbViewportRegion newRegion)
Sets current viewport region to use for rendering.
|
void |
setWindowSize(SbVec2s newSize)
Calls setWindowSize(newSize, (float)1.0).
|
void |
setWindowSize(SbVec2s newSize,
float newScale)
Sets the size of the window in which the scene manager should render.
|
void |
updateRealTimeSensor()
Internal usage.
|
dispose, getAddress, getNativeResourceHandle, startInternalThreads, stopInternalThreads
@Deprecated public static final int AUTO
SoSceneManager.AntialiasingModes.AUTO
instead.@Deprecated public static final int FXAA
SoSceneManager.AntialiasingModes.FXAA
instead.@Deprecated public static final int SMAA
SoSceneManager.AntialiasingModes.SMAA
instead.@Deprecated public static final int FSAA
SoSceneManager.AntialiasingModes.FSAA
instead.@Deprecated public static final int SUPERSAMPLING
SoSceneManager.AntialiasingModes.SUPERSAMPLING
instead.@Deprecated public static final int ACCUM_BUFFERS
SoSceneManager.AntialiasingModes.ACCUM_BUFFERS
instead.@Deprecated public static final int NUM_ANTIALIASING_MODE
SoSceneManager.AntialiasingModes.NUM_ANTIALIASING_MODE
instead.@Deprecated public static final int NO_ANTIALIASING
SoSceneManager.AntialiasingModes.NO_ANTIALIASING
instead.public SoSceneManager()
public SoSceneManager(int nb)
public void setRenderTask(java.lang.Runnable renderTask)
public void setAbortRenderTask(SoSceneManager.AbortRenderTask task)
It allows some Open Inventor nodes to stop their work, if requested, in order to keep reasonable interactivity. For example, the task can be setup to return true if MousePress events are pending during a STILL frame.
@Deprecated public void allowRedraw(boolean allowRedraw)
public void scheduleForcedRedraw()
public void setFloatingColorBuffer(boolean enable, int size)
public int getFloatingPointRenderingPrecision()
public void updateRealTimeSensor()
public void setWindowSize(SbVec2s newSize)
public void render(boolean clearWindow, boolean clearZbuffer, int id)
public void render(boolean clearWindow, boolean clearZbuffer)
public void setAntialiasing(float quality)
public void setShareContext(SbGLShareContext sc)
public void setSize(SbVec2s newSize)
public void render()
public void render(boolean clearWindow)
public SoNode getSceneGraph()
public void setWindowSize(SbVec2s newSize, float newScale)
render()
and processEvent()
are called.public static int getDefaultRedrawPriority()
public void setSize(SbVec2s newSize, float newScale)
public SoGLRenderAction getGLRenderAction()
public SbVec2s getWindowSize()
@Deprecated public void setAntialiasing(boolean smoothing, int numPasses)
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 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.
public void reinitialize()
public void render(boolean clearWindow, boolean clearZbuffer, int id, boolean force)
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.
render()
.
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.) In this scenario the render()
method is usually called with false for both parameters because the application is managing clearing of the OpenGL buffers.
clearWindow
- If true clears the graphics window before rendering.
clearZbuffer
- If true clears the depth buffer before rendering.public boolean processEvent(SoEvent event)
SoHandleEventAction
to the scene graph managed here.
Returns true if the event was handled by a node.public void setSceneGraph(SoNode newScene)
public static void enableRealTimeUpdate(boolean flag)
public void scheduleRedraw()
public static boolean isRealTimeUpdateEnabled()
public SbVec2s getSize()
public void setStillSuperSampling(float quality, float delay)
quality
- The quality is a factor in the range [0.0,1.0]. delay
- The delay is in seconds. public boolean isRGBMode()
public void setShareContext(SbGLShareContext sc, boolean issc)
public void setClearDepth(float depth)
render()
is called with its clearZbuffer parameter set to true .
depth
- value used to clear the depth buffer. Value is clamped to the range [0,1].public float getStillSuperSamplingQuality()
setStillSuperSampling()
public int getBackgroundIndex()
public void setAntialiasing(float quality, SoSceneManager.AntialiasingModes mode)
setAntialiasing(SoAntialiasingParameters*)
method.
The default mode is AUTO but this may be overridden by setting the environment variable OIV_ANTIALIASING_DEFAULT_MODE (see SoPreferences
).
quality
- The quality is a factor in the range [0.0,1.0]. mode
- The antialiasing algorithm. Default is AUTO, which means use the best for the current hardware. public void setRGBMode(boolean onOrOff)
SoLightModel
should be set to BASE_COLOR ), and the SoColorIndex
node should be used to specify colors.public float getStillSuperSamplingDelay()
setStillSuperSampling()
public void setAutoInteractiveMode(boolean flag)
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.
public boolean isAutoRedraw()
public boolean isAutoInteractiveMode()
public void setInteractive(boolean flag)
It mainly setup SoInteractionElement
for all used actions (preRenderAction and renderAction).
public void deactivate()
public int getRedrawPriority()
public float getClearDepth()
setClearDepth()
public void setRedrawPriority(int priority)
public void activate()
public SiAntialiasingEventListener getAntialiasingEventListener()
public void setViewportRegion(SbViewportRegion newRegion)
public void setAntialiasingEventListener(SiAntialiasingEventListener listener)
listener
- The listener object.public SbViewportRegion getViewportRegion()
public void setHandleEventAction(SoHandleEventAction hea)
public void setOrigin(SbVec2s newOrigin)
public void setGLRenderAction(SoGLRenderAction ra)
public SbVec2s getOrigin()
public SoHandleEventAction getHandleEventAction()
public SbColorRGBA getBackgroundColorRGBA()
setBackgroundColorRGBA()
public float getAntialiasingQuality()
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.public void setBackgroundIndex(int index)
render()
is called with its clearWindow parameter set to true . Default is black (index 0).public void setAntialiasing(SoAntialiasingParameters advancedParameters)
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.
SoSceneManager
makes a copy of the parameter values, so the object can be destroyed after calling this method.
advancedParameters
- Provides specific parameters for an antialiasing mode. SoAntialiasingParameters
.public void setBackgroundColorRGBA(SbColorRGBA color)
render()
is called with its clearWindow parameter set to true . 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()
.
color
- RGBA background colorpublic SoSceneManager.AntialiasingModes getAntialiasingMode()
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.public void setBackgroundColor(SbColor c)
render()
is called with its clearWindow parameter set to true . 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.
public SoAntialiasingParameters getAntialiasingParameters()
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.public SbColor getBackgroundColor()
Generated on January 23, 2025, Copyright © Thermo Fisher Scientific. All rights reserved. http://www.openinventor.com