提交 8559c8ea 编写于 作者: N Ningxin Hu

Support Uint8Array in BufferAttribute

Fix #8358
上级 cf584a60
......@@ -1016,8 +1016,19 @@ THREE.WebGLRenderer = function ( parameters ) {
}
var type = _gl.FLOAT;
var normalized = false;
var array = geometryAttribute.array;
if ( array instanceof Uint8Array ) {
type = _gl.UNSIGNED_BYTE;
normalized = true;
}
_gl.bindBuffer( _gl.ARRAY_BUFFER, buffer );
_gl.vertexAttribPointer( programAttribute, size, _gl.FLOAT, false, 0, startIndex * size * 4 ); // 4 bytes per Float32
_gl.vertexAttribPointer( programAttribute, size, type, normalized, 0, startIndex * size * array.BYTES_PER_ELEMENT );
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册