Ocular Engine
Uniform.hpp
1 
17 #pragma once
18 #ifndef __H__OCULAR_GRAPHICS_SHADER_UNIFORM__H__
19 #define __H__OCULAR_GRAPHICS_SHADER_UNIFORM__H__
20 
21 #include "Math/Matrix4x4.hpp"
22 #include "Math/Vector4.hpp"
23 
24 #include <array>
25 
26 //------------------------------------------------------------------------------------------
27 
32 namespace Ocular
33 {
38  namespace Graphics
39  {
43  class Uniform
44  {
45  public:
46 
48  static const uint32_t MaxDataSize = 16;
49 
50  Uniform();
51  ~Uniform();
52 
53  Uniform(Uniform const&);
54  void operator=(Uniform const&);
55 
56  //------------------------------------------------------------
57  // Data Methods
58  //------------------------------------------------------------
59 
64  void setData(float data);
65 
70  void setData(Math::Vector4f const& data);
71 
76  void setData(Math::Matrix3x3 const& data);
77 
82  void setData(Math::Matrix4x4 const& data);
83 
92  bool setData(uint32_t size, float const* data);
93 
97  uint32_t getSize() const;
98 
107  float getElement(uint32_t index) const;
108 
114  float const* getData() const;
115 
116  //------------------------------------------------------------
117  // Name Methods
118  //------------------------------------------------------------
119 
124  void setName(std::string const& name);
125 
129  std::string const& getName() const;
130 
131  //------------------------------------------------------------
132  // Type Methods
133  //------------------------------------------------------------
134 
139  void setType(std::string const& type);
140 
144  std::string const& getType() const;
145 
146  //------------------------------------------------------------
147  // Register Methods
148  //------------------------------------------------------------
149 
154  void setRegister(uint32_t index);
155 
159  uint32_t getRegister() const;
160 
161  protected:
162 
163  std::string m_Name;
164  std::string m_Type;
165 
166  uint32_t m_Register;
167 
168  uint32_t m_Size;
169  std::array<float, Uniform::MaxDataSize> m_Data;
170 
171  private:
172  };
173  }
177 }
182 //------------------------------------------------------------------------------------------
183 
184 #endif
Definition: Matrix3x3.hpp:39
Definition: Uniform.hpp:43
static const uint32_t MaxDataSize
Maximum size of the m_Data array.
Definition: Uniform.hpp:48
std::string const & getName() const
Definition: Uniform.cpp:182
Note: Once this library is made dynamic, this will no longer be needed.
Definition: Common.hpp:70
void setType(std::string const &type)
Definition: Uniform.cpp:191
void setName(std::string const &name)
Definition: Uniform.cpp:177
float const * getData() const
Definition: Uniform.cpp:168
A 3x3 column-major float matrix.
Definition: Matrix3x3.hpp:63
std::string const & getType() const
Definition: Uniform.cpp:196
void setRegister(uint32_t index)
Definition: Uniform.cpp:205
uint32_t getRegister() const
Definition: Uniform.cpp:210
A 4x4 column-major float matrix.
Definition: Matrix4x4.hpp:64
float getElement(uint32_t index) const
Definition: Uniform.cpp:152
void setData(float data)
Definition: Uniform.cpp:81
uint32_t getSize() const
Definition: Uniform.cpp:147