4#include <raftel/global_macros.hpp>
5#include <glm/mat4x4.hpp>
7#include <glm/gtc/quaternion.hpp>
8#include "raftel/input.hpp"
19 enum class CameraState {
81 void Update(
const std::unique_ptr<Window>& window);
99 void Rotate(
float angle,
const glm::vec3& axis);
106 void SetState(CameraState newState, GLFWwindow* window);
151 std::unique_ptr<Raftel::Input> input;
154 glm::mat4 projection;
162 glm::vec3 inputMovement;
163 glm::vec3 inputRotation;
169 glm::quat orientation = glm::quat(1.0, 0.0, 0.0, 0.0);
171 glm::vec3 cameraPosition;
172 float yawAngle = 0.0f;
173 float pitchAngle = 0.0f;
void ChangeSpeedWithKey(Raftel::Window *window, Raftel::Input::Keys key_, float fastSpeed=5.0f, float normalSpeed=2.0f)
Changes camera movement speed when a specific key is pressed.
Camera(Raftel::Window *w)
Constructs a Camera object.
glm::vec3 getPosition() const
Gets the current position of the camera.
void Translate(const glm::vec3 &translation)
Moves the camera by a given translation vector.
float getMovementSpeed() const
Gets the current movement speed of the camera.
void Update(const std::unique_ptr< Window > &window)
Updates the camera's transformation matrices.
glm::mat4 getViewMatrix() const
Gets the view matrix of the camera.
void setUniforms(ShaderProgram &prg)
Sets shader uniforms related to the camera.
void SetState(CameraState newState, GLFWwindow *window)
Sets the camera state.
void SetPosition(const glm::vec3 &position)
Sets the position of the camera.
void SetRotation(const glm::vec3 &rotation)
Sets the rotation of the camera.
void ToggleState(Raftel::Window *window, Raftel::Input::Keys key_)
Toggles the camera state using a keyboard key.
CameraState GetState() const
Gets the current camera state.
void PossessedInput(Raftel::Window *window)
Processes user input when the camera is in possessed mode.
void ChangeSpeedWithScroll(Raftel::Window *window, float speedOffset)
Adjusts camera movement speed using mouse scroll input.
glm::vec3 getRotation() const
Gets the current rotation of the camera.
void ToggleState(Raftel::Window *window, Raftel::Input::Buttons button_)
Toggles the camera state using a mouse button.
void Rotate(float angle, const glm::vec3 &axis)
Rotates the camera around an axis.
glm::mat4 getProjectionMatrix() const
Gets the projection matrix of the camera.
A class to represent an OpenGL shader program, combining vertex and fragment shaders.
Represents a single window in the system, supporting OpenGL context and input handling.