Members
对应于
UNSIGNED_BYTE
的8位无符号字节和Uint8Array
中的元素类型。
对应
UNSIGNED_INT
的32位无符号int以及Uint32Array
中的元素类型。
对应
UNSIGNED_SHORT
>的16位无符号short以及Uint16Array
>中的元素类型。
Methods
staticCesium.IndexDatatype.createTypedArray(numberOfVertices, indicesLengthOrArray) → Uint16Array|Uint32Array
创建一个将存储索引的类型化数组,根据顶点的数量使用
或Uint32Array
。
Name | Type | Description |
---|---|---|
numberOfVertices |
Number | 索引将引用的顶点数。 |
indicesLengthOrArray |
Number | Array | 传递给类型化数组构造函数。 |
Returns:
一个
Uint16Array
或Uint32Array
构建的indicesLengthOrArray
。
Example:
this.indices = Cesium.IndexDatatype.createTypedArray(positions.length / 3, numberOfIndices);
staticCesium.IndexDatatype.createTypedArrayFromArrayBuffer(numberOfVertices, sourceArray, byteOffset, length) → Uint16Array|Uint32Array
从源数组缓冲区创建类型化数组。得到的类型化数组将存储索引,根据顶点的数量使用
或Uint32Array
。
Name | Type | Description |
---|---|---|
numberOfVertices |
Number | Number of vertices that the indices will reference. |
sourceArray |
ArrayBuffer | 传递给类型化数组构造函数。 |
byteOffset |
Number | 传递给类型化数组构造函数。 |
length |
Number | 传递给类型化数组构造函数。 |
Returns:
一个
Uint16Array
或Uint32Array
构造sourceArray
, byteOffset
, length
。
staticCesium.IndexDatatype.fromSizeInBytes(sizeInBytes) → IndexDatatype
获取具有给定大小(以字节为单位)的数据类型。
Name | Type | Description |
---|---|---|
sizeInBytes |
Number | 单个索引的大小(以字节为单位)。 |
Returns:
具有给定大小的索引数据类型。
返回相应数据类型的大小(以字节为单位)。
Name | Type | Description |
---|---|---|
indexDatatype |
IndexDatatype | 获取大小的索引数据类型。 |
Returns:
字节大小。
Example:
// Returns 2
var size = Cesium.IndexDatatype.getSizeInBytes(Cesium.IndexDatatype.UNSIGNED_SHORT);
验证所提供的索引数据类型是有效的
IndexDatatype
。
Name | Type | Description |
---|---|---|
indexDatatype |
IndexDatatype | 要验证的索引数据类型。 |
Returns:
如果提供的索引数据类型是有效值,则
true
;否则,false
。
Example:
if (!Cesium.IndexDatatype.validate(indexDatatype)) {
throw new Cesium.DeveloperError('indexDatatype must be a valid value.');
}