提交 1fd0a3fb 编写于 作者: M Mr.doob

Updated builds.

上级 1e321b91
......@@ -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;
......
......@@ -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<e;d++){var f=a[d],g=c.parse(f);void 0!==f.id&&(g.id=f.id);void 0!==f.name&&(g.name=f.name);b[f.id]=g}return b},parseObject:function(){var a=new THREE.Matrix4;return function(b,c,d){var e;switch(b.type){case "Scene":e=new THREE.Scene;break;case "PerspectiveCamera":e=new THREE.PerspectiveCamera(b.fov,b.aspect,b.near,b.far);break;case "OrthographicCamera":e=new THREE.OrthographicCamera(b.left,b.right,b.top,b.bottom,b.near,b.far);break;
case "AmbientLight":e=new THREE.AmbientLight(b.color);break;case "DirectionalLight":e=new THREE.DirectionalLight(b.color,b.intensity);break;case "PointLight":e=new THREE.PointLight(b.color,b.intensity,b.distance);break;case "SpotLight":e=new THREE.SpotLight(b.color,b.intensity,b.distance,b.angle,b.exponent);break;case "HemisphereLight":e=new THREE.HemisphereLight(b.color,b.groundColor,b.intensity);break;case "Mesh":e=new THREE.Mesh(c[b.geometry],d[b.material]);break;default:e=new THREE.Object3D}a.fromArray(b.matrix);
a.decompose(e.position,e.quaternion,e.scale);e.rotation.updateEuler();void 0!==b.id&&(e.id=b.id);void 0!==b.name&&(e.name=b.name);void 0!==b.visible&&(e.visible=b.visible);void 0!==b.userData&&(e.userData=b.userData);if(void 0!==b.children)for(var f in b.children)e.add(this.parseObject(b.children[f],c,d));return e}}()};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){};this.geometryHandlers={};this.hierarchyHandlers={};this.addGeometryHandler("ascii",THREE.JSONLoader)};
case "AmbientLight":e=new THREE.AmbientLight(b.color);break;case "DirectionalLight":e=new THREE.DirectionalLight(b.color,b.intensity);break;case "PointLight":e=new THREE.PointLight(b.color,b.intensity,b.distance);break;case "SpotLight":e=new THREE.SpotLight(b.color,b.intensity,b.distance,b.angle,b.exponent);break;case "HemisphereLight":e=new THREE.HemisphereLight(b.color,b.groundColor,b.intensity);break;case "Mesh":e=new THREE.Mesh(c[b.geometry],d[b.material]);break;default:e=new THREE.Object3D}void 0!==
b.matrix?(a.fromArray(b.matrix),a.decompose(e.position,e.quaternion,e.scale),e.rotation.updateEuler()):(void 0!==b.position&&e.position.fromArray(b.position),void 0!==b.rotation&&e.rotation.fromArray(b.rotation),void 0!==b.scale&&e.scale.fromArray(b.scale));void 0!==b.id&&(e.id=b.id);void 0!==b.name&&(e.name=b.name);void 0!==b.visible&&(e.visible=b.visible);void 0!==b.userData&&(e.userData=b.userData);if(void 0!==b.children)for(var f in b.children)e.add(this.parseObject(b.children[f],c,d));return e}}()};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){};this.geometryHandlers={};this.hierarchyHandlers={};this.addGeometryHandler("ascii",THREE.JSONLoader)};
THREE.SceneLoader.prototype={constructor:THREE.SceneLoader,load:function(a,b){var c=this,d=new THREE.XHRLoader(c.manager);d.setCrossOrigin(this.crossOrigin);d.load(a,function(d){c.parse(JSON.parse(d),b,a)})},setCrossOrigin:function(a){this.crossOrigin=a},addGeometryHandler:function(a,b){this.geometryHandlers[a]={loaderClass:b}},addHierarchyHandler:function(a,b){this.hierarchyHandlers[a]={loaderClass:b}},parse:function(a,b,c){function d(a,b){return"relativeToHTML"==b?a:p+"/"+a}function e(){f(A.scene,
B.objects)}function f(a,b){var c,e,g,i,j,m,p;for(p in b){var r=A.objects[p],s=b[p];if(void 0===r){if(s.type&&s.type in l.hierarchyHandlers){if(void 0===s.loading){e={type:1,url:1,material:1,position:1,rotation:1,scale:1,visible:1,children:1,userData:1,skin:1,morph:1,mirroredLoop:1,duration:1};g={};for(var y in s)y in e||(g[y]=s[y]);t=A.materials[s.material];s.loading=!0;e=l.hierarchyHandlers[s.type].loaderObject;e.options?e.load(d(s.url,B.urlBaseType),h(p,a,t,s)):e.load(d(s.url,B.urlBaseType),h(p,
a,t,s),g)}}else if(void 0!==s.geometry){if(q=A.geometries[s.geometry]){r=!1;t=A.materials[s.material];r=t instanceof THREE.ShaderMaterial;g=s.position;i=s.rotation;j=s.scale;c=s.matrix;m=s.quaternion;s.material||(t=new THREE.MeshFaceMaterial(A.face_materials[s.geometry]));t instanceof THREE.MeshFaceMaterial&&0===t.materials.length&&(t=new THREE.MeshFaceMaterial(A.face_materials[s.geometry]));if(t instanceof THREE.MeshFaceMaterial)for(e=0;e<t.materials.length;e++)r=r||t.materials[e]instanceof THREE.ShaderMaterial;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册