指定一组裁剪平面。裁剪平面选择性地禁用对单个gltf模型、3D Tileset或地球的外部区域的渲染。
通常情况下,裁剪平面的坐标是相对于它们所附加的对象的,因此距离设置为0的平面将裁剪穿过对象的中心。
对于3D Tiles,使用根瓦片的变换来定位裁剪平面。如果未定义变换,则使用根瓦片的Cesium3DTile#boundingSphere。
| Name | Type | Description | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object |
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
应用于突出显示对象被裁剪的边缘的颜色。
-
Default Value:
Color.WHITE
应用于突出显示对象被裁剪的边缘的宽度,以像素为单位。
-
Default Value:
0.0
如果为true,裁剪将被启用。
-
Default Value:
true
返回此集合中的平面数量。通常与
ClippingPlaneCollection#get一起使用,以遍历集合中的所有平面。
modelMatrix : Matrix4
指定相对于裁剪平面原始坐标系统的附加变换的4x4变换矩阵。
-
Default Value:
Matrix4.IDENTITY
planeAdded : Event
当新裁剪平面被添加到集合中时触发的事件。事件处理程序会传递新平面及其被添加的索引。
-
Default Value:
Event()
planeRemoved : Event
当新裁剪平面从集合中移除时触发的事件。事件处理程序会传递被移除的平面及其被移除的索引。
-
Default Value:
Event()
如果为true,则如果区域位于集合中任何平面的外部,则该区域将被裁剪。否则,只有当区域位于所有平面的外部时,才会被裁剪。
-
Default Value:
false
Methods
将指定的
ClippingPlane添加到集合中,以选择性地禁用每个平面外部区域的渲染。使用ClippingPlaneCollection#unionClippingRegions修改多个平面的裁剪行为。
| Name | Type | Description |
|---|---|---|
plane |
ClippingPlane | 要添加到集合中的ClippingPlane。 |
See:
检查此集合是否包含与给定ClippingPlane相等的ClippingPlane。
| Name | Type | Description |
|---|---|---|
clippingPlane |
ClippingPlane | optional 要检查的ClippingPlane。 |
Returns:
如果此集合包含该ClippingPlane,则返回true,否则返回false。
销毁此对象持有的WebGL资源。销毁对象允许确定性地释放WebGL资源,而不是依赖垃圾收集器来销毁此对象。
一旦对象被销毁,它就不应再被使用;调用
一旦对象被销毁,它就不应再被使用;调用
isDestroyed以外的任何函数都将导致DeveloperError异常。因此,将返回值(undefined)赋给对象,如示例所示。
Throws:
-
DeveloperError : 此对象已被销毁,即destroy()已被调用。
Example:
clippingPlanes = clippingPlanes && clippingPlanes.destroy();
See:
返回集合中指定索引处的平面。索引从零开始,随着平面的添加而增加。移除平面会将该平面之后的所有平面向左移动,改变它们的索引。此函数通常与
ClippingPlaneCollection#length一起使用,以遍历集合中的所有平面。
| Name | Type | Description |
|---|---|---|
index |
number | 平面的零基索引。 |
Returns:
指定索引处的ClippingPlane。
Returns:
如果此对象已被销毁,则返回
true;否则返回false。
从集合中移除给定ClippingPlane的首次出现。
| Name | Type | Description |
|---|---|---|
clippingPlane |
ClippingPlane |
Returns:
如果平面被移除,则返回
true;如果平面未在集合中找到,则返回false。
从集合中移除所有平面。
