diff options
author | Mike Krus <mike.krus@kdab.com> | 2020-07-30 12:03:46 +0100 |
---|---|---|
committer | Mike Krus <mike.krus@kdab.com> | 2020-07-30 13:51:37 +0100 |
commit | 174cd487b4644a69853de9007b90cba989afe344 (patch) | |
tree | 03e331f2b0a51ec2c6518d352c4b7a759edebbed /examples/qt3d/basicshapes-cpp | |
parent | eb728b5501f0ffb61ca4916ff5975c496ab98970 (diff) |
Make sample meshes geometry renderers again
Introduce new geometry view class for each.
Change-Id: I8e9a8f3a078d4cc63f9656ae8142e39f05d755c7
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Diffstat (limited to 'examples/qt3d/basicshapes-cpp')
-rw-r--r-- | examples/qt3d/basicshapes-cpp/scenemodifier.cpp | 25 |
1 files changed, 6 insertions, 19 deletions
diff --git a/examples/qt3d/basicshapes-cpp/scenemodifier.cpp b/examples/qt3d/basicshapes-cpp/scenemodifier.cpp index fa268afa6..4946f1a48 100644 --- a/examples/qt3d/basicshapes-cpp/scenemodifier.cpp +++ b/examples/qt3d/basicshapes-cpp/scenemodifier.cpp @@ -82,9 +82,7 @@ SceneModifier::SceneModifier(Qt3DCore::QEntity *rootEntity) // Torus //! [3] m_torusEntity = new Qt3DCore::QEntity(m_rootEntity); - auto renderer = new Qt3DRender::QGeometryRenderer; - renderer->setView(m_torus); - m_torusEntity->addComponent(renderer); + m_torusEntity->addComponent(m_torus); m_torusEntity->addComponent(torusMaterial); m_torusEntity->addComponent(torusTransform); //! [3] @@ -110,9 +108,7 @@ SceneModifier::SceneModifier(Qt3DCore::QEntity *rootEntity) // Cone { m_coneEntity = new Qt3DCore::QEntity(m_rootEntity); - auto renderer = new Qt3DRender::QGeometryRenderer; - renderer->setView(cone); - m_coneEntity->addComponent(renderer); + m_coneEntity->addComponent(cone); m_coneEntity->addComponent(coneMaterial); m_coneEntity->addComponent(coneTransform); } @@ -136,9 +132,7 @@ SceneModifier::SceneModifier(Qt3DCore::QEntity *rootEntity) // Cylinder { m_cylinderEntity = new Qt3DCore::QEntity(m_rootEntity); - auto renderer = new Qt3DRender::QGeometryRenderer; - renderer->setView(cylinder); - m_cylinderEntity->addComponent(renderer); + m_cylinderEntity->addComponent(cylinder); m_cylinderEntity->addComponent(cylinderMaterial); m_cylinderEntity->addComponent(cylinderTransform); } @@ -157,9 +151,7 @@ SceneModifier::SceneModifier(Qt3DCore::QEntity *rootEntity) //Cuboid { m_cuboidEntity = new Qt3DCore::QEntity(m_rootEntity); - auto renderer = new Qt3DRender::QGeometryRenderer; - renderer->setView(cuboid); - m_cuboidEntity->addComponent(renderer); + m_cuboidEntity->addComponent(cuboid); m_cuboidEntity->addComponent(cuboidMaterial); m_cuboidEntity->addComponent(cuboidTransform); } @@ -181,9 +173,7 @@ SceneModifier::SceneModifier(Qt3DCore::QEntity *rootEntity) // Plane { m_planeEntity = new Qt3DCore::QEntity(m_rootEntity); - auto renderer = new Qt3DRender::QGeometryRenderer; - renderer->setView(planeMesh); - m_planeEntity->addComponent(renderer); + m_planeEntity->addComponent(planeMesh); m_planeEntity->addComponent(planeMaterial); m_planeEntity->addComponent(planeTransform); } @@ -203,12 +193,9 @@ SceneModifier::SceneModifier(Qt3DCore::QEntity *rootEntity) Qt3DExtras::QPhongMaterial *sphereMaterial = new Qt3DExtras::QPhongMaterial(); sphereMaterial->setDiffuse(QColor(QRgb(0xa69929))); - auto renderer = new Qt3DRender::QGeometryRenderer; - renderer->setView(sphereMesh); - // Sphere m_sphereEntity = new Qt3DCore::QEntity(m_rootEntity); - m_sphereEntity->addComponent(renderer); + m_sphereEntity->addComponent(sphereMesh); m_sphereEntity->addComponent(sphereMaterial); m_sphereEntity->addComponent(sphereTransform); } |