提交 60032480 编写于 作者: M Mr.doob

Simplified WebGLRenderer's initDirectBuffers.

上级 d9fb3dcc
......@@ -1063,30 +1063,19 @@ THREE.WebGLRenderer = function ( parameters ) {
function initDirectBuffers( geometry ) {
var a, attribute, type;
for ( var name in geometry.attributes ) {
for ( a in geometry.attributes ) {
if ( a === "index" ) {
type = _gl.ELEMENT_ARRAY_BUFFER;
} else {
type = _gl.ARRAY_BUFFER;
}
attribute = geometry.attributes[ a ];
var bufferType = ( name === "index" ) ? _gl.ELEMENT_ARRAY_BUFFER : _gl.ARRAY_BUFFER;
var attribute = geometry.attributes[ name ];
attribute.buffer = _gl.createBuffer();
_gl.bindBuffer( type, attribute.buffer );
_gl.bufferData( type, attribute.array, _gl.STATIC_DRAW );
_gl.bindBuffer( bufferType, attribute.buffer );
_gl.bufferData( bufferType, attribute.array, _gl.STATIC_DRAW );
}
};
}
// Buffer setting
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册