BillboardCollection
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
Types
Properties
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.
The distance from the camera, beyond which, billboards are depth-tested against an approximation of the globe ellipsoid rather than against the full globe depth buffer. When set to 0, the approximate depth test is always applied. When set to Number.POSITIVE_INFINITY, the approximate depth test is never applied.
This setting only applies when a billboard's Billboard.disableDepthTestDistance value would otherwise allow depth testing—i.e., distance from the camera to the billboard is less than a billboard's Billboard.disableDepthTestDistance value.
This property is for debugging only; it is not for production use nor is it optimized.
This property is for debugging only; it is not for production use nor is it optimized.
Returns the number of billboards in this collection. This is commonly used with BillboardCollection.get to iterate over all the billboards in the collection.
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.
The distance from the camera, within which, billboards with a Billboard.heightReference value of HeightReference.CLAMP_TO_GROUND or HeightReference.CLAMP_TO_TERRAIN are depth tested against three key points. This ensures that if any key point of the billboard is visible, the whole billboard will be visible. When set to 0, this feature is disabled and portions of a billboards behind terrain be clipped.
This setting only applies when a billboard's Billboard.disableDepthTestDistance value would otherwise allow depth testing—i.e., distance from the camera to the billboard is less than a billboard's Billboard.disableDepthTestDistance value.
Functions
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.
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.
Returns true if this object was destroyed; otherwise, false.
Called when Viewer or CesiumWidget render the scene to get the draw commands needed to render this primitive.