Model QML Type

Lets you load a 3D model data. 更多...

import 语句: import QtQuick3D 1.15
继承:

Node

特性

详细描述

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"
}
					
					

材质

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 DefaultMaterial ,和 CustomMaterial . In addition the Material Library provides a set of pre-made materials that can be used.

特性文档编制

[read-only] bounds : Bounds

This holds the bounds of the model. It can be read from the model that is set as a source .

注意: 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 : 几何体

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 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.

常量 描述
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.