IndexDatatype

IndexDatatype()

WebGL索引数据types的常量。这些常量对应于 类型参数drawElements

Members

staticconstantCesium.IndexDatatype.UNSIGNED_BYTE : Number

对应于UNSIGNED_BYTE和类型的8位无符号字节 Uint8Array中的一个元素。

staticconstantCesium.IndexDatatype.UNSIGNED_INT : Number

UNSIGNED_INT和类型对应的32位无符号int 在Uint32Array中的一个元素中。

staticconstantCesium.IndexDatatype.UNSIGNED_SHORT : Number

对应于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:
一个Uint16ArrayUint32Array,由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:
sourceArraybyteOffsetlength构成的Uint16ArrayUint32Array

staticCesium.IndexDatatype.fromSizeInBytes(sizeInBytes)IndexDatatype

获取具有给定大小(以字节为单位)的数据类型。
Name Type Description
sizeInBytes Number 单个索引的大小(以字节为单位)。
Returns:
具有给定大小的索引数据类型。

staticCesium.IndexDatatype.getSizeInBytes(indexDatatype)Number

返回相应数据类型的大小(以字节为单位)。
Name Type Description
indexDatatype IndexDatatype 要获取其大小的索引数据类型。
Returns:
以字节为单位的大小。
Example:
// Returns 2
var size = Cesium.IndexDatatype.getSizeInBytes(Cesium.IndexDatatype.UNSIGNED_SHORT);

staticCesium.IndexDatatype.validate(indexDatatype)Boolean

验证提供的索引数据类型是否为有效的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.');
}