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.
| Name |
Type |
Description |
options |
object
|
optional
Object with the following properties:
| Name |
Type |
Default |
Description |
polygons |
Array.<ClippingPolygon>
|
[]
|
optional
An array of ClippingPolygon objects used to selectively disable rendering on the inside of each polygon. |
enabled |
boolean
|
true
|
optional
Determines whether the clipping polygons are active. |
inverse |
boolean
|
false
|
optional
If true, a region will be clipped if it is outside of every polygon in the collection. Otherwise, a region will only be clipped if it is on the inside of any polygon. |
quality |
number
|
1.0
|
optional
A scalar that controls the resolution of the signed distance texture used for clipping. Values greater than 1.0 increase quality, values less than 1.0 decrease it. Must be greater than 0.0. Deprecated in CesiumJS 1.145 and will be removed in 1.147. Signed distance field clipping was replaced with vector clipping, so this option no longer has any effect. |
ellipsoid |
Ellipsoid
|
Ellipsoid.default
|
optional
The ellipsoid to use to project the clipping polygons onto the globe. |
|
Example:
const positions = Cesium.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 Cesium.ClippingPolygon({
positions: positions
});
const polygons = new Cesium.ClippingPolygonCollection({
polygons: [ polygon ]
});
Members
If true, a debug texture visualizing the signed distance field is shown.
This property was deprecated in CesiumJS 1.145 and will be removed in 1.147. Signed distance field clipping was replaced with vector clipping, so this property no longer has any effect.
false
The ellipsoid to use to project the clipping polygons onto the globe.
Ellipsoid.default
If true, clipping will be enabled.
true
If true, a region will be clipped if it is outside of every polygon in the
collection. Otherwise, a region will only be clipped if it is
inside of any polygon.
false
Returns the number of polygons in this collection. This is commonly used with
ClippingPolygonCollection#get to iterate over all the polygons
in the collection.
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.
Event()
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.
Event()
A scalar that controlled the resolution of the signed distance texture used for clipping.
This property was deprecated in CesiumJS 1.145 and will be removed in 1.147. Signed distance field clipping was replaced with vector clipping, so this property no longer has any effect.
1.0
Methods
Function for checking if the context will allow clipping polygons, which require floating point textures.
| Name |
Type |
Description |
scene |
Scene
|
object
|
The scene that will contain clipped objects and clipping textures. |
Returns:
true if the context supports clipping polygons.
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.
| Name |
Type |
Description |
polygon |
ClippingPolygon
|
The ClippingPolygon to add to the collection. |
Returns:
The added ClippingPolygon.
Example:
const polygons = new Cesium.ClippingPolygonCollection();
const positions = Cesium.Cartesian3.fromRadiansArray([
-1.3194369277314022,
0.6988062530900625,
-1.31941,
0.69879,
-1.3193955980204217,
0.6988091578771254,
-1.3193931220959367,
0.698743632490865,
-1.3194358224045408,
0.6987471965556998,
]);
polygons.add(new Cesium.ClippingPolygon({
positions: positions
}));
See:
Checks whether this collection contains a ClippingPolygon equal to the given ClippingPolygon.
| Name |
Type |
Description |
polygon |
ClippingPolygon
|
The ClippingPolygon to check for. |
Returns:
true if this collection contains the ClippingPolygon, false otherwise.
See:
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.
Once an object is destroyed, it should not be used; calling any function other than
isDestroyed will result in a
DeveloperError exception. Therefore,
assign the return value (
undefined) to the object as done in the example.
Throws:
-
DeveloperError
: This object was destroyed, i.e., destroy() was called.
This function was deprecated in CesiumJS 1.145 and will be removed in 1.147. The collection no longer holds any GPU resources of its own, so it does not need to be destroyed.
Example:
clippingPolygons = clippingPolygons && clippingPolygons.destroy();
See:
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.
| Name |
Type |
Description |
index |
number
|
The zero-based index of the polygon. |
Returns:
The ClippingPolygon at the specified index.
See:
Returns true if this object was destroyed; otherwise, false.
If this object was destroyed, it should not be used; calling any function other than
isDestroyed will result in a
DeveloperError exception.
Returns:
true if this object was destroyed; otherwise, false.
This function was deprecated in CesiumJS 1.145 and will be removed in 1.147. The collection no longer holds any GPU resources of its own, so it does not need to be destroyed.
See:
Removes the first occurrence of the given ClippingPolygon from the collection.
Returns:
true if the polygon was removed; false if the polygon was not found in the collection.
See:
Removes all polygons from the collection.
See: