Scene

external class Scene(options: Scene.ConstructorOptions)(source)

The container for all 3D graphical objects and state in a Cesium virtual scene. Generally, a scene is not created directly; instead, it is implicitly created by CesiumWidget.

// Create scene without anisotropic texture filtering
const scene = new Scene({
canvas : canvas,
contextOptions : {
allowTextureFilterAnisotropic : false
}
});

See also

Constructors

Link copied to clipboard
constructor(options: Scene.ConstructorOptions)

Types

Link copied to clipboard
object Companion
Link copied to clipboard

Properties

Link copied to clipboard

Settings for atmosphere lighting effects affecting 3D Tiles and model rendering. This is not to be confused with Scene.skyAtmosphere which is responsible for rendering the sky.

Link copied to clipboard

The background color, which is only visible if there is no sky box, i.e., Scene.skyBox is undefined.

Link copied to clipboard

Gets or sets the camera.

Link copied to clipboard

Whether or not the camera is underneath the globe.

Link copied to clipboard

Gets the canvas element to which this scene is bound.

Link copied to clipboard

Returns true if the Scene.clampToHeight and Scene.clampToHeightMostDetailed functions are supported.

Link copied to clipboard

Determines whether or not to instantly complete the scene transition animation on user input.

Link copied to clipboard

This property is for debugging only; it is not for production use.

Link copied to clipboard

This property is for debugging only; it is not for production use.

Link copied to clipboard

This property is for debugging only; it is not for production use.

Link copied to clipboard

This property is for debugging only; it is not for production use.

Link copied to clipboard

This property is for debugging only; it is not for production use.

Link copied to clipboard

This property is for debugging only; it is not for production use.

Link copied to clipboard

This property is for debugging only; it is not for production use.

Link copied to clipboard

The drawingBufferHeight of the underlying GL context.

Link copied to clipboard

The drawingBufferWidth of the underlying GL context.

Link copied to clipboard

The ellipsoid. If not specified, the default ellipsoid is used.

Link copied to clipboard

The eye separation distance in meters for use with cardboard or WebVR.

Link copied to clipboard

The far-to-near ratio of the multi-frustum when using a normal depth buffer.

Link copied to clipboard

The focal length for use when with cardboard or WebVR.

Link copied to clipboard
var fog: Fog

Blends the atmosphere to geometry far from the camera for horizon views. Allows for additional performance improvements by rendering less geometry and dispatching less terrain requests.

Link copied to clipboard

The value used for gamma correction. This is only used when rendering with high dynamic range.

Link copied to clipboard

Gets or sets the depth-test ellipsoid.

Link copied to clipboard

Gets the collection of ground primitives.

Link copied to clipboard

Whether or not to use high dynamic range rendering.

Link copied to clipboard

Whether or not high dynamic range rendering is supported.

Link copied to clipboard
val id: String

Gets the unique identifier for this scene.

Link copied to clipboard

Gets the collection of image layers that will be rendered on the globe.

Link copied to clipboard

When false, 3D Tiles will render normally. When true, classified 3D Tile geometry will render normally and unclassified 3D Tile geometry will render with the color multiplied by Scene.invertClassificationColor.

Link copied to clipboard

The highlight color of unclassified 3D Tile geometry when Scene.invertClassification is true. When the color's alpha is less than 1.0, the unclassified portions of the 3D Tiles will not blend correctly with the classified positions of the 3D Tiles. Also, when the color's alpha is less than 1.0, the WEBGL_depth_texture and EXT_frag_depth WebGL extensions must be supported.

Link copied to clipboard
Link copied to clipboard

Gets the simulation time when the scene was last rendered. Returns undefined if the scene has not yet been rendered.

Link copied to clipboard

The light source for shading. Defaults to a directional light from the Sun.

Link copied to clipboard

Whether or not to use a logarithmic depth buffer. Enabling this option will allow for less frustums in the multi-frustum, increasing performance. This property relies on fragmentDepth being supported.

Link copied to clipboard

The far-to-near ratio of the multi-frustum when using a logarithmic depth buffer.

Link copied to clipboard

Determines if the 2D map is rotatable or can be scrolled infinitely in the horizontal direction.

Link copied to clipboard

Get the map projection to use in 2D and Columbus View modes.

Link copied to clipboard

The maximum aliased line width, in pixels, supported by this WebGL implementation. It will be at least one.

Link copied to clipboard

The maximum length in pixels of one edge of a cube map, supported by this WebGL implementation. It will be at least 16.

Link copied to clipboard

If Scene.requestRenderMode is true, this value defines the maximum change in simulation time allowed before a render is requested. Lower values increase the number of frames rendered and higher values decrease the number of frames rendered. If undefined, changes to the simulation time will never request a render. This value impacts the rate of rendering for changes in the scene like lighting, entity property updates, and animations.

Link copied to clipboard

The distance from the camera at which to disable the depth test of billboards, labels and points to, for example, prevent clipping against terrain. When set to zero, the depth test should always be applied. When less than zero, the depth test should never be applied. Setting the disableDepthTestDistance property of a billboard, label or point will override this value.

