|
@@ -20,18 +20,6 @@ THREE.Quaternion.prototype = {
|
|
|
|
|
|
_x: 0,_y: 0, _z: 0, _w: 0,
|
|
|
|
|
|
- _euler: undefined,
|
|
|
-
|
|
|
- _updateEuler: function ( callback ) {
|
|
|
-
|
|
|
- if ( this._euler !== undefined ) {
|
|
|
-
|
|
|
- this._euler.setFromQuaternion( this, undefined, false );
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- },
|
|
|
-
|
|
|
get x () {
|
|
|
|
|
|
return this._x;
|
|
@@ -41,7 +29,7 @@ THREE.Quaternion.prototype = {
|
|
|
set x ( value ) {
|
|
|
|
|
|
this._x = value;
|
|
|
- this._updateEuler();
|
|
|
+ this.onChangeCallback();
|
|
|
|
|
|
},
|
|
|
|
|
@@ -54,7 +42,7 @@ THREE.Quaternion.prototype = {
|
|
|
set y ( value ) {
|
|
|
|
|
|
this._y = value;
|
|
|
- this._updateEuler();
|
|
|
+ this.onChangeCallback();
|
|
|
|
|
|
},
|
|
|
|
|
@@ -67,7 +55,7 @@ THREE.Quaternion.prototype = {
|
|
|
set z ( value ) {
|
|
|
|
|
|
this._z = value;
|
|
|
- this._updateEuler();
|
|
|
+ this.onChangeCallback();
|
|
|
|
|
|
},
|
|
|
|
|
@@ -80,7 +68,7 @@ THREE.Quaternion.prototype = {
|
|
|
set w ( value ) {
|
|
|
|
|
|
this._w = value;
|
|
|
- this._updateEuler();
|
|
|
+ this.onChangeCallback();
|
|
|
|
|
|
},
|
|
|
|
|
@@ -91,7 +79,7 @@ THREE.Quaternion.prototype = {
|
|
|
this._z = z;
|
|
|
this._w = w;
|
|
|
|
|
|
- this._updateEuler();
|
|
|
+ this.onChangeCallback();
|
|
|
|
|
|
return this;
|
|
|
|
|
@@ -104,7 +92,7 @@ THREE.Quaternion.prototype = {
|
|
|
this._z = quaternion._z;
|
|
|
this._w = quaternion._w;
|
|
|
|
|
|
- this._updateEuler();
|
|
|
+ this.onChangeCallback();
|
|
|
|
|
|
return this;
|
|
|
|
|
@@ -172,7 +160,7 @@ THREE.Quaternion.prototype = {
|
|
|
|
|
|
}
|
|
|
|
|
|
- if ( update !== false ) this._updateEuler();
|
|
|
+ if ( update !== false ) this.onChangeCallback();
|
|
|
|
|
|
return this;
|
|
|
|
|
@@ -191,7 +179,7 @@ THREE.Quaternion.prototype = {
|
|
|
this._z = axis.z * s;
|
|
|
this._w = Math.cos( halfAngle );
|
|
|
|
|
|
- this._updateEuler();
|
|
|
+ this.onChangeCallback();
|
|
|
|
|
|
return this;
|
|
|
|
|
@@ -250,7 +238,7 @@ THREE.Quaternion.prototype = {
|
|
|
|
|
|
}
|
|
|
|
|
|
- this._updateEuler();
|
|
|
+ this.onChangeCallback();
|
|
|
|
|
|
return this;
|
|
|
|
|
@@ -294,7 +282,7 @@ THREE.Quaternion.prototype = {
|
|
|
|
|
|
this.set( v1.x, v1.y, v1.z, r ).normalize();
|
|
|
|
|
|
- this._updateEuler();
|
|
|
+ this.onChangeCallback();
|
|
|
|
|
|
return this;
|
|
|
|
|
@@ -316,7 +304,7 @@ THREE.Quaternion.prototype = {
|
|
|
this._y *= -1;
|
|
|
this._z *= -1;
|
|
|
|
|
|
- this._updateEuler();
|
|
|
+ this.onChangeCallback();
|
|
|
|
|
|
return this;
|
|
|
|
|
@@ -385,7 +373,7 @@ THREE.Quaternion.prototype = {
|
|
|
this._z = qaz * qbw + qaw * qbz + qax * qby - qay * qbx;
|
|
|
this._w = qaw * qbw - qax * qbx - qay * qby - qaz * qbz;
|
|
|
|
|
|
- this._updateEuler();
|
|
|
+ this.onChangeCallback();
|
|
|
|
|
|
return this;
|
|
|
|
|
@@ -454,7 +442,7 @@ THREE.Quaternion.prototype = {
|
|
|
this._y = ( y * ratioA + this._y * ratioB );
|
|
|
this._z = ( z * ratioA + this._z * ratioB );
|
|
|
|
|
|
- this._updateEuler();
|
|
|
+ this.onChangeCallback();
|
|
|
|
|
|
return this;
|
|
|
|
|
@@ -473,7 +461,7 @@ THREE.Quaternion.prototype = {
|
|
|
this._z = array[ 2 ];
|
|
|
this._w = array[ 3 ];
|
|
|
|
|
|
- this._updateEuler();
|
|
|
+ this.onChangeCallback();
|
|
|
|
|
|
return this;
|
|
|
|
|
@@ -485,6 +473,16 @@ THREE.Quaternion.prototype = {
|
|
|
|
|
|
},
|
|
|
|
|
|
+ onChange: function ( callback ) {
|
|
|
+
|
|
|
+ this.onChangeCallback = callback;
|
|
|
+
|
|
|
+ return this;
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+ onChangeCallback: function () {},
|
|
|
+
|
|
|
clone: function () {
|
|
|
|
|
|
return new THREE.Quaternion( this._x, this._y, this._z, this._w );
|