10#include <glm/gtc/matrix_transform.hpp>
40 : theta(theta), phi(phi), radius(radius)
67 : yaw(yaw), pitch(pitch), roll(roll)
100 enum class camera_type
106 enum class projection_type
126 projection_type proj_type;
127 camera_type cam_type;
146 float mouse_sensitivity;
230 camera::camera_type get_camera_type();
231 camera::projection_type get_projection_type();
232 glm::vec3 get_position();
233 glm::vec3 get_world_up();
234 glm::vec3 get_center();
235 float get_movement_speed();
236 float get_mouse_sensitivity();
240 glm::mat4 get_view_matrix();
241 glm::mat4 get_projection_matrix(
int window_width,
int window_height);
242 glm::vec3 get_front();
244 glm::vec3 get_right();
263 void set_camera_type(camera::camera_type camera_type);
264 void set_projection_type(camera::projection_type projection_type);
265 void set_world_up(glm::vec3
world_up);
266 void set_center(glm::vec3
center);
268 void set_mouse_sensitivity(
float mouse_sensitivity);
269 void set_zoom(
float zoom);
273 void set_front(glm::vec3
front);
274 void set_up(glm::vec3
up);
275 void set_right(glm::vec3
right);
276 void set_position(glm::vec3 position);
311 camera_type cam_type;
312 projection_type proj_type;
316 float movement_speed;
317 float mouse_sensitivity;
334 camera::camera_type::aircraft,
335 camera::projection_type::perspective,
336 glm::vec3(0.0f, 0.0f, 0.0f),
337 glm::vec3(0.0f, 1.0f, 0.0f),
338 glm::vec3(0.0f, 0.0f, 0.0f),
344 glm::vec3(0.0f, 0.0f, -1.0f),
345 glm::vec3(0.0f, 1.0f, 0.0f),
346 glm::vec3(1.0f, 0.0f, 0.0f),
351 builder &camera_type(camera::camera_type camera_type);
352 builder &projection_type(camera::projection_type projection_type);
353 builder &position(glm::vec3 position);
357 builder &mouse_sensitivity(
float mouse_sensitivity);
Builder pattern for the Camera class.
types::spherical_coordinates spherical_coordinates
Spherical coordinates.
glm::vec3 front
Front vector.
void set_last_y(float last_y)
Set the last y position of the mouse.
float last_x
Last x position of the mouse.
camera_movement
Camera movement directions.
void set_last_x(float last_x)
Set the last x position of the mouse.
glm::vec3 right
Right vector.
glm::vec3 world_up
The world up vector.
float get_last_x()
Get the last x position of the mouse.
void update_camera_euler()
Update the camera euler angles.
float movement_speed
Space translational movement speed.
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 zoom
Zoom level (field of view)
bool first_mouse
Is the first mouse movement?
glm::vec3 center
The center of the spehere.
float get_last_y()
Get the last y position of the mouse.
float last_y
Last y position of the mouse.
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.