Nymph Game Engine
Chaiscript based Game Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
uniform.h
Go to the documentation of this file.
1 #ifndef UNIFORM_H
2 #define UNIFORM_H
3 #include <glm/glm.hpp>
4 #include <string>
5 
6 namespace Graphics {
10  class Uniform {
11  public:
17  private:
18  UniformTypes uniform_type;
19  std::string name;
20  float float_data;
21  glm::vec2 vec2_data;
22  glm::vec3 vec3_data;
23  glm::vec4 vec4_data;
24  int int_data;
25  glm::ivec2 ivec2_data;
26  glm::ivec3 ivec3_data;
27  glm::ivec4 ivec4_data;
28  unsigned int uint_data;
29  glm::uvec2 uvec2_data;
30  glm::uvec3 uvec3_data;
31  glm::uvec4 uvec4_data;
32  bool bool_data;
33  glm::bvec2 bvec2_data;
34  glm::bvec3 bvec3_data;
35  glm::bvec4 bvec4_data;
36  glm::mat2 mat2_data;
37  glm::mat3 mat3_data;
38  glm::mat4 mat4_data;
39  glm::mat2x3 mat23_data;
40  glm::mat3x2 mat32_data;
41  glm::mat2x4 mat24_data;
42  glm::mat4x2 mat42_data;
43  glm::mat3x4 mat34_data;
44  glm::mat4x3 mat43_data;
45 
46  bool dirty;
47  public:
48  //= BEGIN SCRIPTABLE
49 
53  Uniform();
62  template<typename T>
63  void setData(const std::string& name, const T& data);
69  UniformTypes getType() const noexcept;
75  std::string getName() const noexcept;
81  bool isDirty() const noexcept;
85  void clean() noexcept;
86 
94  template<typename T>
95  T getData() const noexcept;
96 
104  bool operator<(const Uniform& right) const noexcept;
112  bool operator==(const Uniform& right) const noexcept;
120  bool operator!=(const Uniform& right) const noexcept;
121 
127  std::string to_string() const noexcept;
128  //= END SCRIPTABLE
129  };
130 }
131 
132 #endif
bool isDirty() const noexcept
Determines if dirty.
Definition: uniform.cpp:266
Uniform()
Uniform constructor.
Definition: uniform.cpp:5
Class for shader uniform.
Definition: uniform.h:10
std::string getName() const noexcept
Gets the name.
Definition: uniform.cpp:262
std::string to_string() const noexcept
Returns a string representation of the object.
Definition: uniform.cpp:492
void clean() noexcept
dirty = false
Definition: uniform.cpp:270
void setData(const std::string &name, const T &data)
Sets the data.
T getData() const noexcept
Gets the data.
UniformTypes getType() const noexcept
Gets the type.
Definition: uniform.cpp:258
UniformTypes
Definition: uniform.h:15