Billboard

external class Billboard(source)
A billboard is created and its initial properties are set by calling [BillboardCollection.add]. Do not call the constructor directly.
A viewport-aligned image positioned in the 3D scene, that is created and rendered using a [BillboardCollection].

Parameters

billboardCollection

Instance of BillboardCollection

See also

Types

Link copied to clipboard
sealed interface ConstructorOptions

Initialization options for the first param of Billboard constructor

Properties

Link copied to clipboard

Gets or sets the aligned axis in world space. The aligned axis is the unit vector that the billboard up vector points towards. The default is the zero vector, which means the billboard is aligned to the screen up vector.

Link copied to clipboard

Gets or sets the color that is multiplied with the billboard's texture. This has two common use cases. First, the same white texture may be used by many different billboards, each with a different color, to create colored billboards. Second, the color's alpha component can be used to make the billboard translucent as shown below. An alpha of 0.0 makes the billboard transparent, and 1.0 makes the billboard opaque.

Link copied to clipboard

Gets or sets the distance from the camera at which to disable the depth test to, for example, prevent clipping against terrain. When set to zero, the depth test is always applied. When set to Number.POSITIVE_INFINITY, the depth test is never applied.

Link copied to clipboard

Gets or sets the condition specifying at what distance from the camera that this billboard will be displayed.

Link copied to clipboard

Gets or sets the 3D Cartesian offset applied to this billboard in eye coordinates. Eye coordinates is a left-handed coordinate system, where x points towards the viewer's right, y points up, and z points into the screen. Eye coordinates use the same scale as world and model coordinates, which is typically meters.

Link copied to clipboard

Gets or sets a height for the billboard. If undefined, the image height will be used.

Link copied to clipboard

Gets or sets the height reference of this billboard.

Link copied to clipboard

Gets or sets the horizontal origin of this billboard, which determines if the billboard is to the left, center, or right of its anchor position.

Link copied to clipboard
var id: Any

Gets or sets the user-defined object returned when the billboard is picked.

Link copied to clipboard

Gets or sets the image to be used for this billboard. If a texture has already been created for the given image, the existing texture is used.

Link copied to clipboard

Gets or sets the pixel offset in screen space from the origin of this billboard. This is commonly used to align multiple billboards and labels at the same position, e.g., an image and text. The screen space origin is the top, left corner of the canvas; x increases from left to right, and y increases from top to bottom.

Link copied to clipboard

Gets or sets near and far pixel offset scaling properties of a Billboard based on the billboard's distance from the camera. A billboard's pixel offset will be scaled between the NearFarScalar.nearValue and NearFarScalar.farValue while the camera distance falls within the lower and upper bounds of the specified NearFarScalar.near and NearFarScalar.far. Outside of these ranges the billboard's pixel offset scale remains clamped to the nearest bound. If undefined, pixelOffsetScaleByDistance will be disabled.

Link copied to clipboard

Gets or sets the Cartesian position of this billboard.

Link copied to clipboard

When true, this billboard is ready to render, i.e., the image has been downloaded and the WebGL resources are created.

Link copied to clipboard

Gets or sets the rotation angle in radians.

Link copied to clipboard

Gets or sets the uniform scale that is multiplied with the billboard's image size in pixels. A scale of 1.0 does not change the size of the billboard; a scale greater than 1.0 enlarges the billboard; a positive scale less than 1.0 shrinks the billboard.

Link copied to clipboard

Gets or sets near and far scaling properties of a Billboard based on the billboard's distance from the camera. A billboard's scale will interpolate between the NearFarScalar.nearValue and NearFarScalar.farValue while the camera distance falls within the lower and upper bounds of the specified NearFarScalar.near and NearFarScalar.far. Outside of these ranges the billboard's scale remains clamped to the nearest bound. If undefined, scaleByDistance will be disabled.

Link copied to clipboard

Determines if this billboard will be shown. Use this to hide or show a billboard, instead of removing it and re-adding it to the collection.

Link copied to clipboard

Gets or sets if the billboard size is in meters or pixels. true to size the billboard in meters; otherwise, the size is in pixels.

Link copied to clipboard

Gets or sets the SplitDirection of this billboard.

Link copied to clipboard

Gets or sets near and far translucency properties of a Billboard based on the billboard's distance from the camera. A billboard's translucency will interpolate between the NearFarScalar.nearValue and NearFarScalar.farValue while the camera distance falls within the lower and upper bounds of the specified NearFarScalar.near and NearFarScalar.far. Outside of these ranges the billboard's translucency remains clamped to the nearest bound. If undefined, translucencyByDistance will be disabled.

Link copied to clipboard

Gets or sets the vertical origin of this billboard, which determines if the billboard is to the above, below, or at the center of its anchor position.

Link copied to clipboard

Gets or sets a width for the billboard. If undefined, the image width will be used.

Functions

Link copied to clipboard
fun computeScreenSpacePosition(scene: Scene, result: Cartesian2? = definedExternally): Cartesian2

Computes the screen-space position of the billboard's origin, taking into account eye and pixel offsets. The screen space origin is the top, left corner of the canvas; x increases from left to right, and y increases from top to bottom.

Link copied to clipboard
fun setImage(id: String, image: Resource)
fun setImage(id: String, image: String)

Sets the image to be used for this billboard. If a texture has already been created for the given id, the existing texture is used.

Link copied to clipboard

Uses a sub-region of the image with the given id as the image for this billboard, measured in pixels from the bottom-left.