| |   |
| 49 | 49 | #include "qglabstracteffect.h" |
| 50 | 50 | #include "qgloperation.h" |
| 51 | 51 | #include "qtest_helpers_p.h" |
| #include "qgeometrydata.h" |
| 52 | 53 | |
| 53 | 54 | class tst_QGLDisplayList : public QObject |
| 54 | 55 | { |
| … | … | |
| 871 | 871 | |
| 872 | 872 | QCOMPARE(displayList.sections().count(), 0); |
| 873 | 873 | |
| #if 0 // TODO: needs to check the vertex buffer instead |
| 875 | 874 | QGeometryData *geom = node->geometry(); |
|
| QGLVertexArray verts = geom->toVertexArray(); |
| 878 | 875 | QGLIndexArray ids = geom->indices(); |
| 879 | 876 | |
| QCOMPARE(verts.vertexCount(), 13); |
| QCOMPARE(geom->count(QGL::Position), 13); |
| 881 | 878 | QCOMPARE(ids.size(), 36); |
| 882 | 879 | |
| 883 | 880 | // triangulated face |
| 884 | 881 | int tf = ids[node->start()]; // beginning of triangulated face |
| 885 | 882 | QCOMPARE(node->count(), 12); |
| QCOMPARE(verts.vector3DAt(tf, QGL::Position), center); |
| QCOMPARE(verts.vector3DAt(tf + 2, QGL::Position), b); |
| QCOMPARE(verts.vector3DAt(tf, QGL::Normal), n0); |
| QCOMPARE(verts.vector3DAt(tf + 2, QGL::Normal), n0); |
| QCOMPARE(geom->vertex(tf), center); |
| QCOMPARE(geom->vertex(tf + 2), b); |
| QCOMPARE(geom->normal(tf), n0); |
| QCOMPARE(geom->normal(tf + 2), n0); |
| 890 | 887 | |
| 891 | 888 | int ext = ids[node2->start()]; // beginning of extrude |
| 892 | 889 | int last = ids[node2->start() + (node2->count() - 1)]; |
| 893 | 890 | QCOMPARE(node2->count(), 24); |
| QCOMPARE(verts.vector3DAt(ext, QGL::Position), a - n); |
| QCOMPARE(verts.vector3DAt(ext, QGL::Normal), n1); |
| QCOMPARE(verts.vector3DAt(last, QGL::Position), d); |
| QCOMPARE(verts.vector3DAt(last, QGL::Normal), n4); |
| QCOMPARE(geom->vertex(ext), a - n); |
| QCOMPARE(geom->normal(ext), n1); |
| QCOMPARE(geom->vertex(last), d); |
| QCOMPARE(geom->normal(last), n4); |
| 898 | 895 | |
| 899 | 896 | #ifndef QT_NO_MEMBER_TEMPLATES |
| 900 | 897 | QList<QGLSceneNode*> nodes = displayList.findChildren<QGLSceneNode*>(); |
| … | … | |
| 910 | 910 | QVERIFY(node3->geometry() != geom); |
| 911 | 911 | |
| 912 | 912 | geom = node3->geometry(); |
| QGLVertexArray verts2 = geom->toVertexArray(); |
| 914 | 913 | QGLIndexArray ids2 = geom->indices(); |
| 915 | 914 | |
| 916 | 915 | int tri = ids2[node->start()]; |
| QGLVertexDescription desc = verts2.fields(); |
| QCOMPARE(verts2.vector3DAt(tri, desc.indexOf(QGL::Position)), e); |
| QCOMPARE(verts2.vector3DAt(tri, desc.indexOf(QGL::Normal)), n10); |
| QCOMPARE(verts2.vector2DAt(tri, desc.indexOf(QGL::TextureCoord0)), ta); |
| #endif |
| QCOMPARE(geom->vertex(tri), e); |
| QCOMPARE(geom->normal(tri), n10); |
| QCOMPARE(geom->texCoord(tri), ta); |
| 922 | 919 | } |
| 923 | 920 | |
| 924 | 921 | QTEST_APPLESS_MAIN(tst_QGLDisplayList) |