31#include <glm/gtc/matrix_transform.hpp>
61 : theta(theta), phi(phi), radius(radius)
88 : yaw(yaw), pitch(pitch), roll(roll)
472 enums::camera_type camera_type = enums::camera_type::AIRCRAFT;
473 enums::projection_type projection_type =
474 enums::projection_type::PERSPECTIVE;
475 glm::vec3 position = glm::vec3(0.0f, 0.0f, 0.0f);
476 glm::vec3 world_up = glm::vec3(0.0f, 1.0f, 0.0f);
477 glm::vec3 center = glm::vec3(0.0f, 0.0f, 0.0f);
478 float movement_speed = 2.5f;
479 float mouse_sensitivity = 0.1f;
481 glm::vec3 front = glm::vec3(0.0f, 0.0f, -1.0f);
482 glm::vec3 up = glm::vec3(0.0f, 1.0f, 0.0f);
483 glm::vec3 right = glm::vec3(1.0f, 0.0f, 0.0f);
488 builder &set_camera_type(enums::camera_type camera_type);
489 builder &set_projection_type(enums::projection_type projection_type);
490 builder &set_position(glm::vec3 position);
491 builder &set_world_up(glm::vec3 worldUp);
492 builder &set_center(glm::vec3 center);
493 builder &set_movement_speed(
float movement_speed);
494 builder &set_mouse_sensitivity(
float mouse_sensitivity);
496 builder &set_spherical_coordinates(
499 builder &set_front(glm::vec3 front);
501 builder &set_right(glm::vec3 right);
511extern camera default_camera;
Builder pattern for the Camera class.
types::spherical_coordinates spherical_coordinates
Spherical coordinates.
float get_zoom()
Get the zoom level.
glm::vec3 get_center()
Get the center of the sphere.
glm::vec3 front
Front vector.
void set_last_y(float last_y)
Set the last y position of the mouse.
glm::vec3 get_position()
Get the position of the camera.
float last_x
Last x position of the mouse.
void set_zoom(float zoom)
Set the zoom level.
glm::vec3 get_right()
Get the right vector.
types::spherical_coordinates get_spherical_coordinates()
Get the spherical coordinates of the camera.
glm::vec3 get_up()
Get the up vector.
void set_first_mouse(bool first_mouse)
Set the first mouse flag.
void set_last_x(float last_x)
Set the last x position of the mouse.
void set_camera_type(enums::camera_type camera_type)
Set the camera type.
void set_up(glm::vec3 up)
Set the up vector.
void set_mouse_sensitivity(float mouse_sensitivity)
Set the mouse sensitivity.
void set_world_up(glm::vec3 world_up)
Set the world up vector.
glm::vec3 right
Right vector.
glm::vec3 world_up
The world up vector.
types::euler_angles get_euler_angles()
Get the euler angles of the camera.
glm::vec3 get_front()
Get the front vector.
float get_last_x()
Get the last x position of the mouse.
void update_camera_euler()
Update the camera euler angles.
enums::camera_type get_camera_type()
Get the camera type.
void set_projection_type(enums::projection_type projection_type)
Set the projection type.
enums::camera_type camera_type
Camera type.
float movement_speed
Space translational movement speed.
float mouse_sensitivity
Mouse sensitivity.
bool get_first_mouse()
Get the first mouse flag.
camera()=default
Default constructor.
types::euler_angles euler_angles
Euler angles.
void spherical_to_cartesian()
Update the camera spherical coordinates.
float get_movement_speed()
Get the movement speed.
void set_movement_speed(float movement_speed)
Set the movement speed.
enums::projection_type projection_type
Projection type.
void set_right(glm::vec3 right)
Set the right vector.
glm::mat4 get_projection_matrix()
Get the projection matrix.
void set_spherical_coordinates(types::spherical_coordinates spherical_coordinates)
Set the spherical coordinates of the camera.
void set_euler_angles(types::euler_angles euler_angles)
Set the euler angles of the camera.
float zoom
Zoom level (field of view)
glm::mat4 get_view_matrix()
Get the view matrix.
void set_center(glm::vec3 center)
Set the center of the sphere.
float get_mouse_sensitivity()
Get the mouse sensitivity.
bool first_mouse
Is the first mouse movement?
glm::vec3 center
The center of the spehere.
void set_front(glm::vec3 front)
Set the front vector.
enums::projection_type get_projection_type()
Get the projection type.
glm::vec3 get_world_up()
Get the world up vector.
glm::vec3 position
Camera position.
float get_last_y()
Get the last y position of the mouse.
float last_y
Last y position of the mouse.
void set_position(glm::vec3 position)
Set the position of the camera.
euler_angles(float yaw, float pitch, float roll)
Constructor.
euler_angles()=default
Default constructor.
spherical_coordinates(float theta, float phi, float radius)
Constructor.
spherical_coordinates()=default
Default constructor.