//
// Created by sebastian on 24.12.25.
//

#ifndef DICEWARS_SIEDLER_SHADERPROGRAM_H
#define DICEWARS_SIEDLER_SHADERPROGRAM_H
#include <string>

#include "../../../../lib/glfw/src/internal.h"
#include <glm/glm.hpp>

class ShaderProgram {
public:
    ShaderProgram(std::string vert, std::string frag);
    void start();
    void stop();
    void cleanUp();
protected:
    GLuint programID;
    GLuint vertexShaderID;
    GLuint fragmentShaderID;

    void bindAttribute(int attribute, const std::string& variableName) const;

    virtual void bindAttributes() const = 0;

    [[nodiscard]] int getUniformLocation(const std::string& uniformName) const;
    virtual void getAllUniformLocations() = 0;

    void loadFloat(int location, float value);
    void loadVector(int location, glm::vec3 vector);
    void loadBoolean(int location, bool value);
    void loadMatrix(int location, glm::mat4 matrix);
private:
    static int loadShader(const std::string& file, int type);
};


#endif //DICEWARS_SIEDLER_SHADERPROGRAM_H