sgltk 0.6
Simple OpenGL Tool Kit
Loading...
Searching...
No Matches
sgltk::Camera Class Referenceabstract

Manages cameras. More...

#include <camera.h>

Inheritance diagram for sgltk::Camera:

Public Member Functions

 Camera (glm::vec3 position, glm::vec3 direction, glm::vec3 up)
void update_view_matrix ()
 Recalculates the view matrix.
virtual void update_projection_matrix ()=0
 Recalculates the projection 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.

Public Attributes

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 cameras.

Definition at line 12 of file camera.h.

Constructor & Destructor Documentation

◆ Camera()

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

Definition at line 5 of file camera.cpp.

◆ ~Camera()

Camera::~Camera ( )

Definition at line 22 of file camera.cpp.

Member Function Documentation

◆ move_by() [1/2]

void Camera::move_by ( float x,
float y,
float z )

Move the camera by the vector (x, y, z)

Parameters
xThe x component
yThe y component
zThe z component

Definition at line 41 of file camera.cpp.

◆ move_by() [2/2]

void Camera::move_by ( glm::vec3 vector)

Move the camera by the vector.

Parameters
vectorThe vector to move the camera by

Definition at line 47 of file camera.cpp.

◆ move_forward()

void Camera::move_forward ( float delta)

Move the camera along the forward vector.

Parameters
deltaThe distance to move the camera

Definition at line 37 of file camera.cpp.

◆ move_right()

void Camera::move_right ( float delta)

Move the camera along the right vector.

Parameters
deltaThe distance to move the camera

Definition at line 33 of file camera.cpp.

◆ move_up()

void Camera::move_up ( float delta)

Move the camera along the up vector.

Parameters
deltaThe distance to move the camera

Definition at line 29 of file camera.cpp.

◆ pitch()

void Camera::pitch ( float angle)

Rotate the camera using the right vector as the axis.

Parameters
angleThe angle to rotate the camera

Definition at line 63 of file camera.cpp.

◆ roll()

void Camera::roll ( float angle)

Rotate the camera using the forward vector as the axis.

Parameters
angleThe angle to rotate the camera

Definition at line 57 of file camera.cpp.

◆ update_projection_matrix()

virtual void sgltk::Camera::update_projection_matrix ( )
pure virtual

Recalculates the projection matrix.

Implemented in sgltk::IP_Camera, sgltk::O_Camera, and sgltk::P_Camera.

◆ update_view_matrix()

void Camera::update_view_matrix ( )

Recalculates the view matrix.

Definition at line 25 of file camera.cpp.

◆ yaw()

void Camera::yaw ( float angle)

Rotate the camera using the up vector as the axis.

Parameters
angleThe angle to rotate the camera

Definition at line 51 of file camera.cpp.

Member Data Documentation

◆ direction

glm::vec3 sgltk::Camera::direction

The direction the camera is pointing.

Definition at line 49 of file camera.h.

◆ far_plane

float sgltk::Camera::far_plane

The far plane of the camera frustum.

Definition at line 37 of file camera.h.

◆ fovy

float sgltk::Camera::fovy

The vertical field of view angle of the camera.

Definition at line 33 of file camera.h.

◆ height

float sgltk::Camera::height

Viewport height.

Definition at line 29 of file camera.h.

◆ near_plane

float sgltk::Camera::near_plane

The near plane of the camera frustum.

Definition at line 41 of file camera.h.

◆ position

glm::vec3 sgltk::Camera::position

The camera position.

Definition at line 45 of file camera.h.

◆ projection_matrix

glm::mat4 sgltk::Camera::projection_matrix

The perspective projection matrix.

Definition at line 21 of file camera.h.

◆ right

glm::vec3 sgltk::Camera::right

The right vector of the camera.

Definition at line 57 of file camera.h.

◆ up

glm::vec3 sgltk::Camera::up

The up vector of the camera.

Definition at line 53 of file camera.h.

◆ view_matrix

glm::mat4 sgltk::Camera::view_matrix

The view matrix.

Definition at line 17 of file camera.h.

◆ width

float sgltk::Camera::width

Viewport width.

Definition at line 25 of file camera.h.


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