O'Reilly logo

Qt 5 Projects by Marco Piccolino

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Varying the properties of the mesh

From the tool's screenshot at the beginning of the chapter, you can see how we want to allow our users to choose from three different shape variations: a cube, a vertical cuboid, and a horizontal cuboid. Thus, we will want to expose a property of our element to control this parameter, and check out the documentation of CuboidMesh (https://doc.qt.io/qt-5.9/qml-qt3d-extras-cuboidmesh.html) to see which properties govern the meshes size. As it turns out, these are xExtent, yExtent, and zExtent.

All of these have a default value of 1. Thus, we will set to 2 either the x (horizontal cuboid) or the y extent (vertical cuboid), depending on the value of the element's shape property:

// Element.qmlimport Qt3D.Core ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required