Link copied to clipboard

Gets or sets the current mode of the scene.

Link copied to clipboard
var moon: Moon

The Moon

Link copied to clipboard

The event fired at the completion of a scene transition.

Link copied to clipboard

The event fired at the beginning of a scene transition.

Link copied to clipboard

The current morph transition time between 2D/Columbus View and 3D, with 0.0 being 2D or Columbus View and 1.0 being 3D.

Link copied to clipboard

The sample rate of multisample antialiasing (values greater than 1 enable MSAA).

Link copied to clipboard

Returns true if the Scene's context supports MSAA.

Link copied to clipboard

Determines the uniform depth size in meters of each frustum of the multifrustum in 2D. If a primitive or model close to the surface shows z-fighting, decreasing this will eliminate the artifact, but decrease performance. On the other hand, increasing this will increase performance but may cause z-fighting among primitives close to the surface.

Link copied to clipboard

Gets whether or not the scene has order independent translucency enabled. Note that this only reflects the original construction option, and there are other factors that could prevent OIT from functioning on a given system configuration.

Link copied to clipboard

Returns true if the Scene.pickPosition function is supported.

Link copied to clipboard

When true, enables picking translucent geometry using the depth buffer. Note that Scene.useDepthPicking must also be true for enabling this to work.

Link copied to clipboard

Post processing effects applied to the final render.

Link copied to clipboard

Gets the event that will be raised immediately after the scene is rendered. Subscribers to the event receive the Scene instance as the first parameter and the current time as the second parameter.

Link copied to clipboard

Gets the event that will be raised immediately after the scene is updated and before the scene is rendered. Subscribers to the event receive the Scene instance as the first parameter and the current time as the second parameter.

Link copied to clipboard

Gets the event that will be raised after the scene is updated and immediately before the scene is rendered. Subscribers to the event receive the Scene instance as the first parameter and the current time as the second parameter.

Link copied to clipboard

Gets the event that will be raised before the scene is updated or rendered. Subscribers to the event receive the Scene instance as the first parameter and the current time as the second parameter.

Link copied to clipboard

Gets the collection of primitives.

Link copied to clipboard

Gets the event that will be raised when an error is thrown inside the render function. The Scene instance and the thrown error are the only two parameters passed to the event handler. By default, errors are not rethrown after this event is raised, but that can be changed by setting the rethrowRenderErrors property.

Link copied to clipboard

When true, rendering a frame will only occur when needed as determined by changes within the scene. Enabling improves performance of the application, but requires using Scene.requestRender to render a new frame explicitly in this mode. This will be necessary in many cases after making changes to the scene in other parts of the API.

Link copied to clipboard

Exceptions occurring in render are always caught in order to raise the renderError event. If this property is true, the error is rethrown after the event is raised. If this property is false, the render function returns normally after raising the event.

Link copied to clipboard

Returns true if the Scene.sampleHeight and Scene.sampleHeightMostDetailed functions are supported.

Link copied to clipboard

Gets whether or not the scene is optimized for 3D only viewing.

Link copied to clipboard

Gets the controller for camera input handling.

Link copied to clipboard

The shadow map for the scene's light source. When enabled, models, primitives, and the globe may cast and receive shadows.

Link copied to clipboard

The sky atmosphere drawn around the globe.

Link copied to clipboard

The SkyBox used to draw the stars.

Link copied to clipboard

The url to the KTX2 file containing the specular environment map and convoluted mipmaps for image-based lighting of PBR models.

Link copied to clipboard

Returns true if specular environment maps are supported.

Link copied to clipboard

The spherical harmonic coefficients for image-based lighting of PBR models.

Link copied to clipboard

Gets or sets the position of the splitter within the viewport. Valid values are between 0.0 and 1.0.

Link copied to clipboard
var sun: Sun

The Sun.

Link copied to clipboard

Uses a bloom filter on the sun when enabled.

Link copied to clipboard

The terrain provider providing surface geometry for the globe.

Link copied to clipboard

Gets an event that's raised when the terrain provider is changed

Link copied to clipboard

When true, enables picking using the depth buffer.

Link copied to clipboard

When true, splits the scene into two viewports with steroscopic views for the left and right eyes. Used for cardboard and WebVR.

Link copied to clipboard

The vertical exaggeration of the scene. When set to 1.0, no exaggeration is applied.

Link copied to clipboard

The reference height for vertical exaggeration of the scene. When set to 0.0, the exaggeration is applied relative to the ellipsoid surface.

Functions

Link copied to clipboard
fun cartesianToCanvasCoordinates(position: Cartesian3, result: Cartesian2? = definedExternally): Cartesian2

Transforms a position in cartesian coordinates to canvas coordinates. This is commonly used to place an HTML element at the same screen position as an object in the scene.

Link copied to clipboard
fun clampToHeight(cartesian: Cartesian3, objectsToExclude: ReadonlyArray<Any>? = definedExternally, width: Double? = definedExternally, result: Cartesian3? = definedExternally): Cartesian3

