| Name | Type | Description | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object |
|
Example:
import earcut from "earcut";
const collection = new BufferPolygonCollection({
primitiveCountMax: 1024,
vertexCountMax: 4096,
holeCountMax: 1024,
triangleCountMax: 2048,
});
const polygon = new BufferPolygon();
const positions = [ ... ];
const holes = [ ... ];
const material = new BufferPolygonMaterial({color: Color.WHITE});
// 创建新多边形,临时绑定到 'polygon' 局部变量。
collection.add({
positions: new Float64Array(positions),
holes: new Uint32Array(holes),
triangles: new Uint32Array(earcut(positions, holes, 3)),
material
}, polygon);
// 遍历集合中的所有多边形,将 'polygon' 局部变量临时绑定到每个多边形,
// 并更新多边形材质。
for (let i = 0; i < collection.primitiveCount; i++) {
collection.get(i, polygon);
polygon.setMaterial(material);
}
Experimental
此功能尚未最终确定,可能会在不遵循 Cesium 标准弃用政策的情况下进行更改。
See:
Extends
Members
此集合拥有的缓冲区的总字节长度。包括由
primitiveCountMax 分配的任何未使用空间,即使尚未在该空间中添加多边形。
集合中的孔数。必须 <=
holeCountMax。
集合中的最大孔数。必须 >=
holeCount。
-
Default Value:
BufferPrimitiveCollection.DEFAULT_CAPACITY
集合中的三角形数。必须 <=
triangleCountMax。
集合中的最大三角形数。必须 >=
triangleCount。
-
Default Value:
BufferPrimitiveCollection.DEFAULT_CAPACITY
Methods
static Cesium.BufferPolygonCollection.clone(collection, result) → BufferPolygonCollection
将此集合的内容复制到结果集合。
结果集合不调整大小,必须包含足够的空间以容纳源集合中的所有图元。
结果集合中的现有多边形将被覆盖。
在为已达到容量的集合分配更多空间, 并将多边形高效转移到新集合时非常有用。
| Name | Type | Description |
|---|---|---|
collection |
BufferPolygonCollection | |
result |
BufferPolygonCollection |
Returns:
Example:
const result = new BufferPolygonCollection({ ... }); // 分配更大的 'result' 集合
BufferPolygonCollection.clone(collection, result); // 将 'collection' 中的多边形复制到 'result'
add(options, result) → BufferPolygon
向集合添加新多边形,并指定选项。
BufferPolygon 实例链接到新多边形,使用 'result' 参数(如果提供),
否则使用新实例。对于重复调用,建议重用单个 BufferPolygon 实例,
而不是在每次调用时分配新实例。
| Name | Type | Description |
|---|---|---|
options |
BufferPolygonOptions | |
result |
BufferPolygon |
