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

Manages infinite perspective cameras. More...

#include <camera.h>

Inheritance diagram for sgltk::IP_Camera:
Collaboration diagram for sgltk::IP_Camera:

Public Member Functions

 IP_Camera (const IP_Camera &camera)
 IP_Camera (glm::vec3 position, glm::vec3 direction, glm::vec3 up)
 IP_Camera (glm::vec3 position, glm::vec3 direction, glm::vec3 up, float fovy, float width, float height, float near_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.

Detailed Description

Manages infinite perspective cameras.

class IP_Camera

Definition at line 291 of file camera.h.

Constructor & Destructor Documentation

◆ IP_Camera() [1/4]

IP_Camera::IP_Camera ( )

Definition at line 5 of file camera_ip.cpp.

◆ IP_Camera() [2/4]

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

Definition at line 11 of file camera_ip.cpp.

◆ IP_Camera() [3/4]

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

Definition at line 21 of file camera_ip.cpp.

◆ IP_Camera() [4/4]

IP_Camera::IP_Camera ( glm::vec3 position,
glm::vec3 direction,
glm::vec3 up,
float fovy,
float width,
float height,
float near_plane )
Parameters
positionThe camera position
directionThe view direction
upThe up vector
fovyThe field of view in radians
widthThe width of the viewport
heightThe height of the viewport
near_planeThe near plane

Definition at line 27 of file camera_ip.cpp.

◆ ~IP_Camera()

IP_Camera::~IP_Camera ( )

Definition at line 38 of file camera_ip.cpp.

Member Function Documentation

◆ calculate_frustum_distance()

std::vector< float > IP_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 - near 1 - left 2 - right 3 - top 4 - bottom

Definition at line 68 of file camera_ip.cpp.

◆ calculate_frustum_points()

std::vector< glm::vec3 > IP_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

Definition at line 48 of file camera_ip.cpp.

◆ update_projection_matrix()

void IP_Camera::update_projection_matrix ( )
virtual

Recalculates the projection matrix.

Implements sgltk::Camera.

Definition at line 41 of file camera_ip.cpp.


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