diff options
Diffstat (limited to 'tests/auto/extras/qcuboidgeometry/tst_qcuboidgeometry.cpp')
-rw-r--r-- | tests/auto/extras/qcuboidgeometry/tst_qcuboidgeometry.cpp | 180 |
1 files changed, 168 insertions, 12 deletions
diff --git a/tests/auto/extras/qcuboidgeometry/tst_qcuboidgeometry.cpp b/tests/auto/extras/qcuboidgeometry/tst_qcuboidgeometry.cpp index ddd9eed22..fa1657732 100644 --- a/tests/auto/extras/qcuboidgeometry/tst_qcuboidgeometry.cpp +++ b/tests/auto/extras/qcuboidgeometry/tst_qcuboidgeometry.cpp @@ -286,13 +286,13 @@ private Q_SLOTS: << QVector3D(1.0f, 0.0f, 0.0f) << QVector3D(1.0f, 0.0f, 0.0f)); const auto texCoords = (QVector<QVector2D>() - << QVector2D(0.0f, 0.0f) - << QVector2D(0.0f, 1.0f) - << QVector2D(1.0f, 0.0f)); + << QVector2D(1.0f, 0.0f) + << QVector2D(1.0f, 1.0f) + << QVector2D(0.0f, 0.0f)); const auto tangents = (QVector<QVector4D>() - << QVector4D(0.0f, 0.0f, 1.0f, -1.0f) - << QVector4D(0.0f, 0.0f, 1.0f, -1.0f) - << QVector4D(0.0f, 0.0f, 1.0f, -1.0f)); + << QVector4D(0.0f, 0.0f, -1.0f, 1.0f) + << QVector4D(0.0f, 0.0f, -1.0f, 1.0f) + << QVector4D(0.0f, 0.0f, -1.0f, 1.0f)); QTest::newRow("default_positiveX_firstTriangle") << 1.0f << 1.0f << 1.0f << QSize(2,2) << QSize(2,2) << QSize(2,2) @@ -312,13 +312,13 @@ private Q_SLOTS: << QVector3D(-1.0f, 0.0f, 0.0f) << QVector3D(-1.0f, 0.0f, 0.0f)); const auto texCoords = (QVector<QVector2D>() - << QVector2D(1.0f, 0.0f) - << QVector2D(0.0f, 1.0f) - << QVector2D(1.0f, 1.0f)); + << QVector2D(0.0f, 0.0f) + << QVector2D(1.0f, 1.0f) + << QVector2D(0.0f, 1.0f)); const auto tangents = (QVector<QVector4D>() - << QVector4D(0.0f, 0.0f, -1.0f, -1.0f) - << QVector4D(0.0f, 0.0f, -1.0f, -1.0f) - << QVector4D(0.0f, 0.0f, -1.0f, -1.0f)); + << QVector4D(0.0f, 0.0f, 1.0f, 1.0f) + << QVector4D(0.0f, 0.0f, 1.0f, 1.0f) + << QVector4D(0.0f, 0.0f, 1.0f, 1.0f)); QTest::newRow("default_negativeX_lastTriangle") << 1.0f << 1.0f << 1.0f << QSize(2,2) << QSize(2,2) << QSize(2,2) @@ -429,6 +429,162 @@ private Q_SLOTS: << triangleIndex << indices << positions << normals << texCoords << tangents; } + + { + const int triangleIndex = 0; + const auto indices = (QVector<quint16>() << 0 << 1 << 2); + const auto positions = (QVector<QVector3D>() + << QVector3D(1.0f, -1.5f, -2.5f) + << QVector3D(1.0f, 1.5f, -2.5f) + << QVector3D(1.0f, -1.5f, -1.25f)); + const auto normals = (QVector<QVector3D>() + << QVector3D(1.0f, 0.0f, 0.0f) + << QVector3D(1.0f, 0.0f, 0.0f) + << QVector3D(1.0f, 0.0f, 0.0f)); + const auto texCoords = (QVector<QVector2D>() + << QVector2D(1.0f, 0.0f) + << QVector2D(1.0f, 1.0f) + << QVector2D(0.75f, 0.0f)); + const auto tangents = (QVector<QVector4D>() + << QVector4D(0.0f, 0.0f, -1.0f, 1.0f) + << QVector4D(0.0f, 0.0f, -1.0f, 1.0f) + << QVector4D(0.0f, 0.0f, -1.0f, 1.0f)); + QTest::newRow("default_positiveX_firstTriangle_nonSymmetric") + << 2.0f << 3.0f << 5.0f + << QSize(2,3) << QSize(2,5) << QSize(2,9) + << triangleIndex + << indices << positions << normals << texCoords << tangents; + } + + { + const int triangleIndex = 15; + const auto indices = (QVector<quint16>() << 18 << 17 << 19); + const auto positions = (QVector<QVector3D>() + << QVector3D(-1.0f, -1.5f, -2.5f) + << QVector3D(-1.0f, 1.5f, -1.25f) + << QVector3D(-1.0f, 1.5f, -2.5f)); + const auto normals = (QVector<QVector3D>() + << QVector3D(-1.0f, 0.0f, 0.0f) + << QVector3D(-1.0f, 0.0f, 0.0f) + << QVector3D(-1.0f, 0.0f, 0.0f)); + const auto texCoords = (QVector<QVector2D>() + << QVector2D(0.0f, 0.0f) + << QVector2D(0.25f, 1.0f) + << QVector2D(0.0f, 1.0f)); + const auto tangents = (QVector<QVector4D>() + << QVector4D(0.0f, 0.0f, 1.0f, 1.0f) + << QVector4D(0.0f, 0.0f, 1.0f, 1.0f) + << QVector4D(0.0f, 0.0f, 1.0f, 1.0f)); + QTest::newRow("default_negativeX_lastTriangle_nonSymmetric") + << 2.0f << 3.0f << 5.0f + << QSize(2,3) << QSize(2,5) << QSize(2,9) + << triangleIndex + << indices << positions << normals << texCoords << tangents; + } + + { + const int triangleIndex = 16; + const auto indices = (QVector<quint16>() << 20 << 21 << 22); + const auto positions = (QVector<QVector3D>() + << QVector3D(-1.0f, 1.5f, 2.5f) + << QVector3D(1.0f, 1.5f, 2.5f) + << QVector3D(-1.0f, 1.5f, 1.875f)); + const auto normals = (QVector<QVector3D>() + << QVector3D(0.0f, 1.0f, 0.0f) + << QVector3D(0.0f, 1.0f, 0.0f) + << QVector3D(0.0f, 1.0f, 0.0f)); + const auto texCoords = (QVector<QVector2D>() + << QVector2D(0.0f, 0.0f) + << QVector2D(1.0f, 0.0f) + << QVector2D(0.0f, 0.125f)); + const auto tangents = (QVector<QVector4D>() + << QVector4D(1.0f, 0.0f, 0.0f, 1.0f) + << QVector4D(1.0f, 0.0f, 0.0f, 1.0f) + << QVector4D(1.0f, 0.0f, 0.0f, 1.0f)); + QTest::newRow("default_positiveY_firstTriangle_nonSymmetric") + << 2.0f << 3.0f << 5.0f + << QSize(2,3) << QSize(2,5) << QSize(2,9) + << triangleIndex + << indices << positions << normals << texCoords << tangents; + } + + { + const int triangleIndex = 47; + const auto indices = (QVector<quint16>() << 54 << 53 << 55); + const auto positions = (QVector<QVector3D>() + << QVector3D(-1.0f, -1.5f, 2.5f) + << QVector3D(1.0f, -1.5f, 1.875f) + << QVector3D(1.0f, -1.5f, 2.5f)); + const auto normals = (QVector<QVector3D>() + << QVector3D(0.0f, -1.0f, 0.0f) + << QVector3D(0.0f, -1.0f, 0.0f) + << QVector3D(0.0f, -1.0f, 0.0f)); + const auto texCoords = (QVector<QVector2D>() + << QVector2D(0.0f, 1.0f) + << QVector2D(1.0f, 0.875f) + << QVector2D(1.0f, 1.0f)); + const auto tangents = (QVector<QVector4D>() + << QVector4D(1.0f, 0.0f, 0.0f, 1.0f) + << QVector4D(1.0f, 0.0f, 0.0f, 1.0f) + << QVector4D(1.0f, 0.0f, 0.0f, 1.0f)); + QTest::newRow("default_negativeY_lastTriangle_nonSymmetric") + << 2.0f << 3.0f << 5.0f + << QSize(2,3) << QSize(2,5) << QSize(2,9) + << triangleIndex + << indices << positions << normals << texCoords << tangents; + } + + { + const int triangleIndex = 48; + const auto indices = (QVector<quint16>() << 56 << 57 << 58); + const auto positions = (QVector<QVector3D>() + << QVector3D(-1.0f, -1.5f, 2.5f) + << QVector3D(1.0f, -1.5f, 2.5f) + << QVector3D(-1.0f, 0.0f, 2.5f)); + const auto normals = (QVector<QVector3D>() + << QVector3D(0.0f, 0.0f, 1.0f) + << QVector3D(0.0f, 0.0f, 1.0f) + << QVector3D(0.0f, 0.0f, 1.0f)); + const auto texCoords = (QVector<QVector2D>() + << QVector2D(0.0f, 0.0f) + << QVector2D(1.0f, 0.0f) + << QVector2D(0.0f, 0.5f)); + const auto tangents = (QVector<QVector4D>() + << QVector4D(1.0f, 0.0f, 0.0f, 1.0f) + << QVector4D(1.0f, 0.0f, 0.0f, 1.0f) + << QVector4D(1.0f, 0.0f, 0.0f, 1.0f)); + QTest::newRow("default_positiveZ_firstTriangle_nonSymmetric") + << 2.0f << 3.0f << 5.0f + << QSize(2,3) << QSize(2,5) << QSize(2,9) + << triangleIndex + << indices << positions << normals << texCoords << tangents; + } + + { + const int triangleIndex = 55; + const auto indices = (QVector<quint16>() << 66 << 65 << 67); + const auto positions = (QVector<QVector3D>() + << QVector3D(1.0f, 1.5f, -2.5f) + << QVector3D(-1.0f, 0.0f, -2.5f) + << QVector3D(-1.0f, 1.5f, -2.5f)); + const auto normals = (QVector<QVector3D>() + << QVector3D(0.0f, 0.0f, -1.0f) + << QVector3D(0.0f, 0.0f, -1.0f) + << QVector3D(0.0f, 0.0f, -1.0f)); + const auto texCoords = (QVector<QVector2D>() + << QVector2D(0.0f, 1.0f) + << QVector2D(1.0f, 0.5f) + << QVector2D(1.0f, 1.0f)); + const auto tangents = (QVector<QVector4D>() + << QVector4D(-1.0f, 0.0f, 0.0f, 1.0f) + << QVector4D(-1.0f, 0.0f, 0.0f, 1.0f) + << QVector4D(-1.0f, 0.0f, 0.0f, 1.0f)); + QTest::newRow("default_negativeZ_lastTriangle_nonSymmetric") + << 2.0f << 3.0f << 5.0f + << QSize(2,3) << QSize(2,5) << QSize(2,9) + << triangleIndex + << indices << positions << normals << texCoords << tangents; + } } void generatedGeometryShouldBeConsistent() |