Table of Contents

Class PerspectiveCamera

Namespace
LibGFX.Graphics
Assembly
LibGFX.dll

Represents a perspective camera

public class PerspectiveCamera : Camera
Inheritance
PerspectiveCamera
Inherited Members

Constructors

PerspectiveCamera()

Creates a new perspective camera

public PerspectiveCamera()

PerspectiveCamera(Vector3, Vector2)

Creates a new perspective camera

public PerspectiveCamera(Vector3 position, Vector2 resolution)

Parameters

position Vector3
resolution Vector2

Properties

Fov

The field of view of the camera

public float Fov { get; set; }

Property Value

float

Methods

ComputeAABB()

Computes the axis-aligned bounding box (AABB) of the camera

public override void ComputeAABB()

ExtractFrustumPlanes(Matrix4)

Extracts the frustum planes from the view-projection matrix

public static Plane[] ExtractFrustumPlanes(Matrix4 vp)

Parameters

vp Matrix4

Returns

Plane[]

GetCameraFront()

Gets the front of the camera

public Vector3 GetCameraFront()

Returns

Vector3

GetProjectionMatrix(Viewport)

Gets the projection matrix of the camera

public override Matrix4 GetProjectionMatrix(Viewport viewport)

Parameters

viewport Viewport

Returns

Matrix4

GetViewMatrix()

Gets the view matrix of the camera

public override Matrix4 GetViewMatrix()

Returns

Matrix4

IntersectsFrustum(Plane[], Vector3, Vector3)

Checks if a bounding box intersects with the frustum defined by the planes

public static bool IntersectsFrustum(Plane[] planes, Vector3 min, Vector3 max)

Parameters

planes Plane[]
min Vector3
max Vector3

Returns

bool

IsAABBInFrustum(Viewport, Vector3, Vector3)

Checks if a axis-aligned bounding box (AABB) is in the frustum of the camera

public override bool IsAABBInFrustum(Viewport viewport, Vector3 min, Vector3 max)

Parameters

viewport Viewport
min Vector3
max Vector3

Returns

bool

IsPointInFrustum(Viewport, Vector3)

Checks if a point is in the frustum of the camera

public override bool IsPointInFrustum(Viewport viewport, Vector3 point)

Parameters

viewport Viewport
point Vector3

Returns

bool

LookAt(Vector3)

Looks at the target position

public override void LookAt(Vector3 target)

Parameters

target Vector3

ScreenToWorldPosition3D(PerspectiveCamera, Viewport, float, float)

Converts a screen position to a world position

public static Vector3 ScreenToWorldPosition3D(PerspectiveCamera camera, Viewport viewport, float sX, float sY)

Parameters

camera PerspectiveCamera
viewport Viewport
sX float
sY float

Returns

Vector3

WorldToScreen(PerspectiveCamera, Vector3, Viewport)

Projects a world position to screen coordinates

public static Vector3 WorldToScreen(PerspectiveCamera camera, Vector3 worldPos, Viewport viewport)

Parameters

camera PerspectiveCamera
worldPos Vector3
viewport Viewport

Returns

Vector3