29#include "engine_logger.hpp"
34using namespace Brenta;
35using namespace Brenta::Utils;
38 Enums::ProjectionType projection_type, glm::vec3 position,
39 glm::vec3 worldUp, glm::vec3 center,
float movementSpeed,
40 float mouseSensitivity,
float zoom,
62 case Enums::CameraType::SPHERICAL:
65 case Enums::CameraType::AIRCRAFT:
72 INFO(
"Camera created");
79 case Enums::CameraType::SPHERICAL:
81 case Enums::CameraType::AIRCRAFT:
84 return glm::mat4(1.0f);
92 case Enums::ProjectionType::PERSPECTIVE:
93 return glm::perspective(glm::radians(
Zoom),
97 case Enums::ProjectionType::ORTHOGRAPHIC:
103 return glm::mat4(1.0f);
129 Front = glm::normalize(front);
296Camera::Builder &Camera::Builder::set_camera_type(Enums::CameraType camera_type)
298 this->camera_type = camera_type;
303Camera::Builder::set_projection_type(Enums::ProjectionType projection_type)
305 this->projection_type = projection_type;
311 this->position = position;
317 this->worldUp = worldUp;
327Camera::Builder &Camera::Builder::set_movement_speed(
float movementSpeed)
329 this->movementSpeed = movementSpeed;
333Camera::Builder &Camera::Builder::set_mouse_sensitivity(
float mouseSensitivity)
335 this->mouseSensitivity = mouseSensitivity;
377Camera Camera::Camera::Builder::build()
379 return Camera(camera_type, projection_type, position, worldUp,
center,
Builder pattern for the Camera class.
glm::vec3 Position
Camera position.
Types::EulerAngles GetEulerAngles()
Get the euler angles of the camera.
Types::SphericalCoordinates GetSphericalCoordinates()
Get the spherical coordinates of the camera.
Types::SphericalCoordinates sphericalCoordinates
Spherical coordinates.
float GetLastX()
Get the last x position of the mouse.
float lastX
Last x position of the mouse.
void updateCameraEuler()
Update the camera euler angles.
float MouseSensitivity
Mouse sensitivity.
Enums::ProjectionType GetProjectionType()
Get the projection type.
void SetZoom(float zoom)
Set the zoom level.
Enums::CameraType GetCameraType()
Get the camera type.
void SetMovementSpeed(float movementSpeed)
Set the movement speed.
float GetZoom()
Get the zoom level.
glm::vec3 WorldUp
The world up vector.
void SetPosition(glm::vec3 position)
Set the position of the camera.
void SetLastY(float lastY)
Set the last y position of the mouse.
void SetCameraType(Enums::CameraType camera_type)
Set the camera type.
glm::vec3 GetRight()
Get the right vector.
float lastY
Last y position of the mouse.
Types::EulerAngles eulerAngles
Euler angles.
glm::vec3 GetPosition()
Get the position of the camera.
float GetMovementSpeed()
Get the movement speed.
float GetLastY()
Get the last y position of the mouse.
float MovementSpeed
Space translational movement speed.
bool firstMouse
Is the first mouse movement?
void SetRight(glm::vec3 right)
Set the right vector.
void SetEulerAngles(Types::EulerAngles eulerAngles)
Set the euler angles of the camera.
glm::vec3 GetCenter()
Get the center of the sphere.
void SetWorldUp(glm::vec3 worldUp)
Set the world up vector.
void SetLastX(float lastX)
Set the last x position of the mouse.
void SetCenter(glm::vec3 center)
Set the center of the sphere.
void SetProjectionType(Enums::ProjectionType projection_type)
Set the projection type.
float Zoom
Zoom level (field of view)
float GetMouseSensitivity()
Get the mouse sensitivity.
Enums::CameraType CameraType
Camera type.
Camera()=default
Default constructor.
glm::mat4 GetProjectionMatrix()
Get the projection matrix.
void SetFirstMouse(bool firstMouse)
Set the first mouse flag.
void SetUp(glm::vec3 up)
Set the up vector.
glm::vec3 Front
Front vector.
void SetSphericalCoordinates(Types::SphericalCoordinates sphericalCoordinates)
Set the spherical coordinates of the camera.
glm::vec3 GetWorldUp()
Get the world up vector.
glm::vec3 Right
Right vector.
void SetMouseSensitivity(float mouseSensitivity)
Set the mouse sensitivity.
bool GetFirstMouse()
Get the first mouse flag.
void SetFront(glm::vec3 front)
Set the front vector.
glm::vec3 GetFront()
Get the front vector.
glm::vec3 center
The center of the spehere.
Enums::ProjectionType ProjectionType
Projection type.
void SphericalToCartesian()
Update the camera spherical coordinates.
glm::vec3 GetUp()
Get the up vector.
glm::mat4 GetViewMatrix()
Get the view matrix.
static int GetHeight()
Get the height of the window.
static int GetWidth()
Get the width of the window.