Qt3DRender::QLevelOfDetail Class
class Qt3DRender::QLevelOfDetailA classe QLevelOfDetail oferece uma maneira de controlar a complexidade das entidades renderizadas com base em seu tamanho na tela. Mais...
| Cabeçalho: | #include <qlevelofdetail.h> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS 3drender) target_link_libraries(mytarget PRIVATE Qt6::3drender) |
| qmake: | QT += 3drender |
| No QML: | LevelOfDetail |
| Herdado de: | Qt3DCore::QComponent |
| Herdado por: | |
| Status: | Obsoleta |
Esta classe está obsoleta. Recomendamos enfaticamente que não seja usada em código novo.
Tipos públicos
| enum | ThresholdType { DistanceToCameraThreshold, ProjectedScreenPixelSizeThreshold } |
Propriedades
|
|
Funções públicas
| QLevelOfDetail(Qt3DCore::QNode *parent = nullptr) | |
| Qt3DRender::QCamera * | camera() const |
| int | currentIndex() const |
| Qt3DRender::QLevelOfDetail::ThresholdType | thresholdType() const |
| QList<qreal> | thresholds() const |
| Qt3DRender::QLevelOfDetailBoundingSphere | volumeOverride() const |
Slots públicos
| void | setCamera(Qt3DRender::QCamera *camera) |
| void | setCurrentIndex(int currentIndex) |
| void | setThresholdType(Qt3DRender::QLevelOfDetail::ThresholdType thresholdType) |
| void | setThresholds(const QList<qreal> &thresholds) |
| void | setVolumeOverride(const Qt3DRender::QLevelOfDetailBoundingSphere &volumeOverride) |
Sinais
| void | cameraChanged(Qt3DRender::QCamera *camera) |
| void | currentIndexChanged(int currentIndex) |
| void | thresholdTypeChanged(Qt3DRender::QLevelOfDetail::ThresholdType thresholdType) |
| void | thresholdsChanged(const QList<qreal> &thresholds) |
| void | volumeOverrideChanged(const Qt3DRender::QLevelOfDetailBoundingSphere &volumeOverride) |
Descrição detalhada
QLevelOfDetail pode ser usado para controlar a representação de uma entidade com base na distância do observador ou no tamanho na tela.
Para melhorar o desempenho da renderização, objetos muito pequenos podem ser renderizados com muito menos detalhes, tanto na geometria quanto na textura.
O componente é controlado pela especificação de limites de valores que são interpretados como distâncias em relação à câmera ou como tamanho da tela.
À medida que o ponto de vista muda, a propriedade ` currentIndex ` será alterada para refletir o valor correspondente na matriz de intervalos.
A propriedade ` currentIndex ` pode então ser usada, por exemplo, para ativar ou desativar entidades, alterar o material etc.
O componente “ LevelOfDetail ” não pode ser compartilhado entre vários “ 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
...Documentação sobre tipos de membros
enum QLevelOfDetail::ThresholdType
Especifica como os valores nos limites são interpretados
| Constante | Valor | Descrição |
|---|---|---|
Qt3DRender::QLevelOfDetail::DistanceToCameraThreshold | 0 | Distância da entidade até a câmera selecionada |
Qt3DRender::QLevelOfDetail::ProjectedScreenPixelSizeThreshold | 1 | Tamanho da entidade quando projetada na tela, vista da câmera selecionada, expresso em número de pixels no lado do quadrado delimitador no espaço da tela. |
Documentação da propriedade
camera : Qt3DRender::QCamera*
Contém o ID da câmera usada para calcular a distância real ou o tamanho da tela.
Funções de acesso:
| Qt3DRender::QCamera * | camera() const |
| void | setCamera(Qt3DRender::QCamera *camera) |
Sinal de notificação:
| void | cameraChanged(Qt3DRender::QCamera *camera) |
currentIndex : int
O índice na matriz de intervalos que corresponde à distância atual em relação à câmera ou ao tamanho da tela.
Funções de acesso:
| int | currentIndex() const |
| void | setCurrentIndex(int currentIndex) |
Sinal de notificação:
| void | currentIndexChanged(int currentIndex) |
thresholdType : ThresholdType
Especifica como os valores de intervalo são interpretados.
Funções de acesso:
| Qt3DRender::QLevelOfDetail::ThresholdType | thresholdType() const |
| void | setThresholdType(Qt3DRender::QLevelOfDetail::ThresholdType thresholdType) |
Sinal do Notifier:
| void | thresholdTypeChanged(Qt3DRender::QLevelOfDetail::ThresholdType thresholdType) |
Veja também Qt3DRender::QLevelOfDetail::ThresholdType.
thresholds : QList<qreal>
Matriz de valores de intervalo na forma de números de ponto flutuante. O valor correspondente à representação mais detalhada deve ser especificado primeiro.
Se ` Qt3DRender::QLevelOfDetail::thresholdType ` estiver definido como ` Qt3DRender::QLevelOfDetail::DistanceToCameraThreshold`, os valores devem ser especificados em ordem crescente, nas coordenadas do espaço da câmera
Se ` Qt3DRender::QLevelOfDetail::thresholdType ` estiver definido como ` Qt3DRender::QLevelOfDetail::ProjectedScreenPixelSizeThreshold`, os valores devem ser especificados em ordem decrescente, em pixels no espaço da tela.
Funções de acesso:
| QList<qreal> | thresholds() const |
| void | setThresholds(const QList<qreal> &thresholds) |
Sinal de notificação:
| void | thresholdsChanged(const QList<qreal> &thresholds) |
Veja também Qt3DRender::QLevelOfDetail::ThresholdType.
volumeOverride : Qt3DRender::QLevelOfDetailBoundingSphere
O padrão é uma esfera de raio 1, com centro na origem local da entidade. Esse volume proxy é usado para calcular a distância até a câmera ou o tamanho da projeção na tela.
Se esse valor for `nullptr`, o volume delimitador da entidade será utilizado. É preciso ter cuidado para que esse volume delimitador nunca se torne inválido.
Funções de acesso:
| Qt3DRender::QLevelOfDetailBoundingSphere | volumeOverride() const |
| void | setVolumeOverride(const Qt3DRender::QLevelOfDetailBoundingSphere &volumeOverride) |
Sinal de notificação:
| void | volumeOverrideChanged(const Qt3DRender::QLevelOfDetailBoundingSphere &volumeOverride) |
Veja também Qt3DRender::QLevelOfDetailBoundingSphere.
Documentação das funções de membro
[explicit] QLevelOfDetail::QLevelOfDetail(Qt3DCore::QNode *parent = nullptr)
Cria um novo objeto `QLevelOfDetail` com o ` parent` especificado.
[slot] void QLevelOfDetail::setCamera(Qt3DRender::QCamera *camera)
Define a propriedade ` camera `, em relação à qual a distância e o tamanho são calculados.
Observação: Funçãosetter para a propriedade camera.
Veja também camera().
[slot] void QLevelOfDetail::setCurrentIndex(int currentIndex)
Define a variável ` currentIndex`.
Observação: Normalmente,isso não deve ser definido pelo usuário.
No entanto, se o componente estiver desativado, alterar o índice atual é uma maneira simples de alternar entre várias representações.
Observação: Funçãode definição para a propriedade ` currentIndex`.
Veja também currentIndex().
[slot] void QLevelOfDetail::setThresholdType(Qt3DRender::QLevelOfDetail::ThresholdType thresholdType)
Define a forma como os valores dos limites são interpretados com o parâmetro thresholdType
Observação: Funçãosetter para a propriedade thresholdType.
Veja também ` thresholdType()` e ` Qt3DRender::QLevelOfDetail::ThresholdType`.
[slot] void QLevelOfDetail::setThresholds(const QList<qreal> &thresholds)
Define os valores do intervalo em thresholds.
Observação: Funçãosetter para a propriedade thresholds.
Veja também ` thresholds()` e ` Qt3DRender::QLevelOfDetail::thresholdType`.
© 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.