From 1fd0a3fb60aa2935f90afbe8f7bb25a519a2a066 Mon Sep 17 00:00:00 2001 From: "Mr.doob" Date: Sat, 29 Jun 2013 17:41:14 +0200 Subject: [PATCH] Updated builds. --- build/three.js | 24 +++++++++++++++++++++--- build/three.min.js | 8 ++++---- 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/build/three.js b/build/three.js index b19afbb878..b7823b4167 100644 --- a/build/three.js +++ b/build/three.js @@ -2966,6 +2966,13 @@ THREE.Rotation.prototype = { }, + setEulerFromRotationMatrix: function ( matrix, order ) { + + console.warn( 'DEPRECATED: Rotation\'s .setEulerFromRotationMatrix() has been renamed to .setFromRotationMatrix().' ); + return this.setFromRotationMatrix( matrix, order ); + + }, + setFromRotationMatrix: function ( matrix, order ) { this.euler.setFromRotationMatrix( matrix, order ); @@ -2996,6 +3003,7 @@ THREE.Rotation.prototype = { fromArray: function ( array ) { this.euler.fromArray( array ); + this.updateQuaternion(); return this; @@ -11239,10 +11247,20 @@ THREE.ObjectLoader.prototype = { } - matrix.fromArray( data.matrix ); - matrix.decompose( object.position, object.quaternion, object.scale ); + if ( data.matrix !== undefined ) { + + matrix.fromArray( data.matrix ); + matrix.decompose( object.position, object.quaternion, object.scale ); - object.rotation.updateEuler(); + object.rotation.updateEuler(); + + } else { + + if ( data.position !== undefined ) object.position.fromArray( data.position ); + if ( data.rotation !== undefined ) object.rotation.fromArray( data.rotation ); + if ( data.scale !== undefined ) object.scale.fromArray( data.scale ); + + } if ( data.id !== undefined ) object.id = data.id; if ( data.name !== undefined ) object.name = data.name; diff --git a/build/three.min.js b/build/three.min.js index e2047e14ea..be668b42f5 100644 --- a/build/three.min.js +++ b/build/three.min.js @@ -62,8 +62,8 @@ THREE.Euler.prototype={constructor:THREE.Euler,set:function(a,b,c,d){this.x=a;th a.z))),this.z=Math.atan2(2*(a.x*a.y+a.z*a.w),g+d-e-f)):"YZX"===b?(this.x=Math.atan2(2*(a.x*a.w-a.z*a.y),g-d+e-f),this.y=Math.atan2(2*(a.y*a.w-a.x*a.z),g+d-e-f),this.z=Math.asin(c(2*(a.x*a.y+a.z*a.w)))):"XZY"===b?(this.x=Math.atan2(2*(a.x*a.w+a.y*a.z),g-d+e-f),this.y=Math.atan2(2*(a.x*a.z+a.y*a.w),g+d-e-f),this.z=Math.asin(c(2*(a.z*a.w-a.x*a.y)))):console.warn("WARNING: Euler.setFromQuaternion() given unsupported order: "+b);this.order=b;return this},reorder:function(){var a=new THREE.Quaternion;return function(b){a.setFromEuler(this); this.setFromQuaternion(a,b)}}(),fromArray:function(a){this.x=a[0];this.y=a[1];this.z=a[2];this.order=a[3];return this},toArray:function(){return[this.x,this.y,this.z,this.order]},equals:function(a){return a.x===this.x&&a.y===this.y&&a.z===this.z&&a.order===this.order},clone:function(){return new THREE.Euler(this.x,this.y,this.z,this.order)}};THREE.Rotation=function(a){this.euler=new THREE.Euler;this.quaternion=a;this.updateEuler()}; THREE.Rotation.prototype={get x(){return this.euler.x},set x(a){this.euler.x=a;this.updateQuaternion()},get y(){return this.euler.y},set y(a){this.euler.y=a;this.updateQuaternion()},get z(){return this.euler.z},set z(a){this.euler.z=a;this.updateQuaternion()},set:function(a,b,c){this.euler.x=a;this.euler.y=b;this.euler.z=c;this.updateQuaternion();return this},setX:function(a){this.euler.x=a;this.updateQuaternion();return this},setY:function(a){this.euler.y=a;this.updateQuaternion();return this},setZ:function(a){this.euler.z= -a;this.updateQuaternion();return this},setFromRotationMatrix:function(a,b){this.euler.setFromRotationMatrix(a,b);this.updateQuaternion();return this},setFromQuaternion:function(a,b){this.euler.setFromQuaternion(a,b);this.quaternion.copy(a);return this},copy:function(a){this.euler.copy(a.euler);this.quaternion.copy(a.quaternion);return this},fromArray:function(a){this.euler.fromArray(a);return this},toArray:function(){return this.euler.toArray()},updateEuler:function(){this.euler.setFromQuaternion(this.quaternion); -return this},updateQuaternion:function(){this.quaternion.setFromEuler(this.euler);return this}};THREE.Line3=function(a,b){this.start=void 0!==a?a:new THREE.Vector3;this.end=void 0!==b?b:new THREE.Vector3}; +a;this.updateQuaternion();return this},setEulerFromRotationMatrix:function(a,b){console.warn("DEPRECATED: Rotation's .setEulerFromRotationMatrix() has been renamed to .setFromRotationMatrix().");return this.setFromRotationMatrix(a,b)},setFromRotationMatrix:function(a,b){this.euler.setFromRotationMatrix(a,b);this.updateQuaternion();return this},setFromQuaternion:function(a,b){this.euler.setFromQuaternion(a,b);this.quaternion.copy(a);return this},copy:function(a){this.euler.copy(a.euler);this.quaternion.copy(a.quaternion); +return this},fromArray:function(a){this.euler.fromArray(a);this.updateQuaternion();return this},toArray:function(){return this.euler.toArray()},updateEuler:function(){this.euler.setFromQuaternion(this.quaternion);return this},updateQuaternion:function(){this.quaternion.setFromEuler(this.euler);return this}};THREE.Line3=function(a,b){this.start=void 0!==a?a:new THREE.Vector3;this.end=void 0!==b?b:new THREE.Vector3}; THREE.Line3.prototype={constructor:THREE.Line3,set:function(a,b){this.start.copy(a);this.end.copy(b);return this},copy:function(a){this.start.copy(a.start);this.end.copy(a.end);return this},center:function(a){return(a||new THREE.Vector3).addVectors(this.start,this.end).multiplyScalar(0.5)},delta:function(a){return(a||new THREE.Vector3).subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(a, b){var c=b||new THREE.Vector3;return this.delta(c).multiplyScalar(a).add(this.start)},closestPointToPointParameter:function(){var a=new THREE.Vector3,b=new THREE.Vector3;return function(c,d){a.subVectors(c,this.start);b.subVectors(this.end,this.start);var e=b.dot(b),e=b.dot(a)/e;d&&(e=THREE.Math.clamp(e,0,1));return e}}(),closestPointToPoint:function(a,b,c){a=this.closestPointToPointParameter(a,b);c=c||new THREE.Vector3;return this.delta(c).multiplyScalar(a).add(this.start)},applyMatrix4:function(a){this.start.applyMatrix4(a); this.end.applyMatrix4(a);return this},equals:function(a){return a.start.equals(this.start)&&a.end.equals(this.end)},clone:function(){return(new THREE.Line3).copy(this)}};THREE.Box2=function(a,b){this.min=void 0!==a?a:new THREE.Vector2(Infinity,Infinity);this.max=void 0!==b?b:new THREE.Vector2(-Infinity,-Infinity)}; @@ -227,8 +227,8 @@ THREE.ObjectLoader.prototype={constructor:THREE.ObjectLoader,load:function(a,b){ g=a[d];switch(g.type){case "PlaneGeometry":f=new THREE.PlaneGeometry(g.width,g.height,g.widthSegments,g.heightSegments);break;case "CubeGeometry":f=new THREE.CubeGeometry(g.width,g.height,g.depth,g.widthSegments,g.heightSegments,g.depthSegments);break;case "CylinderGeometry":f=new THREE.CylinderGeometry(g.radiusTop,g.radiusBottom,g.height,g.radiusSegments,g.heightSegments,g.openEnded);break;case "SphereGeometry":f=new THREE.SphereGeometry(g.radius,g.widthSegments,g.heightSegments,g.phiStart,g.phiLength, g.thetaStart,g.thetaLength);break;case "IcosahedronGeometry":f=new THREE.IcosahedronGeometry(g.radius,g.detail);break;case "TorusGeometry":f=new THREE.TorusGeometry(g.radius,g.tube,g.radialSegments,g.tubularSegments,g.arc);break;case "TorusKnotGeometry":f=new THREE.TorusKnotGeometry(g.radius,g.tube,g.radialSegments,g.tubularSegments,g.p,g.q,g.heightScale);break;case "Geometry":f=c.parse(g.data).geometry}void 0!==g.id&&(f.id=g.id);void 0!==g.name&&(f.name=g.name);b[g.id]=f}return b},parseMaterials:function(a){var b= {};if(void 0!==a)for(var c=new THREE.MaterialLoader,d=0,e=a.length;d