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

Updated builds.

上级 4eebf6af
此差异已折叠。
......@@ -77,8 +77,8 @@ THREE.ClosedSplineCurve3=THREE.Curve.create(function(b){this.points=b==void 0?[]
d[c[1]].z,d[c[2]].z,d[c[3]].z,e);return a});THREE.CurvePath=function(){this.curves=[];this.bends=[];this.autoClose=false};THREE.CurvePath.prototype=Object.create(THREE.Curve.prototype);THREE.CurvePath.prototype.add=function(b){this.curves.push(b)};THREE.CurvePath.prototype.checkConnection=function(){};THREE.CurvePath.prototype.closePath=function(){var b=this.curves[0].getPoint(0),a=this.curves[this.curves.length-1].getPoint(1);b.equals(a)||this.curves.push(new THREE.LineCurve(a,b))};
THREE.CurvePath.prototype.getPoint=function(b){for(var a=b*this.getLength(),c=this.getCurveLengths(),b=0;b<c.length;){if(c[b]>=a){a=c[b]-a;b=this.curves[b];a=1-a/b.getLength();return b.getPointAt(a)}b++}return null};THREE.CurvePath.prototype.getLength=function(){var b=this.getCurveLengths();return b[b.length-1]};
THREE.CurvePath.prototype.getCurveLengths=function(){if(this.cacheLengths&&this.cacheLengths.length==this.curves.length)return this.cacheLengths;var b=[],a=0,c,d=this.curves.length;for(c=0;c<d;c++){a=a+this.curves[c].getLength();b.push(a)}return this.cacheLengths=b};
THREE.CurvePath.prototype.getBoundingBox=function(){var b=this.getPoints(),a,c,d,e;a=c=Number.NEGATIVE_INFINITY;d=e=Number.POSITIVE_INFINITY;var f,g,h,i;i=new THREE.Vector2;g=0;for(h=b.length;g<h;g++){f=b[g];if(f.x>a)a=f.x;else if(f.x<d)d=f.x;if(f.y>c)c=f.y;else if(f.y<e)e=f.y;i.addSelf(f.x,f.y)}return{minX:d,minY:e,maxX:a,maxY:c,centroid:i.divideScalar(h)}};THREE.CurvePath.prototype.createPointsGeometry=function(b){return this.createGeometry(this.getPoints(b,true))};
THREE.CurvePath.prototype.createSpacedPointsGeometry=function(b){return this.createGeometry(this.getSpacedPoints(b,true))};THREE.CurvePath.prototype.createGeometry=function(b){for(var a=new THREE.Geometry,c=0;c<b.length;c++)a.vertices.push(new THREE.Vector3(b[c].x,b[c].y,0));return a};THREE.CurvePath.prototype.addWrapPath=function(b){this.bends.push(b)};
THREE.CurvePath.prototype.getBoundingBox=function(){var b=this.getPoints(),a,c,d,e,f,g;a=c=Number.NEGATIVE_INFINITY;e=f=Number.POSITIVE_INFINITY;var h,i,j,l,m=b[0]instanceof THREE.Vector3;l=m?new THREE.Vector3:new THREE.Vector2;i=0;for(j=b.length;i<j;i++){h=b[i];if(h.x>a)a=h.x;else if(h.x<e)e=h.x;if(h.y>c)c=h.y;else if(h.y<f)f=h.y;if(m){if(h.z>d)d=h.z;else if(h.z<g)g=h.z;l.addSelf(h.x,h.y,h.z)}else l.addSelf(h.x,h.y)}b={minX:e,minY:f,maxX:a,maxY:c,centroid:l.divideScalar(j)};if(m){b.maxZ=d;b.minZ=
g}return b};THREE.CurvePath.prototype.createPointsGeometry=function(b){return this.createGeometry(this.getPoints(b,true))};THREE.CurvePath.prototype.createSpacedPointsGeometry=function(b){return this.createGeometry(this.getSpacedPoints(b,true))};THREE.CurvePath.prototype.createGeometry=function(b){for(var a=new THREE.Geometry,c=0;c<b.length;c++)a.vertices.push(new THREE.Vector3(b[c].x,b[c].y,b[c].z||0));return a};THREE.CurvePath.prototype.addWrapPath=function(b){this.bends.push(b)};
THREE.CurvePath.prototype.getTransformedPoints=function(b,a){var c=this.getPoints(b),d,e;if(!a)a=this.bends;d=0;for(e=a.length;d<e;d++)c=this.getWrapPoints(c,a[d]);return c};THREE.CurvePath.prototype.getTransformedSpacedPoints=function(b,a){var c=this.getSpacedPoints(b),d,e;if(!a)a=this.bends;d=0;for(e=a.length;d<e;d++)c=this.getWrapPoints(c,a[d]);return c};
THREE.CurvePath.prototype.getWrapPoints=function(b,a){var c=this.getBoundingBox(),d,e,f,g,h,i;d=0;for(e=b.length;d<e;d++){f=b[d];g=f.x;h=f.y;i=g/c.maxX;i=a.getUtoTmapping(i,g);g=a.getPoint(i);h=a.getNormalVector(i).multiplyScalar(h);f.x=g.x+h.x;f.y=g.y+h.y}return b};THREE.Gyroscope=function(){THREE.Object3D.call(this)};THREE.Gyroscope.prototype=Object.create(THREE.Object3D.prototype);
THREE.Gyroscope.prototype.updateMatrixWorld=function(b){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||b){if(this.parent){this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix);this.matrixWorld.decompose(this.translationWorld,this.rotationWorld,this.scaleWorld);this.matrix.decompose(this.translationObject,this.rotationObject,this.scaleObject);this.matrixWorld.compose(this.translationWorld,this.rotationObject,this.scaleWorld)}else this.matrixWorld.copy(this.matrix);
......@@ -87,8 +87,8 @@ THREE.Path=function(b){THREE.CurvePath.call(this);this.actions=[];b&&this.fromPo
THREE.Path.prototype.moveTo=function(b,a){var c=Array.prototype.slice.call(arguments);this.actions.push({action:THREE.PathActions.MOVE_TO,args:c})};THREE.Path.prototype.lineTo=function(b,a){var c=Array.prototype.slice.call(arguments),d=this.actions[this.actions.length-1].args;this.curves.push(new THREE.LineCurve(new THREE.Vector2(d[d.length-2],d[d.length-1]),new THREE.Vector2(b,a)));this.actions.push({action:THREE.PathActions.LINE_TO,args:c})};
THREE.Path.prototype.quadraticCurveTo=function(b,a,c,d){var e=Array.prototype.slice.call(arguments),f=this.actions[this.actions.length-1].args;this.curves.push(new THREE.QuadraticBezierCurve(new THREE.Vector2(f[f.length-2],f[f.length-1]),new THREE.Vector2(b,a),new THREE.Vector2(c,d)));this.actions.push({action:THREE.PathActions.QUADRATIC_CURVE_TO,args:e})};
THREE.Path.prototype.bezierCurveTo=function(b,a,c,d,e,f){var g=Array.prototype.slice.call(arguments),h=this.actions[this.actions.length-1].args;this.curves.push(new THREE.CubicBezierCurve(new THREE.Vector2(h[h.length-2],h[h.length-1]),new THREE.Vector2(b,a),new THREE.Vector2(c,d),new THREE.Vector2(e,f)));this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:g})};
THREE.Path.prototype.splineThru=function(b){var a=Array.prototype.slice.call(arguments),c=this.actions[this.actions.length-1].args,c=[new THREE.Vector2(c[c.length-2],c[c.length-1])];Array.prototype.push.apply(c,b);this.curves.push(new THREE.SplineCurve(c));this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:a})};THREE.Path.prototype.ellipse=function(b,a,c,d,e,f,g){var h=this.actions[this.actions.length-1];this.absellipse(h.x+b,h.y+a,c,d,e,f,g)};
THREE.Path.prototype.arc=function(b,a,c,d,e,f){var g=this.actions[this.actions.length-1];this.absarc(g.x+b,g.y+a,c,d,e,f)};THREE.Path.prototype.absellipse=function(b,a,c,d,e,f,g){var h=Array.prototype.slice.call(arguments),i=new THREE.EllipseCurve(b,a,c,d,e,f,g);this.curves.push(i);i=i.getPoint(g?1:0);h.push(i.x);h.push(i.y);this.actions.push({action:THREE.PathActions.ELLIPSE,args:h})};THREE.Path.prototype.absarc=function(b,a,c,d,e,f){this.absellipse(b,a,c,c,d,e,f)};
THREE.Path.prototype.splineThru=function(b){var a=Array.prototype.slice.call(arguments),c=this.actions[this.actions.length-1].args,c=[new THREE.Vector2(c[c.length-2],c[c.length-1])];Array.prototype.push.apply(c,b);this.curves.push(new THREE.SplineCurve(c));this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:a})};THREE.Path.prototype.arc=function(b,a,c,d,e,f){var g=this.actions[this.actions.length-1].args;this.absarc(b+g[g.length-2],a+g[g.length-1],c,d,e,f)};
THREE.Path.prototype.absarc=function(b,a,c,d,e,f){this.absellipse(b,a,c,c,d,e,f)};THREE.Path.prototype.ellipse=function(b,a,c,d,e,f,g){var h=this.actions[this.actions.length-1].args;this.absellipse(b+h[h.length-2],a+h[h.length-1],c,d,e,f,g)};THREE.Path.prototype.absellipse=function(b,a,c,d,e,f,g){var h=Array.prototype.slice.call(arguments),i=new THREE.EllipseCurve(b,a,c,d,e,f,g);this.curves.push(i);i=i.getPoint(g?1:0);h.push(i.x);h.push(i.y);this.actions.push({action:THREE.PathActions.ELLIPSE,args:h})};
THREE.Path.prototype.getSpacedPoints=function(b){b||(b=40);for(var a=[],c=0;c<b;c++)a.push(this.getPoint(c/b));return a};
THREE.Path.prototype.getPoints=function(b,a){if(this.useSpacedPoints){console.log("tata");return this.getSpacedPoints(b,a)}var b=b||12,c=[],d,e,f,g,h,i,j,l,m,n,k,o,q;d=0;for(e=this.actions.length;d<e;d++){f=this.actions[d];g=f.action;f=f.args;switch(g){case THREE.PathActions.MOVE_TO:c.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=f[2];i=f[3];m=f[0];n=f[1];if(c.length>0){g=c[c.length-1];
k=g.x;o=g.y}else{g=this.actions[d-1].args;k=g[g.length-2];o=g[g.length-1]}for(f=1;f<=b;f++){q=f/b;g=THREE.Shape.Utils.b2(q,k,m,h);q=THREE.Shape.Utils.b2(q,o,n,i);c.push(new THREE.Vector2(g,q))}break;case THREE.PathActions.BEZIER_CURVE_TO:h=f[4];i=f[5];m=f[0];n=f[1];j=f[2];l=f[3];if(c.length>0){g=c[c.length-1];k=g.x;o=g.y}else{g=this.actions[d-1].args;k=g[g.length-2];o=g[g.length-1]}for(f=1;f<=b;f++){q=f/b;g=THREE.Shape.Utils.b3(q,k,m,j,h);q=THREE.Shape.Utils.b3(q,o,n,l,i);c.push(new THREE.Vector2(g,
......@@ -186,8 +186,8 @@ r=e}}THREE.EventTarget.call(this);this.object=b;this.domElement=a!==void 0?a:doc
s=s-a};this.rotateRight=function(a){a===void 0&&(a=f());s=s+a};this.rotateUp=function(a){a===void 0&&(a=f());p=p-a};this.rotateDown=function(a){a===void 0&&(a=f());p=p+a};this.zoomIn=function(a){a===void 0&&(a=Math.pow(0.95,i.userZoomSpeed));u=u/a};this.zoomOut=function(a){a===void 0&&(a=Math.pow(0.95,i.userZoomSpeed));u=u*a};this.update=function(){var a=this.object.position,b=a.clone().subSelf(this.center),c=Math.atan2(b.x,b.z),d=Math.atan2(Math.sqrt(b.x*b.x+b.z*b.z),b.y);this.autoRotate&&this.rotateLeft(f());
var c=c+s,d=d+p,d=Math.max(1.0E-6,Math.min(Math.PI-1.0E-6,d)),e=b.length();b.x=e*Math.sin(d)*Math.sin(c);b.y=e*Math.cos(d);b.z=e*Math.sin(d)*Math.cos(c);b.multiplyScalar(u);a.copy(this.center).addSelf(b);this.object.lookAt(this.center);p=s=0;u=1;if(t.distanceTo(this.object.position)>0){this.dispatchEvent(v);t.copy(this.object.position)}};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},false);this.domElement.addEventListener("mousedown",function(a){if(i.userRotate){a.preventDefault();
if(a.button===0||a.button===2){r=c;l.set(a.clientX,a.clientY)}else if(a.button===1){r=d;k.set(a.clientX,a.clientY)}document.addEventListener("mousemove",g,false);document.addEventListener("mouseup",h,false)}},false);this.domElement.addEventListener("mousewheel",function(a){i.userZoom&&(a.wheelDelta>0?i.zoomOut():i.zoomIn())},false)};
THREE.CubeGeometry=function(b,a,c,d,e,f,g,h){function i(a,b,c,g,h,i,k,n){var m,l=d||1,o=e||1,q=h/2,p=i/2,s=j.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")m="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x"){m="y";o=f||1}else if(a==="z"&&b==="y"||a==="y"&&b==="z"){m="x";l=f||1}var t=l+1,u=o+1,I=h/l,M=i/o,J=new THREE.Vector3;J[m]=k>0?1:-1;for(h=0;h<u;h++)for(i=0;i<t;i++){var N=new THREE.Vector3;N[a]=(i*I-q)*c;N[b]=(h*M-p)*g;N[m]=k;j.vertices.push(N)}for(h=0;h<o;h++)for(i=0;i<l;i++){a=new THREE.Face4(i+
t*h+s,i+t*(h+1)+s,i+1+t*(h+1)+s,i+1+t*h+s);a.normal.copy(J);a.vertexNormals.push(J.clone(),J.clone(),J.clone(),J.clone());a.materialIndex=n;j.faces.push(a);j.faceVertexUvs[0].push([new THREE.UV(i/l,1-h/o),new THREE.UV(i/l,1-(h+1)/o),new THREE.UV((i+1)/l,1-(h+1)/o),new THREE.UV((i+1)/l,1-h/o)])}}THREE.Geometry.call(this);var j=this,l=b/2,m=a/2,n=c/2,k,o,q,p,s,u;if(g!==void 0){if(g instanceof Array)this.materials=g;else{this.materials=[];for(k=0;k<6;k++)this.materials.push(g)}k=0;p=1;o=2;s=3;q=4;u=
THREE.CubeGeometry=function(b,a,c,d,e,f,g,h){function i(a,b,c,g,h,i,k,m){var n,l=d||1,o=e||1,q=h/2,p=i/2,s=j.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")n="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x"){n="y";o=f||1}else if(a==="z"&&b==="y"||a==="y"&&b==="z"){n="x";l=f||1}var t=l+1,u=o+1,I=h/l,M=i/o,J=new THREE.Vector3;J[n]=k>0?1:-1;for(h=0;h<u;h++)for(i=0;i<t;i++){var N=new THREE.Vector3;N[a]=(i*I-q)*c;N[b]=(h*M-p)*g;N[n]=k;j.vertices.push(N)}for(h=0;h<o;h++)for(i=0;i<l;i++){a=new THREE.Face4(i+
t*h+s,i+t*(h+1)+s,i+1+t*(h+1)+s,i+1+t*h+s);a.normal.copy(J);a.vertexNormals.push(J.clone(),J.clone(),J.clone(),J.clone());a.materialIndex=m;j.faces.push(a);j.faceVertexUvs[0].push([new THREE.UV(i/l,1-h/o),new THREE.UV(i/l,1-(h+1)/o),new THREE.UV((i+1)/l,1-(h+1)/o),new THREE.UV((i+1)/l,1-h/o)])}}THREE.Geometry.call(this);var j=this,l=b/2,m=a/2,n=c/2,k,o,q,p,s,u;if(g!==void 0){if(g instanceof Array)this.materials=g;else{this.materials=[];for(k=0;k<6;k++)this.materials.push(g)}k=0;p=1;o=2;s=3;q=4;u=
5}else this.materials=[];this.sides={px:true,nx:true,py:true,ny:true,pz:true,nz:true};if(h!=void 0)for(var t in h)this.sides[t]!==void 0&&(this.sides[t]=h[t]);this.sides.px&&i("z","y",-1,-1,c,a,l,k);this.sides.nx&&i("z","y",1,-1,c,a,-l,p);this.sides.py&&i("x","z",1,1,b,c,m,o);this.sides.ny&&i("x","z",1,-1,b,c,-m,s);this.sides.pz&&i("x","y",1,-1,b,a,n,q);this.sides.nz&&i("x","y",-1,-1,b,a,-n,u);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=Object.create(THREE.Geometry.prototype);
THREE.CylinderGeometry=function(b,a,c,d,e,f){THREE.Geometry.call(this);var b=b!==void 0?b:20,a=a!==void 0?a:20,c=c!==void 0?c:100,g=c/2,d=d||8,e=e||1,h,i,j=[],l=[];for(i=0;i<=e;i++){var m=[],n=[],k=i/e,o=k*(a-b)+b;for(h=0;h<=d;h++){var q=h/d,p=new THREE.Vector3;p.x=o*Math.sin(q*Math.PI*2);p.y=-k*c+g;p.z=o*Math.cos(q*Math.PI*2);this.vertices.push(p);m.push(this.vertices.length-1);n.push(new THREE.UV(q,k))}j.push(m);l.push(n)}c=(a-b)/c;for(h=0;h<d;h++){if(b!==0){m=this.vertices[j[0][h]].clone();n=this.vertices[j[0][h+
1]].clone()}else{m=this.vertices[j[1][h]].clone();n=this.vertices[j[1][h+1]].clone()}m.setY(Math.sqrt(m.x*m.x+m.z*m.z)*c).normalize();n.setY(Math.sqrt(n.x*n.x+n.z*n.z)*c).normalize();for(i=0;i<e;i++){var k=j[i][h],o=j[i+1][h],q=j[i+1][h+1],p=j[i][h+1],s=m.clone(),u=m.clone(),t=n.clone(),r=n.clone(),v=l[i][h].clone(),z=l[i+1][h].clone(),A=l[i+1][h+1].clone(),x=l[i][h+1].clone();this.faces.push(new THREE.Face4(k,o,q,p,[s,u,t,r]));this.faceVertexUvs[0].push([v,z,A,x])}}if(!f&&b>0){this.vertices.push(new THREE.Vector3(0,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册