CustomHeightmapTerrainProvider
A simple TerrainProvider that gets height values from a callback function. It can be used for procedurally generated terrain or as a way to load custom heightmap data without creating a subclass of TerrainProvider.
There are some limitations such as no water mask, no vertex normals, and no availability, so a full-fledged TerrainProvider subclass is better suited for these more sophisticated use cases.
const viewer = new Viewer("cesiumContainer", {
terrainProvider: new CustomHeightmapTerrainProvider({
width: 32,
height: 32,
callback: function (x, y, level) {
return new Float32Array(32 * 32); // all zeros
},
}),
});
See also
Types
Properties
Gets an object that can be used to determine availability of terrain from this provider, such as at points and in rectangles. This property may be undefined if availability information is not available.
Gets an event that is raised when the terrain provider encounters an asynchronous error. By subscribing to the event, you will be notified of the error and can potentially recover from it. Event listeners are passed an instance of TileProviderError.
Gets a value indicating whether or not the requested tiles include vertex normals. Vertex normals are not supported by CustomHeightmapTerrainProvider, so the return value will always be false.
Gets a value indicating whether or not the provider includes a water mask. The water mask indicates which areas of the globe are water rather than land, so they can be rendered as a reflective surface with animated waves. Water mask is not supported by CustomHeightmapTerrainProvider, so the return value will always be false.
Gets the tiling scheme used by this provider.
Functions
Gets the maximum geometric error allowed in a tile at a given level.
Determines whether data for a tile is available to be loaded.
Makes sure we load availability data for a tile
Requests the geometry for a given tile. The result must include terrain data and may optionally include a water mask and an indication of which child tiles are available.
Requests the geometry for a given tile. The result includes terrain data and indicates that all child tiles are available.