|
@@ -625,8 +625,8 @@ t=t-a};this.rotateRight=function(a){a===void 0&&(a=f());t=t+a};this.rotateUp=fun
|
|
|
var c=c+t,d=d+q,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);q=t=0;u=1;if(w.distanceTo(this.object.position)>0){this.dispatchEvent(x);w.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){s=c;l.set(a.clientX,a.clientY)}else if(a.button===1){s=d;p.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(a,b,c,d,e,f,g,h){function i(a,b,c,g,h,i,l,m){var n,o=d||1,p=e||1,r=h/2,q=i/2,t=k.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";p=f||1}else if(a==="z"&&b==="y"||a==="y"&&b==="z"){n="x";o=f||1}var u=o+1,j=p+1,w=h/o,L=i/p,S=new THREE.Vector3;S[n]=l>0?1:-1;for(h=0;h<j;h++)for(i=0;i<u;i++){var aa=new THREE.Vector3;aa[a]=(i*w-r)*c;aa[b]=(h*L-q)*g;aa[n]=l;k.vertices.push(aa)}for(h=0;h<p;h++)for(i=0;i<o;i++){a=new THREE.Face4(i+
|
|
|
-u*h+t,i+u*(h+1)+t,i+1+u*(h+1)+t,i+1+u*h+t);a.normal.copy(S);a.vertexNormals.push(S.clone(),S.clone(),S.clone(),S.clone());a.materialIndex=m;k.faces.push(a);k.faceVertexUvs[0].push([new THREE.UV(i/o,h/p),new THREE.UV(i/o,(h+1)/p),new THREE.UV((i+1)/o,(h+1)/p),new THREE.UV((i+1)/o,h/p)])}}THREE.Geometry.call(this);var k=this,l=a/2,o=b/2,m=c/2,p,r,n,q,t,u;if(g!==void 0){if(g instanceof Array)this.materials=g;else{this.materials=[];for(p=0;p<6;p++)this.materials.push(g)}p=0;q=1;r=2;t=3;n=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 w in h)this.sides[w]!==void 0&&(this.sides[w]=h[w]);this.sides.px&&i("z","y",-1,-1,c,b,l,p);this.sides.nx&&i("z","y",1,-1,c,b,-l,q);this.sides.py&&i("x","z",1,1,a,c,o,r);this.sides.ny&&i("x","z",1,-1,a,c,-o,t);this.sides.pz&&i("x","y",1,-1,a,b,m,n);this.sides.nz&&i("x","y",-1,-1,a,b,-m,u);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=Object.create(THREE.Geometry.prototype);
|
|
|
+u*h+t,i+u*(h+1)+t,i+1+u*(h+1)+t,i+1+u*h+t);a.normal.copy(S);a.vertexNormals.push(S.clone(),S.clone(),S.clone(),S.clone());a.materialIndex=m;k.faces.push(a);k.faceVertexUvs[0].push([new THREE.UV(i/o,1-h/p),new THREE.UV(i/o,1-(h+1)/p),new THREE.UV((i+1)/o,1-(h+1)/p),new THREE.UV((i+1)/o,1-h/p)])}}THREE.Geometry.call(this);var k=this,l=a/2,o=b/2,m=c/2,p,r,n,q,t,u;if(g!==void 0){if(g instanceof Array)this.materials=g;else{this.materials=[];for(p=0;p<6;p++)this.materials.push(g)}p=0;q=1;r=2;t=3;n=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 w in h)this.sides[w]!==void 0&&(this.sides[w]=h[w]);this.sides.px&&i("z","y",-1,-1,c,b,l,p);this.sides.nx&&i("z","y",1,-1,c,b,-l,q);this.sides.py&&i("x","z",1,1,a,c,o,r);this.sides.ny&&i("x","z",1,-1,a,c,-o,t);this.sides.pz&&i("x","y",1,-1,a,b,m,n);this.sides.nz&&i("x","y",-1,-1,a,b,-m,u);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=a!==void 0?a:20,b=b!==void 0?b:20,c=c!==void 0?c:100,g=c/2,d=d||8,e=e||1,h,i,k=[],l=[];for(i=0;i<=e;i++){var o=[],m=[],p=i/e,r=p*(b-a)+a;for(h=0;h<=d;h++){var n=h/d,q=new THREE.Vector3;q.x=r*Math.sin(n*Math.PI*2);q.y=-p*c+g;q.z=r*Math.cos(n*Math.PI*2);this.vertices.push(q);o.push(this.vertices.length-1);m.push(new THREE.UV(n,p))}k.push(o);l.push(m)}c=(b-a)/c;for(h=0;h<d;h++){if(a!==0){o=this.vertices[k[0][h]].clone();m=this.vertices[k[0][h+
|
|
|
1]].clone()}else{o=this.vertices[k[1][h]].clone();m=this.vertices[k[1][h+1]].clone()}o.setY(Math.sqrt(o.x*o.x+o.z*o.z)*c).normalize();m.setY(Math.sqrt(m.x*m.x+m.z*m.z)*c).normalize();for(i=0;i<e;i++){var p=k[i][h],r=k[i+1][h],n=k[i+1][h+1],q=k[i][h+1],t=o.clone(),u=o.clone(),w=m.clone(),s=m.clone(),x=l[i][h].clone(),F=l[i+1][h].clone(),C=l[i+1][h+1].clone(),z=l[i][h+1].clone();this.faces.push(new THREE.Face4(p,r,n,q,[t,u,w,s]));this.faceVertexUvs[0].push([x,F,C,z])}}if(!f&&a>0){this.vertices.push(new THREE.Vector3(0,
|
|
|
g,0));for(h=0;h<d;h++){p=k[0][h];r=k[0][h+1];n=this.vertices.length-1;t=new THREE.Vector3(0,1,0);u=new THREE.Vector3(0,1,0);w=new THREE.Vector3(0,1,0);x=l[0][h].clone();F=l[0][h+1].clone();C=new THREE.UV(F.u,0);this.faces.push(new THREE.Face3(p,r,n,[t,u,w]));this.faceVertexUvs[0].push([x,F,C])}}if(!f&&b>0){this.vertices.push(new THREE.Vector3(0,-g,0));for(h=0;h<d;h++){p=k[i][h+1];r=k[i][h];n=this.vertices.length-1;t=new THREE.Vector3(0,-1,0);u=new THREE.Vector3(0,-1,0);w=new THREE.Vector3(0,-1,0);
|