Constants for WebGL index datatypes. These corresponds to the
type
parameter of drawElements.- Source:
Members
(static, constant) UNSIGNED_BYTE :Number
8-bit unsigned byte corresponding to
UNSIGNED_BYTE
and the type
of an element in Uint8Array
.
Type:
- Number
- Source:
(static, constant) UNSIGNED_INT :Number
32-bit unsigned int corresponding to
UNSIGNED_INT
and the type
of an element in Uint32Array
.
Type:
- Number
- Source:
(static, constant) UNSIGNED_SHORT :Number
16-bit unsigned short corresponding to
UNSIGNED_SHORT
and the type
of an element in Uint16Array
.
Type:
- Number
- Source:
Methods
(static) createTypedArray(numberOfVertices, indicesLengthOrArray) → {Uint16Array|Uint32Array}
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.
- Source:
Returns:
A Uint16Array
or Uint32Array
constructed with indicesLengthOrArray
.
-
Type
-
Uint16Array
|
Uint32Array
Example
this.indices = Cesium.IndexDatatype.createTypedArray(positions.length / 3, numberOfIndices);
(static) createTypedArrayFromArrayBuffer(numberOfVertices, sourceArray, byteOffset, length) → {Uint16Array|Uint32Array}
Creates a typed array from a source array buffer. The resulting typed array 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.
sourceArray
ArrayBuffer
Passed through to the typed array constructor.
byteOffset
Number
Passed through to the typed array constructor.
length
Number
Passed through to the typed array constructor.
- Source:
Returns:
A Uint16Array
or Uint32Array
constructed with sourceArray
, byteOffset
, and length
.
-
Type
-
Uint16Array
|
Uint32Array
(static) getSizeInBytes(indexDatatype) → {Number}
Returns the size, in bytes, of the corresponding datatype.
Parameters:
Name
Type
Description
indexDatatype
IndexDatatype
The index datatype to get the size of.
- Source:
Returns:
The size in bytes.
-
Type
-
Number
Example
// Returns 2
var size = Cesium.IndexDatatype.getSizeInBytes(Cesium.IndexDatatype.UNSIGNED_SHORT);
(static) validate(indexDatatype) → {Boolean}
Validates that the provided index datatype is a valid IndexDatatype
.
Parameters:
Name
Type
Description
indexDatatype
IndexDatatype
The index datatype to validate.
- Source:
Returns:
true
if the provided index datatype is a valid value; otherwise, false
.
-
Type
-
Boolean
Example
if (!Cesium.IndexDatatype.validate(indexDatatype)) {
throw new Cesium.DeveloperError('indexDatatype must be a valid value.');
}