Skip to content

KBE3D / KBCore / Cesium / ClippingPlaneCollection

类: ClippingPlaneCollection

Specifies a set of clipping planes. Clipping planes selectively disable rendering in a region on the outside of the specified list of ClippingPlane objects for a single gltf model, 3D Tileset, or the globe. <p> In general the clipping planes' coordinates are relative to the object they're attached to, so a plane with distance set to 0 will clip through the center of the object. </p> <p> For 3D Tiles, the root tile's transform is used to position the clipping planes. If a transform is not defined, the root tile's Cesium3DTile#boundingSphere is used instead. </p>

示例

ts
// This clipping plane's distance is positive, which means its normal
// is facing the origin. This will clip everything that is behind
// the plane, which is anything with y coordinate < -5.
const clippingPlanes = new Cesium.ClippingPlaneCollection({
    planes : [
        new Cesium.ClippingPlane(new Cesium.Cartesian3(0.0, 1.0, 0.0), 5.0)
    ],
});
// Create an entity and attach the ClippingPlaneCollection to the model.
const entity = viewer.entities.add({
    position : Cesium.Cartesian3.fromDegrees(-123.0744619, 44.0503706, 10000),
    model : {
        uri : 'model.gltf',
        minimumPixelSize : 128,
        maximumScale : 20000,
        clippingPlanes : clippingPlanes
    }
});
viewer.zoomTo(entity);

参数

Object with the following properties:

参数

An array of ClippingPlane objects used to selectively disable rendering on the outside of each plane.

参数

Determines whether the clipping planes are active.

参数

The 4x4 transformation matrix specifying an additional transform relative to the clipping planes original coordinate system.

参数

If true, a region will be clipped if it is on the outside of any plane in the collection. Otherwise, a region will only be clipped if it is on the outside of every plane.

参数

The color applied to highlight the edge along which an object is clipped.

参数

The width, in pixels, of the highlight applied to the edge along which an object is clipped.

属性

modelMatrix

modelMatrix: Matrix4

The 4x4 transformation matrix specifying an additional transform relative to the clipping planes original coordinate system.


edgeColor

edgeColor: Color

The color applied to highlight the edge along which an object is clipped.


edgeWidth

edgeWidth: number

The width, in pixels, of the highlight applied to the edge along which an object is clipped.


planeAdded

readonly planeAdded: Event

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


planeRemoved

readonly planeRemoved: Event

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


length

readonly length: number

Returns the number of planes in this collection. This is commonly used with ClippingPlaneCollection#get to iterate over all the planes in the collection.


unionClippingRegions

unionClippingRegions: boolean

If true, a region will be clipped if it is on the outside of any plane in the collection. Otherwise, a region will only be clipped if it is on the outside of every plane.


enabled

enabled: boolean

If true, clipping will be enabled.

方法

add()

add(plane: ClippingPlane): void

Adds the specified ClippingPlane to the collection to be used to selectively disable rendering on the outside of each plane. Use ClippingPlaneCollection#unionClippingRegions to modify how modify the clipping behavior of multiple planes.

参数

plane

ClippingPlane

The ClippingPlane to add to the collection.

返回

void


get()

get(index: number): ClippingPlane

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

参数

index

number

The zero-based index of the plane.

返回

ClippingPlane

The ClippingPlane at the specified index.


contains()

contains(clippingPlane?: ClippingPlane): boolean

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

参数

clippingPlane?

ClippingPlane

The ClippingPlane to check for.

返回

boolean

true if this collection contains the ClippingPlane, false otherwise.


remove()

remove(clippingPlane: ClippingPlane): boolean

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

参数

clippingPlane

ClippingPlane

返回

boolean

true if the plane was removed; false if the plane was not found in the collection.


removeAll()

removeAll(): void

Removes all planes from the collection.

返回

void


update()

update(): void

Called when Viewer or CesiumWidget render the scene to build the resources for clipping planes. <p> Do not call this function directly. </p>

返回

void


isDestroyed()

isDestroyed(): boolean

Returns true if this object was destroyed; otherwise, false. <br /><br /> If this object was destroyed, it should not be used; calling any function other than <code>isDestroyed</code> will result in a DeveloperError exception.

返回

boolean

true if this object was destroyed; otherwise, false.


destroy()

destroy(): void

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. <br /><br /> Once an object is destroyed, it should not be used; calling any function other than <code>isDestroyed</code> will result in a DeveloperError exception. Therefore, assign the return value (<code>undefined</code>) to the object as done in the example.

返回

void

示例

ts
clippingPlanes = clippingPlanes && clippingPlanes.destroy();

构造函数

构造函数

new ClippingPlaneCollection(options?: { planes?: ClippingPlane[]; enabled?: boolean; modelMatrix?: Matrix4; unionClippingRegions?: boolean; edgeColor?: Color; edgeWidth?: number; }): ClippingPlaneCollection

参数

options?
planes?

ClippingPlane[]

enabled?

boolean

modelMatrix?

Matrix4

unionClippingRegions?

boolean

edgeColor?

Color

edgeWidth?

number

返回

ClippingPlaneCollection

KBE3D @3.0.0 Copyright © 2024-present KBE3D