Class PerspectiveCamera
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
Properties
Fov
The field of view of the camera
public float Fov { get; set; }
Property Value
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
vpMatrix4
Returns
- Plane[]
GetCameraFront()
Gets the front of the camera
public Vector3 GetCameraFront()
Returns
GetProjectionMatrix(Viewport)
Gets the projection matrix of the camera
public override Matrix4 GetProjectionMatrix(Viewport viewport)
Parameters
viewportViewport
Returns
GetViewMatrix()
Gets the view matrix of the camera
public override Matrix4 GetViewMatrix()
Returns
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
Returns
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
Returns
IsPointInFrustum(Viewport, Vector3)
Checks if a point is in the frustum of the camera
public override bool IsPointInFrustum(Viewport viewport, Vector3 point)
Parameters
Returns
LookAt(Vector3)
Looks at the target position
public override void LookAt(Vector3 target)
Parameters
targetVector3
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
cameraPerspectiveCameraviewportViewportsXfloatsYfloat
Returns
WorldToScreen(PerspectiveCamera, Vector3, Viewport)
Projects a world position to screen coordinates
public static Vector3 WorldToScreen(PerspectiveCamera camera, Vector3 worldPos, Viewport viewport)
Parameters
cameraPerspectiveCameraworldPosVector3viewportViewport