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

WebGLRenderer: Do not upload MorphTargets with 0 influence.

上级 4d024233
......@@ -49,6 +49,12 @@ THREE.BufferGeometry.prototype = {
},
removeAttribute: function ( name ) {
delete this.attributes[ name ];
},
get offsets() {
console.warn( 'THREE.BufferGeometry: .offsets has been renamed to .drawcalls.' );
......
......@@ -902,9 +902,9 @@ THREE.WebGLRenderer = function ( parameters ) {
if ( geometryAttribute !== undefined ) {
var size = geometryAttribute.itemSize;
state.enableAttribute( programAttribute );
var size = geometryAttribute.itemSize;
var buffer = objects.getAttributeBuffer( geometryAttribute );
if ( geometryAttribute instanceof THREE.InterleavedBufferAttribute ) {
......@@ -1051,15 +1051,16 @@ THREE.WebGLRenderer = function ( parameters ) {
var influence = activeInfluences[ i ];
morphInfluences[ i ] = influence[ 0 ];
if ( influence[ 0 ] !== 0 ) {
var attribute = geometry.morphAttributes[ influence[ 1 ] ];
objects.updateAttribute( attribute );
geometry.addAttribute( 'morphTarget' + i, attribute );
} else {
geometry.removeAttribute( 'morphTarget' + i );
}
}
......
......@@ -87,8 +87,6 @@ THREE.WebGLObjects = function ( gl, properties, info ) {
}
//
var attributes = geometry.attributes;
for ( var name in attributes ) {
......@@ -97,6 +95,16 @@ THREE.WebGLObjects = function ( gl, properties, info ) {
}
// morph targets
var morphAttributes = geometry.morphAttributes;
for ( var i = 0, l = morphAttributes.length; i < l; i ++ ) {
updateAttribute( morphAttributes[ i ], i );
}
}
function updateAttribute( attribute, name ) {
......@@ -196,8 +204,6 @@ THREE.WebGLObjects = function ( gl, properties, info ) {
};
this.updateAttribute = updateAttribute;
this.clear = function () {
objects = {};
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册