|
@@ -60,9 +60,10 @@ THREE.Euler.prototype={constructor:THREE.Euler,set:function(a,b,c,d){this.x=a;th
|
|
|
(this.x=Math.atan2(-j,i),this.y=Math.atan2(-m,e)):(this.x=0,this.y=Math.atan2(g,d))):"XZY"===b?(this.z=Math.asin(-c(f)),0.99999>Math.abs(f)?(this.x=Math.atan2(l,i),this.y=Math.atan2(g,e)):(this.x=Math.atan2(-j,d),this.y=0)):console.warn("WARNING: Euler.setFromRotationMatrix() given unsupported order: "+b);this.order=b;return this},setFromQuaternion:function(a,b){function c(a){return Math.min(Math.max(a,-1),1)}var d=a.x*a.x,e=a.y*a.y,f=a.z*a.z,g=a.w*a.w,b=b||this.order;"XYZ"===b?(this.x=Math.atan2(2*
|
|
|
(a.x*a.w-a.y*a.z),g-d-e+f),this.y=Math.asin(c(2*(a.x*a.z+a.y*a.w))),this.z=Math.atan2(2*(a.z*a.w-a.x*a.y),g+d-e-f)):"YXZ"===b?(this.x=Math.asin(c(2*(a.x*a.w-a.y*a.z))),this.y=Math.atan2(2*(a.x*a.z+a.y*a.w),g-d-e+f),this.z=Math.atan2(2*(a.x*a.y+a.z*a.w),g-d+e-f)):"ZXY"===b?(this.x=Math.asin(c(2*(a.x*a.w+a.y*a.z))),this.y=Math.atan2(2*(a.y*a.w-a.z*a.x),g-d-e+f),this.z=Math.atan2(2*(a.z*a.w-a.x*a.y),g-d+e-f)):"ZYX"===b?(this.x=Math.atan2(2*(a.x*a.w+a.z*a.y),g-d-e+f),this.y=Math.asin(c(2*(a.y*a.w-a.x*
|
|
|
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).setFromQuaternion(a);this.quaternion=a};
|
|
|
-THREE.Rotation.prototype={get x(){return this.euler.x},set x(a){this.euler.x=a;this.quaternion.setFromEuler(this.euler)},get y(){return this.euler.y},set y(a){this.euler.y=a;this.quaternion.setFromEuler(this.euler)},get z(){return this.euler.z},set z(a){this.euler.z=a;this.quaternion.setFromEuler(this.euler)},set:function(a,b,c){this.euler.x=a;this.euler.y=b;this.euler.z=c;this.quaternion.setFromEuler(this.euler);return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},
|
|
|
-setZ:function(a){this.z=a;return this},setFromRotationMatrix:function(a,b){this.euler.setFromRotationMatrix(a,b);this.quaternion.setFromEuler(this.euler);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.setFromEuler(this.euler);return this},fromArray:function(a){this.euler.fromArray(a);this.quaternion.setFromEuler(this.euler);return this},toArray:function(){return this.euler.toArray()}};THREE.Line3=function(a,b){this.start=void 0!==a?a:new THREE.Vector3;this.end=void 0!==b?b:new THREE.Vector3};
|
|
|
+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};
|
|
|
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)};
|
|
@@ -83,7 +84,7 @@ THREE.Matrix3.prototype={constructor:THREE.Matrix3,set:function(a,b,c,d,e,f,g,h,
|
|
|
multiplyVector3Array:function(){var a=new THREE.Vector3;return function(b){for(var c=0,d=b.length;c<d;c+=3)a.x=b[c],a.y=b[c+1],a.z=b[c+2],a.applyMatrix3(this),b[c]=a.x,b[c+1]=a.y,b[c+2]=a.z;return b}}(),multiplyScalar:function(a){var b=this.elements;b[0]*=a;b[3]*=a;b[6]*=a;b[1]*=a;b[4]*=a;b[7]*=a;b[2]*=a;b[5]*=a;b[8]*=a;return this},determinant:function(){var a=this.elements,b=a[0],c=a[1],d=a[2],e=a[3],f=a[4],g=a[5],h=a[6],i=a[7],a=a[8];return b*f*a-b*g*i-c*e*a+c*g*h+d*e*i-d*f*h},getInverse:function(a,
|
|
|
b){var c=a.elements,d=this.elements;d[0]=c[10]*c[5]-c[6]*c[9];d[1]=-c[10]*c[1]+c[2]*c[9];d[2]=c[6]*c[1]-c[2]*c[5];d[3]=-c[10]*c[4]+c[6]*c[8];d[4]=c[10]*c[0]-c[2]*c[8];d[5]=-c[6]*c[0]+c[2]*c[4];d[6]=c[9]*c[4]-c[5]*c[8];d[7]=-c[9]*c[0]+c[1]*c[8];d[8]=c[5]*c[0]-c[1]*c[4];c=c[0]*d[0]+c[1]*d[3]+c[2]*d[6];if(0===c){if(b)throw Error("Matrix3.getInverse(): can't invert matrix, determinant is 0");console.warn("Matrix3.getInverse(): can't invert matrix, determinant is 0");this.identity();return this}this.multiplyScalar(1/
|
|
|
c);return this},transpose:function(){var a,b=this.elements;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},getNormalMatrix:function(a){this.getInverse(a).transpose();return this},transposeIntoArray:function(a){var b=this.elements;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this},clone:function(){var a=this.elements;return new THREE.Matrix3(a[0],a[3],a[6],a[1],a[4],a[7],a[2],a[5],a[8])}};THREE.Matrix4=function(a,b,c,d,e,f,g,h,i,j,m,l,p,q,t,n){var r=this.elements=new Float32Array(16);r[0]=void 0!==a?a:1;r[4]=b||0;r[8]=c||0;r[12]=d||0;r[1]=e||0;r[5]=void 0!==f?f:1;r[9]=g||0;r[13]=h||0;r[2]=i||0;r[6]=j||0;r[10]=void 0!==m?m:1;r[14]=l||0;r[3]=p||0;r[7]=q||0;r[11]=t||0;r[15]=void 0!==n?n:1};
|
|
|
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,f,g,h,i,j,m,l,p,q,t,n){var r=this.elements;r[0]=a;r[4]=b;r[8]=c;r[12]=d;r[1]=e;r[5]=f;r[9]=g;r[13]=h;r[2]=i;r[6]=j;r[10]=m;r[14]=l;r[3]=p;r[7]=q;r[11]=t;r[15]=n;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){a=a.elements;this.set(a[0],a[4],a[8],a[12],a[1],a[5],a[9],a[13],a[2],a[6],a[10],a[14],a[3],a[7],a[11],a[15]);return this},extractPosition:function(a){console.warn("DEPRECATED: Matrix4's .extractPosition() has been renamed to .copyPosition().");
|
|
|
+THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,f,g,h,i,j,m,l,p,q,t,n){var r=this.elements;r[0]=a;r[4]=b;r[8]=c;r[12]=d;r[1]=e;r[5]=f;r[9]=g;r[13]=h;r[2]=i;r[6]=j;r[10]=m;r[14]=l;r[3]=p;r[7]=q;r[11]=t;r[15]=n;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.elements.set(a.elements);return this},extractPosition:function(a){console.warn("DEPRECATED: Matrix4's .extractPosition() has been renamed to .copyPosition().");
|
|
|
return this.copyPosition(a)},copyPosition:function(a){var b=this.elements,a=a.elements;b[12]=a[12];b[13]=a[13];b[14]=a[14];return this},extractRotation:function(){var a=new THREE.Vector3;return function(b){var c=this.elements,b=b.elements,d=1/a.set(b[0],b[1],b[2]).length(),e=1/a.set(b[4],b[5],b[6]).length(),f=1/a.set(b[8],b[9],b[10]).length();c[0]=b[0]*d;c[1]=b[1]*d;c[2]=b[2]*d;c[4]=b[4]*e;c[5]=b[5]*e;c[6]=b[6]*e;c[8]=b[8]*f;c[9]=b[9]*f;c[10]=b[10]*f;return this}}(),makeRotationFromEuler:function(a){void 0===
|
|
|
typeof a.order&&console.error("ERROR: Matrix's .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order. Please update your code.");var b=this.elements,c=a.x,d=a.y,e=a.z,f=Math.cos(c),c=Math.sin(c),g=Math.cos(d),d=Math.sin(d),h=Math.cos(e),e=Math.sin(e);if(void 0===a.order||"XYZ"===a.order){var a=f*h,i=f*e,j=c*h,m=c*e;b[0]=g*h;b[4]=-g*e;b[8]=d;b[1]=i+j*d;b[5]=a-m*d;b[9]=-c*g;b[2]=m-a*d;b[6]=j+i*d;b[10]=f*g}else"YXZ"===a.order?(a=g*h,i=g*e,j=d*h,m=d*e,b[0]=a+m*c,b[4]=
|
|
|
j*c-i,b[8]=f*d,b[1]=f*e,b[5]=f*h,b[9]=-c,b[2]=i*c-j,b[6]=m+a*c,b[10]=f*g):"ZXY"===a.order?(a=g*h,i=g*e,j=d*h,m=d*e,b[0]=a-m*c,b[4]=-f*e,b[8]=j+i*c,b[1]=i+j*c,b[5]=f*h,b[9]=m-a*c,b[2]=-f*d,b[6]=c,b[10]=f*g):"ZYX"===a.order?(a=f*h,i=f*e,j=c*h,m=c*e,b[0]=g*h,b[4]=j*d-i,b[8]=a*d+m,b[1]=g*e,b[5]=m*d+a,b[9]=i*d-j,b[2]=-d,b[6]=c*g,b[10]=f*g):"YZX"===a.order?(a=f*g,i=f*d,j=c*g,m=c*d,b[0]=g*h,b[4]=m-a*e,b[8]=j*e+i,b[1]=e,b[5]=f*h,b[9]=-c*h,b[2]=-d*h,b[6]=i*e+j,b[10]=a-m*e):"XZY"===a.order&&(a=f*g,i=f*d,j=
|
|
@@ -103,7 +104,8 @@ scale:function(a){var b=this.elements,c=a.x,d=a.y,a=a.z;b[0]*=c;b[4]*=d;b[8]*=a;
|
|
|
0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},makeRotationY:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},makeRotationZ:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},makeRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,f=a.x,g=a.y,h=a.z,i=e*f,j=e*g;this.set(i*f+c,i*g-d*h,i*h+d*g,0,i*g+d*h,j*g+c,j*h-d*f,0,i*h-d*g,j*h+d*f,e*h*h+c,0,0,0,0,1);return this},makeScale:function(a,b,c){this.set(a,
|
|
|
0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},compose:function(a,b,c){console.warn("DEPRECATED: Matrix4's .compose() has been deprecated in favor of makeFromPositionQuaternionScale. Please update your code.");return this.makeFromPositionQuaternionScale(a,b,c)},makeFromPositionQuaternionScale:function(a,b,c){this.makeRotationFromQuaternion(b);this.scale(c);this.setPosition(a);return this},makeFromPositionEulerScale:function(a,b,c){void 0===typeof b.order&&console.error("ERROR: Matrix4's .makeFromPositionEulerScale() now expects a Euler rotation rather than a Vector3 and order. Please update your code.");
|
|
|
this.makeRotationFromEuler(b);this.scale(c);this.setPosition(a);return this},makeFrustum:function(a,b,c,d,e,f){var g=this.elements;g[0]=2*e/(b-a);g[4]=0;g[8]=(b+a)/(b-a);g[12]=0;g[1]=0;g[5]=2*e/(d-c);g[9]=(d+c)/(d-c);g[13]=0;g[2]=0;g[6]=0;g[10]=-(f+e)/(f-e);g[14]=-2*f*e/(f-e);g[3]=0;g[7]=0;g[11]=-1;g[15]=0;return this},makePerspective:function(a,b,c,d){var a=c*Math.tan(THREE.Math.degToRad(0.5*a)),e=-a;return this.makeFrustum(e*b,a*b,e,a,c,d)},makeOrthographic:function(a,b,c,d,e,f){var g=this.elements,
|
|
|
-h=b-a,i=c-d,j=f-e;g[0]=2/h;g[4]=0;g[8]=0;g[12]=-((b+a)/h);g[1]=0;g[5]=2/i;g[9]=0;g[13]=-((c+d)/i);g[2]=0;g[6]=0;g[10]=-2/j;g[14]=-((f+e)/j);g[3]=0;g[7]=0;g[11]=0;g[15]=1;return this},clone:function(){var a=this.elements;return new THREE.Matrix4(a[0],a[4],a[8],a[12],a[1],a[5],a[9],a[13],a[2],a[6],a[10],a[14],a[3],a[7],a[11],a[15])}};
|
|
|
+h=b-a,i=c-d,j=f-e;g[0]=2/h;g[4]=0;g[8]=0;g[12]=-((b+a)/h);g[1]=0;g[5]=2/i;g[9]=0;g[13]=-((c+d)/i);g[2]=0;g[6]=0;g[10]=-2/j;g[14]=-((f+e)/j);g[3]=0;g[7]=0;g[11]=0;g[15]=1;return this},fromArray:function(a){this.elements.set(a);return this},toArray:function(){var a=this.elements;return[a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9],a[10],a[11],a[12],a[13],a[14],a[15]]},clone:function(){var a=this.elements;return new THREE.Matrix4(a[0],a[4],a[8],a[12],a[1],a[5],a[9],a[13],a[2],a[6],a[10],a[14],a[3],
|
|
|
+a[7],a[11],a[15])}};
|
|
|
THREE.extend(THREE.Matrix4.prototype,{decompose:function(){var a=new THREE.Vector3,b=new THREE.Vector3,c=new THREE.Vector3,d=new THREE.Matrix4;return function(e,f,g){var h=this.elements;a.set(h[0],h[1],h[2]);b.set(h[4],h[5],h[6]);c.set(h[8],h[9],h[10]);e=e instanceof THREE.Vector3?e:new THREE.Vector3;f=f instanceof THREE.Quaternion?f:new THREE.Quaternion;g=g instanceof THREE.Vector3?g:new THREE.Vector3;g.x=a.length();g.y=b.length();g.z=c.length();e.x=h[12];e.y=h[13];e.z=h[14];d.copy(this);d.elements[0]/=
|
|
|
g.x;d.elements[1]/=g.x;d.elements[2]/=g.x;d.elements[4]/=g.y;d.elements[5]/=g.y;d.elements[6]/=g.y;d.elements[8]/=g.z;d.elements[9]/=g.z;d.elements[10]/=g.z;f.setFromRotationMatrix(d);return[e,f,g]}}()});THREE.Ray=function(a,b){this.origin=void 0!==a?a:new THREE.Vector3;this.direction=void 0!==b?b:new THREE.Vector3};
|
|
|
THREE.Ray.prototype={constructor:THREE.Ray,set:function(a,b){this.origin.copy(a);this.direction.copy(b);return this},copy:function(a){this.origin.copy(a.origin);this.direction.copy(a.direction);return this},at:function(a,b){return(b||new THREE.Vector3).copy(this.direction).multiplyScalar(a).add(this.origin)},recast:function(){var a=new THREE.Vector3;return function(b){this.origin.copy(this.at(b,a));return this}}(),closestPointToPoint:function(a,b){var c=b||new THREE.Vector3;c.subVectors(a,this.origin);
|
|
@@ -224,10 +226,9 @@ transparent:a.transparent,wireframe:a.wireframe})}return b}};THREE.ObjectLoader=
|
|
|
THREE.ObjectLoader.prototype={constructor:THREE.ObjectLoader,load:function(a,b){var c=this,d=new THREE.XHRLoader(c.manager);d.setCrossOrigin(this.crossOrigin);d.load(a,function(a){b(c.parse(JSON.parse(a)))})},setCrossOrigin:function(a){this.crossOrigin=a},parse:function(a){var b=this.parseGeometries(a.geometries),c=this.parseMaterials(a.materials);return this.parseObject(a.object,b,c)},parseGeometries:function(a){var b={};if(void 0!==a)for(var c=new THREE.JSONLoader,d=0,e=a.length;d<e;d++){var f,
|
|
|
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(a,b,c){var d;switch(a.type){case "Scene":d=new THREE.Scene;break;case "PerspectiveCamera":d=new THREE.PerspectiveCamera(a.fov,a.aspect,a.near,a.far);d.position.fromArray(a.position);d.rotation.fromArray(a.rotation);break;case "OrthographicCamera":d=new THREE.OrthographicCamera(a.left,a.right,a.top,a.bottom,
|
|
|
-a.near,a.far);d.position.fromArray(a.position);d.rotation.fromArray(a.rotation);break;case "AmbientLight":d=new THREE.AmbientLight(a.color);break;case "DirectionalLight":d=new THREE.DirectionalLight(a.color,a.intensity);d.position.fromArray(a.position);break;case "PointLight":d=new THREE.PointLight(a.color,a.intensity,a.distance);d.position.fromArray(a.position);break;case "SpotLight":d=new THREE.SpotLight(a.color,a.intensity,a.distance,a.angle,a.exponent);d.position.fromArray(a.position);break;case "HemisphereLight":d=
|
|
|
-new THREE.HemisphereLight(a.color,a.groundColor,a.intensity);d.position.fromArray(a.position);break;case "Mesh":d=new THREE.Mesh(b[a.geometry],c[a.material]);d.position.fromArray(a.position);d.rotation.fromArray(a.rotation);d.scale.fromArray(a.scale);break;default:d=new THREE.Object3D,d.position.fromArray(a.position),d.rotation.fromArray(a.rotation),d.scale.fromArray(a.scale)}void 0!==a.id&&(d.id=a.id);void 0!==a.name&&(d.name=a.name);void 0!==a.visible&&(d.visible=a.visible);void 0!==a.userData&&
|
|
|
-(d.userData=a.userData);if(void 0!==a.children)for(var e in a.children)d.add(this.parseObject(a.children[e],b,c));return d}};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)};
|
|
|
+{};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)};
|
|
|
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;
|