BufferPointCollection
Cesium v1.147 · 中文

为优化性能和内存使用,点集存储在 ArrayBuffer 中。

默认的缓冲区内存分配是任意的,且无法调整大小, 因此应在集合中指定每个缓冲区的容量。 当构造函数可用时。

new Cesium.BufferPointCollection(options)

Name Type Description
options object
Name Type Default Description
modelMatrix Matrix4 Matrix4.IDENTITY optional 将几何图形从模型坐标转换为世界坐标。
primitiveCountMax number BufferPrimitiveCollection.DEFAULT_CAPACITY optional
positionDatatype ComponentDatatype ComponentDatatype.DOUBLE optional
positionNormalized boolean false optional
show boolean true optional
allowPicking boolean false optional 当 true 时,原语可通过 Scene#pick 选择。当 false 时,内存和初始化成本更低。
boundingVolume BoundingSphere optional 集合在世界空间中的边界体积。当 未指定时,边界体积自动计算并在原语位置变化时更新。当 指定时,用户需负责根据需求更新边界体积。手动预计算边界体积 并仅按需更新,可提升大型动态集合的性能。
debugShowBoundingVolume boolean false optional
blendOption BlendOption BlendOption.TRANSLUCENT optional 决定集合中的原语如何与场景混合。必须是 BlendOption.OPAQUE 或 BlendOption.TRANSLUCENT;不支持 BlendOption.OPAQUE_AND_TRANSLUCENT。
Example:
const collection = new BufferPointCollection({primitiveCountMax: 1024});

const point = new BufferPoint();
const material = new BufferPointMaterial({color: Color.WHITE});

// 创建新点,暂时绑定到 'point' 局部变量。
collection.add({
position: new Cartesian3(0.0, 0.0, 0.0),
material
}, point);

// 遍历集合中的所有点,暂时将 'point'
// 局部变量绑定到每个点,并更新点材质。
for (let i = 0; i < collection.primitiveCount; i++) {
collection.get(i, point);
point.setMaterial(material);
}
Experimental

This 该特性尚未最终确定,可能根据 Cesium 的标准弃用政策发生变化。

See:

Extends

Methods

根据指定选项向集合添加新点。一个 BufferPoint 实例与新点关联,如果提供 'result' 参数则使用该值,否则创建新实例。对于重复 the 'result' argument if given, or a new instance if not. For repeated 调用,最好重用单个 BufferPoint 实例,而不是 每次调用时都分配新实例。
Name Type Description
options BufferPointOptions
result BufferPoint
Returns:

setPositions(positions, primitiveOffset, primitiveCount)

在指定的原语范围内更新顶点位置。对于 仅位置更新的多个原语,使用 `setPositions()` 更为高效。 比单独更新每个primitive更高效。 参数 `positions` 必须包含与 目标primitive范围相同的顶点总数;此方法不能添加或移除顶点。
Name Type Description
positions TypedArray
primitiveOffset number
primitiveCount number
Need help? The fastest way to get answers is from the community and team on the Cesium Forum.