Class PoSceneView
- All Implemented Interfaces:
SafeDisposable
Views allow the application to specify multiple cameras, each with its own separate viewport (region of the 3D window). This is more powerful than just using multiple SoCamera
nodes, because camera nodes do not allow specifying a viewport (the viewport is always the full window). See PoBaseView
for more explanation.
A scene is a set of any nodes (except SoCamera
nodes) placed under an SoGroup
node which must be seen in a viewport according to a camera configuration. To define a view, set the fields viewportOrigin
and viewportSize
according to the viewport position and size you want to have (relative to the display window sizes), configure the camera (set the part cameraKit), build the scene under an SoGroup
node, and set this scene to the view (set the part scene). All shape nodes contained in the scene will be drawn in the viewport previously defined and according to the camera definition. You can define as many views as you want.
NOTES:
- If you use a viewer, you should call the method SoBaseKit.setSearchingChildren(true) to allow the viewer to search for cameras inside nodekits (like this one).
- Do not place a camera node before this nodekit.
- Create a camera for each view and set it using the setPart method. See example.
- When you use HardCopy, the graphics window is the paper sheet.
- LIMITATIONS:
- The field
SoCamera.viewportMapping
must be equal to ADJUST_CAMERA in order to have a correct vectorisation when you use HardCopy, - Do not use the
SoBoxHighlightRenderAction
class on a scene graph which contains a view, - Do not push view,
- Be careful when you use the method viewAll() of the class SoXtViewer, because this method works on the entire scene graph and not on a portion of a scene graph. Overload this method according to your requirements,
- Some of the viewer functions/buttons do not work correctly with views.
For example, saveHomePosition() and resetToHomePosition() do not work correctly because the viewer only stores one copy of the camera. - The viewer rendering options, e.g. wireframe, apply to ALL views inside the viewer. You can implement these effects per-view using an
SoDrawStyle
node andsetOverride()
if necessary. - In case of tile rendering with
SoOffscreenRenderArea
:SoGradientBackground
in aPoSceneView
will not be rendered with the correct size (i.e. theSoGradientBackground
size will not match the target size). Call SoOffscreenRenderArea.setTileSize() with the offscreen rendering total size to avoid this size problem.
// Must enable this option or viewer will not be able to find the camera in the PoSceneView nodeKit. SoBaseKit.setSearchingChildren( true ); // First scene graph SoSeparator scene1 = new SoSeparator(); scene1.addChild( new SoCone() ); // First view (lower left quadrant of window) PoSceneView view1 = new PoSceneView(); view1.sensitiveOnEvents( true ); view1.isBorderVisible.setValue( true ); view1.viewportOrigin.setValue( 0, 0 ); view1.viewportSize.setValue( 0.5f, 0.5f ); SoPerspectiveCamera cam1 = new SoPerspectiveCamera(); view1.setPart( "cameraKit.camera", cam1 ); view1.setPart( "scene", scene1 ); cam1.viewAll( scene1, new SbViewportRegion((short)100, (short)100) ); root.addChild( view1 ); // Second scene graph Separator scene2 = new SoSeparator(); scene2.addChild( new SoCube() ); // Second view (upper right quadrant of window) PoSceneView view2 = new PoSceneView(); view2.sensitiveOnEvents( true ); view2.isBorderVisible.setValue( true ); view2.set( "borderApp.drawStyle", "lineWidth 1.5" ); // Work-around for border view2.viewportOrigin.setValue( 0.5f, 0.5f ); view2.viewportSize.setValue( 0.5f, 0.5f ); SoPerspectiveCamera cam2 = new SoPerspectiveCamera(); view2.setPart( "cameraKit.camera", cam2 ); view2.setPart( "scene", scene2 ); cam2.viewAll( scene2, new SbViewportRegion((short)100, (short)100) ); root.addChild( view2 ); viewer.setSceneGraph( root );
File format/default:
viewportOrigin | 0 0 |
viewportSize | 1 1 |
isBackgroundVisible | false |
isBorderVisible | false |
-
Nested Class Summary
Nested classes/interfaces inherited from class com.openinventor.inventor.nodes.SoNode
SoNode.RenderModes
Nested classes/interfaces inherited from class com.openinventor.inventor.Inventor
Inventor.ConstructorCommand
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal SoSFBool
Defines the visibility of the background of the view.final SoSFBool
Defines the visibility of the borders of the view.Fields inherited from class com.openinventor.inventor.gui.view.PoBaseView
viewportOrigin, viewportSize
Fields inherited from class com.openinventor.inventor.nodekits.SoBaseKit
boundingBoxIgnoring
Fields inherited from class com.openinventor.inventor.Inventor
VERBOSE_LEVEL, ZeroHandle
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic SoNodekitCatalog
Returns theSoNodekitCatalog
for this class.Methods inherited from class com.openinventor.inventor.gui.view.PoBaseView
isPointWithinViewport, isSensitiveOnEvents, sensitiveOnEvents
Methods inherited from class com.openinventor.inventor.nodekits.SoBaseKit
getNodekitCatalog, getPart, getPart, getPartString, getViewportIsEnabled, getViewportOrigin, getViewportSize, isSearchingChildren, set, set, setPart, setSearchingChildren
Methods inherited from class com.openinventor.inventor.nodes.SoNode
affectsState, callback, copy, copy, distribute, doAction, getAlternateRep, getBoundingBox, getByName, getMatrix, getPrimitiveCount, getRenderEngineMode, getRenderUnitID, GLRender, GLRenderBelowPath, GLRenderInPath, GLRenderOffPath, grabEventsCleanup, grabEventsSetup, handleEvent, isBoundingBoxIgnoring, isOverride, pick, rayPick, search, setOverride, touch, write
Methods inherited from class com.openinventor.inventor.fields.SoFieldContainer
copyFieldValues, copyFieldValues, enableNotify, fieldsAreEqual, get, getAllFields, getEventIn, getEventOut, getField, getFieldName, hasDefaultValues, isNotifyEnabled, setToDefaults
Methods inherited from class com.openinventor.inventor.misc.SoBase
dispose, getName, isDisposable, isSynchronizable, setName, setSynchronizable
Methods inherited from class com.openinventor.inventor.Inventor
getNativeResourceHandle
-
Field Details
-
isBackgroundVisible
Defines the visibility of the background of the view. -
isBorderVisible
Defines the visibility of the borders of the view.
-
-
Constructor Details
-
PoSceneView
public PoSceneView()Default constructor.
-
-
Method Details
-
getClassNodekitCatalog
Returns theSoNodekitCatalog
for this class.
-