Pioneer
Uniform.h
Go to the documentation of this file.
1 // Copyright © 2008-2023 Pioneer Developers. See AUTHORS.txt for details
2 // Licensed under the terms of the GPL v3. See licenses/GPL-3.txt
3 
4 #ifndef _OGL_UNIFORM_H
5 #define _OGL_UNIFORM_H
6 /*
7  * Shader uniform
8  */
9 #include "OpenGLLibs.h"
10 
11 #include "Color.h"
12 #include "matrix3x3.h"
13 #include "matrix4x4.h"
14 #include "vector3.h"
15 
16 namespace Graphics {
17 
18  class Texture;
19 
20  namespace OGL {
21  class Uniform {
22  public:
23  Uniform();
24  Uniform(GLint location) :
25  m_location(location) {}
26  void Init(const char *name, GLuint program);
27  void InitBlock(const char *name, GLuint program, GLint binding);
28  void Set(int);
29  void Set(float);
30  void Set(const vector3f &);
31  void Set(const vector3d &);
32  void Set(const Color &);
33  void Set(const Color4f &);
34  void Set(const matrix3x3f &);
35  void Set(const matrix4x4f &);
36  void Set(Texture *t, unsigned int unit);
37  bool IsValid() const { return (m_location != -1); }
38  GLint Location() const { return m_location; }
39 
40  private:
41  GLint m_location;
42  };
43  } // namespace OGL
44 } // namespace Graphics
45 
46 #endif
Definition: Uniform.h:21
Uniform(GLint location)
Definition: Uniform.h:24
Uniform()
Definition: Uniform.cpp:10
void Init(const char *name, GLuint program)
Definition: Uniform.cpp:15
GLint Location() const
Definition: Uniform.h:38
bool IsValid() const
Definition: Uniform.h:37
void Set(int)
Definition: Uniform.cpp:27
void InitBlock(const char *name, GLuint program, GLint binding)
Definition: Uniform.cpp:20
Definition: Texture.h:106
Definition: Background.h:14
Definition: Color.h:11
Definition: Color.h:66