#ifndef TERRAIN_STAGE_HPP_
#define TERRAIN_STAGE_HPP_

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

/**
 * @brief The stage at which terrain is drawn via raymarching.
 */
class TerrainStage : public DrawStage
{
private:
    std::shared_ptr<Vk::DescriptorSet> dataDescSet;

    std::shared_ptr<Vk::Buffer> skyboxDataBuffer;
    std::shared_ptr<Vk::DescriptorSet> skyboxDescSet;

    struct SkyboxData
    {
        alignas(16) glm::mat4 model;
        alignas(16) glm::mat4 antiModel;
        alignas(16) glm::vec3 color;
        alignas(8) glm::vec2 screenSize;
        float playerZ;
        float farZ;
        int debugMode;
        int fxaaEnabled;
    };

public:
    BlockTintManager tintManager;

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

    virtual void onFrameBegins() override;
    virtual void onFrameEnds() override;
};

#endif