uniform3(tag, va);
}
-void ProgramData::uniform(Tag tag, const Vector3 &v)
-{
- uniform(tag, v.x, v.y, v.z);
-}
-
void ProgramData::uniform3(Tag tag, const int *v)
{
uniform<Uniform3i>(tag, v);
uniform4(tag, va);
}
-void ProgramData::uniform(Tag tag, const Vector4 &v)
-{
- uniform(tag, v.x, v.y, v.z, v.w);
-}
-
void ProgramData::uniform(Tag tag, const Color &c)
{
uniform(tag, c.r, c.g, c.b, c.a);
uniform<Uniform4f>(tag, v);
}
-void ProgramData::uniform(Tag tag, const LinAl::Matrix<float, 2, 2> &m)
-{
- uniform_matrix2(tag, &m(0, 0));
-}
-
void ProgramData::uniform_matrix2(Tag tag, const float *v)
{
uniform<UniformMatrix2x2f>(tag, v);
}
-void ProgramData::uniform(Tag tag, const LinAl::Matrix<float, 2, 3> &m)
-{
- uniform_matrix3x2(tag, &m(0, 0));
-}
-
void ProgramData::uniform_matrix3x2(Tag tag, const float *v)
{
uniform<UniformMatrix3x2f>(tag, v);
}
-void ProgramData::uniform(Tag tag, const LinAl::Matrix<float, 2, 4> &m)
-{
- uniform_matrix4x2(tag, &m(0, 0));
-}
-
void ProgramData::uniform_matrix4x2(Tag tag, const float *v)
{
uniform<UniformMatrix4x2f>(tag, v);
}
-void ProgramData::uniform(Tag tag, const LinAl::Matrix<float, 3, 2> &m)
-{
- uniform_matrix2x3(tag, &m(0, 0));
-}
-
void ProgramData::uniform_matrix2x3(Tag tag, const float *v)
{
uniform<UniformMatrix2x3f>(tag, v);
}
-void ProgramData::uniform(Tag tag, const LinAl::Matrix<float, 3, 3> &m)
-{
- uniform_matrix3(tag, &m(0, 0));
-}
-
void ProgramData::uniform_matrix3(Tag tag, const float *v)
{
uniform<UniformMatrix3x3f>(tag, v);
}
-void ProgramData::uniform(Tag tag, const LinAl::Matrix<float, 3, 4> &m)
-{
- uniform_matrix4x3(tag, &m(0, 0));
-}
-
void ProgramData::uniform_matrix4x3(Tag tag, const float *v)
{
uniform<UniformMatrix4x3f>(tag, v);
}
-void ProgramData::uniform(Tag tag, const LinAl::Matrix<float, 4, 2> &m)
-{
- uniform_matrix2x4(tag, &m(0, 0));
-}
-
void ProgramData::uniform_matrix2x4(Tag tag, const float *v)
{
uniform<UniformMatrix2x4f>(tag, v);
}
-void ProgramData::uniform(Tag tag, const LinAl::Matrix<float, 4, 3> &m)
-{
- uniform_matrix3x4(tag, &m(0, 0));
-}
-
void ProgramData::uniform_matrix3x4(Tag tag, const float *v)
{
uniform<UniformMatrix3x4f>(tag, v);
uniform<UniformMatrix4x4f>(tag, v);
}
+void ProgramData::uniform_array(Tag tag, unsigned n, const int *v)
+{
+ uniform_array<Uniform1i>(tag, n, v);
+}
+
+void ProgramData::uniform_array(Tag tag, unsigned n, const float *v)
+{
+ uniform_array<Uniform1f>(tag, n, v);
+}
+
void ProgramData::uniform1_array(Tag tag, unsigned n, const int *v)
{
uniform_array<Uniform1i>(tag, n, v);
#include "matrix.h"
#include "program.h"
#include "tag.h"
+#include "uniform.h"
#include "vector.h"
namespace Msp {
class Buffer;
class BufferBackedUniformBlock;
-class Uniform;
class UniformBlock;
struct Color;
void uniform2(Tag, const float *);
void uniform(Tag, int, int, int);
void uniform(Tag, float, float, float);
- void uniform(Tag, const Vector3 &);
void uniform3(Tag, const int *);
void uniform3(Tag, const float *);
void uniform(Tag, int, int, int, int);
void uniform(Tag, float, float, float, float);
- void uniform(Tag, const Vector4 &);
void uniform(Tag, const Color &);
void uniform4(Tag, const int *);
void uniform4(Tag, const float *);
- void uniform(Tag, const LinAl::Matrix<float, 2, 2> &);
void uniform_matrix2(Tag, const float *);
- void uniform(Tag, const LinAl::Matrix<float, 2, 3> &);
void uniform_matrix3x2(Tag, const float *);
- void uniform(Tag, const LinAl::Matrix<float, 2, 4> &);
void uniform_matrix4x2(Tag, const float *);
- void uniform(Tag, const LinAl::Matrix<float, 3, 2> &);
void uniform_matrix2x3(Tag, const float *);
- void uniform(Tag, const LinAl::Matrix<float, 3, 3> &);
void uniform_matrix3(Tag, const float *);
- void uniform(Tag, const LinAl::Matrix<float, 3, 4> &);
void uniform_matrix4x3(Tag, const float *);
- void uniform(Tag, const LinAl::Matrix<float, 4, 2> &);
void uniform_matrix2x4(Tag, const float *);
- void uniform(Tag, const LinAl::Matrix<float, 4, 3> &);
void uniform_matrix3x4(Tag, const float *);
void uniform(Tag, const Matrix &);
void uniform_matrix4(Tag, const float *);
+ void uniform_array(Tag, unsigned, const int *);
+ void uniform_array(Tag, unsigned, const float *);
void uniform1_array(Tag, unsigned, const int *);
void uniform1_array(Tag, unsigned, const float *);
void uniform2_array(Tag, unsigned, const int *);
void uniform_matrix2x4_array(Tag, unsigned, const float *);
void uniform_matrix3x4_array(Tag, unsigned, const float *);
void uniform_matrix4_array(Tag, unsigned, const float *);
+
+ template<typename T, unsigned N>
+ void uniform(Tag, const LinAl::Vector<T, N> &);
+
+ template<typename T, unsigned R, unsigned C>
+ void uniform(Tag, const LinAl::Matrix<T, R, C> &);
+
+ template<typename T, unsigned N>
+ void uniform_array(Tag, unsigned, const LinAl::Vector<T, N> *);
+
+ template<typename T, unsigned R, unsigned C>
+ void uniform_array(Tag, unsigned, const LinAl::Matrix<T, R, C> *);
+
void remove_uniform(Tag);
std::vector<Tag> get_uniform_tags() const;
void apply() const;
};
+template<typename T, unsigned N>
+void ProgramData::uniform(Tag tag, const LinAl::Vector<T, N> &v)
+{ uniform<UniformVector<T, N> >(tag, &v.x); }
+
+template<typename T, unsigned R, unsigned C>
+void ProgramData::uniform(Tag tag, const LinAl::Matrix<T, R, C> &v)
+{ uniform<UniformMatrix<T, R, C> >(tag, &v(0, 0)); }
+
+template<typename T, unsigned N>
+void ProgramData::uniform_array(Tag tag, unsigned n, const LinAl::Vector<T, N> *v)
+{ uniform_array<UniformVector<T, N> >(tag, n, &v[0].x); }
+
+template<typename T, unsigned R, unsigned C>
+void ProgramData::uniform_array(Tag tag, unsigned n, const LinAl::Matrix<T, R, C> *v)
+{ uniform_array<UniformMatrix<T, R, C> >(tag, n, &v[0](0, 0)); }
+
} // namespace GL
} // namespace Msp