From d147aa8f56e6a60d80f628ffeedf16bc99b588d3 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Thu, 13 Nov 2014 23:20:08 +0200 Subject: [PATCH] Add overloaded setters for 2x2 and 3x3 uniform matrices --- source/programdata.cpp | 10 ++++++++++ source/programdata.h | 4 +++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/source/programdata.cpp b/source/programdata.cpp index 535ade96..65e660f0 100644 --- a/source/programdata.cpp +++ b/source/programdata.cpp @@ -147,11 +147,21 @@ void ProgramData::uniform4(const string &name, const float *v) uniform(name, new Uniform4f(v)); } +void ProgramData::uniform(const string &name, const LinAl::Matrix &m) +{ + uniform_matrix2(name, &m(0, 0)); +} + void ProgramData::uniform_matrix2(const string &name, const float *v) { uniform(name, new UniformMatrix2x2f(v)); } +void ProgramData::uniform(const string &name, const LinAl::Matrix &m) +{ + uniform_matrix3(name, &m(0, 0)); +} + void ProgramData::uniform_matrix3(const string &name, const float *v) { uniform(name, new UniformMatrix3x3f(v)); diff --git a/source/programdata.h b/source/programdata.h index 0f752191..196abcb1 100644 --- a/source/programdata.h +++ b/source/programdata.h @@ -3,6 +3,7 @@ #include #include +#include "matrix.h" #include "program.h" #include "vector.h" @@ -10,7 +11,6 @@ namespace Msp { namespace GL { class Buffer; -class Matrix; class Uniform; class UniformBlock; struct Color; @@ -110,7 +110,9 @@ public: void uniform(const std::string &, const Vector4 &); void uniform(const std::string &, const Color &); void uniform4(const std::string &, const float *); + void uniform(const std::string &, const LinAl::Matrix &); void uniform_matrix2(const std::string &, const float *); + void uniform(const std::string &, const LinAl::Matrix &); void uniform_matrix3(const std::string &, const float *); void uniform(const std::string &, const Matrix &); void uniform_matrix4(const std::string &, const float *); -- 2.45.2