]> git.tdb.fi Git - libs/gl.git/blobdiff - source/uniform.h
Check the flat qualifier from the correct member
[libs/gl.git] / source / uniform.h
diff --git a/source/uniform.h b/source/uniform.h
deleted file mode 100644 (file)
index 216d3be..0000000
+++ /dev/null
@@ -1,132 +0,0 @@
-#ifndef MSP_GL_UNIFORM_H_
-#define MSP_GL_UNIFORM_H_
-
-#include <algorithm>
-
-namespace Msp {
-namespace GL {
-
-class Uniform
-{
-protected:
-       Uniform() { }
-private:
-       Uniform(const Uniform &);
-       Uniform &operator=(const Uniform &);
-public:
-       virtual ~Uniform() { }
-
-       virtual void apply(int) const = 0;
-       virtual Uniform *clone() const = 0;
-};
-
-
-template<typename T>
-class UniformScalar: public Uniform
-{
-public:
-       typedef T BaseType;
-       typedef T Type;
-
-private:
-       Type value;
-
-public:
-       UniformScalar(Type v): value(v) { }
-
-       virtual void apply(int index) const
-       { apply(index, 1, &value); }
-
-       static void apply(int, unsigned, const T *);
-
-       virtual UniformScalar *clone() const
-       { return new UniformScalar(value); }
-};
-
-typedef UniformScalar<int> Uniform1i;
-typedef UniformScalar<float> Uniform1f;
-
-
-template<typename T, unsigned vecsize>
-class UniformVector: public Uniform
-{
-public:
-       typedef T BaseType;
-       typedef T Type[vecsize];
-
-private:
-       Type value;
-
-public:
-       UniformVector(const T *vp)
-       { std::copy(vp, vp+vecsize, value); }
-
-       virtual void apply(int index) const
-       { apply(index, 1, value); }
-
-       static void apply(int index, unsigned size, const T *value);
-
-       virtual UniformVector *clone() const
-       { return new UniformVector(value); }
-};
-
-typedef UniformVector<float, 2> Uniform2f;
-typedef UniformVector<float, 3> Uniform3f;
-typedef UniformVector<float, 4> Uniform4f;
-
-
-template<typename T, unsigned rows, unsigned cols>
-class UniformMatrix: public Uniform
-{
-public:
-       typedef T BaseType;
-       typedef T Type[rows*cols];
-
-private:
-       Type value;
-
-public:
-       UniformMatrix(const T *vp)
-       { std::copy(vp, vp+rows*cols, value); }
-
-       virtual void apply(int index) const
-       { apply(index, 1, value); }
-
-       static void apply(int index, unsigned size, const T *value);
-
-       virtual UniformMatrix *clone() const
-       { return new UniformMatrix(value); }
-};
-
-typedef UniformMatrix<float, 4, 4> UniformMatrix4x4f;
-
-
-template<typename T>
-class UniformArray: public Uniform
-{
-private:
-       typedef typename T::BaseType BaseType;
-
-       BaseType *values;
-       unsigned size;
-
-public:
-       UniformArray(unsigned n, const BaseType *vp):
-               size(n)
-       {
-               unsigned elemsize = sizeof(typename T::Type)/sizeof(typename T::BaseType);
-               values = new BaseType[elemsize*size];
-               std::copy(vp, vp+elemsize*size, values);
-       }
-
-       virtual void apply(int index) const
-       { T::apply(index, size, values); }
-
-       virtual UniformArray *clone() const
-       { return new UniformArray(size, values); }
-};
-
-} // namespace GL
-} // namespace Msp
-
-#endif