IndexDatatype
Constants for WebGL index datatypes. These corresponds to the
type
parameter of drawElements.
Source:
Members
-
<static, constant> UNSIGNED_BYTE :Number
-
0x1401. 8-bit unsigned byte corresponding to
UNSIGNED_BYTE
and the type of an element inUint8Array
. -
<static, constant> UNSIGNED_INT :Number
-
0x1405. 32-bit unsigned int corresponding to
UNSIGNED_INT
and the type of an element inUint32Array
. -
<static, constant> UNSIGNED_SHORT :Number
-
0x1403. 16-bit unsigned short corresponding to
UNSIGNED_SHORT
and the type of an element inUint16Array
.
Methods
-
<static> createTypedArray
-
Creates a typed array that will store indices, using either
or Uint32Array
depending on the number of vertices.Parameters:
Name Type Description numberOfVertices
Number Number of vertices that the indices will reference. indicesLengthOrArray
Any Passed through to the typed array constructor. Returns:
Array AUint16Array
orUint32Array
constructed withindicesLengthOrArray
.Example
this.indices = Cesium.IndexDatatype.createTypedArray(positions.length / 3, numberOfIndices);
-
<static> getSizeInBytes
-
Returns the size, in bytes, of the corresponding datatype.
Parameters:
Name Type Description indexDatatype
IndexDatatype The index datatype to get the size of. Returns:
Number The size in bytes.Example
// Returns 2 var size = Cesium.IndexDatatype.getSizeInBytes(Cesium.IndexDatatype.UNSIGNED_SHORT);
-
<static> validate
-
Validates that the provided index datatype is a valid IndexDatatype.
Parameters:
Name Type Description indexDatatype
IndexDatatype The index datatype to validate. Returns:
Booleantrue
if the provided index datatype is a valid value; otherwise,false
.Example
if (!Cesium.IndexDatatype.validate(indexDatatype)) { throw new Cesium.DeveloperError('indexDatatype must be a valid value.'); }