TINMAN 3D / REALTIME TERRAIN
Software Development Kit - User Manual

class Camera in Tinman.AddOns.Components

The 6-DOF scene camera.

sealed class Camera implements IEquatable<Camera>
  IJsonizable
  IVersioned

Public / Attributes

DirectionForward

The forward direction of the camera.

public property DirectionForward { get }
type Vec3D
value The unit-length direction vector.

DirectionRight

The right-hand direction of the camera.

public property DirectionRight { get }
type Vec3D
value The unit-length direction vector.

DirectionUp

The upwards direction of the camera.

public property DirectionUp { get }
type Vec3D
value The unit-length direction vector.

FovY

Vertical field of view, in degrees.

public property FovY { get set }
type float64
value [>0] The field of view, in degrees.

Remarks:

The default value is 50.625° (conforms to a horizontal field of view of 90°, for an aspect ratio of 16:9).

Handedness

The coordinate system handedness.

public property Handedness { get set }
type CartesianHandedness
value The cartesian handedness.

Remarks:

The default value is RightHanded.

IsUndefined

Is this camera undefined?

public property IsUndefined { get }
type bool
value true if this camera is undefined, false if it is valid.

Position

The camera position.

public property Position { get set }
type Vec3D
value The absolute camera position.

Target

public property Target { get }
type Vec3D
value

Version

Returns the current version of object.

public property Version { get }
type int32
value The current version number.
implements IVersioned.Version

Remarks:

For each modification, the version is incremented by at least one.

Zoom

The zoom-factor of the camera.

public property Zoom { get set }
type float64
value The zoom factor.

Remarks:

The current vertical field of view of the camera can be computed as follows:

currentFovY := FovY / Zoom

Public / Constructors

Camera

Creates a new instance of Camera.

public constructor Camera (CartesianHandedness handedness = CartesianHandedness.RightHanded)
params handedness The coordinate system handedness. Defaults to RightHanded

Public / Methods

Equals

Compares this object with the given one.

[Pure]
public method Equals (Camera other)
type bool
params other The object to compare to.
returns true if this object is equal to other, false if not.
implements IEquatable.Equals

FromMatrix

Updates this camera view from the view and projection matrices.

public method FromMatrix (Mat4D view, Mat4D projection)
params view The combined model-view transformation matrix.
  projection The projection matrix.

JsonDeserialize

Restores the object state from the given JSON value.

public method JsonDeserialize (JsonValue value)
params value [not-null] The input JSON value.
implements IJsonizable.JsonDeserialize

Remarks:

Implementations of this method must be able to consume malformed JSON values, without corrupting the object state.

JsonSerialize

Serializes the object state to an JSON value.

public method JsonSerialize (JsonValue value)
params value [not-null] The output JSON value.
implements IJsonizable.JsonSerialize

LookAt

Lets the scene camera look at the given target from its current position.

public method LookAt (Vec3D target, Vec3D up)
type bool
params target The target to look at.
  up The up direction.
returns true if the camera has been updated, false if not because the given target and/or up direction are invalid.

MatrixPerspective

Creates a perspective projection matrix for the current camera settings.

[Pure]
public method MatrixPerspective (int32 width, int32 height, bool nearAtZero, float64 zNear = 0.001, float64 zFar = 20000000)
type Mat4D
params width [>0] The viewport width.
  height [>0] The viewport height.
  nearAtZero When true, the near clipping plane will be mapped to 0 in clip-space (e.g. Direct3D); when false it will be mapped to -1 (e.g. OpenGL).
  zNear Z-value of near clipping plane. Defaults to 0.001.
  zFar Z-value of far clipping plane. Defaults to 20000000.
returns The perspective projection matrix.

MatrixView

Creates a view matrix for the current camera settings.

[Pure]
public method MatrixView ()
type Mat4D
returns The view matrix.

MatrixViewLocal

Creates a view matrix without translation components for the current camera settings.

public method MatrixViewLocal ()
type Mat4D
returns The view matrix.

Move

Moves the camera into the given direction.

[Pure]
public method Move (float64 forward, float64 right = 0, float64 up = 0)
params forward Amount to move in forward direction.
  right Amount to move in right-hand direction.
  up Amount to move in upwards direction.

PanoramaAlign

Aligns the camera for taking a series of panorama screenshots.

public method PanoramaAlign (Vec3D up)
params up The up-vector to align to.

See also:

PanoramaRotate

PanoramaRotate

Rotates the camera for taking the next screenshot in a series of panorama screenshots.

public method PanoramaRotate (int32 steps)
params steps [1..6] The total number of panorama screenshots.

See also:

PanoramaAlign

Rotate

Rotates the camera by the given amounts.

public method Rotate (float64 yaw, float64 pitch, float64 roll)
params yaw Counter-clockwise rotation around upwards direction, in radians.
  pitch Counter-clockwise rotation around right-hand direction, in radians.
  roll Counter-clockwise rotation around forward direction, in radians.

Set

Copies all settings from the given camera to this one.

public method Set (Camera other)
params other [not-null] The camera to copy settings from.

Transform

Transforms this camera using the given matrix.

public method Transform (Mat4D matrix, Vec3D origin = default(Vec3D))
params matrix The transformation matrix.
  origin The transformation origin.

Update

Updates the given Viewport object using values from the current state of this camera.

public method Update (Viewport viewport)
params viewport [not-null] The Viewport object to update.

Updates the given CameraInfo object using values from the current state of this camera.

public method Update (CameraInfo cameraInfo)
params cameraInfo [not-null] The CameraInfo object to update.