Class Camera
- javafx.scene.Node
-
- javafx.scene.Camera
All Implemented Interfaces:
Direct Known Subclasses:
public abstract class Camera extends Node
ParallelCamera and PerspectiveCamera. 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 and height of the Scene to which it is attached and its fieldOfView.
The nearClip and farClip 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 is fieldOfView in degrees, NEAR is nearClip specified in eye space, and FAR is farClip 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.
Since:
JavaFX 2.0
-
Property Summary
All MethodsInstance MethodsConcrete Methods Type Property and Description DoublePropertyfarClipSpecifies the distance from the eye of the far clipping plane of thisCamerain the eye coordinate space.DoublePropertynearClipSpecifies the distance from the eye of the near clipping plane of thisCamerain 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, visible
-
-
Field Summary
-
Fields inherited from class javafx.scene.Node
BASELINE_OFFSET_SAME_AS_HEIGHT
-
-
Constructor Summary
Constructors Modifier Constructor and Description protectedCamera()
-
Method Summary
All MethodsInstance MethodsConcrete Methods Modifier and Type Method and Description DoublePropertyfarClipProperty()Specifies the distance from the eye of the far clipping plane of thisCamerain the eye coordinate space.doublegetFarClip()Gets the value of the property farClip.doublegetNearClip()Gets the value of the property nearClip.DoublePropertynearClipProperty()Specifies the distance from the eye of the near clipping plane of thisCamerain the eye coordinate space.voidsetFarClip(double value)Sets the value of the property farClip.voidsetNearClip(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, 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, 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, setVisible, snapshot, snapshot, startDragAndDrop, startFullDrag, styleProperty, toBack, toFront, toString, translateXProperty, translateYProperty, translateZProperty, usesMirroring, visibleProperty
-
-
Property Detail
-
nearClip
public final DoubleProperty nearClipProperty
Specifies the distance from the eye of the near clipping plane of thisCamerain the eye coordinate space. Objects closer to the eye thannearClipare not drawn.nearClipis specified as a value greater than zero. A value less than or equal to zero is treated as a very small positive number.
-
farClip
public final DoubleProperty farClipProperty
Specifies the distance from the eye of the far clipping plane of thisCamerain the eye coordinate space. Objects farther away from the eye thanfarClipare not drawn.farClipis specified as a value greater thannearClip. A value less than or equal tonearClipis treated asnearClipplus a very small positive number.
-
-
Constructor Detail
-
Camera
protected Camera()
-
-
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
Camerain the eye coordinate space. Objects closer to the eye thannearClipare not drawn.nearClipis 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
Camerain the eye coordinate space. Objects closer to the eye thannearClipare not drawn.nearClipis 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 thisCamerain the eye coordinate space. Objects closer to the eye thannearClipare not drawn.nearClipis specified as a value greater than zero. A value less than or equal to zero is treated as a very small positive number.
-
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
Camerain the eye coordinate space. Objects farther away from the eye thanfarClipare not drawn.farClipis specified as a value greater thannearClip. A value less than or equal tonearClipis treated asnearClipplus 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
Camerain the eye coordinate space. Objects farther away from the eye thanfarClipare not drawn.farClipis specified as a value greater thannearClip. A value less than or equal tonearClipis treated asnearClipplus 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 thisCamerain the eye coordinate space. Objects farther away from the eye thanfarClipare not drawn.farClipis specified as a value greater thannearClip. A value less than or equal tonearClipis treated asnearClipplus a very small positive number.
-
© 2008, 2025, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from JavaFX API Documentation.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Java, JavaFX and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.