Jelajahi Sumber

Lines can be treated as Objects

Mr.doob 13 tahun lalu
induk
melakukan
caabab07f3
6 mengubah file dengan 233 tambahan dan 245 penghapusan
  1. 59 59
      build/Three.js
  2. 37 37
      build/custom/ThreeCanvas.js
  3. 14 14
      build/custom/ThreeDOM.js
  4. 27 27
      build/custom/ThreeSVG.js
  5. 91 91
      build/custom/ThreeWebGL.js
  6. 5 17
      src/core/Projector.js

+ 59 - 59
build/Three.js

@@ -55,18 +55,18 @@ 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)},remove:function(a){var c=this.children.indexOf(a);if(c!==-1)a.parent=void 0,this.children.splice(c,1)},getChildByName:function(a,c){var b,e,k;b=0;for(e=this.children.length;b<e;b++){k=this.children[b];if(k.name===a)return k;if(c&&(k=k.getChildByName(a,c),k!==void 0))return k}},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=h[k]=h[k]||new THREE.RenderableVertex;k++;return a}function c(a,b){return b.z-a.z}function b(a,b){var c=0,e=1,f=a.z+a.w,k=b.z+b.w,h=-a.z+a.w,l=-b.z+b.w;return f>=0&&k>=0&&h>=0&&l>=0?!0:f<0&&k<0||h<0&&l<0?!1:(f<0?c=Math.max(c,f/(f-k)):k<0&&(e=Math.min(e,f/(f-k))),h<0?c=Math.max(c,h/(h-l)):l<0&&(e=Math.min(e,h/(h-l))),e<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-e),!0))}var e,k,h=[],f,l,n=[],u,t=[],p,w,v=[],z,x,y=[],C={objects:[],lines:[],sprites:[],lights:[],
-elements:[]};new THREE.Vector3;var A=new THREE.Vector4,B=new THREE.Matrix4,D=new THREE.Matrix4,K=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],H=new THREE.Vector4,M=new THREE.Vector4;this.computeFrustum=function(a){K[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);K[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);K[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);K[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-
-a.n24);K[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);K[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=K[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);B.multiply(b.projectionMatrix,b.matrixWorldInverse);B.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);B.multiply(b.matrixWorld,b.projectionMatrixInverse);
-B.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(a){C.objects.length=0;C.lines.length=0;C.sprites.length=0;C.lights.length=0;var b=function(a){if(a.visible!=!1){var c;if(c=a instanceof THREE.Mesh)if(!(c=a.frustumCulled==!1))a:{for(var e=a.matrixWorld,f=-a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,
-a.scale.z)),k=0;k<6;k++)if(c=K[k].x*e.n14+K[k].y*e.n24+K[k].z*e.n34+K[k].w,c<=f){c=!1;break a}c=!0}c?C.objects.push(a):a instanceof THREE.Line?C.lines.push(a):a instanceof THREE.Sprite||a instanceof THREE.Particle?C.sprites.push(a):a instanceof THREE.Light&&C.lights.push(a);c=0;for(e=a.children.length;c<e;c++)b(a.children[c])}};b(a);return C};this.projectScene=function(K,L,W){var N=L.near,O=L.far,$,Y,P,o,U,Q,aa,T,J,ra,pa,la,qa,ja,ma,ea;x=w=u=l=0;C.elements.length=0;L.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),
-K.add(L));K.updateMatrixWorld();L.matrixWorldInverse.getInverse(L.matrixWorld);B.multiply(L.projectionMatrix,L.matrixWorldInverse);this.computeFrustum(B);C=this.projectGraph(K);K=0;for($=C.objects.length;K<$;K++)if(J=C.objects[K],ra=J.matrixWorld,la=J.material,k=0,J instanceof THREE.Mesh){pa=J.geometry;qa=J.geometry.materials;o=pa.vertices;ja=pa.faces;ma=pa.faceVertexUvs;pa=J.matrixRotationWorld.extractRotation(ra);Y=0;for(P=o.length;Y<P;Y++)e=a(),e.positionWorld.copy(o[Y].position),ra.multiplyVector3(e.positionWorld),
+THREE.Projector=function(){function a(){var a=h[k]=h[k]||new THREE.RenderableVertex;k++;return a}function c(a,b){return b.z-a.z}function b(a,b){var c=0,e=1,f=a.z+a.w,k=b.z+b.w,h=-a.z+a.w,l=-b.z+b.w;return f>=0&&k>=0&&h>=0&&l>=0?!0:f<0&&k<0||h<0&&l<0?!1:(f<0?c=Math.max(c,f/(f-k)):k<0&&(e=Math.min(e,f/(f-k))),h<0?c=Math.max(c,h/(h-l)):l<0&&(e=Math.min(e,h/(h-l))),e<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-e),!0))}var e,k,h=[],f,l,n=[],u,t=[],p,w,v=[],z,x,y=[],C={objects:[],sprites:[],lights:[],elements:[]};
+new THREE.Vector3;var A=new THREE.Vector4,B=new THREE.Matrix4,D=new THREE.Matrix4,K=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],H=new THREE.Vector4,M=new THREE.Vector4;this.computeFrustum=function(a){K[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);K[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);K[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);K[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);K[4].set(a.n41-
+a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);K[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=K[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);B.multiply(b.projectionMatrix,b.matrixWorldInverse);B.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);B.multiply(b.matrixWorld,b.projectionMatrixInverse);B.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(a){C.objects.length=0;C.sprites.length=0;C.lights.length=0;var b=function(a){if(a.visible!=!1){var c;if(c=a instanceof THREE.Mesh)if(!(c=a.frustumCulled==!1))a:{for(var e=a.matrixWorld,f=-a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)),k=0;k<6;k++)if(c=
+K[k].x*e.n14+K[k].y*e.n24+K[k].z*e.n34+K[k].w,c<=f){c=!1;break a}c=!0}c?C.objects.push(a):a instanceof THREE.Line?C.objects.push(a):a instanceof THREE.Sprite||a instanceof THREE.Particle?C.sprites.push(a):a instanceof THREE.Light&&C.lights.push(a);c=0;for(e=a.children.length;c<e;c++)b(a.children[c])}};b(a);return C};this.projectScene=function(K,L,W){var N=L.near,O=L.far,$,Y,P,o,U,Q,aa,T,J,ra,pa,na,qa,ja,la,ea;x=w=u=l=0;C.elements.length=0;L.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),
+K.add(L));K.updateMatrixWorld();L.matrixWorldInverse.getInverse(L.matrixWorld);B.multiply(L.projectionMatrix,L.matrixWorldInverse);this.computeFrustum(B);C=this.projectGraph(K);K=0;for($=C.objects.length;K<$;K++)if(J=C.objects[K],ra=J.matrixWorld,na=J.material,k=0,J instanceof THREE.Mesh){pa=J.geometry;qa=J.geometry.materials;o=pa.vertices;ja=pa.faces;la=pa.faceVertexUvs;pa=J.matrixRotationWorld.extractRotation(ra);Y=0;for(P=o.length;Y<P;Y++)e=a(),e.positionWorld.copy(o[Y].position),ra.multiplyVector3(e.positionWorld),
 e.positionScreen.copy(e.positionWorld),B.multiplyVector4(e.positionScreen),e.positionScreen.x/=e.positionScreen.w,e.positionScreen.y/=e.positionScreen.w,e.visible=e.positionScreen.z>N&&e.positionScreen.z<O;o=0;for(Y=ja.length;o<Y;o++){P=ja[o];if(P instanceof THREE.Face3)if(U=h[P.a],Q=h[P.b],aa=h[P.c],U.visible&&Q.visible&&aa.visible&&(J.doubleSided||J.flipSided!=(aa.positionScreen.x-U.positionScreen.x)*(Q.positionScreen.y-U.positionScreen.y)-(aa.positionScreen.y-U.positionScreen.y)*(Q.positionScreen.x-
 U.positionScreen.x)<0))T=n[l]=n[l]||new THREE.RenderableFace3,l++,f=T,f.v1.copy(U),f.v2.copy(Q),f.v3.copy(aa);else continue;else if(P instanceof THREE.Face4)if(U=h[P.a],Q=h[P.b],aa=h[P.c],T=h[P.d],U.visible&&Q.visible&&aa.visible&&T.visible&&(J.doubleSided||J.flipSided!=((T.positionScreen.x-U.positionScreen.x)*(Q.positionScreen.y-U.positionScreen.y)-(T.positionScreen.y-U.positionScreen.y)*(Q.positionScreen.x-U.positionScreen.x)<0||(Q.positionScreen.x-aa.positionScreen.x)*(T.positionScreen.y-aa.positionScreen.y)-
 (Q.positionScreen.y-aa.positionScreen.y)*(T.positionScreen.x-aa.positionScreen.x)<0)))ea=t[u]=t[u]||new THREE.RenderableFace4,u++,f=ea,f.v1.copy(U),f.v2.copy(Q),f.v3.copy(aa),f.v4.copy(T);else continue;f.normalWorld.copy(P.normal);pa.multiplyVector3(f.normalWorld);f.centroidWorld.copy(P.centroid);ra.multiplyVector3(f.centroidWorld);f.centroidScreen.copy(f.centroidWorld);B.multiplyVector3(f.centroidScreen);aa=P.vertexNormals;U=0;for(Q=aa.length;U<Q;U++)T=f.vertexNormalsWorld[U],T.copy(aa[U]),pa.multiplyVector3(T);
-U=0;for(Q=ma.length;U<Q;U++)if(ea=ma[U][o]){aa=0;for(T=ea.length;aa<T;aa++)f.uvs[U][aa]=ea[aa]}f.material=la;f.faceMaterial=P.materialIndex!==null?qa[P.materialIndex]:null;f.z=f.centroidScreen.z;C.elements.push(f)}}K=0;for($=C.lines.length;K<$;K++)if(J=C.lines[K],ra=J.matrixWorld,la=J.material,k=0,J instanceof THREE.Line){D.multiply(B,ra);o=J.geometry.vertices;U=a();U.positionScreen.copy(o[0].position);D.multiplyVector4(U.positionScreen);Y=1;for(P=o.length;Y<P;Y++)if(U=a(),U.positionScreen.copy(o[Y].position),
-D.multiplyVector4(U.positionScreen),Q=h[k-2],H.copy(U.positionScreen),M.copy(Q.positionScreen),b(H,M))H.multiplyScalar(1/H.w),M.multiplyScalar(1/M.w),N=v[w]=v[w]||new THREE.RenderableLine,w++,p=N,p.v1.positionScreen.copy(H),p.v2.positionScreen.copy(M),p.z=Math.max(H.z,M.z),p.material=la,C.elements.push(p)}K=0;for($=C.sprites.length;K<$;K++)if(J=C.sprites[K],ra=J.matrixWorld,J instanceof THREE.Particle&&(A.set(ra.n14,ra.n24,ra.n34,1),B.multiplyVector4(A),A.z/=A.w,A.z>0&&A.z<1))N=y[x]=y[x]||new THREE.RenderableParticle,
-x++,z=N,z.x=A.x/A.w,z.y=A.y/A.w,z.z=A.z,z.rotation=J.rotation.z,z.scale.x=J.scale.x*Math.abs(z.x-(A.x+L.projectionMatrix.n11)/(A.w+L.projectionMatrix.n14)),z.scale.y=J.scale.y*Math.abs(z.y-(A.y+L.projectionMatrix.n22)/(A.w+L.projectionMatrix.n24)),z.material=J.material,C.elements.push(z);W&&C.elements.sort(c);return C}};THREE.Quaternion=function(a,c,b,e){this.set(a||0,c||0,b||0,e!==void 0?e:1)};
+U=0;for(Q=la.length;U<Q;U++)if(ea=la[U][o]){aa=0;for(T=ea.length;aa<T;aa++)f.uvs[U][aa]=ea[aa]}f.material=na;f.faceMaterial=P.materialIndex!==null?qa[P.materialIndex]:null;f.z=f.centroidScreen.z;C.elements.push(f)}}else if(J instanceof THREE.Line){D.multiply(B,ra);o=J.geometry.vertices;U=a();U.positionScreen.copy(o[0].position);D.multiplyVector4(U.positionScreen);Y=1;for(P=o.length;Y<P;Y++)if(U=a(),U.positionScreen.copy(o[Y].position),D.multiplyVector4(U.positionScreen),Q=h[k-2],H.copy(U.positionScreen),
+M.copy(Q.positionScreen),b(H,M))H.multiplyScalar(1/H.w),M.multiplyScalar(1/M.w),J=v[w]=v[w]||new THREE.RenderableLine,w++,p=J,p.v1.positionScreen.copy(H),p.v2.positionScreen.copy(M),p.z=Math.max(H.z,M.z),p.material=na,C.elements.push(p)}K=0;for($=C.sprites.length;K<$;K++)if(J=C.sprites[K],ra=J.matrixWorld,J instanceof THREE.Particle&&(A.set(ra.n14,ra.n24,ra.n34,1),B.multiplyVector4(A),A.z/=A.w,A.z>0&&A.z<1))N=y[x]=y[x]||new THREE.RenderableParticle,x++,z=N,z.x=A.x/A.w,z.y=A.y/A.w,z.z=A.z,z.rotation=
+J.rotation.z,z.scale.x=J.scale.x*Math.abs(z.x-(A.x+L.projectionMatrix.n11)/(A.w+L.projectionMatrix.n14)),z.scale.y=J.scale.y*Math.abs(z.y-(A.y+L.projectionMatrix.n22)/(A.w+L.projectionMatrix.n24)),z.material=J.material,C.elements.push(z);W&&C.elements.sort(c);return C}};THREE.Quaternion=function(a,c,b,e){this.set(a||0,c||0,b||0,e!==void 0?e:1)};
 THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,c,b,e){this.x=a;this.y=c;this.z=b;this.w=e;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,e=a.y*c,k=a.z*c,a=Math.cos(e),e=Math.sin(e),c=Math.cos(-k),k=Math.sin(-k),h=Math.cos(b),b=Math.sin(b),f=a*c,l=e*k;this.w=f*h-l*b;this.x=f*b+l*h;this.y=e*c*h+a*k*b;this.z=a*k*h-e*c*b;return this},setFromAxisAngle:function(a,c){var b=c/2,e=Math.sin(b);
 this.x=a.x*e;this.y=a.y*e;this.z=a.z*e;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=
@@ -149,7 +149,7 @@ THREE.SpriteAlignment.topRight=new THREE.Vector2(-1,-1);THREE.SpriteAlignment.ce
 THREE.Scene=function(){THREE.Object3D.call(this);this.overrideMaterial=this.fog=null;this.matrixAutoUpdate=!1};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Fog=function(a,c,b){this.color=new THREE.Color(a);this.near=c!==void 0?c:1;this.far=b!==void 0?b:1E3};THREE.FogExp2=function(a,c){this.color=new THREE.Color(a);this.density=c!==void 0?c:2.5E-4};
 THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,b,e,k,h;this.domElement=document.createElement("div");this.setSize=function(a,c){b=a;e=c;k=b/2;h=e/2};this.render=function(b,e){var n,u,t,p,w,v,z,x;a=c.projectScene(b,e);n=0;for(u=a.length;n<u;n++)if(w=a[n],w instanceof THREE.RenderableParticle){z=w.x*k+k;x=w.y*h+h;t=0;for(p=w.material.length;t<p;t++)if(v=w.material[t],v instanceof THREE.ParticleDOMMaterial)v=v.domElement,v.style.left=z+"px",v.style.top=x+"px"}}};
 THREE.CanvasRenderer=function(a){function c(a){if(A!=a)x.globalAlpha=A=a}function b(a){if(B!=a){switch(a){case THREE.NormalBlending:x.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:x.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:x.globalCompositeOperation="darker"}B=a}}function e(a){if(D!=a)x.strokeStyle=D=a}function k(a){if(K!=a)x.fillStyle=K=a}var h=this,f,l,n,u=new THREE.Projector,a=a||{},t=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
-p,w,v,z,x=t.getContext("2d"),y=new THREE.Color(0),C=0,A=1,B=0,D=null,K=null,H=null,M=null,V=null,L,W,N,O,$=new THREE.RenderableVertex,Y=new THREE.RenderableVertex,P,o,U,Q,aa,T,J,ra,pa,la,qa,ja,ma=new THREE.Color,ea=new THREE.Color,ca=new THREE.Color,Z=new THREE.Color,ga=new THREE.Color,ha=[],oa,na,ka,sa,Da,Ea,Ca,Fa,za,F,fa=new THREE.Rectangle,ia=new THREE.Rectangle,G=new THREE.Rectangle,da=!1,va=new THREE.Color,ua=new THREE.Color,ta=new THREE.Color,wa=new THREE.Vector3,Ga,Ba,Ka,ya,X,Ia,a=16;Ga=document.createElement("canvas");
+p,w,v,z,x=t.getContext("2d"),y=new THREE.Color(0),C=0,A=1,B=0,D=null,K=null,H=null,M=null,V=null,L,W,N,O,$=new THREE.RenderableVertex,Y=new THREE.RenderableVertex,P,o,U,Q,aa,T,J,ra,pa,na,qa,ja,la=new THREE.Color,ea=new THREE.Color,ca=new THREE.Color,Z=new THREE.Color,ga=new THREE.Color,ha=[],oa,ma,ka,sa,Da,Ea,Ca,Fa,za,F,fa=new THREE.Rectangle,ia=new THREE.Rectangle,G=new THREE.Rectangle,da=!1,va=new THREE.Color,ua=new THREE.Color,ta=new THREE.Color,wa=new THREE.Vector3,Ga,Ba,Ka,ya,X,Ia,a=16;Ga=document.createElement("canvas");
 Ga.width=Ga.height=2;Ba=Ga.getContext("2d");Ba.fillStyle="rgba(0,0,0,1)";Ba.fillRect(0,0,2,2);Ka=Ba.getImageData(0,0,2,2);ya=Ka.data;X=document.createElement("canvas");X.width=X.height=a;Ia=X.getContext("2d");Ia.translate(-a/2,-a/2);Ia.scale(a,a);a--;this.domElement=t;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){p=a;w=b;v=Math.floor(p/2);z=Math.floor(w/2);t.width=p;t.height=w;fa.set(-v,-z,v,z);ia.set(-v,-z,v,z);A=1;B=0;V=M=
 H=K=D=null};this.setClearColor=function(a,b){y.copy(a);C=b;ia.set(-v,-z,v,z)};this.setClearColorHex=function(a,b){y.setHex(a);C=b;ia.set(-v,-z,v,z)};this.clear=function(){x.setTransform(1,0,0,-1,v,z);ia.isEmpty()||(ia.minSelf(fa),ia.inflate(2),C<1&&x.clearRect(Math.floor(ia.getX()),Math.floor(ia.getY()),Math.floor(ia.getWidth()),Math.floor(ia.getHeight())),C>0&&(b(THREE.NormalBlending),c(1),k("rgba("+Math.floor(y.r*255)+","+Math.floor(y.g*255)+","+Math.floor(y.b*255)+","+C+")"),x.fillRect(Math.floor(ia.getX()),
 Math.floor(ia.getY()),Math.floor(ia.getWidth()),Math.floor(ia.getHeight()))),ia.empty())};this.render=function(a,t){function p(a){var b,c,e,f;va.setRGB(0,0,0);ua.setRGB(0,0,0);ta.setRGB(0,0,0);b=0;for(c=a.length;b<c;b++)e=a[b],f=e.color,e instanceof THREE.AmbientLight?(va.r+=f.r,va.g+=f.g,va.b+=f.b):e instanceof THREE.DirectionalLight?(ua.r+=f.r,ua.g+=f.g,ua.b+=f.b):e instanceof THREE.PointLight&&(ta.r+=f.r,ta.g+=f.g,ta.b+=f.b)}function w(a,b,c,e){var f,k,h,o,l,n;f=0;for(k=a.length;f<k;f++)h=a[f],
@@ -159,14 +159,14 @@ f,h,k){c(k.opacity);b(k.blending);x.beginPath();x.moveTo(a.positionScreen.x,a.po
 U=e.positionScreen.x;Q=e.positionScreen.y;aa=f.positionScreen.x;T=f.positionScreen.y;C(P,o,U,Q,aa,T);if(p instanceof THREE.MeshBasicMaterial)if(p.map)p.map.mapping instanceof THREE.UVMapping&&(sa=v.uvs[0],Wa(P,o,U,Q,aa,T,sa[k].u,sa[k].v,sa[l].u,sa[l].v,sa[u].u,sa[u].v,p.map));else if(p.envMap){if(p.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=t.matrixWorldInverse,wa.copy(v.vertexNormalsWorld[k]),Da=(wa.x*a.n11+wa.y*a.n12+wa.z*a.n13)*0.5+0.5,Ea=-(wa.x*a.n21+wa.y*a.n22+wa.z*a.n23)*0.5+
 0.5,wa.copy(v.vertexNormalsWorld[l]),Ca=(wa.x*a.n11+wa.y*a.n12+wa.z*a.n13)*0.5+0.5,Fa=-(wa.x*a.n21+wa.y*a.n22+wa.z*a.n23)*0.5+0.5,wa.copy(v.vertexNormalsWorld[u]),za=(wa.x*a.n11+wa.y*a.n12+wa.z*a.n13)*0.5+0.5,F=-(wa.x*a.n21+wa.y*a.n22+wa.z*a.n23)*0.5+0.5,Wa(P,o,U,Q,aa,T,Da,Ea,Ca,Fa,za,F,p.envMap)}else p.wireframe?K(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ma(p.color);else if(p instanceof THREE.MeshLambertMaterial)p.map&&!p.wireframe&&(p.map.mapping instanceof THREE.UVMapping&&
 (sa=v.uvs[0],Wa(P,o,U,Q,aa,T,sa[k].u,sa[k].v,sa[l].u,sa[l].v,sa[u].u,sa[u].v,p.map)),b(THREE.SubtractiveBlending)),da?!p.wireframe&&p.shading==THREE.SmoothShading&&v.vertexNormalsWorld.length==3?(ea.r=ca.r=Z.r=va.r,ea.g=ca.g=Z.g=va.g,ea.b=ca.b=Z.b=va.b,w(n,v.v1.positionWorld,v.vertexNormalsWorld[0],ea),w(n,v.v2.positionWorld,v.vertexNormalsWorld[1],ca),w(n,v.v3.positionWorld,v.vertexNormalsWorld[2],Z),ea.r=Math.max(0,Math.min(p.color.r*ea.r,1)),ea.g=Math.max(0,Math.min(p.color.g*ea.g,1)),ea.b=Math.max(0,
-Math.min(p.color.b*ea.b,1)),ca.r=Math.max(0,Math.min(p.color.r*ca.r,1)),ca.g=Math.max(0,Math.min(p.color.g*ca.g,1)),ca.b=Math.max(0,Math.min(p.color.b*ca.b,1)),Z.r=Math.max(0,Math.min(p.color.r*Z.r,1)),Z.g=Math.max(0,Math.min(p.color.g*Z.g,1)),Z.b=Math.max(0,Math.min(p.color.b*Z.b,1)),ga.r=(ca.r+Z.r)*0.5,ga.g=(ca.g+Z.g)*0.5,ga.b=(ca.b+Z.b)*0.5,ka=Ua(ea,ca,Z,ga),Sa(P,o,U,Q,aa,T,0,0,1,0,0,1,ka)):(ma.r=va.r,ma.g=va.g,ma.b=va.b,w(n,v.centroidWorld,v.normalWorld,ma),ma.r=Math.max(0,Math.min(p.color.r*
-ma.r,1)),ma.g=Math.max(0,Math.min(p.color.g*ma.g,1)),ma.b=Math.max(0,Math.min(p.color.b*ma.b,1)),p.wireframe?K(ma,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ma(ma)):p.wireframe?K(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ma(p.color);else if(p instanceof THREE.MeshDepthMaterial)oa=t.near,na=t.far,ea.r=ea.g=ea.b=1-Oa(a.positionScreen.z,oa,na),ca.r=ca.g=ca.b=1-Oa(e.positionScreen.z,oa,na),Z.r=Z.g=Z.b=1-Oa(f.positionScreen.z,oa,na),ga.r=(ca.r+Z.r)*0.5,ga.g=
-(ca.g+Z.g)*0.5,ga.b=(ca.b+Z.b)*0.5,ka=Ua(ea,ca,Z,ga),Sa(P,o,U,Q,aa,T,0,0,1,0,0,1,ka);else if(p instanceof THREE.MeshNormalMaterial)ma.r=Ta(v.normalWorld.x),ma.g=Ta(v.normalWorld.y),ma.b=Ta(v.normalWorld.z),p.wireframe?K(ma,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ma(ma)}function B(a,e,f,k,l,u,p,v,xa){h.info.render.vertices+=4;h.info.render.faces++;c(v.opacity);b(v.blending);if(v.map||v.envMap)A(a,e,k,0,1,3,p,v,xa),A(l,f,u,1,2,3,p,v,xa);else if(P=a.positionScreen.x,o=a.positionScreen.y,
-U=e.positionScreen.x,Q=e.positionScreen.y,aa=f.positionScreen.x,T=f.positionScreen.y,J=k.positionScreen.x,ra=k.positionScreen.y,pa=l.positionScreen.x,la=l.positionScreen.y,qa=u.positionScreen.x,ja=u.positionScreen.y,v instanceof THREE.MeshBasicMaterial)D(P,o,U,Q,aa,T,J,ra),v.wireframe?K(v.color,v.wireframeLinewidth,v.wireframeLinecap,v.wireframeLinejoin):Ma(v.color);else if(v instanceof THREE.MeshLambertMaterial)da?!v.wireframe&&v.shading==THREE.SmoothShading&&p.vertexNormalsWorld.length==4?(ea.r=
+Math.min(p.color.b*ea.b,1)),ca.r=Math.max(0,Math.min(p.color.r*ca.r,1)),ca.g=Math.max(0,Math.min(p.color.g*ca.g,1)),ca.b=Math.max(0,Math.min(p.color.b*ca.b,1)),Z.r=Math.max(0,Math.min(p.color.r*Z.r,1)),Z.g=Math.max(0,Math.min(p.color.g*Z.g,1)),Z.b=Math.max(0,Math.min(p.color.b*Z.b,1)),ga.r=(ca.r+Z.r)*0.5,ga.g=(ca.g+Z.g)*0.5,ga.b=(ca.b+Z.b)*0.5,ka=Ua(ea,ca,Z,ga),Sa(P,o,U,Q,aa,T,0,0,1,0,0,1,ka)):(la.r=va.r,la.g=va.g,la.b=va.b,w(n,v.centroidWorld,v.normalWorld,la),la.r=Math.max(0,Math.min(p.color.r*
+la.r,1)),la.g=Math.max(0,Math.min(p.color.g*la.g,1)),la.b=Math.max(0,Math.min(p.color.b*la.b,1)),p.wireframe?K(la,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ma(la)):p.wireframe?K(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ma(p.color);else if(p instanceof THREE.MeshDepthMaterial)oa=t.near,ma=t.far,ea.r=ea.g=ea.b=1-Oa(a.positionScreen.z,oa,ma),ca.r=ca.g=ca.b=1-Oa(e.positionScreen.z,oa,ma),Z.r=Z.g=Z.b=1-Oa(f.positionScreen.z,oa,ma),ga.r=(ca.r+Z.r)*0.5,ga.g=
+(ca.g+Z.g)*0.5,ga.b=(ca.b+Z.b)*0.5,ka=Ua(ea,ca,Z,ga),Sa(P,o,U,Q,aa,T,0,0,1,0,0,1,ka);else if(p instanceof THREE.MeshNormalMaterial)la.r=Ta(v.normalWorld.x),la.g=Ta(v.normalWorld.y),la.b=Ta(v.normalWorld.z),p.wireframe?K(la,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ma(la)}function B(a,e,f,k,l,u,p,v,xa){h.info.render.vertices+=4;h.info.render.faces++;c(v.opacity);b(v.blending);if(v.map||v.envMap)A(a,e,k,0,1,3,p,v,xa),A(l,f,u,1,2,3,p,v,xa);else if(P=a.positionScreen.x,o=a.positionScreen.y,
+U=e.positionScreen.x,Q=e.positionScreen.y,aa=f.positionScreen.x,T=f.positionScreen.y,J=k.positionScreen.x,ra=k.positionScreen.y,pa=l.positionScreen.x,na=l.positionScreen.y,qa=u.positionScreen.x,ja=u.positionScreen.y,v instanceof THREE.MeshBasicMaterial)D(P,o,U,Q,aa,T,J,ra),v.wireframe?K(v.color,v.wireframeLinewidth,v.wireframeLinecap,v.wireframeLinejoin):Ma(v.color);else if(v instanceof THREE.MeshLambertMaterial)da?!v.wireframe&&v.shading==THREE.SmoothShading&&p.vertexNormalsWorld.length==4?(ea.r=
 ca.r=Z.r=ga.r=va.r,ea.g=ca.g=Z.g=ga.g=va.g,ea.b=ca.b=Z.b=ga.b=va.b,w(n,p.v1.positionWorld,p.vertexNormalsWorld[0],ea),w(n,p.v2.positionWorld,p.vertexNormalsWorld[1],ca),w(n,p.v4.positionWorld,p.vertexNormalsWorld[3],Z),w(n,p.v3.positionWorld,p.vertexNormalsWorld[2],ga),ea.r=Math.max(0,Math.min(v.color.r*ea.r,1)),ea.g=Math.max(0,Math.min(v.color.g*ea.g,1)),ea.b=Math.max(0,Math.min(v.color.b*ea.b,1)),ca.r=Math.max(0,Math.min(v.color.r*ca.r,1)),ca.g=Math.max(0,Math.min(v.color.g*ca.g,1)),ca.b=Math.max(0,
-Math.min(v.color.b*ca.b,1)),Z.r=Math.max(0,Math.min(v.color.r*Z.r,1)),Z.g=Math.max(0,Math.min(v.color.g*Z.g,1)),Z.b=Math.max(0,Math.min(v.color.b*Z.b,1)),ga.r=Math.max(0,Math.min(v.color.r*ga.r,1)),ga.g=Math.max(0,Math.min(v.color.g*ga.g,1)),ga.b=Math.max(0,Math.min(v.color.b*ga.b,1)),ka=Ua(ea,ca,Z,ga),C(P,o,U,Q,J,ra),Sa(P,o,U,Q,J,ra,0,0,1,0,0,1,ka),C(pa,la,aa,T,qa,ja),Sa(pa,la,aa,T,qa,ja,1,0,1,1,0,1,ka)):(ma.r=va.r,ma.g=va.g,ma.b=va.b,w(n,p.centroidWorld,p.normalWorld,ma),ma.r=Math.max(0,Math.min(v.color.r*
-ma.r,1)),ma.g=Math.max(0,Math.min(v.color.g*ma.g,1)),ma.b=Math.max(0,Math.min(v.color.b*ma.b,1)),D(P,o,U,Q,aa,T,J,ra),v.wireframe?K(ma,v.wireframeLinewidth,v.wireframeLinecap,v.wireframeLinejoin):Ma(ma)):(D(P,o,U,Q,aa,T,J,ra),v.wireframe?K(v.color,v.wireframeLinewidth,v.wireframeLinecap,v.wireframeLinejoin):Ma(v.color));else if(v instanceof THREE.MeshNormalMaterial)ma.r=Ta(p.normalWorld.x),ma.g=Ta(p.normalWorld.y),ma.b=Ta(p.normalWorld.z),D(P,o,U,Q,aa,T,J,ra),v.wireframe?K(ma,v.wireframeLinewidth,
-v.wireframeLinecap,v.wireframeLinejoin):Ma(ma);else if(v instanceof THREE.MeshDepthMaterial)oa=t.near,na=t.far,ea.r=ea.g=ea.b=1-Oa(a.positionScreen.z,oa,na),ca.r=ca.g=ca.b=1-Oa(e.positionScreen.z,oa,na),Z.r=Z.g=Z.b=1-Oa(k.positionScreen.z,oa,na),ga.r=ga.g=ga.b=1-Oa(f.positionScreen.z,oa,na),ka=Ua(ea,ca,Z,ga),C(P,o,U,Q,J,ra),Sa(P,o,U,Q,J,ra,0,0,1,0,0,1,ka),C(pa,la,aa,T,qa,ja),Sa(pa,la,aa,T,qa,ja,1,0,1,1,0,1,ka)}function C(a,b,c,e,f,k){x.beginPath();x.moveTo(a,b);x.lineTo(c,e);x.lineTo(f,k);x.lineTo(a,
+Math.min(v.color.b*ca.b,1)),Z.r=Math.max(0,Math.min(v.color.r*Z.r,1)),Z.g=Math.max(0,Math.min(v.color.g*Z.g,1)),Z.b=Math.max(0,Math.min(v.color.b*Z.b,1)),ga.r=Math.max(0,Math.min(v.color.r*ga.r,1)),ga.g=Math.max(0,Math.min(v.color.g*ga.g,1)),ga.b=Math.max(0,Math.min(v.color.b*ga.b,1)),ka=Ua(ea,ca,Z,ga),C(P,o,U,Q,J,ra),Sa(P,o,U,Q,J,ra,0,0,1,0,0,1,ka),C(pa,na,aa,T,qa,ja),Sa(pa,na,aa,T,qa,ja,1,0,1,1,0,1,ka)):(la.r=va.r,la.g=va.g,la.b=va.b,w(n,p.centroidWorld,p.normalWorld,la),la.r=Math.max(0,Math.min(v.color.r*
+la.r,1)),la.g=Math.max(0,Math.min(v.color.g*la.g,1)),la.b=Math.max(0,Math.min(v.color.b*la.b,1)),D(P,o,U,Q,aa,T,J,ra),v.wireframe?K(la,v.wireframeLinewidth,v.wireframeLinecap,v.wireframeLinejoin):Ma(la)):(D(P,o,U,Q,aa,T,J,ra),v.wireframe?K(v.color,v.wireframeLinewidth,v.wireframeLinecap,v.wireframeLinejoin):Ma(v.color));else if(v instanceof THREE.MeshNormalMaterial)la.r=Ta(p.normalWorld.x),la.g=Ta(p.normalWorld.y),la.b=Ta(p.normalWorld.z),D(P,o,U,Q,aa,T,J,ra),v.wireframe?K(la,v.wireframeLinewidth,
+v.wireframeLinecap,v.wireframeLinejoin):Ma(la);else if(v instanceof THREE.MeshDepthMaterial)oa=t.near,ma=t.far,ea.r=ea.g=ea.b=1-Oa(a.positionScreen.z,oa,ma),ca.r=ca.g=ca.b=1-Oa(e.positionScreen.z,oa,ma),Z.r=Z.g=Z.b=1-Oa(k.positionScreen.z,oa,ma),ga.r=ga.g=ga.b=1-Oa(f.positionScreen.z,oa,ma),ka=Ua(ea,ca,Z,ga),C(P,o,U,Q,J,ra),Sa(P,o,U,Q,J,ra,0,0,1,0,0,1,ka),C(pa,na,aa,T,qa,ja),Sa(pa,na,aa,T,qa,ja,1,0,1,1,0,1,ka)}function C(a,b,c,e,f,k){x.beginPath();x.moveTo(a,b);x.lineTo(c,e);x.lineTo(f,k);x.lineTo(a,
 b);x.closePath()}function D(a,b,c,e,f,k,h,o){x.beginPath();x.moveTo(a,b);x.lineTo(c,e);x.lineTo(f,k);x.lineTo(h,o);x.lineTo(a,b);x.closePath()}function K(a,b,c,f){if(H!=b)x.lineWidth=H=b;if(M!=c)x.lineCap=M=c;if(V!=f)x.lineJoin=V=f;e(a.getContextStyle());x.stroke();G.inflate(b*2)}function Ma(a){k(a.getContextStyle());x.fill()}function Wa(a,b,c,e,f,h,o,l,n,v,p,u,t){if(t.image.width!=0){if(t.needsUpdate==!0||ha[t.id]==void 0){var xa=t.wrapS==THREE.RepeatWrapping,w=t.wrapT==THREE.RepeatWrapping;ha[t.id]=
 x.createPattern(t.image,xa&&w?"repeat":xa&&!w?"repeat-x":!xa&&w?"repeat-y":"no-repeat");t.needsUpdate=!1}k(ha[t.id]);var xa=t.offset.x/t.repeat.x,w=t.offset.y/t.repeat.y,F=(t.image.width-1)*t.repeat.x,t=(t.image.height-1)*t.repeat.y,o=(o+xa)*F,l=(l+w)*t,n=(n+xa)*F,v=(v+w)*t,p=(p+xa)*F,u=(u+w)*t;c-=a;e-=b;f-=a;h-=b;n-=o;v-=l;p-=o;u-=l;xa=1/(n*u-p*v);t=(u*c-v*f)*xa;v=(u*e-v*h)*xa;c=(n*f-p*c)*xa;e=(n*h-p*e)*xa;a=a-t*o-c*l;b=b-v*o-e*l;x.save();x.transform(t,v,c,e,a,b);x.fill();x.restore()}}function Sa(a,
 b,c,e,f,k,h,o,l,n,v,p,u){var t,xa;t=u.width-1;xa=u.height-1;h*=t;o*=xa;l*=t;n*=xa;v*=t;p*=xa;c-=a;e-=b;f-=a;k-=b;l-=h;n-=o;v-=h;p-=o;xa=1/(l*p-v*n);t=(p*c-n*f)*xa;n=(p*e-n*k)*xa;c=(l*f-v*c)*xa;e=(l*k-v*e)*xa;a=a-t*h-c*o;b=b-n*h-e*o;x.save();x.transform(t,n,c,e,a,b);x.clip();x.drawImage(u,0,0);x.restore()}function Ua(a,b,c,e){var f=~~(a.r*255),k=~~(a.g*255),a=~~(a.b*255),h=~~(b.r*255),o=~~(b.g*255),b=~~(b.b*255),l=~~(c.r*255),n=~~(c.g*255),c=~~(c.b*255),v=~~(e.r*255),p=~~(e.g*255),e=~~(e.b*255);ya[0]=
@@ -182,10 +182,10 @@ faces:0}};this.setQuality=function(a){switch(a){case "high":P=1;break;case "low"
 f=k.lights;Y=$=0;if(B=f.length>0){K.setRGB(0,0,0);H.setRGB(0,0,0);M.setRGB(0,0,0);t=0;for(L=f.length;t<L;t++)J=f[t],T=J.color,J instanceof THREE.AmbientLight?(K.r+=T.r,K.g+=T.g,K.b+=T.b):J instanceof THREE.DirectionalLight?(H.r+=T.r,H.g+=T.g,H.b+=T.b):J instanceof THREE.PointLight&&(M.r+=T.r,M.g+=T.g,M.b+=T.b)}t=0;for(L=h.length;t<L;t++)if(T=h[t],J=T.material,J=J instanceof THREE.MeshFaceMaterial?T.faceMaterial:J,!(J==null||J.opacity==0))if(A.empty(),T instanceof THREE.RenderableParticle)v=T,v.x*=
 p,v.y*=-w,m=0,ml=T.materials.length;else if(T instanceof THREE.RenderableLine){if(v=T.v1,z=T.v2,v.positionScreen.x*=p,v.positionScreen.y*=-w,z.positionScreen.x*=p,z.positionScreen.y*=-w,A.addPoint(v.positionScreen.x,v.positionScreen.y),A.addPoint(z.positionScreen.x,z.positionScreen.y),C.intersects(A)){T=v;var W=z,pa=Y++;N[pa]==null&&(N[pa]=document.createElementNS("http://www.w3.org/2000/svg","line"),P==0&&N[pa].setAttribute("shape-rendering","crispEdges"));O=N[pa];O.setAttribute("x1",T.positionScreen.x);
 O.setAttribute("y1",T.positionScreen.y);O.setAttribute("x2",W.positionScreen.x);O.setAttribute("y2",W.positionScreen.y);J instanceof THREE.LineBasicMaterial&&(O.setAttribute("style","fill: none; stroke: "+J.color.getContextStyle()+"; stroke-width: "+J.linewidth+"; stroke-opacity: "+J.opacity+"; stroke-linecap: "+J.linecap+"; stroke-linejoin: "+J.linejoin),n.appendChild(O))}}else if(T instanceof THREE.RenderableFace3){if(v=T.v1,z=T.v2,x=T.v3,v.positionScreen.x*=p,v.positionScreen.y*=-w,z.positionScreen.x*=
-p,z.positionScreen.y*=-w,x.positionScreen.x*=p,x.positionScreen.y*=-w,A.addPoint(v.positionScreen.x,v.positionScreen.y),A.addPoint(z.positionScreen.x,z.positionScreen.y),A.addPoint(x.positionScreen.x,x.positionScreen.y),C.intersects(A)){var W=v,pa=z,la=x;e.info.render.vertices+=3;e.info.render.faces++;O=c($++);O.setAttribute("d","M "+W.positionScreen.x+" "+W.positionScreen.y+" L "+pa.positionScreen.x+" "+pa.positionScreen.y+" L "+la.positionScreen.x+","+la.positionScreen.y+"z");J instanceof THREE.MeshBasicMaterial?
+p,z.positionScreen.y*=-w,x.positionScreen.x*=p,x.positionScreen.y*=-w,A.addPoint(v.positionScreen.x,v.positionScreen.y),A.addPoint(z.positionScreen.x,z.positionScreen.y),A.addPoint(x.positionScreen.x,x.positionScreen.y),C.intersects(A)){var W=v,pa=z,na=x;e.info.render.vertices+=3;e.info.render.faces++;O=c($++);O.setAttribute("d","M "+W.positionScreen.x+" "+W.positionScreen.y+" L "+pa.positionScreen.x+" "+pa.positionScreen.y+" L "+na.positionScreen.x+","+na.positionScreen.y+"z");J instanceof THREE.MeshBasicMaterial?
 D.copy(J.color):J instanceof THREE.MeshLambertMaterial?B?(D.r=K.r,D.g=K.g,D.b=K.b,a(f,T.centroidWorld,T.normalWorld,D),D.r=Math.max(0,Math.min(J.color.r*D.r,1)),D.g=Math.max(0,Math.min(J.color.g*D.g,1)),D.b=Math.max(0,Math.min(J.color.b*D.b,1))):D.copy(J.color):J instanceof THREE.MeshDepthMaterial?(V=1-J.__2near/(J.__farPlusNear-T.z*J.__farMinusNear),D.setRGB(V,V,V)):J instanceof THREE.MeshNormalMaterial&&D.setRGB(b(T.normalWorld.x),b(T.normalWorld.y),b(T.normalWorld.z));J.wireframe?O.setAttribute("style",
 "fill: none; stroke: "+D.getContextStyle()+"; stroke-width: "+J.wireframeLinewidth+"; stroke-opacity: "+J.opacity+"; stroke-linecap: "+J.wireframeLinecap+"; stroke-linejoin: "+J.wireframeLinejoin):O.setAttribute("style","fill: "+D.getContextStyle()+"; fill-opacity: "+J.opacity);n.appendChild(O)}}else if(T instanceof THREE.RenderableFace4&&(v=T.v1,z=T.v2,x=T.v3,y=T.v4,v.positionScreen.x*=p,v.positionScreen.y*=-w,z.positionScreen.x*=p,z.positionScreen.y*=-w,x.positionScreen.x*=p,x.positionScreen.y*=
--w,y.positionScreen.x*=p,y.positionScreen.y*=-w,A.addPoint(v.positionScreen.x,v.positionScreen.y),A.addPoint(z.positionScreen.x,z.positionScreen.y),A.addPoint(x.positionScreen.x,x.positionScreen.y),A.addPoint(y.positionScreen.x,y.positionScreen.y),C.intersects(A))){var W=v,pa=z,la=x,qa=y;e.info.render.vertices+=4;e.info.render.faces++;O=c($++);O.setAttribute("d","M "+W.positionScreen.x+" "+W.positionScreen.y+" L "+pa.positionScreen.x+" "+pa.positionScreen.y+" L "+la.positionScreen.x+","+la.positionScreen.y+
+-w,y.positionScreen.x*=p,y.positionScreen.y*=-w,A.addPoint(v.positionScreen.x,v.positionScreen.y),A.addPoint(z.positionScreen.x,z.positionScreen.y),A.addPoint(x.positionScreen.x,x.positionScreen.y),A.addPoint(y.positionScreen.x,y.positionScreen.y),C.intersects(A))){var W=v,pa=z,na=x,qa=y;e.info.render.vertices+=4;e.info.render.faces++;O=c($++);O.setAttribute("d","M "+W.positionScreen.x+" "+W.positionScreen.y+" L "+pa.positionScreen.x+" "+pa.positionScreen.y+" L "+na.positionScreen.x+","+na.positionScreen.y+
 " L "+qa.positionScreen.x+","+qa.positionScreen.y+"z");J instanceof THREE.MeshBasicMaterial?D.copy(J.color):J instanceof THREE.MeshLambertMaterial?B?(D.r=K.r,D.g=K.g,D.b=K.b,a(f,T.centroidWorld,T.normalWorld,D),D.r=Math.max(0,Math.min(J.color.r*D.r,1)),D.g=Math.max(0,Math.min(J.color.g*D.g,1)),D.b=Math.max(0,Math.min(J.color.b*D.b,1))):D.copy(J.color):J instanceof THREE.MeshDepthMaterial?(V=1-J.__2near/(J.__farPlusNear-T.z*J.__farMinusNear),D.setRGB(V,V,V)):J instanceof THREE.MeshNormalMaterial&&
 D.setRGB(b(T.normalWorld.x),b(T.normalWorld.y),b(T.normalWorld.z));J.wireframe?O.setAttribute("style","fill: none; stroke: "+D.getContextStyle()+"; stroke-width: "+J.wireframeLinewidth+"; stroke-opacity: "+J.opacity+"; stroke-linecap: "+J.wireframeLinecap+"; stroke-linejoin: "+J.wireframeLinejoin):O.setAttribute("style","fill: "+D.getContextStyle()+"; fill-opacity: "+J.opacity);n.appendChild(O)}}};
 THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",
@@ -248,17 +248,17 @@ h.__webglTangentBuffer),o.vertexAttribPointer(a.tangent,4,o.FLOAT,!1,0,0));a.uv>
 (o.lineWidth(f.wireframeLinewidth),b&&o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer),o.drawElements(o.LINES,h.__webglLineCount,o.UNSIGNED_SHORT,0)):(b&&o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),o.drawElements(o.TRIANGLES,h.__webglFaceCount,o.UNSIGNED_SHORT,0)),P.info.render.calls++,P.info.render.vertices+=h.__webglFaceCount,P.info.render.faces+=h.__webglFaceCount/3):k instanceof THREE.Line?(k=k.type===THREE.LineStrip?o.LINE_STRIP:o.LINES,o.lineWidth(f.linewidth),o.drawArrays(k,
 0,h.__webglLineCount),P.info.render.calls++):k instanceof THREE.ParticleSystem?(o.drawArrays(o.POINTS,0,h.__webglParticleCount),P.info.render.calls++):k instanceof THREE.Ribbon&&(o.drawArrays(o.TRIANGLE_STRIP,0,h.__webglVertexCount),P.info.render.calls++)}}function h(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=o.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=o.createBuffer();a.hasPos&&(o.bindBuffer(o.ARRAY_BUFFER,a.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,a.positionArray,
 o.DYNAMIC_DRAW),o.enableVertexAttribArray(b.attributes.position),o.vertexAttribPointer(b.attributes.position,3,o.FLOAT,!1,0,0));if(a.hasNormal){o.bindBuffer(o.ARRAY_BUFFER,a.__webglNormalBuffer);if(c===THREE.FlatShading){var e,f,h,k,l,n,v,p,u,t,x=a.count*3;for(t=0;t<x;t+=9)c=a.normalArray,e=c[t],f=c[t+1],h=c[t+2],k=c[t+3],n=c[t+4],p=c[t+5],l=c[t+6],v=c[t+7],u=c[t+8],e=(e+k+l)/3,f=(f+n+v)/3,h=(h+p+u)/3,c[t]=e,c[t+1]=f,c[t+2]=h,c[t+3]=e,c[t+4]=f,c[t+5]=h,c[t+6]=e,c[t+7]=f,c[t+8]=h}o.bufferData(o.ARRAY_BUFFER,
-a.normalArray,o.DYNAMIC_DRAW);o.enableVertexAttribArray(b.attributes.normal);o.vertexAttribPointer(b.attributes.normal,3,o.FLOAT,!1,0,0)}o.drawArrays(o.TRIANGLES,0,a.count);a.count=0}function f(a){if(pa!==a.doubleSided)a.doubleSided?o.disable(o.CULL_FACE):o.enable(o.CULL_FACE),pa=a.doubleSided;if(la!==a.flipSided)a.flipSided?o.frontFace(o.CW):o.frontFace(o.CCW),la=a.flipSided}function l(a){ja!==a&&(a?o.enable(o.DEPTH_TEST):o.disable(o.DEPTH_TEST),ja=a)}function n(a){ma!==a&&(o.depthMask(a),ma=a)}
+a.normalArray,o.DYNAMIC_DRAW);o.enableVertexAttribArray(b.attributes.normal);o.vertexAttribPointer(b.attributes.normal,3,o.FLOAT,!1,0,0)}o.drawArrays(o.TRIANGLES,0,a.count);a.count=0}function f(a){if(pa!==a.doubleSided)a.doubleSided?o.disable(o.CULL_FACE):o.enable(o.CULL_FACE),pa=a.doubleSided;if(na!==a.flipSided)a.flipSided?o.frontFace(o.CW):o.frontFace(o.CCW),na=a.flipSided}function l(a){ja!==a&&(a?o.enable(o.DEPTH_TEST):o.disable(o.DEPTH_TEST),ja=a)}function n(a){la!==a&&(o.depthMask(a),la=a)}
 function u(a,b,c){ea!==a&&(a?o.enable(o.POLYGON_OFFSET_FILL):o.disable(o.POLYGON_OFFSET_FILL),ea=a);if(a&&(ca!==b||Z!==c))o.polygonOffset(b,c),ca=b,Z=c}function t(a){ka[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);ka[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);ka[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);ka[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);ka[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);ka[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=ka[a],b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}function p(a){for(var b=a.matrixWorld,c=-a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)),e=0;e<6;e++)if(a=ka[e].x*b.n14+ka[e].y*b.n24+ka[e].z*b.n34+ka[e].w,a<=c)return!1;return!0}function w(a){var b=a.object.material;b.transparent?(a.transparent=b,a.opaque=null):(a.opaque=b,a.transparent=null)}function v(a){var b=a.object,c=a.buffer,e;e=b.material;if(e instanceof THREE.MeshFaceMaterial){if(c=
 c.materialIndex,c>=0)b=b.geometry.materials[c],b.transparent?(a.transparent=b,a.opaque=null):(a.opaque=b,a.transparent=null)}else if(b=e)b.transparent?(a.transparent=b,a.opaque=null):(a.opaque=b,a.transparent=null)}function z(a,b){return b.z-a.z}function x(a){var b,c,n,v=0,u,x,w,F,y=a.lights;ua||(ua=new THREE.PerspectiveCamera(P.shadowCameraFov,P.shadowMapWidth/P.shadowMapHeight,P.shadowCameraNear,P.shadowCameraFar));b=0;for(c=y.length;b<c;b++)if(n=y[b],n instanceof THREE.SpotLight&&n.castShadow){T=
 -1;P.shadowMap[v]||(P.shadowMap[v]=new THREE.WebGLRenderTarget(P.shadowMapWidth,P.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));ta[v]||(ta[v]=new THREE.Matrix4);u=P.shadowMap[v];x=ta[v];ua.position.copy(n.position);ua.lookAt(n.target.position);ua.update(void 0,!0);a.update(void 0,!1,ua);x.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);x.multiplySelf(ua.projectionMatrix);x.multiplySelf(ua.matrixWorldInverse);ua.matrixWorldInverse.flattenToArray(Ea);
 ua.projectionMatrix.flattenToArray(Da);sa.multiply(ua.projectionMatrix,ua.matrixWorldInverse);t(sa);W(u);o.clearColor(1,1,1,1);P.clear();o.clearColor(G.r,G.g,G.b,da);x=a.__webglObjects.length;n=a.__webglObjectsImmediate.length;for(u=0;u<x;u++)w=a.__webglObjects[u],F=w.object,F.visible&&F.castShadow?!(F instanceof THREE.Mesh)||!F.frustumCulled||p(F)?(F.matrixWorld.flattenToArray(F._objectMatrixArray),C(F,ua,!1),w.render=!0):w.render=!1:w.render=!1;l(!0);H(THREE.NormalBlending);for(u=0;u<x;u++)if(w=
 a.__webglObjects[u],w.render)F=w.object,buffer=w.buffer,f(F),w=F.customDepthMaterial?F.customDepthMaterial:F.geometry.morphTargets.length?Ba:Ga,k(ua,y,null,w,buffer,F);for(u=0;u<n;u++)w=a.__webglObjectsImmediate[u],F=w.object,F.visible&&F.castShadow&&(F.matrixAutoUpdate&&F.matrixWorld.flattenToArray(F._objectMatrixArray),J=-1,C(F,ua,!1),f(F),program=e(ua,y,null,Ga,F),F.immediateRenderCallback?F.immediateRenderCallback(program,o,ka):F.render(function(a){h(a,program,Ga.shading)}));v++}}function y(a,
-b){var c,e,f;c=X.attributes;var h=X.uniforms,k=na/oa,l,n=[],v=oa*0.5,u=na*0.5,p=!0;o.useProgram(X.program);Q=X.program;J=ja=qa=-1;Ia||(o.enableVertexAttribArray(X.attributes.position),o.enableVertexAttribArray(X.attributes.uv),Ia=!0);o.disable(o.CULL_FACE);o.enable(o.BLEND);o.depthMask(!0);o.bindBuffer(o.ARRAY_BUFFER,X.vertexBuffer);o.vertexAttribPointer(c.position,2,o.FLOAT,!1,16,0);o.vertexAttribPointer(c.uv,2,o.FLOAT,!1,16,8);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,X.elementBuffer);o.uniformMatrix4fv(h.projectionMatrix,
+b){var c,e,f;c=X.attributes;var h=X.uniforms,k=ma/oa,l,n=[],v=oa*0.5,u=ma*0.5,p=!0;o.useProgram(X.program);Q=X.program;J=ja=qa=-1;Ia||(o.enableVertexAttribArray(X.attributes.position),o.enableVertexAttribArray(X.attributes.uv),Ia=!0);o.disable(o.CULL_FACE);o.enable(o.BLEND);o.depthMask(!0);o.bindBuffer(o.ARRAY_BUFFER,X.vertexBuffer);o.vertexAttribPointer(c.position,2,o.FLOAT,!1,16,0);o.vertexAttribPointer(c.uv,2,o.FLOAT,!1,16,8);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,X.elementBuffer);o.uniformMatrix4fv(h.projectionMatrix,
 !1,Da);o.activeTexture(o.TEXTURE0);o.uniform1i(h.map,0);c=0;for(e=a.__webglSprites.length;c<e;c++)if(f=a.__webglSprites[c],f.visible&&f.opacity!==0)f.useScreenCoordinates?f.z=-f.position.z:(f._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,f.matrixWorld,f._modelViewMatrixArray),f.z=-f._modelViewMatrix.n34);a.__webglSprites.sort(z);c=0;for(e=a.__webglSprites.length;c<e;c++)f=a.__webglSprites[c],f.visible&&f.opacity!==0&&f.map&&f.map.image&&f.map.image.width&&(f.useScreenCoordinates?(o.uniform1i(h.useScreenCoordinates,
-1),o.uniform3f(h.screenPosition,(f.position.x-v)/v,(u-f.position.y)/u,Math.max(0,Math.min(1,f.position.z)))):(o.uniform1i(h.useScreenCoordinates,0),o.uniform1i(h.affectedByDistance,f.affectedByDistance?1:0),o.uniformMatrix4fv(h.modelViewMatrix,!1,f._modelViewMatrixArray)),l=f.map.image.width/(f.scaleByViewport?na:1),n[0]=l*k*f.scale.x,n[1]=l*f.scale.y,o.uniform2f(h.uvScale,f.uvScale.x,f.uvScale.y),o.uniform2f(h.uvOffset,f.uvOffset.x,f.uvOffset.y),o.uniform2f(h.alignment,f.alignment.x,f.alignment.y),
-o.uniform1f(h.opacity,f.opacity),o.uniform3f(h.color,f.color.r,f.color.g,f.color.b),o.uniform1f(h.rotation,f.rotation),o.uniform2fv(h.scale,n),f.mergeWith3D&&!p?(o.enable(o.DEPTH_TEST),p=!0):!f.mergeWith3D&&p&&(o.disable(o.DEPTH_TEST),p=!1),H(f.blending),V(f.map,0),o.drawElements(o.TRIANGLES,6,o.UNSIGNED_SHORT,0));o.enable(o.CULL_FACE);o.enable(o.DEPTH_TEST);o.depthMask(ma)}function C(a,b,c){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);c&&THREE.Matrix4.makeInvert3x3(a._modelViewMatrix).transposeIntoArray(a._normalMatrixArray)}
+1),o.uniform3f(h.screenPosition,(f.position.x-v)/v,(u-f.position.y)/u,Math.max(0,Math.min(1,f.position.z)))):(o.uniform1i(h.useScreenCoordinates,0),o.uniform1i(h.affectedByDistance,f.affectedByDistance?1:0),o.uniformMatrix4fv(h.modelViewMatrix,!1,f._modelViewMatrixArray)),l=f.map.image.width/(f.scaleByViewport?ma:1),n[0]=l*k*f.scale.x,n[1]=l*f.scale.y,o.uniform2f(h.uvScale,f.uvScale.x,f.uvScale.y),o.uniform2f(h.uvOffset,f.uvOffset.x,f.uvOffset.y),o.uniform2f(h.alignment,f.alignment.x,f.alignment.y),
+o.uniform1f(h.opacity,f.opacity),o.uniform3f(h.color,f.color.r,f.color.g,f.color.b),o.uniform1f(h.rotation,f.rotation),o.uniform2fv(h.scale,n),f.mergeWith3D&&!p?(o.enable(o.DEPTH_TEST),p=!0):!f.mergeWith3D&&p&&(o.disable(o.DEPTH_TEST),p=!1),H(f.blending),V(f.map,0),o.drawElements(o.TRIANGLES,6,o.UNSIGNED_SHORT,0));o.enable(o.CULL_FACE);o.enable(o.DEPTH_TEST);o.depthMask(la)}function C(a,b,c){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);c&&THREE.Matrix4.makeInvert3x3(a._modelViewMatrix).transposeIntoArray(a._normalMatrixArray)}
 function A(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function B(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function D(a,b){for(var c=a.length-1;c>=0;c--)a[c].object===b&&a.splice(c,1)}function K(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function H(a){if(a!==qa){switch(a){case THREE.AdditiveBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.SRC_ALPHA,o.ONE);break;case THREE.SubtractiveBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.ZERO,
 o.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.ZERO,o.SRC_COLOR);break;default:o.blendEquationSeparate(o.FUNC_ADD,o.FUNC_ADD),o.blendFuncSeparate(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA,o.ONE,o.ONE_MINUS_SRC_ALPHA)}qa=a}}function M(a,b,c){(c.width&c.width-1)===0&&(c.height&c.height-1)===0?(o.texParameteri(a,o.TEXTURE_WRAP_S,Y(b.wrapS)),o.texParameteri(a,o.TEXTURE_WRAP_T,Y(b.wrapT)),o.texParameteri(a,o.TEXTURE_MAG_FILTER,Y(b.magFilter)),o.texParameteri(a,
 o.TEXTURE_MIN_FILTER,Y(b.minFilter)),o.generateMipmap(a)):(o.texParameteri(a,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(a,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texParameteri(a,o.TEXTURE_MAG_FILTER,$(b.magFilter)),o.texParameteri(a,o.TEXTURE_MIN_FILTER,$(b.minFilter)))}function V(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=!0,a.__webglTexture=o.createTexture(),P.info.memory.textures++;o.activeTexture(o.TEXTURE0+b);o.bindTexture(o.TEXTURE_2D,a.__webglTexture);a instanceof THREE.DataTexture?
@@ -266,11 +266,11 @@ o.texImage2D(o.TEXTURE_2D,0,Y(a.format),a.image.width,a.image.height,0,Y(a.forma
 o.DEPTH_ATTACHMENT,o.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(o.renderbufferStorage(o.RENDERBUFFER,o.DEPTH_STENCIL,b.width,b.height),o.framebufferRenderbuffer(o.FRAMEBUFFER,o.DEPTH_STENCIL_ATTACHMENT,o.RENDERBUFFER,a)):o.renderbufferStorage(o.RENDERBUFFER,o.RGBA4,b.width,b.height)}function W(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=o.createTexture();
 if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];o.bindTexture(o.TEXTURE_CUBE_MAP,a.__webglTexture);M(o.TEXTURE_CUBE_MAP,a,a);for(var c=0;c<6;c++){a.__webglFramebuffer[c]=o.createFramebuffer();a.__webglRenderbuffer[c]=o.createRenderbuffer();o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,Y(a.format),a.width,a.height,0,Y(a.format),Y(a.type),null);var e=a,f=o.TEXTURE_CUBE_MAP_POSITIVE_X+c;o.bindFramebuffer(o.FRAMEBUFFER,a.__webglFramebuffer[c]);o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,
 f,e.__webglTexture,0);L(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=o.createFramebuffer(),a.__webglRenderbuffer=o.createRenderbuffer(),o.bindTexture(o.TEXTURE_2D,a.__webglTexture),M(o.TEXTURE_2D,a,a),o.texImage2D(o.TEXTURE_2D,0,Y(a.format),a.width,a.height,0,Y(a.format),Y(a.type),null),c=o.TEXTURE_2D,o.bindFramebuffer(o.FRAMEBUFFER,a.__webglFramebuffer),o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,c,a.__webglTexture,0),o.bindRenderbuffer(o.RENDERBUFFER,a.__webglRenderbuffer),
-L(a.__webglRenderbuffer,a);b?o.bindTexture(o.TEXTURE_CUBE_MAP,null):o.bindTexture(o.TEXTURE_2D,null);o.bindRenderbuffer(o.RENDERBUFFER,null);o.bindFramebuffer(o.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,f=e=0):(b=null,c=oa,a=na,e=ga,f=ha);b!==aa&&(o.bindFramebuffer(o.FRAMEBUFFER,b),o.viewport(e,f,c,a),aa=b)}function N(a){a instanceof THREE.WebGLRenderTargetCube?(o.bindTexture(o.TEXTURE_CUBE_MAP,a.__webglTexture),o.generateMipmap(o.TEXTURE_CUBE_MAP),
+L(a.__webglRenderbuffer,a);b?o.bindTexture(o.TEXTURE_CUBE_MAP,null):o.bindTexture(o.TEXTURE_2D,null);o.bindRenderbuffer(o.RENDERBUFFER,null);o.bindFramebuffer(o.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,f=e=0):(b=null,c=oa,a=ma,e=ga,f=ha);b!==aa&&(o.bindFramebuffer(o.FRAMEBUFFER,b),o.viewport(e,f,c,a),aa=b)}function N(a){a instanceof THREE.WebGLRenderTargetCube?(o.bindTexture(o.TEXTURE_CUBE_MAP,a.__webglTexture),o.generateMipmap(o.TEXTURE_CUBE_MAP),
 o.bindTexture(o.TEXTURE_CUBE_MAP,null)):(o.bindTexture(o.TEXTURE_2D,a.__webglTexture),o.generateMipmap(o.TEXTURE_2D),o.bindTexture(o.TEXTURE_2D,null))}function O(a,b){var c;a==="fragment"?c=o.createShader(o.FRAGMENT_SHADER):a==="vertex"&&(c=o.createShader(o.VERTEX_SHADER));o.shaderSource(c,b);o.compileShader(c);if(!o.getShaderParameter(c,o.COMPILE_STATUS))return console.error(o.getShaderInfoLog(c)),console.error(b),null;return c}function $(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return o.NEAREST;
 default:return o.LINEAR}}function Y(a){switch(a){case THREE.RepeatWrapping:return o.REPEAT;case THREE.ClampToEdgeWrapping:return o.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return o.MIRRORED_REPEAT;case THREE.NearestFilter:return o.NEAREST;case THREE.NearestMipMapNearestFilter:return o.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return o.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return o.LINEAR;case THREE.LinearMipMapNearestFilter:return o.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return o.LINEAR_MIPMAP_LINEAR;
 case THREE.ByteType:return o.BYTE;case THREE.UnsignedByteType:return o.UNSIGNED_BYTE;case THREE.ShortType:return o.SHORT;case THREE.UnsignedShortType:return o.UNSIGNED_SHORT;case THREE.IntType:return o.INT;case THREE.UnsignedShortType:return o.UNSIGNED_INT;case THREE.FloatType:return o.FLOAT;case THREE.AlphaFormat:return o.ALPHA;case THREE.RGBFormat:return o.RGB;case THREE.RGBAFormat:return o.RGBA;case THREE.LuminanceFormat:return o.LUMINANCE;case THREE.LuminanceAlphaFormat:return o.LUMINANCE_ALPHA}return 0}
-var P=this,o,U=[],Q=null,aa=null,T=-1,J=null,ra=0,pa=null,la=null,qa=null,ja=null,ma=null,ea=null,ca=null,Z=null,ga=0,ha=0,oa=0,na=0,ka=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],sa=new THREE.Matrix4,Da=new Float32Array(16),Ea=new Float32Array(16),Ca=new THREE.Vector4,Fa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},a=a||{},za=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
+var P=this,o,U=[],Q=null,aa=null,T=-1,J=null,ra=0,pa=null,na=null,qa=null,ja=null,la=null,ea=null,ca=null,Z=null,ga=0,ha=0,oa=0,ma=0,ka=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],sa=new THREE.Matrix4,Da=new Float32Array(16),Ea=new Float32Array(16),Ca=new THREE.Vector4,Fa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},a=a||{},za=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
 F=a.stencil!==void 0?a.stencil:!0,fa=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,ia=a.antialias!==void 0?a.antialias:!1,G=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),da=a.clearAlpha!==void 0?a.clearAlpha:0,va=a.maxLights!==void 0?a.maxLights:4;this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};this.maxMorphTargets=8;this.domElement=za;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=[];this.shadowMapEnabled=!1;this.shadowMapSoft=this.shadowMapAutoUpdate=!0;var ua,ta=[],a=THREE.ShaderLib.depthRGBA,wa=THREE.UniformsUtils.clone(a.uniforms),Ga=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,
 vertexShader:a.vertexShader,uniforms:wa}),Ba=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:wa,morphTargets:!0});Ga._shadowPass=!0;Ba._shadowPass=!0;try{if(!(o=za.getContext("experimental-webgl",{antialias:ia,stencil:F,preserveDrawingBuffer:fa})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+o.getParameter(o.VERSION)+" | "+o.getParameter(o.VENDOR)+" | "+o.getParameter(o.RENDERER)+" | "+o.getParameter(o.SHADING_LANGUAGE_VERSION))}catch(Ka){console.error(Ka)}o.clearColor(0,
@@ -278,7 +278,7 @@ vertexShader:a.vertexShader,uniforms:wa}),Ba=new THREE.ShaderMaterial({fragmentS
 X.vertices[F++]=-1;X.vertices[F++]=1;X.vertices[F++]=1;X.vertices[F++]=1;X.vertices[F++]=1;X.vertices[F++]=1;X.vertices[F++]=0;X.vertices[F++]=-1;X.vertices[F++]=1;X.vertices[F++]=0;F=X.vertices[F++]=0;X.faces[F++]=0;X.faces[F++]=1;X.faces[F++]=2;X.faces[F++]=0;X.faces[F++]=2;X.faces[F++]=3;X.vertexBuffer=o.createBuffer();X.elementBuffer=o.createBuffer();o.bindBuffer(o.ARRAY_BUFFER,X.vertexBuffer);o.bufferData(o.ARRAY_BUFFER,X.vertices,o.STATIC_DRAW);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,X.elementBuffer);
 o.bufferData(o.ELEMENT_ARRAY_BUFFER,X.faces,o.STATIC_DRAW);X.program=o.createProgram();o.attachShader(X.program,O("fragment",THREE.ShaderLib.sprite.fragmentShader));o.attachShader(X.program,O("vertex",THREE.ShaderLib.sprite.vertexShader));o.linkProgram(X.program);X.attributes={};X.uniforms={};X.attributes.position=o.getAttribLocation(X.program,"position");X.attributes.uv=o.getAttribLocation(X.program,"uv");X.uniforms.uvOffset=o.getUniformLocation(X.program,"uvOffset");X.uniforms.uvScale=o.getUniformLocation(X.program,
 "uvScale");X.uniforms.rotation=o.getUniformLocation(X.program,"rotation");X.uniforms.scale=o.getUniformLocation(X.program,"scale");X.uniforms.alignment=o.getUniformLocation(X.program,"alignment");X.uniforms.color=o.getUniformLocation(X.program,"color");X.uniforms.map=o.getUniformLocation(X.program,"map");X.uniforms.opacity=o.getUniformLocation(X.program,"opacity");X.uniforms.useScreenCoordinates=o.getUniformLocation(X.program,"useScreenCoordinates");X.uniforms.affectedByDistance=o.getUniformLocation(X.program,
-"affectedByDistance");X.uniforms.screenPosition=o.getUniformLocation(X.program,"screenPosition");X.uniforms.modelViewMatrix=o.getUniformLocation(X.program,"modelViewMatrix");X.uniforms.projectionMatrix=o.getUniformLocation(X.program,"projectionMatrix");var Ia=!1;this.setSize=function(a,b){za.width=a;za.height=b;this.setViewport(0,0,za.width,za.height)};this.setViewport=function(a,b,c,e){ga=a;ha=b;oa=c;na=e;o.viewport(ga,ha,oa,na)};this.setScissor=function(a,b,c,e){o.scissor(a,b,c,e)};this.enableScissorTest=
+"affectedByDistance");X.uniforms.screenPosition=o.getUniformLocation(X.program,"screenPosition");X.uniforms.modelViewMatrix=o.getUniformLocation(X.program,"modelViewMatrix");X.uniforms.projectionMatrix=o.getUniformLocation(X.program,"projectionMatrix");var Ia=!1;this.setSize=function(a,b){za.width=a;za.height=b;this.setViewport(0,0,za.width,za.height)};this.setViewport=function(a,b,c,e){ga=a;ha=b;oa=c;ma=e;o.viewport(ga,ha,oa,ma)};this.setScissor=function(a,b,c,e){o.scissor(a,b,c,e)};this.enableScissorTest=
 function(a){a?o.enable(o.SCISSOR_TEST):o.disable(o.SCISSOR_TEST)};this.setClearColorHex=function(a,b){G.setHex(a);da=b;o.clearColor(G.r,G.g,G.b,da)};this.setClearColor=function(a,b){G.copy(a);da=b;o.clearColor(G.r,G.g,G.b,da)};this.getClearColor=function(){return G};this.getClearAlpha=function(){return da};this.clear=function(a,b,c){var e=0;if(a===void 0||a)e|=o.COLOR_BUFFER_BIT;if(b===void 0||b)e|=o.DEPTH_BUFFER_BIT;if(c===void 0||c)e|=o.STENCIL_BUFFER_BIT;o.clear(e)};this.getContext=function(){return o};
 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(g in a.geometry.geometryGroups){var b=a.geometry.geometryGroups[g];o.deleteBuffer(b.__webglVertexBuffer);o.deleteBuffer(b.__webglNormalBuffer);o.deleteBuffer(b.__webglTangentBuffer);o.deleteBuffer(b.__webglColorBuffer);o.deleteBuffer(b.__webglUVBuffer);o.deleteBuffer(b.__webglUV2Buffer);o.deleteBuffer(b.__webglSkinVertexABuffer);
 o.deleteBuffer(b.__webglSkinVertexBBuffer);o.deleteBuffer(b.__webglSkinIndicesBuffer);o.deleteBuffer(b.__webglSkinWeightsBuffer);o.deleteBuffer(b.__webglFaceBuffer);o.deleteBuffer(b.__webglLineBuffer);if(b.numMorphTargets)for(var c=0,e=b.numMorphTargets;c<e;c++)o.deleteBuffer(b.__webglMorphTargetsBuffers[c]);P.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,o.deleteBuffer(a.__webglVertexBuffer),o.deleteBuffer(a.__webglColorBuffer),P.info.memory.geometries--;else if(a instanceof
@@ -293,12 +293,12 @@ k=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+c.ma
 O("vertex",e+p));o.linkProgram(F);o.getProgramParameter(F,o.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+o.getProgramParameter(F,o.VALIDATE_STATUS)+", gl error ["+o.getError()+"]");F.uniforms={};F.attributes={};var w,e=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(w in n)e.push(w);w=e;e=0;for(n=w.length;e<n;e++)v=w[e],F.uniforms[v]=o.getUniformLocation(F,
 v);e=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(w=0;w<c.maxMorphTargets;w++)e.push("morphTarget"+w);for(x in b)e.push(x);x=e;w=0;for(b=x.length;w<b;w++)c=x[w],F.attributes[c]=o.getAttribLocation(F,c);F.id=U.length;U.push({program:F,code:l});P.info.memory.programs=U.length;x=F}a.program=x;x=a.program.attributes;x.position>=0&&o.enableVertexAttribArray(x.position);x.color>=0&&o.enableVertexAttribArray(x.color);x.normal>=0&&o.enableVertexAttribArray(x.normal);
 x.tangent>=0&&o.enableVertexAttribArray(x.tangent);a.skinning&&x.skinVertexA>=0&&x.skinVertexB>=0&&x.skinIndex>=0&&x.skinWeight>=0&&(o.enableVertexAttribArray(x.skinVertexA),o.enableVertexAttribArray(x.skinVertexB),o.enableVertexAttribArray(x.skinIndex),o.enableVertexAttribArray(x.skinWeight));if(a.attributes)for(h in a.attributes)x[h]!==void 0&&x[h]>=0&&o.enableVertexAttribArray(x[h]);if(a.morphTargets)for(h=a.numSupportedMorphTargets=0;h<this.maxMorphTargets;h++)w="morphTarget"+h,x[w]>=0&&(o.enableVertexAttribArray(x[w]),
-a.numSupportedMorphTargets++);a.uniformsList=[];for(f in a.uniforms)a.uniformsList.push([a.uniforms[f],f])};this.clearTarget=function(a,b,c,e){W(a);this.clear(b,c,e)};this.updateShadowMap=function(a,b){x(a,b)};this.render=function(a,b,c,F){var ia,fa,A,B,D,G,ga,K=a.lights,L=a.fog;T=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);this.shadowMapEnabled&&this.shadowMapAutoUpdate&&x(a,b);P.info.render.calls=0;P.info.render.vertices=0;P.info.render.faces=0;if(b.matrixAutoUpdate){for(A=b;A.parent;)A=
+a.numSupportedMorphTargets++);a.uniformsList=[];for(f in a.uniforms)a.uniformsList.push([a.uniforms[f],f])};this.clearTarget=function(a,b,c,e){W(a);this.clear(b,c,e)};this.updateShadowMap=function(a,b){x(a,b)};this.render=function(a,b,c,F){var ia,fa,A,B,D,G,ga,L=a.lights,K=a.fog;T=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);this.shadowMapEnabled&&this.shadowMapAutoUpdate&&x(a,b);P.info.render.calls=0;P.info.render.vertices=0;P.info.render.faces=0;if(b.matrixAutoUpdate){for(A=b;A.parent;)A=
 A.parent;A.update(void 0,!0)}a.update(void 0,!1,b);b.matrixWorldInverse.flattenToArray(Ea);b.projectionMatrix.flattenToArray(Da);sa.multiply(b.projectionMatrix,b.matrixWorldInverse);t(sa);W(c);(this.autoClear||F)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);A=a.__webglObjects.length;for(F=0;F<A;F++)if(D=a.__webglObjects[F],G=D.object,G.visible)if(!(G instanceof THREE.Mesh)||!G.frustumCulled||p(G)){if(G.matrixWorld.flattenToArray(G._objectMatrixArray),C(G,b,!0),v(D),D.render=
 !0,this.sortObjects)G.renderDepth?D.z=G.renderDepth:(Ca.copy(G.position),sa.multiplyVector3(Ca),D.z=Ca.z)}else D.render=!1;else D.render=!1;this.sortObjects&&a.__webglObjects.sort(z);B=a.__webglObjectsImmediate.length;for(F=0;F<B;F++)D=a.__webglObjectsImmediate[F],G=D.object,G.visible&&(G.matrixAutoUpdate&&G.matrixWorld.flattenToArray(G._objectMatrixArray),C(G,b,!0),w(D));if(a.overrideMaterial){l(a.overrideMaterial.depthTest);H(a.overrideMaterial.blending);for(F=0;F<A;F++)if(D=a.__webglObjects[F],
-D.render)G=D.object,ga=D.buffer,f(G),k(b,K,L,a.overrideMaterial,ga,G);for(F=0;F<B;F++)D=a.__webglObjectsImmediate[F],G=D.object,G.visible&&(J=-1,f(G),ia=e(b,K,L,a.overrideMaterial,G),G.immediateRenderCallback?G.immediateRenderCallback(ia,o,ka):G.render(function(b){h(b,ia,a.overrideMaterial.shading)}))}else{H(THREE.NormalBlending);for(F=A-1;F>=0;F--)if(D=a.__webglObjects[F],D.render&&(G=D.object,ga=D.buffer,fa=D.opaque))f(G),l(fa.depthTest),n(fa.depthWrite),u(fa.polygonOffset,fa.polygonOffsetFactor,
-fa.polygonOffsetUnits),k(b,K,L,fa,ga,G);for(F=0;F<B;F++)if(D=a.__webglObjectsImmediate[F],G=D.object,G.visible&&(J=-1,fa=D.opaque))f(G),l(fa.depthTest),n(fa.depthWrite),u(fa.polygonOffset,fa.polygonOffsetFactor,fa.polygonOffsetUnits),ia=e(b,K,L,fa,G),G.immediateRenderCallback?G.immediateRenderCallback(ia,o,ka):G.render(function(a){h(a,ia,fa.shading)});for(F=0;F<A;F++)if(D=a.__webglObjects[F],D.render&&(G=D.object,ga=D.buffer,fa=D.transparent))f(G),H(fa.blending),l(fa.depthTest),n(fa.depthWrite),u(fa.polygonOffset,
-fa.polygonOffsetFactor,fa.polygonOffsetUnits),k(b,K,L,fa,ga,G);for(F=0;F<B;F++)if(D=a.__webglObjectsImmediate[F],G=D.object,G.visible&&(J=-1,fa=D.transparent))f(G),H(fa.blending),l(fa.depthTest),n(fa.depthWrite),u(fa.polygonOffset,fa.polygonOffsetFactor,fa.polygonOffsetUnits),ia=e(b,K,L,fa,G),G.immediateRenderCallback?G.immediateRenderCallback(ia,o,ka):G.render(function(a){h(a,ia,fa.shading)})}a.__webglSprites.length&&y(a,b);c&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&
+D.render)G=D.object,ga=D.buffer,f(G),k(b,L,K,a.overrideMaterial,ga,G);for(F=0;F<B;F++)D=a.__webglObjectsImmediate[F],G=D.object,G.visible&&(J=-1,f(G),ia=e(b,L,K,a.overrideMaterial,G),G.immediateRenderCallback?G.immediateRenderCallback(ia,o,ka):G.render(function(b){h(b,ia,a.overrideMaterial.shading)}))}else{H(THREE.NormalBlending);for(F=A-1;F>=0;F--)if(D=a.__webglObjects[F],D.render&&(G=D.object,ga=D.buffer,fa=D.opaque))f(G),l(fa.depthTest),n(fa.depthWrite),u(fa.polygonOffset,fa.polygonOffsetFactor,
+fa.polygonOffsetUnits),k(b,L,K,fa,ga,G);for(F=0;F<B;F++)if(D=a.__webglObjectsImmediate[F],G=D.object,G.visible&&(J=-1,fa=D.opaque))f(G),l(fa.depthTest),n(fa.depthWrite),u(fa.polygonOffset,fa.polygonOffsetFactor,fa.polygonOffsetUnits),ia=e(b,L,K,fa,G),G.immediateRenderCallback?G.immediateRenderCallback(ia,o,ka):G.render(function(a){h(a,ia,fa.shading)});for(F=0;F<A;F++)if(D=a.__webglObjects[F],D.render&&(G=D.object,ga=D.buffer,fa=D.transparent))f(G),H(fa.blending),l(fa.depthTest),n(fa.depthWrite),u(fa.polygonOffset,
+fa.polygonOffsetFactor,fa.polygonOffsetUnits),k(b,L,K,fa,ga,G);for(F=0;F<B;F++)if(D=a.__webglObjectsImmediate[F],G=D.object,G.visible&&(J=-1,fa=D.transparent))f(G),H(fa.blending),l(fa.depthTest),n(fa.depthWrite),u(fa.polygonOffset,fa.polygonOffsetFactor,fa.polygonOffsetUnits),ia=e(b,L,K,fa,G),G.immediateRenderCallback?G.immediateRenderCallback(ia,o,ka):G.render(function(a){h(a,ia,fa.shading)})}a.__webglSprites.length&&y(a,b);c&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&
 N(c)};this.initWebGLObjects=function(a){if(!a.__webglObjects)a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[];for(;a.__objectsAdded.length;){var e=a.__objectsAdded[0],f=a,h=void 0,k=void 0,l=void 0;if(!e.__webglInit)if(e.__webglInit=!0,e._modelViewMatrix=new THREE.Matrix4,e._normalMatrixArray=new Float32Array(9),e._modelViewMatrixArray=new Float32Array(16),e._objectMatrixArray=new Float32Array(16),e.matrixWorld.flattenToArray(e._objectMatrixArray),e instanceof THREE.Mesh){k=e.geometry;
 if(k.geometryGroups===void 0){var l=k,n=void 0,v=void 0,u=void 0,p=void 0,t=u=void 0,F=void 0,x={},w=l.morphTargets.length;l.geometryGroups={};n=0;for(v=l.faces.length;n<v;n++)u=l.faces[n],p=u.materialIndex,t=p!==void 0?p:-1,x[t]===void 0&&(x[t]={hash:t,counter:0}),F=x[t].hash+"_"+x[t].counter,l.geometryGroups[F]===void 0&&(l.geometryGroups[F]={faces:[],materialIndex:p,vertices:0,numMorphTargets:w}),u=u instanceof THREE.Face3?3:4,l.geometryGroups[F].vertices+u>65535&&(x[t].counter+=1,F=x[t].hash+
 "_"+x[t].counter,l.geometryGroups[F]===void 0&&(l.geometryGroups[F]={faces:[],materialIndex:p,vertices:0,numMorphTargets:w})),l.geometryGroups[F].faces.push(n),l.geometryGroups[F].vertices+=u;l.geometryGroupsList=[];n=void 0;for(n in l.geometryGroups)l.geometryGroups[n].id=ra++,l.geometryGroupsList.push(l.geometryGroups[n])}for(h in k.geometryGroups)if(l=k.geometryGroups[h],!l.__webglVertexBuffer){n=l;n.__webglVertexBuffer=o.createBuffer();n.__webglNormalBuffer=o.createBuffer();n.__webglTangentBuffer=
@@ -313,27 +313,27 @@ l.__webglColorBuffer=o.createBuffer(),P.info.memory.geometries++,l=k,n=l.vertice
 attribute.type==="c"&&(size=3),attribute.size=size,attribute.array=new Float32Array(n*size),attribute.buffer=o.createBuffer(),attribute.buffer.belongsToAttribute=p,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;l.__webglCustomAttributesList.push(attribute)}}k.__dirtyVertices=!0;k.__dirtyColors=!0}if(!e.__webglActive){if(e instanceof THREE.Mesh)for(h in k=e.geometry,k.geometryGroups)l=k.geometryGroups[h],K(f.__webglObjects,l,e);else e instanceof THREE.Ribbon||e instanceof THREE.Line||
 e instanceof THREE.ParticleSystem?(k=e.geometry,K(f.__webglObjects,k,e)):THREE.MarchingCubes!==void 0&&e instanceof THREE.MarchingCubes||e.immediateRenderCallback?f.__webglObjectsImmediate.push({object:e,opaque:null,transparent:null}):e instanceof THREE.Sprite&&f.__webglSprites.push(e);e.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){e=a.__objectsRemoved[0];f=a;if(e instanceof THREE.Mesh||e instanceof THREE.ParticleSystem||e instanceof THREE.Ribbon||e instanceof THREE.Line)D(f.__webglObjects,
 e);else if(e instanceof THREE.Sprite){f=f.__webglSprites;h=e;for(k=f.length-1;k>=0;k--)f[k]===h&&f.splice(k,1)}else(e instanceof THREE.MarchingCubes||e.immediateRenderCallback)&&D(f.__webglObjectsImmediate,e);e.__webglActive=!1;a.__objectsRemoved.splice(0,1)}e=0;for(f=a.__webglObjects.length;e<f;e++)if(k=a.__webglObjects[e].object,h=k.geometry,l=t=p=void 0,k instanceof THREE.Mesh){n=0;for(v=h.geometryGroupsList.length;n<v;n++)if(p=h.geometryGroupsList[n],l=c(k,p),t=l.attributes&&A(l),h.__dirtyVertices||
-h.__dirtyMorphTargets||h.__dirtyElements||h.__dirtyUvs||h.__dirtyNormals||h.__dirtyColors||h.__dirtyTangents||t)if(t=o.DYNAMIC_DRAW,F=!h.dynamic,p.__inittedArrays){var fa=w=x=void 0,G=void 0,C=fa=void 0,ga=void 0,L=void 0,va=void 0,N=y=ia=z=u=void 0,J=void 0,H=void 0,ha=void 0,O=void 0,R=G=va=G=L=ga=void 0,da=void 0,I=da=R=ga=void 0,E=void 0,I=da=R=fa=fa=C=da=R=G=I=da=R=E=I=da=R=E=I=da=R=void 0,M=0,Q=0,T=0,W=0,$=0,ua=0,oa=0,X=0,Y=0,S=0,U=0,na=I=0,na=void 0,V=p.__vertexArray,wa=p.__uvArray,ma=p.__uv2Array,
-aa=p.__normalArray,ka=p.__tangentArray,ea=p.__colorArray,Z=p.__skinVertexAArray,ca=p.__skinVertexBArray,ta=p.__skinIndexArray,ja=p.__skinWeightArray,pa=p.__morphTargetsArrays,sa=p.__webglCustomAttributesList,E=void 0,Ba=p.__faceArray,la=p.__lineArray,Ga=p.__needsSmoothNormals,z=p.__vertexColorType,u=p.__uvType,ia=p.__normalType,qa=k.geometry,Da=qa.__dirtyVertices,Ea=qa.__dirtyElements,ya=qa.__dirtyUvs,Ka=qa.__dirtyNormals,Ca=qa.__dirtyTangents,Fa=qa.__dirtyColors,Ia=qa.__dirtyMorphTargets,za=qa.vertices,
+h.__dirtyMorphTargets||h.__dirtyElements||h.__dirtyUvs||h.__dirtyNormals||h.__dirtyColors||h.__dirtyTangents||t)if(t=o.DYNAMIC_DRAW,F=!h.dynamic,p.__inittedArrays){var fa=w=x=void 0,G=void 0,C=fa=void 0,ga=void 0,L=void 0,va=void 0,N=y=ia=z=u=void 0,J=void 0,H=void 0,ha=void 0,O=void 0,R=G=va=G=L=ga=void 0,da=void 0,I=da=R=ga=void 0,E=void 0,I=da=R=fa=fa=C=da=R=G=I=da=R=E=I=da=R=E=I=da=R=void 0,M=0,Q=0,T=0,W=0,$=0,ua=0,oa=0,X=0,Y=0,S=0,U=0,ma=I=0,ma=void 0,V=p.__vertexArray,wa=p.__uvArray,la=p.__uv2Array,
+aa=p.__normalArray,ka=p.__tangentArray,ea=p.__colorArray,Z=p.__skinVertexAArray,ca=p.__skinVertexBArray,ta=p.__skinIndexArray,ja=p.__skinWeightArray,pa=p.__morphTargetsArrays,sa=p.__webglCustomAttributesList,E=void 0,Ba=p.__faceArray,na=p.__lineArray,Ga=p.__needsSmoothNormals,z=p.__vertexColorType,u=p.__uvType,ia=p.__normalType,qa=k.geometry,Da=qa.__dirtyVertices,Ea=qa.__dirtyElements,ya=qa.__dirtyUvs,Ka=qa.__dirtyNormals,Ca=qa.__dirtyTangents,Fa=qa.__dirtyColors,Ia=qa.__dirtyMorphTargets,za=qa.vertices,
 Ya=p.faces,bb=qa.faces,Za=qa.faceVertexUvs[0],$a=qa.faceVertexUvs[1],Pa=qa.skinVerticesA,Qa=qa.skinVerticesB,Ra=qa.skinIndices,La=qa.skinWeights,Ja=qa.morphTargets;if(sa){R=0;for(da=sa.length;R<da;R++)sa[R].offset=0,sa[R].offsetSrc=0}x=0;for(w=Ya.length;x<w;x++)if(fa=Ya[x],G=bb[fa],Za&&(y=Za[fa]),$a&&(N=$a[fa]),fa=G.vertexNormals,C=G.normal,ga=G.vertexColors,L=G.color,va=G.vertexTangents,G instanceof THREE.Face3){if(Da)J=za[G.a].position,H=za[G.b].position,ha=za[G.c].position,V[Q]=J.x,V[Q+1]=J.y,
-V[Q+2]=J.z,V[Q+3]=H.x,V[Q+4]=H.y,V[Q+5]=H.z,V[Q+6]=ha.x,V[Q+7]=ha.y,V[Q+8]=ha.z,Q+=9;if(sa){R=0;for(da=sa.length;R<da;R++)if(E=sa[R],E.__original.needsUpdate)I=E.offset,na=E.offsetSrc,E.size===1?(E.boundTo===void 0||E.boundTo==="vertices"?(E.array[I]=E.value[G.a],E.array[I+1]=E.value[G.b],E.array[I+2]=E.value[G.c]):E.boundTo==="faces"?(na=E.value[na],E.array[I]=na,E.array[I+1]=na,E.array[I+2]=na,E.offsetSrc++):E.boundTo==="faceVertices"&&(E.array[I]=E.value[na],E.array[I+1]=E.value[na+1],E.array[I+
-2]=E.value[na+2],E.offsetSrc+=3),E.offset+=3):(E.boundTo===void 0||E.boundTo==="vertices"?(J=E.value[G.a],H=E.value[G.b],ha=E.value[G.c]):E.boundTo==="faces"?(ha=H=J=na=E.value[na],E.offsetSrc++):E.boundTo==="faceVertices"&&(J=E.value[na],H=E.value[na+1],ha=E.value[na+2],E.offsetSrc+=3),E.size===2?(E.array[I]=J.x,E.array[I+1]=J.y,E.array[I+2]=H.x,E.array[I+3]=H.y,E.array[I+4]=ha.x,E.array[I+5]=ha.y,E.offset+=6):E.size===3?(E.type==="c"?(E.array[I]=J.r,E.array[I+1]=J.g,E.array[I+2]=J.b,E.array[I+3]=
+V[Q+2]=J.z,V[Q+3]=H.x,V[Q+4]=H.y,V[Q+5]=H.z,V[Q+6]=ha.x,V[Q+7]=ha.y,V[Q+8]=ha.z,Q+=9;if(sa){R=0;for(da=sa.length;R<da;R++)if(E=sa[R],E.__original.needsUpdate)I=E.offset,ma=E.offsetSrc,E.size===1?(E.boundTo===void 0||E.boundTo==="vertices"?(E.array[I]=E.value[G.a],E.array[I+1]=E.value[G.b],E.array[I+2]=E.value[G.c]):E.boundTo==="faces"?(ma=E.value[ma],E.array[I]=ma,E.array[I+1]=ma,E.array[I+2]=ma,E.offsetSrc++):E.boundTo==="faceVertices"&&(E.array[I]=E.value[ma],E.array[I+1]=E.value[ma+1],E.array[I+
+2]=E.value[ma+2],E.offsetSrc+=3),E.offset+=3):(E.boundTo===void 0||E.boundTo==="vertices"?(J=E.value[G.a],H=E.value[G.b],ha=E.value[G.c]):E.boundTo==="faces"?(ha=H=J=ma=E.value[ma],E.offsetSrc++):E.boundTo==="faceVertices"&&(J=E.value[ma],H=E.value[ma+1],ha=E.value[ma+2],E.offsetSrc+=3),E.size===2?(E.array[I]=J.x,E.array[I+1]=J.y,E.array[I+2]=H.x,E.array[I+3]=H.y,E.array[I+4]=ha.x,E.array[I+5]=ha.y,E.offset+=6):E.size===3?(E.type==="c"?(E.array[I]=J.r,E.array[I+1]=J.g,E.array[I+2]=J.b,E.array[I+3]=
 H.r,E.array[I+4]=H.g,E.array[I+5]=H.b,E.array[I+6]=ha.r,E.array[I+7]=ha.g,E.array[I+8]=ha.b):(E.array[I]=J.x,E.array[I+1]=J.y,E.array[I+2]=J.z,E.array[I+3]=H.x,E.array[I+4]=H.y,E.array[I+5]=H.z,E.array[I+6]=ha.x,E.array[I+7]=ha.y,E.array[I+8]=ha.z),E.offset+=9):(E.array[I]=J.x,E.array[I+1]=J.y,E.array[I+2]=J.z,E.array[I+3]=J.w,E.array[I+4]=H.x,E.array[I+5]=H.y,E.array[I+6]=H.z,E.array[I+7]=H.w,E.array[I+8]=ha.x,E.array[I+9]=ha.y,E.array[I+10]=ha.z,E.array[I+11]=ha.w,E.offset+=12))}if(Ia){R=0;for(da=
 Ja.length;R<da;R++)J=Ja[R].vertices[G.a].position,H=Ja[R].vertices[G.b].position,ha=Ja[R].vertices[G.c].position,I=pa[R],I[U]=J.x,I[U+1]=J.y,I[U+2]=J.z,I[U+3]=H.x,I[U+4]=H.y,I[U+5]=H.z,I[U+6]=ha.x,I[U+7]=ha.y,I[U+8]=ha.z;U+=9}if(La.length)R=La[G.a],da=La[G.b],I=La[G.c],ja[S]=R.x,ja[S+1]=R.y,ja[S+2]=R.z,ja[S+3]=R.w,ja[S+4]=da.x,ja[S+5]=da.y,ja[S+6]=da.z,ja[S+7]=da.w,ja[S+8]=I.x,ja[S+9]=I.y,ja[S+10]=I.z,ja[S+11]=I.w,R=Ra[G.a],da=Ra[G.b],I=Ra[G.c],ta[S]=R.x,ta[S+1]=R.y,ta[S+2]=R.z,ta[S+3]=R.w,ta[S+4]=
 da.x,ta[S+5]=da.y,ta[S+6]=da.z,ta[S+7]=da.w,ta[S+8]=I.x,ta[S+9]=I.y,ta[S+10]=I.z,ta[S+11]=I.w,R=Pa[G.a],da=Pa[G.b],I=Pa[G.c],Z[S]=R.x,Z[S+1]=R.y,Z[S+2]=R.z,Z[S+3]=1,Z[S+4]=da.x,Z[S+5]=da.y,Z[S+6]=da.z,Z[S+7]=1,Z[S+8]=I.x,Z[S+9]=I.y,Z[S+10]=I.z,Z[S+11]=1,R=Qa[G.a],da=Qa[G.b],I=Qa[G.c],ca[S]=R.x,ca[S+1]=R.y,ca[S+2]=R.z,ca[S+3]=1,ca[S+4]=da.x,ca[S+5]=da.y,ca[S+6]=da.z,ca[S+7]=1,ca[S+8]=I.x,ca[S+9]=I.y,ca[S+10]=I.z,ca[S+11]=1,S+=12;if(Fa&&z)ga.length===3&&z===THREE.VertexColors?(G=ga[0],R=ga[1],da=ga[2]):
 da=R=G=L,ea[Y]=G.r,ea[Y+1]=G.g,ea[Y+2]=G.b,ea[Y+3]=R.r,ea[Y+4]=R.g,ea[Y+5]=R.b,ea[Y+6]=da.r,ea[Y+7]=da.g,ea[Y+8]=da.b,Y+=9;if(Ca&&qa.hasTangents)ga=va[0],L=va[1],G=va[2],ka[oa]=ga.x,ka[oa+1]=ga.y,ka[oa+2]=ga.z,ka[oa+3]=ga.w,ka[oa+4]=L.x,ka[oa+5]=L.y,ka[oa+6]=L.z,ka[oa+7]=L.w,ka[oa+8]=G.x,ka[oa+9]=G.y,ka[oa+10]=G.z,ka[oa+11]=G.w,oa+=12;if(Ka&&ia)if(fa.length===3&&Ga)for(R=0;R<3;R++)C=fa[R],aa[ua]=C.x,aa[ua+1]=C.y,aa[ua+2]=C.z,ua+=3;else for(R=0;R<3;R++)aa[ua]=C.x,aa[ua+1]=C.y,aa[ua+2]=C.z,ua+=3;if(ya&&
-y!==void 0&&u)for(R=0;R<3;R++)fa=y[R],wa[T]=fa.u,wa[T+1]=fa.v,T+=2;if(ya&&N!==void 0&&u)for(R=0;R<3;R++)fa=N[R],ma[W]=fa.u,ma[W+1]=fa.v,W+=2;Ea&&(Ba[$]=M,Ba[$+1]=M+1,Ba[$+2]=M+2,$+=3,la[X]=M,la[X+1]=M+1,la[X+2]=M,la[X+3]=M+2,la[X+4]=M+1,la[X+5]=M+2,X+=6,M+=3)}else if(G instanceof THREE.Face4){if(Da)J=za[G.a].position,H=za[G.b].position,ha=za[G.c].position,O=za[G.d].position,V[Q]=J.x,V[Q+1]=J.y,V[Q+2]=J.z,V[Q+3]=H.x,V[Q+4]=H.y,V[Q+5]=H.z,V[Q+6]=ha.x,V[Q+7]=ha.y,V[Q+8]=ha.z,V[Q+9]=O.x,V[Q+10]=O.y,V[Q+
-11]=O.z,Q+=12;if(sa){R=0;for(da=sa.length;R<da;R++)if(E=sa[R],E.__original.needsUpdate)I=E.offset,na=E.offsetSrc,E.size===1?(E.boundTo===void 0||E.boundTo==="vertices"?(E.array[I]=E.value[G.a],E.array[I+1]=E.value[G.b],E.array[I+2]=E.value[G.c],E.array[I+3]=E.value[G.d]):E.boundTo==="faces"?(na=E.value[na],E.array[I]=na,E.array[I+1]=na,E.array[I+2]=na,E.array[I+3]=na,E.offsetSrc++):E.boundTo==="faceVertices"&&(E.array[I]=E.value[na],E.array[I+1]=E.value[na+1],E.array[I+2]=E.value[na+2],E.array[I+
-3]=E.value[na+3],E.offsetSrc+=4),E.offset+=4):(E.boundTo===void 0||E.boundTo==="vertices"?(J=E.value[G.a],H=E.value[G.b],ha=E.value[G.c],O=E.value[G.d]):E.boundTo==="faces"?(O=ha=H=J=na=E.value[na],E.offsetSrc++):E.boundTo==="faceVertices"&&(J=E.value[na],H=E.value[na+1],ha=E.value[na+2],O=E.value[na+3],E.offsetSrc+=4),E.size===2?(E.array[I]=J.x,E.array[I+1]=J.y,E.array[I+2]=H.x,E.array[I+3]=H.y,E.array[I+4]=ha.x,E.array[I+5]=ha.y,E.array[I+6]=O.x,E.array[I+7]=O.y,E.offset+=8):E.size===3?(E.type===
+y!==void 0&&u)for(R=0;R<3;R++)fa=y[R],wa[T]=fa.u,wa[T+1]=fa.v,T+=2;if(ya&&N!==void 0&&u)for(R=0;R<3;R++)fa=N[R],la[W]=fa.u,la[W+1]=fa.v,W+=2;Ea&&(Ba[$]=M,Ba[$+1]=M+1,Ba[$+2]=M+2,$+=3,na[X]=M,na[X+1]=M+1,na[X+2]=M,na[X+3]=M+2,na[X+4]=M+1,na[X+5]=M+2,X+=6,M+=3)}else if(G instanceof THREE.Face4){if(Da)J=za[G.a].position,H=za[G.b].position,ha=za[G.c].position,O=za[G.d].position,V[Q]=J.x,V[Q+1]=J.y,V[Q+2]=J.z,V[Q+3]=H.x,V[Q+4]=H.y,V[Q+5]=H.z,V[Q+6]=ha.x,V[Q+7]=ha.y,V[Q+8]=ha.z,V[Q+9]=O.x,V[Q+10]=O.y,V[Q+
+11]=O.z,Q+=12;if(sa){R=0;for(da=sa.length;R<da;R++)if(E=sa[R],E.__original.needsUpdate)I=E.offset,ma=E.offsetSrc,E.size===1?(E.boundTo===void 0||E.boundTo==="vertices"?(E.array[I]=E.value[G.a],E.array[I+1]=E.value[G.b],E.array[I+2]=E.value[G.c],E.array[I+3]=E.value[G.d]):E.boundTo==="faces"?(ma=E.value[ma],E.array[I]=ma,E.array[I+1]=ma,E.array[I+2]=ma,E.array[I+3]=ma,E.offsetSrc++):E.boundTo==="faceVertices"&&(E.array[I]=E.value[ma],E.array[I+1]=E.value[ma+1],E.array[I+2]=E.value[ma+2],E.array[I+
+3]=E.value[ma+3],E.offsetSrc+=4),E.offset+=4):(E.boundTo===void 0||E.boundTo==="vertices"?(J=E.value[G.a],H=E.value[G.b],ha=E.value[G.c],O=E.value[G.d]):E.boundTo==="faces"?(O=ha=H=J=ma=E.value[ma],E.offsetSrc++):E.boundTo==="faceVertices"&&(J=E.value[ma],H=E.value[ma+1],ha=E.value[ma+2],O=E.value[ma+3],E.offsetSrc+=4),E.size===2?(E.array[I]=J.x,E.array[I+1]=J.y,E.array[I+2]=H.x,E.array[I+3]=H.y,E.array[I+4]=ha.x,E.array[I+5]=ha.y,E.array[I+6]=O.x,E.array[I+7]=O.y,E.offset+=8):E.size===3?(E.type===
 "c"?(E.array[I]=J.r,E.array[I+1]=J.g,E.array[I+2]=J.b,E.array[I+3]=H.r,E.array[I+4]=H.g,E.array[I+5]=H.b,E.array[I+6]=ha.r,E.array[I+7]=ha.g,E.array[I+8]=ha.b,E.array[I+9]=O.r,E.array[I+10]=O.g,E.array[I+11]=O.b):(E.array[I]=J.x,E.array[I+1]=J.y,E.array[I+2]=J.z,E.array[I+3]=H.x,E.array[I+4]=H.y,E.array[I+5]=H.z,E.array[I+6]=ha.x,E.array[I+7]=ha.y,E.array[I+8]=ha.z,E.array[I+9]=O.x,E.array[I+10]=O.y,E.array[I+11]=O.z),E.offset+=12):(E.array[I]=J.x,E.array[I+1]=J.y,E.array[I+2]=J.z,E.array[I+3]=J.w,
 E.array[I+4]=H.x,E.array[I+5]=H.y,E.array[I+6]=H.z,E.array[I+7]=H.w,E.array[I+8]=ha.x,E.array[I+9]=ha.y,E.array[I+10]=ha.z,E.array[I+11]=ha.w,E.array[I+12]=O.x,E.array[I+13]=O.y,E.array[I+14]=O.z,E.array[I+15]=O.w,E.offset+=16))}if(Ia){R=0;for(da=Ja.length;R<da;R++)J=Ja[R].vertices[G.a].position,H=Ja[R].vertices[G.b].position,ha=Ja[R].vertices[G.c].position,O=Ja[R].vertices[G.d].position,I=pa[R],I[U]=J.x,I[U+1]=J.y,I[U+2]=J.z,I[U+3]=H.x,I[U+4]=H.y,I[U+5]=H.z,I[U+6]=ha.x,I[U+7]=ha.y,I[U+8]=ha.z,I[U+
 9]=O.x,I[U+10]=O.y,I[U+11]=O.z;U+=12}if(La.length)R=La[G.a],da=La[G.b],I=La[G.c],E=La[G.d],ja[S]=R.x,ja[S+1]=R.y,ja[S+2]=R.z,ja[S+3]=R.w,ja[S+4]=da.x,ja[S+5]=da.y,ja[S+6]=da.z,ja[S+7]=da.w,ja[S+8]=I.x,ja[S+9]=I.y,ja[S+10]=I.z,ja[S+11]=I.w,ja[S+12]=E.x,ja[S+13]=E.y,ja[S+14]=E.z,ja[S+15]=E.w,R=Ra[G.a],da=Ra[G.b],I=Ra[G.c],E=Ra[G.d],ta[S]=R.x,ta[S+1]=R.y,ta[S+2]=R.z,ta[S+3]=R.w,ta[S+4]=da.x,ta[S+5]=da.y,ta[S+6]=da.z,ta[S+7]=da.w,ta[S+8]=I.x,ta[S+9]=I.y,ta[S+10]=I.z,ta[S+11]=I.w,ta[S+12]=E.x,ta[S+13]=
 E.y,ta[S+14]=E.z,ta[S+15]=E.w,R=Pa[G.a],da=Pa[G.b],I=Pa[G.c],E=Pa[G.d],Z[S]=R.x,Z[S+1]=R.y,Z[S+2]=R.z,Z[S+3]=1,Z[S+4]=da.x,Z[S+5]=da.y,Z[S+6]=da.z,Z[S+7]=1,Z[S+8]=I.x,Z[S+9]=I.y,Z[S+10]=I.z,Z[S+11]=1,Z[S+12]=E.x,Z[S+13]=E.y,Z[S+14]=E.z,Z[S+15]=1,R=Qa[G.a],da=Qa[G.b],I=Qa[G.c],G=Qa[G.d],ca[S]=R.x,ca[S+1]=R.y,ca[S+2]=R.z,ca[S+3]=1,ca[S+4]=da.x,ca[S+5]=da.y,ca[S+6]=da.z,ca[S+7]=1,ca[S+8]=I.x,ca[S+9]=I.y,ca[S+10]=I.z,ca[S+11]=1,ca[S+12]=G.x,ca[S+13]=G.y,ca[S+14]=G.z,ca[S+15]=1,S+=16;if(Fa&&z)ga.length===
 4&&z===THREE.VertexColors?(G=ga[0],R=ga[1],da=ga[2],ga=ga[3]):ga=da=R=G=L,ea[Y]=G.r,ea[Y+1]=G.g,ea[Y+2]=G.b,ea[Y+3]=R.r,ea[Y+4]=R.g,ea[Y+5]=R.b,ea[Y+6]=da.r,ea[Y+7]=da.g,ea[Y+8]=da.b,ea[Y+9]=ga.r,ea[Y+10]=ga.g,ea[Y+11]=ga.b,Y+=12;if(Ca&&qa.hasTangents)ga=va[0],L=va[1],G=va[2],va=va[3],ka[oa]=ga.x,ka[oa+1]=ga.y,ka[oa+2]=ga.z,ka[oa+3]=ga.w,ka[oa+4]=L.x,ka[oa+5]=L.y,ka[oa+6]=L.z,ka[oa+7]=L.w,ka[oa+8]=G.x,ka[oa+9]=G.y,ka[oa+10]=G.z,ka[oa+11]=G.w,ka[oa+12]=va.x,ka[oa+13]=va.y,ka[oa+14]=va.z,ka[oa+15]=
-va.w,oa+=16;if(Ka&&ia)if(fa.length===4&&Ga)for(R=0;R<4;R++)C=fa[R],aa[ua]=C.x,aa[ua+1]=C.y,aa[ua+2]=C.z,ua+=3;else for(R=0;R<4;R++)aa[ua]=C.x,aa[ua+1]=C.y,aa[ua+2]=C.z,ua+=3;if(ya&&y!==void 0&&u)for(R=0;R<4;R++)fa=y[R],wa[T]=fa.u,wa[T+1]=fa.v,T+=2;if(ya&&N!==void 0&&u)for(R=0;R<4;R++)fa=N[R],ma[W]=fa.u,ma[W+1]=fa.v,W+=2;Ea&&(Ba[$]=M,Ba[$+1]=M+1,Ba[$+2]=M+3,Ba[$+3]=M+1,Ba[$+4]=M+2,Ba[$+5]=M+3,$+=6,la[X]=M,la[X+1]=M+1,la[X+2]=M,la[X+3]=M+3,la[X+4]=M+1,la[X+5]=M+2,la[X+6]=M+2,la[X+7]=M+3,X+=8,M+=4)}Da&&
+va.w,oa+=16;if(Ka&&ia)if(fa.length===4&&Ga)for(R=0;R<4;R++)C=fa[R],aa[ua]=C.x,aa[ua+1]=C.y,aa[ua+2]=C.z,ua+=3;else for(R=0;R<4;R++)aa[ua]=C.x,aa[ua+1]=C.y,aa[ua+2]=C.z,ua+=3;if(ya&&y!==void 0&&u)for(R=0;R<4;R++)fa=y[R],wa[T]=fa.u,wa[T+1]=fa.v,T+=2;if(ya&&N!==void 0&&u)for(R=0;R<4;R++)fa=N[R],la[W]=fa.u,la[W+1]=fa.v,W+=2;Ea&&(Ba[$]=M,Ba[$+1]=M+1,Ba[$+2]=M+3,Ba[$+3]=M+1,Ba[$+4]=M+2,Ba[$+5]=M+3,$+=6,na[X]=M,na[X+1]=M+1,na[X+2]=M,na[X+3]=M+3,na[X+4]=M+1,na[X+5]=M+2,na[X+6]=M+2,na[X+7]=M+3,X+=8,M+=4)}Da&&
 (o.bindBuffer(o.ARRAY_BUFFER,p.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,V,t));if(sa){R=0;for(da=sa.length;R<da;R++)E=sa[R],E.__original.needsUpdate&&(o.bindBuffer(o.ARRAY_BUFFER,E.buffer),o.bufferData(o.ARRAY_BUFFER,E.array,t))}if(Ia){R=0;for(da=Ja.length;R<da;R++)o.bindBuffer(o.ARRAY_BUFFER,p.__webglMorphTargetsBuffers[R]),o.bufferData(o.ARRAY_BUFFER,pa[R],t)}Fa&&Y>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,ea,t));Ka&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglNormalBuffer),
-o.bufferData(o.ARRAY_BUFFER,aa,t));Ca&&qa.hasTangents&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglTangentBuffer),o.bufferData(o.ARRAY_BUFFER,ka,t));ya&&T>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUVBuffer),o.bufferData(o.ARRAY_BUFFER,wa,t));ya&&W>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUV2Buffer),o.bufferData(o.ARRAY_BUFFER,ma,t));Ea&&(o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,p.__webglFaceBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,Ba,t),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,p.__webglLineBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,
-la,t));S>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinVertexABuffer),o.bufferData(o.ARRAY_BUFFER,Z,t),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinVertexBBuffer),o.bufferData(o.ARRAY_BUFFER,ca,t),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinIndicesBuffer),o.bufferData(o.ARRAY_BUFFER,ta,t),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinWeightsBuffer),o.bufferData(o.ARRAY_BUFFER,ja,t));F&&(delete p.__inittedArrays,delete p.__colorArray,delete p.__normalArray,delete p.__tangentArray,delete p.__uvArray,delete p.__uv2Array,
+o.bufferData(o.ARRAY_BUFFER,aa,t));Ca&&qa.hasTangents&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglTangentBuffer),o.bufferData(o.ARRAY_BUFFER,ka,t));ya&&T>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUVBuffer),o.bufferData(o.ARRAY_BUFFER,wa,t));ya&&W>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUV2Buffer),o.bufferData(o.ARRAY_BUFFER,la,t));Ea&&(o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,p.__webglFaceBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,Ba,t),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,p.__webglLineBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,
+na,t));S>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinVertexABuffer),o.bufferData(o.ARRAY_BUFFER,Z,t),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinVertexBBuffer),o.bufferData(o.ARRAY_BUFFER,ca,t),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinIndicesBuffer),o.bufferData(o.ARRAY_BUFFER,ta,t),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinWeightsBuffer),o.bufferData(o.ARRAY_BUFFER,ja,t));F&&(delete p.__inittedArrays,delete p.__colorArray,delete p.__normalArray,delete p.__tangentArray,delete p.__uvArray,delete p.__uv2Array,
 delete p.__faceArray,delete p.__vertexArray,delete p.__lineArray,delete p.__skinVertexAArray,delete p.__skinVertexBArray,delete p.__skinIndexArray,delete p.__skinWeightArray)}h.__dirtyVertices=!1;h.__dirtyMorphTargets=!1;h.__dirtyElements=!1;h.__dirtyUvs=!1;h.__dirtyNormals=!1;h.__dirtyColors=!1;h.__dirtyTangents=!1;l.attributes&&B(l)}else if(k instanceof THREE.Ribbon){if(h.__dirtyVertices||h.__dirtyColors){k=h;l=o.DYNAMIC_DRAW;n=x=F=F=void 0;w=k.vertices;v=k.colors;u=w.length;p=v.length;z=k.__vertexArray;
 t=k.__colorArray;ia=k.__dirtyColors;if(k.__dirtyVertices){for(F=0;F<u;F++)x=w[F].position,n=F*3,z[n]=x.x,z[n+1]=x.y,z[n+2]=x.z;o.bindBuffer(o.ARRAY_BUFFER,k.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,z,l)}if(ia){for(F=0;F<p;F++)color=v[F],n=F*3,t[n]=color.r,t[n+1]=color.g,t[n+2]=color.b;o.bindBuffer(o.ARRAY_BUFFER,k.__webglColorBuffer);o.bufferData(o.ARRAY_BUFFER,t,l)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(k instanceof THREE.Line){if(h.__dirtyVertices||h.__dirtyColors){k=h;l=o.DYNAMIC_DRAW;
 n=x=F=F=void 0;w=k.vertices;v=k.colors;u=w.length;p=v.length;z=k.__vertexArray;t=k.__colorArray;ia=k.__dirtyColors;if(k.__dirtyVertices){for(F=0;F<u;F++)x=w[F].position,n=F*3,z[n]=x.x,z[n+1]=x.y,z[n+2]=x.z;o.bindBuffer(o.ARRAY_BUFFER,k.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,z,l)}if(ia){for(F=0;F<p;F++)color=v[F],n=F*3,t[n]=color.r,t[n+1]=color.g,t[n+2]=color.b;o.bindBuffer(o.ARRAY_BUFFER,k.__webglColorBuffer);o.bufferData(o.ARRAY_BUFFER,t,l)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(k instanceof
@@ -489,13 +489,13 @@ this.vertices[b].position.clone().setY(0).normalize(),x=this.vertices[p].positio
 D=new THREE.UV(B.u,1),this.faces.push(new THREE.Face3(b,p,w,[z,x,y])),this.faceVertexUvs[0].push([A,B,D])}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,e=a.length,k;this.shapebb=a[e-1].getBoundingBox();for(b=0;b<e;b++)k=a[b],this.addShape(k,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 e(a,b,c){var e=THREE.ExtrudeGeometry.__v1,f=THREE.ExtrudeGeometry.__v2,h=THREE.ExtrudeGeometry.__v3,k=THREE.ExtrudeGeometry.__v4,l=THREE.ExtrudeGeometry.__v5,n=THREE.ExtrudeGeometry.__v6;e.set(a.x-b.x,a.y-b.y);f.set(a.x-c.x,a.y-c.y);e=e.normalize();f=f.normalize();h.set(-e.y,e.x);k.set(f.y,-f.x);l.copy(a).addSelf(h);n.copy(a).addSelf(k);if(l.equals(n))return k.clone();
-l.copy(b).addSelf(h);n.copy(c).addSelf(k);h=e.dot(k);k=n.subSelf(l).dot(k);h===0&&(console.log("Either infinite or no solutions!"),k===0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));k/=h;if(k<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),anglec=(b+a)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return e.multiplyScalar(k).addSelf(l).subSelf(a).clone()}function k(a){for(N=a.length;--N>=0;){pa=N;la=N-1;la<0&&(la=a.length-
-1);for(var b=0,c=v+t*2,b=0;b<c;b++){var e=U*b,f=U*(b+1),h=qa+pa+e,k=qa+pa+f,o=h,e=qa+la+e,f=qa+la+f,p=k;o+=W;e+=W;f+=W;p+=W;L.faces.push(new THREE.Face4(o,e,f,p,null,null,D));D&&(o=b/c,e=(b+1)/c,f=l+n*2,h=(L.vertices[h].position.z+n)/f,k=(L.vertices[k].position.z+n)/f,L.faceVertexUvs[0].push([new THREE.UV(h,o),new THREE.UV(k,o),new THREE.UV(k,e),new THREE.UV(h,e)]))}}}function h(a,b,c){L.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function f(a,b,c){a+=W;b+=W;c+=W;L.faces.push(new THREE.Face3(a,
+l.copy(b).addSelf(h);n.copy(c).addSelf(k);h=e.dot(k);k=n.subSelf(l).dot(k);h===0&&(console.log("Either infinite or no solutions!"),k===0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));k/=h;if(k<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),anglec=(b+a)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return e.multiplyScalar(k).addSelf(l).subSelf(a).clone()}function k(a){for(N=a.length;--N>=0;){pa=N;na=N-1;na<0&&(na=a.length-
+1);for(var b=0,c=v+t*2,b=0;b<c;b++){var e=U*b,f=U*(b+1),h=qa+pa+e,k=qa+pa+f,o=h,e=qa+na+e,f=qa+na+f,p=k;o+=W;e+=W;f+=W;p+=W;L.faces.push(new THREE.Face4(o,e,f,p,null,null,D));D&&(o=b/c,e=(b+1)/c,f=l+n*2,h=(L.vertices[h].position.z+n)/f,k=(L.vertices[k].position.z+n)/f,L.faceVertexUvs[0].push([new THREE.UV(h,o),new THREE.UV(k,o),new THREE.UV(k,e),new THREE.UV(h,e)]))}}}function h(a,b,c){L.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function f(a,b,c){a+=W;b+=W;c+=W;L.faces.push(new THREE.Face3(a,
 b,c,null,null,B));if(B){var e=K.maxY,f=K.maxX,h=L.vertices[b].position.x,b=L.vertices[b].position.y,k=L.vertices[c].position.x,c=L.vertices[c].position.y;L.faceVertexUvs[0].push([new THREE.UV(L.vertices[a].position.x/f,L.vertices[a].position.y/e),new THREE.UV(h/f,b/e),new THREE.UV(k/f,c/e)])}}var l=c.amount!==void 0?c.amount:100,n=c.bevelThickness!==void 0?c.bevelThickness:6,u=c.bevelSize!==void 0?c.bevelSize:n-2,t=c.bevelSegments!==void 0?c.bevelSegments:3,p=c.bevelEnabled!==void 0?c.bevelEnabled:
 !0,w=c.curveSegments!==void 0?c.curveSegments:12,v=c.steps!==void 0?c.steps:1,z=c.bendPath,x=c.extrudePath,y,C=!1,A=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,B=c.material,D=c.extrudeMaterial,K=this.shapebb;if(x)y=x.getPoints(w),v=y.length,C=!0,p=!1;p||(u=n=t=0);var H,M,V,L=this,W=this.vertices.length;z&&a.addWrapPath(z);w=A?a.extractAllSpacedPoints(w):a.extractAllPoints(w);z=w.shape;w=w.holes;if(x=!THREE.Shape.Utils.isClockWise(z)){z=z.reverse();M=0;for(V=w.length;M<V;M++)H=w[M],THREE.Shape.Utils.isClockWise(H)&&
-(w[M]=H.reverse());x=!1}x=THREE.Shape.Utils.triangulateShape(z,w);A=z;M=0;for(V=w.length;M<V;M++)H=w[M],z=z.concat(H);var N,O,$,Y,P,o,U=z.length,Q=x.length,aa=[];N=0;O=A.length;pa=O-1;for(la=N+1;N<O;N++,pa++,la++)pa===O&&(pa=0),la===O&&(la=0),aa[N]=e(A[N],A[pa],A[la]);var T=[],J,ra=aa.concat();M=0;for(V=w.length;M<V;M++){H=w[M];J=[];N=0;O=H.length;pa=O-1;for(la=N+1;N<O;N++,pa++,la++)pa===O&&(pa=0),la===O&&(la=0),J[N]=e(H[N],H[pa],H[la]);T.push(J);ra=ra.concat(J)}for($=0;$<t;$++){Y=$/t;P=n*(1-Y);Y=
+(w[M]=H.reverse());x=!1}x=THREE.Shape.Utils.triangulateShape(z,w);A=z;M=0;for(V=w.length;M<V;M++)H=w[M],z=z.concat(H);var N,O,$,Y,P,o,U=z.length,Q=x.length,aa=[];N=0;O=A.length;pa=O-1;for(na=N+1;N<O;N++,pa++,na++)pa===O&&(pa=0),na===O&&(na=0),aa[N]=e(A[N],A[pa],A[na]);var T=[],J,ra=aa.concat();M=0;for(V=w.length;M<V;M++){H=w[M];J=[];N=0;O=H.length;pa=O-1;for(na=N+1;N<O;N++,pa++,na++)pa===O&&(pa=0),na===O&&(na=0),J[N]=e(H[N],H[pa],H[na]);T.push(J);ra=ra.concat(J)}for($=0;$<t;$++){Y=$/t;P=n*(1-Y);Y=
 u*Math.sin(Y*Math.PI/2);N=0;for(O=A.length;N<O;N++)o=b(A[N],aa[N],Y),h(o.x,o.y,-P);M=0;for(V=w.length;M<V;M++){H=w[M];J=T[M];N=0;for(O=H.length;N<O;N++)o=b(H[N],J[N],Y),h(o.x,o.y,-P)}}Y=u;for(N=0;N<U;N++)o=p?b(z[N],ra[N],Y):z[N],C?h(o.x,o.y+y[0].y,y[0].x):h(o.x,o.y,0);for($=1;$<=v;$++)for(N=0;N<U;N++)o=p?b(z[N],ra[N],Y):z[N],C?h(o.x,o.y+y[$-1].y,y[$-1].x):h(o.x,o.y,l/v*$);for($=t-1;$>=0;$--){Y=$/t;P=n*(1-Y);Y=u*Math.sin(Y*Math.PI/2);N=0;for(O=A.length;N<O;N++)o=b(A[N],aa[N],Y),h(o.x,o.y,l+P);M=0;
-for(V=w.length;M<V;M++){H=w[M];J=T[M];N=0;for(O=H.length;N<O;N++)o=b(H[N],J[N],Y),C?h(o.x,o.y+y[v-1].y,y[v-1].x+P):h(o.x,o.y,l+P)}}if(p){p=U*0;for(N=0;N<Q;N++)u=x[N],f(u[2]+p,u[1]+p,u[0]+p);p=U*(v+t*2);for(N=0;N<Q;N++)u=x[N],f(u[0]+p,u[1]+p,u[2]+p)}else{for(N=0;N<Q;N++)u=x[N],f(u[2],u[1],u[0]);for(N=0;N<Q;N++)u=x[N],f(u[0]+U*v,u[1]+U*v,u[2]+U*v)}var pa,la,qa=0;k(A);qa+=A.length;M=0;for(V=w.length;M<V;M++)H=w[M],k(H),qa+=H.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;
+for(V=w.length;M<V;M++){H=w[M];J=T[M];N=0;for(O=H.length;N<O;N++)o=b(H[N],J[N],Y),C?h(o.x,o.y+y[v-1].y,y[v-1].x+P):h(o.x,o.y,l+P)}}if(p){p=U*0;for(N=0;N<Q;N++)u=x[N],f(u[2]+p,u[1]+p,u[0]+p);p=U*(v+t*2);for(N=0;N<Q;N++)u=x[N],f(u[0]+p,u[1]+p,u[2]+p)}else{for(N=0;N<Q;N++)u=x[N],f(u[2],u[1],u[0]);for(N=0;N<Q;N++)u=x[N],f(u[0]+U*v,u[1]+U*v,u[2]+U*v)}var pa,na,qa=0;k(A);qa+=A.length;M=0;for(V=w.length;M<V;M++)H=w[M],k(H),qa+=H.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 e=Math.sqrt(a*a+b*b+c*c);return k.vertices.push(new THREE.Vertex(new THREE.Vector3(a/e,b/e,c/e)))-1}function b(a,b,c,e){e.faces.push(new THREE.Face3(a,b,c))}function e(a,b){var e=k.vertices[a].position,f=k.vertices[b].position;return c((e.x+f.x)/2,(e.y+f.y)/2,(e.z+f.z)/2)}var k=this,h=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,h);b(0,5,1,h);b(0,1,7,h);b(0,7,10,h);b(0,10,11,h);b(1,5,9,h);b(5,11,4,h);b(11,10,2,h);b(10,7,6,h);b(7,1,8,h);b(3,9,4,h);b(3,4,2,h);b(3,2,6,h);b(3,6,8,h);b(3,8,9,h);b(4,9,5,h);b(2,4,11,h);b(6,2,10,h);b(8,6,7,h);b(9,8,1,h);for(var f=0;f<this.subdivisions;f++){var a=new THREE.Geometry,l;for(l in h.faces){var n=e(h.faces[l].a,h.faces[l].b),u=e(h.faces[l].b,h.faces[l].c),t=e(h.faces[l].c,h.faces[l].a);b(h.faces[l].a,n,t,a);b(h.faces[l].b,u,
@@ -548,35 +548,35 @@ THREE.BinaryLoader.prototype.load=function(a,c,b,e){if(a instanceof Object){cons
 c,e,b,h)};a.onerror=function(a){alert("worker.onerror: "+a.message+"\n"+a.data);a.preventDefault()};a.postMessage(k)};
 THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,c,b,e,k,h){var f=new XMLHttpRequest,l=e+"/"+a,n=0;f.onreadystatechange=function(){f.readyState==4?f.status==200||f.status==0?THREE.BinaryLoader.prototype.createBinModel(f.responseText,b,k,c):alert("Couldn't load ["+l+"] ["+f.status+"]"):f.readyState==3?h&&(n==0&&(n=f.getResponseHeader("Content-Length")),h({total:n,loaded:f.responseText.length})):f.readyState==2&&(n=f.getResponseHeader("Content-Length"))};f.open("GET",l,!0);f.overrideMimeType("text/plain; charset=x-user-defined");
 f.setRequestHeader("Content-Type","text/plain");f.send(null)};
-THREE.BinaryLoader.prototype.createBinModel=function(a,c,b,e){var k=function(b){function c(a,b){var e=t(a,b),h=t(a,b+1),k=t(a,b+2),f=t(a,b+3),l=(f<<1&255|k>>7)-127;e|=(k&127)<<16|h<<8;if(e==0&&l==-127)return 0;return(1-2*(f>>7))*(1+e*Math.pow(2,-23))*Math.pow(2,l)}function k(a,b){var c=t(a,b),e=t(a,b+1),h=t(a,b+2);return(t(a,b+3)<<24)+(h<<16)+(e<<8)+c}function n(a,b){var c=t(a,b);return(t(a,b+1)<<8)+c}function u(a,b){var c=t(a,b);return c>127?c-256:c}function t(a,b){return a.charCodeAt(b)&255}function p(b){var c,
+THREE.BinaryLoader.prototype.createBinModel=function(a,c,b,e){var k=function(b){function c(a,b){var e=t(a,b),h=t(a,b+1),f=t(a,b+2),k=t(a,b+3),l=(k<<1&255|f>>7)-127;e|=(f&127)<<16|h<<8;if(e==0&&l==-127)return 0;return(1-2*(k>>7))*(1+e*Math.pow(2,-23))*Math.pow(2,l)}function k(a,b){var c=t(a,b),e=t(a,b+1),h=t(a,b+2);return(t(a,b+3)<<24)+(h<<16)+(e<<8)+c}function n(a,b){var c=t(a,b);return(t(a,b+1)<<8)+c}function u(a,b){var c=t(a,b);return c>127?c-256:c}function t(a,b){return a.charCodeAt(b)&255}function p(b){var c,
 e,h;c=k(a,b);e=k(a,b+H);h=k(a,b+M);b=n(a,b+V);C.faces.push(new THREE.Face3(c,e,h,null,null,b))}function w(b){var c,e,h,f,o,p,u;c=k(a,b);e=k(a,b+H);h=k(a,b+M);f=n(a,b+V);o=k(a,b+L);p=k(a,b+W);u=k(a,b+N);var b=D[p*3],t=D[p*3+1];p=D[p*3+2];var v=D[u*3],x=D[u*3+1];u=D[u*3+2];C.faces.push(new THREE.Face3(c,e,h,[new THREE.Vector3(D[o*3],D[o*3+1],D[o*3+2]),new THREE.Vector3(b,t,p),new THREE.Vector3(v,x,u)],null,f))}function v(b){var c,e,h,f;c=k(a,b);e=k(a,b+O);h=k(a,b+$);f=k(a,b+Y);b=n(a,b+P);C.faces.push(new THREE.Face4(c,
 e,h,f,null,null,b))}function z(b){var c,e,h,f,p,u,t,v,x;c=k(a,b);e=k(a,b+O);h=k(a,b+$);f=k(a,b+Y);p=n(a,b+P);u=k(a,b+o);t=k(a,b+U);v=k(a,b+Q);x=k(a,b+aa);var b=D[t*3],w=D[t*3+1];t=D[t*3+2];var F=D[v*3],y=D[v*3+1];v=D[v*3+2];var ia=D[x*3],G=D[x*3+1];x=D[x*3+2];C.faces.push(new THREE.Face4(c,e,h,f,[new THREE.Vector3(D[u*3],D[u*3+1],D[u*3+2]),new THREE.Vector3(b,w,t),new THREE.Vector3(F,y,v),new THREE.Vector3(ia,G,x)],null,p))}function x(b){var c,e,h,f;c=k(a,b);e=k(a,b+T);h=k(a,b+J);b=K[c*2];f=K[c*2+
-1];c=K[e*2];var n=C.faceVertexUvs[0];e=K[e*2+1];var o=K[h*2];h=K[h*2+1];var p=[];p.push(new THREE.UV(b,f));p.push(new THREE.UV(c,e));p.push(new THREE.UV(o,h));n.push(p)}function y(b){var c,e,h,f,n,o;c=k(a,b);e=k(a,b+ra);h=k(a,b+pa);f=k(a,b+la);b=K[c*2];n=K[c*2+1];c=K[e*2];o=K[e*2+1];e=K[h*2];var p=C.faceVertexUvs[0];h=K[h*2+1];var u=K[f*2];f=K[f*2+1];var t=[];t.push(new THREE.UV(b,n));t.push(new THREE.UV(c,o));t.push(new THREE.UV(e,h));t.push(new THREE.UV(u,f));p.push(t)}var C=this,A=0,B,D=[],K=[],
-H,M,V,L,W,N,O,$,Y,P,o,U,Q,aa,T,J,ra,pa,la,qa,ja,ma,ea,ca,Z;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(C,e,b);B={signature:a.substr(A,8),header_bytes:t(a,A+8),vertex_coordinate_bytes:t(a,A+9),normal_coordinate_bytes:t(a,A+10),uv_coordinate_bytes:t(a,A+11),vertex_index_bytes:t(a,A+12),normal_index_bytes:t(a,A+13),uv_index_bytes:t(a,A+14),material_index_bytes:t(a,A+15),nvertices:k(a,A+16),nnormals:k(a,A+16+4),nuvs:k(a,A+16+8),ntri_flat:k(a,A+16+12),ntri_smooth:k(a,A+16+16),ntri_flat_uv:k(a,
+1];c=K[e*2];var n=C.faceVertexUvs[0];e=K[e*2+1];var o=K[h*2];h=K[h*2+1];var p=[];p.push(new THREE.UV(b,f));p.push(new THREE.UV(c,e));p.push(new THREE.UV(o,h));n.push(p)}function y(b){var c,e,h,f,n,o;c=k(a,b);e=k(a,b+ra);h=k(a,b+pa);f=k(a,b+na);b=K[c*2];n=K[c*2+1];c=K[e*2];o=K[e*2+1];e=K[h*2];var p=C.faceVertexUvs[0];h=K[h*2+1];var u=K[f*2];f=K[f*2+1];var t=[];t.push(new THREE.UV(b,n));t.push(new THREE.UV(c,o));t.push(new THREE.UV(e,h));t.push(new THREE.UV(u,f));p.push(t)}var C=this,A=0,B,D=[],K=[],
+H,M,V,L,W,N,O,$,Y,P,o,U,Q,aa,T,J,ra,pa,na,qa,ja,la,ea,ca,Z;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(C,e,b);B={signature:a.substr(A,8),header_bytes:t(a,A+8),vertex_coordinate_bytes:t(a,A+9),normal_coordinate_bytes:t(a,A+10),uv_coordinate_bytes:t(a,A+11),vertex_index_bytes:t(a,A+12),normal_index_bytes:t(a,A+13),uv_index_bytes:t(a,A+14),material_index_bytes:t(a,A+15),nvertices:k(a,A+16),nnormals:k(a,A+16+4),nuvs:k(a,A+16+8),ntri_flat:k(a,A+16+12),ntri_smooth:k(a,A+16+16),ntri_flat_uv:k(a,
 A+16+20),ntri_smooth_uv:k(a,A+16+24),nquad_flat:k(a,A+16+28),nquad_smooth:k(a,A+16+32),nquad_flat_uv:k(a,A+16+36),nquad_smooth_uv:k(a,A+16+40)};A+=B.header_bytes;H=B.vertex_index_bytes;M=B.vertex_index_bytes*2;V=B.vertex_index_bytes*3;L=B.vertex_index_bytes*3+B.material_index_bytes;W=B.vertex_index_bytes*3+B.material_index_bytes+B.normal_index_bytes;N=B.vertex_index_bytes*3+B.material_index_bytes+B.normal_index_bytes*2;O=B.vertex_index_bytes;$=B.vertex_index_bytes*2;Y=B.vertex_index_bytes*3;P=B.vertex_index_bytes*
-4;o=B.vertex_index_bytes*4+B.material_index_bytes;U=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes;Q=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes*2;aa=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes*3;T=B.uv_index_bytes;J=B.uv_index_bytes*2;ra=B.uv_index_bytes;pa=B.uv_index_bytes*2;la=B.uv_index_bytes*3;b=B.vertex_index_bytes*3+B.material_index_bytes;Z=B.vertex_index_bytes*4+B.material_index_bytes;qa=B.ntri_flat*b;ja=B.ntri_smooth*(b+B.normal_index_bytes*
-3);ma=B.ntri_flat_uv*(b+B.uv_index_bytes*3);ea=B.ntri_smooth_uv*(b+B.normal_index_bytes*3+B.uv_index_bytes*3);ca=B.nquad_flat*Z;b=B.nquad_smooth*(Z+B.normal_index_bytes*4);Z=B.nquad_flat_uv*(Z+B.uv_index_bytes*4);A+=function(b){for(var e,h,k,l=B.vertex_coordinate_bytes*3,n=b+B.nvertices*l;b<n;b+=l)e=c(a,b),h=c(a,b+B.vertex_coordinate_bytes),k=c(a,b+B.vertex_coordinate_bytes*2),C.vertices.push(new THREE.Vertex(new THREE.Vector3(e,h,k)));return B.nvertices*l}(A);A+=function(b){for(var c,e,h,f=B.normal_coordinate_bytes*
-3,k=b+B.nnormals*f;b<k;b+=f)c=u(a,b),e=u(a,b+B.normal_coordinate_bytes),h=u(a,b+B.normal_coordinate_bytes*2),D.push(c/127,e/127,h/127);return B.nnormals*f}(A);A+=function(b){for(var e,h,k=B.uv_coordinate_bytes*2,l=b+B.nuvs*k;b<l;b+=k)e=c(a,b),h=c(a,b+B.uv_coordinate_bytes),K.push(e,h);return B.nuvs*k}(A);qa=A+qa;ja=qa+ja;ma=ja+ma;ea=ma+ea;ca=ea+ca;b=ca+b;Z=b+Z;(function(a){var b,c=B.vertex_index_bytes*3+B.material_index_bytes,e=c+B.uv_index_bytes*3,h=a+B.ntri_flat_uv*e;for(b=a;b<h;b+=e)p(b),x(b+c);
-return h-a})(ja);(function(a){var b,c=B.vertex_index_bytes*3+B.material_index_bytes+B.normal_index_bytes*3,e=c+B.uv_index_bytes*3,h=a+B.ntri_smooth_uv*e;for(b=a;b<h;b+=e)w(b),x(b+c);return h-a})(ma);(function(a){var b,c=B.vertex_index_bytes*4+B.material_index_bytes,e=c+B.uv_index_bytes*4,h=a+B.nquad_flat_uv*e;for(b=a;b<h;b+=e)v(b),y(b+c);return h-a})(b);(function(a){var b,c=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes*4,e=c+B.uv_index_bytes*4,h=a+B.nquad_smooth_uv*e;for(b=a;b<
+4;o=B.vertex_index_bytes*4+B.material_index_bytes;U=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes;Q=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes*2;aa=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes*3;T=B.uv_index_bytes;J=B.uv_index_bytes*2;ra=B.uv_index_bytes;pa=B.uv_index_bytes*2;na=B.uv_index_bytes*3;b=B.vertex_index_bytes*3+B.material_index_bytes;Z=B.vertex_index_bytes*4+B.material_index_bytes;qa=B.ntri_flat*b;ja=B.ntri_smooth*(b+B.normal_index_bytes*
+3);la=B.ntri_flat_uv*(b+B.uv_index_bytes*3);ea=B.ntri_smooth_uv*(b+B.normal_index_bytes*3+B.uv_index_bytes*3);ca=B.nquad_flat*Z;b=B.nquad_smooth*(Z+B.normal_index_bytes*4);Z=B.nquad_flat_uv*(Z+B.uv_index_bytes*4);A+=function(b){for(var e,h,k,l=B.vertex_coordinate_bytes*3,n=b+B.nvertices*l;b<n;b+=l)e=c(a,b),h=c(a,b+B.vertex_coordinate_bytes),k=c(a,b+B.vertex_coordinate_bytes*2),C.vertices.push(new THREE.Vertex(new THREE.Vector3(e,h,k)));return B.nvertices*l}(A);A+=function(b){for(var c,e,h,f=B.normal_coordinate_bytes*
+3,k=b+B.nnormals*f;b<k;b+=f)c=u(a,b),e=u(a,b+B.normal_coordinate_bytes),h=u(a,b+B.normal_coordinate_bytes*2),D.push(c/127,e/127,h/127);return B.nnormals*f}(A);A+=function(b){for(var e,h,k=B.uv_coordinate_bytes*2,l=b+B.nuvs*k;b<l;b+=k)e=c(a,b),h=c(a,b+B.uv_coordinate_bytes),K.push(e,h);return B.nuvs*k}(A);qa=A+qa;ja=qa+ja;la=ja+la;ea=la+ea;ca=ea+ca;b=ca+b;Z=b+Z;(function(a){var b,c=B.vertex_index_bytes*3+B.material_index_bytes,e=c+B.uv_index_bytes*3,h=a+B.ntri_flat_uv*e;for(b=a;b<h;b+=e)p(b),x(b+c);
+return h-a})(ja);(function(a){var b,c=B.vertex_index_bytes*3+B.material_index_bytes+B.normal_index_bytes*3,e=c+B.uv_index_bytes*3,h=a+B.ntri_smooth_uv*e;for(b=a;b<h;b+=e)w(b),x(b+c);return h-a})(la);(function(a){var b,c=B.vertex_index_bytes*4+B.material_index_bytes,e=c+B.uv_index_bytes*4,h=a+B.nquad_flat_uv*e;for(b=a;b<h;b+=e)v(b),y(b+c);return h-a})(b);(function(a){var b,c=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes*4,e=c+B.uv_index_bytes*4,h=a+B.nquad_smooth_uv*e;for(b=a;b<
 h;b+=e)z(b),y(b+c);return h-a})(Z);(function(a){var b,c=B.vertex_index_bytes*3+B.material_index_bytes,e=a+B.ntri_flat*c;for(b=a;b<e;b+=c)p(b);return e-a})(A);(function(a){var b,c=B.vertex_index_bytes*3+B.material_index_bytes+B.normal_index_bytes*3,e=a+B.ntri_smooth*c;for(b=a;b<e;b+=c)w(b);return e-a})(qa);(function(a){var b,c=B.vertex_index_bytes*4+B.material_index_bytes,e=a+B.nquad_flat*c;for(b=a;b<e;b+=c)v(b);return e-a})(ea);(function(a){var b,c=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes*
 4,e=a+B.nquad_smooth*c;for(b=a;b<e;b+=c)z(b);return e-a})(ca);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};k.prototype=new THREE.Geometry;k.prototype.constructor=k;c(new k(b))};
-THREE.ColladaLoader=function(){function a(a,e,k){ja=a;e=e||ca;k!==void 0&&(a=k.split("/"),a.pop(),Ea=a.length<1?"":a.join("/")+"/");ga=c("//dae:library_images/dae:image",f,"image");ka=c("//dae:library_materials/dae:material",V,"material");sa=c("//dae:library_effects/dae:effect",$,"effect");na=c("//dae:library_geometries/dae:geometry",y,"geometry");oa=c("//dae:library_controllers/dae:controller",l,"controller");ha=c("//dae:library_animations/dae:animation",P,"animation");Da=c(".//dae:library_visual_scenes/dae:visual_scene",
-t,"visual_scene");Ca=[];Fa=[];(a=ja.evaluate(".//dae:scene/dae:instance_visual_scene",ja,aa,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),ea=Da[a]):ea=null;ma=new THREE.Object3D;for(a=0;a<ea.nodes.length;a++)ma.add(h(ea.nodes[a]));b();for(var n in ha);n={scene:ma,morphs:Ca,skins:Fa,dae:{images:ga,materials:ka,effects:sa,geometries:na,controllers:oa,animations:ha,visualScenes:Da,scene:ea}};e&&e(n);return n}function c(a,b,c){for(var a=ja.evaluate(a,
+THREE.ColladaLoader=function(){function a(a,e,k){ja=a;e=e||ca;k!==void 0&&(a=k.split("/"),a.pop(),Ea=a.length<1?"":a.join("/")+"/");ga=c("//dae:library_images/dae:image",f,"image");ka=c("//dae:library_materials/dae:material",V,"material");sa=c("//dae:library_effects/dae:effect",$,"effect");ma=c("//dae:library_geometries/dae:geometry",y,"geometry");oa=c("//dae:library_controllers/dae:controller",l,"controller");ha=c("//dae:library_animations/dae:animation",P,"animation");Da=c(".//dae:library_visual_scenes/dae:visual_scene",
+t,"visual_scene");Ca=[];Fa=[];(a=ja.evaluate(".//dae:scene/dae:instance_visual_scene",ja,aa,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),ea=Da[a]):ea=null;la=new THREE.Object3D;for(a=0;a<ea.nodes.length;a++)la.add(h(ea.nodes[a]));b();for(var n in ha);n={scene:la,morphs:Ca,skins:Fa,dae:{images:ga,materials:ka,effects:sa,geometries:ma,controllers:oa,animations:ha,visualScenes:Da,scene:ea}};e&&e(n);return n}function c(a,b,c){for(var a=ja.evaluate(a,
 ja,aa,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),e={},h=a.iterateNext(),f=0;h;){h=(new b).parse(h);if(h.id.length==0)h.id=c+f++;e[h.id]=h;h=a.iterateNext()}return e}function b(){var a=1E6,b=-a,c=0,e;for(e in ha)for(var h=ha[e],f=0;f<h.sampler.length;f++){var k=h.sampler[f];k.create();a=Math.min(a,k.startTime);b=Math.max(b,k.endTime);c=Math.max(c,k.input.length)}return{start:a,end:b,frames:c}}function e(a,b,c,h){a.world=a.world||new THREE.Matrix4;a.world.copy(a.matrix);if(a.channels&&a.channels.length){var f=
 a.channels[0].sampler.output[c];f instanceof THREE.Matrix4&&a.world.copy(f)}h&&a.world.multiply(h,a.world);b.push(a);for(h=0;h<a.nodes.length;h++)e(a.nodes[h],b,c,a.world)}function k(a,c,h){var f=oa[c.url];if(!f||!f.skin)console.log("ColladaLoader: Could not find skin controller.");else if(!c.skeleton||!c.skeleton.length)console.log("ColladaLoader: Could not find the skeleton for the skin. ");else{var k=b(),c=ea.getChildById(c.skeleton[0],!0)||ea.getChildBySid(c.skeleton[0],!0),l,n,o,p,u=new THREE.Vector3,
 t;for(l=0;l<a.vertices.length;l++)f.skin.bindShapeMatrix.multiplyVector3(a.vertices[l].position);for(h=0;h<k.frames;h++){var v=[],x=[];for(l=0;l<a.vertices.length;l++)x.push(new THREE.Vertex(new THREE.Vector3));e(c,v,h);l=v;n=f.skin;for(p=0;p<l.length;p++)if(o=l[p],t=-1,o.type=="JOINT"){for(var w=0;w<n.joints.length;w++)if(o.sid==n.joints[w]){t=w;break}if(t>=0){w=n.invBindMatrices[t];o.invBindMatrix=w;o.skinningMatrix=new THREE.Matrix4;o.skinningMatrix.multiply(o.world,w);o.weights=[];for(w=0;w<n.weights.length;w++)for(var y=
 0;y<n.weights[w].length;y++){var z=n.weights[w][y];z.joint==t&&o.weights.push(z)}}else throw"ColladaLoader: Could not find joint '"+o.sid+"'.";}for(l=0;l<v.length;l++)if(v[l].type=="JOINT")for(n=0;n<v[l].weights.length;n++)o=v[l].weights[n],p=o.index,o=o.weight,t=a.vertices[p],p=x[p],u.x=t.position.x,u.y=t.position.y,u.z=t.position.z,v[l].skinningMatrix.multiplyVector3(u),p.position.x+=u.x*o,p.position.y+=u.y*o,p.position.z+=u.z*o;a.morphTargets.push({name:"target_"+h,vertices:x})}}}function h(a){var b=
-new THREE.Object3D,c,e,f;for(f=0;f<a.controllers.length;f++){var l=oa[a.controllers[f].url];switch(l.type){case "skin":if(na[l.skin.source]){var n=new x;n.url=l.skin.source;n.instance_material=a.controllers[f].instance_material;a.geometries.push(n);c=a.controllers[f]}else if(oa[l.skin.source]&&(e=l=oa[l.skin.source],l.morph&&na[l.morph.source]))n=new x,n.url=l.morph.source,n.instance_material=a.controllers[f].instance_material,a.geometries.push(n);break;case "morph":if(na[l.morph.source])n=new x,
-n.url=l.morph.source,n.instance_material=a.controllers[f].instance_material,a.geometries.push(n),e=a.controllers[f];console.log("ColladaLoader: Morph-controller partially supported.")}}for(f=0;f<a.geometries.length;f++){var l=a.geometries[f],n=l.instance_material,l=na[l.url],o={},p=0,t;if(l&&l.mesh&&l.mesh.primitives){if(b.name.length==0)b.name=l.id;if(n)for(j=0;j<n.length;j++){t=n[j];var u=sa[ka[t.target].instance_effect.url].shader;u.material.opacity=!u.material.opacity?1:u.material.opacity;t=o[t.symbol]=
+new THREE.Object3D,c,e,f;for(f=0;f<a.controllers.length;f++){var l=oa[a.controllers[f].url];switch(l.type){case "skin":if(ma[l.skin.source]){var n=new x;n.url=l.skin.source;n.instance_material=a.controllers[f].instance_material;a.geometries.push(n);c=a.controllers[f]}else if(oa[l.skin.source]&&(e=l=oa[l.skin.source],l.morph&&ma[l.morph.source]))n=new x,n.url=l.morph.source,n.instance_material=a.controllers[f].instance_material,a.geometries.push(n);break;case "morph":if(ma[l.morph.source])n=new x,
+n.url=l.morph.source,n.instance_material=a.controllers[f].instance_material,a.geometries.push(n),e=a.controllers[f];console.log("ColladaLoader: Morph-controller partially supported.")}}for(f=0;f<a.geometries.length;f++){var l=a.geometries[f],n=l.instance_material,l=ma[l.url],o={},p=0,t;if(l&&l.mesh&&l.mesh.primitives){if(b.name.length==0)b.name=l.id;if(n)for(j=0;j<n.length;j++){t=n[j];var u=sa[ka[t.target].instance_effect.url].shader;u.material.opacity=!u.material.opacity?1:u.material.opacity;t=o[t.symbol]=
 u.material;p++}n=t||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});l=l.mesh.geometry3js;if(p>1){n=new THREE.MeshFaceMaterial;for(j=0;j<l.faces.length;j++)p=l.faces[j],p.materials=[o[p.daeMaterial]]}if(c!==void 0)k(l,c),n.morphTargets=!0,n=new THREE.SkinnedMesh(l,n),n.skeleton=c.skeleton,n.skinController=oa[c.url],n.skinInstanceController=c,n.name="skin_"+Fa.length,Fa.push(n);else if(e!==void 0){o=l;p=e instanceof v?oa[e.url]:e;if(!p||!p.morph)console.log("could not find morph controller!");
-else{p=p.morph;for(u=0;u<p.targets.length;u++){var w=na[p.targets[u]];if(w.mesh&&w.mesh.primitives&&w.mesh.primitives.length)w=w.mesh.primitives[0].geometry,w.vertices.length===o.vertices.length&&o.morphTargets.push({name:"target_1",vertices:w.vertices})}o.morphTargets.push({name:"target_Z",vertices:o.vertices})}n.morphTargets=!0;n=new THREE.Mesh(l,n);n.name="morph_"+Ca.length;Ca.push(n)}else n=new THREE.Mesh(l,n);a.geometries.length>1?b.add(n):b=n}}b.name=a.id||"";a.matrix.decompose(b.position,b.rotation,
+else{p=p.morph;for(u=0;u<p.targets.length;u++){var w=ma[p.targets[u]];if(w.mesh&&w.mesh.primitives&&w.mesh.primitives.length)w=w.mesh.primitives[0].geometry,w.vertices.length===o.vertices.length&&o.morphTargets.push({name:"target_1",vertices:w.vertices})}o.morphTargets.push({name:"target_Z",vertices:o.vertices})}n.morphTargets=!0;n=new THREE.Mesh(l,n);n.name="morph_"+Ca.length;Ca.push(n)}else n=new THREE.Mesh(l,n);a.geometries.length>1?b.add(n):b=n}}b.name=a.id||"";a.matrix.decompose(b.position,b.rotation,
 b.scale);for(f=0;f<a.nodes.length;f++)b.add(h(a.nodes[f],a));return b}function f(){this.init_from=this.id=""}function l(){this.type=this.name=this.id="";this.morph=this.skin=null}function n(){this.weights=this.targets=this.source=this.method=null}function u(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function t(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function p(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=
 [];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function w(){this.type=this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function v(){this.url="";this.skeleton=[];this.instance_material=[]}function z(){this.target=this.symbol=""}function x(){this.url="";this.instance_material=[]}function y(){this.id="";this.mesh=null}function C(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function A(){}function B(){this.material="";this.count=
 0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function D(){this.source="";this.stride=this.count=0;this.params=[]}function K(){this.input={}}function H(){this.semantic="";this.offset=0;this.source="";this.set=0}function M(a){this.id=a;this.type=null}function V(){this.name=this.id="";this.instance_effect=null}function L(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texcoord=this.texture=null}function W(a,
 b){this.type=a;this.effect=b;this.material=null}function N(a){this.effect=a;this.format=this.init_from=null}function O(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function $(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function Y(){this.url=""}function P(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function o(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=
 this.dotSyntax=this.sid=null}function U(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function Q(a){var b=a.getAttribute("id");if(Z[b]!=void 0)return Z[b];Z[b]=(new M(b)).parse(a);return Z[b]}function aa(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function T(a){for(var a=ra(a),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function J(a){for(var a=ra(a),b=[],c=0;c<
-a.length;c++)b.push(parseInt(a[c],10));return b}function ra(a){return a.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s+/)}function pa(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function la(a,b){if(a===void 0){for(var c="0.";c.length<b+2;)c+="0";return c}b=b||2;c=a.toString().split(".");for(c[1]=c.length>1?c[1].substr(0,b):"0";c[1].length<b;)c[1]+="0";return c.join(".")}function qa(a,b){var c="";c+=la(a.x,b)+",";c+=la(a.y,b)+",";c+=la(a.z,b);return c}var ja=null,ma=null,ea,ca=
-null,Z={},ga={},ha={},oa={},na={},ka={},sa={},Da,Ea,Ca,Fa,za=THREE.SmoothShading;f.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="init_from")this.init_from=c.textContent}return this};l.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.type="none";for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "skin":this.skin=(new u).parse(c);this.type=
+a.length;c++)b.push(parseInt(a[c],10));return b}function ra(a){return a.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s+/)}function pa(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function na(a,b){if(a===void 0){for(var c="0.";c.length<b+2;)c+="0";return c}b=b||2;c=a.toString().split(".");for(c[1]=c.length>1?c[1].substr(0,b):"0";c[1].length<b;)c[1]+="0";return c.join(".")}function qa(a,b){var c="";c+=na(a.x,b)+",";c+=na(a.y,b)+",";c+=na(a.z,b);return c}var ja=null,la=null,ea,ca=
+null,Z={},ga={},ha={},oa={},ma={},ka={},sa={},Da,Ea,Ca,Fa,za=THREE.SmoothShading;f.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="init_from")this.init_from=c.textContent}return this};l.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.type="none";for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "skin":this.skin=(new u).parse(c);this.type=
 c.nodeName;break;case "morph":this.morph=(new n).parse(c),this.type=c.nodeName}}return this};n.prototype.parse=function(a){var b={},c=[],e;this.method=a.getAttribute("method");this.source=a.getAttribute("source").replace(/^#/,"");for(e=0;e<a.childNodes.length;e++){var h=a.childNodes[e];if(h.nodeType==1)switch(h.nodeName){case "source":h=(new M).parse(h);b[h.id]=h;break;case "targets":c=this.parseInputs(h);break;default:console.log(h.nodeName)}}for(e=0;e<c.length;e++)switch(a=c[e],h=b[a.source],a.semantic){case "MORPH_TARGET":this.targets=
 h.read();break;case "MORPH_WEIGHT":this.weights=h.read()}return this};n.prototype.parseInputs=function(a){for(var b=[],c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "input":b.push((new H).parse(e))}}return b};u.prototype.parse=function(a){var b={},c,e;this.source=a.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var h=0;h<a.childNodes.length;h++){var f=a.childNodes[h];if(f.nodeType==1)switch(f.nodeName){case "bind_shape_matrix":f=
 T(f.textContent);this.bindShapeMatrix=new THREE.Matrix4;this.bindShapeMatrix.set(f[0],f[1],f[2],f[3],f[4],f[5],f[6],f[7],f[8],f[9],f[10],f[11],f[12],f[13],f[14],f[15]);break;case "source":f=(new M).parse(f);b[f.id]=f;break;case "joints":c=f;break;case "vertex_weights":e=f;break;default:console.log(f.nodeName)}}this.parseJoints(c,b);this.parseWeights(e,b);return this};u.prototype.parseJoints=function(a,b){for(var c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "input":var e=
@@ -614,7 +614,7 @@ this.name=a.getAttribute("name");this.source={};for(var b=0;b<a.childNodes.lengt
 b.shift(),c=a.indexOf(".")>=0,e=a.indexOf("(")>=0,h,f;if(c)b=a.split("."),a=b.shift(),f=b.shift();else if(e){h=a.split("(");a=h.shift();for(b=0;b<h.length;b++)h[b]=parseInt(h[b].replace(/\)/,""))}this.sid=a;this.dotSyntax=c;this.arrSyntax=e;this.arrIndices=h;this.member=f;return this};U.prototype.parse=function(a){this.id=a.getAttribute("id");this.inputs=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "input":this.inputs.push((new H).parse(c))}}return this};
 U.prototype.create=function(){for(var a=0;a<this.inputs.length;a++){var b=this.inputs[a],c=this.animation.source[b.source];switch(b.semantic){case "INPUT":this.input=c.read();break;case "OUTPUT":this.output=c.read();break;case "INTERPOLATION":this.interpolation=c.read();break;case "IN_TANGENT":break;case "OUT_TANGENT":break;default:console.log(b.semantic)}}this.duration=this.endTime=this.startTime=0;if(this.input.length){this.startTime=1E8;this.endTime=-1E8;for(a=0;a<this.input.length;a++)this.startTime=
 Math.min(this.startTime,this.input[a]),this.endTime=Math.max(this.endTime,this.input[a]);this.duration=this.endTime-this.startTime}};return{load:function(b,c){if(document.implementation&&document.implementation.createDocument){document.implementation.createDocument("http://www.collada.org/2005/11/COLLADASchema","COLLADA",null);b+="?rnd="+Math.random();var e=new XMLHttpRequest;e.overrideMimeType&&e.overrideMimeType("text/xml");e.onreadystatechange=function(){if(e.readyState==4&&(e.status==0||e.status==
-200))ca=c,a(e.responseXML,void 0,b)};e.open("GET",b,!0);e.send(null)}else alert("Don't know how to parse XML!")},parse:a,setPreferredShading:function(a){za=a},applySkin:k,geometries:na}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
+200))ca=c,a(e.responseXML,void 0,b)};e.open("GET",b,!0);e.send(null)}else alert("Don't know how to parse XML!")},parse:a,setPreferredShading:function(a){za=a},applySkin:k,geometries:ma}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
 THREE.JSONLoader.prototype.load=function(a,c,b){var e,k=this;if(a instanceof Object)console.warn("DEPRECATED: JSONLoader( parameters ) is now JSONLoader( url, callback, texturePath )."),e=a,a=e.model,c=e.callback,b=e.texture_path;e=new Worker(a);b=b?b:this.extractUrlbase(a);e.onmessage=function(a){k.createModel(a.data,c,b);k.onLoadComplete()};this.onLoadStart();e.postMessage(Date.now())};
 THREE.JSONLoader.prototype.createModel=function(a,c,b){var e=new THREE.Geometry,k=a.scale!==void 0?1/a.scale:1;this.initMaterials(e,a.materials,b);(function(b){if(a.version===void 0||a.version!=2)console.error("Deprecated file format.");else{var c,k,n,u,t,p,w,v,z,x,y,C,A,B,D=a.faces;p=a.vertices;var K=a.normals,H=a.colors,M=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&M++;for(c=0;c<M;c++)e.faceUvs[c]=[],e.faceVertexUvs[c]=[];u=0;for(t=p.length;u<t;)w=new THREE.Vertex,w.position.x=p[u++]*b,w.position.y=
 p[u++]*b,w.position.z=p[u++]*b,e.vertices.push(w);u=0;for(t=D.length;u<t;){b=D[u++];p=b&1;n=b&2;c=b&4;k=b&8;v=b&16;w=b&32;x=b&64;b&=128;p?(y=new THREE.Face4,y.a=D[u++],y.b=D[u++],y.c=D[u++],y.d=D[u++],p=4):(y=new THREE.Face3,y.a=D[u++],y.b=D[u++],y.c=D[u++],p=3);if(n)n=D[u++],y.materialIndex=n;n=e.faces.length;if(c)for(c=0;c<M;c++)C=a.uvs[c],z=D[u++],B=C[z*2],z=C[z*2+1],e.faceUvs[c][n]=new THREE.UV(B,z);if(k)for(c=0;c<M;c++){C=a.uvs[c];A=[];for(k=0;k<p;k++)z=D[u++],B=C[z*2],z=C[z*2+1],A[k]=new THREE.UV(B,

+ 37 - 37
build/custom/ThreeCanvas.js

@@ -26,8 +26,8 @@ THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var a,b=
 THREE.Matrix4=function(a,b,c,d,f,e,g,h,l,m,j,i,o,n,p,k){this.set(a!==void 0?a:1,b||0,c||0,d||0,f||0,e!==void 0?e:1,g||0,h||0,l||0,m||0,j!==void 0?j:1,i||0,o||0,n||0,p||0,k!==void 0?k:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
 THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,f,e,g,h,l,m,j,i,o,n,p,k){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=f;this.n22=e;this.n23=g;this.n24=h;this.n31=l;this.n32=m;this.n33=j;this.n34=i;this.n41=o;this.n42=n;this.n43=p;this.n44=k;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,
 b,c){var d=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,e=THREE.Matrix4.__v3;e.sub(a,b).normalize();if(e.length()===0)e.z=1;d.cross(c,e).normalize();d.length()===0&&(e.x+=1.0E-4,d.cross(c,e).normalize());f.cross(e,d).normalize();this.n11=d.x;this.n12=f.x;this.n13=e.x;this.n21=d.y;this.n22=f.y;this.n23=e.y;this.n31=d.z;this.n32=f.z;this.n33=e.z;return this},multiply:function(a,b){var c=a.n11,d=a.n12,f=a.n13,e=a.n14,g=a.n21,h=a.n22,l=a.n23,m=a.n24,j=a.n31,i=a.n32,o=a.n33,n=a.n34,p=a.n41,k=a.n42,u=a.n43,
-v=a.n44,F=b.n11,H=b.n12,M=b.n13,K=b.n14,N=b.n21,L=b.n22,I=b.n23,s=b.n24,y=b.n31,G=b.n32,U=b.n33,R=b.n34,P=b.n41,t=b.n42,z=b.n43,r=b.n44;this.n11=c*F+d*N+f*y+e*P;this.n12=c*H+d*L+f*G+e*t;this.n13=c*M+d*I+f*U+e*z;this.n14=c*K+d*s+f*R+e*r;this.n21=g*F+h*N+l*y+m*P;this.n22=g*H+h*L+l*G+m*t;this.n23=g*M+h*I+l*U+m*z;this.n24=g*K+h*s+l*R+m*r;this.n31=j*F+i*N+o*y+n*P;this.n32=j*H+i*L+o*G+n*t;this.n33=j*M+i*I+o*U+n*z;this.n34=j*K+i*s+o*R+n*r;this.n41=p*F+k*N+u*y+v*P;this.n42=p*H+k*L+u*G+v*t;this.n43=p*M+k*
-I+u*U+v*z;this.n44=p*K+k*s+u*R+v*r;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=
+x=a.n44,E=b.n11,G=b.n12,M=b.n13,I=b.n14,N=b.n21,L=b.n22,K=b.n23,s=b.n24,y=b.n31,J=b.n32,S=b.n33,T=b.n34,P=b.n41,t=b.n42,z=b.n43,r=b.n44;this.n11=c*E+d*N+f*y+e*P;this.n12=c*G+d*L+f*J+e*t;this.n13=c*M+d*K+f*S+e*z;this.n14=c*I+d*s+f*T+e*r;this.n21=g*E+h*N+l*y+m*P;this.n22=g*G+h*L+l*J+m*t;this.n23=g*M+h*K+l*S+m*z;this.n24=g*I+h*s+l*T+m*r;this.n31=j*E+i*N+o*y+n*P;this.n32=j*G+i*L+o*J+n*t;this.n33=j*M+i*K+o*S+n*z;this.n34=j*I+i*s+o*T+n*r;this.n41=p*E+k*N+u*y+x*P;this.n42=p*G+k*L+u*J+x*t;this.n43=p*M+k*
+K+u*S+x*z;this.n44=p*I+k*s+u*T+x*r;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=
 a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},multiplyVector3:function(a){var b=a.x,c=a.y,d=a.z,f=1/(this.n41*b+this.n42*c+this.n43*d+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*d+this.n14)*f;a.y=(this.n21*b+this.n22*c+this.n23*d+this.n24)*f;a.z=(this.n31*b+this.n32*c+this.n33*d+this.n34)*f;return a},multiplyVector4:function(a){var b=a.x,c=a.y,d=a.z,f=a.w;a.x=this.n11*b+this.n12*c+this.n13*d+this.n14*f;a.y=this.n21*b+this.n22*
 c+this.n23*d+this.n24*f;a.z=this.n31*b+this.n32*c+this.n33*d+this.n34*f;a.w=this.n41*b+this.n42*c+this.n43*d+this.n44*f;return a},rotateAxis:function(a){var b=a.x,c=a.y,d=a.z;a.x=b*this.n11+c*this.n12+d*this.n13;a.y=b*this.n21+c*this.n22+d*this.n23;a.z=b*this.n31+c*this.n32+d*this.n33;a.normalize();return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*
 a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,d=this.n14,f=this.n21,e=this.n22,g=this.n23,h=this.n24,l=this.n31,m=this.n32,j=this.n33,i=this.n34,o=this.n41,n=this.n42,p=this.n43,k=this.n44;return d*g*m*o-c*h*m*o-d*e*j*o+b*h*j*o+c*e*i*o-b*g*i*o-d*g*l*n+c*h*l*n+d*f*j*n-a*h*j*n-c*f*i*n+a*g*i*n+d*e*l*p-b*h*l*p-d*f*m*p+a*h*m*p+b*f*i*p-a*e*i*p-c*e*l*k+b*g*l*k+c*f*m*k-a*g*m*k-b*f*j*k+a*e*j*k},transpose:function(){var a;
@@ -53,18 +53,18 @@ THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(a,b){thi
 -1)a.parent!==void 0&&a.parent.remove(a),a.parent=this,this.children.push(a)},remove:function(a){var b=this.children.indexOf(a);if(b!==-1)a.parent=void 0,this.children.splice(b,1)},getChildByName:function(a,b){var c,d,f;c=0;for(d=this.children.length;c<d;c++){f=this.children[c];if(f.name===a)return f;if(b&&(f=f.getChildByName(a,b),f!==void 0))return f}},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 b=0,c=this.children.length;b<
 c;b++)this.children[b].updateMatrixWorld(a)}};THREE.Object3DCount=0;
-THREE.Projector=function(){function a(){var a=e[f]=e[f]||new THREE.RenderableVertex;f++;return a}function b(a,b){return b.z-a.z}function c(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;return e>=0&&f>=0&&g>=0&&h>=0?!0:e<0&&f<0||g<0&&h<0?!1:(e<0?c=Math.max(c,e/(e-f)):f<0&&(d=Math.min(d,e/(e-f))),g<0?c=Math.max(c,g/(g-h)):h<0&&(d=Math.min(d,g/(g-h))),d<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-d),!0))}var d,f,e=[],g,h,l=[],m,j=[],i,o,n=[],p,k,u=[],v={objects:[],lines:[],sprites:[],lights:[],
-elements:[]};new THREE.Vector3;var F=new THREE.Vector4,H=new THREE.Matrix4,M=new THREE.Matrix4,K=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],N=new THREE.Vector4,L=new THREE.Vector4;this.computeFrustum=function(a){K[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);K[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);K[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);K[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-
-a.n24);K[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);K[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=K[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);H.multiply(b.projectionMatrix,b.matrixWorldInverse);H.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);H.multiply(b.matrixWorld,b.projectionMatrixInverse);
-H.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(a){v.objects.length=0;v.lines.length=0;v.sprites.length=0;v.lights.length=0;var b=function(a){if(a.visible!=!1){var c;if(c=a instanceof THREE.Mesh)if(!(c=a.frustumCulled==!1))a:{for(var d=a.matrixWorld,e=-a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,
-a.scale.z)),f=0;f<6;f++)if(c=K[f].x*d.n14+K[f].y*d.n24+K[f].z*d.n34+K[f].w,c<=e){c=!1;break a}c=!0}c?v.objects.push(a):a instanceof THREE.Line?v.lines.push(a):a instanceof THREE.Sprite||a instanceof THREE.Particle?v.sprites.push(a):a instanceof THREE.Light&&v.lights.push(a);c=0;for(d=a.children.length;c<d;c++)b(a.children[c])}};b(a);return v};this.projectScene=function(I,s,y){var G=s.near,K=s.far,R,P,t,z,r,D,x,J,E,T,Z,ba,ga,da,w,A;k=o=m=h=0;v.elements.length=0;s.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),
-I.add(s));I.updateMatrixWorld();s.matrixWorldInverse.getInverse(s.matrixWorld);H.multiply(s.projectionMatrix,s.matrixWorldInverse);this.computeFrustum(H);v=this.projectGraph(I);I=0;for(R=v.objects.length;I<R;I++)if(E=v.objects[I],T=E.matrixWorld,ba=E.material,f=0,E instanceof THREE.Mesh){Z=E.geometry;ga=E.geometry.materials;z=Z.vertices;da=Z.faces;w=Z.faceVertexUvs;Z=E.matrixRotationWorld.extractRotation(T);P=0;for(t=z.length;P<t;P++)d=a(),d.positionWorld.copy(z[P].position),T.multiplyVector3(d.positionWorld),
-d.positionScreen.copy(d.positionWorld),H.multiplyVector4(d.positionScreen),d.positionScreen.x/=d.positionScreen.w,d.positionScreen.y/=d.positionScreen.w,d.visible=d.positionScreen.z>G&&d.positionScreen.z<K;z=0;for(P=da.length;z<P;z++){t=da[z];if(t instanceof THREE.Face3)if(r=e[t.a],D=e[t.b],x=e[t.c],r.visible&&D.visible&&x.visible&&(E.doubleSided||E.flipSided!=(x.positionScreen.x-r.positionScreen.x)*(D.positionScreen.y-r.positionScreen.y)-(x.positionScreen.y-r.positionScreen.y)*(D.positionScreen.x-
-r.positionScreen.x)<0))J=l[h]=l[h]||new THREE.RenderableFace3,h++,g=J,g.v1.copy(r),g.v2.copy(D),g.v3.copy(x);else continue;else if(t instanceof THREE.Face4)if(r=e[t.a],D=e[t.b],x=e[t.c],J=e[t.d],r.visible&&D.visible&&x.visible&&J.visible&&(E.doubleSided||E.flipSided!=((J.positionScreen.x-r.positionScreen.x)*(D.positionScreen.y-r.positionScreen.y)-(J.positionScreen.y-r.positionScreen.y)*(D.positionScreen.x-r.positionScreen.x)<0||(D.positionScreen.x-x.positionScreen.x)*(J.positionScreen.y-x.positionScreen.y)-
-(D.positionScreen.y-x.positionScreen.y)*(J.positionScreen.x-x.positionScreen.x)<0)))A=j[m]=j[m]||new THREE.RenderableFace4,m++,g=A,g.v1.copy(r),g.v2.copy(D),g.v3.copy(x),g.v4.copy(J);else continue;g.normalWorld.copy(t.normal);Z.multiplyVector3(g.normalWorld);g.centroidWorld.copy(t.centroid);T.multiplyVector3(g.centroidWorld);g.centroidScreen.copy(g.centroidWorld);H.multiplyVector3(g.centroidScreen);x=t.vertexNormals;r=0;for(D=x.length;r<D;r++)J=g.vertexNormalsWorld[r],J.copy(x[r]),Z.multiplyVector3(J);
-r=0;for(D=w.length;r<D;r++)if(A=w[r][z]){x=0;for(J=A.length;x<J;x++)g.uvs[r][x]=A[x]}g.material=ba;g.faceMaterial=t.materialIndex!==null?ga[t.materialIndex]:null;g.z=g.centroidScreen.z;v.elements.push(g)}}I=0;for(R=v.lines.length;I<R;I++)if(E=v.lines[I],T=E.matrixWorld,ba=E.material,f=0,E instanceof THREE.Line){M.multiply(H,T);z=E.geometry.vertices;r=a();r.positionScreen.copy(z[0].position);M.multiplyVector4(r.positionScreen);P=1;for(t=z.length;P<t;P++)if(r=a(),r.positionScreen.copy(z[P].position),
-M.multiplyVector4(r.positionScreen),D=e[f-2],N.copy(r.positionScreen),L.copy(D.positionScreen),c(N,L))N.multiplyScalar(1/N.w),L.multiplyScalar(1/L.w),G=n[o]=n[o]||new THREE.RenderableLine,o++,i=G,i.v1.positionScreen.copy(N),i.v2.positionScreen.copy(L),i.z=Math.max(N.z,L.z),i.material=ba,v.elements.push(i)}I=0;for(R=v.sprites.length;I<R;I++)if(E=v.sprites[I],T=E.matrixWorld,E instanceof THREE.Particle&&(F.set(T.n14,T.n24,T.n34,1),H.multiplyVector4(F),F.z/=F.w,F.z>0&&F.z<1))G=u[k]=u[k]||new THREE.RenderableParticle,
-k++,p=G,p.x=F.x/F.w,p.y=F.y/F.w,p.z=F.z,p.rotation=E.rotation.z,p.scale.x=E.scale.x*Math.abs(p.x-(F.x+s.projectionMatrix.n11)/(F.w+s.projectionMatrix.n14)),p.scale.y=E.scale.y*Math.abs(p.y-(F.y+s.projectionMatrix.n22)/(F.w+s.projectionMatrix.n24)),p.material=E.material,v.elements.push(p);y&&v.elements.sort(b);return v}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==void 0?d:1)};
+THREE.Projector=function(){function a(){var a=e[f]=e[f]||new THREE.RenderableVertex;f++;return a}function b(a,b){return b.z-a.z}function c(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;return e>=0&&f>=0&&g>=0&&h>=0?!0:e<0&&f<0||g<0&&h<0?!1:(e<0?c=Math.max(c,e/(e-f)):f<0&&(d=Math.min(d,e/(e-f))),g<0?c=Math.max(c,g/(g-h)):h<0&&(d=Math.min(d,g/(g-h))),d<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-d),!0))}var d,f,e=[],g,h,l=[],m,j=[],i,o,n=[],p,k,u=[],x={objects:[],sprites:[],lights:[],elements:[]};
+new THREE.Vector3;var E=new THREE.Vector4,G=new THREE.Matrix4,M=new THREE.Matrix4,I=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],N=new THREE.Vector4,L=new THREE.Vector4;this.computeFrustum=function(a){I[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);I[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);I[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);I[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);I[4].set(a.n41-
+a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);I[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=I[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);G.multiply(b.projectionMatrix,b.matrixWorldInverse);G.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);G.multiply(b.matrixWorld,b.projectionMatrixInverse);G.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(a){x.objects.length=0;x.sprites.length=0;x.lights.length=0;var b=function(a){if(a.visible!=!1){var c;if(c=a instanceof THREE.Mesh)if(!(c=a.frustumCulled==!1))a:{for(var d=a.matrixWorld,e=-a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)),f=0;f<6;f++)if(c=
+I[f].x*d.n14+I[f].y*d.n24+I[f].z*d.n34+I[f].w,c<=e){c=!1;break a}c=!0}c?x.objects.push(a):a instanceof THREE.Line?x.objects.push(a):a instanceof THREE.Sprite||a instanceof THREE.Particle?x.sprites.push(a):a instanceof THREE.Light&&x.lights.push(a);c=0;for(d=a.children.length;c<d;c++)b(a.children[c])}};b(a);return x};this.projectScene=function(K,s,y){var J=s.near,I=s.far,T,P,t,z,r,D,w,H,F,U,Z,ca,ga,da,v,A;k=o=m=h=0;x.elements.length=0;s.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),
+K.add(s));K.updateMatrixWorld();s.matrixWorldInverse.getInverse(s.matrixWorld);G.multiply(s.projectionMatrix,s.matrixWorldInverse);this.computeFrustum(G);x=this.projectGraph(K);K=0;for(T=x.objects.length;K<T;K++)if(F=x.objects[K],U=F.matrixWorld,ca=F.material,f=0,F instanceof THREE.Mesh){Z=F.geometry;ga=F.geometry.materials;z=Z.vertices;da=Z.faces;v=Z.faceVertexUvs;Z=F.matrixRotationWorld.extractRotation(U);P=0;for(t=z.length;P<t;P++)d=a(),d.positionWorld.copy(z[P].position),U.multiplyVector3(d.positionWorld),
+d.positionScreen.copy(d.positionWorld),G.multiplyVector4(d.positionScreen),d.positionScreen.x/=d.positionScreen.w,d.positionScreen.y/=d.positionScreen.w,d.visible=d.positionScreen.z>J&&d.positionScreen.z<I;z=0;for(P=da.length;z<P;z++){t=da[z];if(t instanceof THREE.Face3)if(r=e[t.a],D=e[t.b],w=e[t.c],r.visible&&D.visible&&w.visible&&(F.doubleSided||F.flipSided!=(w.positionScreen.x-r.positionScreen.x)*(D.positionScreen.y-r.positionScreen.y)-(w.positionScreen.y-r.positionScreen.y)*(D.positionScreen.x-
+r.positionScreen.x)<0))H=l[h]=l[h]||new THREE.RenderableFace3,h++,g=H,g.v1.copy(r),g.v2.copy(D),g.v3.copy(w);else continue;else if(t instanceof THREE.Face4)if(r=e[t.a],D=e[t.b],w=e[t.c],H=e[t.d],r.visible&&D.visible&&w.visible&&H.visible&&(F.doubleSided||F.flipSided!=((H.positionScreen.x-r.positionScreen.x)*(D.positionScreen.y-r.positionScreen.y)-(H.positionScreen.y-r.positionScreen.y)*(D.positionScreen.x-r.positionScreen.x)<0||(D.positionScreen.x-w.positionScreen.x)*(H.positionScreen.y-w.positionScreen.y)-
+(D.positionScreen.y-w.positionScreen.y)*(H.positionScreen.x-w.positionScreen.x)<0)))A=j[m]=j[m]||new THREE.RenderableFace4,m++,g=A,g.v1.copy(r),g.v2.copy(D),g.v3.copy(w),g.v4.copy(H);else continue;g.normalWorld.copy(t.normal);Z.multiplyVector3(g.normalWorld);g.centroidWorld.copy(t.centroid);U.multiplyVector3(g.centroidWorld);g.centroidScreen.copy(g.centroidWorld);G.multiplyVector3(g.centroidScreen);w=t.vertexNormals;r=0;for(D=w.length;r<D;r++)H=g.vertexNormalsWorld[r],H.copy(w[r]),Z.multiplyVector3(H);
+r=0;for(D=v.length;r<D;r++)if(A=v[r][z]){w=0;for(H=A.length;w<H;w++)g.uvs[r][w]=A[w]}g.material=ca;g.faceMaterial=t.materialIndex!==null?ga[t.materialIndex]:null;g.z=g.centroidScreen.z;x.elements.push(g)}}else if(F instanceof THREE.Line){M.multiply(G,U);z=F.geometry.vertices;r=a();r.positionScreen.copy(z[0].position);M.multiplyVector4(r.positionScreen);P=1;for(t=z.length;P<t;P++)if(r=a(),r.positionScreen.copy(z[P].position),M.multiplyVector4(r.positionScreen),D=e[f-2],N.copy(r.positionScreen),L.copy(D.positionScreen),
+c(N,L))N.multiplyScalar(1/N.w),L.multiplyScalar(1/L.w),F=n[o]=n[o]||new THREE.RenderableLine,o++,i=F,i.v1.positionScreen.copy(N),i.v2.positionScreen.copy(L),i.z=Math.max(N.z,L.z),i.material=ca,x.elements.push(i)}K=0;for(T=x.sprites.length;K<T;K++)if(F=x.sprites[K],U=F.matrixWorld,F instanceof THREE.Particle&&(E.set(U.n14,U.n24,U.n34,1),G.multiplyVector4(E),E.z/=E.w,E.z>0&&E.z<1))J=u[k]=u[k]||new THREE.RenderableParticle,k++,p=J,p.x=E.x/E.w,p.y=E.y/E.w,p.z=E.z,p.rotation=F.rotation.z,p.scale.x=F.scale.x*
+Math.abs(p.x-(E.x+s.projectionMatrix.n11)/(E.w+s.projectionMatrix.n14)),p.scale.y=F.scale.y*Math.abs(p.y-(E.y+s.projectionMatrix.n22)/(E.w+s.projectionMatrix.n24)),p.material=F.material,x.elements.push(p);y&&x.elements.sort(b);return x}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==void 0?d:1)};
 THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;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 b=Math.PI/360,c=a.x*b,d=a.y*b,f=a.z*b,a=Math.cos(d),d=Math.sin(d),b=Math.cos(-f),f=Math.sin(-f),e=Math.cos(c),c=Math.sin(c),g=a*b,h=d*f;this.w=g*e-h*c;this.x=g*c+h*e;this.y=d*b*e+a*f*c;this.z=a*f*e-d*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);
 this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,b+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,b+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,b-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,b-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 b=
@@ -80,9 +80,9 @@ b;a++)c=this.faces[a],c.centroid.set(0,0,0),c instanceof THREE.Face3?(c.centroid
 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,t){h=a.vertices[b].position;l=a.vertices[c].position;m=a.vertices[d].position;j=g[e];i=g[f];o=g[t];n=l.x-h.x;p=m.x-h.x;k=l.y-h.y;u=m.y-h.y;v=l.z-h.z;F=m.z-h.z;H=i.u-j.u;M=o.u-j.u;K=i.v-j.v;N=o.v-j.v;L=1/(H*N-M*K);G.set((N*n-K*p)*L,(N*k-K*u)*L,(N*v-K*F)*L);U.set((H*p-M*n)*L,(H*u-M*k)*L,(H*F-M*v)*L);s[b].addSelf(G);s[c].addSelf(G);s[d].addSelf(G);y[b].addSelf(U);
-y[c].addSelf(U);y[d].addSelf(U)}var b,c,d,f,e,g,h,l,m,j,i,o,n,p,k,u,v,F,H,M,K,N,L,I,s=[],y=[],G=new THREE.Vector3,U=new THREE.Vector3,R=new THREE.Vector3,P=new THREE.Vector3,t=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)s[b]=new THREE.Vector3,y[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 z=["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++)t.copy(e.vertexNormals[d]),f=e[z[d]],I=s[f],R.copy(I),R.subSelf(t.multiplyScalar(t.dot(I))).normalize(),P.cross(e.vertexNormals[d],I),f=P.dot(y[f]),f=f<0?-1:1,e.vertexTangents[d]=new THREE.Vector4(R.x,R.y,R.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,
+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,t){h=a.vertices[b].position;l=a.vertices[c].position;m=a.vertices[d].position;j=g[e];i=g[f];o=g[t];n=l.x-h.x;p=m.x-h.x;k=l.y-h.y;u=m.y-h.y;x=l.z-h.z;E=m.z-h.z;G=i.u-j.u;M=o.u-j.u;I=i.v-j.v;N=o.v-j.v;L=1/(G*N-M*I);J.set((N*n-I*p)*L,(N*k-I*u)*L,(N*x-I*E)*L);S.set((G*p-M*n)*L,(G*u-M*k)*L,(G*E-M*x)*L);s[b].addSelf(J);s[c].addSelf(J);s[d].addSelf(J);y[b].addSelf(S);
+y[c].addSelf(S);y[d].addSelf(S)}var b,c,d,f,e,g,h,l,m,j,i,o,n,p,k,u,x,E,G,M,I,N,L,K,s=[],y=[],J=new THREE.Vector3,S=new THREE.Vector3,T=new THREE.Vector3,P=new THREE.Vector3,t=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)s[b]=new THREE.Vector3,y[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 z=["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++)t.copy(e.vertexNormals[d]),f=e[z[d]],K=s[f],T.copy(K),T.subSelf(t.multiplyScalar(t.dot(K))).normalize(),P.cross(e.vertexNormals[d],K),f=P.dot(y[f]),f=f<0?-1:1,e.vertexTangents[d]=new THREE.Vector4(T.x,T.y,T.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;
@@ -120,33 +120,33 @@ this.geometry.morphTargets.length;c++)this.morphTargetInfluences.push(0),this.mo
 THREE.Mesh.prototype.getMorphTargetIndexByName=function(a){if(this.morphTargetDictionary[a]!==void 0)return this.morphTargetDictionary[a];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+a+" does not exist. Returning 0.");return 0};THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
 THREE.Bone.prototype.update=function(a,b,c){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate)a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,b=!0;var d,f=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(d=0;d<f;d++)a=this.children[d],a instanceof THREE.Bone?a.update(this.skinMatrix,b,c):a.update(this.matrixWorld,!0,c)}else for(d=0;d<f;d++)this.children[d].update(this.skinMatrix,
 b,c)};THREE.Bone.prototype.add=function(a){if(this.children.indexOf(a)===-1&&(a.parent!==void 0&&a.parent.removeChild(a),a.parent=this,this.children.push(a),!(a instanceof THREE.Bone)))this.hasNoneBoneChildren=!0};THREE.Scene=function(){THREE.Object3D.call(this);this.overrideMaterial=this.fog=null;this.matrixAutoUpdate=!1};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;
-THREE.CanvasRenderer=function(a){function b(a){if(F!=a)k.globalAlpha=F=a}function c(a){if(H!=a){switch(a){case THREE.NormalBlending:k.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:k.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:k.globalCompositeOperation="darker"}H=a}}function d(a){if(M!=a)k.strokeStyle=M=a}function f(a){if(K!=a)k.fillStyle=K=a}var e=this,g,h,l,m=new THREE.Projector,a=a||{},j=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
-i,o,n,p,k=j.getContext("2d"),u=new THREE.Color(0),v=0,F=1,H=0,M=null,K=null,N=null,L=null,I=null,s,y,G,U,R=new THREE.RenderableVertex,P=new THREE.RenderableVertex,t,z,r,D,x,J,E,T,Z,ba,ga,da,w=new THREE.Color,A=new THREE.Color,B=new THREE.Color,C=new THREE.Color,O=new THREE.Color,wa=[],ea,fa,ca,Y,Aa,Ba,Ca,Da,Ea,Fa,ka=new THREE.Rectangle,W=new THREE.Rectangle,V=new THREE.Rectangle,xa=!1,X=new THREE.Color,ra=new THREE.Color,sa=new THREE.Color,Q=new THREE.Vector3,oa,pa,ya,$,qa,ta,a=16;oa=document.createElement("canvas");
-oa.width=oa.height=2;pa=oa.getContext("2d");pa.fillStyle="rgba(0,0,0,1)";pa.fillRect(0,0,2,2);ya=pa.getImageData(0,0,2,2);$=ya.data;qa=document.createElement("canvas");qa.width=qa.height=a;ta=qa.getContext("2d");ta.translate(-a/2,-a/2);ta.scale(a,a);a--;this.domElement=j;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){i=a;o=b;n=Math.floor(i/2);p=Math.floor(o/2);j.width=i;j.height=o;ka.set(-n,-p,n,p);W.set(-n,-p,n,p);F=1;H=0;I=
-L=N=K=M=null};this.setClearColor=function(a,b){u.copy(a);v=b;W.set(-n,-p,n,p)};this.setClearColorHex=function(a,b){u.setHex(a);v=b;W.set(-n,-p,n,p)};this.clear=function(){k.setTransform(1,0,0,-1,n,p);W.isEmpty()||(W.minSelf(ka),W.inflate(2),v<1&&k.clearRect(Math.floor(W.getX()),Math.floor(W.getY()),Math.floor(W.getWidth()),Math.floor(W.getHeight())),v>0&&(c(THREE.NormalBlending),b(1),f("rgba("+Math.floor(u.r*255)+","+Math.floor(u.g*255)+","+Math.floor(u.b*255)+","+v+")"),k.fillRect(Math.floor(W.getX()),
+THREE.CanvasRenderer=function(a){function b(a){if(E!=a)k.globalAlpha=E=a}function c(a){if(G!=a){switch(a){case THREE.NormalBlending:k.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:k.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:k.globalCompositeOperation="darker"}G=a}}function d(a){if(M!=a)k.strokeStyle=M=a}function f(a){if(I!=a)k.fillStyle=I=a}var e=this,g,h,l,m=new THREE.Projector,a=a||{},j=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
+i,o,n,p,k=j.getContext("2d"),u=new THREE.Color(0),x=0,E=1,G=0,M=null,I=null,N=null,L=null,K=null,s,y,J,S,T=new THREE.RenderableVertex,P=new THREE.RenderableVertex,t,z,r,D,w,H,F,U,Z,ca,ga,da,v=new THREE.Color,A=new THREE.Color,B=new THREE.Color,C=new THREE.Color,O=new THREE.Color,wa=[],ea,fa,ba,Y,Aa,Ba,Ca,Da,Ea,Fa,ka=new THREE.Rectangle,W=new THREE.Rectangle,V=new THREE.Rectangle,xa=!1,X=new THREE.Color,ra=new THREE.Color,sa=new THREE.Color,Q=new THREE.Vector3,oa,pa,ya,$,qa,ta,a=16;oa=document.createElement("canvas");
+oa.width=oa.height=2;pa=oa.getContext("2d");pa.fillStyle="rgba(0,0,0,1)";pa.fillRect(0,0,2,2);ya=pa.getImageData(0,0,2,2);$=ya.data;qa=document.createElement("canvas");qa.width=qa.height=a;ta=qa.getContext("2d");ta.translate(-a/2,-a/2);ta.scale(a,a);a--;this.domElement=j;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){i=a;o=b;n=Math.floor(i/2);p=Math.floor(o/2);j.width=i;j.height=o;ka.set(-n,-p,n,p);W.set(-n,-p,n,p);E=1;G=0;K=
+L=N=I=M=null};this.setClearColor=function(a,b){u.copy(a);x=b;W.set(-n,-p,n,p)};this.setClearColorHex=function(a,b){u.setHex(a);x=b;W.set(-n,-p,n,p)};this.clear=function(){k.setTransform(1,0,0,-1,n,p);W.isEmpty()||(W.minSelf(ka),W.inflate(2),x<1&&k.clearRect(Math.floor(W.getX()),Math.floor(W.getY()),Math.floor(W.getWidth()),Math.floor(W.getHeight())),x>0&&(c(THREE.NormalBlending),b(1),f("rgba("+Math.floor(u.r*255)+","+Math.floor(u.g*255)+","+Math.floor(u.b*255)+","+x+")"),k.fillRect(Math.floor(W.getX()),
 Math.floor(W.getY()),Math.floor(W.getWidth()),Math.floor(W.getHeight()))),W.empty())};this.render=function(a,j){function i(a){var b,c,d,e;X.setRGB(0,0,0);ra.setRGB(0,0,0);sa.setRGB(0,0,0);b=0;for(c=a.length;b<c;b++)d=a[b],e=d.color,d instanceof THREE.AmbientLight?(X.r+=e.r,X.g+=e.g,X.b+=e.b):d instanceof THREE.DirectionalLight?(ra.r+=e.r,ra.g+=e.g,ra.b+=e.b):d instanceof THREE.PointLight&&(sa.r+=e.r,sa.g+=e.g,sa.b+=e.b)}function o(a,b,c,d){var e,f,g,h,k,j;e=0;for(f=a.length;e<f;e++)g=a[e],h=g.color,
 g instanceof THREE.DirectionalLight?(k=g.matrixWorld.getPosition(),j=c.dot(k),j<=0||(j*=g.intensity,d.r+=h.r*j,d.g+=h.g*j,d.b+=h.b*j)):g instanceof THREE.PointLight&&(k=g.matrixWorld.getPosition(),j=c.dot(Q.sub(k,b).normalize()),j<=0||(j*=g.distance==0?1:1-Math.min(b.distanceTo(k)/g.distance,1),j!=0&&(j*=g.intensity,d.r+=h.r*j,d.g+=h.g*j,d.b+=h.b*j)))}function u(a,e,g){b(g.opacity);c(g.blending);var h,j,l,i,q,o;if(g instanceof THREE.ParticleBasicMaterial){if(g.map)i=g.map.image,q=i.width>>1,o=i.height>>
-1,g=e.scale.x*n,l=e.scale.y*p,h=g*q,j=l*o,V.set(a.x-h,a.y-j,a.x+h,a.y+j),ka.intersects(V)&&(k.save(),k.translate(a.x,a.y),k.rotate(-e.rotation),k.scale(g,-l),k.translate(-q,-o),k.drawImage(i,0,0),k.restore())}else g instanceof THREE.ParticleCanvasMaterial&&(h=e.scale.x*n,j=e.scale.y*p,V.set(a.x-h,a.y-j,a.x+h,a.y+j),ka.intersects(V)&&(d(g.color.getContextStyle()),f(g.color.getContextStyle()),k.save(),k.translate(a.x,a.y),k.rotate(-e.rotation),k.scale(h,j),g.program(k),k.restore()))}function v(a,e,
-f,g){b(g.opacity);c(g.blending);k.beginPath();k.moveTo(a.positionScreen.x,a.positionScreen.y);k.lineTo(e.positionScreen.x,e.positionScreen.y);k.closePath();if(g instanceof THREE.LineBasicMaterial){a=g.linewidth;if(N!=a)k.lineWidth=N=a;a=g.linecap;if(L!=a)k.lineCap=L=a;a=g.linejoin;if(I!=a)k.lineJoin=I=a;d(g.color.getContextStyle());k.stroke();V.inflate(g.linewidth*2)}}function F(a,d,f,g,h,k,i,q){e.info.render.vertices+=3;e.info.render.faces++;b(q.opacity);c(q.blending);t=a.positionScreen.x;z=a.positionScreen.y;
-r=d.positionScreen.x;D=d.positionScreen.y;x=f.positionScreen.x;J=f.positionScreen.y;H(t,z,r,D,x,J);if(q instanceof THREE.MeshBasicMaterial)if(q.map)q.map.mapping instanceof THREE.UVMapping&&(Y=i.uvs[0],za(t,z,r,D,x,J,Y[g].u,Y[g].v,Y[h].u,Y[h].v,Y[k].u,Y[k].v,q.map));else if(q.envMap){if(q.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=j.matrixWorldInverse,Q.copy(i.vertexNormalsWorld[g]),Aa=(Q.x*a.n11+Q.y*a.n12+Q.z*a.n13)*0.5+0.5,Ba=-(Q.x*a.n21+Q.y*a.n22+Q.z*a.n23)*0.5+0.5,Q.copy(i.vertexNormalsWorld[h]),
-Ca=(Q.x*a.n11+Q.y*a.n12+Q.z*a.n13)*0.5+0.5,Da=-(Q.x*a.n21+Q.y*a.n22+Q.z*a.n23)*0.5+0.5,Q.copy(i.vertexNormalsWorld[k]),Ea=(Q.x*a.n11+Q.y*a.n12+Q.z*a.n13)*0.5+0.5,Fa=-(Q.x*a.n21+Q.y*a.n22+Q.z*a.n23)*0.5+0.5,za(t,z,r,D,x,J,Aa,Ba,Ca,Da,Ea,Fa,q.envMap)}else q.wireframe?ha(q.color,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ia(q.color);else if(q instanceof THREE.MeshLambertMaterial)q.map&&!q.wireframe&&(q.map.mapping instanceof THREE.UVMapping&&(Y=i.uvs[0],za(t,z,r,D,x,J,Y[g].u,Y[g].v,
+1,g=e.scale.x*n,l=e.scale.y*p,h=g*q,j=l*o,V.set(a.x-h,a.y-j,a.x+h,a.y+j),ka.intersects(V)&&(k.save(),k.translate(a.x,a.y),k.rotate(-e.rotation),k.scale(g,-l),k.translate(-q,-o),k.drawImage(i,0,0),k.restore())}else g instanceof THREE.ParticleCanvasMaterial&&(h=e.scale.x*n,j=e.scale.y*p,V.set(a.x-h,a.y-j,a.x+h,a.y+j),ka.intersects(V)&&(d(g.color.getContextStyle()),f(g.color.getContextStyle()),k.save(),k.translate(a.x,a.y),k.rotate(-e.rotation),k.scale(h,j),g.program(k),k.restore()))}function x(a,e,
+f,g){b(g.opacity);c(g.blending);k.beginPath();k.moveTo(a.positionScreen.x,a.positionScreen.y);k.lineTo(e.positionScreen.x,e.positionScreen.y);k.closePath();if(g instanceof THREE.LineBasicMaterial){a=g.linewidth;if(N!=a)k.lineWidth=N=a;a=g.linecap;if(L!=a)k.lineCap=L=a;a=g.linejoin;if(K!=a)k.lineJoin=K=a;d(g.color.getContextStyle());k.stroke();V.inflate(g.linewidth*2)}}function E(a,d,f,g,h,k,i,q){e.info.render.vertices+=3;e.info.render.faces++;b(q.opacity);c(q.blending);t=a.positionScreen.x;z=a.positionScreen.y;
+r=d.positionScreen.x;D=d.positionScreen.y;w=f.positionScreen.x;H=f.positionScreen.y;G(t,z,r,D,w,H);if(q instanceof THREE.MeshBasicMaterial)if(q.map)q.map.mapping instanceof THREE.UVMapping&&(Y=i.uvs[0],za(t,z,r,D,w,H,Y[g].u,Y[g].v,Y[h].u,Y[h].v,Y[k].u,Y[k].v,q.map));else if(q.envMap){if(q.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=j.matrixWorldInverse,Q.copy(i.vertexNormalsWorld[g]),Aa=(Q.x*a.n11+Q.y*a.n12+Q.z*a.n13)*0.5+0.5,Ba=-(Q.x*a.n21+Q.y*a.n22+Q.z*a.n23)*0.5+0.5,Q.copy(i.vertexNormalsWorld[h]),
+Ca=(Q.x*a.n11+Q.y*a.n12+Q.z*a.n13)*0.5+0.5,Da=-(Q.x*a.n21+Q.y*a.n22+Q.z*a.n23)*0.5+0.5,Q.copy(i.vertexNormalsWorld[k]),Ea=(Q.x*a.n11+Q.y*a.n12+Q.z*a.n13)*0.5+0.5,Fa=-(Q.x*a.n21+Q.y*a.n22+Q.z*a.n23)*0.5+0.5,za(t,z,r,D,w,H,Aa,Ba,Ca,Da,Ea,Fa,q.envMap)}else q.wireframe?ha(q.color,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ia(q.color);else if(q instanceof THREE.MeshLambertMaterial)q.map&&!q.wireframe&&(q.map.mapping instanceof THREE.UVMapping&&(Y=i.uvs[0],za(t,z,r,D,w,H,Y[g].u,Y[g].v,
 Y[h].u,Y[h].v,Y[k].u,Y[k].v,q.map)),c(THREE.SubtractiveBlending)),xa?!q.wireframe&&q.shading==THREE.SmoothShading&&i.vertexNormalsWorld.length==3?(A.r=B.r=C.r=X.r,A.g=B.g=C.g=X.g,A.b=B.b=C.b=X.b,o(l,i.v1.positionWorld,i.vertexNormalsWorld[0],A),o(l,i.v2.positionWorld,i.vertexNormalsWorld[1],B),o(l,i.v3.positionWorld,i.vertexNormalsWorld[2],C),A.r=Math.max(0,Math.min(q.color.r*A.r,1)),A.g=Math.max(0,Math.min(q.color.g*A.g,1)),A.b=Math.max(0,Math.min(q.color.b*A.b,1)),B.r=Math.max(0,Math.min(q.color.r*
-B.r,1)),B.g=Math.max(0,Math.min(q.color.g*B.g,1)),B.b=Math.max(0,Math.min(q.color.b*B.b,1)),C.r=Math.max(0,Math.min(q.color.r*C.r,1)),C.g=Math.max(0,Math.min(q.color.g*C.g,1)),C.b=Math.max(0,Math.min(q.color.b*C.b,1)),O.r=(B.r+C.r)*0.5,O.g=(B.g+C.g)*0.5,O.b=(B.b+C.b)*0.5,ca=ua(A,B,C,O),ma(t,z,r,D,x,J,0,0,1,0,0,1,ca)):(w.r=X.r,w.g=X.g,w.b=X.b,o(l,i.centroidWorld,i.normalWorld,w),w.r=Math.max(0,Math.min(q.color.r*w.r,1)),w.g=Math.max(0,Math.min(q.color.g*w.g,1)),w.b=Math.max(0,Math.min(q.color.b*w.b,
-1)),q.wireframe?ha(w,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ia(w)):q.wireframe?ha(q.color,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ia(q.color);else if(q instanceof THREE.MeshDepthMaterial)ea=j.near,fa=j.far,A.r=A.g=A.b=1-la(a.positionScreen.z,ea,fa),B.r=B.g=B.b=1-la(d.positionScreen.z,ea,fa),C.r=C.g=C.b=1-la(f.positionScreen.z,ea,fa),O.r=(B.r+C.r)*0.5,O.g=(B.g+C.g)*0.5,O.b=(B.b+C.b)*0.5,ca=ua(A,B,C,O),ma(t,z,r,D,x,J,0,0,1,0,0,1,ca);else if(q instanceof THREE.MeshNormalMaterial)w.r=
-na(i.normalWorld.x),w.g=na(i.normalWorld.y),w.b=na(i.normalWorld.z),q.wireframe?ha(w,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ia(w)}function K(a,d,f,g,h,k,i,q,n){e.info.render.vertices+=4;e.info.render.faces++;b(q.opacity);c(q.blending);if(q.map||q.envMap)F(a,d,g,0,1,3,i,q,n),F(h,f,k,1,2,3,i,q,n);else if(t=a.positionScreen.x,z=a.positionScreen.y,r=d.positionScreen.x,D=d.positionScreen.y,x=f.positionScreen.x,J=f.positionScreen.y,E=g.positionScreen.x,T=g.positionScreen.y,Z=h.positionScreen.x,
-ba=h.positionScreen.y,ga=k.positionScreen.x,da=k.positionScreen.y,q instanceof THREE.MeshBasicMaterial)M(t,z,r,D,x,J,E,T),q.wireframe?ha(q.color,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ia(q.color);else if(q instanceof THREE.MeshLambertMaterial)xa?!q.wireframe&&q.shading==THREE.SmoothShading&&i.vertexNormalsWorld.length==4?(A.r=B.r=C.r=O.r=X.r,A.g=B.g=C.g=O.g=X.g,A.b=B.b=C.b=O.b=X.b,o(l,i.v1.positionWorld,i.vertexNormalsWorld[0],A),o(l,i.v2.positionWorld,i.vertexNormalsWorld[1],
+B.r,1)),B.g=Math.max(0,Math.min(q.color.g*B.g,1)),B.b=Math.max(0,Math.min(q.color.b*B.b,1)),C.r=Math.max(0,Math.min(q.color.r*C.r,1)),C.g=Math.max(0,Math.min(q.color.g*C.g,1)),C.b=Math.max(0,Math.min(q.color.b*C.b,1)),O.r=(B.r+C.r)*0.5,O.g=(B.g+C.g)*0.5,O.b=(B.b+C.b)*0.5,ba=ua(A,B,C,O),ma(t,z,r,D,w,H,0,0,1,0,0,1,ba)):(v.r=X.r,v.g=X.g,v.b=X.b,o(l,i.centroidWorld,i.normalWorld,v),v.r=Math.max(0,Math.min(q.color.r*v.r,1)),v.g=Math.max(0,Math.min(q.color.g*v.g,1)),v.b=Math.max(0,Math.min(q.color.b*v.b,
+1)),q.wireframe?ha(v,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ia(v)):q.wireframe?ha(q.color,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ia(q.color);else if(q instanceof THREE.MeshDepthMaterial)ea=j.near,fa=j.far,A.r=A.g=A.b=1-la(a.positionScreen.z,ea,fa),B.r=B.g=B.b=1-la(d.positionScreen.z,ea,fa),C.r=C.g=C.b=1-la(f.positionScreen.z,ea,fa),O.r=(B.r+C.r)*0.5,O.g=(B.g+C.g)*0.5,O.b=(B.b+C.b)*0.5,ba=ua(A,B,C,O),ma(t,z,r,D,w,H,0,0,1,0,0,1,ba);else if(q instanceof THREE.MeshNormalMaterial)v.r=
+na(i.normalWorld.x),v.g=na(i.normalWorld.y),v.b=na(i.normalWorld.z),q.wireframe?ha(v,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ia(v)}function I(a,d,f,g,h,k,i,q,n){e.info.render.vertices+=4;e.info.render.faces++;b(q.opacity);c(q.blending);if(q.map||q.envMap)E(a,d,g,0,1,3,i,q,n),E(h,f,k,1,2,3,i,q,n);else if(t=a.positionScreen.x,z=a.positionScreen.y,r=d.positionScreen.x,D=d.positionScreen.y,w=f.positionScreen.x,H=f.positionScreen.y,F=g.positionScreen.x,U=g.positionScreen.y,Z=h.positionScreen.x,
+ca=h.positionScreen.y,ga=k.positionScreen.x,da=k.positionScreen.y,q instanceof THREE.MeshBasicMaterial)M(t,z,r,D,w,H,F,U),q.wireframe?ha(q.color,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ia(q.color);else if(q instanceof THREE.MeshLambertMaterial)xa?!q.wireframe&&q.shading==THREE.SmoothShading&&i.vertexNormalsWorld.length==4?(A.r=B.r=C.r=O.r=X.r,A.g=B.g=C.g=O.g=X.g,A.b=B.b=C.b=O.b=X.b,o(l,i.v1.positionWorld,i.vertexNormalsWorld[0],A),o(l,i.v2.positionWorld,i.vertexNormalsWorld[1],
 B),o(l,i.v4.positionWorld,i.vertexNormalsWorld[3],C),o(l,i.v3.positionWorld,i.vertexNormalsWorld[2],O),A.r=Math.max(0,Math.min(q.color.r*A.r,1)),A.g=Math.max(0,Math.min(q.color.g*A.g,1)),A.b=Math.max(0,Math.min(q.color.b*A.b,1)),B.r=Math.max(0,Math.min(q.color.r*B.r,1)),B.g=Math.max(0,Math.min(q.color.g*B.g,1)),B.b=Math.max(0,Math.min(q.color.b*B.b,1)),C.r=Math.max(0,Math.min(q.color.r*C.r,1)),C.g=Math.max(0,Math.min(q.color.g*C.g,1)),C.b=Math.max(0,Math.min(q.color.b*C.b,1)),O.r=Math.max(0,Math.min(q.color.r*
-O.r,1)),O.g=Math.max(0,Math.min(q.color.g*O.g,1)),O.b=Math.max(0,Math.min(q.color.b*O.b,1)),ca=ua(A,B,C,O),H(t,z,r,D,E,T),ma(t,z,r,D,E,T,0,0,1,0,0,1,ca),H(Z,ba,x,J,ga,da),ma(Z,ba,x,J,ga,da,1,0,1,1,0,1,ca)):(w.r=X.r,w.g=X.g,w.b=X.b,o(l,i.centroidWorld,i.normalWorld,w),w.r=Math.max(0,Math.min(q.color.r*w.r,1)),w.g=Math.max(0,Math.min(q.color.g*w.g,1)),w.b=Math.max(0,Math.min(q.color.b*w.b,1)),M(t,z,r,D,x,J,E,T),q.wireframe?ha(w,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ia(w)):(M(t,
-z,r,D,x,J,E,T),q.wireframe?ha(q.color,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ia(q.color));else if(q instanceof THREE.MeshNormalMaterial)w.r=na(i.normalWorld.x),w.g=na(i.normalWorld.y),w.b=na(i.normalWorld.z),M(t,z,r,D,x,J,E,T),q.wireframe?ha(w,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ia(w);else if(q instanceof THREE.MeshDepthMaterial)ea=j.near,fa=j.far,A.r=A.g=A.b=1-la(a.positionScreen.z,ea,fa),B.r=B.g=B.b=1-la(d.positionScreen.z,ea,fa),C.r=C.g=C.b=1-la(g.positionScreen.z,
-ea,fa),O.r=O.g=O.b=1-la(f.positionScreen.z,ea,fa),ca=ua(A,B,C,O),H(t,z,r,D,E,T),ma(t,z,r,D,E,T,0,0,1,0,0,1,ca),H(Z,ba,x,J,ga,da),ma(Z,ba,x,J,ga,da,1,0,1,1,0,1,ca)}function H(a,b,c,d,e,f){k.beginPath();k.moveTo(a,b);k.lineTo(c,d);k.lineTo(e,f);k.lineTo(a,b);k.closePath()}function M(a,b,c,d,e,f,g,h){k.beginPath();k.moveTo(a,b);k.lineTo(c,d);k.lineTo(e,f);k.lineTo(g,h);k.lineTo(a,b);k.closePath()}function ha(a,b,c,e){if(N!=b)k.lineWidth=N=b;if(L!=c)k.lineCap=L=c;if(I!=e)k.lineJoin=I=e;d(a.getContextStyle());
+O.r,1)),O.g=Math.max(0,Math.min(q.color.g*O.g,1)),O.b=Math.max(0,Math.min(q.color.b*O.b,1)),ba=ua(A,B,C,O),G(t,z,r,D,F,U),ma(t,z,r,D,F,U,0,0,1,0,0,1,ba),G(Z,ca,w,H,ga,da),ma(Z,ca,w,H,ga,da,1,0,1,1,0,1,ba)):(v.r=X.r,v.g=X.g,v.b=X.b,o(l,i.centroidWorld,i.normalWorld,v),v.r=Math.max(0,Math.min(q.color.r*v.r,1)),v.g=Math.max(0,Math.min(q.color.g*v.g,1)),v.b=Math.max(0,Math.min(q.color.b*v.b,1)),M(t,z,r,D,w,H,F,U),q.wireframe?ha(v,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ia(v)):(M(t,
+z,r,D,w,H,F,U),q.wireframe?ha(q.color,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ia(q.color));else if(q instanceof THREE.MeshNormalMaterial)v.r=na(i.normalWorld.x),v.g=na(i.normalWorld.y),v.b=na(i.normalWorld.z),M(t,z,r,D,w,H,F,U),q.wireframe?ha(v,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ia(v);else if(q instanceof THREE.MeshDepthMaterial)ea=j.near,fa=j.far,A.r=A.g=A.b=1-la(a.positionScreen.z,ea,fa),B.r=B.g=B.b=1-la(d.positionScreen.z,ea,fa),C.r=C.g=C.b=1-la(g.positionScreen.z,
+ea,fa),O.r=O.g=O.b=1-la(f.positionScreen.z,ea,fa),ba=ua(A,B,C,O),G(t,z,r,D,F,U),ma(t,z,r,D,F,U,0,0,1,0,0,1,ba),G(Z,ca,w,H,ga,da),ma(Z,ca,w,H,ga,da,1,0,1,1,0,1,ba)}function G(a,b,c,d,e,f){k.beginPath();k.moveTo(a,b);k.lineTo(c,d);k.lineTo(e,f);k.lineTo(a,b);k.closePath()}function M(a,b,c,d,e,f,g,h){k.beginPath();k.moveTo(a,b);k.lineTo(c,d);k.lineTo(e,f);k.lineTo(g,h);k.lineTo(a,b);k.closePath()}function ha(a,b,c,e){if(N!=b)k.lineWidth=N=b;if(L!=c)k.lineCap=L=c;if(K!=e)k.lineJoin=K=e;d(a.getContextStyle());
 k.stroke();V.inflate(b*2)}function ia(a){f(a.getContextStyle());k.fill()}function za(a,b,c,d,e,g,h,i,j,l,n,o,m){if(m.image.width!=0){if(m.needsUpdate==!0||wa[m.id]==void 0){var p=m.wrapS==THREE.RepeatWrapping,r=m.wrapT==THREE.RepeatWrapping;wa[m.id]=k.createPattern(m.image,p&&r?"repeat":p&&!r?"repeat-x":!p&&r?"repeat-y":"no-repeat");m.needsUpdate=!1}f(wa[m.id]);var p=m.offset.x/m.repeat.x,r=m.offset.y/m.repeat.y,s=(m.image.width-1)*m.repeat.x,m=(m.image.height-1)*m.repeat.y,h=(h+p)*s,i=(i+r)*m,j=
 (j+p)*s,l=(l+r)*m,n=(n+p)*s,o=(o+r)*m;c-=a;d-=b;e-=a;g-=b;j-=h;l-=i;n-=h;o-=i;p=1/(j*o-n*l);m=(o*c-l*e)*p;l=(o*d-l*g)*p;c=(j*e-n*c)*p;d=(j*g-n*d)*p;a=a-m*h-c*i;b=b-l*h-d*i;k.save();k.transform(m,l,c,d,a,b);k.fill();k.restore()}}function ma(a,b,c,d,e,f,g,h,i,j,l,m,n){var o,p;o=n.width-1;p=n.height-1;g*=o;h*=p;i*=o;j*=p;l*=o;m*=p;c-=a;d-=b;e-=a;f-=b;i-=g;j-=h;l-=g;m-=h;p=1/(i*m-l*j);o=(m*c-j*e)*p;j=(m*d-j*f)*p;c=(i*e-l*c)*p;d=(i*f-l*d)*p;a=a-o*g-c*h;b=b-j*g-d*h;k.save();k.transform(o,j,c,d,a,b);k.clip();
 k.drawImage(n,0,0);k.restore()}function ua(a,b,c,d){var e=~~(a.r*255),f=~~(a.g*255),a=~~(a.b*255),g=~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),i=~~(c.r*255),j=~~(c.g*255),c=~~(c.b*255),k=~~(d.r*255),l=~~(d.g*255),d=~~(d.b*255);$[0]=e<0?0:e>255?255:e;$[1]=f<0?0:f>255?255:f;$[2]=a<0?0:a>255?255:a;$[4]=g<0?0:g>255?255:g;$[5]=h<0?0:h>255?255:h;$[6]=b<0?0:b>255?255:b;$[8]=i<0?0:i>255?255:i;$[9]=j<0?0:j>255?255:j;$[10]=c<0?0:c>255?255:c;$[12]=k<0?0:k>255?255:k;$[13]=l<0?0:l>255?255:l;$[14]=d<0?0:d>255?255:
-d;pa.putImageData(ya,0,0);ta.drawImage(oa,0,0);return qa}function la(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function na(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function ja(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;e!=0&&(e=1/Math.sqrt(e),c*=e,d*=e,b.x+=c,b.y+=d,a.x-=c,a.y-=d)}var va,Ga,S,aa;this.autoClear?this.clear():k.setTransform(1,0,0,-1,n,p);e.info.render.vertices=0;e.info.render.faces=0;g=m.projectScene(a,j,this.sortElements);h=g.elements;l=g.lights;(xa=l.length>0)&&i(l);va=0;for(Ga=h.length;va<Ga;va++)if(S=
-h[va],aa=S.material,aa=aa instanceof THREE.MeshFaceMaterial?S.faceMaterial:aa,!(aa==null||aa.opacity==0)){V.empty();if(S instanceof THREE.RenderableParticle)s=S,s.x*=n,s.y*=p,u(s,S,aa,a);else if(S instanceof THREE.RenderableLine)s=S.v1,y=S.v2,s.positionScreen.x*=n,s.positionScreen.y*=p,y.positionScreen.x*=n,y.positionScreen.y*=p,V.addPoint(s.positionScreen.x,s.positionScreen.y),V.addPoint(y.positionScreen.x,y.positionScreen.y),ka.intersects(V)&&v(s,y,S,aa,a);else if(S instanceof THREE.RenderableFace3)s=
-S.v1,y=S.v2,G=S.v3,s.positionScreen.x*=n,s.positionScreen.y*=p,y.positionScreen.x*=n,y.positionScreen.y*=p,G.positionScreen.x*=n,G.positionScreen.y*=p,aa.overdraw&&(ja(s.positionScreen,y.positionScreen),ja(y.positionScreen,G.positionScreen),ja(G.positionScreen,s.positionScreen)),V.add3Points(s.positionScreen.x,s.positionScreen.y,y.positionScreen.x,y.positionScreen.y,G.positionScreen.x,G.positionScreen.y),ka.intersects(V)&&F(s,y,G,0,1,2,S,aa,a);else if(S instanceof THREE.RenderableFace4)s=S.v1,y=S.v2,
-G=S.v3,U=S.v4,s.positionScreen.x*=n,s.positionScreen.y*=p,y.positionScreen.x*=n,y.positionScreen.y*=p,G.positionScreen.x*=n,G.positionScreen.y*=p,U.positionScreen.x*=n,U.positionScreen.y*=p,R.positionScreen.copy(y.positionScreen),P.positionScreen.copy(U.positionScreen),aa.overdraw&&(ja(s.positionScreen,y.positionScreen),ja(y.positionScreen,U.positionScreen),ja(U.positionScreen,s.positionScreen),ja(G.positionScreen,R.positionScreen),ja(G.positionScreen,P.positionScreen)),V.addPoint(s.positionScreen.x,
-s.positionScreen.y),V.addPoint(y.positionScreen.x,y.positionScreen.y),V.addPoint(G.positionScreen.x,G.positionScreen.y),V.addPoint(U.positionScreen.x,U.positionScreen.y),ka.intersects(V)&&aa.opacity!=0&&K(s,y,G,U,R,P,S,aa,a);W.addRectangle(V)}k.setTransform(1,0,0,1,0,0)}};THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};THREE.RenderableVertex.prototype.copy=function(a){this.positionWorld.copy(a.positionWorld);this.positionScreen.copy(a.positionScreen)};
+d;pa.putImageData(ya,0,0);ta.drawImage(oa,0,0);return qa}function la(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function na(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function ja(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;e!=0&&(e=1/Math.sqrt(e),c*=e,d*=e,b.x+=c,b.y+=d,a.x-=c,a.y-=d)}var va,Ga,R,aa;this.autoClear?this.clear():k.setTransform(1,0,0,-1,n,p);e.info.render.vertices=0;e.info.render.faces=0;g=m.projectScene(a,j,this.sortElements);h=g.elements;l=g.lights;(xa=l.length>0)&&i(l);va=0;for(Ga=h.length;va<Ga;va++)if(R=
+h[va],aa=R.material,aa=aa instanceof THREE.MeshFaceMaterial?R.faceMaterial:aa,!(aa==null||aa.opacity==0)){V.empty();if(R instanceof THREE.RenderableParticle)s=R,s.x*=n,s.y*=p,u(s,R,aa,a);else if(R instanceof THREE.RenderableLine)s=R.v1,y=R.v2,s.positionScreen.x*=n,s.positionScreen.y*=p,y.positionScreen.x*=n,y.positionScreen.y*=p,V.addPoint(s.positionScreen.x,s.positionScreen.y),V.addPoint(y.positionScreen.x,y.positionScreen.y),ka.intersects(V)&&x(s,y,R,aa,a);else if(R instanceof THREE.RenderableFace3)s=
+R.v1,y=R.v2,J=R.v3,s.positionScreen.x*=n,s.positionScreen.y*=p,y.positionScreen.x*=n,y.positionScreen.y*=p,J.positionScreen.x*=n,J.positionScreen.y*=p,aa.overdraw&&(ja(s.positionScreen,y.positionScreen),ja(y.positionScreen,J.positionScreen),ja(J.positionScreen,s.positionScreen)),V.add3Points(s.positionScreen.x,s.positionScreen.y,y.positionScreen.x,y.positionScreen.y,J.positionScreen.x,J.positionScreen.y),ka.intersects(V)&&E(s,y,J,0,1,2,R,aa,a);else if(R instanceof THREE.RenderableFace4)s=R.v1,y=R.v2,
+J=R.v3,S=R.v4,s.positionScreen.x*=n,s.positionScreen.y*=p,y.positionScreen.x*=n,y.positionScreen.y*=p,J.positionScreen.x*=n,J.positionScreen.y*=p,S.positionScreen.x*=n,S.positionScreen.y*=p,T.positionScreen.copy(y.positionScreen),P.positionScreen.copy(S.positionScreen),aa.overdraw&&(ja(s.positionScreen,y.positionScreen),ja(y.positionScreen,S.positionScreen),ja(S.positionScreen,s.positionScreen),ja(J.positionScreen,T.positionScreen),ja(J.positionScreen,P.positionScreen)),V.addPoint(s.positionScreen.x,
+s.positionScreen.y),V.addPoint(y.positionScreen.x,y.positionScreen.y),V.addPoint(J.positionScreen.x,J.positionScreen.y),V.addPoint(S.positionScreen.x,S.positionScreen.y),ka.intersects(V)&&aa.opacity!=0&&I(s,y,J,S,T,P,R,aa,a);W.addRectangle(V)}k.setTransform(1,0,0,1,0,0)}};THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};THREE.RenderableVertex.prototype.copy=function(a){this.positionWorld.copy(a.positionWorld);this.positionScreen.copy(a.positionScreen)};
 THREE.RenderableFace3=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterial=this.material=null;this.uvs=[[]];this.z=null};
 THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.v4=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterial=this.material=null;this.uvs=[[]];this.z=null};
 THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.material=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.material=null};

+ 14 - 14
build/custom/ThreeDOM.js

@@ -26,8 +26,8 @@ THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var a,b=
 THREE.Matrix4=function(a,b,c,d,e,g,f,h,k,l,i,j,n,m,o,p){this.set(a!==void 0?a:1,b||0,c||0,d||0,e||0,g!==void 0?g:1,f||0,h||0,k||0,l||0,i!==void 0?i:1,j||0,n||0,m||0,o||0,p!==void 0?p:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
 THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,g,f,h,k,l,i,j,n,m,o,p){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=e;this.n22=g;this.n23=f;this.n24=h;this.n31=k;this.n32=l;this.n33=i;this.n34=j;this.n41=n;this.n42=m;this.n43=o;this.n44=p;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,
 b,c){var d=THREE.Matrix4.__v1,e=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,b).normalize();if(g.length()===0)g.z=1;d.cross(c,g).normalize();d.length()===0&&(g.x+=1.0E-4,d.cross(c,g).normalize());e.cross(g,d).normalize();this.n11=d.x;this.n12=e.x;this.n13=g.x;this.n21=d.y;this.n22=e.y;this.n23=g.y;this.n31=d.z;this.n32=e.z;this.n33=g.z;return this},multiply:function(a,b){var c=a.n11,d=a.n12,e=a.n13,g=a.n14,f=a.n21,h=a.n22,k=a.n23,l=a.n24,i=a.n31,j=a.n32,n=a.n33,m=a.n34,o=a.n41,p=a.n42,r=a.n43,
-s=a.n44,v=b.n11,C=b.n12,K=b.n13,y=b.n14,F=b.n21,G=b.n22,w=b.n23,A=b.n24,O=b.n31,I=b.n32,M=b.n33,H=b.n34,D=b.n41,t=b.n42,B=b.n43,q=b.n44;this.n11=c*v+d*F+e*O+g*D;this.n12=c*C+d*G+e*I+g*t;this.n13=c*K+d*w+e*M+g*B;this.n14=c*y+d*A+e*H+g*q;this.n21=f*v+h*F+k*O+l*D;this.n22=f*C+h*G+k*I+l*t;this.n23=f*K+h*w+k*M+l*B;this.n24=f*y+h*A+k*H+l*q;this.n31=i*v+j*F+n*O+m*D;this.n32=i*C+j*G+n*I+m*t;this.n33=i*K+j*w+n*M+m*B;this.n34=i*y+j*A+n*H+m*q;this.n41=o*v+p*F+r*O+s*D;this.n42=o*C+p*G+r*I+s*t;this.n43=o*K+p*
-w+r*M+s*B;this.n44=o*y+p*A+r*H+s*q;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=
+t=a.n44,w=b.n11,B=b.n12,I=b.n13,s=b.n14,E=b.n21,F=b.n22,O=b.n23,z=b.n24,L=b.n31,J=b.n32,M=b.n33,G=b.n34,C=b.n41,u=b.n42,A=b.n43,q=b.n44;this.n11=c*w+d*E+e*L+g*C;this.n12=c*B+d*F+e*J+g*u;this.n13=c*I+d*O+e*M+g*A;this.n14=c*s+d*z+e*G+g*q;this.n21=f*w+h*E+k*L+l*C;this.n22=f*B+h*F+k*J+l*u;this.n23=f*I+h*O+k*M+l*A;this.n24=f*s+h*z+k*G+l*q;this.n31=i*w+j*E+n*L+m*C;this.n32=i*B+j*F+n*J+m*u;this.n33=i*I+j*O+n*M+m*A;this.n34=i*s+j*z+n*G+m*q;this.n41=o*w+p*E+r*L+t*C;this.n42=o*B+p*F+r*J+t*u;this.n43=o*I+p*
+O+r*M+t*A;this.n44=o*s+p*z+r*G+t*q;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=
 a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},multiplyVector3:function(a){var b=a.x,c=a.y,d=a.z,e=1/(this.n41*b+this.n42*c+this.n43*d+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*d+this.n14)*e;a.y=(this.n21*b+this.n22*c+this.n23*d+this.n24)*e;a.z=(this.n31*b+this.n32*c+this.n33*d+this.n34)*e;return a},multiplyVector4:function(a){var b=a.x,c=a.y,d=a.z,e=a.w;a.x=this.n11*b+this.n12*c+this.n13*d+this.n14*e;a.y=this.n21*b+this.n22*
 c+this.n23*d+this.n24*e;a.z=this.n31*b+this.n32*c+this.n33*d+this.n34*e;a.w=this.n41*b+this.n42*c+this.n43*d+this.n44*e;return a},rotateAxis:function(a){var b=a.x,c=a.y,d=a.z;a.x=b*this.n11+c*this.n12+d*this.n13;a.y=b*this.n21+c*this.n22+d*this.n23;a.z=b*this.n31+c*this.n32+d*this.n33;a.normalize();return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*
 a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,d=this.n14,e=this.n21,g=this.n22,f=this.n23,h=this.n24,k=this.n31,l=this.n32,i=this.n33,j=this.n34,n=this.n41,m=this.n42,o=this.n43,p=this.n44;return d*f*l*n-c*h*l*n-d*g*i*n+b*h*i*n+c*g*j*n-b*f*j*n-d*f*k*m+c*h*k*m+d*e*i*m-a*h*i*m-c*e*j*m+a*f*j*m+d*g*k*o-b*h*k*o-d*e*l*o+a*h*l*o+b*e*j*o-a*g*j*o-c*g*k*p+b*f*k*p+c*e*l*p-a*f*l*p-b*e*i*p+a*g*i*p},transpose:function(){var a;
@@ -53,18 +53,18 @@ THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(a,b){thi
 -1)a.parent!==void 0&&a.parent.remove(a),a.parent=this,this.children.push(a)},remove:function(a){var b=this.children.indexOf(a);if(b!==-1)a.parent=void 0,this.children.splice(b,1)},getChildByName:function(a,b){var c,d,e;c=0;for(d=this.children.length;c<d;c++){e=this.children[c];if(e.name===a)return e;if(b&&(e=e.getChildByName(a,b),e!==void 0))return e}},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 b=0,c=this.children.length;b<
 c;b++)this.children[b].updateMatrixWorld(a)}};THREE.Object3DCount=0;
-THREE.Projector=function(){function a(){var a=g[e]=g[e]||new THREE.RenderableVertex;e++;return a}function b(a,b){return b.z-a.z}function c(a,b){var c=0,d=1,f=a.z+a.w,e=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;return f>=0&&e>=0&&g>=0&&h>=0?!0:f<0&&e<0||g<0&&h<0?!1:(f<0?c=Math.max(c,f/(f-e)):e<0&&(d=Math.min(d,f/(f-e))),g<0?c=Math.max(c,g/(g-h)):h<0&&(d=Math.min(d,g/(g-h))),d<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-d),!0))}var d,e,g=[],f,h,k=[],l,i=[],j,n,m=[],o,p,r=[],s={objects:[],lines:[],sprites:[],lights:[],
-elements:[]};new THREE.Vector3;var v=new THREE.Vector4,C=new THREE.Matrix4,K=new THREE.Matrix4,y=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],F=new THREE.Vector4,G=new THREE.Vector4;this.computeFrustum=function(a){y[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);y[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);y[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);y[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-
-a.n24);y[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);y[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=y[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);C.multiply(b.projectionMatrix,b.matrixWorldInverse);C.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);C.multiply(b.matrixWorld,b.projectionMatrixInverse);
-C.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(a){s.objects.length=0;s.lines.length=0;s.sprites.length=0;s.lights.length=0;var b=function(a){if(a.visible!=!1){var c;if(c=a instanceof THREE.Mesh)if(!(c=a.frustumCulled==!1))a:{for(var d=a.matrixWorld,f=-a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,
-a.scale.z)),e=0;e<6;e++)if(c=y[e].x*d.n14+y[e].y*d.n24+y[e].z*d.n34+y[e].w,c<=f){c=!1;break a}c=!0}c?s.objects.push(a):a instanceof THREE.Line?s.lines.push(a):a instanceof THREE.Sprite||a instanceof THREE.Particle?s.sprites.push(a):a instanceof THREE.Light&&s.lights.push(a);c=0;for(d=a.children.length;c<d;c++)b(a.children[c])}};b(a);return s};this.projectScene=function(w,A,y){var I=A.near,M=A.far,H,D,t,B,q,z,x,E,u,J,L,P,S,Q,R,N;p=n=l=h=0;s.elements.length=0;A.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),
-w.add(A));w.updateMatrixWorld();A.matrixWorldInverse.getInverse(A.matrixWorld);C.multiply(A.projectionMatrix,A.matrixWorldInverse);this.computeFrustum(C);s=this.projectGraph(w);w=0;for(H=s.objects.length;w<H;w++)if(u=s.objects[w],J=u.matrixWorld,P=u.material,e=0,u instanceof THREE.Mesh){L=u.geometry;S=u.geometry.materials;B=L.vertices;Q=L.faces;R=L.faceVertexUvs;L=u.matrixRotationWorld.extractRotation(J);D=0;for(t=B.length;D<t;D++)d=a(),d.positionWorld.copy(B[D].position),J.multiplyVector3(d.positionWorld),
-d.positionScreen.copy(d.positionWorld),C.multiplyVector4(d.positionScreen),d.positionScreen.x/=d.positionScreen.w,d.positionScreen.y/=d.positionScreen.w,d.visible=d.positionScreen.z>I&&d.positionScreen.z<M;B=0;for(D=Q.length;B<D;B++){t=Q[B];if(t instanceof THREE.Face3)if(q=g[t.a],z=g[t.b],x=g[t.c],q.visible&&z.visible&&x.visible&&(u.doubleSided||u.flipSided!=(x.positionScreen.x-q.positionScreen.x)*(z.positionScreen.y-q.positionScreen.y)-(x.positionScreen.y-q.positionScreen.y)*(z.positionScreen.x-
-q.positionScreen.x)<0))E=k[h]=k[h]||new THREE.RenderableFace3,h++,f=E,f.v1.copy(q),f.v2.copy(z),f.v3.copy(x);else continue;else if(t instanceof THREE.Face4)if(q=g[t.a],z=g[t.b],x=g[t.c],E=g[t.d],q.visible&&z.visible&&x.visible&&E.visible&&(u.doubleSided||u.flipSided!=((E.positionScreen.x-q.positionScreen.x)*(z.positionScreen.y-q.positionScreen.y)-(E.positionScreen.y-q.positionScreen.y)*(z.positionScreen.x-q.positionScreen.x)<0||(z.positionScreen.x-x.positionScreen.x)*(E.positionScreen.y-x.positionScreen.y)-
-(z.positionScreen.y-x.positionScreen.y)*(E.positionScreen.x-x.positionScreen.x)<0)))N=i[l]=i[l]||new THREE.RenderableFace4,l++,f=N,f.v1.copy(q),f.v2.copy(z),f.v3.copy(x),f.v4.copy(E);else continue;f.normalWorld.copy(t.normal);L.multiplyVector3(f.normalWorld);f.centroidWorld.copy(t.centroid);J.multiplyVector3(f.centroidWorld);f.centroidScreen.copy(f.centroidWorld);C.multiplyVector3(f.centroidScreen);x=t.vertexNormals;q=0;for(z=x.length;q<z;q++)E=f.vertexNormalsWorld[q],E.copy(x[q]),L.multiplyVector3(E);
-q=0;for(z=R.length;q<z;q++)if(N=R[q][B]){x=0;for(E=N.length;x<E;x++)f.uvs[q][x]=N[x]}f.material=P;f.faceMaterial=t.materialIndex!==null?S[t.materialIndex]:null;f.z=f.centroidScreen.z;s.elements.push(f)}}w=0;for(H=s.lines.length;w<H;w++)if(u=s.lines[w],J=u.matrixWorld,P=u.material,e=0,u instanceof THREE.Line){K.multiply(C,J);B=u.geometry.vertices;q=a();q.positionScreen.copy(B[0].position);K.multiplyVector4(q.positionScreen);D=1;for(t=B.length;D<t;D++)if(q=a(),q.positionScreen.copy(B[D].position),K.multiplyVector4(q.positionScreen),
-z=g[e-2],F.copy(q.positionScreen),G.copy(z.positionScreen),c(F,G))F.multiplyScalar(1/F.w),G.multiplyScalar(1/G.w),I=m[n]=m[n]||new THREE.RenderableLine,n++,j=I,j.v1.positionScreen.copy(F),j.v2.positionScreen.copy(G),j.z=Math.max(F.z,G.z),j.material=P,s.elements.push(j)}w=0;for(H=s.sprites.length;w<H;w++)if(u=s.sprites[w],J=u.matrixWorld,u instanceof THREE.Particle&&(v.set(J.n14,J.n24,J.n34,1),C.multiplyVector4(v),v.z/=v.w,v.z>0&&v.z<1))I=r[p]=r[p]||new THREE.RenderableParticle,p++,o=I,o.x=v.x/v.w,
-o.y=v.y/v.w,o.z=v.z,o.rotation=u.rotation.z,o.scale.x=u.scale.x*Math.abs(o.x-(v.x+A.projectionMatrix.n11)/(v.w+A.projectionMatrix.n14)),o.scale.y=u.scale.y*Math.abs(o.y-(v.y+A.projectionMatrix.n22)/(v.w+A.projectionMatrix.n24)),o.material=u.material,s.elements.push(o);y&&s.elements.sort(b);return s}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==void 0?d:1)};
+THREE.Projector=function(){function a(){var a=g[e]=g[e]||new THREE.RenderableVertex;e++;return a}function b(a,b){return b.z-a.z}function c(a,b){var c=0,d=1,f=a.z+a.w,e=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;return f>=0&&e>=0&&g>=0&&h>=0?!0:f<0&&e<0||g<0&&h<0?!1:(f<0?c=Math.max(c,f/(f-e)):e<0&&(d=Math.min(d,f/(f-e))),g<0?c=Math.max(c,g/(g-h)):h<0&&(d=Math.min(d,g/(g-h))),d<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-d),!0))}var d,e,g=[],f,h,k=[],l,i=[],j,n,m=[],o,p,r=[],t={objects:[],sprites:[],lights:[],elements:[]};
+new THREE.Vector3;var w=new THREE.Vector4,B=new THREE.Matrix4,I=new THREE.Matrix4,s=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],E=new THREE.Vector4,F=new THREE.Vector4;this.computeFrustum=function(a){s[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);s[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);s[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);s[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);s[4].set(a.n41-
+a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);s[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=s[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);B.multiply(b.projectionMatrix,b.matrixWorldInverse);B.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);B.multiply(b.matrixWorld,b.projectionMatrixInverse);B.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(a){t.objects.length=0;t.sprites.length=0;t.lights.length=0;var b=function(a){if(a.visible!=!1){var c;if(c=a instanceof THREE.Mesh)if(!(c=a.frustumCulled==!1))a:{for(var d=a.matrixWorld,f=-a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)),e=0;e<6;e++)if(c=
+s[e].x*d.n14+s[e].y*d.n24+s[e].z*d.n34+s[e].w,c<=f){c=!1;break a}c=!0}c?t.objects.push(a):a instanceof THREE.Line?t.objects.push(a):a instanceof THREE.Sprite||a instanceof THREE.Particle?t.sprites.push(a):a instanceof THREE.Light&&t.lights.push(a);c=0;for(d=a.children.length;c<d;c++)b(a.children[c])}};b(a);return t};this.projectScene=function(s,z,L){var J=z.near,M=z.far,G,C,u,A,q,y,x,D,v,H,K,P,S,Q,R,N;p=n=l=h=0;t.elements.length=0;z.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),
+s.add(z));s.updateMatrixWorld();z.matrixWorldInverse.getInverse(z.matrixWorld);B.multiply(z.projectionMatrix,z.matrixWorldInverse);this.computeFrustum(B);t=this.projectGraph(s);s=0;for(G=t.objects.length;s<G;s++)if(v=t.objects[s],H=v.matrixWorld,P=v.material,e=0,v instanceof THREE.Mesh){K=v.geometry;S=v.geometry.materials;A=K.vertices;Q=K.faces;R=K.faceVertexUvs;K=v.matrixRotationWorld.extractRotation(H);C=0;for(u=A.length;C<u;C++)d=a(),d.positionWorld.copy(A[C].position),H.multiplyVector3(d.positionWorld),
+d.positionScreen.copy(d.positionWorld),B.multiplyVector4(d.positionScreen),d.positionScreen.x/=d.positionScreen.w,d.positionScreen.y/=d.positionScreen.w,d.visible=d.positionScreen.z>J&&d.positionScreen.z<M;A=0;for(C=Q.length;A<C;A++){u=Q[A];if(u instanceof THREE.Face3)if(q=g[u.a],y=g[u.b],x=g[u.c],q.visible&&y.visible&&x.visible&&(v.doubleSided||v.flipSided!=(x.positionScreen.x-q.positionScreen.x)*(y.positionScreen.y-q.positionScreen.y)-(x.positionScreen.y-q.positionScreen.y)*(y.positionScreen.x-
+q.positionScreen.x)<0))D=k[h]=k[h]||new THREE.RenderableFace3,h++,f=D,f.v1.copy(q),f.v2.copy(y),f.v3.copy(x);else continue;else if(u instanceof THREE.Face4)if(q=g[u.a],y=g[u.b],x=g[u.c],D=g[u.d],q.visible&&y.visible&&x.visible&&D.visible&&(v.doubleSided||v.flipSided!=((D.positionScreen.x-q.positionScreen.x)*(y.positionScreen.y-q.positionScreen.y)-(D.positionScreen.y-q.positionScreen.y)*(y.positionScreen.x-q.positionScreen.x)<0||(y.positionScreen.x-x.positionScreen.x)*(D.positionScreen.y-x.positionScreen.y)-
+(y.positionScreen.y-x.positionScreen.y)*(D.positionScreen.x-x.positionScreen.x)<0)))N=i[l]=i[l]||new THREE.RenderableFace4,l++,f=N,f.v1.copy(q),f.v2.copy(y),f.v3.copy(x),f.v4.copy(D);else continue;f.normalWorld.copy(u.normal);K.multiplyVector3(f.normalWorld);f.centroidWorld.copy(u.centroid);H.multiplyVector3(f.centroidWorld);f.centroidScreen.copy(f.centroidWorld);B.multiplyVector3(f.centroidScreen);x=u.vertexNormals;q=0;for(y=x.length;q<y;q++)D=f.vertexNormalsWorld[q],D.copy(x[q]),K.multiplyVector3(D);
+q=0;for(y=R.length;q<y;q++)if(N=R[q][A]){x=0;for(D=N.length;x<D;x++)f.uvs[q][x]=N[x]}f.material=P;f.faceMaterial=u.materialIndex!==null?S[u.materialIndex]:null;f.z=f.centroidScreen.z;t.elements.push(f)}}else if(v instanceof THREE.Line){I.multiply(B,H);A=v.geometry.vertices;q=a();q.positionScreen.copy(A[0].position);I.multiplyVector4(q.positionScreen);C=1;for(u=A.length;C<u;C++)if(q=a(),q.positionScreen.copy(A[C].position),I.multiplyVector4(q.positionScreen),y=g[e-2],E.copy(q.positionScreen),F.copy(y.positionScreen),
+c(E,F))E.multiplyScalar(1/E.w),F.multiplyScalar(1/F.w),v=m[n]=m[n]||new THREE.RenderableLine,n++,j=v,j.v1.positionScreen.copy(E),j.v2.positionScreen.copy(F),j.z=Math.max(E.z,F.z),j.material=P,t.elements.push(j)}s=0;for(G=t.sprites.length;s<G;s++)if(v=t.sprites[s],H=v.matrixWorld,v instanceof THREE.Particle&&(w.set(H.n14,H.n24,H.n34,1),B.multiplyVector4(w),w.z/=w.w,w.z>0&&w.z<1))J=r[p]=r[p]||new THREE.RenderableParticle,p++,o=J,o.x=w.x/w.w,o.y=w.y/w.w,o.z=w.z,o.rotation=v.rotation.z,o.scale.x=v.scale.x*
+Math.abs(o.x-(w.x+z.projectionMatrix.n11)/(w.w+z.projectionMatrix.n14)),o.scale.y=v.scale.y*Math.abs(o.y-(w.y+z.projectionMatrix.n22)/(w.w+z.projectionMatrix.n24)),o.material=v.material,t.elements.push(o);L&&t.elements.sort(b);return t}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==void 0?d:1)};
 THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;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 b=Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b,a=Math.cos(d),d=Math.sin(d),b=Math.cos(-e),e=Math.sin(-e),g=Math.cos(c),c=Math.sin(c),f=a*b,h=d*e;this.w=f*g-h*c;this.x=f*c+h*g;this.y=d*b*g+a*e*c;this.z=a*e*g-d*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);
 this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,b+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,b+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,b-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,b-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 b=

+ 27 - 27
build/custom/ThreeSVG.js

@@ -26,8 +26,8 @@ THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var a,b=
 THREE.Matrix4=function(a,b,c,d,f,e,g,h,i,n,k,j,o,l,q,r){this.set(a!==void 0?a:1,b||0,c||0,d||0,f||0,e!==void 0?e:1,g||0,h||0,i||0,n||0,k!==void 0?k:1,j||0,o||0,l||0,q||0,r!==void 0?r:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
 THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,f,e,g,h,i,n,k,j,o,l,q,r){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=f;this.n22=e;this.n23=g;this.n24=h;this.n31=i;this.n32=n;this.n33=k;this.n34=j;this.n41=o;this.n42=l;this.n43=q;this.n44=r;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,
 b,c){var d=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,e=THREE.Matrix4.__v3;e.sub(a,b).normalize();if(e.length()===0)e.z=1;d.cross(c,e).normalize();d.length()===0&&(e.x+=1.0E-4,d.cross(c,e).normalize());f.cross(e,d).normalize();this.n11=d.x;this.n12=f.x;this.n13=e.x;this.n21=d.y;this.n22=f.y;this.n23=e.y;this.n31=d.z;this.n32=f.z;this.n33=e.z;return this},multiply:function(a,b){var c=a.n11,d=a.n12,f=a.n13,e=a.n14,g=a.n21,h=a.n22,i=a.n23,n=a.n24,k=a.n31,j=a.n32,o=a.n33,l=a.n34,q=a.n41,r=a.n42,v=a.n43,
-x=a.n44,w=b.n11,D=b.n12,t=b.n13,u=b.n14,H=b.n21,F=b.n22,z=b.n23,O=b.n24,G=b.n31,L=b.n32,B=b.n33,I=b.n34,J=b.n41,A=b.n42,K=b.n43,y=b.n44;this.n11=c*w+d*H+f*G+e*J;this.n12=c*D+d*F+f*L+e*A;this.n13=c*t+d*z+f*B+e*K;this.n14=c*u+d*O+f*I+e*y;this.n21=g*w+h*H+i*G+n*J;this.n22=g*D+h*F+i*L+n*A;this.n23=g*t+h*z+i*B+n*K;this.n24=g*u+h*O+i*I+n*y;this.n31=k*w+j*H+o*G+l*J;this.n32=k*D+j*F+o*L+l*A;this.n33=k*t+j*z+o*B+l*K;this.n34=k*u+j*O+o*I+l*y;this.n41=q*w+r*H+v*G+x*J;this.n42=q*D+r*F+v*L+x*A;this.n43=q*t+r*
-z+v*B+x*K;this.n44=q*u+r*O+v*I+x*y;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=
+y=a.n44,w=b.n11,D=b.n12,t=b.n13,u=b.n14,G=b.n21,E=b.n22,L=b.n23,A=b.n24,F=b.n31,M=b.n32,B=b.n33,K=b.n34,H=b.n41,z=b.n42,I=b.n43,x=b.n44;this.n11=c*w+d*G+f*F+e*H;this.n12=c*D+d*E+f*M+e*z;this.n13=c*t+d*L+f*B+e*I;this.n14=c*u+d*A+f*K+e*x;this.n21=g*w+h*G+i*F+n*H;this.n22=g*D+h*E+i*M+n*z;this.n23=g*t+h*L+i*B+n*I;this.n24=g*u+h*A+i*K+n*x;this.n31=k*w+j*G+o*F+l*H;this.n32=k*D+j*E+o*M+l*z;this.n33=k*t+j*L+o*B+l*I;this.n34=k*u+j*A+o*K+l*x;this.n41=q*w+r*G+v*F+y*H;this.n42=q*D+r*E+v*M+y*z;this.n43=q*t+r*
+L+v*B+y*I;this.n44=q*u+r*A+v*K+y*x;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=
 a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},multiplyVector3:function(a){var b=a.x,c=a.y,d=a.z,f=1/(this.n41*b+this.n42*c+this.n43*d+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*d+this.n14)*f;a.y=(this.n21*b+this.n22*c+this.n23*d+this.n24)*f;a.z=(this.n31*b+this.n32*c+this.n33*d+this.n34)*f;return a},multiplyVector4:function(a){var b=a.x,c=a.y,d=a.z,f=a.w;a.x=this.n11*b+this.n12*c+this.n13*d+this.n14*f;a.y=this.n21*b+this.n22*
 c+this.n23*d+this.n24*f;a.z=this.n31*b+this.n32*c+this.n33*d+this.n34*f;a.w=this.n41*b+this.n42*c+this.n43*d+this.n44*f;return a},rotateAxis:function(a){var b=a.x,c=a.y,d=a.z;a.x=b*this.n11+c*this.n12+d*this.n13;a.y=b*this.n21+c*this.n22+d*this.n23;a.z=b*this.n31+c*this.n32+d*this.n33;a.normalize();return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*
 a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,d=this.n14,f=this.n21,e=this.n22,g=this.n23,h=this.n24,i=this.n31,n=this.n32,k=this.n33,j=this.n34,o=this.n41,l=this.n42,q=this.n43,r=this.n44;return d*g*n*o-c*h*n*o-d*e*k*o+b*h*k*o+c*e*j*o-b*g*j*o-d*g*i*l+c*h*i*l+d*f*k*l-a*h*k*l-c*f*j*l+a*g*j*l+d*e*i*q-b*h*i*q-d*f*n*q+a*h*n*q+b*f*j*q-a*e*j*q-c*e*i*r+b*g*i*r+c*f*n*r-a*g*n*r-b*f*k*r+a*e*k*r},transpose:function(){var a;
@@ -53,18 +53,18 @@ THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(a,b){thi
 -1)a.parent!==void 0&&a.parent.remove(a),a.parent=this,this.children.push(a)},remove:function(a){var b=this.children.indexOf(a);if(b!==-1)a.parent=void 0,this.children.splice(b,1)},getChildByName:function(a,b){var c,d,f;c=0;for(d=this.children.length;c<d;c++){f=this.children[c];if(f.name===a)return f;if(b&&(f=f.getChildByName(a,b),f!==void 0))return f}},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 b=0,c=this.children.length;b<
 c;b++)this.children[b].updateMatrixWorld(a)}};THREE.Object3DCount=0;
-THREE.Projector=function(){function a(){var a=e[f]=e[f]||new THREE.RenderableVertex;f++;return a}function b(a,b){return b.z-a.z}function c(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;return e>=0&&f>=0&&g>=0&&h>=0?!0:e<0&&f<0||g<0&&h<0?!1:(e<0?c=Math.max(c,e/(e-f)):f<0&&(d=Math.min(d,e/(e-f))),g<0?c=Math.max(c,g/(g-h)):h<0&&(d=Math.min(d,g/(g-h))),d<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-d),!0))}var d,f,e=[],g,h,i=[],n,k=[],j,o,l=[],q,r,v=[],x={objects:[],lines:[],sprites:[],lights:[],
-elements:[]};new THREE.Vector3;var w=new THREE.Vector4,D=new THREE.Matrix4,t=new THREE.Matrix4,u=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],H=new THREE.Vector4,F=new THREE.Vector4;this.computeFrustum=function(a){u[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);u[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);u[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);u[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-
-a.n24);u[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);u[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=u[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);D.multiply(b.projectionMatrix,b.matrixWorldInverse);D.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);D.multiply(b.matrixWorld,b.projectionMatrixInverse);
-D.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(a){x.objects.length=0;x.lines.length=0;x.sprites.length=0;x.lights.length=0;var b=function(a){if(a.visible!=!1){var c;if(c=a instanceof THREE.Mesh)if(!(c=a.frustumCulled==!1))a:{for(var d=a.matrixWorld,e=-a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,
-a.scale.z)),f=0;f<6;f++)if(c=u[f].x*d.n14+u[f].y*d.n24+u[f].z*d.n34+u[f].w,c<=e){c=!1;break a}c=!0}c?x.objects.push(a):a instanceof THREE.Line?x.lines.push(a):a instanceof THREE.Sprite||a instanceof THREE.Particle?x.sprites.push(a):a instanceof THREE.Light&&x.lights.push(a);c=0;for(d=a.children.length;c<d;c++)b(a.children[c])}};b(a);return x};this.projectScene=function(z,u,G){var L=u.near,B=u.far,I,J,A,K,y,C,E,s,p,M,N,Q,T,R,S,P;r=o=n=h=0;x.elements.length=0;u.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),
-z.add(u));z.updateMatrixWorld();u.matrixWorldInverse.getInverse(u.matrixWorld);D.multiply(u.projectionMatrix,u.matrixWorldInverse);this.computeFrustum(D);x=this.projectGraph(z);z=0;for(I=x.objects.length;z<I;z++)if(p=x.objects[z],M=p.matrixWorld,Q=p.material,f=0,p instanceof THREE.Mesh){N=p.geometry;T=p.geometry.materials;K=N.vertices;R=N.faces;S=N.faceVertexUvs;N=p.matrixRotationWorld.extractRotation(M);J=0;for(A=K.length;J<A;J++)d=a(),d.positionWorld.copy(K[J].position),M.multiplyVector3(d.positionWorld),
-d.positionScreen.copy(d.positionWorld),D.multiplyVector4(d.positionScreen),d.positionScreen.x/=d.positionScreen.w,d.positionScreen.y/=d.positionScreen.w,d.visible=d.positionScreen.z>L&&d.positionScreen.z<B;K=0;for(J=R.length;K<J;K++){A=R[K];if(A instanceof THREE.Face3)if(y=e[A.a],C=e[A.b],E=e[A.c],y.visible&&C.visible&&E.visible&&(p.doubleSided||p.flipSided!=(E.positionScreen.x-y.positionScreen.x)*(C.positionScreen.y-y.positionScreen.y)-(E.positionScreen.y-y.positionScreen.y)*(C.positionScreen.x-
-y.positionScreen.x)<0))s=i[h]=i[h]||new THREE.RenderableFace3,h++,g=s,g.v1.copy(y),g.v2.copy(C),g.v3.copy(E);else continue;else if(A instanceof THREE.Face4)if(y=e[A.a],C=e[A.b],E=e[A.c],s=e[A.d],y.visible&&C.visible&&E.visible&&s.visible&&(p.doubleSided||p.flipSided!=((s.positionScreen.x-y.positionScreen.x)*(C.positionScreen.y-y.positionScreen.y)-(s.positionScreen.y-y.positionScreen.y)*(C.positionScreen.x-y.positionScreen.x)<0||(C.positionScreen.x-E.positionScreen.x)*(s.positionScreen.y-E.positionScreen.y)-
-(C.positionScreen.y-E.positionScreen.y)*(s.positionScreen.x-E.positionScreen.x)<0)))P=k[n]=k[n]||new THREE.RenderableFace4,n++,g=P,g.v1.copy(y),g.v2.copy(C),g.v3.copy(E),g.v4.copy(s);else continue;g.normalWorld.copy(A.normal);N.multiplyVector3(g.normalWorld);g.centroidWorld.copy(A.centroid);M.multiplyVector3(g.centroidWorld);g.centroidScreen.copy(g.centroidWorld);D.multiplyVector3(g.centroidScreen);E=A.vertexNormals;y=0;for(C=E.length;y<C;y++)s=g.vertexNormalsWorld[y],s.copy(E[y]),N.multiplyVector3(s);
-y=0;for(C=S.length;y<C;y++)if(P=S[y][K]){E=0;for(s=P.length;E<s;E++)g.uvs[y][E]=P[E]}g.material=Q;g.faceMaterial=A.materialIndex!==null?T[A.materialIndex]:null;g.z=g.centroidScreen.z;x.elements.push(g)}}z=0;for(I=x.lines.length;z<I;z++)if(p=x.lines[z],M=p.matrixWorld,Q=p.material,f=0,p instanceof THREE.Line){t.multiply(D,M);K=p.geometry.vertices;y=a();y.positionScreen.copy(K[0].position);t.multiplyVector4(y.positionScreen);J=1;for(A=K.length;J<A;J++)if(y=a(),y.positionScreen.copy(K[J].position),t.multiplyVector4(y.positionScreen),
-C=e[f-2],H.copy(y.positionScreen),F.copy(C.positionScreen),c(H,F))H.multiplyScalar(1/H.w),F.multiplyScalar(1/F.w),L=l[o]=l[o]||new THREE.RenderableLine,o++,j=L,j.v1.positionScreen.copy(H),j.v2.positionScreen.copy(F),j.z=Math.max(H.z,F.z),j.material=Q,x.elements.push(j)}z=0;for(I=x.sprites.length;z<I;z++)if(p=x.sprites[z],M=p.matrixWorld,p instanceof THREE.Particle&&(w.set(M.n14,M.n24,M.n34,1),D.multiplyVector4(w),w.z/=w.w,w.z>0&&w.z<1))L=v[r]=v[r]||new THREE.RenderableParticle,r++,q=L,q.x=w.x/w.w,
-q.y=w.y/w.w,q.z=w.z,q.rotation=p.rotation.z,q.scale.x=p.scale.x*Math.abs(q.x-(w.x+u.projectionMatrix.n11)/(w.w+u.projectionMatrix.n14)),q.scale.y=p.scale.y*Math.abs(q.y-(w.y+u.projectionMatrix.n22)/(w.w+u.projectionMatrix.n24)),q.material=p.material,x.elements.push(q);G&&x.elements.sort(b);return x}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==void 0?d:1)};
+THREE.Projector=function(){function a(){var a=e[f]=e[f]||new THREE.RenderableVertex;f++;return a}function b(a,b){return b.z-a.z}function c(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;return e>=0&&f>=0&&g>=0&&h>=0?!0:e<0&&f<0||g<0&&h<0?!1:(e<0?c=Math.max(c,e/(e-f)):f<0&&(d=Math.min(d,e/(e-f))),g<0?c=Math.max(c,g/(g-h)):h<0&&(d=Math.min(d,g/(g-h))),d<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-d),!0))}var d,f,e=[],g,h,i=[],n,k=[],j,o,l=[],q,r,v=[],y={objects:[],sprites:[],lights:[],elements:[]};
+new THREE.Vector3;var w=new THREE.Vector4,D=new THREE.Matrix4,t=new THREE.Matrix4,u=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],G=new THREE.Vector4,E=new THREE.Vector4;this.computeFrustum=function(a){u[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);u[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);u[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);u[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);u[4].set(a.n41-
+a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);u[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=u[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);D.multiply(b.projectionMatrix,b.matrixWorldInverse);D.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);D.multiply(b.matrixWorld,b.projectionMatrixInverse);D.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(a){y.objects.length=0;y.sprites.length=0;y.lights.length=0;var b=function(a){if(a.visible!=!1){var c;if(c=a instanceof THREE.Mesh)if(!(c=a.frustumCulled==!1))a:{for(var d=a.matrixWorld,e=-a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)),f=0;f<6;f++)if(c=
+u[f].x*d.n14+u[f].y*d.n24+u[f].z*d.n34+u[f].w,c<=e){c=!1;break a}c=!0}c?y.objects.push(a):a instanceof THREE.Line?y.objects.push(a):a instanceof THREE.Sprite||a instanceof THREE.Particle?y.sprites.push(a):a instanceof THREE.Light&&y.lights.push(a);c=0;for(d=a.children.length;c<d;c++)b(a.children[c])}};b(a);return y};this.projectScene=function(u,A,F){var M=A.near,B=A.far,K,H,z,I,x,C,J,s,p,N,O,R,P,S,T,Q;r=o=n=h=0;y.elements.length=0;A.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),
+u.add(A));u.updateMatrixWorld();A.matrixWorldInverse.getInverse(A.matrixWorld);D.multiply(A.projectionMatrix,A.matrixWorldInverse);this.computeFrustum(D);y=this.projectGraph(u);u=0;for(K=y.objects.length;u<K;u++)if(p=y.objects[u],N=p.matrixWorld,R=p.material,f=0,p instanceof THREE.Mesh){O=p.geometry;P=p.geometry.materials;I=O.vertices;S=O.faces;T=O.faceVertexUvs;O=p.matrixRotationWorld.extractRotation(N);H=0;for(z=I.length;H<z;H++)d=a(),d.positionWorld.copy(I[H].position),N.multiplyVector3(d.positionWorld),
+d.positionScreen.copy(d.positionWorld),D.multiplyVector4(d.positionScreen),d.positionScreen.x/=d.positionScreen.w,d.positionScreen.y/=d.positionScreen.w,d.visible=d.positionScreen.z>M&&d.positionScreen.z<B;I=0;for(H=S.length;I<H;I++){z=S[I];if(z instanceof THREE.Face3)if(x=e[z.a],C=e[z.b],J=e[z.c],x.visible&&C.visible&&J.visible&&(p.doubleSided||p.flipSided!=(J.positionScreen.x-x.positionScreen.x)*(C.positionScreen.y-x.positionScreen.y)-(J.positionScreen.y-x.positionScreen.y)*(C.positionScreen.x-
+x.positionScreen.x)<0))s=i[h]=i[h]||new THREE.RenderableFace3,h++,g=s,g.v1.copy(x),g.v2.copy(C),g.v3.copy(J);else continue;else if(z instanceof THREE.Face4)if(x=e[z.a],C=e[z.b],J=e[z.c],s=e[z.d],x.visible&&C.visible&&J.visible&&s.visible&&(p.doubleSided||p.flipSided!=((s.positionScreen.x-x.positionScreen.x)*(C.positionScreen.y-x.positionScreen.y)-(s.positionScreen.y-x.positionScreen.y)*(C.positionScreen.x-x.positionScreen.x)<0||(C.positionScreen.x-J.positionScreen.x)*(s.positionScreen.y-J.positionScreen.y)-
+(C.positionScreen.y-J.positionScreen.y)*(s.positionScreen.x-J.positionScreen.x)<0)))Q=k[n]=k[n]||new THREE.RenderableFace4,n++,g=Q,g.v1.copy(x),g.v2.copy(C),g.v3.copy(J),g.v4.copy(s);else continue;g.normalWorld.copy(z.normal);O.multiplyVector3(g.normalWorld);g.centroidWorld.copy(z.centroid);N.multiplyVector3(g.centroidWorld);g.centroidScreen.copy(g.centroidWorld);D.multiplyVector3(g.centroidScreen);J=z.vertexNormals;x=0;for(C=J.length;x<C;x++)s=g.vertexNormalsWorld[x],s.copy(J[x]),O.multiplyVector3(s);
+x=0;for(C=T.length;x<C;x++)if(Q=T[x][I]){J=0;for(s=Q.length;J<s;J++)g.uvs[x][J]=Q[J]}g.material=R;g.faceMaterial=z.materialIndex!==null?P[z.materialIndex]:null;g.z=g.centroidScreen.z;y.elements.push(g)}}else if(p instanceof THREE.Line){t.multiply(D,N);I=p.geometry.vertices;x=a();x.positionScreen.copy(I[0].position);t.multiplyVector4(x.positionScreen);H=1;for(z=I.length;H<z;H++)if(x=a(),x.positionScreen.copy(I[H].position),t.multiplyVector4(x.positionScreen),C=e[f-2],G.copy(x.positionScreen),E.copy(C.positionScreen),
+c(G,E))G.multiplyScalar(1/G.w),E.multiplyScalar(1/E.w),p=l[o]=l[o]||new THREE.RenderableLine,o++,j=p,j.v1.positionScreen.copy(G),j.v2.positionScreen.copy(E),j.z=Math.max(G.z,E.z),j.material=R,y.elements.push(j)}u=0;for(K=y.sprites.length;u<K;u++)if(p=y.sprites[u],N=p.matrixWorld,p instanceof THREE.Particle&&(w.set(N.n14,N.n24,N.n34,1),D.multiplyVector4(w),w.z/=w.w,w.z>0&&w.z<1))M=v[r]=v[r]||new THREE.RenderableParticle,r++,q=M,q.x=w.x/w.w,q.y=w.y/w.w,q.z=w.z,q.rotation=p.rotation.z,q.scale.x=p.scale.x*
+Math.abs(q.x-(w.x+A.projectionMatrix.n11)/(w.w+A.projectionMatrix.n14)),q.scale.y=p.scale.y*Math.abs(q.y-(w.y+A.projectionMatrix.n22)/(w.w+A.projectionMatrix.n24)),q.material=p.material,y.elements.push(q);F&&y.elements.sort(b);return y}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==void 0?d:1)};
 THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;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 b=Math.PI/360,c=a.x*b,d=a.y*b,f=a.z*b,a=Math.cos(d),d=Math.sin(d),b=Math.cos(-f),f=Math.sin(-f),e=Math.cos(c),c=Math.sin(c),g=a*b,h=d*f;this.w=g*e-h*c;this.x=g*c+h*e;this.y=d*b*e+a*f*c;this.z=a*f*e-d*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);
 this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,b+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,b+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,b-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,b-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 b=
@@ -80,9 +80,9 @@ b;a++)c=this.faces[a],c.centroid.set(0,0,0),c instanceof THREE.Face3?(c.centroid
 c,d,f,e,g,h=new THREE.Vector3,i=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),i.sub(b.position,c.position),h.crossSelf(i);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,K){h=a.vertices[b].position;i=a.vertices[c].position;n=a.vertices[d].position;k=g[e];j=g[f];o=g[K];l=i.x-h.x;q=n.x-h.x;r=i.y-h.y;v=n.y-h.y;x=i.z-h.z;w=n.z-h.z;D=j.u-k.u;t=o.u-k.u;u=j.v-k.v;H=o.v-k.v;F=1/(D*H-t*u);L.set((H*l-u*q)*F,(H*r-u*v)*F,(H*x-u*w)*F);B.set((D*q-t*l)*F,(D*v-t*r)*F,(D*w-t*x)*F);O[b].addSelf(L);O[c].addSelf(L);O[d].addSelf(L);G[b].addSelf(B);
-G[c].addSelf(B);G[d].addSelf(B)}var b,c,d,f,e,g,h,i,n,k,j,o,l,q,r,v,x,w,D,t,u,H,F,z,O=[],G=[],L=new THREE.Vector3,B=new THREE.Vector3,I=new THREE.Vector3,J=new THREE.Vector3,A=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)O[b]=new THREE.Vector3,G[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 K=["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++)A.copy(e.vertexNormals[d]),f=e[K[d]],z=O[f],I.copy(z),I.subSelf(A.multiplyScalar(A.dot(z))).normalize(),J.cross(e.vertexNormals[d],z),f=J.dot(G[f]),f=f<0?-1:1,e.vertexTangents[d]=new THREE.Vector4(I.x,I.y,I.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,
+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,I){h=a.vertices[b].position;i=a.vertices[c].position;n=a.vertices[d].position;k=g[e];j=g[f];o=g[I];l=i.x-h.x;q=n.x-h.x;r=i.y-h.y;v=n.y-h.y;y=i.z-h.z;w=n.z-h.z;D=j.u-k.u;t=o.u-k.u;u=j.v-k.v;G=o.v-k.v;E=1/(D*G-t*u);M.set((G*l-u*q)*E,(G*r-u*v)*E,(G*y-u*w)*E);B.set((D*q-t*l)*E,(D*v-t*r)*E,(D*w-t*y)*E);A[b].addSelf(M);A[c].addSelf(M);A[d].addSelf(M);F[b].addSelf(B);
+F[c].addSelf(B);F[d].addSelf(B)}var b,c,d,f,e,g,h,i,n,k,j,o,l,q,r,v,y,w,D,t,u,G,E,L,A=[],F=[],M=new THREE.Vector3,B=new THREE.Vector3,K=new THREE.Vector3,H=new THREE.Vector3,z=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)A[b]=new THREE.Vector3,F[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 I=["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++)z.copy(e.vertexNormals[d]),f=e[I[d]],L=A[f],K.copy(L),K.subSelf(z.multiplyScalar(z.dot(L))).normalize(),H.cross(e.vertexNormals[d],L),f=H.dot(F[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;
@@ -115,17 +115,17 @@ this.geometry.morphTargets.length;c++)this.morphTargetInfluences.push(0),this.mo
 THREE.Mesh.prototype.getMorphTargetIndexByName=function(a){if(this.morphTargetDictionary[a]!==void 0)return this.morphTargetDictionary[a];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+a+" does not exist. Returning 0.");return 0};THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
 THREE.Bone.prototype.update=function(a,b,c){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate)a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,b=!0;var d,f=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(d=0;d<f;d++)a=this.children[d],a instanceof THREE.Bone?a.update(this.skinMatrix,b,c):a.update(this.matrixWorld,!0,c)}else for(d=0;d<f;d++)this.children[d].update(this.skinMatrix,
 b,c)};THREE.Bone.prototype.add=function(a){if(this.children.indexOf(a)===-1&&(a.parent!==void 0&&a.parent.removeChild(a),a.parent=this,this.children.push(a),!(a instanceof THREE.Bone)))this.hasNoneBoneChildren=!0};THREE.Scene=function(){THREE.Object3D.call(this);this.overrideMaterial=this.fog=null;this.matrixAutoUpdate=!1};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;
-THREE.SVGRenderer=function(){function a(a,b,c,d){var e,f,g,h,j,i;e=0;for(f=a.length;e<f;e++)g=a[e],h=g.color,g instanceof THREE.DirectionalLight?(j=g.matrixWorld.getPosition(),i=c.dot(j),i<=0||(i*=g.intensity,d.r+=h.r*i,d.g+=h.g*i,d.b+=h.b*i)):g instanceof THREE.PointLight&&(j=g.matrixWorld.getPosition(),i=c.dot(O.sub(j,b).normalize()),i<=0||(i*=g.distance==0?1:1-Math.min(b.distanceTo(j)/g.distance,1),i!=0&&(i*=g.intensity,d.r+=h.r*i,d.g+=h.g*i,d.b+=h.b*i)))}function b(a){G[a]==null&&(G[a]=document.createElementNS("http://www.w3.org/2000/svg",
-"path"),A==0&&G[a].setAttribute("shape-rendering","crispEdges"));return G[a]}function c(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}var d=this,f,e,g,h=new THREE.Projector,i=document.createElementNS("http://www.w3.org/2000/svg","svg"),n,k,j,o,l,q,r,v,x=new THREE.Rectangle,w=new THREE.Rectangle,D=!1,t=new THREE.Color,u=new THREE.Color,H=new THREE.Color,F=new THREE.Color,z,O=new THREE.Vector3,G=[],L=[],B,I,J,A=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":A=1;break;case "low":A=0}};this.setSize=function(a,b){n=a;k=b;j=n/2;o=k/2;i.setAttribute("viewBox",-j+" "+-o+" "+n+" "+k);i.setAttribute("width",n);i.setAttribute("height",k);x.set(-j,-o,j,o)};this.clear=function(){for(;i.childNodes.length>0;)i.removeChild(i.childNodes[0])};this.render=function(k,n){var C,E,s,p;this.autoClear&&this.clear();d.info.render.vertices=0;d.info.render.faces=0;f=h.projectScene(k,n,this.sortElements);e=f.elements;
-g=f.lights;J=I=0;if(D=g.length>0){u.setRGB(0,0,0);H.setRGB(0,0,0);F.setRGB(0,0,0);C=0;for(E=g.length;C<E;C++)p=g[C],s=p.color,p instanceof THREE.AmbientLight?(u.r+=s.r,u.g+=s.g,u.b+=s.b):p instanceof THREE.DirectionalLight?(H.r+=s.r,H.g+=s.g,H.b+=s.b):p instanceof THREE.PointLight&&(F.r+=s.r,F.g+=s.g,F.b+=s.b)}C=0;for(E=e.length;C<E;C++)if(s=e[C],p=s.material,p=p instanceof THREE.MeshFaceMaterial?s.faceMaterial:p,!(p==null||p.opacity==0))if(w.empty(),s instanceof THREE.RenderableParticle)l=s,l.x*=
-j,l.y*=-o,m=0,ml=s.materials.length;else if(s instanceof THREE.RenderableLine){if(l=s.v1,q=s.v2,l.positionScreen.x*=j,l.positionScreen.y*=-o,q.positionScreen.x*=j,q.positionScreen.y*=-o,w.addPoint(l.positionScreen.x,l.positionScreen.y),w.addPoint(q.positionScreen.x,q.positionScreen.y),x.intersects(w)){s=l;var M=q,N=J++;L[N]==null&&(L[N]=document.createElementNS("http://www.w3.org/2000/svg","line"),A==0&&L[N].setAttribute("shape-rendering","crispEdges"));B=L[N];B.setAttribute("x1",s.positionScreen.x);
-B.setAttribute("y1",s.positionScreen.y);B.setAttribute("x2",M.positionScreen.x);B.setAttribute("y2",M.positionScreen.y);p instanceof THREE.LineBasicMaterial&&(B.setAttribute("style","fill: none; stroke: "+p.color.getContextStyle()+"; stroke-width: "+p.linewidth+"; stroke-opacity: "+p.opacity+"; stroke-linecap: "+p.linecap+"; stroke-linejoin: "+p.linejoin),i.appendChild(B))}}else if(s instanceof THREE.RenderableFace3){if(l=s.v1,q=s.v2,r=s.v3,l.positionScreen.x*=j,l.positionScreen.y*=-o,q.positionScreen.x*=
-j,q.positionScreen.y*=-o,r.positionScreen.x*=j,r.positionScreen.y*=-o,w.addPoint(l.positionScreen.x,l.positionScreen.y),w.addPoint(q.positionScreen.x,q.positionScreen.y),w.addPoint(r.positionScreen.x,r.positionScreen.y),x.intersects(w)){var M=l,N=q,G=r;d.info.render.vertices+=3;d.info.render.faces++;B=b(I++);B.setAttribute("d","M "+M.positionScreen.x+" "+M.positionScreen.y+" L "+N.positionScreen.x+" "+N.positionScreen.y+" L "+G.positionScreen.x+","+G.positionScreen.y+"z");p instanceof THREE.MeshBasicMaterial?
-t.copy(p.color):p instanceof THREE.MeshLambertMaterial?D?(t.r=u.r,t.g=u.g,t.b=u.b,a(g,s.centroidWorld,s.normalWorld,t),t.r=Math.max(0,Math.min(p.color.r*t.r,1)),t.g=Math.max(0,Math.min(p.color.g*t.g,1)),t.b=Math.max(0,Math.min(p.color.b*t.b,1))):t.copy(p.color):p instanceof THREE.MeshDepthMaterial?(z=1-p.__2near/(p.__farPlusNear-s.z*p.__farMinusNear),t.setRGB(z,z,z)):p instanceof THREE.MeshNormalMaterial&&t.setRGB(c(s.normalWorld.x),c(s.normalWorld.y),c(s.normalWorld.z));p.wireframe?B.setAttribute("style",
+THREE.SVGRenderer=function(){function a(a,b,c,d){var e,f,g,h,j,i;e=0;for(f=a.length;e<f;e++)g=a[e],h=g.color,g instanceof THREE.DirectionalLight?(j=g.matrixWorld.getPosition(),i=c.dot(j),i<=0||(i*=g.intensity,d.r+=h.r*i,d.g+=h.g*i,d.b+=h.b*i)):g instanceof THREE.PointLight&&(j=g.matrixWorld.getPosition(),i=c.dot(A.sub(j,b).normalize()),i<=0||(i*=g.distance==0?1:1-Math.min(b.distanceTo(j)/g.distance,1),i!=0&&(i*=g.intensity,d.r+=h.r*i,d.g+=h.g*i,d.b+=h.b*i)))}function b(a){F[a]==null&&(F[a]=document.createElementNS("http://www.w3.org/2000/svg",
+"path"),z==0&&F[a].setAttribute("shape-rendering","crispEdges"));return F[a]}function c(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}var d=this,f,e,g,h=new THREE.Projector,i=document.createElementNS("http://www.w3.org/2000/svg","svg"),n,k,j,o,l,q,r,v,y=new THREE.Rectangle,w=new THREE.Rectangle,D=!1,t=new THREE.Color,u=new THREE.Color,G=new THREE.Color,E=new THREE.Color,L,A=new THREE.Vector3,F=[],M=[],B,K,H,z=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":z=1;break;case "low":z=0}};this.setSize=function(a,b){n=a;k=b;j=n/2;o=k/2;i.setAttribute("viewBox",-j+" "+-o+" "+n+" "+k);i.setAttribute("width",n);i.setAttribute("height",k);y.set(-j,-o,j,o)};this.clear=function(){for(;i.childNodes.length>0;)i.removeChild(i.childNodes[0])};this.render=function(k,n){var C,A,s,p;this.autoClear&&this.clear();d.info.render.vertices=0;d.info.render.faces=0;f=h.projectScene(k,n,this.sortElements);e=f.elements;
+g=f.lights;H=K=0;if(D=g.length>0){u.setRGB(0,0,0);G.setRGB(0,0,0);E.setRGB(0,0,0);C=0;for(A=g.length;C<A;C++)p=g[C],s=p.color,p instanceof THREE.AmbientLight?(u.r+=s.r,u.g+=s.g,u.b+=s.b):p instanceof THREE.DirectionalLight?(G.r+=s.r,G.g+=s.g,G.b+=s.b):p instanceof THREE.PointLight&&(E.r+=s.r,E.g+=s.g,E.b+=s.b)}C=0;for(A=e.length;C<A;C++)if(s=e[C],p=s.material,p=p instanceof THREE.MeshFaceMaterial?s.faceMaterial:p,!(p==null||p.opacity==0))if(w.empty(),s instanceof THREE.RenderableParticle)l=s,l.x*=
+j,l.y*=-o,m=0,ml=s.materials.length;else if(s instanceof THREE.RenderableLine){if(l=s.v1,q=s.v2,l.positionScreen.x*=j,l.positionScreen.y*=-o,q.positionScreen.x*=j,q.positionScreen.y*=-o,w.addPoint(l.positionScreen.x,l.positionScreen.y),w.addPoint(q.positionScreen.x,q.positionScreen.y),y.intersects(w)){s=l;var N=q,O=H++;M[O]==null&&(M[O]=document.createElementNS("http://www.w3.org/2000/svg","line"),z==0&&M[O].setAttribute("shape-rendering","crispEdges"));B=M[O];B.setAttribute("x1",s.positionScreen.x);
+B.setAttribute("y1",s.positionScreen.y);B.setAttribute("x2",N.positionScreen.x);B.setAttribute("y2",N.positionScreen.y);p instanceof THREE.LineBasicMaterial&&(B.setAttribute("style","fill: none; stroke: "+p.color.getContextStyle()+"; stroke-width: "+p.linewidth+"; stroke-opacity: "+p.opacity+"; stroke-linecap: "+p.linecap+"; stroke-linejoin: "+p.linejoin),i.appendChild(B))}}else if(s instanceof THREE.RenderableFace3){if(l=s.v1,q=s.v2,r=s.v3,l.positionScreen.x*=j,l.positionScreen.y*=-o,q.positionScreen.x*=
+j,q.positionScreen.y*=-o,r.positionScreen.x*=j,r.positionScreen.y*=-o,w.addPoint(l.positionScreen.x,l.positionScreen.y),w.addPoint(q.positionScreen.x,q.positionScreen.y),w.addPoint(r.positionScreen.x,r.positionScreen.y),y.intersects(w)){var N=l,O=q,F=r;d.info.render.vertices+=3;d.info.render.faces++;B=b(K++);B.setAttribute("d","M "+N.positionScreen.x+" "+N.positionScreen.y+" L "+O.positionScreen.x+" "+O.positionScreen.y+" L "+F.positionScreen.x+","+F.positionScreen.y+"z");p instanceof THREE.MeshBasicMaterial?
+t.copy(p.color):p instanceof THREE.MeshLambertMaterial?D?(t.r=u.r,t.g=u.g,t.b=u.b,a(g,s.centroidWorld,s.normalWorld,t),t.r=Math.max(0,Math.min(p.color.r*t.r,1)),t.g=Math.max(0,Math.min(p.color.g*t.g,1)),t.b=Math.max(0,Math.min(p.color.b*t.b,1))):t.copy(p.color):p instanceof THREE.MeshDepthMaterial?(L=1-p.__2near/(p.__farPlusNear-s.z*p.__farMinusNear),t.setRGB(L,L,L)):p instanceof THREE.MeshNormalMaterial&&t.setRGB(c(s.normalWorld.x),c(s.normalWorld.y),c(s.normalWorld.z));p.wireframe?B.setAttribute("style",
 "fill: none; stroke: "+t.getContextStyle()+"; stroke-width: "+p.wireframeLinewidth+"; stroke-opacity: "+p.opacity+"; stroke-linecap: "+p.wireframeLinecap+"; stroke-linejoin: "+p.wireframeLinejoin):B.setAttribute("style","fill: "+t.getContextStyle()+"; fill-opacity: "+p.opacity);i.appendChild(B)}}else if(s instanceof THREE.RenderableFace4&&(l=s.v1,q=s.v2,r=s.v3,v=s.v4,l.positionScreen.x*=j,l.positionScreen.y*=-o,q.positionScreen.x*=j,q.positionScreen.y*=-o,r.positionScreen.x*=j,r.positionScreen.y*=
--o,v.positionScreen.x*=j,v.positionScreen.y*=-o,w.addPoint(l.positionScreen.x,l.positionScreen.y),w.addPoint(q.positionScreen.x,q.positionScreen.y),w.addPoint(r.positionScreen.x,r.positionScreen.y),w.addPoint(v.positionScreen.x,v.positionScreen.y),x.intersects(w))){var M=l,N=q,G=r,O=v;d.info.render.vertices+=4;d.info.render.faces++;B=b(I++);B.setAttribute("d","M "+M.positionScreen.x+" "+M.positionScreen.y+" L "+N.positionScreen.x+" "+N.positionScreen.y+" L "+G.positionScreen.x+","+G.positionScreen.y+
-" L "+O.positionScreen.x+","+O.positionScreen.y+"z");p instanceof THREE.MeshBasicMaterial?t.copy(p.color):p instanceof THREE.MeshLambertMaterial?D?(t.r=u.r,t.g=u.g,t.b=u.b,a(g,s.centroidWorld,s.normalWorld,t),t.r=Math.max(0,Math.min(p.color.r*t.r,1)),t.g=Math.max(0,Math.min(p.color.g*t.g,1)),t.b=Math.max(0,Math.min(p.color.b*t.b,1))):t.copy(p.color):p instanceof THREE.MeshDepthMaterial?(z=1-p.__2near/(p.__farPlusNear-s.z*p.__farMinusNear),t.setRGB(z,z,z)):p instanceof THREE.MeshNormalMaterial&&t.setRGB(c(s.normalWorld.x),
+-o,v.positionScreen.x*=j,v.positionScreen.y*=-o,w.addPoint(l.positionScreen.x,l.positionScreen.y),w.addPoint(q.positionScreen.x,q.positionScreen.y),w.addPoint(r.positionScreen.x,r.positionScreen.y),w.addPoint(v.positionScreen.x,v.positionScreen.y),y.intersects(w))){var N=l,O=q,F=r,P=v;d.info.render.vertices+=4;d.info.render.faces++;B=b(K++);B.setAttribute("d","M "+N.positionScreen.x+" "+N.positionScreen.y+" L "+O.positionScreen.x+" "+O.positionScreen.y+" L "+F.positionScreen.x+","+F.positionScreen.y+
+" L "+P.positionScreen.x+","+P.positionScreen.y+"z");p instanceof THREE.MeshBasicMaterial?t.copy(p.color):p instanceof THREE.MeshLambertMaterial?D?(t.r=u.r,t.g=u.g,t.b=u.b,a(g,s.centroidWorld,s.normalWorld,t),t.r=Math.max(0,Math.min(p.color.r*t.r,1)),t.g=Math.max(0,Math.min(p.color.g*t.g,1)),t.b=Math.max(0,Math.min(p.color.b*t.b,1))):t.copy(p.color):p instanceof THREE.MeshDepthMaterial?(L=1-p.__2near/(p.__farPlusNear-s.z*p.__farMinusNear),t.setRGB(L,L,L)):p instanceof THREE.MeshNormalMaterial&&t.setRGB(c(s.normalWorld.x),
 c(s.normalWorld.y),c(s.normalWorld.z));p.wireframe?B.setAttribute("style","fill: none; stroke: "+t.getContextStyle()+"; stroke-width: "+p.wireframeLinewidth+"; stroke-opacity: "+p.opacity+"; stroke-linecap: "+p.wireframeLinecap+"; stroke-linejoin: "+p.wireframeLinejoin):B.setAttribute("style","fill: "+t.getContextStyle()+"; fill-opacity: "+p.opacity);i.appendChild(B)}}};THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};
 THREE.RenderableVertex.prototype.copy=function(a){this.positionWorld.copy(a.positionWorld);this.positionScreen.copy(a.positionScreen)};
 THREE.RenderableFace3=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterial=this.material=null;this.uvs=[[]];this.z=null};

+ 91 - 91
build/custom/ThreeWebGL.js

@@ -26,9 +26,9 @@ THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var a,b=
 THREE.Matrix4=function(a,b,c,e,h,f,i,j,n,l,o,k,r,v,z,B){this.set(a!==void 0?a:1,b||0,c||0,e||0,h||0,f!==void 0?f:1,i||0,j||0,n||0,l||0,o!==void 0?o:1,k||0,r||0,v||0,z||0,B!==void 0?B:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
 THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,e,h,f,i,j,n,l,o,k,r,v,z,B){this.n11=a;this.n12=b;this.n13=c;this.n14=e;this.n21=h;this.n22=f;this.n23=i;this.n24=j;this.n31=n;this.n32=l;this.n33=o;this.n34=k;this.n41=r;this.n42=v;this.n43=z;this.n44=B;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,
 b,c){var e=THREE.Matrix4.__v1,h=THREE.Matrix4.__v2,f=THREE.Matrix4.__v3;f.sub(a,b).normalize();if(f.length()===0)f.z=1;e.cross(c,f).normalize();e.length()===0&&(f.x+=1.0E-4,e.cross(c,f).normalize());h.cross(f,e).normalize();this.n11=e.x;this.n12=h.x;this.n13=f.x;this.n21=e.y;this.n22=h.y;this.n23=f.y;this.n31=e.z;this.n32=h.z;this.n33=f.z;return this},multiply:function(a,b){var c=a.n11,e=a.n12,h=a.n13,f=a.n14,i=a.n21,j=a.n22,n=a.n23,l=a.n24,o=a.n31,k=a.n32,r=a.n33,v=a.n34,z=a.n41,B=a.n42,F=a.n43,
-E=a.n44,fa=b.n11,ia=b.n12,ra=b.n13,I=b.n14,J=b.n21,T=b.n22,ta=b.n23,U=b.n24,ma=b.n31,ka=b.n32,X=b.n33,Q=b.n34,L=b.n41,A=b.n42,d=b.n43,C=b.n44;this.n11=c*fa+e*J+h*ma+f*L;this.n12=c*ia+e*T+h*ka+f*A;this.n13=c*ra+e*ta+h*X+f*d;this.n14=c*I+e*U+h*Q+f*C;this.n21=i*fa+j*J+n*ma+l*L;this.n22=i*ia+j*T+n*ka+l*A;this.n23=i*ra+j*ta+n*X+l*d;this.n24=i*I+j*U+n*Q+l*C;this.n31=o*fa+k*J+r*ma+v*L;this.n32=o*ia+k*T+r*ka+v*A;this.n33=o*ra+k*ta+r*X+v*d;this.n34=o*I+k*U+r*Q+v*C;this.n41=z*fa+B*J+F*ma+E*L;this.n42=z*ia+
-B*T+F*ka+E*A;this.n43=z*ra+B*ta+F*X+E*d;this.n44=z*I+B*U+F*Q+E*C;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;
-this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},multiplyVector3:function(a){var b=a.x,c=a.y,e=a.z,h=1/(this.n41*b+this.n42*c+this.n43*e+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*e+this.n14)*h;a.y=(this.n21*b+this.n22*c+this.n23*e+this.n24)*h;a.z=(this.n31*b+this.n32*c+this.n33*e+this.n34)*h;return a},multiplyVector4:function(a){var b=a.x,c=a.y,e=a.z,h=a.w;a.x=this.n11*b+this.n12*c+this.n13*
+E=a.n44,fa=b.n11,ia=b.n12,ra=b.n13,O=b.n14,I=b.n21,T=b.n22,ta=b.n23,U=b.n24,la=b.n31,pa=b.n32,ma=b.n33,R=b.n34,K=b.n41,A=b.n42,d=b.n43,C=b.n44;this.n11=c*fa+e*I+h*la+f*K;this.n12=c*ia+e*T+h*pa+f*A;this.n13=c*ra+e*ta+h*ma+f*d;this.n14=c*O+e*U+h*R+f*C;this.n21=i*fa+j*I+n*la+l*K;this.n22=i*ia+j*T+n*pa+l*A;this.n23=i*ra+j*ta+n*ma+l*d;this.n24=i*O+j*U+n*R+l*C;this.n31=o*fa+k*I+r*la+v*K;this.n32=o*ia+k*T+r*pa+v*A;this.n33=o*ra+k*ta+r*ma+v*d;this.n34=o*O+k*U+r*R+v*C;this.n41=z*fa+B*I+F*la+E*K;this.n42=z*
+ia+B*T+F*pa+E*A;this.n43=z*ra+B*ta+F*ma+E*d;this.n44=z*O+B*U+F*R+E*C;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=
+a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},multiplyVector3:function(a){var b=a.x,c=a.y,e=a.z,h=1/(this.n41*b+this.n42*c+this.n43*e+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*e+this.n14)*h;a.y=(this.n21*b+this.n22*c+this.n23*e+this.n24)*h;a.z=(this.n31*b+this.n32*c+this.n33*e+this.n34)*h;return a},multiplyVector4:function(a){var b=a.x,c=a.y,e=a.z,h=a.w;a.x=this.n11*b+this.n12*c+this.n13*
 e+this.n14*h;a.y=this.n21*b+this.n22*c+this.n23*e+this.n24*h;a.z=this.n31*b+this.n32*c+this.n33*e+this.n34*h;a.w=this.n41*b+this.n42*c+this.n43*e+this.n44*h;return a},rotateAxis:function(a){var b=a.x,c=a.y,e=a.z;a.x=b*this.n11+c*this.n12+e*this.n13;a.y=b*this.n21+c*this.n22+e*this.n23;a.z=b*this.n31+c*this.n32+e*this.n33;a.normalize();return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*
 a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,e=this.n14,h=this.n21,f=this.n22,i=this.n23,j=this.n24,n=this.n31,l=this.n32,o=this.n33,k=this.n34,r=this.n41,v=this.n42,z=this.n43,B=this.n44;return e*i*l*r-c*j*l*r-e*f*o*r+b*j*o*r+c*f*k*r-b*i*k*r-e*i*n*v+c*j*n*v+e*h*o*v-a*j*o*v-c*h*k*v+a*i*k*v+e*f*n*z-b*j*n*z-e*h*l*z+a*j*l*z+b*h*k*z-a*f*k*z-c*f*n*B+b*i*n*B+
 c*h*l*B-a*i*l*B-b*h*o*B+a*f*o*B},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;
@@ -53,18 +53,18 @@ THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(a,b){thi
 -1)a.parent!==void 0&&a.parent.remove(a),a.parent=this,this.children.push(a)},remove:function(a){var b=this.children.indexOf(a);if(b!==-1)a.parent=void 0,this.children.splice(b,1)},getChildByName:function(a,b){var c,e,h;c=0;for(e=this.children.length;c<e;c++){h=this.children[c];if(h.name===a)return h;if(b&&(h=h.getChildByName(a,b),h!==void 0))return h}},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 b=0,c=this.children.length;b<
 c;b++)this.children[b].updateMatrixWorld(a)}};THREE.Object3DCount=0;
-THREE.Projector=function(){function a(){var a=f[h]=f[h]||new THREE.RenderableVertex;h++;return a}function b(a,b){return b.z-a.z}function c(a,b){var c=0,e=1,f=a.z+a.w,h=b.z+b.w,i=-a.z+a.w,j=-b.z+b.w;return f>=0&&h>=0&&i>=0&&j>=0?!0:f<0&&h<0||i<0&&j<0?!1:(f<0?c=Math.max(c,f/(f-h)):h<0&&(e=Math.min(e,f/(f-h))),i<0?c=Math.max(c,i/(i-j)):j<0&&(e=Math.min(e,i/(i-j))),e<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-e),!0))}var e,h,f=[],i,j,n=[],l,o=[],k,r,v=[],z,B,F=[],E={objects:[],lines:[],sprites:[],lights:[],
-elements:[]};new THREE.Vector3;var fa=new THREE.Vector4,ia=new THREE.Matrix4,ra=new THREE.Matrix4,I=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],J=new THREE.Vector4,T=new THREE.Vector4;this.computeFrustum=function(a){I[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);I[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);I[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);I[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,
-a.n44-a.n24);I[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);I[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=I[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);ia.multiply(b.projectionMatrix,b.matrixWorldInverse);ia.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);ia.multiply(b.matrixWorld,b.projectionMatrixInverse);
-ia.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(a){E.objects.length=0;E.lines.length=0;E.sprites.length=0;E.lights.length=0;var b=function(a){if(a.visible!=!1){var c;if(c=a instanceof THREE.Mesh)if(!(c=a.frustumCulled==!1))a:{for(var e=a.matrixWorld,f=-a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,
-a.scale.z)),h=0;h<6;h++)if(c=I[h].x*e.n14+I[h].y*e.n24+I[h].z*e.n34+I[h].w,c<=f){c=!1;break a}c=!0}c?E.objects.push(a):a instanceof THREE.Line?E.lines.push(a):a instanceof THREE.Sprite||a instanceof THREE.Particle?E.sprites.push(a):a instanceof THREE.Light&&E.lights.push(a);c=0;for(e=a.children.length;c<e;c++)b(a.children[c])}};b(a);return E};this.projectScene=function(I,U,ma){var ka=U.near,X=U.far,Q,L,A,d,C,S,W,R,M,za,wa,xa,Ia,Ca,Da,Aa;B=r=l=j=0;E.elements.length=0;U.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),
-I.add(U));I.updateMatrixWorld();U.matrixWorldInverse.getInverse(U.matrixWorld);ia.multiply(U.projectionMatrix,U.matrixWorldInverse);this.computeFrustum(ia);E=this.projectGraph(I);I=0;for(Q=E.objects.length;I<Q;I++)if(M=E.objects[I],za=M.matrixWorld,xa=M.material,h=0,M instanceof THREE.Mesh){wa=M.geometry;Ia=M.geometry.materials;d=wa.vertices;Ca=wa.faces;Da=wa.faceVertexUvs;wa=M.matrixRotationWorld.extractRotation(za);L=0;for(A=d.length;L<A;L++)e=a(),e.positionWorld.copy(d[L].position),za.multiplyVector3(e.positionWorld),
-e.positionScreen.copy(e.positionWorld),ia.multiplyVector4(e.positionScreen),e.positionScreen.x/=e.positionScreen.w,e.positionScreen.y/=e.positionScreen.w,e.visible=e.positionScreen.z>ka&&e.positionScreen.z<X;d=0;for(L=Ca.length;d<L;d++){A=Ca[d];if(A instanceof THREE.Face3)if(C=f[A.a],S=f[A.b],W=f[A.c],C.visible&&S.visible&&W.visible&&(M.doubleSided||M.flipSided!=(W.positionScreen.x-C.positionScreen.x)*(S.positionScreen.y-C.positionScreen.y)-(W.positionScreen.y-C.positionScreen.y)*(S.positionScreen.x-
-C.positionScreen.x)<0))R=n[j]=n[j]||new THREE.RenderableFace3,j++,i=R,i.v1.copy(C),i.v2.copy(S),i.v3.copy(W);else continue;else if(A instanceof THREE.Face4)if(C=f[A.a],S=f[A.b],W=f[A.c],R=f[A.d],C.visible&&S.visible&&W.visible&&R.visible&&(M.doubleSided||M.flipSided!=((R.positionScreen.x-C.positionScreen.x)*(S.positionScreen.y-C.positionScreen.y)-(R.positionScreen.y-C.positionScreen.y)*(S.positionScreen.x-C.positionScreen.x)<0||(S.positionScreen.x-W.positionScreen.x)*(R.positionScreen.y-W.positionScreen.y)-
-(S.positionScreen.y-W.positionScreen.y)*(R.positionScreen.x-W.positionScreen.x)<0)))Aa=o[l]=o[l]||new THREE.RenderableFace4,l++,i=Aa,i.v1.copy(C),i.v2.copy(S),i.v3.copy(W),i.v4.copy(R);else continue;i.normalWorld.copy(A.normal);wa.multiplyVector3(i.normalWorld);i.centroidWorld.copy(A.centroid);za.multiplyVector3(i.centroidWorld);i.centroidScreen.copy(i.centroidWorld);ia.multiplyVector3(i.centroidScreen);W=A.vertexNormals;C=0;for(S=W.length;C<S;C++)R=i.vertexNormalsWorld[C],R.copy(W[C]),wa.multiplyVector3(R);
-C=0;for(S=Da.length;C<S;C++)if(Aa=Da[C][d]){W=0;for(R=Aa.length;W<R;W++)i.uvs[C][W]=Aa[W]}i.material=xa;i.faceMaterial=A.materialIndex!==null?Ia[A.materialIndex]:null;i.z=i.centroidScreen.z;E.elements.push(i)}}I=0;for(Q=E.lines.length;I<Q;I++)if(M=E.lines[I],za=M.matrixWorld,xa=M.material,h=0,M instanceof THREE.Line){ra.multiply(ia,za);d=M.geometry.vertices;C=a();C.positionScreen.copy(d[0].position);ra.multiplyVector4(C.positionScreen);L=1;for(A=d.length;L<A;L++)if(C=a(),C.positionScreen.copy(d[L].position),
-ra.multiplyVector4(C.positionScreen),S=f[h-2],J.copy(C.positionScreen),T.copy(S.positionScreen),c(J,T))J.multiplyScalar(1/J.w),T.multiplyScalar(1/T.w),ka=v[r]=v[r]||new THREE.RenderableLine,r++,k=ka,k.v1.positionScreen.copy(J),k.v2.positionScreen.copy(T),k.z=Math.max(J.z,T.z),k.material=xa,E.elements.push(k)}I=0;for(Q=E.sprites.length;I<Q;I++)if(M=E.sprites[I],za=M.matrixWorld,M instanceof THREE.Particle&&(fa.set(za.n14,za.n24,za.n34,1),ia.multiplyVector4(fa),fa.z/=fa.w,fa.z>0&&fa.z<1))ka=F[B]=F[B]||
-new THREE.RenderableParticle,B++,z=ka,z.x=fa.x/fa.w,z.y=fa.y/fa.w,z.z=fa.z,z.rotation=M.rotation.z,z.scale.x=M.scale.x*Math.abs(z.x-(fa.x+U.projectionMatrix.n11)/(fa.w+U.projectionMatrix.n14)),z.scale.y=M.scale.y*Math.abs(z.y-(fa.y+U.projectionMatrix.n22)/(fa.w+U.projectionMatrix.n24)),z.material=M.material,E.elements.push(z);ma&&E.elements.sort(b);return E}};THREE.Quaternion=function(a,b,c,e){this.set(a||0,b||0,c||0,e!==void 0?e:1)};
+THREE.Projector=function(){function a(){var a=f[h]=f[h]||new THREE.RenderableVertex;h++;return a}function b(a,b){return b.z-a.z}function c(a,b){var c=0,e=1,f=a.z+a.w,h=b.z+b.w,i=-a.z+a.w,j=-b.z+b.w;return f>=0&&h>=0&&i>=0&&j>=0?!0:f<0&&h<0||i<0&&j<0?!1:(f<0?c=Math.max(c,f/(f-h)):h<0&&(e=Math.min(e,f/(f-h))),i<0?c=Math.max(c,i/(i-j)):j<0&&(e=Math.min(e,i/(i-j))),e<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-e),!0))}var e,h,f=[],i,j,n=[],l,o=[],k,r,v=[],z,B,F=[],E={objects:[],sprites:[],lights:[],elements:[]};
+new THREE.Vector3;var fa=new THREE.Vector4,ia=new THREE.Matrix4,ra=new THREE.Matrix4,O=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],I=new THREE.Vector4,T=new THREE.Vector4;this.computeFrustum=function(a){O[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);O[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);O[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);O[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);
+O[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);O[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=O[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);ia.multiply(b.projectionMatrix,b.matrixWorldInverse);ia.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);ia.multiply(b.matrixWorld,b.projectionMatrixInverse);
+ia.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(a){E.objects.length=0;E.sprites.length=0;E.lights.length=0;var b=function(a){if(a.visible!=!1){var c;if(c=a instanceof THREE.Mesh)if(!(c=a.frustumCulled==!1))a:{for(var e=a.matrixWorld,f=-a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)),
+h=0;h<6;h++)if(c=O[h].x*e.n14+O[h].y*e.n24+O[h].z*e.n34+O[h].w,c<=f){c=!1;break a}c=!0}c?E.objects.push(a):a instanceof THREE.Line?E.objects.push(a):a instanceof THREE.Sprite||a instanceof THREE.Particle?E.sprites.push(a):a instanceof THREE.Light&&E.lights.push(a);c=0;for(e=a.children.length;c<e;c++)b(a.children[c])}};b(a);return E};this.projectScene=function(O,U,la){var pa=U.near,ma=U.far,R,K,A,d,C,S,W,Q,N,Aa,va,Ha,La,wa,Ba,ya;B=r=l=j=0;E.elements.length=0;U.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),
+O.add(U));O.updateMatrixWorld();U.matrixWorldInverse.getInverse(U.matrixWorld);ia.multiply(U.projectionMatrix,U.matrixWorldInverse);this.computeFrustum(ia);E=this.projectGraph(O);O=0;for(R=E.objects.length;O<R;O++)if(N=E.objects[O],Aa=N.matrixWorld,Ha=N.material,h=0,N instanceof THREE.Mesh){va=N.geometry;La=N.geometry.materials;d=va.vertices;wa=va.faces;Ba=va.faceVertexUvs;va=N.matrixRotationWorld.extractRotation(Aa);K=0;for(A=d.length;K<A;K++)e=a(),e.positionWorld.copy(d[K].position),Aa.multiplyVector3(e.positionWorld),
+e.positionScreen.copy(e.positionWorld),ia.multiplyVector4(e.positionScreen),e.positionScreen.x/=e.positionScreen.w,e.positionScreen.y/=e.positionScreen.w,e.visible=e.positionScreen.z>pa&&e.positionScreen.z<ma;d=0;for(K=wa.length;d<K;d++){A=wa[d];if(A instanceof THREE.Face3)if(C=f[A.a],S=f[A.b],W=f[A.c],C.visible&&S.visible&&W.visible&&(N.doubleSided||N.flipSided!=(W.positionScreen.x-C.positionScreen.x)*(S.positionScreen.y-C.positionScreen.y)-(W.positionScreen.y-C.positionScreen.y)*(S.positionScreen.x-
+C.positionScreen.x)<0))Q=n[j]=n[j]||new THREE.RenderableFace3,j++,i=Q,i.v1.copy(C),i.v2.copy(S),i.v3.copy(W);else continue;else if(A instanceof THREE.Face4)if(C=f[A.a],S=f[A.b],W=f[A.c],Q=f[A.d],C.visible&&S.visible&&W.visible&&Q.visible&&(N.doubleSided||N.flipSided!=((Q.positionScreen.x-C.positionScreen.x)*(S.positionScreen.y-C.positionScreen.y)-(Q.positionScreen.y-C.positionScreen.y)*(S.positionScreen.x-C.positionScreen.x)<0||(S.positionScreen.x-W.positionScreen.x)*(Q.positionScreen.y-W.positionScreen.y)-
+(S.positionScreen.y-W.positionScreen.y)*(Q.positionScreen.x-W.positionScreen.x)<0)))ya=o[l]=o[l]||new THREE.RenderableFace4,l++,i=ya,i.v1.copy(C),i.v2.copy(S),i.v3.copy(W),i.v4.copy(Q);else continue;i.normalWorld.copy(A.normal);va.multiplyVector3(i.normalWorld);i.centroidWorld.copy(A.centroid);Aa.multiplyVector3(i.centroidWorld);i.centroidScreen.copy(i.centroidWorld);ia.multiplyVector3(i.centroidScreen);W=A.vertexNormals;C=0;for(S=W.length;C<S;C++)Q=i.vertexNormalsWorld[C],Q.copy(W[C]),va.multiplyVector3(Q);
+C=0;for(S=Ba.length;C<S;C++)if(ya=Ba[C][d]){W=0;for(Q=ya.length;W<Q;W++)i.uvs[C][W]=ya[W]}i.material=Ha;i.faceMaterial=A.materialIndex!==null?La[A.materialIndex]:null;i.z=i.centroidScreen.z;E.elements.push(i)}}else if(N instanceof THREE.Line){ra.multiply(ia,Aa);d=N.geometry.vertices;C=a();C.positionScreen.copy(d[0].position);ra.multiplyVector4(C.positionScreen);K=1;for(A=d.length;K<A;K++)if(C=a(),C.positionScreen.copy(d[K].position),ra.multiplyVector4(C.positionScreen),S=f[h-2],I.copy(C.positionScreen),
+T.copy(S.positionScreen),c(I,T))I.multiplyScalar(1/I.w),T.multiplyScalar(1/T.w),N=v[r]=v[r]||new THREE.RenderableLine,r++,k=N,k.v1.positionScreen.copy(I),k.v2.positionScreen.copy(T),k.z=Math.max(I.z,T.z),k.material=Ha,E.elements.push(k)}O=0;for(R=E.sprites.length;O<R;O++)if(N=E.sprites[O],Aa=N.matrixWorld,N instanceof THREE.Particle&&(fa.set(Aa.n14,Aa.n24,Aa.n34,1),ia.multiplyVector4(fa),fa.z/=fa.w,fa.z>0&&fa.z<1))pa=F[B]=F[B]||new THREE.RenderableParticle,B++,z=pa,z.x=fa.x/fa.w,z.y=fa.y/fa.w,z.z=
+fa.z,z.rotation=N.rotation.z,z.scale.x=N.scale.x*Math.abs(z.x-(fa.x+U.projectionMatrix.n11)/(fa.w+U.projectionMatrix.n14)),z.scale.y=N.scale.y*Math.abs(z.y-(fa.y+U.projectionMatrix.n22)/(fa.w+U.projectionMatrix.n24)),z.material=N.material,E.elements.push(z);la&&E.elements.sort(b);return E}};THREE.Quaternion=function(a,b,c,e){this.set(a||0,b||0,c||0,e!==void 0?e:1)};
 THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,e){this.x=a;this.y=b;this.z=c;this.w=e;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 b=Math.PI/360,c=a.x*b,e=a.y*b,h=a.z*b,a=Math.cos(e),e=Math.sin(e),b=Math.cos(-h),h=Math.sin(-h),f=Math.cos(c),c=Math.sin(c),i=a*b,j=e*h;this.w=i*f-j*c;this.x=i*c+j*f;this.y=e*b*f+a*h*c;this.z=a*h*f-e*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,e=Math.sin(c);
 this.x=a.x*e;this.y=a.y*e;this.z=a.z*e;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,b+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,b+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,b-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,b-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 b=
@@ -80,9 +80,9 @@ b;a++)c=this.faces[a],c.centroid.set(0,0,0),c instanceof THREE.Face3?(c.centroid
 c,e,h,f,i,j=new THREE.Vector3,n=new THREE.Vector3;e=0;for(h=this.faces.length;e<h;e++){f=this.faces[e];if(a&&f.vertexNormals.length){j.set(0,0,0);b=0;for(c=f.vertexNormals.length;b<c;b++)j.addSelf(f.vertexNormals[b]);j.divideScalar(3)}else b=this.vertices[f.a],c=this.vertices[f.b],i=this.vertices[f.c],j.sub(i.position,c.position),n.sub(b.position,c.position),j.crossSelf(n);j.isZero()||j.normalize();f.normal.copy(j)}},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,d,b,c,e,f,h){j=a.vertices[d].position;n=a.vertices[b].position;l=a.vertices[c].position;o=i[e];k=i[f];r=i[h];v=n.x-j.x;z=l.x-j.x;B=n.y-j.y;F=l.y-j.y;E=n.z-j.z;fa=l.z-j.z;ia=k.u-o.u;ra=r.u-o.u;I=k.v-o.v;J=r.v-o.v;T=1/(ia*J-ra*I);ka.set((J*v-I*z)*T,(J*B-I*F)*T,(J*E-I*fa)*T);X.set((ia*z-ra*v)*T,(ia*F-ra*B)*T,(ia*fa-ra*E)*T);U[d].addSelf(ka);U[b].addSelf(ka);U[c].addSelf(ka);
-ma[d].addSelf(X);ma[b].addSelf(X);ma[c].addSelf(X)}var b,c,e,h,f,i,j,n,l,o,k,r,v,z,B,F,E,fa,ia,ra,I,J,T,ta,U=[],ma=[],ka=new THREE.Vector3,X=new THREE.Vector3,Q=new THREE.Vector3,L=new THREE.Vector3,A=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)U[b]=new THREE.Vector3,ma[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)f=this.faces[b],i=this.faceVertexUvs[0][b],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 d=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){f=this.faces[b];for(e=0;e<f.vertexNormals.length;e++)A.copy(f.vertexNormals[e]),h=f[d[e]],ta=U[h],Q.copy(ta),Q.subSelf(A.multiplyScalar(A.dot(ta))).normalize(),L.cross(f.vertexNormals[e],ta),h=L.dot(ma[h]),h=h<0?-1:1,f.vertexTangents[e]=new THREE.Vector4(Q.x,Q.y,Q.z,h)}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],
+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,d,b,c,e,f,h){j=a.vertices[d].position;n=a.vertices[b].position;l=a.vertices[c].position;o=i[e];k=i[f];r=i[h];v=n.x-j.x;z=l.x-j.x;B=n.y-j.y;F=l.y-j.y;E=n.z-j.z;fa=l.z-j.z;ia=k.u-o.u;ra=r.u-o.u;O=k.v-o.v;I=r.v-o.v;T=1/(ia*I-ra*O);pa.set((I*v-O*z)*T,(I*B-O*F)*T,(I*E-O*fa)*T);ma.set((ia*z-ra*v)*T,(ia*F-ra*B)*T,(ia*fa-ra*E)*T);U[d].addSelf(pa);U[b].addSelf(pa);U[c].addSelf(pa);
+la[d].addSelf(ma);la[b].addSelf(ma);la[c].addSelf(ma)}var b,c,e,h,f,i,j,n,l,o,k,r,v,z,B,F,E,fa,ia,ra,O,I,T,ta,U=[],la=[],pa=new THREE.Vector3,ma=new THREE.Vector3,R=new THREE.Vector3,K=new THREE.Vector3,A=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)U[b]=new THREE.Vector3,la[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)f=this.faces[b],i=this.faceVertexUvs[0][b],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 d=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){f=this.faces[b];for(e=0;e<f.vertexNormals.length;e++)A.copy(f.vertexNormals[e]),h=f[d[e]],ta=U[h],R.copy(ta),R.subSelf(A.multiplyScalar(A.dot(ta))).normalize(),K.cross(f.vertexNormals[e],ta),h=K.dot(la[h]),h=h<0?-1:1,f.vertexTangents[e]=new THREE.Vector4(R.x,R.y,R.z,h)}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,h=Math.pow(10,4),f,i;f=0;for(i=this.vertices.length;f<i;f++)e=this.vertices[f].position,e=[Math.round(e.x*h),Math.round(e.y*h),Math.round(e.z*h)].join("_"),
 a[e]===void 0?(a[e]=f,b.push(this.vertices[f]),c[f]=b.length-1):c[f]=c[a[e]];f=0;for(i=this.faces.length;f<i;f++)if(a=this.faces[f],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;
@@ -175,24 +175,24 @@ 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 b(a,d){if(a.material&&!(a.material instanceof THREE.MeshFaceMaterial))return a.material;else if(d.materialIndex>=0)return a.geometry.materials[d.materialIndex]}function c(a,b,c){var e,f,h,i=a.vertices,u=i.length,p=a.colors,q=p.length,j=a.__vertexArray,ya=a.__colorArray,Ba=a.__sortArray,P=a.__dirtyVertices,o=a.__dirtyColors,n=a.__webglCustomAttributesList,k;if(n){h=0;for(e=n.length;h<e;h++)n[h].offset=0}if(c.sortParticles){Ea.multiplySelf(c.matrixWorld);for(e=
-0;e<u;e++)f=i[e].position,La.copy(f),Ea.multiplyVector3(La),Ba[e]=[La.z,e];Ba.sort(function(a,d){return d[0]-a[0]});for(e=0;e<u;e++)f=i[Ba[e][1]].position,h=e*3,j[h]=f.x,j[h+1]=f.y,j[h+2]=f.z;for(e=0;e<q;e++)h=e*3,color=p[Ba[e][1]],ya[h]=color.r,ya[h+1]=color.g,ya[h+2]=color.b;if(n){h=0;for(e=n.length;h<e;h++){u=n[h];q=u.value.length;for(p=0;p<q;p++){index=Ba[p][1];i=u.offset;if(u.size===1){if(u.boundTo===void 0||u.boundTo==="vertices")u.array[i]=u.value[index]}else{if(u.boundTo===void 0||u.boundTo===
-"vertices")k=u.value[index];u.size===2?(u.array[i]=k.x,u.array[i+1]=k.y):u.size===3?u.type==="c"?(u.array[i]=k.r,u.array[i+1]=k.g,u.array[i+2]=k.b):(u.array[i]=k.x,u.array[i+1]=k.y,u.array[i+2]=k.z):(u.array[i]=k.x,u.array[i+1]=k.y,u.array[i+2]=k.z,u.array[i+3]=k.w)}u.offset+=u.size}}}}else{if(P)for(e=0;e<u;e++)f=i[e].position,h=e*3,j[h]=f.x,j[h+1]=f.y,j[h+2]=f.z;if(o)for(e=0;e<q;e++)color=p[e],h=e*3,ya[h]=color.r,ya[h+1]=color.g,ya[h+2]=color.b;if(n){h=0;for(e=n.length;h<e;h++)if(u=n[h],u.__original.needsUpdate){q=
+THREE.WebGLRenderer=function(a){function b(a,d){if(a.material&&!(a.material instanceof THREE.MeshFaceMaterial))return a.material;else if(d.materialIndex>=0)return a.geometry.materials[d.materialIndex]}function c(a,b,c){var e,f,h,i=a.vertices,u=i.length,p=a.colors,q=p.length,j=a.__vertexArray,xa=a.__colorArray,za=a.__sortArray,P=a.__dirtyVertices,o=a.__dirtyColors,n=a.__webglCustomAttributesList,k;if(n){h=0;for(e=n.length;h<e;h++)n[h].offset=0}if(c.sortParticles){Ca.multiplySelf(c.matrixWorld);for(e=
+0;e<u;e++)f=i[e].position,Ia.copy(f),Ca.multiplyVector3(Ia),za[e]=[Ia.z,e];za.sort(function(a,d){return d[0]-a[0]});for(e=0;e<u;e++)f=i[za[e][1]].position,h=e*3,j[h]=f.x,j[h+1]=f.y,j[h+2]=f.z;for(e=0;e<q;e++)h=e*3,color=p[za[e][1]],xa[h]=color.r,xa[h+1]=color.g,xa[h+2]=color.b;if(n){h=0;for(e=n.length;h<e;h++){u=n[h];q=u.value.length;for(p=0;p<q;p++){index=za[p][1];i=u.offset;if(u.size===1){if(u.boundTo===void 0||u.boundTo==="vertices")u.array[i]=u.value[index]}else{if(u.boundTo===void 0||u.boundTo===
+"vertices")k=u.value[index];u.size===2?(u.array[i]=k.x,u.array[i+1]=k.y):u.size===3?u.type==="c"?(u.array[i]=k.r,u.array[i+1]=k.g,u.array[i+2]=k.b):(u.array[i]=k.x,u.array[i+1]=k.y,u.array[i+2]=k.z):(u.array[i]=k.x,u.array[i+1]=k.y,u.array[i+2]=k.z,u.array[i+3]=k.w)}u.offset+=u.size}}}}else{if(P)for(e=0;e<u;e++)f=i[e].position,h=e*3,j[h]=f.x,j[h+1]=f.y,j[h+2]=f.z;if(o)for(e=0;e<q;e++)color=p[e],h=e*3,xa[h]=color.r,xa[h+1]=color.g,xa[h+2]=color.b;if(n){h=0;for(e=n.length;h<e;h++)if(u=n[h],u.__original.needsUpdate){q=
 u.value.length;for(p=0;p<q;p++){i=u.offset;if(u.size===1){if(u.boundTo===void 0||u.boundTo==="vertices")u.array[i]=u.value[p]}else{if(u.boundTo===void 0||u.boundTo==="vertices")k=u.value[p];u.size===2?(u.array[i]=k.x,u.array[i+1]=k.y):u.size===3?u.type==="c"?(u.array[i]=k.r,u.array[i+1]=k.g,u.array[i+2]=k.b):(u.array[i]=k.x,u.array[i+1]=k.y,u.array[i+2]=k.z):(u.array[i]=k.x,u.array[i+1]=k.y,u.array[i+2]=k.z,u.array[i+3]=k.w)}u.offset+=u.size}}}}if(P||c.sortParticles)d.bindBuffer(d.ARRAY_BUFFER,a.__webglVertexBuffer),
-d.bufferData(d.ARRAY_BUFFER,j,b);if(o||c.sortParticles)d.bindBuffer(d.ARRAY_BUFFER,a.__webglColorBuffer),d.bufferData(d.ARRAY_BUFFER,ya,b);if(n){h=0;for(e=n.length;h<e;h++)if(u=n[h],u.__original.needsUpdate||c.sortParticles)d.bindBuffer(d.ARRAY_BUFFER,u.buffer),d.bufferData(d.ARRAY_BUFFER,u.array,b)}}function e(a,b,c,e,h){e.program||A.initMaterial(e,b,c,h);if(e.morphTargets&&!h.__webglMorphTargetInfluences){h.__webglMorphTargetInfluences=new Float32Array(A.maxMorphTargets);for(var f=0,i=A.maxMorphTargets;f<
-i;f++)h.__webglMorphTargetInfluences[f]=0}var u=!1,f=e.program,i=f.uniforms,p=e.uniforms;f!==S&&(d.useProgram(f),S=f,u=!0);if(e.id!==R)R=e.id,u=!0;if(u){d.uniformMatrix4fv(i.projectionMatrix,!1,Sa);if(c&&e.fog)if(p.fogColor.value=c.color,c instanceof THREE.Fog)p.fogNear.value=c.near,p.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)p.fogDensity.value=c.density;if(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e.lights){for(var q,j,k=0,n=0,P=0,o,l,r,v=Ya,y=v.directional.colors,
-t=v.directional.positions,z=v.point.colors,B=v.point.positions,C=v.point.distances,I=0,G=0,c=q=r=0,u=b.length;c<u;c++)if(q=b[c],j=q.color,o=q.position,l=q.intensity,r=q.distance,q instanceof THREE.AmbientLight)A.gammaInput?(k+=j.r*j.r,n+=j.g*j.g,P+=j.b*j.b):(k+=j.r,n+=j.g,P+=j.b);else if(q instanceof THREE.DirectionalLight)r=I*3,A.gammaInput?(y[r]=j.r*j.r*l*l,y[r+1]=j.g*j.g*l*l,y[r+2]=j.b*j.b*l*l):(y[r]=j.r*l,y[r+1]=j.g*l,y[r+2]=j.b*l),t[r]=o.x,t[r+1]=o.y,t[r+2]=o.z,I+=1;else if(q instanceof THREE.SpotLight)r=
-I*3,A.gammaInput?(y[r]=j.r*j.r*l*l,y[r+1]=j.g*j.g*l*l,y[r+2]=j.b*j.b*l*l):(y[r]=j.r*l,y[r+1]=j.g*l,y[r+2]=j.b*l),j=1/o.length(),t[r]=o.x*j,t[r+1]=o.y*j,t[r+2]=o.z*j,I+=1;else if(q instanceof THREE.PointLight)q=G*3,A.gammaInput?(z[q]=j.r*j.r*l*l,z[q+1]=j.g*j.g*l*l,z[q+2]=j.b*j.b*l*l):(z[q]=j.r*l,z[q+1]=j.g*l,z[q+2]=j.b*l),B[q]=o.x,B[q+1]=o.y,B[q+2]=o.z,C[G]=r,G+=1;c=I*3;for(u=y.length;c<u;c++)y[c]=0;c=G*3;for(u=z.length;c<u;c++)z[c]=0;v.point.length=G;v.directional.length=I;v.ambient[0]=k;v.ambient[1]=
-n;v.ambient[2]=P;b=Ya;p.enableLighting.value=b.directional.length+b.point.length;p.ambientLightColor.value=b.ambient;p.directionalLightColor.value=b.directional.colors;p.directionalLightDirection.value=b.directional.positions;p.pointLightColor.value=b.point.colors;p.pointLightPosition.value=b.point.positions;p.pointLightDistance.value=b.point.distances}if(e instanceof THREE.MeshBasicMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.MeshPhongMaterial)p.opacity.value=e.opacity,A.gammaInput?
+d.bufferData(d.ARRAY_BUFFER,j,b);if(o||c.sortParticles)d.bindBuffer(d.ARRAY_BUFFER,a.__webglColorBuffer),d.bufferData(d.ARRAY_BUFFER,xa,b);if(n){h=0;for(e=n.length;h<e;h++)if(u=n[h],u.__original.needsUpdate||c.sortParticles)d.bindBuffer(d.ARRAY_BUFFER,u.buffer),d.bufferData(d.ARRAY_BUFFER,u.array,b)}}function e(a,b,c,e,h){e.program||A.initMaterial(e,b,c,h);if(e.morphTargets&&!h.__webglMorphTargetInfluences){h.__webglMorphTargetInfluences=new Float32Array(A.maxMorphTargets);for(var f=0,i=A.maxMorphTargets;f<
+i;f++)h.__webglMorphTargetInfluences[f]=0}var u=!1,f=e.program,i=f.uniforms,p=e.uniforms;f!==S&&(d.useProgram(f),S=f,u=!0);if(e.id!==Q)Q=e.id,u=!0;if(u){d.uniformMatrix4fv(i.projectionMatrix,!1,Ta);if(c&&e.fog)if(p.fogColor.value=c.color,c instanceof THREE.Fog)p.fogNear.value=c.near,p.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)p.fogDensity.value=c.density;if(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e.lights){for(var q,j,k=0,n=0,P=0,o,l,r,v=Za,y=v.directional.colors,
+t=v.directional.positions,z=v.point.colors,B=v.point.positions,C=v.point.distances,O=0,G=0,c=q=r=0,u=b.length;c<u;c++)if(q=b[c],j=q.color,o=q.position,l=q.intensity,r=q.distance,q instanceof THREE.AmbientLight)A.gammaInput?(k+=j.r*j.r,n+=j.g*j.g,P+=j.b*j.b):(k+=j.r,n+=j.g,P+=j.b);else if(q instanceof THREE.DirectionalLight)r=O*3,A.gammaInput?(y[r]=j.r*j.r*l*l,y[r+1]=j.g*j.g*l*l,y[r+2]=j.b*j.b*l*l):(y[r]=j.r*l,y[r+1]=j.g*l,y[r+2]=j.b*l),t[r]=o.x,t[r+1]=o.y,t[r+2]=o.z,O+=1;else if(q instanceof THREE.SpotLight)r=
+O*3,A.gammaInput?(y[r]=j.r*j.r*l*l,y[r+1]=j.g*j.g*l*l,y[r+2]=j.b*j.b*l*l):(y[r]=j.r*l,y[r+1]=j.g*l,y[r+2]=j.b*l),j=1/o.length(),t[r]=o.x*j,t[r+1]=o.y*j,t[r+2]=o.z*j,O+=1;else if(q instanceof THREE.PointLight)q=G*3,A.gammaInput?(z[q]=j.r*j.r*l*l,z[q+1]=j.g*j.g*l*l,z[q+2]=j.b*j.b*l*l):(z[q]=j.r*l,z[q+1]=j.g*l,z[q+2]=j.b*l),B[q]=o.x,B[q+1]=o.y,B[q+2]=o.z,C[G]=r,G+=1;c=O*3;for(u=y.length;c<u;c++)y[c]=0;c=G*3;for(u=z.length;c<u;c++)z[c]=0;v.point.length=G;v.directional.length=O;v.ambient[0]=k;v.ambient[1]=
+n;v.ambient[2]=P;b=Za;p.enableLighting.value=b.directional.length+b.point.length;p.ambientLightColor.value=b.ambient;p.directionalLightColor.value=b.directional.colors;p.directionalLightDirection.value=b.directional.positions;p.pointLightColor.value=b.point.colors;p.pointLightPosition.value=b.point.positions;p.pointLightDistance.value=b.point.distances}if(e instanceof THREE.MeshBasicMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.MeshPhongMaterial)p.opacity.value=e.opacity,A.gammaInput?
 p.diffuse.value.copyGammaToLinear(e.color):p.diffuse.value=e.color,(p.map.texture=e.map)&&p.offsetRepeat.value.set(e.map.offset.x,e.map.offset.y,e.map.repeat.x,e.map.repeat.y),p.lightMap.texture=e.lightMap,p.envMap.texture=e.envMap,p.flipEnvMap.value=e.envMap instanceof THREE.WebGLRenderTargetCube?1:-1,p.reflectivity.value=e.reflectivity,p.refractionRatio.value=e.refractionRatio,p.combine.value=e.combine,p.useRefract.value=e.envMap&&e.envMap.mapping instanceof THREE.CubeRefractionMapping;if(e instanceof
-THREE.LineBasicMaterial)p.diffuse.value=e.color,p.opacity.value=e.opacity;else if(e instanceof THREE.ParticleBasicMaterial)p.psColor.value=e.color,p.opacity.value=e.opacity,p.size.value=e.size,p.scale.value=Fa.height/2,p.map.texture=e.map;else if(e instanceof THREE.MeshPhongMaterial)p.shininess.value=e.shininess,A.gammaInput?(p.ambient.value.copyGammaToLinear(e.ambient),p.specular.value.copyGammaToLinear(e.specular)):(p.ambient.value=e.ambient,p.specular.value=e.specular);else if(e instanceof THREE.MeshLambertMaterial)A.gammaInput?
-p.ambient.value.copyGammaToLinear(e.ambient):p.ambient.value=e.ambient;else if(e instanceof THREE.MeshDepthMaterial)p.mNear.value=a.near,p.mFar.value=a.far,p.opacity.value=e.opacity;else if(e instanceof THREE.MeshNormalMaterial)p.opacity.value=e.opacity;if(h.receiveShadow&&!e._shadowPass&&p.shadowMatrix){for(b=0;b<Ma.length;b++)p.shadowMatrix.value[b]=Ma[b],p.shadowMap.texture[b]=A.shadowMap[b];p.shadowDarkness.value=A.shadowMapDarkness;p.shadowBias.value=A.shadowMapBias}b=e.uniformsList;p=0;for(c=
+THREE.LineBasicMaterial)p.diffuse.value=e.color,p.opacity.value=e.opacity;else if(e instanceof THREE.ParticleBasicMaterial)p.psColor.value=e.color,p.opacity.value=e.opacity,p.size.value=e.size,p.scale.value=Da.height/2,p.map.texture=e.map;else if(e instanceof THREE.MeshPhongMaterial)p.shininess.value=e.shininess,A.gammaInput?(p.ambient.value.copyGammaToLinear(e.ambient),p.specular.value.copyGammaToLinear(e.specular)):(p.ambient.value=e.ambient,p.specular.value=e.specular);else if(e instanceof THREE.MeshLambertMaterial)A.gammaInput?
+p.ambient.value.copyGammaToLinear(e.ambient):p.ambient.value=e.ambient;else if(e instanceof THREE.MeshDepthMaterial)p.mNear.value=a.near,p.mFar.value=a.far,p.opacity.value=e.opacity;else if(e instanceof THREE.MeshNormalMaterial)p.opacity.value=e.opacity;if(h.receiveShadow&&!e._shadowPass&&p.shadowMatrix){for(b=0;b<Ra.length;b++)p.shadowMatrix.value[b]=Ra[b],p.shadowMap.texture[b]=A.shadowMap[b];p.shadowDarkness.value=A.shadowMapDarkness;p.shadowBias.value=A.shadowMapBias}b=e.uniformsList;p=0;for(c=
 b.length;p<c;p++)if(n=f.uniforms[b[p][1]])if(k=b[p][0],P=k.type,u=k.value,P==="i")d.uniform1i(n,u);else if(P==="f")d.uniform1f(n,u);else if(P==="v2")d.uniform2f(n,u.x,u.y);else if(P==="v3")d.uniform3f(n,u.x,u.y,u.z);else if(P==="v4")d.uniform4f(n,u.x,u.y,u.z,u.w);else if(P==="c")d.uniform3f(n,u.r,u.g,u.b);else if(P==="fv1")d.uniform1fv(n,u);else if(P==="fv")d.uniform3fv(n,u);else if(P==="v3v"){if(!k._array)k._array=new Float32Array(3*u.length);P=0;for(o=u.length;P<o;P++)v=P*3,k._array[v]=u[P].x,k._array[v+
 1]=u[P].y,k._array[v+2]=u[P].z;d.uniform3fv(n,k._array)}else if(P==="m4"){if(!k._array)k._array=new Float32Array(16);u.flattenToArray(k._array);d.uniformMatrix4fv(n,!1,k._array)}else if(P==="m4v"){if(!k._array)k._array=new Float32Array(16*u.length);P=0;for(o=u.length;P<o;P++)u[P].flattenToArrayOffset(k._array,P*16);d.uniformMatrix4fv(n,!1,k._array)}else if(P==="t"){if(d.uniform1i(n,u),n=k.texture)if(n.image instanceof Array&&n.image.length===6){if(k=n,k.image.length===6)if(k.needsUpdate){if(!k.image.__webglTextureCube)k.image.__webglTextureCube=
 d.createTexture();d.activeTexture(d.TEXTURE0+u);d.bindTexture(d.TEXTURE_CUBE_MAP,k.image.__webglTextureCube);for(u=0;u<6;u++)d.texImage2D(d.TEXTURE_CUBE_MAP_POSITIVE_X+u,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,k.image[u]);T(d.TEXTURE_CUBE_MAP,k,k.image[0]);k.needsUpdate=!1}else d.activeTexture(d.TEXTURE0+u),d.bindTexture(d.TEXTURE_CUBE_MAP,k.image.__webglTextureCube)}else n instanceof THREE.WebGLRenderTargetCube?(k=n,d.activeTexture(d.TEXTURE0+u),d.bindTexture(d.TEXTURE_CUBE_MAP,k.__webglTexture)):ta(n,u)}else if(P===
 "tv"){if(!k._array){k._array=[];P=0;for(o=k.texture.length;P<o;P++)k._array[P]=u+P}d.uniform1iv(n,k._array);P=0;for(o=k.texture.length;P<o;P++)(n=k.texture[P])&&ta(n,k._array[P])}(e instanceof THREE.ShaderMaterial||e instanceof THREE.MeshPhongMaterial||e.envMap)&&i.cameraPosition!==null&&d.uniform3f(i.cameraPosition,a.position.x,a.position.y,a.position.z);(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.ShaderMaterial||e.skinning)&&i.viewMatrix!==null&&
-d.uniformMatrix4fv(i.viewMatrix,!1,Ta);e.skinning&&(d.uniformMatrix4fv(i.cameraInverseMatrix,!1,Ta),d.uniformMatrix4fv(i.boneGlobalMatrices,!1,h.boneMatrices))}d.uniformMatrix4fv(i.modelViewMatrix,!1,h._modelViewMatrixArray);i.normalMatrix&&d.uniformMatrix3fv(i.normalMatrix,!1,h._normalMatrixArray);(e instanceof THREE.ShaderMaterial||e.envMap||e.skinning||h.receiveShadow)&&i.objectMatrix!==null&&d.uniformMatrix4fv(i.objectMatrix,!1,h._objectMatrixArray);return f}function h(a,b,c,h,f,i){if(h.opacity!==
-0){var j,u,c=e(a,b,c,h,i),a=c.attributes,b=!1,c=f.id*16777215+c.id*2+(h.wireframe?1:0);c!==M&&(M=c,b=!0);if(!h.morphTargets&&a.position>=0)b&&(d.bindBuffer(d.ARRAY_BUFFER,f.__webglVertexBuffer),d.vertexAttribPointer(a.position,3,d.FLOAT,!1,0,0));else if(i.morphTargetBase){c=h.program.attributes;i.morphTargetBase!==-1?(d.bindBuffer(d.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[i.morphTargetBase]),d.vertexAttribPointer(c.position,3,d.FLOAT,!1,0,0)):c.position>=0&&(d.bindBuffer(d.ARRAY_BUFFER,f.__webglVertexBuffer),
+d.uniformMatrix4fv(i.viewMatrix,!1,Ua);e.skinning&&(d.uniformMatrix4fv(i.cameraInverseMatrix,!1,Ua),d.uniformMatrix4fv(i.boneGlobalMatrices,!1,h.boneMatrices))}d.uniformMatrix4fv(i.modelViewMatrix,!1,h._modelViewMatrixArray);i.normalMatrix&&d.uniformMatrix3fv(i.normalMatrix,!1,h._normalMatrixArray);(e instanceof THREE.ShaderMaterial||e.envMap||e.skinning||h.receiveShadow)&&i.objectMatrix!==null&&d.uniformMatrix4fv(i.objectMatrix,!1,h._objectMatrixArray);return f}function h(a,b,c,h,f,i){if(h.opacity!==
+0){var j,u,c=e(a,b,c,h,i),a=c.attributes,b=!1,c=f.id*16777215+c.id*2+(h.wireframe?1:0);c!==N&&(N=c,b=!0);if(!h.morphTargets&&a.position>=0)b&&(d.bindBuffer(d.ARRAY_BUFFER,f.__webglVertexBuffer),d.vertexAttribPointer(a.position,3,d.FLOAT,!1,0,0));else if(i.morphTargetBase){c=h.program.attributes;i.morphTargetBase!==-1?(d.bindBuffer(d.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[i.morphTargetBase]),d.vertexAttribPointer(c.position,3,d.FLOAT,!1,0,0)):c.position>=0&&(d.bindBuffer(d.ARRAY_BUFFER,f.__webglVertexBuffer),
 d.vertexAttribPointer(c.position,3,d.FLOAT,!1,0,0));if(i.morphTargetForcedOrder.length){j=0;var p=i.morphTargetForcedOrder;for(u=i.morphTargetInfluences;j<h.numSupportedMorphTargets&&j<p.length;)d.bindBuffer(d.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[p[j]]),d.vertexAttribPointer(c["morphTarget"+j],3,d.FLOAT,!1,0,0),i.__webglMorphTargetInfluences[j]=u[p[j]],j++}else{var p=[],q=-1,k=0;u=i.morphTargetInfluences;var n,o=u.length;j=0;for(i.morphTargetBase!==-1&&(p[i.morphTargetBase]=!0);j<h.numSupportedMorphTargets;){for(n=
 0;n<o;n++)!p[n]&&u[n]>q&&(k=n,q=u[k]);d.bindBuffer(d.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[k]);d.vertexAttribPointer(c["morphTarget"+j],3,d.FLOAT,!1,0,0);i.__webglMorphTargetInfluences[j]=q;p[k]=1;q=-1;j++}}h.program.uniforms.morphTargetInfluences!==null&&d.uniform1fv(h.program.uniforms.morphTargetInfluences,i.__webglMorphTargetInfluences)}if(b){if(f.__webglCustomAttributesList){j=0;for(u=f.__webglCustomAttributesList.length;j<u;j++)c=f.__webglCustomAttributesList[j],a[c.buffer.belongsToAttribute]>=
 0&&(d.bindBuffer(d.ARRAY_BUFFER,c.buffer),d.vertexAttribPointer(a[c.buffer.belongsToAttribute],c.size,d.FLOAT,!1,0,0))}a.color>=0&&(d.bindBuffer(d.ARRAY_BUFFER,f.__webglColorBuffer),d.vertexAttribPointer(a.color,3,d.FLOAT,!1,0,0));a.normal>=0&&(d.bindBuffer(d.ARRAY_BUFFER,f.__webglNormalBuffer),d.vertexAttribPointer(a.normal,3,d.FLOAT,!1,0,0));a.tangent>=0&&(d.bindBuffer(d.ARRAY_BUFFER,f.__webglTangentBuffer),d.vertexAttribPointer(a.tangent,4,d.FLOAT,!1,0,0));a.uv>=0&&(f.__webglUVBuffer?(d.bindBuffer(d.ARRAY_BUFFER,
@@ -201,60 +201,60 @@ d.FLOAT,!1,0,0),d.bindBuffer(d.ARRAY_BUFFER,f.__webglSkinVertexBBuffer),d.vertex
 d.UNSIGNED_SHORT,0)):(b&&d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,f.__webglFaceBuffer),d.drawElements(d.TRIANGLES,f.__webglFaceCount,d.UNSIGNED_SHORT,0)),A.info.render.calls++,A.info.render.vertices+=f.__webglFaceCount,A.info.render.faces+=f.__webglFaceCount/3):i instanceof THREE.Line?(i=i.type===THREE.LineStrip?d.LINE_STRIP:d.LINES,d.lineWidth(h.linewidth),d.drawArrays(i,0,f.__webglLineCount),A.info.render.calls++):i instanceof THREE.ParticleSystem?(d.drawArrays(d.POINTS,0,f.__webglParticleCount),A.info.render.calls++):
 i instanceof THREE.Ribbon&&(d.drawArrays(d.TRIANGLE_STRIP,0,f.__webglVertexCount),A.info.render.calls++)}}function f(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=d.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=d.createBuffer();a.hasPos&&(d.bindBuffer(d.ARRAY_BUFFER,a.__webglVertexBuffer),d.bufferData(d.ARRAY_BUFFER,a.positionArray,d.DYNAMIC_DRAW),d.enableVertexAttribArray(b.attributes.position),d.vertexAttribPointer(b.attributes.position,3,d.FLOAT,!1,0,0));if(a.hasNormal){d.bindBuffer(d.ARRAY_BUFFER,
 a.__webglNormalBuffer);if(c===THREE.FlatShading){var e,f,h,i,j,p,q,k,n,o,l=a.count*3;for(o=0;o<l;o+=9)c=a.normalArray,e=c[o],f=c[o+1],h=c[o+2],i=c[o+3],p=c[o+4],k=c[o+5],j=c[o+6],q=c[o+7],n=c[o+8],e=(e+i+j)/3,f=(f+p+q)/3,h=(h+k+n)/3,c[o]=e,c[o+1]=f,c[o+2]=h,c[o+3]=e,c[o+4]=f,c[o+5]=h,c[o+6]=e,c[o+7]=f,c[o+8]=h}d.bufferData(d.ARRAY_BUFFER,a.normalArray,d.DYNAMIC_DRAW);d.enableVertexAttribArray(b.attributes.normal);d.vertexAttribPointer(b.attributes.normal,3,d.FLOAT,!1,0,0)}d.drawArrays(d.TRIANGLES,
-0,a.count);a.count=0}function i(a){if(wa!==a.doubleSided)a.doubleSided?d.disable(d.CULL_FACE):d.enable(d.CULL_FACE),wa=a.doubleSided;if(xa!==a.flipSided)a.flipSided?d.frontFace(d.CW):d.frontFace(d.CCW),xa=a.flipSided}function j(a){Ca!==a&&(a?d.enable(d.DEPTH_TEST):d.disable(d.DEPTH_TEST),Ca=a)}function n(a){Da!==a&&(d.depthMask(a),Da=a)}function l(a,b,c){Aa!==a&&(a?d.enable(d.POLYGON_OFFSET_FILL):d.disable(d.POLYGON_OFFSET_FILL),Aa=a);if(a&&(Za!==b||$a!==c))d.polygonOffset(b,c),Za=b,$a=c}function o(a){Z[0].set(a.n41-
+0,a.count);a.count=0}function i(a){if(va!==a.doubleSided)a.doubleSided?d.disable(d.CULL_FACE):d.enable(d.CULL_FACE),va=a.doubleSided;if(Ha!==a.flipSided)a.flipSided?d.frontFace(d.CW):d.frontFace(d.CCW),Ha=a.flipSided}function j(a){wa!==a&&(a?d.enable(d.DEPTH_TEST):d.disable(d.DEPTH_TEST),wa=a)}function n(a){Ba!==a&&(d.depthMask(a),Ba=a)}function l(a,b,c){ya!==a&&(a?d.enable(d.POLYGON_OFFSET_FILL):d.disable(d.POLYGON_OFFSET_FILL),ya=a);if(a&&($a!==b||ab!==c))d.polygonOffset(b,c),$a=b,ab=c}function o(a){Z[0].set(a.n41-
 a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);Z[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);Z[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);Z[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);Z[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);Z[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=Z[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,d=-a.geometry.boundingSphere.radius*Math.max(a.scale.x,
 Math.max(a.scale.y,a.scale.z)),c=0;c<6;c++)if(a=Z[c].x*b.n14+Z[c].y*b.n24+Z[c].z*b.n34+Z[c].w,a<=d)return!1;return!0}function r(a){var b=a.object.material;b.transparent?(a.transparent=b,a.opaque=null):(a.opaque=b,a.transparent=null)}function v(a){var b=a.object,d=a.buffer,c;c=b.material;if(c instanceof THREE.MeshFaceMaterial){if(d=d.materialIndex,d>=0)b=b.geometry.materials[d],b.transparent?(a.transparent=b,a.opaque=null):(a.opaque=b,a.transparent=null)}else if(b=c)b.transparent?(a.transparent=b,
-a.opaque=null):(a.opaque=b,a.transparent=null)}function z(a,b){return b.z-a.z}function B(a){var b,c,n,sa=0,K,l,u,p,q=a.lights;pa||(pa=new THREE.PerspectiveCamera(A.shadowCameraFov,A.shadowMapWidth/A.shadowMapHeight,A.shadowCameraNear,A.shadowCameraFar));b=0;for(c=q.length;b<c;b++)if(n=q[b],n instanceof THREE.SpotLight&&n.castShadow){R=-1;A.shadowMap[sa]||(A.shadowMap[sa]=new THREE.WebGLRenderTarget(A.shadowMapWidth,A.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));
-Ma[sa]||(Ma[sa]=new THREE.Matrix4);K=A.shadowMap[sa];l=Ma[sa];pa.position.copy(n.position);pa.lookAt(n.target.position);pa.update(void 0,!0);a.update(void 0,!1,pa);l.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);l.multiplySelf(pa.projectionMatrix);l.multiplySelf(pa.matrixWorldInverse);pa.matrixWorldInverse.flattenToArray(Ta);pa.projectionMatrix.flattenToArray(Sa);Ea.multiply(pa.projectionMatrix,pa.matrixWorldInverse);o(Ea);ma(K);d.clearColor(1,1,1,1);A.clear();d.clearColor(ga.r,ga.g,ga.b,ua);l=
-a.__webglObjects.length;n=a.__webglObjectsImmediate.length;for(K=0;K<l;K++)u=a.__webglObjects[K],p=u.object,p.visible&&p.castShadow?!(p instanceof THREE.Mesh)||!p.frustumCulled||k(p)?(p.matrixWorld.flattenToArray(p._objectMatrixArray),E(p,pa,!1),u.render=!0):u.render=!1:u.render=!1;j(!0);J(THREE.NormalBlending);for(K=0;K<l;K++)if(u=a.__webglObjects[K],u.render)p=u.object,buffer=u.buffer,i(p),u=p.customDepthMaterial?p.customDepthMaterial:p.geometry.morphTargets.length?ab:Ua,h(pa,q,null,u,buffer,p);
-for(K=0;K<n;K++)u=a.__webglObjectsImmediate[K],p=u.object,p.visible&&p.castShadow&&(p.matrixAutoUpdate&&p.matrixWorld.flattenToArray(p._objectMatrixArray),M=-1,E(p,pa,!1),i(p),program=e(pa,q,null,Ua,p),p.immediateRenderCallback?p.immediateRenderCallback(program,d,Z):p.render(function(a){f(a,program,Ua.shading)}));sa++}}function F(a,b){var c,e,f;c=t.attributes;var h=t.uniforms,i=Ja/Ra,j,p=[],q=Ra*0.5,k=Ja*0.5,n=!0;d.useProgram(t.program);S=t.program;M=Ca=Ia=-1;bb||(d.enableVertexAttribArray(t.attributes.position),
-d.enableVertexAttribArray(t.attributes.uv),bb=!0);d.disable(d.CULL_FACE);d.enable(d.BLEND);d.depthMask(!0);d.bindBuffer(d.ARRAY_BUFFER,t.vertexBuffer);d.vertexAttribPointer(c.position,2,d.FLOAT,!1,16,0);d.vertexAttribPointer(c.uv,2,d.FLOAT,!1,16,8);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,t.elementBuffer);d.uniformMatrix4fv(h.projectionMatrix,!1,Sa);d.activeTexture(d.TEXTURE0);d.uniform1i(h.map,0);c=0;for(e=a.__webglSprites.length;c<e;c++)if(f=a.__webglSprites[c],f.visible&&f.opacity!==0)f.useScreenCoordinates?
-f.z=-f.position.z:(f._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,f.matrixWorld,f._modelViewMatrixArray),f.z=-f._modelViewMatrix.n34);a.__webglSprites.sort(z);c=0;for(e=a.__webglSprites.length;c<e;c++)f=a.__webglSprites[c],f.visible&&f.opacity!==0&&f.map&&f.map.image&&f.map.image.width&&(f.useScreenCoordinates?(d.uniform1i(h.useScreenCoordinates,1),d.uniform3f(h.screenPosition,(f.position.x-q)/q,(k-f.position.y)/k,Math.max(0,Math.min(1,f.position.z)))):(d.uniform1i(h.useScreenCoordinates,
-0),d.uniform1i(h.affectedByDistance,f.affectedByDistance?1:0),d.uniformMatrix4fv(h.modelViewMatrix,!1,f._modelViewMatrixArray)),j=f.map.image.width/(f.scaleByViewport?Ja:1),p[0]=j*i*f.scale.x,p[1]=j*f.scale.y,d.uniform2f(h.uvScale,f.uvScale.x,f.uvScale.y),d.uniform2f(h.uvOffset,f.uvOffset.x,f.uvOffset.y),d.uniform2f(h.alignment,f.alignment.x,f.alignment.y),d.uniform1f(h.opacity,f.opacity),d.uniform3f(h.color,f.color.r,f.color.g,f.color.b),d.uniform1f(h.rotation,f.rotation),d.uniform2fv(h.scale,p),
-f.mergeWith3D&&!n?(d.enable(d.DEPTH_TEST),n=!0):!f.mergeWith3D&&n&&(d.disable(d.DEPTH_TEST),n=!1),J(f.blending),ta(f.map,0),d.drawElements(d.TRIANGLES,6,d.UNSIGNED_SHORT,0));d.enable(d.CULL_FACE);d.enable(d.DEPTH_TEST);d.depthMask(Da)}function E(a,b,c){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);c&&THREE.Matrix4.makeInvert3x3(a._modelViewMatrix).transposeIntoArray(a._normalMatrixArray)}function fa(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;
-return!1}function ia(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function ra(a,b){for(var c=a.length-1;c>=0;c--)a[c].object===b&&a.splice(c,1)}function I(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function J(a){if(a!==Ia){switch(a){case THREE.AdditiveBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.SRC_ALPHA,d.ONE);break;case THREE.SubtractiveBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.ZERO,d.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:d.blendEquation(d.FUNC_ADD);
-d.blendFunc(d.ZERO,d.SRC_COLOR);break;default:d.blendEquationSeparate(d.FUNC_ADD,d.FUNC_ADD),d.blendFuncSeparate(d.SRC_ALPHA,d.ONE_MINUS_SRC_ALPHA,d.ONE,d.ONE_MINUS_SRC_ALPHA)}Ia=a}}function T(a,b,c){(c.width&c.width-1)===0&&(c.height&c.height-1)===0?(d.texParameteri(a,d.TEXTURE_WRAP_S,L(b.wrapS)),d.texParameteri(a,d.TEXTURE_WRAP_T,L(b.wrapT)),d.texParameteri(a,d.TEXTURE_MAG_FILTER,L(b.magFilter)),d.texParameteri(a,d.TEXTURE_MIN_FILTER,L(b.minFilter)),d.generateMipmap(a)):(d.texParameteri(a,d.TEXTURE_WRAP_S,
-d.CLAMP_TO_EDGE),d.texParameteri(a,d.TEXTURE_WRAP_T,d.CLAMP_TO_EDGE),d.texParameteri(a,d.TEXTURE_MAG_FILTER,Q(b.magFilter)),d.texParameteri(a,d.TEXTURE_MIN_FILTER,Q(b.minFilter)))}function ta(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=!0,a.__webglTexture=d.createTexture(),A.info.memory.textures++;d.activeTexture(d.TEXTURE0+b);d.bindTexture(d.TEXTURE_2D,a.__webglTexture);a instanceof THREE.DataTexture?d.texImage2D(d.TEXTURE_2D,0,L(a.format),a.image.width,a.image.height,0,L(a.format),d.UNSIGNED_BYTE,
-a.image.data):d.texImage2D(d.TEXTURE_2D,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,a.image);T(d.TEXTURE_2D,a,a.image);a.needsUpdate=!1}else d.activeTexture(d.TEXTURE0+b),d.bindTexture(d.TEXTURE_2D,a.__webglTexture)}function U(a,b){d.bindRenderbuffer(d.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(d.renderbufferStorage(d.RENDERBUFFER,d.DEPTH_COMPONENT16,b.width,b.height),d.framebufferRenderbuffer(d.FRAMEBUFFER,d.DEPTH_ATTACHMENT,d.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(d.renderbufferStorage(d.RENDERBUFFER,
-d.DEPTH_STENCIL,b.width,b.height),d.framebufferRenderbuffer(d.FRAMEBUFFER,d.DEPTH_STENCIL_ATTACHMENT,d.RENDERBUFFER,a)):d.renderbufferStorage(d.RENDERBUFFER,d.RGBA4,b.width,b.height)}function ma(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=d.createTexture();if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];d.bindTexture(d.TEXTURE_CUBE_MAP,a.__webglTexture);
-T(d.TEXTURE_CUBE_MAP,a,a);for(var c=0;c<6;c++){a.__webglFramebuffer[c]=d.createFramebuffer();a.__webglRenderbuffer[c]=d.createRenderbuffer();d.texImage2D(d.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,L(a.format),a.width,a.height,0,L(a.format),L(a.type),null);var e=a,f=d.TEXTURE_CUBE_MAP_POSITIVE_X+c;d.bindFramebuffer(d.FRAMEBUFFER,a.__webglFramebuffer[c]);d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0,f,e.__webglTexture,0);U(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=d.createFramebuffer(),
-a.__webglRenderbuffer=d.createRenderbuffer(),d.bindTexture(d.TEXTURE_2D,a.__webglTexture),T(d.TEXTURE_2D,a,a),d.texImage2D(d.TEXTURE_2D,0,L(a.format),a.width,a.height,0,L(a.format),L(a.type),null),c=d.TEXTURE_2D,d.bindFramebuffer(d.FRAMEBUFFER,a.__webglFramebuffer),d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0,c,a.__webglTexture,0),d.bindRenderbuffer(d.RENDERBUFFER,a.__webglRenderbuffer),U(a.__webglRenderbuffer,a);b?d.bindTexture(d.TEXTURE_CUBE_MAP,null):d.bindTexture(d.TEXTURE_2D,null);
-d.bindRenderbuffer(d.RENDERBUFFER,null);d.bindFramebuffer(d.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,f=e=0):(b=null,c=Ra,a=Ja,e=Va,f=Wa);b!==W&&(d.bindFramebuffer(d.FRAMEBUFFER,b),d.viewport(e,f,c,a),W=b)}function ka(a){a instanceof THREE.WebGLRenderTargetCube?(d.bindTexture(d.TEXTURE_CUBE_MAP,a.__webglTexture),d.generateMipmap(d.TEXTURE_CUBE_MAP),d.bindTexture(d.TEXTURE_CUBE_MAP,null)):(d.bindTexture(d.TEXTURE_2D,a.__webglTexture),
-d.generateMipmap(d.TEXTURE_2D),d.bindTexture(d.TEXTURE_2D,null))}function X(a,b){var c;a==="fragment"?c=d.createShader(d.FRAGMENT_SHADER):a==="vertex"&&(c=d.createShader(d.VERTEX_SHADER));d.shaderSource(c,b);d.compileShader(c);if(!d.getShaderParameter(c,d.COMPILE_STATUS))return console.error(d.getShaderInfoLog(c)),console.error(b),null;return c}function Q(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return d.NEAREST;default:return d.LINEAR}}
-function L(a){switch(a){case THREE.RepeatWrapping:return d.REPEAT;case THREE.ClampToEdgeWrapping:return d.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return d.MIRRORED_REPEAT;case THREE.NearestFilter:return d.NEAREST;case THREE.NearestMipMapNearestFilter:return d.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return d.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return d.LINEAR;case THREE.LinearMipMapNearestFilter:return d.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return d.LINEAR_MIPMAP_LINEAR;
-case THREE.ByteType:return d.BYTE;case THREE.UnsignedByteType:return d.UNSIGNED_BYTE;case THREE.ShortType:return d.SHORT;case THREE.UnsignedShortType:return d.UNSIGNED_SHORT;case THREE.IntType:return d.INT;case THREE.UnsignedShortType:return d.UNSIGNED_INT;case THREE.FloatType:return d.FLOAT;case THREE.AlphaFormat:return d.ALPHA;case THREE.RGBFormat:return d.RGB;case THREE.RGBAFormat:return d.RGBA;case THREE.LuminanceFormat:return d.LUMINANCE;case THREE.LuminanceAlphaFormat:return d.LUMINANCE_ALPHA}return 0}
-var A=this,d,C=[],S=null,W=null,R=-1,M=null,za=0,wa=null,xa=null,Ia=null,Ca=null,Da=null,Aa=null,Za=null,$a=null,Va=0,Wa=0,Ra=0,Ja=0,Z=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Ea=new THREE.Matrix4,Sa=new Float32Array(16),Ta=new Float32Array(16),La=new THREE.Vector4,Ya={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},a=a||{},Fa=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
-H=a.stencil!==void 0?a.stencil:!0,eb=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,fb=a.antialias!==void 0?a.antialias:!1,ga=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),ua=a.clearAlpha!==void 0?a.clearAlpha:0,Xa=a.maxLights!==void 0?a.maxLights:4;this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};this.maxMorphTargets=8;this.domElement=Fa;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=[];this.shadowMapEnabled=!1;this.shadowMapSoft=this.shadowMapAutoUpdate=!0;var pa,Ma=[],a=THREE.ShaderLib.depthRGBA,cb=THREE.UniformsUtils.clone(a.uniforms),Ua=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,
-vertexShader:a.vertexShader,uniforms:cb}),ab=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:cb,morphTargets:!0});Ua._shadowPass=!0;ab._shadowPass=!0;try{if(!(d=Fa.getContext("experimental-webgl",{antialias:fb,stencil:H,preserveDrawingBuffer:eb})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+d.getParameter(d.VERSION)+" | "+d.getParameter(d.VENDOR)+" | "+d.getParameter(d.RENDERER)+" | "+d.getParameter(d.SHADING_LANGUAGE_VERSION))}catch(gb){console.error(gb)}d.clearColor(0,
-0,0,1);d.clearDepth(1);d.clearStencil(0);d.enable(d.DEPTH_TEST);d.depthFunc(d.LEQUAL);d.frontFace(d.CCW);d.cullFace(d.BACK);d.enable(d.CULL_FACE);d.enable(d.BLEND);d.blendEquation(d.FUNC_ADD);d.blendFunc(d.SRC_ALPHA,d.ONE_MINUS_SRC_ALPHA);d.clearColor(ga.r,ga.g,ga.b,ua);this.context=d;var db=d.getParameter(d.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,t={};t.vertices=new Float32Array(16);t.faces=new Uint16Array(6);H=0;t.vertices[H++]=-1;t.vertices[H++]=-1;t.vertices[H++]=0;t.vertices[H++]=1;t.vertices[H++]=
+a.opaque=null):(a.opaque=b,a.transparent=null)}function z(a,b){return b.z-a.z}function B(a){var b,c,n,sa=0,J,l,u,p,q=a.lights;X||(X=new THREE.PerspectiveCamera(A.shadowCameraFov,A.shadowMapWidth/A.shadowMapHeight,A.shadowCameraNear,A.shadowCameraFar));b=0;for(c=q.length;b<c;b++)if(n=q[b],n instanceof THREE.SpotLight&&n.castShadow){Q=-1;A.shadowMap[sa]||(A.shadowMap[sa]=new THREE.WebGLRenderTarget(A.shadowMapWidth,A.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));
+Ra[sa]||(Ra[sa]=new THREE.Matrix4);J=A.shadowMap[sa];l=Ra[sa];X.position.copy(n.position);X.lookAt(n.target.position);X.update(void 0,!0);a.update(void 0,!1,X);l.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);l.multiplySelf(X.projectionMatrix);l.multiplySelf(X.matrixWorldInverse);X.matrixWorldInverse.flattenToArray(Ua);X.projectionMatrix.flattenToArray(Ta);Ca.multiply(X.projectionMatrix,X.matrixWorldInverse);o(Ca);la(J);d.clearColor(1,1,1,1);A.clear();d.clearColor(ga.r,ga.g,ga.b,Ea);l=a.__webglObjects.length;
+n=a.__webglObjectsImmediate.length;for(J=0;J<l;J++)u=a.__webglObjects[J],p=u.object,p.visible&&p.castShadow?!(p instanceof THREE.Mesh)||!p.frustumCulled||k(p)?(p.matrixWorld.flattenToArray(p._objectMatrixArray),E(p,X,!1),u.render=!0):u.render=!1:u.render=!1;j(!0);I(THREE.NormalBlending);for(J=0;J<l;J++)if(u=a.__webglObjects[J],u.render)p=u.object,buffer=u.buffer,i(p),u=p.customDepthMaterial?p.customDepthMaterial:p.geometry.morphTargets.length?bb:Va,h(X,q,null,u,buffer,p);for(J=0;J<n;J++)u=a.__webglObjectsImmediate[J],
+p=u.object,p.visible&&p.castShadow&&(p.matrixAutoUpdate&&p.matrixWorld.flattenToArray(p._objectMatrixArray),N=-1,E(p,X,!1),i(p),program=e(X,q,null,Va,p),p.immediateRenderCallback?p.immediateRenderCallback(program,d,Z):p.render(function(a){f(a,program,Va.shading)}));sa++}}function F(a,b){var c,e,f;c=t.attributes;var h=t.uniforms,i=Ja/Sa,j,p=[],q=Sa*0.5,k=Ja*0.5,n=!0;d.useProgram(t.program);S=t.program;N=wa=La=-1;cb||(d.enableVertexAttribArray(t.attributes.position),d.enableVertexAttribArray(t.attributes.uv),
+cb=!0);d.disable(d.CULL_FACE);d.enable(d.BLEND);d.depthMask(!0);d.bindBuffer(d.ARRAY_BUFFER,t.vertexBuffer);d.vertexAttribPointer(c.position,2,d.FLOAT,!1,16,0);d.vertexAttribPointer(c.uv,2,d.FLOAT,!1,16,8);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,t.elementBuffer);d.uniformMatrix4fv(h.projectionMatrix,!1,Ta);d.activeTexture(d.TEXTURE0);d.uniform1i(h.map,0);c=0;for(e=a.__webglSprites.length;c<e;c++)if(f=a.__webglSprites[c],f.visible&&f.opacity!==0)f.useScreenCoordinates?f.z=-f.position.z:(f._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,
+f.matrixWorld,f._modelViewMatrixArray),f.z=-f._modelViewMatrix.n34);a.__webglSprites.sort(z);c=0;for(e=a.__webglSprites.length;c<e;c++)f=a.__webglSprites[c],f.visible&&f.opacity!==0&&f.map&&f.map.image&&f.map.image.width&&(f.useScreenCoordinates?(d.uniform1i(h.useScreenCoordinates,1),d.uniform3f(h.screenPosition,(f.position.x-q)/q,(k-f.position.y)/k,Math.max(0,Math.min(1,f.position.z)))):(d.uniform1i(h.useScreenCoordinates,0),d.uniform1i(h.affectedByDistance,f.affectedByDistance?1:0),d.uniformMatrix4fv(h.modelViewMatrix,
+!1,f._modelViewMatrixArray)),j=f.map.image.width/(f.scaleByViewport?Ja:1),p[0]=j*i*f.scale.x,p[1]=j*f.scale.y,d.uniform2f(h.uvScale,f.uvScale.x,f.uvScale.y),d.uniform2f(h.uvOffset,f.uvOffset.x,f.uvOffset.y),d.uniform2f(h.alignment,f.alignment.x,f.alignment.y),d.uniform1f(h.opacity,f.opacity),d.uniform3f(h.color,f.color.r,f.color.g,f.color.b),d.uniform1f(h.rotation,f.rotation),d.uniform2fv(h.scale,p),f.mergeWith3D&&!n?(d.enable(d.DEPTH_TEST),n=!0):!f.mergeWith3D&&n&&(d.disable(d.DEPTH_TEST),n=!1),
+I(f.blending),ta(f.map,0),d.drawElements(d.TRIANGLES,6,d.UNSIGNED_SHORT,0));d.enable(d.CULL_FACE);d.enable(d.DEPTH_TEST);d.depthMask(Ba)}function E(a,b,c){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);c&&THREE.Matrix4.makeInvert3x3(a._modelViewMatrix).transposeIntoArray(a._normalMatrixArray)}function fa(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function ia(a){for(var b in a.attributes)a.attributes[b].needsUpdate=
+!1}function ra(a,b){for(var c=a.length-1;c>=0;c--)a[c].object===b&&a.splice(c,1)}function O(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function I(a){if(a!==La){switch(a){case THREE.AdditiveBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.SRC_ALPHA,d.ONE);break;case THREE.SubtractiveBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.ZERO,d.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.ZERO,d.SRC_COLOR);break;default:d.blendEquationSeparate(d.FUNC_ADD,
+d.FUNC_ADD),d.blendFuncSeparate(d.SRC_ALPHA,d.ONE_MINUS_SRC_ALPHA,d.ONE,d.ONE_MINUS_SRC_ALPHA)}La=a}}function T(a,b,c){(c.width&c.width-1)===0&&(c.height&c.height-1)===0?(d.texParameteri(a,d.TEXTURE_WRAP_S,K(b.wrapS)),d.texParameteri(a,d.TEXTURE_WRAP_T,K(b.wrapT)),d.texParameteri(a,d.TEXTURE_MAG_FILTER,K(b.magFilter)),d.texParameteri(a,d.TEXTURE_MIN_FILTER,K(b.minFilter)),d.generateMipmap(a)):(d.texParameteri(a,d.TEXTURE_WRAP_S,d.CLAMP_TO_EDGE),d.texParameteri(a,d.TEXTURE_WRAP_T,d.CLAMP_TO_EDGE),
+d.texParameteri(a,d.TEXTURE_MAG_FILTER,R(b.magFilter)),d.texParameteri(a,d.TEXTURE_MIN_FILTER,R(b.minFilter)))}function ta(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=!0,a.__webglTexture=d.createTexture(),A.info.memory.textures++;d.activeTexture(d.TEXTURE0+b);d.bindTexture(d.TEXTURE_2D,a.__webglTexture);a instanceof THREE.DataTexture?d.texImage2D(d.TEXTURE_2D,0,K(a.format),a.image.width,a.image.height,0,K(a.format),d.UNSIGNED_BYTE,a.image.data):d.texImage2D(d.TEXTURE_2D,0,d.RGBA,d.RGBA,
+d.UNSIGNED_BYTE,a.image);T(d.TEXTURE_2D,a,a.image);a.needsUpdate=!1}else d.activeTexture(d.TEXTURE0+b),d.bindTexture(d.TEXTURE_2D,a.__webglTexture)}function U(a,b){d.bindRenderbuffer(d.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(d.renderbufferStorage(d.RENDERBUFFER,d.DEPTH_COMPONENT16,b.width,b.height),d.framebufferRenderbuffer(d.FRAMEBUFFER,d.DEPTH_ATTACHMENT,d.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(d.renderbufferStorage(d.RENDERBUFFER,d.DEPTH_STENCIL,b.width,b.height),d.framebufferRenderbuffer(d.FRAMEBUFFER,
+d.DEPTH_STENCIL_ATTACHMENT,d.RENDERBUFFER,a)):d.renderbufferStorage(d.RENDERBUFFER,d.RGBA4,b.width,b.height)}function la(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=d.createTexture();if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];d.bindTexture(d.TEXTURE_CUBE_MAP,a.__webglTexture);T(d.TEXTURE_CUBE_MAP,a,a);for(var c=0;c<6;c++){a.__webglFramebuffer[c]=
+d.createFramebuffer();a.__webglRenderbuffer[c]=d.createRenderbuffer();d.texImage2D(d.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,K(a.format),a.width,a.height,0,K(a.format),K(a.type),null);var e=a,f=d.TEXTURE_CUBE_MAP_POSITIVE_X+c;d.bindFramebuffer(d.FRAMEBUFFER,a.__webglFramebuffer[c]);d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0,f,e.__webglTexture,0);U(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=d.createFramebuffer(),a.__webglRenderbuffer=d.createRenderbuffer(),d.bindTexture(d.TEXTURE_2D,
+a.__webglTexture),T(d.TEXTURE_2D,a,a),d.texImage2D(d.TEXTURE_2D,0,K(a.format),a.width,a.height,0,K(a.format),K(a.type),null),c=d.TEXTURE_2D,d.bindFramebuffer(d.FRAMEBUFFER,a.__webglFramebuffer),d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0,c,a.__webglTexture,0),d.bindRenderbuffer(d.RENDERBUFFER,a.__webglRenderbuffer),U(a.__webglRenderbuffer,a);b?d.bindTexture(d.TEXTURE_CUBE_MAP,null):d.bindTexture(d.TEXTURE_2D,null);d.bindRenderbuffer(d.RENDERBUFFER,null);d.bindFramebuffer(d.FRAMEBUFFER,
+null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,f=e=0):(b=null,c=Sa,a=Ja,e=Wa,f=Xa);b!==W&&(d.bindFramebuffer(d.FRAMEBUFFER,b),d.viewport(e,f,c,a),W=b)}function pa(a){a instanceof THREE.WebGLRenderTargetCube?(d.bindTexture(d.TEXTURE_CUBE_MAP,a.__webglTexture),d.generateMipmap(d.TEXTURE_CUBE_MAP),d.bindTexture(d.TEXTURE_CUBE_MAP,null)):(d.bindTexture(d.TEXTURE_2D,a.__webglTexture),d.generateMipmap(d.TEXTURE_2D),d.bindTexture(d.TEXTURE_2D,null))}function ma(a,
+b){var c;a==="fragment"?c=d.createShader(d.FRAGMENT_SHADER):a==="vertex"&&(c=d.createShader(d.VERTEX_SHADER));d.shaderSource(c,b);d.compileShader(c);if(!d.getShaderParameter(c,d.COMPILE_STATUS))return console.error(d.getShaderInfoLog(c)),console.error(b),null;return c}function R(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return d.NEAREST;default:return d.LINEAR}}function K(a){switch(a){case THREE.RepeatWrapping:return d.REPEAT;
+case THREE.ClampToEdgeWrapping:return d.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return d.MIRRORED_REPEAT;case THREE.NearestFilter:return d.NEAREST;case THREE.NearestMipMapNearestFilter:return d.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return d.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return d.LINEAR;case THREE.LinearMipMapNearestFilter:return d.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return d.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return d.BYTE;
+case THREE.UnsignedByteType:return d.UNSIGNED_BYTE;case THREE.ShortType:return d.SHORT;case THREE.UnsignedShortType:return d.UNSIGNED_SHORT;case THREE.IntType:return d.INT;case THREE.UnsignedShortType:return d.UNSIGNED_INT;case THREE.FloatType:return d.FLOAT;case THREE.AlphaFormat:return d.ALPHA;case THREE.RGBFormat:return d.RGB;case THREE.RGBAFormat:return d.RGBA;case THREE.LuminanceFormat:return d.LUMINANCE;case THREE.LuminanceAlphaFormat:return d.LUMINANCE_ALPHA}return 0}var A=this,d,C=[],S=null,
+W=null,Q=-1,N=null,Aa=0,va=null,Ha=null,La=null,wa=null,Ba=null,ya=null,$a=null,ab=null,Wa=0,Xa=0,Sa=0,Ja=0,Z=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Ca=new THREE.Matrix4,Ta=new Float32Array(16),Ua=new Float32Array(16),Ia=new THREE.Vector4,Za={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},a=a||{},Da=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
+H=a.stencil!==void 0?a.stencil:!0,fb=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,gb=a.antialias!==void 0?a.antialias:!1,ga=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),Ea=a.clearAlpha!==void 0?a.clearAlpha:0,Ya=a.maxLights!==void 0?a.maxLights:4;this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};this.maxMorphTargets=8;this.domElement=Da;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=[];this.shadowMapEnabled=!1;this.shadowMapSoft=this.shadowMapAutoUpdate=!0;var X,Ra=[],a=THREE.ShaderLib.depthRGBA,db=THREE.UniformsUtils.clone(a.uniforms),Va=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,
+vertexShader:a.vertexShader,uniforms:db}),bb=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:db,morphTargets:!0});Va._shadowPass=!0;bb._shadowPass=!0;try{if(!(d=Da.getContext("experimental-webgl",{antialias:gb,stencil:H,preserveDrawingBuffer:fb})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+d.getParameter(d.VERSION)+" | "+d.getParameter(d.VENDOR)+" | "+d.getParameter(d.RENDERER)+" | "+d.getParameter(d.SHADING_LANGUAGE_VERSION))}catch(hb){console.error(hb)}d.clearColor(0,
+0,0,1);d.clearDepth(1);d.clearStencil(0);d.enable(d.DEPTH_TEST);d.depthFunc(d.LEQUAL);d.frontFace(d.CCW);d.cullFace(d.BACK);d.enable(d.CULL_FACE);d.enable(d.BLEND);d.blendEquation(d.FUNC_ADD);d.blendFunc(d.SRC_ALPHA,d.ONE_MINUS_SRC_ALPHA);d.clearColor(ga.r,ga.g,ga.b,Ea);this.context=d;var eb=d.getParameter(d.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,t={};t.vertices=new Float32Array(16);t.faces=new Uint16Array(6);H=0;t.vertices[H++]=-1;t.vertices[H++]=-1;t.vertices[H++]=0;t.vertices[H++]=1;t.vertices[H++]=
 1;t.vertices[H++]=-1;t.vertices[H++]=1;t.vertices[H++]=1;t.vertices[H++]=1;t.vertices[H++]=1;t.vertices[H++]=1;t.vertices[H++]=0;t.vertices[H++]=-1;t.vertices[H++]=1;t.vertices[H++]=0;H=t.vertices[H++]=0;t.faces[H++]=0;t.faces[H++]=1;t.faces[H++]=2;t.faces[H++]=0;t.faces[H++]=2;t.faces[H++]=3;t.vertexBuffer=d.createBuffer();t.elementBuffer=d.createBuffer();d.bindBuffer(d.ARRAY_BUFFER,t.vertexBuffer);d.bufferData(d.ARRAY_BUFFER,t.vertices,d.STATIC_DRAW);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,t.elementBuffer);
-d.bufferData(d.ELEMENT_ARRAY_BUFFER,t.faces,d.STATIC_DRAW);t.program=d.createProgram();d.attachShader(t.program,X("fragment",THREE.ShaderLib.sprite.fragmentShader));d.attachShader(t.program,X("vertex",THREE.ShaderLib.sprite.vertexShader));d.linkProgram(t.program);t.attributes={};t.uniforms={};t.attributes.position=d.getAttribLocation(t.program,"position");t.attributes.uv=d.getAttribLocation(t.program,"uv");t.uniforms.uvOffset=d.getUniformLocation(t.program,"uvOffset");t.uniforms.uvScale=d.getUniformLocation(t.program,
+d.bufferData(d.ELEMENT_ARRAY_BUFFER,t.faces,d.STATIC_DRAW);t.program=d.createProgram();d.attachShader(t.program,ma("fragment",THREE.ShaderLib.sprite.fragmentShader));d.attachShader(t.program,ma("vertex",THREE.ShaderLib.sprite.vertexShader));d.linkProgram(t.program);t.attributes={};t.uniforms={};t.attributes.position=d.getAttribLocation(t.program,"position");t.attributes.uv=d.getAttribLocation(t.program,"uv");t.uniforms.uvOffset=d.getUniformLocation(t.program,"uvOffset");t.uniforms.uvScale=d.getUniformLocation(t.program,
 "uvScale");t.uniforms.rotation=d.getUniformLocation(t.program,"rotation");t.uniforms.scale=d.getUniformLocation(t.program,"scale");t.uniforms.alignment=d.getUniformLocation(t.program,"alignment");t.uniforms.color=d.getUniformLocation(t.program,"color");t.uniforms.map=d.getUniformLocation(t.program,"map");t.uniforms.opacity=d.getUniformLocation(t.program,"opacity");t.uniforms.useScreenCoordinates=d.getUniformLocation(t.program,"useScreenCoordinates");t.uniforms.affectedByDistance=d.getUniformLocation(t.program,
-"affectedByDistance");t.uniforms.screenPosition=d.getUniformLocation(t.program,"screenPosition");t.uniforms.modelViewMatrix=d.getUniformLocation(t.program,"modelViewMatrix");t.uniforms.projectionMatrix=d.getUniformLocation(t.program,"projectionMatrix");var bb=!1;this.setSize=function(a,b){Fa.width=a;Fa.height=b;this.setViewport(0,0,Fa.width,Fa.height)};this.setViewport=function(a,b,c,e){Va=a;Wa=b;Ra=c;Ja=e;d.viewport(Va,Wa,Ra,Ja)};this.setScissor=function(a,b,c,e){d.scissor(a,b,c,e)};this.enableScissorTest=
-function(a){a?d.enable(d.SCISSOR_TEST):d.disable(d.SCISSOR_TEST)};this.setClearColorHex=function(a,b){ga.setHex(a);ua=b;d.clearColor(ga.r,ga.g,ga.b,ua)};this.setClearColor=function(a,b){ga.copy(a);ua=b;d.clearColor(ga.r,ga.g,ga.b,ua)};this.getClearColor=function(){return ga};this.getClearAlpha=function(){return ua};this.clear=function(a,b,c){var e=0;if(a===void 0||a)e|=d.COLOR_BUFFER_BIT;if(b===void 0||b)e|=d.DEPTH_BUFFER_BIT;if(c===void 0||c)e|=d.STENCIL_BUFFER_BIT;d.clear(e)};this.getContext=function(){return d};
+"affectedByDistance");t.uniforms.screenPosition=d.getUniformLocation(t.program,"screenPosition");t.uniforms.modelViewMatrix=d.getUniformLocation(t.program,"modelViewMatrix");t.uniforms.projectionMatrix=d.getUniformLocation(t.program,"projectionMatrix");var cb=!1;this.setSize=function(a,b){Da.width=a;Da.height=b;this.setViewport(0,0,Da.width,Da.height)};this.setViewport=function(a,b,c,e){Wa=a;Xa=b;Sa=c;Ja=e;d.viewport(Wa,Xa,Sa,Ja)};this.setScissor=function(a,b,c,e){d.scissor(a,b,c,e)};this.enableScissorTest=
+function(a){a?d.enable(d.SCISSOR_TEST):d.disable(d.SCISSOR_TEST)};this.setClearColorHex=function(a,b){ga.setHex(a);Ea=b;d.clearColor(ga.r,ga.g,ga.b,Ea)};this.setClearColor=function(a,b){ga.copy(a);Ea=b;d.clearColor(ga.r,ga.g,ga.b,Ea)};this.getClearColor=function(){return ga};this.getClearAlpha=function(){return Ea};this.clear=function(a,b,c){var e=0;if(a===void 0||a)e|=d.COLOR_BUFFER_BIT;if(b===void 0||b)e|=d.DEPTH_BUFFER_BIT;if(c===void 0||c)e|=d.STENCIL_BUFFER_BIT;d.clear(e)};this.getContext=function(){return 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(g in a.geometry.geometryGroups){var b=a.geometry.geometryGroups[g];d.deleteBuffer(b.__webglVertexBuffer);d.deleteBuffer(b.__webglNormalBuffer);d.deleteBuffer(b.__webglTangentBuffer);d.deleteBuffer(b.__webglColorBuffer);d.deleteBuffer(b.__webglUVBuffer);d.deleteBuffer(b.__webglUV2Buffer);d.deleteBuffer(b.__webglSkinVertexABuffer);
 d.deleteBuffer(b.__webglSkinVertexBBuffer);d.deleteBuffer(b.__webglSkinIndicesBuffer);d.deleteBuffer(b.__webglSkinWeightsBuffer);d.deleteBuffer(b.__webglFaceBuffer);d.deleteBuffer(b.__webglLineBuffer);if(b.numMorphTargets)for(var c=0,e=b.numMorphTargets;c<e;c++)d.deleteBuffer(b.__webglMorphTargetsBuffers[c]);A.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,d.deleteBuffer(a.__webglVertexBuffer),d.deleteBuffer(a.__webglColorBuffer),A.info.memory.geometries--;else if(a instanceof
 THREE.Line)a=a.geometry,d.deleteBuffer(a.__webglVertexBuffer),d.deleteBuffer(a.__webglColorBuffer),A.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,d.deleteBuffer(a.__webglVertexBuffer),d.deleteBuffer(a.__webglColorBuffer),A.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,d.deleteTexture(a.__webglTexture),A.info.memory.textures--};this.initMaterial=function(a,b,c,e){var f,h,i,j;a instanceof THREE.MeshDepthMaterial?j="depth":
 a instanceof THREE.MeshNormalMaterial?j="normal":a instanceof THREE.MeshBasicMaterial?j="basic":a instanceof THREE.MeshLambertMaterial?j="lambert":a instanceof THREE.MeshPhongMaterial?j="phong":a instanceof THREE.LineBasicMaterial?j="basic":a instanceof THREE.ParticleBasicMaterial&&(j="particle_basic");if(j){var p=THREE.ShaderLib[j];a.uniforms=THREE.UniformsUtils.clone(p.uniforms);a.vertexShader=p.vertexShader;a.fragmentShader=p.fragmentShader}var q,k,n;q=n=p=0;for(k=b.length;q<k;q++)i=b[q],i instanceof
-THREE.SpotLight&&n++,i instanceof THREE.DirectionalLight&&n++,i instanceof THREE.PointLight&&p++;p+n<=Xa?q=n:(q=Math.ceil(Xa*n/(p+n)),p=Xa-q);i={directional:q,point:p};p=n=0;for(q=b.length;p<q;p++)k=b[p],k instanceof THREE.SpotLight&&k.castShadow&&n++;var o=50;if(e!==void 0&&e instanceof THREE.SkinnedMesh)o=e.bones.length;var l;a:{q=a.fragmentShader;k=a.vertexShader;var p=a.uniforms,b=a.attributes,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,
+THREE.SpotLight&&n++,i instanceof THREE.DirectionalLight&&n++,i instanceof THREE.PointLight&&p++;p+n<=Ya?q=n:(q=Math.ceil(Ya*n/(p+n)),p=Ya-q);i={directional:q,point:p};p=n=0;for(q=b.length;p<q;p++)k=b[p],k instanceof THREE.SpotLight&&k.castShadow&&n++;var o=50;if(e!==void 0&&e instanceof THREE.SkinnedMesh)o=e.bones.length;var l;a:{q=a.fragmentShader;k=a.vertexShader;var p=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:i.directional,maxPointLights:i.point,maxBones:o,shadowMapEnabled:this.shadowMapEnabled&&e.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:n,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel},r,e=[];j?e.push(j):(e.push(q),e.push(k));for(r in c)e.push(r),e.push(c[r]);j=e.join();r=0;
-for(e=C.length;r<e;r++)if(C[r].code===j){l=C[r].program;break a}r=d.createProgram();e=[db?"#define VERTEX_TEXTURES":"",A.gammaInput?"#define GAMMA_INPUT":"",A.gammaOutput?"#define GAMMA_OUTPUT":"",A.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":
+for(e=C.length;r<e;r++)if(C[r].code===j){l=C[r].program;break a}r=d.createProgram();e=[eb?"#define VERTEX_TEXTURES":"",A.gammaInput?"#define GAMMA_INPUT":"",A.gammaOutput?"#define GAMMA_OUTPUT":"",A.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.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");
 i=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",A.gammaInput?"#define GAMMA_INPUT":"",A.gammaOutput?"#define GAMMA_OUTPUT":"",A.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");d.attachShader(r,X("fragment",i+q));d.attachShader(r,
-X("vertex",e+k));d.linkProgram(r);d.getProgramParameter(r,d.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+d.getProgramParameter(r,d.VALIDATE_STATUS)+", gl error ["+d.getError()+"]");r.uniforms={};r.attributes={};var v,e=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(v in p)e.push(v);v=e;e=0;for(p=v.length;e<p;e++)q=v[e],r.uniforms[q]=d.getUniformLocation(r,
+"",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");d.attachShader(r,ma("fragment",i+q));d.attachShader(r,
+ma("vertex",e+k));d.linkProgram(r);d.getProgramParameter(r,d.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+d.getProgramParameter(r,d.VALIDATE_STATUS)+", gl error ["+d.getError()+"]");r.uniforms={};r.attributes={};var v,e=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(v in p)e.push(v);v=e;e=0;for(p=v.length;e<p;e++)q=v[e],r.uniforms[q]=d.getUniformLocation(r,
 q);e=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(v=0;v<c.maxMorphTargets;v++)e.push("morphTarget"+v);for(l in b)e.push(l);l=e;v=0;for(b=l.length;v<b;v++)c=l[v],r.attributes[c]=d.getAttribLocation(r,c);r.id=C.length;C.push({program:r,code:j});A.info.memory.programs=C.length;l=r}a.program=l;l=a.program.attributes;l.position>=0&&d.enableVertexAttribArray(l.position);l.color>=0&&d.enableVertexAttribArray(l.color);l.normal>=0&&d.enableVertexAttribArray(l.normal);
 l.tangent>=0&&d.enableVertexAttribArray(l.tangent);a.skinning&&l.skinVertexA>=0&&l.skinVertexB>=0&&l.skinIndex>=0&&l.skinWeight>=0&&(d.enableVertexAttribArray(l.skinVertexA),d.enableVertexAttribArray(l.skinVertexB),d.enableVertexAttribArray(l.skinIndex),d.enableVertexAttribArray(l.skinWeight));if(a.attributes)for(h in a.attributes)l[h]!==void 0&&l[h]>=0&&d.enableVertexAttribArray(l[h]);if(a.morphTargets)for(h=a.numSupportedMorphTargets=0;h<this.maxMorphTargets;h++)v="morphTarget"+h,l[v]>=0&&(d.enableVertexAttribArray(l[v]),
-a.numSupportedMorphTargets++);a.uniformsList=[];for(f in a.uniforms)a.uniformsList.push([a.uniforms[f],f])};this.clearTarget=function(a,b,c,d){ma(a);this.clear(b,c,d)};this.updateShadowMap=function(a,b){B(a,b)};this.render=function(a,b,c,t){var sa,K,Ga,u,p,q,Qa,ya=a.lights,Ba=a.fog;R=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);this.shadowMapEnabled&&this.shadowMapAutoUpdate&&B(a,b);A.info.render.calls=0;A.info.render.vertices=0;A.info.render.faces=0;if(b.matrixAutoUpdate){for(Ga=b;Ga.parent;)Ga=
-Ga.parent;Ga.update(void 0,!0)}a.update(void 0,!1,b);b.matrixWorldInverse.flattenToArray(Ta);b.projectionMatrix.flattenToArray(Sa);Ea.multiply(b.projectionMatrix,b.matrixWorldInverse);o(Ea);ma(c);(this.autoClear||t)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);Ga=a.__webglObjects.length;for(t=0;t<Ga;t++)if(p=a.__webglObjects[t],q=p.object,q.visible)if(!(q instanceof THREE.Mesh)||!q.frustumCulled||k(q)){if(q.matrixWorld.flattenToArray(q._objectMatrixArray),E(q,b,!0),v(p),
-p.render=!0,this.sortObjects)q.renderDepth?p.z=q.renderDepth:(La.copy(q.position),Ea.multiplyVector3(La),p.z=La.z)}else p.render=!1;else p.render=!1;this.sortObjects&&a.__webglObjects.sort(z);u=a.__webglObjectsImmediate.length;for(t=0;t<u;t++)p=a.__webglObjectsImmediate[t],q=p.object,q.visible&&(q.matrixAutoUpdate&&q.matrixWorld.flattenToArray(q._objectMatrixArray),E(q,b,!0),r(p));if(a.overrideMaterial){j(a.overrideMaterial.depthTest);J(a.overrideMaterial.blending);for(t=0;t<Ga;t++)if(p=a.__webglObjects[t],
-p.render)q=p.object,Qa=p.buffer,i(q),h(b,ya,Ba,a.overrideMaterial,Qa,q);for(t=0;t<u;t++)p=a.__webglObjectsImmediate[t],q=p.object,q.visible&&(M=-1,i(q),sa=e(b,ya,Ba,a.overrideMaterial,q),q.immediateRenderCallback?q.immediateRenderCallback(sa,d,Z):q.render(function(b){f(b,sa,a.overrideMaterial.shading)}))}else{J(THREE.NormalBlending);for(t=Ga-1;t>=0;t--)if(p=a.__webglObjects[t],p.render&&(q=p.object,Qa=p.buffer,K=p.opaque))i(q),j(K.depthTest),n(K.depthWrite),l(K.polygonOffset,K.polygonOffsetFactor,
-K.polygonOffsetUnits),h(b,ya,Ba,K,Qa,q);for(t=0;t<u;t++)if(p=a.__webglObjectsImmediate[t],q=p.object,q.visible&&(M=-1,K=p.opaque))i(q),j(K.depthTest),n(K.depthWrite),l(K.polygonOffset,K.polygonOffsetFactor,K.polygonOffsetUnits),sa=e(b,ya,Ba,K,q),q.immediateRenderCallback?q.immediateRenderCallback(sa,d,Z):q.render(function(a){f(a,sa,K.shading)});for(t=0;t<Ga;t++)if(p=a.__webglObjects[t],p.render&&(q=p.object,Qa=p.buffer,K=p.transparent))i(q),J(K.blending),j(K.depthTest),n(K.depthWrite),l(K.polygonOffset,
-K.polygonOffsetFactor,K.polygonOffsetUnits),h(b,ya,Ba,K,Qa,q);for(t=0;t<u;t++)if(p=a.__webglObjectsImmediate[t],q=p.object,q.visible&&(M=-1,K=p.transparent))i(q),J(K.blending),j(K.depthTest),n(K.depthWrite),l(K.polygonOffset,K.polygonOffsetFactor,K.polygonOffsetUnits),sa=e(b,ya,Ba,K,q),q.immediateRenderCallback?q.immediateRenderCallback(sa,d,Z):q.render(function(a){f(a,sa,K.shading)})}a.__webglSprites.length&&F(a,b);c&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&ka(c)};this.initWebGLObjects=
+a.numSupportedMorphTargets++);a.uniformsList=[];for(f in a.uniforms)a.uniformsList.push([a.uniforms[f],f])};this.clearTarget=function(a,b,c,d){la(a);this.clear(b,c,d)};this.updateShadowMap=function(a,b){B(a,b)};this.render=function(a,b,c,t){var sa,J,Fa,u,p,q,Qa,xa=a.lights,za=a.fog;Q=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);this.shadowMapEnabled&&this.shadowMapAutoUpdate&&B(a,b);A.info.render.calls=0;A.info.render.vertices=0;A.info.render.faces=0;if(b.matrixAutoUpdate){for(Fa=b;Fa.parent;)Fa=
+Fa.parent;Fa.update(void 0,!0)}a.update(void 0,!1,b);b.matrixWorldInverse.flattenToArray(Ua);b.projectionMatrix.flattenToArray(Ta);Ca.multiply(b.projectionMatrix,b.matrixWorldInverse);o(Ca);la(c);(this.autoClear||t)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);Fa=a.__webglObjects.length;for(t=0;t<Fa;t++)if(p=a.__webglObjects[t],q=p.object,q.visible)if(!(q instanceof THREE.Mesh)||!q.frustumCulled||k(q)){if(q.matrixWorld.flattenToArray(q._objectMatrixArray),E(q,b,!0),v(p),
+p.render=!0,this.sortObjects)q.renderDepth?p.z=q.renderDepth:(Ia.copy(q.position),Ca.multiplyVector3(Ia),p.z=Ia.z)}else p.render=!1;else p.render=!1;this.sortObjects&&a.__webglObjects.sort(z);u=a.__webglObjectsImmediate.length;for(t=0;t<u;t++)p=a.__webglObjectsImmediate[t],q=p.object,q.visible&&(q.matrixAutoUpdate&&q.matrixWorld.flattenToArray(q._objectMatrixArray),E(q,b,!0),r(p));if(a.overrideMaterial){j(a.overrideMaterial.depthTest);I(a.overrideMaterial.blending);for(t=0;t<Fa;t++)if(p=a.__webglObjects[t],
+p.render)q=p.object,Qa=p.buffer,i(q),h(b,xa,za,a.overrideMaterial,Qa,q);for(t=0;t<u;t++)p=a.__webglObjectsImmediate[t],q=p.object,q.visible&&(N=-1,i(q),sa=e(b,xa,za,a.overrideMaterial,q),q.immediateRenderCallback?q.immediateRenderCallback(sa,d,Z):q.render(function(b){f(b,sa,a.overrideMaterial.shading)}))}else{I(THREE.NormalBlending);for(t=Fa-1;t>=0;t--)if(p=a.__webglObjects[t],p.render&&(q=p.object,Qa=p.buffer,J=p.opaque))i(q),j(J.depthTest),n(J.depthWrite),l(J.polygonOffset,J.polygonOffsetFactor,
+J.polygonOffsetUnits),h(b,xa,za,J,Qa,q);for(t=0;t<u;t++)if(p=a.__webglObjectsImmediate[t],q=p.object,q.visible&&(N=-1,J=p.opaque))i(q),j(J.depthTest),n(J.depthWrite),l(J.polygonOffset,J.polygonOffsetFactor,J.polygonOffsetUnits),sa=e(b,xa,za,J,q),q.immediateRenderCallback?q.immediateRenderCallback(sa,d,Z):q.render(function(a){f(a,sa,J.shading)});for(t=0;t<Fa;t++)if(p=a.__webglObjects[t],p.render&&(q=p.object,Qa=p.buffer,J=p.transparent))i(q),I(J.blending),j(J.depthTest),n(J.depthWrite),l(J.polygonOffset,
+J.polygonOffsetFactor,J.polygonOffsetUnits),h(b,xa,za,J,Qa,q);for(t=0;t<u;t++)if(p=a.__webglObjectsImmediate[t],q=p.object,q.visible&&(N=-1,J=p.transparent))i(q),I(J.blending),j(J.depthTest),n(J.depthWrite),l(J.polygonOffset,J.polygonOffsetFactor,J.polygonOffsetUnits),sa=e(b,xa,za,J,q),q.immediateRenderCallback?q.immediateRenderCallback(sa,d,Z):q.render(function(a){f(a,sa,J.shading)})}a.__webglSprites.length&&F(a,b);c&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&pa(c)};this.initWebGLObjects=
 function(a){if(!a.__webglObjects)a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[];for(;a.__objectsAdded.length;){var e=a.__objectsAdded[0],f=a,h=void 0,i=void 0,j=void 0;if(!e.__webglInit)if(e.__webglInit=!0,e._modelViewMatrix=new THREE.Matrix4,e._normalMatrixArray=new Float32Array(9),e._modelViewMatrixArray=new Float32Array(16),e._objectMatrixArray=new Float32Array(16),e.matrixWorld.flattenToArray(e._objectMatrixArray),e instanceof THREE.Mesh){i=e.geometry;if(i.geometryGroups===
 void 0){var j=i,k=void 0,n=void 0,p=void 0,q=void 0,l=p=void 0,o=void 0,r={},t=j.morphTargets.length;j.geometryGroups={};k=0;for(n=j.faces.length;k<n;k++)p=j.faces[k],q=p.materialIndex,l=q!==void 0?q:-1,r[l]===void 0&&(r[l]={hash:l,counter:0}),o=r[l].hash+"_"+r[l].counter,j.geometryGroups[o]===void 0&&(j.geometryGroups[o]={faces:[],materialIndex:q,vertices:0,numMorphTargets:t}),p=p instanceof THREE.Face3?3:4,j.geometryGroups[o].vertices+p>65535&&(r[l].counter+=1,o=r[l].hash+"_"+r[l].counter,j.geometryGroups[o]===
-void 0&&(j.geometryGroups[o]={faces:[],materialIndex:q,vertices:0,numMorphTargets:t})),j.geometryGroups[o].faces.push(k),j.geometryGroups[o].vertices+=p;j.geometryGroupsList=[];k=void 0;for(k in j.geometryGroups)j.geometryGroups[k].id=za++,j.geometryGroupsList.push(j.geometryGroups[k])}for(h in i.geometryGroups)if(j=i.geometryGroups[h],!j.__webglVertexBuffer){k=j;k.__webglVertexBuffer=d.createBuffer();k.__webglNormalBuffer=d.createBuffer();k.__webglTangentBuffer=d.createBuffer();k.__webglColorBuffer=
+void 0&&(j.geometryGroups[o]={faces:[],materialIndex:q,vertices:0,numMorphTargets:t})),j.geometryGroups[o].faces.push(k),j.geometryGroups[o].vertices+=p;j.geometryGroupsList=[];k=void 0;for(k in j.geometryGroups)j.geometryGroups[k].id=Aa++,j.geometryGroupsList.push(j.geometryGroups[k])}for(h in i.geometryGroups)if(j=i.geometryGroups[h],!j.__webglVertexBuffer){k=j;k.__webglVertexBuffer=d.createBuffer();k.__webglNormalBuffer=d.createBuffer();k.__webglTangentBuffer=d.createBuffer();k.__webglColorBuffer=
 d.createBuffer();k.__webglUVBuffer=d.createBuffer();k.__webglUV2Buffer=d.createBuffer();k.__webglSkinVertexABuffer=d.createBuffer();k.__webglSkinVertexBBuffer=d.createBuffer();k.__webglSkinIndicesBuffer=d.createBuffer();k.__webglSkinWeightsBuffer=d.createBuffer();k.__webglFaceBuffer=d.createBuffer();k.__webglLineBuffer=d.createBuffer();if(k.numMorphTargets){q=n=void 0;k.__webglMorphTargetsBuffers=[];n=0;for(q=k.numMorphTargets;n<q;n++)k.__webglMorphTargetsBuffers.push(d.createBuffer())}A.info.memory.geometries++;
 for(var q=e,v=p=r=void 0,l=v=t=v=void 0,o=l=k=0,z=p=void 0,B=void 0,p=n=t=r=void 0,t=q.geometry,z=t.faces,B=j.faces,r=0,p=B.length;r<p;r++)v=B[r],v=z[v],v instanceof THREE.Face3?(k+=3,l+=1,o+=3):v instanceof THREE.Face4&&(k+=4,l+=2,o+=4);r=b(q,j);p=r.map||r.lightMap||r instanceof THREE.ShaderMaterial?!0:!1;B=r instanceof THREE.MeshBasicMaterial&&!r.envMap||r instanceof THREE.MeshDepthMaterial?!1:r&&r.shading!==void 0&&r.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;z=r.vertexColors?
 r.vertexColors:!1;j.__vertexArray=new Float32Array(k*3);if(B)j.__normalArray=new Float32Array(k*3);if(t.hasTangents)j.__tangentArray=new Float32Array(k*4);if(z)j.__colorArray=new Float32Array(k*3);if(p){if(t.faceUvs.length>0||t.faceVertexUvs.length>0)j.__uvArray=new Float32Array(k*2);if(t.faceUvs.length>1||t.faceVertexUvs.length>1)j.__uv2Array=new Float32Array(k*2)}if(q.geometry.skinWeights.length&&q.geometry.skinIndices.length)j.__skinVertexAArray=new Float32Array(k*4),j.__skinVertexBArray=new Float32Array(k*
@@ -263,34 +263,34 @@ r.vertexColors:!1;j.__vertexArray=new Float32Array(k*3);if(B)j.__normalArray=new
 !0;i.__dirtyTangents=!0;i.__dirtyColors=!0}}else if(e instanceof THREE.Ribbon){if(i=e.geometry,!i.__webglVertexBuffer)j=i,j.__webglVertexBuffer=d.createBuffer(),j.__webglColorBuffer=d.createBuffer(),A.info.memory.geometries++,j=i,k=j.vertices.length,j.__vertexArray=new Float32Array(k*3),j.__colorArray=new Float32Array(k*3),j.__webglVertexCount=k,i.__dirtyVertices=!0,i.__dirtyColors=!0}else if(e instanceof THREE.Line){if(i=e.geometry,!i.__webglVertexBuffer)j=i,j.__webglVertexBuffer=d.createBuffer(),
 j.__webglColorBuffer=d.createBuffer(),A.info.memory.geometries++,j=i,k=j.vertices.length,j.__vertexArray=new Float32Array(k*3),j.__colorArray=new Float32Array(k*3),j.__webglLineCount=k,i.__dirtyVertices=!0,i.__dirtyColors=!0}else if(e instanceof THREE.ParticleSystem&&(i=e.geometry,!i.__webglVertexBuffer)){j=i;j.__webglVertexBuffer=d.createBuffer();j.__webglColorBuffer=d.createBuffer();A.info.geometries++;j=i;n=e;k=j.vertices.length;j.__vertexArray=new Float32Array(k*3);j.__colorArray=new Float32Array(k*
 3);j.__sortArray=[];j.__webglParticleCount=k;n=n.material;if(n.attributes){if(j.__webglCustomAttributesList===void 0)j.__webglCustomAttributesList=[];q=void 0;for(q in n.attributes){originalAttribute=n.attributes[q];attribute={};for(property in originalAttribute)attribute[property]=originalAttribute[property];if(!attribute.__webglInitialized||attribute.createUniqueBuffers)attribute.__webglInitialized=!0,size=1,attribute.type==="v2"?size=2:attribute.type==="v3"?size=3:attribute.type==="v4"?size=4:
-attribute.type==="c"&&(size=3),attribute.size=size,attribute.array=new Float32Array(k*size),attribute.buffer=d.createBuffer(),attribute.buffer.belongsToAttribute=q,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;j.__webglCustomAttributesList.push(attribute)}}i.__dirtyVertices=!0;i.__dirtyColors=!0}if(!e.__webglActive){if(e instanceof THREE.Mesh)for(h in i=e.geometry,i.geometryGroups)j=i.geometryGroups[h],I(f.__webglObjects,j,e);else e instanceof THREE.Ribbon||e instanceof THREE.Line||
-e instanceof THREE.ParticleSystem?(i=e.geometry,I(f.__webglObjects,i,e)):THREE.MarchingCubes!==void 0&&e instanceof THREE.MarchingCubes||e.immediateRenderCallback?f.__webglObjectsImmediate.push({object:e,opaque:null,transparent:null}):e instanceof THREE.Sprite&&f.__webglSprites.push(e);e.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){e=a.__objectsRemoved[0];f=a;if(e instanceof THREE.Mesh||e instanceof THREE.ParticleSystem||e instanceof THREE.Ribbon||e instanceof THREE.Line)ra(f.__webglObjects,
+attribute.type==="c"&&(size=3),attribute.size=size,attribute.array=new Float32Array(k*size),attribute.buffer=d.createBuffer(),attribute.buffer.belongsToAttribute=q,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;j.__webglCustomAttributesList.push(attribute)}}i.__dirtyVertices=!0;i.__dirtyColors=!0}if(!e.__webglActive){if(e instanceof THREE.Mesh)for(h in i=e.geometry,i.geometryGroups)j=i.geometryGroups[h],O(f.__webglObjects,j,e);else e instanceof THREE.Ribbon||e instanceof THREE.Line||
+e instanceof THREE.ParticleSystem?(i=e.geometry,O(f.__webglObjects,i,e)):THREE.MarchingCubes!==void 0&&e instanceof THREE.MarchingCubes||e.immediateRenderCallback?f.__webglObjectsImmediate.push({object:e,opaque:null,transparent:null}):e instanceof THREE.Sprite&&f.__webglSprites.push(e);e.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){e=a.__objectsRemoved[0];f=a;if(e instanceof THREE.Mesh||e instanceof THREE.ParticleSystem||e instanceof THREE.Ribbon||e instanceof THREE.Line)ra(f.__webglObjects,
 e);else if(e instanceof THREE.Sprite){f=f.__webglSprites;h=e;for(i=f.length-1;i>=0;i--)f[i]===h&&f.splice(i,1)}else(e instanceof THREE.MarchingCubes||e.immediateRenderCallback)&&ra(f.__webglObjectsImmediate,e);e.__webglActive=!1;a.__objectsRemoved.splice(0,1)}e=0;for(f=a.__webglObjects.length;e<f;e++)if(i=a.__webglObjects[e].object,h=i.geometry,j=l=q=void 0,i instanceof THREE.Mesh){k=0;for(n=h.geometryGroupsList.length;k<n;k++)if(q=h.geometryGroupsList[k],j=b(i,q),l=j.attributes&&fa(j),h.__dirtyVertices||
-h.__dirtyMorphTargets||h.__dirtyElements||h.__dirtyUvs||h.__dirtyNormals||h.__dirtyColors||h.__dirtyTangents||l)if(l=d.DYNAMIC_DRAW,o=!h.dynamic,q.__inittedArrays){var C=t=r=void 0,y=void 0,F=C=void 0,E=void 0,L=void 0,M=void 0,U=v=B=z=p=void 0,G=void 0,N=void 0,O=void 0,H=void 0,w=y=M=y=L=E=void 0,D=void 0,s=D=w=E=void 0,m=void 0,s=D=w=C=C=F=D=w=y=s=D=w=m=s=D=w=m=s=D=w=void 0,ha=0,J=0,T=0,W=0,S=0,Q=0,Y=0,R=0,ja=0,x=0,la=0,V=s=0,V=void 0,na=q.__vertexArray,ka=q.__uvArray,ma=q.__uv2Array,X=q.__normalArray,
-$=q.__tangentArray,oa=q.__colorArray,aa=q.__skinVertexAArray,ca=q.__skinVertexBArray,da=q.__skinIndexArray,ea=q.__skinWeightArray,pa=q.__morphTargetsArrays,Z=q.__webglCustomAttributesList,m=void 0,ga=q.__faceArray,va=q.__lineArray,ta=q.__needsSmoothNormals,z=q.__vertexColorType,p=q.__uvType,B=q.__normalType,qa=i.geometry,wa=qa.__dirtyVertices,Aa=qa.__dirtyElements,xa=qa.__dirtyUvs,Ca=qa.__dirtyNormals,Da=qa.__dirtyTangents,Ea=qa.__dirtyColors,Fa=qa.__dirtyMorphTargets,ua=qa.vertices,Ia=q.faces,La=
-qa.faces,Ja=qa.faceVertexUvs[0],Ma=qa.faceVertexUvs[1],Na=qa.skinVerticesA,Oa=qa.skinVerticesB,Pa=qa.skinIndices,Ka=qa.skinWeights,Ha=qa.morphTargets;if(Z){w=0;for(D=Z.length;w<D;w++)Z[w].offset=0,Z[w].offsetSrc=0}r=0;for(t=Ia.length;r<t;r++)if(C=Ia[r],y=La[C],Ja&&(v=Ja[C]),Ma&&(U=Ma[C]),C=y.vertexNormals,F=y.normal,E=y.vertexColors,L=y.color,M=y.vertexTangents,y instanceof THREE.Face3){if(wa)G=ua[y.a].position,N=ua[y.b].position,O=ua[y.c].position,na[J]=G.x,na[J+1]=G.y,na[J+2]=G.z,na[J+3]=N.x,na[J+
-4]=N.y,na[J+5]=N.z,na[J+6]=O.x,na[J+7]=O.y,na[J+8]=O.z,J+=9;if(Z){w=0;for(D=Z.length;w<D;w++)if(m=Z[w],m.__original.needsUpdate)s=m.offset,V=m.offsetSrc,m.size===1?(m.boundTo===void 0||m.boundTo==="vertices"?(m.array[s]=m.value[y.a],m.array[s+1]=m.value[y.b],m.array[s+2]=m.value[y.c]):m.boundTo==="faces"?(V=m.value[V],m.array[s]=V,m.array[s+1]=V,m.array[s+2]=V,m.offsetSrc++):m.boundTo==="faceVertices"&&(m.array[s]=m.value[V],m.array[s+1]=m.value[V+1],m.array[s+2]=m.value[V+2],m.offsetSrc+=3),m.offset+=
-3):(m.boundTo===void 0||m.boundTo==="vertices"?(G=m.value[y.a],N=m.value[y.b],O=m.value[y.c]):m.boundTo==="faces"?(O=N=G=V=m.value[V],m.offsetSrc++):m.boundTo==="faceVertices"&&(G=m.value[V],N=m.value[V+1],O=m.value[V+2],m.offsetSrc+=3),m.size===2?(m.array[s]=G.x,m.array[s+1]=G.y,m.array[s+2]=N.x,m.array[s+3]=N.y,m.array[s+4]=O.x,m.array[s+5]=O.y,m.offset+=6):m.size===3?(m.type==="c"?(m.array[s]=G.r,m.array[s+1]=G.g,m.array[s+2]=G.b,m.array[s+3]=N.r,m.array[s+4]=N.g,m.array[s+5]=N.b,m.array[s+6]=
-O.r,m.array[s+7]=O.g,m.array[s+8]=O.b):(m.array[s]=G.x,m.array[s+1]=G.y,m.array[s+2]=G.z,m.array[s+3]=N.x,m.array[s+4]=N.y,m.array[s+5]=N.z,m.array[s+6]=O.x,m.array[s+7]=O.y,m.array[s+8]=O.z),m.offset+=9):(m.array[s]=G.x,m.array[s+1]=G.y,m.array[s+2]=G.z,m.array[s+3]=G.w,m.array[s+4]=N.x,m.array[s+5]=N.y,m.array[s+6]=N.z,m.array[s+7]=N.w,m.array[s+8]=O.x,m.array[s+9]=O.y,m.array[s+10]=O.z,m.array[s+11]=O.w,m.offset+=12))}if(Fa){w=0;for(D=Ha.length;w<D;w++)G=Ha[w].vertices[y.a].position,N=Ha[w].vertices[y.b].position,
-O=Ha[w].vertices[y.c].position,s=pa[w],s[la]=G.x,s[la+1]=G.y,s[la+2]=G.z,s[la+3]=N.x,s[la+4]=N.y,s[la+5]=N.z,s[la+6]=O.x,s[la+7]=O.y,s[la+8]=O.z;la+=9}if(Ka.length)w=Ka[y.a],D=Ka[y.b],s=Ka[y.c],ea[x]=w.x,ea[x+1]=w.y,ea[x+2]=w.z,ea[x+3]=w.w,ea[x+4]=D.x,ea[x+5]=D.y,ea[x+6]=D.z,ea[x+7]=D.w,ea[x+8]=s.x,ea[x+9]=s.y,ea[x+10]=s.z,ea[x+11]=s.w,w=Pa[y.a],D=Pa[y.b],s=Pa[y.c],da[x]=w.x,da[x+1]=w.y,da[x+2]=w.z,da[x+3]=w.w,da[x+4]=D.x,da[x+5]=D.y,da[x+6]=D.z,da[x+7]=D.w,da[x+8]=s.x,da[x+9]=s.y,da[x+10]=s.z,da[x+
-11]=s.w,w=Na[y.a],D=Na[y.b],s=Na[y.c],aa[x]=w.x,aa[x+1]=w.y,aa[x+2]=w.z,aa[x+3]=1,aa[x+4]=D.x,aa[x+5]=D.y,aa[x+6]=D.z,aa[x+7]=1,aa[x+8]=s.x,aa[x+9]=s.y,aa[x+10]=s.z,aa[x+11]=1,w=Oa[y.a],D=Oa[y.b],s=Oa[y.c],ca[x]=w.x,ca[x+1]=w.y,ca[x+2]=w.z,ca[x+3]=1,ca[x+4]=D.x,ca[x+5]=D.y,ca[x+6]=D.z,ca[x+7]=1,ca[x+8]=s.x,ca[x+9]=s.y,ca[x+10]=s.z,ca[x+11]=1,x+=12;if(Ea&&z)E.length===3&&z===THREE.VertexColors?(y=E[0],w=E[1],D=E[2]):D=w=y=L,oa[ja]=y.r,oa[ja+1]=y.g,oa[ja+2]=y.b,oa[ja+3]=w.r,oa[ja+4]=w.g,oa[ja+5]=w.b,
-oa[ja+6]=D.r,oa[ja+7]=D.g,oa[ja+8]=D.b,ja+=9;if(Da&&qa.hasTangents)E=M[0],L=M[1],y=M[2],$[Y]=E.x,$[Y+1]=E.y,$[Y+2]=E.z,$[Y+3]=E.w,$[Y+4]=L.x,$[Y+5]=L.y,$[Y+6]=L.z,$[Y+7]=L.w,$[Y+8]=y.x,$[Y+9]=y.y,$[Y+10]=y.z,$[Y+11]=y.w,Y+=12;if(Ca&&B)if(C.length===3&&ta)for(w=0;w<3;w++)F=C[w],X[Q]=F.x,X[Q+1]=F.y,X[Q+2]=F.z,Q+=3;else for(w=0;w<3;w++)X[Q]=F.x,X[Q+1]=F.y,X[Q+2]=F.z,Q+=3;if(xa&&v!==void 0&&p)for(w=0;w<3;w++)C=v[w],ka[T]=C.u,ka[T+1]=C.v,T+=2;if(xa&&U!==void 0&&p)for(w=0;w<3;w++)C=U[w],ma[W]=C.u,ma[W+
-1]=C.v,W+=2;Aa&&(ga[S]=ha,ga[S+1]=ha+1,ga[S+2]=ha+2,S+=3,va[R]=ha,va[R+1]=ha+1,va[R+2]=ha,va[R+3]=ha+2,va[R+4]=ha+1,va[R+5]=ha+2,R+=6,ha+=3)}else if(y instanceof THREE.Face4){if(wa)G=ua[y.a].position,N=ua[y.b].position,O=ua[y.c].position,H=ua[y.d].position,na[J]=G.x,na[J+1]=G.y,na[J+2]=G.z,na[J+3]=N.x,na[J+4]=N.y,na[J+5]=N.z,na[J+6]=O.x,na[J+7]=O.y,na[J+8]=O.z,na[J+9]=H.x,na[J+10]=H.y,na[J+11]=H.z,J+=12;if(Z){w=0;for(D=Z.length;w<D;w++)if(m=Z[w],m.__original.needsUpdate)s=m.offset,V=m.offsetSrc,m.size===
-1?(m.boundTo===void 0||m.boundTo==="vertices"?(m.array[s]=m.value[y.a],m.array[s+1]=m.value[y.b],m.array[s+2]=m.value[y.c],m.array[s+3]=m.value[y.d]):m.boundTo==="faces"?(V=m.value[V],m.array[s]=V,m.array[s+1]=V,m.array[s+2]=V,m.array[s+3]=V,m.offsetSrc++):m.boundTo==="faceVertices"&&(m.array[s]=m.value[V],m.array[s+1]=m.value[V+1],m.array[s+2]=m.value[V+2],m.array[s+3]=m.value[V+3],m.offsetSrc+=4),m.offset+=4):(m.boundTo===void 0||m.boundTo==="vertices"?(G=m.value[y.a],N=m.value[y.b],O=m.value[y.c],
-H=m.value[y.d]):m.boundTo==="faces"?(H=O=N=G=V=m.value[V],m.offsetSrc++):m.boundTo==="faceVertices"&&(G=m.value[V],N=m.value[V+1],O=m.value[V+2],H=m.value[V+3],m.offsetSrc+=4),m.size===2?(m.array[s]=G.x,m.array[s+1]=G.y,m.array[s+2]=N.x,m.array[s+3]=N.y,m.array[s+4]=O.x,m.array[s+5]=O.y,m.array[s+6]=H.x,m.array[s+7]=H.y,m.offset+=8):m.size===3?(m.type==="c"?(m.array[s]=G.r,m.array[s+1]=G.g,m.array[s+2]=G.b,m.array[s+3]=N.r,m.array[s+4]=N.g,m.array[s+5]=N.b,m.array[s+6]=O.r,m.array[s+7]=O.g,m.array[s+
-8]=O.b,m.array[s+9]=H.r,m.array[s+10]=H.g,m.array[s+11]=H.b):(m.array[s]=G.x,m.array[s+1]=G.y,m.array[s+2]=G.z,m.array[s+3]=N.x,m.array[s+4]=N.y,m.array[s+5]=N.z,m.array[s+6]=O.x,m.array[s+7]=O.y,m.array[s+8]=O.z,m.array[s+9]=H.x,m.array[s+10]=H.y,m.array[s+11]=H.z),m.offset+=12):(m.array[s]=G.x,m.array[s+1]=G.y,m.array[s+2]=G.z,m.array[s+3]=G.w,m.array[s+4]=N.x,m.array[s+5]=N.y,m.array[s+6]=N.z,m.array[s+7]=N.w,m.array[s+8]=O.x,m.array[s+9]=O.y,m.array[s+10]=O.z,m.array[s+11]=O.w,m.array[s+12]=H.x,
-m.array[s+13]=H.y,m.array[s+14]=H.z,m.array[s+15]=H.w,m.offset+=16))}if(Fa){w=0;for(D=Ha.length;w<D;w++)G=Ha[w].vertices[y.a].position,N=Ha[w].vertices[y.b].position,O=Ha[w].vertices[y.c].position,H=Ha[w].vertices[y.d].position,s=pa[w],s[la]=G.x,s[la+1]=G.y,s[la+2]=G.z,s[la+3]=N.x,s[la+4]=N.y,s[la+5]=N.z,s[la+6]=O.x,s[la+7]=O.y,s[la+8]=O.z,s[la+9]=H.x,s[la+10]=H.y,s[la+11]=H.z;la+=12}if(Ka.length)w=Ka[y.a],D=Ka[y.b],s=Ka[y.c],m=Ka[y.d],ea[x]=w.x,ea[x+1]=w.y,ea[x+2]=w.z,ea[x+3]=w.w,ea[x+4]=D.x,ea[x+
+h.__dirtyMorphTargets||h.__dirtyElements||h.__dirtyUvs||h.__dirtyNormals||h.__dirtyColors||h.__dirtyTangents||l)if(l=d.DYNAMIC_DRAW,o=!h.dynamic,q.__inittedArrays){var C=t=r=void 0,y=void 0,F=C=void 0,E=void 0,K=void 0,N=void 0,U=v=B=z=p=void 0,G=void 0,L=void 0,M=void 0,H=void 0,w=y=N=y=K=E=void 0,D=void 0,s=D=w=E=void 0,m=void 0,s=D=w=C=C=F=D=w=y=s=D=w=m=s=D=w=m=s=D=w=void 0,ha=0,I=0,T=0,W=0,S=0,Q=0,Y=0,R=0,ja=0,x=0,ka=0,V=s=0,V=void 0,na=q.__vertexArray,la=q.__uvArray,ma=q.__uv2Array,X=q.__normalArray,
+$=q.__tangentArray,oa=q.__colorArray,aa=q.__skinVertexAArray,ca=q.__skinVertexBArray,da=q.__skinIndexArray,ea=q.__skinWeightArray,pa=q.__morphTargetsArrays,Z=q.__webglCustomAttributesList,m=void 0,ga=q.__faceArray,ua=q.__lineArray,ta=q.__needsSmoothNormals,z=q.__vertexColorType,p=q.__uvType,B=q.__normalType,qa=i.geometry,va=qa.__dirtyVertices,ya=qa.__dirtyElements,wa=qa.__dirtyUvs,Ba=qa.__dirtyNormals,Ca=qa.__dirtyTangents,Da=qa.__dirtyColors,Ea=qa.__dirtyMorphTargets,Ma=qa.vertices,Ha=q.faces,La=
+qa.faces,Ia=qa.faceVertexUvs[0],Ja=qa.faceVertexUvs[1],Na=qa.skinVerticesA,Oa=qa.skinVerticesB,Pa=qa.skinIndices,Ka=qa.skinWeights,Ga=qa.morphTargets;if(Z){w=0;for(D=Z.length;w<D;w++)Z[w].offset=0,Z[w].offsetSrc=0}r=0;for(t=Ha.length;r<t;r++)if(C=Ha[r],y=La[C],Ia&&(v=Ia[C]),Ja&&(U=Ja[C]),C=y.vertexNormals,F=y.normal,E=y.vertexColors,K=y.color,N=y.vertexTangents,y instanceof THREE.Face3){if(va)G=Ma[y.a].position,L=Ma[y.b].position,M=Ma[y.c].position,na[I]=G.x,na[I+1]=G.y,na[I+2]=G.z,na[I+3]=L.x,na[I+
+4]=L.y,na[I+5]=L.z,na[I+6]=M.x,na[I+7]=M.y,na[I+8]=M.z,I+=9;if(Z){w=0;for(D=Z.length;w<D;w++)if(m=Z[w],m.__original.needsUpdate)s=m.offset,V=m.offsetSrc,m.size===1?(m.boundTo===void 0||m.boundTo==="vertices"?(m.array[s]=m.value[y.a],m.array[s+1]=m.value[y.b],m.array[s+2]=m.value[y.c]):m.boundTo==="faces"?(V=m.value[V],m.array[s]=V,m.array[s+1]=V,m.array[s+2]=V,m.offsetSrc++):m.boundTo==="faceVertices"&&(m.array[s]=m.value[V],m.array[s+1]=m.value[V+1],m.array[s+2]=m.value[V+2],m.offsetSrc+=3),m.offset+=
+3):(m.boundTo===void 0||m.boundTo==="vertices"?(G=m.value[y.a],L=m.value[y.b],M=m.value[y.c]):m.boundTo==="faces"?(M=L=G=V=m.value[V],m.offsetSrc++):m.boundTo==="faceVertices"&&(G=m.value[V],L=m.value[V+1],M=m.value[V+2],m.offsetSrc+=3),m.size===2?(m.array[s]=G.x,m.array[s+1]=G.y,m.array[s+2]=L.x,m.array[s+3]=L.y,m.array[s+4]=M.x,m.array[s+5]=M.y,m.offset+=6):m.size===3?(m.type==="c"?(m.array[s]=G.r,m.array[s+1]=G.g,m.array[s+2]=G.b,m.array[s+3]=L.r,m.array[s+4]=L.g,m.array[s+5]=L.b,m.array[s+6]=
+M.r,m.array[s+7]=M.g,m.array[s+8]=M.b):(m.array[s]=G.x,m.array[s+1]=G.y,m.array[s+2]=G.z,m.array[s+3]=L.x,m.array[s+4]=L.y,m.array[s+5]=L.z,m.array[s+6]=M.x,m.array[s+7]=M.y,m.array[s+8]=M.z),m.offset+=9):(m.array[s]=G.x,m.array[s+1]=G.y,m.array[s+2]=G.z,m.array[s+3]=G.w,m.array[s+4]=L.x,m.array[s+5]=L.y,m.array[s+6]=L.z,m.array[s+7]=L.w,m.array[s+8]=M.x,m.array[s+9]=M.y,m.array[s+10]=M.z,m.array[s+11]=M.w,m.offset+=12))}if(Ea){w=0;for(D=Ga.length;w<D;w++)G=Ga[w].vertices[y.a].position,L=Ga[w].vertices[y.b].position,
+M=Ga[w].vertices[y.c].position,s=pa[w],s[ka]=G.x,s[ka+1]=G.y,s[ka+2]=G.z,s[ka+3]=L.x,s[ka+4]=L.y,s[ka+5]=L.z,s[ka+6]=M.x,s[ka+7]=M.y,s[ka+8]=M.z;ka+=9}if(Ka.length)w=Ka[y.a],D=Ka[y.b],s=Ka[y.c],ea[x]=w.x,ea[x+1]=w.y,ea[x+2]=w.z,ea[x+3]=w.w,ea[x+4]=D.x,ea[x+5]=D.y,ea[x+6]=D.z,ea[x+7]=D.w,ea[x+8]=s.x,ea[x+9]=s.y,ea[x+10]=s.z,ea[x+11]=s.w,w=Pa[y.a],D=Pa[y.b],s=Pa[y.c],da[x]=w.x,da[x+1]=w.y,da[x+2]=w.z,da[x+3]=w.w,da[x+4]=D.x,da[x+5]=D.y,da[x+6]=D.z,da[x+7]=D.w,da[x+8]=s.x,da[x+9]=s.y,da[x+10]=s.z,da[x+
+11]=s.w,w=Na[y.a],D=Na[y.b],s=Na[y.c],aa[x]=w.x,aa[x+1]=w.y,aa[x+2]=w.z,aa[x+3]=1,aa[x+4]=D.x,aa[x+5]=D.y,aa[x+6]=D.z,aa[x+7]=1,aa[x+8]=s.x,aa[x+9]=s.y,aa[x+10]=s.z,aa[x+11]=1,w=Oa[y.a],D=Oa[y.b],s=Oa[y.c],ca[x]=w.x,ca[x+1]=w.y,ca[x+2]=w.z,ca[x+3]=1,ca[x+4]=D.x,ca[x+5]=D.y,ca[x+6]=D.z,ca[x+7]=1,ca[x+8]=s.x,ca[x+9]=s.y,ca[x+10]=s.z,ca[x+11]=1,x+=12;if(Da&&z)E.length===3&&z===THREE.VertexColors?(y=E[0],w=E[1],D=E[2]):D=w=y=K,oa[ja]=y.r,oa[ja+1]=y.g,oa[ja+2]=y.b,oa[ja+3]=w.r,oa[ja+4]=w.g,oa[ja+5]=w.b,
+oa[ja+6]=D.r,oa[ja+7]=D.g,oa[ja+8]=D.b,ja+=9;if(Ca&&qa.hasTangents)E=N[0],K=N[1],y=N[2],$[Y]=E.x,$[Y+1]=E.y,$[Y+2]=E.z,$[Y+3]=E.w,$[Y+4]=K.x,$[Y+5]=K.y,$[Y+6]=K.z,$[Y+7]=K.w,$[Y+8]=y.x,$[Y+9]=y.y,$[Y+10]=y.z,$[Y+11]=y.w,Y+=12;if(Ba&&B)if(C.length===3&&ta)for(w=0;w<3;w++)F=C[w],X[Q]=F.x,X[Q+1]=F.y,X[Q+2]=F.z,Q+=3;else for(w=0;w<3;w++)X[Q]=F.x,X[Q+1]=F.y,X[Q+2]=F.z,Q+=3;if(wa&&v!==void 0&&p)for(w=0;w<3;w++)C=v[w],la[T]=C.u,la[T+1]=C.v,T+=2;if(wa&&U!==void 0&&p)for(w=0;w<3;w++)C=U[w],ma[W]=C.u,ma[W+
+1]=C.v,W+=2;ya&&(ga[S]=ha,ga[S+1]=ha+1,ga[S+2]=ha+2,S+=3,ua[R]=ha,ua[R+1]=ha+1,ua[R+2]=ha,ua[R+3]=ha+2,ua[R+4]=ha+1,ua[R+5]=ha+2,R+=6,ha+=3)}else if(y instanceof THREE.Face4){if(va)G=Ma[y.a].position,L=Ma[y.b].position,M=Ma[y.c].position,H=Ma[y.d].position,na[I]=G.x,na[I+1]=G.y,na[I+2]=G.z,na[I+3]=L.x,na[I+4]=L.y,na[I+5]=L.z,na[I+6]=M.x,na[I+7]=M.y,na[I+8]=M.z,na[I+9]=H.x,na[I+10]=H.y,na[I+11]=H.z,I+=12;if(Z){w=0;for(D=Z.length;w<D;w++)if(m=Z[w],m.__original.needsUpdate)s=m.offset,V=m.offsetSrc,m.size===
+1?(m.boundTo===void 0||m.boundTo==="vertices"?(m.array[s]=m.value[y.a],m.array[s+1]=m.value[y.b],m.array[s+2]=m.value[y.c],m.array[s+3]=m.value[y.d]):m.boundTo==="faces"?(V=m.value[V],m.array[s]=V,m.array[s+1]=V,m.array[s+2]=V,m.array[s+3]=V,m.offsetSrc++):m.boundTo==="faceVertices"&&(m.array[s]=m.value[V],m.array[s+1]=m.value[V+1],m.array[s+2]=m.value[V+2],m.array[s+3]=m.value[V+3],m.offsetSrc+=4),m.offset+=4):(m.boundTo===void 0||m.boundTo==="vertices"?(G=m.value[y.a],L=m.value[y.b],M=m.value[y.c],
+H=m.value[y.d]):m.boundTo==="faces"?(H=M=L=G=V=m.value[V],m.offsetSrc++):m.boundTo==="faceVertices"&&(G=m.value[V],L=m.value[V+1],M=m.value[V+2],H=m.value[V+3],m.offsetSrc+=4),m.size===2?(m.array[s]=G.x,m.array[s+1]=G.y,m.array[s+2]=L.x,m.array[s+3]=L.y,m.array[s+4]=M.x,m.array[s+5]=M.y,m.array[s+6]=H.x,m.array[s+7]=H.y,m.offset+=8):m.size===3?(m.type==="c"?(m.array[s]=G.r,m.array[s+1]=G.g,m.array[s+2]=G.b,m.array[s+3]=L.r,m.array[s+4]=L.g,m.array[s+5]=L.b,m.array[s+6]=M.r,m.array[s+7]=M.g,m.array[s+
+8]=M.b,m.array[s+9]=H.r,m.array[s+10]=H.g,m.array[s+11]=H.b):(m.array[s]=G.x,m.array[s+1]=G.y,m.array[s+2]=G.z,m.array[s+3]=L.x,m.array[s+4]=L.y,m.array[s+5]=L.z,m.array[s+6]=M.x,m.array[s+7]=M.y,m.array[s+8]=M.z,m.array[s+9]=H.x,m.array[s+10]=H.y,m.array[s+11]=H.z),m.offset+=12):(m.array[s]=G.x,m.array[s+1]=G.y,m.array[s+2]=G.z,m.array[s+3]=G.w,m.array[s+4]=L.x,m.array[s+5]=L.y,m.array[s+6]=L.z,m.array[s+7]=L.w,m.array[s+8]=M.x,m.array[s+9]=M.y,m.array[s+10]=M.z,m.array[s+11]=M.w,m.array[s+12]=H.x,
+m.array[s+13]=H.y,m.array[s+14]=H.z,m.array[s+15]=H.w,m.offset+=16))}if(Ea){w=0;for(D=Ga.length;w<D;w++)G=Ga[w].vertices[y.a].position,L=Ga[w].vertices[y.b].position,M=Ga[w].vertices[y.c].position,H=Ga[w].vertices[y.d].position,s=pa[w],s[ka]=G.x,s[ka+1]=G.y,s[ka+2]=G.z,s[ka+3]=L.x,s[ka+4]=L.y,s[ka+5]=L.z,s[ka+6]=M.x,s[ka+7]=M.y,s[ka+8]=M.z,s[ka+9]=H.x,s[ka+10]=H.y,s[ka+11]=H.z;ka+=12}if(Ka.length)w=Ka[y.a],D=Ka[y.b],s=Ka[y.c],m=Ka[y.d],ea[x]=w.x,ea[x+1]=w.y,ea[x+2]=w.z,ea[x+3]=w.w,ea[x+4]=D.x,ea[x+
 5]=D.y,ea[x+6]=D.z,ea[x+7]=D.w,ea[x+8]=s.x,ea[x+9]=s.y,ea[x+10]=s.z,ea[x+11]=s.w,ea[x+12]=m.x,ea[x+13]=m.y,ea[x+14]=m.z,ea[x+15]=m.w,w=Pa[y.a],D=Pa[y.b],s=Pa[y.c],m=Pa[y.d],da[x]=w.x,da[x+1]=w.y,da[x+2]=w.z,da[x+3]=w.w,da[x+4]=D.x,da[x+5]=D.y,da[x+6]=D.z,da[x+7]=D.w,da[x+8]=s.x,da[x+9]=s.y,da[x+10]=s.z,da[x+11]=s.w,da[x+12]=m.x,da[x+13]=m.y,da[x+14]=m.z,da[x+15]=m.w,w=Na[y.a],D=Na[y.b],s=Na[y.c],m=Na[y.d],aa[x]=w.x,aa[x+1]=w.y,aa[x+2]=w.z,aa[x+3]=1,aa[x+4]=D.x,aa[x+5]=D.y,aa[x+6]=D.z,aa[x+7]=1,aa[x+
-8]=s.x,aa[x+9]=s.y,aa[x+10]=s.z,aa[x+11]=1,aa[x+12]=m.x,aa[x+13]=m.y,aa[x+14]=m.z,aa[x+15]=1,w=Oa[y.a],D=Oa[y.b],s=Oa[y.c],y=Oa[y.d],ca[x]=w.x,ca[x+1]=w.y,ca[x+2]=w.z,ca[x+3]=1,ca[x+4]=D.x,ca[x+5]=D.y,ca[x+6]=D.z,ca[x+7]=1,ca[x+8]=s.x,ca[x+9]=s.y,ca[x+10]=s.z,ca[x+11]=1,ca[x+12]=y.x,ca[x+13]=y.y,ca[x+14]=y.z,ca[x+15]=1,x+=16;if(Ea&&z)E.length===4&&z===THREE.VertexColors?(y=E[0],w=E[1],D=E[2],E=E[3]):E=D=w=y=L,oa[ja]=y.r,oa[ja+1]=y.g,oa[ja+2]=y.b,oa[ja+3]=w.r,oa[ja+4]=w.g,oa[ja+5]=w.b,oa[ja+6]=D.r,
-oa[ja+7]=D.g,oa[ja+8]=D.b,oa[ja+9]=E.r,oa[ja+10]=E.g,oa[ja+11]=E.b,ja+=12;if(Da&&qa.hasTangents)E=M[0],L=M[1],y=M[2],M=M[3],$[Y]=E.x,$[Y+1]=E.y,$[Y+2]=E.z,$[Y+3]=E.w,$[Y+4]=L.x,$[Y+5]=L.y,$[Y+6]=L.z,$[Y+7]=L.w,$[Y+8]=y.x,$[Y+9]=y.y,$[Y+10]=y.z,$[Y+11]=y.w,$[Y+12]=M.x,$[Y+13]=M.y,$[Y+14]=M.z,$[Y+15]=M.w,Y+=16;if(Ca&&B)if(C.length===4&&ta)for(w=0;w<4;w++)F=C[w],X[Q]=F.x,X[Q+1]=F.y,X[Q+2]=F.z,Q+=3;else for(w=0;w<4;w++)X[Q]=F.x,X[Q+1]=F.y,X[Q+2]=F.z,Q+=3;if(xa&&v!==void 0&&p)for(w=0;w<4;w++)C=v[w],ka[T]=
-C.u,ka[T+1]=C.v,T+=2;if(xa&&U!==void 0&&p)for(w=0;w<4;w++)C=U[w],ma[W]=C.u,ma[W+1]=C.v,W+=2;Aa&&(ga[S]=ha,ga[S+1]=ha+1,ga[S+2]=ha+3,ga[S+3]=ha+1,ga[S+4]=ha+2,ga[S+5]=ha+3,S+=6,va[R]=ha,va[R+1]=ha+1,va[R+2]=ha,va[R+3]=ha+3,va[R+4]=ha+1,va[R+5]=ha+2,va[R+6]=ha+2,va[R+7]=ha+3,R+=8,ha+=4)}wa&&(d.bindBuffer(d.ARRAY_BUFFER,q.__webglVertexBuffer),d.bufferData(d.ARRAY_BUFFER,na,l));if(Z){w=0;for(D=Z.length;w<D;w++)m=Z[w],m.__original.needsUpdate&&(d.bindBuffer(d.ARRAY_BUFFER,m.buffer),d.bufferData(d.ARRAY_BUFFER,
-m.array,l))}if(Fa){w=0;for(D=Ha.length;w<D;w++)d.bindBuffer(d.ARRAY_BUFFER,q.__webglMorphTargetsBuffers[w]),d.bufferData(d.ARRAY_BUFFER,pa[w],l)}Ea&&ja>0&&(d.bindBuffer(d.ARRAY_BUFFER,q.__webglColorBuffer),d.bufferData(d.ARRAY_BUFFER,oa,l));Ca&&(d.bindBuffer(d.ARRAY_BUFFER,q.__webglNormalBuffer),d.bufferData(d.ARRAY_BUFFER,X,l));Da&&qa.hasTangents&&(d.bindBuffer(d.ARRAY_BUFFER,q.__webglTangentBuffer),d.bufferData(d.ARRAY_BUFFER,$,l));xa&&T>0&&(d.bindBuffer(d.ARRAY_BUFFER,q.__webglUVBuffer),d.bufferData(d.ARRAY_BUFFER,
-ka,l));xa&&W>0&&(d.bindBuffer(d.ARRAY_BUFFER,q.__webglUV2Buffer),d.bufferData(d.ARRAY_BUFFER,ma,l));Aa&&(d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,q.__webglFaceBuffer),d.bufferData(d.ELEMENT_ARRAY_BUFFER,ga,l),d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,q.__webglLineBuffer),d.bufferData(d.ELEMENT_ARRAY_BUFFER,va,l));x>0&&(d.bindBuffer(d.ARRAY_BUFFER,q.__webglSkinVertexABuffer),d.bufferData(d.ARRAY_BUFFER,aa,l),d.bindBuffer(d.ARRAY_BUFFER,q.__webglSkinVertexBBuffer),d.bufferData(d.ARRAY_BUFFER,ca,l),d.bindBuffer(d.ARRAY_BUFFER,
+8]=s.x,aa[x+9]=s.y,aa[x+10]=s.z,aa[x+11]=1,aa[x+12]=m.x,aa[x+13]=m.y,aa[x+14]=m.z,aa[x+15]=1,w=Oa[y.a],D=Oa[y.b],s=Oa[y.c],y=Oa[y.d],ca[x]=w.x,ca[x+1]=w.y,ca[x+2]=w.z,ca[x+3]=1,ca[x+4]=D.x,ca[x+5]=D.y,ca[x+6]=D.z,ca[x+7]=1,ca[x+8]=s.x,ca[x+9]=s.y,ca[x+10]=s.z,ca[x+11]=1,ca[x+12]=y.x,ca[x+13]=y.y,ca[x+14]=y.z,ca[x+15]=1,x+=16;if(Da&&z)E.length===4&&z===THREE.VertexColors?(y=E[0],w=E[1],D=E[2],E=E[3]):E=D=w=y=K,oa[ja]=y.r,oa[ja+1]=y.g,oa[ja+2]=y.b,oa[ja+3]=w.r,oa[ja+4]=w.g,oa[ja+5]=w.b,oa[ja+6]=D.r,
+oa[ja+7]=D.g,oa[ja+8]=D.b,oa[ja+9]=E.r,oa[ja+10]=E.g,oa[ja+11]=E.b,ja+=12;if(Ca&&qa.hasTangents)E=N[0],K=N[1],y=N[2],N=N[3],$[Y]=E.x,$[Y+1]=E.y,$[Y+2]=E.z,$[Y+3]=E.w,$[Y+4]=K.x,$[Y+5]=K.y,$[Y+6]=K.z,$[Y+7]=K.w,$[Y+8]=y.x,$[Y+9]=y.y,$[Y+10]=y.z,$[Y+11]=y.w,$[Y+12]=N.x,$[Y+13]=N.y,$[Y+14]=N.z,$[Y+15]=N.w,Y+=16;if(Ba&&B)if(C.length===4&&ta)for(w=0;w<4;w++)F=C[w],X[Q]=F.x,X[Q+1]=F.y,X[Q+2]=F.z,Q+=3;else for(w=0;w<4;w++)X[Q]=F.x,X[Q+1]=F.y,X[Q+2]=F.z,Q+=3;if(wa&&v!==void 0&&p)for(w=0;w<4;w++)C=v[w],la[T]=
+C.u,la[T+1]=C.v,T+=2;if(wa&&U!==void 0&&p)for(w=0;w<4;w++)C=U[w],ma[W]=C.u,ma[W+1]=C.v,W+=2;ya&&(ga[S]=ha,ga[S+1]=ha+1,ga[S+2]=ha+3,ga[S+3]=ha+1,ga[S+4]=ha+2,ga[S+5]=ha+3,S+=6,ua[R]=ha,ua[R+1]=ha+1,ua[R+2]=ha,ua[R+3]=ha+3,ua[R+4]=ha+1,ua[R+5]=ha+2,ua[R+6]=ha+2,ua[R+7]=ha+3,R+=8,ha+=4)}va&&(d.bindBuffer(d.ARRAY_BUFFER,q.__webglVertexBuffer),d.bufferData(d.ARRAY_BUFFER,na,l));if(Z){w=0;for(D=Z.length;w<D;w++)m=Z[w],m.__original.needsUpdate&&(d.bindBuffer(d.ARRAY_BUFFER,m.buffer),d.bufferData(d.ARRAY_BUFFER,
+m.array,l))}if(Ea){w=0;for(D=Ga.length;w<D;w++)d.bindBuffer(d.ARRAY_BUFFER,q.__webglMorphTargetsBuffers[w]),d.bufferData(d.ARRAY_BUFFER,pa[w],l)}Da&&ja>0&&(d.bindBuffer(d.ARRAY_BUFFER,q.__webglColorBuffer),d.bufferData(d.ARRAY_BUFFER,oa,l));Ba&&(d.bindBuffer(d.ARRAY_BUFFER,q.__webglNormalBuffer),d.bufferData(d.ARRAY_BUFFER,X,l));Ca&&qa.hasTangents&&(d.bindBuffer(d.ARRAY_BUFFER,q.__webglTangentBuffer),d.bufferData(d.ARRAY_BUFFER,$,l));wa&&T>0&&(d.bindBuffer(d.ARRAY_BUFFER,q.__webglUVBuffer),d.bufferData(d.ARRAY_BUFFER,
+la,l));wa&&W>0&&(d.bindBuffer(d.ARRAY_BUFFER,q.__webglUV2Buffer),d.bufferData(d.ARRAY_BUFFER,ma,l));ya&&(d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,q.__webglFaceBuffer),d.bufferData(d.ELEMENT_ARRAY_BUFFER,ga,l),d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,q.__webglLineBuffer),d.bufferData(d.ELEMENT_ARRAY_BUFFER,ua,l));x>0&&(d.bindBuffer(d.ARRAY_BUFFER,q.__webglSkinVertexABuffer),d.bufferData(d.ARRAY_BUFFER,aa,l),d.bindBuffer(d.ARRAY_BUFFER,q.__webglSkinVertexBBuffer),d.bufferData(d.ARRAY_BUFFER,ca,l),d.bindBuffer(d.ARRAY_BUFFER,
 q.__webglSkinIndicesBuffer),d.bufferData(d.ARRAY_BUFFER,da,l),d.bindBuffer(d.ARRAY_BUFFER,q.__webglSkinWeightsBuffer),d.bufferData(d.ARRAY_BUFFER,ea,l));o&&(delete q.__inittedArrays,delete q.__colorArray,delete q.__normalArray,delete q.__tangentArray,delete q.__uvArray,delete q.__uv2Array,delete q.__faceArray,delete q.__vertexArray,delete q.__lineArray,delete q.__skinVertexAArray,delete q.__skinVertexBArray,delete q.__skinIndexArray,delete q.__skinWeightArray)}h.__dirtyVertices=!1;h.__dirtyMorphTargets=
 !1;h.__dirtyElements=!1;h.__dirtyUvs=!1;h.__dirtyNormals=!1;h.__dirtyColors=!1;h.__dirtyTangents=!1;j.attributes&&ia(j)}else if(i instanceof THREE.Ribbon){if(h.__dirtyVertices||h.__dirtyColors){i=h;j=d.DYNAMIC_DRAW;k=r=o=o=void 0;t=i.vertices;n=i.colors;p=t.length;q=n.length;z=i.__vertexArray;l=i.__colorArray;B=i.__dirtyColors;if(i.__dirtyVertices){for(o=0;o<p;o++)r=t[o].position,k=o*3,z[k]=r.x,z[k+1]=r.y,z[k+2]=r.z;d.bindBuffer(d.ARRAY_BUFFER,i.__webglVertexBuffer);d.bufferData(d.ARRAY_BUFFER,z,
 j)}if(B){for(o=0;o<q;o++)color=n[o],k=o*3,l[k]=color.r,l[k+1]=color.g,l[k+2]=color.b;d.bindBuffer(d.ARRAY_BUFFER,i.__webglColorBuffer);d.bufferData(d.ARRAY_BUFFER,l,j)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(i instanceof THREE.Line){if(h.__dirtyVertices||h.__dirtyColors){i=h;j=d.DYNAMIC_DRAW;k=r=o=o=void 0;t=i.vertices;n=i.colors;p=t.length;q=n.length;z=i.__vertexArray;l=i.__colorArray;B=i.__dirtyColors;if(i.__dirtyVertices){for(o=0;o<p;o++)r=t[o].position,k=o*3,z[k]=r.x,z[k+1]=r.y,z[k+2]=
 r.z;d.bindBuffer(d.ARRAY_BUFFER,i.__webglVertexBuffer);d.bufferData(d.ARRAY_BUFFER,z,j)}if(B){for(o=0;o<q;o++)color=n[o],k=o*3,l[k]=color.r,l[k+1]=color.g,l[k+2]=color.b;d.bindBuffer(d.ARRAY_BUFFER,i.__webglColorBuffer);d.bufferData(d.ARRAY_BUFFER,l,j)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(i instanceof THREE.ParticleSystem)j=b(i,q),l=j.attributes&&fa(j),(h.__dirtyVertices||h.__dirtyColors||i.sortParticles||l)&&c(h,d.DYNAMIC_DRAW,i),h.__dirtyVertices=!1,h.__dirtyColors=!1,j.attributes&&
-ia(j)};this.setFaceCulling=function(a,b){a?(!b||b==="ccw"?d.frontFace(d.CCW):d.frontFace(d.CW),a==="back"?d.cullFace(d.BACK):a==="front"?d.cullFace(d.FRONT):d.cullFace(d.FRONT_AND_BACK),d.enable(d.CULL_FACE)):d.disable(d.CULL_FACE)};this.supportsVertexTextures=function(){return db}};
+ia(j)};this.setFaceCulling=function(a,b){a?(!b||b==="ccw"?d.frontFace(d.CCW):d.frontFace(d.CW),a==="back"?d.cullFace(d.BACK):a==="front"?d.cullFace(d.FRONT):d.cullFace(d.FRONT_AND_BACK),d.enable(d.CULL_FACE)):d.disable(d.CULL_FACE)};this.supportsVertexTextures=function(){return eb}};
 THREE.WebGLRenderTarget=function(a,b,c){this.width=a;this.height=b;c=c||{};this.wrapS=c.wrapS!==void 0?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=c.wrapT!==void 0?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=c.magFilter!==void 0?c.magFilter:THREE.LinearFilter;this.minFilter=c.minFilter!==void 0?c.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=c.format!==void 0?c.format:THREE.RGBAFormat;this.type=c.type!==void 0?c.type:
 THREE.UnsignedByteType;this.depthBuffer=c.depthBuffer!==void 0?c.depthBuffer:!0;this.stencilBuffer=c.stencilBuffer!==void 0?c.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,b,c){THREE.WebGLRenderTarget.call(this,a,b,c);this.activeCubeFace=0};

+ 5 - 17
src/core/Projector.js

@@ -11,7 +11,7 @@ THREE.Projector = function() {
 	_line, _lineCount, _linePool = [],
 	_particle, _particleCount, _particlePool = [],
 
-	_renderData = { objects: [], lines: [], sprites: [], lights: [], elements: [] },
+	_renderData = { objects: [], sprites: [], lights: [], elements: [] },
 
 	_vector3 = new THREE.Vector3(),
 	_vector4 = new THREE.Vector4(),
@@ -100,7 +100,6 @@ THREE.Projector = function() {
 	this.projectGraph = function ( object ) {
 
 		_renderData.objects.length = 0;
-		_renderData.lines.length = 0;
 		_renderData.sprites.length = 0;
 		_renderData.lights.length = 0;
 
@@ -114,7 +113,7 @@ THREE.Projector = function() {
 
 			} else if ( object instanceof THREE.Line ) {
 
-				_renderData.lines.push( object );
+				_renderData.objects.push( object );
 
 			} else if ( object instanceof THREE.Sprite || object instanceof THREE.Particle ) {
 
@@ -307,20 +306,7 @@ THREE.Projector = function() {
 
 				}
 
-			}
-
-		}
-
-		for ( o = 0, ol = _renderData.lines.length; o < ol; o++ ) {
-
-			object = _renderData.lines[ o ];
-
-			objectMatrixWorld = object.matrixWorld;
-			objectMaterial = object.material;
-
-			_vertexCount = 0;
-
-			if ( object instanceof THREE.Line ) {
+			} else if ( object instanceof THREE.Line ) {
 
 				_projScreenobjectMatrixWorld.multiply( _projScreenMatrix, objectMatrixWorld );
 
@@ -358,9 +344,11 @@ THREE.Projector = function() {
 						_renderData.elements.push( _line );
 
 					}
+
 				}
 
 			}
+
 		}
 
 		for ( o = 0, ol = _renderData.sprites.length; o < ol; o++ ) {