Advertisement
Guest User

Untitled

a guest
Jun 25th, 2018
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.01 KB | None | 0 0
  1. class Shader
  2.     {
  3.     public:
  4.         enum Type
  5.         {
  6.             NONE = 0,
  7.             VERTEX = 1,
  8.             FRAGMENT = 2,
  9.             GEOMETRY = 3,
  10.             TESSELATION_CONTROL = 4
  11.         };
  12.         static const Shader* currentlyBound;
  13.  
  14.         Shader() = default;
  15.         virtual ~Shader() = default;
  16.  
  17.         virtual void* CreateShader(const std::string& shader, Type type) { return nullptr; }
  18.         virtual void CreateAndUseProgram(const void* shaders, int shaderCount) {}
  19.         virtual void UseProgram() const {}
  20.         virtual void UnuseProgram() const {}
  21.  
  22.         virtual int getUniformLocation(const std::string &uniformName) const { return 0; }
  23.  
  24.         virtual void Free() {}
  25.  
  26.         template<typename T>
  27.         T getShaderProgram()
  28.         {
  29.             return static_cast<T>(getProgram());
  30.         }
  31.        
  32.         virtual void Uniform1i(const std::string& name, int value) {}
  33.         virtual void Uniform1f(const std::string& name, float value) {}
  34.         virtual void Uniform1d(const std::string& name, double value) {}
  35.  
  36.         virtual void Uniform1iv(const std::string& name, Uint count, const int* value) {}
  37.         virtual void Uniform1fv(const std::string& name, Uint count, const float* value) {}
  38.         virtual void Uniform1dv(const std::string& name, Uint count, const double* value) {}
  39.  
  40.         virtual void Uniform2i(const std::string& name, int value0, int value1) {}
  41.         virtual void Uniform2f(const std::string& name, float value0, float value) {}
  42.         virtual void Uniform2d(const std::string& name, double value0, double value) {}
  43.  
  44.         virtual void Uniform2iv(const std::string& name, Uint count, const int* value) {}
  45.         virtual void Uniform2fv(const std::string& name, Uint count, const float* value) {}
  46.         virtual void Uniform2dv(const std::string& name, Uint count, const double* value) {}
  47.  
  48.         virtual void Uniform3i(const std::string& name, int value0, int value1, int value2) {}
  49.         virtual void Uniform3f(const std::string& name, float value0, float value, float value2) {}
  50.         virtual void Uniform3d(const std::string& name, double value0, double value, double value2) {}
  51.  
  52.         virtual void Uniform3iv(const std::string& name, Uint count, const int* value) {}
  53.         virtual void Uniform3fv(const std::string& name, Uint count, const float* value) {}
  54.         virtual void Uniform3dv(const std::string& name, Uint count, const double* value) {}
  55.  
  56.         virtual void Uniform4i(const std::string& name, int value0, int value1, int value2, int value3) {}
  57.         virtual void Uniform4f(const std::string& name, float value0, float value, float value2, float value3) {}
  58.         virtual void Uniform4d(const std::string& name, double value0, double value, double value2, double value4) {}
  59.  
  60.         virtual void Uniform4iv(const std::string& name, Uint count, const int* value) {}
  61.         virtual void Uniform4fv(const std::string& name, Uint count, const float* value) {}
  62.         virtual void Uniform4dv(const std::string& name, Uint count, const double* value) {}
  63.  
  64.         virtual void UniformMatrix4fv(const std::string& name, const Mat4& matrix) {}
  65.         virtual void UniformMatrix4dv(const std::string& name, const Mat4& matrix) {}
  66.  
  67.     protected:
  68.         virtual inline void* getProgram() const { return nullptr; }
  69.  
  70.         Type type = Type::NONE;
  71.     };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement