|
@@ -680,55 +680,60 @@ THREE.Quaternion.prototype = {
|
|
|
|
|
|
},
|
|
},
|
|
|
|
|
|
- setFromEuler: function ( v, order ) {
|
|
|
|
|
|
+ setFromEuler: function ( euler ) {
|
|
|
|
+
|
|
|
|
+ if ( typeof euler['order'] === undefined ) {
|
|
|
|
+
|
|
|
|
+ console.error( 'ERROR: Quaternion\'s .setFromEuler() now expects a Euler rotation rather than a Vector3 and order. Please update your code.' );
|
|
|
|
+ }
|
|
|
|
|
|
// http://www.mathworks.com/matlabcentral/fileexchange/
|
|
// http://www.mathworks.com/matlabcentral/fileexchange/
|
|
// 20696-function-to-convert-between-dcm-euler-angles-quaternions-and-euler-vectors/
|
|
// 20696-function-to-convert-between-dcm-euler-angles-quaternions-and-euler-vectors/
|
|
// content/SpinCalc.m
|
|
// content/SpinCalc.m
|
|
|
|
|
|
- var c1 = Math.cos( v.x / 2 );
|
|
|
|
- var c2 = Math.cos( v.y / 2 );
|
|
|
|
- var c3 = Math.cos( v.z / 2 );
|
|
|
|
- var s1 = Math.sin( v.x / 2 );
|
|
|
|
- var s2 = Math.sin( v.y / 2 );
|
|
|
|
- var s3 = Math.sin( v.z / 2 );
|
|
|
|
|
|
+ var c1 = Math.cos( euler.x / 2 );
|
|
|
|
+ var c2 = Math.cos( euler.y / 2 );
|
|
|
|
+ var c3 = Math.cos( euler.z / 2 );
|
|
|
|
+ var s1 = Math.sin( euler.x / 2 );
|
|
|
|
+ var s2 = Math.sin( euler.y / 2 );
|
|
|
|
+ var s3 = Math.sin( euler.z / 2 );
|
|
|
|
|
|
- if ( order === undefined || order === 'XYZ' ) {
|
|
|
|
|
|
+ if ( euler.order === undefined || euler.order === 'XYZ' ) {
|
|
|
|
|
|
this.x = s1 * c2 * c3 + c1 * s2 * s3;
|
|
this.x = s1 * c2 * c3 + c1 * s2 * s3;
|
|
this.y = c1 * s2 * c3 - s1 * c2 * s3;
|
|
this.y = c1 * s2 * c3 - s1 * c2 * s3;
|
|
this.z = c1 * c2 * s3 + s1 * s2 * c3;
|
|
this.z = c1 * c2 * s3 + s1 * s2 * c3;
|
|
this.w = c1 * c2 * c3 - s1 * s2 * s3;
|
|
this.w = c1 * c2 * c3 - s1 * s2 * s3;
|
|
|
|
|
|
- } else if ( order === 'YXZ' ) {
|
|
|
|
|
|
+ } else if ( euler.order === 'YXZ' ) {
|
|
|
|
|
|
this.x = s1 * c2 * c3 + c1 * s2 * s3;
|
|
this.x = s1 * c2 * c3 + c1 * s2 * s3;
|
|
this.y = c1 * s2 * c3 - s1 * c2 * s3;
|
|
this.y = c1 * s2 * c3 - s1 * c2 * s3;
|
|
this.z = c1 * c2 * s3 - s1 * s2 * c3;
|
|
this.z = c1 * c2 * s3 - s1 * s2 * c3;
|
|
this.w = c1 * c2 * c3 + s1 * s2 * s3;
|
|
this.w = c1 * c2 * c3 + s1 * s2 * s3;
|
|
|
|
|
|
- } else if ( order === 'ZXY' ) {
|
|
|
|
|
|
+ } else if ( euler.order === 'ZXY' ) {
|
|
|
|
|
|
this.x = s1 * c2 * c3 - c1 * s2 * s3;
|
|
this.x = s1 * c2 * c3 - c1 * s2 * s3;
|
|
this.y = c1 * s2 * c3 + s1 * c2 * s3;
|
|
this.y = c1 * s2 * c3 + s1 * c2 * s3;
|
|
this.z = c1 * c2 * s3 + s1 * s2 * c3;
|
|
this.z = c1 * c2 * s3 + s1 * s2 * c3;
|
|
this.w = c1 * c2 * c3 - s1 * s2 * s3;
|
|
this.w = c1 * c2 * c3 - s1 * s2 * s3;
|
|
|
|
|
|
- } else if ( order === 'ZYX' ) {
|
|
|
|
|
|
+ } else if ( euler.order === 'ZYX' ) {
|
|
|
|
|
|
this.x = s1 * c2 * c3 - c1 * s2 * s3;
|
|
this.x = s1 * c2 * c3 - c1 * s2 * s3;
|
|
this.y = c1 * s2 * c3 + s1 * c2 * s3;
|
|
this.y = c1 * s2 * c3 + s1 * c2 * s3;
|
|
this.z = c1 * c2 * s3 - s1 * s2 * c3;
|
|
this.z = c1 * c2 * s3 - s1 * s2 * c3;
|
|
this.w = c1 * c2 * c3 + s1 * s2 * s3;
|
|
this.w = c1 * c2 * c3 + s1 * s2 * s3;
|
|
|
|
|
|
- } else if ( order === 'YZX' ) {
|
|
|
|
|
|
+ } else if ( euler.order === 'YZX' ) {
|
|
|
|
|
|
this.x = s1 * c2 * c3 + c1 * s2 * s3;
|
|
this.x = s1 * c2 * c3 + c1 * s2 * s3;
|
|
this.y = c1 * s2 * c3 + s1 * c2 * s3;
|
|
this.y = c1 * s2 * c3 + s1 * c2 * s3;
|
|
this.z = c1 * c2 * s3 - s1 * s2 * c3;
|
|
this.z = c1 * c2 * s3 - s1 * s2 * c3;
|
|
this.w = c1 * c2 * c3 - s1 * s2 * s3;
|
|
this.w = c1 * c2 * c3 - s1 * s2 * s3;
|
|
|
|
|
|
- } else if ( order === 'XZY' ) {
|
|
|
|
|
|
+ } else if ( euler.order === 'XZY' ) {
|
|
|
|
|
|
this.x = s1 * c2 * c3 - c1 * s2 * s3;
|
|
this.x = s1 * c2 * c3 - c1 * s2 * s3;
|
|
this.y = c1 * s2 * c3 - s1 * c2 * s3;
|
|
this.y = c1 * s2 * c3 - s1 * c2 * s3;
|
|
@@ -1844,182 +1849,14 @@ THREE.Vector3.prototype = {
|
|
|
|
|
|
setEulerFromRotationMatrix: function ( m, order ) {
|
|
setEulerFromRotationMatrix: function ( m, order ) {
|
|
|
|
|
|
- // assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)
|
|
|
|
-
|
|
|
|
- // clamp, to handle numerical problems
|
|
|
|
-
|
|
|
|
- function clamp( x ) {
|
|
|
|
-
|
|
|
|
- return Math.min( Math.max( x, -1 ), 1 );
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- var te = m.elements;
|
|
|
|
- var m11 = te[0], m12 = te[4], m13 = te[8];
|
|
|
|
- var m21 = te[1], m22 = te[5], m23 = te[9];
|
|
|
|
- var m31 = te[2], m32 = te[6], m33 = te[10];
|
|
|
|
-
|
|
|
|
- if ( order === undefined || order === 'XYZ' ) {
|
|
|
|
-
|
|
|
|
- this.y = Math.asin( clamp( m13 ) );
|
|
|
|
-
|
|
|
|
- if ( Math.abs( m13 ) < 0.99999 ) {
|
|
|
|
-
|
|
|
|
- this.x = Math.atan2( - m23, m33 );
|
|
|
|
- this.z = Math.atan2( - m12, m11 );
|
|
|
|
-
|
|
|
|
- } else {
|
|
|
|
-
|
|
|
|
- this.x = Math.atan2( m32, m22 );
|
|
|
|
- this.z = 0;
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- } else if ( order === 'YXZ' ) {
|
|
|
|
-
|
|
|
|
- this.x = Math.asin( - clamp( m23 ) );
|
|
|
|
-
|
|
|
|
- if ( Math.abs( m23 ) < 0.99999 ) {
|
|
|
|
-
|
|
|
|
- this.y = Math.atan2( m13, m33 );
|
|
|
|
- this.z = Math.atan2( m21, m22 );
|
|
|
|
-
|
|
|
|
- } else {
|
|
|
|
-
|
|
|
|
- this.y = Math.atan2( - m31, m11 );
|
|
|
|
- this.z = 0;
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- } else if ( order === 'ZXY' ) {
|
|
|
|
-
|
|
|
|
- this.x = Math.asin( clamp( m32 ) );
|
|
|
|
-
|
|
|
|
- if ( Math.abs( m32 ) < 0.99999 ) {
|
|
|
|
-
|
|
|
|
- this.y = Math.atan2( - m31, m33 );
|
|
|
|
- this.z = Math.atan2( - m12, m22 );
|
|
|
|
-
|
|
|
|
- } else {
|
|
|
|
-
|
|
|
|
- this.y = 0;
|
|
|
|
- this.z = Math.atan2( m21, m11 );
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- } else if ( order === 'ZYX' ) {
|
|
|
|
-
|
|
|
|
- this.y = Math.asin( - clamp( m31 ) );
|
|
|
|
-
|
|
|
|
- if ( Math.abs( m31 ) < 0.99999 ) {
|
|
|
|
-
|
|
|
|
- this.x = Math.atan2( m32, m33 );
|
|
|
|
- this.z = Math.atan2( m21, m11 );
|
|
|
|
-
|
|
|
|
- } else {
|
|
|
|
-
|
|
|
|
- this.x = 0;
|
|
|
|
- this.z = Math.atan2( - m12, m22 );
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- } else if ( order === 'YZX' ) {
|
|
|
|
-
|
|
|
|
- this.z = Math.asin( clamp( m21 ) );
|
|
|
|
-
|
|
|
|
- if ( Math.abs( m21 ) < 0.99999 ) {
|
|
|
|
-
|
|
|
|
- this.x = Math.atan2( - m23, m22 );
|
|
|
|
- this.y = Math.atan2( - m31, m11 );
|
|
|
|
-
|
|
|
|
- } else {
|
|
|
|
-
|
|
|
|
- this.x = 0;
|
|
|
|
- this.y = Math.atan2( m13, m33 );
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- } else if ( order === 'XZY' ) {
|
|
|
|
-
|
|
|
|
- this.z = Math.asin( - clamp( m12 ) );
|
|
|
|
-
|
|
|
|
- if ( Math.abs( m12 ) < 0.99999 ) {
|
|
|
|
-
|
|
|
|
- this.x = Math.atan2( m32, m22 );
|
|
|
|
- this.y = Math.atan2( m13, m11 );
|
|
|
|
-
|
|
|
|
- } else {
|
|
|
|
-
|
|
|
|
- this.x = Math.atan2( - m23, m33 );
|
|
|
|
- this.y = 0;
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- return this;
|
|
|
|
|
|
+ console.error( "REMOVED: Vector3\'s setEulerFromRotationMatrix has been removed in favor of Euler.setFromRotationMatrix(), please update your code.");
|
|
|
|
|
|
},
|
|
},
|
|
|
|
|
|
setEulerFromQuaternion: function ( q, order ) {
|
|
setEulerFromQuaternion: function ( q, order ) {
|
|
|
|
|
|
- // q is assumed to be normalized
|
|
|
|
-
|
|
|
|
- // clamp, to handle numerical problems
|
|
|
|
-
|
|
|
|
- function clamp( x ) {
|
|
|
|
-
|
|
|
|
- return Math.min( Math.max( x, -1 ), 1 );
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- // http://www.mathworks.com/matlabcentral/fileexchange/20696-function-to-convert-between-dcm-euler-angles-quaternions-and-euler-vectors/content/SpinCalc.m
|
|
|
|
-
|
|
|
|
- var sqx = q.x * q.x;
|
|
|
|
- var sqy = q.y * q.y;
|
|
|
|
- var sqz = q.z * q.z;
|
|
|
|
- var sqw = q.w * q.w;
|
|
|
|
-
|
|
|
|
- if ( order === undefined || order === 'XYZ' ) {
|
|
|
|
-
|
|
|
|
- this.x = Math.atan2( 2 * ( q.x * q.w - q.y * q.z ), ( sqw - sqx - sqy + sqz ) );
|
|
|
|
- this.y = Math.asin( clamp( 2 * ( q.x * q.z + q.y * q.w ) ) );
|
|
|
|
- this.z = Math.atan2( 2 * ( q.z * q.w - q.x * q.y ), ( sqw + sqx - sqy - sqz ) );
|
|
|
|
-
|
|
|
|
- } else if ( order === 'YXZ' ) {
|
|
|
|
-
|
|
|
|
- this.x = Math.asin( clamp( 2 * ( q.x * q.w - q.y * q.z ) ) );
|
|
|
|
- this.y = Math.atan2( 2 * ( q.x * q.z + q.y * q.w ), ( sqw - sqx - sqy + sqz ) );
|
|
|
|
- this.z = Math.atan2( 2 * ( q.x * q.y + q.z * q.w ), ( sqw - sqx + sqy - sqz ) );
|
|
|
|
-
|
|
|
|
- } else if ( order === 'ZXY' ) {
|
|
|
|
-
|
|
|
|
- this.x = Math.asin( clamp( 2 * ( q.x * q.w + q.y * q.z ) ) );
|
|
|
|
- this.y = Math.atan2( 2 * ( q.y * q.w - q.z * q.x ), ( sqw - sqx - sqy + sqz ) );
|
|
|
|
- this.z = Math.atan2( 2 * ( q.z * q.w - q.x * q.y ), ( sqw - sqx + sqy - sqz ) );
|
|
|
|
-
|
|
|
|
- } else if ( order === 'ZYX' ) {
|
|
|
|
-
|
|
|
|
- this.x = Math.atan2( 2 * ( q.x * q.w + q.z * q.y ), ( sqw - sqx - sqy + sqz ) );
|
|
|
|
- this.y = Math.asin( clamp( 2 * ( q.y * q.w - q.x * q.z ) ) );
|
|
|
|
- this.z = Math.atan2( 2 * ( q.x * q.y + q.z * q.w ), ( sqw + sqx - sqy - sqz ) );
|
|
|
|
-
|
|
|
|
- } else if ( order === 'YZX' ) {
|
|
|
|
-
|
|
|
|
- this.x = Math.atan2( 2 * ( q.x * q.w - q.z * q.y ), ( sqw - sqx + sqy - sqz ) );
|
|
|
|
- this.y = Math.atan2( 2 * ( q.y * q.w - q.x * q.z ), ( sqw + sqx - sqy - sqz ) );
|
|
|
|
- this.z = Math.asin( clamp( 2 * ( q.x * q.y + q.z * q.w ) ) );
|
|
|
|
-
|
|
|
|
- } else if ( order === 'XZY' ) {
|
|
|
|
-
|
|
|
|
- this.x = Math.atan2( 2 * ( q.x * q.w + q.y * q.z ), ( sqw - sqx + sqy - sqz ) );
|
|
|
|
- this.y = Math.atan2( 2 * ( q.x * q.z + q.y * q.w ), ( sqw + sqx - sqy - sqz ) );
|
|
|
|
- this.z = Math.asin( clamp( 2 * ( q.z * q.w - q.x * q.y ) ) );
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- return this;
|
|
|
|
-
|
|
|
|
|
|
+ console.error( "REMOVED: Vector3\'s setEulerFromQuaternion: has been removed in favor of Euler.setFromQuaternion(), please update your code.");
|
|
|
|
+
|
|
},
|
|
},
|
|
|
|
|
|
getPositionFromMatrix: function ( m ) {
|
|
getPositionFromMatrix: function ( m ) {
|
|
@@ -2095,9 +1932,13 @@ THREE.extend( THREE.Vector3.prototype, {
|
|
|
|
|
|
var q1 = new THREE.Quaternion();
|
|
var q1 = new THREE.Quaternion();
|
|
|
|
|
|
- return function ( v, eulerOrder ) {
|
|
|
|
|
|
+ return function ( rotation ) {
|
|
|
|
|
|
- var quaternion = q1.setFromEuler( v, eulerOrder );
|
|
|
|
|
|
+ if( typeof rotation['order'] === undefined ) {
|
|
|
|
+ console.error( 'ERROR: Vector3\'s .applyEuler() now expects a Euler rotation rather than a Vector3 and order. Please update your code.' );
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ var quaternion = q1.setFromEuler( rotation );
|
|
|
|
|
|
this.applyQuaternion( quaternion );
|
|
this.applyQuaternion( quaternion );
|
|
|
|
|
|
@@ -2741,6 +2582,379 @@ THREE.Vector4.prototype = {
|
|
|
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+/**
|
|
|
|
+ * @author mrdoob / http://mrdoob.com/
|
|
|
|
+ * @author WestLangley / http://github.com/WestLangley
|
|
|
|
+ * @author bhouston / http://exocortex.com
|
|
|
|
+ */
|
|
|
|
+
|
|
|
|
+THREE.Euler = function ( x, y, z, order ) {
|
|
|
|
+
|
|
|
|
+ this.x = x || 0;
|
|
|
|
+ this.y = y || 0;
|
|
|
|
+ this.z = z || 0;
|
|
|
|
+ this.order = order || THREE.Euler.DefaultOrder;
|
|
|
|
+
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+THREE.Euler.RotationOrders = [ 'XYZ', 'YZX', 'ZXY', 'XZY', 'YXZ', 'ZYX' ];
|
|
|
|
+
|
|
|
|
+THREE.Euler.DefaultOrder = 'XYZ';
|
|
|
|
+
|
|
|
|
+THREE.Euler.prototype = {
|
|
|
|
+
|
|
|
|
+ constructor: THREE.Euler,
|
|
|
|
+
|
|
|
|
+ set: function ( x, y, z, order ) {
|
|
|
|
+
|
|
|
|
+ this.x = x;
|
|
|
|
+ this.y = y;
|
|
|
|
+ this.z = z;
|
|
|
|
+ this.order = order || this.order;
|
|
|
|
+
|
|
|
|
+ return this;
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ copy: function ( e ) {
|
|
|
|
+
|
|
|
|
+ this.x = e.x;
|
|
|
|
+ this.y = e.y;
|
|
|
|
+ this.z = e.z;
|
|
|
|
+ this.order = e.order;
|
|
|
|
+
|
|
|
|
+ return this;
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ setFromRotationMatrix: function ( m, order ) {
|
|
|
|
+
|
|
|
|
+ // assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)
|
|
|
|
+
|
|
|
|
+ // clamp, to handle numerical problems
|
|
|
|
+
|
|
|
|
+ function clamp( x ) {
|
|
|
|
+
|
|
|
|
+ return Math.min( Math.max( x, -1 ), 1 );
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ var te = m.elements;
|
|
|
|
+ var m11 = te[0], m12 = te[4], m13 = te[8];
|
|
|
|
+ var m21 = te[1], m22 = te[5], m23 = te[9];
|
|
|
|
+ var m31 = te[2], m32 = te[6], m33 = te[10];
|
|
|
|
+
|
|
|
|
+ order = order || this.order;
|
|
|
|
+
|
|
|
|
+ if ( order === 'XYZ' ) {
|
|
|
|
+
|
|
|
|
+ this.y = Math.asin( clamp( m13 ) );
|
|
|
|
+
|
|
|
|
+ if ( Math.abs( m13 ) < 0.99999 ) {
|
|
|
|
+
|
|
|
|
+ this.x = Math.atan2( - m23, m33 );
|
|
|
|
+ this.z = Math.atan2( - m12, m11 );
|
|
|
|
+
|
|
|
|
+ } else {
|
|
|
|
+
|
|
|
|
+ this.x = Math.atan2( m32, m22 );
|
|
|
|
+ this.z = 0;
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ } else if ( order === 'YXZ' ) {
|
|
|
|
+
|
|
|
|
+ this.x = Math.asin( - clamp( m23 ) );
|
|
|
|
+
|
|
|
|
+ if ( Math.abs( m23 ) < 0.99999 ) {
|
|
|
|
+
|
|
|
|
+ this.y = Math.atan2( m13, m33 );
|
|
|
|
+ this.z = Math.atan2( m21, m22 );
|
|
|
|
+
|
|
|
|
+ } else {
|
|
|
|
+
|
|
|
|
+ this.y = Math.atan2( - m31, m11 );
|
|
|
|
+ this.z = 0;
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ } else if ( order === 'ZXY' ) {
|
|
|
|
+
|
|
|
|
+ this.x = Math.asin( clamp( m32 ) );
|
|
|
|
+
|
|
|
|
+ if ( Math.abs( m32 ) < 0.99999 ) {
|
|
|
|
+
|
|
|
|
+ this.y = Math.atan2( - m31, m33 );
|
|
|
|
+ this.z = Math.atan2( - m12, m22 );
|
|
|
|
+
|
|
|
|
+ } else {
|
|
|
|
+
|
|
|
|
+ this.y = 0;
|
|
|
|
+ this.z = Math.atan2( m21, m11 );
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ } else if ( order === 'ZYX' ) {
|
|
|
|
+
|
|
|
|
+ this.y = Math.asin( - clamp( m31 ) );
|
|
|
|
+
|
|
|
|
+ if ( Math.abs( m31 ) < 0.99999 ) {
|
|
|
|
+
|
|
|
|
+ this.x = Math.atan2( m32, m33 );
|
|
|
|
+ this.z = Math.atan2( m21, m11 );
|
|
|
|
+
|
|
|
|
+ } else {
|
|
|
|
+
|
|
|
|
+ this.x = 0;
|
|
|
|
+ this.z = Math.atan2( - m12, m22 );
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ } else if ( order === 'YZX' ) {
|
|
|
|
+
|
|
|
|
+ this.z = Math.asin( clamp( m21 ) );
|
|
|
|
+
|
|
|
|
+ if ( Math.abs( m21 ) < 0.99999 ) {
|
|
|
|
+
|
|
|
|
+ this.x = Math.atan2( - m23, m22 );
|
|
|
|
+ this.y = Math.atan2( - m31, m11 );
|
|
|
|
+
|
|
|
|
+ } else {
|
|
|
|
+
|
|
|
|
+ this.x = 0;
|
|
|
|
+ this.y = Math.atan2( m13, m33 );
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ } else if ( order === 'XZY' ) {
|
|
|
|
+
|
|
|
|
+ this.z = Math.asin( - clamp( m12 ) );
|
|
|
|
+
|
|
|
|
+ if ( Math.abs( m12 ) < 0.99999 ) {
|
|
|
|
+
|
|
|
|
+ this.x = Math.atan2( m32, m22 );
|
|
|
|
+ this.y = Math.atan2( m13, m11 );
|
|
|
|
+
|
|
|
|
+ } else {
|
|
|
|
+
|
|
|
|
+ this.x = Math.atan2( - m23, m33 );
|
|
|
|
+ this.y = 0;
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ } else {
|
|
|
|
+
|
|
|
|
+ console.warn( 'WARNING: Euler.setFromRotationMatrix() given unsupported order: ' + order )
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ this.order = order;
|
|
|
|
+
|
|
|
|
+ return this;
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ setFromQuaternion: function ( q, order ) {
|
|
|
|
+
|
|
|
|
+ // q is assumed to be normalized
|
|
|
|
+
|
|
|
|
+ // clamp, to handle numerical problems
|
|
|
|
+
|
|
|
|
+ function clamp( x ) {
|
|
|
|
+
|
|
|
|
+ return Math.min( Math.max( x, -1 ), 1 );
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // http://www.mathworks.com/matlabcentral/fileexchange/20696-function-to-convert-between-dcm-euler-angles-quaternions-and-euler-vectors/content/SpinCalc.m
|
|
|
|
+
|
|
|
|
+ var sqx = q.x * q.x;
|
|
|
|
+ var sqy = q.y * q.y;
|
|
|
|
+ var sqz = q.z * q.z;
|
|
|
|
+ var sqw = q.w * q.w;
|
|
|
|
+
|
|
|
|
+ order = order || this.order;
|
|
|
|
+
|
|
|
|
+ if ( order === 'XYZ' ) {
|
|
|
|
+
|
|
|
|
+ this.x = Math.atan2( 2 * ( q.x * q.w - q.y * q.z ), ( sqw - sqx - sqy + sqz ) );
|
|
|
|
+ this.y = Math.asin( clamp( 2 * ( q.x * q.z + q.y * q.w ) ) );
|
|
|
|
+ this.z = Math.atan2( 2 * ( q.z * q.w - q.x * q.y ), ( sqw + sqx - sqy - sqz ) );
|
|
|
|
+
|
|
|
|
+ } else if ( order === 'YXZ' ) {
|
|
|
|
+
|
|
|
|
+ this.x = Math.asin( clamp( 2 * ( q.x * q.w - q.y * q.z ) ) );
|
|
|
|
+ this.y = Math.atan2( 2 * ( q.x * q.z + q.y * q.w ), ( sqw - sqx - sqy + sqz ) );
|
|
|
|
+ this.z = Math.atan2( 2 * ( q.x * q.y + q.z * q.w ), ( sqw - sqx + sqy - sqz ) );
|
|
|
|
+
|
|
|
|
+ } else if ( order === 'ZXY' ) {
|
|
|
|
+
|
|
|
|
+ this.x = Math.asin( clamp( 2 * ( q.x * q.w + q.y * q.z ) ) );
|
|
|
|
+ this.y = Math.atan2( 2 * ( q.y * q.w - q.z * q.x ), ( sqw - sqx - sqy + sqz ) );
|
|
|
|
+ this.z = Math.atan2( 2 * ( q.z * q.w - q.x * q.y ), ( sqw - sqx + sqy - sqz ) );
|
|
|
|
+
|
|
|
|
+ } else if ( order === 'ZYX' ) {
|
|
|
|
+
|
|
|
|
+ this.x = Math.atan2( 2 * ( q.x * q.w + q.z * q.y ), ( sqw - sqx - sqy + sqz ) );
|
|
|
|
+ this.y = Math.asin( clamp( 2 * ( q.y * q.w - q.x * q.z ) ) );
|
|
|
|
+ this.z = Math.atan2( 2 * ( q.x * q.y + q.z * q.w ), ( sqw + sqx - sqy - sqz ) );
|
|
|
|
+
|
|
|
|
+ } else if ( order === 'YZX' ) {
|
|
|
|
+
|
|
|
|
+ this.x = Math.atan2( 2 * ( q.x * q.w - q.z * q.y ), ( sqw - sqx + sqy - sqz ) );
|
|
|
|
+ this.y = Math.atan2( 2 * ( q.y * q.w - q.x * q.z ), ( sqw + sqx - sqy - sqz ) );
|
|
|
|
+ this.z = Math.asin( clamp( 2 * ( q.x * q.y + q.z * q.w ) ) );
|
|
|
|
+
|
|
|
|
+ } else if ( order === 'XZY' ) {
|
|
|
|
+
|
|
|
|
+ this.x = Math.atan2( 2 * ( q.x * q.w + q.y * q.z ), ( sqw - sqx + sqy - sqz ) );
|
|
|
|
+ this.y = Math.atan2( 2 * ( q.x * q.z + q.y * q.w ), ( sqw + sqx - sqy - sqz ) );
|
|
|
|
+ this.z = Math.asin( clamp( 2 * ( q.z * q.w - q.x * q.y ) ) );
|
|
|
|
+
|
|
|
|
+ } else {
|
|
|
|
+
|
|
|
|
+ console.warn( 'WARNING: Euler.setFromQuaternion() given unsupported order: ' + order )
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ this.order = order;
|
|
|
|
+
|
|
|
|
+ return this;
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ reorder: function() {
|
|
|
|
+
|
|
|
|
+ // WARNING: this discards revolution information -bhouston
|
|
|
|
+
|
|
|
|
+ var q = new THREE.Quaternion();
|
|
|
|
+
|
|
|
|
+ return function( newOrder ) {
|
|
|
|
+
|
|
|
|
+ q.setFromEuler( this );
|
|
|
|
+ this.setFromQuaternion( q, newOrder );
|
|
|
|
+
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ }(),
|
|
|
|
+
|
|
|
|
+ fromArray: function ( array ) {
|
|
|
|
+
|
|
|
|
+ this.x = array[ 0 ];
|
|
|
|
+ this.y = array[ 1 ];
|
|
|
|
+ this.z = array[ 2 ];
|
|
|
|
+ this.order = array[ 3 ];
|
|
|
|
+
|
|
|
|
+ return this;
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ toArray: function () {
|
|
|
|
+
|
|
|
|
+ return [ this.x, this.y, this.z, this.order ];
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ equals: function ( rotation ) {
|
|
|
|
+
|
|
|
|
+ return ( ( rotation.x === this.x ) && ( rotation.y === this.y ) && ( rotation.z === this.z ) && ( rotation.order === this.order ) );
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ clone: function () {
|
|
|
|
+
|
|
|
|
+ return new THREE.Euler( this.x, this.y, this.z, this.order );
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * @author mrdoob / http://mrdoob.com/
|
|
|
|
+ * @author bhouston / http://exocortex.com/
|
|
|
|
+ */
|
|
|
|
+
|
|
|
|
+THREE.Rotation = function ( quaternion ) {
|
|
|
|
+
|
|
|
|
+ this.euler = new THREE.Euler().setFromQuaternion( quaternion );
|
|
|
|
+ this.quaternion = quaternion;
|
|
|
|
+
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+THREE.Rotation.prototype = {
|
|
|
|
+
|
|
|
|
+ get x () {
|
|
|
|
+
|
|
|
|
+ return this.euler.x;
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ set x ( value ) {
|
|
|
|
+
|
|
|
|
+ this.euler.x = value;
|
|
|
|
+ this.quaternion.setFromEuler( this.euler );
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ get y () {
|
|
|
|
+
|
|
|
|
+ return this.euler.y;
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ set y ( value ) {
|
|
|
|
+
|
|
|
|
+ this.euler.y = value;
|
|
|
|
+ this.quaternion.setFromEuler( this.euler );
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ get z () {
|
|
|
|
+
|
|
|
|
+ return this.euler.z;
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ set z ( value ) {
|
|
|
|
+
|
|
|
|
+ this.euler.z = value;
|
|
|
|
+ this.quaternion.setFromEuler( this.euler );
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ set: function ( x, y, z ) {
|
|
|
|
+
|
|
|
|
+ this.euler.x = x;
|
|
|
|
+ this.euler.y = y;
|
|
|
|
+ this.euler.z = z;
|
|
|
|
+
|
|
|
|
+ this.quaternion.setFromEuler( this.euler );
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ copy: function ( rotation ) {
|
|
|
|
+
|
|
|
|
+ this.euler.copy( rotation.euler );
|
|
|
|
+ this.quaternion.setFromEuler( this.euler );
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ fromArray: function( array ) {
|
|
|
|
+
|
|
|
|
+ this.euler.fromArray( array );
|
|
|
|
+ this.quaternion.setFromEuler( this.euler );
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ toArray: function () {
|
|
|
|
+
|
|
|
|
+ return this.euler.toArray();
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+};
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* @author bhouston / http://exocortex.com
|
|
* @author bhouston / http://exocortex.com
|
|
*/
|
|
*/
|
|
@@ -3859,24 +4073,20 @@ THREE.Matrix4.prototype = {
|
|
|
|
|
|
}(),
|
|
}(),
|
|
|
|
|
|
- setRotationFromEuler: function ( v, order ) {
|
|
|
|
-
|
|
|
|
- console.warn( 'DEPRECATED: Matrix4\'s .setRotationFromEuler() has been deprecated in favor of makeRotationFromEuler. Please update your code.' );
|
|
|
|
-
|
|
|
|
- return this.makeRotationFromEuler( v, order );
|
|
|
|
-
|
|
|
|
- },
|
|
|
|
|
|
+ makeRotationFromEuler: function ( rotation ) {
|
|
|
|
|
|
- makeRotationFromEuler: function ( v, order ) {
|
|
|
|
|
|
+ if( typeof rotation['order'] === undefined ) {
|
|
|
|
+ console.error( 'ERROR: Matrix\'s .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order. Please update your code.' );
|
|
|
|
+ }
|
|
|
|
|
|
var te = this.elements;
|
|
var te = this.elements;
|
|
|
|
|
|
- var x = v.x, y = v.y, z = v.z;
|
|
|
|
|
|
+ var x = rotation.x, y = rotation.y, z = rotation.z;
|
|
var a = Math.cos( x ), b = Math.sin( x );
|
|
var a = Math.cos( x ), b = Math.sin( x );
|
|
var c = Math.cos( y ), d = Math.sin( y );
|
|
var c = Math.cos( y ), d = Math.sin( y );
|
|
var e = Math.cos( z ), f = Math.sin( z );
|
|
var e = Math.cos( z ), f = Math.sin( z );
|
|
|
|
|
|
- if ( order === undefined || order === 'XYZ' ) {
|
|
|
|
|
|
+ if ( rotation.order === undefined || rotation.order === 'XYZ' ) {
|
|
|
|
|
|
var ae = a * e, af = a * f, be = b * e, bf = b * f;
|
|
var ae = a * e, af = a * f, be = b * e, bf = b * f;
|
|
|
|
|
|
@@ -3892,7 +4102,7 @@ THREE.Matrix4.prototype = {
|
|
te[6] = be + af * d;
|
|
te[6] = be + af * d;
|
|
te[10] = a * c;
|
|
te[10] = a * c;
|
|
|
|
|
|
- } else if ( order === 'YXZ' ) {
|
|
|
|
|
|
+ } else if ( rotation.order === 'YXZ' ) {
|
|
|
|
|
|
var ce = c * e, cf = c * f, de = d * e, df = d * f;
|
|
var ce = c * e, cf = c * f, de = d * e, df = d * f;
|
|
|
|
|
|
@@ -3908,7 +4118,7 @@ THREE.Matrix4.prototype = {
|
|
te[6] = df + ce * b;
|
|
te[6] = df + ce * b;
|
|
te[10] = a * c;
|
|
te[10] = a * c;
|
|
|
|
|
|
- } else if ( order === 'ZXY' ) {
|
|
|
|
|
|
+ } else if ( rotation.order === 'ZXY' ) {
|
|
|
|
|
|
var ce = c * e, cf = c * f, de = d * e, df = d * f;
|
|
var ce = c * e, cf = c * f, de = d * e, df = d * f;
|
|
|
|
|
|
@@ -3924,7 +4134,7 @@ THREE.Matrix4.prototype = {
|
|
te[6] = b;
|
|
te[6] = b;
|
|
te[10] = a * c;
|
|
te[10] = a * c;
|
|
|
|
|
|
- } else if ( order === 'ZYX' ) {
|
|
|
|
|
|
+ } else if ( rotation.order === 'ZYX' ) {
|
|
|
|
|
|
var ae = a * e, af = a * f, be = b * e, bf = b * f;
|
|
var ae = a * e, af = a * f, be = b * e, bf = b * f;
|
|
|
|
|
|
@@ -3940,7 +4150,7 @@ THREE.Matrix4.prototype = {
|
|
te[6] = b * c;
|
|
te[6] = b * c;
|
|
te[10] = a * c;
|
|
te[10] = a * c;
|
|
|
|
|
|
- } else if ( order === 'YZX' ) {
|
|
|
|
|
|
+ } else if ( rotation.order === 'YZX' ) {
|
|
|
|
|
|
var ac = a * c, ad = a * d, bc = b * c, bd = b * d;
|
|
var ac = a * c, ad = a * d, bc = b * c, bd = b * d;
|
|
|
|
|
|
@@ -3956,7 +4166,7 @@ THREE.Matrix4.prototype = {
|
|
te[6] = ad * f + bc;
|
|
te[6] = ad * f + bc;
|
|
te[10] = ac - bd * f;
|
|
te[10] = ac - bd * f;
|
|
|
|
|
|
- } else if ( order === 'XZY' ) {
|
|
|
|
|
|
+ } else if ( rotation.order === 'XZY' ) {
|
|
|
|
|
|
var ac = a * c, ad = a * d, bc = b * c, bd = b * d;
|
|
var ac = a * c, ad = a * d, bc = b * c, bd = b * d;
|
|
|
|
|
|
@@ -4576,9 +4786,13 @@ THREE.Matrix4.prototype = {
|
|
|
|
|
|
},
|
|
},
|
|
|
|
|
|
- makeFromPositionEulerScale: function ( position, rotation, eulerOrder, scale ) {
|
|
|
|
|
|
+ makeFromPositionEulerScale: function ( position, rotation, scale ) {
|
|
|
|
+
|
|
|
|
+ if( typeof rotation['order'] === undefined ) {
|
|
|
|
+ console.error( 'ERROR: Matrix4\'s .makeFromPositionEulerScale() now expects a Euler rotation rather than a Vector3 and order. Please update your code.' );
|
|
|
|
+ }
|
|
|
|
|
|
- this.makeRotationFromEuler( rotation, eulerOrder );
|
|
|
|
|
|
+ this.makeRotationFromEuler( rotation );
|
|
this.scale( scale );
|
|
this.scale( scale );
|
|
this.setPosition( position );
|
|
this.setPosition( position );
|
|
|
|
|
|
@@ -5398,6 +5612,7 @@ THREE.Plane.prototype = {
|
|
|
|
|
|
THREE.Math = {
|
|
THREE.Math = {
|
|
|
|
|
|
|
|
+ PI2: Math.PI * 2,
|
|
generateUUID: function () {
|
|
generateUUID: function () {
|
|
|
|
|
|
// http://www.broofa.com/Tools/Math.uuid.htm
|
|
// http://www.broofa.com/Tools/Math.uuid.htm
|
|
@@ -6459,10 +6674,12 @@ THREE.Object3D = function () {
|
|
this.up = new THREE.Vector3( 0, 1, 0 );
|
|
this.up = new THREE.Vector3( 0, 1, 0 );
|
|
|
|
|
|
this.position = new THREE.Vector3();
|
|
this.position = new THREE.Vector3();
|
|
- this.rotation = new THREE.Vector3();
|
|
|
|
- this.eulerOrder = THREE.Object3D.defaultEulerOrder;
|
|
|
|
|
|
+ this.quaternion = new THREE.Quaternion();
|
|
this.scale = new THREE.Vector3( 1, 1, 1 );
|
|
this.scale = new THREE.Vector3( 1, 1, 1 );
|
|
|
|
|
|
|
|
+ // for backwards compatibility (maps changes to this.rotation onto this.quaternion)
|
|
|
|
+ this.rotation = new THREE.Rotation( this.quaternion );
|
|
|
|
+
|
|
this.renderDepth = null;
|
|
this.renderDepth = null;
|
|
|
|
|
|
this.rotationAutoUpdate = true;
|
|
this.rotationAutoUpdate = true;
|
|
@@ -6473,9 +6690,6 @@ THREE.Object3D = function () {
|
|
this.matrixAutoUpdate = true;
|
|
this.matrixAutoUpdate = true;
|
|
this.matrixWorldNeedsUpdate = true;
|
|
this.matrixWorldNeedsUpdate = true;
|
|
|
|
|
|
- this.quaternion = new THREE.Quaternion();
|
|
|
|
- this.useQuaternion = false;
|
|
|
|
-
|
|
|
|
this.visible = true;
|
|
this.visible = true;
|
|
|
|
|
|
this.castShadow = false;
|
|
this.castShadow = false;
|
|
@@ -6511,15 +6725,7 @@ THREE.Object3D.prototype = {
|
|
|
|
|
|
m1.extractRotation( this.matrix );
|
|
m1.extractRotation( this.matrix );
|
|
|
|
|
|
- if ( this.useQuaternion === true ) {
|
|
|
|
-
|
|
|
|
- this.quaternion.setFromRotationMatrix( m1 );
|
|
|
|
-
|
|
|
|
- } else {
|
|
|
|
-
|
|
|
|
- this.rotation.setEulerFromRotationMatrix( m1, this.eulerOrder );
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
|
|
+ this.quaternion.setFromRotationMatrix( m1 );
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -6537,18 +6743,7 @@ THREE.Object3D.prototype = {
|
|
|
|
|
|
q1.setFromAxisAngle( axis, angle );
|
|
q1.setFromAxisAngle( axis, angle );
|
|
|
|
|
|
- if ( this.useQuaternion === true ) {
|
|
|
|
-
|
|
|
|
- this.quaternion.multiply( q1 );
|
|
|
|
-
|
|
|
|
- } else {
|
|
|
|
-
|
|
|
|
- q2.setFromEuler( this.rotation, this.eulerOrder );
|
|
|
|
- q2.multiply( q1 );
|
|
|
|
-
|
|
|
|
- this.rotation.setEulerFromQuaternion( q2, this.eulerOrder );
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
|
|
+ this.quaternion.multiply( q1 );
|
|
|
|
|
|
return this;
|
|
return this;
|
|
|
|
|
|
@@ -6567,15 +6762,7 @@ THREE.Object3D.prototype = {
|
|
|
|
|
|
v1.copy( axis );
|
|
v1.copy( axis );
|
|
|
|
|
|
- if ( this.useQuaternion === true ) {
|
|
|
|
-
|
|
|
|
- v1.applyQuaternion( this.quaternion );
|
|
|
|
-
|
|
|
|
- } else {
|
|
|
|
-
|
|
|
|
- v1.applyEuler( this.rotation, this.eulerOrder );
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
|
|
+ v1.applyQuaternion( this.quaternion );
|
|
|
|
|
|
this.position.add( v1.multiplyScalar( distance ) );
|
|
this.position.add( v1.multiplyScalar( distance ) );
|
|
|
|
|
|
@@ -6656,15 +6843,7 @@ THREE.Object3D.prototype = {
|
|
|
|
|
|
m1.lookAt( vector, this.position, this.up );
|
|
m1.lookAt( vector, this.position, this.up );
|
|
|
|
|
|
- if ( this.useQuaternion === true ) {
|
|
|
|
-
|
|
|
|
- this.quaternion.setFromRotationMatrix( m1 );
|
|
|
|
-
|
|
|
|
- } else {
|
|
|
|
-
|
|
|
|
- this.rotation.setEulerFromRotationMatrix( m1, this.eulerOrder );
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
|
|
+ this.quaternion.setFromRotationMatrix( m1 );
|
|
|
|
|
|
};
|
|
};
|
|
|
|
|
|
@@ -6836,17 +7015,7 @@ THREE.Object3D.prototype = {
|
|
|
|
|
|
updateMatrix: function () {
|
|
updateMatrix: function () {
|
|
|
|
|
|
- // if we are not using a quaternion directly, convert Euler rotation to this.quaternion.
|
|
|
|
-
|
|
|
|
- if ( this.useQuaternion === false ) {
|
|
|
|
-
|
|
|
|
- this.matrix.makeFromPositionEulerScale( this.position, this.rotation, this.eulerOrder, this.scale );
|
|
|
|
-
|
|
|
|
- } else {
|
|
|
|
-
|
|
|
|
- this.matrix.makeFromPositionQuaternionScale( this.position, this.quaternion, this.scale );
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
|
|
+ this.matrix.makeFromPositionQuaternionScale( this.position, this.quaternion, this.scale );
|
|
|
|
|
|
this.matrixWorldNeedsUpdate = true;
|
|
this.matrixWorldNeedsUpdate = true;
|
|
|
|
|
|
@@ -6894,8 +7063,7 @@ THREE.Object3D.prototype = {
|
|
object.up.copy( this.up );
|
|
object.up.copy( this.up );
|
|
|
|
|
|
object.position.copy( this.position );
|
|
object.position.copy( this.position );
|
|
- if ( object.rotation instanceof THREE.Vector3 ) object.rotation.copy( this.rotation ); // because of Sprite madness
|
|
|
|
- object.eulerOrder = this.eulerOrder;
|
|
|
|
|
|
+ object.quaternion.copy( this.quaternion );
|
|
object.scale.copy( this.scale );
|
|
object.scale.copy( this.scale );
|
|
|
|
|
|
object.renderDepth = this.renderDepth;
|
|
object.renderDepth = this.renderDepth;
|
|
@@ -6908,9 +7076,6 @@ THREE.Object3D.prototype = {
|
|
object.matrixAutoUpdate = this.matrixAutoUpdate;
|
|
object.matrixAutoUpdate = this.matrixAutoUpdate;
|
|
object.matrixWorldNeedsUpdate = this.matrixWorldNeedsUpdate;
|
|
object.matrixWorldNeedsUpdate = this.matrixWorldNeedsUpdate;
|
|
|
|
|
|
- object.quaternion.copy( this.quaternion );
|
|
|
|
- object.useQuaternion = this.useQuaternion;
|
|
|
|
-
|
|
|
|
object.visible = this.visible;
|
|
object.visible = this.visible;
|
|
|
|
|
|
object.castShadow = this.castShadow;
|
|
object.castShadow = this.castShadow;
|
|
@@ -9078,15 +9243,7 @@ THREE.Camera.prototype.lookAt = function () {
|
|
|
|
|
|
m1.lookAt( this.position, vector, this.up );
|
|
m1.lookAt( this.position, vector, this.up );
|
|
|
|
|
|
- if ( this.useQuaternion === true ) {
|
|
|
|
-
|
|
|
|
- this.quaternion.setFromRotationMatrix( m1 );
|
|
|
|
-
|
|
|
|
- } else {
|
|
|
|
-
|
|
|
|
- this.rotation.setEulerFromRotationMatrix( m1, this.eulerOrder );
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
|
|
+ this.quaternion.setFromRotationMatrix( m1 );
|
|
|
|
|
|
};
|
|
};
|
|
|
|
|
|
@@ -11367,7 +11524,6 @@ THREE.SceneLoader.prototype = {
|
|
if ( quat ) {
|
|
if ( quat ) {
|
|
|
|
|
|
object.quaternion.fromArray( quat );
|
|
object.quaternion.fromArray( quat );
|
|
- object.useQuaternion = true;
|
|
|
|
|
|
|
|
} else {
|
|
} else {
|
|
|
|
|
|
@@ -11458,7 +11614,6 @@ THREE.SceneLoader.prototype = {
|
|
if ( quat !== undefined ) {
|
|
if ( quat !== undefined ) {
|
|
|
|
|
|
camera.quaternion.fromArray( quat );
|
|
camera.quaternion.fromArray( quat );
|
|
- camera.useQuaternion = true;
|
|
|
|
|
|
|
|
} else if ( rot !== undefined ) {
|
|
} else if ( rot !== undefined ) {
|
|
|
|
|
|
@@ -11487,7 +11642,6 @@ THREE.SceneLoader.prototype = {
|
|
if ( quat ) {
|
|
if ( quat ) {
|
|
|
|
|
|
object.quaternion.fromArray( quat );
|
|
object.quaternion.fromArray( quat );
|
|
- object.useQuaternion = true;
|
|
|
|
|
|
|
|
} else {
|
|
} else {
|
|
|
|
|
|
@@ -11570,7 +11724,6 @@ THREE.SceneLoader.prototype = {
|
|
if ( q ) {
|
|
if ( q ) {
|
|
|
|
|
|
node.quaternion.fromArray( q );
|
|
node.quaternion.fromArray( q );
|
|
- node.useQuaternion = true;
|
|
|
|
|
|
|
|
} else {
|
|
} else {
|
|
|
|
|
|
@@ -13792,8 +13945,7 @@ THREE.SkinnedMesh = function ( geometry, material, useVertexTexture ) {
|
|
bone.name = gbone.name;
|
|
bone.name = gbone.name;
|
|
bone.position.set( p[0], p[1], p[2] );
|
|
bone.position.set( p[0], p[1], p[2] );
|
|
bone.quaternion.set( q[0], q[1], q[2], q[3] );
|
|
bone.quaternion.set( q[0], q[1], q[2], q[3] );
|
|
- bone.useQuaternion = true;
|
|
|
|
-
|
|
|
|
|
|
+
|
|
if ( s !== undefined ) {
|
|
if ( s !== undefined ) {
|
|
|
|
|
|
bone.scale.set( s[0], s[1], s[2] );
|
|
bone.scale.set( s[0], s[1], s[2] );
|
|
@@ -14375,8 +14527,8 @@ THREE.Sprite.prototype = Object.create( THREE.Object3D.prototype );
|
|
|
|
|
|
THREE.Sprite.prototype.updateMatrix = function () {
|
|
THREE.Sprite.prototype.updateMatrix = function () {
|
|
|
|
|
|
- this.rotation3d.set( 0, 0, this.rotation );
|
|
|
|
- this.quaternion.setFromEuler( this.rotation3d, this.eulerOrder );
|
|
|
|
|
|
+ this.rotation3d.set( 0, 0, this.rotation, this.rotation3d.order );
|
|
|
|
+ this.quaternion.setFromEuler( this.rotation3d );
|
|
this.matrix.makeFromPositionQuaternionScale( this.position, this.quaternion, this.scale );
|
|
this.matrix.makeFromPositionQuaternionScale( this.position, this.quaternion, this.scale );
|
|
|
|
|
|
this.matrixWorldNeedsUpdate = true;
|
|
this.matrixWorldNeedsUpdate = true;
|
|
@@ -30741,12 +30893,6 @@ THREE.Animation.prototype.play = function ( loop, startTimeMS ) {
|
|
|
|
|
|
object = this.hierarchy[ h ];
|
|
object = this.hierarchy[ h ];
|
|
|
|
|
|
- if ( this.interpolationType !== THREE.AnimationHandler.CATMULLROM_FORWARD ) {
|
|
|
|
-
|
|
|
|
- object.useQuaternion = true;
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
object.matrixAutoUpdate = true;
|
|
object.matrixAutoUpdate = true;
|
|
|
|
|
|
if ( object.animationCache === undefined ) {
|
|
if ( object.animationCache === undefined ) {
|
|
@@ -31162,7 +31308,6 @@ THREE.KeyFrameAnimation.prototype.play = function( loop, startTimeMS ) {
|
|
|
|
|
|
object = this.hierarchy[ h ];
|
|
object = this.hierarchy[ h ];
|
|
node = this.data.hierarchy[ h ];
|
|
node = this.data.hierarchy[ h ];
|
|
- object.useQuaternion = true;
|
|
|
|
|
|
|
|
if ( node.animationCache === undefined ) {
|
|
if ( node.animationCache === undefined ) {
|
|
|
|
|
|
@@ -34518,8 +34663,6 @@ THREE.ArrowHelper = function ( dir, origin, length, hex ) {
|
|
|
|
|
|
this.position = origin;
|
|
this.position = origin;
|
|
|
|
|
|
- this.useQuaternion = true;
|
|
|
|
-
|
|
|
|
var lineGeometry = new THREE.Geometry();
|
|
var lineGeometry = new THREE.Geometry();
|
|
lineGeometry.vertices.push( new THREE.Vector3( 0, 0, 0 ) );
|
|
lineGeometry.vertices.push( new THREE.Vector3( 0, 0, 0 ) );
|
|
lineGeometry.vertices.push( new THREE.Vector3( 0, 1, 0 ) );
|
|
lineGeometry.vertices.push( new THREE.Vector3( 0, 1, 0 ) );
|