Members
对应于
UNSIGNED_BYTE
和类型的8位无符号字节
Uint8Array
中的一个元素。UNSIGNED_INT
和类型对应的32位无符号int
在Uint32Array
中的一个元素中。对应于
UNSIGNED_SHORT
和类型的16位无符号短
Uint16Array
中的一个元素。Methods
staticCesium.IndexDatatype.createTypedArray(numberOfVertices, indicesLengthOrArray) → Uint16Array|Uint32Array
使用
or Uint32Array
depending on the number of vertices.
创建将存储索引的类型化数组
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
从源数组缓冲区创建类型化数组。生成的类型化数组将使用
or Uint32Array
depending on the number of vertices.
存储索引
Name
Type
Description
numberOfVertices
Number
索引将引用的顶点数。
sourceArray
ArrayBuffer
传递给类型化数组构造函数。
byteOffset
Number
传递给类型化数组构造函数。
length
Number
传递给类型化数组构造函数。
Returns:
由sourceArray
、byteOffset
和length
构成的Uint16Array
或Uint32Array
。
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.');
}