This class represents a camera as used in real-time rendering APIs. It provides a view and projection matrices, and handles their proper update.
More...
#include <Camera.hpp>
|
void | updateProjection () |
| Update the projection matrix using the camera parameters.
|
|
void | updateView () |
| Update the view matrix using the camera position and orientation.
|
|
|
glm::mat4 | _view = glm::mat4(1.0f) |
| The view matrix.
|
|
glm::mat4 | _projection = glm::mat4(1.0f) |
| The projection matrix.
|
|
glm::vec3 | _eye = glm::vec3(0.0, 0.0, 1.0) |
| The camera position.
|
|
glm::vec3 | _center = glm::vec3(0.0, 0.0, 0.0) |
| The camera center (look-at point)
|
|
glm::vec3 | _up = glm::vec3(0.0, 1.0, 0.0) |
| The camera up vector.
|
|
glm::vec3 | _right = glm::vec3(1.0, 0.0, 0.0) |
| The camera right vector.
|
|
glm::vec2 | _clippingPlanes = glm::vec2(0.01f, 100.0f) |
| The near and far plane distances.
|
|
float | _fov = 1.3f |
| The vertical field of view, in radians.
|
|
float | _ratio = 1.0f |
| The aspect ratio.
|
|
This class represents a camera as used in real-time rendering APIs. It provides a view and projection matrices, and handles their proper update.
Inherited by ControllableCamera.
◆ ~Camera()
virtual Camera::~Camera |
( |
| ) |
|
|
virtualdefault |
◆ Camera() [1/2]
Camera::Camera |
( |
const Camera & |
| ) |
|
|
default |
◆ Camera() [2/2]
◆ apply()
void Camera::apply |
( |
const Camera & |
camera | ) |
|
Apply the pose and parameters of another camera.
- Parameters
-
camera | the camera to align with |
◆ center()
const glm::vec3 & Camera::center |
( |
| ) |
const |
|
inline |
Obtain the current world space center position.
- Returns
- the current center
◆ clippingPlanes()
const glm::vec2 & Camera::clippingPlanes |
( |
| ) |
const |
|
inline |
Obtain the current world space camera position.
- Returns
- the current position
◆ decode()
bool Camera::decode |
( |
const KeyValues & |
params | ) |
|
Setup a camera parameters from a list of key-value tuples. The following keywords will be searched for:
camera:
position: X,Y,Z
center: X,Y,Z
up: X,Y,Z
fov: F
planes: N,F
where the field of view is given in radians.
- Parameters
-
params | the parameters tuples list |
- Returns
- decoding status
◆ direction()
const glm::vec3 Camera::direction |
( |
| ) |
const |
|
inline |
Obtain the current world space view direction.
- Returns
- the current direction
◆ encode()
Encode a camera as a key-values representation.
- Returns
- the encoded camera parameters
◆ fov() [1/2]
float Camera::fov |
( |
| ) |
const |
|
inline |
Obtain the current vertical field of view, in radians.
- Returns
- the field of view
◆ fov() [2/2]
void Camera::fov |
( |
float |
fov | ) |
|
Update the vertical field of view.
- Parameters
-
fov | the new field of view, in radians |
◆ frustum()
void Camera::frustum |
( |
float |
near, |
|
|
float |
far |
|
) |
| |
Update the frustum near and far planes.
- Parameters
-
near | the new near plane distance |
far | the new far plane distance |
◆ operator=() [1/2]
Move assignment.
- Returns
- a reference to the object assigned to
◆ operator=() [2/2]
Copy assignment.
- Returns
- a reference to the object assigned to
◆ pixelShifts()
void Camera::pixelShifts |
( |
glm::vec3 & |
corner, |
|
|
glm::vec3 & |
dx, |
|
|
glm::vec3 & |
dy |
|
) |
| const |
Compute world space position of the top-left corner of the image, and the shifts to move to the next pixel, horizontally and vertically.
- Parameters
-
corner | will contain the position of the top-left corner |
dx | will contain the horizontal step |
dy | will contain the vertical step |
◆ pose()
void Camera::pose |
( |
const glm::vec3 & |
position, |
|
|
const glm::vec3 & |
center, |
|
|
const glm::vec3 & |
up |
|
) |
| |
|
virtual |
Update all view parameters
- Parameters
-
position | the camera position |
center | the camera center of interest |
up | the camera vertical orientation |
Reimplemented in ControllableCamera.
◆ position()
const glm::vec3 & Camera::position |
( |
| ) |
const |
|
inline |
Obtain the current world space camera position.
- Returns
- the current position
◆ projection() [1/2]
const glm::mat4 & Camera::projection |
( |
| ) |
const |
|
inline |
Obtain the current projection matrix.
- Returns
- the projection matrix
◆ projection() [2/2]
void Camera::projection |
( |
float |
ratio, |
|
|
float |
fov, |
|
|
float |
near, |
|
|
float |
far |
|
) |
| |
|
virtual |
Update all projection parameters.
- Parameters
-
ratio | the aspect ratio |
fov | the vertical field of view in radians |
near | the near plane distance |
far | the far plane distance |
◆ ratio() [1/2]
float Camera::ratio |
( |
| ) |
const |
|
inline |
Obtain the current aspect ratio.
- Returns
- the aspect ratio
◆ ratio() [2/2]
void Camera::ratio |
( |
float |
ratio | ) |
|
Update the aspect ratio.
- Parameters
-
ratio | the new aspect ratio |
◆ up()
const glm::vec3 & Camera::up |
( |
| ) |
const |
|
inline |
Obtain the current world space up direction.
- Returns
- the current direction
◆ view()
const glm::mat4 & Camera::view |
( |
| ) |
const |
|
inline |
Obtain the current view matrix.
- Returns
- the view matrix
The documentation for this class was generated from the following files:
- src/engine/input/Camera.hpp
- src/engine/input/Camera.cpp