shader.h 1.0 KB

123456789101112131415161718192021222324252627282930
  1. #pragma once
  2. #include <string>
  3. #include <glm/gtc/matrix_transform.hpp>
  4. class Shader
  5. {
  6. public:
  7. Shader(const char* vertexPath, const char* fragmentPath);
  8. void use();
  9. void set4f(const std::string& uniform, float val1, float val2, float val3, float val4);
  10. void setFloat(const char* name, float value, bool useShader = false);
  11. void setInteger(const char* name, int value, bool useShader = false);
  12. void setVector2f(const char* name, float x, float y, bool useShader = false);
  13. void setVector2f(const char* name, const glm::vec2& value, bool useShader = false);
  14. void setVector3f(const char* name, float x, float y, float z, bool useShader = false);
  15. void setVector3f(const char* name, const glm::vec3& value, bool useShader = false);
  16. void setVector4f(const char* name, float x, float y, float z, float w, bool useShader = false);
  17. void setVector4f(const char* name, const glm::vec4& value, bool useShader = false);
  18. void setMatrix4(const char* name, const glm::mat4& matrix, bool useShader = false);
  19. private:
  20. bool compiled = false;
  21. unsigned int ID;
  22. };