fromWorldTerrain
fun fromWorldTerrain(options: Terrain.Companion.FromWorldTerrainOptions? = definedExternally): Terrain(source)
Creates a Terrain instance for Cesium World Terrain.
// Create Cesium World Terrain with default settings
const viewer = new Viewer("cesiumContainer", {
terrain: fromWorldTerrain()
});
Content copied to clipboard
// Create Cesium World Terrain with water and normals.
const viewer1 = new Viewer("cesiumContainer", {
terrain: fromWorldTerrain({
requestWaterMask: true,
requestVertexNormals: true
});
});
Content copied to clipboard
// Handle loading events
const terrain = Terrain.fromWorldTerrain();
scene.setTerrain(terrain);
terrain.readyEvent.addEventListener(provider => {
scene.globe.enableLighting = true;
terrain.provider.errorEvent.addEventListener(error => {
alert(`Encountered an error while loading terrain tiles! ${error}`);
});
});
terrain.errorEvent.addEventListener(error => {
alert(`Encountered an error while creating terrain! ${error}`);
});
Content copied to clipboard
Return
An asynchronous helper object for a CesiumTerrainProvider