QLevelOfDetail#
The QLevelOfDetail
class provides a way of controlling the complexity of rendered entities based on their size on the screen. More…
Inherited by: QLevelOfDetailSwitch
Synopsis#
Properties#
Functions#
def
camera
()def
createBoundingSphere
(center, radius)def
currentIndex
()def
thresholdType
()def
thresholds
()def
volumeOverride
()
Slots#
def
setCamera
(camera)def
setCurrentIndex
(currentIndex)def
setThresholdType
(thresholdType)def
setThresholds
(thresholds)def
setVolumeOverride
(volumeOverride)
Signals#
def
cameraChanged
(camera)def
currentIndexChanged
(currentIndex)def
thresholdTypeChanged
(thresholdType)def
thresholdsChanged
(thresholds)def
volumeOverrideChanged
(volumeOverride)
Note
This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE
Detailed Description#
QLevelOfDetail
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 material, etc.
The LevelOfDetail component is not shareable between multiple entities .
#include <Qt3DCore/QEntity> #include <Qt3DRender/QGeometryRenderer> #include <Qt3DRender/QLevelOfDetail> // Scene Qt3DCore::QEntity *rootEntity = new Qt3DCore::Qt3DCore::QEntity; Qt3DCore::QEntity *renderableEntity = new Qt3DCore::QEntity(rootEntity); Qt3DRender::QGeometryRenderer *geometryRenderer = new Qt3DCore::QGeometryRenderer(renderableEntity); renderableEntity->addComponent(geometryRenderer); Qt3DRender::QLevelOfDetail* lod = new Qt3Render::QLevelOfDetail(renderableEntity); QList<qreal> thresholds = {20, 35, 50, 65}; lod->setThresholds(thresholds); lod->setCamera(mainCamera); renderableEntity->addComponent(lod); // connect to QLevelOfDetail::currentIndexChanged to toggle rendering ...
- class PySide6.Qt3DRender.Qt3DRender.QLevelOfDetail([parent=None])#
- Parameters:
parent –
PySide6.Qt3DCore.Qt3DCore.QNode
Constructs a new QLevelOfDetail
with the specified parent
.
Note
Properties can be used directly when from __feature__ import true_property
is used or via accessor functions otherwise.
- property PᅟySide6.Qt3DRender.Qt3DRender.QLevelOfDetail.camera: PySide6.Qt3DRender.Qt3DRender.QCamera#
Holds the id of the camera that is used to compute the actual distance or the screen size.
- Access functions:
camera
()setCamera
(camera)Signal
cameraChanged
(camera)
- property PᅟySide6.Qt3DRender.Qt3DRender.QLevelOfDetail.currentIndex: int#
The index in the range array which matches the current distance to the camera or screen size.
- Access functions:
currentIndex
()setCurrentIndex
(currentIndex)Signal
currentIndexChanged
(currentIndex)
- property PᅟySide6.Qt3DRender.Qt3DRender.QLevelOfDetail.thresholdType: ThresholdType#
Specifies how range values are interpreted.
See also
ThresholdType
- Access functions:
setThresholdType
(thresholdType)Signal
thresholdTypeChanged
(thresholdType)
- property PᅟySide6.Qt3DRender.Qt3DRender.QLevelOfDetail.thresholds: list of qreal#
Array of range values as float point numbers. The value for the most detailed representation should be specified first.
If thresholdType
is set to DistanceToCameraThreshold
, values should be specified in ascending order, in camera space coordinates
If thresholdType
is set to ProjectedScreenPixelSizeThreshold
, values should be specified in descending order, in screen space pixels.
See also
ThresholdType
- Access functions:
thresholds
()setThresholds
(thresholds)Signal
thresholdsChanged
(thresholds)
- property PᅟySide6.Qt3DRender.Qt3DRender.QLevelOfDetail.volumeOverride: PySide6.Qt3DRender.Qt3DRender.QLevelOfDetailBoundingSphere#
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 nullptr, the bounding volume of the entity is used. Care must be taken that this bounding volume never becomes invalid.
See also
QLevelOfDetailBoundingSphere
- Access functions:
setVolumeOverride
(volumeOverride)Signal
volumeOverrideChanged
(volumeOverride)
- PySide6.Qt3DRender.Qt3DRender.QLevelOfDetail.ThresholdType#
Specifies how the values in the thresholds are interpreted
Constant
Description
Qt3DRender.QLevelOfDetail.DistanceToCameraThreshold
Distance from the entity to the selected camera
Qt3DRender.QLevelOfDetail.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.
- PySide6.Qt3DRender.Qt3DRender.QLevelOfDetail.camera()#
- Return type:
See also
Getter of property camera
.
- PySide6.Qt3DRender.Qt3DRender.QLevelOfDetail.cameraChanged(camera)#
- Parameters:
Notification signal of property camera
.
- PySide6.Qt3DRender.Qt3DRender.QLevelOfDetail.createBoundingSphere(center, radius)#
- Parameters:
center –
PySide6.QtGui.QVector3D
radius – float
- Return type:
- PySide6.Qt3DRender.Qt3DRender.QLevelOfDetail.currentIndex()#
- Return type:
int
See also
Getter of property currentIndex
.
- PySide6.Qt3DRender.Qt3DRender.QLevelOfDetail.currentIndexChanged(currentIndex)#
- Parameters:
currentIndex – int
Notification signal of property currentIndex
.
- PySide6.Qt3DRender.Qt3DRender.QLevelOfDetail.setCamera(camera)#
- Parameters:
Sets the camera
relative to which distance and size are computed.
See also
Setter of property camera
.
- PySide6.Qt3DRender.Qt3DRender.QLevelOfDetail.setCurrentIndex(currentIndex)#
- Parameters:
currentIndex – int
Sets the currentIndex
.
Note
This should not normally be set by the user.
However, if the component is disabled, then changing the current index is a simple way of switching between multiple representations.
See also
Setter of property currentIndex
.
- PySide6.Qt3DRender.Qt3DRender.QLevelOfDetail.setThresholdType(thresholdType)#
- Parameters:
thresholdType –
ThresholdType
Sets the way thresholds values are interpreted with parameter thresholdType
See also
thresholdType()
ThresholdType
Setter of property thresholdType
.
- PySide6.Qt3DRender.Qt3DRender.QLevelOfDetail.setThresholds(thresholds)#
- Parameters:
thresholds – .list of qreal
Sets the range values in thresholds
.
See also
Setter of property thresholds
.
- PySide6.Qt3DRender.Qt3DRender.QLevelOfDetail.setVolumeOverride(volumeOverride)#
- Parameters:
volumeOverride –
PySide6.Qt3DRender.Qt3DRender.QLevelOfDetailBoundingSphere
See also
Setter of property volumeOverride
.
- PySide6.Qt3DRender.Qt3DRender.QLevelOfDetail.thresholdType()#
- Return type:
See also
Getter of property thresholdType
.
- PySide6.Qt3DRender.Qt3DRender.QLevelOfDetail.thresholdTypeChanged(thresholdType)#
- Parameters:
thresholdType –
ThresholdType
Notification signal of property thresholdType
.
- PySide6.Qt3DRender.Qt3DRender.QLevelOfDetail.thresholds()#
- Return type:
.list of qreal
See also
Getter of property thresholds
.
- PySide6.Qt3DRender.Qt3DRender.QLevelOfDetail.thresholdsChanged(thresholds)#
- Parameters:
thresholds – .list of qreal
Notification signal of property thresholds
.
- PySide6.Qt3DRender.Qt3DRender.QLevelOfDetail.volumeOverride()#
-
See also
Getter of property volumeOverride
.
- PySide6.Qt3DRender.Qt3DRender.QLevelOfDetail.volumeOverrideChanged(volumeOverride)#
- Parameters:
volumeOverride –
PySide6.Qt3DRender.Qt3DRender.QLevelOfDetailBoundingSphere
Notification signal of property volumeOverride
.