Show / Hide Table of Contents

Interface ICameras

Camera Operations: Creation, Configuration and Destruction 2D Cameras are used by Drawing Stages (IDrawStage and IDistortionStage) 3D Cameras are used by the MeshRender Stage

Namespace: Yak2D
Assembly: Yak2D.Api.dll
Syntax
public interface ICameras

Properties

Camera2DCount

Returns the number of 2D Cameras that currently exist

Declaration
int Camera2DCount { get; }
Property Value
Type Description
System.Int32

Camera3DCount

Returns the number of 3D Cameras that currently exist

Declaration
int Camera3DCount { get; }
Property Value
Type Description
System.Int32

Methods

CreateCamera2D(UInt32, UInt32, Single)

Create a Camera for use in 2D drawing operations

Declaration
ICamera2D CreateCamera2D(uint virtualResolutionWidth = null, uint virtualResolutionHeight = null, float zoom = 1F)
Parameters
Type Name Description
System.UInt32 virtualResolutionWidth

The Camera's view window 'pixel' width in terms of the global coordinate system

System.UInt32 virtualResolutionHeight

The Camera's view window 'pixel' height in terms of the global coordinate system

System.Single zoom

The Camera's view window world-view zoom factor

Returns
Type Description
ICamera2D

CreateCamera3D(Vector3, Vector3, Vector3, Single, Single, Single, Single)

Create a Camera for use in 3D rendering operations. Left-handed coordinate system

Declaration
ICamera3D CreateCamera3D(Vector3 position, Vector3 lookAt, Vector3 up, float fieldOfViewDegress = 60F, float aspectRatio = null, float nearPlane = 0.0001F, float farPlane = 1000F)
Parameters
Type Name Description
Vector3 position

Camera's position in 3D space

Vector3 lookAt

A point in 3D space that the camera is looking at

Vector3 up

A unit vector describing the direction that is 'up' relative to the Camera view

System.Single fieldOfViewDegress

Horizontal field of view angle in degress"

System.Single aspectRatio

Aspect ratio of camera's viewport (width / height)"

System.Single nearPlane

Closest distance to camera in 3D space that an object would be rendered"

System.Single farPlane

Furthest distance to camera in 3D space that an object would be rendered"

Returns
Type Description
ICamera3D

DestroyAllCameras()

Destroy all cameras (2D and 3D)

Declaration
void DestroyAllCameras()

DestroyAllCameras2D()

Destroy all 2D cameras

Declaration
void DestroyAllCameras2D()

DestroyAllCameras3D()

Destroy all 3D cameras

Declaration
void DestroyAllCameras3D()

DestroyCamera(UInt64)

Destroy an existing Camera

Declaration
void DestroyCamera(ulong camera)
Parameters
Type Name Description
System.UInt64 camera

The id key of the Camera to destory"

DestroyCamera(ICamera)

Destroy an existing Camera

Declaration
void DestroyCamera(ICamera camera)
Parameters
Type Name Description
ICamera camera

The Camera to destory"

GetCamera2DRotation(UInt64)

Gets a Camera's Rotation in RADIANS (clockwise from positive y direction)

Declaration
float GetCamera2DRotation(ulong camera)
Parameters
Type Name Description
System.UInt64 camera

The id key of the camera to query

Returns
Type Description
System.Single

GetCamera2DRotation(ICamera2D)

Gets a Camera's Rotation in RADIANS (clockwise from positive y direction)

Declaration
float GetCamera2DRotation(ICamera2D camera)
Parameters
Type Name Description
ICamera2D camera

The camera to query

Returns
Type Description
System.Single

GetCamera2DUp(UInt64)

Get a unit vector pointing in the Camera's world up direction

Declaration
Vector2 GetCamera2DUp(ulong camera)
Parameters
Type Name Description
System.UInt64 camera

The id key of the camera to query

Returns
Type Description
Vector2

GetCamera2DUp(ICamera2D)

Get a unit vector pointing in the Camera's world up direction

Declaration
Vector2 GetCamera2DUp(ICamera2D camera)
Parameters
Type Name Description
ICamera2D camera

The camera to query

Returns
Type Description
Vector2

GetCamera2DVirtualResolution(UInt64)

Gets a Camera's Virtual Resolution

Declaration
Size GetCamera2DVirtualResolution(ulong camera)
Parameters
Type Name Description
System.UInt64 camera

The id key of the camera to query

Returns
Type Description
Size

GetCamera2DVirtualResolution(ICamera2D)

Gets a Camera's Virtual Resolution

