10#include <glm/gtc/matrix_transform.hpp>
32 : theta(theta), phi(phi), radius(radius)
51 : yaw(yaw), pitch(pitch), roll(roll)
84 enum class camera_type
90 enum class projection_type
110 projection_type proj_type;
111 camera_type cam_type;
130 float mouse_sensitivity;
214 camera::camera_type get_camera_type()
const;
215 camera::projection_type get_projection_type()
const;
216 glm::vec3 get_position()
const;
217 glm::vec3 get_world_up()
const;
218 glm::vec3 get_center()
const;
219 float get_movement_speed()
const;
220 float get_mouse_sensitivity()
const;
221 float get_zoom()
const;
224 glm::mat4 get_view_matrix()
const;
225 glm::mat4 get_projection_matrix(
int window_width,
int window_height)
const;
226 glm::vec3 get_front()
const;
227 glm::vec3 get_up()
const;
228 glm::vec3 get_right()
const;
247 void set_camera_type(camera::camera_type camera_type);
248 void set_projection_type(camera::projection_type projection_type);
249 void set_world_up(glm::vec3
world_up);
250 void set_center(glm::vec3
center);
252 void set_mouse_sensitivity(
float mouse_sensitivity);
253 void set_zoom(
float zoom);
257 void set_front(glm::vec3
front);
258 void set_up(glm::vec3
up);
259 void set_right(glm::vec3
right);
260 void set_position(glm::vec3 position);
295 camera_type cam_type;
296 projection_type proj_type;
300 float movement_speed;
301 float mouse_sensitivity;
318 camera::camera_type::aircraft,
319 camera::projection_type::perspective,
320 glm::vec3(0.0f, 0.0f, 0.0f),
321 glm::vec3(0.0f, 1.0f, 0.0f),
322 glm::vec3(0.0f, 0.0f, 0.0f),
328 glm::vec3(0.0f, 0.0f, -1.0f),
329 glm::vec3(0.0f, 1.0f, 0.0f),
330 glm::vec3(1.0f, 0.0f, 0.0f),
335 builder &camera_type(camera::camera_type camera_type);
336 builder &projection_type(camera::projection_type projection_type);
337 builder &position(glm::vec3 position);
341 builder &mouse_sensitivity(
float mouse_sensitivity);
Builder pattern for the Camera class.
types::spherical_coordinates spherical_coordinates
Spherical coordinates.
bool get_first_mouse() const
Get the first mouse flag.
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.
float get_last_x() const
Get the last x position of the mouse.
glm::vec3 right
Right vector.
glm::vec3 world_up
The world up vector.
void update_camera_euler()
Update the camera euler angles.
float movement_speed
Space translational movement speed.
camera()=default
Default constructor.
types::euler_angles euler_angles
Euler angles.
void spherical_to_cartesian()
Update the camera spherical coordinates.
float get_last_y() const
Get the last y position of the mouse.
float zoom
Zoom level (field of view)
bool first_mouse
Is the first mouse movement?
glm::vec3 center
The center of the spehere.
float last_y
Last y position of the mouse.