//
// Created by slinky on 5/11/26.
//

#ifndef B_ENGINE_UISCENEVIEWER_H
#define B_ENGINE_UISCENEVIEWER_H

#include "glad/gl.h"
#include "imgui.h"
#include "IUIPanel.h"

#include "Scene.h"
#include "Camera.h"

class UISceneViewer : public IUIPanel {
public:
    UISceneViewer();

    void update(EditorContext& ctx) override;

    void bind_fbo() const;
private:
    ImVec2 sceneViewportSize = { 0.0f, 0.0f };
    GLuint sceneRenderTexture = 0;
    GLuint fbo = 0;
    GLuint rbo = 0;

    Scene* scene = nullptr;
    Camera* camera = nullptr;

    bool capturedMouse = false;

    void create_scene_framebuffer();
    void resize_scene_framebuffer(int width, int height);
};


#endif //B_ENGINE_UISCENEVIEWER_H
