ComponentDatatype

ComponentDatatype()

WebGL分量数据类型。分量是内嵌原语(intrinsics),它形成属性,它形成顶点。

Members

staticconstantCesium.ComponentDatatype.DOUBLE : Number

64位浮点对应的gl.DOUBLE(在OpenGL;这在WebGL中不受支持,在Cesium中通过GeometryPipeline.encodeAttribute进行模拟) 和Float64Array中的元素类型。
Default Value: 0x140A

staticconstantCesium.ComponentDatatype.INT : Number

32位有符号int对应的INTInt32Array中的元素类型。

staticconstantCesium.ComponentDatatype.UNSIGNED_INT : Number

32位无符号int对应的UNSIGNED_INTUint32Array中的元素类型。

staticconstantCesium.ComponentDatatype.BYTE : Number

8位有符号字节对应的gl.BYTEInt8Array中的元素类型。

staticconstantCesium.ComponentDatatype.FLOAT : Number

32位浮点对应的FLOATFloat32Array中的元素类型。

staticconstantCesium.ComponentDatatype.SHORT : Number

16位有符号short对应的SHORTInt16Array中的元素类型。

staticconstantCesium.ComponentDatatype.UNSIGNED_BYTE : Number

8位无符号字节对应的UNSIGNED_BYTEUint8Array中的元素类型。

staticconstantCesium.ComponentDatatype.UNSIGNED_SHORT : Number

16位无符号short对应的UNSIGNED_SHORTUint16Array中的元素类型。

Methods

staticCesium.ComponentDatatype.createArrayBufferView(componentDatatype, buffer, byteOffset, length)Int8Array|Uint8Array|Int16Array|Uint16Array|Int32Array|Uint32Array|Float32Array|Float64Array

创建字节数组的类型化视图。
Name Type Description
componentDatatype ComponentDatatype 要创建的视图的类型。
buffer ArrayBuffer 要用于视图的缓冲区存储。
byteOffset Number optional 到视图中第一个元素的偏移量(以字节为单位)。
length Number optional 视图中元素的数量。
Returns:
缓冲区的一个类型化数组视图。
Throws:

staticCesium.ComponentDatatype.createTypedArray(componentDatatype, valuesOrLength)Int8Array|Uint8Array|Int16Array|Uint16Array|Int32Array|Uint32Array|Float32Array|Float64Array

创建与分量数据类型对应的类型化数组。
Name Type Description
componentDatatype ComponentDatatype 分量数据类型。
valuesOrLength Number | Array 要创建的数组或数组的长度。
Returns:
类型化数组。
Throws:
Example:
// 创建长度为100的Float32Array。
var typedArray = Cesium.ComponentDatatype.createTypedArray(Cesium.ComponentDatatype.FLOAT, 100);

staticCesium.ComponentDatatype.fromName(name)ComponentDatatype

从名称中获取ComponentDatatype。
Name Type Description
name String 分量数据类型的名称。
Returns:
ComponentDatatype.
Throws:

staticCesium.ComponentDatatype.fromTypedArray(array)ComponentDatatype

获取提供的TypedArray实例的ComponentDatatype
Name Type Description
array TypedArray 类型化数组。
Returns:
提供的数组的ComponentDatatype,如果数组不是TypedArray,则为undefined。

staticCesium.ComponentDatatype.getSizeInBytes(componentDatatype)Number

返回相对于数据类型的大小(以字节为单位)。
Name Type Description
componentDatatype ComponentDatatype 获取分量数据类型的大小。
Returns:
字节大小。
Throws:
Example:
// 返回 Int8Array.BYTES_PER_ELEMENT
var size = Cesium.ComponentDatatype.getSizeInBytes(Cesium.ComponentDatatype.BYTE);

staticCesium.ComponentDatatype.validate(componentDatatype)Boolean

验证所提供的分量数据类型是有效的ComponentDatatype
Name Type Description
componentDatatype ComponentDatatype 要验证的分量数据类型。
Returns:
如果提供的分量数据类型是有效值,则true;否则,false
Example:
if (!Cesium.ComponentDatatype.validate(componentDatatype)) {
  throw new Cesium.DeveloperError('componentDatatype must be a valid value.');
}