Skip to content

Commit

Permalink
RequestRender when loadQueue is not empty
Browse files Browse the repository at this point in the history
  • Loading branch information
ggetz committed Feb 26, 2018
1 parent f151c93 commit 319c2ca
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Change Log
* Added `preserveQueryParameters` parameter to `getDerivedResource`, to allow us to append query parameters instead of always replacing them.
* Added `setQueryParameters` and `appendQueryParameters` to allow for better handling of query strings.
* Enable terrain in the `CesiumViewer` demo application [#6198](https://github.com/AnalyticalGraphicsInc/cesium/pull/6198)
* Added `Globe.tilesLoaded` getter property to determine if all terrain and imagery is loaded. [#6194](https://github.com/AnalyticalGraphicsInc/cesium/pull/6194)

##### Fixes :wrench:
* Fixed bug where AxisAlignedBoundingBox did not copy over center value when cloning an undefined result. [#6183](https://github.com/AnalyticalGraphicsInc/cesium/pull/6183)
Expand Down
13 changes: 12 additions & 1 deletion Source/Scene/Globe.js
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,18 @@ define([
return this._surface.tileLoadProgressEvent;
}
},

/**
* Returns <code>true</code> when the tile load queue is empty, <code>false</code> otherwise. When the load queue is empty,
* all terrain and imagery for the current view have been loaded.
* @memeberof Globe.prototype
* @type {Boolean}
* @readonly
*/
tilesLoaded: {
get: function() {
return (this._surface._lastTileLoadQueueLength === 0);
}
},
/**
* 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
* {@link https://github.com/AnalyticalGraphicsInc/cesium/wiki/Fabric|Fabric}.
Expand Down
10 changes: 7 additions & 3 deletions Source/Scene/Scene.js
Original file line number Diff line number Diff line change
Expand Up @@ -782,7 +782,6 @@ define([

var removeGlobeCallbacks = [];
if (defined(globe)) {
removeGlobeCallbacks.push(globe.tileLoadedEvent.addEventListener(requestRenderAfterFrame(scene)));
removeGlobeCallbacks.push(globe.imageryLayersUpdatedEvent.addEventListener(requestRenderAfterFrame(scene)));
removeGlobeCallbacks.push(globe.terrainProviderChanged.addEventListener(requestRenderAfterFrame(scene)));
}
Expand Down Expand Up @@ -2750,8 +2749,13 @@ define([
updateDebugFrustumPlanes(scene);
updateShadowMaps(scene);

if (scene._globe) {
scene._globe.render(frameState);
var globe = scene._globe;
if (defined(globe)) {
globe.render(frameState);

if (!globe.tilesLoaded) {
scene._renderRequested = true;
}
}
}

Expand Down
1 change: 1 addition & 0 deletions Specs/createGlobe.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ define([
},
_surface : {},
tileLoadedEvent : new Event(),
tilesLoaded : true,
imageryLayersUpdatedEvent : new Event(),
terrainProviderChanged : new Event(),
destroy : function() {}
Expand Down

0 comments on commit 319c2ca

Please sign in to comment.