Instancing QML Type (Uncreatable)
实例表的基础类型。更多...
| Import Statement: | import QtQuick3D |
| Since: | Qt 6.2 |
| In C++: | QQuick3DInstancing |
| Inherits: | |
| Inherited By: |
注意:此类型无法创建。无法在 QML 中实例化。
属性
- depthSortingEnabled : bool
- hasTransparency : bool
- instanceCountOverride : int
- shadowBoundsMaximum : vector3d
- shadowBoundsMinimum : vector3d
方法
- color instanceColor(int index)
(since 6.3) - vector3d instanceCustomData(int index)
(since 6.3) - vector3d instancePosition(int index)
(since 6.3) - quaternion instanceRotation(int index)
(since 6.3) - vector3d instanceScale(int index)
(since 6.3)
详细说明
实例化渲染允许复制模型并生成变体。
实例化类型定义了一个表格,用于指定每个实例相对于基础模型的修改方式。该表格针对每个索引项都包含一个条目,其中包含一个变换矩阵、一种颜色以及供自定义材质使用的通用数据。要使用实例化功能,请将模型的instancing 属性设置为引用一个Instancing对象。
应用程序可以通过继承QQuick3DInstancing 类在C++中定义一个实例化对象,或者使用以下预定义的QML类型之一:InstanceList 、FileInstancing 或RandomInstancing 。此外,还可以使用particle system 并通过ModelParticle3D.instanceTable 属性来定义实例化表。
属性文档
depthSortingEnabled : bool
保存实例表中“启用深度排序”的值。启用后,实例将按距离摄像机最远到最近的顺序进行排序和渲染,即从后到前。如果禁用(这是默认设置),则实例将按照其在实例表中指定的顺序进行渲染。
注意:实例 仅在彼此之间进行排序,不会与场景中的其他对象进行排序。
注意: 排序会 增加帧准备时间,尤其在实例数量较多时。
hasTransparency : bool
如果实例化表中包含渲染模型时应使用的透明度值,请将此属性设置为 true。此属性仅在模型为不透明时才起作用:如果模型具有透明的material ,或者其opacity 小于 1,则无论如何都会使用表中的透明度值。
注意:启用 透明度混合可能会在实例重叠时导致渲染问题。详情请参阅透明度混合和实例化文档。
instanceCountOverride : int
将此属性设置为限制实例数量,而无需重新生成或重新上传实例表。这样可以以极低的开销实现渲染实例数量的动画效果。
shadowBoundsMaximum : vector3d
设置计算实例表中模型的阴影贴图边界时所使用的最大边界。
默认值:(-1, -1, -1)
注意: 仅当 `Instancing::shadowBoundsMinimum ` 中的相应组件小于 `Instancing::shadowBoundsMaximum` 中的值时,此 属性才生效。否则,边界将自动计算。
另请参阅 shadowBoundsMinimum 。
shadowBoundsMinimum : vector3d
设置计算实例表中模型的阴影贴图边界时所使用的最小边界。
默认值:(1, 1, 1)
注意: 仅当 Instancing::shadowBoundsMinimum 的相应组件小于Instancing::shadowBoundsMaximum 中的数值时,此 属性才生效。否则,边界将自动计算。
另请参阅 shadowBoundsMaximum 。
方法文档
[since 6.3] color instanceColor(int index)
返回位于index
该方法在 Qt 6.3 中引入。
另请参阅 instancePosition 、instanceScale 、instanceRotation 、instanceColor 以及instanceCustomData 。
[since 6.3] vector3d instanceCustomData(int index)
返回位于index
该方法在 Qt 6.3 中引入。
另请参阅 instancePosition 、instanceScale 、instanceRotation 、instanceColor 以及 instanceCustomData。
[since 6.3] vector3d instancePosition(int index)
返回实例在index
该方法在 Qt 6.3 中引入。
另请参阅 instanceScale 、instanceRotation 、instanceColor 以及instanceCustomData 。
[since 6.3] quaternion instanceRotation(int index)
返回一个四元数,表示实例在index
该方法在 Qt 6.3 中引入。
另请参阅 instancePosition 、instanceScale 、instanceRotation、instanceColor 以及instanceCustomData 。
[since 6.3] vector3d instanceScale(int index)
返回该实例在index
该方法在 Qt 6.3 中引入。
另请参阅 instancePosition 、instanceScale、instanceRotation 、instanceColor 以及instanceCustomData 。
© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.