Clamps the given cartesian position to the scene geometry along the geodetic surface normal. Returns the clamped position or undefined if there was no scene geometry to clamp to. May be used to clamp objects to the globe, 3D Tiles, or primitives in the scene.

Link copied to clipboard
suspend fun clampToHeightMostDetailed(cartesians: ReadonlyArray<Cartesian3>, objectsToExclude: ReadonlyArray<Any>? = definedExternally, width: Double? = definedExternally): ReadonlyArray<Cartesian3>

Initiates an asynchronous Scene.clampToHeight query for an array of Cartesian3 positions using the maximum level of detail for 3D Tilesets in the scene. Returns a promise that is resolved when the query completes. Each position is modified in place. If a position cannot be clamped because no geometry can be sampled at that location, or another error occurs, the element in the array is set to undefined.

Link copied to clipboard
fun clampToHeightMostDetailedAsync(cartesians: ReadonlyArray<Cartesian3>, objectsToExclude: ReadonlyArray<Any>? = definedExternally, width: Double? = definedExternally): Promise<ReadonlyArray<Cartesian3>>
Link copied to clipboard

Instantly completes an active transition.

Link copied to clipboard
fun destroy()

Destroys the WebGL resources held by this object. Destroying an object allows for deterministic release of WebGL resources, instead of relying on the garbage collector to destroy this object.

Link copied to clipboard
fun drillPick(windowPosition: Cartesian2, limit: Double? = definedExternally, width: Double? = definedExternally, height: Double? = definedExternally): ReadonlyArray<Any>

Returns a list of objects, each containing a primitive property, for all primitives at a particular window coordinate position. Other properties may also be set depending on the type of primitive and may be used to further identify the picked object. The primitives in the list are ordered by their visual order in the scene (front to back).

Link copied to clipboard

Determines if a compressed texture format is supported.

Link copied to clipboard

Returns true if this object was destroyed; otherwise, false.

Link copied to clipboard
fun morphTo2D(duration: Double? = definedExternally)

Asynchronously transitions the scene to 2D.

Link copied to clipboard
fun morphTo3D(duration: Double? = definedExternally)

Asynchronously transitions the scene to 3D.

Link copied to clipboard
fun morphToColumbusView(duration: Double? = definedExternally)

Asynchronously transitions the scene to Columbus View.

Link copied to clipboard
fun pick(windowPosition: Cartesian2, width: Double? = definedExternally, height: Double? = definedExternally): Any

Returns an object with a primitive property that contains the first (top) primitive in the scene at a particular window coordinate or undefined if nothing is at the location. Other properties may potentially be set depending on the type of primitive and may be used to further identify the picked object.

Link copied to clipboard
fun pickMetadata(windowPosition: Cartesian2, schemaId: String?, className: String, propertyName: String): MetadataValue?

Pick a metadata value at the given window position.

Link copied to clipboard

Pick the schema of the metadata of the object at the given position

Link copied to clipboard
fun pickPosition(windowPosition: Cartesian2, result: Cartesian3? = definedExternally): Cartesian3

Returns the cartesian position reconstructed from the depth buffer and window position.

Link copied to clipboard
fun pickVoxel(windowPosition: Cartesian2, width: Double? = definedExternally, height: Double? = definedExternally): VoxelCell?

Returns a VoxelCell for the voxel sample rendered at a particular window coordinate, or undefined if no voxel is rendered at that position.

Link copied to clipboard
fun render(time: JulianDate? = definedExternally)

Update and render the scene. It is usually not necessary to call this function directly because CesiumWidget will do it automatically.

Link copied to clipboard

Requests a new rendered frame when Scene.requestRenderMode is set to true. The render rate will not exceed the CesiumWidget.targetFrameRate.

Link copied to clipboard
fun sampleHeight(position: Cartographic, objectsToExclude: ReadonlyArray<Any>? = definedExternally, width: Double? = definedExternally): Double

Returns the height of scene geometry at the given cartographic position or undefined if there was no scene geometry to sample height from. The height of the input position is ignored. May be used to clamp objects to the globe, 3D Tiles, or primitives in the scene.

Link copied to clipboard
suspend fun sampleHeightMostDetailed(positions: ReadonlyArray<Cartographic>, objectsToExclude: ReadonlyArray<Any>? = definedExternally, width: Double? = definedExternally): ReadonlyArray<Cartographic>

Initiates an asynchronous Scene.sampleHeight query for an array of Cartographic positions using the maximum level of detail for 3D Tilesets in the scene. The height of the input positions is ignored. Returns a promise that is resolved when the query completes. Each point height is modified in place. If a height cannot be determined because no geometry can be sampled at that location, or another error occurs, the height is set to undefined.

Link copied to clipboard
fun sampleHeightMostDetailedAsync(positions: ReadonlyArray<Cartographic>, objectsToExclude: ReadonlyArray<Any>? = definedExternally, width: Double? = definedExternally): Promise<ReadonlyArray<Cartographic>>
Link copied to clipboard
fun setTerrain(terrain: Terrain): Terrain

Update the terrain providing surface geometry for the globe.