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.
| Modifier and Type | Field and Description |
|---|---|
| private boolean | |
| private DoubleProperty | farClip
Specifies the distance from the eye of the far clipping plane of
this |
| private double | |
| private Affine3D | |
| private boolean | |
| private DoubleProperty | nearClip
Specifies the distance from the eye of the near clipping plane of
this |
| private double | |
| private Scene | |
| private SubScene | |
| private Vec3d | |
| private GeneralTransform3D | |
| private GeneralTransform3D | |
| private boolean | |
| private Affine3D | sceneToLocalTx
An affine transform that holds the computed scene-to-local transform. |
| private boolean | |
| private double | |
| private Affine3D | |
| private double |
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv abstract PickRay | Returns: The PickRay instance computed based on this camera and the given arguments.horizontal coordinate of the pick ray in the projected
view, usually mouse cursor position x, double vertical coordinate of the pick ray in the projected
view, usually mouse cursor position y, PickRay pick ray to be reused. New instance is created in case
of null. pickRay)Computes pick ray for the content rendered by this camera. |
| pack-priv abstract Vec3d | Returns: The position of the camera in the scene in camera local coordsPosition to be reused. New instance is created in case
of null. position)Computes local position of the camera in the scene. |
| pack-priv abstract void | |
| pack-priv abstract void | |
| pack-priv Camera | |
| private boolean | |
| private BaseBounds | |
| private void | doMarkDirty(DirtyBits dirtyBit)
Hides javafx. Mark the specified bit as dirty, and add this node to the scene's dirty list. |
| private void | |
| public final DoubleProperty | |
| pack-priv Affine3D | |
| public final double | |
| pack-priv double | |
| public final double | |
| pack-priv double | |
| pack-priv GeneralTransform3D | |
| pack-priv Affine3D | |
| pack-priv double | |
| pack-priv double | |
| private void | |
| public final DoubleProperty | |
| private Point2D | pickNodeXYPlane(Node node, double x, double y)
Computes intersection point of the pick ray cast by the given coordinates and the node's local XY plane. |
| pack-priv Point3D | pickProjectPlane(double x, double y)
Computes intersection point of the pick ray cast by the given coordinates and the projection plane. |
| private Point2D | |
| private static double | |
| public final void | |
| public final void | |
| pack-priv void | |
| pack-priv void | |
| pack-priv void | |
| pack-priv void | |
| private void |
| clipInSceneValid | back to summary |
|---|---|
| private boolean clipInSceneValid | |
| farClip | back to summary |
|---|---|
| private DoubleProperty farClip Specifies the distance from the eye of the far clipping plane of
this
| |
| farClipInScene | back to summary |
|---|---|
| private double farClipInScene | |
| localToSceneTx | back to summary |
|---|---|
| private Affine3D localToSceneTx | |
| localToSceneValid | back to summary |
|---|---|
| private boolean localToSceneValid | |
| nearClip | back to summary |
|---|---|
| private DoubleProperty nearClip Specifies the distance from the eye of the near clipping plane of
this
| |
| nearClipInScene | back to summary |
|---|---|
| private double nearClipInScene | |
| ownerScene | back to summary |
|---|---|
| private Scene ownerScene | |
| ownerSubScene | back to summary |
|---|---|
| private SubScene ownerSubScene | |
| position | back to summary |
|---|---|
| private Vec3d position | |
| projTx | back to summary |
|---|---|
| private GeneralTransform3D projTx | |
| projViewTx | back to summary |
|---|---|
| private GeneralTransform3D projViewTx | |
| projViewTxValid | back to summary |
|---|---|
| private boolean projViewTxValid | |
| sceneToLocalTx | back to summary |
|---|---|
| private Affine3D sceneToLocalTx An affine transform that holds the computed scene-to-local transform. It is used to convert node to camera coordinate when rotation is involved. | |
| sceneToLocalValid | back to summary |
|---|---|
| private boolean sceneToLocalValid | |
| viewHeight | back to summary |
|---|---|
| private double viewHeight | |
| viewTx | back to summary |
|---|---|
| private Affine3D viewTx | |
| viewWidth | back to summary |
|---|---|
| private double viewWidth | |
| Camera | back to summary |
|---|---|
| protected Camera() Constructor for subclasses to call. | |
| computePickRay | back to summary |
|---|---|
| pack-priv abstract PickRay computePickRay(double x, double y, PickRay pickRay) Computes pick ray for the content rendered by this camera.
| |
| computePosition | back to summary |
|---|---|
| pack-priv abstract Vec3d computePosition(Vec3d position) Computes local position of the camera in the scene. | |
| computeProjectionTransform | back to summary |
|---|---|
| pack-priv abstract void computeProjectionTransform(GeneralTransform3D proj) | |
| computeViewTransform | back to summary |
|---|---|
| pack-priv abstract void computeViewTransform(Affine3D view) | |
| copy | back to summary |
|---|---|
| pack-priv Camera copy() | |
| doComputeContains | back to summary |
|---|---|
| private boolean doComputeContains(double localX, double localY) | |
| doComputeGeomBounds | back to summary |
|---|---|
| private BaseBounds doComputeGeomBounds(BaseBounds bounds, BaseTransform tx) | |
| doMarkDirty | back to summary |
|---|---|
| private void doMarkDirty(DirtyBits dirtyBit) Hides javafx. Doc from javafx. Mark the specified bit as dirty, and add this node to the scene's dirty list. Note This method MUST only be called via its accessor method. | |
| doUpdatePeer | back to summary |
|---|---|
| private void doUpdatePeer() | |
| farClipProperty | back to summary |
|---|---|
| public final DoubleProperty farClipProperty() | |
| getCameraTransform | back to summary |
|---|---|
| pack-priv Affine3D getCameraTransform() Returns the local-to-scene transform of this camera. Package private, for use in our internal subclasses. Returns directly the internal instance, it must not be altered. | |
| getFarClip | back to summary |
|---|---|
| public final double getFarClip() | |
| getFarClipInScene | back to summary |
|---|---|
| pack-priv double getFarClipInScene() | |
| getNearClip | back to summary |
|---|---|
| public final double getNearClip() | |
| getNearClipInScene | back to summary |
|---|---|
| pack-priv double getNearClipInScene() | |
| getProjViewTransform | back to summary |
|---|---|
| pack-priv GeneralTransform3D getProjViewTransform() Returns the projView transform of this camera. Package private, for internal use. Returns directly the internal instance, it must not be altered. | |
| getSceneToLocalTransform | back to summary |
|---|---|
| pack-priv Affine3D getSceneToLocalTransform() | |
| getViewHeight | back to summary |
|---|---|
| pack-priv double getViewHeight() | |
| getViewWidth | back to summary |
|---|---|
| pack-priv double getViewWidth() | |
| markOwnerDirty | back to summary |
|---|---|
| private void markOwnerDirty() | |
| nearClipProperty | back to summary |
|---|---|
| public final DoubleProperty nearClipProperty() | |
| pickNodeXYPlane | back to summary |
|---|---|
| private Point2D pickNodeXYPlane(Node node, double x, double y) Computes intersection point of the pick ray cast by the given coordinates and the node's local XY plane. | |
| pickProjectPlane | back to summary |
|---|---|
| pack-priv Point3D pickProjectPlane(double x, double y) Computes intersection point of the pick ray cast by the given coordinates and the projection plane. | |
| project | back to summary |
|---|---|
| private Point2D project(Point3D p) Transforms the given 3D point to the flat projected coordinates. | |
| safeSize | back to summary |
|---|---|
| private static double safeSize(double size) | |
| setFarClip | back to summary |
|---|---|
| public final void setFarClip(double value) | |
| setNearClip | back to summary |
|---|---|
| public final void setNearClip(double value) | |
| setOwnerScene | back to summary |
|---|---|
| pack-priv void setOwnerScene(Scene s) | |
| setOwnerSubScene | back to summary |
|---|---|
| pack-priv void setOwnerSubScene(SubScene s) | |
| setViewHeight | back to summary |
|---|---|
| pack-priv void setViewHeight(double height) | |
| setViewWidth | back to summary |
|---|---|
| pack-priv void setViewWidth(double width) | |
| updateClipPlane | back to summary |
|---|---|
| private void updateClipPlane() | |