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
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 |
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() |
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() |
SbColorRGBA |
getBackgroundColorRGBA() |
int |
getBackgroundIndex() |
float |
getClearDepth() |
static int |
getDefaultRedrawPriority()
Gets the default priority of the redraw sensor.
|
int |
getFloatingPointRenderingPrecision()
Internal usage.
|
SoGLRenderAction |
getGLRenderAction() |
SoHandleEventAction |
getHandleEventAction() |
SbVec2s |
getOrigin() |
int |
getRedrawPriority() |
SoNode |
getSceneGraph() |
SbVec2s |
getSize() |
float |
getStillSuperSamplingDelay() |
float |
getStillSuperSamplingQuality() |
SbViewportRegion |
getViewportRegion() |
SbVec2s |
getWindowSize() |
boolean |
isAutoInteractiveMode() |
boolean |
isAutoRedraw()
Returns true if there is currently a render callback registered.
|
static boolean |
isRealTimeUpdateEnabled() |
boolean |
isRGBMode() |
boolean |
processEvent(SoEvent event)
Processes the passed event by applying an
SoHandleEventAction to the scene graph managed here. |
void |
reinitialize()
Reinitializes graphics.
|
void |
render()
Applies an
SoGLRenderAction to the scene graph managed here. |
void |
render(boolean clearWindow)
Deprecated.
|
void |
render(boolean clearWindow,
boolean clearZbuffer)
Deprecated.
As of Open Inventor 10100 No longer used and the parameters are ignored. Use render() instead.
|
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 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 |
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)
Defines the auto interactive mode.
|
void |
setBackgroundColor(SbColor c)
Defines 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)
Defines 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)
Defines the color mode (true - RGB mode, false - color map mode).
|
void |
setSceneGraph(SoNode newScene)
Defines 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)
Defines 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)
Defines current viewport region to use for rendering.
|
void |
setWindowSize(SbVec2s newSize)
Calls setWindowSize(newSize, (float)1.0).
|
void |
setWindowSize(SbVec2s newSize,
float newScale)
Defines the size of the window in which the scene manager should render.
|
void |
updateRealTimeSensor()
Internal usage.
|
dispose, getNativeResourceHandle
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.
public void scheduleForcedRedraw()
public void setFloatingColorBuffer(boolean enable, int size)
public int getFloatingPointRenderingPrecision()
public void updateRealTimeSensor()
public void setSize(SbVec2s newSize)
public void setShareContext(SbGLShareContext sc)
public void setAntialiasing(float quality)
@Deprecated public void render(boolean clearWindow)
public void setWindowSize(SbVec2s newSize)
public SoGLRenderAction getGLRenderAction()
setGLRenderAction()
public void setSceneGraph(SoNode newScene)
@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 scheduleRedraw()
public void setGLRenderAction(SoGLRenderAction ra)
public void setWindowSize(SbVec2s newSize, float newScale)
render()
and processEvent()
are called.public void setHandleEventAction(SoHandleEventAction hea)
public SoNode getSceneGraph()
setSceneGraph()
public SoHandleEventAction getHandleEventAction()
setHandleEventAction()
public void render()
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.)
public static void enableRealTimeUpdate(boolean flag)
public static boolean isRealTimeUpdateEnabled()
enableRealTimeUpdate()
@Deprecated public void render(boolean clearWindow, boolean clearZbuffer)
public void reinitialize()
public static int getDefaultRedrawPriority()
public boolean processEvent(SoEvent event)
SoHandleEventAction
to the scene graph managed here. Returns true if the event was handled by a node.public SbVec2s getWindowSize()
setWindowSize()
public int getBackgroundIndex()
setBackgroundIndex()
public int getRedrawPriority()
setRedrawPriority()
public void setRGBMode(boolean onOrOff)
SoLightModel
should be set to BASE_COLOR ), and the SoColorIndex
node should be used to specify colors.public void setRedrawPriority(int priority)
public SbColorRGBA getBackgroundColorRGBA()
setBackgroundColorRGBA()
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 void setBackgroundIndex(int index)
render()
is called. Default is black (index 0).public void setShareContext(SbGLShareContext sc, boolean issc)
public boolean isAutoRedraw()
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 float getClearDepth()
setClearDepth()
public void deactivate()
public void activate()
public void setInteractive(boolean flag)
It mainly setup SoInteractionElement
for all used actions (preRenderAction and renderAction).
public boolean isRGBMode()
setRGBMode()
public boolean isAutoInteractiveMode()
setAutoInteractiveMode()
public void setClearDepth(float depth)
render()
is called.
depth
- value used to clear the depth buffer. Value is clamped to the range [0,1].public void setBackgroundColorRGBA(SbColorRGBA color)
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()
.
color
- RGBA background colorpublic void setOrigin(SbVec2s newOrigin)
public 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 SbVec2s getOrigin()
setOrigin()
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 void setSize(SbVec2s newSize, float newScale)
public SiAntialiasingEventListener getAntialiasingEventListener()
setAntialiasingEventListener()
public void setAntialiasingEventListener(SiAntialiasingEventListener listener)
listener
- The listener object.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 float getStillSuperSamplingDelay()
setStillSuperSampling()
public void setBackgroundColor(SbColor c)
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.
public float getStillSuperSamplingQuality()
setStillSuperSampling()
public SbColor getBackgroundColor()
setBackgroundColor()
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.
setAntialiasingEventListener()
.
advancedParameters
- Provides specific parameters for an antialiasing mode. SoAntialiasingParameters
.public void setViewportRegion(SbViewportRegion newRegion)
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 SbViewportRegion getViewportRegion()
setViewportRegion()
Generated on July 31, 2019, Copyright © Thermo Fisher Scientific. All rights reserved. http://www.openinventor.com