29#include "engine_logger.hpp"
34using namespace brenta;
37 enums::projection_type projection_type, glm::vec3 position,
38 glm::vec3 world_up, glm::vec3 center,
float movement_speed,
39 float mouse_sensitivity,
float zoom,
59 switch (this->camera_type)
61 case enums::camera_type::SPHERICAL:
64 case enums::camera_type::AIRCRAFT:
71 INFO(
"Camera created");
78 case enums::camera_type::SPHERICAL:
80 case enums::camera_type::AIRCRAFT:
84 return glm::mat4(1.0f);
92 case enums::projection_type::PERSPECTIVE:
93 return glm::perspective(glm::radians(this->
zoom),
97 case enums::projection_type::ORTHOGRAPHIC:
103 return glm::mat4(1.0f);
132 this->
front = glm::normalize(new_front);
135 this->
up = glm::normalize(glm::cross(this->
right, this->
front));
300camera::builder::set_camera_type(enums::camera_type camera_type)
302 this->camera_type = camera_type;
307camera::builder::set_projection_type(enums::projection_type
projection_type)
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.
static int get_width()
Get the width of the window.
static int get_height()
Get the height of the window.