X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Frender%2Fprogramdata.h;fp=source%2Frender%2Fprogramdata.h;h=f600f02585c3d13fcd5cdd57ba0004da30c2e04b;hb=4124807fcacedc8317bd109f056d48e077d0c12f;hp=a90d868e3bb7e3598200f074791189ee85e0cc15;hpb=ccd636b2fa8b9f270fbe600629dd109e78d00992;p=libs%2Fgl.git diff --git a/source/render/programdata.h b/source/render/programdata.h index a90d868e..f600f025 100644 --- a/source/render/programdata.h +++ b/source/render/programdata.h @@ -8,6 +8,7 @@ #include "matrix.h" #include "program.h" #include "tag.h" +#include "uniform.h" #include "vector.h" namespace Msp { @@ -22,7 +23,6 @@ public: class Buffer; class BufferBackedUniformBlock; -class Uniform; class UniformBlock; struct Color; @@ -183,33 +183,25 @@ public: 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 &); void uniform_matrix2(Tag, const float *); - void uniform(Tag, const LinAl::Matrix &); void uniform_matrix3x2(Tag, const float *); - void uniform(Tag, const LinAl::Matrix &); void uniform_matrix4x2(Tag, const float *); - void uniform(Tag, const LinAl::Matrix &); void uniform_matrix2x3(Tag, const float *); - void uniform(Tag, const LinAl::Matrix &); void uniform_matrix3(Tag, const float *); - void uniform(Tag, const LinAl::Matrix &); void uniform_matrix4x3(Tag, const float *); - void uniform(Tag, const LinAl::Matrix &); void uniform_matrix2x4(Tag, const float *); - void uniform(Tag, const LinAl::Matrix &); 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 *); @@ -227,6 +219,19 @@ public: 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 + void uniform(Tag, const LinAl::Vector &); + + template + void uniform(Tag, const LinAl::Matrix &); + + template + void uniform_array(Tag, unsigned, const LinAl::Vector *); + + template + void uniform_array(Tag, unsigned, const LinAl::Matrix *); + void remove_uniform(Tag); std::vector get_uniform_tags() const; @@ -245,6 +250,22 @@ public: void apply() const; }; +template +void ProgramData::uniform(Tag tag, const LinAl::Vector &v) +{ uniform >(tag, &v.x); } + +template +void ProgramData::uniform(Tag tag, const LinAl::Matrix &v) +{ uniform >(tag, &v(0, 0)); } + +template +void ProgramData::uniform_array(Tag tag, unsigned n, const LinAl::Vector *v) +{ uniform_array >(tag, n, &v[0].x); } + +template +void ProgramData::uniform_array(Tag tag, unsigned n, const LinAl::Matrix *v) +{ uniform_array >(tag, n, &v[0](0, 0)); } + } // namespace GL } // namespace Msp