Commit b2861e03 authored by Robert Menzel's avatar Robert Menzel

Uniform class can set uniform arrays of floats (quick fix for SPAG)

parent e5feebdc
......@@ -59,6 +59,7 @@ typedef UniformControl<Uniform1f> Uniform1fControl;
typedef UniformControl<Uniform2f> Uniform2fControl;
typedef UniformControl<Uniform3f> Uniform3fControl;
typedef UniformControl<Uniform4f> Uniform4fControl;
typedef UniformControl<Uniform1fv> Uniform1fvControl;
typedef UniformControl<UniformMatrix2f> UniformMatrix2fControl;
typedef UniformControl<UniformMatrix3f> UniformMatrix3fControl;
typedef UniformControl<UniformMatrix4f> UniformMatrix4fControl;
......
......@@ -22,7 +22,7 @@
#include <ACGL/OpenGL/GL.hh>
#include <ACGL/Math/Math.hh>
#include <ACGL/OpenGL/Objects/Texture.hh>
#include <vector>
namespace ACGL{
namespace OpenGL{
......@@ -104,6 +104,21 @@ ACGL_SMARTPOINTER_TYPEDEFS(Uniform1f)
//=========================
class Uniform1fv : public UniformData<std::vector<GLfloat>>, public Uniform
{
public:
virtual ~Uniform1fv(void) {}
void apply(GLint _location) const
{
if(!mValue.empty())
glUniform1fv(_location, (GLsizei)mValue.size(), (GLfloat*)&mValue[0]);
}
};
ACGL_SMARTPOINTER_TYPEDEFS(Uniform1fv)
//=========================
class Uniform2f : public UniformData<glm::vec2>, public Uniform
{
public:
......@@ -114,6 +129,7 @@ public:
ACGL_SMARTPOINTER_TYPEDEFS(Uniform2f)
//=========================
class Uniform3f : public UniformData<glm::vec3>, public Uniform
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment