@@ -198,6 +198,8 @@ void Qgs3DMapScene::onCameraChanged()
198198 entity->update ( _sceneState ( mCameraController ) );
199199 }
200200
201+ updateSceneState ();
202+
201203 // Update near and far plane from the terrain.
202204 // this needs to be done with great care as we have kind of circular dependency here:
203205 // active nodes are culled based on the current frustum (which involves near + far plane)
@@ -279,6 +281,8 @@ void Qgs3DMapScene::onFrameTriggered( float dt )
279281 entity->update ( _sceneState ( mCameraController ) );
280282 }
281283 }
284+
285+ updateSceneState ();
282286}
283287
284288void Qgs3DMapScene::createTerrain ()
@@ -296,6 +300,7 @@ void Qgs3DMapScene::createTerrain()
296300 // defer re-creation of terrain: there may be multiple invocations of this slot, so create the new entity just once
297301 QTimer::singleShot ( 0 , this , &Qgs3DMapScene::createTerrainDeferred );
298302 mTerrainUpdateScheduled = true ;
303+ setSceneState ( Updating );
299304 }
300305}
301306
@@ -453,3 +458,31 @@ void Qgs3DMapScene::addCameraViewCenterEntity( Qt3DRender::QCamera *camera )
453458 mEntityCameraViewCenter ->setEnabled ( mMap .showCameraViewCenter () );
454459 } );
455460}
461+
462+ void Qgs3DMapScene::setSceneState ( Qgs3DMapScene::SceneState state )
463+ {
464+ if ( mSceneState == state )
465+ return ;
466+ mSceneState = state;
467+ emit sceneStateChanged ();
468+ }
469+
470+ void Qgs3DMapScene::updateSceneState ()
471+ {
472+ if ( mTerrainUpdateScheduled )
473+ {
474+ setSceneState ( Updating );
475+ return ;
476+ }
477+
478+ Q_FOREACH ( QgsChunkedEntity *entity, mChunkEntities )
479+ {
480+ if ( entity->isEnabled () && entity->pendingJobsCount () > 0 )
481+ {
482+ setSceneState ( Updating );
483+ return ;
484+ }
485+ }
486+
487+ setSceneState ( Ready );
488+ }
0 commit comments