//
// Created by sfd on 25-5-28.
//

#ifndef SCENCECAMERA_H
#define SCENCECAMERA_H

#include "Camera.h"

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

        void SetOrthographic(const float size, const float nearClip, const float farClip);
        void SetPerspective(const float verticalFOV, const float nearClip, const float farClip);
        void SetViewPortSize(uint32_t width, uint32_t height);


        // Perspective getters
        float GetPerspectiveVerticalFOV() const { return m_PerspectiveFOV;};
        float GetPerspectiveNearCLip() const { return m_PerspectiveNear; }
        float GetPerspectiveFarCLip() const { return m_PerspectiveFar; }
        // Perspective setters
        void SetPerspectiveVerticalFOV(const float fov) { m_PerspectiveFOV = fov; RecalculateProjection(); }
        void SetPerspectiveNearClip(const float nearClip) {m_PerspectiveNear = nearClip; RecalculateProjection();}
        void SetPerspectiveFarClip(const float farClip) {m_PerspectiveFar = farClip; RecalculateProjection();}


        // Orthographic getters
        float GetOrthographicSize() const { return m_OrthographicSize; }
        float GetOrthographicNearCLip() const { return m_OrthographicNear; }
        float GetOrthographicFarCLip() const { return m_OrthographicFar; }
        // Orthographic setters
        void SetOrthographicSize(const float size) { m_OrthographicSize = size; RecalculateProjection(); }
        void SetOrthographicNearClip(const float nearClip) {m_OrthographicNear = nearClip; RecalculateProjection();}
        void SetOrthographicFarClip(const float farClip) {m_OrthographicFar = farClip; RecalculateProjection();}



        ProjectionType GetProjectionType() const { return m_ProjectionType; }
        void SetProjectionType(const ProjectionType type) { m_ProjectionType = type; RecalculateProjection(); }
    private:
        void RecalculateProjection();
    private:
        ProjectionType m_ProjectionType = ProjectionType::Orthographic;

        float m_OrthographicSize = 10.0f;
        float m_OrthographicNear = -1.0f, m_OrthographicFar = 1.0f;

        float m_PerspectiveFOV = glm::radians(45.f);
        float m_PerspectiveNear = 0.01f, m_PerspectiveFar = 1000.0f;

        float m_AspectRatio = 1.0f;
    };
}


#endif //SCENCECAMERA_H
