- All Implemented Interfaces:
Styleable,EventTarget
- Direct Known Subclasses:
ParallelCamera,PerspectiveCamera
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.
An application should not extend the Camera class directly. Doing so may lead to an UnsupportedOperationException being thrown.
- Since:
- JavaFX 2.0
-
Property Summary
PropertiesTypePropertyDescriptionfinal DoublePropertySpecifies the distance from the eye of the far clipping plane of thisCamerain the eye coordinate space.final DoublePropertySpecifies the distance from the eye of the near clipping plane of thisCamerain the eye coordinate space.Properties declared in class javafx.scene.Node
accessibleHelp, accessibleRoleDescription, accessibleRole, accessibleText, blendMode, boundsInLocal, boundsInParent, cacheHint, cache, clip, cursor, depthTest, disabled, disable, effectiveNodeOrientation, effect, eventDispatcher, focused, focusTraversable, focusVisible, focusWithin, 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 declared in class javafx.scene.Node
BASELINE_OFFSET_SAME_AS_HEIGHT -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal DoublePropertySpecifies the distance from the eye of the far clipping plane of thisCamerain the eye coordinate space.final doubleGets the value of thefarClipproperty.final doubleGets the value of thenearClipproperty.final DoublePropertySpecifies the distance from the eye of the near clipping plane of thisCamerain the eye coordinate space.final voidsetFarClip(double value) Sets the value of thefarClipproperty.final voidsetNearClip(double value) Sets the value of thenearClipproperty.Methods declared in 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, focusVisibleProperty, focusWithinProperty, 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, isFocusVisible, isFocusWithin, 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, visiblePropertyMethods declared in class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods declared in interface javafx.css.Styleable
getStyleableNode
-
Property Details
-
nearClip
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.- Default value:
- 0.1
- Since:
- JavaFX 8.0
- See Also:
-
farClip
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.- Default value:
- 100.0
- Since:
- JavaFX 8.0
- See Also:
-
-
Constructor Details
-
Camera
protected Camera()Constructor for subclasses to call.
-
-
Method Details
-
setNearClip
public final void setNearClip(double value) Sets the value of thenearClipproperty.- 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
- Parameters:
value- the value for thenearClipproperty- Since:
- JavaFX 8.0
- See Also:
-
getNearClip
public final double getNearClip()Gets the value of thenearClipproperty.- 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
- Returns:
- the value of the
nearClipproperty - Since:
- JavaFX 8.0
- See Also:
-
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.- Default value:
- 0.1
- Returns:
- the
nearClipproperty - Since:
- JavaFX 8.0
- See Also:
-
setFarClip
public final void setFarClip(double value) Sets the value of thefarClipproperty.- 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
- Parameters:
value- the value for thefarClipproperty- Since:
- JavaFX 8.0
- See Also:
-
getFarClip
public final double getFarClip()Gets the value of thefarClipproperty.- 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
- Returns:
- the value of the
farClipproperty - Since:
- JavaFX 8.0
- See Also:
-
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.- Default value:
- 100.0
- Returns:
- the
farClipproperty - Since:
- JavaFX 8.0
- See Also:
-