I am working off the latest code in the terrain branch and I’m trying to use a combined Cesium.js. Working directly with Scene, I can render properly and place the camera where I want. When I try to attach an instance of CesiumTerrainProvider to the scene’s central body surface, though, things break. Nothing renders although the animation loop is being called. I can confirm the two top-level tiles of terrain heightmaps were requested and nothing else beyond that. There are no error messages in the console.
I can’t see anything in CesiumWidget that I haven’t already done in my code. My init() is the body’s onload handler:
function init() {
var div = document.getElementById('cesiumContainer');
var canvas = document.getElementById('cesiumCanvas');
canvas.width = div.scrollWidth;
canvas.height = div.scrollHeight;
var ellipsoid = Cesium.Ellipsoid.WGS84;
var cb = new Cesium.CentralBody(ellipsoid);
scene = new Cesium.Scene(canvas);
scene.getPrimitives().setCentralBody(cb);
var camera = scene.getCamera();
//camera.frustum.near = 100.0;
//camera.frustum.far = 50000.0;
//camera.frustum.aspectRatio = canvas.clientWidth / canvas.clientHeight;
//scene.backgroundColor = new Cesium.Color(0.86, 0.925, 1.0, 1.0);
//cb.logoOffset = new Cesium.Cartesian2(125, 0);
/*
var terrainProvider = new Cesium.CesiumTerrainProvider({
url : 'http://cesium.agi.com/smallterrain'
});
terrainProvider.hasWaterMask = false;
cb._surface._terrainProvider = terrainProvider;
*/
cb.getImageryLayers().addImageryProvider(new Cesium.OpenStreetMapImageryProvider({
url : "http://www.rideleader.com/services/map/ocean;land;topo:0.4;hydrography;roads;streetnames;text:0.8/tile/",
maximumLevel: 16,
credit: "Map ©RideLeader. Data ©OpenStreetMap contributors, CC BY-SA"
}));
route = loadRoute();
var cameraPos = new Cesium.Cartesian3(route.track[0].cameraX, route.track[0].cameraY, route.track[0].cameraZ);
camera.controller.lookAt(cameraPos,
new Cesium.Cartesian3(route.track[0].X, route.track[0].Y, route.track[0].Z),
cameraPos.normalize());
animLoop();
}
function animLoop() {
var currentTime = new Cesium.JulianDate();
scene.initializeFrame(currentTime);
scene.render();
Cesium.requestAnimationFrame(animLoop);
}
The route object is valid and the data correct (things render with the default terrain provider). Am I missing something important?
Thanks,
Peter