sgltk 0.6
Simple OpenGL Tool Kit
|
Manages perspective cameras. More...
#include <camera.h>
Public Member Functions | |
P_Camera (const sgltk::P_Camera &camera) | |
P_Camera (glm::vec3 position, glm::vec3 direction, glm::vec3 up) | |
P_Camera (glm::vec3 position, glm::vec3 direction, glm::vec3 up, float fovy, float width, float height, float near_plane, float far_plane) | |
void | update_projection_matrix () |
Recalculates the projection matrix. | |
std::vector< glm::vec3 > | calculate_frustum_points () |
Calculates the corner points of the camera's frustum. | |
std::vector< float > | calculate_frustum_distance (glm::vec3 point) |
Calculates the distances of a point to all planes of the camera's frustum. Positive values indicate that the point and the frustum are on the opposite sides of the plane. | |
Public Member Functions inherited from sgltk::Camera | |
Camera (glm::vec3 position, glm::vec3 direction, glm::vec3 up) | |
void | update_view_matrix () |
Recalculates the view matrix. | |
void | move_up (float delta) |
Move the camera along the up vector. | |
void | move_right (float delta) |
Move the camera along the right vector. | |
void | move_forward (float delta) |
Move the camera along the forward vector. | |
void | move_by (float x, float y, float z) |
Move the camera by the vector (x, y, z) | |
void | move_by (glm::vec3 vector) |
Move the camera by the vector. | |
void | yaw (float angle) |
Rotate the camera using the up vector as the axis. | |
void | roll (float angle) |
Rotate the camera using the forward vector as the axis. | |
void | pitch (float angle) |
Rotate the camera using the right vector as the axis. |
Additional Inherited Members | |
Public Attributes inherited from sgltk::Camera | |
glm::mat4 | view_matrix |
The view matrix. | |
glm::mat4 | projection_matrix |
The perspective projection matrix. | |
float | width |
Viewport width. | |
float | height |
Viewport height. | |
float | fovy |
The vertical field of view angle of the camera. | |
float | far_plane |
The far plane of the camera frustum. | |
float | near_plane |
The near plane of the camera frustum. | |
glm::vec3 | position |
The camera position. | |
glm::vec3 | direction |
The direction the camera is pointing. | |
glm::vec3 | up |
The up vector of the camera. | |
glm::vec3 | right |
The right vector of the camera. |
P_Camera::P_Camera | ( | ) |
Definition at line 5 of file camera_p.cpp.
P_Camera::P_Camera | ( | const sgltk::P_Camera & | camera | ) |
camera | The camera to copy |
Definition at line 12 of file camera_p.cpp.
P_Camera::P_Camera | ( | glm::vec3 | position, |
glm::vec3 | direction, | ||
glm::vec3 | up ) |
position | The camera position |
direction | The view direction |
up | The up vector |
Definition at line 23 of file camera_p.cpp.
P_Camera::P_Camera | ( | glm::vec3 | position, |
glm::vec3 | direction, | ||
glm::vec3 | up, | ||
float | fovy, | ||
float | width, | ||
float | height, | ||
float | near_plane, | ||
float | far_plane ) |
position | The camera position |
direction | The view direction |
up | The up vector |
fovy | The field of view in radians |
width | The width of the viewport |
height | The height of the viewport |
near_plane | The near plane |
far_plane | The far plane |
Definition at line 31 of file camera_p.cpp.
P_Camera::~P_Camera | ( | ) |
Definition at line 49 of file camera_p.cpp.
std::vector< float > P_Camera::calculate_frustum_distance | ( | glm::vec3 | point | ) |
Calculates the distances of a point to all planes of the camera's frustum. Positive values indicate that the point and the frustum are on the opposite sides of the plane.
point | The point to calculate the distances to. |
Definition at line 83 of file camera_p.cpp.
std::vector< glm::vec3 > P_Camera::calculate_frustum_points | ( | ) |
Calculates the corner points of the camera's frustum.
Definition at line 59 of file camera_p.cpp.
|
virtual |
Recalculates the projection matrix.
Implements sgltk::Camera.
Definition at line 52 of file camera_p.cpp.