提交 a53d5d20 编写于 作者: W Wandalen

Color/Euler: 'toArray' expected behavior fix

上级 23f792fa
......@@ -372,10 +372,16 @@ THREE.Color.prototype = {
},
toArray: function () {
toArray: function( array, offset ) {
return [ this.r, this.g, this.b ];
if ( array === undefined ) array = [];
if ( offset === undefined ) offset = 0;
array[ offset + 0 ] = this.r;
array[ offset + 1 ] = this.g;
array[ offset + 2 ] = this.b;
return array;
},
clone: function () {
......
......@@ -280,10 +280,20 @@ THREE.Euler.prototype = {
},
toArray: function () {
toArray: function( array, offset, withoutOrder ) {
return [ this._x, this._y, this._z, this._order ];
if ( array === undefined ) array = [];
if ( offset === undefined ) offset = 0;
array[ offset + 0 ] = this._x;
array[ offset + 1 ] = this._y;
array[ offset + 2 ] = this._z;
if( !withoutOrder ) {
array[ offset + 3 ] = this._order;
}
return array;
},
toVector3: function ( optionalResult ) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册