提交 d3553473 编写于 作者: M Mugen87

Points: Make updateMorphTargets() more robust.

上级 7cd094cd
......@@ -143,29 +143,43 @@ Points.prototype = Object.assign( Object.create( Object3D.prototype ), {
var geometry = this.geometry;
var m, ml, name;
var morphAttributes = geometry.morphAttributes;
var keys = Object.keys( morphAttributes );
if ( geometry.isBufferGeometry ) {
if ( keys.length > 0 ) {
var morphAttributes = geometry.morphAttributes;
var keys = Object.keys( morphAttributes );
var morphAttribute = morphAttributes[ keys[ 0 ] ];
if ( keys.length > 0 ) {
if ( morphAttribute !== undefined ) {
var morphAttribute = morphAttributes[ keys[ 0 ] ];
this.morphTargetInfluences = [];
this.morphTargetDictionary = {};
if ( morphAttribute !== undefined ) {
for ( m = 0, ml = morphAttribute.length; m < ml; m ++ ) {
this.morphTargetInfluences = [];
this.morphTargetDictionary = {};
name = morphAttribute[ m ].name || String( m );
for ( m = 0, ml = morphAttribute.length; m < ml; m ++ ) {
this.morphTargetInfluences.push( 0 );
this.morphTargetDictionary[ name ] = m;
name = morphAttribute[ m ].name || String( m );
this.morphTargetInfluences.push( 0 );
this.morphTargetDictionary[ name ] = m;
}
}
}
} else {
var morphTargets = geometry.morphTargets;
if ( morphTargets !== undefined && morphTargets.length > 0 ) {
console.error( 'THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.' );
}
}
},
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册