BillboardCollection

external class BillboardCollection(options: BillboardCollection.ConstructorOptions? = definedExternally)(source)

A renderable collection of billboards. Billboards are viewport-aligned images positioned in the 3D scene.

Billboards are added and removed from the collection using BillboardCollection.add and BillboardCollection.remove. Billboards in a collection automatically share textures for images with the same identifier.

// Create a billboard collection with two billboards
const billboards = scene.primitives.add(new BillboardCollection());
billboards.add({
position : new Cartesian3(1.0, 2.0, 3.0),
image : 'url/to/image'
});
billboards.add({
position : new Cartesian3(4.0, 5.0, 6.0),
image : 'url/to/another/image'
});

See also

Constructors

Link copied to clipboard
constructor(options: BillboardCollection.ConstructorOptions? = definedExternally)

Types

Link copied to clipboard
sealed interface ConstructorOptions

Properties

Link copied to clipboard

The billboard blending option. The default is used for rendering both opaque and translucent billboards. However, if either all of the billboards are completely opaque or all are completely translucent, setting the technique to BlendOption.OPAQUE or BlendOption.TRANSLUCENT can improve performance by up to 2x.

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
var length: Int

Returns the number of billboards in this collection. This is commonly used with BillboardCollection.get to iterate over all the billboards in the collection.

Link copied to clipboard

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

Link copied to clipboard

Determines if billboards in this collection will be shown.

Functions

Link copied to clipboard
fun add(options: Billboard.ConstructorOptions? = definedExternally): Billboard

Creates and adds a billboard with the specified initial properties to the collection. The added billboard is returned so it can be modified or removed from the collection later.

Link copied to clipboard
fun contains(billboard: Billboard? = definedExternally): Boolean

Check whether this collection contains a given billboard.

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
operator fun get(index: Int): Billboard

Returns the billboard in the collection at the specified index. Indices are zero-based and increase as billboards are added. Removing a billboard shifts all billboards after it to the left, changing their indices. This function is commonly used with BillboardCollection.length to iterate over all the billboards in the collection.

Link copied to clipboard

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

Link copied to clipboard
fun remove(billboard: Billboard): Boolean

Removes a billboard from the collection.

Link copied to clipboard
fun removeAll()

Removes all billboards from the collection.

Link copied to clipboard
fun update()

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