#pragma once

#include "MaterialNode.h"
#include "Color.h"

class SceneModel;

class GridNode : public MaterialNode
{
public:
    GridNode(const Transform& transform);

    virtual ~GridNode();

    void setNumX(std::size_t numX);

    void setNumY(std::size_t numY);

    void setData(const std::vector<Color>& colors);

    SceneItem* getSceneItem(std::size_t idx) const override;
    std::size_t getNumSceneItems() const override;

    void update(SceneInfo* sceneInfo) override;

    void setWidth(double width);
    void setHeight(double height);

private:
    std::size_t mNumberX{5};
    std::size_t mNumberY{5};
    double mWidth{1};
    double mHeight{1};

    bool mDataDirty = true;
    bool mGeometryIsDirty = true;

    std::vector<Color> mData;

    std::unique_ptr<SceneModel> mBackgroundModel;
    std::unique_ptr<SceneModel> mOutlineModel;
};
