#include "engine/camera.hpp"

// Camera Constructor
Camera::Camera(const glm::vec3& position, const glm::vec3& target, const glm::vec3& up)
    : position(position), target(target), up(up) {
}

// Get View Matrix
glm::mat4 Camera::getViewMatrix() const {
    return glm::lookAt(position, target, up);
}

// Set Position
void Camera::setPosition(const glm::vec3& position) {
    this->position = position;
}

// Set Target
void Camera::setTarget(const glm::vec3& target) {
    this->target = target;
}

// Set Up Vector
void Camera::setUp(const glm::vec3& up) {
    this->up = up;
}

// Get Position
glm::vec3 Camera::getPosition() const {
    return position;
}

// Get Projection Matrix
glm::mat4 Camera::getProjectionMatrix() const {
    return glm::perspective(glm::radians(fov), aspectRatio, nearPlane, farPlane);
}

// Set Projection Matrix Parameters
void Camera::setProjectionMatrix(float fov, float aspectRatio, float nearPlane, float farPlane) {
    this->fov = fov;
    this->aspectRatio = aspectRatio;
    this->nearPlane = nearPlane;
    this->farPlane = farPlane;
}