ClippingPlaneCollection

指定一组剪切平面。剪切平面有选择地禁用单个GLTF模型、3D Tileset或球体的指定ClippingPlane对象列表外部区域的渲染。

通常,裁剪平面的坐标是相对于它们所附着的对象的,因此距离设置为0的平面将裁剪通过对象的中心。

对于3D瓦片,根瓦片的变换用于定位剪切平面。如果未定义转换,则使用根瓦片的BM3DTile#boundingSphere

new ClippingPlaneCollection(options)
Parameters:
options (Object)
Name Description
options.planes
Array.<ClippingPlane>
default []
ClippingPlane对象数组,用于选择性地禁用每个平面外部的渲染。
options.enabled
Boolean
default true
确定剪切平面是否处于活动状态。
options.modelMatrix
Matrix4
default Matrix4.IDENTITY
4x4变换矩阵,指定相对于裁剪平面原始坐标系的附加变换。
options.unionClippingRegions
Boolean
default false
如果为true,则如果区域位于集合中任何平面的外部,则该区域将被剪裁。否则,仅当区域位于每个平面的外部时,区域才会被剪裁。
options.edgeColor
Color
default Color.WHITE
用于突出显示对象沿其裁剪的边的颜色。
options.edgeWidth
Number
default 0.0
应用于对象剪切边缘的高光的宽度(以像素为单位)。
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.
var clippingPlanes = new bmgl.ClippingPlaneCollection({
    planes : [
        new bmgl.ClippingPlane(new bmgl.Cartesian3(0.0, 1.0, 0.0), 5.0)
    ],
});
// Create an entity and attach the ClippingPlaneCollection to the model.
var entity = viewer.entities.add({
    position : bmgl.Cartesian3.fromDegrees(-123.0744619, 44.0503706, 10000),
    model : {
        uri : 'model.gltf',
        minimumPixelSize : 128,
        maximumScale : 20000,
        clippingPlanes : clippingPlanes
    }
});
viewer.zoomTo(entity);

Members

edgeColor : Color

用于突出显示对象沿其裁剪的边的颜色。
Default Value: Color.WHITE

edgeWidth : Number

应用于对象剪切边缘的高光的宽度(以像素为单位)。
Default Value: 0.0

enabled : Boolean

如果为真,将启用剪辑。
Default Value: true

(readonly) length : Number

返回此集合中的平面数。这通常与ClippingPlaneCollection#get一起用于迭代集合中的所有平面。

modelMatrix : Matrix4

4x4变换矩阵,指定相对于裁剪平面原始坐标系的附加变换。
Default Value: Matrix4.IDENTITY

planeAdded : Event

将新剪切平面添加到集合时触发的事件。事件处理程序将传递新平面及其添加索引。
Default Value: Event()

planeRemoved : Event

从集合中删除新剪切平面时触发的事件。事件处理程序将传递新平面及其从中移除的索引。
Default Value: Event()

unionClippingRegions : Boolean

如果为true,则如果区域位于集合中任何平面的外部,则该区域将被剪裁。否则,仅当区域位于每个平面的外部时,区域才会被剪裁。
Default Value: false

Methods

add(plane)
将指定的ClippingPlane添加到集合中,用于选择性地禁用每个平面外部的渲染。使用ClippingPlaneCollection#unionClippingRegions修改如何修改多个平面的剪切行为。
Parameters:
plane (ClippingPlane) 要添加到集合中的ClippingPlane。
See:
contains(clippingPlane) → {Boolean}
检查此集合是否包含与给定clippingplane相等的clippingplane。
Parameters:
clippingPlane (ClippingPlane) 要检查的裁剪平面。
See:
destroy()
销毁此对象持有的WebGL资源。销毁对象允许确定地释放WebGL资源,而不是依赖垃圾收集器来销毁此对象。

一旦对象被破坏,就不应使用它;调用除isDestroyed以外的任何函数都将导致DeveloperError异常。因此,将返回值(undefined)赋给对象,如示例中所述。
Example
clippingPlanes = clippingPlanes && clippingPlanes .destroy();
Throws
See:
get(index) → {ClippingPlane}
返回集合中指定索引处的平面。索引以零为基础,并随着平面的添加而增加。删除一个平面后,所有平面都会向左移动,从而更改其索引。此函数通常与ClippingPlaneCollection#length一起用于迭代集合中的所有平面。
Parameters:
index (Number) 平面的零基索引。
See:
isDestroyed() → {Boolean}
如果此对象被破坏,则返回true;否则返回false。

如果此对象被破坏,则不应使用它;调用除isDestroyed以外的任何函数将导致DeveloperError异常。
See:
remove(clippingPlane) → {Boolean}
从集合中移除给定clippingplane的第一个匹配项。
Parameters:
clippingPlane (ClippingPlane)
See:
removeAll()
从集合中删除所有平面。
See:
update()
当渲染场景以生成裁剪平面的资源时调用。

不要直接调用此函数。