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

Updated builds.

上级 5b22bffd
......@@ -481,7 +481,7 @@ b.clientY):this.noPan||(w=u=this.getMouseOnScreen(b.clientX,b.clientY))}),!1);th
this.STATE.NONE&&(f=!0)}}),!1);window.addEventListener("keyup",e(this,function(){if(h!==this.STATE.NONE)h=this.STATE.NONE}),!1)};THREE.TrackballControls.prototype.STATE={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};
THREE.CubeGeometry=function(b,c,e,f,h,k,m,n,p){function t(b,e,c,m,n,t,p,u){var v,x,z=f||1,A=h||1,P=n/2,Q=t/2,T=w.vertices.length;if(b=="x"&&e=="y"||b=="y"&&e=="x")v="z";else if(b=="x"&&e=="z"||b=="z"&&e=="x")v="y",A=k||1;else if(b=="z"&&e=="y"||b=="y"&&e=="z")v="x",z=k||1;var X=z+1,o=A+1;n/=z;var ea=t/A;for(x=0;x<o;x++)for(t=0;t<X;t++){var V=new THREE.Vector3;V[b]=(t*n-P)*c;V[e]=(x*ea-Q)*m;V[v]=p;w.vertices.push(new THREE.Vertex(V))}for(x=0;x<A;x++)for(t=0;t<z;t++)w.faces.push(new THREE.Face4(t+X*
x+T,t+X*(x+1)+T,t+1+X*(x+1)+T,t+1+X*x+T,null,null,u)),w.faceVertexUvs[0].push([new THREE.UV(t/z,x/A),new THREE.UV(t/z,(x+1)/A),new THREE.UV((t+1)/z,(x+1)/A),new THREE.UV((t+1)/z,x/A)])}THREE.Geometry.call(this);var w=this,u=b/2,x=c/2,v=e/2,n=n?-1:1;if(m!==void 0)if(m instanceof Array)this.materials=m;else{this.materials=[];for(var A=0;A<6;A++)this.materials.push([m])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(p!=void 0)for(var z in p)this.sides[z]!=void 0&&(this.sides[z]=
p[z]);this.sides.px&&t("z","y",1*n,-1,e,c,-u,this.materials[0]);this.sides.nx&&t("z","y",-1*n,-1,e,c,u,this.materials[1]);this.sides.py&&t("x","z",1*n,1,b,e,x,this.materials[2]);this.sides.ny&&t("x","z",1*n,-1,b,e,-x,this.materials[3]);this.sides.pz&&t("x","y",1*n,-1,b,c,v,this.materials[4]);this.sides.nz&&t("x","y",-1*n,-1,b,c,-v,this.materials[5]);this.mergeVertices();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;
p[z]);this.sides.px&&t("z","y",-1*n,-1,e,c,u,this.materials[0]);this.sides.nx&&t("z","y",1*n,-1,e,c,-u,this.materials[1]);this.sides.py&&t("x","z",1*n,1,b,e,x,this.materials[2]);this.sides.ny&&t("x","z",1*n,-1,b,e,-x,this.materials[3]);this.sides.pz&&t("x","y",1*n,-1,b,c,v,this.materials[4]);this.sides.nz&&t("x","y",-1*n,-1,b,c,-v,this.materials[5]);this.mergeVertices();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;
THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
THREE.CylinderGeometry=function(b,c,e,f,h,k){THREE.Geometry.call(this);var b=b!=null?b:20,c=c!=null?c:20,e=e||100,m=e/2,f=f||8,h=h||1,n,p,t=[],w=[];for(p=0;p<=h;p++){var u=[],x=[],v=p/h,A=v*(c-b)+b;for(n=0;n<=f;n++){var z=n/f;this.vertices.push(new THREE.Vertex(new THREE.Vector3(A*Math.sin(z*Math.PI*2),-v*e+m,A*Math.cos(z*Math.PI*2))));u.push(this.vertices.length-1);x.push(new THREE.UV(z,v))}t.push(u);w.push(x)}for(p=0;p<h;p++)for(n=0;n<f;n++){var e=t[p][n],u=t[p+1][n],x=t[p+1][n+1],v=t[p][n+1],A=
this.vertices[e].position.clone().setY(0).normalize(),z=this.vertices[u].position.clone().setY(0).normalize(),y=this.vertices[x].position.clone().setY(0).normalize(),E=this.vertices[v].position.clone().setY(0).normalize(),F=w[p][n].clone(),D=w[p+1][n].clone(),G=w[p+1][n+1].clone(),L=w[p][n+1].clone();this.faces.push(new THREE.Face4(e,u,x,v,[A,z,y,E]));this.faceVertexUvs[0].push([F,D,G,L])}if(!k&&b>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,m,0)));for(n=0;n<f;n++)e=t[0][n],u=t[0][n+
......
......@@ -138,7 +138,7 @@ a.clientY):this.noPan||(n=o=this.getMouseOnScreen(a.clientX,a.clientY))}),!1);th
this.STATE.NONE&&(e=!0)}}),!1);window.addEventListener("keyup",c(this,function(){if(g!==this.STATE.NONE)g=this.STATE.NONE}),!1)};THREE.TrackballControls.prototype.STATE={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};
THREE.CubeGeometry=function(a,b,c,e,g,h,f,k,l){function m(a,c,b,f,k,l,m,o){var u,t,y=e||1,v=g||1,F=k/2,J=l/2,L=n.vertices.length;if(a=="x"&&c=="y"||a=="y"&&c=="x")u="z";else if(a=="x"&&c=="z"||a=="z"&&c=="x")u="y",v=h||1;else if(a=="z"&&c=="y"||a=="y"&&c=="z")u="x",y=h||1;var N=y+1,K=v+1;k/=y;var P=l/v;for(t=0;t<K;t++)for(l=0;l<N;l++){var G=new THREE.Vector3;G[a]=(l*k-F)*b;G[c]=(t*P-J)*f;G[u]=m;n.vertices.push(new THREE.Vertex(G))}for(t=0;t<v;t++)for(l=0;l<y;l++)n.faces.push(new THREE.Face4(l+N*t+
L,l+N*(t+1)+L,l+1+N*(t+1)+L,l+1+N*t+L,null,null,o)),n.faceVertexUvs[0].push([new THREE.UV(l/y,t/v),new THREE.UV(l/y,(t+1)/v),new THREE.UV((l+1)/y,(t+1)/v),new THREE.UV((l+1)/y,t/v)])}THREE.Geometry.call(this);var n=this,o=a/2,t=b/2,u=c/2,k=k?-1:1;if(f!==void 0)if(f instanceof Array)this.materials=f;else{this.materials=[];for(var y=0;y<6;y++)this.materials.push([f])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(l!=void 0)for(var v in l)this.sides[v]!=void 0&&(this.sides[v]=
l[v]);this.sides.px&&m("z","y",1*k,-1,c,b,-o,this.materials[0]);this.sides.nx&&m("z","y",-1*k,-1,c,b,o,this.materials[1]);this.sides.py&&m("x","z",1*k,1,a,c,t,this.materials[2]);this.sides.ny&&m("x","z",1*k,-1,a,c,-t,this.materials[3]);this.sides.pz&&m("x","y",1*k,-1,a,b,u,this.materials[4]);this.sides.nz&&m("x","y",-1*k,-1,a,b,-u,this.materials[5]);this.mergeVertices();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;
l[v]);this.sides.px&&m("z","y",-1*k,-1,c,b,o,this.materials[0]);this.sides.nx&&m("z","y",1*k,-1,c,b,-o,this.materials[1]);this.sides.py&&m("x","z",1*k,1,a,c,t,this.materials[2]);this.sides.ny&&m("x","z",1*k,-1,a,c,-t,this.materials[3]);this.sides.pz&&m("x","y",1*k,-1,a,b,u,this.materials[4]);this.sides.nz&&m("x","y",-1*k,-1,a,b,-u,this.materials[5]);this.mergeVertices();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;
THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
THREE.CylinderGeometry=function(a,b,c,e,g,h){THREE.Geometry.call(this);var a=a!=null?a:20,b=b!=null?b:20,c=c||100,f=c/2,e=e||8,g=g||1,k,l,m=[],n=[];for(l=0;l<=g;l++){var o=[],t=[],u=l/g,y=u*(b-a)+a;for(k=0;k<=e;k++){var v=k/e;this.vertices.push(new THREE.Vertex(new THREE.Vector3(y*Math.sin(v*Math.PI*2),-u*c+f,y*Math.cos(v*Math.PI*2))));o.push(this.vertices.length-1);t.push(new THREE.UV(v,u))}m.push(o);n.push(t)}for(l=0;l<g;l++)for(k=0;k<e;k++){var c=m[l][k],o=m[l+1][k],t=m[l+1][k+1],u=m[l][k+1],y=
this.vertices[c].position.clone().setY(0).normalize(),v=this.vertices[o].position.clone().setY(0).normalize(),p=this.vertices[t].position.clone().setY(0).normalize(),z=this.vertices[u].position.clone().setY(0).normalize(),w=n[l][k].clone(),x=n[l+1][k].clone(),A=n[l+1][k+1].clone(),D=n[l][k+1].clone();this.faces.push(new THREE.Face4(c,o,t,u,[y,v,p,z]));this.faceVertexUvs[0].push([w,x,A,D])}if(!h&&a>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,f,0)));for(k=0;k<e;k++)c=m[0][k],o=m[0][k+
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册