Cannot use CesiumTerrainProvider from combined Cesium.js?

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

I have confirmed that it’s an issue with web workers, specifically createVerticesFromHeightmap.js which appears to be loaded (at least the network request returns 200 or 304), but using Chrome to debug inside createCesiumWorkerBootstrapper.js reveals that “workerModule” is undefined inside the require() block:

self.onmessage = function(event) {

var data = event.data;

require(data.loaderConfig, [data.workerModule], function(workerModule) {

//replace onmessage with the required-in workerModule

self.onmessage = workerModule;

});

};

When using AMD, data.loaderConfig shows a baseUrl of ‘…’. When using standalone Cesium.js it contains “paths” with value ‘.’.

Peter

It looks like a recent change to the way the worker layers are built didn’t get applied to the heightmap web worker, which only exists in the terrain branch. I’ve made the fix and checked that the standalone version works with terrain again. Sorry for the trouble!

Scott

It works now. Thank you!