summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorSean Harmer <sean.harmer@kdab.com>2017-08-04 11:03:21 +0100
committerSean Harmer <sean.harmer@kdab.com>2017-08-09 20:18:15 +0000
commit413821f349bd6c706977144bd506b49d383dea4d (patch)
treeb1ca4d84323934b700469f978e275ea29144e28d /tests
parentb44682a625ae23410b8269cb74b22b8871f3d5d4 (diff)
Extend UniformValue to handle vectors of QMatrix4x4
We copy the actual matrix data into the UniformValue such that it is contiguous (unlike a vector of QMatrix4x4) and suitable for setting to a uniform mat4 array in GLSL. May need adjusting once the SIMD classes land. Change-Id: Ib4f3f55f3e34b571ee7d6542bec6805603841b42 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/render/uniform/tst_uniform.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/auto/render/uniform/tst_uniform.cpp b/tests/auto/render/uniform/tst_uniform.cpp
index 47e64eafe..29a8b2e4c 100644
--- a/tests/auto/render/uniform/tst_uniform.cpp
+++ b/tests/auto/render/uniform/tst_uniform.cpp
@@ -123,6 +123,26 @@ private Q_SLOTS:
QCOMPARE(v.constData<float>()[2], 1340.0f);
QCOMPARE(v.constData<float>()[3], 1603.0f);
}
+ {
+ // GIVEN
+ const QMatrix4x4 m1;
+ QMatrix4x4 m2;
+ m2.rotate(90.0f, 1.0f, 0.0f, 0.0f);
+ QMatrix4x4 m3;
+ m3.scale(2.5f);
+ QMatrix4x4 m4;
+ m4.translate(1.0f, 2.0f, 3.0f);
+
+ const QVector<QMatrix4x4> matrices = (QVector<QMatrix4x4>() << m1 << m2 << m3 << m4);
+ UniformValue v(matrices);
+
+ // THEN
+ for (int j = 0; j < matrices.size(); ++j) {
+ for (int i = 0; i < 16; ++i) {
+ QCOMPARE(v.constData<float>()[16 * j + i], matrices[j].constData()[i]);
+ }
+ }
+ }
}
void checkFromVariant()