#pragma once

#include "Program.hpp"

namespace pass {
    /// Abstract voxels pass
    class VoxelProgram: public Program {
    public:
        using options = render::passOptions;

        VoxelProgram(const options &opts, std::vector<std::string> flags = {});
        ~VoxelProgram();

        void start(render::gl::Renderer *);

    protected:
        void setup(glm::vec4 sphereProj, float curvature);

        std::string getName() const override;
        void setView(const GLfloat *matrix);
        void setProj(const GLfloat *matrix);

        void bindTexture(const GLuint textureID);
        void bindNormal(const GLuint textureID);
        void bindHOS(const GLuint textureID);

        void setLightInvDir(const GLfloat *pos);
        void setFog(const GLfloat *color, GLfloat depth);

        void setSphereProj(const GLfloat *offRad);
        void setCurvature(GLfloat ratio);

    private:
        GLuint ViewMatrixID;
        GLuint ProjMatrixID;

        GLuint TextureID;
        GLuint NormalID;
        GLuint HOSID;

        GLuint LightInvDirID;
        GLuint FogDepthID;
        GLuint FogColorID;

        GLuint SphereProjID;
        GLuint CurvatureID;
    };
}