public abstract class Camera
  Comment     Returned-by     Constructor-argument     Method-argument     Field-type     Type-bound     Links  

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 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.

extends Node

Since:  JavaFX 2.0