#ifndef MODEL_STAGE_HPP_
#define MODEL_STAGE_HPP_

#include <PipelineStage/DrawStage/DrawStage.hpp>

/**
 * @brief Represents the drawing stage during which we draw voxel models via raytracing.
 */
class ModelStage : public DrawStage
{
private:
    std::shared_ptr<Vk::DescriptorSet> dataDescSet;

public:
    struct ModelBuffer
    {
        uint32_t xsize;
        uint32_t ysize;
        uint32_t zsize;
        uint32_t resv;
        uint32_t voxels[];
    };

    struct ModelData
    {
        alignas(16) glm::mat4 modelMatrix;
        alignas(16) glm::mat4 antiMVP;
    };

    ModelStage(
        FrameDrawer &frameDrawer,
        std::shared_ptr<Vk::DescriptorSet> dataDescSet
    );

    /**
     * @brief Set the model matrix.
     */
    void setModelMatrix(const glm::mat4 &modelMatrix);

    /**
     * @brief Draw the model given its descriptor set.
     */
    void drawModel(Vk::DescriptorSet &descSet);

    virtual void onFrameBegins() override;
};


#endif