Camera

Description

sealed class Tinman.Engine.Components.Camera

The 6-DOF scene camera.

Public / Constructors

Camera


public constructor Camera → (1)

handedness opt : CartesianHandedness = CartesianHandedness.RightHanded

The coordinate system handedness.

Creates a new instance of Camera.

Public / Methods

FromMatrix


public method FromMatrix → (2)

view in : Mat4D

The combined model-view transformation matrix.

projection in : Mat4D

The projection matrix.

Updates this camera view from the view and projection matrices.

LookAt


public method LookAt → (2)

target in : Vec3D

The target to look at.

up in : Vec3D

The up direction.

returns → bool

true if the camera has been updated, false if not because the given target and/or up direction are invalid.

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

MatrixPerspective


[Pure]
public method MatrixPerspective → (5)

width in : int32

[>0]
The viewport width.

height in : int32

[>0]
The viewport height.

nearAtZero in : bool

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 opt : float64 = 0.001

Z-value of near clipping plane.

zFar opt : float64 = 20000000

Z-value of far clipping plane.

returns → Mat4D

The perspective projection matrix.

Creates a perspective projection matrix for the current camera settings.

MatrixView


[Pure]
public method MatrixView → ()

returns → Mat4D

The view matrix.

Creates a view matrix for the current camera settings.

MatrixViewLocal


[Pure]
public method MatrixViewLocal → ()

returns → Mat4D

The view matrix.

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

Move


public method Move → (3)

forward in : float64

Amount to move in forward direction.

right opt : float64 = 0

Amount to move in right-hand direction.

up opt : float64 = 0

Amount to move in upwards direction.

Moves the camera into the given direction.

PanoramaAlign


public method PanoramaAlign → (1)

up in : Vec3D

The up-vector to align to.

Aligns the camera for taking a series of panorama screenshots.

PanoramaRotate


public method PanoramaRotate → (1)

steps in : int32

[1..6]
The total number of panorama screenshots.

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

Rotate


public method Rotate → (3)

yaw in : float64

Counter-clockwise rotation around upwards direction, in radians.

pitch in : float64

Counter-clockwise rotation around right-hand direction, in radians.

roll in : float64

Counter-clockwise rotation around forward direction, in radians.

Rotates the camera by the given amounts.

Set


public method Set → (1)

other in : Camera

[not-null]
The camera to copy settings from.

Copies all settings from the given camera to this one.

Transform


public method Transform → (2)

matrix in : Mat4D

The transformation matrix.

origin opt : Vec3D = default(Vec3D)

The transformation origin.

Transforms this camera using the given matrix.

Update

2 overloads


public method Update1 → (1)

viewport in : Viewport

[not-null]
The Viewport object to update.

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


public method Update2 → (1)

cameraInfo in : CameraInfo

[not-null]
The CameraInfo object to update.

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

Public / Attributes

DirectionForward


public attribute DirectionForward → (get)

value : Vec3D

The unit-length direction vector.

The forward direction of the camera.

DirectionRight


public attribute DirectionRight → (get)

value : Vec3D

The unit-length direction vector.

The right-hand direction of the camera.

DirectionUp


public attribute DirectionUp → (get)

value : Vec3D

The unit-length direction vector.

The upwards direction of the camera.

FovY


public attribute FovY → (get,set)

value : float64

[>0]
The field of view, in degrees.

Vertical field of view, in degrees.

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

Handedness


public attribute Handedness → (get,set)

value : CartesianHandedness

The cartesian handedness.

The coordinate system handedness.

The default value is CartesianHandedness.RightHanded.

IsUndefined


public attribute IsUndefined → (get)

value : bool

true if this camera is undefined, false if it is valid.

Is this camera undefined?

Position


public attribute Position → (get,set)

value : Vec3D

The absolute camera position.

The camera position.

Target


public attribute Target → (get)

value : Vec3D

The look-at target coordinates.

Returns the look-at target at a distance of 1 to Position.

Zoom


public attribute Zoom → (get,set)

value : float64

The zoom factor.

The zoom-factor of the camera.

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

currentFovY := FovY / Zoom