sgltk 0.6
Simple OpenGL Tool Kit
|
Manages orthographic cameras. More...
#include <camera.h>
Public Member Functions | |
O_Camera (const O_Camera &camera) | |
O_Camera (glm::vec3 position, glm::vec3 direction, glm::vec3 up) | |
O_Camera (glm::vec3 position, glm::vec3 direction, glm::vec3 up, 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. | |
void | calculate_bounding_frustum (O_Camera &camera, glm::vec3 direction, float offset) |
Sets the camera parameters in such a way as to make the frustum of this camera the bounding box of the frustum of the other camera aligned to the direction vector. | |
void | calculate_bounding_frustum (P_Camera &camera, glm::vec3 direction, float offset) |
Sets the camera parameters in such a way as to make the frustum of this camera the bounding box of the frustum of the other camera aligned to the direction vector. | |
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. |
O_Camera::O_Camera | ( | ) |
Definition at line 5 of file camera_o.cpp.
O_Camera::O_Camera | ( | const O_Camera & | camera | ) |
camera | The camera to copy |
Definition at line 12 of file camera_o.cpp.
O_Camera::O_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 22 of file camera_o.cpp.
O_Camera::O_Camera | ( | glm::vec3 | position, |
glm::vec3 | direction, | ||
glm::vec3 | up, | ||
float | width, | ||
float | height, | ||
float | near_plane, | ||
float | far_plane ) |
position | The camera position |
direction | The view direction |
up | The up vector |
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 30 of file camera_o.cpp.
O_Camera::~O_Camera | ( | ) |
Definition at line 46 of file camera_o.cpp.
void O_Camera::calculate_bounding_frustum | ( | O_Camera & | camera, |
glm::vec3 | direction, | ||
float | offset ) |
Sets the camera parameters in such a way as to make the frustum of this camera the bounding box of the frustum of the other camera aligned to the direction vector.
camera | The camera to calculate the bounding box for |
direction | The vector to align the bounding box to |
offset | The offset by which the planes of the frustum will be moved |
Definition at line 103 of file camera_o.cpp.
void O_Camera::calculate_bounding_frustum | ( | P_Camera & | camera, |
glm::vec3 | direction, | ||
float | offset ) |
Sets the camera parameters in such a way as to make the frustum of this camera the bounding box of the frustum of the other camera aligned to the direction vector.
camera | The camera to calculate the bounding box for |
direction | The vector to align the bounding box to |
offset | The offset by which the planes of the frustum will be moved |
Definition at line 142 of file camera_o.cpp.
std::vector< float > O_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 78 of file camera_o.cpp.
std::vector< glm::vec3 > O_Camera::calculate_frustum_points | ( | ) |
Calculates the corner points of the camera's frustum.
Definition at line 56 of file camera_o.cpp.
|
virtual |
Recalculates the projection matrix.
Implements sgltk::Camera.
Definition at line 49 of file camera_o.cpp.