WebGL組件數(shù)據(jù)類型。組件是內(nèi)部函數(shù),它形成屬性,形成頂點。
Members
(static, constant) BYTE : Number
對應(yīng)
gl.BYTE
和Int8Array
中元素類型的8位有符號字節(jié)。
(static, constant) FLOAT : Number
與
FLOAT
和Float32Array
中元素類型對應(yīng)的32位浮點。
(static, constant) SHORT : Number
與
SHORT
和Int16Array
中元素類型相對應(yīng)的16位有符號短。
(static, constant) UNSIGNED_BYTE : Number
對應(yīng)于
UNSIGNED_BYTE
和Uint8Array
中元素類型的8位無符號字節(jié)。
(static, constant) UNSIGNED_SHORT : Number
對應(yīng)于
UNSIGNED_SHORT
和Uint16Array
中元素類型的16位無符號短。
Methods
(static) createArrayBufferView(componentDatatype, buffer, byteOffset, length) → {Int8Array|Uint8Array|Int16Array|Uint16Array|Int32Array|Uint32Array|Float32Array|Float64Array}
創(chuàng)建字節(jié)數(shù)組的類型化視圖。
Parameters:
buffer
(ArrayBuffer)
用于視圖的緩沖區(qū)存儲。
byteOffset
(Number)
到視圖中第一個元素的偏移量(以字節(jié)為單位)。
length
(Number)
視圖中的元素數(shù)。
Throws
-
DeveloperError : componentdatatype不是有效值。
創(chuàng)建與組件數(shù)據(jù)類型對應(yīng)的類型化數(shù)組。
Parameters:
valuesOrLength
((Number | Array))
要創(chuàng)建的數(shù)組或數(shù)組的長度。
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)
類型化數(shù)組。
返回相應(yīng)數(shù)據(jù)類型的大?。ㄒ宰止?jié)為單位)。
Parameters:
Example
// Returns Int8Array.BYTES_PER_ELEMENT
var size = bmgl.ComponentDatatype.getSizeInBytes(bmgl.ComponentDatatype.BYTE);
Throws
-
DeveloperError : componentdatatype不是有效值。
驗證提供的組件數(shù)據(jù)類型是否有效
ComponentDatatype
Parameters:
Example
if (!bmgl.ComponentDatatype.validate(componentDatatype)) {
throw new bmgl.DeveloperError('componentDatatype must be a valid value.');
}