Model QML Type
Lets you load a 3D model data. More...
Import Statement: | import QtQuick3D 1.15 |
Inherits: |
Properties
- bounds : Bounds
- castsShadows : bool
- edgeTessellation : real
- geometry : Geometry
- innerTessellation : real
- isWireframeMode : bool
- materials : List<QtQuick3D::Material>
- pickable : bool
- receivesShadows : bool
- source : url
- tessellationMode : enumeration
Detailed Description
The Model item makes it possible to load a mesh and modify how its shaded, by adding materials to it. For a model to be renderable, it needs at least a mesh and a material.
Mesh format and built-in primitives
The model can load static meshes from storage or one of the built-in primitive types. The mesh format used is a run-time format that's native to the engine, but additional formats are supported through the asset import tool Balsam.
The built-in primitives can be loaded by setting the source
property to one of these values: #Rectangle, #Sphere, #Cube, #Cylinder or #Cone
.
Model { source: "#Sphere" }
Materials
A model can consist of several sub-meshes, each of which can have its own material. The sub-mess uses a material from the materials list, corresponding to its index. If the number of materials is less than the sub-meshes, the last material in the list is used for subsequent sub-meshes.
There are currently three different materials that can be used with the model item, the PrincipledMaterial, the DefaultMaterial, and the CustomMaterial. In addition the Material Library provides a set of pre-made materials that can be used.
Property Documentation
[read-only] bounds : Bounds |
This holds the bounds of the model. It can be read from the model that is set as a source.
Note: Bounds might not be immediately available since the source might have not been loaded.
castsShadows : bool |
When this property is true
, the geometry of this model is used when rendering to the shadow maps.
edgeTessellation : real |
This property defines the edge multiplier to the tessellation generator.
geometry : Geometry |
Specify custom geometry for the model. The Model::source must be empty when custom geometry is used.
innerTessellation : real |
This property defines the inner multiplier to the tessellation generator.
isWireframeMode : bool |
When this property is true
and the tessellationMode is not Model.NoTessellation, a wireframe is displayed to highlight the additional geometry created by the tessellation generator.
materials : List<QtQuick3D::Material> |
This property contains a list of materials used to render the provided geometry. To render anything, there must be at least one material. Normally there should be one material for each sub-mesh included in the source geometry.
pickable : bool |
This property controls whether the model is pickable or not. By default models are not pickable and therefore not included when picking against the scene.
receivesShadows : bool |
When this property is true
, shadows can be cast onto this item. So the shadow map is applied to this model by the renderer.
source : url |
This property defines the location of the mesh file containing the geometry of this Model or one of the built-in primitive meshes listed below as described in Mesh format and built-in primitives.
- "#Rectangle"
- "#Sphere"
- "#Cube"
- "#Cone"
- "#Cylinder"
tessellationMode : enumeration |
This property defines what method to use to dynamically generate additional geometry for the model. Tessellation is useful if you are using a displacement map with your geometry, or if you wish to generate a smoother silhouette when zooming in.
Constant | Description |
---|---|
Model.NoTessellation | No tessellation is used. This is the default. |
Model.Linear | Tessellation uses linear generation. |
Model.Phong | Tessellation uses Phong generation. |
Model.NPatch | Tessellation uses NPatch generation. |