提交 55c5baf6 编写于 作者: D dubejf

Extract createBuffer and updateBuffer

上级 e29f28d6
......@@ -167,8 +167,7 @@ THREE.WebGLObjects = function ( gl, properties, info ) {
for ( var name in attributes ) {
var attribute = attributes[ name ];
updateAttribute( attribute, name );
updateAttribute( attributes[ name ], name );
}
......@@ -184,6 +183,18 @@ THREE.WebGLObjects = function ( gl, properties, info ) {
if ( attributeProperties.__webglBuffer === undefined ) {
createBuffer( attributeProperties, data, bufferType );
} else if ( data.needsUpdate === true ) {
updateBuffer( attributeProperties, data, bufferType );
}
}
function createBuffer ( attributeProperties, data, bufferType ) {
attributeProperties.__webglBuffer = gl.createBuffer();
gl.bindBuffer( bufferType, attributeProperties.__webglBuffer );
......@@ -201,7 +212,9 @@ THREE.WebGLObjects = function ( gl, properties, info ) {
data.needsUpdate = false;
} else if ( data.needsUpdate === true ) {
}
function updateBuffer( attributeProperties, data, bufferType ) {
gl.bindBuffer( bufferType, attributeProperties.__webglBuffer );
......@@ -226,22 +239,18 @@ THREE.WebGLObjects = function ( gl, properties, info ) {
}
}
// returns the webgl buffer for a specified attribute
this.getAttributeBuffer = function ( attribute ) {
if ( attribute instanceof THREE.InterleavedBufferAttribute ) {
return properties.get( attribute.data ).__webglBuffer
return properties.get( attribute.data ).__webglBuffer;
}
return properties.get( attribute ).__webglBuffer;
}
};
this.update = function ( renderList ) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册