]> git.tdb.fi Git - libs/gl.git/blobdiff - source/programdata.cpp
Convert Matrix to use floats
[libs/gl.git] / source / programdata.cpp
index ded9f8a7bb242c38f5606b9cc1dce7bef67d4b2a..1287914005055ff91bb2102260daf4b28d50e710 100644 (file)
@@ -1,4 +1,4 @@
-#include "arb_shader_objects.h"
+#include <msp/gl/extensions/arb_shader_objects.h>
 #include "buffer.h"
 #include "color.h"
 #include "error.h"
@@ -33,6 +33,24 @@ ProgramData::ProgramData(const ProgramData &other):
                i->second = i->second->clone();
 }
 
+ProgramData &ProgramData::operator=(const ProgramData &other)
+{
+       for(UniformMap::iterator i=uniforms.begin(); i!=uniforms.end(); ++i)
+               delete i->second;
+       uniforms.clear();
+
+       for(UniformMap::const_iterator i=other.uniforms.begin(); i!=other.uniforms.end(); ++i)
+               uniforms.insert(uniforms.end(), UniformMap::value_type(i->first, i->second->clone()));
+
+       for(BlockMap::iterator i=blocks.begin(); i!=blocks.end(); ++i)
+               delete i->second.block;
+       blocks.clear();
+
+       changes = NO_CHANGES;
+
+       return *this;
+}
+
 ProgramData::~ProgramData()
 {
        for(UniformMap::iterator i=uniforms.begin(); i!=uniforms.end(); ++i)
@@ -131,9 +149,7 @@ void ProgramData::uniform_matrix3(const string &name, const float *v)
 
 void ProgramData::uniform(const string &name, const Matrix &m)
 {
-       float v[16];
-       copy(m.data(), m.data()+16, v);
-       uniform_matrix4(name, v);
+       uniform_matrix4(name, m.data());
 }
 
 void ProgramData::uniform_matrix4(const string &name, const float *v)