指定一組剪切平面。剪切平面有選擇地禁用單個GLTF模型、3D Tileset或球體的指定
new ClippingPlaneCollection(options)
ClippingPlane
對象列表外部區域的渲染。通常,裁剪平面的坐標是相對于它們所附著的對象的,因此距離設置為0的平面將裁剪通過對象的中心。
對于3D瓦片,根瓦片的變換用于定位剪切平面。如果未定義轉換,則使用根瓦片的BM3DTile#boundingSphere
。
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:
See:
檢查此集合是否包含與給定clippingplane相等的clippingplane。
Parameters:
銷毀此對象持有的WebGL資源。銷毀對象允許確定地釋放WebGL資源,而不是依賴垃圾收集器來銷毀此對象。
一旦對象被破壞,就不應使用它;調用除
一旦對象被破壞,就不應使用它;調用除
isDestroyed
以外的任何函數都將導致DeveloperError
異常。因此,將返回值(undefined
)賦給對象,如示例中所述。
Throws
-
DeveloperError : 此對象已被銷毀,即調用destroy()。
返回集合中指定索引處的平面。索引以零為基礎,并隨著平面的添加而增加。刪除一個平面后,所有平面都會向左移動,從而更改其索引。此函數通常與
ClippingPlaneCollection#length
一起用于迭代集合中的所有平面。
Parameters:
index
(Number)
平面的零基索引。
從集合中移除給定clippingplane的第一個匹配項。
Parameters:
clippingPlane
(ClippingPlane)
從集合中刪除所有平面。
update()
當渲染場景以生成裁剪平面的資源時調用。
不要直接調用此函數。