#include <Camera.h>
|
| Camera (const glm::vec3 &position, const glm::vec3 &target, const glm::vec3 &up, int width, int height, float nearPlane, float farPlane, float fov) |
|
void | setPerspective (int width, int height, float nearPlane, float farPlane, float fov) |
|
void | setDistance (float nearPlane, float farPlane) |
|
void | setWindowSize (int width, int height) |
|
void | setPosition (const glm::vec3 &position) |
|
void | setTarget (const glm::vec3 &target) |
|
void | setUp (const glm::vec3 &up) |
|
void | setView (const glm::vec3 &position, const glm::vec3 &target, const glm::vec3 &up) |
|
const glm::vec3 & | getPosition () const |
|
const glm::vec3 & | getTarget () const |
|
const glm::vec3 & | getUp () const |
|
const glm::mat4 & | getView () const |
|
const glm::mat4 & | getInverseView () const |
|
const glm::mat4 & | getPerspective () const |
|
const glm::mat4 & | getVP () const |
|
float | getRatio () const |
|
float | getNearPlane () const |
|
float | getFarPlane () const |
|
float | getFieldOfView () const |
|
int | getWidth () const |
|
int | getHeight () const |
|
void | getMouseRay (float mouseX, float mouseY, glm::vec3 &rayOrigin, glm::vec3 &rayDirection) |
|
void | updateTransform () |
|
Perspective projection camera. Encapsulates a position, direction, view frustum and screen size. Provides corresponding view and perspective matrices. The matrices are not automatically updated after a new value has been set. updateTransform() will update them.
Camera::Camera |
( |
const glm::vec3 & |
position, |
|
|
const glm::vec3 & |
target, |
|
|
const glm::vec3 & |
up, |
|
|
int |
width, |
|
|
int |
height, |
|
|
float |
nearPlane, |
|
|
float |
farPlane, |
|
|
float |
fov |
|
) |
| |
Initializes position, direction, view frustum and screen size.
- Parameters
-
fov | opening angle of the camera in the vertical direction |
float Camera::getFieldOfView |
( |
) | |
const |
Returns the opening angle of the camera in the vertical direction
- Returns
- opening angle of the camera in the vertical direction
void Camera::getMouseRay |
( |
float |
mouseX, |
|
|
float |
mouseY, |
|
|
glm::vec3 & |
rayOrigin, |
|
|
glm::vec3 & |
rayDirection |
|
) |
| |
Returns the origin and direction of a ray shot from the camera position to the unprojection of the mouse position. The mouse coordinate system is thought to have (0,0) at the top-left corner of the frustum and (width,height) at the bottom-right corner.
- Parameters
-
[in] | mouseX | x-coordinate of mouse position |
[in] | mouseY | y-coordinate of mouse position |
[out] | rayOrigin | origin of the mouse ray |
[out] | rayDirection | direction of the mouse ray |
float Camera::getRatio |
( |
) | |
const |
Returns the screen's image ratio
- Returns
- getWidth() / getHeight()
const glm::mat4 & Camera::getVP |
( |
) | |
const |
Returns the view projection matrix
- Returns
- the view projection matrix
void Camera::setDistance |
( |
float |
nearPlane, |
|
|
float |
farPlane |
|
) |
| |
void Camera::setPerspective |
( |
int |
width, |
|
|
int |
height, |
|
|
float |
nearPlane, |
|
|
float |
farPlane, |
|
|
float |
fov |
|
) |
| |
- Parameters
-
fov | opening angle of the camera in the vertical direction |
void Camera::updateTransform |
( |
) | |
|
Recalculates the view matrix, perspective matrix and their inverses if any changes have been made to their parameters.
The documentation for this class was generated from the following files: