From bd2f75b48ad486240781f6bc579867a569a4eb27 Mon Sep 17 00:00:00 2001 From: "Mr.doob" <info@mrdoob.com> Date: Thu, 17 Nov 2011 01:14:01 +0100 Subject: [PATCH] Updated r46 with some bugfixes found post release. --- README.md | 3 +- REVISION | 2 +- build/Three.js | 190 ++++++++++++++++++------------------ build/custom/ThreeCanvas.js | 31 +++--- build/custom/ThreeDOM.js | 4 +- build/custom/ThreeExtras.js | 22 ++--- build/custom/ThreeSVG.js | 31 +++--- build/custom/ThreeWebGL.js | 24 ++--- src/extras/SceneUtils.js | 8 +- 9 files changed, 157 insertions(+), 158 deletions(-) diff --git a/README.md b/README.md index 96065e1ff..d835fee95 100644 --- a/README.md +++ b/README.md @@ -141,7 +141,7 @@ 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) +2011 11 17 - **r46** (343.383 KB, gzip: 87.468 KB) * Added reflections to Normal Mapping. ([alteredq](http://github.com/alteredq)) * `Ray` now checks also object children. ([mrdoob](http://github.com/mrdoob)) @@ -161,6 +161,7 @@ This code creates a camera, then creates a scene, adds a cube on it, creates a & * 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)) +* Added `cloneObject()` method to `SceneUtils`. ([alteredq](http://github.com/alteredq)) 2011 10 06 - **r45** (340.863 KB, gzip: 86.568 KB) diff --git a/REVISION b/REVISION index b7ca28825..9e5feb525 100644 --- a/REVISION +++ b/REVISION @@ -1 +1 @@ -47dev +46 diff --git a/build/Three.js b/build/Three.js index db132b4a1..735dacf40 100644 --- a/build/Three.js +++ b/build/Three.js @@ -1,6 +1,6 @@ -// Three.js r47dev - 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}; @@ -55,43 +55,43 @@ THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(a,c){thi -1){a.parent!==void 0&&a.parent.remove(a);a.parent=this;this.children.push(a);for(var c=this;c.parent!==void 0;)c=c.parent;c!==void 0&&c instanceof THREE.Scene&&c.addObject(a)}},remove:function(a){var c=this.children.indexOf(a);if(c!==-1){a.parent=void 0;this.children.splice(c,1);for(c=this;c.parent!==void 0;)c=c.parent;c!==void 0&&c instanceof THREE.Scene&&c.removeObject(a)}},getChildByName:function(a,c){var b,d,g;b=0;for(d=this.children.length;b<d;b++){g=this.children[b];if(g.name===a)return g; if(c&&(g=g.getChildByName(a,c),g!==void 0))return g}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(a){this.matrixAutoUpdate&& this.updateMatrix();if(this.matrixWorldNeedsUpdate||a)this.parent?this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,a=!0;for(var c=0,b=this.children.length;c<b;c++)this.children[c].updateMatrixWorld(a)}};THREE.Object3DCount=0; -THREE.Projector=function(){function a(){var a=e[f]=e[f]||new THREE.RenderableObject;f++;return a}function c(){var a=l[i]=l[i]||new THREE.RenderableVertex;i++;return a}function b(a,b){return b.z-a.z}function d(a,b){var c=0,d=1,f=a.z+a.w,g=b.z+b.w,e=-a.z+a.w,h=-b.z+b.w;return f>=0&&g>=0&&e>=0&&h>=0?!0:f<0&&g<0||e<0&&h<0?!1:(f<0?c=Math.max(c,f/(f-g)):g<0&&(d=Math.min(d,f/(f-g))),e<0?c=Math.max(c,e/(e-h)):h<0&&(d=Math.min(d,e/(e-h))),d<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-d),!0))}var g,f,e=[],h,i,l=[], +THREE.Projector=function(){function a(){var a=e[f]=e[f]||new THREE.RenderableObject;f++;return a}function c(){var a=l[i]=l[i]||new THREE.RenderableVertex;i++;return a}function b(a,b){return b.z-a.z}function d(a,b){var c=0,d=1,g=a.z+a.w,f=b.z+b.w,e=-a.z+a.w,h=-b.z+b.w;return g>=0&&f>=0&&e>=0&&h>=0?!0:g<0&&f<0||e<0&&h<0?!1:(g<0?c=Math.max(c,g/(g-f)):f<0&&(d=Math.min(d,g/(g-f))),e<0?c=Math.max(c,e/(e-h)):h<0&&(d=Math.min(d,e/(e-h))),d<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-d),!0))}var g,f,e=[],h,i,l=[], k,o,p=[],m,r=[],n,q,t=[],w,u,B=[],F={objects:[],sprites:[],lights:[],elements:[]},A=new THREE.Vector3,x=new THREE.Vector4,y=new THREE.Matrix4,v=new THREE.Matrix4,J=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],s=new THREE.Vector4,E=new THREE.Vector4;this.computeFrustum=function(a){J[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);J[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);J[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+ a.n23,a.n44+a.n24);J[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);J[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);J[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(a=0;a<6;a++){var b=J[a];b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}};this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);y.multiply(b.projectionMatrix,b.matrixWorldInverse);y.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix); y.multiply(b.matrixWorld,b.projectionMatrixInverse);y.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(c,d){f=0;F.objects.length=0;F.sprites.length=0;F.lights.length=0;var e=function(b){if(b.visible!==!1){var c;if(c=b instanceof THREE.Mesh||b instanceof THREE.Line)if(!(c=b.frustumCulled===!1))a:{for(var d=b.matrixWorld, f=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),h=0;h<6;h++)if(c=J[h].x*d.n14+J[h].y*d.n24+J[h].z*d.n34+J[h].w,c<=f){c=!1;break a}c=!0}c?(y.multiplyVector3(A.copy(b.position)),g=a(),g.object=b,g.z=A.z,F.objects.push(g)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(y.multiplyVector3(A.copy(b.position)),g=a(),g.object=b,g.z=A.z,F.sprites.push(g)):b instanceof THREE.Light&&F.lights.push(b);c=0;for(d=b.children.length;c<d;c++)e(b.children[c])}};e(c);d&& -F.objects.sort(b);return F};this.projectScene=function(a,f,g){var e=f.near,J=f.far,A,H,G,I,M,S,ba,W,j,X,V,da,ga,$,ua,ra;u=q=m=o=0;F.elements.length=0;f.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(f));a.updateMatrixWorld();f.matrixWorldInverse.getInverse(f.matrixWorld);y.multiply(f.projectionMatrix,f.matrixWorldInverse);this.computeFrustum(y);F=this.projectGraph(a,!1);a=0;for(A=F.objects.length;a<A;a++)if(j=F.objects[a].object,X=j.matrixWorld, +F.objects.sort(b);return F};this.projectScene=function(a,g,f){var e=g.near,J=g.far,A,H,G,I,M,S,ba,W,j,X,V,da,ga,$,ua,ra;u=q=m=o=0;F.elements.length=0;g.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(g));a.updateMatrixWorld();g.matrixWorldInverse.getInverse(g.matrixWorld);y.multiply(g.projectionMatrix,g.matrixWorldInverse);this.computeFrustum(y);F=this.projectGraph(a,!1);a=0;for(A=F.objects.length;a<A;a++)if(j=F.objects[a].object,X=j.matrixWorld, da=j.material,i=0,j instanceof THREE.Mesh){V=j.geometry;ga=j.geometry.materials;I=V.vertices;$=V.faces;ua=V.faceVertexUvs;V=j.matrixRotationWorld.extractRotation(X);H=0;for(G=I.length;H<G;H++)h=c(),h.positionWorld.copy(I[H].position),X.multiplyVector3(h.positionWorld),h.positionScreen.copy(h.positionWorld),y.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>e&&h.positionScreen.z<J;I=0;for(H=$.length;I<H;I++){G= $[I];if(G instanceof THREE.Face3)if(M=l[G.a],S=l[G.b],ba=l[G.c],M.visible&&S.visible&&ba.visible&&(j.doubleSided||j.flipSided!=(ba.positionScreen.x-M.positionScreen.x)*(S.positionScreen.y-M.positionScreen.y)-(ba.positionScreen.y-M.positionScreen.y)*(S.positionScreen.x-M.positionScreen.x)<0))W=p[o]=p[o]||new THREE.RenderableFace3,o++,k=W,k.v1.copy(M),k.v2.copy(S),k.v3.copy(ba);else continue;else if(G instanceof THREE.Face4)if(M=l[G.a],S=l[G.b],ba=l[G.c],W=l[G.d],M.visible&&S.visible&&ba.visible&&W.visible&& (j.doubleSided||j.flipSided!=((W.positionScreen.x-M.positionScreen.x)*(S.positionScreen.y-M.positionScreen.y)-(W.positionScreen.y-M.positionScreen.y)*(S.positionScreen.x-M.positionScreen.x)<0||(S.positionScreen.x-ba.positionScreen.x)*(W.positionScreen.y-ba.positionScreen.y)-(S.positionScreen.y-ba.positionScreen.y)*(W.positionScreen.x-ba.positionScreen.x)<0)))ra=r[m]=r[m]||new THREE.RenderableFace4,m++,k=ra,k.v1.copy(M),k.v2.copy(S),k.v3.copy(ba),k.v4.copy(W);else continue;k.normalWorld.copy(G.normal); V.multiplyVector3(k.normalWorld);k.centroidWorld.copy(G.centroid);X.multiplyVector3(k.centroidWorld);k.centroidScreen.copy(k.centroidWorld);y.multiplyVector3(k.centroidScreen);ba=G.vertexNormals;M=0;for(S=ba.length;M<S;M++)W=k.vertexNormalsWorld[M],W.copy(ba[M]),V.multiplyVector3(W);M=0;for(S=ua.length;M<S;M++)if(ra=ua[M][I]){ba=0;for(W=ra.length;ba<W;ba++)k.uvs[M][ba]=ra[ba]}k.material=da;k.faceMaterial=G.materialIndex!==null?ga[G.materialIndex]:null;k.z=k.centroidScreen.z;F.elements.push(k)}}else if(j instanceof THREE.Line){v.multiply(y,X);I=j.geometry.vertices;M=c();M.positionScreen.copy(I[0].position);v.multiplyVector4(M.positionScreen);H=1;for(G=I.length;H<G;H++)if(M=c(),M.positionScreen.copy(I[H].position),v.multiplyVector4(M.positionScreen),S=l[i-2],s.copy(M.positionScreen),E.copy(S.positionScreen),d(s,E))s.multiplyScalar(1/s.w),E.multiplyScalar(1/E.w),j=t[q]=t[q]||new THREE.RenderableLine,q++,n=j,n.v1.positionScreen.copy(s),n.v2.positionScreen.copy(E),n.z=Math.max(s.z,E.z),n.material=da,F.elements.push(n)}a= -0;for(A=F.sprites.length;a<A;a++)if(j=F.sprites[a].object,X=j.matrixWorld,j instanceof THREE.Particle&&(x.set(X.n14,X.n24,X.n34,1),y.multiplyVector4(x),x.z/=x.w,x.z>0&&x.z<1))e=B[u]=B[u]||new THREE.RenderableParticle,u++,w=e,w.x=x.x/x.w,w.y=x.y/x.w,w.z=x.z,w.rotation=j.rotation.z,w.scale.x=j.scale.x*Math.abs(w.x-(x.x+f.projectionMatrix.n11)/(x.w+f.projectionMatrix.n14)),w.scale.y=j.scale.y*Math.abs(w.y-(x.y+f.projectionMatrix.n22)/(x.w+f.projectionMatrix.n24)),w.material=j.material,F.elements.push(w); -g&&F.elements.sort(b);return F}};THREE.Quaternion=function(a,c,b,d){this.set(a||0,c||0,b||0,d!==void 0?d:1)}; +0;for(A=F.sprites.length;a<A;a++)if(j=F.sprites[a].object,X=j.matrixWorld,j instanceof THREE.Particle&&(x.set(X.n14,X.n24,X.n34,1),y.multiplyVector4(x),x.z/=x.w,x.z>0&&x.z<1))e=B[u]=B[u]||new THREE.RenderableParticle,u++,w=e,w.x=x.x/x.w,w.y=x.y/x.w,w.z=x.z,w.rotation=j.rotation.z,w.scale.x=j.scale.x*Math.abs(w.x-(x.x+g.projectionMatrix.n11)/(x.w+g.projectionMatrix.n14)),w.scale.y=j.scale.y*Math.abs(w.y-(x.y+g.projectionMatrix.n22)/(x.w+g.projectionMatrix.n24)),w.material=j.material,F.elements.push(w); +f&&F.elements.sort(b);return F}};THREE.Quaternion=function(a,c,b,d){this.set(a||0,c||0,b||0,d!==void 0?d:1)}; THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,c,b,d){this.x=a;this.y=c;this.z=b;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a){var c=Math.PI/360,b=a.x*c,d=a.y*c,g=a.z*c,a=Math.cos(d),d=Math.sin(d),c=Math.cos(-g),g=Math.sin(-g),f=Math.cos(b),b=Math.sin(b),e=a*c,h=d*g;this.w=e*f-h*b;this.x=e*b+h*f;this.y=d*c*f+a*g*b;this.z=a*g*f-d*c*b;return this},setFromAxisAngle:function(a,c){var b=c/2,d=Math.sin(b); this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(b);return this},setFromRotationMatrix:function(a){var c=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,c+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,c+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,c-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,c-a.n11-a.n22+a.n33))/2;this.x=a.n32-a.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=a.n13-a.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=a.n21-a.n12<0?-Math.abs(this.z):Math.abs(this.z); 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)}}; THREE.Geometry=function(){this.id=THREE.GeometryCount++;this.vertices=[];this.colors=[];this.materials=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=!1}; THREE.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(a){var c=new THREE.Matrix4;c.extractRotation(a,new THREE.Vector3(1,1,1));for(var b=0,d=this.vertices.length;b<d;b++)a.multiplyVector3(this.vertices[b].position);b=0;for(d=this.faces.length;b<d;b++){var g=this.faces[b];c.multiplyVector3(g.normal);for(var f=0,e=g.vertexNormals.length;f<e;f++)c.multiplyVector3(g.vertexNormals[f]);a.multiplyVector3(g.centroid)}},computeCentroids:function(){var a,c,b;a=0;for(c=this.faces.length;a< -c;a++)b=this.faces[a],b.centroid.set(0,0,0),b instanceof THREE.Face3?(b.centroid.addSelf(this.vertices[b.a].position),b.centroid.addSelf(this.vertices[b.b].position),b.centroid.addSelf(this.vertices[b.c].position),b.centroid.divideScalar(3)):b instanceof THREE.Face4&&(b.centroid.addSelf(this.vertices[b.a].position),b.centroid.addSelf(this.vertices[b.b].position),b.centroid.addSelf(this.vertices[b.c].position),b.centroid.addSelf(this.vertices[b.d].position),b.centroid.divideScalar(4))},computeFaceNormals:function(a){var c, -b,d,g,f,e,h=new THREE.Vector3,i=new THREE.Vector3;d=0;for(g=this.faces.length;d<g;d++){f=this.faces[d];if(a&&f.vertexNormals.length){h.set(0,0,0);c=0;for(b=f.vertexNormals.length;c<b;c++)h.addSelf(f.vertexNormals[c]);h.divideScalar(3)}else c=this.vertices[f.a],b=this.vertices[f.b],e=this.vertices[f.c],h.sub(e.position,b.position),i.sub(c.position,b.position),h.crossSelf(i);h.isZero()||h.normalize();f.normal.copy(h)}},computeVertexNormals:function(){var a,c,b,d;if(this.__tmpVertices===void 0){d=this.__tmpVertices= -Array(this.vertices.length);a=0;for(c=this.vertices.length;a<c;a++)d[a]=new THREE.Vector3;a=0;for(c=this.faces.length;a<c;a++)if(b=this.faces[a],b instanceof THREE.Face3)b.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(b instanceof THREE.Face4)b.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{d=this.__tmpVertices;a=0;for(c=this.vertices.length;a<c;a++)d[a].set(0,0,0)}a=0;for(c=this.faces.length;a<c;a++)b=this.faces[a],b instanceof -THREE.Face3?(d[b.a].addSelf(b.normal),d[b.b].addSelf(b.normal),d[b.c].addSelf(b.normal)):b instanceof THREE.Face4&&(d[b.a].addSelf(b.normal),d[b.b].addSelf(b.normal),d[b.c].addSelf(b.normal),d[b.d].addSelf(b.normal));a=0;for(c=this.vertices.length;a<c;a++)d[a].normalize();a=0;for(c=this.faces.length;a<c;a++)b=this.faces[a],b instanceof THREE.Face3?(b.vertexNormals[0].copy(d[b.a]),b.vertexNormals[1].copy(d[b.b]),b.vertexNormals[2].copy(d[b.c])):b instanceof THREE.Face4&&(b.vertexNormals[0].copy(d[b.a]), -b.vertexNormals[1].copy(d[b.b]),b.vertexNormals[2].copy(d[b.c]),b.vertexNormals[3].copy(d[b.d]))},computeTangents:function(){function a(a,b,c,d,f,g,R){h=a.vertices[b].position;i=a.vertices[c].position;l=a.vertices[d].position;k=e[f];o=e[g];p=e[R];m=i.x-h.x;r=l.x-h.x;n=i.y-h.y;q=l.y-h.y;t=i.z-h.z;w=l.z-h.z;u=o.u-k.u;B=p.u-k.u;F=o.v-k.v;A=p.v-k.v;x=1/(u*A-B*F);s.set((A*m-F*r)*x,(A*n-F*q)*x,(A*t-F*w)*x);E.set((u*r-B*m)*x,(u*q-B*n)*x,(u*w-B*t)*x);v[b].addSelf(s);v[c].addSelf(s);v[d].addSelf(s);J[b].addSelf(E); -J[c].addSelf(E);J[d].addSelf(E)}var c,b,d,g,f,e,h,i,l,k,o,p,m,r,n,q,t,w,u,B,F,A,x,y,v=[],J=[],s=new THREE.Vector3,E=new THREE.Vector3,R=new THREE.Vector3,U=new THREE.Vector3,K=new THREE.Vector3;c=0;for(b=this.vertices.length;c<b;c++)v[c]=new THREE.Vector3,J[c]=new THREE.Vector3;c=0;for(b=this.faces.length;c<b;c++)f=this.faces[c],e=this.faceVertexUvs[0][c],f instanceof THREE.Face3?a(this,f.a,f.b,f.c,0,1,2):f instanceof THREE.Face4&&(a(this,f.a,f.b,f.c,0,1,2),a(this,f.a,f.b,f.d,0,1,3));var P=["a","b", -"c","d"];c=0;for(b=this.faces.length;c<b;c++){f=this.faces[c];for(d=0;d<f.vertexNormals.length;d++)K.copy(f.vertexNormals[d]),g=f[P[d]],y=v[g],R.copy(y),R.subSelf(K.multiplyScalar(K.dot(y))).normalize(),U.cross(f.vertexNormals[d],y),g=U.dot(J[g]),g=g<0?-1:1,f.vertexTangents[d]=new THREE.Vector4(R.x,R.y,R.z,g)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y, -this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,b=this.vertices.length;c<b;c++){a=this.vertices[c];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]= -a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=0,c=0,b=this.vertices.length;c<b;c++)a=Math.max(a,this.vertices[c].position.length());this.boundingSphere={radius:a}},mergeVertices:function(){var a={},c=[],b=[],d,g=Math.pow(10,4),f,e;f=0;for(e=this.vertices.length;f<e;f++)d=this.vertices[f].position,d=[Math.round(d.x*g),Math.round(d.y*g),Math.round(d.z*g)].join("_"),a[d]===void 0?(a[d]=f,c.push(this.vertices[f]), -b[f]=c.length-1):b[f]=b[a[d]];f=0;for(e=this.faces.length;f<e;f++)if(a=this.faces[f],a instanceof THREE.Face3)a.a=b[a.a],a.b=b[a.b],a.c=b[a.c];else if(a instanceof THREE.Face4)a.a=b[a.a],a.b=b[a.b],a.c=b[a.c],a.d=b[a.d];this.vertices=c}};THREE.GeometryCount=0; -THREE.Spline=function(a){function c(a,b,c,d,f,g,e){a=(c-a)*0.5;d=(d-b)*0.5;return(2*(b-c)+a+d)*e+(-3*(b-c)-2*a-d)*g+a*f+b}this.points=a;var b=[],d={x:0,y:0,z:0},g,f,e,h,i,l,k,o,p;this.initFromArray=function(a){this.points=[];for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}};this.getPoint=function(a){g=(this.points.length-1)*a;f=Math.floor(g);e=g-f;b[0]=f===0?f:f-1;b[1]=f;b[2]=f>this.points.length-2?f:f+1;b[3]=f>this.points.length-3?f:f+2;l=this.points[b[0]];k=this.points[b[1]]; -o=this.points[b[2]];p=this.points[b[3]];h=e*e;i=e*h;d.x=c(l.x,k.x,o.x,p.x,e,h,i);d.y=c(l.y,k.y,o.y,p.y,e,h,i);d.z=c(l.z,k.z,o.z,p.z,e,h,i);return d};this.getControlPointsArray=function(){var a,b,c=this.points.length,d=[];for(a=0;a<c;a++)b=this.points[a],d[a]=[b.x,b.y,b.z];return d};this.getLength=function(a){var b,c,d,f=b=b=0,g=new THREE.Vector3,e=new THREE.Vector3,h=[],i=0;h[0]=0;a||(a=100);c=this.points.length*a;g.copy(this.points[0]);for(a=1;a<c;a++)b=a/c,d=this.getPoint(b),e.copy(d),i+=e.distanceTo(g), -g.copy(d),b*=this.points.length-1,b=Math.floor(b),b!=f&&(h[b]=i,f=b);h[h.length]=i;return{chunks:h,total:i}};this.reparametrizeByArcLength=function(a){var b,c,d,f,g,e,h=[],i=new THREE.Vector3,k=this.getLength();h.push(i.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=k.chunks[b]-k.chunks[b-1];e=Math.ceil(a*c/k.total);f=(b-1)/(this.points.length-1);g=b/(this.points.length-1);for(c=1;c<e-1;c++)d=f+c*(1/e)*(g-f),d=this.getPoint(d),h.push(i.copy(d).clone());h.push(i.copy(this.points[b]).clone())}this.points= +c;a++)b=this.faces[a],b.centroid.set(0,0,0),b instanceof THREE.Face3?(b.centroid.addSelf(this.vertices[b.a].position),b.centroid.addSelf(this.vertices[b.b].position),b.centroid.addSelf(this.vertices[b.c].position),b.centroid.divideScalar(3)):b instanceof THREE.Face4&&(b.centroid.addSelf(this.vertices[b.a].position),b.centroid.addSelf(this.vertices[b.b].position),b.centroid.addSelf(this.vertices[b.c].position),b.centroid.addSelf(this.vertices[b.d].position),b.centroid.divideScalar(4))},computeFaceNormals:function(){var a, +c,b,d,g,f,e=new THREE.Vector3,h=new THREE.Vector3;a=0;for(c=this.faces.length;a<c;a++)b=this.faces[a],d=this.vertices[b.a],g=this.vertices[b.b],f=this.vertices[b.c],e.sub(f.position,g.position),h.sub(d.position,g.position),e.crossSelf(h),e.isZero()||e.normalize(),b.normal.copy(e)},computeVertexNormals:function(){var a,c,b,d;if(this.__tmpVertices===void 0){d=this.__tmpVertices=Array(this.vertices.length);a=0;for(c=this.vertices.length;a<c;a++)d[a]=new THREE.Vector3;a=0;for(c=this.faces.length;a<c;a++)if(b= +this.faces[a],b instanceof THREE.Face3)b.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(b instanceof THREE.Face4)b.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{d=this.__tmpVertices;a=0;for(c=this.vertices.length;a<c;a++)d[a].set(0,0,0)}a=0;for(c=this.faces.length;a<c;a++)b=this.faces[a],b instanceof THREE.Face3?(d[b.a].addSelf(b.normal),d[b.b].addSelf(b.normal),d[b.c].addSelf(b.normal)):b instanceof THREE.Face4&&(d[b.a].addSelf(b.normal), +d[b.b].addSelf(b.normal),d[b.c].addSelf(b.normal),d[b.d].addSelf(b.normal));a=0;for(c=this.vertices.length;a<c;a++)d[a].normalize();a=0;for(c=this.faces.length;a<c;a++)b=this.faces[a],b instanceof THREE.Face3?(b.vertexNormals[0].copy(d[b.a]),b.vertexNormals[1].copy(d[b.b]),b.vertexNormals[2].copy(d[b.c])):b instanceof THREE.Face4&&(b.vertexNormals[0].copy(d[b.a]),b.vertexNormals[1].copy(d[b.b]),b.vertexNormals[2].copy(d[b.c]),b.vertexNormals[3].copy(d[b.d]))},computeTangents:function(){function a(a, +b,c,d,g,f,R){h=a.vertices[b].position;i=a.vertices[c].position;l=a.vertices[d].position;k=e[g];o=e[f];p=e[R];m=i.x-h.x;r=l.x-h.x;n=i.y-h.y;q=l.y-h.y;t=i.z-h.z;w=l.z-h.z;u=o.u-k.u;B=p.u-k.u;F=o.v-k.v;A=p.v-k.v;x=1/(u*A-B*F);s.set((A*m-F*r)*x,(A*n-F*q)*x,(A*t-F*w)*x);E.set((u*r-B*m)*x,(u*q-B*n)*x,(u*w-B*t)*x);v[b].addSelf(s);v[c].addSelf(s);v[d].addSelf(s);J[b].addSelf(E);J[c].addSelf(E);J[d].addSelf(E)}var c,b,d,g,f,e,h,i,l,k,o,p,m,r,n,q,t,w,u,B,F,A,x,y,v=[],J=[],s=new THREE.Vector3,E=new THREE.Vector3, +R=new THREE.Vector3,U=new THREE.Vector3,K=new THREE.Vector3;c=0;for(b=this.vertices.length;c<b;c++)v[c]=new THREE.Vector3,J[c]=new THREE.Vector3;c=0;for(b=this.faces.length;c<b;c++)f=this.faces[c],e=this.faceVertexUvs[0][c],f instanceof THREE.Face3?a(this,f.a,f.b,f.c,0,1,2):f instanceof THREE.Face4&&(a(this,f.a,f.b,f.c,0,1,2),a(this,f.a,f.b,f.d,0,1,3));var P=["a","b","c","d"];c=0;for(b=this.faces.length;c<b;c++){f=this.faces[c];for(d=0;d<f.vertexNormals.length;d++)K.copy(f.vertexNormals[d]),g=f[P[d]], +y=v[g],R.copy(y),R.subSelf(K.multiplyScalar(K.dot(y))).normalize(),U.cross(f.vertexNormals[d],y),g=U.dot(J[g]),g=g<0?-1:1,f.vertexTangents[d]=new THREE.Vector4(R.x,R.y,R.z,g)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,b=this.vertices.length;c<b;c++){a= +this.vertices[c];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a= +0,c=0,b=this.vertices.length;c<b;c++)a=Math.max(a,this.vertices[c].position.length());this.boundingSphere={radius:a}},mergeVertices:function(){var a={},c=[],b=[],d,g=Math.pow(10,4),f,e;f=0;for(e=this.vertices.length;f<e;f++)d=this.vertices[f].position,d=[Math.round(d.x*g),Math.round(d.y*g),Math.round(d.z*g)].join("_"),a[d]===void 0?(a[d]=f,c.push(this.vertices[f]),b[f]=c.length-1):b[f]=b[a[d]];f=0;for(e=this.faces.length;f<e;f++)if(a=this.faces[f],a instanceof THREE.Face3)a.a=b[a.a],a.b=b[a.b],a.c= +b[a.c];else if(a instanceof THREE.Face4)a.a=b[a.a],a.b=b[a.b],a.c=b[a.c],a.d=b[a.d];this.vertices=c}};THREE.GeometryCount=0; +THREE.Spline=function(a){function c(a,b,c,d,g,f,e){a=(c-a)*0.5;d=(d-b)*0.5;return(2*(b-c)+a+d)*e+(-3*(b-c)-2*a-d)*f+a*g+b}this.points=a;var b=[],d={x:0,y:0,z:0},g,f,e,h,i,l,k,o,p;this.initFromArray=function(a){this.points=[];for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}};this.getPoint=function(a){g=(this.points.length-1)*a;f=Math.floor(g);e=g-f;b[0]=f===0?f:f-1;b[1]=f;b[2]=f>this.points.length-2?f:f+1;b[3]=f>this.points.length-3?f:f+2;l=this.points[b[0]];k=this.points[b[1]]; +o=this.points[b[2]];p=this.points[b[3]];h=e*e;i=e*h;d.x=c(l.x,k.x,o.x,p.x,e,h,i);d.y=c(l.y,k.y,o.y,p.y,e,h,i);d.z=c(l.z,k.z,o.z,p.z,e,h,i);return d};this.getControlPointsArray=function(){var a,b,c=this.points.length,d=[];for(a=0;a<c;a++)b=this.points[a],d[a]=[b.x,b.y,b.z];return d};this.getLength=function(a){var b,c,d,g=b=b=0,f=new THREE.Vector3,e=new THREE.Vector3,h=[],i=0;h[0]=0;a||(a=100);c=this.points.length*a;f.copy(this.points[0]);for(a=1;a<c;a++)b=a/c,d=this.getPoint(b),e.copy(d),i+=e.distanceTo(f), +f.copy(d),b*=this.points.length-1,b=Math.floor(b),b!=g&&(h[b]=i,g=b);h[h.length]=i;return{chunks:h,total:i}};this.reparametrizeByArcLength=function(a){var b,c,d,g,f,e,h=[],i=new THREE.Vector3,k=this.getLength();h.push(i.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=k.chunks[b]-k.chunks[b-1];e=Math.ceil(a*c/k.total);g=(b-1)/(this.points.length-1);f=b/(this.points.length-1);for(c=1;c<e-1;c++)d=g+c*(1/e)*(f-g),d=this.getPoint(d),h.push(i.copy(d).clone());h.push(i.copy(this.points[b]).clone())}this.points= h}};THREE.Edge=function(a,c,b,d){this.vertices=[a,c];this.vertexIndices=[b,d];this.faces=[];this.faceIndices=[]};THREE.Camera=function(){if(arguments.length)return console.warn("DEPRECATED: Camera() is now PerspectiveCamera() or OrthographicCamera()."),new THREE.PerspectiveCamera(arguments[0],arguments[1],arguments[2],arguments[3]);THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4;this.projectionMatrixInverse=new THREE.Matrix4}; THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.lookAt=function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)};THREE.OrthographicCamera=function(a,c,b,d,g,f){THREE.Camera.call(this);this.left=a;this.right=c;this.top=b;this.bottom=d;this.near=g!==void 0?g:0.1;this.far=f!==void 0?f:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera; THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera;THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makeOrtho(this.left,this.right,this.top,this.bottom,this.near,this.far)};THREE.PerspectiveCamera=function(a,c,b,d){THREE.Camera.call(this);this.fov=a!==void 0?a:50;this.aspect=c!==void 0?c:1;this.near=b!==void 0?b:0.1;this.far=d!==void 0?d:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=new THREE.Camera; @@ -153,10 +153,10 @@ THREE.CanvasRenderer=function(a){function c(a){if(w!=a)n.globalAlpha=w=a}functio o,p,m,r,n=k.getContext("2d"),q=new THREE.Color(0),t=0,w=1,u=0,B=null,F=null,A=null,x=null,y=null,v,J,s,E,R=new THREE.RenderableVertex,U=new THREE.RenderableVertex,K,P,O,aa,H,G,I,M,S,ba,W,j,X=new THREE.Color,V=new THREE.Color,da=new THREE.Color,ga=new THREE.Color,$=new THREE.Color,ua=[],ra=[],qa,na,oa,pa,Da,za,Aa,Ba,L,Z,Q=new THREE.Rectangle,ea=new THREE.Rectangle,ha=new THREE.Rectangle,N=!1,ca=new THREE.Color,la=new THREE.Color,ma=new THREE.Color,fa=new THREE.Vector3,Y,xa,va,ta,T,wa,a=16;Y=document.createElement("canvas"); Y.width=Y.height=2;xa=Y.getContext("2d");xa.fillStyle="rgba(0,0,0,1)";xa.fillRect(0,0,2,2);va=xa.getImageData(0,0,2,2);ta=va.data;T=document.createElement("canvas");T.width=T.height=a;wa=T.getContext("2d");wa.translate(-a/2,-a/2);wa.scale(a,a);a--;this.domElement=k;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){o=a;p=b;m=Math.floor(o/2);r=Math.floor(p/2);k.width=o;k.height=p;Q.set(-m,-r,m,r);ea.set(-m,-r,m,r);w=1;u=0;y=x=A=F= B=null};this.setClearColor=function(a,b){q.copy(a);t=b;ea.set(-m,-r,m,r)};this.setClearColorHex=function(a,b){q.setHex(a);t=b;ea.set(-m,-r,m,r)};this.clear=function(){n.setTransform(1,0,0,-1,m,r);ea.isEmpty()||(ea.minSelf(Q),ea.inflate(2),t<1&&n.clearRect(Math.floor(ea.getX()),Math.floor(ea.getY()),Math.floor(ea.getWidth()),Math.floor(ea.getHeight())),t>0&&(b(THREE.NormalBlending),c(1),g("rgba("+Math.floor(q.r*255)+","+Math.floor(q.g*255)+","+Math.floor(q.b*255)+","+t+")"),n.fillRect(Math.floor(ea.getX()), -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<c;b++)d=a[b],f=d.color,d instanceof THREE.AmbientLight?(ca.r+=f.r,ca.g+=f.g,ca.b+=f.b):d instanceof THREE.DirectionalLight?(la.r+=f.r,la.g+=f.g,la.b+=f.b):d instanceof THREE.PointLight&&(ma.r+=f.r,ma.g+=f.g,ma.b+=f.b)}function o(a,b,c,d){var f,g,e,j,h,i;f=0;for(g=a.length;f<g;f++)e=a[f], +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,g;ca.setRGB(0,0,0);la.setRGB(0,0,0);ma.setRGB(0,0,0);b=0;for(c=a.length;b<c;b++)d=a[b],g=d.color,d instanceof THREE.AmbientLight?(ca.r+=g.r,ca.g+=g.g,ca.b+=g.b):d instanceof THREE.DirectionalLight?(la.r+=g.r,la.g+=g.g,la.b+=g.b):d instanceof THREE.PointLight&&(ma.r+=g.r,ma.g+=g.g,ma.b+=g.b)}function o(a,b,c,d){var g,f,e,j,h,i;g=0;for(f=a.length;g<f;g++)e=a[g], j=e.color,e instanceof THREE.DirectionalLight?(h=e.matrixWorld.getPosition(),i=c.dot(h),i<=0||(i*=e.intensity,d.r+=j.r*i,d.g+=j.g*i,d.b+=j.b*i)):e instanceof THREE.PointLight&&(h=e.matrixWorld.getPosition(),i=c.dot(fa.sub(h,b).normalize()),i<=0||(i*=e.distance==0?1:1-Math.min(b.distanceTo(h)/e.distance,1),i!=0&&(i*=e.intensity,d.r+=j.r*i,d.g+=j.g*i,d.b+=j.b*i)))}function q(a,f,e){c(e.opacity);b(e.blending);var j,h,i,k,l,ia;if(e instanceof THREE.ParticleBasicMaterial){if(e.map)k=e.map.image,l=k.width>> 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,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; +function t(a,g,f,e){c(e.opacity);b(e.blending);n.beginPath();n.moveTo(a.positionScreen.x,a.positionScreen.y);n.lineTo(g.positionScreen.x,g.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, @@ -167,17 +167,17 @@ aa=d.positionScreen.y,H=g.positionScreen.x,G=g.positionScreen.y,I=e.positionScre 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; +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,g,e){n.beginPath();n.moveTo(a,b);n.lineTo(c,d);n.lineTo(g,e);n.lineTo(a,b);n.closePath()}function Ia(a,b,c,d,g,e,f,j){n.beginPath();n.moveTo(a,b);n.lineTo(c, +d);n.lineTo(g,e);n.lineTo(f,j);n.lineTo(a,b);n.closePath()}function u(a,b,c,g){if(A!=b)n.lineWidth=A=b;if(x!=c)n.lineCap=x=c;if(y!=g)n.lineJoin=y=g;d(a.getContextStyle());n.stroke();ha.inflate(b*2)}function Ca(a){g(a.getContextStyle());n.fill()}function Ka(a,b,c,d,e,f,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;e-=a;f-=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*e)*o,m=(l*d-m*f)*o,c=(i*e-k*c)*o,d=(i*f-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,g,e,f,j,h,i,m,k,l){var ia,o;ia=l.width-1;o=l.height-1;f*=ia;j*=o;h*=ia;i*=o;m*=ia;k*=o;c-=a;d-=b;g-=a;e-=b;h-=f;i-=j;m-=f;k-=j;o=1/(h*k-m*i);ia=(k*c-i*g)*o;i=(k*d-i*e)*o;c=(h*g-m*c)*o;d=(h*e-m*d)*o;a=a-ia*f-c*j;b=b-i*f-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 g=~~(a.r*255),e=~~(a.g*255),a=~~(a.b*255),f=~~(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]=g<0?0:g>255?255:g;ta[1]=e<0?0:e>255?255:e;ta[2]=a<0?0:a>255?255:a;ta[4]=f<0?0:f>255?255:f;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,g=c*c+d*d;g!=0&&(g=1/Math.sqrt(g),c*=g,d*=g,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;Ja<La;Ja++)if(sa=h[Ja],D=sa.material,D=D instanceof THREE.MeshFaceMaterial?sa.faceMaterial:D,!(D==null||D.opacity==0)){ha.empty();if(sa instanceof THREE.RenderableParticle)v=sa,v.x*=m,v.y*=r,q(v,sa,D,a);else if(sa instanceof THREE.RenderableLine)v=sa.v1,J=sa.v2,v.positionScreen.x*=m,v.positionScreen.y*=r,J.positionScreen.x*=m,J.positionScreen.y*=r,ha.addPoint(v.positionScreen.x,v.positionScreen.y),ha.addPoint(J.positionScreen.x,J.positionScreen.y),Q.intersects(ha)&& t(v,J,sa,D,a);else if(sa instanceof THREE.RenderableFace3)v=sa.v1,J=sa.v2,s=sa.v3,v.positionScreen.x*=m,v.positionScreen.y*=r,J.positionScreen.x*=m,J.positionScreen.y*=r,s.positionScreen.x*=m,s.positionScreen.y*=r,D.overdraw&&(Ea(v.positionScreen,J.positionScreen),Ea(J.positionScreen,s.positionScreen),Ea(s.positionScreen,v.positionScreen)),ha.add3Points(v.positionScreen.x,v.positionScreen.y,J.positionScreen.x,J.positionScreen.y,s.positionScreen.x,s.positionScreen.y),Q.intersects(ha)&&w(v,J,s,0,1, 2,sa,D,a);else if(sa instanceof THREE.RenderableFace4)v=sa.v1,J=sa.v2,s=sa.v3,E=sa.v4,v.positionScreen.x*=m,v.positionScreen.y*=r,J.positionScreen.x*=m,J.positionScreen.y*=r,s.positionScreen.x*=m,s.positionScreen.y*=r,E.positionScreen.x*=m,E.positionScreen.y*=r,R.positionScreen.copy(J.positionScreen),U.positionScreen.copy(E.positionScreen),D.overdraw&&(Ea(v.positionScreen,J.positionScreen),Ea(J.positionScreen,E.positionScreen),Ea(E.positionScreen,v.positionScreen),Ea(s.positionScreen,R.positionScreen), Ea(s.positionScreen,U.positionScreen)),ha.addPoint(v.positionScreen.x,v.positionScreen.y),ha.addPoint(J.positionScreen.x,J.positionScreen.y),ha.addPoint(s.positionScreen.x,s.positionScreen.y),ha.addPoint(E.positionScreen.x,E.positionScreen.y),Q.intersects(ha)&&Ma(v,J,s,E,R,U,sa,D,a);ea.addRectangle(ha)}n.setTransform(1,0,0,1,0,0)}}; -THREE.SVGRenderer=function(){function a(a,b,c,d){var f,g,e,h,i,m;f=0;for(g=a.length;f<g;f++)e=a[f],h=e.color,e instanceof THREE.DirectionalLight?(i=e.matrixWorld.getPosition(),m=c.dot(i),m<=0||(m*=e.intensity,d.r+=h.r*m,d.g+=h.g*m,d.b+=h.b*m)):e instanceof THREE.PointLight&&(i=e.matrixWorld.getPosition(),m=c.dot(v.sub(i,b).normalize()),m<=0||(m*=e.distance==0?1:1-Math.min(b.distanceTo(i)/e.distance,1),m!=0&&(m*=e.intensity,d.r+=h.r*m,d.g+=h.g*m,d.b+=h.b*m)))}function c(a){J[a]==null&&(J[a]=document.createElementNS("http://www.w3.org/2000/svg", +THREE.SVGRenderer=function(){function a(a,b,c,d){var g,e,f,h,i,m;g=0;for(e=a.length;g<e;g++)f=a[g],h=f.color,f instanceof THREE.DirectionalLight?(i=f.matrixWorld.getPosition(),m=c.dot(i),m<=0||(m*=f.intensity,d.r+=h.r*m,d.g+=h.g*m,d.b+=h.b*m)):f instanceof THREE.PointLight&&(i=f.matrixWorld.getPosition(),m=c.dot(v.sub(i,b).normalize()),m<=0||(m*=f.distance==0?1:1-Math.min(b.distanceTo(i)/f.distance,1),m!=0&&(m*=f.intensity,d.r+=h.r*m,d.g+=h.g*m,d.b+=h.b*m)))}function c(a){J[a]==null&&(J[a]=document.createElementNS("http://www.w3.org/2000/svg", "path"),K==0&&J[a].setAttribute("shape-rendering","crispEdges"));return J[a]}function b(a){a=(a+1)*0.5;return a<0?0:a>1?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(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<v;J++)I=e[J],G=I.color,I instanceof THREE.AmbientLight?(F.r+=G.r,F.g+=G.g,F.b+=G.b):I instanceof THREE.DirectionalLight?(A.r+=G.r,A.g+=G.g,A.b+=G.b):I instanceof THREE.PointLight&&(x.r+=G.r,x.g+=G.g,x.b+=G.b)}J=0;for(v=f.length;J<v;J++)if(G=f[J],I=G.material,I=I instanceof THREE.MeshFaceMaterial?G.faceMaterial:I,!(I==null||I.opacity==0))if(w.empty(),G instanceof THREE.RenderableParticle)m=G,m.x*= @@ -222,41 +222,41 @@ THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.lights_phong_fragment,THR THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;",THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment, THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},depthRGBA:{uniforms:{},vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.morphtarget_vertex, THREE.ShaderChunk.default_vertex,"}"].join("\n"),fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}"}}; -THREE.WebGLRenderer=function(a){function c(a,b){var c=a.vertices.length,d=b.material;if(d.attributes){if(a.__webglCustomAttributesList===void 0)a.__webglCustomAttributesList=[];for(var f in d.attributes){var e=d.attributes[f];if(!e.__webglInitialized||e.createUniqueBuffers){e.__webglInitialized=!0;var g=1;e.type==="v2"?g=2:e.type==="v3"?g=3:e.type==="v4"?g=4:e.type==="c"&&(g=3);e.size=g;e.array=new Float32Array(c*g);e.buffer=j.createBuffer();e.buffer.belongsToAttribute=f;e.needsUpdate=!0}a.__webglCustomAttributesList.push(e)}}} +THREE.WebGLRenderer=function(a){function c(a,b){var c=a.vertices.length,d=b.material;if(d.attributes){if(a.__webglCustomAttributesList===void 0)a.__webglCustomAttributesList=[];for(var g in d.attributes){var f=d.attributes[g];if(!f.__webglInitialized||f.createUniqueBuffers){f.__webglInitialized=!0;var e=1;f.type==="v2"?e=2:f.type==="v3"?e=3:f.type==="v4"?e=4:f.type==="c"&&(e=3);f.size=e;f.array=new Float32Array(c*e);f.buffer=j.createBuffer();f.buffer.belongsToAttribute=g;f.needsUpdate=!0}a.__webglCustomAttributesList.push(f)}}} function b(a,b){if(a.material&&!(a.material instanceof THREE.MeshFaceMaterial))return a.material;else if(b.materialIndex>=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,k=a.__vertexArray,n=a.__colorArray,l=a.__sortArray,o=a.__dirtyVertices,p=a.__dirtyColors,L=a.__webglCustomAttributesList;if(c.sortParticles){N.multiplySelf(c.matrixWorld);for(d=0;d<g;d++)f=h[d].position,ma.copy(f),N.multiplyVector3(ma),l[d]=[ma.z,d];l.sort(function(a,b){return b[0]-a[0]});for(d=0;d<g;d++)f=h[l[d][1]].position,e=d*3,k[e]=f.x,k[e+1]=f.y,k[e+2]=f.z;for(d=0;d<m;d++)e=d*3,f=i[l[d][1]],n[e]=f.r,n[e+ -1]=f.g,n[e+2]=f.b;if(L){i=0;for(m=L.length;i<m;i++)if(h=L[i],h.boundTo===void 0||h.boundTo==="vertices")if(e=0,f=h.value.length,h.size===1)for(d=0;d<f;d++)g=l[d][1],h.array[d]=h.value[g];else if(h.size===2)for(d=0;d<f;d++)g=l[d][1],g=h.value[g],h.array[e]=g.x,h.array[e+1]=g.y,e+=2;else if(h.size===3)if(h.type==="c")for(d=0;d<f;d++)g=l[d][1],g=h.value[g],h.array[e]=g.r,h.array[e+1]=g.g,h.array[e+2]=g.b,e+=3;else for(d=0;d<f;d++)g=l[d][1],g=h.value[g],h.array[e]=g.x,h.array[e+1]=g.y,h.array[e+2]=g.z, -e+=3;else if(h.size===4)for(d=0;d<f;d++)g=l[d][1],g=h.value[g],h.array[e]=g.x,h.array[e+1]=g.y,h.array[e+2]=g.z,h.array[e+3]=g.w,e+=4}}else{if(o)for(d=0;d<g;d++)f=h[d].position,e=d*3,k[e]=f.x,k[e+1]=f.y,k[e+2]=f.z;if(p)for(d=0;d<m;d++)f=i[d],e=d*3,n[e]=f.r,n[e+1]=f.g,n[e+2]=f.b;if(L){i=0;for(m=L.length;i<m;i++)if(h=L[i],h.needsUpdate&&(h.boundTo===void 0||h.boundTo==="vertices"))if(f=h.value.length,e=0,h.size===1)for(d=0;d<f;d++)h.array[d]=h.value[d];else if(h.size===2)for(d=0;d<f;d++)g=h.value[d], -h.array[e]=g.x,h.array[e+1]=g.y,e+=2;else if(h.size===3)if(h.type==="c")for(d=0;d<f;d++)g=h.value[d],h.array[e]=g.r,h.array[e+1]=g.g,h.array[e+2]=g.b,e+=3;else for(d=0;d<f;d++)g=h.value[d],h.array[e]=g.x,h.array[e+1]=g.y,h.array[e+2]=g.z,e+=3;else if(h.size===4)for(d=0;d<f;d++)g=h.value[d],h.array[e]=g.x,h.array[e+1]=g.y,h.array[e+2]=g.z,h.array[e+3]=g.w,e+=4}}if(o||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,a.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,k,b);if(p||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER, +return!1}function e(a,b,c){var d,g,f,e,h=a.vertices;e=h.length;var i=a.colors,m=i.length,k=a.__vertexArray,n=a.__colorArray,l=a.__sortArray,o=a.__dirtyVertices,p=a.__dirtyColors,L=a.__webglCustomAttributesList;if(c.sortParticles){N.multiplySelf(c.matrixWorld);for(d=0;d<e;d++)g=h[d].position,ma.copy(g),N.multiplyVector3(ma),l[d]=[ma.z,d];l.sort(function(a,b){return b[0]-a[0]});for(d=0;d<e;d++)g=h[l[d][1]].position,f=d*3,k[f]=g.x,k[f+1]=g.y,k[f+2]=g.z;for(d=0;d<m;d++)f=d*3,g=i[l[d][1]],n[f]=g.r,n[f+ +1]=g.g,n[f+2]=g.b;if(L){i=0;for(m=L.length;i<m;i++)if(h=L[i],h.boundTo===void 0||h.boundTo==="vertices")if(f=0,g=h.value.length,h.size===1)for(d=0;d<g;d++)e=l[d][1],h.array[d]=h.value[e];else if(h.size===2)for(d=0;d<g;d++)e=l[d][1],e=h.value[e],h.array[f]=e.x,h.array[f+1]=e.y,f+=2;else if(h.size===3)if(h.type==="c")for(d=0;d<g;d++)e=l[d][1],e=h.value[e],h.array[f]=e.r,h.array[f+1]=e.g,h.array[f+2]=e.b,f+=3;else for(d=0;d<g;d++)e=l[d][1],e=h.value[e],h.array[f]=e.x,h.array[f+1]=e.y,h.array[f+2]=e.z, +f+=3;else if(h.size===4)for(d=0;d<g;d++)e=l[d][1],e=h.value[e],h.array[f]=e.x,h.array[f+1]=e.y,h.array[f+2]=e.z,h.array[f+3]=e.w,f+=4}}else{if(o)for(d=0;d<e;d++)g=h[d].position,f=d*3,k[f]=g.x,k[f+1]=g.y,k[f+2]=g.z;if(p)for(d=0;d<m;d++)g=i[d],f=d*3,n[f]=g.r,n[f+1]=g.g,n[f+2]=g.b;if(L){i=0;for(m=L.length;i<m;i++)if(h=L[i],h.needsUpdate&&(h.boundTo===void 0||h.boundTo==="vertices"))if(g=h.value.length,f=0,h.size===1)for(d=0;d<g;d++)h.array[d]=h.value[d];else if(h.size===2)for(d=0;d<g;d++)e=h.value[d], +h.array[f]=e.x,h.array[f+1]=e.y,f+=2;else if(h.size===3)if(h.type==="c")for(d=0;d<g;d++)e=h.value[d],h.array[f]=e.r,h.array[f+1]=e.g,h.array[f+2]=e.b,f+=3;else for(d=0;d<g;d++)e=h.value[d],h.array[f]=e.x,h.array[f+1]=e.y,h.array[f+2]=e.z,f+=3;else if(h.size===4)for(d=0;d<g;d++)e=h.value[d],h.array[f]=e.x,h.array[f+1]=e.y,h.array[f+2]=e.z,h.array[f+3]=e.w,f+=4}}if(o||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,a.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,k,b);if(p||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER, a.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,n,b);if(L){i=0;for(m=L.length;i<m;i++)if(h=L[i],h.needsUpdate||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,h.buffer),j.bufferData(j.ARRAY_BUFFER,h.array,b)}}function h(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=j.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=j.createBuffer();a.hasPos&&(j.bindBuffer(j.ARRAY_BUFFER,a.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,a.positionArray,j.DYNAMIC_DRAW),j.enableVertexAttribArray(b.attributes.position), -j.vertexAttribPointer(b.attributes.position,3,j.FLOAT,!1,0,0));if(a.hasNormal){j.bindBuffer(j.ARRAY_BUFFER,a.__webglNormalBuffer);if(c===THREE.FlatShading){var d,f,e,g,h,i,m,k,n,l,o=a.count*3;for(l=0;l<o;l+=9)c=a.normalArray,d=c[l],f=c[l+1],e=c[l+2],g=c[l+3],i=c[l+4],k=c[l+5],h=c[l+6],m=c[l+7],n=c[l+8],d=(d+g+h)/3,f=(f+i+m)/3,e=(e+k+n)/3,c[l]=d,c[l+1]=f,c[l+2]=e,c[l+3]=d,c[l+4]=f,c[l+5]=e,c[l+6]=d,c[l+7]=f,c[l+8]=e}j.bufferData(j.ARRAY_BUFFER,a.normalArray,j.DYNAMIC_DRAW);j.enableVertexAttribArray(b.attributes.normal); -j.vertexAttribPointer(b.attributes.normal,3,j.FLOAT,!1,0,0)}j.drawArrays(j.TRIANGLES,0,a.count);a.count=0}function i(a,b,c,d,f,e){if(d.opacity!==0){var g,h,c=u(a,b,c,d,e),b=c.attributes,a=!1,c=f.id*16777215+c.id*2+(d.wireframe?1:0);c!==$&&($=c,a=!0);if(!d.morphTargets&&b.position>=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;g<d.numSupportedMorphTargets&&g<i.length;)j.bindBuffer(j.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[i[g]]),j.vertexAttribPointer(c["morphTarget"+g],3,j.FLOAT,!1,0,0),e.__webglMorphTargetInfluences[g]=h[i[g]],g++}else{var i=[],m=-1, -l=0;h=e.morphTargetInfluences;var k,n=h.length;g=0;for(e.morphTargetBase!==-1&&(i[e.morphTargetBase]=!0);g<d.numSupportedMorphTargets;){for(k=0;k<n;k++)!i[k]&&h[k]>m&&(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<h;g++)c=f.__webglCustomAttributesList[g],b[c.buffer.belongsToAttribute]>=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? -(d=d.wireframeLinewidth,d!==Ba&&(j.lineWidth(d),Ba=d),a&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,f.__webglLineBuffer),j.drawElements(j.LINES,f.__webglLineCount,j.UNSIGNED_SHORT,0)):(a&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,f.__webglFaceBuffer),j.drawElements(j.TRIANGLES,f.__webglFaceCount,j.UNSIGNED_SHORT,0)),W.info.render.calls++,W.info.render.vertices+=f.__webglFaceCount,W.info.render.faces+=f.__webglFaceCount/3):e instanceof THREE.Line?(e=e.type===THREE.LineStrip?j.LINE_STRIP:j.LINES,d=d.linewidth,d!== -Ba&&(j.lineWidth(d),Ba=d),j.drawArrays(e,0,f.__webglLineCount),W.info.render.calls++):e instanceof THREE.ParticleSystem?(j.drawArrays(j.POINTS,0,f.__webglParticleCount),W.info.render.calls++):e instanceof THREE.Ribbon&&(j.drawArrays(j.TRIANGLE_STRIP,0,f.__webglVertexCount),W.info.render.calls++)}}function l(a){ha[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);ha[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);ha[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);ha[3].set(a.n41- +j.vertexAttribPointer(b.attributes.position,3,j.FLOAT,!1,0,0));if(a.hasNormal){j.bindBuffer(j.ARRAY_BUFFER,a.__webglNormalBuffer);if(c===THREE.FlatShading){var d,g,f,e,h,i,m,k,n,l,o=a.count*3;for(l=0;l<o;l+=9)c=a.normalArray,d=c[l],g=c[l+1],f=c[l+2],e=c[l+3],i=c[l+4],k=c[l+5],h=c[l+6],m=c[l+7],n=c[l+8],d=(d+e+h)/3,g=(g+i+m)/3,f=(f+k+n)/3,c[l]=d,c[l+1]=g,c[l+2]=f,c[l+3]=d,c[l+4]=g,c[l+5]=f,c[l+6]=d,c[l+7]=g,c[l+8]=f}j.bufferData(j.ARRAY_BUFFER,a.normalArray,j.DYNAMIC_DRAW);j.enableVertexAttribArray(b.attributes.normal); +j.vertexAttribPointer(b.attributes.normal,3,j.FLOAT,!1,0,0)}j.drawArrays(j.TRIANGLES,0,a.count);a.count=0}function i(a,b,c,d,g,f){if(d.opacity!==0){var e,h,c=u(a,b,c,d,f),b=c.attributes,a=!1,c=g.id*16777215+c.id*2+(d.wireframe?1:0);c!==$&&($=c,a=!0);if(!d.morphTargets&&b.position>=0)a&&(j.bindBuffer(j.ARRAY_BUFFER,g.__webglVertexBuffer),j.vertexAttribPointer(b.position,3,j.FLOAT,!1,0,0));else if(f.morphTargetBase){c=d.program.attributes;f.morphTargetBase!==-1?(j.bindBuffer(j.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[f.morphTargetBase]), +j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0)):c.position>=0&&(j.bindBuffer(j.ARRAY_BUFFER,g.__webglVertexBuffer),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0));if(f.morphTargetForcedOrder.length){e=0;var i=f.morphTargetForcedOrder;for(h=f.morphTargetInfluences;e<d.numSupportedMorphTargets&&e<i.length;)j.bindBuffer(j.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[i[e]]),j.vertexAttribPointer(c["morphTarget"+e],3,j.FLOAT,!1,0,0),f.__webglMorphTargetInfluences[e]=h[i[e]],e++}else{var i=[],m=-1, +l=0;h=f.morphTargetInfluences;var k,n=h.length;e=0;for(f.morphTargetBase!==-1&&(i[f.morphTargetBase]=!0);e<d.numSupportedMorphTargets;){for(k=0;k<n;k++)!i[k]&&h[k]>m&&(l=k,m=h[l]);j.bindBuffer(j.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[l]);j.vertexAttribPointer(c["morphTarget"+e],3,j.FLOAT,!1,0,0);f.__webglMorphTargetInfluences[e]=m;i[l]=1;m=-1;e++}}d.program.uniforms.morphTargetInfluences!==null&&j.uniform1fv(d.program.uniforms.morphTargetInfluences,f.__webglMorphTargetInfluences)}if(a){if(g.__webglCustomAttributesList){e= +0;for(h=g.__webglCustomAttributesList.length;e<h;e++)c=g.__webglCustomAttributesList[e],b[c.buffer.belongsToAttribute]>=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,g.__webglColorBuffer),j.vertexAttribPointer(b.color,3,j.FLOAT,!1,0,0));b.normal>=0&&(j.bindBuffer(j.ARRAY_BUFFER,g.__webglNormalBuffer),j.vertexAttribPointer(b.normal,3,j.FLOAT,!1,0,0));b.tangent>=0&&(j.bindBuffer(j.ARRAY_BUFFER, +g.__webglTangentBuffer),j.vertexAttribPointer(b.tangent,4,j.FLOAT,!1,0,0));b.uv>=0&&(g.__webglUVBuffer?(j.bindBuffer(j.ARRAY_BUFFER,g.__webglUVBuffer),j.vertexAttribPointer(b.uv,2,j.FLOAT,!1,0,0),j.enableVertexAttribArray(b.uv)):j.disableVertexAttribArray(b.uv));b.uv2>=0&&(g.__webglUV2Buffer?(j.bindBuffer(j.ARRAY_BUFFER,g.__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,g.__webglSkinVertexABuffer),j.vertexAttribPointer(b.skinVertexA,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,g.__webglSkinVertexBBuffer),j.vertexAttribPointer(b.skinVertexB,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,g.__webglSkinIndicesBuffer),j.vertexAttribPointer(b.skinIndex,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,g.__webglSkinWeightsBuffer),j.vertexAttribPointer(b.skinWeight,4,j.FLOAT,!1,0,0))}f instanceof THREE.Mesh?(d.wireframe? +(d=d.wireframeLinewidth,d!==Ba&&(j.lineWidth(d),Ba=d),a&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,g.__webglLineBuffer),j.drawElements(j.LINES,g.__webglLineCount,j.UNSIGNED_SHORT,0)):(a&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,g.__webglFaceBuffer),j.drawElements(j.TRIANGLES,g.__webglFaceCount,j.UNSIGNED_SHORT,0)),W.info.render.calls++,W.info.render.vertices+=g.__webglFaceCount,W.info.render.faces+=g.__webglFaceCount/3):f instanceof THREE.Line?(f=f.type===THREE.LineStrip?j.LINE_STRIP:j.LINES,d=d.linewidth,d!== +Ba&&(j.lineWidth(d),Ba=d),j.drawArrays(f,0,g.__webglLineCount),W.info.render.calls++):f instanceof THREE.ParticleSystem?(j.drawArrays(j.POINTS,0,g.__webglParticleCount),W.info.render.calls++):f instanceof THREE.Ribbon&&(j.drawArrays(j.TRIANGLE_STRIP,0,g.__webglVertexCount),W.info.render.calls++)}}function l(a){ha[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);ha[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);ha[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);ha[3].set(a.n41- 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.n43-a.n33,a.n44-a.n34);ha[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(var b,a=0;a<6;a++)b=ha[a],b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}function k(a){for(var b=a.matrixWorld,c=-a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)),d=0;d<6;d++)if(a=ha[d].x*b.n14+ha[d].y*b.n24+ha[d].z*b.n34+ha[d].w,a<=c)return!1;return!0}function o(a,b){return b.z-a.z}function p(a){var b, -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<c;b++)if(n=p[b],n.castShadow&&n instanceof THREE.SpotLight){ga=-1;W.shadowMap[o]||(W.shadowMap[o]=new THREE.WebGLRenderTarget(W.shadowMapWidth,W.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}),xa[o]=new THREE.Matrix4);d=W.shadowMap[o];f=xa[o];Y.position.copy(n.position);Y.lookAt(n.target.position); -Y.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),a.add(Y),this.autoUpdateScene&&a.updateMatrixWorld());Y.matrixWorldInverse.getInverse(Y.matrixWorld);f.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);f.multiplySelf(Y.projectionMatrix);f.multiplySelf(Y.matrixWorldInverse);Y.matrixWorldInverse.flattenToArray(la);Y.projectionMatrix.flattenToArray(ca);N.multiply(Y.projectionMatrix,Y.matrixWorldInverse);l(N);U(d);j.clearColor(1,1,1,1);W.clear();j.clearColor(M.r,M.g,M.b,S);f=a.__webglObjects.length; -for(d=0;d<f;d++)if(g=a.__webglObjects[d],n=g.object,g.render=!1,n.visible&&n.castShadow&&(!(n instanceof THREE.Mesh)||!n.frustumCulled||k(n)))n.matrixWorld.flattenToArray(n._objectMatrixArray),B(n,Y,!1),g.render=!0;A(!0);v(THREE.NormalBlending);for(d=0;d<f;d++)if(g=a.__webglObjects[d],g.render)n=g.object,g=g.buffer,F(n),m=n.customDepthMaterial?n.customDepthMaterial:n.geometry.morphTargets.length?ta:va,i(Y,p,null,m,g,n);f=a.__webglObjectsImmediate.length;for(d=0;d<f;d++)g=a.__webglObjectsImmediate[d], -n=g.object,n.visible&&n.castShadow&&(n.matrixAutoUpdate&&n.matrixWorld.flattenToArray(n._objectMatrixArray),$=-1,B(n,Y,!1),F(n),e=u(Y,p,null,va,n),n.immediateRenderCallback?n.immediateRenderCallback(e,j,ha):n.render(function(a){h(a,e,va.shading)}));o++}}function m(a,b,c,d,f,e,g,h){var j,m,n,l;b?(m=a.length-1,l=b=-1):(m=0,b=a.length,l=1);for(var k=m;k!==b;k+=l)if(j=a[k],j.render){m=j.object;n=j.buffer;if(h)j=h;else{j=j[c];if(!j)continue;g&&v(j.blending);A(j.depthTest);x(j.depthWrite);y(j.polygonOffset, -j.polygonOffsetFactor,j.polygonOffsetUnits)}F(m);i(d,f,e,j,n,m)}}function r(a,b,c,d,f,e,g){for(var i,m,n,l,k=0,o=a.length;k<o;k++)if(i=a[k],m=i.object,m.visible){$=-1;if(g)n=g;else{n=i[b];if(!n)continue;e&&v(n.blending);A(n.depthTest);x(n.depthWrite);y(n.polygonOffset,n.polygonOffsetFactor,n.polygonOffsetUnits)}F(m);l=u(c,d,f,n,m);m.immediateRenderCallback?m.immediateRenderCallback(l,j,ha):m.render(function(a){h(a,l,n.shading)})}}function n(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})} -function q(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function t(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function w(a,b){for(var c=a.length-1;c>=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<g;e++)f.__webglMorphTargetInfluences[e]=0}var h=!1,e=d.program, -g=e.uniforms,i=d.uniforms;e!==V&&(j.useProgram(e),V=e,h=!0);if(d.id!==ga)ga=d.id,h=!0;if(h){j.uniformMatrix4fv(g.projectionMatrix,!1,ca);if(c&&d.fog)if(i.fogColor.value=c.color,c instanceof THREE.Fog)i.fogNear.value=c.near,i.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)i.fogDensity.value=c.density;if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){for(var m,n,l=0,k=0,o=0,p,L,q,r=fa,t=r.directional.colors,Q=r.directional.positions,Z=r.point.colors,w= +c,d,g,f,e,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<c;b++)if(n=p[b],n.castShadow&&n instanceof THREE.SpotLight){ga=-1;W.shadowMap[o]||(W.shadowMap[o]=new THREE.WebGLRenderTarget(W.shadowMapWidth,W.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}),xa[o]=new THREE.Matrix4);d=W.shadowMap[o];g=xa[o];Y.position.copy(n.position);Y.lookAt(n.target.position); +Y.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),a.add(Y),this.autoUpdateScene&&a.updateMatrixWorld());Y.matrixWorldInverse.getInverse(Y.matrixWorld);g.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);g.multiplySelf(Y.projectionMatrix);g.multiplySelf(Y.matrixWorldInverse);Y.matrixWorldInverse.flattenToArray(la);Y.projectionMatrix.flattenToArray(ca);N.multiply(Y.projectionMatrix,Y.matrixWorldInverse);l(N);U(d);j.clearColor(1,1,1,1);W.clear();j.clearColor(M.r,M.g,M.b,S);g=a.__webglObjects.length; +for(d=0;d<g;d++)if(e=a.__webglObjects[d],n=e.object,e.render=!1,n.visible&&n.castShadow&&(!(n instanceof THREE.Mesh)||!n.frustumCulled||k(n)))n.matrixWorld.flattenToArray(n._objectMatrixArray),B(n,Y,!1),e.render=!0;A(!0);v(THREE.NormalBlending);for(d=0;d<g;d++)if(e=a.__webglObjects[d],e.render)n=e.object,e=e.buffer,F(n),m=n.customDepthMaterial?n.customDepthMaterial:n.geometry.morphTargets.length?ta:va,i(Y,p,null,m,e,n);g=a.__webglObjectsImmediate.length;for(d=0;d<g;d++)e=a.__webglObjectsImmediate[d], +n=e.object,n.visible&&n.castShadow&&(n.matrixAutoUpdate&&n.matrixWorld.flattenToArray(n._objectMatrixArray),$=-1,B(n,Y,!1),F(n),f=u(Y,p,null,va,n),n.immediateRenderCallback?n.immediateRenderCallback(f,j,ha):n.render(function(a){h(a,f,va.shading)}));o++}}function m(a,b,c,d,g,f,e,h){var j,m,n,l;b?(m=a.length-1,l=b=-1):(m=0,b=a.length,l=1);for(var k=m;k!==b;k+=l)if(j=a[k],j.render){m=j.object;n=j.buffer;if(h)j=h;else{j=j[c];if(!j)continue;e&&v(j.blending);A(j.depthTest);x(j.depthWrite);y(j.polygonOffset, +j.polygonOffsetFactor,j.polygonOffsetUnits)}F(m);i(d,g,f,j,n,m)}}function r(a,b,c,d,g,f,e){for(var i,m,n,l,k=0,o=a.length;k<o;k++)if(i=a[k],m=i.object,m.visible){$=-1;if(e)n=e;else{n=i[b];if(!n)continue;f&&v(n.blending);A(n.depthTest);x(n.depthWrite);y(n.polygonOffset,n.polygonOffsetFactor,n.polygonOffsetUnits)}F(m);l=u(c,d,g,n,m);m.immediateRenderCallback?m.immediateRenderCallback(l,j,ha):m.render(function(a){h(a,l,n.shading)})}}function n(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})} +function q(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function t(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function w(a,b){for(var c=a.length-1;c>=0;c--)a[c].object===b&&a.splice(c,1)}function u(a,b,c,d,g){d.program||W.initMaterial(d,b,c,g);if(d.morphTargets&&!g.__webglMorphTargetInfluences){g.__webglMorphTargetInfluences=new Float32Array(W.maxMorphTargets);for(var f=0,e=W.maxMorphTargets;f<e;f++)g.__webglMorphTargetInfluences[f]=0}var h=!1,f=d.program, +e=f.uniforms,i=d.uniforms;f!==V&&(j.useProgram(f),V=f,h=!0);if(d.id!==ga)ga=d.id,h=!0;if(h){j.uniformMatrix4fv(e.projectionMatrix,!1,ca);if(c&&d.fog)if(i.fogColor.value=c.color,c instanceof THREE.Fog)i.fogNear.value=c.near,i.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)i.fogDensity.value=c.density;if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){for(var m,n,l=0,k=0,o=0,p,L,q,r=fa,t=r.directional.colors,Q=r.directional.positions,Z=r.point.colors,w= r.point.positions,u=r.point.distances,J=0,ea=0,c=m=q=0,h=b.length;c<h;c++)if(m=b[c],n=m.color,p=m.position,L=m.intensity,q=m.distance,m instanceof THREE.AmbientLight)W.gammaInput?(l+=n.r*n.r,k+=n.g*n.g,o+=n.b*n.b):(l+=n.r,k+=n.g,o+=n.b);else if(m instanceof THREE.DirectionalLight)q=J*3,W.gammaInput?(t[q]=n.r*n.r*L*L,t[q+1]=n.g*n.g*L*L,t[q+2]=n.b*n.b*L*L):(t[q]=n.r*L,t[q+1]=n.g*L,t[q+2]=n.b*L),Q[q]=p.x,Q[q+1]=p.y,Q[q+2]=p.z,J+=1;else if(m instanceof THREE.SpotLight)q=J*3,W.gammaInput?(t[q]=n.r*n.r* L*L,t[q+1]=n.g*n.g*L*L,t[q+2]=n.b*n.b*L*L):(t[q]=n.r*L,t[q+1]=n.g*L,t[q+2]=n.b*L),n=1/p.length(),Q[q]=p.x*n,Q[q+1]=p.y*n,Q[q+2]=p.z*n,J+=1;else if(m instanceof THREE.PointLight)m=ea*3,W.gammaInput?(Z[m]=n.r*n.r*L*L,Z[m+1]=n.g*n.g*L*L,Z[m+2]=n.b*n.b*L*L):(Z[m]=n.r*L,Z[m+1]=n.g*L,Z[m+2]=n.b*L),w[m]=p.x,w[m+1]=p.y,w[m+2]=p.z,u[ea]=q,ea+=1;c=J*3;for(h=t.length;c<h;c++)t[c]=0;c=ea*3;for(h=Z.length;c<h;c++)Z[c]=0;r.point.length=ea;r.directional.length=J;r.ambient[0]=l;r.ambient[1]=k;r.ambient[2]=o;b=fa; i.ambientLightColor.value=b.ambient;i.directionalLightColor.value=b.directional.colors;i.directionalLightDirection.value=b.directional.positions;i.pointLightColor.value=b.point.colors;i.pointLightPosition.value=b.point.positions;i.pointLightDistance.value=b.point.distances}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial)i.opacity.value=d.opacity,W.gammaInput?i.diffuse.value.copyGammaToLinear(d.color):i.diffuse.value=d.color,(i.map.texture= d.map)&&i.offsetRepeat.value.set(d.map.offset.x,d.map.offset.y,d.map.repeat.x,d.map.repeat.y),i.lightMap.texture=d.lightMap,i.envMap.texture=d.envMap,i.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?1:-1,i.reflectivity.value=d.reflectivity,i.refractionRatio.value=d.refractionRatio,i.combine.value=d.combine,i.useRefract.value=d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping;if(d instanceof THREE.LineBasicMaterial)i.diffuse.value=d.color,i.opacity.value=d.opacity; else if(d instanceof THREE.ParticleBasicMaterial)i.psColor.value=d.color,i.opacity.value=d.opacity,i.size.value=d.size,i.scale.value=O.height/2,i.map.texture=d.map;else if(d instanceof THREE.MeshPhongMaterial)i.shininess.value=d.shininess,W.gammaInput?(i.ambient.value.copyGammaToLinear(d.ambient),i.specular.value.copyGammaToLinear(d.specular)):(i.ambient.value=d.ambient,i.specular.value=d.specular);else if(d instanceof THREE.MeshLambertMaterial)W.gammaInput?i.ambient.value.copyGammaToLinear(d.ambient): -i.ambient.value=d.ambient;else if(d instanceof THREE.MeshDepthMaterial)i.mNear.value=a.near,i.mFar.value=a.far,i.opacity.value=d.opacity;else if(d instanceof THREE.MeshNormalMaterial)i.opacity.value=d.opacity;if(f.receiveShadow&&!d._shadowPass&&i.shadowMatrix){for(b=0;b<xa.length;b++)i.shadowMatrix.value[b]=xa[b],i.shadowMap.texture[b]=W.shadowMap[b];i.shadowDarkness.value=W.shadowMapDarkness;i.shadowBias.value=W.shadowMapBias}b=d.uniformsList;i=0;for(c=b.length;i<c;i++)if(k=e.uniforms[b[i][1]])if(l= +i.ambient.value=d.ambient;else if(d instanceof THREE.MeshDepthMaterial)i.mNear.value=a.near,i.mFar.value=a.far,i.opacity.value=d.opacity;else if(d instanceof THREE.MeshNormalMaterial)i.opacity.value=d.opacity;if(g.receiveShadow&&!d._shadowPass&&i.shadowMatrix){for(b=0;b<xa.length;b++)i.shadowMatrix.value[b]=xa[b],i.shadowMap.texture[b]=W.shadowMap[b];i.shadowDarkness.value=W.shadowMapDarkness;i.shadowBias.value=W.shadowMapBias}b=d.uniformsList;i=0;for(c=b.length;i<c;i++)if(k=f.uniforms[b[i][1]])if(l= b[i][0],o=l.type,h=l.value,o==="i")j.uniform1i(k,h);else if(o==="f")j.uniform1f(k,h);else if(o==="v2")j.uniform2f(k,h.x,h.y);else if(o==="v3")j.uniform3f(k,h.x,h.y,h.z);else if(o==="v4")j.uniform4f(k,h.x,h.y,h.z,h.w);else if(o==="c")j.uniform3f(k,h.r,h.g,h.b);else if(o==="fv1")j.uniform1fv(k,h);else if(o==="fv")j.uniform3fv(k,h);else if(o==="v3v"){if(!l._array)l._array=new Float32Array(3*h.length);o=0;for(p=h.length;o<p;o++)r=o*3,l._array[r]=h[o].x,l._array[r+1]=h[o].y,l._array[r+2]=h[o].z;j.uniform3fv(k, l._array)}else if(o==="m4"){if(!l._array)l._array=new Float32Array(16);h.flattenToArray(l._array);j.uniformMatrix4fv(k,!1,l._array)}else if(o==="m4v"){if(!l._array)l._array=new Float32Array(16*h.length);o=0;for(p=h.length;o<p;o++)h[o].flattenToArrayOffset(l._array,o*16);j.uniformMatrix4fv(k,!1,l._array)}else if(o==="t"){if(j.uniform1i(k,h),k=l.texture)if(k.image instanceof Array&&k.image.length===6){if(l=k,l.image.length===6)if(l.needsUpdate){if(!l.image.__webglTextureCube)l.image.__webglTextureCube= j.createTexture();j.activeTexture(j.TEXTURE0+h);j.bindTexture(j.TEXTURE_CUBE_MAP,l.image.__webglTextureCube);h=s(j.TEXTURE_CUBE_MAP,l,l.image[0]);for(k=0;k<6;k++)j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+k,0,j.RGBA,j.RGBA,j.UNSIGNED_BYTE,l.image[k]);h&&j.generateMipmap(j.TEXTURE_CUBE_MAP);l.needsUpdate=!1}else j.activeTexture(j.TEXTURE0+h),j.bindTexture(j.TEXTURE_CUBE_MAP,l.image.__webglTextureCube)}else k instanceof THREE.WebGLRenderTargetCube?(l=k,j.activeTexture(j.TEXTURE0+h),j.bindTexture(j.TEXTURE_CUBE_MAP, -l.__webglTexture)):E(k,h)}else if(o==="tv"){if(!l._array){l._array=[];o=0;for(p=l.texture.length;o<p;o++)l._array[o]=h+o}j.uniform1iv(k,l._array);o=0;for(p=l.texture.length;o<p;o++)(k=l.texture[o])&&E(k,l._array[o])}(d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&g.cameraPosition!==null&&j.uniform3f(g.cameraPosition,a.position.x,a.position.y,a.position.z);(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial|| -d.skinning)&&g.viewMatrix!==null&&j.uniformMatrix4fv(g.viewMatrix,!1,la);d.skinning&&(j.uniformMatrix4fv(g.cameraInverseMatrix,!1,la),j.uniformMatrix4fv(g.boneGlobalMatrices,!1,f.boneMatrices))}j.uniformMatrix4fv(g.modelViewMatrix,!1,f._modelViewMatrixArray);g.normalMatrix&&j.uniformMatrix3fv(g.normalMatrix,!1,f._normalMatrixArray);(d instanceof THREE.ShaderMaterial||d.envMap||d.skinning||f.receiveShadow)&&g.objectMatrix!==null&&j.uniformMatrix4fv(g.objectMatrix,!1,f._objectMatrixArray);return e} +l.__webglTexture)):E(k,h)}else if(o==="tv"){if(!l._array){l._array=[];o=0;for(p=l.texture.length;o<p;o++)l._array[o]=h+o}j.uniform1iv(k,l._array);o=0;for(p=l.texture.length;o<p;o++)(k=l.texture[o])&&E(k,l._array[o])}(d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&e.cameraPosition!==null&&j.uniform3f(e.cameraPosition,a.position.x,a.position.y,a.position.z);(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial|| +d.skinning)&&e.viewMatrix!==null&&j.uniformMatrix4fv(e.viewMatrix,!1,la);d.skinning&&(j.uniformMatrix4fv(e.cameraInverseMatrix,!1,la),j.uniformMatrix4fv(e.boneGlobalMatrices,!1,g.boneMatrices))}j.uniformMatrix4fv(e.modelViewMatrix,!1,g._modelViewMatrixArray);e.normalMatrix&&j.uniformMatrix3fv(e.normalMatrix,!1,g._normalMatrixArray);(d instanceof THREE.ShaderMaterial||d.envMap||d.skinning||g.receiveShadow)&&e.objectMatrix!==null&&j.uniformMatrix4fv(e.objectMatrix,!1,g._objectMatrixArray);return f} function B(a,b,c){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);c&&THREE.Matrix4.makeInvert3x3(a._modelViewMatrix).transposeIntoArray(a._normalMatrixArray)}function F(a){if(ra!==a.doubleSided)a.doubleSided?j.disable(j.CULL_FACE):j.enable(j.CULL_FACE),ra=a.doubleSided;if(qa!==a.flipSided)a.flipSided?j.frontFace(j.CW):j.frontFace(j.CCW),qa=a.flipSided}function A(a){oa!==a&&(a?j.enable(j.DEPTH_TEST):j.disable(j.DEPTH_TEST),oa=a)}function x(a){pa!==a&& (j.depthMask(a),pa=a)}function y(a,b,c){Da!==a&&(a?j.enable(j.POLYGON_OFFSET_FILL):j.disable(j.POLYGON_OFFSET_FILL),Da=a);if(a&&(za!==b||Aa!==c))j.polygonOffset(b,c),za=b,Aa=c}function v(a){if(a!==na){switch(a){case THREE.AdditiveBlending:j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,j.ONE);break;case THREE.SubtractiveBlending:j.blendEquation(j.FUNC_ADD);j.blendFunc(j.ZERO,j.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:j.blendEquation(j.FUNC_ADD);j.blendFunc(j.ZERO,j.SRC_COLOR);break; default:j.blendEquationSeparate(j.FUNC_ADD,j.FUNC_ADD),j.blendFuncSeparate(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA,j.ONE,j.ONE_MINUS_SRC_ALPHA)}na=a}}function J(a,b){var c;a==="fragment"?c=j.createShader(j.FRAGMENT_SHADER):a==="vertex"&&(c=j.createShader(j.VERTEX_SHADER));j.shaderSource(c,b);j.compileShader(c);if(!j.getShaderParameter(c,j.COMPILE_STATUS))return console.error(j.getShaderInfoLog(c)),console.error(b),null;return c}function s(a,b,c){return(c.width&c.width-1)===0&&(c.height&c.height-1)===0? @@ -264,9 +264,9 @@ default:j.blendEquationSeparate(j.FUNC_ADD,j.FUNC_ADD),j.blendFuncSeparate(j.SRC j.createTexture(),W.info.memory.textures++;j.activeTexture(j.TEXTURE0+b);j.bindTexture(j.TEXTURE_2D,a.__webglTexture);var c=s(j.TEXTURE_2D,a,a.image);a instanceof THREE.DataTexture?j.texImage2D(j.TEXTURE_2D,0,P(a.format),a.image.width,a.image.height,0,P(a.format),j.UNSIGNED_BYTE,a.image.data):j.texImage2D(j.TEXTURE_2D,0,j.RGBA,j.RGBA,j.UNSIGNED_BYTE,a.image);c&&j.generateMipmap(j.TEXTURE_2D);a.needsUpdate=!1;if(a.onUpdated)a.onUpdated()}else j.activeTexture(j.TEXTURE0+b),j.bindTexture(j.TEXTURE_2D, a.__webglTexture)}function R(a,b){j.bindRenderbuffer(j.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_COMPONENT16,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_ATTACHMENT,j.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_STENCIL,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_STENCIL_ATTACHMENT,j.RENDERBUFFER,a)):j.renderbufferStorage(j.RENDERBUFFER,j.RGBA4,b.width,b.height)} function U(a){var b=a instanceof THREE.WebGLRenderTargetCube;if(a&&!a.__webglFramebuffer){if(a.depthBuffer===void 0)a.depthBuffer=!0;if(a.stencilBuffer===void 0)a.stencilBuffer=!0;a.__webglTexture=j.createTexture();if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];j.bindTexture(j.TEXTURE_CUBE_MAP,a.__webglTexture);s(j.TEXTURE_CUBE_MAP,a,a);for(var c=0;c<6;c++){a.__webglFramebuffer[c]=j.createFramebuffer();a.__webglRenderbuffer[c]=j.createRenderbuffer();j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+ -c,0,P(a.format),a.width,a.height,0,P(a.format),P(a.type),null);var d=a,f=j.TEXTURE_CUBE_MAP_POSITIVE_X+c;j.bindFramebuffer(j.FRAMEBUFFER,a.__webglFramebuffer[c]);j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,f,d.__webglTexture,0);R(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=j.createFramebuffer(),a.__webglRenderbuffer=j.createRenderbuffer(),j.bindTexture(j.TEXTURE_2D,a.__webglTexture),s(j.TEXTURE_2D,a,a),j.texImage2D(j.TEXTURE_2D,0,P(a.format),a.width,a.height,0,P(a.format), -P(a.type),null),c=j.TEXTURE_2D,j.bindFramebuffer(j.FRAMEBUFFER,a.__webglFramebuffer),j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,c,a.__webglTexture,0),R(a.__webglRenderbuffer,a);b?j.bindTexture(j.TEXTURE_CUBE_MAP,null):j.bindTexture(j.TEXTURE_2D,null);j.bindRenderbuffer(j.RENDERBUFFER,null);j.bindFramebuffer(j.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,f=d=0):(b=null,c=Q,a=ea,d=L,f=Z);b!==da&&(j.bindFramebuffer(j.FRAMEBUFFER, -b),j.viewport(d,f,c,a),da=b)}function K(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return j.NEAREST;default:return j.LINEAR}}function P(a){switch(a){case THREE.RepeatWrapping:return j.REPEAT;case THREE.ClampToEdgeWrapping:return j.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return j.MIRRORED_REPEAT;case THREE.NearestFilter:return j.NEAREST;case THREE.NearestMipMapNearestFilter:return j.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return j.NEAREST_MIPMAP_LINEAR; +c,0,P(a.format),a.width,a.height,0,P(a.format),P(a.type),null);var d=a,g=j.TEXTURE_CUBE_MAP_POSITIVE_X+c;j.bindFramebuffer(j.FRAMEBUFFER,a.__webglFramebuffer[c]);j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,g,d.__webglTexture,0);R(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=j.createFramebuffer(),a.__webglRenderbuffer=j.createRenderbuffer(),j.bindTexture(j.TEXTURE_2D,a.__webglTexture),s(j.TEXTURE_2D,a,a),j.texImage2D(j.TEXTURE_2D,0,P(a.format),a.width,a.height,0,P(a.format), +P(a.type),null),c=j.TEXTURE_2D,j.bindFramebuffer(j.FRAMEBUFFER,a.__webglFramebuffer),j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,c,a.__webglTexture,0),R(a.__webglRenderbuffer,a);b?j.bindTexture(j.TEXTURE_CUBE_MAP,null):j.bindTexture(j.TEXTURE_2D,null);j.bindRenderbuffer(j.RENDERBUFFER,null);j.bindFramebuffer(j.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,g=d=0):(b=null,c=Q,a=ea,d=L,g=Z);b!==da&&(j.bindFramebuffer(j.FRAMEBUFFER, +b),j.viewport(d,g,c,a),da=b)}function K(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return j.NEAREST;default:return j.LINEAR}}function P(a){switch(a){case THREE.RepeatWrapping:return j.REPEAT;case THREE.ClampToEdgeWrapping:return j.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return j.MIRRORED_REPEAT;case THREE.NearestFilter:return j.NEAREST;case THREE.NearestMipMapNearestFilter:return j.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return j.NEAREST_MIPMAP_LINEAR; case THREE.LinearFilter:return j.LINEAR;case THREE.LinearMipMapNearestFilter:return j.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return j.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return j.BYTE;case THREE.UnsignedByteType:return j.UNSIGNED_BYTE;case THREE.ShortType:return j.SHORT;case THREE.UnsignedShortType:return j.UNSIGNED_SHORT;case THREE.IntType:return j.INT;case THREE.UnsignedShortType:return j.UNSIGNED_INT;case THREE.FloatType:return j.FLOAT;case THREE.AlphaFormat:return j.ALPHA; case THREE.RGBFormat:return j.RGB;case THREE.RGBAFormat:return j.RGBA;case THREE.LuminanceFormat:return j.LUMINANCE;case THREE.LuminanceAlphaFormat:return j.LUMINANCE_ALPHA}return 0}var a=a||{},O=a.canvas!==void 0?a.canvas:document.createElement("canvas"),aa=a.precision!==void 0?a.precision:"highp",H=a.antialias!==void 0?a.antialias:!1,G=a.stencil!==void 0?a.stencil:!0,I=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,M=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0), S=a.clearAlpha!==void 0?a.clearAlpha:0,ba=a.maxLights!==void 0?a.maxLights:4;this.domElement=O;this.context=null;this.autoUpdateScene=this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowMap= @@ -280,16 +280,16 @@ j.getUniformLocation(T.program,"screenPosition");T.uniforms.modelViewMatrix=j.ge va._shadowPass=!0;ta._shadowPass=!0})();this.context=j;var ya=j.getParameter(j.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;this.getContext=function(){return j};this.supportsVertexTextures=function(){return ya};this.setSize=function(a,b){O.width=a;O.height=b;this.setViewport(0,0,O.width,O.height)};this.setViewport=function(a,b,c,d){L=a;Z=b;Q=c;ea=d;j.viewport(L,Z,Q,ea)};this.setScissor=function(a,b,c,d){j.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?j.enable(j.SCISSOR_TEST):j.disable(j.SCISSOR_TEST)}; this.setClearColorHex=function(a,b){M.setHex(a);S=b;j.clearColor(M.r,M.g,M.b,S)};this.setClearColor=function(a,b){M.copy(a);S=b;j.clearColor(M.r,M.g,M.b,S)};this.getClearColor=function(){return M};this.getClearAlpha=function(){return S};this.clear=function(a,b,c){var d=0;if(a===void 0||a)d|=j.COLOR_BUFFER_BIT;if(b===void 0||b)d|=j.DEPTH_BUFFER_BIT;if(c===void 0||c)d|=j.STENCIL_BUFFER_BIT;j.clear(d)};this.clearTarget=function(a,b,c,d){U(a);this.clear(b,c,d)};this.deallocateObject=function(a){if(a.__webglInit)if(a.__webglInit= !1,delete a._modelViewMatrix,delete a._normalMatrixArray,delete a._modelViewMatrixArray,delete a._objectMatrixArray,a instanceof THREE.Mesh)for(var b in a.geometry.geometryGroups){var c=a.geometry.geometryGroups[b];j.deleteBuffer(c.__webglVertexBuffer);j.deleteBuffer(c.__webglNormalBuffer);j.deleteBuffer(c.__webglTangentBuffer);j.deleteBuffer(c.__webglColorBuffer);j.deleteBuffer(c.__webglUVBuffer);j.deleteBuffer(c.__webglUV2Buffer);j.deleteBuffer(c.__webglSkinVertexABuffer);j.deleteBuffer(c.__webglSkinVertexBBuffer); -j.deleteBuffer(c.__webglSkinIndicesBuffer);j.deleteBuffer(c.__webglSkinWeightsBuffer);j.deleteBuffer(c.__webglFaceBuffer);j.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var d=0,f=c.numMorphTargets;d<f;d++)j.deleteBuffer(c.__webglMorphTargetsBuffers[d]);if(c.__webglCustomAttributesList)for(d in d=void 0,c.__webglCustomAttributesList)j.deleteBuffer(c.__webglCustomAttributesList[d].buffer);W.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer), +j.deleteBuffer(c.__webglSkinIndicesBuffer);j.deleteBuffer(c.__webglSkinWeightsBuffer);j.deleteBuffer(c.__webglFaceBuffer);j.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var d=0,g=c.numMorphTargets;d<g;d++)j.deleteBuffer(c.__webglMorphTargetsBuffers[d]);if(c.__webglCustomAttributesList)for(d in d=void 0,c.__webglCustomAttributesList)j.deleteBuffer(c.__webglCustomAttributesList[d].buffer);W.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer), j.deleteBuffer(a.__webglColorBuffer),W.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),W.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),W.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,j.deleteTexture(a.__webglTexture),W.info.memory.textures--};this.updateShadowMap= -function(a,b){p(a,b)};this.render=function(a,b,c,d){var f,e,g,h,i=a.lights,n=a.fog;ga=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);b.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(b));this.autoUpdateScene&&a.updateMatrixWorld();this.shadowMapEnabled&&this.shadowMapAutoUpdate&&p(a,b);W.info.render.calls=0;W.info.render.vertices=0;W.info.render.faces=0;b.matrixWorldInverse.getInverse(b.matrixWorld);b.matrixWorldInverse.flattenToArray(la); -b.projectionMatrix.flattenToArray(ca);N.multiply(b.projectionMatrix,b.matrixWorldInverse);l(N);U(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);h=a.__webglObjects;d=0;for(f=h.length;d<f;d++)if(e=h[d],g=e.object,e.render=!1,g.visible&&(!(g instanceof THREE.Mesh)||!g.frustumCulled||k(g))){g.matrixWorld.flattenToArray(g._objectMatrixArray);B(g,b,!0);var L=e,q=L.object,t=L.buffer,Z=void 0,Z=Z=void 0,Z=q.material;if(Z instanceof THREE.MeshFaceMaterial){if(Z= -t.materialIndex,Z>=0)Z=q.geometry.materials[Z],Z.transparent?(L.transparent=Z,L.opaque=null):(L.opaque=Z,L.transparent=null)}else if(Z)Z.transparent?(L.transparent=Z,L.opaque=null):(L.opaque=Z,L.transparent=null);e.render=!0;if(this.sortObjects)g.renderDepth?e.z=g.renderDepth:(ma.copy(g.position),N.multiplyVector3(ma),e.z=ma.z)}this.sortObjects&&h.sort(o);h=a.__webglObjectsImmediate;d=0;for(f=h.length;d<f;d++)if(e=h[d],g=e.object,g.visible)g.matrixAutoUpdate&&g.matrixWorld.flattenToArray(g._objectMatrixArray), -B(g,b,!0),g=e.object.material,g.transparent?(e.transparent=g,e.opaque=null):(e.opaque=g,e.transparent=null);a.overrideMaterial?(v(a.overrideMaterial.blending),A(a.overrideMaterial.depthTest),x(a.overrideMaterial.depthWrite),y(a.overrideMaterial.polygonOffset,a.overrideMaterial.polygonOffsetFactor,a.overrideMaterial.polygonOffsetUnits),m(a.__webglObjects,!1,"",b,i,n,!0,a.overrideMaterial),r(a.__webglObjectsImmediate,"",b,i,n,!1,a.overrideMaterial)):(v(THREE.NormalBlending),m(a.__webglObjects,!0,"opaque", -b,i,n,!1),r(a.__webglObjectsImmediate,"opaque",b,i,n,!1),m(a.__webglObjects,!1,"transparent",b,i,n,!0),r(a.__webglObjectsImmediate,"transparent",b,i,n,!0));if(a.__webglSprites.length){g=T.attributes;i=T.uniforms;n=ea/Q;d=[];f=Q*0.5;h=ea*0.5;e=!0;j.useProgram(T.program);V=T.program;$=oa=na=-1;wa||(j.enableVertexAttribArray(T.attributes.position),j.enableVertexAttribArray(T.attributes.uv),wa=!0);j.disable(j.CULL_FACE);j.enable(j.BLEND);j.depthMask(!0);j.bindBuffer(j.ARRAY_BUFFER,T.vertexBuffer);j.vertexAttribPointer(g.position, -2,j.FLOAT,!1,16,0);j.vertexAttribPointer(g.uv,2,j.FLOAT,!1,16,8);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,T.elementBuffer);j.uniformMatrix4fv(i.projectionMatrix,!1,ca);j.activeTexture(j.TEXTURE0);j.uniform1i(i.map,0);g=0;for(L=a.__webglSprites.length;g<L;g++)if(q=a.__webglSprites[g],q.visible&&q.opacity!==0)q.useScreenCoordinates?q.z=-q.position.z:(q._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,q.matrixWorld,q._modelViewMatrixArray),q.z=-q._modelViewMatrix.n34);a.__webglSprites.sort(o);g=0;for(L= -a.__webglSprites.length;g<L;g++)q=a.__webglSprites[g],q.visible&&q.opacity!==0&&q.map&&q.map.image&&q.map.image.width&&(q.useScreenCoordinates?(j.uniform1i(i.useScreenCoordinates,1),j.uniform3f(i.screenPosition,(q.position.x-f)/f,(h-q.position.y)/h,Math.max(0,Math.min(1,q.position.z)))):(j.uniform1i(i.useScreenCoordinates,0),j.uniform1i(i.affectedByDistance,q.affectedByDistance?1:0),j.uniformMatrix4fv(i.modelViewMatrix,!1,q._modelViewMatrixArray)),b=q.map.image.width/(q.scaleByViewport?ea:1),d[0]= -b*n*q.scale.x,d[1]=b*q.scale.y,j.uniform2f(i.uvScale,q.uvScale.x,q.uvScale.y),j.uniform2f(i.uvOffset,q.uvOffset.x,q.uvOffset.y),j.uniform2f(i.alignment,q.alignment.x,q.alignment.y),j.uniform1f(i.opacity,q.opacity),j.uniform3f(i.color,q.color.r,q.color.g,q.color.b),j.uniform1f(i.rotation,q.rotation),j.uniform2fv(i.scale,d),q.mergeWith3D&&!e?(j.enable(j.DEPTH_TEST),e=!0):!q.mergeWith3D&&e&&(j.disable(j.DEPTH_TEST),e=!1),v(q.blending),E(q.map,0),j.drawElements(j.TRIANGLES,6,j.UNSIGNED_SHORT,0));j.enable(j.CULL_FACE); +function(a,b){p(a,b)};this.render=function(a,b,c,d){var g,f,e,h,i=a.lights,n=a.fog;ga=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);b.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(b));this.autoUpdateScene&&a.updateMatrixWorld();this.shadowMapEnabled&&this.shadowMapAutoUpdate&&p(a,b);W.info.render.calls=0;W.info.render.vertices=0;W.info.render.faces=0;b.matrixWorldInverse.getInverse(b.matrixWorld);b.matrixWorldInverse.flattenToArray(la); +b.projectionMatrix.flattenToArray(ca);N.multiply(b.projectionMatrix,b.matrixWorldInverse);l(N);U(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);h=a.__webglObjects;d=0;for(g=h.length;d<g;d++)if(f=h[d],e=f.object,f.render=!1,e.visible&&(!(e instanceof THREE.Mesh)||!e.frustumCulled||k(e))){e.matrixWorld.flattenToArray(e._objectMatrixArray);B(e,b,!0);var L=f,q=L.object,t=L.buffer,Z=void 0,Z=Z=void 0,Z=q.material;if(Z instanceof THREE.MeshFaceMaterial){if(Z= +t.materialIndex,Z>=0)Z=q.geometry.materials[Z],Z.transparent?(L.transparent=Z,L.opaque=null):(L.opaque=Z,L.transparent=null)}else if(Z)Z.transparent?(L.transparent=Z,L.opaque=null):(L.opaque=Z,L.transparent=null);f.render=!0;if(this.sortObjects)e.renderDepth?f.z=e.renderDepth:(ma.copy(e.position),N.multiplyVector3(ma),f.z=ma.z)}this.sortObjects&&h.sort(o);h=a.__webglObjectsImmediate;d=0;for(g=h.length;d<g;d++)if(f=h[d],e=f.object,e.visible)e.matrixAutoUpdate&&e.matrixWorld.flattenToArray(e._objectMatrixArray), +B(e,b,!0),e=f.object.material,e.transparent?(f.transparent=e,f.opaque=null):(f.opaque=e,f.transparent=null);a.overrideMaterial?(v(a.overrideMaterial.blending),A(a.overrideMaterial.depthTest),x(a.overrideMaterial.depthWrite),y(a.overrideMaterial.polygonOffset,a.overrideMaterial.polygonOffsetFactor,a.overrideMaterial.polygonOffsetUnits),m(a.__webglObjects,!1,"",b,i,n,!0,a.overrideMaterial),r(a.__webglObjectsImmediate,"",b,i,n,!1,a.overrideMaterial)):(v(THREE.NormalBlending),m(a.__webglObjects,!0,"opaque", +b,i,n,!1),r(a.__webglObjectsImmediate,"opaque",b,i,n,!1),m(a.__webglObjects,!1,"transparent",b,i,n,!0),r(a.__webglObjectsImmediate,"transparent",b,i,n,!0));if(a.__webglSprites.length){e=T.attributes;i=T.uniforms;n=ea/Q;d=[];g=Q*0.5;h=ea*0.5;f=!0;j.useProgram(T.program);V=T.program;$=oa=na=-1;wa||(j.enableVertexAttribArray(T.attributes.position),j.enableVertexAttribArray(T.attributes.uv),wa=!0);j.disable(j.CULL_FACE);j.enable(j.BLEND);j.depthMask(!0);j.bindBuffer(j.ARRAY_BUFFER,T.vertexBuffer);j.vertexAttribPointer(e.position, +2,j.FLOAT,!1,16,0);j.vertexAttribPointer(e.uv,2,j.FLOAT,!1,16,8);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,T.elementBuffer);j.uniformMatrix4fv(i.projectionMatrix,!1,ca);j.activeTexture(j.TEXTURE0);j.uniform1i(i.map,0);e=0;for(L=a.__webglSprites.length;e<L;e++)if(q=a.__webglSprites[e],q.visible&&q.opacity!==0)q.useScreenCoordinates?q.z=-q.position.z:(q._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,q.matrixWorld,q._modelViewMatrixArray),q.z=-q._modelViewMatrix.n34);a.__webglSprites.sort(o);e=0;for(L= +a.__webglSprites.length;e<L;e++)q=a.__webglSprites[e],q.visible&&q.opacity!==0&&q.map&&q.map.image&&q.map.image.width&&(q.useScreenCoordinates?(j.uniform1i(i.useScreenCoordinates,1),j.uniform3f(i.screenPosition,(q.position.x-g)/g,(h-q.position.y)/h,Math.max(0,Math.min(1,q.position.z)))):(j.uniform1i(i.useScreenCoordinates,0),j.uniform1i(i.affectedByDistance,q.affectedByDistance?1:0),j.uniformMatrix4fv(i.modelViewMatrix,!1,q._modelViewMatrixArray)),b=q.map.image.width/(q.scaleByViewport?ea:1),d[0]= +b*n*q.scale.x,d[1]=b*q.scale.y,j.uniform2f(i.uvScale,q.uvScale.x,q.uvScale.y),j.uniform2f(i.uvOffset,q.uvOffset.x,q.uvOffset.y),j.uniform2f(i.alignment,q.alignment.x,q.alignment.y),j.uniform1f(i.opacity,q.opacity),j.uniform3f(i.color,q.color.r,q.color.g,q.color.b),j.uniform1f(i.rotation,q.rotation),j.uniform2fv(i.scale,d),q.mergeWith3D&&!f?(j.enable(j.DEPTH_TEST),f=!0):!q.mergeWith3D&&f&&(j.disable(j.DEPTH_TEST),f=!1),v(q.blending),E(q.map,0),j.drawElements(j.TRIANGLES,6,j.UNSIGNED_SHORT,0));j.enable(j.CULL_FACE); j.enable(j.DEPTH_TEST);j.depthMask(pa)}c&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&(c instanceof THREE.WebGLRenderTargetCube?(j.bindTexture(j.TEXTURE_CUBE_MAP,c.__webglTexture),j.generateMipmap(j.TEXTURE_CUBE_MAP),j.bindTexture(j.TEXTURE_CUBE_MAP,null)):(j.bindTexture(j.TEXTURE_2D,c.__webglTexture),j.generateMipmap(j.TEXTURE_2D),j.bindTexture(j.TEXTURE_2D,null)))};this.initWebGLObjects=function(a){if(!a.__webglObjects)a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites= [];for(;a.__objectsAdded.length;){var h=a.__objectsAdded[0],i=a,m=void 0,l=void 0,k=void 0;if(!h.__webglInit)if(h.__webglInit=!0,h._modelViewMatrix=new THREE.Matrix4,h._normalMatrixArray=new Float32Array(9),h._modelViewMatrixArray=new Float32Array(16),h._objectMatrixArray=new Float32Array(16),h.matrixWorld.flattenToArray(h._objectMatrixArray),h instanceof THREE.Mesh){l=h.geometry;if(l.geometryGroups===void 0){var k=l,o=void 0,p=void 0,L=void 0,r=void 0,Q=void 0,Z=void 0,s=void 0,u={},J=k.morphTargets.length; k.geometryGroups={};o=0;for(p=k.faces.length;o<p;o++)L=k.faces[o],r=L.materialIndex,Z=r!==void 0?r:-1,u[Z]===void 0&&(u[Z]={hash:Z,counter:0}),s=u[Z].hash+"_"+u[Z].counter,k.geometryGroups[s]===void 0&&(k.geometryGroups[s]={faces3:[],faces4:[],materialIndex:r,vertices:0,numMorphTargets:J}),Q=L instanceof THREE.Face3?3:4,k.geometryGroups[s].vertices+Q>65535&&(u[Z].counter+=1,s=u[Z].hash+"_"+u[Z].counter,k.geometryGroups[s]===void 0&&(k.geometryGroups[s]={faces3:[],faces4:[],materialIndex:r,vertices:0, @@ -330,18 +330,18 @@ delete p.__lineArray,delete p.__skinVertexAArray,delete p.__skinVertexBArray,del if(l.__dirtyVertices){for(r=0;r<s;r++)Q=Z[r].position,k=r*3,u[k]=Q.x,u[k+1]=Q.y,u[k+2]=Q.z;j.bindBuffer(j.ARRAY_BUFFER,l.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,u,ea)}if(J){for(r=0;r<p;r++)Q=o[r],k=r*3,L[k]=Q.r,L[k+1]=Q.g,L[k+2]=Q.b;j.bindBuffer(j.ARRAY_BUFFER,l.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,L,ea)}}m.__dirtyVertices=!1;m.__dirtyColors=!1}else if(ea instanceof THREE.Line){l=b(ea,p);L=l.attributes&&q(l);if(m.__dirtyVertices||m.__dirtyColors||L){ea=m;k=j.DYNAMIC_DRAW;s=o=R= Z=B=void 0;Z=ea.vertices;p=ea.colors;s=Z.length;L=p.length;u=ea.__vertexArray;r=ea.__colorArray;J=ea.__dirtyColors;Q=ea.__webglCustomAttributesList;O=ka=ja=E=R=B=void 0;if(ea.__dirtyVertices){for(B=0;B<s;B++)R=Z[B].position,o=B*3,u[o]=R.x,u[o+1]=R.y,u[o+2]=R.z;j.bindBuffer(j.ARRAY_BUFFER,ea.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,u,k)}if(J){for(Z=0;Z<L;Z++)s=p[Z],o=Z*3,r[o]=s.r,r[o+1]=s.g,r[o+2]=s.b;j.bindBuffer(j.ARRAY_BUFFER,ea.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,r,k)}if(Q){B= 0;for(R=Q.length;B<R;B++)if(O=Q[B],O.needsUpdate&&(O.boundTo===void 0||O.boundTo==="vertices")){o=0;ja=O.value.length;if(O.size===1)for(E=0;E<ja;E++)O.array[E]=O.value[E];else if(O.size===2)for(E=0;E<ja;E++)ka=O.value[E],O.array[o]=ka.x,O.array[o+1]=ka.y,o+=2;else if(O.size===3)if(O.type==="c")for(E=0;E<ja;E++)ka=O.value[E],O.array[o]=ka.r,O.array[o+1]=ka.g,O.array[o+2]=ka.b,o+=3;else for(E=0;E<ja;E++)ka=O.value[E],O.array[o]=ka.x,O.array[o+1]=ka.y,O.array[o+2]=ka.z,o+=3;else if(O.size===4)for(E= -0;E<ja;E++)ka=O.value[E],O.array[o]=ka.x,O.array[o+1]=ka.y,O.array[o+2]=ka.z,O.array[o+3]=ka.w,o+=4;j.bindBuffer(j.ARRAY_BUFFER,O.buffer);j.bufferData(j.ARRAY_BUFFER,O.array,k)}}}m.__dirtyVertices=!1;m.__dirtyColors=!1;l.attributes&&t(l)}else if(ea instanceof THREE.ParticleSystem)l=b(ea,p),L=l.attributes&&q(l),(m.__dirtyVertices||m.__dirtyColors||ea.sortParticles||L)&&e(m,j.DYNAMIC_DRAW,ea),m.__dirtyVertices=!1,m.__dirtyColors=!1,l.attributes&&t(l)};this.initMaterial=function(a,b,c,d){var f,g,e,h; +0;E<ja;E++)ka=O.value[E],O.array[o]=ka.x,O.array[o+1]=ka.y,O.array[o+2]=ka.z,O.array[o+3]=ka.w,o+=4;j.bindBuffer(j.ARRAY_BUFFER,O.buffer);j.bufferData(j.ARRAY_BUFFER,O.array,k)}}}m.__dirtyVertices=!1;m.__dirtyColors=!1;l.attributes&&t(l)}else if(ea instanceof THREE.ParticleSystem)l=b(ea,p),L=l.attributes&&q(l),(m.__dirtyVertices||m.__dirtyColors||ea.sortParticles||L)&&e(m,j.DYNAMIC_DRAW,ea),m.__dirtyVertices=!1,m.__dirtyColors=!1,l.attributes&&t(l)};this.initMaterial=function(a,b,c,d){var g,e,f,h; a instanceof THREE.MeshDepthMaterial?h="depth":a instanceof THREE.MeshNormalMaterial?h="normal":a instanceof THREE.MeshBasicMaterial?h="basic":a instanceof THREE.MeshLambertMaterial?h="lambert":a instanceof THREE.MeshPhongMaterial?h="phong":a instanceof THREE.LineBasicMaterial?h="basic":a instanceof THREE.ParticleBasicMaterial&&(h="particle_basic");if(h){var i=THREE.ShaderLib[h];a.uniforms=THREE.UniformsUtils.clone(i.uniforms);a.vertexShader=i.vertexShader;a.fragmentShader=i.fragmentShader}var k, -l,m;k=m=i=0;for(l=b.length;k<l;k++)e=b[k],e instanceof THREE.SpotLight&&m++,e instanceof THREE.DirectionalLight&&m++,e instanceof THREE.PointLight&&i++;i+m<=ba?k=m:(k=Math.ceil(ba*m/(i+m)),i=ba-k);e={directional:k,point:i};i=m=0;for(k=b.length;i<k;i++)l=b[i],l instanceof THREE.SpotLight&&l.castShadow&&m++;var n=50;if(d!==void 0&&d instanceof THREE.SkinnedMesh)n=d.bones.length;var o;a:{k=a.fragmentShader;l=a.vertexShader;var i=a.uniforms,b=a.attributes,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap, -vertexColors:a.vertexColors,fog:c,useFog:a.fog,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,morphTargets:a.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:e.directional,maxPointLights:e.point,maxBones:n,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:m,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel},p,d=[];h?d.push(h):(d.push(k),d.push(l));for(p in c)d.push(p), +l,m;k=m=i=0;for(l=b.length;k<l;k++)f=b[k],f instanceof THREE.SpotLight&&m++,f instanceof THREE.DirectionalLight&&m++,f instanceof THREE.PointLight&&i++;i+m<=ba?k=m:(k=Math.ceil(ba*m/(i+m)),i=ba-k);f={directional:k,point:i};i=m=0;for(k=b.length;i<k;i++)l=b[i],l instanceof THREE.SpotLight&&l.castShadow&&m++;var n=50;if(d!==void 0&&d instanceof THREE.SkinnedMesh)n=d.bones.length;var o;a:{k=a.fragmentShader;l=a.vertexShader;var i=a.uniforms,b=a.attributes,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap, +vertexColors:a.vertexColors,fog:c,useFog:a.fog,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,morphTargets:a.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:f.directional,maxPointLights:f.point,maxBones:n,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:m,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel},p,d=[];h?d.push(h):(d.push(k),d.push(l));for(p in c)d.push(p), d.push(c[p]);h=d.join();p=0;for(d=X.length;p<d;p++)if(X[p].code===h){o=X[p].program;break a}p=j.createProgram();d=[ya?"#define VERTEX_TEXTURES":"",W.gammaInput?"#define GAMMA_INPUT":"",W.gammaOutput?"#define GAMMA_OUTPUT":"",W.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"", c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n"); -e=["#ifdef GL_ES","precision "+aa+" float;","#endif","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",W.gammaInput?"#define GAMMA_INPUT":"",W.gammaOutput?"#define GAMMA_OUTPUT":"",W.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP": -"",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, +f=["#ifdef GL_ES","precision "+aa+" float;","#endif","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",W.gammaInput?"#define GAMMA_INPUT":"",W.gammaOutput?"#define GAMMA_OUTPUT":"",W.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP": +"",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",f+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<i;d++)k=L[d],p.uniforms[k]=j.getUniformLocation(p, k);d=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(L=0;L<c.maxMorphTargets;L++)d.push("morphTarget"+L);for(o in b)d.push(o);o=d;L=0;for(b=o.length;L<b;L++)c=o[L],p.attributes[c]=j.getAttribLocation(p,c);p.id=X.length;X.push({program:p,code:h});W.info.memory.programs=X.length;o=p}a.program=o;o=a.program.attributes;o.position>=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<this.maxMorphTargets;g++)L="morphTarget"+g,o[L]>=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)}}; +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(e in a.attributes)o[e]!==void 0&&o[e]>=0&&j.enableVertexAttribArray(o[e]);if(a.morphTargets)for(e=a.numSupportedMorphTargets=0;e<this.maxMorphTargets;e++)L="morphTarget"+e,o[L]>=0&&(j.enableVertexAttribArray(o[L]), +a.numSupportedMorphTargets++);a.uniformsList=[];for(g in a.uniforms)a.uniformsList.push([a.uniforms[g],g])};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: THREE.UnsignedByteType;this.depthBuffer=b.depthBuffer!==void 0?b.depthBuffer:!0;this.stencilBuffer=b.stencilBuffer!==void 0?b.stencilBuffer:!0}; THREE.WebGLRenderTarget.prototype.clone=function(){var a=new THREE.WebGLRenderTarget(this.width,this.height);a.wrapS=this.wrapS;a.wrapT=this.wrapT;a.magFilter=this.magFilter;a.minFilter=this.minFilter;a.offset.copy(this.offset);a.repeat.copy(this.repeat);a.format=this.format;a.type=this.type;a.depthBuffer=this.depthBuffer;a.stencilBuffer=this.stencilBuffer;return a};THREE.WebGLRenderTargetCube=function(a,c,b){THREE.WebGLRenderTarget.call(this,a,c,b);this.activeCubeFace=0}; @@ -357,7 +357,7 @@ n=p[h.id];if(n===void 0)n=a.materials.length,a.materials.push(h);q.materialIndex for(b=g.length;a<b;a++){var h=g[a],i,l,k=h.vertexNormals,o=h.vertexColors;h instanceof THREE.Face3?i=new THREE.Face3(h.a,h.b,h.c):h instanceof THREE.Face4&&(i=new THREE.Face4(h.a,h.b,h.c,h.d));i.normal.copy(h.normal);d=0;for(e=k.length;d<e;d++)l=k[d],i.vertexNormals.push(l.clone());i.color.copy(h.color);d=0;for(e=o.length;d<e;d++)l=o[d],i.vertexColors.push(l.clone());i.materialIndex=h.materialIndex;i.centroid.copy(h.centroid);c.faces.push(i)}a=0;for(b=f.length;a<b;a++){g=f[a];i=[];d=0;for(e=g.length;d< e;d++)i.push(new THREE.UV(g[d].u,g[d].v));c.faceVertexUvs[0].push(i)}return c},randomPointInTriangle:function(a,c,b){var d,g,f,e=new THREE.Vector3,h=THREE.GeometryUtils.__v1;d=THREE.GeometryUtils.random();g=THREE.GeometryUtils.random();d+g>1&&(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)<b?THREE.GeometryUtils.randomPointInTriangle(d,g,c):THREE.GeometryUtils.randomPointInTriangle(g,f,c)}},randomPointsInGeometry:function(a,c){function b(a){function b(c,d){if(d<c)return c;var f=c+Math.floor((d-c)/2);return l[f]>a?b(c,f-1):l[f]<a?b(f+1,d):f}return b(0,l.length-1)}var d,g,f=a.faces,e=a.vertices,h=f.length,i=0,l=[],k,o,p,m;for(g=0;g<h;g++){d=f[g];if(d instanceof THREE.Face3)k=e[d.a].position,o=e[d.b].position,p=e[d.c].position,d._area=THREE.GeometryUtils.triangleArea(k,o,p);else if(d instanceof +e)<b?THREE.GeometryUtils.randomPointInTriangle(d,g,c):THREE.GeometryUtils.randomPointInTriangle(g,f,c)}},randomPointsInGeometry:function(a,c){function b(a){function b(c,d){if(d<c)return c;var e=c+Math.floor((d-c)/2);return l[e]>a?b(c,e-1):l[e]<a?b(e+1,d):e}return b(0,l.length-1)}var d,g,f=a.faces,e=a.vertices,h=f.length,i=0,l=[],k,o,p,m;for(g=0;g<h;g++){d=f[g];if(d instanceof THREE.Face3)k=e[d.a].position,o=e[d.b].position,p=e[d.c].position,d._area=THREE.GeometryUtils.triangleArea(k,o,p);else if(d instanceof THREE.Face4)k=e[d.a].position,o=e[d.b].position,p=e[d.c].position,m=e[d.d].position,d._area1=THREE.GeometryUtils.triangleArea(k,o,m),d._area2=THREE.GeometryUtils.triangleArea(o,p,m),d._area=d._area1+d._area2;i+=d._area;l[g]=i}d=[];e={};for(g=0;g<c;g++)h=THREE.GeometryUtils.random()*i,h=b(h),d[g]=THREE.GeometryUtils.randomPointInFace(f[h],a,!0),e[h]?e[h]+=1:e[h]=1;return d},triangleArea:function(a,c,b){var d,g=THREE.GeometryUtils.__v1;g.sub(a,c);d=g.length();g.sub(a,b);a=g.length();g.sub(c,b);b=g.length(); c=0.5*(d+a+b);return Math.sqrt(c*(c-d)*(c-a)*(c-b))},center:function(a){a.computeBoundingBox();var c=new THREE.Matrix4;c.setTranslation(-0.5*(a.boundingBox.x[1]+a.boundingBox.x[0]),-0.5*(a.boundingBox.y[1]+a.boundingBox.y[0]),-0.5*(a.boundingBox.z[1]+a.boundingBox.z[0]));a.applyMatrix(c);a.computeBoundingBox()}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3; THREE.ImageUtils={loadTexture:function(a,c,b){var d=new Image,g=new THREE.Texture(d,c);d.onload=function(){g.needsUpdate=!0;b&&b(this)};d.crossOrigin="";d.src=a;return g},loadTextureCube:function(a,c,b){var d,g=[],f=new THREE.Texture(g,c),c=g.loadCount=0;for(d=a.length;c<d;++c)g[c]=new Image,g[c].onload=function(){g.loadCount+=1;if(g.loadCount===6)f.needsUpdate=!0;b&&b(this)},g[c].crossOrigin="",g[c].src=a[c];return f},getNormalMap:function(a,c){var b=function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+ @@ -365,11 +365,11 @@ a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]};c|=1;var d=a.width,g=a.height,f=documen q.push([1,0,h[(o*d+n)*4]/255*c]);q.push([1,1,h[(m*d+n)*4]/255*c]);q.push([0,1,h[(m*d+k)*4]/255*c]);q.push([-1,1,h[(m*d+r)*4]/255*c]);p=[];r=q.length;for(m=0;m<r;m++){var n=q[m],w=q[(m+1)%r],n=[n[0]-t[0],n[1]-t[1],n[2]-t[2]],w=[w[0]-t[0],w[1]-t[1],w[2]-t[2]];p.push(b([n[1]*w[2]-n[2]*w[1],n[2]*w[0]-n[0]*w[2],n[0]*w[1]-n[1]*w[0]]))}q=[0,0,0];for(m=0;m<p.length;m++)q[0]+=p[m][0],q[1]+=p[m][1],q[2]+=p[m][2];q[0]/=p.length;q[1]/=p.length;q[2]/=p.length;t=(o*d+k)*4;l[t]=(q[0]+1)/2*255|0;l[t+1]=(q[1]+0.5)* 255|0;l[t+2]=q[2]*255|0;l[t+3]=255}e.putImageData(i,0,0);return f}}; THREE.SceneUtils={showHierarchy:function(a,c){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=c})},traverseHierarchy:function(a,c){var b,d,g=a.children.length;for(d=0;d<g;d++)b=a.children[d],c(b),THREE.SceneUtils.traverseHierarchy(b,c)},createMultiMaterialObject:function(a,c){var b,d=c.length,g=new THREE.Object3D;for(b=0;b<d;b++){var f=new THREE.Mesh(a,c[b]);g.add(f)}return g},cloneObject:function(a){var c;a instanceof THREE.MorphAnimMesh?(c=new THREE.MorphAnimMesh(a.geometry,a.material), -c.duration=a.duration,c.mirroredLoop=a.mirroredLoop,c.time=a.time,c.lastKeyframe=a.lastKeyframe,c.currentKeyframe=a.currentKeyframe,c.direction=a.direction,c.directionBackwards=a.directionBackwards):a instanceof THREE.Mesh?c=new THREE.Mesh(a.geometry,a.material):a instanceof THREE.Line?c=new THREE.Line(a.geometry,a.material,a.type):a instanceof THREE.Ribbon?c=new THREE.Ribbon(a.geometry,a.material):a instanceof THREE.ParticleSystem?(c=new THREE.ParticleSystem(a.geometry,a.material),c.sortParticles= -a.sortParticles):a instanceof THREE.Particle?c=new THREE.Particle(a.material):a instanceof THREE.Sprite?(c=new THREE.Sprite({}),c.color.copy(a.color),c.map=a.map,c.blending=a.blending,c.useScreenCoordinates=a.useScreenCoordinates,c.mergeWith3D=a.mergeWith3D,c.affectedByDistance=a.affectedByDistance,c.scaleByViewport=a.scaleByViewport,c.alignment=a.alignment,c.rotation3d.copy(a.rotation3d),c.rotation=a.rotation,c.opacity=a.opacity,c.uvOffset.copy(a.uvOffset),c.uvScale.copy(a.uvScale)):a instanceof -THREE.LOD?c=new THREE.LOD:a instanceof THREE.SkinnedMesh?c=new THREE.SkinnedMesh:a instanceof THREE.MarchingCubes?(c=new THREE.MarchingCubes(a.resolution,a.material),c.field.set(a.field),c.isolation=a.isolation):a instanceof THREE.Object3D&&(c=new THREE.Object3D);c.parent=a.parent;c.up.copy(a.up);c.position.copy(a.position);c.rotation instanceof THREE.Vector3&&c.rotation.copy(a.rotation);c.eulerOrder=a.eulerOrder;c.scale.copy(a.scale);c.dynamic=a.dynamic;c.doubleSided=a.doubleSided;c.flipSided=a.flipSided; -c.renderDepth=a.renderDepth;c.rotationAutoUpdate=a.rotationAutoUpdate;c.matrix.copy(a.matrix);c.matrixWorld.copy(a.matrixWorld);c.matrixRotationWorld.copy(a.matrixRotationWorld);c.matrixAutoUpdate=a.matrixAutoUpdate;c.matrixWorldNeedsUpdate=a.matrixWorldNeedsUpdate;c.quaternion.copy(a.quaternion);c.useQuaternion=a.useQuaternion;c.boundRadius=a.boundRadius;c.boundRadiusScale=a.boundRadiusScale;c.visible=a.visible;c.castShadow=a.castShadow;c.receiveShadow=a.receiveShadow;c.frustumCulled=a.frustumCulled; -for(var b=0;b<a.children.length;b++){var d=THREE.SceneUtils.cloneObject(a.children[b]);c.children[b]=d;d.parent=c}if(a instanceof THREE.LOD)for(b=0;b<a.LODs.length;b++)c.LODs[b]={visibleAtDistance:a.LODs[b].visibleAtDistance,object3D:c.children[b]};return c}}; +c.duration=a.duration,c.mirroredLoop=a.mirroredLoop,c.time=a.time,c.lastKeyframe=a.lastKeyframe,c.currentKeyframe=a.currentKeyframe,c.direction=a.direction,c.directionBackwards=a.directionBackwards):a instanceof THREE.SkinnedMesh?c=new THREE.SkinnedMesh(a.geometry,a.material):a instanceof THREE.Mesh?c=new THREE.Mesh(a.geometry,a.material):a instanceof THREE.Line?c=new THREE.Line(a.geometry,a.material,a.type):a instanceof THREE.Ribbon?c=new THREE.Ribbon(a.geometry,a.material):a instanceof THREE.ParticleSystem? +(c=new THREE.ParticleSystem(a.geometry,a.material),c.sortParticles=a.sortParticles):a instanceof THREE.Particle?c=new THREE.Particle(a.material):a instanceof THREE.Sprite?(c=new THREE.Sprite({}),c.color.copy(a.color),c.map=a.map,c.blending=a.blending,c.useScreenCoordinates=a.useScreenCoordinates,c.mergeWith3D=a.mergeWith3D,c.affectedByDistance=a.affectedByDistance,c.scaleByViewport=a.scaleByViewport,c.alignment=a.alignment,c.rotation3d.copy(a.rotation3d),c.rotation=a.rotation,c.opacity=a.opacity, +c.uvOffset.copy(a.uvOffset),c.uvScale.copy(a.uvScale)):a instanceof THREE.LOD?c=new THREE.LOD:a instanceof THREE.MarchingCubes?(c=new THREE.MarchingCubes(a.resolution,a.material),c.field.set(a.field),c.isolation=a.isolation):a instanceof THREE.Object3D&&(c=new THREE.Object3D);c.parent=a.parent;c.up.copy(a.up);c.position.copy(a.position);c.rotation instanceof THREE.Vector3&&c.rotation.copy(a.rotation);c.eulerOrder=a.eulerOrder;c.scale.copy(a.scale);c.dynamic=a.dynamic;c.doubleSided=a.doubleSided;c.flipSided= +a.flipSided;c.renderDepth=a.renderDepth;c.rotationAutoUpdate=a.rotationAutoUpdate;c.matrix.copy(a.matrix);c.matrixWorld.copy(a.matrixWorld);c.matrixRotationWorld.copy(a.matrixRotationWorld);c.matrixAutoUpdate=a.matrixAutoUpdate;c.matrixWorldNeedsUpdate=a.matrixWorldNeedsUpdate;c.quaternion.copy(a.quaternion);c.useQuaternion=a.useQuaternion;c.boundRadius=a.boundRadius;c.boundRadiusScale=a.boundRadiusScale;c.visible=a.visible;c.castShadow=a.castShadow;c.receiveShadow=a.receiveShadow;c.frustumCulled= +a.frustumCulled;for(var b=0;b<a.children.length;b++){var d=THREE.SceneUtils.cloneObject(a.children[b]);c.children[b]=d;d.parent=c}if(a instanceof THREE.LOD)for(b=0;b<a.LODs.length;b++)c.LODs[b]={visibleAtDistance:a.LODs[b].visibleAtDistance,object3D:c.children[b]};return c}}; if(THREE.WebGLRenderer)THREE.ShaderUtils={lib:{fresnel:{uniforms:{mRefractionRatio:{type:"f",value:1.02},mFresnelBias:{type:"f",value:0.1},mFresnelPower:{type:"f",value:2},mFresnelScale:{type:"f",value:1},tCube:{type:"t",value:1,texture:null}},fragmentShader:"uniform samplerCube tCube;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\nvec4 refractedColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nrefractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;\nrefractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;\nrefractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;\nrefractedColor.a = 1.0;\ngl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );\n}", vertexShader:"uniform float mRefractionRatio;\nuniform float mFresnelBias;\nuniform float mFresnelScale;\nuniform float mFresnelPower;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = normalize ( mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal );\nvec3 I = mPosition.xyz - cameraPosition;\nvReflect = reflect( I, nWorld );\nvRefract[0] = refract( normalize( I ), nWorld, mRefractionRatio );\nvRefract[1] = refract( normalize( I ), nWorld, mRefractionRatio * 0.99 );\nvRefract[2] = refract( normalize( I ), nWorld, mRefractionRatio * 0.98 );\nvReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), nWorld ), mFresnelPower );\ngl_Position = projectionMatrix * mvPosition;\n}"}, normal:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.fog,THREE.UniformsLib.lights,THREE.UniformsLib.shadowmap,{enableAO:{type:"i",value:0},enableDiffuse:{type:"i",value:0},enableSpecular:{type:"i",value:0},enableReflection:{type:"i",value:0},tDiffuse:{type:"t",value:0,texture:null},tCube:{type:"t",value:1,texture:null},tNormal:{type:"t",value:2,texture:null},tSpecular:{type:"t",value:3,texture:null},tAO:{type:"t",value:4,texture:null},tDisplacement:{type:"t",value:5,texture:null},uNormalScale:{type:"f", @@ -452,7 +452,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= @@ -460,16 +460,16 @@ function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!0;break;case 37: 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)* 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<q-1;e++)t=d*h.chunks[e]/h.total,b.keys[e]={time:t,pos:g[e]};f.hierarchy[0]= -b;THREE.AnimationHandler.add(f);return new THREE.Animation(a,c,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function f(a,b){var c,d,f=new THREE.Geometry;for(c=0;c<a.points.length*b;c++)d=c/(a.points.length*b),d=a.getPoint(d),f.vertices[c]=new THREE.Vertex(new THREE.Vector3(d.x,d.y,d.z));return f}this.object=a;this.domElement=c!==void 0?c:document;this.id="PathControls"+THREE.PathControlsIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath= -new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookHorizontal=this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.target=new THREE.Object3D;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX= +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 e={name:c,fps:0.6,length:d,hierarchy:[]},f,g=b.getControlPointsArray(),h=b.getLength(),q=g.length,t=0;f=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[f]={time:d,pos:g[f],rot:[0,0,0,1],scl:[1,1,1]};for(f=1;f<q-1;f++)t=d*h.chunks[f]/h.total,b.keys[f]={time:t,pos:g[f]};e.hierarchy[0]= +b;THREE.AnimationHandler.add(e);return new THREE.Animation(a,c,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function f(a,b){var c,d,e=new THREE.Geometry;for(c=0;c<a.points.length*b;c++)d=c/(a.points.length*b),d=a.getPoint(d),e.vertices[c]=new THREE.Vertex(new THREE.Vector3(d.x,d.y,d.z));return e}this.object=a;this.domElement=c!==void 0?c:document;this.id="PathControls"+THREE.PathControlsIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath= +new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.005;this.lookHorizontal=this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.target=new THREE.Object3D;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;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));var e=Math.PI*2,h=Math.PI/180;this.update=function(a){var c;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed*a);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed*a);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*h;this.theta=this.lon*h;a=this.phi%e;this.phi=a>=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;m<b.points.length;m++)c=new THREE.Mesh(e,h),c.position.copy(b.points[m]),a.add(c)}this.domElement.addEventListener("mousemove",d(this,this.onMouseMove), !1)}};THREE.PathControlsIdCounter=0; -THREE.FlyControls=function(a,c){function b(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.domElement=c!==void 0?c:document;c&&this.domElement.setAttribute("tabindex",-1);this.movementSpeed=1;this.rollSpeed=0.0050;this.autoForward=this.dragToLook=!1;this.object.useQuaternion=!0;this.tmpQuaternion=new THREE.Quaternion;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0, +THREE.FlyControls=function(a,c){function b(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.domElement=c!==void 0?c:document;c&&this.domElement.setAttribute("tabindex",-1);this.movementSpeed=1;this.rollSpeed=0.005;this.autoForward=this.dragToLook=!1;this.object.useQuaternion=!0;this.tmpQuaternion=new THREE.Quaternion;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0, 0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.keydown=function(a){if(!a.altKey){switch(a.keyCode){case 16:this.movementSpeedMultiplier=0.1;break;case 87:this.moveState.forward=1;break;case 83:this.moveState.back=1;break;case 65:this.moveState.left=1;break;case 68:this.moveState.right=1;break;case 82:this.moveState.up=1;break;case 70:this.moveState.down=1;break;case 38:this.moveState.pitchUp=1;break;case 40:this.moveState.pitchDown= 1;break;case 37:this.moveState.yawLeft=1;break;case 39:this.moveState.yawRight=1;break;case 81:this.moveState.rollLeft=1;break;case 69:this.moveState.rollRight=1}this.updateMovementVector();this.updateRotationVector()}};this.keyup=function(a){switch(a.keyCode){case 16:this.movementSpeedMultiplier=1;break;case 87:this.moveState.forward=0;break;case 83:this.moveState.back=0;break;case 65:this.moveState.left=0;break;case 68:this.moveState.right=0;break;case 82:this.moveState.up=0;break;case 70:this.moveState.down= 0;break;case 38:this.moveState.pitchUp=0;break;case 40:this.moveState.pitchDown=0;break;case 37:this.moveState.yawLeft=0;break;case 39:this.moveState.yawRight=0;break;case 81:this.moveState.rollLeft=0;break;case 69:this.moveState.rollRight=0}this.updateMovementVector();this.updateRotationVector()};this.mousedown=function(a){this.domElement!==document&&this.domElement.focus();a.preventDefault();a.stopPropagation();if(this.dragToLook)this.mouseStatus++;else switch(a.button){case 0:this.object.moveForward= @@ -502,20 +502,20 @@ this.vertices[b].position.clone().setY(0).normalize(),n=this.vertices[o].positio 1],p=this.vertices.length-1,r=new THREE.Vector3(0,1,0),n=new THREE.Vector3(0,1,0),q=new THREE.Vector3(0,1,0),w=k[0][h].clone(),u=k[0][h+1].clone(),B=new THREE.UV(u.u,0),this.faces.push(new THREE.Face3(b,o,p,[r,n,q])),this.faceVertexUvs[0].push([w,u,B])}if(!f&&c>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-e,0)));for(h=0;h<d;h++)b=l[i][h+1],o=l[i][h],p=this.vertices.length-1,r=new THREE.Vector3(0,-1,0),n=new THREE.Vector3(0,-1,0),q=new THREE.Vector3(0,-1,0),w=k[i][h+1].clone(),u=k[i][h].clone(), B=new THREE.UV(u.u,1),this.faces.push(new THREE.Face3(b,o,p,[r,n,q])),this.faceVertexUvs[0].push([w,u,B])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry; THREE.ExtrudeGeometry=function(a,c){if(typeof a!=="undefined"){THREE.Geometry.call(this);var a=a instanceof Array?a:[a],b,d=a.length,g;this.shapebb=a[d-1].getBoundingBox();for(b=0;b<d;b++)g=a[b],this.addShape(g,c);this.computeCentroids();this.computeFaceNormals()}};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry; -THREE.ExtrudeGeometry.prototype.addShape=function(a,c){function b(a,b,c){b||console.log("die");return b.clone().multiplyScalar(c).addSelf(a)}function d(a,b,c){var d=THREE.ExtrudeGeometry.__v1,f=THREE.ExtrudeGeometry.__v2,e=THREE.ExtrudeGeometry.__v3,g=THREE.ExtrudeGeometry.__v4,h=THREE.ExtrudeGeometry.__v5,i=THREE.ExtrudeGeometry.__v6;d.set(a.x-b.x,a.y-b.y);f.set(a.x-c.x,a.y-c.y);d=d.normalize();f=f.normalize();e.set(-d.y,d.x);g.set(f.y,-f.x);h.copy(a).addSelf(e);i.copy(a).addSelf(g);if(h.equals(i))return g.clone(); -h.copy(b).addSelf(e);i.copy(c).addSelf(g);e=d.dot(g);g=i.subSelf(h).dot(g);e===0&&(console.log("Either infinite or no solutions!"),g===0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));g/=e;if(g<0)return b=Math.atan2(b.y-a.y,b.x-a.x),a=Math.atan2(c.y-a.y,c.x-a.x),b>a&&(a+=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(s=a.length;--s>=0;){S=s;ba=s-1;ba<0&&(ba=a.length-1);for(var b= -0,c=m+k*2,b=0;b<c;b++){var d=O*b,f=O*(b+1),e=W+S+d,g=W+S+f,l=e,d=W+ba+d,f=W+ba+f,n=g;l+=J;d+=J;f+=J;n+=J;v.faces.push(new THREE.Face4(l,d,f,n,null,null,B));B&&(l=b/c,d=(b+1)/c,f=h+i*2,e=(v.vertices[e].position.z+i)/f,g=(v.vertices[g].position.z+i)/f,v.faceVertexUvs[0].push([new THREE.UV(e,l),new THREE.UV(g,l),new THREE.UV(g,d),new THREE.UV(e,d)]))}}}function f(a,b,c){v.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function e(a,b,c){a+=J;b+=J;c+=J;v.faces.push(new THREE.Face3(a,b,c,null, -null,u));if(u){var d=F.maxY,f=F.maxX,e=v.vertices[b].position.x,b=v.vertices[b].position.y,g=v.vertices[c].position.x,c=v.vertices[c].position.y;v.faceVertexUvs[0].push([new THREE.UV(v.vertices[a].position.x/f,v.vertices[a].position.y/d),new THREE.UV(e/f,b/d),new THREE.UV(g/f,c/d)])}}var h=c.amount!==void 0?c.amount:100,i=c.bevelThickness!==void 0?c.bevelThickness:6,l=c.bevelSize!==void 0?c.bevelSize:i-2,k=c.bevelSegments!==void 0?c.bevelSegments:3,o=c.bevelEnabled!==void 0?c.bevelEnabled:!0,p=c.curveSegments!== +THREE.ExtrudeGeometry.prototype.addShape=function(a,c){function b(a,b,c){b||console.log("die");return b.clone().multiplyScalar(c).addSelf(a)}function d(a,b,c){var d=THREE.ExtrudeGeometry.__v1,e=THREE.ExtrudeGeometry.__v2,f=THREE.ExtrudeGeometry.__v3,g=THREE.ExtrudeGeometry.__v4,h=THREE.ExtrudeGeometry.__v5,i=THREE.ExtrudeGeometry.__v6;d.set(a.x-b.x,a.y-b.y);e.set(a.x-c.x,a.y-c.y);d=d.normalize();e=e.normalize();f.set(-d.y,d.x);g.set(e.y,-e.x);h.copy(a).addSelf(f);i.copy(a).addSelf(g);if(h.equals(i))return g.clone(); +h.copy(b).addSelf(f);i.copy(c).addSelf(g);f=d.dot(g);g=i.subSelf(h).dot(g);f===0&&(console.log("Either infinite or no solutions!"),g===0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));g/=f;if(g<0)return b=Math.atan2(b.y-a.y,b.x-a.x),a=Math.atan2(c.y-a.y,c.x-a.x),b>a&&(a+=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(s=a.length;--s>=0;){S=s;ba=s-1;ba<0&&(ba=a.length-1);for(var b= +0,c=m+k*2,b=0;b<c;b++){var d=O*b,e=O*(b+1),f=W+S+d,g=W+S+e,l=f,d=W+ba+d,e=W+ba+e,n=g;l+=J;d+=J;e+=J;n+=J;v.faces.push(new THREE.Face4(l,d,e,n,null,null,B));B&&(l=b/c,d=(b+1)/c,e=h+i*2,f=(v.vertices[f].position.z+i)/e,g=(v.vertices[g].position.z+i)/e,v.faceVertexUvs[0].push([new THREE.UV(f,l),new THREE.UV(g,l),new THREE.UV(g,d),new THREE.UV(f,d)]))}}}function f(a,b,c){v.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function e(a,b,c){a+=J;b+=J;c+=J;v.faces.push(new THREE.Face3(a,b,c,null, +null,u));if(u){var d=F.maxY,e=F.maxX,f=v.vertices[b].position.x,b=v.vertices[b].position.y,g=v.vertices[c].position.x,c=v.vertices[c].position.y;v.faceVertexUvs[0].push([new THREE.UV(v.vertices[a].position.x/e,v.vertices[a].position.y/d),new THREE.UV(f/e,b/d),new THREE.UV(g/e,c/d)])}}var h=c.amount!==void 0?c.amount:100,i=c.bevelThickness!==void 0?c.bevelThickness:6,l=c.bevelSize!==void 0?c.bevelSize:i-2,k=c.bevelSegments!==void 0?c.bevelSegments:3,o=c.bevelEnabled!==void 0?c.bevelEnabled:!0,p=c.curveSegments!== void 0?c.curveSegments:12,m=c.steps!==void 0?c.steps:1,r=c.bendPath,n=c.extrudePath,q,t=!1,w=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,u=c.material,B=c.extrudeMaterial,F=this.shapebb;if(n)q=n.getPoints(p),m=q.length,t=!0,o=!1;o||(l=i=k=0);var A,x,y,v=this,J=this.vertices.length;r&&a.addWrapPath(r);p=w?a.extractAllSpacedPoints(p):a.extractAllPoints(p);r=p.shape;p=p.holes;if(n=!THREE.Shape.Utils.isClockWise(r)){r=r.reverse();x=0;for(y=p.length;x<y;x++)A=p[x],THREE.Shape.Utils.isClockWise(A)&& (p[x]=A.reverse());n=!1}n=THREE.Shape.Utils.triangulateShape(r,p);w=r;x=0;for(y=p.length;x<y;x++)A=p[x],r=r.concat(A);var s,E,R,U,K,P,O=r.length,aa=n.length,H=[];s=0;E=w.length;S=E-1;for(ba=s+1;s<E;s++,S++,ba++)S===E&&(S=0),ba===E&&(ba=0),H[s]=d(w[s],w[S],w[ba]);var G=[],I,M=H.concat();x=0;for(y=p.length;x<y;x++){A=p[x];I=[];s=0;E=A.length;S=E-1;for(ba=s+1;s<E;s++,S++,ba++)S===E&&(S=0),ba===E&&(ba=0),I[s]=d(A[s],A[S],A[ba]);G.push(I);M=M.concat(I)}for(R=0;R<k;R++){U=R/k;K=i*(1-U);U=l*Math.sin(U*Math.PI/ 2);s=0;for(E=w.length;s<E;s++)P=b(w[s],H[s],U),f(P.x,P.y,-K);x=0;for(y=p.length;x<y;x++){A=p[x];I=G[x];s=0;for(E=A.length;s<E;s++)P=b(A[s],I[s],U),f(P.x,P.y,-K)}}U=l;for(s=0;s<O;s++)P=o?b(r[s],M[s],U):r[s],t?f(P.x,P.y+q[0].y,q[0].x):f(P.x,P.y,0);for(R=1;R<=m;R++)for(s=0;s<O;s++)P=o?b(r[s],M[s],U):r[s],t?f(P.x,P.y+q[R-1].y,q[R-1].x):f(P.x,P.y,h/m*R);for(R=k-1;R>=0;R--){U=R/k;K=i*(1-U);U=l*Math.sin(U*Math.PI/2);s=0;for(E=w.length;s<E;s++)P=b(w[s],H[s],U),f(P.x,P.y,h+K);x=0;for(y=p.length;x<y;x++){A= p[x];I=G[x];s=0;for(E=A.length;s<E;s++)P=b(A[s],I[s],U),t?f(P.x,P.y+q[m-1].y,q[m-1].x+K):f(P.x,P.y,h+K)}}if(o){o=O*0;for(s=0;s<aa;s++)l=n[s],e(l[2]+o,l[1]+o,l[0]+o);o=O*(m+k*2);for(s=0;s<aa;s++)l=n[s],e(l[0]+o,l[1]+o,l[2]+o)}else{for(s=0;s<aa;s++)l=n[s],e(l[2],l[1],l[0]);for(s=0;s<aa;s++)l=n[s],e(l[0]+O*m,l[1]+O*m,l[2]+O*m)}var S,ba,W=0;g(w);W+=w.length;x=0;for(y=p.length;x<y;x++)A=p[x],g(A),W+=A.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2; THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;THREE.ExtrudeGeometry.__v5=new THREE.Vector2;THREE.ExtrudeGeometry.__v6=new THREE.Vector2; -THREE.IcosahedronGeometry=function(a){function c(a,b,c){var d=Math.sqrt(a*a+b*b+c*c);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(a/d,b/d,c/d)))-1}function b(a,b,c,d){var f=g.vertices[a].position,e=g.vertices[b].position,h=g.vertices[c].position,a=new THREE.Face3(a,b,c);a.vertexNormals.push(f.clone().normalize(),e.clone().normalize(),h.clone().normalize());d.faces.push(a);d.faceVertexUvs[0].push([new THREE.UV(1-(Math.atan2(f.z,f.x)+Math.PI)%Math.PI/Math.PI*0.5,0.5-f.y/2),new THREE.UV(1- -(Math.atan2(e.z,e.x)+Math.PI)%Math.PI/Math.PI*0.5,0.5-e.y/2),new THREE.UV(1-(Math.atan2(h.z,h.x)+Math.PI)%Math.PI/Math.PI*0.5,0.5-h.y/2)])}function d(a,b){var d=g.vertices[a].position,f=g.vertices[b].position;return c((d.x+f.x)/2,(d.y+f.y)/2,(d.z+f.z)/2)}var g=this,f=new THREE.Geometry;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;c(-1,a,0);c(1,a,0);c(-1,-a,0);c(1,-a,0);c(0,-1,a);c(0,1,a);c(0,-1,-a);c(0,1,-a);c(a,0,-1);c(a,0,1);c(-a,0,-1);c(-a,0,1);b(0,11,5,f);b(0,5,1,f);b(0, +THREE.IcosahedronGeometry=function(a){function c(a,b,c){var d=Math.sqrt(a*a+b*b+c*c);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(a/d,b/d,c/d)))-1}function b(a,b,c,d){var e=g.vertices[a].position,f=g.vertices[b].position,h=g.vertices[c].position,a=new THREE.Face3(a,b,c);a.vertexNormals.push(e.clone().normalize(),f.clone().normalize(),h.clone().normalize());d.faces.push(a);d.faceVertexUvs[0].push([new THREE.UV(1-(Math.atan2(e.z,e.x)+Math.PI)%Math.PI/Math.PI*0.5,0.5-e.y/2),new THREE.UV(1- +(Math.atan2(f.z,f.x)+Math.PI)%Math.PI/Math.PI*0.5,0.5-f.y/2),new THREE.UV(1-(Math.atan2(h.z,h.x)+Math.PI)%Math.PI/Math.PI*0.5,0.5-h.y/2)])}function d(a,b){var d=g.vertices[a].position,e=g.vertices[b].position;return c((d.x+e.x)/2,(d.y+e.y)/2,(d.z+e.z)/2)}var g=this,f=new THREE.Geometry;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;c(-1,a,0);c(1,a,0);c(-1,-a,0);c(1,-a,0);c(0,-1,a);c(0,1,a);c(0,-1,-a);c(0,1,-a);c(a,0,-1);c(a,0,1);c(-a,0,-1);c(-a,0,1);b(0,11,5,f);b(0,5,1,f);b(0, 1,7,f);b(0,7,10,f);b(0,10,11,f);b(1,5,9,f);b(5,11,4,f);b(11,10,2,f);b(10,7,6,f);b(7,1,8,f);b(3,9,4,f);b(3,4,2,f);b(3,2,6,f);b(3,6,8,f);b(3,8,9,f);b(4,9,5,f);b(2,4,11,f);b(6,2,10,f);b(8,6,7,f);b(9,8,1,f);for(var e=0;e<this.subdivisions;e++){var a=new THREE.Geometry,h;for(h in f.faces){var i=d(f.faces[h].a,f.faces[h].b),l=d(f.faces[h].b,f.faces[h].c),k=d(f.faces[h].c,f.faces[h].a);b(f.faces[h].a,i,k,a);b(f.faces[h].b,l,i,a);b(f.faces[h].c,k,l,a);b(i,l,k,a)}f.faces=a.faces;f.faceVertexUvs[0]=a.faceVertexUvs[0]}g.faces= -f.faces;g.faceVertexUvs[0]=f.faceVertexUvs[0];this.computeCentroids();this.computeFaceNormals(!0)};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry; -THREE.LatheGeometry=function(a,c,b){THREE.Geometry.call(this);this.steps=c||12;this.angle=b||2*Math.PI;for(var c=this.angle/this.steps,b=[],d=[],g=[],f=[],e=(new THREE.Matrix4).setRotationZ(c),h=0;h<a.length;h++)this.vertices.push(new THREE.Vertex(a[h])),b[h]=a[h].clone(),d[h]=this.vertices.length-1;for(var i=0;i<=this.angle+0.0010;i+=c){for(h=0;h<b.length;h++)i<this.angle?(b[h]=e.multiplyVector3(b[h].clone()),this.vertices.push(new THREE.Vertex(b[h])),g[h]=this.vertices.length-1):g=f;i==0&&(f=d); +f.faces;g.faceVertexUvs[0]=f.faceVertexUvs[0];this.computeCentroids();this.computeFaceNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry; +THREE.LatheGeometry=function(a,c,b){THREE.Geometry.call(this);this.steps=c||12;this.angle=b||2*Math.PI;for(var c=this.angle/this.steps,b=[],d=[],g=[],f=[],e=(new THREE.Matrix4).setRotationZ(c),h=0;h<a.length;h++)this.vertices.push(new THREE.Vertex(a[h])),b[h]=a[h].clone(),d[h]=this.vertices.length-1;for(var i=0;i<=this.angle+0.001;i+=c){for(h=0;h<b.length;h++)i<this.angle?(b[h]=e.multiplyVector3(b[h].clone()),this.vertices.push(new THREE.Vertex(b[h])),g[h]=this.vertices.length-1):g=f;i==0&&(f=d); for(h=0;h<d.length-1;h++)this.faces.push(new THREE.Face4(g[h],g[h+1],d[h+1],d[h])),this.faceVertexUvs[0].push([new THREE.UV(1-i/this.angle,h/a.length),new THREE.UV(1-i/this.angle,(h+1)/a.length),new THREE.UV(1-(i-c)/this.angle,(h+1)/a.length),new THREE.UV(1-(i-c)/this.angle,h/a.length)]);d=g;g=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry; THREE.OctahedronGeometry=function(a,c){function b(b){var c=b.clone().normalize(),c=new THREE.Vertex(c.clone().multiplyScalar(a));c.index=e.vertices.push(c)-1;c.uv=new THREE.UV(Math.atan2(b.z,-b.x)/2/Math.PI+0.5,Math.atan2(-b.y,Math.sqrt(b.x*b.x+b.z*b.z))/Math.PI+0.5);return c}function d(a,b,c,h){h<1?(h=new THREE.Face3(a.index,b.index,c.index,[a.position,b.position,c.position]),h.centroid.addSelf(a.position).addSelf(b.position).addSelf(c.position).divideScalar(3),h.normal=h.centroid.clone().normalize(), e.faces.push(h),h=Math.atan2(h.centroid.z,-h.centroid.x),e.faceVertexUvs[0].push([f(a.uv,a.position,h),f(b.uv,b.position,h),f(c.uv,c.position,h)])):(h-=1,d(a,g(a,b),g(a,c),h),d(g(a,b),b,g(b,c),h),d(g(a,c),g(b,c),c,h),d(g(a,b),g(b,c),g(a,c),h))}function g(a,c){h[a.index]||(h[a.index]=[]);h[c.index]||(h[c.index]=[]);var d=h[a.index][c.index];d===void 0&&(h[a.index][c.index]=h[c.index][a.index]=d=b((new THREE.Vector3).add(a.position,c.position).divideScalar(2)));return d}function f(a,b,c){c<0&&a.u=== @@ -538,13 +538,13 @@ F=void 0,A=void 0,x=void 0,y=void 0,v=void 0,J=void 0,u=p[t[m]].x,B=p[t[m]].y,F= THREE.TorusGeometry=function(a,c,b,d,g){THREE.Geometry.call(this);this.radius=a||100;this.tube=c||40;this.segmentsR=b||8;this.segmentsT=d||6;this.arc=g||Math.PI*2;g=new THREE.Vector3;a=[];c=[];for(b=0;b<=this.segmentsR;b++)for(d=0;d<=this.segmentsT;d++){var f=d/this.segmentsT*this.arc,e=b/this.segmentsR*Math.PI*2;g.x=this.radius*Math.cos(f);g.y=this.radius*Math.sin(f);var h=new THREE.Vector3;h.x=(this.radius+this.tube*Math.cos(e))*Math.cos(f);h.y=(this.radius+this.tube*Math.cos(e))*Math.sin(f);h.z= this.tube*Math.sin(e);this.vertices.push(new THREE.Vertex(h));a.push(new THREE.UV(d/this.segmentsT,1-b/this.segmentsR));c.push(h.clone().subSelf(g).normalize())}for(b=1;b<=this.segmentsR;b++)for(d=1;d<=this.segmentsT;d++){var g=(this.segmentsT+1)*b+d-1,f=(this.segmentsT+1)*(b-1)+d-1,e=(this.segmentsT+1)*(b-1)+d,h=(this.segmentsT+1)*b+d,i=new THREE.Face4(g,f,e,h,[c[g],c[f],c[e],c[h]]);i.normal.addSelf(c[g]);i.normal.addSelf(c[f]);i.normal.addSelf(c[e]);i.normal.addSelf(c[h]);i.normal.normalize();this.faces.push(i); this.faceVertexUvs[0].push([a[g].clone(),a[f].clone(),a[e].clone(),a[h].clone()])}this.computeCentroids()};THREE.TorusGeometry.prototype=new THREE.Geometry;THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry; -THREE.TorusKnotGeometry=function(a,c,b,d,g,f,e){function h(a,b,c,d,f,e){b=c/d*a;c=Math.cos(b);return new THREE.Vector3(f*(2+c)*0.5*Math.cos(a),f*(2+c)*Math.sin(a)*0.5,e*f*Math.sin(b)*0.5)}THREE.Geometry.call(this);this.radius=a||200;this.tube=c||40;this.segmentsR=b||64;this.segmentsT=d||8;this.p=g||2;this.q=f||3;this.heightScale=e||1;this.grid=Array(this.segmentsR);b=new THREE.Vector3;d=new THREE.Vector3;f=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=Array(this.segmentsT);for(c=0;c< +THREE.TorusKnotGeometry=function(a,c,b,d,g,f,e){function h(a,b,c,d,e,f){b=c/d*a;c=Math.cos(b);return new THREE.Vector3(e*(2+c)*0.5*Math.cos(a),e*(2+c)*Math.sin(a)*0.5,f*e*Math.sin(b)*0.5)}THREE.Geometry.call(this);this.radius=a||200;this.tube=c||40;this.segmentsR=b||64;this.segmentsT=d||8;this.p=g||2;this.q=f||3;this.heightScale=e||1;this.grid=Array(this.segmentsR);b=new THREE.Vector3;d=new THREE.Vector3;f=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=Array(this.segmentsT);for(c=0;c< this.segmentsT;++c){var i=a/this.segmentsR*2*this.p*Math.PI,e=c/this.segmentsT*2*Math.PI,g=h(i,e,this.q,this.p,this.radius,this.heightScale),i=h(i+0.01,e,this.q,this.p,this.radius,this.heightScale);b.x=i.x-g.x;b.y=i.y-g.y;b.z=i.z-g.z;d.x=i.x+g.x;d.y=i.y+g.y;d.z=i.z+g.z;f.cross(b,d);d.cross(f,b);f.normalize();d.normalize();i=-this.tube*Math.cos(e);e=this.tube*Math.sin(e);g.x+=i*d.x+e*f.x;g.y+=i*d.y+e*f.y;g.z+=i*d.z+e*f.z;this.grid[a][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(g.x,g.y, g.z)))-1}}for(a=0;a<this.segmentsR;++a)for(c=0;c<this.segmentsT;++c){var d=(a+1)%this.segmentsR,f=(c+1)%this.segmentsT,g=this.grid[a][c],b=this.grid[d][c],d=this.grid[d][f],f=this.grid[a][f],e=new THREE.UV(a/this.segmentsR,c/this.segmentsT),i=new THREE.UV((a+1)/this.segmentsR,c/this.segmentsT),l=new THREE.UV((a+1)/this.segmentsR,(c+1)/this.segmentsT),k=new THREE.UV(a/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(g,b,d,f));this.faceVertexUvs[0].push([e,i,l,k])}this.computeCentroids(); this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;THREE.SubdivisionModifier=function(a){this.subdivisions=a===void 0?1:a;this.useOldVertexColors=!1;this.supportUVs=!0};THREE.SubdivisionModifier.prototype.constructor=THREE.SubdivisionModifier;THREE.SubdivisionModifier.prototype.modify=function(a){for(var c=this.subdivisions;c-- >0;)this.smooth(a)}; THREE.SubdivisionModifier.prototype.smooth=function(a){function c(a,b,c,d,h,i){var k=new THREE.Face4(a,b,c,d,null,h.color,h.material);if(e.useOldVertexColors){k.vertexColors=[];for(var l,m,n,j=0;j<4;j++){n=i[j];l=new THREE.Color;l.setRGB(0,0,0);for(var o=0;o<n.length;o++)m=h.vertexColors[n[o]-1],l.r+=m.r,l.g+=m.g,l.b+=m.b;l.r/=n.length;l.g/=n.length;l.b/=n.length;k.vertexColors[j]=l}}g.push(k);(!e.supportUVs||p.length!=0)&&f.push([p[a],p[b],p[c],p[d]])}function b(a,b){return Math.min(a,b)+"_"+Math.max(a, b)}var d=[],g=[],f=[],e=this,h=a.vertices,d=a.faces,i=h.concat(),l=[],k={},o={},p=[],m,r,n,q,t,w=a.faceVertexUvs[0];m=0;for(r=w.length;m<r;m++){n=0;for(q=w[m].length;n<q;n++)t=d[m]["abcd".charAt(n)],p[t]||(p[t]=w[m][n])}var u;m=0;for(r=d.length;m<r;m++)if(t=d[m],l.push(t.centroid),i.push(new THREE.Vertex(t.centroid)),e.supportUVs&&p.length!=0){u=new THREE.UV;if(t instanceof THREE.Face3)u.u=p[t.a].u+p[t.b].u+p[t.c].u,u.v=p[t.a].v+p[t.b].v+p[t.c].v,u.u/=3,u.v/=3;else if(t instanceof THREE.Face4)u.u= -p[t.a].u+p[t.b].u+p[t.c].u+p[t.d].u,u.v=p[t.a].v+p[t.b].v+p[t.c].v+p[t.d].v,u.u/=4,u.v/=4;p.push(u)}r=function(a){function c(a,b,d){a[b]===void 0&&(a[b]=[]);a[b].push(d)}var d,f,e,g,h={};d=0;for(f=a.faces.length;d<f;d++)e=a.faces[d],e instanceof THREE.Face3?(g=b(e.a,e.b),c(h,g,d),g=b(e.b,e.c),c(h,g,d),g=b(e.c,e.a),c(h,g,d)):e instanceof THREE.Face4&&(g=b(e.a,e.b),c(h,g,d),g=b(e.b,e.c),c(h,g,d),g=b(e.c,e.d),c(h,g,d),g=b(e.d,e.a),c(h,g,d));return h}(a);var B=0,w=h.length,F,A,x={},y={},v=function(a, +p[t.a].u+p[t.b].u+p[t.c].u+p[t.d].u,u.v=p[t.a].v+p[t.b].v+p[t.c].v+p[t.d].v,u.u/=4,u.v/=4;p.push(u)}r=function(a){function c(a,b,d){a[b]===void 0&&(a[b]=[]);a[b].push(d)}var d,e,f,g,h={};d=0;for(e=a.faces.length;d<e;d++)f=a.faces[d],f instanceof THREE.Face3?(g=b(f.a,f.b),c(h,g,d),g=b(f.b,f.c),c(h,g,d),g=b(f.c,f.a),c(h,g,d)):f instanceof THREE.Face4&&(g=b(f.a,f.b),c(h,g,d),g=b(f.b,f.c),c(h,g,d),g=b(f.c,f.d),c(h,g,d),g=b(f.d,f.a),c(h,g,d));return h}(a);var B=0,w=h.length,F,A,x={},y={},v=function(a, b){x[a]===void 0&&(x[a]=[]);x[a].push(b)},J=function(a,b){y[a]===void 0&&(y[a]={});y[a][b]=null};for(m in r){u=r[m];F=m.split("_");A=F[0];F=F[1];v(A,[A,F]);v(F,[A,F]);n=0;for(q=u.length;n<q;n++)t=u[n],J(A,t,m),J(F,t,m);u.length<2&&(o[m]=!0)}for(m in r)if(u=r[m],t=u[0],u=u[1],F=m.split("_"),A=F[0],F=F[1],q=new THREE.Vector3,o[m]?(q.addSelf(h[A].position),q.addSelf(h[F].position),q.multiplyScalar(0.5)):(q.addSelf(l[t]),q.addSelf(l[u]),q.addSelf(h[A].position),q.addSelf(h[F].position),q.multiplyScalar(0.25)), k[m]=w+d.length+B,i.push(new THREE.Vertex(q)),B++,e.supportUVs&&p.length!=0)u=new THREE.UV,u.u=p[A].u+p[F].u,u.v=p[A].v+p[F].v,u.u/=2,u.v/=2,p.push(u);var s,E;F=["123","12","2","23"];q=["123","23","3","31"];var v=["123","31","1","12"],J=["1234","12","2","23"],R=["1234","23","3","34"],U=["1234","34","4","41"],K=["1234","41","1","12"];m=0;for(r=l.length;m<r;m++)t=d[m],u=w+m,t instanceof THREE.Face3?(B=b(t.a,t.b),A=b(t.b,t.c),s=b(t.c,t.a),c(u,k[B],t.b,k[A],t,F),c(u,k[A],t.c,k[s],t,q),c(u,k[s],t.a,k[B], t,v)):t instanceof THREE.Face4?(B=b(t.a,t.b),A=b(t.b,t.c),s=b(t.c,t.d),E=b(t.d,t.a),c(u,k[B],t.b,k[A],t,J),c(u,k[A],t.c,k[s],t,R),c(u,k[s],t.d,k[E],t,U),c(u,k[E],t.a,k[B],t,K)):console.log("face should be a face!",t);d=i;i=new THREE.Vector3;k=new THREE.Vector3;m=0;for(r=h.length;m<r;m++)if(x[m]!==void 0){i.set(0,0,0);k.set(0,0,0);t=new THREE.Vector3(0,0,0);u=0;for(n in y[m])i.addSelf(l[n]),u++;B=0;w=x[m].length;for(n=0;n<w;n++)o[b(x[m][n][0],x[m][n][1])]&&B++;if(B!=2){i.divideScalar(u);for(n=0;n< @@ -552,8 +552,8 @@ w;n++)u=x[m][n],u=h[u[0]].position.clone().addSelf(h[u[1]].position).divideScala THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}}; THREE.Loader.prototype={constructor:THREE.Loader,addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var c="Loaded ";c+=a.total?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/ 1E3).toFixed(2)+" KB";this.statusDomElement.innerHTML=c},extractUrlbase:function(a){a=a.split("/");a.pop();return a.length<1?"":a.join("/")+"/"},initMaterials:function(a,c,b){a.materials=[];for(var d=0;d<c.length;++d)a.materials[d]=THREE.Loader.prototype.createMaterial(c[d],b)},hasNormals:function(a){var c,b,d=a.materials.length;for(b=0;b<d;b++)if(c=a.materials[b],c instanceof THREE.ShaderMaterial)return!0;return!1},createMaterial:function(a,c){function b(a){a=Math.log(a)/Math.LN2;return Math.floor(a)== -a}function d(a,c){var d=new Image;d.onload=function(){if(!b(this.width)||!b(this.height)){var c=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),d=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));a.image.width=c;a.image.height=d;a.image.getContext("2d").drawImage(this,0,0,c,d)}else a.image=this;a.needsUpdate=!0};d.src=c}function g(a,b,f,e,g,h){var i=document.createElement("canvas");a[b]=new THREE.Texture(i);a[b].sourceFile=f;if(e){a[b].repeat.set(e[0],e[1]);if(e[0]!=1)a[b].wrapS=THREE.RepeatWrapping; -if(e[1]!=1)a[b].wrapT=THREE.RepeatWrapping}g&&a[b].offset.set(g[0],g[1]);if(h){e={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(e[h[0]]!==void 0)a[b].wrapS=e[h[0]];if(e[h[1]]!==void 0)a[b].wrapT=e[h[1]]}d(a[b],c+"/"+f)}function f(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var e,h,i;h="MeshLambertMaterial";e={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};a.shading&&(a.shading=="Phong"?h="MeshPhongMaterial":a.shading=="Basic"&&(h="MeshBasicMaterial")); +a}function d(a,c){var d=new Image;d.onload=function(){if(!b(this.width)||!b(this.height)){var c=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),d=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));a.image.width=c;a.image.height=d;a.image.getContext("2d").drawImage(this,0,0,c,d)}else a.image=this;a.needsUpdate=!0};d.src=c}function g(a,b,e,f,g,h){var i=document.createElement("canvas");a[b]=new THREE.Texture(i);a[b].sourceFile=e;if(f){a[b].repeat.set(f[0],f[1]);if(f[0]!=1)a[b].wrapS=THREE.RepeatWrapping; +if(f[1]!=1)a[b].wrapT=THREE.RepeatWrapping}g&&a[b].offset.set(g[0],g[1]);if(h){f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(f[h[0]]!==void 0)a[b].wrapS=f[h[0]];if(f[h[1]]!==void 0)a[b].wrapT=f[h[1]]}d(a[b],c+"/"+e)}function f(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var e,h,i;h="MeshLambertMaterial";e={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};a.shading&&(a.shading=="Phong"?h="MeshPhongMaterial":a.shading=="Basic"&&(h="MeshBasicMaterial")); if(a.blending)if(a.blending=="Additive")e.blending=THREE.AdditiveBlending;else if(a.blending=="Subtractive")e.blending=THREE.SubtractiveBlending;else if(a.blending=="Multiply")e.blending=THREE.MultiplyBlending;if(a.transparent!==void 0||a.opacity<1)e.transparent=a.transparent;if(a.depthTest!==void 0)e.depthTest=a.depthTest;if(a.vertexColors!==void 0)if(a.vertexColors=="face")e.vertexColors=THREE.FaceColors;else if(a.vertexColors)e.vertexColors=THREE.VertexColors;if(a.colorDiffuse)e.color=f(a.colorDiffuse); else if(a.DbgColor)e.color=a.DbgColor;if(a.colorSpecular)e.specular=f(a.colorSpecular);if(a.colorAmbient)e.ambient=f(a.colorAmbient);if(a.transparency)e.opacity=a.transparency;if(a.specularCoef)e.shininess=a.specularCoef;a.mapDiffuse&&c&&g(e,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&c&&g(e,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&c&&g(e,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap); a.mapSpecular&&c&&g(e,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){var l=THREE.ShaderUtils.lib.normal,k=THREE.UniformsUtils.clone(l.uniforms),o=e.color;h=e.specular;i=e.ambient;var p=e.shininess;k.tNormal.texture=e.normalMap;if(a.mapNormalFactor)k.uNormalScale.value=a.mapNormalFactor;if(e.map)k.tDiffuse.texture=e.map,k.enableDiffuse.value=!0;if(e.specularMap)k.tSpecular.texture=e.specularMap,k.enableSpecular.value=!0;if(e.lightMap)k.tAO.texture= diff --git a/build/custom/ThreeCanvas.js b/build/custom/ThreeCanvas.js index 65252bc1f..103b92523 100644 --- a/build/custom/ThreeCanvas.js +++ b/build/custom/ThreeCanvas.js @@ -1,4 +1,4 @@ -// ThreeCanvas.js r47dev - 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,26 +72,25 @@ 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)}}; THREE.Geometry=function(){this.id=THREE.GeometryCount++;this.vertices=[];this.colors=[];this.materials=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=!1}; THREE.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(a){var b=new THREE.Matrix4;b.extractRotation(a,new THREE.Vector3(1,1,1));for(var c=0,d=this.vertices.length;c<d;c++)a.multiplyVector3(this.vertices[c].position);c=0;for(d=this.faces.length;c<d;c++){var f=this.faces[c];b.multiplyVector3(f.normal);for(var e=0,g=f.vertexNormals.length;e<g;e++)b.multiplyVector3(f.vertexNormals[e]);a.multiplyVector3(f.centroid)}},computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a< -b;a++)c=this.faces[a],c.centroid.set(0,0,0),c instanceof THREE.Face3?(c.centroid.addSelf(this.vertices[c.a].position),c.centroid.addSelf(this.vertices[c.b].position),c.centroid.addSelf(this.vertices[c.c].position),c.centroid.divideScalar(3)):c instanceof THREE.Face4&&(c.centroid.addSelf(this.vertices[c.a].position),c.centroid.addSelf(this.vertices[c.b].position),c.centroid.addSelf(this.vertices[c.c].position),c.centroid.addSelf(this.vertices[c.d].position),c.centroid.divideScalar(4))},computeFaceNormals:function(a){var b, -c,d,f,e,g,h=new THREE.Vector3,m=new THREE.Vector3;d=0;for(f=this.faces.length;d<f;d++){e=this.faces[d];if(a&&e.vertexNormals.length){h.set(0,0,0);b=0;for(c=e.vertexNormals.length;b<c;b++)h.addSelf(e.vertexNormals[b]);h.divideScalar(3)}else b=this.vertices[e.a],c=this.vertices[e.b],g=this.vertices[e.c],h.sub(g.position,c.position),m.sub(b.position,c.position),h.crossSelf(m);h.isZero()||h.normalize();e.normal.copy(h)}},computeVertexNormals:function(){var a,b,c,d;if(this.__tmpVertices===void 0){d=this.__tmpVertices= -Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++)if(c=this.faces[a],c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{d=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof -THREE.Face3?(d[c.a].addSelf(c.normal),d[c.b].addSelf(c.normal),d[c.c].addSelf(c.normal)):c instanceof THREE.Face4&&(d[c.a].addSelf(c.normal),d[c.b].addSelf(c.normal),d[c.c].addSelf(c.normal),d[c.d].addSelf(c.normal));a=0;for(b=this.vertices.length;a<b;a++)d[a].normalize();a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof THREE.Face3?(c.vertexNormals[0].copy(d[c.a]),c.vertexNormals[1].copy(d[c.b]),c.vertexNormals[2].copy(d[c.c])):c instanceof THREE.Face4&&(c.vertexNormals[0].copy(d[c.a]), -c.vertexNormals[1].copy(d[c.b]),c.vertexNormals[2].copy(d[c.c]),c.vertexNormals[3].copy(d[c.d]))},computeTangents:function(){function a(a,b,c,d,e,f,D){h=a.vertices[b].position;m=a.vertices[c].position;l=a.vertices[d].position;j=g[e];i=g[f];n=g[D];o=m.x-h.x;p=l.x-h.x;k=m.y-h.y;s=l.y-h.y;K=m.z-h.z;C=l.z-h.z;Q=i.u-j.u;O=n.u-j.u;w=i.v-j.v;F=n.v-j.v;z=1/(Q*F-O*w);E.set((F*o-w*p)*z,(F*k-w*s)*z,(F*K-w*C)*z);N.set((Q*p-O*o)*z,(Q*s-O*k)*z,(Q*C-O*K)*z);u[b].addSelf(E);u[c].addSelf(E);u[d].addSelf(E);r[b].addSelf(N); -r[c].addSelf(N);r[d].addSelf(N)}var b,c,d,f,e,g,h,m,l,j,i,n,o,p,k,s,K,C,Q,O,w,F,z,D,u=[],r=[],E=new THREE.Vector3,N=new THREE.Vector3,W=new THREE.Vector3,da=new THREE.Vector3,G=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)u[b]=new THREE.Vector3,r[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],g=this.faceVertexUvs[0][b],e instanceof THREE.Face3?a(this,e.a,e.b,e.c,0,1,2):e instanceof THREE.Face4&&(a(this,e.a,e.b,e.c,0,1,2),a(this,e.a,e.b,e.d,0,1,3));var H=["a", -"b","c","d"];b=0;for(c=this.faces.length;b<c;b++){e=this.faces[b];for(d=0;d<e.vertexNormals.length;d++)G.copy(e.vertexNormals[d]),f=e[H[d]],D=u[f],W.copy(D),W.subSelf(G.multiplyScalar(G.dot(D))).normalize(),da.cross(e.vertexNormals[d],D),f=da.dot(r[f]),f=f<0?-1:1,e.vertexTangents[d]=new THREE.Vector4(W.x,W.y,W.z,f)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y, -this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,c=this.vertices.length;b<c;b++){a=this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]= -a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=0,b=0,c=this.vertices.length;b<c;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}},mergeVertices:function(){var a={},b=[],c=[],d,f=Math.pow(10,4),e,g;e=0;for(g=this.vertices.length;e<g;e++)d=this.vertices[e].position,d=[Math.round(d.x*f),Math.round(d.y*f),Math.round(d.z*f)].join("_"),a[d]===void 0?(a[d]=e,b.push(this.vertices[e]), -c[e]=b.length-1):c[e]=c[a[d]];e=0;for(g=this.faces.length;e<g;e++)if(a=this.faces[e],a instanceof THREE.Face3)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c];else if(a instanceof THREE.Face4)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c],a.d=c[a.d];this.vertices=b}};THREE.GeometryCount=0; -THREE.Camera=function(){if(arguments.length)return console.warn("DEPRECATED: Camera() is now PerspectiveCamera() or OrthographicCamera()."),new THREE.PerspectiveCamera(arguments[0],arguments[1],arguments[2],arguments[3]);THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4;this.projectionMatrixInverse=new THREE.Matrix4};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera; -THREE.Camera.prototype.lookAt=function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)};THREE.OrthographicCamera=function(a,b,c,d,f,e){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=f!==void 0?f:0.1;this.far=e!==void 0?e:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera;THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera; -THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makeOrtho(this.left,this.right,this.top,this.bottom,this.near,this.far)};THREE.PerspectiveCamera=function(a,b,c,d){THREE.Camera.call(this);this.fov=a!==void 0?a:50;this.aspect=b!==void 0?b:1;this.near=c!==void 0?c:0.1;this.far=d!==void 0?d:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=new THREE.Camera;THREE.PerspectiveCamera.prototype.constructor=THREE.PerspectiveCamera; -THREE.PerspectiveCamera.prototype.setLens=function(a,b){this.fov=2*Math.atan((b!==void 0?b:43.25)/(a*2));this.fov*=180/Math.PI;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype.setViewOffset=function(a,b,c,d,f,e){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=d;this.width=f;this.height=e;this.updateProjectionMatrix()}; +b;a++)c=this.faces[a],c.centroid.set(0,0,0),c instanceof THREE.Face3?(c.centroid.addSelf(this.vertices[c.a].position),c.centroid.addSelf(this.vertices[c.b].position),c.centroid.addSelf(this.vertices[c.c].position),c.centroid.divideScalar(3)):c instanceof THREE.Face4&&(c.centroid.addSelf(this.vertices[c.a].position),c.centroid.addSelf(this.vertices[c.b].position),c.centroid.addSelf(this.vertices[c.c].position),c.centroid.addSelf(this.vertices[c.d].position),c.centroid.divideScalar(4))},computeFaceNormals:function(){var a, +b,c,d,f,e,g=new THREE.Vector3,h=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],d=this.vertices[c.a],f=this.vertices[c.b],e=this.vertices[c.c],g.sub(e.position,f.position),h.sub(d.position,f.position),g.crossSelf(h),g.isZero()||g.normalize(),c.normal.copy(g)},computeVertexNormals:function(){var a,b,c,d;if(this.__tmpVertices===void 0){d=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++)if(c= +this.faces[a],c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{d=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof THREE.Face3?(d[c.a].addSelf(c.normal),d[c.b].addSelf(c.normal),d[c.c].addSelf(c.normal)):c instanceof THREE.Face4&&(d[c.a].addSelf(c.normal), +d[c.b].addSelf(c.normal),d[c.c].addSelf(c.normal),d[c.d].addSelf(c.normal));a=0;for(b=this.vertices.length;a<b;a++)d[a].normalize();a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof THREE.Face3?(c.vertexNormals[0].copy(d[c.a]),c.vertexNormals[1].copy(d[c.b]),c.vertexNormals[2].copy(d[c.c])):c instanceof THREE.Face4&&(c.vertexNormals[0].copy(d[c.a]),c.vertexNormals[1].copy(d[c.b]),c.vertexNormals[2].copy(d[c.c]),c.vertexNormals[3].copy(d[c.d]))},computeTangents:function(){function a(a, +b,c,d,e,f,D){h=a.vertices[b].position;m=a.vertices[c].position;l=a.vertices[d].position;j=g[e];i=g[f];n=g[D];o=m.x-h.x;p=l.x-h.x;k=m.y-h.y;s=l.y-h.y;K=m.z-h.z;C=l.z-h.z;Q=i.u-j.u;O=n.u-j.u;w=i.v-j.v;F=n.v-j.v;z=1/(Q*F-O*w);E.set((F*o-w*p)*z,(F*k-w*s)*z,(F*K-w*C)*z);N.set((Q*p-O*o)*z,(Q*s-O*k)*z,(Q*C-O*K)*z);u[b].addSelf(E);u[c].addSelf(E);u[d].addSelf(E);r[b].addSelf(N);r[c].addSelf(N);r[d].addSelf(N)}var b,c,d,f,e,g,h,m,l,j,i,n,o,p,k,s,K,C,Q,O,w,F,z,D,u=[],r=[],E=new THREE.Vector3,N=new THREE.Vector3, +W=new THREE.Vector3,da=new THREE.Vector3,G=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)u[b]=new THREE.Vector3,r[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],g=this.faceVertexUvs[0][b],e instanceof THREE.Face3?a(this,e.a,e.b,e.c,0,1,2):e instanceof THREE.Face4&&(a(this,e.a,e.b,e.c,0,1,2),a(this,e.a,e.b,e.d,0,1,3));var H=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){e=this.faces[b];for(d=0;d<e.vertexNormals.length;d++)G.copy(e.vertexNormals[d]),f=e[H[d]], +D=u[f],W.copy(D),W.subSelf(G.multiplyScalar(G.dot(D))).normalize(),da.cross(e.vertexNormals[d],D),f=da.dot(r[f]),f=f<0?-1:1,e.vertexTangents[d]=new THREE.Vector4(W.x,W.y,W.z,f)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,c=this.vertices.length;b<c;b++){a= +this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a= +0,b=0,c=this.vertices.length;b<c;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}},mergeVertices:function(){var a={},b=[],c=[],d,f=Math.pow(10,4),e,g;e=0;for(g=this.vertices.length;e<g;e++)d=this.vertices[e].position,d=[Math.round(d.x*f),Math.round(d.y*f),Math.round(d.z*f)].join("_"),a[d]===void 0?(a[d]=e,b.push(this.vertices[e]),c[e]=b.length-1):c[e]=c[a[d]];e=0;for(g=this.faces.length;e<g;e++)if(a=this.faces[e],a instanceof THREE.Face3)a.a=c[a.a],a.b=c[a.b],a.c= +c[a.c];else if(a instanceof THREE.Face4)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c],a.d=c[a.d];this.vertices=b}};THREE.GeometryCount=0;THREE.Camera=function(){if(arguments.length)return console.warn("DEPRECATED: Camera() is now PerspectiveCamera() or OrthographicCamera()."),new THREE.PerspectiveCamera(arguments[0],arguments[1],arguments[2],arguments[3]);THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4;this.projectionMatrixInverse=new THREE.Matrix4}; +THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.lookAt=function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)};THREE.OrthographicCamera=function(a,b,c,d,f,e){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=f!==void 0?f:0.1;this.far=e!==void 0?e:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera; +THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera;THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makeOrtho(this.left,this.right,this.top,this.bottom,this.near,this.far)};THREE.PerspectiveCamera=function(a,b,c,d){THREE.Camera.call(this);this.fov=a!==void 0?a:50;this.aspect=b!==void 0?b:1;this.near=c!==void 0?c:0.1;this.far=d!==void 0?d:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=new THREE.Camera; +THREE.PerspectiveCamera.prototype.constructor=THREE.PerspectiveCamera;THREE.PerspectiveCamera.prototype.setLens=function(a,b){this.fov=2*Math.atan((b!==void 0?b:43.25)/(a*2));this.fov*=180/Math.PI;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype.setViewOffset=function(a,b,c,d,f,e){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=d;this.width=f;this.height=e;this.updateProjectionMatrix()}; THREE.PerspectiveCamera.prototype.updateProjectionMatrix=function(){if(this.fullWidth){var a=this.fullWidth/this.fullHeight,b=Math.tan(this.fov*Math.PI/360)*this.near,c=-b,d=a*c,a=Math.abs(a*b-d),c=Math.abs(b-c);this.projectionMatrix=THREE.Matrix4.makeFrustum(d+this.x*a/this.fullWidth,d+(this.x+this.width)*a/this.fullWidth,b-(this.y+this.height)*c/this.fullHeight,b-this.y*c/this.fullHeight,this.near,this.far)}else this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near, this.far)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight; THREE.DirectionalLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=b!==void 0?b:1;this.distance=c!==void 0?c:0};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,0,0);this.intensity=b!==void 0?b:1;this.distance=c!==void 0?c:0};THREE.PointLight.prototype=new THREE.Light; diff --git a/build/custom/ThreeDOM.js b/build/custom/ThreeDOM.js index ec6ebe2a3..da46e6fa0 100644 --- a/build/custom/ThreeDOM.js +++ b/build/custom/ThreeDOM.js @@ -1,4 +1,4 @@ -// ThreeDOM.js r47dev - 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 c32a470a2..86d0a7813 100644 --- a/build/custom/ThreeExtras.js +++ b/build/custom/ThreeExtras.js @@ -1,4 +1,4 @@ -// ThreeExtras.js r47dev - http://github.com/mrdoob/three.js +// ThreeExtras.js r46 - 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}}; 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;n<a.materials.length;n++)o[a.materials[n].id]=n;if(c instanceof THREE.Mesh)c.matrixAutoUpdate&&c.updateMatrix(),b=c.matrix,d=new THREE.Matrix4,d.extractRotation(b,c.scale);for(var n=0,s=h.length;n<s;n++){var m=new THREE.Vertex(h[n].position.clone());b&&b.multiplyVector3(m.position);e.push(m)}n= @@ -15,11 +15,11 @@ a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]};c|=1;var d=a.width,g=a.height,f=documen p.push([1,0,h[(q*d+m)*4]/255*c]);p.push([1,1,h[(n*d+m)*4]/255*c]);p.push([0,1,h[(n*d+j)*4]/255*c]);p.push([-1,1,h[(n*d+s)*4]/255*c]);o=[];s=p.length;for(n=0;n<s;n++){var m=p[n],r=p[(n+1)%s],m=[m[0]-l[0],m[1]-l[1],m[2]-l[2]],r=[r[0]-l[0],r[1]-l[1],r[2]-l[2]];o.push(b([m[1]*r[2]-m[2]*r[1],m[2]*r[0]-m[0]*r[2],m[0]*r[1]-m[1]*r[0]]))}p=[0,0,0];for(n=0;n<o.length;n++)p[0]+=o[n][0],p[1]+=o[n][1],p[2]+=o[n][2];p[0]/=o.length;p[1]/=o.length;p[2]/=o.length;l=(q*d+j)*4;k[l]=(p[0]+1)/2*255|0;k[l+1]=(p[1]+0.5)* 255|0;k[l+2]=p[2]*255|0;k[l+3]=255}e.putImageData(i,0,0);return f}}; THREE.SceneUtils={showHierarchy:function(a,c){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=c})},traverseHierarchy:function(a,c){var b,d,g=a.children.length;for(d=0;d<g;d++)b=a.children[d],c(b),THREE.SceneUtils.traverseHierarchy(b,c)},createMultiMaterialObject:function(a,c){var b,d=c.length,g=new THREE.Object3D;for(b=0;b<d;b++){var f=new THREE.Mesh(a,c[b]);g.add(f)}return g},cloneObject:function(a){var c;a instanceof THREE.MorphAnimMesh?(c=new THREE.MorphAnimMesh(a.geometry,a.material), -c.duration=a.duration,c.mirroredLoop=a.mirroredLoop,c.time=a.time,c.lastKeyframe=a.lastKeyframe,c.currentKeyframe=a.currentKeyframe,c.direction=a.direction,c.directionBackwards=a.directionBackwards):a instanceof THREE.Mesh?c=new THREE.Mesh(a.geometry,a.material):a instanceof THREE.Line?c=new THREE.Line(a.geometry,a.material,a.type):a instanceof THREE.Ribbon?c=new THREE.Ribbon(a.geometry,a.material):a instanceof THREE.ParticleSystem?(c=new THREE.ParticleSystem(a.geometry,a.material),c.sortParticles= -a.sortParticles):a instanceof THREE.Particle?c=new THREE.Particle(a.material):a instanceof THREE.Sprite?(c=new THREE.Sprite({}),c.color.copy(a.color),c.map=a.map,c.blending=a.blending,c.useScreenCoordinates=a.useScreenCoordinates,c.mergeWith3D=a.mergeWith3D,c.affectedByDistance=a.affectedByDistance,c.scaleByViewport=a.scaleByViewport,c.alignment=a.alignment,c.rotation3d.copy(a.rotation3d),c.rotation=a.rotation,c.opacity=a.opacity,c.uvOffset.copy(a.uvOffset),c.uvScale.copy(a.uvScale)):a instanceof -THREE.LOD?c=new THREE.LOD:a instanceof THREE.SkinnedMesh?c=new THREE.SkinnedMesh:a instanceof THREE.MarchingCubes?(c=new THREE.MarchingCubes(a.resolution,a.material),c.field.set(a.field),c.isolation=a.isolation):a instanceof THREE.Object3D&&(c=new THREE.Object3D);c.parent=a.parent;c.up.copy(a.up);c.position.copy(a.position);c.rotation instanceof THREE.Vector3&&c.rotation.copy(a.rotation);c.eulerOrder=a.eulerOrder;c.scale.copy(a.scale);c.dynamic=a.dynamic;c.doubleSided=a.doubleSided;c.flipSided=a.flipSided; -c.renderDepth=a.renderDepth;c.rotationAutoUpdate=a.rotationAutoUpdate;c.matrix.copy(a.matrix);c.matrixWorld.copy(a.matrixWorld);c.matrixRotationWorld.copy(a.matrixRotationWorld);c.matrixAutoUpdate=a.matrixAutoUpdate;c.matrixWorldNeedsUpdate=a.matrixWorldNeedsUpdate;c.quaternion.copy(a.quaternion);c.useQuaternion=a.useQuaternion;c.boundRadius=a.boundRadius;c.boundRadiusScale=a.boundRadiusScale;c.visible=a.visible;c.castShadow=a.castShadow;c.receiveShadow=a.receiveShadow;c.frustumCulled=a.frustumCulled; -for(var b=0;b<a.children.length;b++){var d=THREE.SceneUtils.cloneObject(a.children[b]);c.children[b]=d;d.parent=c}if(a instanceof THREE.LOD)for(b=0;b<a.LODs.length;b++)c.LODs[b]={visibleAtDistance:a.LODs[b].visibleAtDistance,object3D:c.children[b]};return c}}; +c.duration=a.duration,c.mirroredLoop=a.mirroredLoop,c.time=a.time,c.lastKeyframe=a.lastKeyframe,c.currentKeyframe=a.currentKeyframe,c.direction=a.direction,c.directionBackwards=a.directionBackwards):a instanceof THREE.SkinnedMesh?c=new THREE.SkinnedMesh(a.geometry,a.material):a instanceof THREE.Mesh?c=new THREE.Mesh(a.geometry,a.material):a instanceof THREE.Line?c=new THREE.Line(a.geometry,a.material,a.type):a instanceof THREE.Ribbon?c=new THREE.Ribbon(a.geometry,a.material):a instanceof THREE.ParticleSystem? +(c=new THREE.ParticleSystem(a.geometry,a.material),c.sortParticles=a.sortParticles):a instanceof THREE.Particle?c=new THREE.Particle(a.material):a instanceof THREE.Sprite?(c=new THREE.Sprite({}),c.color.copy(a.color),c.map=a.map,c.blending=a.blending,c.useScreenCoordinates=a.useScreenCoordinates,c.mergeWith3D=a.mergeWith3D,c.affectedByDistance=a.affectedByDistance,c.scaleByViewport=a.scaleByViewport,c.alignment=a.alignment,c.rotation3d.copy(a.rotation3d),c.rotation=a.rotation,c.opacity=a.opacity, +c.uvOffset.copy(a.uvOffset),c.uvScale.copy(a.uvScale)):a instanceof THREE.LOD?c=new THREE.LOD:a instanceof THREE.MarchingCubes?(c=new THREE.MarchingCubes(a.resolution,a.material),c.field.set(a.field),c.isolation=a.isolation):a instanceof THREE.Object3D&&(c=new THREE.Object3D);c.parent=a.parent;c.up.copy(a.up);c.position.copy(a.position);c.rotation instanceof THREE.Vector3&&c.rotation.copy(a.rotation);c.eulerOrder=a.eulerOrder;c.scale.copy(a.scale);c.dynamic=a.dynamic;c.doubleSided=a.doubleSided;c.flipSided= +a.flipSided;c.renderDepth=a.renderDepth;c.rotationAutoUpdate=a.rotationAutoUpdate;c.matrix.copy(a.matrix);c.matrixWorld.copy(a.matrixWorld);c.matrixRotationWorld.copy(a.matrixRotationWorld);c.matrixAutoUpdate=a.matrixAutoUpdate;c.matrixWorldNeedsUpdate=a.matrixWorldNeedsUpdate;c.quaternion.copy(a.quaternion);c.useQuaternion=a.useQuaternion;c.boundRadius=a.boundRadius;c.boundRadiusScale=a.boundRadiusScale;c.visible=a.visible;c.castShadow=a.castShadow;c.receiveShadow=a.receiveShadow;c.frustumCulled= +a.frustumCulled;for(var b=0;b<a.children.length;b++){var d=THREE.SceneUtils.cloneObject(a.children[b]);c.children[b]=d;d.parent=c}if(a instanceof THREE.LOD)for(b=0;b<a.LODs.length;b++)c.LODs[b]={visibleAtDistance:a.LODs[b].visibleAtDistance,object3D:c.children[b]};return c}}; if(THREE.WebGLRenderer)THREE.ShaderUtils={lib:{fresnel:{uniforms:{mRefractionRatio:{type:"f",value:1.02},mFresnelBias:{type:"f",value:0.1},mFresnelPower:{type:"f",value:2},mFresnelScale:{type:"f",value:1},tCube:{type:"t",value:1,texture:null}},fragmentShader:"uniform samplerCube tCube;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\nvec4 refractedColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nrefractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;\nrefractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;\nrefractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;\nrefractedColor.a = 1.0;\ngl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );\n}", vertexShader:"uniform float mRefractionRatio;\nuniform float mFresnelBias;\nuniform float mFresnelScale;\nuniform float mFresnelPower;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = normalize ( mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal );\nvec3 I = mPosition.xyz - cameraPosition;\nvReflect = reflect( I, nWorld );\nvRefract[0] = refract( normalize( I ), nWorld, mRefractionRatio );\nvRefract[1] = refract( normalize( I ), nWorld, mRefractionRatio * 0.99 );\nvRefract[2] = refract( normalize( I ), nWorld, mRefractionRatio * 0.98 );\nvReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), nWorld ), mFresnelPower );\ngl_Position = projectionMatrix * mvPosition;\n}"}, normal:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.fog,THREE.UniformsLib.lights,THREE.UniformsLib.shadowmap,{enableAO:{type:"i",value:0},enableDiffuse:{type:"i",value:0},enableSpecular:{type:"i",value:0},enableReflection:{type:"i",value:0},tDiffuse:{type:"t",value:0,texture:null},tCube:{type:"t",value:1,texture:null},tNormal:{type:"t",value:2,texture:null},tSpecular:{type:"t",value:3,texture:null},tAO:{type:"t",value:4,texture:null},tDisplacement:{type:"t",value:5,texture:null},uNormalScale:{type:"f", @@ -102,7 +102,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= @@ -112,14 +112,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,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<p-1;f++)l=c*h.chunks[f]/h.total,b.keys[f]={time:l,pos:g[f]};e.hierarchy[0]= b;THREE.AnimationHandler.add(e);return new THREE.Animation(a,d,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function f(a,b){var d,c,e=new THREE.Geometry;for(d=0;d<a.points.length*b;d++)c=d/(a.points.length*b),c=a.getPoint(c),e.vertices[d]=new THREE.Vertex(new THREE.Vector3(c.x,c.y,c.z));return e}this.object=a;this.domElement=c!==void 0?c:document;this.id="PathControls"+THREE.PathControlsIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath= -new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookHorizontal=this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.target=new THREE.Object3D;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX= +new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.005;this.lookHorizontal=this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.target=new THREE.Object3D;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;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));var e=Math.PI*2,h=Math.PI/180;this.update=function(a){var d;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed*a);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed*a);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*h;this.theta=this.lon*h;a=this.phi%e;this.phi=a>=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= 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;n<b.points.length;n++)c=new THREE.Mesh(e,h),c.position.copy(b.points[n]),a.add(c)}this.domElement.addEventListener("mousemove",d(this,this.onMouseMove), !1)}};THREE.PathControlsIdCounter=0; -THREE.FlyControls=function(a,c){function b(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.domElement=c!==void 0?c:document;c&&this.domElement.setAttribute("tabindex",-1);this.movementSpeed=1;this.rollSpeed=0.0050;this.autoForward=this.dragToLook=!1;this.object.useQuaternion=!0;this.tmpQuaternion=new THREE.Quaternion;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0, +THREE.FlyControls=function(a,c){function b(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.domElement=c!==void 0?c:document;c&&this.domElement.setAttribute("tabindex",-1);this.movementSpeed=1;this.rollSpeed=0.005;this.autoForward=this.dragToLook=!1;this.object.useQuaternion=!0;this.tmpQuaternion=new THREE.Quaternion;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0, 0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.keydown=function(a){if(!a.altKey){switch(a.keyCode){case 16:this.movementSpeedMultiplier=0.1;break;case 87:this.moveState.forward=1;break;case 83:this.moveState.back=1;break;case 65:this.moveState.left=1;break;case 68:this.moveState.right=1;break;case 82:this.moveState.up=1;break;case 70:this.moveState.down=1;break;case 38:this.moveState.pitchUp=1;break;case 40:this.moveState.pitchDown= 1;break;case 37:this.moveState.yawLeft=1;break;case 39:this.moveState.yawRight=1;break;case 81:this.moveState.rollLeft=1;break;case 69:this.moveState.rollRight=1}this.updateMovementVector();this.updateRotationVector()}};this.keyup=function(a){switch(a.keyCode){case 16:this.movementSpeedMultiplier=1;break;case 87:this.moveState.forward=0;break;case 83:this.moveState.back=0;break;case 65:this.moveState.left=0;break;case 68:this.moveState.right=0;break;case 82:this.moveState.up=0;break;case 70:this.moveState.down= 0;break;case 38:this.moveState.pitchUp=0;break;case 40:this.moveState.pitchDown=0;break;case 37:this.moveState.yawLeft=0;break;case 39:this.moveState.yawRight=0;break;case 81:this.moveState.rollLeft=0;break;case 69:this.moveState.rollRight=0}this.updateMovementVector();this.updateRotationVector()};this.mousedown=function(a){this.domElement!==document&&this.domElement.focus();a.preventDefault();a.stopPropagation();if(this.dragToLook)this.mouseStatus++;else switch(a.button){case 0:this.object.moveForward= @@ -164,8 +164,8 @@ THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THRE THREE.IcosahedronGeometry=function(a){function c(a,b,c){var d=Math.sqrt(a*a+b*b+c*c);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(a/d,b/d,c/d)))-1}function b(a,b,c,d){var e=g.vertices[a].position,f=g.vertices[b].position,h=g.vertices[c].position,a=new THREE.Face3(a,b,c);a.vertexNormals.push(e.clone().normalize(),f.clone().normalize(),h.clone().normalize());d.faces.push(a);d.faceVertexUvs[0].push([new THREE.UV(1-(Math.atan2(e.z,e.x)+Math.PI)%Math.PI/Math.PI*0.5,0.5-e.y/2),new THREE.UV(1- (Math.atan2(f.z,f.x)+Math.PI)%Math.PI/Math.PI*0.5,0.5-f.y/2),new THREE.UV(1-(Math.atan2(h.z,h.x)+Math.PI)%Math.PI/Math.PI*0.5,0.5-h.y/2)])}function d(a,b){var d=g.vertices[a].position,e=g.vertices[b].position;return c((d.x+e.x)/2,(d.y+e.y)/2,(d.z+e.z)/2)}var g=this,f=new THREE.Geometry;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;c(-1,a,0);c(1,a,0);c(-1,-a,0);c(1,-a,0);c(0,-1,a);c(0,1,a);c(0,-1,-a);c(0,1,-a);c(a,0,-1);c(a,0,1);c(-a,0,-1);c(-a,0,1);b(0,11,5,f);b(0,5,1,f);b(0, 1,7,f);b(0,7,10,f);b(0,10,11,f);b(1,5,9,f);b(5,11,4,f);b(11,10,2,f);b(10,7,6,f);b(7,1,8,f);b(3,9,4,f);b(3,4,2,f);b(3,2,6,f);b(3,6,8,f);b(3,8,9,f);b(4,9,5,f);b(2,4,11,f);b(6,2,10,f);b(8,6,7,f);b(9,8,1,f);for(var e=0;e<this.subdivisions;e++){var a=new THREE.Geometry,h;for(h in f.faces){var i=d(f.faces[h].a,f.faces[h].b),k=d(f.faces[h].b,f.faces[h].c),j=d(f.faces[h].c,f.faces[h].a);b(f.faces[h].a,i,j,a);b(f.faces[h].b,k,i,a);b(f.faces[h].c,j,k,a);b(i,k,j,a)}f.faces=a.faces;f.faceVertexUvs[0]=a.faceVertexUvs[0]}g.faces= -f.faces;g.faceVertexUvs[0]=f.faceVertexUvs[0];this.computeCentroids();this.computeFaceNormals(!0)};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry; -THREE.LatheGeometry=function(a,c,b){THREE.Geometry.call(this);this.steps=c||12;this.angle=b||2*Math.PI;for(var c=this.angle/this.steps,b=[],d=[],g=[],f=[],e=(new THREE.Matrix4).setRotationZ(c),h=0;h<a.length;h++)this.vertices.push(new THREE.Vertex(a[h])),b[h]=a[h].clone(),d[h]=this.vertices.length-1;for(var i=0;i<=this.angle+0.0010;i+=c){for(h=0;h<b.length;h++)i<this.angle?(b[h]=e.multiplyVector3(b[h].clone()),this.vertices.push(new THREE.Vertex(b[h])),g[h]=this.vertices.length-1):g=f;i==0&&(f=d); +f.faces;g.faceVertexUvs[0]=f.faceVertexUvs[0];this.computeCentroids();this.computeFaceNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry; +THREE.LatheGeometry=function(a,c,b){THREE.Geometry.call(this);this.steps=c||12;this.angle=b||2*Math.PI;for(var c=this.angle/this.steps,b=[],d=[],g=[],f=[],e=(new THREE.Matrix4).setRotationZ(c),h=0;h<a.length;h++)this.vertices.push(new THREE.Vertex(a[h])),b[h]=a[h].clone(),d[h]=this.vertices.length-1;for(var i=0;i<=this.angle+0.001;i+=c){for(h=0;h<b.length;h++)i<this.angle?(b[h]=e.multiplyVector3(b[h].clone()),this.vertices.push(new THREE.Vertex(b[h])),g[h]=this.vertices.length-1):g=f;i==0&&(f=d); for(h=0;h<d.length-1;h++)this.faces.push(new THREE.Face4(g[h],g[h+1],d[h+1],d[h])),this.faceVertexUvs[0].push([new THREE.UV(1-i/this.angle,h/a.length),new THREE.UV(1-i/this.angle,(h+1)/a.length),new THREE.UV(1-(i-c)/this.angle,(h+1)/a.length),new THREE.UV(1-(i-c)/this.angle,h/a.length)]);d=g;g=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry; THREE.OctahedronGeometry=function(a,c){function b(b){var c=b.clone().normalize(),c=new THREE.Vertex(c.clone().multiplyScalar(a));c.index=e.vertices.push(c)-1;c.uv=new THREE.UV(Math.atan2(b.z,-b.x)/2/Math.PI+0.5,Math.atan2(-b.y,Math.sqrt(b.x*b.x+b.z*b.z))/Math.PI+0.5);return c}function d(a,b,c,h){h<1?(h=new THREE.Face3(a.index,b.index,c.index,[a.position,b.position,c.position]),h.centroid.addSelf(a.position).addSelf(b.position).addSelf(c.position).divideScalar(3),h.normal=h.centroid.clone().normalize(), e.faces.push(h),h=Math.atan2(h.centroid.z,-h.centroid.x),e.faceVertexUvs[0].push([f(a.uv,a.position,h),f(b.uv,b.position,h),f(c.uv,c.position,h)])):(h-=1,d(a,g(a,b),g(a,c),h),d(g(a,b),b,g(b,c),h),d(g(a,c),g(b,c),c,h),d(g(a,b),g(b,c),g(a,c),h))}function g(a,c){h[a.index]||(h[a.index]=[]);h[c.index]||(h[c.index]=[]);var d=h[a.index][c.index];d===void 0&&(h[a.index][c.index]=h[c.index][a.index]=d=b((new THREE.Vector3).add(a.position,c.position).divideScalar(2)));return d}function f(a,b,c){c<0&&a.u=== diff --git a/build/custom/ThreeSVG.js b/build/custom/ThreeSVG.js index 16787fdce..04331ae25 100644 --- a/build/custom/ThreeSVG.js +++ b/build/custom/ThreeSVG.js @@ -1,4 +1,4 @@ -// ThreeSVG.js r47dev - 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,26 +72,25 @@ 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)}}; THREE.Geometry=function(){this.id=THREE.GeometryCount++;this.vertices=[];this.colors=[];this.materials=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=!1}; THREE.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(a){var b=new THREE.Matrix4;b.extractRotation(a,new THREE.Vector3(1,1,1));for(var c=0,d=this.vertices.length;c<d;c++)a.multiplyVector3(this.vertices[c].position);c=0;for(d=this.faces.length;c<d;c++){var f=this.faces[c];b.multiplyVector3(f.normal);for(var e=0,g=f.vertexNormals.length;e<g;e++)b.multiplyVector3(f.vertexNormals[e]);a.multiplyVector3(f.centroid)}},computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a< -b;a++)c=this.faces[a],c.centroid.set(0,0,0),c instanceof THREE.Face3?(c.centroid.addSelf(this.vertices[c.a].position),c.centroid.addSelf(this.vertices[c.b].position),c.centroid.addSelf(this.vertices[c.c].position),c.centroid.divideScalar(3)):c instanceof THREE.Face4&&(c.centroid.addSelf(this.vertices[c.a].position),c.centroid.addSelf(this.vertices[c.b].position),c.centroid.addSelf(this.vertices[c.c].position),c.centroid.addSelf(this.vertices[c.d].position),c.centroid.divideScalar(4))},computeFaceNormals:function(a){var b, -c,d,f,e,g,h=new THREE.Vector3,l=new THREE.Vector3;d=0;for(f=this.faces.length;d<f;d++){e=this.faces[d];if(a&&e.vertexNormals.length){h.set(0,0,0);b=0;for(c=e.vertexNormals.length;b<c;b++)h.addSelf(e.vertexNormals[b]);h.divideScalar(3)}else b=this.vertices[e.a],c=this.vertices[e.b],g=this.vertices[e.c],h.sub(g.position,c.position),l.sub(b.position,c.position),h.crossSelf(l);h.isZero()||h.normalize();e.normal.copy(h)}},computeVertexNormals:function(){var a,b,c,d;if(this.__tmpVertices===void 0){d=this.__tmpVertices= -Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++)if(c=this.faces[a],c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{d=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof -THREE.Face3?(d[c.a].addSelf(c.normal),d[c.b].addSelf(c.normal),d[c.c].addSelf(c.normal)):c instanceof THREE.Face4&&(d[c.a].addSelf(c.normal),d[c.b].addSelf(c.normal),d[c.c].addSelf(c.normal),d[c.d].addSelf(c.normal));a=0;for(b=this.vertices.length;a<b;a++)d[a].normalize();a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof THREE.Face3?(c.vertexNormals[0].copy(d[c.a]),c.vertexNormals[1].copy(d[c.b]),c.vertexNormals[2].copy(d[c.c])):c instanceof THREE.Face4&&(c.vertexNormals[0].copy(d[c.a]), -c.vertexNormals[1].copy(d[c.b]),c.vertexNormals[2].copy(d[c.c]),c.vertexNormals[3].copy(d[c.d]))},computeTangents:function(){function a(a,b,c,d,e,f,B){h=a.vertices[b].position;l=a.vertices[c].position;m=a.vertices[d].position;i=g[e];j=g[f];n=g[B];k=l.x-h.x;o=m.x-h.x;p=l.y-h.y;u=m.y-h.y;I=l.z-h.z;v=m.z-h.z;E=j.u-i.u;s=n.u-i.u;t=j.v-i.v;C=n.v-i.v;y=1/(E*C-s*t);H.set((C*k-t*o)*y,(C*p-t*u)*y,(C*I-t*v)*y);A.set((E*o-s*k)*y,(E*u-s*p)*y,(E*v-s*I)*y);G[b].addSelf(H);G[c].addSelf(H);G[d].addSelf(H);x[b].addSelf(A); -x[c].addSelf(A);x[d].addSelf(A)}var b,c,d,f,e,g,h,l,m,i,j,n,k,o,p,u,I,v,E,s,t,C,y,z,G=[],x=[],H=new THREE.Vector3,A=new THREE.Vector3,K=new THREE.Vector3,J=new THREE.Vector3,M=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)G[b]=new THREE.Vector3,x[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],g=this.faceVertexUvs[0][b],e instanceof THREE.Face3?a(this,e.a,e.b,e.c,0,1,2):e instanceof THREE.Face4&&(a(this,e.a,e.b,e.c,0,1,2),a(this,e.a,e.b,e.d,0,1,3));var N=["a","b", -"c","d"];b=0;for(c=this.faces.length;b<c;b++){e=this.faces[b];for(d=0;d<e.vertexNormals.length;d++)M.copy(e.vertexNormals[d]),f=e[N[d]],z=G[f],K.copy(z),K.subSelf(M.multiplyScalar(M.dot(z))).normalize(),J.cross(e.vertexNormals[d],z),f=J.dot(x[f]),f=f<0?-1:1,e.vertexTangents[d]=new THREE.Vector4(K.x,K.y,K.z,f)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y, -this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,c=this.vertices.length;b<c;b++){a=this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]= -a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=0,b=0,c=this.vertices.length;b<c;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}},mergeVertices:function(){var a={},b=[],c=[],d,f=Math.pow(10,4),e,g;e=0;for(g=this.vertices.length;e<g;e++)d=this.vertices[e].position,d=[Math.round(d.x*f),Math.round(d.y*f),Math.round(d.z*f)].join("_"),a[d]===void 0?(a[d]=e,b.push(this.vertices[e]), -c[e]=b.length-1):c[e]=c[a[d]];e=0;for(g=this.faces.length;e<g;e++)if(a=this.faces[e],a instanceof THREE.Face3)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c];else if(a instanceof THREE.Face4)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c],a.d=c[a.d];this.vertices=b}};THREE.GeometryCount=0; -THREE.Camera=function(){if(arguments.length)return console.warn("DEPRECATED: Camera() is now PerspectiveCamera() or OrthographicCamera()."),new THREE.PerspectiveCamera(arguments[0],arguments[1],arguments[2],arguments[3]);THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4;this.projectionMatrixInverse=new THREE.Matrix4};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera; -THREE.Camera.prototype.lookAt=function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)};THREE.OrthographicCamera=function(a,b,c,d,f,e){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=f!==void 0?f:0.1;this.far=e!==void 0?e:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera;THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera; -THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makeOrtho(this.left,this.right,this.top,this.bottom,this.near,this.far)};THREE.PerspectiveCamera=function(a,b,c,d){THREE.Camera.call(this);this.fov=a!==void 0?a:50;this.aspect=b!==void 0?b:1;this.near=c!==void 0?c:0.1;this.far=d!==void 0?d:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=new THREE.Camera;THREE.PerspectiveCamera.prototype.constructor=THREE.PerspectiveCamera; -THREE.PerspectiveCamera.prototype.setLens=function(a,b){this.fov=2*Math.atan((b!==void 0?b:43.25)/(a*2));this.fov*=180/Math.PI;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype.setViewOffset=function(a,b,c,d,f,e){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=d;this.width=f;this.height=e;this.updateProjectionMatrix()}; +b;a++)c=this.faces[a],c.centroid.set(0,0,0),c instanceof THREE.Face3?(c.centroid.addSelf(this.vertices[c.a].position),c.centroid.addSelf(this.vertices[c.b].position),c.centroid.addSelf(this.vertices[c.c].position),c.centroid.divideScalar(3)):c instanceof THREE.Face4&&(c.centroid.addSelf(this.vertices[c.a].position),c.centroid.addSelf(this.vertices[c.b].position),c.centroid.addSelf(this.vertices[c.c].position),c.centroid.addSelf(this.vertices[c.d].position),c.centroid.divideScalar(4))},computeFaceNormals:function(){var a, +b,c,d,f,e,g=new THREE.Vector3,h=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],d=this.vertices[c.a],f=this.vertices[c.b],e=this.vertices[c.c],g.sub(e.position,f.position),h.sub(d.position,f.position),g.crossSelf(h),g.isZero()||g.normalize(),c.normal.copy(g)},computeVertexNormals:function(){var a,b,c,d;if(this.__tmpVertices===void 0){d=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++)if(c= +this.faces[a],c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{d=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof THREE.Face3?(d[c.a].addSelf(c.normal),d[c.b].addSelf(c.normal),d[c.c].addSelf(c.normal)):c instanceof THREE.Face4&&(d[c.a].addSelf(c.normal), +d[c.b].addSelf(c.normal),d[c.c].addSelf(c.normal),d[c.d].addSelf(c.normal));a=0;for(b=this.vertices.length;a<b;a++)d[a].normalize();a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof THREE.Face3?(c.vertexNormals[0].copy(d[c.a]),c.vertexNormals[1].copy(d[c.b]),c.vertexNormals[2].copy(d[c.c])):c instanceof THREE.Face4&&(c.vertexNormals[0].copy(d[c.a]),c.vertexNormals[1].copy(d[c.b]),c.vertexNormals[2].copy(d[c.c]),c.vertexNormals[3].copy(d[c.d]))},computeTangents:function(){function a(a, +b,c,d,e,f,B){h=a.vertices[b].position;l=a.vertices[c].position;m=a.vertices[d].position;i=g[e];j=g[f];n=g[B];k=l.x-h.x;o=m.x-h.x;p=l.y-h.y;u=m.y-h.y;I=l.z-h.z;v=m.z-h.z;E=j.u-i.u;s=n.u-i.u;t=j.v-i.v;C=n.v-i.v;y=1/(E*C-s*t);H.set((C*k-t*o)*y,(C*p-t*u)*y,(C*I-t*v)*y);A.set((E*o-s*k)*y,(E*u-s*p)*y,(E*v-s*I)*y);G[b].addSelf(H);G[c].addSelf(H);G[d].addSelf(H);x[b].addSelf(A);x[c].addSelf(A);x[d].addSelf(A)}var b,c,d,f,e,g,h,l,m,i,j,n,k,o,p,u,I,v,E,s,t,C,y,z,G=[],x=[],H=new THREE.Vector3,A=new THREE.Vector3, +K=new THREE.Vector3,J=new THREE.Vector3,M=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)G[b]=new THREE.Vector3,x[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],g=this.faceVertexUvs[0][b],e instanceof THREE.Face3?a(this,e.a,e.b,e.c,0,1,2):e instanceof THREE.Face4&&(a(this,e.a,e.b,e.c,0,1,2),a(this,e.a,e.b,e.d,0,1,3));var N=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){e=this.faces[b];for(d=0;d<e.vertexNormals.length;d++)M.copy(e.vertexNormals[d]),f=e[N[d]], +z=G[f],K.copy(z),K.subSelf(M.multiplyScalar(M.dot(z))).normalize(),J.cross(e.vertexNormals[d],z),f=J.dot(x[f]),f=f<0?-1:1,e.vertexTangents[d]=new THREE.Vector4(K.x,K.y,K.z,f)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,c=this.vertices.length;b<c;b++){a= +this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a= +0,b=0,c=this.vertices.length;b<c;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}},mergeVertices:function(){var a={},b=[],c=[],d,f=Math.pow(10,4),e,g;e=0;for(g=this.vertices.length;e<g;e++)d=this.vertices[e].position,d=[Math.round(d.x*f),Math.round(d.y*f),Math.round(d.z*f)].join("_"),a[d]===void 0?(a[d]=e,b.push(this.vertices[e]),c[e]=b.length-1):c[e]=c[a[d]];e=0;for(g=this.faces.length;e<g;e++)if(a=this.faces[e],a instanceof THREE.Face3)a.a=c[a.a],a.b=c[a.b],a.c= +c[a.c];else if(a instanceof THREE.Face4)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c],a.d=c[a.d];this.vertices=b}};THREE.GeometryCount=0;THREE.Camera=function(){if(arguments.length)return console.warn("DEPRECATED: Camera() is now PerspectiveCamera() or OrthographicCamera()."),new THREE.PerspectiveCamera(arguments[0],arguments[1],arguments[2],arguments[3]);THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4;this.projectionMatrixInverse=new THREE.Matrix4}; +THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.lookAt=function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)};THREE.OrthographicCamera=function(a,b,c,d,f,e){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=f!==void 0?f:0.1;this.far=e!==void 0?e:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera; +THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera;THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makeOrtho(this.left,this.right,this.top,this.bottom,this.near,this.far)};THREE.PerspectiveCamera=function(a,b,c,d){THREE.Camera.call(this);this.fov=a!==void 0?a:50;this.aspect=b!==void 0?b:1;this.near=c!==void 0?c:0.1;this.far=d!==void 0?d:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=new THREE.Camera; +THREE.PerspectiveCamera.prototype.constructor=THREE.PerspectiveCamera;THREE.PerspectiveCamera.prototype.setLens=function(a,b){this.fov=2*Math.atan((b!==void 0?b:43.25)/(a*2));this.fov*=180/Math.PI;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype.setViewOffset=function(a,b,c,d,f,e){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=d;this.width=f;this.height=e;this.updateProjectionMatrix()}; THREE.PerspectiveCamera.prototype.updateProjectionMatrix=function(){if(this.fullWidth){var a=this.fullWidth/this.fullHeight,b=Math.tan(this.fov*Math.PI/360)*this.near,c=-b,d=a*c,a=Math.abs(a*b-d),c=Math.abs(b-c);this.projectionMatrix=THREE.Matrix4.makeFrustum(d+this.x*a/this.fullWidth,d+(this.x+this.width)*a/this.fullWidth,b-(this.y+this.height)*c/this.fullHeight,b-this.y*c/this.fullHeight,this.near,this.far)}else this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near, this.far)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight; THREE.DirectionalLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=b!==void 0?b:1;this.distance=c!==void 0?c:0};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,0,0);this.intensity=b!==void 0?b:1;this.distance=c!==void 0?c:0};THREE.PointLight.prototype=new THREE.Light; diff --git a/build/custom/ThreeWebGL.js b/build/custom/ThreeWebGL.js index f7848e65c..aad20a270 100644 --- a/build/custom/ThreeWebGL.js +++ b/build/custom/ThreeWebGL.js @@ -1,4 +1,4 @@ -// ThreeWebGL.js r47dev - 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,22 +72,22 @@ 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)}}; THREE.Geometry=function(){this.id=THREE.GeometryCount++;this.vertices=[];this.colors=[];this.materials=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=!1}; THREE.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(a){var b=new THREE.Matrix4;b.extractRotation(a,new THREE.Vector3(1,1,1));for(var c=0,e=this.vertices.length;c<e;c++)a.multiplyVector3(this.vertices[c].position);c=0;for(e=this.faces.length;c<e;c++){var f=this.faces[c];b.multiplyVector3(f.normal);for(var g=0,h=f.vertexNormals.length;g<h;g++)b.multiplyVector3(f.vertexNormals[g]);a.multiplyVector3(f.centroid)}},computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a< -b;a++)c=this.faces[a],c.centroid.set(0,0,0),c instanceof THREE.Face3?(c.centroid.addSelf(this.vertices[c.a].position),c.centroid.addSelf(this.vertices[c.b].position),c.centroid.addSelf(this.vertices[c.c].position),c.centroid.divideScalar(3)):c instanceof THREE.Face4&&(c.centroid.addSelf(this.vertices[c.a].position),c.centroid.addSelf(this.vertices[c.b].position),c.centroid.addSelf(this.vertices[c.c].position),c.centroid.addSelf(this.vertices[c.d].position),c.centroid.divideScalar(4))},computeFaceNormals:function(a){var b, -c,e,f,g,h,i=new THREE.Vector3,n=new THREE.Vector3;e=0;for(f=this.faces.length;e<f;e++){g=this.faces[e];if(a&&g.vertexNormals.length){i.set(0,0,0);b=0;for(c=g.vertexNormals.length;b<c;b++)i.addSelf(g.vertexNormals[b]);i.divideScalar(3)}else b=this.vertices[g.a],c=this.vertices[g.b],h=this.vertices[g.c],i.sub(h.position,c.position),n.sub(b.position,c.position),i.crossSelf(n);i.isZero()||i.normalize();g.normal.copy(i)}},computeVertexNormals:function(){var a,b,c,e;if(this.__tmpVertices===void 0){e=this.__tmpVertices= -Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)e[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++)if(c=this.faces[a],c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{e=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)e[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof -THREE.Face3?(e[c.a].addSelf(c.normal),e[c.b].addSelf(c.normal),e[c.c].addSelf(c.normal)):c instanceof THREE.Face4&&(e[c.a].addSelf(c.normal),e[c.b].addSelf(c.normal),e[c.c].addSelf(c.normal),e[c.d].addSelf(c.normal));a=0;for(b=this.vertices.length;a<b;a++)e[a].normalize();a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof THREE.Face3?(c.vertexNormals[0].copy(e[c.a]),c.vertexNormals[1].copy(e[c.b]),c.vertexNormals[2].copy(e[c.c])):c instanceof THREE.Face4&&(c.vertexNormals[0].copy(e[c.a]), -c.vertexNormals[1].copy(e[c.b]),c.vertexNormals[2].copy(e[c.c]),c.vertexNormals[3].copy(e[c.d]))},computeTangents:function(){function a(a,b,c,e,g,f,N){i=a.vertices[b].position;n=a.vertices[c].position;k=a.vertices[e].position;l=h[g];p=h[f];A=h[N];r=n.x-i.x;y=k.x-i.x;I=n.y-i.y;R=k.y-i.y;va=n.z-i.z;ha=k.z-i.z;ja=p.u-l.u;ga=A.u-l.u;L=p.v-l.v;S=A.v-l.v;F=1/(ja*S-ga*L);W.set((S*r-L*y)*F,(S*I-L*R)*F,(S*va-L*ha)*F);la.set((ja*y-ga*r)*F,(ja*R-ga*I)*F,(ja*ha-ga*va)*F);ca[b].addSelf(W);ca[c].addSelf(W);ca[e].addSelf(W); -M[b].addSelf(la);M[c].addSelf(la);M[e].addSelf(la)}var b,c,e,f,g,h,i,n,k,l,p,A,r,y,I,R,va,ha,ja,ga,L,S,F,N,ca=[],M=[],W=new THREE.Vector3,la=new THREE.Vector3,oa=new THREE.Vector3,ra=new THREE.Vector3,wa=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)ca[b]=new THREE.Vector3,M[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)g=this.faces[b],h=this.faceVertexUvs[0][b],g instanceof THREE.Face3?a(this,g.a,g.b,g.c,0,1,2):g instanceof THREE.Face4&&(a(this,g.a,g.b,g.c,0,1,2),a(this,g.a, -g.b,g.d,0,1,3));var Q=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){g=this.faces[b];for(e=0;e<g.vertexNormals.length;e++)wa.copy(g.vertexNormals[e]),f=g[Q[e]],N=ca[f],oa.copy(N),oa.subSelf(wa.multiplyScalar(wa.dot(N))).normalize(),ra.cross(g.vertexNormals[e],N),f=ra.dot(M[f]),f=f<0?-1:1,g.vertexTangents[e]=new THREE.Vector4(oa.x,oa.y,oa.z,f)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x], -y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,c=this.vertices.length;b<c;b++){a=this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z< -this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=0,b=0,c=this.vertices.length;b<c;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}},mergeVertices:function(){var a={},b=[],c=[],e,f=Math.pow(10,4),g,h;g=0;for(h=this.vertices.length;g<h;g++)e=this.vertices[g].position,e=[Math.round(e.x*f),Math.round(e.y*f),Math.round(e.z*f)].join("_"), -a[e]===void 0?(a[e]=g,b.push(this.vertices[g]),c[g]=b.length-1):c[g]=c[a[e]];g=0;for(h=this.faces.length;g<h;g++)if(a=this.faces[g],a instanceof THREE.Face3)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c];else if(a instanceof THREE.Face4)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c],a.d=c[a.d];this.vertices=b}};THREE.GeometryCount=0; +b;a++)c=this.faces[a],c.centroid.set(0,0,0),c instanceof THREE.Face3?(c.centroid.addSelf(this.vertices[c.a].position),c.centroid.addSelf(this.vertices[c.b].position),c.centroid.addSelf(this.vertices[c.c].position),c.centroid.divideScalar(3)):c instanceof THREE.Face4&&(c.centroid.addSelf(this.vertices[c.a].position),c.centroid.addSelf(this.vertices[c.b].position),c.centroid.addSelf(this.vertices[c.c].position),c.centroid.addSelf(this.vertices[c.d].position),c.centroid.divideScalar(4))},computeFaceNormals:function(){var a, +b,c,e,f,g,h=new THREE.Vector3,i=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],e=this.vertices[c.a],f=this.vertices[c.b],g=this.vertices[c.c],h.sub(g.position,f.position),i.sub(e.position,f.position),h.crossSelf(i),h.isZero()||h.normalize(),c.normal.copy(h)},computeVertexNormals:function(){var a,b,c,e;if(this.__tmpVertices===void 0){e=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)e[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++)if(c= +this.faces[a],c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{e=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)e[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof THREE.Face3?(e[c.a].addSelf(c.normal),e[c.b].addSelf(c.normal),e[c.c].addSelf(c.normal)):c instanceof THREE.Face4&&(e[c.a].addSelf(c.normal), +e[c.b].addSelf(c.normal),e[c.c].addSelf(c.normal),e[c.d].addSelf(c.normal));a=0;for(b=this.vertices.length;a<b;a++)e[a].normalize();a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof THREE.Face3?(c.vertexNormals[0].copy(e[c.a]),c.vertexNormals[1].copy(e[c.b]),c.vertexNormals[2].copy(e[c.c])):c instanceof THREE.Face4&&(c.vertexNormals[0].copy(e[c.a]),c.vertexNormals[1].copy(e[c.b]),c.vertexNormals[2].copy(e[c.c]),c.vertexNormals[3].copy(e[c.d]))},computeTangents:function(){function a(a, +b,c,e,g,f,N){i=a.vertices[b].position;n=a.vertices[c].position;k=a.vertices[e].position;l=h[g];p=h[f];A=h[N];r=n.x-i.x;y=k.x-i.x;I=n.y-i.y;R=k.y-i.y;va=n.z-i.z;ha=k.z-i.z;ja=p.u-l.u;ga=A.u-l.u;L=p.v-l.v;S=A.v-l.v;F=1/(ja*S-ga*L);W.set((S*r-L*y)*F,(S*I-L*R)*F,(S*va-L*ha)*F);la.set((ja*y-ga*r)*F,(ja*R-ga*I)*F,(ja*ha-ga*va)*F);ca[b].addSelf(W);ca[c].addSelf(W);ca[e].addSelf(W);M[b].addSelf(la);M[c].addSelf(la);M[e].addSelf(la)}var b,c,e,f,g,h,i,n,k,l,p,A,r,y,I,R,va,ha,ja,ga,L,S,F,N,ca=[],M=[],W=new THREE.Vector3, +la=new THREE.Vector3,oa=new THREE.Vector3,ra=new THREE.Vector3,wa=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)ca[b]=new THREE.Vector3,M[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)g=this.faces[b],h=this.faceVertexUvs[0][b],g instanceof THREE.Face3?a(this,g.a,g.b,g.c,0,1,2):g instanceof THREE.Face4&&(a(this,g.a,g.b,g.c,0,1,2),a(this,g.a,g.b,g.d,0,1,3));var Q=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){g=this.faces[b];for(e=0;e<g.vertexNormals.length;e++)wa.copy(g.vertexNormals[e]), +f=g[Q[e]],N=ca[f],oa.copy(N),oa.subSelf(wa.multiplyScalar(wa.dot(N))).normalize(),ra.cross(g.vertexNormals[e],N),f=ra.dot(M[f]),f=f<0?-1:1,g.vertexTangents[e]=new THREE.Vector4(oa.x,oa.y,oa.z,f)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,c=this.vertices.length;b< +c;b++){a=this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a= +0,b=0,c=this.vertices.length;b<c;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}},mergeVertices:function(){var a={},b=[],c=[],e,f=Math.pow(10,4),g,h;g=0;for(h=this.vertices.length;g<h;g++)e=this.vertices[g].position,e=[Math.round(e.x*f),Math.round(e.y*f),Math.round(e.z*f)].join("_"),a[e]===void 0?(a[e]=g,b.push(this.vertices[g]),c[g]=b.length-1):c[g]=c[a[e]];g=0;for(h=this.faces.length;g<h;g++)if(a=this.faces[g],a instanceof THREE.Face3)a.a=c[a.a],a.b=c[a.b],a.c= +c[a.c];else if(a instanceof THREE.Face4)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c],a.d=c[a.d];this.vertices=b}};THREE.GeometryCount=0; THREE.Spline=function(a){function b(a,b,c,e,g,f,h){a=(c-a)*0.5;e=(e-b)*0.5;return(2*(b-c)+a+e)*h+(-3*(b-c)-2*a-e)*f+a*g+b}this.points=a;var c=[],e={x:0,y:0,z:0},f,g,h,i,n,k,l,p,A;this.initFromArray=function(a){this.points=[];for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}};this.getPoint=function(a){f=(this.points.length-1)*a;g=Math.floor(f);h=f-g;c[0]=g===0?g:g-1;c[1]=g;c[2]=g>this.points.length-2?g:g+1;c[3]=g>this.points.length-3?g:g+2;k=this.points[c[0]];l=this.points[c[1]]; p=this.points[c[2]];A=this.points[c[3]];i=h*h;n=h*i;e.x=b(k.x,l.x,p.x,A.x,h,i,n);e.y=b(k.y,l.y,p.y,A.y,h,i,n);e.z=b(k.z,l.z,p.z,A.z,h,i,n);return e};this.getControlPointsArray=function(){var a,b,c=this.points.length,e=[];for(a=0;a<c;a++)b=this.points[a],e[a]=[b.x,b.y,b.z];return e};this.getLength=function(a){var b,c,e,g=b=b=0,f=new THREE.Vector3,h=new THREE.Vector3,i=[],l=0;i[0]=0;a||(a=100);c=this.points.length*a;f.copy(this.points[0]);for(a=1;a<c;a++)b=a/c,e=this.getPoint(b),h.copy(e),l+=h.distanceTo(f), f.copy(e),b*=this.points.length-1,b=Math.floor(b),b!=g&&(i[b]=l,g=b);i[i.length]=l;return{chunks:i,total:l}};this.reparametrizeByArcLength=function(a){var b,c,e,g,f,h,i=[],l=new THREE.Vector3,p=this.getLength();i.push(l.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=p.chunks[b]-p.chunks[b-1];h=Math.ceil(a*c/p.total);g=(b-1)/(this.points.length-1);f=b/(this.points.length-1);for(c=1;c<h-1;c++)e=g+c*(1/h)*(f-g),e=this.getPoint(e),i.push(l.copy(e).clone());i.push(l.copy(this.points[b]).clone())}this.points= diff --git a/src/extras/SceneUtils.js b/src/extras/SceneUtils.js index 7c8f64d79..c423a8700 100644 --- a/src/extras/SceneUtils.js +++ b/src/extras/SceneUtils.js @@ -63,6 +63,10 @@ THREE.SceneUtils = { object.direction = source.direction; object.directionBackwards = source.directionBackwards; + } else if ( source instanceof THREE.SkinnedMesh ) { + + object = new THREE.SkinnedMesh( source.geometry, source.material ); + } else if ( source instanceof THREE.Mesh ) { object = new THREE.Mesh( source.geometry, source.material ); @@ -109,10 +113,6 @@ THREE.SceneUtils = { object = new THREE.LOD(); - } else if ( source instanceof THREE.SkinnedMesh ) { - - object = new THREE.SkinnedMesh(); - } else if ( source instanceof THREE.MarchingCubes ) { object = new THREE.MarchingCubes( source.resolution, source.material ); -- GitLab