Declaration
Size GetCamera2DVirtualResolution(ICamera2D camera)
Parameters
Type Name Description
ICamera2D camera

The camera to query

Returns
Type Description
Size

GetCamera2DWorldFocus(UInt64)

Gets a Camera's world focus point

Declaration
Vector2 GetCamera2DWorldFocus(ulong camera)
Parameters
Type Name Description
System.UInt64 camera

The id key of the camera to query

Returns
Type Description
Vector2

GetCamera2DWorldFocus(ICamera2D)

Gets a Camera's world focus point

Declaration
Vector2 GetCamera2DWorldFocus(ICamera2D camera)
Parameters
Type Name Description
ICamera2D camera

The camera to query

Returns
Type Description
Vector2

GetCamera2DZoom(UInt64)

Gets a Camera's Zoom

Declaration
float GetCamera2DZoom(ulong camera)
Parameters
Type Name Description
System.UInt64 camera

The id key of the camera to query

Returns
Type Description
System.Single

GetCamera2DZoom(ICamera2D)

Gets a Camera's Zoom

Declaration
float GetCamera2DZoom(ICamera2D camera)
Parameters
Type Name Description
ICamera2D camera

The camera to query

Returns
Type Description
System.Single

SetCamera2DFocusAndZoom(UInt64, Vector2, Single)

Set a Camera's world focus position and zoom

Declaration
void SetCamera2DFocusAndZoom(ulong camera, Vector2 focus, float zoom)
Parameters
Type Name Description
System.UInt64 camera

The id key of the camera to modify

Vector2 focus

The world position to use as the camera's focus point

System.Single zoom

The camera's world zoom factor

SetCamera2DFocusAndZoom(ICamera2D, Vector2, Single)

Set a Camera's world focus position and zoom

Declaration
void SetCamera2DFocusAndZoom(ICamera2D camera, Vector2 focus, float zoom)
Parameters
Type Name Description
ICamera2D camera

The camera to modify

Vector2 focus

The world position to use as the camera's focus point

System.Single zoom

The camera's world zoom factor

SetCamera2DFocusZoomAndRotation(UInt64, Vector2, Single, Single)

Set a Camera's world focus position, zoom and rotation described as a clockwise rotation from the positive Y axis direction

Declaration
void SetCamera2DFocusZoomAndRotation(ulong camera, Vector2 focus, float zoom, float angle)
Parameters
Type Name Description
System.UInt64 camera

The id key of the camera to modify

Vector2 focus

The world position to use as the camera's focus point

System.Single zoom

The camera's world zoom factor

System.Single angle

Angle in RADIANS representing a clockwise rotation from the positive Y axis direction

SetCamera2DFocusZoomAndRotation(UInt64, Vector2, Single, Vector2)

Set a Camera's world focus position, zoom and rotation described by an 'up' vector

Declaration
void SetCamera2DFocusZoomAndRotation(ulong camera, Vector2 focus, float zoom, Vector2 up)
Parameters
Type Name Description
System.UInt64 camera

The id key of the camera to modify

Vector2 focus

The world position to use as the camera's focus point

System.Single zoom

The camera's world zoom factor

Vector2 up

A unit vector pointing in the upwards direction of the camera

SetCamera2DFocusZoomAndRotation(ICamera2D, Vector2, Single, Single)

Set a Camera's world focus position, zoom and rotation described as a clockwise rotation from the positive Y axis direction

Declaration
void SetCamera2DFocusZoomAndRotation(ICamera2D camera, Vector2 focus, float zoom, float angle)
Parameters
Type Name Description
ICamera2D camera

The camera to modify

Vector2 focus

The world position to use as the camera's focus point

System.Single zoom

The camera's world zoom factor

System.Single angle

Angle in RADIANS representing a clockwise rotation from the positive Y axis direction

SetCamera2DFocusZoomAndRotation(ICamera2D, Vector2, Single, Vector2)

Set a Camera's world focus position, zoom and rotation described by an 'up' vector

Declaration
void SetCamera2DFocusZoomAndRotation(ICamera2D camera, Vector2 focus, float zoom, Vector2 up)
Parameters
Type Name Description
ICamera2D camera

The camera to modify

Vector2 focus

The world position to use as the camera's focus point

System.Single zoom

The camera's world zoom factor

Vector2 up

A unit vector pointing in the upwards direction of the camera

SetCamera2DRotation(UInt64, Single)

Set a Camera's world rotation as clockwise rotation from the positive Y axis direction

