]> git.tdb.fi Git - libs/gl.git/blobdiff - source/uniform.cpp
Drop Id tags and copyright notices from files
[libs/gl.git] / source / uniform.cpp
index 88c42d377067f73fbde380164b7acad458b6cdf7..af49c047f71be82f5c635a66560a40d7f27d549d 100644 (file)
@@ -1,10 +1,4 @@
-/* $Id$
-
-This file is part of libmspgl
-Copyright © 2007  Mikko Rasa, Mikkosoft Productions
-Distributed under the LGPL
-*/
-
+#include <algorithm>
 #include "arb_shader_objects.h"
 #include "uniform.h"
 
@@ -20,6 +14,11 @@ void Uniform1i::apply(int index) const
        glUniform1iARB(index, v);
 }
 
+Uniform1i *Uniform1i::clone() const
+{
+       return new Uniform1i(v);
+}
+
 
 Uniform1f::Uniform1f(float v_):
        v(v_)
@@ -30,11 +29,16 @@ void Uniform1f::apply(int index) const
        glUniform1fARB(index, v);
 }
 
+Uniform1f *Uniform1f::clone() const
+{
+       return new Uniform1f(v);
+}
+
 
 Uniform2f::Uniform2f(float v0, float v1)
 {
-       v[0]=v0;
-       v[1]=v1;
+       v[0] = v0;
+       v[1] = v1;
 }
 
 void Uniform2f::apply(int index) const
@@ -42,12 +46,17 @@ void Uniform2f::apply(int index) const
        glUniform2fvARB(index, 1, v);
 }
 
+Uniform2f *Uniform2f::clone() const
+{
+       return new Uniform2f(v[0], v[1]);
+}
+
 
 Uniform3f::Uniform3f(float v0, float v1, float v2)
 {
-       v[0]=v0;
-       v[1]=v1;
-       v[2]=v2;
+       v[0] = v0;
+       v[1] = v1;
+       v[2] = v2;
 }
 
 void Uniform3f::apply(int index) const
@@ -55,13 +64,18 @@ void Uniform3f::apply(int index) const
        glUniform3fvARB(index, 1, v);
 }
 
+Uniform3f *Uniform3f::clone() const
+{
+       return new Uniform3f(v[0], v[1], v[2]);
+}
+
 
 Uniform4f::Uniform4f(float v0, float v1, float v2, float v3)
 {
-       v[0]=v0;
-       v[1]=v1;
-       v[2]=v2;
-       v[3]=v3;
+       v[0] = v0;
+       v[1] = v1;
+       v[2] = v2;
+       v[3] = v3;
 }
 
 void Uniform4f::apply(int index) const
@@ -69,5 +83,26 @@ void Uniform4f::apply(int index) const
        glUniform4fvARB(index, 1, v);
 }
 
+Uniform4f *Uniform4f::clone() const
+{
+       return new Uniform4f(v[0], v[1], v[2], v[3]);
+}
+
+
+UniformMatrix4x4f::UniformMatrix4x4f(const float *vp)
+{
+       std::copy(vp, vp+16, v);
+}
+
+void UniformMatrix4x4f::apply(int index) const
+{
+       glUniformMatrix4fvARB(index, 1, false, v);
+}
+
+UniformMatrix4x4f *UniformMatrix4x4f::clone() const
+{
+       return new UniformMatrix4x4f(v);
+}
+
 } // namespace GL
 } // namespace Msp