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.viewportMappingmust be equal to ADJUST_CAMERA in order to have a correct vectorisation when you use HardCopy, - Do not use the
SoBoxHighlightRenderActionclass 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
SoDrawStylenode andsetOverride()if necessary. - In case of tile rendering with
SoOffscreenRenderArea:SoGradientBackgroundin aPoSceneViewwill not be rendered with the correct size (i.e. theSoGradientBackgroundsize 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.RenderModesNested classes/interfaces inherited from class com.openinventor.inventor.Inventor
Inventor.ConstructorCommand -
Field Summary
FieldsModifier and TypeFieldDescriptionfinal SoSFBoolDefines the visibility of the background of the view.final SoSFBoolDefines the visibility of the borders of the view.Fields inherited from class com.openinventor.inventor.gui.view.PoBaseView
viewportOrigin, viewportSizeFields inherited from class com.openinventor.inventor.nodekits.SoBaseKit
boundingBoxIgnoringFields inherited from class com.openinventor.inventor.Inventor
VERBOSE_LEVEL, ZeroHandle -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic SoNodekitCatalogReturns theSoNodekitCatalogfor this class.Methods inherited from class com.openinventor.inventor.gui.view.PoBaseView
isPointWithinViewport, isSensitiveOnEvents, sensitiveOnEventsMethods inherited from class com.openinventor.inventor.nodekits.SoBaseKit
getNodekitCatalog, getPart, getPart, getPartString, getViewportIsEnabled, getViewportOrigin, getViewportSize, isSearchingChildren, set, set, setPart, setSearchingChildrenMethods 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, writeMethods inherited from class com.openinventor.inventor.fields.SoFieldContainer
copyFieldValues, copyFieldValues, enableNotify, fieldsAreEqual, get, getAllFields, getEventIn, getEventOut, getField, getFieldName, hasDefaultValues, isNotifyEnabled, setToDefaultsMethods inherited from class com.openinventor.inventor.misc.SoBase
dispose, getName, isDisposable, isSynchronizable, setName, setSynchronizableMethods 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 theSoNodekitCatalogfor this class.
-