public class SubScene extends Node
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:
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.
Type | Property and Description |
---|---|
<any> |
camera
Specifies the type of camera use for rendering this
SubScene . |
<any> |
fill
Defines the background fill of this
SubScene . |
DoubleProperty |
height
Defines the height of this
SubScene |
<any> |
root
Defines the root
Node of the SubScene scene graph. |
<any> |
userAgentStylesheet |
DoubleProperty |
width
Defines the width of this
SubScene |
accessibleHelpProperty, accessibleRoleDescriptionProperty, accessibleRoleProperty, accessibleTextProperty, blendModeProperty, boundsInLocalProperty, boundsInParentProperty, cacheHintProperty, cacheProperty, clipProperty, cursorProperty, depthTestProperty, disabledProperty, disableProperty, effectiveNodeOrientationProperty, effectProperty, eventDispatcherProperty, focusedProperty, focusTraversableProperty, hoverProperty, idProperty, inputMethodRequestsProperty, layoutBoundsProperty, layoutXProperty, layoutYProperty, localToParentTransformProperty, localToSceneTransformProperty, managedProperty, mouseTransparentProperty, nodeOrientationProperty, onContextMenuRequestedProperty, onDragDetectedProperty, onDragDoneProperty, onDragDroppedProperty, onDragEnteredProperty, onDragExitedProperty, onDragOverProperty, onInputMethodTextChangedProperty, onKeyPressedProperty, onKeyReleasedProperty, onKeyTypedProperty, onMouseClickedProperty, onMouseDragEnteredProperty, onMouseDragExitedProperty, onMouseDraggedProperty, onMouseDragOverProperty, onMouseDragReleasedProperty, onMouseEnteredProperty, onMouseExitedProperty, onMouseMovedProperty, onMousePressedProperty, onMouseReleasedProperty, onRotateProperty, onRotationFinishedProperty, onRotationStartedProperty, onScrollFinishedProperty, onScrollProperty, onScrollStartedProperty, onSwipeDownProperty, onSwipeLeftProperty, onSwipeRightProperty, onSwipeUpProperty, onTouchMovedProperty, onTouchPressedProperty, onTouchReleasedProperty, onTouchStationaryProperty, onZoomFinishedProperty, onZoomProperty, onZoomStartedProperty, opacityProperty, parentProperty, pickOnBoundsProperty, pressedProperty, rotateProperty, rotationAxisProperty, scaleXProperty, scaleYProperty, scaleZProperty, sceneProperty, showMnemonicsProperty, styleProperty, translateXProperty, translateYProperty, translateZProperty, treeShowingProperty, treeVisibleProperty, viewOrderProperty, visibleProperty
Modifier and Type | Class and Description |
---|---|
private static class |
SubScene.SubSceneDirtyBits |
Node.FocusedProperty, Node.TreeShowingPropertyReadOnly, Node.TreeVisiblePropertyReadOnly
Modifier and Type | Field and Description |
---|---|
private SceneAntialiasing |
antiAliasing |
private <any> |
camera
Specifies the type of camera use for rendering this
SubScene . |
private Camera |
defaultCamera |
private boolean |
depthBuffer |
private int |
dirtyBits |
(package private) boolean |
dirtyLayout
Dirty Bits *
|
private boolean |
dirtyNodes |
private <any> |
fill
Defines the background fill of this
SubScene . |
private DoubleProperty |
height
Defines the height of this
SubScene |
private static boolean |
is3DSupported |
private java.util.List<LightBase> |
lights |
private <any> |
root
Defines the root
Node of the SubScene scene graph. |
private TopMostTraversalEngine |
traversalEngine |
private <any> |
userAgentStylesheet |
private DoubleProperty |
width
Defines the width of this
SubScene |
accessibilityProperties, accessible, BASELINE_OFFSET_SAME_AS_HEIGHT, boundsChanged, cssFlag, pseudoClassStates, styleHelper
Constructor and Description |
---|
SubScene(Parent root,
double width,
double height)
Creates a
SubScene for a specific root Node with a specific size. |
SubScene(Parent root,
double width,
double height,
boolean depthBuffer,
SceneAntialiasing antiAliasing)
Constructs a
SubScene consisting of a root, with a dimension of width and
height, specifies whether a depth buffer is created for this scene and
specifies whether scene anti-aliasing is requested. |
Modifier and Type | Method and Description |
---|---|
(package private) void |
addLight(LightBase light) |
<any> |
cameraProperty()
Specifies the type of camera use for rendering this
SubScene . |
private void |
clearDirtyBits() |
private boolean |
doComputeContains(double localX,
double localY)
Picking *
|
private BaseBounds |
doComputeGeomBounds(BaseBounds bounds,
BaseTransform tx) |
private NGNode |
doCreatePeer() |
private void |
doPickNodeLocal(PickRay localPickRay,
PickResultChooser result)
Finds a top-most child node that contains the given local coordinates.
|
private void |
doProcessCSS()
CSS *
|
private void |
doUpdatePeer() |
<any> |
fillProperty()
Defines the background fill of this
SubScene . |
SceneAntialiasing |
getAntiAliasing()
Return the defined
SceneAntialiasing for this SubScene . |
Camera |
getCamera()
Gets the value of the property camera.
|
(package private) Camera |
getEffectiveCamera() |
Paint |
getFill()
Gets the value of the property fill.
|
double |
getHeight()
Gets the value of the property height.
|
Parent |
getRoot()
Gets the value of the property root.
|
java.lang.String |
getUserAgentStylesheet()
Get the URL of the user-agent stylesheet that will be used by this SubScene.
|
double |
getWidth()
Gets the value of the property width.
|
DoubleProperty |
heightProperty()
Defines the height of this
SubScene |
boolean |
isDepthBuffer()
Retrieves the depth buffer attribute for this
SubScene . |
private boolean |
isDepthBufferInternal() |
private boolean |
isDirty() |
private boolean |
isDirty(SubScene.SubSceneDirtyBits dirtyBit) |
(package private) void |
layoutPass() |
(package private) void |
markContentDirty() |
private void |
markDirty(SubScene.SubSceneDirtyBits dirtyBit) |
(package private) void |
nodeResolvedOrientationChanged() |
private PickResult |
pickRootSG(double localX,
double localY) |
(package private) void |
processCSS() |
(package private) void |
removeLight(LightBase light) |
<any> |
rootProperty()
Defines the root
Node of the SubScene scene graph. |
void |
setCamera(Camera value)
Sets the value of the property camera.
|
(package private) void |
setDirty(Node n) |
private void |
setDirty(SubScene.SubSceneDirtyBits dirtyBit) |
(package private) void |
setDirtyLayout(Parent p) |
void |
setFill(Paint value)
Sets the value of the property fill.
|
void |
setHeight(double value)
Sets the value of the property height.
|
void |
setRoot(Parent value)
Sets the value of the property root.
|
void |
setUserAgentStylesheet(java.lang.String url)
Set the URL of the user-agent stylesheet that will be used by this SubScene in place of the
the platform-default user-agent stylesheet.
|
void |
setWidth(double value)
Sets the value of the property width.
|
private boolean |
subSceneComputeContains(double localX,
double localY)
Determines whether
SubScene contains the given point. |
private boolean |
syncLights()
PG Light synchronizer.
|
(package private) boolean |
traverse(Node node,
Direction dir) |
(package private) void |
updateBounds() |
<any> |
userAgentStylesheetProperty() |
DoubleProperty |
widthProperty()
Defines the width of this
SubScene |
accessibleHelpProperty, accessibleRoleDescriptionProperty, accessibleRoleProperty, accessibleTextProperty, addEventFilter, addEventHandler, almostZero, applyCss, autosize, blendModeProperty, boundedSize, boundsInLocalProperty, boundsInParentProperty, buildEventDispatchChain, cacheHintProperty, cacheProperty, clearDirty, clipProperty, computeAreaInScreen, computeDerivedDepthTest, contains, contains, cursorProperty, depthTestProperty, disabledProperty, disableProperty, effectiveNodeOrientationProperty, effectProperty, eventDispatcherProperty, executeAccessibleAction, findStyles, fireEvent, focusedProperty, focusTraversableProperty, getAccessible, getAccessibleHelp, getAccessibleRole, getAccessibleRoleDescription, getAccessibleText, getBaselineOffset, getBlendMode, getBoundsInLocal, getBoundsInParent, getCacheHint, getClassCssMetaData, getClip, getClipParent, getContentBias, getCSSFlags, getCssMetaData, getCurrentLocalToSceneTransformState, getCursor, getDepthTest, getEffect, getEffectiveNodeOrientation, getEventDispatcher, getGeomBounds, getId, getInitialCursor, getInitialFocusTraversable, getInputMethodRequests, getLayoutBounds, getLayoutX, getLayoutY, getLeafTransform, getLocalBounds, getLocalToParentTransform, getLocalToParentTransform, getLocalToSceneTransform, getMatchingStyles, getNodeOrientation, getOnContextMenuRequested, getOnDragDetected, getOnDragDone, getOnDragDropped, getOnDragEntered, getOnDragExited, getOnDragOver, getOnInputMethodTextChanged, getOnKeyPressed, getOnKeyReleased, getOnKeyTyped, getOnMouseClicked, getOnMouseDragEntered, getOnMouseDragExited, getOnMouseDragged, getOnMouseDragOver, getOnMouseDragReleased, getOnMouseEntered, getOnMouseExited, getOnMouseMoved, getOnMousePressed, getOnMouseReleased, getOnRotate, getOnRotationFinished, getOnRotationStarted, getOnScroll, getOnScrollFinished, getOnScrollStarted, getOnSwipeDown, getOnSwipeLeft, getOnSwipeRight, getOnSwipeUp, getOnTouchMoved, getOnTouchPressed, getOnTouchReleased, getOnTouchStationary, getOnZoom, getOnZoomFinished, getOnZoomStarted, getOpacity, getParent, getPeer, getPivotX, getPivotY, getPivotZ, getProperties, getPseudoClassStates, getRotate, getRotationAxis, getScaleX, getScaleY, getScaleZ, getScene, getStyle, getStyleableParent, getStyleClass, getStyleMap, getSubScene, getTransformedBounds, getTransforms, getTranslateX, getTranslateY, getTranslateZ, getTypeSelector, getUserData, getViewOrder, hasMirroring, hasProperties, hoverProperty, idProperty, indent, inputMethodRequestsProperty, intersects, intersects, intersects, intersectsBounds, isCache, isCanReceiveFocus, isConnected, isDerivedDepthTest, isDirtyEmpty, isDisable, isDisabled, isFocused, isFocusTraversable, isHover, isManaged, isMouseTransparent, isPickOnBounds, isPressed, isResizable, isShowMnemonics, isTreeShowing, isTreeVisible, isVisible, layoutBoundsChanged, layoutBoundsProperty, layoutXProperty, layoutYProperty, localBoundsChanged, localToParent, localToParent, localToParent, localToParent, localToParent, localToParent, localToParent, localToParentTransformProperty, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToSceneTransformProperty, localToScreen, localToScreen, localToScreen, localToScreen, localToScreen, lookup, lookupAll, lookupAll, managedProperty, markDirtyLayoutBranch, maxHeight, maxWidth, minHeight, minWidth, mouseTransparentProperty, nodeOrientationProperty, nodeResolvedOrientationInvalidated, notifyAccessibleAttributeChanged, notifyManagedChanged, notifyParentOfBoundsChange, notifyParentsOfInvalidatedCSS, onContextMenuRequestedProperty, onDragDetectedProperty, onDragDoneProperty, onDragDroppedProperty, onDragEnteredProperty, onDragExitedProperty, onDragOverProperty, onInputMethodTextChangedProperty, onKeyPressedProperty, onKeyReleasedProperty, onKeyTypedProperty, onMouseClickedProperty, onMouseDragEnteredProperty, onMouseDragExitedProperty, onMouseDraggedProperty, onMouseDragOverProperty, onMouseDragReleasedProperty, onMouseEnteredProperty, onMouseExitedProperty, onMouseMovedProperty, onMousePressedProperty, onMouseReleasedProperty, onRotateProperty, onRotationFinishedProperty, onRotationStartedProperty, onScrollFinishedProperty, onScrollProperty, onScrollStartedProperty, onSwipeDownProperty, onSwipeLeftProperty, onSwipeRightProperty, onSwipeUpProperty, onTouchMovedProperty, onTouchPressedProperty, onTouchReleasedProperty, onTouchStationaryProperty, onZoomFinishedProperty, onZoomProperty, onZoomStartedProperty, opacityProperty, parentProperty, parentResolvedOrientationInvalidated, parentToLocal, parentToLocal, parentToLocal, parentToLocal, parentToLocal, parentToLocal, parentToLocal, pickNode, pickOnBoundsProperty, prefHeight, prefWidth, pressedProperty, pseudoClassStateChanged, queryAccessibleAttribute, reapplyCSS, releaseAccessible, relocate, removeEventFilter, removeEventHandler, requestFocus, resize, resizeRelocate, rotateProperty, rotationAxisProperty, scaleXProperty, scaleYProperty, scaleZProperty, sceneProperty, scenesChanged, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, screenToLocal, screenToLocal, screenToLocal, setAccessibleHelp, setAccessibleRole, setAccessibleRoleDescription, setAccessibleText, setBlendMode, setCache, setCacheHint, setClip, setCursor, setDepthTest, setDerivedDepthTest, setDisable, setDisabled, setEffect, setEventDispatcher, setEventHandler, setFocused, setFocusTraversable, setHover, setId, setInputMethodRequests, setLayoutX, setLayoutY, setManaged, setMouseTransparent, setNodeOrientation, setOnContextMenuRequested, setOnDragDetected, setOnDragDone, setOnDragDropped, setOnDragEntered, setOnDragExited, setOnDragOver, setOnInputMethodTextChanged, setOnKeyPressed, setOnKeyReleased, setOnKeyTyped, setOnMouseClicked, setOnMouseDragEntered, setOnMouseDragExited, setOnMouseDragged, setOnMouseDragOver, setOnMouseDragReleased, setOnMouseEntered, setOnMouseExited, setOnMouseMoved, setOnMousePressed, setOnMouseReleased, setOnRotate, setOnRotationFinished, setOnRotationStarted, setOnScroll, setOnScrollFinished, setOnScrollStarted, setOnSwipeDown, setOnSwipeLeft, setOnSwipeRight, setOnSwipeUp, setOnTouchMoved, setOnTouchPressed, setOnTouchReleased, setOnTouchStationary, setOnZoom, setOnZoomFinished, setOnZoomStarted, setOpacity, setParent, setPickOnBounds, setPressed, setRotate, setRotationAxis, setScaleX, setScaleY, setScaleZ, setScenes, setShowMnemonics, setStyle, setStyleMap, setTranslateX, setTranslateY, setTranslateZ, setTreeShowing, setTreeVisible, setUserData, setViewOrder, setVisible, showMnemonicsProperty, snapshot, snapshot, startDragAndDrop, startFullDrag, styleProperty, syncPeer, toBack, toFront, toString, transformedBoundsChanged, translateXProperty, translateYProperty, translateZProperty, traverse, treeShowingProperty, treeVisibleProperty, updateGeomBounds, updateLocalToParentTransform, updateTxBounds, usesMirroring, viewOrderProperty, visibleProperty, wouldCreateCycle
public final <any> rootProperty
Node
of the SubScene
scene graph.
If a Group
is used as the root, the
contents of the scene graph will be clipped by the SubScene
's width and height.
SubScene
doesn't accept null root.getRoot()
,
setRoot(Parent)
public final <any> cameraProperty
SubScene
.
If camera
is null, a parallel camera is used for rendering.
It is illegal to set a camera that belongs to other Scene
or SubScene
.
Note: this is a conditional feature. See
ConditionalFeature.SCENE3D
for more information.
getCamera()
,
setCamera(Camera)
public final DoubleProperty widthProperty
SubScene
getWidth()
,
setWidth(double)
public final DoubleProperty heightProperty
SubScene
getHeight()
,
setHeight(double)
public final <any> fillProperty
SubScene
. Both a null
value meaning paint no background and a javafx.scene.paint.Paint
with transparency are supported. The default value is null.getFill()
,
setFill(Paint)
public final <any> userAgentStylesheetProperty
getUserAgentStylesheet()
,
setUserAgentStylesheet(String)
private static boolean is3DSupported
private final SceneAntialiasing antiAliasing
private final boolean depthBuffer
private <any> root
Node
of the SubScene
scene graph.
If a Group
is used as the root, the
contents of the scene graph will be clipped by the SubScene
's width and height.
SubScene
doesn't accept null root.private <any> camera
SubScene
.
If camera
is null, a parallel camera is used for rendering.
It is illegal to set a camera that belongs to other Scene
or SubScene
.
Note: this is a conditional feature. See
ConditionalFeature.SCENE3D
for more information.
private Camera defaultCamera
private DoubleProperty width
SubScene
private DoubleProperty height
SubScene
private <any> fill
SubScene
. Both a null
value meaning paint no background and a javafx.scene.paint.Paint
with transparency are supported. The default value is null.private <any> userAgentStylesheet
boolean dirtyLayout
private boolean dirtyNodes
private TopMostTraversalEngine traversalEngine
private int dirtyBits
private java.util.List<LightBase> lights
public SubScene(Parent root, double width, double height)
SubScene
for a specific root Node with a specific size.root
- The root node of the scene graphwidth
- The width of the sub-sceneheight
- The height of the sub-scenejava.lang.NullPointerException
- if root is nullpublic SubScene(Parent root, double width, double height, boolean depthBuffer, SceneAntialiasing antiAliasing)
SubScene
consisting of a root, with a dimension of width and
height, specifies whether a depth buffer is created for this scene and
specifies whether scene anti-aliasing is requested.
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.
root
- The root node of the scene graphwidth
- The width of the sub-sceneheight
- The height of the sub-scenedepthBuffer
- The depth buffer flagantiAliasing
- The sub-scene anti-aliasing attribute. A value of
null
is treated as DISABLED.
The depthBuffer and antiAliasing flags are conditional features. With the
respective default values of: false and SceneAntialiasing.DISABLED
.
See ConditionalFeature.SCENE3D
for more information.
java.lang.NullPointerException
- if root is nullNode.setDepthTest(DepthTest)
public final SceneAntialiasing getAntiAliasing()
SceneAntialiasing
for this SubScene
.
Note: this is a conditional feature. See
ConditionalFeature.SCENE3D
and SceneAntialiasing
for more information.
public final boolean isDepthBuffer()
SubScene
.private boolean isDepthBufferInternal()
public final void setRoot(Parent value)
public final Parent getRoot()
public final <any> rootProperty()
Node
of the SubScene
scene graph.
If a Group
is used as the root, the
contents of the scene graph will be clipped by the SubScene
's width and height.
SubScene
doesn't accept null root.getRoot()
,
setRoot(Parent)
public final void setCamera(Camera value)
public final Camera getCamera()
public final <any> cameraProperty()
SubScene
.
If camera
is null, a parallel camera is used for rendering.
It is illegal to set a camera that belongs to other Scene
or SubScene
.
Note: this is a conditional feature. See
ConditionalFeature.SCENE3D
for more information.
getCamera()
,
setCamera(Camera)
Camera getEffectiveCamera()
final void markContentDirty()
public final void setWidth(double value)
public final double getWidth()
public final DoubleProperty widthProperty()
SubScene
getWidth()
,
setWidth(double)
public final void setHeight(double value)
public final double getHeight()
public final DoubleProperty heightProperty()
SubScene
getHeight()
,
setHeight(double)
public final void setFill(Paint value)
public final Paint getFill()
public final <any> fillProperty()
SubScene
. Both a null
value meaning paint no background and a javafx.scene.paint.Paint
with transparency are supported. The default value is null.getFill()
,
setFill(Paint)
private void doUpdatePeer()
void nodeResolvedOrientationChanged()
nodeResolvedOrientationChanged
in class Node
private void doProcessCSS()
void processCSS()
processCSS
in class Node
public final <any> userAgentStylesheetProperty()
getUserAgentStylesheet()
,
setUserAgentStylesheet(String)
public final java.lang.String getUserAgentStylesheet()
For additional information about using CSS with the scene graph, see the CSS Reference Guide.
public final void setUserAgentStylesheet(java.lang.String url)
For additional information about using CSS with the scene graph, see the CSS Reference Guide.
url
- The URL is a hierarchical URI of the form [scheme:][//authority][path]. If the URL
does not have a [scheme:] component, the URL is considered to be the [path] component only.
Any leading '/' character of the [path] is ignored and the [path] is treated as a path relative to
the root of the application's classpath.void updateBounds()
updateBounds
in class Node
private NGNode doCreatePeer()
private BaseBounds doComputeGeomBounds(BaseBounds bounds, BaseTransform tx)
void setDirtyLayout(Parent p)
void setDirty(Node n)
void layoutPass()
boolean traverse(Node node, Direction dir)
private void clearDirtyBits()
private boolean isDirty()
private void setDirty(SubScene.SubSceneDirtyBits dirtyBit)
private boolean isDirty(SubScene.SubSceneDirtyBits dirtyBit)
private void markDirty(SubScene.SubSceneDirtyBits dirtyBit)
private boolean doComputeContains(double localX, double localY)
private boolean subSceneComputeContains(double localX, double localY)
SubScene
contains the given point.
It does not consider the contained nodes, only SubScene
's
size and fills.localX
- horizontal coordinate in the local space of the SubScene
nodelocalY
- vertical coordinate in the local space of the SubScene
nodeSubScene
's area covered by its fillprivate PickResult pickRootSG(double localX, double localY)
private void doPickNodeLocal(PickRay localPickRay, PickResultChooser result)
final void addLight(LightBase light)
final void removeLight(LightBase light)
private boolean syncLights()