#pragma once

#include "buffer.hpp"
#include "interfaces/IResizable.hpp"
#include "Vector2.hpp"

namespace TSE::OpenGL
{
    class FrameBuffer : public buffer, public IResizable
    {
    private:
        uint textureOutputCount = 1;
        uint textureIDs[32] = {0};
        uint depthRboID = 0;
        bool shouldResize = false;

    public:
        FrameBuffer(const Vector2& size, uint textureCount = 1);
        void Bind() override;
        void Unbind() override;
        ~FrameBuffer() override;
        void Resize(Vector2 size);
        void Update();
        uint GetTextureId(uint id = 0) const;
        Vector2 GetSize() const;

    private:
        void Initialize();
        void LoadFBTexture();
        void CreateFBTexture();
    };
} // namespace TSE
