Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 319c2ca

Browse files
committedFeb 26, 2018
RequestRender when loadQueue is not empty
1 parent f151c93 commit 319c2ca

File tree

4 files changed

+21
-4
lines changed

4 files changed

+21
-4
lines changed
 

‎CHANGES.md

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Change Log
2020
* Added `preserveQueryParameters` parameter to `getDerivedResource`, to allow us to append query parameters instead of always replacing them.
2121
* Added `setQueryParameters` and `appendQueryParameters` to allow for better handling of query strings.
2222
* Enable terrain in the `CesiumViewer` demo application [#6198](https://github.com/AnalyticalGraphicsInc/cesium/pull/6198)
23+
* Added `Globe.tilesLoaded` getter property to determine if all terrain and imagery is loaded. [#6194](https://github.com/AnalyticalGraphicsInc/cesium/pull/6194)
2324

2425
##### Fixes :wrench:
2526
* Fixed bug where AxisAlignedBoundingBox did not copy over center value when cloning an undefined result. [#6183](https://github.com/AnalyticalGraphicsInc/cesium/pull/6183)

‎Source/Scene/Globe.js

+12-1
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,18 @@ define([
326326
return this._surface.tileLoadProgressEvent;
327327
}
328328
},
329-
329+
/**
330+
* Returns <code>true</code> when the tile load queue is empty, <code>false</code> otherwise. When the load queue is empty,
331+
* all terrain and imagery for the current view have been loaded.
332+
* @memeberof Globe.prototype
333+
* @type {Boolean}
334+
* @readonly
335+
*/
336+
tilesLoaded: {
337+
get: function() {
338+
return (this._surface._lastTileLoadQueueLength === 0);
339+
}
340+
},
330341
/**
331342
* Gets or sets the material appearance of the Globe. This can be one of several built-in {@link Material} objects or a custom material, scripted with
332343
* {@link https://github.com/AnalyticalGraphicsInc/cesium/wiki/Fabric|Fabric}.

‎Source/Scene/Scene.js

+7-3
Original file line numberDiff line numberDiff line change
@@ -782,7 +782,6 @@ define([
782782

783783
var removeGlobeCallbacks = [];
784784
if (defined(globe)) {
785-
removeGlobeCallbacks.push(globe.tileLoadedEvent.addEventListener(requestRenderAfterFrame(scene)));
786785
removeGlobeCallbacks.push(globe.imageryLayersUpdatedEvent.addEventListener(requestRenderAfterFrame(scene)));
787786
removeGlobeCallbacks.push(globe.terrainProviderChanged.addEventListener(requestRenderAfterFrame(scene)));
788787
}
@@ -2750,8 +2749,13 @@ define([
27502749
updateDebugFrustumPlanes(scene);
27512750
updateShadowMaps(scene);
27522751

2753-
if (scene._globe) {
2754-
scene._globe.render(frameState);
2752+
var globe = scene._globe;
2753+
if (defined(globe)) {
2754+
globe.render(frameState);
2755+
2756+
if (!globe.tilesLoaded) {
2757+
scene._renderRequested = true;
2758+
}
27552759
}
27562760
}
27572761

‎Specs/createGlobe.js

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ define([
2626
},
2727
_surface : {},
2828
tileLoadedEvent : new Event(),
29+
tilesLoaded : true,
2930
imageryLayersUpdatedEvent : new Event(),
3031
terrainProviderChanged : new Event(),
3132
destroy : function() {}

0 commit comments

Comments
 (0)
Please sign in to comment.