#ifndef PARTICLES_STAGE_HPP_
#define PARTICLES_STAGE_HPP_

#include <PipelineStage/DrawStage/DrawStage.hpp>
#include <Vk/DescriptorSet/DescriptorSet.hpp>

/**
 * @brief The stage at which additive particles are drawn.
 */
class ParticlesStage : public DrawStage
{
private:
    std::shared_ptr<Vk::DescriptorSet> dataDescSet;

public:
    struct Particle
    {
        alignas(16) glm::vec3 startPos;
        alignas(16) glm::vec3 startVel;
        alignas(16) glm::vec3 acceleration;
        alignas(16) glm::vec3 startSize;
        alignas(16) glm::vec3 endSize;
        alignas(16) glm::vec4 startColor;
        alignas(16) glm::vec4 endColor;
        alignas(16) glm::uvec3 baseVoxel;
        uint32_t startTime;
        uint32_t endTime;

        bool isAlive() const;
    };

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

    /**
     * @brief Draw particles from the specified array descriptor set.
     */
    void draw(Vk::DescriptorSet &descSet, uint32_t count);

    virtual void onFrameBegins() override;
};

#endif