WebGL索引數(shù)據(jù)類型的常量。這些對(duì)應(yīng)于drawElements的
type
參數(shù)。
Members
(static, constant) UNSIGNED_BYTE : Number
對(duì)應(yīng)于
UNSIGNED_BYTE
和Uint8Array
中元素類型的8位無(wú)符號(hào)字節(jié)。
(static, constant) UNSIGNED_INT : Number
對(duì)應(yīng)于
UNSIGNED_INT
和Uint32Array
中元素類型的32位無(wú)符號(hào)int。
(static, constant) UNSIGNED_SHORT : Number
對(duì)應(yīng)于
UNSIGNED_SHORT
和Uint16Array
中元素類型的16位無(wú)符號(hào)短。
Methods
(static) createTypedArray(numberOfVertices, indicesLengthOrArray) → {Uint16Array|Uint32Array}
使用
或Uint32Array
創(chuàng)建將存儲(chǔ)索引的類型化數(shù)組,具體取決于頂點(diǎn)的數(shù)量。
Parameters:
numberOfVertices
(Number)
索引將引用的頂點(diǎn)數(shù)。
indicesLengthOrArray
((Number | Array))
傳遞給類型化數(shù)組構(gòu)造函數(shù)。
從源數(shù)組緩沖區(qū)創(chuàng)建類型化數(shù)組。生成的類型化數(shù)組將使用
或Uint32Array
存儲(chǔ)索引,具體取決于頂點(diǎn)的數(shù)量。
Parameters:
numberOfVertices
(Number)
索引將引用的頂點(diǎn)數(shù)。
sourceArray
(ArrayBuffer)
傳遞給類型化數(shù)組構(gòu)造函數(shù)。
byteOffset
(Number)
傳遞給類型化數(shù)組構(gòu)造函數(shù)。
length
(Number)
傳遞給類型化數(shù)組構(gòu)造函數(shù)。
獲取具有給定大小(字節(jié))的數(shù)據(jù)類型。
Parameters:
sizeInBytes
(Number)
以字節(jié)為單位的單個(gè)索引的大小。
返回相應(yīng)數(shù)據(jù)類型的大小(以字節(jié)為單位)。
Parameters:
indexDatatype
(IndexDatatype)
要獲取大小的索引數(shù)據(jù)類型。
Example
// Returns 2
var size = bmgl.IndexDatatype.getSizeInBytes(bmgl.IndexDatatype.UNSIGNED_SHORT);
驗(yàn)證提供的索引數(shù)據(jù)類型是否有效。
Parameters:
indexDatatype
(IndexDatatype)
要驗(yàn)證的索引數(shù)據(jù)類型。
Example
if (!bmgl.IndexDatatype.validate(indexDatatype)) {
throw new bmgl.DeveloperError('indexDatatype must be a valid value.');
}