|
@@ -336,8 +336,8 @@ this.lat=this.mouseY=this.mouseX=0;this.windowHalfX=window.innerWidth/2;this.win
|
|
|
this.phi=(this.phi-u[0])*(o[1]-o[0])/(u[1]-u[0])+o[0];u=this.horizontalAngleMap.srcRange;o=this.horizontalAngleMap.dstRange;this.theta=(this.theta-u[0])*(o[1]-o[0])/(u[1]-u[0])+o[0];u=this.target.position;u.x=100*Math.sin(this.phi)*Math.cos(this.theta);u.y=100*Math.cos(this.phi);u.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,n,p,v)};this.onMouseMove=function(n){this.mouseX=n.clientX-this.windowHalfX;this.mouseY=n.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);
|
|
|
this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){a=new THREE.MeshLambertMaterial({color:30719});var h=new THREE.MeshLambertMaterial({color:65280}),m=new Cube(10,10,20),j=new Cube(2,2,10);this.animationParent=new THREE.Mesh(m,a);a=new THREE.Mesh(j,h);a.position.set(0,10,0);this.animation=c(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this);this.animationParent.addChild(this.target);this.animationParent.addChild(a)}else{this.animation=
|
|
|
c(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this.target);this.animationParent.addChild(this)}this.createDebugPath&&d(this.debugPath,this.spline);this.domElement.addEventListener("mousemove",function(n,p){return function(){p.apply(n,arguments)}}(this,this.onMouseMove),!1)};THREE.PathCamera.prototype=new THREE.Camera;THREE.PathCamera.prototype.constructor=THREE.PathCamera;THREE.PathCamera.prototype.supr=THREE.Camera.prototype;THREE.PathCameraIdCounter=0;
|
|
|
-var Cube=function(a,c,b,d,f,g,h,m,j){function n(E,w,M,J,N,R,da,O){var e,Y,V=d||1,ma=f||1,ka=N/2,K=R/2,ea=p.vertices.length;if(E=="x"&&w=="y"||E=="y"&&w=="x")e="z";else if(E=="x"&&w=="z"||E=="z"&&w=="x"){e="y";ma=g||1}else if(E=="z"&&w=="y"||E=="y"&&w=="z"){e="x";V=g||1}var Ha=V+1,fa=ma+1;N/=V;var Ca=R/ma;for(Y=0;Y<fa;Y++)for(R=0;R<Ha;R++){var na=new THREE.Vector3;na[E]=(R*N-ka)*M;na[w]=(Y*Ca-K)*J;na[e]=da;p.vertices.push(new THREE.Vertex(na))}for(Y=0;Y<ma;Y++)for(R=0;R<V;R++){p.faces.push(new THREE.Face4(R+
|
|
|
-Ha*Y+ea,R+Ha*(Y+1)+ea,R+1+Ha*(Y+1)+ea,R+1+Ha*Y+ea,null,null,O));p.faceVertexUvs.push([new THREE.UV(R/V,Y/ma),new THREE.UV(R/V,(Y+1)/ma),new THREE.UV((R+1)/V,(Y+1)/ma),new THREE.UV((R+1)/V,Y/ma)])}}THREE.Geometry.call(this);var p=this,v=a/2,u=c/2,o=b/2;m=m?-1:1;if(h!==undefined)if(h instanceof Array)this.materials=h;else{this.materials=[];for(var x=0;x<6;x++)this.materials.push([h])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(j!=undefined)for(var B in j)this.sides[B]!=
|
|
|
+var Cube=function(a,c,b,d,f,g,h,m,j){function n(E,w,M,J,N,R,da,O){var e,Y,V=d||1,ma=f||1,ka=N/2,K=R/2,ea=p.vertices.length;if(E=="x"&&w=="y"||E=="y"&&w=="x")e="z";else if(E=="x"&&w=="z"||E=="z"&&w=="x"){e="y";ma=g||1}else if(E=="z"&&w=="y"||E=="y"&&w=="z"){e="x";V=g||1}var Ha=V+1,fa=ma+1;N/=V;var Ca=R/ma;for(Y=0;Y<fa;Y++)for(R=0;R<Ha;R++){var na=new THREE.Vector3;na[E]=(R*N-ka)*M;na[w]=(Y*Ca-K)*J;na[e]=da;p.vertices.push(new THREE.Vertex(na))}p.faceVertexUvs[0]=[];for(Y=0;Y<ma;Y++)for(R=0;R<V;R++){p.faces.push(new THREE.Face4(R+
|
|
|
+Ha*Y+ea,R+Ha*(Y+1)+ea,R+1+Ha*(Y+1)+ea,R+1+Ha*Y+ea,null,null,O));p.faceVertexUvs[0].push([new THREE.UV(R/V,Y/ma),new THREE.UV(R/V,(Y+1)/ma),new THREE.UV((R+1)/V,(Y+1)/ma),new THREE.UV((R+1)/V,Y/ma)])}}THREE.Geometry.call(this);var p=this,v=a/2,u=c/2,o=b/2;m=m?-1:1;if(h!==undefined)if(h instanceof Array)this.materials=h;else{this.materials=[];for(var x=0;x<6;x++)this.materials.push([h])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(j!=undefined)for(var B in j)this.sides[B]!=
|
|
|
undefined&&(this.sides[B]=j[B]);this.sides.px&&n("z","y",1*m,-1,b,c,-v,this.materials[0]);this.sides.nx&&n("z","y",-1*m,-1,b,c,v,this.materials[1]);this.sides.py&&n("x","z",1*m,1,a,b,u,this.materials[2]);this.sides.ny&&n("x","z",1*m,-1,a,b,-u,this.materials[3]);this.sides.pz&&n("x","y",1*m,-1,a,c,o,this.materials[4]);this.sides.nz&&n("x","y",-1*m,-1,a,c,-o,this.materials[5]);(function(){for(var E=[],w=[],M=0,J=p.vertices.length;M<J;M++){for(var N=p.vertices[M],R=!1,da=0,O=E.length;da<O;da++){var e=
|
|
|
E[da];if(N.position.x==e.position.x&&N.position.y==e.position.y&&N.position.z==e.position.z){w[M]=da;R=!0;break}}if(!R){w[M]=E.length;E.push(new THREE.Vertex(N.position.clone()))}}M=0;for(J=p.faces.length;M<J;M++){N=p.faces[M];N.a=w[N.a];N.b=w[N.b];N.c=w[N.c];N.d=w[N.d]}p.vertices=E})();this.computeCentroids();this.computeFaceNormals()};Cube.prototype=new THREE.Geometry;Cube.prototype.constructor=Cube;
|
|
|
var Cylinder=function(a,c,b,d,f,g){function h(p,v,u){m.vertices.push(new THREE.Vertex(new THREE.Vector3(p,v,u)))}THREE.Geometry.call(this);var m=this,j=Math.PI,n=d/2;for(d=0;d<a;d++)h(Math.sin(2*j*d/a)*c,Math.cos(2*j*d/a)*c,-n);for(d=0;d<a;d++)h(Math.sin(2*j*d/a)*b,Math.cos(2*j*d/a)*b,n);for(d=0;d<a;d++)m.faces.push(new THREE.Face4(d,d+a,a+(d+1)%a,(d+1)%a));if(b>0){h(0,0,-n-(g||0));for(d=a;d<a+a/2;d++)m.faces.push(new THREE.Face4(2*a,(2*d-2*a)%a,(2*d-2*a+1)%a,(2*d-2*a+2)%a))}if(c>0){h(0,0,n+(f||0));
|
|
@@ -347,8 +347,8 @@ var Icosahedron=function(a){function c(v,u,o){var x=Math.sqrt(v*v+u*u+o*o);retur
|
|
|
p,n,h);b(j,n,p,h)}g.faces=h.faces}f.faces=g.faces;delete g;delete h;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Icosahedron.prototype=new THREE.Geometry;Icosahedron.prototype.constructor=Icosahedron;
|
|
|
function Lathe(a,c,b){THREE.Geometry.call(this);this.steps=c||12;this.angle=b||2*Math.PI;c=this.angle/this.steps;for(var d=[],f=[],g=[],h=[],m=0;m<a.length;m++){this.vertices.push(new THREE.Vertex(a[m]));d[m]=a[m].clone();f[m]=this.vertices.length-1}for(var j=(new THREE.Matrix4).setRotationZ(c),n=0;n<=this.angle+0.0010;n+=c){for(m=0;m<d.length;m++)if(n<this.angle){d[m]=j.multiplyVector3(d[m].clone());this.vertices.push(new THREE.Vertex(d[m]));g[m]=this.vertices.length-1}else g=h;n==0&&(h=f);for(m=
|
|
|
0;m<f.length-1;m++){this.faces.push(new THREE.Face4(g[m],g[m+1],f[m+1],f[m]));this.uvs.push([new THREE.UV(n/b,m/a.length),new THREE.UV(n/b,(m+1)/a.length),new THREE.UV((n-c)/b,(m+1)/a.length),new THREE.UV((n-c)/b,m/a.length)])}f=g;g=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()}Lathe.prototype=new THREE.Geometry;Lathe.prototype.constructor=Lathe;
|
|
|
-var Plane=function(a,c,b,d){THREE.Geometry.call(this);var f,g=a/2,h=c/2;b=b||1;d=d||1;var m=b+1,j=d+1;a/=b;var n=c/d;for(f=0;f<j;f++)for(c=0;c<m;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*a-g,-(f*n-h),0)));for(f=0;f<d;f++)for(c=0;c<b;c++){this.faces.push(new THREE.Face4(c+m*f,c+m*(f+1),c+1+m*(f+1),c+1+m*f));this.faceVertexUvs.push([new THREE.UV(c/b,f/d),new THREE.UV(c/b,(f+1)/d),new THREE.UV((c+1)/b,(f+1)/d),new THREE.UV((c+1)/b,f/d)])}this.computeCentroids();this.computeFaceNormals()};
|
|
|
-Plane.prototype=new THREE.Geometry;Plane.prototype.constructor=Plane;
|
|
|
+var Plane=function(a,c,b,d){THREE.Geometry.call(this);var f,g=a/2,h=c/2;b=b||1;d=d||1;var m=b+1,j=d+1;a/=b;var n=c/d;for(f=0;f<j;f++)for(c=0;c<m;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*a-g,-(f*n-h),0)));this.faceVertexUvs[0]=[];for(f=0;f<d;f++)for(c=0;c<b;c++){this.faces.push(new THREE.Face4(c+m*f,c+m*(f+1),c+1+m*(f+1),c+1+m*f));this.faceVertexUvs[0].push([new THREE.UV(c/b,f/d),new THREE.UV(c/b,(f+1)/d),new THREE.UV((c+1)/b,(f+1)/d),new THREE.UV((c+1)/b,f/d)])}this.computeCentroids();
|
|
|
+this.computeFaceNormals()};Plane.prototype=new THREE.Geometry;Plane.prototype.constructor=Plane;
|
|
|
var Sphere=function(a,c,b){THREE.Geometry.call(this);var d,f=Math.PI,g=Math.max(3,c||8),h=Math.max(2,b||6);c=[];for(b=0;b<h+1;b++){d=b/h;var m=a*Math.cos(d*f),j=a*Math.sin(d*f),n=[],p=0;for(d=0;d<g;d++){var v=2*d/g,u=j*Math.sin(v*f);v=j*Math.cos(v*f);(b==0||b==h)&&d>0||(p=this.vertices.push(new THREE.Vertex(new THREE.Vector3(v,m,u)))-1);n.push(p)}c.push(n)}var o,x,B;f=c.length;for(b=0;b<f;b++){g=c[b].length;if(b>0)for(d=0;d<g;d++){n=d==g-1;h=c[b][n?0:d+1];m=c[b][n?g-1:d];j=c[b-1][n?g-1:d];n=c[b-1][n?
|
|
|
0:d+1];u=b/(f-1);o=(b-1)/(f-1);x=(d+1)/g;v=d/g;p=new THREE.UV(1-x,u);u=new THREE.UV(1-v,u);v=new THREE.UV(1-v,o);var E=new THREE.UV(1-x,o);if(b<c.length-1){o=this.vertices[h].position.clone();x=this.vertices[m].position.clone();B=this.vertices[j].position.clone();o.normalize();x.normalize();B.normalize();this.faces.push(new THREE.Face3(h,m,j,[new THREE.Vector3(o.x,o.y,o.z),new THREE.Vector3(x.x,x.y,x.z),new THREE.Vector3(B.x,B.y,B.z)]));this.uvs.push([p,u,v])}if(b>1){o=this.vertices[h].position.clone();
|
|
|
x=this.vertices[j].position.clone();B=this.vertices[n].position.clone();o.normalize();x.normalize();B.normalize();this.faces.push(new THREE.Face3(h,j,n,[new THREE.Vector3(o.x,o.y,o.z),new THREE.Vector3(x.x,x.y,x.z),new THREE.Vector3(B.x,B.y,B.z)]));this.uvs.push([p,v,E])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere;
|