- java.lang.Object
-
- javafx.scene.Node
-
- javafx.scene.Camera
-
- All Implemented Interfaces:
-
Styleable
,EventTarget
- 已知直接子类:
-
ParallelCamera
,PerspectiveCamera
public abstract class Camera extends Node
用于渲染场景的相机的基类。 相机定义了场景坐标空间到窗口的映射。 相机是一个具有两个具体子类的抽象类:ParallelCamera
和PerspectiveCamera
。默认摄像机位于场景中,使其在场景坐标空间中的投影平面处于Z = 0,并且在正Z方向上观察屏幕。 从相机到投影平面的Z距离
width
height
的场景的width
和height
及其fieldOfView
。本相机的
nearClip
和farClip
在眼睛坐标空间中指定。 该空间被定义为使得眼睛处于其原点并且投影平面在正Z方向上在眼前方的一个单位。以下伪代码是用于计算场景坐标空间中近距离和远距离剪辑距离的数学:
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;
其中
FOV
是fieldOfView
度,NEAR
是nearClip
眼空间指定,并且FAR
是farClip
在眼空间中指定。注意:由于ParallelCamera类没有
fieldOfView
属性,因此使用30度垂直视野。注意:对于PerspectiveCamera,其中fixedEyeAtCameraZero属性为true,场景坐标空间被归一化以适应视锥结构(详见
PerspectiveCamera
)。 在此模式下,眼睛坐标空间与该Camera节点的局部坐标空间相同。 因此,不使用上述转化公式。应用程序不应该直接扩展Camera类。 否则可能导致抛出UnsupportedOperationException异常。
- 从以下版本开始:
- JavaFX 2.0
-
-
Property Summary
Properties Type Property 描述 DoubleProperty
farClip
指定眼睛坐标空间中该Camera
的远剪切平面眼睛的距离。DoubleProperty
nearClip
指定眼睛坐标空间中Camera
的近剪裁平面眼睛的距离。-
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
-
-
构造方法摘要
构造方法 Modifier Constructor 描述 protected
Camera()
-
方法摘要
所有方法 接口方法 具体的方法 Modifier and Type 方法 描述 DoubleProperty
farClipProperty()
指定眼睛坐标空间中该Camera
的远剪切平面的距离。double
getFarClip()
获取属性farClip的值。double
getNearClip()
获取nearClip附近的属性的值。DoubleProperty
nearClipProperty()
指定眼睛坐标空间中Camera
的近剪取平面眼睛的距离。void
setFarClip(double value)
设置属性farClip的值。void
setNearClip(double value)
设置属性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
指定眼睛坐标空间中该Camera
的近剪取平面眼睛的距离。 没有绘制比nearClip
更接近眼睛的物体。nearClip
被指定为大于零的值。 小于或等于零的值被视为非常小的正数。- Default value:
- 0.1
- 从以下版本开始:
- JavaFX 8.0
- 另请参见:
-
getNearClip()
,setNearClip(double)
-
farClip
public final DoubleProperty farClipProperty
指定眼睛坐标空间中该Camera
的远剪切平面眼睛的距离。 远离眼睛的物体比farClip
没有绘制。farClip
被指定为大于nearClip
的值。 小于或等于nearClip
值被视为nearClip
加上非常小的正数。- Default value:
- 100.0
- 从以下版本开始:
- JavaFX 8.0
- 另请参见:
-
getFarClip()
,setFarClip(double)
-
-
方法详细信息
-
setNearClip
public final void setNearClip(double value)
设置属性nearClip的值。- Property description:
-
指定眼睛坐标空间中该
Camera
的近剪取平面眼睛的距离。 没有绘制比nearClip
更接近眼睛的物体。nearClip
被指定为大于零的值。 小于或等于零的值被视为非常小的正数。 - Default value:
- 0.1
- 从以下版本开始:
- JavaFX 8.0
-
getNearClip
public final double getNearClip()
获取nearClip附近的属性的值。- Property description:
-
指定眼睛坐标空间中该
Camera
的近剪裁平面眼睛的距离。 没有画出比nearClip
更接近眼睛的物体。nearClip
被指定为大于零的值。 小于或等于零的值被视为非常小的正数。 - Default value:
- 0.1
- 从以下版本开始:
- JavaFX 8.0
-
nearClipProperty
public final DoubleProperty nearClipProperty()
指定眼睛坐标空间中该Camera
的近剪取平面眼睛的距离。 没有绘制比nearClip
更接近眼睛的物体。nearClip
被指定为大于零的值。 小于或等于零的值被视为非常小的正数。- Default value:
- 0.1
- 从以下版本开始:
- JavaFX 8.0
- 另请参见:
-
getNearClip()
,setNearClip(double)
-
setFarClip
public final void setFarClip(double value)
设置属性farClip的值。- Property description:
-
指定眼睛坐标空间中该
Camera
的远剪切平面眼睛的距离。 远离眼睛的物体比farClip
没有绘制。farClip
被指定为大于nearClip
的值。 小于或等于nearClip
值被视为nearClip
加上非常小的正数。 - Default value:
- 100.0
- 从以下版本开始:
- JavaFX 8.0
-
getFarClip
public final double getFarClip()
获取属性farClip的值。- Property description:
-
指定眼睛坐标空间中该
Camera
的远剪切平面的距离。 远离眼睛的物体比farClip
没有绘制。farClip
被指定为大于nearClip
的值。 小于或等于nearClip
值被视为nearClip
加上非常小的正数。 - Default value:
- 100.0
- 从以下版本开始:
- JavaFX 8.0
-
farClipProperty
public final DoubleProperty farClipProperty()
指定眼睛坐标空间中该Camera
的远剪取平面的距离。 远离眼睛的物体比farClip
没有绘制。farClip
被指定为大于nearClip
的值。 小于或等于nearClip
值被视为nearClip
加上非常小的正数。- Default value:
- 100.0
- 从以下版本开始:
- JavaFX 8.0
- 另请参见:
-
getFarClip()
,setFarClip(double)
-
-