Sparkle 0.0.1
Loading...
Searching...
No Matches
spk::Camera Class Reference

Stores projection matrices and converts screen coordinates. More...

#include <spk_camera.hpp>

Collaboration diagram for spk::Camera:
Collaboration graph

Public Member Functions

 Camera ()
 Builds a camera with an identity projection.
void setPerspective (float p_fovDegrees, float p_aspectRatio, float p_nearPlane=0.1f, float p_farPlane=1000.0f)
 Sets a perspective projection.
void setOrthographic (float p_left, float p_right, float p_bottom, float p_top, float p_nearPlane=0.1f, float p_farPlane=1000.0f)
 Sets an orthographic projection.
const spk::Matrix4x4projectionMatrix () const
 Returns the projection matrix.
const spk::Matrix4x4inverseProjectionMatrix () const
 Returns the inverse projection matrix.
spk::Vector3 convertScreenToCamera (const spk::Vector3 &p_screenPosition) const
 Converts a screen position to camera space.
spk::Vector3 convertScreenToCamera (const spk::Vector2 &p_screenPosition) const
 Converts a screen position to camera space.
spk::ContractProvider::Contract subscribeToProjectionEdition (const spk::ContractProvider::Job &p_job)
 Subscribes to projection changes.

Detailed Description

Stores projection matrices and converts screen coordinates.

Member Function Documentation

◆ convertScreenToCamera() [1/2]

spk::Vector3 spk::Camera::convertScreenToCamera ( const spk::Vector2 & p_screenPosition) const

Converts a screen position to camera space.

Parameters
p_screenPositionScreen position.
Returns
Camera-space position.
Here is the call graph for this function:

◆ convertScreenToCamera() [2/2]

spk::Vector3 spk::Camera::convertScreenToCamera ( const spk::Vector3 & p_screenPosition) const

Converts a screen position to camera space.

Parameters
p_screenPositionScreen position with depth.
Returns
Camera-space position.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ inverseProjectionMatrix()

const spk::Matrix4x4 & spk::Camera::inverseProjectionMatrix ( ) const

Returns the inverse projection matrix.

Returns
Inverse projection matrix.

◆ projectionMatrix()

const spk::Matrix4x4 & spk::Camera::projectionMatrix ( ) const

Returns the projection matrix.

Returns
Projection matrix.

◆ setOrthographic()

void spk::Camera::setOrthographic ( float p_left,
float p_right,
float p_bottom,
float p_top,
float p_nearPlane = 0.1f,
float p_farPlane = 1000.0f )

Sets an orthographic projection.

Parameters
p_leftLeft plane.
p_rightRight plane.
p_bottomBottom plane.
p_topTop plane.
p_nearPlaneNear clipping plane.
p_farPlaneFar clipping plane.
Here is the call graph for this function:

◆ setPerspective()

void spk::Camera::setPerspective ( float p_fovDegrees,
float p_aspectRatio,
float p_nearPlane = 0.1f,
float p_farPlane = 1000.0f )

Sets a perspective projection.

Parameters
p_fovDegreesField of view in degrees.
p_aspectRatioAspect ratio.
p_nearPlaneNear clipping plane.
p_farPlaneFar clipping plane.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ subscribeToProjectionEdition()

spk::ContractProvider::Contract spk::Camera::subscribeToProjectionEdition ( const spk::ContractProvider::Job & p_job)

Subscribes to projection changes.

Parameters
p_jobCallback executed on projection updates.
Returns
Contract for the subscription.

The documentation for this class was generated from the following files:
  • includes/structure/engine/spk_camera.hpp
  • srcs/structure/engine/spk_camera.cpp