Class GorgonPerspectiveCamera
A camera that performs perspective (3D) projection.
Inherited Members
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 SourceGorgonPerspectiveCamera(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 |
Properties
| Edit this page View SourceFov
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 |
Rotation
Property to set or return the quaternion used for rotation.
Declaration
public Quaternion Rotation { get; set; }
Property Value
Type | Description |
---|---|
Quaternion |
ViewableRegion
Property to return the viewable region for the camera.
Declaration
public override RectangleF ViewableRegion { get; }
Property Value
Type | Description |
---|---|
RectangleF |
Overrides
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 SourceAssignRotationMatrix(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. |
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).
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. |
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. |
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
| Edit this page View SourceUpdateViewMatrix(ref Matrix4x4)
Function to update the view matrix.
Declaration
protected override void UpdateViewMatrix(ref Matrix4x4 viewMatrix)
Parameters
Type | Name | Description |
---|---|---|
Matrix4x4 | viewMatrix |