Model

external class Model(source)
To construct a Model, call [Model.fromGltfAsync]. Do not call the constructor directly.
A 3D model based on glTF, the runtime asset format for WebGL, OpenGL ES, and OpenGL.

Cesium supports glTF assets with the following extensions:

Note: for models with compressed textures using the KHR_texture_basisu extension, we recommend power of 2 textures in both dimensions for maximum compatibility. This is because some samplers require power of 2 textures (Using textures in WebGL) and KHR_texture_basisu requires multiple of 4 dimensions (KHR_texture_basisu additional requirements).

See also

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

The currently playing glTF animations.

Link copied to clipboard

Whether to cull back-facing geometry. When true, back face culling is determined by the material's doubleSided property; when false, back face culling is disabled. Back faces are not culled if Model.color is translucent or Model.silhouetteSize is greater than 0.0.

Link copied to clipboard

Gets the model's bounding sphere in world space. This does not take into account glTF animations, skins, or morph targets. It also does not account for Model.minimumPixelSize.

Link copied to clipboard

Determines if the model's animations should hold a pose over frames where no keyframes are specified.

Link copied to clipboard

Gets the model's classification type. This determines whether terrain, 3D Tiles, or both will be classified by this model.

Link copied to clipboard

The ClippingPlaneCollection used to selectively disable rendering the model.

Link copied to clipboard

The ClippingPolygonCollection used to selectively disable rendering the model.

Link copied to clipboard

The color to blend with the model's rendered color.

Link copied to clipboard

Value used to determine the color strength when the colorBlendMode is MIX. A value of 0.0 results in the model's rendered color while a value of 1.0 results in a solid color, with any value in-between resulting in a mix of the two.

Link copied to clipboard

Defines how the color blends with the model.

Link copied to clipboard

Gets the credit that will be displayed for the model.

Link copied to clipboard

The model's custom shader, if it exists. Using custom shaders with a Cesium3DTileStyle may lead to undefined behavior.

Link copied to clipboard

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

Link copied to clipboard

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

Link copied to clipboard

Gets or sets the distance display condition, which specifies at what distance from the camera this model will be displayed.

Link copied to clipboard

If true, the model is exaggerated along the ellipsoid normal when Scene.verticalExaggeration is set to a value other than 1.0.

Link copied to clipboard

The properties for managing dynamic environment maps on this model. Affects lighting.

Link copied to clipboard

Gets an event that is raised when the model encounters an asynchronous rendering 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 ModelError.

Link copied to clipboard

Label of the feature ID set to use for picking and styling.

Link copied to clipboard

The height reference of the model, which determines how the model is drawn relative to terrain.

Link copied to clipboard
var id: Any

A user-defined object that is returned when the model is picked.

Link copied to clipboard

The properties for managing image-based lighting on this model.

Link copied to clipboard

Label of the instance feature ID set used for picking and styling.

Link copied to clipboard

The directional light color when shading the model. When undefined the scene's light color is used instead.

Link copied to clipboard

The maximum scale size for a model. This can be used to give an upper limit to the Model.minimumPixelSize, ensuring that the model is never an unreasonable scale.

Link copied to clipboard

The approximate minimum pixel size of the model regardless of zoom. This can be used to ensure that a model is visible even when the viewer zooms out. When 0.0, no minimum size is enforced.

Link copied to clipboard

The 4x4 transformation matrix that transforms the model from model to world coordinates. When this is the identity matrix, the model is drawn in world coordinates, i.e., Earth's Cartesian WGS84 coordinates. Local reference frames can be used by providing a different transformation matrix, like that returned by Transforms.eastNorthUpToFixedFrame.

Link copied to clipboard

The color to use when rendering outlines.

Link copied to clipboard

Point cloud shading settings for controlling point cloud attenuation and lighting. For 3D Tiles, this is inherited from the Cesium3DTileset.

Link copied to clipboard

When true, this model is ready to render, i.e., the external binary, image, and shader files were downloaded and the WebGL resources were created.

Link copied to clipboard

Gets an event that is raised when the model is loaded and ready for rendering, i.e. when the external resources have been downloaded and the WebGL resources are created. Event listeners are passed an instance of the Model.

Link copied to clipboard

A uniform scale applied to this model before the Model.modelMatrix. Values greater than 1.0 increase the size of the model; values less than 1.0 decrease.

Link copied to clipboard

Determines whether the model casts or receives shadows from light sources.

Link copied to clipboard

Whether or not to render the model.

Link copied to clipboard

Gets or sets whether the credits of the model will be displayed on the screen.

Link copied to clipboard

Whether to display the outline for models using the CESIUM_primitive_outline extension. When true, outlines are displayed. When false, outlines are not displayed.

Link copied to clipboard

The silhouette color.

Link copied to clipboard

The size of the silhouette in pixels.

Link copied to clipboard

The SplitDirection to apply to this model.

Link copied to clipboard

The style to apply to the features in the model. Cannot be applied if a CustomShader is also applied.

Link copied to clipboard

Gets an event that, if Model.incrementallyLoadTextures is true, is raised when the model textures are loaded and ready for rendering, i.e. when the external resources have been downloaded and the WebGL resources are created. Event listeners are passed an instance of the Model.

Functions

Link copied to clipboard

Applies any modified articulation stages to the matrix of each node that participates in any articulation. Note that this will overwrite any node transformations on participating nodes.

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 getExtension(extensionName: String): Any?

Returns the object that was created for the given extension.

Link copied to clipboard

Returns the node with the given name in the glTF. This is used to modify a node's transform for user-defined animation.

Link copied to clipboard

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

Link copied to clipboard

Marks the model's Model.style as dirty, which forces all features to re-evaluate the style in the next frame the model is visible.

Link copied to clipboard
fun setArticulationStage(articulationStageKey: String, value: Double)

Sets the current value of an articulation stage. After setting one or multiple stage values, call Model.applyArticulations() to cause the node matrices to be recalculated.

Link copied to clipboard
fun update()

Called when Viewer or CesiumWidget render the scene to get the draw commands needed to render this primitive.