From 174cd487b4644a69853de9007b90cba989afe344 Mon Sep 17 00:00:00 2001 From: Mike Krus Date: Thu, 30 Jul 2020 12:03:46 +0100 Subject: Make sample meshes geometry renderers again Introduce new geometry view class for each. Change-Id: I8e9a8f3a078d4cc63f9656ae8142e39f05d755c7 Reviewed-by: Paul Lemire --- examples/qt3d/basicshapes-cpp/scenemodifier.cpp | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) (limited to 'examples/qt3d/basicshapes-cpp') 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); } -- cgit v1.2.3