diff options
author | Sean Harmer <sean.harmer@kdab.com> | 2017-09-10 11:49:46 +0100 |
---|---|---|
committer | Sean Harmer <sean.harmer@kdab.com> | 2017-10-03 10:38:01 +0000 |
commit | 4f2ff902545842bc715a936ff0c70b3ca3ce0cc9 (patch) | |
tree | ad82c71994c746c7ae5e7a79f894c8b00db0b586 /tests/manual/bigscene-cpp/main.cpp | |
parent | 733afa3b259f78b81145ed2d1a8b8cc54184c4aa (diff) |
Share the mesh in bigscene-cpp
No point loading the same data 1k times. Shaves 35% off the time from
application start to first frame being complete.
Change-Id: I8cd7c8a5aa377c0663c03e35d7a4c03f50b052f6
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Diffstat (limited to 'tests/manual/bigscene-cpp/main.cpp')
-rw-r--r-- | tests/manual/bigscene-cpp/main.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/manual/bigscene-cpp/main.cpp b/tests/manual/bigscene-cpp/main.cpp index 791aeb19d..cf893e051 100644 --- a/tests/manual/bigscene-cpp/main.cpp +++ b/tests/manual/bigscene-cpp/main.cpp @@ -81,6 +81,13 @@ int main(int ac, char **av) QEntity *root = new QEntity(); + // Mesh + auto *mesh = new Qt3DExtras::QCylinderMesh(root); + mesh->setRings(50.0f); + mesh->setSlices(30.0f); + mesh->setRadius(2.5f); + mesh->setLength(5.0f); + // Camera QCamera *cameraEntity = view.camera(); cameraEntity->lens()->setPerspectiveProjection(45.0f, 16.0f/9.0f, 0.1f, 1000.0f); @@ -99,6 +106,7 @@ int main(int ac, char **av) // Scene for (int i = 0; i < max; i++) { Entity *e = new Entity(); + e->addComponent(mesh); const float angle = M_PI * 2.0f * i * det * 10.; e->setDiffuseColor(QColor(qFabs(qCos(angle)) * 255, 204, 75)); |