Scale3DThe Scale3D item supports scaling of items in 3D. More... Inherits QtObject Scale3D instantiates the C++ class QGraphicsScale3D This type was introduced in Qt 4.8. Detailed Description3D items in QML can have a simple scale applied directly as follows: Item3D {
mesh: Mesh { source: "chair.3ds" }
scale: 0.5
}
An alternative is to use Scale3D to apply a transform directly to an item as part of a sequence of transformations: Item3D {
mesh: Mesh { source: "chair.3ds" }
transform: [
Translation3D { translate: Qt.vector3d(5, 0, 0) },
Scale3D { scale: 0.5 }
]
}
This allows the application writer to control exactly when the scale occurs relative to other transformations. In the example above, the item is first translated by 5 units along the x-axis, and then the co-ordinates are scaled by half. This is distinct from the following example which scales the object to half its original size and then translates it by 5 units along the x-axis: Item3D {
mesh: Mesh { source: "chair.3ds" }
transform: [
Scale3D { scale: 0.5 },
Translation3D { translate: Qt.vector3d(5, 0, 0) }
]
}
The scale property on the item itself is applied before any of the transforms. So the previous example is equivalent to: Item3D {
mesh: Mesh { source: "chair.3ds" }
scale: 0.5
transform: [
Translation3D { translate: Qt.vector3d(5, 0, 0) }
]
}
Scale values can also affect the x, y, and z axes by different amounts by using a vector3D value: Item3D {
mesh: Mesh { source: "chair.3ds" }
transform: [
Scale3D { scale: Qt.vector3d(0.5, 0.2, 1.0) },
Translation3D { translate: Qt.vector3d(5, 0, 0) }
]
}
See also Rotation3D and Translation3D. |