From: Mikko Rasa Date: Sun, 9 Feb 2020 20:51:04 +0000 (+0200) Subject: Add the specializations for non-square matrix uniforms X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=6dc3e14d26c747dfcece883771f457e5561c5d09;p=libs%2Fgl.git Add the specializations for non-square matrix uniforms These were forgotten from d971f8d. --- diff --git a/source/uniform.cpp b/source/uniform.cpp index b183719f..c18fc360 100644 --- a/source/uniform.cpp +++ b/source/uniform.cpp @@ -1,4 +1,5 @@ #include +#include #include "uniform.h" namespace Msp { @@ -60,12 +61,48 @@ void UniformMatrix::apply(int index, unsigned size, const float *va glUniformMatrix2fv(index, size, false, value); } +template<> +void UniformMatrix::apply(int index, unsigned size, const float *value) +{ + glUniformMatrix3x2fv(index, size, false, value); +} + +template<> +void UniformMatrix::apply(int index, unsigned size, const float *value) +{ + glUniformMatrix4x2fv(index, size, false, value); +} + +template<> +void UniformMatrix::apply(int index, unsigned size, const float *value) +{ + glUniformMatrix2x3fv(index, size, false, value); +} + template<> void UniformMatrix::apply(int index, unsigned size, const float *value) { glUniformMatrix3fv(index, size, false, value); } +template<> +void UniformMatrix::apply(int index, unsigned size, const float *value) +{ + glUniformMatrix4x3fv(index, size, false, value); +} + +template<> +void UniformMatrix::apply(int index, unsigned size, const float *value) +{ + glUniformMatrix2x4fv(index, size, false, value); +} + +template<> +void UniformMatrix::apply(int index, unsigned size, const float *value) +{ + glUniformMatrix3x4fv(index, size, false, value); +} + template<> void UniformMatrix::apply(int index, unsigned size, const float *value) { diff --git a/source/uniform.h b/source/uniform.h index 8dc43ab5..ad2d88cc 100644 --- a/source/uniform.h +++ b/source/uniform.h @@ -124,8 +124,15 @@ public: { return new UniformMatrix(value); } }; +// The naming of these types follows the OpenGL convention of columns x rows typedef UniformMatrix UniformMatrix2x2f; +typedef UniformMatrix UniformMatrix3x2f; +typedef UniformMatrix UniformMatrix4x2f; +typedef UniformMatrix UniformMatrix2x3f; typedef UniformMatrix UniformMatrix3x3f; +typedef UniformMatrix UniformMatrix4x3f; +typedef UniformMatrix UniformMatrix2x4f; +typedef UniformMatrix UniformMatrix3x4f; typedef UniformMatrix UniformMatrix4x4f;