WebGL組件數據類型。組件是內部函數,它形成屬性,形成頂點。
Members
(static, constant) BYTE : Number
對應
gl.BYTE
和Int8Array
中元素類型的8位有符號字節。
(static, constant) FLOAT : Number
與
FLOAT
和Float32Array
中元素類型對應的32位浮點。
(static, constant) SHORT : Number
與
SHORT
和Int16Array
中元素類型相對應的16位有符號短。
(static, constant) UNSIGNED_BYTE : Number
對應于
UNSIGNED_BYTE
和Uint8Array
中元素類型的8位無符號字節。
(static, constant) UNSIGNED_SHORT : Number
對應于
UNSIGNED_SHORT
和Uint16Array
中元素類型的16位無符號短。
Methods
(static) createArrayBufferView(componentDatatype, buffer, byteOffset, length) → {Int8Array|Uint8Array|Int16Array|Uint16Array|Int32Array|Uint32Array|Float32Array|Float64Array}
創建字節數組的類型化視圖。
Parameters:
buffer
(ArrayBuffer)
用于視圖的緩沖區存儲。
byteOffset
(Number)
到視圖中第一個元素的偏移量(以字節為單位)。
length
(Number)
視圖中的元素數。
Throws
-
DeveloperError : componentdatatype不是有效值。
創建與組件數據類型對應的類型化數組。
Parameters:
valuesOrLength
((Number | Array))
要創建的數組或數組的長度。
Example
// creates a Float32Array with length of 100
var typedArray = bmgl.ComponentDatatype.createTypedArray(bmgl.ComponentDatatype.FLOAT, 100);
Throws
-
DeveloperError : componentdatatype不是有效值。
從其名稱中獲取componentdatatype。
Parameters:
name
(String)
componentdatatype的名稱。
Throws
-
DeveloperError : 名稱不是有效值。
獲取提供的typedarray實例的
ComponentDatatype
。
Parameters:
array
(TypedArray)
類型化數組。
返回相應數據類型的大小(以字節為單位)。
Parameters:
Example
// Returns Int8Array.BYTES_PER_ELEMENT
var size = bmgl.ComponentDatatype.getSizeInBytes(bmgl.ComponentDatatype.BYTE);
Throws
-
DeveloperError : componentdatatype不是有效值。
驗證提供的組件數據類型是否有效
ComponentDatatype
Parameters:
Example
if (!bmgl.ComponentDatatype.validate(componentDatatype)) {
throw new bmgl.DeveloperError('componentDatatype must be a valid value.');
}