Skip to content

Class Camera

Namespace: Apogee.Rendering
Assembly: Apogee.Rendering.dll

A perspective camera in a right-handed world (+Y up, looking down -Z at yaw 0). The projection is reverse-Z with an infinite far plane: the near plane maps to depth 1 and infinity to 0, which spreads float precision evenly over the whole depth range. Normalized device y points down, as in Vulkan, so no viewport flip is needed; the image, and so the winding of triangles (counter-clockwise for front faces, as in glTF), is unchanged. The position is a (the world is double precision) and the renderer works relative to it: has the camera at the origin, and everything else is turned into an offset from the camera before it reaches the GPU.

public sealed class Camera

Inheritance

object ← Camera

Inherited Members

object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.ReferenceEquals(object?, object?), object.ToString()

Properties

ClusterFar

How far the light-culling clusters reach; nothing is clipped at this distance.

public float ClusterFar { get; set; }

Property Value

float

Forward

public Vector3 Forward { get; }

Property Value

Vector3

Near

public float Near { get; set; }

Property Value

float

Pitch

Rotation up (positive) or down, in radians.

public float Pitch { get; set; }

Property Value

float

Position

public Double3 Position { get; set; }

Property Value

Double3

public Vector3 Right { get; }

Property Value

Vector3

VerticalFov

public float VerticalFov { get; set; }

Property Value

float

View

The view matrix for camera-relative positions: the camera is at the origin, so it holds only the rotation. Use for a world point.

public Matrix4x4 View { get; }

Property Value

Matrix4x4

Yaw

Rotation about +Y in radians; positive turns to the left.

public float Yaw { get; set; }

Property Value

float

Methods

LookAt(Double3)

Points the camera at a target.

public void LookAt(Double3 target)

Parameters

target Double3

Projection(float)

public Matrix4x4 Projection(float aspect)

Parameters

aspect float

Returns

Matrix4x4

ReverseZ(float, float, float)

public static Matrix4x4 ReverseZ(float verticalFov, float aspect, float near)

Parameters

verticalFov float

aspect float

near float

Returns

Matrix4x4

WorldToView(Double3)

A world position in view space (x right, y up, the camera looking down -Z): the offset from the camera is taken in double precision first.

public Vector3 WorldToView(Double3 point)

Parameters

point Double3

Returns

Vector3