Gorgon
Show / Hide Table of Contents

Class GorgonPerspectiveCamera

A camera that performs perspective (3D) projection.

Inheritance
object
GorgonCameraCommon
GorgonPerspectiveCamera
Implements
IGorgonGraphicsObject
IGorgonNamedObject
Inherited Members
GorgonCameraCommon.PositionRef
GorgonCameraCommon.Target
GorgonCameraCommon.Changes
GorgonCameraCommon.Graphics
GorgonCameraCommon.AspectRatio
GorgonCameraCommon.ViewDimensions
GorgonCameraCommon.MinimumDepth
GorgonCameraCommon.MaximumDepth
GorgonCameraCommon.Position
GorgonCameraCommon.AllowUpdateOnResize
GorgonCameraCommon.TargetWidth
GorgonCameraCommon.TargetHeight
GorgonCameraCommon.Name
GorgonCameraCommon.GetTarget()
GorgonCameraCommon.GetViewMatrix()
GorgonCameraCommon.GetProjectionMatrix()
GorgonCameraCommon.Project(ref Vector3, out Vector3, bool)
GorgonCameraCommon.Project(ref Vector3, out Vector3, Size2, bool)
GorgonCameraCommon.Unproject(in Vector3, out Vector3, bool)
GorgonCameraCommon.Unproject(in Vector3, out Vector3, Size2, bool)
GorgonCameraCommon.Project(Vector3, Size2, bool)
GorgonCameraCommon.Project(Vector3, bool)
GorgonCameraCommon.Unproject(Vector3, bool)
GorgonCameraCommon.Unproject(Vector3, Size2, bool)
GorgonCameraCommon.DiscardChanges()
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
Namespace: Gorgon.Renderers.Cameras
Assembly: Gorgon.Graphics.Core.dll
Syntax
public class GorgonPerspectiveCamera : GorgonCameraCommon, IGorgonGraphicsObject, IGorgonNamedObject
Remarks

This camera is used to bring depth to a 2D scene. Sprites and other renderables can use their Depth property to determine how far away the object is from the camera.

This camera object works in 3 dimensions, so it can be moved further into a scene, and further out. It also makes use of the near and far clip planes. Note that the near clip plane should be as large as is tolerable because it will have the greatest impact on the depth precision. For more information about depth clip planes, please consult http://www.sjbaker.org/steve/omniv/love_your_z_buffer.html.

Constructors

| Edit this page View Source

GorgonPerspectiveCamera(GorgonGraphics, Size2F, float, float, string)

Initializes a new instance of the GorgonPerspectiveCamera class.

Declaration
public GorgonPerspectiveCamera(GorgonGraphics graphics, Size2F viewDimensions, float minDepth = 0.1, float maximumDepth = 1000, string name = null)
Parameters
Type Name Description
GorgonGraphics graphics

The graphics interface to use with this object.

Size2F viewDimensions

The view dimensions.

float minDepth

[Optional] The minimum depth value.

float maximumDepth

[Optional] The maximum depth value.

string name

[Optional] The name of the camera.

Exceptions
Type Condition
ArgumentNullException

Thrown when the graphics parameter is null.

Properties

| Edit this page View Source

Fov

Property to set or return the field of view, in degrees, for the camera.

Declaration
public float Fov { get; set; }
Property Value
Type Description
float
| Edit this page View Source

Rotation

Property to set or return the quaternion used for rotation.

Declaration
public Quaternion Rotation { get; set; }
Property Value
Type Description
Quaternion
| Edit this page View Source

ViewableRegion

Property to return the viewable region for the camera.

Declaration
public override RectangleF ViewableRegion { get; }
Property Value
Type Description
RectangleF
Overrides
GorgonCameraCommon.ViewableRegion
Remarks

This represents the boundaries of viewable space for the camera using its coordinate system. The upper left of the region corresponds with the upper left of the active render target at minimum Z depth, and the lower right of the region corresponds with the lower right of the active render target at minimum Z depth.

Methods

| Edit this page View Source

AssignRotationMatrix(in Matrix4x4)

Function to set the camera rotation using a rotation matrix.

Declaration
public void AssignRotationMatrix(in Matrix4x4 rotation)
Parameters
Type Name Description
Matrix4x4 rotation

The matrix used for rotation.

| Edit this page View Source

LookAt(Vector3, Vector3?)

Function to point the camera at a point in space.

Declaration
public void LookAt(Vector3 target, Vector3? upVector = null)
Parameters
Type Name Description
Vector3 target

The point in space to look at.

Vector3? upVector

[Optional] The up vector for the camera.

Remarks

If the upVector parameter is null, then a default positive unit vector is used on the Y axis (0, 1, 0).

| Edit this page View Source

RotateAxis(Vector3, float)

Function to rotate the camera around the specified axes.

Declaration
public void RotateAxis(Vector3 axis, float angle)
Parameters
Type Name Description
Vector3 axis

The axes to rotate around.

float angle

The angle of rotation, in degrees.

| Edit this page View Source

RotateEuler(float, float, float)

Function to rotate the camera using euler angles.

Declaration
public void RotateEuler(float yaw, float pitch, float roll)
Parameters
Type Name Description
float yaw

The yaw of the camera, in degrees.

float pitch

The pitch of the camera, in degrees.

float roll

The roll of the camera, in degrees.

| Edit this page View Source

UpdateProjectionMatrix(ref Matrix4x4)

Function to update the projection matrix.

Declaration
protected override void UpdateProjectionMatrix(ref Matrix4x4 projectionMatrix)
Parameters
Type Name Description
Matrix4x4 projectionMatrix

The instance of the matrix to update.

Overrides
GorgonCameraCommon.UpdateProjectionMatrix(ref Matrix4x4)
| Edit this page View Source

UpdateViewMatrix(ref Matrix4x4)

Function to update the view matrix.

Declaration
protected override void UpdateViewMatrix(ref Matrix4x4 viewMatrix)
Parameters
Type Name Description
Matrix4x4 viewMatrix
Overrides
GorgonCameraCommon.UpdateViewMatrix(ref Matrix4x4)

Implements

IGorgonGraphicsObject
IGorgonNamedObject

Extension Methods

GorgonDebugExtensions.ValidateObject<T>(T, string)
GorgonNullExtensions.AsNullable<T>(object)
GorgonNullExtensions.IfNull<T>(object, T)
GorgonNullExtensions.IsNull(object)
  • Edit this page
  • View Source
In this article
Back to top Copyright 2023 - Licensed under the MIT license by Michael Winsor (Tape_Worm).
Send comments on this topic to the author