Declaration
void SetCamera2DRotation(ulong camera, float angle)
Parameters
Type Name Description
System.UInt64 camera

The id key of the camera to modify

System.Single angle

Angle in RADIANS representing a clockwise rotation from the positive Y axis direction

SetCamera2DRotation(UInt64, Vector2)

Set a Camera's world rotation described by an 'up' vector

Declaration
void SetCamera2DRotation(ulong camera, Vector2 up)
Parameters
Type Name Description
System.UInt64 camera

The id key of the camera to modify

Vector2 up

A unit vector pointing in the upwards direction of the camera

SetCamera2DRotation(ICamera2D, Single)

Set a Camera's world rotation as clockwise rotation from the positive Y axis direction

Declaration
void SetCamera2DRotation(ICamera2D camera, float angle)
Parameters
Type Name Description
ICamera2D camera

The camera to modify

System.Single angle

Angle in RADIANS representing a clockwise rotation from the positive Y axis direction

SetCamera2DRotation(ICamera2D, Vector2)

Set a Camera's world rotation described by an 'up' vector

Declaration
void SetCamera2DRotation(ICamera2D camera, Vector2 up)
Parameters
Type Name Description
ICamera2D camera

The camera to modify

Vector2 up

A unit vector pointing in the upwards direction of the camera

SetCamera2DVirtualResolution(UInt64, UInt32, UInt32)

Set a Camera's view window dimensions in terms of the global coordinate system

Declaration
void SetCamera2DVirtualResolution(ulong camera, uint width, uint height)
Parameters
Type Name Description
System.UInt64 camera

The id key of the camera to modify

System.UInt32 width

The camera's width in terms of the global coordinate system

System.UInt32 height

The camera's height in terms of the global coordinate system

SetCamera2DVirtualResolution(ICamera2D, UInt32, UInt32)

Set a Camera's view window dimensions in terms of the global coordinate system

Declaration
void SetCamera2DVirtualResolution(ICamera2D camera, uint width, uint height)
Parameters
Type Name Description
ICamera2D camera

The camera to modify

System.UInt32 width

The camera's width in terms of the global coordinate system

System.UInt32 height

The camera's height in terms of the global coordinate system

SetCamera3DProjection(UInt64, Single, Single, Single, Single)

Set a Camera's 3D view projection

Declaration
void SetCamera3DProjection(ulong camera, float fovDegress, float aspectRatio, float nearPlane, float farPlane)
Parameters
Type Name Description
System.UInt64 camera

The id key of the camera to modify

System.Single fovDegress

Horizontal field of view angle in DEGREES"

System.Single aspectRatio

Aspect ratio of camera's viewport (width / height)"

System.Single nearPlane

Closest distance to camera in 3D space that an object would be rendered"

System.Single farPlane

Furthest distance to camera in 3D space that an object would be rendered"

SetCamera3DProjection(ICamera3D, Single, Single, Single, Single)

Set a Camera's 3D view projection

Declaration
void SetCamera3DProjection(ICamera3D camera, float fovDegress, float aspectRatio, float nearPlane, float farPlane)
Parameters
Type Name Description
ICamera3D camera

The camera to modify

System.Single fovDegress

Horizontal field of view angle in degress"

System.Single aspectRatio

Aspect ratio of camera's viewport (width / height)"

System.Single nearPlane

Closest distance to camera in 3D space that an object would be rendered"

System.Single farPlane

Furthest distance to camera in 3D space that an object would be rendered"

SetCamera3DView(UInt64, Vector3, Vector3, Vector3)

Set a Camera's 3D view orientation

Declaration
void SetCamera3DView(ulong camera, Vector3 position, Vector3 lookAt, Vector3 up)
Parameters
Type Name Description
System.UInt64 camera

The id key of the camera to modify

Vector3 position

Camera's position in 3D space

Vector3 lookAt

A point in 3D space that the camera is looking at

Vector3 up

A unit vector describing the direction that is 'up' relative to the Camera view

SetCamera3DView(ICamera3D, Vector3, Vector3, Vector3)

Set a Camera's 3D view orientation

Declaration
void SetCamera3DView(ICamera3D camera, Vector3 position, Vector3 lookAt, Vector3 up)
Parameters
Type Name Description
ICamera3D camera

The camera to modify

Vector3 position

Camera's position in 3D space

Vector3 lookAt

A point in 3D space that the camera is looking at

Vector3 up

A unit vector describing the direction that is 'up' relative to the Camera view

In This Article
Back to top yak2D - Alex Paterson