sgltk 0.6
Simple OpenGL Tool Kit
Loading...
Searching...
No Matches
sgltk::O_Camera Class Reference

Manages orthographic cameras. More...

#include <camera.h>

Inheritance diagram for sgltk::O_Camera:
Collaboration diagram for sgltk::O_Camera:

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.

Detailed Description

Manages orthographic cameras.

class O_Camera

Definition at line 200 of file camera.h.

Constructor & Destructor Documentation

◆ O_Camera() [1/4]

O_Camera::O_Camera ( )

Definition at line 5 of file camera_o.cpp.

◆ O_Camera() [2/4]

O_Camera::O_Camera ( const O_Camera & camera)
Parameters
cameraThe camera to copy

Definition at line 12 of file camera_o.cpp.

◆ O_Camera() [3/4]

O_Camera::O_Camera ( glm::vec3 position,
glm::vec3 direction,
glm::vec3 up )
Parameters
positionThe camera position
directionThe view direction
upThe up vector

Definition at line 22 of file camera_o.cpp.

◆ O_Camera() [4/4]

O_Camera::O_Camera ( glm::vec3 position,
glm::vec3 direction,
glm::vec3 up,
float width,
float height,
float near_plane,
float far_plane )
Parameters
positionThe camera position
directionThe view direction
upThe up vector
widthThe width of the viewport
heightThe height of the viewport
near_planeThe near plane
far_planeThe far plane

Definition at line 30 of file camera_o.cpp.

◆ ~O_Camera()

O_Camera::~O_Camera ( )

Definition at line 46 of file camera_o.cpp.

Member Function Documentation

◆ calculate_bounding_frustum() [1/2]

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.

Parameters
cameraThe camera to calculate the bounding box for
directionThe vector to align the bounding box to
offsetThe offset by which the planes of the frustum will be moved

Definition at line 103 of file camera_o.cpp.

◆ calculate_bounding_frustum() [2/2]

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.

Parameters
cameraThe camera to calculate the bounding box for
directionThe vector to align the bounding box to
offsetThe offset by which the planes of the frustum will be moved

Definition at line 142 of file camera_o.cpp.

◆ calculate_frustum_distance()

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.

Parameters
pointThe point to calculate the distances to.
Returns
Returns a vector containing the distances of the point to the planes of the frustum. 0 - far 1 - near 2 - left 3 - right 4 - top 5 - bottom

Definition at line 78 of file camera_o.cpp.

◆ calculate_frustum_points()

std::vector< glm::vec3 > O_Camera::calculate_frustum_points ( )

Calculates the corner points of the camera's frustum.

Returns
Returns a vector containing the world coordinates of the frustum points. 0 - near-bottom-left 1 - near-bottom-right 2 - near-top-right 3 - near-top-left 4 - far-bottom-left 5 - far-bottom-right 6 - far-top-right 7 - far-top-left

Definition at line 56 of file camera_o.cpp.

◆ update_projection_matrix()

void O_Camera::update_projection_matrix ( )
virtual

Recalculates the projection matrix.

Implements sgltk::Camera.

Definition at line 49 of file camera_o.cpp.


The documentation for this class was generated from the following files: