LevelOfDetail QML Type

LevelOfDetail provides a way of controlling the complexity of rendered entities based on their size on the screen. 更多...

import 语句: import Qt3D.Render 2.12
Since: Qt 5.9
实例化: QLevelOfDetail
继承: Component3D

特性

详细描述

LevelOfDetail can be used to control the representation of an entity based on distance from the observer or size on the screen.

In order to improve rendering performance, objects that are very small can be rendered using far fewer details, in geometry or texture.

The component is controlled by specifying thresholds of values which are interpreted as either distances from the camera or screen size.

As the point of view changes, the currentIndex property will change to reflect matching value in the range array.

The currentIndex property can then be used, for example, to enable or disable entities, change source in an EntityLoader , or material.

The LevelOfDetail component is not shareable between multiple Entity's.

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
    }
    CylinderMesh {
        id: mesh
        property var sliceValues: [20, 10, 6, 4]
        slices: sliceValues[lod.currentIndex]
    }
    Entity {
        id: renderableEntity
        components: [ mesh, lod ]
    }
}
					

特性文档编制

ThresholdType : enumeration

Specifies how the values in the thresholds are interpreted

  • DistanceToCameraThreshold Distance from the entity to the selected camera
  • ProjectedScreenPixelSizeThreshold Size of the entity when projected on the screen as seen from the selected camera, expressed in number of pixels on the side of the bounding square in screen space.

另请参阅 Qt3DRender::QLevelOfDetail::ThresholdType .

camera : Camera

Holds the id of the camera that is used to compute the actual distance or the screen size.

currentIndex : int

The index in the range array which matches the current distance to the camera or screen size.

thresholdType : int

Specifies how range values are interpreted.

thresholds : QVector < qreal >

Array of range values as float point numbers. The value for the most detailed representation should be specified first.

LevelOfDetail::thresholdType 被设为 LevelOfDetail .DistanceToCameraThreshold, values should be specified in ascending order, in camera space coordinates

LevelOfDetail::thresholdType 被设为 LevelOfDetail .ProjectedScreenPixelSizeThreshold, values should be specified in descending order, in screen space pixels.

volumeOverride : int

Specifies what is used to evaluate the distance or screen size.

The default is a sphere of radius 1 and centered at the local origin of the entity. This proxy volume is used to compute the distance to the camera or the size of the screen projection.

If this value to null, the bounding volume of the entity is used. Care must be taken that this bounding volume never becomes invalid.

另请参阅 Qt3DRender::QLevelOfDetailBoundingSphere .