diff --git a/README.md b/README.md index ad39be6799babbdd7b71245e760ae2d7bc9275d9..dd9c55ca81431679f0e62a2c8dd22deb51cd0f9f 100644 --- a/README.md +++ b/README.md @@ -140,6 +140,28 @@ This code creates a camera, then creates a scene, adds a cube on it, creates a & ### Change Log ### +2011 11 13 - **r46** (341.109 KB, gzip: 86.845 KB) + +* Added reflections to Normal Mapping. ([alteredq](http://github.com/alteredq)) +* `Ray` now checks also object children. ([mrdoob](http://github.com/mrdoob)) +* `*Loader.load( parameters )` to `*Loader( url, callback, texturePath )`. ([mrdoob](http://github.com/mrdoob) and [alteredq](http://github.com/alteredq)) +* Reworked scene graph setup. ([mrdoob](http://github.com/mrdoob) and [alteredq](http://github.com/alteredq)) +* Fixed `CanvasRenderer`'s `SphericalReflectionMapping` rendering. ([mrdoob](http://github.com/mrdoob)) +* Improved `SubdivisionModifier`. ([zz85](http://github.com/zz85)) +* Refactored `*Controls` to use externally supplied time delta. ([alteredq](http://github.com/alteredq)) +* Improvements to `CombinedCamera`. ([zz85](http://github.com/zz85)) +* `ColladaLoader` doesn't create extra `Object3D`. ([mrdoob](http://github.com/mrdoob)) +* Improvements to Lambert and Phong materials. ([alteredq](http://github.com/alteredq)) +* Removed multi-materials for simplicity reasons. (Multi-materials will come back with MeshLayerMaterial hopefully soon) ([alteredq](http://github.com/alteredq)) +* Fixed `Ray` not considering edges. ([mrdoob](http://github.com/mrdoob)) +* Massive cleanup to `WebGLRenderer`. ([alteredq](http://github.com/alteredq)) +* `Ray` optimisations. ([mrdoob](http://github.com/mrdoob) and [alteredq](http://github.com/alteredq)) +* JSON file format is now worker-less (this was crashing Chrome/Firefox with dealing with many assets). ([alteredq](http://github.com/alteredq)) +* Improved `CubeGeometry`, `PlaneGeometry`, `IcosahedronGeometry` and `SphereGeometry`. ([mrdoob](http://github.com/mrdoob)) +* Improvements to `Curve`. ([zz85](http://github.com/zz85)) +* Removed `Collisions` code and focusing on `Ray`. ([mrdoob](http://github.com/mrdoob)) + + 2011 10 06 - **r45** (340.863 KB, gzip: 86.568 KB) * `Object/Scene.add*()` and `Object/Scene.remove*()` are now `Object/Scene.add()` and `Object/Scene.remove()`. ([mrdoob](http://github.com/mrdoob)) diff --git a/REVISION b/REVISION index 640c64e2dd338f30e40821f3632cf4e2543d46b4..9e5feb5256930f3cae636754eef8a244ede164eb 100644 --- a/REVISION +++ b/REVISION @@ -1 +1 @@ -46dev +46 diff --git a/TODO b/TODO deleted file mode 100644 index fbe47280f9f5ab150e286a10546af6291c1f5051..0000000000000000000000000000000000000000 --- a/TODO +++ /dev/null @@ -1,9 +0,0 @@ -Examples -* DOMRenderer example - -Materials -* Layer based material system - -Renderers -* FrustrumClipping near to Projector (CanvasRenderer and SVGRenderer) -* Implement VertexColors in CanvasRenderer diff --git a/build/Three.js b/build/Three.js index 370066cb2d8f22f6c77cfe4a5d259d43483e08b7..3dc29712a9a010bfc13baad49fa271927125b1f6 100644 --- a/build/Three.js +++ b/build/Three.js @@ -1,6 +1,6 @@ -// Three.js r46dev - http://github.com/mrdoob/three.js +// Three.js r46 - http://github.com/mrdoob/three.js var THREE=THREE||{};if(!self.Int32Array)self.Int32Array=Array,self.Float32Array=Array;THREE.Clock=function(a){this.autoStart=a!==void 0?a:!0;this.elapsedTime=this.oldTime=this.startTime=0;this.running=!1};THREE.Clock.prototype.start=function(){this.oldTime=this.startTime=Date.now();this.running=!0};THREE.Clock.prototype.stop=function(){this.getElapsedTime();this.running=!1};THREE.Clock.prototype.getElapsedTime=function(){this.elapsedTime+=this.getDelta();return this.elapsedTime}; -THREE.Clock.prototype.getDelta=function(){var a=0;this.autoStart&&!this.running&&this.start();if(this.running){var c=Date.now(),a=0.0010*(c-this.oldTime);this.oldTime=c;this.elapsedTime+=a}return a};THREE.Color=function(a){a!==void 0&&this.setHex(a);return this}; +THREE.Clock.prototype.getDelta=function(){var a=0;this.autoStart&&!this.running&&this.start();if(this.running){var c=Date.now(),a=0.001*(c-this.oldTime);this.oldTime=c;this.elapsedTime+=a}return a};THREE.Color=function(a){a!==void 0&&this.setHex(a);return this}; THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;return this},copyGammaToLinear:function(a){this.r=a.r*a.r;this.g=a.g*a.g;this.b=a.b*a.b;return this},copyLinearToGamma:function(a){this.r=Math.sqrt(a.r);this.g=Math.sqrt(a.g);this.b=Math.sqrt(a.b);return this},setRGB:function(a,c,b){this.r=a;this.g=c;this.b=b;return this},setHSV:function(a,c,b){var d,g,f;if(b===0)this.r=this.g=this.b=0;else switch(d=Math.floor(a*6),g=a*6-d,a=b*(1-c),f=b*(1- c*g),c=b*(1-c*(1-g)),d){case 1:this.r=f;this.g=b;this.b=a;break;case 2:this.r=a;this.g=b;this.b=c;break;case 3:this.r=a;this.g=f;this.b=b;break;case 4:this.r=c;this.g=a;this.b=b;break;case 5:this.r=b;this.g=a;this.b=f;break;case 6:case 0:this.r=b,this.g=c,this.b=a}return this},setHex:function(a){a=Math.floor(a);this.r=(a>>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255;return this},getHex:function(){return~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},getContextStyle:function(){return"rgb("+ Math.floor(this.r*255)+","+Math.floor(this.g*255)+","+Math.floor(this.b*255)+")"},clone:function(){return(new THREE.Color).setRGB(this.r,this.g,this.b)}};THREE.Vector2=function(a,c){this.x=a||0;this.y=c||0}; @@ -73,7 +73,7 @@ this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(b);return this},setFromRo this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a===0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var c= this.x,b=this.y,d=this.z,g=this.w,f=a.x,e=a.y,h=a.z,a=a.w;this.x=c*a+g*f+b*h-d*e;this.y=b*a+g*e+d*f-c*h;this.z=d*a+g*h+c*e-b*f;this.w=g*a-c*f-b*e-d*h;return this},multiply:function(a,c){this.x=a.x*c.w+a.y*c.z-a.z*c.y+a.w*c.x;this.y=-a.x*c.z+a.y*c.w+a.z*c.x+a.w*c.y;this.z=a.x*c.y-a.y*c.x+a.z*c.w+a.w*c.z;this.w=-a.x*c.x-a.y*c.y-a.z*c.z+a.w*c.w;return this},multiplyVector3:function(a,c){c||(c=a);var b=a.x,d=a.y,g=a.z,f=this.x,e=this.y,h=this.z,i=this.w,l=i*b+e*g-h*d,k=i*d+h*b-f*g,o=i*g+f*d-e*b,b=-f* b-e*d-h*g;c.x=l*i+b*-f+k*-h-o*-e;c.y=k*i+b*-e+o*-f-l*-h;c.z=o*i+b*-h+l*-e-k*-f;return c}}; -THREE.Quaternion.slerp=function(a,c,b,d){var g=a.w*c.w+a.x*c.x+a.y*c.y+a.z*c.z;g<0?(b.w=-c.w,b.x=-c.x,b.y=-c.y,b.z=-c.z,g=-g):b.copy(c);if(Math.abs(g)>=1)return b.w=a.w,b.x=a.x,b.y=a.y,b.z=a.z,b;var f=Math.acos(g),g=Math.sqrt(1-g*g);if(Math.abs(g)<0.0010)return b.w=0.5*(a.w+c.w),b.x=0.5*(a.x+c.x),b.y=0.5*(a.y+c.y),b.z=0.5*(a.z+c.z),b;c=Math.sin((1-d)*f)/g;d=Math.sin(d*f)/g;b.w=a.w*c+b.w*d;b.x=a.x*c+b.x*d;b.y=a.y*c+b.y*d;b.z=a.z*c+b.z*d;return b};THREE.Vertex=function(a){this.position=a||new THREE.Vector3}; +THREE.Quaternion.slerp=function(a,c,b,d){var g=a.w*c.w+a.x*c.x+a.y*c.y+a.z*c.z;g<0?(b.w=-c.w,b.x=-c.x,b.y=-c.y,b.z=-c.z,g=-g):b.copy(c);if(Math.abs(g)>=1)return b.w=a.w,b.x=a.x,b.y=a.y,b.z=a.z,b;var f=Math.acos(g),g=Math.sqrt(1-g*g);if(Math.abs(g)<0.001)return b.w=0.5*(a.w+c.w),b.x=0.5*(a.x+c.x),b.y=0.5*(a.y+c.y),b.z=0.5*(a.z+c.z),b;c=Math.sin((1-d)*f)/g;d=Math.sin(d*f)/g;b.w=a.w*c+b.w*d;b.x=a.x*c+b.x*d;b.y=a.y*c+b.y*d;b.z=a.z*c+b.z*d;return b};THREE.Vertex=function(a){this.position=a||new THREE.Vector3}; THREE.Face3=function(a,c,b,d,g,f){this.a=a;this.b=c;this.c=b;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materialIndex=f;this.centroid=new THREE.Vector3}; THREE.Face4=function(a,c,b,d,g,f,e){this.a=a;this.b=c;this.c=b;this.d=d;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=e;this.centroid=new THREE.Vector3};THREE.UV=function(a,c){this.u=a||0;this.v=c||0}; THREE.UV.prototype={constructor:THREE.UV,set:function(a,c){this.u=a;this.v=c;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}}; @@ -156,30 +156,30 @@ B=null};this.setClearColor=function(a,b){q.copy(a);t=b;ea.set(-m,-r,m,r)};this.s Math.floor(ea.getY()),Math.floor(ea.getWidth()),Math.floor(ea.getHeight()))),ea.empty())};this.render=function(a,k){function p(a){var b,c,d,f;ca.setRGB(0,0,0);la.setRGB(0,0,0);ma.setRGB(0,0,0);b=0;for(c=a.length;b> 1,ia=k.height>>1,e=f.scale.x*m,i=f.scale.y*r,j=e*l,h=i*ia,ha.set(a.x-j,a.y-h,a.x+j,a.y+h),Q.intersects(ha)&&(n.save(),n.translate(a.x,a.y),n.rotate(-f.rotation),n.scale(e,-i),n.translate(-l,-ia),n.drawImage(k,0,0),n.restore())}else e instanceof THREE.ParticleCanvasMaterial&&(j=f.scale.x*m,h=f.scale.y*r,ha.set(a.x-j,a.y-h,a.x+j,a.y+h),Q.intersects(ha)&&(d(e.color.getContextStyle()),g(e.color.getContextStyle()),n.save(),n.translate(a.x,a.y),n.rotate(-f.rotation),n.scale(j,h),e.program(n),n.restore()))} -function t(a,f,g,e){c(e.opacity);b(e.blending);n.beginPath();n.moveTo(a.positionScreen.x,a.positionScreen.y);n.lineTo(f.positionScreen.x,f.positionScreen.y);n.closePath();if(e instanceof THREE.LineBasicMaterial){a=e.linewidth;if(A!=a)n.lineWidth=A=a;a=e.linecap;if(x!=a)n.lineCap=x=a;a=e.linejoin;if(y!=a)n.lineJoin=y=a;d(e.color.getContextStyle());n.stroke();ha.inflate(e.linewidth*2)}}function w(a,d,e,g,j,h,m,l){f.info.render.vertices+=3;f.info.render.faces++;c(l.opacity);b(l.blending);K=a.positionScreen.x; -P=a.positionScreen.y;O=d.positionScreen.x;aa=d.positionScreen.y;H=e.positionScreen.x;G=e.positionScreen.y;Ga(K,P,O,aa,H,G);if(l instanceof THREE.MeshBasicMaterial)if(l.map)l.map.mapping instanceof THREE.UVMapping&&(pa=m.uvs[0],Ka(K,P,O,aa,H,G,pa[g].u,pa[g].v,pa[j].u,pa[j].v,pa[h].u,pa[h].v,l.map));else if(l.envMap){if(l.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=k.matrixWorldInverse,fa.copy(m.vertexNormalsWorld[g]),Da=(fa.x*a.n11+fa.y*a.n12+fa.z*a.n13)*0.5+0.5,za=-(fa.x*a.n21+fa.y* -a.n22+fa.z*a.n23)*0.5+0.5,fa.copy(m.vertexNormalsWorld[j]),Aa=(fa.x*a.n11+fa.y*a.n12+fa.z*a.n13)*0.5+0.5,Ba=-(fa.x*a.n21+fa.y*a.n22+fa.z*a.n23)*0.5+0.5,fa.copy(m.vertexNormalsWorld[h]),L=(fa.x*a.n11+fa.y*a.n12+fa.z*a.n13)*0.5+0.5,Z=-(fa.x*a.n21+fa.y*a.n22+fa.z*a.n23)*0.5+0.5,Ka(K,P,O,aa,H,G,Da,za,Aa,Ba,L,Z,l.envMap)}else l.wireframe?u(l.color,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):Ca(l.color);else if(l instanceof THREE.MeshLambertMaterial)l.map&&!l.wireframe&&(l.map.mapping instanceof -THREE.UVMapping&&(pa=m.uvs[0],Ka(K,P,O,aa,H,G,pa[g].u,pa[g].v,pa[j].u,pa[j].v,pa[h].u,pa[h].v,l.map)),b(THREE.SubtractiveBlending)),N?!l.wireframe&&l.shading==THREE.SmoothShading&&m.vertexNormalsWorld.length==3?(V.r=da.r=ga.r=ca.r,V.g=da.g=ga.g=ca.g,V.b=da.b=ga.b=ca.b,o(i,m.v1.positionWorld,m.vertexNormalsWorld[0],V),o(i,m.v2.positionWorld,m.vertexNormalsWorld[1],da),o(i,m.v3.positionWorld,m.vertexNormalsWorld[2],ga),V.r=Math.max(0,Math.min(l.color.r*V.r,1)),V.g=Math.max(0,Math.min(l.color.g*V.g, -1)),V.b=Math.max(0,Math.min(l.color.b*V.b,1)),da.r=Math.max(0,Math.min(l.color.r*da.r,1)),da.g=Math.max(0,Math.min(l.color.g*da.g,1)),da.b=Math.max(0,Math.min(l.color.b*da.b,1)),ga.r=Math.max(0,Math.min(l.color.r*ga.r,1)),ga.g=Math.max(0,Math.min(l.color.g*ga.g,1)),ga.b=Math.max(0,Math.min(l.color.b*ga.b,1)),$.r=(da.r+ga.r)*0.5,$.g=(da.g+ga.g)*0.5,$.b=(da.b+ga.b)*0.5,oa=Ha(V,da,ga,$),Fa(K,P,O,aa,H,G,0,0,1,0,0,1,oa)):(X.r=ca.r,X.g=ca.g,X.b=ca.b,o(i,m.centroidWorld,m.normalWorld,X),X.r=Math.max(0,Math.min(l.color.r* -X.r,1)),X.g=Math.max(0,Math.min(l.color.g*X.g,1)),X.b=Math.max(0,Math.min(l.color.b*X.b,1)),l.wireframe?u(X,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):Ca(X)):l.wireframe?u(l.color,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):Ca(l.color);else if(l instanceof THREE.MeshDepthMaterial)qa=k.near,na=k.far,V.r=V.g=V.b=1-B(a.positionScreen.z,qa,na),da.r=da.g=da.b=1-B(d.positionScreen.z,qa,na),ga.r=ga.g=ga.b=1-B(e.positionScreen.z,qa,na),$.r=(da.r+ga.r)*0.5,$.g=(da.g+ga.g)* -0.5,$.b=(da.b+ga.b)*0.5,oa=Ha(V,da,ga,$),Fa(K,P,O,aa,H,G,0,0,1,0,0,1,oa);else if(l instanceof THREE.MeshNormalMaterial)X.r=F(m.normalWorld.x),X.g=F(m.normalWorld.y),X.b=F(m.normalWorld.z),l.wireframe?u(X,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):Ca(X)}function Ma(a,d,e,g,h,l,m,n,p){f.info.render.vertices+=4;f.info.render.faces++;c(n.opacity);b(n.blending);if(n.map||n.envMap)w(a,d,g,0,1,3,m,n,p),w(h,e,l,1,2,3,m,n,p);else if(K=a.positionScreen.x,P=a.positionScreen.y,O=d.positionScreen.x, -aa=d.positionScreen.y,H=e.positionScreen.x,G=e.positionScreen.y,I=g.positionScreen.x,M=g.positionScreen.y,S=h.positionScreen.x,ba=h.positionScreen.y,W=l.positionScreen.x,j=l.positionScreen.y,n instanceof THREE.MeshBasicMaterial)Ia(K,P,O,aa,H,G,I,M),n.wireframe?u(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Ca(n.color);else if(n instanceof THREE.MeshLambertMaterial)N?!n.wireframe&&n.shading==THREE.SmoothShading&&m.vertexNormalsWorld.length==4?(V.r=da.r=ga.r=$.r=ca.r,V.g=da.g= -ga.g=$.g=ca.g,V.b=da.b=ga.b=$.b=ca.b,o(i,m.v1.positionWorld,m.vertexNormalsWorld[0],V),o(i,m.v2.positionWorld,m.vertexNormalsWorld[1],da),o(i,m.v4.positionWorld,m.vertexNormalsWorld[3],ga),o(i,m.v3.positionWorld,m.vertexNormalsWorld[2],$),V.r=Math.max(0,Math.min(n.color.r*V.r,1)),V.g=Math.max(0,Math.min(n.color.g*V.g,1)),V.b=Math.max(0,Math.min(n.color.b*V.b,1)),da.r=Math.max(0,Math.min(n.color.r*da.r,1)),da.g=Math.max(0,Math.min(n.color.g*da.g,1)),da.b=Math.max(0,Math.min(n.color.b*da.b,1)),ga.r= -Math.max(0,Math.min(n.color.r*ga.r,1)),ga.g=Math.max(0,Math.min(n.color.g*ga.g,1)),ga.b=Math.max(0,Math.min(n.color.b*ga.b,1)),$.r=Math.max(0,Math.min(n.color.r*$.r,1)),$.g=Math.max(0,Math.min(n.color.g*$.g,1)),$.b=Math.max(0,Math.min(n.color.b*$.b,1)),oa=Ha(V,da,ga,$),Ga(K,P,O,aa,I,M),Fa(K,P,O,aa,I,M,0,0,1,0,0,1,oa),Ga(S,ba,H,G,W,j),Fa(S,ba,H,G,W,j,1,0,1,1,0,1,oa)):(X.r=ca.r,X.g=ca.g,X.b=ca.b,o(i,m.centroidWorld,m.normalWorld,X),X.r=Math.max(0,Math.min(n.color.r*X.r,1)),X.g=Math.max(0,Math.min(n.color.g* -X.g,1)),X.b=Math.max(0,Math.min(n.color.b*X.b,1)),Ia(K,P,O,aa,H,G,I,M),n.wireframe?u(X,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Ca(X)):(Ia(K,P,O,aa,H,G,I,M),n.wireframe?u(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Ca(n.color));else if(n instanceof THREE.MeshNormalMaterial)X.r=F(m.normalWorld.x),X.g=F(m.normalWorld.y),X.b=F(m.normalWorld.z),Ia(K,P,O,aa,H,G,I,M),n.wireframe?u(X,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Ca(X);else if(n instanceof -THREE.MeshDepthMaterial)qa=k.near,na=k.far,V.r=V.g=V.b=1-B(a.positionScreen.z,qa,na),da.r=da.g=da.b=1-B(d.positionScreen.z,qa,na),ga.r=ga.g=ga.b=1-B(g.positionScreen.z,qa,na),$.r=$.g=$.b=1-B(e.positionScreen.z,qa,na),oa=Ha(V,da,ga,$),Ga(K,P,O,aa,I,M),Fa(K,P,O,aa,I,M,0,0,1,0,0,1,oa),Ga(S,ba,H,G,W,j),Fa(S,ba,H,G,W,j,1,0,1,1,0,1,oa)}function Ga(a,b,c,d,f,e){n.beginPath();n.moveTo(a,b);n.lineTo(c,d);n.lineTo(f,e);n.lineTo(a,b);n.closePath()}function Ia(a,b,c,d,f,e,g,j){n.beginPath();n.moveTo(a,b);n.lineTo(c, -d);n.lineTo(f,e);n.lineTo(g,j);n.lineTo(a,b);n.closePath()}function u(a,b,c,f){if(A!=b)n.lineWidth=A=b;if(x!=c)n.lineCap=x=c;if(y!=f)n.lineJoin=y=f;d(a.getContextStyle());n.stroke();ha.inflate(b*2)}function Ca(a){g(a.getContextStyle());n.fill()}function Ka(a,b,c,d,f,e,j,h,i,m,l,k,ia){if(ia.image.width!=0){if(ia.needsUpdate==!0||ua[ia.id]==void 0){var o=ia.wrapS==THREE.RepeatWrapping,p=ia.wrapT==THREE.RepeatWrapping;ua[ia.id]=n.createPattern(ia.image,o&&p?"repeat":o&&!p?"repeat-x":!o&&p?"repeat-y": -"no-repeat");ia.needsUpdate=!1}g(ua[ia.id]);var o=ia.offset.x/ia.repeat.x,p=ia.offset.y/ia.repeat.y,L=ia.image.width*ia.repeat.x,q=ia.image.height*ia.repeat.y,j=(j+o)*L,h=(h+p)*q,i=(i+o)*L,m=(m+p)*q,l=(l+o)*L,k=(k+p)*q;c-=a;d-=b;f-=a;e-=b;i-=j;m-=h;l-=j;k-=h;o=i*k-l*m;if(o==0){if(ra[ia.id]==void 0)b=document.createElement("canvas"),b.width=ia.image.width,b.height=ia.image.height,a=b.getContext("2d"),a.drawImage(ia.image,0,0),ra[ia.id]=a.getImageData(0,0,ia.image.width,ia.image.height).data,delete b; -b=ra[ia.id];j=(Math.floor(j)+Math.floor(h)*ia.image.width)*4;X.setRGB(b[j]/255,b[j+1]/255,b[j+2]/255);Ca(X)}else o=1/o,ia=(k*c-m*f)*o,m=(k*d-m*e)*o,c=(i*f-l*c)*o,d=(i*e-l*d)*o,a=a-ia*j-c*h,j=b-m*j-d*h,n.save(),n.transform(ia,m,c,d,a,j),n.fill(),n.restore()}}function Fa(a,b,c,d,f,e,g,j,h,i,m,l,k){var ia,o;ia=k.width-1;o=k.height-1;g*=ia;j*=o;h*=ia;i*=o;m*=ia;l*=o;c-=a;d-=b;f-=a;e-=b;h-=g;i-=j;m-=g;l-=j;o=1/(h*l-m*i);ia=(l*c-i*f)*o;i=(l*d-i*e)*o;c=(h*f-m*c)*o;d=(h*e-m*d)*o;a=a-ia*g-c*j;b=b-i*g-d*j; -n.save();n.transform(ia,i,c,d,a,b);n.clip();n.drawImage(k,0,0);n.restore()}function Ha(a,b,c,d){var f=~~(a.r*255),e=~~(a.g*255),a=~~(a.b*255),g=~~(b.r*255),j=~~(b.g*255),b=~~(b.b*255),h=~~(c.r*255),i=~~(c.g*255),c=~~(c.b*255),m=~~(d.r*255),l=~~(d.g*255),d=~~(d.b*255);ta[0]=f<0?0:f>255?255:f;ta[1]=e<0?0:e>255?255:e;ta[2]=a<0?0:a>255?255:a;ta[4]=g<0?0:g>255?255:g;ta[5]=j<0?0:j>255?255:j;ta[6]=b<0?0:b>255?255:b;ta[8]=h<0?0:h>255?255:h;ta[9]=i<0?0:i>255?255:i;ta[10]=c<0?0:c>255?255:c;ta[12]=m<0?0:m>255? -255:m;ta[13]=l<0?0:l>255?255:l;ta[14]=d<0?0:d>255?255:d;xa.putImageData(va,0,0);wa.drawImage(Y,0,0);return T}function B(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function F(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function Ea(a,b){var c=b.x-a.x,d=b.y-a.y,f=c*c+d*d;f!=0&&(f=1/Math.sqrt(f),c*=f,d*=f,b.x+=c,b.y+=d,a.x-=c,a.y-=d)}var Ja,La,sa,D;this.autoClear?this.clear():n.setTransform(1,0,0,-1,m,r);f.info.render.vertices=0;f.info.render.faces=0;e=l.projectScene(a,k,this.sortElements);h=e.elements;i=e.lights; +function t(a,f,g,e){c(e.opacity);b(e.blending);n.beginPath();n.moveTo(a.positionScreen.x,a.positionScreen.y);n.lineTo(f.positionScreen.x,f.positionScreen.y);n.closePath();if(e instanceof THREE.LineBasicMaterial){a=e.linewidth;if(A!=a)n.lineWidth=A=a;a=e.linecap;if(x!=a)n.lineCap=x=a;a=e.linejoin;if(y!=a)n.lineJoin=y=a;d(e.color.getContextStyle());n.stroke();ha.inflate(e.linewidth*2)}}function w(a,d,g,e,j,h,m,n){f.info.render.vertices+=3;f.info.render.faces++;c(n.opacity);b(n.blending);K=a.positionScreen.x; +P=a.positionScreen.y;O=d.positionScreen.x;aa=d.positionScreen.y;H=g.positionScreen.x;G=g.positionScreen.y;Ga(K,P,O,aa,H,G);if(n instanceof THREE.MeshBasicMaterial)if(n.map)n.map.mapping instanceof THREE.UVMapping&&(pa=m.uvs[0],Ka(K,P,O,aa,H,G,pa[e].u,pa[e].v,pa[j].u,pa[j].v,pa[h].u,pa[h].v,n.map));else if(n.envMap){if(n.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=k.matrixWorldInverse,fa.copy(m.vertexNormalsWorld[e]),Da=(fa.x*a.n11+fa.y*a.n12+fa.z*a.n13)*0.5+0.5,za=-(fa.x*a.n21+fa.y* +a.n22+fa.z*a.n23)*0.5+0.5,fa.copy(m.vertexNormalsWorld[j]),Aa=(fa.x*a.n11+fa.y*a.n12+fa.z*a.n13)*0.5+0.5,Ba=-(fa.x*a.n21+fa.y*a.n22+fa.z*a.n23)*0.5+0.5,fa.copy(m.vertexNormalsWorld[h]),L=(fa.x*a.n11+fa.y*a.n12+fa.z*a.n13)*0.5+0.5,Z=-(fa.x*a.n21+fa.y*a.n22+fa.z*a.n23)*0.5+0.5,Ka(K,P,O,aa,H,G,Da,za,Aa,Ba,L,Z,n.envMap)}else n.wireframe?u(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Ca(n.color);else if(n instanceof THREE.MeshLambertMaterial)n.map&&!n.wireframe&&(n.map.mapping instanceof +THREE.UVMapping&&(pa=m.uvs[0],Ka(K,P,O,aa,H,G,pa[e].u,pa[e].v,pa[j].u,pa[j].v,pa[h].u,pa[h].v,n.map)),b(THREE.SubtractiveBlending)),N?!n.wireframe&&n.shading==THREE.SmoothShading&&m.vertexNormalsWorld.length==3?(V.r=da.r=ga.r=ca.r,V.g=da.g=ga.g=ca.g,V.b=da.b=ga.b=ca.b,o(i,m.v1.positionWorld,m.vertexNormalsWorld[0],V),o(i,m.v2.positionWorld,m.vertexNormalsWorld[1],da),o(i,m.v3.positionWorld,m.vertexNormalsWorld[2],ga),V.r=Math.max(0,Math.min(n.color.r*V.r,1)),V.g=Math.max(0,Math.min(n.color.g*V.g, +1)),V.b=Math.max(0,Math.min(n.color.b*V.b,1)),da.r=Math.max(0,Math.min(n.color.r*da.r,1)),da.g=Math.max(0,Math.min(n.color.g*da.g,1)),da.b=Math.max(0,Math.min(n.color.b*da.b,1)),ga.r=Math.max(0,Math.min(n.color.r*ga.r,1)),ga.g=Math.max(0,Math.min(n.color.g*ga.g,1)),ga.b=Math.max(0,Math.min(n.color.b*ga.b,1)),$.r=(da.r+ga.r)*0.5,$.g=(da.g+ga.g)*0.5,$.b=(da.b+ga.b)*0.5,oa=Ha(V,da,ga,$),Fa(K,P,O,aa,H,G,0,0,1,0,0,1,oa)):(X.r=ca.r,X.g=ca.g,X.b=ca.b,o(i,m.centroidWorld,m.normalWorld,X),X.r=Math.max(0,Math.min(n.color.r* +X.r,1)),X.g=Math.max(0,Math.min(n.color.g*X.g,1)),X.b=Math.max(0,Math.min(n.color.b*X.b,1)),n.wireframe?u(X,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Ca(X)):n.wireframe?u(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Ca(n.color);else if(n instanceof THREE.MeshDepthMaterial)qa=k.near,na=k.far,V.r=V.g=V.b=1-B(a.positionScreen.z,qa,na),da.r=da.g=da.b=1-B(d.positionScreen.z,qa,na),ga.r=ga.g=ga.b=1-B(g.positionScreen.z,qa,na),$.r=(da.r+ga.r)*0.5,$.g=(da.g+ga.g)* +0.5,$.b=(da.b+ga.b)*0.5,oa=Ha(V,da,ga,$),Fa(K,P,O,aa,H,G,0,0,1,0,0,1,oa);else if(n instanceof THREE.MeshNormalMaterial)X.r=F(m.normalWorld.x),X.g=F(m.normalWorld.y),X.b=F(m.normalWorld.z),n.wireframe?u(X,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Ca(X)}function Ma(a,d,g,e,h,n,m,l,p){f.info.render.vertices+=4;f.info.render.faces++;c(l.opacity);b(l.blending);if(l.map||l.envMap)w(a,d,e,0,1,3,m,l,p),w(h,g,n,1,2,3,m,l,p);else if(K=a.positionScreen.x,P=a.positionScreen.y,O=d.positionScreen.x, +aa=d.positionScreen.y,H=g.positionScreen.x,G=g.positionScreen.y,I=e.positionScreen.x,M=e.positionScreen.y,S=h.positionScreen.x,ba=h.positionScreen.y,W=n.positionScreen.x,j=n.positionScreen.y,l instanceof THREE.MeshBasicMaterial)Ia(K,P,O,aa,H,G,I,M),l.wireframe?u(l.color,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):Ca(l.color);else if(l instanceof THREE.MeshLambertMaterial)N?!l.wireframe&&l.shading==THREE.SmoothShading&&m.vertexNormalsWorld.length==4?(V.r=da.r=ga.r=$.r=ca.r,V.g=da.g= +ga.g=$.g=ca.g,V.b=da.b=ga.b=$.b=ca.b,o(i,m.v1.positionWorld,m.vertexNormalsWorld[0],V),o(i,m.v2.positionWorld,m.vertexNormalsWorld[1],da),o(i,m.v4.positionWorld,m.vertexNormalsWorld[3],ga),o(i,m.v3.positionWorld,m.vertexNormalsWorld[2],$),V.r=Math.max(0,Math.min(l.color.r*V.r,1)),V.g=Math.max(0,Math.min(l.color.g*V.g,1)),V.b=Math.max(0,Math.min(l.color.b*V.b,1)),da.r=Math.max(0,Math.min(l.color.r*da.r,1)),da.g=Math.max(0,Math.min(l.color.g*da.g,1)),da.b=Math.max(0,Math.min(l.color.b*da.b,1)),ga.r= +Math.max(0,Math.min(l.color.r*ga.r,1)),ga.g=Math.max(0,Math.min(l.color.g*ga.g,1)),ga.b=Math.max(0,Math.min(l.color.b*ga.b,1)),$.r=Math.max(0,Math.min(l.color.r*$.r,1)),$.g=Math.max(0,Math.min(l.color.g*$.g,1)),$.b=Math.max(0,Math.min(l.color.b*$.b,1)),oa=Ha(V,da,ga,$),Ga(K,P,O,aa,I,M),Fa(K,P,O,aa,I,M,0,0,1,0,0,1,oa),Ga(S,ba,H,G,W,j),Fa(S,ba,H,G,W,j,1,0,1,1,0,1,oa)):(X.r=ca.r,X.g=ca.g,X.b=ca.b,o(i,m.centroidWorld,m.normalWorld,X),X.r=Math.max(0,Math.min(l.color.r*X.r,1)),X.g=Math.max(0,Math.min(l.color.g* +X.g,1)),X.b=Math.max(0,Math.min(l.color.b*X.b,1)),Ia(K,P,O,aa,H,G,I,M),l.wireframe?u(X,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):Ca(X)):(Ia(K,P,O,aa,H,G,I,M),l.wireframe?u(l.color,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):Ca(l.color));else if(l instanceof THREE.MeshNormalMaterial)X.r=F(m.normalWorld.x),X.g=F(m.normalWorld.y),X.b=F(m.normalWorld.z),Ia(K,P,O,aa,H,G,I,M),l.wireframe?u(X,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):Ca(X);else if(l instanceof +THREE.MeshDepthMaterial)qa=k.near,na=k.far,V.r=V.g=V.b=1-B(a.positionScreen.z,qa,na),da.r=da.g=da.b=1-B(d.positionScreen.z,qa,na),ga.r=ga.g=ga.b=1-B(e.positionScreen.z,qa,na),$.r=$.g=$.b=1-B(g.positionScreen.z,qa,na),oa=Ha(V,da,ga,$),Ga(K,P,O,aa,I,M),Fa(K,P,O,aa,I,M,0,0,1,0,0,1,oa),Ga(S,ba,H,G,W,j),Fa(S,ba,H,G,W,j,1,0,1,1,0,1,oa)}function Ga(a,b,c,d,f,g){n.beginPath();n.moveTo(a,b);n.lineTo(c,d);n.lineTo(f,g);n.lineTo(a,b);n.closePath()}function Ia(a,b,c,d,f,g,e,j){n.beginPath();n.moveTo(a,b);n.lineTo(c, +d);n.lineTo(f,g);n.lineTo(e,j);n.lineTo(a,b);n.closePath()}function u(a,b,c,f){if(A!=b)n.lineWidth=A=b;if(x!=c)n.lineCap=x=c;if(y!=f)n.lineJoin=y=f;d(a.getContextStyle());n.stroke();ha.inflate(b*2)}function Ca(a){g(a.getContextStyle());n.fill()}function Ka(a,b,c,d,f,e,j,h,i,m,k,l,ia){if(ia.image.width!=0){if(ia.needsUpdate==!0||ua[ia.id]==void 0){var o=ia.wrapS==THREE.RepeatWrapping,p=ia.wrapT==THREE.RepeatWrapping;ua[ia.id]=n.createPattern(ia.image,o&&p?"repeat":o&&!p?"repeat-x":!o&&p?"repeat-y": +"no-repeat");ia.needsUpdate=!1}g(ua[ia.id]);var o=ia.offset.x/ia.repeat.x,p=ia.offset.y/ia.repeat.y,L=ia.image.width*ia.repeat.x,q=ia.image.height*ia.repeat.y,j=(j+o)*L,h=(h+p)*q,i=(i+o)*L,m=(m+p)*q,k=(k+o)*L,l=(l+p)*q;c-=a;d-=b;f-=a;e-=b;i-=j;m-=h;k-=j;l-=h;o=i*l-k*m;if(o==0){if(ra[ia.id]==void 0)b=document.createElement("canvas"),b.width=ia.image.width,b.height=ia.image.height,a=b.getContext("2d"),a.drawImage(ia.image,0,0),ra[ia.id]=a.getImageData(0,0,ia.image.width,ia.image.height).data,delete b; +b=ra[ia.id];j=(Math.floor(j)+Math.floor(h)*ia.image.width)*4;X.setRGB(b[j]/255,b[j+1]/255,b[j+2]/255);Ca(X)}else o=1/o,ia=(l*c-m*f)*o,m=(l*d-m*e)*o,c=(i*f-k*c)*o,d=(i*e-k*d)*o,a=a-ia*j-c*h,j=b-m*j-d*h,n.save(),n.transform(ia,m,c,d,a,j),n.fill(),n.restore()}}function Fa(a,b,c,d,f,e,g,j,h,i,m,k,l){var ia,o;ia=l.width-1;o=l.height-1;g*=ia;j*=o;h*=ia;i*=o;m*=ia;k*=o;c-=a;d-=b;f-=a;e-=b;h-=g;i-=j;m-=g;k-=j;o=1/(h*k-m*i);ia=(k*c-i*f)*o;i=(k*d-i*e)*o;c=(h*f-m*c)*o;d=(h*e-m*d)*o;a=a-ia*g-c*j;b=b-i*g-d*j; +n.save();n.transform(ia,i,c,d,a,b);n.clip();n.drawImage(l,0,0);n.restore()}function Ha(a,b,c,d){var f=~~(a.r*255),g=~~(a.g*255),a=~~(a.b*255),e=~~(b.r*255),j=~~(b.g*255),b=~~(b.b*255),h=~~(c.r*255),i=~~(c.g*255),c=~~(c.b*255),m=~~(d.r*255),k=~~(d.g*255),d=~~(d.b*255);ta[0]=f<0?0:f>255?255:f;ta[1]=g<0?0:g>255?255:g;ta[2]=a<0?0:a>255?255:a;ta[4]=e<0?0:e>255?255:e;ta[5]=j<0?0:j>255?255:j;ta[6]=b<0?0:b>255?255:b;ta[8]=h<0?0:h>255?255:h;ta[9]=i<0?0:i>255?255:i;ta[10]=c<0?0:c>255?255:c;ta[12]=m<0?0:m>255? +255:m;ta[13]=k<0?0:k>255?255:k;ta[14]=d<0?0:d>255?255:d;xa.putImageData(va,0,0);wa.drawImage(Y,0,0);return T}function B(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function F(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function Ea(a,b){var c=b.x-a.x,d=b.y-a.y,f=c*c+d*d;f!=0&&(f=1/Math.sqrt(f),c*=f,d*=f,b.x+=c,b.y+=d,a.x-=c,a.y-=d)}var Ja,La,sa,D;this.autoClear?this.clear():n.setTransform(1,0,0,-1,m,r);f.info.render.vertices=0;f.info.render.faces=0;e=l.projectScene(a,k,this.sortElements);h=e.elements;i=e.lights; (N=i.length>0)&&p(i);Ja=0;for(La=h.length;Ja1?1:a}var d=this,g,f,e,h=new THREE.Projector,i=document.createElementNS("http://www.w3.org/2000/svg","svg"),l,k,o,p,m,r,n,q,t=new THREE.Rectangle,w=new THREE.Rectangle,u=!1,B=new THREE.Color,F=new THREE.Color,A=new THREE.Color,x=new THREE.Color,y,v=new THREE.Vector3,J=[],s=[],E,R,U,K=1;this.domElement=i;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0, -faces:0}};this.setQuality=function(a){switch(a){case "high":K=1;break;case "low":K=0}};this.setSize=function(a,b){l=a;k=b;o=l/2;p=k/2;i.setAttribute("viewBox",-o+" "+-p+" "+l+" "+k);i.setAttribute("width",l);i.setAttribute("height",k);t.set(-o,-p,o,p)};this.clear=function(){for(;i.childNodes.length>0;)i.removeChild(i.childNodes[0])};this.render=function(l,k){var J,v,G,I;this.autoClear&&this.clear();d.info.render.vertices=0;d.info.render.faces=0;g=h.projectScene(l,k,this.sortElements);f=g.elements; +faces:0}};this.setQuality=function(a){switch(a){case "high":K=1;break;case "low":K=0}};this.setSize=function(a,b){l=a;k=b;o=l/2;p=k/2;i.setAttribute("viewBox",-o+" "+-p+" "+l+" "+k);i.setAttribute("width",l);i.setAttribute("height",k);t.set(-o,-p,o,p)};this.clear=function(){for(;i.childNodes.length>0;)i.removeChild(i.childNodes[0])};this.render=function(k,l){var J,v,G,I;this.autoClear&&this.clear();d.info.render.vertices=0;d.info.render.faces=0;g=h.projectScene(k,l,this.sortElements);f=g.elements; e=g.lights;U=R=0;if(u=e.length>0){F.setRGB(0,0,0);A.setRGB(0,0,0);x.setRGB(0,0,0);J=0;for(v=e.length;J=0)return a.geometry.materials[b.materialIndex]}function d(a){if(a instanceof THREE.MeshBasicMaterial&&!a.envMap||a instanceof THREE.MeshDepthMaterial)return!1;return a&&a.shading!==void 0&&a.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading}function g(a){if(a.vertexColors)return a.vertexColors;return!1}function f(a){if(a.map||a.lightMap||a instanceof THREE.ShaderMaterial)return!0; -return!1}function e(a,b,c){var d,f,e,g,h=a.vertices;g=h.length;var i=a.colors,m=i.length,l=a.__vertexArray,k=a.__colorArray,n=a.__sortArray,o=a.__dirtyVertices,p=a.__dirtyColors,L=a.__webglCustomAttributesList;if(c.sortParticles){N.multiplySelf(c.matrixWorld);for(d=0;d=0)a&&(j.bindBuffer(j.ARRAY_BUFFER,f.__webglVertexBuffer),j.vertexAttribPointer(b.position,3,j.FLOAT,!1,0,0));else if(e.morphTargetBase){c=d.program.attributes;e.morphTargetBase!==-1?(j.bindBuffer(j.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[e.morphTargetBase]), j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0)):c.position>=0&&(j.bindBuffer(j.ARRAY_BUFFER,f.__webglVertexBuffer),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0));if(e.morphTargetForcedOrder.length){g=0;var i=e.morphTargetForcedOrder;for(h=e.morphTargetInfluences;gm&&(l=n,m=h[l]);j.bindBuffer(j.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[l]);j.vertexAttribPointer(c["morphTarget"+g],3,j.FLOAT,!1,0,0);e.__webglMorphTargetInfluences[g]=m;i[l]=1;m=-1;g++}}d.program.uniforms.morphTargetInfluences!==null&&j.uniform1fv(d.program.uniforms.morphTargetInfluences,e.__webglMorphTargetInfluences)}if(a){if(f.__webglCustomAttributesList){g= +l=0;h=e.morphTargetInfluences;var k,n=h.length;g=0;for(e.morphTargetBase!==-1&&(i[e.morphTargetBase]=!0);gm&&(l=k,m=h[l]);j.bindBuffer(j.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[l]);j.vertexAttribPointer(c["morphTarget"+g],3,j.FLOAT,!1,0,0);e.__webglMorphTargetInfluences[g]=m;i[l]=1;m=-1;g++}}d.program.uniforms.morphTargetInfluences!==null&&j.uniform1fv(d.program.uniforms.morphTargetInfluences,e.__webglMorphTargetInfluences)}if(a){if(f.__webglCustomAttributesList){g= 0;for(h=f.__webglCustomAttributesList.length;g=0&&(j.bindBuffer(j.ARRAY_BUFFER,c.buffer),j.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,j.FLOAT,!1,0,0))}b.color>=0&&(j.bindBuffer(j.ARRAY_BUFFER,f.__webglColorBuffer),j.vertexAttribPointer(b.color,3,j.FLOAT,!1,0,0));b.normal>=0&&(j.bindBuffer(j.ARRAY_BUFFER,f.__webglNormalBuffer),j.vertexAttribPointer(b.normal,3,j.FLOAT,!1,0,0));b.tangent>=0&&(j.bindBuffer(j.ARRAY_BUFFER, f.__webglTangentBuffer),j.vertexAttribPointer(b.tangent,4,j.FLOAT,!1,0,0));b.uv>=0&&(f.__webglUVBuffer?(j.bindBuffer(j.ARRAY_BUFFER,f.__webglUVBuffer),j.vertexAttribPointer(b.uv,2,j.FLOAT,!1,0,0),j.enableVertexAttribArray(b.uv)):j.disableVertexAttribArray(b.uv));b.uv2>=0&&(f.__webglUV2Buffer?(j.bindBuffer(j.ARRAY_BUFFER,f.__webglUV2Buffer),j.vertexAttribPointer(b.uv2,2,j.FLOAT,!1,0,0),j.enableVertexAttribArray(b.uv2)):j.disableVertexAttribArray(b.uv2));d.skinning&&b.skinVertexA>=0&&b.skinVertexB>= 0&&b.skinIndex>=0&&b.skinWeight>=0&&(j.bindBuffer(j.ARRAY_BUFFER,f.__webglSkinVertexABuffer),j.vertexAttribPointer(b.skinVertexA,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,f.__webglSkinVertexBBuffer),j.vertexAttribPointer(b.skinVertexB,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,f.__webglSkinIndicesBuffer),j.vertexAttribPointer(b.skinIndex,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,f.__webglSkinWeightsBuffer),j.vertexAttribPointer(b.skinWeight,4,j.FLOAT,!1,0,0))}e instanceof THREE.Mesh?(d.wireframe? @@ -242,12 +242,12 @@ a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);ha[4].set(a.n41-a.n31,a.n42-a.n32,a.n c,d,f,e,g,m,n,o=0,p=a.lights;Y||(Y=new THREE.PerspectiveCamera(W.shadowCameraFov,W.shadowMapWidth/W.shadowMapHeight,W.shadowCameraNear,W.shadowCameraFar));b=0;for(c=p.length;b=0;c--)a[c].object===b&&a.splice(c,1)}function u(a,b,c,d,f){d.program||W.initMaterial(d,b,c,f);if(d.morphTargets&&!f.__webglMorphTargetInfluences){f.__webglMorphTargetInfluences=new Float32Array(W.maxMorphTargets);for(var e=0,g=W.maxMorphTargets;e=0&&j.enableVertexAttribArray(o.position);o.color>=0&&j.enableVertexAttribArray(o.color);o.normal>=0&&j.enableVertexAttribArray(o.normal); +"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapSoft?"#define SHADOWMAP_WIDTH "+c.shadowMapWidth.toFixed(1):"",c.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+c.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");j.attachShader(p,J("fragment",e+k));j.attachShader(p, +J("vertex",d+l));j.linkProgram(p);j.getProgramParameter(p,j.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+j.getProgramParameter(p,j.VALIDATE_STATUS)+", gl error ["+j.getError()+"]");p.uniforms={};p.attributes={};var L,d=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(L in i)d.push(L);L=d;d=0;for(i=L.length;d=0&&j.enableVertexAttribArray(o.position);o.color>=0&&j.enableVertexAttribArray(o.color);o.normal>=0&&j.enableVertexAttribArray(o.normal); o.tangent>=0&&j.enableVertexAttribArray(o.tangent);a.skinning&&o.skinVertexA>=0&&o.skinVertexB>=0&&o.skinIndex>=0&&o.skinWeight>=0&&(j.enableVertexAttribArray(o.skinVertexA),j.enableVertexAttribArray(o.skinVertexB),j.enableVertexAttribArray(o.skinIndex),j.enableVertexAttribArray(o.skinWeight));if(a.attributes)for(g in a.attributes)o[g]!==void 0&&o[g]>=0&&j.enableVertexAttribArray(o[g]);if(a.morphTargets)for(g=a.numSupportedMorphTargets=0;g=0&&(j.enableVertexAttribArray(o[L]), a.numSupportedMorphTargets++);a.uniformsList=[];for(f in a.uniforms)a.uniformsList.push([a.uniforms[f],f])};this.setFaceCulling=function(a,b){a?(!b||b==="ccw"?j.frontFace(j.CCW):j.frontFace(j.CW),a==="back"?j.cullFace(j.BACK):a==="front"?j.cullFace(j.FRONT):j.cullFace(j.FRONT_AND_BACK),j.enable(j.CULL_FACE)):j.disable(j.CULL_FACE)}}; THREE.WebGLRenderTarget=function(a,c,b){this.width=a;this.height=c;b=b||{};this.wrapS=b.wrapS!==void 0?b.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=b.wrapT!==void 0?b.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=b.magFilter!==void 0?b.magFilter:THREE.LinearFilter;this.minFilter=b.minFilter!==void 0?b.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=b.format!==void 0?b.format:THREE.RGBAFormat;this.type=b.type!==void 0?b.type: @@ -375,9 +375,9 @@ THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n")},cube:{uniforms:{tCube:{type: THREE.Curve=function(){};THREE.Curve.prototype.getPoint=function(){console.log("Warning, getPoint() not implemented!");return null};THREE.Curve.prototype.getPointAt=function(a){return this.getPoint(this.getUtoTmapping(a))};THREE.Curve.prototype.getPoints=function(a){a||(a=5);var c,b=[];for(c=0;c<=a;c++)b.push(this.getPoint(c/a));return b};THREE.Curve.prototype.getSpacedPoints=function(a){a||(a=5);var c,b=[];for(c=0;c<=a;c++)b.push(this.getPointAt(c/a));return b}; THREE.Curve.prototype.getLength=function(){var a=this.getLengths();return a[a.length-1]};THREE.Curve.prototype.getLengths=function(a){a||(a=200);if(this.cacheArcLengths&&this.cacheArcLengths.length==a+1)return this.cacheArcLengths;var c=[],b,d=this.getPoint(0),g,f=0;c.push(0);for(g=1;g<=a;g++)b=this.getPoint(g/a),f+=b.distanceTo(d),c.push(f),d=b;return this.cacheArcLengths=c}; THREE.Curve.prototype.getUtoTmapping=function(a,c){var b=this.getLengths(),d=0,g=b.length,f;f=c?c:a*b[g-1];for(var e=0,h=g-1,i;e<=h;)if(d=Math.floor(e+(h-e)/2),i=b[d]-f,i<0)e=d+1;else if(i>0)h=d-1;else{h=d;break}d=h;if(b[d]==f)return d/(g-1);e=b[d];return b=(d+(f-e)/(b[d+1]-e))/(g-1)};THREE.Curve.prototype.getNormalVector=function(a){a=this.getTangent(a);return new THREE.Vector2(-a.y,a.x)}; -THREE.Curve.prototype.getTangent=function(a){var c=a-1.0E-4;a+=1.0E-4;c<0&&(c=0);a>1&&(a=1);c=this.getPoint(c);a=this.getPoint(a);return c.clone().subSelf(a).normalize()};THREE.LineCurve=function(a,c){a instanceof THREE.Vector2?(this.v1=a,this.v2=c):THREE.LineCurve.oldConstructor.apply(this,arguments)};THREE.LineCurve.oldConstructor=function(a,c,b,d){this.constructor(new THREE.Vector2(a,c),new THREE.Vector2(b,d))};THREE.LineCurve.prototype=new THREE.Curve;THREE.LineCurve.prototype.constructor=THREE.LineCurve; -THREE.LineCurve.prototype.getPoint=function(a){var c=new THREE.Vector2;c.sub(this.v2,this.v1);c.multiplyScalar(a).addSelf(this.v1);return c};THREE.LineCurve.prototype.getPointAt=function(a){return this.getPoint(a)};THREE.LineCurve.prototype.getTangent=function(){var a=new THREE.Vector2;a.sub(this.v2,this.v1);a.normalize();return a}; -THREE.QuadraticBezierCurve=function(a,c,b){if(!(c instanceof THREE.Vector2))var d=Array.prototype.slice.call(arguments),a=new THREE.Vector2(d[0],d[1]),c=new THREE.Vector2(d[2],d[3]),b=new THREE.Vector2(d[4],d[5]);this.v0=a;this.v1=c;this.v2=b};THREE.QuadraticBezierCurve.prototype=new THREE.Curve;THREE.QuadraticBezierCurve.prototype.constructor=THREE.QuadraticBezierCurve; +THREE.Curve.prototype.getTangent=function(a){var c=a-1.0E-4;a+=1.0E-4;c<0&&(c=0);a>1&&(a=1);c=this.getPoint(c);a=this.getPoint(a);return c.clone().subSelf(a).normalize()};THREE.Curve.prototype.getTangentAt=function(a){return this.getTangent(this.getUtoTmapping(a))};THREE.LineCurve=function(a,c){a instanceof THREE.Vector2?(this.v1=a,this.v2=c):THREE.LineCurve.oldConstructor.apply(this,arguments)}; +THREE.LineCurve.oldConstructor=function(a,c,b,d){this.constructor(new THREE.Vector2(a,c),new THREE.Vector2(b,d))};THREE.LineCurve.prototype=new THREE.Curve;THREE.LineCurve.prototype.constructor=THREE.LineCurve;THREE.LineCurve.prototype.getPoint=function(a){var c=new THREE.Vector2;c.sub(this.v2,this.v1);c.multiplyScalar(a).addSelf(this.v1);return c};THREE.LineCurve.prototype.getPointAt=function(a){return this.getPoint(a)}; +THREE.LineCurve.prototype.getTangent=function(){var a=new THREE.Vector2;a.sub(this.v2,this.v1);a.normalize();return a};THREE.QuadraticBezierCurve=function(a,c,b){if(!(c instanceof THREE.Vector2))var d=Array.prototype.slice.call(arguments),a=new THREE.Vector2(d[0],d[1]),c=new THREE.Vector2(d[2],d[3]),b=new THREE.Vector2(d[4],d[5]);this.v0=a;this.v1=c;this.v2=b};THREE.QuadraticBezierCurve.prototype=new THREE.Curve;THREE.QuadraticBezierCurve.prototype.constructor=THREE.QuadraticBezierCurve; THREE.QuadraticBezierCurve.prototype.getPoint=function(a){var c;c=THREE.Shape.Utils.b2(a,this.v0.x,this.v1.x,this.v2.x);a=THREE.Shape.Utils.b2(a,this.v0.y,this.v1.y,this.v2.y);return new THREE.Vector2(c,a)};THREE.QuadraticBezierCurve.prototype.getTangent=function(a){var c;c=THREE.Curve.Utils.tangentQuadraticBezier(a,this.v0.x,this.v1.x,this.v2.x);a=THREE.Curve.Utils.tangentQuadraticBezier(a,this.v0.y,this.v1.y,this.v2.y);c=new THREE.Vector2(c,a);c.normalize();return c}; THREE.CubicBezierCurve=function(a,c,b,d){if(!(c instanceof THREE.Vector2))var g=Array.prototype.slice.call(arguments),a=new THREE.Vector2(g[0],g[1]),c=new THREE.Vector2(g[2],g[3]),b=new THREE.Vector2(g[4],g[5]),d=new THREE.Vector2(g[6],g[7]);this.v0=a;this.v1=c;this.v2=b;this.v3=d};THREE.CubicBezierCurve.prototype=new THREE.Curve;THREE.CubicBezierCurve.prototype.constructor=THREE.CubicBezierCurve; THREE.CubicBezierCurve.prototype.getPoint=function(a){var c;c=THREE.Shape.Utils.b3(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x);a=THREE.Shape.Utils.b3(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y);return new THREE.Vector2(c,a)};THREE.CubicBezierCurve.prototype.getTangent=function(a){var c;c=THREE.Curve.Utils.tangentCubicBezier(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x);a=THREE.Curve.Utils.tangentCubicBezier(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y);c=new THREE.Vector2(c,a);c.normalize();return c}; @@ -446,7 +446,7 @@ THREE.CombinedCamera.prototype.toOrthographic=function(){var a=Math.tan(this.fov THREE.CombinedCamera.prototype.setFov=function(a){this.fov=a;this.inPersepectiveMode?this.toPerspective():this.toOrthographic()};THREE.CombinedCamera.prototype.setLens=function(a,c){c||(c=43.25);var b=2*Math.atan(c/(a*2));b*=180/Math.PI;this.setFov(b);return b};THREE.CombinedCamera.prototype.setZoom=function(a){this.zoom=a;this.inPersepectiveMode?this.toPerspective():this.toOrthographic()}; THREE.CombinedCamera.prototype.toFrontView=function(){this.rotation.x=0;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toBackView=function(){this.rotation.x=0;this.rotation.y=Math.PI;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toLeftView=function(){this.rotation.x=0;this.rotation.y=-Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=!1}; THREE.CombinedCamera.prototype.toRightView=function(){this.rotation.x=0;this.rotation.y=Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=!1};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.FirstPersonControls=function(a,c){function b(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.target=new THREE.Vector3(0,0,0);this.domElement=c!==void 0?c:document;this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=Math.PI;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor= +THREE.FirstPersonControls=function(a,c){function b(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.target=new THREE.Vector3(0,0,0);this.domElement=c!==void 0?c:document;this.movementSpeed=1;this.lookSpeed=0.005;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=Math.PI;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor= 0;this.mouseDragOn=this.freeze=this.moveRight=this.moveLeft=this.moveBackward=this.moveForward=!1;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));this.onMouseDown=function(a){this.domElement!==document&&this.domElement.focus();a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward= !0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(a){a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(a){this.domElement===document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.onKeyDown= function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:case 65:this.moveLeft=!0;break;case 40:case 83:this.moveBackward=!0;break;case 39:case 68:this.moveRight=!0;break;case 82:this.moveUp=!0;break;case 70:this.moveDown=!0;break;case 81:this.freeze=!this.freeze}};this.onKeyUp=function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=!1;break;case 40:case 83:this.moveBackward=!1;break;case 39:case 68:this.moveRight=!1;break;case 82:this.moveUp= @@ -456,14 +456,14 @@ this.object.translateX(b);this.moveUp&&this.object.translateY(b);this.moveDown&& Math.sin(this.theta);this.object.lookAt(a)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",b(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",b(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",b(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",b(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",b(this,this.onKeyUp),!1)}; THREE.PathControls=function(a,c){function b(a){if((a*=2)<1)return 0.5*a*a;return-0.5*(--a*(a-2)-1)}function d(a,b){return function(){b.apply(a,arguments)}}function g(a,b,c,d){var f={name:c,fps:0.6,length:d,hierarchy:[]},e,g=b.getControlPointsArray(),h=b.getLength(),q=g.length,t=0;e=q-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:g[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[e]={time:d,pos:g[e],rot:[0,0,0,1],scl:[1,1,1]};for(e=1;e=0?a:a+e;c=this.verticalAngleMap.srcRange; a=this.verticalAngleMap.dstRange;c=THREE.Math.mapLinear(this.phi,c[0],c[1],a[0],a[1]);var d=a[1]-a[0];this.phi=b((c-a[0])/d)*d+a[0];c=this.horizontalAngleMap.srcRange;a=this.horizontalAngleMap.dstRange;c=THREE.Math.mapLinear(this.theta,c[0],c[1],a[0],a[1]);d=a[1]-a[0];this.theta=b((c-a[0])/d)*d+a[0];a=this.target.position;a.x=100*Math.sin(this.phi)*Math.cos(this.theta);a.y=100*Math.cos(this.phi);a.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.object.lookAt(this.target.position)};this.onMouseMove= function(a){this.domElement===document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.init=function(){this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var a=new THREE.MeshLambertMaterial({color:30719}),b=new THREE.MeshLambertMaterial({color:65280}), c=new THREE.CubeGeometry(10,10,20),e=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(c,a);a=new THREE.Mesh(e,b);a.position.set(0,10,0);this.animation=g(this.animationParent,this.spline,this.id,this.duration);this.animationParent.add(this.object);this.animationParent.add(this.target);this.animationParent.add(a)}else this.animation=g(this.animationParent,this.spline,this.id,this.duration),this.animationParent.add(this.target),this.animationParent.add(this.object);if(this.createDebugPath){var a= this.debugPath,b=this.spline,e=f(b,10),c=f(b,10),h=new THREE.LineBasicMaterial({color:16711680,linewidth:3}),e=new THREE.Line(e,h),c=new THREE.ParticleSystem(c,new THREE.ParticleBasicMaterial({color:16755200,size:3}));e.scale.set(1,1,1);a.add(e);c.scale.set(1,1,1);a.add(c);for(var e=new THREE.SphereGeometry(1,16,8),h=new THREE.MeshBasicMaterial({color:65280}),m=0;m1?d.normalize():d.z=Math.sqrt(1-f*f);e.copy(b.object.position).subSelf(b.target);f=b.object.up.clone().setLength(d.y);f.addSelf(b.object.up.clone().crossSelf(e).setLength(d.x));f.addSelf(e.setLength(d.z));return f};this.rotateCamera=function(){var a=Math.acos(h.dot(i)/h.length()/i.length());if(a){var c=(new THREE.Vector3).cross(h,i).normalize(),d=new THREE.Quaternion;a*=b.rotateSpeed;d.setFromAxisAngle(c,-a);d.multiplyVector3(e); -d.multiplyVector3(b.object.up);d.multiplyVector3(i);b.staticMoving?h=i:(d.setFromAxisAngle(c,a*(b.dynamicDampingFactor-1)),d.multiplyVector3(h))}};this.zoomCamera=function(){var a=1+(k.y-l.y)*b.zoomSpeed;a!==1&&a>0&&(e.multiplyScalar(a),b.staticMoving?l=k:l.y+=(k.y-l.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=p.clone().subSelf(o);if(a.lengthSq()){a.multiplyScalar(e.length()*b.panSpeed);var c=e.clone().crossSelf(b.object.up).setLength(a.x);c.addSelf(b.object.up.clone().setLength(a.y)); -b.object.position.addSelf(c);b.target.addSelf(c);b.staticMoving?o=p:o.addSelf(a.sub(p,o).multiplyScalar(b.dynamicDampingFactor))}};this.checkDistances=function(){if(!b.noZoom||!b.noPan)b.object.position.lengthSq()>b.maxDistance*b.maxDistance&&b.object.position.setLength(b.maxDistance),e.lengthSq()1?d.normalize():d.z=Math.sqrt(1-f*f);e.copy(b.object.position).subSelf(b.target);f=b.object.up.clone().setLength(d.y);f.addSelf(b.object.up.clone().crossSelf(e).setLength(d.x));f.addSelf(e.setLength(d.z));return f};this.rotateCamera=function(){var a=Math.acos(h.dot(i)/h.length()/i.length());if(a){var c=(new THREE.Vector3).cross(h,i).normalize(),d=new THREE.Quaternion;a*=b.rotateSpeed;d.setFromAxisAngle(c, +-a);d.multiplyVector3(e);d.multiplyVector3(b.object.up);d.multiplyVector3(i);b.staticMoving?h=i:(d.setFromAxisAngle(c,a*(b.dynamicDampingFactor-1)),d.multiplyVector3(h))}};this.zoomCamera=function(){var a=1+(k.y-l.y)*b.zoomSpeed;a!==1&&a>0&&(e.multiplyScalar(a),b.staticMoving?l=k:l.y+=(k.y-l.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=p.clone().subSelf(o);if(a.lengthSq()){a.multiplyScalar(e.length()*b.panSpeed);var c=e.clone().crossSelf(b.object.up).setLength(a.x);c.addSelf(b.object.up.clone().setLength(a.y)); +b.object.position.addSelf(c);b.target.addSelf(c);b.staticMoving?o=p:o.addSelf(a.sub(p,o).multiplyScalar(b.dynamicDampingFactor))}};this.checkDistances=function(){if(!b.noZoom||!b.noPan)b.object.position.lengthSq()>b.maxDistance*b.maxDistance&&b.object.position.setLength(b.maxDistance),e.lengthSq()0?1:-1;for(h=0;hf?this.hits.push(g):this.hits.unshift(g),f=d;return this.hits}; -THREE.CollisionSystem.prototype.rayCastNearest=function(a){var c=this.rayCastAll(a);if(c.length==0)return null;for(var b=0;c[b]instanceof THREE.MeshCollider;){var d=this.rayMesh(a,c[b]);if(d.distc.length)return null;return c[b]}; -THREE.CollisionSystem.prototype.rayCast=function(a,c){if(c instanceof THREE.PlaneCollider)return this.rayPlane(a,c);else if(c instanceof THREE.SphereCollider)return this.raySphere(a,c);else if(c instanceof THREE.BoxCollider)return this.rayBox(a,c);else if(c instanceof THREE.MeshCollider&&c.box)return this.rayBox(a,c.box)}; -THREE.CollisionSystem.prototype.rayMesh=function(a,c){for(var b=this.makeRayLocal(a,c.mesh),d=Number.MAX_VALUE,g,f=0;f=h*g))return Number.MAX_VALUE;e/=h;h=THREE.CollisionSystem.__v3;h.copy(a.direction);h.multiplyScalar(e);h.addSelf(a.origin);Math.abs(f.x)> -Math.abs(f.y)?Math.abs(f.x)>Math.abs(f.z)?(a=h.y-c.y,f=b.y-c.y,g=d.y-c.y,h=h.z-c.z,b=b.z-c.z,d=d.z-c.z):(a=h.x-c.x,f=b.x-c.x,g=d.x-c.x,h=h.y-c.y,b=b.y-c.y,d=d.y-c.y):Math.abs(f.y)>Math.abs(f.z)?(a=h.x-c.x,f=b.x-c.x,g=d.x-c.x,h=h.z-c.z,b=b.z-c.z,d=d.z-c.z):(a=h.x-c.x,f=b.x-c.x,g=d.x-c.x,h=h.y-c.y,b=b.y-c.y,d=d.y-c.y);c=f*d-b*g;if(c==0)return Number.MAX_VALUE;c=1/c;d=(a*d-h*g)*c;if(!(d>=0))return Number.MAX_VALUE;c*=f*h-b*a;if(!(c>=0))return Number.MAX_VALUE;if(!(1-d-c>=0))return Number.MAX_VALUE;return e}; -THREE.CollisionSystem.prototype.makeRayLocal=function(a,c){var b=THREE.CollisionSystem.__m;b.getInverse(c.matrixWorld);var d=THREE.CollisionSystem.__r;d.origin.copy(a.origin);d.direction.copy(a.direction);b.multiplyVector3(d.origin);b.rotateAxis(d.direction);d.direction.normalize();return d}; -THREE.CollisionSystem.prototype.rayBox=function(a,c){var b;c.dynamic&&c.mesh&&c.mesh.matrixWorld?b=this.makeRayLocal(a,c.mesh):(b=THREE.CollisionSystem.__r,b.origin.copy(a.origin),b.direction.copy(a.direction));var d=0,g=0,f=0,e=0,h=0,i=0,l=!0;b.origin.xc.max.x&&(d=c.max.x-b.origin.x,d/=b.direction.x,l=!1,e=1);b.origin.yc.max.y&&(g=c.max.y-b.origin.y,g/=b.direction.y, -l=!1,h=1);b.origin.zc.max.z&&(f=c.max.z-b.origin.z,f/=b.direction.z,l=!1,i=1);if(l)return-1;l=0;g>d&&(l=1,d=g);f>d&&(l=2,d=f);switch(l){case 0:h=b.origin.y+b.direction.y*d;if(hc.max.y)return Number.MAX_VALUE;b=b.origin.z+b.direction.z*d;if(bc.max.z)return Number.MAX_VALUE;c.normal.set(e,0,0);break;case 1:e=b.origin.x+b.direction.x*d;if(ec.max.x)return Number.MAX_VALUE;b=b.origin.z+b.direction.z* -d;if(bc.max.z)return Number.MAX_VALUE;c.normal.set(0,h,0);break;case 2:e=b.origin.x+b.direction.x*d;if(ec.max.x)return Number.MAX_VALUE;h=b.origin.y+b.direction.y*d;if(hc.max.y)return Number.MAX_VALUE;c.normal.set(0,0,i)}return d};THREE.CollisionSystem.prototype.rayPlane=function(a,c){var b=a.direction.dot(c.normal),d=c.point.dot(c.normal);if(b<0)b=(d-a.origin.dot(c.normal))/b;else return Number.MAX_VALUE;return b>0?b:Number.MAX_VALUE}; -THREE.CollisionSystem.prototype.raySphere=function(a,c){var b=c.center.clone().subSelf(a.origin);if(b.lengthSq=0)return Math.abs(d)-Math.sqrt(b);return Number.MAX_VALUE};THREE.CollisionSystem.__v1=new THREE.Vector3;THREE.CollisionSystem.__v2=new THREE.Vector3;THREE.CollisionSystem.__v3=new THREE.Vector3;THREE.CollisionSystem.__nr=new THREE.Vector3;THREE.CollisionSystem.__m=new THREE.Matrix4; -THREE.CollisionSystem.__r=new THREE.Ray;THREE.CollisionUtils={};THREE.CollisionUtils.MeshOBB=function(a){a.geometry.computeBoundingBox();var c=a.geometry.boundingBox,b=new THREE.Vector3(c.x[0],c.y[0],c.z[0]),c=new THREE.Vector3(c.x[1],c.y[1],c.z[1]),b=new THREE.BoxCollider(b,c);b.mesh=a;return b};THREE.CollisionUtils.MeshAABB=function(a){var c=THREE.CollisionUtils.MeshOBB(a);c.min.addSelf(a.position);c.max.addSelf(a.position);c.dynamic=!1;return c}; -THREE.CollisionUtils.MeshColliderWBox=function(a){return new THREE.MeshCollider(a,THREE.CollisionUtils.MeshOBB(a))}; +2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,3,8,9,1,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,9,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,3,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1]); if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=!1;var c=this,b=this.setSize,d=this.render,g=new THREE.PerspectiveCamera,f=new THREE.PerspectiveCamera,e=new THREE.Matrix4,h=new THREE.Matrix4,i,l,k,o;g.matrixAutoUpdate=f.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},p=new THREE.WebGLRenderTarget(512,512,a),m=new THREE.WebGLRenderTarget(512,512,a),r=new THREE.PerspectiveCamera(53, 1,1,1E4);r.position.z=2;var a=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:p},mapRight:{type:"t",value:1,texture:m}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"}), n=new THREE.Scene;n.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),a));n.add(r);this.setSize=function(a,d){b.call(c,a,d);p.width=a;p.height=d;m.width=a;m.height=d};this.render=function(a,b){a.updateMatrixWorld();if(i!==b.aspect||l!==b.near||k!==b.far||o!==b.fov){i=b.aspect;l=b.near;k=b.far;o=b.fov;var w=b.projectionMatrix.clone(),u=125/30*0.5,B=u*l/125,F=l*Math.tan(o*Math.PI/360),A;e.n14=u;h.n14=-u;u=-F*i+B;A=F*i+B;w.n11=2*l/(A-u);w.n13=(A+u)/(A-u);g.projectionMatrix.copy(w);u=-F*i-B;A=F*i-B;w.n11= diff --git a/build/custom/ThreeCanvas.js b/build/custom/ThreeCanvas.js index 3c370acabf426905f527a927782c22b388abfdaf..5d805bded0afeb8517183a72a8111104da3f3b4a 100644 --- a/build/custom/ThreeCanvas.js +++ b/build/custom/ThreeCanvas.js @@ -1,4 +1,4 @@ -// ThreeCanvas.js r46dev - http://github.com/mrdoob/three.js +// ThreeCanvas.js r46 - http://github.com/mrdoob/three.js var THREE=THREE||{};if(!self.Int32Array)self.Int32Array=Array,self.Float32Array=Array;THREE.Color=function(a){a!==void 0&&this.setHex(a);return this}; THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;return this},copyGammaToLinear:function(a){this.r=a.r*a.r;this.g=a.g*a.g;this.b=a.b*a.b;return this},copyLinearToGamma:function(a){this.r=Math.sqrt(a.r);this.g=Math.sqrt(a.g);this.b=Math.sqrt(a.b);return this},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;return this},setHSV:function(a,b,c){var d,f,e;if(c===0)this.r=this.g=this.b=0;else switch(d=Math.floor(a*6),f=a*6-d,a=c*(1-b),e=c*(1- b*f),b=c*(1-b*(1-f)),d){case 1:this.r=e;this.g=c;this.b=a;break;case 2:this.r=a;this.g=c;this.b=b;break;case 3:this.r=a;this.g=e;this.b=c;break;case 4:this.r=b;this.g=a;this.b=c;break;case 5:this.r=c;this.g=a;this.b=e;break;case 6:case 0:this.r=c,this.g=b,this.b=a}return this},setHex:function(a){a=Math.floor(a);this.r=(a>>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255;return this},getHex:function(){return~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},getContextStyle:function(){return"rgb("+ @@ -72,7 +72,7 @@ this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRo this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a===0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b= this.x,c=this.y,d=this.z,f=this.w,e=a.x,g=a.y,h=a.z,a=a.w;this.x=b*a+f*e+c*h-d*g;this.y=c*a+f*g+d*e-b*h;this.z=d*a+f*h+b*g-c*e;this.w=f*a-b*e-c*g-d*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,f=a.z,e=this.x,g=this.y,h=this.z,m=this.w,l=m*c+g*f-h*d,j=m*d+h*c-e*f,i=m*f+e*d-g*c,c=-e* c-g*d-h*f;b.x=l*m+c*-e+j*-h-i*-g;b.y=j*m+c*-g+i*-e-l*-h;b.z=i*m+c*-h+l*-g-j*-e;return b}}; -THREE.Quaternion.slerp=function(a,b,c,d){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;f<0?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,f=-f):c.copy(b);if(Math.abs(f)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var e=Math.acos(f),f=Math.sqrt(1-f*f);if(Math.abs(f)<0.0010)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;b=Math.sin((1-d)*e)/f;d=Math.sin(d*e)/f;c.w=a.w*b+c.w*d;c.x=a.x*b+c.x*d;c.y=a.y*b+c.y*d;c.z=a.z*b+c.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3}; +THREE.Quaternion.slerp=function(a,b,c,d){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;f<0?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,f=-f):c.copy(b);if(Math.abs(f)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var e=Math.acos(f),f=Math.sqrt(1-f*f);if(Math.abs(f)<0.001)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;b=Math.sin((1-d)*e)/f;d=Math.sin(d*e)/f;c.w=a.w*b+c.w*d;c.x=a.x*b+c.x*d;c.y=a.y*b+c.y*d;c.z=a.z*b+c.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3}; THREE.Face3=function(a,b,c,d,f,e){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=e;this.centroid=new THREE.Vector3}; THREE.Face4=function(a,b,c,d,f,e,g){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=g;this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.u=a||0;this.v=b||0}; THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}}; diff --git a/build/custom/ThreeDOM.js b/build/custom/ThreeDOM.js index 3da6f470a0cde674bba076761061d4f1a37ab54e..96c424bccb7acc928e92e351cc10243ab8a19b3c 100644 --- a/build/custom/ThreeDOM.js +++ b/build/custom/ThreeDOM.js @@ -1,4 +1,4 @@ -// ThreeDOM.js r46dev - http://github.com/mrdoob/three.js +// ThreeDOM.js r46 - http://github.com/mrdoob/three.js var THREE=THREE||{};if(!self.Int32Array)self.Int32Array=Array,self.Float32Array=Array;THREE.Color=function(a){a!==void 0&&this.setHex(a);return this}; THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;return this},copyGammaToLinear:function(a){this.r=a.r*a.r;this.g=a.g*a.g;this.b=a.b*a.b;return this},copyLinearToGamma:function(a){this.r=Math.sqrt(a.r);this.g=Math.sqrt(a.g);this.b=Math.sqrt(a.b);return this},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;return this},setHSV:function(a,b,c){var d,e,f;if(c===0)this.r=this.g=this.b=0;else switch(d=Math.floor(a*6),e=a*6-d,a=c*(1-b),f=c*(1- b*e),b=c*(1-b*(1-e)),d){case 1:this.r=f;this.g=c;this.b=a;break;case 2:this.r=a;this.g=c;this.b=b;break;case 3:this.r=a;this.g=f;this.b=c;break;case 4:this.r=b;this.g=a;this.b=c;break;case 5:this.r=c;this.g=a;this.b=f;break;case 6:case 0:this.r=c,this.g=b,this.b=a}return this},setHex:function(a){a=Math.floor(a);this.r=(a>>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255;return this},getHex:function(){return~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},getContextStyle:function(){return"rgb("+ @@ -72,7 +72,7 @@ this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRo this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a===0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b= this.x,c=this.y,d=this.z,e=this.w,f=a.x,g=a.y,h=a.z,a=a.w;this.x=b*a+e*f+c*h-d*g;this.y=c*a+e*g+d*f-b*h;this.z=d*a+e*h+b*g-c*f;this.w=e*a-b*f-c*g-d*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,f=this.x,g=this.y,h=this.z,k=this.w,m=k*c+g*e-h*d,j=k*d+h*c-f*e,i=k*e+f*d-g*c,c=-f* c-g*d-h*e;b.x=m*k+c*-f+j*-h-i*-g;b.y=j*k+c*-g+i*-f-m*-h;b.z=i*k+c*-h+m*-g-j*-f;return b}}; -THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;e<0?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,e=-e):c.copy(b);if(Math.abs(e)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var f=Math.acos(e),e=Math.sqrt(1-e*e);if(Math.abs(e)<0.0010)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;b=Math.sin((1-d)*f)/e;d=Math.sin(d*f)/e;c.w=a.w*b+c.w*d;c.x=a.x*b+c.x*d;c.y=a.y*b+c.y*d;c.z=a.z*b+c.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3}; +THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;e<0?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,e=-e):c.copy(b);if(Math.abs(e)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var f=Math.acos(e),e=Math.sqrt(1-e*e);if(Math.abs(e)<0.001)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;b=Math.sin((1-d)*f)/e;d=Math.sin(d*f)/e;c.w=a.w*b+c.w*d;c.x=a.x*b+c.x*d;c.y=a.y*b+c.y*d;c.z=a.z*b+c.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3}; THREE.Face3=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=f;this.centroid=new THREE.Vector3}; THREE.Face4=function(a,b,c,d,e,f,g){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=g;this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.u=a||0;this.v=b||0}; THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}}; diff --git a/build/custom/ThreeExtras.js b/build/custom/ThreeExtras.js index ad4b2ec247272dc1f04b9fcab45e0a5f80e87dd3..781a1ccb003d73a6afb7d1bb35e0d22fb1b023db 100644 --- a/build/custom/ThreeExtras.js +++ b/build/custom/ThreeExtras.js @@ -1,19 +1,19 @@ -// ThreeExtras.js r46dev - http://github.com/mrdoob/three.js -THREE.ColorUtils={adjustHSV:function(a,c,b,d){var g=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,g);g.h=THREE.Math.clamp(g.h+c,0,1);g.s=THREE.Math.clamp(g.s+b,0,1);g.v=THREE.Math.clamp(g.v+d,0,1);a.setHSV(g.h,g.s,g.v)},rgbToHsv:function(a,c){var b=a.r,d=a.g,g=a.b,f=Math.max(Math.max(b,d),g),e=Math.min(Math.min(b,d),g);if(e===f)e=b=0;else{var h=f-e,e=h/f,b=b===f?(d-g)/h:d===f?2+(g-b)/h:4+(b-d)/h;b/=6;b<0&&(b+=1);b>1&&(b-=1)}c===void 0&&(c={h:0,s:0,v:0});c.h=b;c.s=e;c.v=f;return c}}; +// ThreeExtras.js r46 - http://github.com/mrdoob/three.js +THREE.ColorUtils={adjustHSV:function(a,d,b,c){var g=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,g);g.h=THREE.Math.clamp(g.h+d,0,1);g.s=THREE.Math.clamp(g.s+b,0,1);g.v=THREE.Math.clamp(g.v+c,0,1);a.setHSV(g.h,g.s,g.v)},rgbToHsv:function(a,d){var b=a.r,c=a.g,g=a.b,f=Math.max(Math.max(b,c),g),e=Math.min(Math.min(b,c),g);if(e===f)e=b=0;else{var h=f-e,e=h/f,b=b===f?(c-g)/h:c===f?2+(g-b)/h:4+(b-c)/h;b/=6;b<0&&(b+=1);b>1&&(b-=1)}d===void 0&&(d={h:0,s:0,v:0});d.h=b;d.s=e;d.v=f;return d}}; THREE.ColorUtils.__hsv={h:0,s:0,v:0}; -THREE.GeometryUtils={merge:function(a,c){for(var b,d,g=a.vertices.length,f=c instanceof THREE.Mesh?c.geometry:c,e=a.vertices,h=f.vertices,i=a.faces,k=f.faces,j=a.faceVertexUvs[0],q=f.faceVertexUvs[0],o={},n=0;n1&&(d=1-d,g=1-g);f=1-d-g;e.copy(a);e.multiplyScalar(d);h.copy(c);h.multiplyScalar(g);e.addSelf(h);h.copy(b);h.multiplyScalar(f);e.addSelf(h);return e},randomPointInFace:function(a,c,b){var d,g,f;if(a instanceof THREE.Face3)return d=c.vertices[a.a].position,g=c.vertices[a.b].position, -f=c.vertices[a.c].position,THREE.GeometryUtils.randomPointInTriangle(d,g,f);else if(a instanceof THREE.Face4){d=c.vertices[a.a].position;g=c.vertices[a.b].position;f=c.vertices[a.c].position;var c=c.vertices[a.d].position,e;b?a._area1&&a._area2?(b=a._area1,e=a._area2):(b=THREE.GeometryUtils.triangleArea(d,g,c),e=THREE.GeometryUtils.triangleArea(g,f,c),a._area1=b,a._area2=e):(b=THREE.GeometryUtils.triangleArea(d,g,c),e=THREE.GeometryUtils.triangleArea(g,f,c));return THREE.GeometryUtils.random()*(b+ -e)a?b(d,e-1):k[e]1&&(c=1-c,g=1-g);f=1-c-g;e.copy(a);e.multiplyScalar(c);h.copy(d);h.multiplyScalar(g);e.addSelf(h);h.copy(b);h.multiplyScalar(f);e.addSelf(h);return e},randomPointInFace:function(a,d,b){var c,g,f;if(a instanceof THREE.Face3)return c=d.vertices[a.a].position,g=d.vertices[a.b].position, +f=d.vertices[a.c].position,THREE.GeometryUtils.randomPointInTriangle(c,g,f);else if(a instanceof THREE.Face4){c=d.vertices[a.a].position;g=d.vertices[a.b].position;f=d.vertices[a.c].position;var d=d.vertices[a.d].position,e;b?a._area1&&a._area2?(b=a._area1,e=a._area2):(b=THREE.GeometryUtils.triangleArea(c,g,d),e=THREE.GeometryUtils.triangleArea(g,f,d),a._area1=b,a._area2=e):(b=THREE.GeometryUtils.triangleArea(c,g,d),e=THREE.GeometryUtils.triangleArea(g,f,d));return THREE.GeometryUtils.random()*(b+ +e)a?b(c,e-1):k[e] 0\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\nuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\nvarying vec4 vPointLight[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;", THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvViewPosition = -mvPosition.xyz;\nvNormal = normalize( normalMatrix * normal );\nvTangent = normalize( normalMatrix * tangent.xyz );\nvBinormal = cross( vNormal, vTangent ) * tangent.w;\nvBinormal = normalize( vBinormal );\nvUv = uv * uRepeat + uOffset;\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 lVector = lPosition.xyz - mvPosition.xyz;\nfloat lDistance = 1.0;\nif ( pointLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );\nlVector = normalize( lVector );\nvPointLight[ i ] = vec4( lVector, lDistance );\n}\n#endif\n#ifdef VERTEX_TEXTURES\nvec3 dv = texture2D( tDisplacement, uv ).xyz;\nfloat df = uDisplacementScale * dv.x + uDisplacementBias;\nvec4 displacedPosition = vec4( vNormal.xyz * df, 0.0 ) + mvPosition;\ngl_Position = projectionMatrix * displacedPosition;\n#else\ngl_Position = projectionMatrix * mvPosition;\n#endif", THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n")},cube:{uniforms:{tCube:{type:"t",value:1,texture:null},tFlip:{type:"f",value:-1}},vertexShader:"varying vec3 vViewPosition;\nvoid main() {\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvViewPosition = cameraPosition - mPosition.xyz;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform samplerCube tCube;\nuniform float tFlip;\nvarying vec3 vViewPosition;\nvoid main() {\nvec3 wPos = cameraPosition - vViewPosition;\ngl_FragColor = textureCube( tCube, vec3( tFlip * wPos.x, wPos.yz ) );\n}"}}}; -THREE.Curve=function(){};THREE.Curve.prototype.getPoint=function(){console.log("Warning, getPoint() not implemented!");return null};THREE.Curve.prototype.getPointAt=function(a){return this.getPoint(this.getUtoTmapping(a))};THREE.Curve.prototype.getPoints=function(a){a||(a=5);var c,b=[];for(c=0;c<=a;c++)b.push(this.getPoint(c/a));return b};THREE.Curve.prototype.getSpacedPoints=function(a){a||(a=5);var c,b=[];for(c=0;c<=a;c++)b.push(this.getPointAt(c/a));return b}; -THREE.Curve.prototype.getLength=function(){var a=this.getLengths();return a[a.length-1]};THREE.Curve.prototype.getLengths=function(a){a||(a=200);if(this.cacheArcLengths&&this.cacheArcLengths.length==a+1)return this.cacheArcLengths;var c=[],b,d=this.getPoint(0),g,f=0;c.push(0);for(g=1;g<=a;g++)b=this.getPoint(g/a),f+=b.distanceTo(d),c.push(f),d=b;return this.cacheArcLengths=c}; -THREE.Curve.prototype.getUtoTmapping=function(a,c){var b=this.getLengths(),d=0,g=b.length,f;f=c?c:a*b[g-1];for(var e=0,h=g-1,i;e<=h;)if(d=Math.floor(e+(h-e)/2),i=b[d]-f,i<0)e=d+1;else if(i>0)h=d-1;else{h=d;break}d=h;if(b[d]==f)return d/(g-1);e=b[d];return b=(d+(f-e)/(b[d+1]-e))/(g-1)};THREE.Curve.prototype.getNormalVector=function(a){a=this.getTangent(a);return new THREE.Vector2(-a.y,a.x)}; -THREE.Curve.prototype.getTangent=function(a){var c=a-1.0E-4;a+=1.0E-4;c<0&&(c=0);a>1&&(a=1);c=this.getPoint(c);a=this.getPoint(a);return c.clone().subSelf(a).normalize()};THREE.LineCurve=function(a,c){a instanceof THREE.Vector2?(this.v1=a,this.v2=c):THREE.LineCurve.oldConstructor.apply(this,arguments)};THREE.LineCurve.oldConstructor=function(a,c,b,d){this.constructor(new THREE.Vector2(a,c),new THREE.Vector2(b,d))};THREE.LineCurve.prototype=new THREE.Curve;THREE.LineCurve.prototype.constructor=THREE.LineCurve; -THREE.LineCurve.prototype.getPoint=function(a){var c=new THREE.Vector2;c.sub(this.v2,this.v1);c.multiplyScalar(a).addSelf(this.v1);return c};THREE.LineCurve.prototype.getPointAt=function(a){return this.getPoint(a)};THREE.LineCurve.prototype.getTangent=function(){var a=new THREE.Vector2;a.sub(this.v2,this.v1);a.normalize();return a}; -THREE.QuadraticBezierCurve=function(a,c,b){if(!(c instanceof THREE.Vector2))var d=Array.prototype.slice.call(arguments),a=new THREE.Vector2(d[0],d[1]),c=new THREE.Vector2(d[2],d[3]),b=new THREE.Vector2(d[4],d[5]);this.v0=a;this.v1=c;this.v2=b};THREE.QuadraticBezierCurve.prototype=new THREE.Curve;THREE.QuadraticBezierCurve.prototype.constructor=THREE.QuadraticBezierCurve; -THREE.QuadraticBezierCurve.prototype.getPoint=function(a){var c;c=THREE.Shape.Utils.b2(a,this.v0.x,this.v1.x,this.v2.x);a=THREE.Shape.Utils.b2(a,this.v0.y,this.v1.y,this.v2.y);return new THREE.Vector2(c,a)};THREE.QuadraticBezierCurve.prototype.getTangent=function(a){var c;c=THREE.Curve.Utils.tangentQuadraticBezier(a,this.v0.x,this.v1.x,this.v2.x);a=THREE.Curve.Utils.tangentQuadraticBezier(a,this.v0.y,this.v1.y,this.v2.y);c=new THREE.Vector2(c,a);c.normalize();return c}; -THREE.CubicBezierCurve=function(a,c,b,d){if(!(c instanceof THREE.Vector2))var g=Array.prototype.slice.call(arguments),a=new THREE.Vector2(g[0],g[1]),c=new THREE.Vector2(g[2],g[3]),b=new THREE.Vector2(g[4],g[5]),d=new THREE.Vector2(g[6],g[7]);this.v0=a;this.v1=c;this.v2=b;this.v3=d};THREE.CubicBezierCurve.prototype=new THREE.Curve;THREE.CubicBezierCurve.prototype.constructor=THREE.CubicBezierCurve; -THREE.CubicBezierCurve.prototype.getPoint=function(a){var c;c=THREE.Shape.Utils.b3(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x);a=THREE.Shape.Utils.b3(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y);return new THREE.Vector2(c,a)};THREE.CubicBezierCurve.prototype.getTangent=function(a){var c;c=THREE.Curve.Utils.tangentCubicBezier(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x);a=THREE.Curve.Utils.tangentCubicBezier(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y);c=new THREE.Vector2(c,a);c.normalize();return c}; +THREE.Curve=function(){};THREE.Curve.prototype.getPoint=function(){console.log("Warning, getPoint() not implemented!");return null};THREE.Curve.prototype.getPointAt=function(a){return this.getPoint(this.getUtoTmapping(a))};THREE.Curve.prototype.getPoints=function(a){a||(a=5);var d,b=[];for(d=0;d<=a;d++)b.push(this.getPoint(d/a));return b};THREE.Curve.prototype.getSpacedPoints=function(a){a||(a=5);var d,b=[];for(d=0;d<=a;d++)b.push(this.getPointAt(d/a));return b}; +THREE.Curve.prototype.getLength=function(){var a=this.getLengths();return a[a.length-1]};THREE.Curve.prototype.getLengths=function(a){a||(a=200);if(this.cacheArcLengths&&this.cacheArcLengths.length==a+1)return this.cacheArcLengths;var d=[],b,c=this.getPoint(0),g,f=0;d.push(0);for(g=1;g<=a;g++)b=this.getPoint(g/a),f+=b.distanceTo(c),d.push(f),c=b;return this.cacheArcLengths=d}; +THREE.Curve.prototype.getUtoTmapping=function(a,d){var b=this.getLengths(),c=0,g=b.length,f;f=d?d:a*b[g-1];for(var e=0,h=g-1,i;e<=h;)if(c=Math.floor(e+(h-e)/2),i=b[c]-f,i<0)e=c+1;else if(i>0)h=c-1;else{h=c;break}c=h;if(b[c]==f)return c/(g-1);e=b[c];return b=(c+(f-e)/(b[c+1]-e))/(g-1)};THREE.Curve.prototype.getNormalVector=function(a){a=this.getTangent(a);return new THREE.Vector2(-a.y,a.x)}; +THREE.Curve.prototype.getTangent=function(a){var d=a-1.0E-4;a+=1.0E-4;d<0&&(d=0);a>1&&(a=1);d=this.getPoint(d);a=this.getPoint(a);return d.clone().subSelf(a).normalize()};THREE.Curve.prototype.getTangentAt=function(a){return this.getTangent(this.getUtoTmapping(a))};THREE.LineCurve=function(a,d){a instanceof THREE.Vector2?(this.v1=a,this.v2=d):THREE.LineCurve.oldConstructor.apply(this,arguments)}; +THREE.LineCurve.oldConstructor=function(a,d,b,c){this.constructor(new THREE.Vector2(a,d),new THREE.Vector2(b,c))};THREE.LineCurve.prototype=new THREE.Curve;THREE.LineCurve.prototype.constructor=THREE.LineCurve;THREE.LineCurve.prototype.getPoint=function(a){var d=new THREE.Vector2;d.sub(this.v2,this.v1);d.multiplyScalar(a).addSelf(this.v1);return d};THREE.LineCurve.prototype.getPointAt=function(a){return this.getPoint(a)}; +THREE.LineCurve.prototype.getTangent=function(){var a=new THREE.Vector2;a.sub(this.v2,this.v1);a.normalize();return a};THREE.QuadraticBezierCurve=function(a,d,b){if(!(d instanceof THREE.Vector2))var c=Array.prototype.slice.call(arguments),a=new THREE.Vector2(c[0],c[1]),d=new THREE.Vector2(c[2],c[3]),b=new THREE.Vector2(c[4],c[5]);this.v0=a;this.v1=d;this.v2=b};THREE.QuadraticBezierCurve.prototype=new THREE.Curve;THREE.QuadraticBezierCurve.prototype.constructor=THREE.QuadraticBezierCurve; +THREE.QuadraticBezierCurve.prototype.getPoint=function(a){var d;d=THREE.Shape.Utils.b2(a,this.v0.x,this.v1.x,this.v2.x);a=THREE.Shape.Utils.b2(a,this.v0.y,this.v1.y,this.v2.y);return new THREE.Vector2(d,a)};THREE.QuadraticBezierCurve.prototype.getTangent=function(a){var d;d=THREE.Curve.Utils.tangentQuadraticBezier(a,this.v0.x,this.v1.x,this.v2.x);a=THREE.Curve.Utils.tangentQuadraticBezier(a,this.v0.y,this.v1.y,this.v2.y);d=new THREE.Vector2(d,a);d.normalize();return d}; +THREE.CubicBezierCurve=function(a,d,b,c){if(!(d instanceof THREE.Vector2))var g=Array.prototype.slice.call(arguments),a=new THREE.Vector2(g[0],g[1]),d=new THREE.Vector2(g[2],g[3]),b=new THREE.Vector2(g[4],g[5]),c=new THREE.Vector2(g[6],g[7]);this.v0=a;this.v1=d;this.v2=b;this.v3=c};THREE.CubicBezierCurve.prototype=new THREE.Curve;THREE.CubicBezierCurve.prototype.constructor=THREE.CubicBezierCurve; +THREE.CubicBezierCurve.prototype.getPoint=function(a){var d;d=THREE.Shape.Utils.b3(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x);a=THREE.Shape.Utils.b3(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y);return new THREE.Vector2(d,a)};THREE.CubicBezierCurve.prototype.getTangent=function(a){var d;d=THREE.Curve.Utils.tangentCubicBezier(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x);a=THREE.Curve.Utils.tangentCubicBezier(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y);d=new THREE.Vector2(d,a);d.normalize();return d}; THREE.SplineCurve=function(a){this.points=a==void 0?[]:a};THREE.SplineCurve.prototype=new THREE.Curve;THREE.SplineCurve.prototype.constructor=THREE.SplineCurve; -THREE.SplineCurve.prototype.getPoint=function(a){var c=new THREE.Vector2,b=[],d=this.points,g;g=(d.length-1)*a;a=Math.floor(g);g-=a;b[0]=a==0?a:a-1;b[1]=a;b[2]=a>d.length-2?a:a+1;b[3]=a>d.length-3?a:a+2;c.x=THREE.Curve.Utils.interpolate(d[b[0]].x,d[b[1]].x,d[b[2]].x,d[b[3]].x,g);c.y=THREE.Curve.Utils.interpolate(d[b[0]].y,d[b[1]].y,d[b[2]].y,d[b[3]].y,g);return c};THREE.ArcCurve=function(a,c,b,d,g,f){this.aX=a;this.aY=c;this.aRadius=b;this.aStartAngle=d;this.aEndAngle=g;this.aClockwise=f}; -THREE.ArcCurve.prototype=new THREE.Curve;THREE.ArcCurve.prototype.constructor=THREE.ArcCurve;THREE.ArcCurve.prototype.getPoint=function(a){var c=this.aEndAngle-this.aStartAngle;this.aClockwise||(a=1-a);a=this.aStartAngle+a*c;return new THREE.Vector2(this.aX+this.aRadius*Math.cos(a),this.aY+this.aRadius*Math.sin(a))}; -THREE.Curve.Utils={tangentQuadraticBezier:function(a,c,b,d){return 2*(1-a)*(b-c)+2*a*(d-b)},tangentCubicBezier:function(a,c,b,d,g){return-3*c*(1-a)*(1-a)+3*b*(1-a)*(1-a)-6*a*b*(1-a)+6*a*d*(1-a)-3*a*a*d+3*a*a*g},tangentSpline:function(a){return 6*a*a-6*a+(3*a*a-4*a+1)+(-6*a*a+6*a)+(3*a*a-2*a)},interpolate:function(a,c,b,d,g){var a=(b-a)*0.5,d=(d-c)*0.5,f=g*g;return(2*c-2*b+a+d)*g*f+(-3*c+3*b-2*a-d)*f+a*g+c}}; -THREE.Curve.create=function(a,c){a.prototype=new THREE.Curve;a.prototype.constructor=a;a.prototype.getPoint=c;return a};THREE.LineCurve3=THREE.Curve.create(function(a,c){this.v1=a;this.v2=c},function(a){var c=new THREE.Vector3;c.sub(this.v2,this.v1);c.multiplyScalar(a);c.addSelf(this.v1);return c}); -THREE.QuadraticBezierCurve3=THREE.Curve.create(function(a,c,b){this.v0=a;this.v1=c;this.v2=b},function(a){var c,b;c=THREE.Shape.Utils.b2(a,this.v0.x,this.v1.x,this.v2.x);b=THREE.Shape.Utils.b2(a,this.v0.y,this.v1.y,this.v2.y);a=THREE.Shape.Utils.b2(a,this.v0.z,this.v1.z,this.v2.z);return new THREE.Vector3(c,b,a)}); -THREE.CubicBezierCurve3=THREE.Curve.create(function(a,c,b,d){this.v0=a;this.v1=c;this.v2=b;this.v3=d},function(a){var c,b;c=THREE.Shape.Utils.b3(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x);b=THREE.Shape.Utils.b3(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y);a=THREE.Shape.Utils.b3(a,this.v0.z,this.v1.z,this.v2.z,this.v3.z);return new THREE.Vector3(c,b,a)}); -THREE.SplineCurve3=THREE.Curve.create(function(a){this.points=a==void 0?[]:a},function(a){var c=new THREE.Vector3,b=[],d=this.points,g;g=(d.length-1)*a;a=Math.floor(g);g-=a;b[0]=a==0?a:a-1;b[1]=a;b[2]=a>d.length-2?a:a+1;b[3]=a>d.length-3?a:a+2;c.x=THREE.Curve.Utils.interpolate(d[b[0]].x,d[b[1]].x,d[b[2]].x,d[b[3]].x,g);c.y=THREE.Curve.Utils.interpolate(d[b[0]].y,d[b[1]].y,d[b[2]].y,d[b[3]].y,g);c.z=THREE.Curve.Utils.interpolate(d[b[0]].z,d[b[1]].z,d[b[2]].z,d[b[3]].z,g);return c}); +THREE.SplineCurve.prototype.getPoint=function(a){var d=new THREE.Vector2,b=[],c=this.points,g;g=(c.length-1)*a;a=Math.floor(g);g-=a;b[0]=a==0?a:a-1;b[1]=a;b[2]=a>c.length-2?a:a+1;b[3]=a>c.length-3?a:a+2;d.x=THREE.Curve.Utils.interpolate(c[b[0]].x,c[b[1]].x,c[b[2]].x,c[b[3]].x,g);d.y=THREE.Curve.Utils.interpolate(c[b[0]].y,c[b[1]].y,c[b[2]].y,c[b[3]].y,g);return d};THREE.ArcCurve=function(a,d,b,c,g,f){this.aX=a;this.aY=d;this.aRadius=b;this.aStartAngle=c;this.aEndAngle=g;this.aClockwise=f}; +THREE.ArcCurve.prototype=new THREE.Curve;THREE.ArcCurve.prototype.constructor=THREE.ArcCurve;THREE.ArcCurve.prototype.getPoint=function(a){var d=this.aEndAngle-this.aStartAngle;this.aClockwise||(a=1-a);a=this.aStartAngle+a*d;return new THREE.Vector2(this.aX+this.aRadius*Math.cos(a),this.aY+this.aRadius*Math.sin(a))}; +THREE.Curve.Utils={tangentQuadraticBezier:function(a,d,b,c){return 2*(1-a)*(b-d)+2*a*(c-b)},tangentCubicBezier:function(a,d,b,c,g){return-3*d*(1-a)*(1-a)+3*b*(1-a)*(1-a)-6*a*b*(1-a)+6*a*c*(1-a)-3*a*a*c+3*a*a*g},tangentSpline:function(a){return 6*a*a-6*a+(3*a*a-4*a+1)+(-6*a*a+6*a)+(3*a*a-2*a)},interpolate:function(a,d,b,c,g){var a=(b-a)*0.5,c=(c-d)*0.5,f=g*g;return(2*d-2*b+a+c)*g*f+(-3*d+3*b-2*a-c)*f+a*g+d}}; +THREE.Curve.create=function(a,d){a.prototype=new THREE.Curve;a.prototype.constructor=a;a.prototype.getPoint=d;return a};THREE.LineCurve3=THREE.Curve.create(function(a,d){this.v1=a;this.v2=d},function(a){var d=new THREE.Vector3;d.sub(this.v2,this.v1);d.multiplyScalar(a);d.addSelf(this.v1);return d}); +THREE.QuadraticBezierCurve3=THREE.Curve.create(function(a,d,b){this.v0=a;this.v1=d;this.v2=b},function(a){var d,b;d=THREE.Shape.Utils.b2(a,this.v0.x,this.v1.x,this.v2.x);b=THREE.Shape.Utils.b2(a,this.v0.y,this.v1.y,this.v2.y);a=THREE.Shape.Utils.b2(a,this.v0.z,this.v1.z,this.v2.z);return new THREE.Vector3(d,b,a)}); +THREE.CubicBezierCurve3=THREE.Curve.create(function(a,d,b,c){this.v0=a;this.v1=d;this.v2=b;this.v3=c},function(a){var d,b;d=THREE.Shape.Utils.b3(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x);b=THREE.Shape.Utils.b3(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y);a=THREE.Shape.Utils.b3(a,this.v0.z,this.v1.z,this.v2.z,this.v3.z);return new THREE.Vector3(d,b,a)}); +THREE.SplineCurve3=THREE.Curve.create(function(a){this.points=a==void 0?[]:a},function(a){var d=new THREE.Vector3,b=[],c=this.points,g;g=(c.length-1)*a;a=Math.floor(g);g-=a;b[0]=a==0?a:a-1;b[1]=a;b[2]=a>c.length-2?a:a+1;b[3]=a>c.length-3?a:a+2;d.x=THREE.Curve.Utils.interpolate(c[b[0]].x,c[b[1]].x,c[b[2]].x,c[b[3]].x,g);d.y=THREE.Curve.Utils.interpolate(c[b[0]].y,c[b[1]].y,c[b[2]].y,c[b[3]].y,g);d.z=THREE.Curve.Utils.interpolate(c[b[0]].z,c[b[1]].z,c[b[2]].z,c[b[3]].z,g);return d}); THREE.CurvePath=function(){this.curves=[];this.bends=[]};THREE.CurvePath.prototype=new THREE.Curve;THREE.CurvePath.prototype.constructor=THREE.CurvePath;THREE.CurvePath.prototype.add=function(a){this.curves.push(a)};THREE.CurvePath.prototype.checkConnection=function(){};THREE.CurvePath.prototype.closePath=function(){}; -THREE.CurvePath.prototype.getPoint=function(a){for(var c=a*this.getLength(),b=this.getCurveLengths(),a=0;a=c)return c=b[a]-c,a=this.curves[a],c=1-c/a.getLength(),a.getPointAt(c);a++}return null};THREE.CurvePath.prototype.getLength=function(){var a=this.getCurveLengths();return a[a.length-1]}; -THREE.CurvePath.prototype.getCurveLengths=function(){if(this.cacheLengths&&this.cacheLengths.length==this.curves.length)return this.cacheLengths;var a=[],c=0,b,d=this.curves.length;for(b=0;bc)c=f.x;else if(f.xb)b=f.y;else if(f.y0?(e=b[b.length-1],n=e.x,s=e.y):(e=this.actions[d-1].args,n=e[e.length-2],s=e[e.length-1]);for(e=1;e<=a;e++)m=e/a,f=THREE.Shape.Utils.b2(m,n,q,h),m=THREE.Shape.Utils.b2(m,s,o, -i),b.push(new THREE.Vector2(f,m));break;case THREE.PathActions.BEZIER_CURVE_TO:h=f[4];i=f[5];q=f[0];o=f[1];k=f[2];j=f[3];b.length>0?(e=b[b.length-1],n=e.x,s=e.y):(e=this.actions[d-1].args,n=e[e.length-2],s=e[e.length-1]);for(e=1;e<=a;e++)m=e/a,f=THREE.Shape.Utils.b3(m,n,q,k,h),m=THREE.Shape.Utils.b3(m,s,o,j,i),b.push(new THREE.Vector2(f,m));break;case THREE.PathActions.CSPLINE_THRU:e=this.actions[d-1].args;e=[new THREE.Vector2(e[e.length-2],e[e.length-1])];m=a*f[0].length;e=e.concat(f[0]);f=new THREE.SplineCurve(e); -for(e=1;e<=m;e++)b.push(f.getPointAt(e/m));break;case THREE.PathActions.ARC:e=this.actions[d-1].args;h=f[0];i=f[1];k=f[2];q=f[3];m=f[4];o=!!f[5];j=e[e.length-2];n=e[e.length-1];e.length==0&&(j=n=0);s=m-q;var p=a*2;for(e=1;e<=p;e++)m=e/p,o||(m=1-m),m=q+m*s,f=j+h+k*Math.cos(m),m=n+i+k*Math.sin(m),b.push(new THREE.Vector2(f,m))}c&&b.push(b[0]);return b};THREE.Path.prototype.transform=function(a,c){this.getBoundingBox();return this.getWrapPoints(this.getPoints(c),a)}; -THREE.Path.prototype.nltransform=function(a,c,b,d,g,f){var e=this.getPoints(),h,i,k,j,q;h=0;for(i=e.length;h=d)return d=b[a]-d,a=this.curves[a],d=1-d/a.getLength(),a.getPointAt(d);a++}return null};THREE.CurvePath.prototype.getLength=function(){var a=this.getCurveLengths();return a[a.length-1]}; +THREE.CurvePath.prototype.getCurveLengths=function(){if(this.cacheLengths&&this.cacheLengths.length==this.curves.length)return this.cacheLengths;var a=[],d=0,b,c=this.curves.length;for(b=0;bd)d=f.x;else if(f.xb)b=f.y;else if(f.y0?(e=b[b.length-1],n=e.x,s=e.y):(e=this.actions[c-1].args,n=e[e.length-2],s=e[e.length-1]);for(e=1;e<=a;e++)m=e/a,f=THREE.Shape.Utils.b2(m,n,q,h),m=THREE.Shape.Utils.b2(m,s,o, +i),b.push(new THREE.Vector2(f,m));break;case THREE.PathActions.BEZIER_CURVE_TO:h=f[4];i=f[5];q=f[0];o=f[1];k=f[2];j=f[3];b.length>0?(e=b[b.length-1],n=e.x,s=e.y):(e=this.actions[c-1].args,n=e[e.length-2],s=e[e.length-1]);for(e=1;e<=a;e++)m=e/a,f=THREE.Shape.Utils.b3(m,n,q,k,h),m=THREE.Shape.Utils.b3(m,s,o,j,i),b.push(new THREE.Vector2(f,m));break;case THREE.PathActions.CSPLINE_THRU:e=this.actions[c-1].args;e=[new THREE.Vector2(e[e.length-2],e[e.length-1])];m=a*f[0].length;e=e.concat(f[0]);f=new THREE.SplineCurve(e); +for(e=1;e<=m;e++)b.push(f.getPointAt(e/m));break;case THREE.PathActions.ARC:e=this.actions[c-1].args;h=f[0];i=f[1];k=f[2];q=f[3];m=f[4];o=!!f[5];j=e[e.length-2];n=e[e.length-1];e.length==0&&(j=n=0);s=m-q;var p=a*2;for(e=1;e<=p;e++)m=e/p,o||(m=1-m),m=q+m*s,f=j+h+k*Math.cos(m),m=n+i+k*Math.sin(m),b.push(new THREE.Vector2(f,m))}d&&b.push(b[0]);return b};THREE.Path.prototype.transform=function(a,d){this.getBoundingBox();return this.getWrapPoints(this.getPoints(d),a)}; +THREE.Path.prototype.nltransform=function(a,d,b,c,g,f){var e=this.getPoints(),h,i,k,j,q;h=0;for(i=e.length;h=0?h-1:b.length-1;f=e-1>=0?e-1:k.length-1;var m=[k[e],b[h],b[g]];q=THREE.FontUtils.Triangulate.area(m);var p=[k[e],k[f],b[h]];o=THREE.FontUtils.Triangulate.area(p);n=h;j=e;h+=1;e+=-1;h< +THREE.Shape.Utils={removeHoles:function(a,d){var b=a.concat(),c=b.concat(),g,f,e,h,i,k,j,q,o,n,s=[];for(i=0;i=0?h-1:b.length-1;f=e-1>=0?e-1:k.length-1;var m=[k[e],b[h],b[g]];q=THREE.FontUtils.Triangulate.area(m);var p=[k[e],k[f],b[h]];o=THREE.FontUtils.Triangulate.area(p);n=h;j=e;h+=1;e+=-1;h< 0&&(h+=b.length);h%=b.length;e<0&&(e+=k.length);e%=k.length;g=h-1>=0?h-1:b.length-1;f=e-1>=0?e-1:k.length-1;m=[k[e],b[h],b[g]];m=THREE.FontUtils.Triangulate.area(m);p=[k[e],k[f],b[h]];p=THREE.FontUtils.Triangulate.area(p);q+o>m+p&&(h=n,e=j,h<0&&(h+=b.length),h%=b.length,e<0&&(e+=k.length),e%=k.length,g=h-1>=0?h-1:b.length-1,f=e-1>=0?e-1:k.length-1);q=b.slice(0,h);o=b.slice(h);n=k.slice(e);j=k.slice(0,e);f=[k[e],k[f],b[h]];s.push([k[e],b[h],b[g]]);s.push(f);b=q.concat(n).concat(j).concat(o)}return{shape:b, -isolatedPts:s,allpoints:d}},triangulateShape:function(a,c){var b=THREE.Shape.Utils.removeHoles(a,c),d=b.allpoints,g=b.isolatedPts,b=THREE.FontUtils.Triangulate(b.shape,!1),f,e,h,i,k={};f=0;for(e=d.length;f1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+n),d=d<0?0:1;if(b==="pos")if(b=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)b.x=g[0]+(f[0]-g[0])*d,b.y=g[1]+(f[1]-g[1])*d,b.z=g[2]+(f[2]-g[2])*d;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]= -this.getPrevKeyWith("pos",n,e.index-1).pos,this.points[1]=g,this.points[2]=f,this.points[3]=this.getNextKeyWith("pos",n,h.index+1).pos,d=d*0.33+0.33,g=this.interpolateCatmullRom(this.points,d),b.x=g[0],b.y=g[1],b.z=g[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)d=this.interpolateCatmullRom(this.points,d*1.01),this.target.set(d[0],d[1],d[2]),this.target.subSelf(b),this.target.y=0,this.target.normalize(),d=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,d,0)}else if(b=== -"rot")THREE.Quaternion.slerp(g,f,a.quaternion,d);else if(b==="scl")b=a.scale,b.x=g[0]+(f[0]-g[0])*d,b.y=g[1]+(f[1]-g[1])*d,b.z=g[2]+(f[2]-g[2])*d}}if(this.JITCompile&&j[0][k]===void 0){this.hierarchy[0].update(null,!0);for(n=0;na.length-2?f:f+1;b[3]=f>a.length-3?f:f+2;f=a[b[0]];h=a[b[1]];i=a[b[2]];k=a[b[3]];b=g*g;e=g*b;d[0]=this.interpolate(f[0],h[0],i[0],k[0],g,b,e);d[1]=this.interpolate(f[1],h[1],i[1],k[1],g,b,e);d[2]=this.interpolate(f[2],h[2],i[2],k[2],g,b,e);return d}; -THREE.Animation.prototype.interpolate=function(a,c,b,d,g,f,e){a=(b-a)*0.5;d=(d-c)*0.5;return(2*(c-b)+a+d)*e+(-3*(c-b)-2*a-d)*f+a*g+c};THREE.Animation.prototype.getNextKeyWith=function(a,c,b){var d=this.data.hierarchy[c].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b=b0?b:0:b>=0?b:b+d.length;b>=0;b--)if(d[b][a]!==void 0)return d[b];return this.data.hierarchy[c].keys[d.length-1]}; -THREE.CubeCamera=function(a,c,b,d){this.heightOffset=b;this.position=new THREE.Vector3(0,b,0);this.cameraPX=new THREE.PerspectiveCamera(90,1,a,c);this.cameraNX=new THREE.PerspectiveCamera(90,1,a,c);this.cameraPY=new THREE.PerspectiveCamera(90,1,a,c);this.cameraNY=new THREE.PerspectiveCamera(90,1,a,c);this.cameraPZ=new THREE.PerspectiveCamera(90,1,a,c);this.cameraNZ=new THREE.PerspectiveCamera(90,1,a,c);this.cameraPX.position=this.position;this.cameraNX.position=this.position;this.cameraPY.position= +THREE.Animation.prototype.update=function(a){if(this.isPlaying){var d=["pos","rot","scl"],b,c,g,f,e,h,i,k,j=this.data.JIT.hierarchy,q,o;this.currentTime+=a*this.timeScale;o=this.currentTime;q=this.currentTime%=this.data.length;k=parseInt(Math.min(q*this.data.fps,this.data.length*this.data.fps),10);for(var n=0,s=this.hierarchy.length;n1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+c+" on bone "+n),c=c<0?0:1;if(b==="pos")if(b=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)b.x=g[0]+(f[0]-g[0])*c,b.y=g[1]+(f[1]-g[1])*c,b.z=g[2]+(f[2]-g[2])*c;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]= +this.getPrevKeyWith("pos",n,e.index-1).pos,this.points[1]=g,this.points[2]=f,this.points[3]=this.getNextKeyWith("pos",n,h.index+1).pos,c=c*0.33+0.33,g=this.interpolateCatmullRom(this.points,c),b.x=g[0],b.y=g[1],b.z=g[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)c=this.interpolateCatmullRom(this.points,c*1.01),this.target.set(c[0],c[1],c[2]),this.target.subSelf(b),this.target.y=0,this.target.normalize(),c=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,c,0)}else if(b=== +"rot")THREE.Quaternion.slerp(g,f,a.quaternion,c);else if(b==="scl")b=a.scale,b.x=g[0]+(f[0]-g[0])*c,b.y=g[1]+(f[1]-g[1])*c,b.z=g[2]+(f[2]-g[2])*c}}if(this.JITCompile&&j[0][k]===void 0){this.hierarchy[0].update(null,!0);for(n=0;na.length-2?f:f+1;b[3]=f>a.length-3?f:f+2;f=a[b[0]];h=a[b[1]];i=a[b[2]];k=a[b[3]];b=g*g;e=g*b;c[0]=this.interpolate(f[0],h[0],i[0],k[0],g,b,e);c[1]=this.interpolate(f[1],h[1],i[1],k[1],g,b,e);c[2]=this.interpolate(f[2],h[2],i[2],k[2],g,b,e);return c}; +THREE.Animation.prototype.interpolate=function(a,d,b,c,g,f,e){a=(b-a)*0.5;c=(c-d)*0.5;return(2*(d-b)+a+c)*e+(-3*(d-b)-2*a-c)*f+a*g+d};THREE.Animation.prototype.getNextKeyWith=function(a,d,b){var c=this.data.hierarchy[d].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b=b0?b:0:b>=0?b:b+c.length;b>=0;b--)if(c[b][a]!==void 0)return c[b];return this.data.hierarchy[d].keys[c.length-1]}; +THREE.CubeCamera=function(a,d,b,c){this.heightOffset=b;this.position=new THREE.Vector3(0,b,0);this.cameraPX=new THREE.PerspectiveCamera(90,1,a,d);this.cameraNX=new THREE.PerspectiveCamera(90,1,a,d);this.cameraPY=new THREE.PerspectiveCamera(90,1,a,d);this.cameraNY=new THREE.PerspectiveCamera(90,1,a,d);this.cameraPZ=new THREE.PerspectiveCamera(90,1,a,d);this.cameraNZ=new THREE.PerspectiveCamera(90,1,a,d);this.cameraPX.position=this.position;this.cameraNX.position=this.position;this.cameraPY.position= this.position;this.cameraNY.position=this.position;this.cameraPZ.position=this.position;this.cameraNZ.position=this.position;this.cameraPX.up.set(0,-1,0);this.cameraNX.up.set(0,-1,0);this.cameraPY.up.set(0,0,1);this.cameraNY.up.set(0,0,-1);this.cameraPZ.up.set(0,-1,0);this.cameraNZ.up.set(0,-1,0);this.targetPX=new THREE.Vector3(0,0,0);this.targetNX=new THREE.Vector3(0,0,0);this.targetPY=new THREE.Vector3(0,0,0);this.targetNY=new THREE.Vector3(0,0,0);this.targetPZ=new THREE.Vector3(0,0,0);this.targetNZ= -new THREE.Vector3(0,0,0);this.renderTarget=new THREE.WebGLRenderTargetCube(d,d,{format:THREE.RGBFormat,magFilter:THREE.LinearFilter,minFilter:THREE.LinearFilter});this.updatePosition=function(a){this.position.copy(a);this.position.y+=this.heightOffset;this.targetPX.copy(this.position);this.targetNX.copy(this.position);this.targetPY.copy(this.position);this.targetNY.copy(this.position);this.targetPZ.copy(this.position);this.targetNZ.copy(this.position);this.targetPX.x+=1;this.targetNX.x-=1;this.targetPY.y+= -1;this.targetNY.y-=1;this.targetPZ.z+=1;this.targetNZ.z-=1;this.cameraPX.lookAt(this.targetPX);this.cameraNX.lookAt(this.targetNX);this.cameraPY.lookAt(this.targetPY);this.cameraNY.lookAt(this.targetNY);this.cameraPZ.lookAt(this.targetPZ);this.cameraNZ.lookAt(this.targetNZ)};this.updateCubeMap=function(a,b){var d=this.renderTarget;d.activeCubeFace=0;a.render(b,this.cameraPX,d);d.activeCubeFace=1;a.render(b,this.cameraNX,d);d.activeCubeFace=2;a.render(b,this.cameraPY,d);d.activeCubeFace=3;a.render(b, -this.cameraNY,d);d.activeCubeFace=4;a.render(b,this.cameraPZ,d);d.activeCubeFace=5;a.render(b,this.cameraNZ,d)}};THREE.FirstPersonCamera=function(){console.warn("DEPRECATED: FirstPersonCamera() is FirstPersonControls().")};THREE.PathCamera=function(){console.warn("DEPRECATED: PathCamera() is PathControls().")};THREE.FlyCamera=function(){console.warn("DEPRECATED: FlyCamera() is FlyControls().")};THREE.RollCamera=function(){console.warn("DEPRECATED: RollCamera() is RollControls().")}; -THREE.TrackballCamera=function(){console.warn("DEPRECATED: TrackballCamera() is TrackballControls().")};THREE.CombinedCamera=function(a,c,b,d,g,f,e){THREE.Camera.call(this);this.fov=b;this.left=-a/2;this.right=a/2;this.top=c/2;this.bottom=-c/2;this.cameraO=new THREE.OrthographicCamera(a/-2,a/2,c/2,c/-2,f,e);this.cameraP=new THREE.PerspectiveCamera(b,a/c,d,g);this.zoom=1;this.toPerspective()};THREE.CombinedCamera.prototype=new THREE.Camera;THREE.CombinedCamera.prototype.constructor=THREE.CoolCamera; +new THREE.Vector3(0,0,0);this.renderTarget=new THREE.WebGLRenderTargetCube(c,c,{format:THREE.RGBFormat,magFilter:THREE.LinearFilter,minFilter:THREE.LinearFilter});this.updatePosition=function(a){this.position.copy(a);this.position.y+=this.heightOffset;this.targetPX.copy(this.position);this.targetNX.copy(this.position);this.targetPY.copy(this.position);this.targetNY.copy(this.position);this.targetPZ.copy(this.position);this.targetNZ.copy(this.position);this.targetPX.x+=1;this.targetNX.x-=1;this.targetPY.y+= +1;this.targetNY.y-=1;this.targetPZ.z+=1;this.targetNZ.z-=1;this.cameraPX.lookAt(this.targetPX);this.cameraNX.lookAt(this.targetNX);this.cameraPY.lookAt(this.targetPY);this.cameraNY.lookAt(this.targetNY);this.cameraPZ.lookAt(this.targetPZ);this.cameraNZ.lookAt(this.targetNZ)};this.updateCubeMap=function(a,b){var c=this.renderTarget;c.activeCubeFace=0;a.render(b,this.cameraPX,c);c.activeCubeFace=1;a.render(b,this.cameraNX,c);c.activeCubeFace=2;a.render(b,this.cameraPY,c);c.activeCubeFace=3;a.render(b, +this.cameraNY,c);c.activeCubeFace=4;a.render(b,this.cameraPZ,c);c.activeCubeFace=5;a.render(b,this.cameraNZ,c)}};THREE.FirstPersonCamera=function(){console.warn("DEPRECATED: FirstPersonCamera() is FirstPersonControls().")};THREE.PathCamera=function(){console.warn("DEPRECATED: PathCamera() is PathControls().")};THREE.FlyCamera=function(){console.warn("DEPRECATED: FlyCamera() is FlyControls().")};THREE.RollCamera=function(){console.warn("DEPRECATED: RollCamera() is RollControls().")}; +THREE.TrackballCamera=function(){console.warn("DEPRECATED: TrackballCamera() is TrackballControls().")};THREE.CombinedCamera=function(a,d,b,c,g,f,e){THREE.Camera.call(this);this.fov=b;this.left=-a/2;this.right=a/2;this.top=d/2;this.bottom=-d/2;this.cameraO=new THREE.OrthographicCamera(a/-2,a/2,d/2,d/-2,f,e);this.cameraP=new THREE.PerspectiveCamera(b,a/d,c,g);this.zoom=1;this.toPerspective()};THREE.CombinedCamera.prototype=new THREE.Camera;THREE.CombinedCamera.prototype.constructor=THREE.CoolCamera; THREE.CombinedCamera.prototype.toPerspective=function(){this.near=this.cameraP.near;this.far=this.cameraP.far;this.cameraP.fov=this.fov/this.zoom;this.cameraP.updateProjectionMatrix();this.projectionMatrix=this.cameraP.projectionMatrix;this.inPersepectiveMode=!0;this.inOrthographicMode=!1}; -THREE.CombinedCamera.prototype.toOrthographic=function(){var a=Math.tan(this.fov/2)*((this.cameraP.near+this.cameraP.far)/2),c=2*a*this.cameraP.aspect/2;a/=this.zoom;c/=this.zoom;this.cameraO.left=-c;this.cameraO.right=c;this.cameraO.top=a;this.cameraO.bottom=-a;this.cameraO.updateProjectionMatrix();this.near=this.cameraO.near;this.far=this.cameraO.far;this.projectionMatrix=this.cameraO.projectionMatrix;this.inPersepectiveMode=!1;this.inOrthographicMode=!0}; -THREE.CombinedCamera.prototype.setFov=function(a){this.fov=a;this.inPersepectiveMode?this.toPerspective():this.toOrthographic()};THREE.CombinedCamera.prototype.setLens=function(a,c){c||(c=43.25);var b=2*Math.atan(c/(a*2));b*=180/Math.PI;this.setFov(b);return b};THREE.CombinedCamera.prototype.setZoom=function(a){this.zoom=a;this.inPersepectiveMode?this.toPerspective():this.toOrthographic()}; +THREE.CombinedCamera.prototype.toOrthographic=function(){var a=Math.tan(this.fov/2)*((this.cameraP.near+this.cameraP.far)/2),d=2*a*this.cameraP.aspect/2;a/=this.zoom;d/=this.zoom;this.cameraO.left=-d;this.cameraO.right=d;this.cameraO.top=a;this.cameraO.bottom=-a;this.cameraO.updateProjectionMatrix();this.near=this.cameraO.near;this.far=this.cameraO.far;this.projectionMatrix=this.cameraO.projectionMatrix;this.inPersepectiveMode=!1;this.inOrthographicMode=!0}; +THREE.CombinedCamera.prototype.setFov=function(a){this.fov=a;this.inPersepectiveMode?this.toPerspective():this.toOrthographic()};THREE.CombinedCamera.prototype.setLens=function(a,d){d||(d=43.25);var b=2*Math.atan(d/(a*2));b*=180/Math.PI;this.setFov(b);return b};THREE.CombinedCamera.prototype.setZoom=function(a){this.zoom=a;this.inPersepectiveMode?this.toPerspective():this.toOrthographic()}; THREE.CombinedCamera.prototype.toFrontView=function(){this.rotation.x=0;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toBackView=function(){this.rotation.x=0;this.rotation.y=Math.PI;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toLeftView=function(){this.rotation.x=0;this.rotation.y=-Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=!1}; THREE.CombinedCamera.prototype.toRightView=function(){this.rotation.x=0;this.rotation.y=Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=!1};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.FirstPersonControls=function(a,c){function b(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.target=new THREE.Vector3(0,0,0);this.domElement=c!==void 0?c:document;this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=Math.PI;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor= +THREE.FirstPersonControls=function(a,d){function b(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.target=new THREE.Vector3(0,0,0);this.domElement=d!==void 0?d:document;this.movementSpeed=1;this.lookSpeed=0.005;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=Math.PI;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor= 0;this.mouseDragOn=this.freeze=this.moveRight=this.moveLeft=this.moveBackward=this.moveForward=!1;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));this.onMouseDown=function(a){this.domElement!==document&&this.domElement.focus();a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward= !0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(a){a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(a){this.domElement===document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.onKeyDown= function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:case 65:this.moveLeft=!0;break;case 40:case 83:this.moveBackward=!0;break;case 39:case 68:this.moveRight=!0;break;case 82:this.moveUp=!0;break;case 70:this.moveDown=!0;break;case 81:this.freeze=!this.freeze}};this.onKeyUp=function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=!1;break;case 40:case 83:this.moveBackward=!1;break;case 39:case 68:this.moveRight=!1;break;case 82:this.moveUp= -!1;break;case 70:this.moveDown=!1}};this.update=function(a){var b=0;if(!this.freeze){if(this.heightSpeed){var c=THREE.Math.clamp(this.object.position.y,this.heightMin,this.heightMax)-this.heightMin;this.autoSpeedFactor=a*c*this.heightCoef}else this.autoSpeedFactor=0;b=a*this.movementSpeed;(this.moveForward||this.autoForward&&!this.moveBackward)&&this.object.translateZ(-(b+this.autoSpeedFactor));this.moveBackward&&this.object.translateZ(b);this.moveLeft&&this.object.translateX(-b);this.moveRight&& -this.object.translateX(b);this.moveUp&&this.object.translateY(b);this.moveDown&&this.object.translateY(-b);c=a*this.lookSpeed;this.activeLook||(c=0);this.lon+=this.mouseX*c;this.lookVertical&&(this.lat-=this.mouseY*c);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;a=this.target;b=this.object.position;a.x=b.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=b.y+100*Math.cos(this.phi);a.z=b.z+100*Math.sin(this.phi)*Math.sin(this.theta)}a= -1;this.constrainVertical&&(a=Math.PI/(this.verticalMax-this.verticalMin));this.lon+=this.mouseX*c;this.lookVertical&&(this.lat-=this.mouseY*c*a);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi=THREE.Math.mapLinear(this.phi,0,Math.PI,this.verticalMin,this.verticalMax);a=this.target;b=this.object.position;a.x=b.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=b.y+100*Math.cos(this.phi);a.z=b.z+100*Math.sin(this.phi)* +!1;break;case 70:this.moveDown=!1}};this.update=function(a){var b=0;if(!this.freeze){if(this.heightSpeed){var d=THREE.Math.clamp(this.object.position.y,this.heightMin,this.heightMax)-this.heightMin;this.autoSpeedFactor=a*d*this.heightCoef}else this.autoSpeedFactor=0;b=a*this.movementSpeed;(this.moveForward||this.autoForward&&!this.moveBackward)&&this.object.translateZ(-(b+this.autoSpeedFactor));this.moveBackward&&this.object.translateZ(b);this.moveLeft&&this.object.translateX(-b);this.moveRight&& +this.object.translateX(b);this.moveUp&&this.object.translateY(b);this.moveDown&&this.object.translateY(-b);d=a*this.lookSpeed;this.activeLook||(d=0);this.lon+=this.mouseX*d;this.lookVertical&&(this.lat-=this.mouseY*d);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;a=this.target;b=this.object.position;a.x=b.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=b.y+100*Math.cos(this.phi);a.z=b.z+100*Math.sin(this.phi)*Math.sin(this.theta)}a= +1;this.constrainVertical&&(a=Math.PI/(this.verticalMax-this.verticalMin));this.lon+=this.mouseX*d;this.lookVertical&&(this.lat-=this.mouseY*d*a);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi=THREE.Math.mapLinear(this.phi,0,Math.PI,this.verticalMin,this.verticalMax);a=this.target;b=this.object.position;a.x=b.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=b.y+100*Math.cos(this.phi);a.z=b.z+100*Math.sin(this.phi)* Math.sin(this.theta);this.object.lookAt(a)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",b(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",b(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",b(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",b(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",b(this,this.onKeyUp),!1)}; -THREE.PathControls=function(a,c){function b(a){if((a*=2)<1)return 0.5*a*a;return-0.5*(--a*(a-2)-1)}function d(a,b){return function(){b.apply(a,arguments)}}function g(a,b,d,c){var e={name:d,fps:0.6,length:c,hierarchy:[]},f,g=b.getControlPointsArray(),h=b.getLength(),p=g.length,l=0;f=p-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:g[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[f]={time:c,pos:g[f],rot:[0,0,0,1],scl:[1,1,1]};for(f=1;f=0?a:a+e;d=this.verticalAngleMap.srcRange; -a=this.verticalAngleMap.dstRange;d=THREE.Math.mapLinear(this.phi,d[0],d[1],a[0],a[1]);var c=a[1]-a[0];this.phi=b((d-a[0])/c)*c+a[0];d=this.horizontalAngleMap.srcRange;a=this.horizontalAngleMap.dstRange;d=THREE.Math.mapLinear(this.theta,d[0],d[1],a[0],a[1]);c=a[1]-a[0];this.theta=b((d-a[0])/c)*c+a[0];a=this.target.position;a.x=100*Math.sin(this.phi)*Math.cos(this.theta);a.y=100*Math.cos(this.phi);a.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.object.lookAt(this.target.position)};this.onMouseMove= +THREE.PathControls=function(a,d){function b(a){if((a*=2)<1)return 0.5*a*a;return-0.5*(--a*(a-2)-1)}function c(a,b){return function(){b.apply(a,arguments)}}function g(a,b,c,d){var e={name:c,fps:0.6,length:d,hierarchy:[]},f,g=b.getControlPointsArray(),h=b.getLength(),p=g.length,l=0;f=p-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:g[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[f]={time:d,pos:g[f],rot:[0,0,0,1],scl:[1,1,1]};for(f=1;f=0?a:a+e;c=this.verticalAngleMap.srcRange; +a=this.verticalAngleMap.dstRange;c=THREE.Math.mapLinear(this.phi,c[0],c[1],a[0],a[1]);var d=a[1]-a[0];this.phi=b((c-a[0])/d)*d+a[0];c=this.horizontalAngleMap.srcRange;a=this.horizontalAngleMap.dstRange;c=THREE.Math.mapLinear(this.theta,c[0],c[1],a[0],a[1]);d=a[1]-a[0];this.theta=b((c-a[0])/d)*d+a[0];a=this.target.position;a.x=100*Math.sin(this.phi)*Math.cos(this.theta);a.y=100*Math.cos(this.phi);a.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.object.lookAt(this.target.position)};this.onMouseMove= function(a){this.domElement===document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.init=function(){this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var a=new THREE.MeshLambertMaterial({color:30719}),b=new THREE.MeshLambertMaterial({color:65280}), -c=new THREE.CubeGeometry(10,10,20),e=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(c,a);a=new THREE.Mesh(e,b);a.position.set(0,10,0);this.animation=g(this.animationParent,this.spline,this.id,this.duration);this.animationParent.add(this.object);this.animationParent.add(this.target);this.animationParent.add(a)}else this.animation=g(this.animationParent,this.spline,this.id,this.duration),this.animationParent.add(this.target),this.animationParent.add(this.object);if(this.createDebugPath){var a= -this.debugPath,b=this.spline,e=f(b,10),c=f(b,10),h=new THREE.LineBasicMaterial({color:16711680,linewidth:3}),e=new THREE.Line(e,h),c=new THREE.ParticleSystem(c,new THREE.ParticleBasicMaterial({color:16755200,size:3}));e.scale.set(1,1,1);a.add(e);c.scale.set(1,1,1);a.add(c);for(var e=new THREE.SphereGeometry(1,16,8),h=new THREE.MeshBasicMaterial({color:65280}),n=0;n0){var b=this.getContainerDimensions(),c=b.size[0]/2,e=b.size[1]/2;this.moveState.yawLeft=-(a.pageX-b.offset[0]-c)/c;this.moveState.pitchDown=(a.pageY-b.offset[1]-e)/e;this.updateRotationVector()}};this.mouseup=function(a){a.preventDefault();a.stopPropagation();if(this.dragToLook)this.mouseStatus--,this.moveState.yawLeft=this.moveState.pitchDown=0;else switch(a.button){case 0:this.moveForward= +!0;break;case 2:this.object.moveBackward=!0}};this.mousemove=function(a){if(!this.dragToLook||this.mouseStatus>0){var b=this.getContainerDimensions(),d=b.size[0]/2,e=b.size[1]/2;this.moveState.yawLeft=-(a.pageX-b.offset[0]-d)/d;this.moveState.pitchDown=(a.pageY-b.offset[1]-e)/e;this.updateRotationVector()}};this.mouseup=function(a){a.preventDefault();a.stopPropagation();if(this.dragToLook)this.mouseStatus--,this.moveState.yawLeft=this.moveState.pitchDown=0;else switch(a.button){case 0:this.moveForward= !1;break;case 2:this.moveBackward=!1}this.updateRotationVector()};this.update=function(a){var b=a*this.movementSpeed;a*=this.rollSpeed;this.object.translateX(this.moveVector.x*b);this.object.translateY(this.moveVector.y*b);this.object.translateZ(this.moveVector.z*b);this.tmpQuaternion.set(this.rotationVector.x*a,this.rotationVector.y*a,this.rotationVector.z*a,1).normalize();this.object.quaternion.multiplySelf(this.tmpQuaternion);this.object.matrix.setPosition(this.object.position);this.object.matrix.setRotationFromQuaternion(this.object.quaternion); this.object.matrixWorldNeedsUpdate=!0};this.updateMovementVector=function(){var a=this.moveState.forward||this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right;this.moveVector.y=-this.moveState.down+this.moveState.up;this.moveVector.z=-a+this.moveState.back};this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp;this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft;this.rotationVector.z= -this.moveState.rollRight+this.moveState.rollLeft};this.getContainerDimensions=function(){return this.domElement!=document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}};this.domElement.addEventListener("mousemove",b(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",b(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",b(this, this.mouseup),!1);this.domElement.addEventListener("keydown",b(this,this.keydown),!1);this.domElement.addEventListener("keyup",b(this,this.keyup),!1);this.updateMovementVector();this.updateRotationVector()}; -THREE.RollControls=function(a,c){this.object=a;this.domElement=c!==void 0?c:document;this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;var b=new THREE.Vector3,d=new THREE.Vector3,g=new THREE.Vector3,f=new THREE.Matrix4,e=!1,h=1,i=0,k=0,j=0,q=0,o=0,n=window.innerWidth/2,s=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var c=a*this.lookSpeed; -this.rotateHorizontally(c*q);this.rotateVertically(c*o)}c=a*this.movementSpeed;this.object.translateZ(-c*(i>0||this.autoForward&&!(i<0)?1:i));this.object.translateX(c*k);this.object.translateY(c*j);e&&(this.roll+=this.rollSpeed*a*h);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();else if(this.forward.y0||this.autoForward&&!(i<0)?1:i));this.object.translateX(d*k);this.object.translateY(d*j);e&&(this.roll+=this.rollSpeed*a*h);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();else if(this.forward.y1?d.normalize():d.z=Math.sqrt(1-f*f);e.copy(b.object.position).subSelf(b.target);f=b.object.up.clone().setLength(d.y);f.addSelf(b.object.up.clone().crossSelf(e).setLength(d.x));f.addSelf(e.setLength(d.z));return f};this.rotateCamera=function(){var a=Math.acos(h.dot(i)/h.length()/i.length());if(a){var c=(new THREE.Vector3).cross(h,i).normalize(),d=new THREE.Quaternion;a*=b.rotateSpeed;d.setFromAxisAngle(c,-a);d.multiplyVector3(e); -d.multiplyVector3(b.object.up);d.multiplyVector3(i);b.staticMoving?h=i:(d.setFromAxisAngle(c,a*(b.dynamicDampingFactor-1)),d.multiplyVector3(h))}};this.zoomCamera=function(){var a=1+(j.y-k.y)*b.zoomSpeed;a!==1&&a>0&&(e.multiplyScalar(a),b.staticMoving?k=j:k.y+=(j.y-k.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=o.clone().subSelf(q);if(a.lengthSq()){a.multiplyScalar(e.length()*b.panSpeed);var c=e.clone().crossSelf(b.object.up).setLength(a.x);c.addSelf(b.object.up.clone().setLength(a.y)); -b.object.position.addSelf(c);b.target.addSelf(c);b.staticMoving?q=o:q.addSelf(a.sub(o,q).multiplyScalar(b.dynamicDampingFactor))}};this.checkDistances=function(){if(!b.noZoom||!b.noPan)b.object.position.lengthSq()>b.maxDistance*b.maxDistance&&b.object.position.setLength(b.maxDistance),e.lengthSq()0?1:-1;for(h=0;h1?d.normalize():d.z=Math.sqrt(1-f*f);e.copy(b.object.position).subSelf(b.target);f=b.object.up.clone().setLength(d.y);f.addSelf(b.object.up.clone().crossSelf(e).setLength(d.x));f.addSelf(e.setLength(d.z));return f};this.rotateCamera=function(){var a=Math.acos(h.dot(i)/h.length()/i.length());if(a){var c=(new THREE.Vector3).cross(h,i).normalize(),d=new THREE.Quaternion;a*=b.rotateSpeed;d.setFromAxisAngle(c, +-a);d.multiplyVector3(e);d.multiplyVector3(b.object.up);d.multiplyVector3(i);b.staticMoving?h=i:(d.setFromAxisAngle(c,a*(b.dynamicDampingFactor-1)),d.multiplyVector3(h))}};this.zoomCamera=function(){var a=1+(j.y-k.y)*b.zoomSpeed;a!==1&&a>0&&(e.multiplyScalar(a),b.staticMoving?k=j:k.y+=(j.y-k.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=o.clone().subSelf(q);if(a.lengthSq()){a.multiplyScalar(e.length()*b.panSpeed);var c=e.clone().crossSelf(b.object.up).setLength(a.x);c.addSelf(b.object.up.clone().setLength(a.y)); +b.object.position.addSelf(c);b.target.addSelf(c);b.staticMoving?q=o:q.addSelf(a.sub(o,q).multiplyScalar(b.dynamicDampingFactor))}};this.checkDistances=function(){if(!b.noZoom||!b.noPan)b.object.position.lengthSq()>b.maxDistance*b.maxDistance&&b.object.position.setLength(b.maxDistance),e.lengthSq()0?1:-1;for(h=0;h0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,e,0)));for(h=0;h0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-e,0)));for(h=0;h0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,e,0)));for(h=0;h0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-e,0)));for(h=0;ha&&(a+=Math.PI*2),a=(b+a)/2,new THREE.Vector2(-Math.cos(a),-Math.sin(a));return d.multiplyScalar(g).addSelf(h).subSelf(a).clone()}function g(a){for(u=a.length;--u>=0;){J=u;N=u-1;N<0&&(N=a.length-1);for(var b= 0,c=n+j*2,b=0;b=0;B--){G=B/j;I=i*(1-G);G=k*Math.sin(G*Math.PI/2);u=0;for(D=r.length;u0)for(k=0;k2;){if(q--<=0){console.log("Warning, unable to triangulate polygon!");if(d)return h;return f}i=k;g<=i&&(i=0);k=i+1;g<=k&&(k=0);j=k+1;g<=j&&(j=0);var o;a:{o=a;var n=i,s=k,m=j,p=g,l=e,r=void 0,t=void 0,w=void 0, +(function(a){var d=function(a){for(var c=a.length,d=0,f=c-1,e=0;e0)for(k=0;k2;){if(q--<=0){console.log("Warning, unable to triangulate polygon!");if(c)return h;return f}i=k;g<=i&&(i=0);k=i+1;g<=k&&(k=0);j=k+1;g<=j&&(j=0);var o;a:{o=a;var n=i,s=k,m=j,p=g,l=e,r=void 0,t=void 0,w=void 0, z=void 0,v=void 0,x=void 0,y=void 0,A=void 0,F=void 0,t=o[l[n]].x,w=o[l[n]].y,z=o[l[s]].x,v=o[l[s]].y,x=o[l[m]].x,y=o[l[m]].y;if(1.0E-10>(z-t)*(y-w)-(v-w)*(x-t))o=!1;else{for(r=0;r=0&&B>=0&&I>=0){o=!1;break a}}o=!0}}if(o){f.push([a[e[i]], -a[e[k]],a[e[j]]]);h.push([e[i],e[k],e[j]]);i=k;for(j=k+1;j0;)this.smooth(a)}; -THREE.SubdivisionModifier.prototype.smooth=function(a){function c(a,b,c,d,h,i){var j=new THREE.Face4(a,b,c,d,null,h.color,h.material);if(e.useOldVertexColors){j.vertexColors=[];for(var k,n,m,l=0;l<4;l++){m=i[l];k=new THREE.Color;k.setRGB(0,0,0);for(var p=0;p0;)this.smooth(a)}; +THREE.SubdivisionModifier.prototype.smooth=function(a){function d(a,b,c,d,h,i){var j=new THREE.Face4(a,b,c,d,null,h.color,h.material);if(e.useOldVertexColors){j.vertexColors=[];for(var k,n,m,l=0;l<4;l++){m=i[l];k=new THREE.Color;k.setRGB(0,0,0);for(var p=0;p=0){p=i.invBindMatrices[n];j.invBindMatrix=p;j.skinningMatrix=new THREE.Matrix4;j.skinningMatrix.multiply(j.world,p);j.weights=[];for(p=0;p=0){p=i.invBindMatrices[n];j.invBindMatrix=p;j.skinningMatrix=new THREE.Matrix4;j.skinningMatrix.multiply(j.world,p);j.weights=[];for(p=0;p1){j=new THREE.MeshFaceMaterial;for(h=0;h=0,d=a.indexOf("(")>=0,e,f;if(c)b=a.split("."),a=b.sh K.prototype.create=function(){for(var a=0;a1&&(D=new THREE.MeshFaceMaterial); +THREE.JSONLoader.prototype.load=function(a,d,b){if(a instanceof Object)console.warn("DEPRECATED: JSONLoader( parameters ) is now JSONLoader( url, callback, texturePath )."),b=a,a=b.model,d=b.callback,b=b.texture_path;b=b?b:this.extractUrlbase(a);this.onLoadStart();this.loadAjaxJSON(this,a,d,b)}; +THREE.JSONLoader.prototype.loadAjaxJSON=function(a,d,b,c,g){var f=new XMLHttpRequest,e=0;f.onreadystatechange=function(){if(f.readyState==4)if(f.status==200||f.status==0)try{var h=JSON.parse(f.responseText);a.createModel(h,b,c);a.onLoadComplete()}catch(i){console.error(i),console.warn("DEPRECATED: ["+d+"] seems to be using old model format")}else console.error("Couldn't load ["+d+"] ["+f.status+"]");else f.readyState==3?g&&(e==0&&(e=f.getResponseHeader("Content-Length")),g({total:e,loaded:f.responseText.length})): +f.readyState==2&&(e=f.getResponseHeader("Content-Length"))};f.open("GET",d,!0);f.overrideMimeType("text/plain; charset=x-user-defined");f.setRequestHeader("Content-Type","text/plain");f.send(null)}; +THREE.JSONLoader.prototype.createModel=function(a,d,b){var c=new THREE.Geometry,g=a.scale!==void 0?1/a.scale:1;this.initMaterials(c,a.materials,b);(function(b){if(a.metadata===void 0||a.metadata.formatVersion===void 0||a.metadata.formatVersion!==3)console.error("Deprecated file format.");else{var d,g,i,k,j,q,o,n,s,m,p,l,r,t,w=a.faces;q=a.vertices;var z=a.normals,v=a.colors,x=0;for(d=0;d1&&(D=new THREE.MeshFaceMaterial); a=new THREE.Mesh(A,D);a.name=o;a.position.set(w[0],w[1],w[2]);v?(a.quaternion.set(v[0],v[1],v[2],v[3]),a.useQuaternion=!0):a.rotation.set(z[0],z[1],z[2]);a.scale.set(x[0],x[1],x[2]);a.visible=l.visible;C.scene.add(a);C.objects[o]=a;if(l.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(a);C.scene.collisions.colliders.push(b)}if(l.castsShadow)b=new THREE.ShadowVolume(A),C.scene.add(b),b.position=a.position,b.rotation=a.rotation,b.scale=a.scale;l.trigger&&l.trigger.toLowerCase()!="none"&&(b= {type:l.trigger,object:l},C.triggers[a.name]=b)}}else w=l.position,z=l.rotation,v=l.quaternion,x=l.scale,v=0,a=new THREE.Object3D,a.name=o,a.position.set(w[0],w[1],w[2]),v?(a.quaternion.set(v[0],v[1],v[2],v[3]),a.useQuaternion=!0):a.rotation.set(z[0],z[1],z[2]),a.scale.set(x[0],x[1],x[2]),a.visible=l.visible!==void 0?l.visible:!1,C.scene.add(a),C.objects[o]=a,C.empties[o]=a,l.trigger&&l.trigger.toLowerCase()!="none"&&(b={type:l.trigger,object:l},C.triggers[a.name]=b)}function f(a){return function(b){C.geometries[a]= -b;g();I-=1;i.onLoadComplete();h()}}function e(a){return function(b){C.geometries[a]=b}}function h(){i.callbackProgress({totalModels:K,totalTextures:O,loadedModels:K-I,loadedTextures:O-E},C);i.onLoadProgress();I==0&&E==0&&c(C)}var i=this,k=THREE.Loader.prototype.extractUrlbase(b),j,q,o,n,s,m,p,l,r,t,w,z,v,x,y,A,F,u,D,B,G,I,E,K,O,C;B=a;b=new THREE.BinaryLoader;G=new THREE.JSONLoader;E=I=0;C={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{}, +b;g();I-=1;i.onLoadComplete();h()}}function e(a){return function(b){C.geometries[a]=b}}function h(){i.callbackProgress({totalModels:K,totalTextures:O,loadedModels:K-I,loadedTextures:O-E},C);i.onLoadProgress();I==0&&E==0&&d(C)}var i=this,k=THREE.Loader.prototype.extractUrlbase(b),j,q,o,n,s,m,p,l,r,t,w,z,v,x,y,A,F,u,D,B,G,I,E,K,O,C;B=a;b=new THREE.BinaryLoader;G=new THREE.JSONLoader;E=I=0;C={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{}, empties:{}};a=!1;for(o in B.objects)if(l=B.objects[o],l.meshCollider){a=!0;break}if(a)C.scene.collisions=new THREE.CollisionSystem;if(B.transform){a=B.transform.position;r=B.transform.rotation;var L=B.transform.scale;a&&C.scene.position.set(a[0],a[1],a[2]);r&&C.scene.rotation.set(r[0],r[1],r[2]);L&&C.scene.scale.set(L[0],L[1],L[2]);(a||r||L)&&C.scene.updateMatrix()}a=function(){E-=1;h();i.onLoadComplete()};for(s in B.cameras)r=B.cameras[s],r.type=="perspective"?F=new THREE.PerspectiveCamera(r.fov, r.aspect,r.near,r.far):r.type=="ortho"&&(F=new THREE.OrthographicCamera(r.left,r.right,r.top,r.bottom,r.near,r.far)),w=r.position,r=r.target,F.position.set(w[0],w[1],w[2]),F.target=new THREE.Vector3(r[0],r[1],r[2]),C.cameras[s]=F;for(n in B.lights)r=B.lights[n],s=r.color!==void 0?r.color:16777215,F=r.intensity!==void 0?r.intensity:1,r.type=="directional"?(w=r.direction,t=new THREE.DirectionalLight(s,F),t.position.set(w[0],w[1],w[2]),t.position.normalize()):r.type=="point"?(w=r.position,t=r.distance, t=new THREE.PointLight(s,F,t),t.position.set(w[0],w[1],w[2])):r.type=="ambient"&&(t=new THREE.AmbientLight(s)),C.scene.add(t),C.lights[n]=t;for(m in B.fogs)n=B.fogs[m],n.type=="linear"?u=new THREE.Fog(0,n.near,n.far):n.type=="exp2"&&(u=new THREE.FogExp2(0,n.density)),r=n.color,u.color.setRGB(r[0],r[1],r[2]),C.fogs[m]=u;if(C.cameras&&B.defaults.camera)C.currentCamera=C.cameras[B.defaults.camera];if(C.fogs&&B.defaults.fog)C.scene.fog=C.fogs[B.defaults.fog];r=B.defaults.bgcolor;C.bgColor=new THREE.Color; C.bgColor.setRGB(r[0],r[1],r[2]);C.bgColorAlpha=B.defaults.bgalpha;for(j in B.geometries)if(m=B.geometries[j],m.type=="bin_mesh"||m.type=="ascii_mesh")I+=1,i.onLoadStart();K=I;for(j in B.geometries)m=B.geometries[j],m.type=="cube"?(A=new THREE.CubeGeometry(m.width,m.height,m.depth,m.segmentsWidth,m.segmentsHeight,m.segmentsDepth,null,m.flipped,m.sides),C.geometries[j]=A):m.type=="plane"?(A=new THREE.PlaneGeometry(m.width,m.height,m.segmentsWidth,m.segmentsHeight),C.geometries[j]=A):m.type=="sphere"? -(A=new THREE.SphereGeometry(m.radius,m.segmentsWidth,m.segmentsHeight),C.geometries[j]=A):m.type=="cylinder"?(A=new THREE.CylinderGeometry(m.topRad,m.botRad,m.height,m.radSegs,m.heightSegs),C.geometries[j]=A):m.type=="torus"?(A=new THREE.TorusGeometry(m.radius,m.tube,m.segmentsR,m.segmentsT),C.geometries[j]=A):m.type=="icosahedron"?(A=new THREE.IcosahedronGeometry(m.subdivisions),C.geometries[j]=A):m.type=="bin_mesh"?b.load(d(m.url,B.urlBaseType),f(j)):m.type=="ascii_mesh"?G.load(d(m.url,B.urlBaseType), -f(j)):m.type=="embedded_mesh"&&(m=B.embeds[m.id])&&G.createModel(m,e(j),"");for(p in B.textures)if(j=B.textures[p],j.url instanceof Array){E+=j.url.length;for(m=0;m=57344&&(c-=2048);c++;for(var b=new Float32Array(8*c),d=1,g=0;g<8;g++){for(var f=0,e=0;e>1^-(h&1);b[8*e+g]=f}d+=c}c=a.length-d;f=new Uint16Array(c);for(g=e=0;g=this.maxCount-3&&h(this)};this.begin= -function(){this.count=0;this.hasNormal=this.hasPos=!1};this.end=function(a){if(this.count!==0){for(var c=this.count*3;cthis.size-1&&(i=this.size-1);var o=Math.floor(k-h);o<1&&(o=1);k=Math.floor(k+h);k>this.size-1&&(k=this.size-1);var n=Math.floor(j-h);n<1&&(n=1);h=Math.floor(j+h); -h>this.size-1&&(h=this.size-1);for(var s,m,p,l,r,t;q0&&(this.field[p+s]+=l)}}};this.addPlaneX=function(a,c){var g,f,e,h,i,k=this.size,j=this.yd,q=this.zd,o=this.field,n=k*Math.sqrt(a/c);n>k&&(n=k);for(g=0;g0)for(f=0;fj&&(s=j);for(f=0;f0){i=f*q;for(g=0;gj&&(s=j);for(e=0;e0){i=o*e;for(f=0;f=57344&&(d-=2048);d++;for(var b=new Float32Array(8*d),c=1,g=0;g<8;g++){for(var f=0,e=0;e>1^-(h&1);b[8*e+g]=f}c+=d}d=a.length-c;f=new Uint16Array(d);for(g=e=0;g=this.maxCount-3&&h(this)};this.begin= +function(){this.count=0;this.hasNormal=this.hasPos=!1};this.end=function(a){if(this.count!==0){for(var c=this.count*3;cthis.size-1&&(i=this.size-1);var o=Math.floor(k-h);o<1&&(o=1);k=Math.floor(k+h);k>this.size-1&&(k=this.size-1);var n=Math.floor(j-h);n<1&&(n=1);h=Math.floor(j+h); +h>this.size-1&&(h=this.size-1);for(var s,m,p,l,r,t;q0&&(this.field[p+s]+=l)}}};this.addPlaneX=function(a,c){var d,f,e,h,i,k=this.size,j=this.yd,q=this.zd,o=this.field,n=k*Math.sqrt(a/c);n>k&&(n=k);for(d=0;d0)for(f=0;fj&&(s=j);for(f=0;f0){i=f*q;for(d=0;dj&&(s=j);for(e=0;e0){i=o*e;for(f=0;ff?this.hits.push(g):this.hits.unshift(g),f=d;return this.hits}; -THREE.CollisionSystem.prototype.rayCastNearest=function(a){var c=this.rayCastAll(a);if(c.length==0)return null;for(var b=0;c[b]instanceof THREE.MeshCollider;){var d=this.rayMesh(a,c[b]);if(d.distc.length)return null;return c[b]}; -THREE.CollisionSystem.prototype.rayCast=function(a,c){if(c instanceof THREE.PlaneCollider)return this.rayPlane(a,c);else if(c instanceof THREE.SphereCollider)return this.raySphere(a,c);else if(c instanceof THREE.BoxCollider)return this.rayBox(a,c);else if(c instanceof THREE.MeshCollider&&c.box)return this.rayBox(a,c.box)}; -THREE.CollisionSystem.prototype.rayMesh=function(a,c){for(var b=this.makeRayLocal(a,c.mesh),d=Number.MAX_VALUE,g,f=0;f=h*g))return Number.MAX_VALUE;e/=h;h=THREE.CollisionSystem.__v3;h.copy(a.direction);h.multiplyScalar(e);h.addSelf(a.origin);Math.abs(f.x)> -Math.abs(f.y)?Math.abs(f.x)>Math.abs(f.z)?(a=h.y-c.y,f=b.y-c.y,g=d.y-c.y,h=h.z-c.z,b=b.z-c.z,d=d.z-c.z):(a=h.x-c.x,f=b.x-c.x,g=d.x-c.x,h=h.y-c.y,b=b.y-c.y,d=d.y-c.y):Math.abs(f.y)>Math.abs(f.z)?(a=h.x-c.x,f=b.x-c.x,g=d.x-c.x,h=h.z-c.z,b=b.z-c.z,d=d.z-c.z):(a=h.x-c.x,f=b.x-c.x,g=d.x-c.x,h=h.y-c.y,b=b.y-c.y,d=d.y-c.y);c=f*d-b*g;if(c==0)return Number.MAX_VALUE;c=1/c;d=(a*d-h*g)*c;if(!(d>=0))return Number.MAX_VALUE;c*=f*h-b*a;if(!(c>=0))return Number.MAX_VALUE;if(!(1-d-c>=0))return Number.MAX_VALUE;return e}; -THREE.CollisionSystem.prototype.makeRayLocal=function(a,c){var b=THREE.CollisionSystem.__m;b.getInverse(c.matrixWorld);var d=THREE.CollisionSystem.__r;d.origin.copy(a.origin);d.direction.copy(a.direction);b.multiplyVector3(d.origin);b.rotateAxis(d.direction);d.direction.normalize();return d}; -THREE.CollisionSystem.prototype.rayBox=function(a,c){var b;c.dynamic&&c.mesh&&c.mesh.matrixWorld?b=this.makeRayLocal(a,c.mesh):(b=THREE.CollisionSystem.__r,b.origin.copy(a.origin),b.direction.copy(a.direction));var d=0,g=0,f=0,e=0,h=0,i=0,k=!0;b.origin.xc.max.x&&(d=c.max.x-b.origin.x,d/=b.direction.x,k=!1,e=1);b.origin.yc.max.y&&(g=c.max.y-b.origin.y,g/=b.direction.y, -k=!1,h=1);b.origin.zc.max.z&&(f=c.max.z-b.origin.z,f/=b.direction.z,k=!1,i=1);if(k)return-1;k=0;g>d&&(k=1,d=g);f>d&&(k=2,d=f);switch(k){case 0:h=b.origin.y+b.direction.y*d;if(hc.max.y)return Number.MAX_VALUE;b=b.origin.z+b.direction.z*d;if(bc.max.z)return Number.MAX_VALUE;c.normal.set(e,0,0);break;case 1:e=b.origin.x+b.direction.x*d;if(ec.max.x)return Number.MAX_VALUE;b=b.origin.z+b.direction.z* -d;if(bc.max.z)return Number.MAX_VALUE;c.normal.set(0,h,0);break;case 2:e=b.origin.x+b.direction.x*d;if(ec.max.x)return Number.MAX_VALUE;h=b.origin.y+b.direction.y*d;if(hc.max.y)return Number.MAX_VALUE;c.normal.set(0,0,i)}return d};THREE.CollisionSystem.prototype.rayPlane=function(a,c){var b=a.direction.dot(c.normal),d=c.point.dot(c.normal);if(b<0)b=(d-a.origin.dot(c.normal))/b;else return Number.MAX_VALUE;return b>0?b:Number.MAX_VALUE}; -THREE.CollisionSystem.prototype.raySphere=function(a,c){var b=c.center.clone().subSelf(a.origin);if(b.lengthSq=0)return Math.abs(d)-Math.sqrt(b);return Number.MAX_VALUE};THREE.CollisionSystem.__v1=new THREE.Vector3;THREE.CollisionSystem.__v2=new THREE.Vector3;THREE.CollisionSystem.__v3=new THREE.Vector3;THREE.CollisionSystem.__nr=new THREE.Vector3;THREE.CollisionSystem.__m=new THREE.Matrix4; -THREE.CollisionSystem.__r=new THREE.Ray;THREE.CollisionUtils={};THREE.CollisionUtils.MeshOBB=function(a){a.geometry.computeBoundingBox();var c=a.geometry.boundingBox,b=new THREE.Vector3(c.x[0],c.y[0],c.z[0]),c=new THREE.Vector3(c.x[1],c.y[1],c.z[1]),b=new THREE.BoxCollider(b,c);b.mesh=a;return b};THREE.CollisionUtils.MeshAABB=function(a){var c=THREE.CollisionUtils.MeshOBB(a);c.min.addSelf(a.position);c.max.addSelf(a.position);c.dynamic=!1;return c}; -THREE.CollisionUtils.MeshColliderWBox=function(a){return new THREE.MeshCollider(a,THREE.CollisionUtils.MeshOBB(a))}; -if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=!1;var c=this,b=this.setSize,d=this.render,g=new THREE.PerspectiveCamera,f=new THREE.PerspectiveCamera,e=new THREE.Matrix4,h=new THREE.Matrix4,i,k,j,q;g.matrixAutoUpdate=f.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},o=new THREE.WebGLRenderTarget(512,512,a),n=new THREE.WebGLRenderTarget(512,512,a),s=new THREE.PerspectiveCamera(53, +2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,3,8,9,1,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,9,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,3,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1]); +if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=!1;var d=this,b=this.setSize,c=this.render,g=new THREE.PerspectiveCamera,f=new THREE.PerspectiveCamera,e=new THREE.Matrix4,h=new THREE.Matrix4,i,k,j,q;g.matrixAutoUpdate=f.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},o=new THREE.WebGLRenderTarget(512,512,a),n=new THREE.WebGLRenderTarget(512,512,a),s=new THREE.PerspectiveCamera(53, 1,1,1E4);s.position.z=2;var a=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:o},mapRight:{type:"t",value:1,texture:n}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"}), -m=new THREE.Scene;m.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),a));m.add(s);this.setSize=function(a,d){b.call(c,a,d);o.width=a;o.height=d;n.width=a;n.height=d};this.render=function(a,b){a.updateMatrixWorld();if(i!==b.aspect||k!==b.near||j!==b.far||q!==b.fov){i=b.aspect;k=b.near;j=b.far;q=b.fov;var r=b.projectionMatrix.clone(),t=125/30*0.5,w=t*k/125,z=k*Math.tan(q*Math.PI/360),v;e.n14=t;h.n14=-t;t=-z*i+w;v=z*i+w;r.n11=2*k/(v-t);r.n13=(v+t)/(v-t);g.projectionMatrix.copy(r);t=-z*i-w;v=z*i-w;r.n11= -2*k/(v-t);r.n13=(v+t)/(v-t);f.projectionMatrix.copy(r)}g.matrixWorld.copy(b.matrixWorld).multiplySelf(h);g.position.copy(b.position);g.near=b.near;g.far=b.far;d.call(c,a,g,o,!0);f.matrixWorld.copy(b.matrixWorld).multiplySelf(e);f.position.copy(b.position);f.near=b.near;f.far=b.far;d.call(c,a,f,n,!0);m.updateMatrixWorld();d.call(c,m,s)}}; -if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=!1;var c=this,b=this.setSize,d=this.render,g,f,e=new THREE.PerspectiveCamera;e.target=new THREE.Vector3(0,0,0);var h=new THREE.PerspectiveCamera;h.target=new THREE.Vector3(0,0,0);c.separation=10;if(a&&a.separation!==void 0)c.separation=a.separation;this.setSize=function(a,d){b.call(c,a,d);g=a/2;f=d};this.render=function(a,b){this.clear();e.fov=b.fov;e.aspect=0.5*b.aspect;e.near=b.near;e.far= -b.far;e.updateProjectionMatrix();e.position.copy(b.position);e.target.copy(b.target);e.translateX(c.separation);e.lookAt(e.target);h.projectionMatrix=e.projectionMatrix;h.position.copy(b.position);h.target.copy(b.target);h.translateX(-c.separation);h.lookAt(h.target);this.setViewport(0,0,g,f);d.call(c,a,e);this.setViewport(g,0,g,f);d.call(c,a,h,!1)}}; +m=new THREE.Scene;m.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),a));m.add(s);this.setSize=function(a,c){b.call(d,a,c);o.width=a;o.height=c;n.width=a;n.height=c};this.render=function(a,b){a.updateMatrixWorld();if(i!==b.aspect||k!==b.near||j!==b.far||q!==b.fov){i=b.aspect;k=b.near;j=b.far;q=b.fov;var r=b.projectionMatrix.clone(),t=125/30*0.5,w=t*k/125,z=k*Math.tan(q*Math.PI/360),v;e.n14=t;h.n14=-t;t=-z*i+w;v=z*i+w;r.n11=2*k/(v-t);r.n13=(v+t)/(v-t);g.projectionMatrix.copy(r);t=-z*i-w;v=z*i-w;r.n11= +2*k/(v-t);r.n13=(v+t)/(v-t);f.projectionMatrix.copy(r)}g.matrixWorld.copy(b.matrixWorld).multiplySelf(h);g.position.copy(b.position);g.near=b.near;g.far=b.far;c.call(d,a,g,o,!0);f.matrixWorld.copy(b.matrixWorld).multiplySelf(e);f.position.copy(b.position);f.near=b.near;f.far=b.far;c.call(d,a,f,n,!0);m.updateMatrixWorld();c.call(d,m,s)}}; +if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=!1;var d=this,b=this.setSize,c=this.render,g,f,e=new THREE.PerspectiveCamera;e.target=new THREE.Vector3(0,0,0);var h=new THREE.PerspectiveCamera;h.target=new THREE.Vector3(0,0,0);d.separation=10;if(a&&a.separation!==void 0)d.separation=a.separation;this.setSize=function(a,c){b.call(d,a,c);g=a/2;f=c};this.render=function(a,b){this.clear();e.fov=b.fov;e.aspect=0.5*b.aspect;e.near=b.near;e.far= +b.far;e.updateProjectionMatrix();e.position.copy(b.position);e.target.copy(b.target);e.translateX(d.separation);e.lookAt(e.target);h.projectionMatrix=e.projectionMatrix;h.position.copy(b.position);h.target.copy(b.target);h.translateX(-d.separation);h.lookAt(h.target);this.setViewport(0,0,g,f);c.call(d,a,e);this.setViewport(g,0,g,f);c.call(d,a,h,!1)}}; diff --git a/build/custom/ThreeSVG.js b/build/custom/ThreeSVG.js index 0a09dc7f7c416cdd89aa1108ebe33e8bc27dfbfb..4281aba9408771dfbc0d88faa5d2d85126ef3935 100644 --- a/build/custom/ThreeSVG.js +++ b/build/custom/ThreeSVG.js @@ -1,4 +1,4 @@ -// ThreeSVG.js r46dev - http://github.com/mrdoob/three.js +// ThreeSVG.js r46 - http://github.com/mrdoob/three.js var THREE=THREE||{};if(!self.Int32Array)self.Int32Array=Array,self.Float32Array=Array;THREE.Color=function(a){a!==void 0&&this.setHex(a);return this}; THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;return this},copyGammaToLinear:function(a){this.r=a.r*a.r;this.g=a.g*a.g;this.b=a.b*a.b;return this},copyLinearToGamma:function(a){this.r=Math.sqrt(a.r);this.g=Math.sqrt(a.g);this.b=Math.sqrt(a.b);return this},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;return this},setHSV:function(a,b,c){var d,f,e;if(c===0)this.r=this.g=this.b=0;else switch(d=Math.floor(a*6),f=a*6-d,a=c*(1-b),e=c*(1- b*f),b=c*(1-b*(1-f)),d){case 1:this.r=e;this.g=c;this.b=a;break;case 2:this.r=a;this.g=c;this.b=b;break;case 3:this.r=a;this.g=e;this.b=c;break;case 4:this.r=b;this.g=a;this.b=c;break;case 5:this.r=c;this.g=a;this.b=e;break;case 6:case 0:this.r=c,this.g=b,this.b=a}return this},setHex:function(a){a=Math.floor(a);this.r=(a>>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255;return this},getHex:function(){return~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},getContextStyle:function(){return"rgb("+ @@ -72,7 +72,7 @@ this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRo this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a===0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b= this.x,c=this.y,d=this.z,f=this.w,e=a.x,g=a.y,h=a.z,a=a.w;this.x=b*a+f*e+c*h-d*g;this.y=c*a+f*g+d*e-b*h;this.z=d*a+f*h+b*g-c*e;this.w=f*a-b*e-c*g-d*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,f=a.z,e=this.x,g=this.y,h=this.z,l=this.w,m=l*c+g*f-h*d,i=l*d+h*c-e*f,j=l*f+e*d-g*c,c=-e* c-g*d-h*f;b.x=m*l+c*-e+i*-h-j*-g;b.y=i*l+c*-g+j*-e-m*-h;b.z=j*l+c*-h+m*-g-i*-e;return b}}; -THREE.Quaternion.slerp=function(a,b,c,d){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;f<0?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,f=-f):c.copy(b);if(Math.abs(f)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var e=Math.acos(f),f=Math.sqrt(1-f*f);if(Math.abs(f)<0.0010)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;b=Math.sin((1-d)*e)/f;d=Math.sin(d*e)/f;c.w=a.w*b+c.w*d;c.x=a.x*b+c.x*d;c.y=a.y*b+c.y*d;c.z=a.z*b+c.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3}; +THREE.Quaternion.slerp=function(a,b,c,d){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;f<0?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,f=-f):c.copy(b);if(Math.abs(f)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var e=Math.acos(f),f=Math.sqrt(1-f*f);if(Math.abs(f)<0.001)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;b=Math.sin((1-d)*e)/f;d=Math.sin(d*e)/f;c.w=a.w*b+c.w*d;c.x=a.x*b+c.x*d;c.y=a.y*b+c.y*d;c.z=a.z*b+c.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3}; THREE.Face3=function(a,b,c,d,f,e){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=e;this.centroid=new THREE.Vector3}; THREE.Face4=function(a,b,c,d,f,e,g){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=g;this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.u=a||0;this.v=b||0}; THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}}; diff --git a/build/custom/ThreeWebGL.js b/build/custom/ThreeWebGL.js index cb5181fbd4bda5efadb68f1a5a28dab04b654347..07c034c4d18b635544c5abd6fd86e578ace6a1b4 100644 --- a/build/custom/ThreeWebGL.js +++ b/build/custom/ThreeWebGL.js @@ -1,4 +1,4 @@ -// ThreeWebGL.js r46dev - http://github.com/mrdoob/three.js +// ThreeWebGL.js r46 - http://github.com/mrdoob/three.js var THREE=THREE||{};if(!self.Int32Array)self.Int32Array=Array,self.Float32Array=Array;THREE.Color=function(a){a!==void 0&&this.setHex(a);return this}; THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;return this},copyGammaToLinear:function(a){this.r=a.r*a.r;this.g=a.g*a.g;this.b=a.b*a.b;return this},copyLinearToGamma:function(a){this.r=Math.sqrt(a.r);this.g=Math.sqrt(a.g);this.b=Math.sqrt(a.b);return this},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;return this},setHSV:function(a,b,c){var e,f,g;if(c===0)this.r=this.g=this.b=0;else switch(e=Math.floor(a*6),f=a*6-e,a=c*(1-b),g=c*(1- b*f),b=c*(1-b*(1-f)),e){case 1:this.r=g;this.g=c;this.b=a;break;case 2:this.r=a;this.g=c;this.b=b;break;case 3:this.r=a;this.g=g;this.b=c;break;case 4:this.r=b;this.g=a;this.b=c;break;case 5:this.r=c;this.g=a;this.b=g;break;case 6:case 0:this.r=c,this.g=b,this.b=a}return this},setHex:function(a){a=Math.floor(a);this.r=(a>>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255;return this},getHex:function(){return~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},getContextStyle:function(){return"rgb("+ @@ -72,7 +72,7 @@ this.x=a.x*e;this.y=a.y*e;this.z=a.z*e;this.w=Math.cos(c);return this},setFromRo this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a===0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b= this.x,c=this.y,e=this.z,f=this.w,g=a.x,h=a.y,i=a.z,a=a.w;this.x=b*a+f*g+c*i-e*h;this.y=c*a+f*h+e*g-b*i;this.z=e*a+f*i+b*h-c*g;this.w=f*a-b*g-c*h-e*i;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,e=a.y,f=a.z,g=this.x,h=this.y,i=this.z,n=this.w,k=n*c+h*f-i*e,l=n*e+i*c-g*f,p=n*f+g*e-h*c,c=-g* c-h*e-i*f;b.x=k*n+c*-g+l*-i-p*-h;b.y=l*n+c*-h+p*-g-k*-i;b.z=p*n+c*-i+k*-h-l*-g;return b}}; -THREE.Quaternion.slerp=function(a,b,c,e){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;f<0?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,f=-f):c.copy(b);if(Math.abs(f)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var g=Math.acos(f),f=Math.sqrt(1-f*f);if(Math.abs(f)<0.0010)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;b=Math.sin((1-e)*g)/f;e=Math.sin(e*g)/f;c.w=a.w*b+c.w*e;c.x=a.x*b+c.x*e;c.y=a.y*b+c.y*e;c.z=a.z*b+c.z*e;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3}; +THREE.Quaternion.slerp=function(a,b,c,e){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;f<0?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,f=-f):c.copy(b);if(Math.abs(f)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var g=Math.acos(f),f=Math.sqrt(1-f*f);if(Math.abs(f)<0.001)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;b=Math.sin((1-e)*g)/f;e=Math.sin(e*g)/f;c.w=a.w*b+c.w*e;c.x=a.x*b+c.x*e;c.y=a.y*b+c.y*e;c.z=a.z*b+c.z*e;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3}; THREE.Face3=function(a,b,c,e,f,g){this.a=a;this.b=b;this.c=c;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=g;this.centroid=new THREE.Vector3}; THREE.Face4=function(a,b,c,e,f,g,h){this.a=a;this.b=b;this.c=c;this.d=e;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materialIndex=h;this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.u=a||0;this.v=b||0}; THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};