Instancing QML Type

实例表格的基本类型。更多

Import Statement: import QtQuick3D
Since: Qt 6.2
In C++: QQuick3DInstancing
Inherits:

Object3D

Inherited By:

FileInstancing, InstanceList, and RandomInstancing

属性

方法

详细说明

实例化渲染允许通过变化来复制模型。

实例化类型定义了一个表格,用于指定每个实例相对于基础模型的修改方式。表中每个索引都有一个条目,包含一个变换矩阵、一种颜色和供自定义材质使用的通用数据。要使用实例化,请将模型的instancing 属性设置为引用实例化对象。

应用程序可通过子类化QQuick3DInstancing 在 C++ 中定义 Instancing 对象,也可使用预先定义的 QML 类型之一: InstanceList FileInstancing RandomInstancing 此外,还可以通过ModelParticle3D.instanceTable 属性使用particle system 来定义一个实例化表。

属性文档

depthSortingEnabled : bool

保存实例表启用的深度排序值。启用后,实例将从离摄像机最近的实例开始排序和渲染,即从后到前。如果禁用(默认值),则按照实例表中指定的顺序渲染实例。

注: 实例之间只进行排序。不会根据场景中的其他对象对实例进行排序。

注: 排序会增加帧准备时间,尤其是在实例数量较多时。


hasTransparency : bool

如果实例化表中包含渲染模型时应使用的 alpha 值,则将此属性设置为 true。该属性只有在模型不透明时才会产生作用:如果模型是透明的material ,或opacity 小于 1,则无论如何都将使用表中的 alpha 值。

注意: 当实例重叠时,启用 alpha 混合可能会导致渲染问题。有关详情,请参阅alpha 混合和实例化文档。


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


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