| Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object |
|
Experimental
此功能尚未最终确定,可能会在不遵循 Cesium 标准弃用策略的情况下进行更改。
See:
Members
新集合上缓冲区的默认容量。元素数量:顶点缓冲区中的顶点数、图元缓冲区中的图元数等。此值是任意的,集合无法调整大小,因此应在集合构造函数中提供特定于每个缓冲区的容量(如果可用)。
protected readonly _boundingVolume : BoundingSphere
protected readonly _modelMatrix : Matrix4
将几何体从模型坐标变换到世界坐标。
-
Default Value:
Matrix4.IDENTITY
readonly boundingVolume : BoundingSphere
集合中所有图元的世界空间包围体,包括已显示和隐藏的图元。
此集合拥有的缓冲区的总字节长度。包括由
primitiveCountMax 分配的任何未使用空间,即使该空间中尚未添加图元。
此属性仅用于调试;不用于生产用途,也未进行优化。
绘制图元中每个绘制命令的包围球。
-
Default Value:
false
readonly modelMatrix : Matrix4
将几何体从模型坐标变换到世界坐标。
-
Default Value:
Matrix4.IDENTITY
readonly positionDatatype : ComponentDatatype
用于存储位置值的分量数据类型。
当为
true 时,整数位置值被视为归一化值,其中完整整数范围映射到 [-1, 1](有符号)或 [0, 1](无符号)。
集合中的图元数量。必须 <=
primitiveCountMax。
此集合可包含的最大图元数。必须 >=
primitiveCount。
-
Default Value:
BufferPrimitiveCollection.DEFAULT_CAPACITY
确定是否显示此集合中的图元。
-
Default Value:
true
集合中的顶点数量。必须 <=
vertexCountMax。
此集合可包含的最大顶点数。必须 >=
vertexCount。
-
Default Value:
BufferPrimitiveCollection.DEFAULT_CAPACITY
Methods
将此集合的内容复制到结果集合中。结果集合不会调整大小,并且必须包含足够的空间来容纳源集合中的所有图元。结果集合中现有的图元将被覆盖。
在为已达到容量的集合分配更多空间并高效地将要素传输到新集合时很有用。
| Name | Type | Description |
|---|---|---|
collection |
BufferPrimitiveCollection.<T> | |
result |
BufferPrimitiveCollection.<T> |
Example:
const result = new BufferPrimitiveCollection({ ... }); // allocate larger 'result' collection
BufferPrimitiveCollection.clone(collection, result); // copy primitives from 'collection' into 'result'
add(options, result) → BufferPrimitive
使用指定的选项向集合添加新图元。
BufferPrimitive 实例链接到新图元,如果提供了 'result' 参数则使用该参数,否则创建新实例。对于重复调用,建议重用单个 BufferPrimitive 实例,而不是在每次调用时分配新实例。
| Name | Type | Description |
|---|---|---|
options |
BufferPrimitiveOptions | |
result |
BufferPrimitive |
Returns:
销毁集合及其 GPU 资源。
get(index, result) → BufferPrimitive
使给定的
BufferPrimitive 成为此集合中给定索引处图元的视图,用于读取/写入图元属性。在遍历大型集合时,建议在整个循环中重用同一个 BufferPrimitive 实例——将现有实例重新绑定到不同图元的开销很低,并避免为每个对象分配内存中的对象。
| Name | Type | Description |
|---|---|---|
index |
number | |
result |
BufferPrimitive |
Returns:
作为 'result' 参数传递的 BufferPrimitive 实例,现在绑定到指定的图元索引。
Example:
const primitive = new BufferPrimitive();
for (let i = 0; i < collection.primitiveCount; i++) {
collection.get(i, primitive);
primitive.setColor(Color.RED);
}
如果此对象已被销毁则返回 true;否则返回 false。
Returns:
如果此对象已被销毁则为 True;否则为 false。
对集合中的图元进行排序。
由于排序会更改集合中图元的索引(但不会更改要素 ID),该函数还会返回一个从先前索引到新索引的映射数组。当重复排序时,可以重用该数组并将其作为 'result' 参数传递给每次调用。
| Name | Type | Description |
|---|---|---|
sortFn |
function | |
result |
Uint32Array |
Returns:
从先前索引到新索引的映射。
返回表示集合的可 JSON 序列化数组。这种编码方式不节省内存,通常应仅用于调试和测试。
Returns:
可 JSON 序列化的对象列表,集合中每个图元一个。
Example:
console.table(collection.toJSON());
| Name | Type | Description |
|---|---|---|
frameState |
object |
