Class PoSceneView

  • All Implemented Interfaces:

    public class PoSceneView
    extends PoBaseView
    Class to define a view which contains a scene. This class allows the user to define a view which contains a scene.

    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.


    • 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.
    • 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 and setOverride() if necessary.
    • In case of tile rendering with SoOffscreenRenderArea : SoGradientBackground in a PoSceneView will not be rendered with the correct size (i.e. the SoGradientBackground 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( "", 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( "", cam2 );
     view2.setPart( "scene", scene2 );
     cam2.viewAll( scene2, new SbViewportRegion((short)100, (short)100) );
     root.addChild( view2 );
     viewer.setSceneGraph( root );

    File format/default:

    PoSceneView {

      viewportOrigin 0 0
      viewportSize 1 1
      isBackgroundVisible false
      isBorderVisible false

    <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> <html> <head> <link REL="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style"> <title></title> </head> <BODY> <h1></h1> <h4> <A NAME="Heading1265">CATALOG PARTS</A></h4> <ul><b>PoSceneView</b> {</ul> <ul><ul><b>Separator</b> <tt>topSep</tt> (from PoSceneView) {<br> </ul></ul> <ul><ul><ul><b>Separator</b> <tt>backgroundSep</tt> (from PoSceneView) {</ul></ul></ul> <ul><ul><ul><i>Contains properties and shapes to draw the background of the view.</i></ul></ul></ul> <ul><ul><ul><ul><b>AppearanceKit</b> <tt>backgroundApp </tt>(from PoSceneView)</ul></ul></ul></ul> <ul><ul><ul><ul><i>Specifies the appearance of the background.</i></ul></ul></ul></ul> <ul><ul><ul><ul><b>Group</b> <tt>background </tt>(from PoSceneView)</ul></ul></ul></ul> <ul><ul><ul><ul><i>Contains a SoFaceSet shape to draw the background.</i></ul></ul></ul></ul> <ul><ul><ul>}</ul></ul></ul> <ul><ul></ul></ul> <ul><ul><ul><b>Separator</b> <tt>sceneSep</tt> (from PoSceneView) {</ul></ul></ul> <ul><ul><ul><i>Contains the camera and the scene of the view specified by the user.</i></ul></ul></ul> <ul><ul><ul><ul><b>Camera</b> <tt>cameraKit </tt>(from PoBaseView) </ul></ul></ul></ul> <ul><ul><ul><ul><i>Contains the camera of the view specified by the user.</i></ul></ul></ul></ul> <ul><ul><ul><ul><b>Group</b> <tt>scene </tt>(from PoSceneView)</ul></ul></ul></ul> <ul><ul><ul><ul><i>Contains the scene of the view specified by the user.</i></ul></ul></ul></ul> <ul><ul><ul>}</ul></ul></ul> <ul><ul></ul></ul> <ul><ul><ul><b>Separator</b> <tt>borderSep</tt> (from PoSceneView) {</ul></ul></ul> <ul><ul><ul><i>Contains properties and shapes to draw the borders of the view.</i></ul></ul></ul> <ul><ul><ul><ul><b>AppearanceKit</b> <tt>borderApp </tt>(from PoSceneView)</ul></ul></ul></ul> <ul><ul><ul><ul><i>Specifies the appearance of the borders.</i></ul></ul></ul></ul> <ul><ul><ul><ul><b>Group</b> <tt>border </tt>(from PoSceneView)</ul></ul></ul></ul> <ul><ul><ul><ul><i>Contains a SoLineSet shape to draw the borders.</i></ul></ul></ul></ul> <ul><ul><ul>}</ul></ul></ul> <ul><ul>}</ul></ul> <ul>}<br> <br> </ul> </body> </html>

    • Field Detail

      • isBackgroundVisible

        public final SoSFBool isBackgroundVisible
        Defines the visibility of the background of the view.
      • isBorderVisible

        public final SoSFBool isBorderVisible
        Defines the visibility of the borders of the view.
    • Constructor Detail

      • PoSceneView

        public PoSceneView()
        Default constructor.