ClippingPolygonCollection

Specifies a set of clipping polygons. Clipping polygons selectively disable rendering in a region inside or outside the specified list of ClippingPolygon objects for a single glTF model, 3D Tileset, or the globe.

Clipping Polygons are only supported in WebGL 2 contexts.

const positions = Cartesian3.fromRadiansArray([
-1.3194369277314022,
0.6988062530900625,
-1.31941,
0.69879,
-1.3193955980204217,
0.6988091578771254,
-1.3193931220959367,
0.698743632490865,
-1.3194358224045408,
0.6987471965556998,
]);

const polygon = new ClippingPolygon({
positions: positions
});

const polygons = new ClippingPolygonCollection({
polygons: [ polygon ]
});

See also

Constructors

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

Types

Link copied to clipboard
object Companion
Link copied to clipboard
sealed interface ConstructorOptions

Properties

Link copied to clipboard
val length: Int

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

Link copied to clipboard

An event triggered when a new clipping polygon is added to the collection. Event handlers are passed the new polygon and the index at which it was added.

Link copied to clipboard

An event triggered when a new clipping polygon is removed from the collection. Event handlers are passed the new polygon and the index from which it was removed.

Functions

Link copied to clipboard

Adds the specified ClippingPolygon to the collection to be used to selectively disable rendering on the inside of each polygon. Use ClippingPolygonCollection.unionClippingRegions to modify how modify the clipping behavior of multiple polygons.

Link copied to clipboard

Checks whether this collection contains a ClippingPolygon equal to the given ClippingPolygon.

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): ClippingPolygon

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

Link copied to clipboard

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

Link copied to clipboard

Removes the first occurrence of the given ClippingPolygon from the collection.

Link copied to clipboard
fun removeAll()

Removes all polygons from the collection.