Permalink
Browse files

Merge pull request #521 from AnalyticalGraphicsInc/VRTheWorld

Add support for VT MAK's VR-TheWorld terrain server
  • Loading branch information...
pjcozzi committed Feb 16, 2013
2 parents d8c9d92 + a0333f9 commit 20b778ea00a0078b3b737652151ede0232501f1c
@@ -143,21 +143,30 @@
var scene = widget.scene;
var centralBody = scene.getPrimitives().getCentralBody();
- var terrainProvider = new Cesium.CesiumTerrainProvider({
- url : 'http://cesium.agi.com/smallterrain'
+ var cesiumTerrainProvider = new Cesium.CesiumTerrainProvider({
+ url : 'http://cesium.agi.com/smallterrain',
+ credit : 'Terrain data courtesy Analytical Graphics, Inc.'
});
- centralBody.terrainProvider = terrainProvider;
-
var ellipsoidProvider = new Cesium.EllipsoidTerrainProvider();
+ var vrTheWorldProvider = new Cesium.VRTheWorldTerrainProvider({
+ url : 'http://www.vr-theworld.com/vr-theworld/tiles1.0.0/73/',
+ credit : 'Terrain data courtesy VT MÄK'
+ });
+
var terrainProviders = [
- { name : 'CesiumTerrainProvider', provider : terrainProvider },
- { name : 'EllipsoidTerrainProvider', provider : ellipsoidProvider }
+ { name : 'CesiumTerrainProvider', provider : cesiumTerrainProvider },
+ { name : 'EllipsoidTerrainProvider', provider : ellipsoidProvider },
+ { name : 'VRTheWorldTerrainProvider', provider : vrTheWorldProvider }
];
+ centralBody.terrainProvider = cesiumTerrainProvider;
+
createTerrainMenu(terrainProviders);
+ centralBody.logoOffset = new Cesium.Cartesian2(300, 40);
+
Sandcastle.finishedLoading();
});
</script>
View
@@ -9,7 +9,7 @@ Beta Releases
* Breaking changes:
* `IntersectionTests.rayPlane` now takes the new `Plane` type instead of separate `planeNormal` and `planeD` arguments.
* Renamed `ImageryProviderError` to `TileProviderError`.
-* Added support for global terrain visualization via `CesiumTerrainProvider` and `ArcGisImageServerTerrainProvider`. See the [Terrain Tutorial](http://cesium.agi.com/2013/02/15/Cesium-Terrain-Tutorial/) for more information.
+* Added support for global terrain visualization via `CesiumTerrainProvider`, `ArcGisImageServerTerrainProvider`, and `VRTheWorldTerrainProvider`. See the [Terrain Tutorial](http://cesium.agi.com/2013/02/15/Cesium-Terrain-Tutorial/) for more information.
* Added `Plane` for representing the equation of a plane.
* Added a line segment-plane intersection test to `IntersectionTests`.
* Fixed an issue where a `PolylineCollection` with a model matrix other than the identity would be incorrectly rendered in 2D and Columbus view.
View
@@ -314,7 +314,7 @@ define([
* @return {Boolean} True if the extent is empty; otherwise, false.
*/
Extent.prototype.isEmpty = function() {
- return (this.west === this.east) && (this.south === this.north);
+ return (this.west >= this.east) && (this.south >= this.north);
};
var subsampleLlaScratch = new Cartographic();
@@ -102,7 +102,7 @@ define([
this._layerOrderChanged = false;
var terrainTilingScheme = this._terrainProvider.getTilingScheme();
- this._levelZeroTiles = terrainTilingScheme.createLevelZeroTiles();
+ this._levelZeroTiles = undefined;
this._tilesToRenderByTextureCount = [];
this._tileCommands = [];
@@ -174,12 +174,13 @@ define([
// Free and recreate the level zero tiles.
var levelZeroTiles = this._levelZeroTiles;
- for (var i = 0; i < levelZeroTiles.length; ++i) {
- levelZeroTiles[i].freeResources();
+ if (typeof levelZeroTiles !== 'undefined') {
+ for (var i = 0; i < levelZeroTiles.length; ++i) {
+ levelZeroTiles[i].freeResources();
+ }
}
- var terrainTilingScheme = this._terrainProvider.getTilingScheme();
- this._levelZeroTiles = terrainTilingScheme.createLevelZeroTiles();
+ this._levelZeroTiles = undefined;
};
CentralBodySurface.prototype._onLayerAdded = function(layer, index) {
@@ -295,8 +296,10 @@ define([
*/
CentralBodySurface.prototype.destroy = function() {
var levelZeroTiles = this._levelZeroTiles;
- for (var i = 0; i < levelZeroTiles.length; ++i) {
- levelZeroTiles[i].freeResources();
+ if (typeof levelZeroTiles !== 'undefined') {
+ for (var i = 0; i < levelZeroTiles.length; ++i) {
+ levelZeroTiles[i].freeResources();
+ }
}
this._imageryLayerCollection.destroy();
@@ -348,11 +351,6 @@ define([
}
}
- // We can't render anything before the level zero tiles exist.
- if (typeof surface._levelZeroTiles === 'undefined') {
- return;
- }
-
var traversalQueue = surface._tileTraversalQueue;
traversalQueue.clear();
@@ -367,6 +365,17 @@ define([
surface._tileLoadQueue.markInsertionPoint();
surface._tileReplacementQueue.markStartOfRenderFrame();
+ // We can't render anything before the level zero tiles exist.
+ if (typeof surface._levelZeroTiles === 'undefined') {
+ if (surface._terrainProvider.isReady()) {
+ var terrainTilingScheme = surface._terrainProvider.getTilingScheme();
+ surface._levelZeroTiles = terrainTilingScheme.createLevelZeroTiles();
+ } else {
+ // Nothing to do until the terrain provider is ready.
+ return;
+ }
+ }
+
var cameraPosition = frameState.camera.getPositionWC();
var ellipsoid = surface._terrainProvider.getTilingScheme().getEllipsoid();
Oops, something went wrong.

0 comments on commit 20b778e

Please sign in to comment.