Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Camera

Add this in your code:

#include <engine/graphics/camera.h>

Description

Component for rendering the scene.

Public methods


SetFov

Set field of view (Perspective mode).

Parameters:

  • fov: Field of view angle (in degrees)
void SetFov(const float fov)

GetFov

Get field of view in degrees.

float GetFov() const

SetProjectionSize

Set projection size (Orthographic mode).

Parameters:

  • value: Projection size
void SetProjectionSize(const float value)

GetProjectionSize

Get projection size.

float GetProjectionSize() const

SetNearClippingPlane

Set near clipping plane.

Parameters:

  • value: Near clipping plane
void SetNearClippingPlane(float value)

GetNearClippingPlane

Get near clipping plane.

float GetNearClippingPlane() const

SetFarClippingPlane

Set far clipping plane.

Parameters:

  • value: far clipping plane
void SetFarClippingPlane(float value)

GetFarClippingPlane

Get far clipping plane.

float GetFarClippingPlane() const

ScreenTo2DWorld

Get 2D world position from pixel coordinate.

Parameters:

  • x: X pixel position
  • y: Y pixel position
Vector2 ScreenTo2DWorld(int x, int y)

MouseTo2DWorld

Get 2D world position from mouse's position.

ector2 MouseTo2DWorld()

SetProjectionType

Set projection type.

Parameters:

  • type: Projection type
void SetProjectionType(const ProjectionType type)

GetProjectionType

Get projection type.

ProjectionType GetProjectionType() const

GetMouseRay

Get mouse normalized ray direction.

Vector3 GetMouseRay()

GetWidth

Get view width in pixel.

int GetWidth() const

GetHeight

Get view height in pixel.

int GetHeight() const

GetAspectRatio

Get view aspect ratio.

float GetAspectRatio() const

GetUseMultisampling

Get if the camera is using multisampling (Windows Only).

bool GetUseMultisampling() const

SetUseMultisampling

Set if the camera is using multisampling (Windows Only).

Parameters:

  • useMultisampling: True to enable Multisampling
void SetUseMultisampling(bool useMultisampling)

GetRawFrameBuffer

Get a copy of the frame buffer.
Heavy operation, use with caution.

std::unique_ptr<uint8_t[]> GetRawFrameBuffer()