Skip to content

Commit

Permalink
Revert "Update Sandcastle demo to not trigger infinite loop"
Browse files Browse the repository at this point in the history
This reverts commit 9c8c800.
  • Loading branch information
lilleyse committed Sep 28, 2018
1 parent 8209e29 commit 1cda2e1
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions Apps/Sandcastle/gallery/Clamp to 3D Model.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@
shadows : true,
shouldAnimate : true
});
var scene = viewer.scene;
scene.globe.depthTestAgainstTerrain = true;
viewer.scene.globe.depthTestAgainstTerrain = true;

var longitude = -2.1480545852753163;
var latitude = 0.7688240036937101;
Expand All @@ -50,9 +49,8 @@
}
});

viewer.trackedEntity = entity;

var point = viewer.entities.add({
position : new Cesium.CallbackProperty(updatePosition, false),
point : {
pixelSize : 10,
color : Cesium.Color.YELLOW,
Expand All @@ -72,18 +70,12 @@
var objectsToExclude = [point];
var cartographic = new Cesium.Cartographic();

if (scene.sampleHeightSupported) {
scene.postRender.addEventListener(updatePosition);
} else {
console.log('This browser does not support sampleHeight.');
}

function updatePosition(scene, time) {
function updatePosition(time, result) {
var offset = (time.secondsOfDay % duration) / duration;
cartographic.longitude = longitude - range + offset * range * 2.0;
cartographic.latitude = latitude;

var height = scene.sampleHeight(cartographic, objectsToExclude);
var height = viewer.scene.sampleHeight(cartographic, objectsToExclude);

if (Cesium.defined(height)) {
cartographic.height = height;
Expand All @@ -94,8 +86,9 @@
point.label.show = false;
}

point.position = Cesium.Cartographic.toCartesian(cartographic, Cesium.Ellipsoid.WGS84);
return Cesium.Cartographic.toCartesian(cartographic, Cesium.Ellipsoid.WGS84, result);
}
viewer.trackedEntity = entity;
//Sandcastle_End
Sandcastle.finishedLoading();
}
Expand Down

0 comments on commit 1cda2e1

Please sign in to comment.