- java.lang.Object
-
- javafx.scene.Node
-
- javafx.scene.Camera
-
- All Implemented Interfaces:
Styleable
,EventTarget
- Direct Known Subclasses:
ParallelCamera
,PerspectiveCamera
public abstract class Camera extends Node
Base class for a camera used to render a scene. The camera defines the mapping of the scene coordinate space onto the window. Camera is an abstract class with two concrete subclasses:ParallelCamera
andPerspectiveCamera
.The default camera is positioned in the scene such that its projection plane in the scene coordinate space is at Z = 0, and it is looking into the screen in the positive Z direction. The distance in Z from the camera to the projection plane is determined by the
width
andheight
of the Scene to which it is attached and itsfieldOfView
.The
nearClip
andfarClip
of this camera are specified in the eye coordinate space. This space is defined such that the eye is at its origin and the projection plane is one unit in front of the eye in the positive Z direction.The following pseudo code is the math used to compute the near and far clip distances in the scene coordinate space:
final double tanOfHalfFOV = Math.tan(Math.toRadians(FOV) / 2.0); final double halfHeight = HEIGHT / 2; final double focalLenght = halfHeight / tanOfHalfFOV; final double eyePositionZ = -1.0 * focalLenght; final double nearClipDistance = focalLenght * NEAR + eyePositionZ; final double farClipDistance = focalLenght * FAR + eyePositionZ;
where
FOV
isfieldOfView
in degrees,NEAR
isnearClip
specified in eye space, andFAR
isfarClip
specified in eye space.Note: Since the ParallelCamera class has no
fieldOfView
property, a 30 degrees vertical field of view is used.Note: For the case of a PerspectiveCamera where the fixedEyeAtCameraZero attribute is true, the scene coordinate space is normalized in order to fit into the view frustum (see
PerspectiveCamera
for more details). In this mode, the eye coordinate space is the same as this Camera node's local coordinate space. Hence the conversion formula mentioned above is not used.An application should not extend the Camera class directly. Doing so may lead to an UnsupportedOperationException being thrown.
- Since:
- JavaFX 2.0
-
-
Property Summary
Properties Type Property Description DoubleProperty
farClip
Specifies the distance from the eye of the far clipping plane of thisCamera
in the eye coordinate space.DoubleProperty
nearClip
Specifies the distance from the eye of the near clipping plane of thisCamera
in the eye coordinate space.-
Properties inherited from class javafx.scene.Node
accessibleHelp, accessibleRoleDescription, accessibleRole, accessibleText, blendMode, boundsInLocal, boundsInParent, cacheHint, cache, clip, cursor, depthTest, disabled, disable, effectiveNodeOrientation, effect, eventDispatcher, focused, focusTraversable, hover, id, inputMethodRequests, layoutBounds, layoutX, layoutY, localToParentTransform, localToSceneTransform, managed, mouseTransparent, nodeOrientation, onContextMenuRequested, onDragDetected, onDragDone, onDragDropped, onDragEntered, onDragExited, onDragOver, onInputMethodTextChanged, onKeyPressed, onKeyReleased, onKeyTyped, onMouseClicked, onMouseDragEntered, onMouseDragExited, onMouseDragged, onMouseDragOver, onMouseDragReleased, onMouseEntered, onMouseExited, onMouseMoved, onMousePressed, onMouseReleased, onRotate, onRotationFinished, onRotationStarted, onScrollFinished, onScroll, onScrollStarted, onSwipeDown, onSwipeLeft, onSwipeRight, onSwipeUp, onTouchMoved, onTouchPressed, onTouchReleased, onTouchStationary, onZoomFinished, onZoom, onZoomStarted, opacity, parent, pickOnBounds, pressed, rotate, rotationAxis, scaleX, scaleY, scaleZ, scene, style, translateX, translateY, translateZ, viewOrder, visible
-
-
Field Summary
-
Fields inherited from class javafx.scene.Node
BASELINE_OFFSET_SAME_AS_HEIGHT
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
Camera()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DoubleProperty
farClipProperty()
Specifies the distance from the eye of the far clipping plane of thisCamera
in the eye coordinate space.double
getFarClip()
Gets the value of the property farClip.double
getNearClip()
Gets the value of the property nearClip.DoubleProperty
nearClipProperty()
Specifies the distance from the eye of the near clipping plane of thisCamera
in the eye coordinate space.void
setFarClip(double value)
Sets the value of the property farClip.void
setNearClip(double value)
Sets the value of the property nearClip.-
Methods inherited from class javafx.scene.Node
accessibleHelpProperty, accessibleRoleDescriptionProperty, accessibleRoleProperty, accessibleTextProperty, addEventFilter, addEventHandler, applyCss, autosize, blendModeProperty, boundsInLocalProperty, boundsInParentProperty, buildEventDispatchChain, cacheHintProperty, cacheProperty, clipProperty, computeAreaInScreen, contains, contains, cursorProperty, depthTestProperty, disabledProperty, disableProperty, effectiveNodeOrientationProperty, effectProperty, eventDispatcherProperty, executeAccessibleAction, fireEvent, focusedProperty, focusTraversableProperty, getAccessibleHelp, getAccessibleRole, getAccessibleRoleDescription, getAccessibleText, getBaselineOffset, getBlendMode, getBoundsInLocal, getBoundsInParent, getCacheHint, getClassCssMetaData, getClip, getContentBias, getCssMetaData, getCursor, getDepthTest, getEffect, getEffectiveNodeOrientation, getEventDispatcher, getId, getInitialCursor, getInitialFocusTraversable, getInputMethodRequests, getLayoutBounds, getLayoutX, getLayoutY, getLocalToParentTransform, getLocalToSceneTransform, 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, getProperties, getPseudoClassStates, getRotate, getRotationAxis, getScaleX, getScaleY, getScaleZ, getScene, getStyle, getStyleableParent, getStyleClass, getTransforms, getTranslateX, getTranslateY, getTranslateZ, getTypeSelector, getUserData, getViewOrder, hasProperties, hoverProperty, idProperty, inputMethodRequestsProperty, intersects, intersects, isCache, isDisable, isDisabled, isFocused, isFocusTraversable, isHover, isManaged, isMouseTransparent, isPickOnBounds, isPressed, isResizable, isVisible, layoutBoundsProperty, layoutXProperty, layoutYProperty, localToParent, localToParent, localToParent, localToParent, localToParent, localToParentTransformProperty, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToSceneTransformProperty, localToScreen, localToScreen, localToScreen, localToScreen, localToScreen, lookup, lookupAll, managedProperty, maxHeight, maxWidth, minHeight, minWidth, mouseTransparentProperty, nodeOrientationProperty, notifyAccessibleAttributeChanged, 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, parentToLocal, parentToLocal, parentToLocal, parentToLocal, parentToLocal, pickOnBoundsProperty, prefHeight, prefWidth, pressedProperty, pseudoClassStateChanged, queryAccessibleAttribute, relocate, removeEventFilter, removeEventHandler, requestFocus, resize, resizeRelocate, rotateProperty, rotationAxisProperty, scaleXProperty, scaleYProperty, scaleZProperty, sceneProperty, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, screenToLocal, screenToLocal, screenToLocal, setAccessibleHelp, setAccessibleRole, setAccessibleRoleDescription, setAccessibleText, setBlendMode, setCache, setCacheHint, setClip, setCursor, setDepthTest, 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, setPickOnBounds, setPressed, setRotate, setRotationAxis, setScaleX, setScaleY, setScaleZ, setStyle, setTranslateX, setTranslateY, setTranslateZ, setUserData, setViewOrder, setVisible, snapshot, snapshot, startDragAndDrop, startFullDrag, styleProperty, toBack, toFront, toString, translateXProperty, translateYProperty, translateZProperty, usesMirroring, viewOrderProperty, visibleProperty
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface javafx.css.Styleable
getStyleableNode
-
-
-
-
Property Detail
-
nearClip
public final DoubleProperty nearClipProperty
Specifies the distance from the eye of the near clipping plane of thisCamera
in the eye coordinate space. Objects closer to the eye thannearClip
are not drawn.nearClip
is specified as a value greater than zero. A value less than or equal to zero is treated as a very small positive number.- Default value:
- 0.1
- Since:
- JavaFX 8.0
- See Also:
getNearClip()
,setNearClip(double)
-
farClip
public final DoubleProperty farClipProperty
Specifies the distance from the eye of the far clipping plane of thisCamera
in the eye coordinate space. Objects farther away from the eye thanfarClip
are not drawn.farClip
is specified as a value greater thannearClip
. A value less than or equal tonearClip
is treated asnearClip
plus a very small positive number.- Default value:
- 100.0
- Since:
- JavaFX 8.0
- See Also:
getFarClip()
,setFarClip(double)
-
-
Method Detail
-
setNearClip
public final void setNearClip(double value)
Sets the value of the property nearClip.- Property description:
- Specifies the distance from the eye of the near clipping plane of
this
Camera
in the eye coordinate space. Objects closer to the eye thannearClip
are not drawn.nearClip
is specified as a value greater than zero. A value less than or equal to zero is treated as a very small positive number. - Default value:
- 0.1
- Since:
- JavaFX 8.0
-
getNearClip
public final double getNearClip()
Gets the value of the property nearClip.- Property description:
- Specifies the distance from the eye of the near clipping plane of
this
Camera
in the eye coordinate space. Objects closer to the eye thannearClip
are not drawn.nearClip
is specified as a value greater than zero. A value less than or equal to zero is treated as a very small positive number. - Default value:
- 0.1
- Since:
- JavaFX 8.0
-
nearClipProperty
public final DoubleProperty nearClipProperty()
Specifies the distance from the eye of the near clipping plane of thisCamera
in the eye coordinate space. Objects closer to the eye thannearClip
are not drawn.nearClip
is specified as a value greater than zero. A value less than or equal to zero is treated as a very small positive number.- Default value:
- 0.1
- Since:
- JavaFX 8.0
- See Also:
getNearClip()
,setNearClip(double)
-
setFarClip
public final void setFarClip(double value)
Sets the value of the property farClip.- Property description:
- Specifies the distance from the eye of the far clipping plane of
this
Camera
in the eye coordinate space. Objects farther away from the eye thanfarClip
are not drawn.farClip
is specified as a value greater thannearClip
. A value less than or equal tonearClip
is treated asnearClip
plus a very small positive number. - Default value:
- 100.0
- Since:
- JavaFX 8.0
-
getFarClip
public final double getFarClip()
Gets the value of the property farClip.- Property description:
- Specifies the distance from the eye of the far clipping plane of
this
Camera
in the eye coordinate space. Objects farther away from the eye thanfarClip
are not drawn.farClip
is specified as a value greater thannearClip
. A value less than or equal tonearClip
is treated asnearClip
plus a very small positive number. - Default value:
- 100.0
- Since:
- JavaFX 8.0
-
farClipProperty
public final DoubleProperty farClipProperty()
Specifies the distance from the eye of the far clipping plane of thisCamera
in the eye coordinate space. Objects farther away from the eye thanfarClip
are not drawn.farClip
is specified as a value greater thannearClip
. A value less than or equal tonearClip
is treated asnearClip
plus a very small positive number.- Default value:
- 100.0
- Since:
- JavaFX 8.0
- See Also:
getFarClip()
,setFarClip(double)
-
-