Browse Source

Used vector's `fromBufferArray` method; check explicitly if itemSize === 3

duma 5 years ago
parent
commit
c29c82c18a
1 changed files with 3 additions and 8 deletions
  1. 3 8
      src/core/BufferAttribute.js

+ 3 - 8
src/core/BufferAttribute.js

@@ -204,23 +204,18 @@ Object.assign( BufferAttribute.prototype, {
 
 			for ( let i = 0, l = this.count; i < l; i ++ ) {
 
-				_vector2.x = this.getX( i );
-				_vector2.y = this.getY( i );
-
+				_vector2.fromBufferAttribute( this, i );
 				_vector2.applyMatrix3( m );
 
 				this.setXY( i, _vector2.x, _vector2.y, );
 
 			}
 
-		} else {
+		} else if ( this.itemSize === 3 ) {
 
 			for ( let i = 0, l = this.count; i < l; i ++ ) {
 
-				_vector.x = this.getX( i );
-				_vector.y = this.getY( i );
-				_vector.z = this.getZ( i );
-
+				_vector.fromBufferAttribute( this, i );
 				_vector.applyMatrix3( m );
 
 				this.setXYZ( i, _vector.x, _vector.y, _vector.z );