diff options
author | Mike Krus <mike.krus@kdab.com> | 2020-01-22 21:35:32 +0000 |
---|---|---|
committer | Mike Krus <mike.krus@kdab.com> | 2020-02-27 06:29:57 +0000 |
commit | 17706144e9dc6c2dfde580b7821f18c5f6924682 (patch) | |
tree | 5f77929db358607fe63a1d438b7a746a6966cbfb /tests/auto/extras | |
parent | 7f625e93620b313466d0223e911c0c3a5b492617 (diff) |
Geometry refactoring
Move QBuffer, QAttribute, QGeometry to Qt3DCore.
Change-Id: I59dfd091eefadcada93350b3aba955f40b304385
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Diffstat (limited to 'tests/auto/extras')
-rw-r--r-- | tests/auto/extras/common/geometrytesthelper.h | 14 | ||||
-rw-r--r-- | tests/auto/extras/qcuboidgeometry/tst_qcuboidgeometry.cpp | 28 | ||||
-rw-r--r-- | tests/auto/extras/qtorusgeometry/tst_qtorusgeometry.cpp | 28 |
3 files changed, 35 insertions, 35 deletions
diff --git a/tests/auto/extras/common/geometrytesthelper.h b/tests/auto/extras/common/geometrytesthelper.h index b825fa407..a80d652a8 100644 --- a/tests/auto/extras/common/geometrytesthelper.h +++ b/tests/auto/extras/common/geometrytesthelper.h @@ -29,12 +29,12 @@ #ifndef GEOMETRYTESTHELPER_H #define GEOMETRYTESTHELPER_H -#include <Qt3DRender/qattribute.h> -#include <Qt3DRender/qbuffer.h> -#include <Qt3DRender/qgeometry.h> +#include <Qt3DCore/qattribute.h> +#include <Qt3DCore/qbuffer.h> +#include <Qt3DCore/qgeometry.h> template<typename IndexType> -IndexType extractIndexData(Qt3DRender::QAttribute *attribute, int index) +IndexType extractIndexData(Qt3DCore::QAttribute *attribute, int index) { // Get the raw data const IndexType *typedData = reinterpret_cast<const IndexType *>(attribute->buffer()->data().constData()); @@ -45,7 +45,7 @@ IndexType extractIndexData(Qt3DRender::QAttribute *attribute, int index) } template<typename VertexType, typename IndexType> -VertexType extractVertexData(Qt3DRender::QAttribute *attribute, IndexType index) +VertexType extractVertexData(Qt3DCore::QAttribute *attribute, IndexType index) { // Get the raw data const char *rawData = attribute->buffer()->data().constData(); @@ -55,10 +55,10 @@ VertexType extractVertexData(Qt3DRender::QAttribute *attribute, IndexType index) // Construct vertex from the typed data VertexType vertex; - const Qt3DRender::QAttribute::VertexBaseType type = attribute->vertexBaseType(); + const Qt3DCore::QAttribute::VertexBaseType type = attribute->vertexBaseType(); switch (type) { - case Qt3DRender::QAttribute::Float: { + case Qt3DCore::QAttribute::Float: { const float *typedVertexData = reinterpret_cast<const float *>(vertexData); const int components = attribute->vertexSize(); for (int i = 0; i < components; ++i) diff --git a/tests/auto/extras/qcuboidgeometry/tst_qcuboidgeometry.cpp b/tests/auto/extras/qcuboidgeometry/tst_qcuboidgeometry.cpp index f20b1e870..2bfa89601 100644 --- a/tests/auto/extras/qcuboidgeometry/tst_qcuboidgeometry.cpp +++ b/tests/auto/extras/qcuboidgeometry/tst_qcuboidgeometry.cpp @@ -29,9 +29,9 @@ #include <QtTest/QTest> #include <QObject> #include <Qt3DExtras/qcuboidgeometry.h> -#include <Qt3DRender/qattribute.h> -#include <Qt3DRender/qbuffer.h> -#include <qopenglcontext.h> +#include <Qt3DCore/qattribute.h> +#include <Qt3DCore/qbuffer.h> +#include <QtGui/qopenglcontext.h> #include <QtGui/qvector2d.h> #include <QtGui/qvector3d.h> #include <QtGui/qvector4d.h> @@ -58,13 +58,13 @@ private Q_SLOTS: QCOMPARE(geometry.yzMeshResolution(), QSize(2, 2)); QCOMPARE(geometry.xzMeshResolution(), QSize(2, 2)); QVERIFY(geometry.positionAttribute() != nullptr); - QCOMPARE(geometry.positionAttribute()->name(), Qt3DRender::QAttribute::defaultPositionAttributeName()); + QCOMPARE(geometry.positionAttribute()->name(), Qt3DCore::QAttribute::defaultPositionAttributeName()); QVERIFY(geometry.normalAttribute() != nullptr); - QCOMPARE(geometry.normalAttribute()->name(), Qt3DRender::QAttribute::defaultNormalAttributeName()); + QCOMPARE(geometry.normalAttribute()->name(), Qt3DCore::QAttribute::defaultNormalAttributeName()); QVERIFY(geometry.texCoordAttribute() != nullptr); - QCOMPARE(geometry.texCoordAttribute()->name(), Qt3DRender::QAttribute::defaultTextureCoordinateAttributeName()); + QCOMPARE(geometry.texCoordAttribute()->name(), Qt3DCore::QAttribute::defaultTextureCoordinateAttributeName()); QVERIFY(geometry.tangentAttribute() != nullptr); - QCOMPARE(geometry.tangentAttribute()->name(), Qt3DRender::QAttribute::defaultTangentAttributeName()); + QCOMPARE(geometry.tangentAttribute()->name(), Qt3DCore::QAttribute::defaultTangentAttributeName()); QVERIFY(geometry.indexAttribute() != nullptr); } @@ -520,12 +520,12 @@ private Q_SLOTS: { // GIVEN Qt3DExtras::QCuboidGeometry geometry; - const QVector<Qt3DRender::QAttribute *> attributes = geometry.attributes(); - Qt3DRender::QAttribute *positionAttribute = geometry.positionAttribute(); - Qt3DRender::QAttribute *normalAttribute = geometry.normalAttribute(); - Qt3DRender::QAttribute *texCoordAttribute = geometry.texCoordAttribute(); - Qt3DRender::QAttribute *tangentAttribute = geometry.tangentAttribute(); - Qt3DRender::QAttribute *indexAttribute = geometry.indexAttribute(); + const QVector<Qt3DCore::QAttribute *> attributes = geometry.attributes(); + Qt3DCore::QAttribute *positionAttribute = geometry.positionAttribute(); + Qt3DCore::QAttribute *normalAttribute = geometry.normalAttribute(); + Qt3DCore::QAttribute *texCoordAttribute = geometry.texCoordAttribute(); + Qt3DCore::QAttribute *tangentAttribute = geometry.tangentAttribute(); + Qt3DCore::QAttribute *indexAttribute = geometry.indexAttribute(); // WHEN QFETCH(float, xExtent); @@ -545,7 +545,7 @@ private Q_SLOTS: // Check buffer of each attribute is valid and actually has some data for (const auto &attribute : attributes) { - Qt3DRender::QBuffer *buffer = attribute->buffer(); + Qt3DCore::QBuffer *buffer = attribute->buffer(); QVERIFY(buffer != nullptr); QVERIFY(buffer->data().size() != 0); } diff --git a/tests/auto/extras/qtorusgeometry/tst_qtorusgeometry.cpp b/tests/auto/extras/qtorusgeometry/tst_qtorusgeometry.cpp index 7a6965f20..08afd09e3 100644 --- a/tests/auto/extras/qtorusgeometry/tst_qtorusgeometry.cpp +++ b/tests/auto/extras/qtorusgeometry/tst_qtorusgeometry.cpp @@ -29,9 +29,9 @@ #include <QtTest/QTest> #include <QObject> #include <Qt3DExtras/qtorusgeometry.h> -#include <Qt3DRender/qattribute.h> -#include <Qt3DRender/qbuffer.h> -#include <qopenglcontext.h> +#include <Qt3DCore/qattribute.h> +#include <Qt3DCore/qbuffer.h> +#include <QtGui/qopenglcontext.h> #include <QtGui/qvector2d.h> #include <QtGui/qvector3d.h> #include <QtGui/qvector4d.h> @@ -57,14 +57,14 @@ private Q_SLOTS: QCOMPARE(geometry.radius(), 1.0f); QCOMPARE(geometry.minorRadius(), 1.0f); QVERIFY(geometry.positionAttribute() != nullptr); - QCOMPARE(geometry.positionAttribute()->name(), Qt3DRender::QAttribute::defaultPositionAttributeName()); + QCOMPARE(geometry.positionAttribute()->name(), Qt3DCore::QAttribute::defaultPositionAttributeName()); QVERIFY(geometry.normalAttribute() != nullptr); - QCOMPARE(geometry.normalAttribute()->name(), Qt3DRender::QAttribute::defaultNormalAttributeName()); + QCOMPARE(geometry.normalAttribute()->name(), Qt3DCore::QAttribute::defaultNormalAttributeName()); QVERIFY(geometry.texCoordAttribute() != nullptr); - QCOMPARE(geometry.texCoordAttribute()->name(), Qt3DRender::QAttribute::defaultTextureCoordinateAttributeName()); + QCOMPARE(geometry.texCoordAttribute()->name(), Qt3DCore::QAttribute::defaultTextureCoordinateAttributeName()); // TODO: Expose tangent attribute in Qt 5.8 and see below // QVERIFY(geometry.tangentAttribute() != nullptr); -// QCOMPARE(geometry.tangentAttribute()->name(), Qt3DRender::QAttribute::defaultTangentAttributeName()); +// QCOMPARE(geometry.tangentAttribute()->name(), Qt3DCore::QAttribute::defaultTangentAttributeName()); QVERIFY(geometry.indexAttribute() != nullptr); } @@ -299,12 +299,12 @@ private Q_SLOTS: { // GIVEN Qt3DExtras::QTorusGeometry geometry; - const QVector<Qt3DRender::QAttribute *> attributes = geometry.attributes(); - Qt3DRender::QAttribute *positionAttribute = geometry.positionAttribute(); - Qt3DRender::QAttribute *normalAttribute = geometry.normalAttribute(); - Qt3DRender::QAttribute *texCoordAttribute = geometry.texCoordAttribute(); -// Qt3DRender::QAttribute *tangentAttribute = geometry.tangentAttribute(); - Qt3DRender::QAttribute *indexAttribute = geometry.indexAttribute(); + const QVector<Qt3DCore::QAttribute *> attributes = geometry.attributes(); + Qt3DCore::QAttribute *positionAttribute = geometry.positionAttribute(); + Qt3DCore::QAttribute *normalAttribute = geometry.normalAttribute(); + Qt3DCore::QAttribute *texCoordAttribute = geometry.texCoordAttribute(); +// Qt3DCore::QAttribute *tangentAttribute = geometry.tangentAttribute(); + Qt3DCore::QAttribute *indexAttribute = geometry.indexAttribute(); // WHEN QFETCH(int, rings); @@ -320,7 +320,7 @@ private Q_SLOTS: // Check buffer of each attribute is valid and actually has some data for (const auto &attribute : attributes) { - Qt3DRender::QBuffer *buffer = attribute->buffer(); + Qt3DCore::QBuffer *buffer = attribute->buffer(); QVERIFY(buffer != nullptr); QVERIFY(buffer->data().size() != 0); } |