指定一组裁剪平面。裁剪平面会选择性地禁用单个 gltf 模型、3D Tileset 或地球上、位于
ClippingPlane 对象指定列表外部区域的渲染。
通常,裁剪平面的坐标是相对于其所附加的对象的,因此距离设为 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
readonly planeAdded : Event
当新的裁剪平面被添加到集合时触发的事件。事件处理程序
会收到新平面以及它被添加到的索引。
readonly planeRemoved : 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。
从集合中移除所有平面。
