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

BufferGeometry: morphAttributes is now an object.

上级 87cf5536
......@@ -14,7 +14,7 @@ THREE.BufferGeometry = function () {
this.attributes = {};
this.morphAttributes = [];
this.morphAttributes = {};
this.drawcalls = [];
......@@ -344,6 +344,7 @@ THREE.BufferGeometry.prototype = {
if ( geometry.morphTargets.length > 0 ) {
var position = [];
var morphTargets = geometry.morphTargets;
for ( var i = 0, l = morphTargets.length; i < l; i ++ ) {
......@@ -352,10 +353,12 @@ THREE.BufferGeometry.prototype = {
var attribute = new THREE.Float32Attribute( morphTarget.length * 3, 3 );
this.morphAttributes.push( attribute.copyVector3sArray( morphTarget ) );
position.push( attribute.copyVector3sArray( morphTarget ) );
}
this.morphAttributes.position = position;
// TODO normals, colors
}
......
......@@ -919,7 +919,7 @@ THREE.WebGLRenderer = function ( parameters ) {
if ( influence[ 0 ] !== 0 ) {
var attribute = geometry.morphAttributes[ influence[ 1 ] ];
var attribute = geometry.morphAttributes.position[ influence[ 1 ] ];
geometry.addAttribute( 'morphTarget' + i, attribute );
......
......@@ -99,9 +99,15 @@ THREE.WebGLObjects = function ( gl, properties, info ) {
var morphAttributes = geometry.morphAttributes;
for ( var i = 0, l = morphAttributes.length; i < l; i ++ ) {
for ( var name in morphAttributes ) {
updateAttribute( morphAttributes[ i ], i );
var array = morphAttributes[ name ];
for ( var i = 0, l = array.length; i < l; i ++ ) {
updateAttribute( array[ i ], i );
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册