| 名称 Name |
类型 Type |
说明 Description |
options |
object
|
| 名称 Name |
类型 Type |
默认值 Default |
说明 Description |
modelMatrix |
Matrix4
|
Matrix4.IDENTITY
|
可选 optional
将几何体从模型转换为世界坐标。 Transforms geometry from model to world coordinates. |
primitiveCountMax |
number
|
BufferPrimitiveCollection.DEFAULT_CAPACITY
|
可选 optional
|
vertexCountMax |
number
|
BufferPrimitiveCollection.DEFAULT_CAPACITY
|
可选 optional
|
show |
boolean
|
true
|
可选 optional
|
positionDatatype |
ComponentDatatype
|
ComponentDatatype.DOUBLE
|
可选 optional
|
allowPicking |
boolean
|
false
|
可选 optional
When true,基元可以选择 , primitives are pickable with Scene#pick。当 . When false,内存和初始化成本较低。 , memory and initialization cost are lower. |
debugShowBoundingVolume |
boolean
|
false
|
可选 optional
|
|
实验性 Experimental
此功能不是最终版本,可能会在没有 Cesium 标准弃用政策的情况下进行更改。 This feature is not final and is subject to change without Cesium's standard deprecation policy.
另见: See:
成员 Members
集合中所有图元的局部包围体,包括显示的和隐藏的图元。 Local bounding volume for all primitives in the collection, including both shown and hidden primitives.
集合中所有图元的世界边界体积,包括显示的和隐藏的图元。 World bounding volume for all primitives in the collection, including both shown and hidden primitives.
该集合拥有的缓冲区的总字节长度。包括分配的任何未使用空间 Total byte length of buffers owned by this collection. Includes any unused space allocated by primitiveCountMax,即使该空间中尚未添加任何基元。 , even if no primitives have yet been added in that space.
该属性仅用于调试;它不适合生产用途,也没有经过优化。
This property is for debugging only; it is not for production use nor is it optimized.
Draws the bounding sphere for each draw command in the primitive.
false
新集合的缓冲区的默认容量。元素数量:顶点缓冲区中的顶点数、图元缓冲区中的图元数量等。该值是任意的,并且集合无法调整大小,因此应在集合构造函数中提供特定的每个缓冲区容量(如果可用)。 Default capacity of buffers on new collections. A quantity of elements: number of vertices in the vertex buffer, primitives in the primitive buffer, etc. This value is arbitrary, and collections cannot be resized, so specific per-buffer capacities should be provided in the collection constructor when available.
将几何体从模型转换为世界坐标。 Transforms geometry from model to world coordinates.
Matrix4.IDENTITY
集合中的基元数量。必须是 Number of primitives in collection. Must be <= primitiveCountMax.
该集合可以包含的最大基元数。必须 >= Maximum number of primitives this collection can contain. Must be >=
primitiveCount.
BufferPrimitiveCollection.DEFAULT_CAPACITY
确定是否显示该集合中的基元。 Determines if primitives in this collection will be shown.
true
集合中的顶点数。必须是 Number of vertices in collection. Must be <= vertexCountMax.
该集合可以包含的最大顶点数。必须 >= Maximum number of vertices this collection can contain. Must be >=
vertexCount.
BufferPrimitiveCollection.DEFAULT_CAPACITY
方法 Methods
将此集合的内容复制到结果集合中。结果集合不会调整大小,并且必须包含足够的空间来容纳源集合中的所有基元。结果集合中的现有基元将被覆盖。
Duplicates the contents of this collection into the result collection. Result collection is not resized, and must contain enough space for all primitives in the source collection. Existing primitives in the result collection will be overwritten.
当为已达到其容量的集合分配更多空间以及有效地将功能转移到新集合时非常有用。 Useful when allocating more space for a collection that has reached its capacity, and efficiently transferring features to the new collection.
示例: Example:
const result = new BufferPrimitiveCollection({ ... }); // allocate larger 'result' collection
BufferPrimitiveCollection.clone(collection, result); // copy primitives from 'collection' into 'result'
使用指定的选项将新基元添加到集合中。一个
Adds a new primitive to the collection, with the specified options. A
BufferPrimitive 实例链接到新的原语,如果给定则使用“结果”参数,如果没有则使用新实例。对于重复调用,最好重用单个 BufferPrimitive 实例,而不是在每次调用时分配一个新实例。
instance is linked to the new primitive, using the 'result' argument if given, or a new instance if not. For repeated calls, prefer to reuse a single BufferPrimitive instance rather than allocating a new instance on each call.
返回: Returns:
破坏集合及其 GPU 资源。 Destroys collection and its GPU resources.
使得给定的
Makes the given BufferPrimitive 给定索引处此集合的基元的视图,供读取/写入基元属性时使用。当迭代大型集合时,最好在整个循环中重用相同的 BufferPrimitive 实例 - 将现有实例重新绑定到不同的基元很便宜,并且避免为每个对象分配内存中的对象。
a view onto this collection's primitive at the given index, for use when reading/writing primitive properties. When iterating over a large collection, prefer to reuse the same BufferPrimitive instance throughout the loop — rebinding an existing instance to a different primitive is cheap, and avoids allocating in-memory objects for every object.
返回: Returns:
作为“结果”参数传递的 BufferPrimitive 实例现在绑定到指定的基元索引。 The BufferPrimitive instance passed as the 'result' argument, now bound to the specified primitive index.
示例: Example:
const primitive = new BufferPrimitive();
for (let i = 0; i < collection.primitiveCount; i++) {
collection.get(i, primitive);
primitive.setColor(Color.RED);
}
如果该对象被销毁则返回 true;否则为假。 Returns true if this object was destroyed; otherwise, false.
返回: Returns:
如果该对象被销毁,则为 True;否则为假。 True if this object was destroyed; otherwise, false.
对集合的基元进行排序。由于排序会更改集合中图元的索引(但不会更改要素 ID),因此该函数还会返回从先前索引到新索引的数组映射。重复排序时,可以重用该数组并将其作为每次调用的“结果”参数传递。 Sorts primitives of the collection. Because sorting changes the indices (but not the feature IDs) of primitives in the collection, the function also returns an array mapping from previous index to new index. When sorting repeatedly, the array can be reused and passed as the 'result' argument for each call.
| 名称 Name |
类型 Type |
说明 Description |
sortFn |
function
|
|
result |
Uint32Array
|
|
返回: Returns:
从先前索引到新索引的映射。 Mapping from previous index to new index.
返回表示集合的 JSON 可序列化数组。这种编码不节省内存,通常应该用于调试和测试。 Returns a JSON-serializable array representing the collection. This encoding is not memory-efficient, and should generally be used for debugging and testing.
返回: Returns:
JSON 可序列化对象的列表,一个对应集合中的每个基元。 List of JSON-serializable objects, one for each primitive in the collection.
示例: Example:
console.table(collection.toJSON());
| 名称 Name |
类型 Type |
说明 Description |
frameState |
object
|
|