#ifndef SCENE_CAMERA_HPP
#define SCENE_CAMERA_HPP

#include "open_engine/renderer/camera.hpp"
#include <cstdint>

namespace OpenEngine {
    class SceneCamera : public Camera
    {
        public:
            enum class ProjectionType { Perspective = 0, Orthographic = 1 };
        public:
            SceneCamera();
            virtual ~SceneCamera() = default;

            void SetViewportSize(uint32_t width, uint32_t height);

            ProjectionType GetProjectionType() { return projection_type; };
            void SetProjectionType(ProjectionType type) {
                projection_type = type;
                RecalculateProjection();
            };

            void SetOrthographic(float size, float near_clip, float far_clip);
            void SetPerspective(float fov, float near_clip, float far_clip);

            float GetOrthographicSize() const { return orthographic_size; }
            void SetOrthographicSize(float size) {
                orthographic_size = size;
                RecalculateProjection();
            };
            float GetOrthographicNearClip() const { return orthographic_near; };
            void SetOrthographicNearClip(float near) {
                orthographic_near = near;
                RecalculateProjection();
            };
            float GetOrthographicFarClip() const { return orthographic_far; };
            void SetOrthographicFarClip(float far) {
                orthographic_far = far;
                RecalculateProjection();
            };

            float GetVerticalFov() const { return fov; }
            void SetVerticalFov(float fov_value) {
                fov = fov_value;
                RecalculateProjection();
            };
            float GetPerspectiveNearClip() const { return perspective_near; };
            void SetPerspectiveNearClip(float near) {
                perspective_near = near;
                RecalculateProjection();
            };
            float GetPerspectiveFarClip() const { return perspective_far; };
            void SetPerspectiveFarClip(float far) {
                perspective_far = far;
                RecalculateProjection();
            };

        private:
            void RecalculateProjection();

        private:
            ProjectionType projection_type = ProjectionType::Orthographic;
            float orthographic_size = 10.0f;
            float orthographic_near = -1.0f, orthographic_far = 1.0f;

            float fov = 45.0f;
            float perspective_near = 0.01f, perspective_far = 1000.0f;

            float aspect_ratio = 16.0f/9.0f;
    };
}

#endif // SCENE_CAMERA_HPP
