Package javafx.scene

Class SubScene

java.lang.Object
javafx.scene.Node
javafx.scene.SubScene
All Implemented Interfaces:
Styleable, EventTarget

public class SubScene extends Node
The SubScene class is the container for content in a scene graph. SubScene provides separation of different parts of a scene, each of which can be rendered with a different camera, depth buffer, or scene anti-aliasing. A SubScene is embedded into the main scene or another sub-scene.

An application may request depth buffer support or scene anti-aliasing support at the creation of a SubScene. A sub-scene with only 2D shapes and without any 3D transforms does not need a depth buffer nor scene anti-aliasing support. A sub-scene containing 3D shapes or 2D shapes with 3D transforms may use depth buffer support for proper depth sorted rendering; to avoid depth fighting (also known as Z fighting), disable depth testing on 2D shapes that have no 3D transforms. See depthTest for more information. A sub-scene with 3D shapes may enable scene anti-aliasing to improve its rendering quality.

The depthBuffer and antiAliasing flags are conditional features. With the respective default values of: false and SceneAntialiasing.DISABLED. See ConditionalFeature.SCENE3D for more information.

Possible use cases are:

  • Mixing 2D and 3D content
  • Overlay for UI controls
  • Underlay for background
  • Heads-up display

A default headlight will be added to a SubScene that contains one or more Shape3D nodes, but no light nodes. This light source is a Color.WHITE PointLight placed at the camera position.

Since:
JavaFX 8.0