MeshThe Mesh item provides a means of abstracting 3D mesh and geometry representations in a way that can be used in QML. The Mesh class contains necessary properties and methods for display and manipulation of 3d objects of this type. More... Inherits QtObject Inherited by CapsuleMesh and CylinderMesh. This type was introduced in Qt 4.8. Properties
Signals
Detailed DescriptionUnderlying ArchitectureQML/3d Mesh objects are a QML enabled means of representing any scene class based on the QGLAbstractScene class. In cases where the scene is composed of multiple nodes (for example, in a .3ds file) the mesh allows users to split away branches of the tree and manipulate them in isolation from the original scene graph. In order to achieve this the mesh object contains a map correlating numeric identifiers for individual branches with specific QGLSceneNode objects which are taken from the original scene. More details on achieving this can be found in the Item3D class. Specifying Simple Mesh ObjectsLike other objects in QML/3d, Mesh objects are created by the standard QML syntax for objects. Meshes should always specify an appropriate file containing the data for the Mesh: Mesh {
id: teapot_mesh
source: "teapot.bez"
}
More complex effects use the usual QML syntax for accessing and updating properties. In order to specify a texture, for example, the following could be used: Mesh { id: teapot_mesh source: "teapot.bez" effect: Effect { texture: "texture.png" } } For objects loaded from the network we can wait for an "onLoaded" signal in QML (from the loaded() signal in the Mesh class) before performing specific actions. For example: Item3D { id: theMesh mesh: Mesh { source: "http://www.example_3d_model_url.com/sample.obj" onLoaded:{theMesh.effect=theEffect} } Effect { id: theEffect texture: ":/qml/texture.jpg" } } } This code will wait until the mesh has been fully loaded before attempting to apply the effects. Property DocumentationFlag set to true if the description of the item will be dumped to the console. When this flag is true, useful debugging and diagnostic information, for example the names of all the subnodes of the mesh, materials and geometry parameters, will be dumped to the console during the loading of the model. Get the main scene node for the QGLAbstractScene associated with this mesh. Users can associate a name with a mesh to facilitate easy finding or description of a mesh. The behaviour of the underlying file loader can be controlled by string encoded options. Consult the documentation for each loader for the options available. Specifies the current options for loading this mesh. The default value is the null string, meaning no options are applied. Each mesh requires a set of data that describes (among other things) vertices transformations, textures, and so on. This data is generally stored in files and specified via the source property. Source files can be of any type supported by Qt3D. The types of file currently supported can be found in the sceneFormat plugins, with .3ds, .bez, .obj, .dae files currently being supported. Meshes can also be stored within QRC files and loaded via the standard resource mechanisms, however there may be issues with some esoteric remote resource loading requirements within the different file types. This property holds the viewport which this Skybox will be displayed inside. The skybox will completely fill the viewport, but since it is drawn first, and with depth buffering off, all other content in the given viewport will overlay the skybox making it appear infinitely distant. Generally this property should not need to be set as the skybox can be simply placed inside the viewport element in which it should display. Signal Documentation |