Combined view-projection matrix, defining the perspective for a Renderer to render from.
More...
#include <donut/graphics/Camera.hpp>
|
| constexpr | Camera () noexcept |
| | Construct a camera with an identity projection matrix and view matrix.
|
| |
| constexpr | Camera (const mat4 &projectionMatrix, const mat4 &viewMatrix) noexcept |
| | Construct a camera with a specific projection matrix and view matrix.
|
| |
| void | setProjectionOrthographic (const CameraOrthographicOptions &options) noexcept |
| | Set the projection of the camera to an orthographic projection.
|
| |
| void | setProjectionPerspective (const CameraPerspectiveOptions &options) noexcept |
| | Set the projection of the camera to a perspective projection.
|
| |
| void | setView (vec3 newPosition, vec3 newTarget, vec3 newUp) noexcept |
| | Set the view of the camera.
|
| |
| void | setProjectionMatrix (const mat4 &newProjectionMatrix) noexcept |
| | Set the projection matrix of the camera.
|
| |
| void | setViewMatrix (const mat4 &newViewMatrix) noexcept |
| | Set the view matrix of the camera.
|
| |
| const mat4 & | getProjectionMatrix () const noexcept |
| | Get the projection matrix of the camera.
|
| |
| const mat4 & | getViewMatrix () const noexcept |
| | Get the view matrix of the camera.
|
| |
Combined view-projection matrix, defining the perspective for a Renderer to render from.
- Examples
- example_game.cpp, and example_rectangle.cpp.
◆ Camera() [1/2]
| constexpr donut::graphics::Camera::Camera |
( |
| ) |
|
|
inlineconstexprnoexcept |
Construct a camera with an identity projection matrix and view matrix.
◆ Camera() [2/2]
| constexpr donut::graphics::Camera::Camera |
( |
const mat4 & |
projectionMatrix, |
|
|
const mat4 & |
viewMatrix |
|
) |
| |
|
inlineconstexprnoexcept |
Construct a camera with a specific projection matrix and view matrix.
- Parameters
-
| projectionMatrix | projection matrix of the camera. |
| viewMatrix | view matrix of the camera. |
◆ createOrthographic() [1/3]
Create a camera with an orthographic projection.
- Parameters
-
- Returns
- an orthographic camera with the specified configuration.
◆ createOrthographic() [2/3]
Create a camera with an orthographic projection and an identity view matrix at the default position.
- Parameters
-
- Returns
- an orthographic camera with the specified configuration.
◆ createOrthographic() [3/3]
Create a camera with an orthographic projection.
- Parameters
-
| options | projection options, see CameraOrthographicOptions. |
| position | position of the camera, in world coordinates. |
| target | target position to aim the camera at, in world coordinates. |
| up | up direction of the camera in the world. |
- Returns
- an orthographic camera with the specified configuration.
◆ createPerspective() [1/3]
Create a camera with a perspective projection.
- Parameters
-
- Returns
- an orthographic camera with the specified configuration.
◆ createPerspective() [2/3]
Create a camera with a perspective projection and an identity view matrix at the default position.
- Parameters
-
- Returns
- an orthographic camera with the specified configuration.
◆ createPerspective() [3/3]
Create a camera with a perspective projection.
- Parameters
-
| options | projection options, see CameraPerspectiveOptions. |
| position | position of the camera, in world coordinates. |
| target | target position to aim the camera at, in world coordinates. |
| up | up direction of the camera in the world. |
- Returns
- an orthographic camera with the specified configuration.
◆ setProjectionOrthographic()
Set the projection of the camera to an orthographic projection.
- Parameters
-
◆ setProjectionPerspective()
Set the projection of the camera to a perspective projection.
- Parameters
-
◆ setView()
| void donut::graphics::Camera::setView |
( |
vec3 |
newPosition, |
|
|
vec3 |
newTarget, |
|
|
vec3 |
newUp |
|
) |
| |
|
inlinenoexcept |
Set the view of the camera.
- Parameters
-
| newPosition | new position of the camera, in world coordinates. |
| newTarget | new target position to aim the camera at, in world coordinates. |
| newUp | new up direction of the camera in the world. |
◆ setProjectionMatrix()
| void donut::graphics::Camera::setProjectionMatrix |
( |
const mat4 & |
newProjectionMatrix | ) |
|
|
inlinenoexcept |
Set the projection matrix of the camera.
- Parameters
-
| newProjectionMatrix | new projection matrix to set. |
◆ setViewMatrix()
| void donut::graphics::Camera::setViewMatrix |
( |
const mat4 & |
newViewMatrix | ) |
|
|
inlinenoexcept |
Set the view matrix of the camera.
- Parameters
-
| newViewMatrix | new view matrix to set. |
◆ getProjectionMatrix()
| const mat4 & donut::graphics::Camera::getProjectionMatrix |
( |
| ) |
const |
|
inlinenoexcept |
Get the projection matrix of the camera.
- Returns
- the camera's current projection matrix.
◆ getViewMatrix()
| const mat4 & donut::graphics::Camera::getViewMatrix |
( |
| ) |
const |
|
inlinenoexcept |
Get the view matrix of the camera.
- Returns
- the camera's current view matrix.
The documentation for this class was generated from the following file: