public final class Camera
extends java.lang.Object
Camera represents a camera in the scene from which to render an image.
This Camera class uses a float array to store certain parameters. This float array can be accessed by calling getArray(). It is never cloned, so use it with caution.
Because the float array is never cloned, changing its element values will change the state of this class, however, the hasUpdated() method will not be aware of this state change. The preferred way to change the parameters, is to use
the methods of this class.
When the pitch and yaw parameters have been changed, it's required to call the update() method, which updates the OrthoNormal Basis.
The float array has the following format:
00 array[ABSOLUTE_OFFSET_APERTURE_RADIUS]: Aperture Radius
01 array[ABSOLUTE_OFFSET_EYE_X]: Eye X
02 array[ABSOLUTE_OFFSET_EYE_Y]: Eye Y
03 array[ABSOLUTE_OFFSET_EYE_Z]: Eye Z
04 array[ABSOLUTE_OFFSET_FIELD_OF_VIEW_X]: Field of View X in Degrees
05 array[ABSOLUTE_OFFSET_FIELD_OF_VIEW_Y]: Field of View Y in Degrees
06 array[ABSOLUTE_OFFSET_FOCAL_DISTANCE]: Focal Distance
07 array[ABSOLUTE_OFFSET_ORTHONORMAL_BASIS_U_X]: OrthoNormal Basis U X
08 array[ABSOLUTE_OFFSET_ORTHONORMAL_BASIS_U_Y]: OrthoNormal Basis U Y
09 array[ABSOLUTE_OFFSET_ORTHONORMAL_BASIS_U_Z]: OrthoNormal Basis U Z
10 array[ABSOLUTE_OFFSET_ORTHONORMAL_BASIS_V_X]: OrthoNormal Basis V X
11 array[ABSOLUTE_OFFSET_ORTHONORMAL_BASIS_V_Y]: OrthoNormal Basis V Y
12 array[ABSOLUTE_OFFSET_ORTHONORMAL_BASIS_V_Z]: OrthoNormal Basis V Z
13 array[ABSOLUTE_OFFSET_ORTHONORMAL_BASIS_W_X]: OrthoNormal Basis W X
14 array[ABSOLUTE_OFFSET_ORTHONORMAL_BASIS_W_Y]: OrthoNormal Basis W Y
15 array[ABSOLUTE_OFFSET_ORTHONORMAL_BASIS_W_Z]: OrthoNormal Basis W Z
16 array[ABSOLUTE_OFFSET_RESOLUTION_X]: Resolution X or Width
17 array[ABSOLUTE_OFFSET_RESOLUTION_Y]: Resolution Y or Height
18 array[ABSOLUTE_OFFSET_CAMERA_LENS]: Camera Lens (one of CAMERA_LENS_FISHEYE (2) and CAMERA_LENS_THIN (1))
| Modifier and Type | Field and Description |
|---|---|
static int |
ABSOLUTE_OFFSET_APERTURE_RADIUS
The absolute offset of the Aperture Radius parameter in the
float array. |
static int |
ABSOLUTE_OFFSET_CAMERA_LENS
The absolute offset of the Camera Lens parameter in the
float array. |
static int |
ABSOLUTE_OFFSET_EYE
The absolute offset of the Eye parameter in the
float array. |
static int |
ABSOLUTE_OFFSET_EYE_X
The absolute offset of the Eye X parameter in the
float array. |
static int |
ABSOLUTE_OFFSET_EYE_Y
The absolute offset of the Eye Y parameter in the
float array. |
static int |
ABSOLUTE_OFFSET_EYE_Z
The absolute offset of the Eye Z parameter in the
float array. |
static int |
ABSOLUTE_OFFSET_FIELD_OF_VIEW
The absolute offset of the Field of View parameter in the
float array. |
static int |
ABSOLUTE_OFFSET_FIELD_OF_VIEW_X
The absolute offset of the Field of View X parameter in the
float array. |
static int |
ABSOLUTE_OFFSET_FIELD_OF_VIEW_Y
The absolute offset of the Field of View Y parameter in the
float array. |
static int |
ABSOLUTE_OFFSET_FOCAL_DISTANCE
The absolute offset of the Focal Distance parameter in the
float array. |
static int |
ABSOLUTE_OFFSET_ORTHONORMAL_BASIS_U
The absolute offset of the OrthoNormal Basis U parameter in the
float array. |
static int |
ABSOLUTE_OFFSET_ORTHONORMAL_BASIS_U_X
The absolute offset of the OrthoNormal Basis U X parameter in the
float array. |
static int |
ABSOLUTE_OFFSET_ORTHONORMAL_BASIS_U_Y
The absolute offset of the OrthoNormal Basis U Y parameter in the
float array. |
static int |
ABSOLUTE_OFFSET_ORTHONORMAL_BASIS_U_Z
The absolute offset of the OrthoNormal Basis U Z parameter in the
float array. |
static int |
ABSOLUTE_OFFSET_ORTHONORMAL_BASIS_V
The absolute offset of the OrthoNormal Basis V parameter in the
float array. |
static int |
ABSOLUTE_OFFSET_ORTHONORMAL_BASIS_W
The absolute offset of the OrthoNormal Basis W parameter in the
float array. |
static int |
ABSOLUTE_OFFSET_ORTHONORMAL_BASIS_V_X
The absolute offset of the OrthoNormal Basis V X parameter in the
float array. |
static int |
ABSOLUTE_OFFSET_ORTHONORMAL_BASIS_W_X
The absolute offset of the OrthoNormal Basis W X parameter in the
float array. |
static int |
ABSOLUTE_OFFSET_ORTHONORMAL_BASIS_V_Y
The absolute offset of the OrthoNormal Basis V Y parameter in the
float array. |
static int |
ABSOLUTE_OFFSET_ORTHONORMAL_BASIS_W_Y
The absolute offset of the OrthoNormal Basis W Y parameter in the
float array. |
static int |
ABSOLUTE_OFFSET_ORTHONORMAL_BASIS_V_Z
The absolute offset of the OrthoNormal Basis V Z parameter in the
float array. |
static int |
ABSOLUTE_OFFSET_ORTHONORMAL_BASIS_W_Z
The absolute offset of the OrthoNormal Basis W Z parameter in the
float array. |
static int |
ABSOLUTE_OFFSET_RESOLUTION
The absolute offset of the Resolution parameter in the
float array. |
static int |
ABSOLUTE_OFFSET_RESOLUTION_X
The absolute offset of the Resolution X parameter in the
float array. |
static int |
ABSOLUTE_OFFSET_RESOLUTION_Y
The absolute offset of the Resolution Y parameter in the
float array. |
static int |
CAMERA_LENS_FISHEYE
A constant denoting the Camera Lens parameter value for a Fisheye camera lens.
|
static int |
CAMERA_LENS_THIN
A constant denoting the Camera Lens parameter value for a Thin camera lens.
|
static int |
SIZE
A constant containing the size of the
float array. |
| Constructor and Description |
|---|
Camera()
Constructs a new default
Camera instance. |
Camera(float[] array)
Constructs a new
Camera instance given array as the float array to store certain parameters. |
| Modifier and Type | Method and Description |
|---|---|
void |
addCameraObserver(CameraObserver cameraObserver)
Adds
cameraObserver to this Camera instance. |
void |
changeAltitude(float y)
Changes the altitude of this
Camera instance. |
void |
changePitch(AngleF pitch)
Changes the pitch angle of this
Camera instance. |
void |
changeYaw(AngleF yaw)
Changes the yaw angle of this
Camera instance. |
void |
forward(float distance)
Moves this
Camera instance forward (or backward) with distance units. |
float |
getApertureRadius()
Returns the value of the Aperture Radius parameter.
|
float[] |
getArray()
Returns the
float array that stores certain parameters. |
float |
getEyeX()
Returns the value of the Eye X parameter.
|
float |
getEyeY()
Returns the value of the Eye Y parameter.
|
float |
getEyeZ()
Returns the value of the Eye Z parameter.
|
float |
getFieldOfViewX()
Returns the value of the Field of View X parameter.
|
float |
getFieldOfViewY()
Returns the value of the Field of View Y parameter.
|
float |
getFocalDistance()
Returns the value of the Focal Distance parameter.
|
float |
getOrthoNormalBasisUX()
Returns the value of the OrthoNormal Basis U X parameter.
|
float |
getOrthoNormalBasisUY()
Returns the value of the OrthoNormal Basis U Y parameter.
|
float |
getOrthoNormalBasisUZ()
Returns the value of the OrthoNormal Basis U Z parameter.
|
float |
getOrthoNormalBasisVX()
Returns the value of the OrthoNormal Basis V X parameter.
|
float |
getOrthoNormalBasisWX()
Returns the value of the OrthoNormal Basis W X parameter.
|
float |
getOrthoNormalBasisVY()
Returns the value of the OrthoNormal Basis V Y parameter.
|
float |
getOrthoNormalBasisWY()
Returns the value of the OrthoNormal Basis W Y parameter.
|
float |
getOrthoNormalBasisVZ()
Returns the value of the OrthoNormal Basis V Z parameter.
|
float |
getOrthoNormalBasisWZ()
Returns the value of the OrthoNormal Basis W Z parameter.
|
AngleF |
getPitch()
Returns an
AngleF with the current pitch angle. |
float |
getResolutionX()
Returns the value of the Resolution X parameter.
|
float |
getResolutionY()
Returns the value of the Resolution Y parameter.
|
AngleF |
getYaw()
Returns an
AngleF with the current yaw angle. |
boolean |
hasUpdated()
Returns
true if, and only if, the state of this Camera instance has been updated, false otherwise. |
boolean |
isFisheyeCameraLens()
Returns
true if, and only if, the Camera Lens parameter is set to Fisheye camera lens, false otherwise. |
boolean |
isThinCameraLens()
Returns
true if, and only if, the Camera Lens parameter is set to Thin camera lens, false otherwise. |
boolean |
isWalkLockEnabled()
Returns
true if, and only if, walk lock is enabled, false otherwise. |
void |
removeCameraObserver(CameraObserver cameraObserver)
Removes
cameraObserver from this Camera instance. |
void |
setApertureRadius(float apertureRadius)
Sets the value of the Aperture Radius parameter.
|
void |
setArray(float[] array)
Sets the
float array to store certain parameters. |
void |
setCameraLens(int cameraLens)
Sets the value for the Camera Lens parameter.
|
void |
setEye(float eyeX,
float eyeY,
float eyeZ)
Sets the values for the Eye X, Eye Y and Eye Z parameters.
|
void |
setFieldOfViewX(float fieldOfViewX)
Sets the value for the Field of View X parameter and calculates the value for the Field of View Y parameter.
|
void |
setFisheyeCameraLens(boolean isFisheyeCameraLens)
Sets the value for the Camera Lens parameter.
|
void |
setFocalDistance(float focalDistance)
Sets the value for the Focal Distance parameter.
|
void |
setPitch(AngleF pitch)
Sets
pitch as the current pitch angle. |
void |
setResolution(float resolutionX,
float resolutionY)
Sets the values for the Resolution X and Resolution Y parameters.
|
void |
setThinCameraLens(boolean isThinCameraLens)
Sets the value for the Camera Lens parameter.
|
void |
setWalkLockEnabled(boolean isWalkLockEnabled)
Sets the walk lock state.
|
void |
setYaw(AngleF yaw)
Sets
yaw as the current yaw angle. |
void |
strafe(float distance)
Moves this
Camera instance to the left or right with distance units. |
void |
update()
Updates the OrthoNormal Basis parameter using the current pitch and yaw angles and clears the update flag.
|
public static final int ABSOLUTE_OFFSET_APERTURE_RADIUS
float array. The value is 0.public static final int ABSOLUTE_OFFSET_CAMERA_LENS
float array. The value is 18.public static final int ABSOLUTE_OFFSET_EYE
float array. The value is 1.public static final int ABSOLUTE_OFFSET_EYE_X
float array. The value is 1.public static final int ABSOLUTE_OFFSET_EYE_Y
float array. The value is 2.public static final int ABSOLUTE_OFFSET_EYE_Z
float array. The value is 3.public static final int ABSOLUTE_OFFSET_FIELD_OF_VIEW
float array. The value is 4.public static final int ABSOLUTE_OFFSET_FIELD_OF_VIEW_X
float array. The value is 4.public static final int ABSOLUTE_OFFSET_FIELD_OF_VIEW_Y
float array. The value is 5.public static final int ABSOLUTE_OFFSET_FOCAL_DISTANCE
float array. The value is 6.public static final int ABSOLUTE_OFFSET_ORTHONORMAL_BASIS_U
float array. The value is 7.public static final int ABSOLUTE_OFFSET_ORTHONORMAL_BASIS_U_X
float array. The value is 7.public static final int ABSOLUTE_OFFSET_ORTHONORMAL_BASIS_U_Y
float array. The value is 8.public static final int ABSOLUTE_OFFSET_ORTHONORMAL_BASIS_U_Z
float array. The value is 9.public static final int ABSOLUTE_OFFSET_ORTHONORMAL_BASIS_V
float array. The value is 10.public static final int ABSOLUTE_OFFSET_ORTHONORMAL_BASIS_V_X
float array. The value is 10.public static final int ABSOLUTE_OFFSET_ORTHONORMAL_BASIS_V_Y
float array. The value is 11.public static final int ABSOLUTE_OFFSET_ORTHONORMAL_BASIS_V_Z
float array. The value is 12.public static final int ABSOLUTE_OFFSET_ORTHONORMAL_BASIS_W
float array. The value is 13.public static final int ABSOLUTE_OFFSET_ORTHONORMAL_BASIS_W_X
float array. The value is 13.public static final int ABSOLUTE_OFFSET_ORTHONORMAL_BASIS_W_Y
float array. The value is 14.public static final int ABSOLUTE_OFFSET_ORTHONORMAL_BASIS_W_Z
float array. The value is 15.public static final int ABSOLUTE_OFFSET_RESOLUTION
float array. The value is 16.public static final int ABSOLUTE_OFFSET_RESOLUTION_X
float array. The value is 16.public static final int ABSOLUTE_OFFSET_RESOLUTION_Y
float array. The value is 17.public static final int CAMERA_LENS_FISHEYE
2.public static final int CAMERA_LENS_THIN
1.public static final int SIZE
float array. The size is 19.public Camera()
Camera instance.public Camera(float[] array)
Camera instance given array as the float array to store certain parameters.
This constructor does not clone array.
If array is null, a NullPointerException will be thrown.
array - the float array to store certain parametersjava.lang.NullPointerException - thrown if, and only if, array is nullpublic AngleF getPitch()
AngleF with the current pitch angle.AngleF with the current pitch anglepublic AngleF getYaw()
AngleF with the current yaw angle.AngleF with the current yaw anglepublic boolean hasUpdated()
true if, and only if, the state of this Camera instance has been updated, false otherwise.true if, and only if, the state of this Camera instance has been updated, false otherwisepublic boolean isFisheyeCameraLens()
true if, and only if, the Camera Lens parameter is set to Fisheye camera lens, false otherwise.true if, and only if, the Camera Lens parameter is set to Fisheye camera lens, false otherwisepublic boolean isThinCameraLens()
true if, and only if, the Camera Lens parameter is set to Thin camera lens, false otherwise.true if, and only if, the Camera Lens parameter is set to Thin camera lens, false otherwisepublic boolean isWalkLockEnabled()
true if, and only if, walk lock is enabled, false otherwise.true if, and only if, walk lock is enabled, false otherwisepublic float getApertureRadius()
public float getEyeX()
public float getEyeY()
public float getEyeZ()
public float getFieldOfViewX()
public float getFieldOfViewY()
public float getFocalDistance()
public float getOrthoNormalBasisUX()
public float getOrthoNormalBasisUY()
public float getOrthoNormalBasisUZ()
public float getOrthoNormalBasisVX()
public float getOrthoNormalBasisVY()
public float getOrthoNormalBasisVZ()
public float getOrthoNormalBasisWX()
public float getOrthoNormalBasisWY()
public float getOrthoNormalBasisWZ()
public float getResolutionX()
public float getResolutionY()
public float[] getArray()
float array that stores certain parameters.
This method will return the actual array and not a clone of it.
float array that stores certain parameterspublic void addCameraObserver(CameraObserver cameraObserver)
cameraObserver to this Camera instance.
If cameraObserver is null, a NullPointerException will be thrown.
cameraObserver - the CameraObserver to addjava.lang.NullPointerException - thrown if, and only if, cameraObserver is nullpublic void changeAltitude(float y)
Camera instance.
This method changes the Eye Y parameter.
y - the value to add to the Eye Y parameterpublic void changePitch(AngleF pitch)
Camera instance.
If pitch is null, a NullPointerException will be thrown.
pitch - the pitch angle to add to the current pitch anglejava.lang.NullPointerException - thrown if, and only if, pitch is nullpublic void changeYaw(AngleF yaw)
Camera instance.
If yaw is null, a NullPointerException will be thrown.
yaw - the yaw angle to add to the current yaw anglejava.lang.NullPointerException - thrown if, and only if, yaw is nullpublic void forward(float distance)
Camera instance forward (or backward) with distance units.
If isWalkLockEnabled() returns true, this method will only affect the X- and Z-axes. Otherwise all axes will be affected.
distance - the distance to movepublic void removeCameraObserver(CameraObserver cameraObserver)
cameraObserver from this Camera instance.
If cameraObserver is null, a NullPointerException will be thrown.
cameraObserver - the CameraObserver to removejava.lang.NullPointerException - thrown if, and only if, cameraObserver is nullpublic void setApertureRadius(float apertureRadius)
apertureRadius - the new value of the Aperture Radius parameterpublic void setArray(float[] array)
float array to store certain parameters.
This method does not clone array.
If array is null, a NullPointerException will be thrown.
array - the float array to store certain parametersjava.lang.NullPointerException - thrown if, and only if, array is nullpublic void setCameraLens(int cameraLens)
cameraLens - the new value for the Camera Lens parameterpublic void setEye(float eyeX,
float eyeY,
float eyeZ)
eyeX - the new value for the Eye X parametereyeY - the new value for the Eye Y parametereyeZ - the new value for the Eye Z parameterpublic void setFieldOfViewX(float fieldOfViewX)
fieldOfViewX - the new value for the Field of View X parameterpublic void setFisheyeCameraLens(boolean isFisheyeCameraLens)
If isFisheyeCameraLens is true, the Camera Lens parameter will be set to CAMERA_LENS_FISHEYE, otherwise it will be set to CAMERA_LENS_THIN.
isFisheyeCameraLens - true if, and only if, the Camera Lens parameter should be set to CAMERA_LENS_FISHEYE, false otherwisepublic void setFocalDistance(float focalDistance)
focalDistance - the new value for the Focal Distance parameterpublic void setPitch(AngleF pitch)
pitch as the current pitch angle.
If pitch is null, a NullPointerException will be thrown.
Calling this method will notify all currently added CameraObservers of an updated pitch angle.
pitch - an AngleF with the pitch angle to setjava.lang.NullPointerException - thrown if, and only if, pitch is nullpublic void setResolution(float resolutionX,
float resolutionY)
resolutionX - the new value for the Resolution X parameterresolutionY - the new value for the Resolution Y parameterpublic void setThinCameraLens(boolean isThinCameraLens)
If isThinCameraLens is true, the Camera Lens parameter will be set to CAMERA_LENS_THIN, otherwise it will be set to CAMERA_LENS_FISHEYE.
isThinCameraLens - true if, and only if, the Camera Lens parameter should be set to CAMERA_LENS_THIN, false otherwisepublic void setWalkLockEnabled(boolean isWalkLockEnabled)
isWalkLockEnabled - true if, and only if, walk lock is enabled, false otherwisepublic void setYaw(AngleF yaw)
yaw as the current yaw angle.
If yaw is null, a NullPointerException will be thrown.
Calling this method will notify all currently added CameraObservers of an updated yaw angle.
yaw - an AngleF with the yaw angle to setjava.lang.NullPointerException - thrown if, and only if, yaw is nullpublic void strafe(float distance)
Camera instance to the left or right with distance units.
If isWalkLockEnabled() returns true, this method will only affect the X- and Z-axes. Otherwise all axes will be affected.
distance - the distance to movepublic void update()