LevelOfDetail QML Type
LevelOfDetail 提供了一种根据渲染实体在屏幕上的大小来控制其复杂程度的方法。更多内容...
| Import Statement: | import Qt3D.Render 2.12 |
| In C++: | QLevelOfDetail |
| Inherits: | |
| Status: | Deprecated |
此类型已弃用。我们强烈建议不要在新代码中使用它。
属性
- ThresholdType : enumeration
- camera : Camera
- currentIndex : int
- thresholdType : int
- thresholds : QList<qreal>
- volumeOverride : int
详细说明
“细节级别”(LevelOfDetail)可用于根据实体与观察者之间的距离或其在屏幕上的大小来控制实体的呈现效果。
为了提高渲染性能,可以对非常小的物体在几何体或纹理上使用更少的细节进行渲染。
该组件通过指定阈值来控制,这些阈值被解释为距离摄像机的距离或屏幕大小。
随着视角的变化,currentIndex 属性也会随之变化,以反映范围数组中的对应值。
然后,可以使用“currentIndex ”属性,例如,启用或禁用实体、更改“EntityLoader ”中的光源,或更改材质。
多个实体之间无法共享“细节级别(LevelOfDetail)”组件。
import Qt3D.Core 2.0
import Qt3D.Render 2.0
Entity {
id: root
// Scene
Camera { id: mainCamera }
LevelOfDetail {
id: lod
camera: mainCamera
thresholds: [20, 35, 50, 65]
thresholdType: LevelOfDetail.DistanceToCameraThreshold
}
GeometryRenderer {
id: mesh
view: CylinderMesh {
property var sliceValues: [20, 10, 6, 4]
slices: sliceValues[lod.currentIndex]
}
}
Entity {
id: renderableEntity
components: [ mesh, lod ]
}
}属性文档
ThresholdType : enumeration
指定如何解释阈值中的数值
- DistanceToCameraThreshold 实体到所选摄像机的距离
- ProjectedScreenPixelSizeThreshold 从选定摄像机视角看,实体投影到屏幕上的尺寸,以屏幕空间中包围矩形边长的像素数表示。
另请参阅 Qt3DRender::QLevelOfDetail::ThresholdType 。
camera : Camera
存储用于计算实际距离或屏幕大小的摄像头的 ID。
currentIndex : int
范围数组中与当前到摄像头的距离或屏幕尺寸相匹配的索引。
thresholdType : int
指定如何解释范围值。
thresholds : QList<qreal>
以浮点数形式表示的范围值数组。应首先指定最精细的表示值。
如果将 `LevelOfDetail::thresholdType ` 设置为 `LevelOfDetail.DistanceToCameraThreshold`,则应在摄像机空间坐标系中按升序指定这些值
如果LevelOfDetail::thresholdType 设置为LevelOfDetail ·DistanceToCameraThreshold,则应按升序指定数值,单位为摄像机空间坐标;
volumeOverride : int
指定用于计算距离或屏幕大小的对象。
默认情况下,使用半径为 1 且中心位于该实体本机原点的球体。该代理体积用于计算到摄像机的距离或屏幕投影的大小。
如果该值为 null,则使用实体的边界体。必须注意确保该边界体永远不会失效。
© 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.