#pragma once
#include "node.h"
#include "canvas.h"

class NodeCanvas : public Node
{
public:
    enum class kCursorVisibility { Never, SmallBrush, NotPainting, Always } m_cursor_visibility;
    std::unique_ptr<Canvas> m_canvas;
    RTT m_blender_rtt;
    RTT m_cache_rtt;
    RTT m_rtt;
    Texture2D m_blender_bg;
    Sampler m_sampler;
    Sampler m_sampler_linear;
    Sampler m_sampler_nearest;
    Sampler m_sampler_stencil;
    Plane m_face_plane;
    LineSegment m_line;
    Plane m_grid;
    glm::vec2 m_outline_pan;
    int m_grid_divs = 30;
    float m_density = 1.f;
    virtual Node* clone_instantiate() const override;
    virtual void init() override;
    virtual void restore_context() override;
    virtual void clear_context() override;
    virtual void draw() override;
    virtual void handle_resize(glm::vec2 old_size, glm::vec2 new_size, float zoom) override;
    virtual kEventResult handle_event(Event* e) override;
    virtual void destroy() override;
    virtual void on_tick(float dt) override;
    void reset_camera();
    void create_buffers();
    void set_density(float d);
    void set_cursor_visibility(kCursorVisibility mode);
    void update_cursor();
};
