Skip to content

Commit

Permalink
qgs3dmapscene: Ensure to update near/far planes on new entity creation
Browse files Browse the repository at this point in the history
The near/far planes are computed in `Qgs3DMapScene` when the camera
parameters have changed. Their values depend on the bounding boxes of
the visible entities. However, the near and far planes are not
recomputed when a new entity is added.
This can be problematic for entities from a vector layer because their
vertical extent is unknown when the associated bounding boxes are
created.

This issue is fixed by calling
`Qgs3DMapscene::updateCameraNearFarPlanes` when a new scene entity is
created. Indeed, on a new scene entity, the exact exact bounding box
has been computed by the loader of the chunked entity.
  • Loading branch information
ptitjano committed Jan 22, 2024
1 parent 5318a5a commit 5ba923b
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/3d/qgs3dmapscene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -698,6 +698,8 @@ void Qgs3DMapScene::addLayerEntity( QgsMapLayer *layer )
connect( sceneNewEntity, &Qgs3DMapSceneEntity::newEntityCreated, this, [this]( Qt3DCore::QEntity * entity )
{
finalizeNewEntity( entity );
// this ensures to update the near/far planes with the exact bounding box of the new entity.
updateCameraNearFarPlanes();
} );

connect( sceneNewEntity, &Qgs3DMapSceneEntity::pendingJobsCountChanged, this, &Qgs3DMapScene::totalPendingJobsCountChanged );
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 5ba923b

Please sign in to comment.