new Cesium.ClippingPlaneCollection(options)

指定一组剪辑机。 有选择地禁用计算机在区域中的渲染 outside of the specified list of ClippingPlane objects for a single gltf model, 3D Tileset, or the globe.

一般说来,剪机的座标是相对于它们附着的物体的,所以一个距离设定为0的平面会剪辑 穿过物体的中心.

对于3D平面,根瓦的变换用于定位剪切平面. 如果没有定义变换,则使用根牌的 Cesium3DTile#boundingSphere .

Name Type Description
options object optional 下列属性的对象 :
Name Type Default Description
planes Array.<ClippingPlane> [] optional An array of ClippingPlane objects used to selectively disable rendering on the outside of each plane.
enabled boolean true optional Determines whether the clipping planes are active.
modelMatrix Matrix4 Matrix4.IDENTITY optional The 4x4 transformation matrix specifying an additional transform relative to the clipping planes original coordinate system.
unionClippingRegions boolean false optional 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.
edgeColor Color Color.WHITE optional The color applied to highlight the edge along which an object is clipped.
edgeWidth number 0.0 optional 用像素表示的用于剪切对象的边缘的亮度的宽度.
Example:
// 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);
Demo:

Members

edgeColor : Color

用于突出剪切对象的边缘的颜色 .
Default Value: Color.WHITE

edgeWidth : number

用像素表示的用于剪切对象的边缘的亮度的宽度.
Default Value: 0.0

enabled : boolean

如果选中的话, 将会启用剪辑 .
Default Value: true

readonly length : number

返回此收藏中的飞机数量 。 这通常用于 ClippingPlaneCollection#get to iterate over all the planes 在收藏中.

modelMatrix : Matrix4

4x4 转换矩阵,指定相对于剪切平面的额外变换 原始坐标系统.
Default Value: Matrix4.IDENTITY

readonly planeAdded : Event

当新剪辑平面添加到收藏中时触发的事件. 事件处理器 被传递到新平面和添加该平面的索引.

readonly planeRemoved : Event

当从收藏中移除新的剪辑平面时触发的事件. 事件处理器 被传送到新平面及其删除的索引.

unionClippingRegions : boolean

如果是真的,如果一个区域位于该区的任何飞机的外侧,将会被剪切 藏书。 否则,一个区域只有处于 在每架飞机外.
Default Value: false

Methods

add(plane)

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 如何修改多架飞机的剪辑行为.
Name Type Description
plane ClippingPlane 克菲特普兰来加入收藏.
See:

contains(clippingPlane)boolean

检查此收藏是否包含一个与给定的 ClippingPlane 相等的 ClippingPlane .
Name Type Description
clippingPlane ClippingPlane optional 要检查的滑板.
Returns:
如果此收藏包含 ClippingPlane , 否则是虚假的 .
See:

destroy()

Destroys the WebGL resources held by this object. Destroying an object allows for deterministic 释放 WebGL 资源,而不是依赖垃圾收集器来摧毁此对象.

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.
Example:
clippingPlanes = clippingPlanes && clippingPlanes.destroy();
See:

get(index)ClippingPlane

在指定的索引中返回收藏中的平面。 指数为零 并随着飞机的增加而增加。 移除飞机后所有飞机 在左边,改变他们的指数。 此函数通常用于 ClippingPlaneCollection#length to iterate over all the planes 在收藏中.
Name Type Description
index number 平面零基指数.
Returns:
指定索引的剪贴板 .
See:

isDestroyed()boolean

如果此对象被销毁, 返回真实; 否则, 错误 .

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.
See:

remove(clippingPlane)boolean

从收藏中删除给定的剪贴板的首次出现.
Name Type Description
clippingPlane ClippingPlane
Returns:
如果该平面被移除,则使用 ;如果该平面未在收藏中找到,则使用 .
See:

removeAll()

从收藏中删除所有飞机.
See:

update()

Called when Viewer or CesiumWidget render the scene to 建立剪机资源.

不要直接调用此函数 .

Need help? The fastest way to get answers is from the community and team on the Cesium Forum.