Class Camera
Represents a camera in a graphics context for rendering 2D scenes.
Inherited Members
Namespace: Genesis.Graphics
Assembly: Genesis.dll
Syntax
public class Camera
Constructors
Camera(Vec3, Vec3, float, float)
Initializes a new instance of the Camera class with the specified location, size, near and far distances.
Declaration
public Camera(Vec3 location, Vec3 size, float near, float far)
Parameters
Type | Name | Description |
---|---|---|
Vec3 | location | The initial location of the camera in 3D space. |
Vec3 | size | The size of the camera. |
float | near | The distance to the near clipping plane of the camera. |
float | far | The distance to the far clipping plane of the camera. |
Properties
Far
Gets or sets the distance to the far clipping plane of the camera.
Declaration
public float Far { get; set; }
Property Value
Type | Description |
---|---|
float |
Location
Gets or sets the location of the camera in 3D space.
Declaration
public Vec3 Location { get; set; }
Property Value
Type | Description |
---|---|
Vec3 |
Near
Gets or sets the distance to the near clipping plane of the camera.
Declaration
public float Near { get; set; }
Property Value
Type | Description |
---|---|
float |
Rotation
Gets or sets the rotation of the camera in 3D space.
Declaration
public Vec3 Rotation { get; set; }
Property Value
Type | Description |
---|---|
Vec3 |
Size
Gets or sets the size of the camera.
Declaration
public Vec3 Size { get; set; }
Property Value
Type | Description |
---|---|
Vec3 |
Type
Gets or sets the type of the camera, either orthographic or perspective.
Declaration
public CameraType Type { get; set; }
Property Value
Type | Description |
---|---|
CameraType |
Methods
GetRect()
Gets the rectangular region represented by the camera's location and size.
Declaration
public Rect GetRect()
Returns
Type | Description |
---|---|
Rect | A Rect object representing the camera's view region. |
LookAt(GameElement)
Adjusts the camera to look at the specified game element (only 2D).
Declaration
public void LookAt(GameElement element)
Parameters
Type | Name | Description |
---|---|---|
GameElement | element | The game element to look at. |
LookAt(GameElement, bool)
Adjusts the camera to look at the specified game element, with an option to center the view on the element.
Declaration
public void LookAt(GameElement element, bool centerOffset)
Parameters
Type | Name | Description |
---|---|---|
GameElement | element | The game element to look at. |
bool | centerOffset | If true, centers the view on the element; otherwise, positions the camera at the element's location. |