uniform(name, new Uniform1f(v));
}
+void ProgramData::uniform(const string &name, int v0, int v1)
+{
+ int va[2] = { v0, v1 };
+ uniform2(name, va);
+}
+
void ProgramData::uniform(const string &name, float v0, float v1)
{
float va[2] = { v0, v1 };
uniform2(name, va);
}
+void ProgramData::uniform2(const string &name, const int *v)
+{
+ uniform(name, new Uniform2i(v));
+}
+
void ProgramData::uniform2(const string &name, const float *v)
{
uniform(name, new Uniform2f(v));
}
+void ProgramData::uniform(const string &name, int v0, int v1, int v2)
+{
+ int va[3] = { v0, v1, v2 };
+ uniform3(name, va);
+}
+
void ProgramData::uniform(const string &name, float v0, float v1, float v2)
{
float va[3] = { v0, v1, v2 };
uniform(name, v.x, v.y, v.z);
}
+void ProgramData::uniform3(const string &name, const int *v)
+{
+ uniform(name, new Uniform3i(v));
+}
+
void ProgramData::uniform3(const string &name, const float *v)
{
uniform(name, new Uniform3f(v));
}
+void ProgramData::uniform(const string &name, int v0, int v1, int v2, int v3)
+{
+ int va[4] = { v0, v1, v2, v3 };
+ uniform4(name, va);
+}
+
void ProgramData::uniform(const string &name, float v0, float v1, float v2, float v3)
{
float va[4] = { v0, v1, v2, v3 };
uniform(name, c.r, c.g, c.b, c.a);
}
+void ProgramData::uniform4(const string &name, const int *v)
+{
+ uniform(name, new Uniform4i(v));
+}
+
void ProgramData::uniform4(const string &name, const float *v)
{
uniform(name, new Uniform4f(v));
uniform(name, new UniformArray<Uniform1f>(n, v));
}
+void ProgramData::uniform2_array(const string &name, unsigned n, const int *v)
+{
+ uniform(name, new UniformArray<Uniform2i>(n, v));
+}
+
void ProgramData::uniform2_array(const string &name, unsigned n, const float *v)
{
uniform(name, new UniformArray<Uniform2f>(n, v));
}
+void ProgramData::uniform3_array(const string &name, unsigned n, const int *v)
+{
+ uniform(name, new UniformArray<Uniform3i>(n, v));
+}
+
void ProgramData::uniform3_array(const string &name, unsigned n, const float *v)
{
uniform(name, new UniformArray<Uniform3f>(n, v));
}
+void ProgramData::uniform4_array(const string &name, unsigned n, const int *v)
+{
+ uniform(name, new UniformArray<Uniform4i>(n, v));
+}
+
void ProgramData::uniform4_array(const string &name, unsigned n, const float *v)
{
uniform(name, new UniformArray<Uniform4f>(n, v));
add("uniform1i", &Loader::uniform1i);
add("uniform", &Loader::uniform1f);
add("uniform1f", &Loader::uniform1f);
+ add("uniform", &Loader::uniform2i);
+ add("uniform2i", &Loader::uniform2i);
add("uniform", &Loader::uniform2f);
add("uniform2f", &Loader::uniform2f);
+ add("uniform", &Loader::uniform3i);
+ add("uniform3i", &Loader::uniform3i);
add("uniform", &Loader::uniform3f);
add("uniform3f", &Loader::uniform3f);
+ add("uniform", &Loader::uniform4i);
+ add("uniform4i", &Loader::uniform4i);
add("uniform", &Loader::uniform4f);
add("uniform4f", &Loader::uniform4f);
add("uniform1i_array", &Loader::uniform1i_array);
obj.uniform(n, v);
}
+void ProgramData::Loader::uniform2i(const string &n, int v0, int v1)
+{
+ obj.uniform(n, v0, v1);
+}
+
void ProgramData::Loader::uniform2f(const string &n, float v0, float v1)
{
obj.uniform(n, v0, v1);
}
+void ProgramData::Loader::uniform3i(const string &n, int v0, int v1, int v2)
+{
+ obj.uniform(n, v0, v1, v2);
+}
+
void ProgramData::Loader::uniform3f(const string &n, float v0, float v1, float v2)
{
obj.uniform(n, v0, v1, v2);
}
+void ProgramData::Loader::uniform4i(const string &n, int v0, int v1, int v2, int v3)
+{
+ obj.uniform(n, v0, v1, v2, v3);
+}
+
void ProgramData::Loader::uniform4f(const string &n, float v0, float v1, float v2, float v3)
{
obj.uniform(n, v0, v1, v2, v3);
const int *data = reinterpret_cast<const int *>(ldr.get_data());
if(elem_size==1)
obj.uniform1_array(n, size, data);
+ else if(elem_size==2)
+ obj.uniform2_array(n, size, data);
+ else if(elem_size==3)
+ obj.uniform3_array(n, size, data);
+ else if(elem_size==4)
+ obj.uniform4_array(n, size, data);
else
throw logic_error("unsupported combination of array type and element size");
}
uniform_array_(n, FLOAT, 1);
}
+void ProgramData::Loader::uniform2i_array(const string &n)
+{
+ uniform_array_(n, INT, 2);
+}
+
void ProgramData::Loader::uniform2f_array(const string &n)
{
uniform_array_(n, FLOAT, 2);
}
+void ProgramData::Loader::uniform3i_array(const string &n)
+{
+ uniform_array_(n, INT, 3);
+}
+
void ProgramData::Loader::uniform3f_array(const string &n)
{
uniform_array_(n, FLOAT, 3);
}
+void ProgramData::Loader::uniform4i_array(const string &n)
+{
+ uniform_array_(n, INT, 4);
+}
+
void ProgramData::Loader::uniform4f_array(const string &n)
{
uniform_array_(n, FLOAT, 4);
uniform(FLOAT, 1, &v);
}
+void ProgramData::ArrayLoader::uniform2i(int v0, int v1)
+{
+ int va[2] = { v0, v1 };
+ uniform(INT, 2, va);
+}
+
void ProgramData::ArrayLoader::uniform2f(float v0, float v1)
{
float va[2] = { v0, v1 };
uniform(FLOAT, 2, va);
}
+void ProgramData::ArrayLoader::uniform3i(int v0, int v1, int v2)
+{
+ int va[3] = { v0, v1, v2 };
+ uniform(INT, 3, va);
+}
+
void ProgramData::ArrayLoader::uniform3f(float v0, float v1, float v2)
{
float va[3] = { v0, v1, v2 };
uniform(FLOAT, 3, va);
}
+void ProgramData::ArrayLoader::uniform4i(int v0, int v1, int v2, int v3)
+{
+ int va[4] = { v0, v1, v2, v3 };
+ uniform(INT, 4, va);
+}
+
void ProgramData::ArrayLoader::uniform4f(float v0, float v1, float v2, float v3)
{
float va[4] = { v0, v1, v2, v3 };
private:
void uniform1i(const std::string &, int);
void uniform1f(const std::string &, float);
+ void uniform2i(const std::string &, int, int);
void uniform2f(const std::string &, float, float);
+ void uniform3i(const std::string &, int, int, int);
void uniform3f(const std::string &, float, float, float);
+ void uniform4i(const std::string &, int, int, int, int);
void uniform4f(const std::string &, float, float, float, float);
void uniform_array_(const std::string &, DataType, unsigned);
void uniform1i_array(const std::string &);
void uniform1f_array(const std::string &);
+ void uniform2i_array(const std::string &);
void uniform2f_array(const std::string &);
+ void uniform3i_array(const std::string &);
void uniform3f_array(const std::string &);
+ void uniform4i_array(const std::string &);
void uniform4f_array(const std::string &);
void uniform_array(const std::string &);
};
void uniform(DataType, unsigned, const void *);
void uniform1i(int);
void uniform1f(float);
+ void uniform2i(int, int);
void uniform2f(float, float);
+ void uniform3i(int, int, int);
void uniform3f(float, float, float);
+ void uniform4i(int, int, int, int);
void uniform4f(float, float, float, float);
};
public:
void uniform(const std::string &, int);
void uniform(const std::string &, float);
+ void uniform(const std::string &, int, int);
void uniform(const std::string &, float, float);
+ void uniform2(const std::string &, const int *);
void uniform2(const std::string &, const float *);
+ void uniform(const std::string &, int, int, int);
void uniform(const std::string &, float, float, float);
void uniform(const std::string &, const Vector3 &);
+ void uniform3(const std::string &, const int *);
void uniform3(const std::string &, const float *);
+ void uniform(const std::string &, int, int, int, int);
void uniform(const std::string &, float, float, float, float);
void uniform(const std::string &, const Vector4 &);
void uniform(const std::string &, const Color &);
+ void uniform4(const std::string &, const int *);
void uniform4(const std::string &, const float *);
void uniform(const std::string &, const LinAl::Matrix<float, 2, 2> &);
void uniform_matrix2(const std::string &, const float *);
void uniform_matrix4(const std::string &, const float *);
void uniform1_array(const std::string &, unsigned, const int *);
void uniform1_array(const std::string &, unsigned, const float *);
+ void uniform2_array(const std::string &, unsigned, const int *);
void uniform2_array(const std::string &, unsigned, const float *);
+ void uniform3_array(const std::string &, unsigned, const int *);
void uniform3_array(const std::string &, unsigned, const float *);
+ void uniform4_array(const std::string &, unsigned, const int *);
void uniform4_array(const std::string &, unsigned, const float *);
void uniform_matrix4_array(const std::string &, unsigned, const float *);