Camera

Inherited: Component

Description

Public Methods

Ray

castRay (float x, float y)

Vector4

color () const

float

farPlane () const

float

focal () const

float

fov () const

float

nearPlane () const

float

orthoSize () const

bool

orthographic () const

Matrix4

projectionMatrix () const

float

ratio () const

void

setColor (const Vector4 color)

void

setFar (const float distance)

void

setFocal (const float focal)

void

setFov (const float angle)

void

setNear (const float distance)

void

setOrthoSize (const float size)

void

setOrthographic (const bool mode)

void

setRatio (float ratio)

Matrix4

viewMatrix () const

Static Methods

Camera *

current ()

array<Vector3, 8>

frustumCorners (const Camera & camera)

array<Vector3, 8>

frustumCorners (bool ortho, float sigma, float ratio, const Vector3 & position, const Quaternion & rotation, float nearPlane, float farPlane)

Vector3

project (const Vector3 & worldSpace, const Matrix4 & modelView, const Matrix4 & projection)

void

setCurrent (Camera * current)

Vector3

unproject (const Vector3 & screenSpace, const Matrix4 & modelView, const Matrix4 & projection)

Methods Description

Ray Camera::castRay (float x, float y)

Returns ray with origin point in camera position and direction to projection plane with x and y coordinates.


Vector4 Camera::color () const

Returns the color with which the screen will be cleared.

See also setColor().


:ref:`Camera<api_Camera>`* Camera::current ()

Returns current active camera.

See also setCurrent().


float Camera::farPlane () const

Returns a distance to far cut plane.


float Camera::focal () const

Returns a focal distance for the camera.

See also setFocal().


float Camera::fov () const

Returns field of view angle for the camera in degrees.

See also setFov().


array<Vector3, 8> Camera::frustumCorners (Camera & camera)

Returns frustum corners for the camera.


array<Vector3, 8> Camera::frustumCorners (bool ortho, float sigma, float ratio, Vector3 & position, Quaternion & rotation, float nearPlane, float farPlane)

Returns frustum corners with provided parameters. This function accepts a list of parameters: ortho is a flag that points ortho*graphic or perspective camera. *sigma is an angle of frustum or ortho size in the case of an ortho*graphic camera. *ratio is an aspect ratio. position of the frustum in world space. rotation of frustum in world space. nearPlane clipping plane. farPlane clipping plane.


float Camera::nearPlane () const

Returns a distance to near cut plane.


float Camera::orthoSize () const

Returns camera size for orthographic mode.

See also setOrthoSize().


bool Camera::orthographic () const

Returns true for the orthographic mode; for the perspective mode, returns false.

See also setOrthographic().


Vector3 Camera::project (Vector3 & worldSpace, Matrix4 & modelView, Matrix4 & projection)

Transforms position from worldSpace into screen space using modelView and projection matrices. Returns result of transformation.


Matrix4 Camera::projectionMatrix () const

Returns projection matrix for the camera.


float Camera::ratio () const

Returns the aspect ratio (width divided by height).

See also setRatio().


void Camera::setColor (Vector4 color)

Sets the color with which the screen will be cleared.

See also *color*().


void Camera::setCurrent (Camera * current)

Sets current active camera.

See also *current*().


void Camera::setFar (float distance)

Sets a distance to far cut plane.


void Camera::setFocal (float focal)

Sets a focal distance for the camera.

See also *focal*().


void Camera::setFov (float angle)

Sets field of view angle for the camera in degrees.

Note: Applicable only for the perspective mode.

See also fov().


void Camera::setNear (float distance)

Sets a distance to near cut plane.


void Camera::setOrthoSize (float size)

Sets camera size for orthographic mode.

See also orthoSize().


void Camera::setOrthographic (bool mode)

Sets orthographic mode.

See also orthographic().


void Camera::setRatio (float ratio)

Sets the aspect ratio (width divided by height).

See also *ratio*().


Vector3 Camera::unproject (Vector3 & screenSpace, Matrix4 & modelView, Matrix4 & projection)

Transforms position from screenSpace into world space using modelView and projection matrices. Returns result of transformation.


Matrix4 Camera::viewMatrix () const

Returns view matrix for the camera.