|
@@ -599,10 +599,10 @@ THREE.CombinedCamera.prototype.toBackView=function(){this.rotation.x=0;this.rota
|
|
|
THREE.CombinedCamera.prototype.toTopView=function(){this.rotation.x=-Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toBottomView=function(){this.rotation.x=Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CircleGeometry=function(a,b,c,d){THREE.Geometry.call(this);var a=a||50,c=void 0!==c?c:0,d=void 0!==d?d:2*Math.PI,b=void 0!==b?Math.max(3,b):8,e,f=[];e=new THREE.Vector3;var g=new THREE.Vector2(0.5,0.5);this.vertices.push(e);f.push(g);for(e=0;e<=b;e++){var h=new THREE.Vector3,i=c+e/b*d;h.x=a*Math.cos(i);h.y=a*Math.sin(i);this.vertices.push(h);f.push(new THREE.Vector2((h.x/a+1)/2,-(h.y/a+1)/2+1))}c=new THREE.Vector3(0,0,-1);for(e=1;e<=b;e++)this.faces.push(new THREE.Face3(e,e+1,0,[c,c,c])),this.faceVertexUvs[0].push([f[e],
|
|
|
f[e+1],g]);this.computeCentroids();this.computeFaceNormals();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,a)};THREE.CircleGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.CubeGeometry=function(a,b,c,d,e,f){function g(a,b,c,d,e,f,g,n){var q,y=h.widthSegments,v=h.heightSegments,w=e/2,t=f/2,D=h.vertices.length;if("x"===a&&"y"===b||"y"===a&&"x"===b)q="z";else if("x"===a&&"z"===b||"z"===a&&"x"===b)q="y",v=h.depthSegments;else if("z"===a&&"y"===b||"y"===a&&"z"===b)q="x",y=h.depthSegments;var I=y+1,F=v+1,z=e/y,G=f/v,L=new THREE.Vector3;L[q]=0<g?1:-1;for(e=0;e<F;e++)for(f=0;f<I;f++){var J=new THREE.Vector3;J[a]=(f*z-w)*c;J[b]=(e*G-t)*d;J[q]=g;h.vertices.push(J)}for(e=
|
|
|
0;e<v;e++)for(f=0;f<y;f++)a=new THREE.Face4(f+I*e+D,f+I*(e+1)+D,f+1+I*(e+1)+D,f+1+I*e+D),a.normal.copy(L),a.vertexNormals.push(L.clone(),L.clone(),L.clone(),L.clone()),a.materialIndex=n,h.faces.push(a),h.faceVertexUvs[0].push([new THREE.Vector2(f/y,1-e/v),new THREE.Vector2(f/y,1-(e+1)/v),new THREE.Vector2((f+1)/y,1-(e+1)/v),new THREE.Vector2((f+1)/y,1-e/v)])}THREE.Geometry.call(this);var h=this;this.width=a;this.height=b;this.depth=c;this.widthSegments=d||1;this.heightSegments=e||1;this.depthSegments=
|
|
|
-f||1;a=this.width/2;b=this.height/2;c=this.depth/2;g("z","y",-1,-1,this.depth,this.height,a,0);g("z","y",1,-1,this.depth,this.height,-a,1);g("x","z",1,1,this.width,this.depth,b,2);g("x","z",1,-1,this.width,this.depth,-b,3);g("x","y",1,-1,this.width,this.height,c,4);g("x","y",-1,-1,this.width,this.height,-c,5);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.CylinderGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);var a=void 0!==a?a:20,b=void 0!==b?b:20,c=void 0!==c?c:100,g=c/2,d=d||8,e=e||1,h,i,k=[],m=[];for(i=0;i<=e;i++){var p=[],l=[],s=i/e,r=s*(b-a)+a;for(h=0;h<=d;h++){var n=h/d,q=new THREE.Vector3;q.x=r*Math.sin(2*n*Math.PI);q.y=-s*c+g;q.z=r*Math.cos(2*n*Math.PI);this.vertices.push(q);p.push(this.vertices.length-1);l.push(new THREE.Vector2(n,1-s))}k.push(p);m.push(l)}c=(b-a)/c;for(h=0;h<d;h++){0!==a?(p=this.vertices[k[0][h]].clone(),
|
|
|
-l=this.vertices[k[0][h+1]].clone()):(p=this.vertices[k[1][h]].clone(),l=this.vertices[k[1][h+1]].clone());p.setY(Math.sqrt(p.x*p.x+p.z*p.z)*c).normalize();l.setY(Math.sqrt(l.x*l.x+l.z*l.z)*c).normalize();for(i=0;i<e;i++){var s=k[i][h],r=k[i+1][h],n=k[i+1][h+1],q=k[i][h+1],y=p.clone(),v=p.clone(),w=l.clone(),t=l.clone(),D=m[i][h].clone(),I=m[i+1][h].clone(),F=m[i+1][h+1].clone(),z=m[i][h+1].clone();this.faces.push(new THREE.Face4(s,r,n,q,[y,v,w,t]));this.faceVertexUvs[0].push([D,I,F,z])}}if(!f&&0<
|
|
|
-a){this.vertices.push(new THREE.Vector3(0,g,0));for(h=0;h<d;h++)s=k[0][h],r=k[0][h+1],n=this.vertices.length-1,y=new THREE.Vector3(0,1,0),v=new THREE.Vector3(0,1,0),w=new THREE.Vector3(0,1,0),D=m[0][h].clone(),I=m[0][h+1].clone(),F=new THREE.Vector2(I.u,0),this.faces.push(new THREE.Face3(s,r,n,[y,v,w])),this.faceVertexUvs[0].push([D,I,F])}if(!f&&0<b){this.vertices.push(new THREE.Vector3(0,-g,0));for(h=0;h<d;h++)s=k[i][h+1],r=k[i][h],n=this.vertices.length-1,y=new THREE.Vector3(0,-1,0),v=new THREE.Vector3(0,
|
|
|
--1,0),w=new THREE.Vector3(0,-1,0),D=m[i][h+1].clone(),I=m[i][h].clone(),F=new THREE.Vector2(I.u,1),this.faces.push(new THREE.Face3(s,r,n,[y,v,w])),this.faceVertexUvs[0].push([D,I,F])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ExtrudeGeometry=function(a,b){"undefined"!==typeof a&&(THREE.Geometry.call(this),a=a instanceof Array?a:[a],this.shapebb=a[a.length-1].getBoundingBox(),this.addShapeList(a,b),this.computeCentroids(),this.computeFaceNormals())};THREE.ExtrudeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ExtrudeGeometry.prototype.addShapeList=function(a,b){for(var c=a.length,d=0;d<c;d++)this.addShape(a[d],b)};
|
|
|
+f||1;a=this.width/2;b=this.height/2;c=this.depth/2;g("z","y",-1,-1,this.depth,this.height,a,0);g("z","y",1,-1,this.depth,this.height,-a,1);g("x","z",1,1,this.width,this.depth,b,2);g("x","z",1,-1,this.width,this.depth,-b,3);g("x","y",1,-1,this.width,this.height,c,4);g("x","y",-1,-1,this.width,this.height,-c,5);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.CylinderGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);this.radiusTop=a=void 0!==a?a:20;this.radiusBottom=b=void 0!==b?b:20;this.height=c=void 0!==c?c:100;this.radiusSegments=d=d||8;this.heightSegments=e=e||1;this.openEnded=f=void 0!==f?f:!1;var g=c/2,h,i,k=[],m=[];for(i=0;i<=e;i++){var p=[],l=[],s=i/e,r=s*(b-a)+a;for(h=0;h<=d;h++){var n=h/d,q=new THREE.Vector3;q.x=r*Math.sin(2*n*Math.PI);q.y=-s*c+g;q.z=r*Math.cos(2*n*Math.PI);this.vertices.push(q);p.push(this.vertices.length-1);l.push(new THREE.Vector2(n,
|
|
|
+1-s))}k.push(p);m.push(l)}c=(b-a)/c;for(h=0;h<d;h++){0!==a?(p=this.vertices[k[0][h]].clone(),l=this.vertices[k[0][h+1]].clone()):(p=this.vertices[k[1][h]].clone(),l=this.vertices[k[1][h+1]].clone());p.setY(Math.sqrt(p.x*p.x+p.z*p.z)*c).normalize();l.setY(Math.sqrt(l.x*l.x+l.z*l.z)*c).normalize();for(i=0;i<e;i++){var s=k[i][h],r=k[i+1][h],n=k[i+1][h+1],q=k[i][h+1],y=p.clone(),v=p.clone(),w=l.clone(),t=l.clone(),D=m[i][h].clone(),I=m[i+1][h].clone(),F=m[i+1][h+1].clone(),z=m[i][h+1].clone();this.faces.push(new THREE.Face4(s,
|
|
|
+r,n,q,[y,v,w,t]));this.faceVertexUvs[0].push([D,I,F,z])}}if(!1===f&&0<a){this.vertices.push(new THREE.Vector3(0,g,0));for(h=0;h<d;h++)s=k[0][h],r=k[0][h+1],n=this.vertices.length-1,y=new THREE.Vector3(0,1,0),v=new THREE.Vector3(0,1,0),w=new THREE.Vector3(0,1,0),D=m[0][h].clone(),I=m[0][h+1].clone(),F=new THREE.Vector2(I.u,0),this.faces.push(new THREE.Face3(s,r,n,[y,v,w])),this.faceVertexUvs[0].push([D,I,F])}if(!1===f&&0<b){this.vertices.push(new THREE.Vector3(0,-g,0));for(h=0;h<d;h++)s=k[i][h+1],
|
|
|
+r=k[i][h],n=this.vertices.length-1,y=new THREE.Vector3(0,-1,0),v=new THREE.Vector3(0,-1,0),w=new THREE.Vector3(0,-1,0),D=m[i][h+1].clone(),I=m[i][h].clone(),F=new THREE.Vector2(I.u,1),this.faces.push(new THREE.Face3(s,r,n,[y,v,w])),this.faceVertexUvs[0].push([D,I,F])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ExtrudeGeometry=function(a,b){"undefined"!==typeof a&&(THREE.Geometry.call(this),a=a instanceof Array?a:[a],this.shapebb=a[a.length-1].getBoundingBox(),this.addShapeList(a,b),this.computeCentroids(),this.computeFaceNormals())};THREE.ExtrudeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ExtrudeGeometry.prototype.addShapeList=function(a,b){for(var c=a.length,d=0;d<c;d++)this.addShape(a[d],b)};
|
|
|
THREE.ExtrudeGeometry.prototype.addShape=function(a,b){function c(a,b,c){b||console.log("die");return b.clone().multiplyScalar(c).add(a)}function d(a,b,c){var d=THREE.ExtrudeGeometry.__v1,e=THREE.ExtrudeGeometry.__v2,f=THREE.ExtrudeGeometry.__v3,g=THREE.ExtrudeGeometry.__v4,h=THREE.ExtrudeGeometry.__v5,i=THREE.ExtrudeGeometry.__v6;d.set(a.x-b.x,a.y-b.y);e.set(a.x-c.x,a.y-c.y);d=d.normalize();e=e.normalize();f.set(-d.y,d.x);g.set(e.y,-e.x);h.copy(a).add(f);i.copy(a).add(g);if(h.equals(i))return g.clone();
|
|
|
h.copy(b).add(f);i.copy(c).add(g);f=d.dot(g);g=i.sub(h).dot(g);0===f&&(console.log("Either infinite or no solutions!"),0===g?console.log("Its finite solutions."):console.log("Too bad, no solutions."));g/=f;return 0>g?(b=Math.atan2(b.y-a.y,b.x-a.x),a=Math.atan2(c.y-a.y,c.x-a.x),b>a&&(a+=2*Math.PI),c=(b+a)/2,a=-Math.cos(c),c=-Math.sin(c),new THREE.Vector2(a,c)):d.multiplyScalar(g).add(h).sub(a).clone()}function e(c,d){var e,f;for(B=c.length;0<=--B;){e=B;f=B-1;0>f&&(f=c.length-1);for(var g=0,h=s+2*m,
|
|
|
g=0;g<h;g++){var i=$*g,k=$*(g+1),l=d+e+i,i=d+f+i,p=d+f+k,k=d+e+k,n=c,q=g,r=h,t=e,y=f,l=l+N,i=i+N,p=p+N,k=k+N;J.faces.push(new THREE.Face4(l,i,p,k,null,null,v));l=w.generateSideWallUV(J,a,n,b,l,i,p,k,q,r,t,y);J.faceVertexUvs[0].push(l)}}}function f(a,b,c){J.vertices.push(new THREE.Vector3(a,b,c))}function g(c,d,e,f){c+=N;d+=N;e+=N;J.faces.push(new THREE.Face3(c,d,e,null,null,y));c=f?w.generateBottomUV(J,a,b,c,d,e):w.generateTopUV(J,a,b,c,d,e);J.faceVertexUvs[0].push(c)}var h=void 0!==b.amount?b.amount:
|