Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: NINE78/three.js
base: d141ea8577
...
head fork: NINE78/three.js
compare: 71778b81a5
  • 5 commits
  • 3 files changed
  • 0 commit comments
  • 1 contributor
View
112 build/Three.js
@@ -151,30 +151,30 @@ ia=n[m-2],F.copy(aa.positionScreen),I.copy(ia.positionScreen),e(F,I))F.multiplyS
H.z,y.rotation=L.rotation.z,y.scale.x=L.scale.x*Math.abs(y.x-(H.x+g.projectionMatrix.n11)/(H.w+g.projectionMatrix.n14)),y.scale.y=L.scale.y*Math.abs(y.y-(H.y+g.projectionMatrix.n22)/(H.w+g.projectionMatrix.n24)),y.materials=L.materials,j.push(y);k&&j.sort(c);return j}};
THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,c=new THREE.Projector,e,f,g,k;this.domElement=document.createElement("div");this.setSize=function(b,c){e=b;f=c;g=e/2;k=f/2};this.render=function(e,f){var n,o,p,t,v,u,w,B;b=c.projectScene(e,f);n=0;for(o=b.length;n<o;n++)if(v=b[n],v instanceof THREE.RenderableParticle){w=v.x*g+g;B=v.y*k+k;p=0;for(t=v.material.length;p<t;p++)if(u=v.material[p],u instanceof THREE.ParticleDOMMaterial)u=u.domElement,u.style.left=w+"px",u.style.top=B+"px"}}};
THREE.CanvasRenderer=function(b){function c(b){if(y!=b)w.globalAlpha=y=b}function e(b){if(G!=b){switch(b){case THREE.NormalBlending:w.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:w.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:w.globalCompositeOperation="darker"}G=b}}function f(b){if(z!=b.hex)z=b.hex,w.strokeStyle="#"+k(z.toString(16))}function g(b){if(C!=b.hex)C=b.hex,w.fillStyle="#"+k(C.toString(16))}function k(b){for(;b.length<6;)b="0"+b;return b}
-var h=this,m=null,n=new THREE.Projector,b=b||{},o=b.canvas!==void 0?b.canvas:document.createElement("canvas"),p,t,v,u,w=o.getContext("2d"),B=new THREE.Color(0),A=0,y=1,G=0,z=null,C=null,H=null,D=null,Q=null,J,F,I,S,K=new THREE.RenderableVertex,ea=new THREE.RenderableVertex,j,ca,T,Z,N,da,X,aa,ia,ha,na,ja,L=new THREE.Color(0),fa=new THREE.Color(0),W=new THREE.Color(0),U=new THREE.Color(0),$=new THREE.Color(0),Y,ka,la,ga,Da,ua,Aa,xa,ta,ya,va=new THREE.Rectangle,qa=new THREE.Rectangle,R=new THREE.Rectangle,
-O=!1,oa=new THREE.Color,P=new THREE.Color,Ba=new THREE.Color,V=new THREE.Color,pa=new THREE.Vector3,Pa,Qa,Wa,wa,Ra,Sa,b=16;Pa=document.createElement("canvas");Pa.width=Pa.height=2;Qa=Pa.getContext("2d");Qa.fillStyle="rgba(0,0,0,1)";Qa.fillRect(0,0,2,2);Wa=Qa.getImageData(0,0,2,2);wa=Wa.data;Ra=document.createElement("canvas");Ra.width=Ra.height=b;Sa=Ra.getContext("2d");Sa.translate(-b/2,-b/2);Sa.scale(b,b);b--;this.domElement=o;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,
-faces:0};this.setSize=function(b,e){p=b;t=e;v=p/2;u=t/2;o.width=p;o.height=t;va.set(-v,-u,v,u);y=1;G=0;Q=D=H=C=z=null};this.setClearColor=function(b,e){B=b;A=e};this.setClearColorHex=function(b,e){B.setHex(b);A=e};this.clear=function(){w.setTransform(1,0,0,-1,v,u);if(!qa.isEmpty())qa.inflate(1),qa.minSelf(va),B.hex==0&&A==0?w.clearRect(qa.getX(),qa.getY(),qa.getWidth(),qa.getHeight()):(e(THREE.NormalBlending),c(1),w.fillStyle="rgba("+Math.floor(B.r*255)+","+Math.floor(B.g*255)+","+Math.floor(B.b*
-255)+","+A+")",w.fillRect(qa.getX(),qa.getY(),qa.getWidth(),qa.getHeight())),qa.empty()};this.render=function(b,k){function o(b){var e,c,j,f=b.lights;P.setRGB(0,0,0);Ba.setRGB(0,0,0);V.setRGB(0,0,0);b=0;for(e=f.length;b<e;b++)c=f[b],j=c.color,c instanceof THREE.AmbientLight?(P.r+=j.r,P.g+=j.g,P.b+=j.b):c instanceof THREE.DirectionalLight?(Ba.r+=j.r,Ba.g+=j.g,Ba.b+=j.b):c instanceof THREE.PointLight&&(V.r+=j.r,V.g+=j.g,V.b+=j.b)}function p(b,e,c,j){var f,g,h,k,m=b.lights,b=0;for(f=m.length;b<f;b++)g=
-m[b],h=g.color,g instanceof THREE.DirectionalLight?(k=c.dot(g.position),k<=0||(k*=g.intensity,j.r+=h.r*k,j.g+=h.g*k,j.b+=h.b*k)):g instanceof THREE.PointLight&&(k=c.dot(pa.sub(g.position,e).normalize()),k<=0||(k*=g.distance==0?1:1-Math.min(e.distanceTo(g.position)/g.distance,1),k!=0&&(k*=g.intensity,j.r+=h.r*k,j.g+=h.g*k,j.b+=h.b*k)))}function t(b,j,h){c(h.opacity);e(h.blending);var k,m,n,o,p,V;if(h instanceof THREE.ParticleBasicMaterial){if(h.map)o=h.map.image,p=o.width>>1,V=o.height>>1,h=j.scale.x*
-v,n=j.scale.y*u,k=h*p,m=n*V,R.set(b.x-k,b.y-m,b.x+k,b.y+m),va.instersects(R)&&(w.save(),w.translate(b.x,b.y),w.rotate(-j.rotation),w.scale(h,-n),w.translate(-p,-V),w.drawImage(o,0,0),w.restore())}else h instanceof THREE.ParticleCanvasMaterial&&(k=j.scale.x*v,m=j.scale.y*u,R.set(b.x-k,b.y-m,b.x+k,b.y+m),va.instersects(R)&&(f(h.color),g(h.color),w.save(),w.translate(b.x,b.y),w.rotate(-j.rotation),w.scale(k,m),h.program(w),w.restore()))}function y(b,j,g,h){c(h.opacity);e(h.blending);w.beginPath();w.moveTo(b.positionScreen.x,
-b.positionScreen.y);w.lineTo(j.positionScreen.x,j.positionScreen.y);w.closePath();if(h instanceof THREE.LineBasicMaterial){b=h.linewidth;if(H!=b)w.lineWidth=H=b;b=h.linecap;if(D!=b)w.lineCap=D=b;b=h.linejoin;if(Q!=b)w.lineJoin=Q=b;f(h.color);w.stroke();R.inflate(h.linewidth*2)}}function A(b,f,g,m,n,o,V,t,u){h.data.vertices+=3;h.data.faces++;c(t.opacity);e(t.blending);j=b.positionScreen.x;ca=b.positionScreen.y;T=f.positionScreen.x;Z=f.positionScreen.y;N=g.positionScreen.x;da=g.positionScreen.y;z(j,
-ca,T,Z,N,da);if(t instanceof THREE.MeshBasicMaterial)if(t.map)t.map.mapping instanceof THREE.UVMapping&&(ga=V.uvs[0],Ea(j,ca,T,Z,N,da,t.map.image,ga[m].u,ga[m].v,ga[n].u,ga[n].v,ga[o].u,ga[o].v));else if(t.envMap){if(t.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=k.matrixWorldInverse,pa.copy(V.vertexNormalsWorld[0]),Da=(pa.x*b.n11+pa.y*b.n12+pa.z*b.n13)*0.5+0.5,ua=-(pa.x*b.n21+pa.y*b.n22+pa.z*b.n23)*0.5+0.5,pa.copy(V.vertexNormalsWorld[1]),Aa=(pa.x*b.n11+pa.y*b.n12+pa.z*b.n13)*0.5+
-0.5,xa=-(pa.x*b.n21+pa.y*b.n22+pa.z*b.n23)*0.5+0.5,pa.copy(V.vertexNormalsWorld[2]),ta=(pa.x*b.n11+pa.y*b.n12+pa.z*b.n13)*0.5+0.5,ya=-(pa.x*b.n21+pa.y*b.n22+pa.z*b.n23)*0.5+0.5,Ea(j,ca,T,Z,N,da,t.envMap.image,Da,ua,Aa,xa,ta,ya)}else t.wireframe?C(t.color,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ga(t.color);else if(t instanceof THREE.MeshLambertMaterial)t.map&&!t.wireframe&&(t.map.mapping instanceof THREE.UVMapping&&(ga=V.uvs[0],Ea(j,ca,T,Z,N,da,t.map.image,ga[m].u,ga[m].v,ga[n].u,
-ga[n].v,ga[o].u,ga[o].v)),e(THREE.SubtractiveBlending)),O?!t.wireframe&&t.shading==THREE.SmoothShading&&V.vertexNormalsWorld.length==3?(fa.r=W.r=U.r=P.r,fa.g=W.g=U.g=P.g,fa.b=W.b=U.b=P.b,p(u,V.v1.positionWorld,V.vertexNormalsWorld[0],fa),p(u,V.v2.positionWorld,V.vertexNormalsWorld[1],W),p(u,V.v3.positionWorld,V.vertexNormalsWorld[2],U),$.r=(W.r+U.r)*0.5,$.g=(W.g+U.g)*0.5,$.b=(W.b+U.b)*0.5,la=Ta(fa,W,U,$),Ea(j,ca,T,Z,N,da,la,0,0,1,0,0,1)):(oa.r=P.r,oa.g=P.g,oa.b=P.b,p(u,V.centroidWorld,V.normalWorld,
-oa),L.r=Math.max(0,Math.min(t.color.r*oa.r,1)),L.g=Math.max(0,Math.min(t.color.g*oa.g,1)),L.b=Math.max(0,Math.min(t.color.b*oa.b,1)),L.updateHex(),t.wireframe?C(L,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ga(L)):t.wireframe?C(t.color,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ga(t.color);else if(t instanceof THREE.MeshDepthMaterial)Y=k.near,ka=k.far,fa.r=fa.g=fa.b=1-Ja(b.positionScreen.z,Y,ka),W.r=W.g=W.b=1-Ja(f.positionScreen.z,Y,ka),U.r=U.g=U.b=1-Ja(g.positionScreen.z,
-Y,ka),$.r=(W.r+U.r)*0.5,$.g=(W.g+U.g)*0.5,$.b=(W.b+U.b)*0.5,la=Ta(fa,W,U,$),Ea(j,ca,T,Z,N,da,la,0,0,1,0,0,1);else if(t instanceof THREE.MeshNormalMaterial)L.r=Na(V.normalWorld.x),L.g=Na(V.normalWorld.y),L.b=Na(V.normalWorld.z),L.updateHex(),t.wireframe?C(L,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ga(L)}function B(b,f,g,m,n,o,t,V,u){h.data.vertices+=4;h.data.faces++;c(V.opacity);e(V.blending);if(V.map||V.envMap)A(b,f,m,0,1,3,t,V,u),A(n,g,o,1,2,3,t,V,u);else if(j=b.positionScreen.x,
-ca=b.positionScreen.y,T=f.positionScreen.x,Z=f.positionScreen.y,N=g.positionScreen.x,da=g.positionScreen.y,X=m.positionScreen.x,aa=m.positionScreen.y,ia=n.positionScreen.x,ha=n.positionScreen.y,na=o.positionScreen.x,ja=o.positionScreen.y,V instanceof THREE.MeshBasicMaterial)G(j,ca,T,Z,N,da,X,aa),V.wireframe?C(V.color,V.wireframeLinewidth,V.wireframeLinecap,V.wireframeLinejoin):Ga(V.color);else if(V instanceof THREE.MeshLambertMaterial)O?!V.wireframe&&V.shading==THREE.SmoothShading&&t.vertexNormalsWorld.length==
-4?(fa.r=W.r=U.r=$.r=P.r,fa.g=W.g=U.g=$.g=P.g,fa.b=W.b=U.b=$.b=P.b,p(u,t.v1.positionWorld,t.vertexNormalsWorld[0],fa),p(u,t.v2.positionWorld,t.vertexNormalsWorld[1],W),p(u,t.v4.positionWorld,t.vertexNormalsWorld[3],U),p(u,t.v3.positionWorld,t.vertexNormalsWorld[2],$),la=Ta(fa,W,U,$),z(j,ca,T,Z,X,aa),Ea(j,ca,T,Z,X,aa,la,0,0,1,0,0,1),z(ia,ha,N,da,na,ja),Ea(ia,ha,N,da,na,ja,la,1,0,1,1,0,1)):(oa.r=P.r,oa.g=P.g,oa.b=P.b,p(u,t.centroidWorld,t.normalWorld,oa),L.r=Math.max(0,Math.min(V.color.r*oa.r,1)),L.g=
-Math.max(0,Math.min(V.color.g*oa.g,1)),L.b=Math.max(0,Math.min(V.color.b*oa.b,1)),L.updateHex(),G(j,ca,T,Z,N,da,X,aa),V.wireframe?C(L,V.wireframeLinewidth,V.wireframeLinecap,V.wireframeLinejoin):Ga(L)):(G(j,ca,T,Z,N,da,X,aa),V.wireframe?C(V.color,V.wireframeLinewidth,V.wireframeLinecap,V.wireframeLinejoin):Ga(V.color));else if(V instanceof THREE.MeshNormalMaterial)L.r=Na(t.normalWorld.x),L.g=Na(t.normalWorld.y),L.b=Na(t.normalWorld.z),L.updateHex(),G(j,ca,T,Z,N,da,X,aa),V.wireframe?C(L,V.wireframeLinewidth,
-V.wireframeLinecap,V.wireframeLinejoin):Ga(L);else if(V instanceof THREE.MeshDepthMaterial)Y=k.near,ka=k.far,fa.r=fa.g=fa.b=1-Ja(b.positionScreen.z,Y,ka),W.r=W.g=W.b=1-Ja(f.positionScreen.z,Y,ka),U.r=U.g=U.b=1-Ja(m.positionScreen.z,Y,ka),$.r=$.g=$.b=1-Ja(g.positionScreen.z,Y,ka),la=Ta(fa,W,U,$),z(j,ca,T,Z,X,aa),Ea(j,ca,T,Z,X,aa,la,0,0,1,0,0,1),z(ia,ha,N,da,na,ja),Ea(ia,ha,N,da,na,ja,la,1,0,1,1,0,1)}function z(b,e,c,j,f,g){w.beginPath();w.moveTo(b,e);w.lineTo(c,j);w.lineTo(f,g);w.lineTo(b,e);w.closePath()}
-function G(b,e,c,j,f,g,h,k){w.beginPath();w.moveTo(b,e);w.lineTo(c,j);w.lineTo(f,g);w.lineTo(h,k);w.lineTo(b,e);w.closePath()}function C(b,e,c,j){if(H!=e)w.lineWidth=H=e;if(D!=c)w.lineCap=D=c;if(Q!=j)w.lineJoin=Q=j;f(b);w.stroke();R.inflate(e*2)}function Ga(b){g(b);w.fill()}function Ea(b,e,c,j,f,g,h,k,m,n,V,t,o){var p,u;p=h.width-1;u=h.height-1;k*=p;m*=u;n*=p;V*=u;t*=p;o*=u;c-=b;j-=e;f-=b;g-=e;n-=k;V-=m;t-=k;o-=m;p=n*o-t*V;p!=0&&(u=1/p,p=(o*c-V*f)*u,V=(o*j-V*g)*u,c=(n*f-t*c)*u,j=(n*g-t*j)*u,b=b-p*
-k-c*m,e=e-V*k-j*m,w.save(),w.transform(p,V,c,j,b,e),w.clip(),w.drawImage(h,0,0),w.restore())}function Ta(b,e,c,j){var f=~~(b.r*255),g=~~(b.g*255),b=~~(b.b*255),h=~~(e.r*255),k=~~(e.g*255),e=~~(e.b*255),m=~~(c.r*255),n=~~(c.g*255),c=~~(c.b*255),V=~~(j.r*255),t=~~(j.g*255),j=~~(j.b*255);wa[0]=f<0?0:f>255?255:f;wa[1]=g<0?0:g>255?255:g;wa[2]=b<0?0:b>255?255:b;wa[4]=h<0?0:h>255?255:h;wa[5]=k<0?0:k>255?255:k;wa[6]=e<0?0:e>255?255:e;wa[8]=m<0?0:m>255?255:m;wa[9]=n<0?0:n>255?255:n;wa[10]=c<0?0:c>255?255:
-c;wa[12]=V<0?0:V>255?255:V;wa[13]=t<0?0:t>255?255:t;wa[14]=j<0?0:j>255?255:j;Qa.putImageData(Wa,0,0);Sa.drawImage(Pa,0,0);return Ra}function Ja(b,e,c){b=(b-e)/(c-e);return b*b*(3-2*b)}function Na(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function E(b,e){var c=e.x-b.x,j=e.y-b.y,f=1/Math.sqrt(c*c+j*j);c*=f;j*=f;e.x+=c;e.y+=j;b.x-=c;b.y-=j}var Ua,x,ma,za,Ha,Oa,Va,ra;this.autoClear?this.clear():w.setTransform(1,0,0,-1,v,u);h.data.vertices=0;h.data.faces=0;m=n.projectScene(b,k,this.sortElements);(O=b.lights.length>
-0)&&o(b);Ua=0;for(x=m.length;Ua<x;Ua++){ma=m[Ua];R.empty();if(ma instanceof THREE.RenderableParticle){J=ma;J.x*=v;J.y*=u;za=0;for(Ha=ma.materials.length;za<Ha;)ra=ma.materials[za++],ra.opacity!=0&&t(J,ma,ra,b)}else if(ma instanceof THREE.RenderableLine){if(J=ma.v1,F=ma.v2,J.positionScreen.x*=v,J.positionScreen.y*=u,F.positionScreen.x*=v,F.positionScreen.y*=u,R.addPoint(J.positionScreen.x,J.positionScreen.y),R.addPoint(F.positionScreen.x,F.positionScreen.y),va.instersects(R)){za=0;for(Ha=ma.materials.length;za<
-Ha;)ra=ma.materials[za++],ra.opacity!=0&&y(J,F,ma,ra,b)}}else if(ma instanceof THREE.RenderableFace3){if(J=ma.v1,F=ma.v2,I=ma.v3,J.positionScreen.x*=v,J.positionScreen.y*=u,F.positionScreen.x*=v,F.positionScreen.y*=u,I.positionScreen.x*=v,I.positionScreen.y*=u,ma.overdraw&&(E(J.positionScreen,F.positionScreen),E(F.positionScreen,I.positionScreen),E(I.positionScreen,J.positionScreen)),R.add3Points(J.positionScreen.x,J.positionScreen.y,F.positionScreen.x,F.positionScreen.y,I.positionScreen.x,I.positionScreen.y),
-va.instersects(R)){za=0;for(Ha=ma.meshMaterials.length;za<Ha;)if(ra=ma.meshMaterials[za++],ra instanceof THREE.MeshFaceMaterial){Oa=0;for(Va=ma.faceMaterials.length;Oa<Va;)(ra=ma.faceMaterials[Oa++])&&ra.opacity!=0&&A(J,F,I,0,1,2,ma,ra,b)}else ra.opacity!=0&&A(J,F,I,0,1,2,ma,ra,b)}}else if(ma instanceof THREE.RenderableFace4&&(J=ma.v1,F=ma.v2,I=ma.v3,S=ma.v4,J.positionScreen.x*=v,J.positionScreen.y*=u,F.positionScreen.x*=v,F.positionScreen.y*=u,I.positionScreen.x*=v,I.positionScreen.y*=u,S.positionScreen.x*=
-v,S.positionScreen.y*=u,K.positionScreen.copy(F.positionScreen),ea.positionScreen.copy(S.positionScreen),ma.overdraw&&(E(J.positionScreen,F.positionScreen),E(F.positionScreen,S.positionScreen),E(S.positionScreen,J.positionScreen),E(I.positionScreen,K.positionScreen),E(I.positionScreen,ea.positionScreen)),R.addPoint(J.positionScreen.x,J.positionScreen.y),R.addPoint(F.positionScreen.x,F.positionScreen.y),R.addPoint(I.positionScreen.x,I.positionScreen.y),R.addPoint(S.positionScreen.x,S.positionScreen.y),
-va.instersects(R))){za=0;for(Ha=ma.meshMaterials.length;za<Ha;)if(ra=ma.meshMaterials[za++],ra instanceof THREE.MeshFaceMaterial){Oa=0;for(Va=ma.faceMaterials.length;Oa<Va;)(ra=ma.faceMaterials[Oa++])&&ra.opacity!=0&&B(J,F,I,S,K,ea,ma,ra,b)}else ra.opacity!=0&&B(J,F,I,S,K,ea,ma,ra,b)}qa.addRectangle(R)}w.setTransform(1,0,0,1,0,0)}};
+var h=this,m=null,n=new THREE.Projector,b=b||{},o=b.canvas!==void 0?b.canvas:document.createElement("canvas"),p,t,v,u,w=o.getContext("2d"),B=new THREE.Color(0),A=0,y=1,G=0,z=null,C=null,H=null,D=null,Q=null,J,F,I,S,K=new THREE.RenderableVertex,ea=new THREE.RenderableVertex,j,ca,T,Z,N,da,X,aa,ia,ha,na,ja,L=new THREE.Color(0),fa=new THREE.Color(0),W=new THREE.Color(0),U=new THREE.Color(0),$=new THREE.Color(0),Y,ka,la,ga,Da,ua,Aa,xa,qa,ya,va=new THREE.Rectangle,oa=new THREE.Rectangle,R=new THREE.Rectangle,
+O=!1,ra=new THREE.Color,P=new THREE.Color,Ba=new THREE.Color,V=new THREE.Color,pa=new THREE.Vector3,Pa,Qa,Wa,wa,Ra,Sa,b=16;Pa=document.createElement("canvas");Pa.width=Pa.height=2;Qa=Pa.getContext("2d");Qa.fillStyle="rgba(0,0,0,1)";Qa.fillRect(0,0,2,2);Wa=Qa.getImageData(0,0,2,2);wa=Wa.data;Ra=document.createElement("canvas");Ra.width=Ra.height=b;Sa=Ra.getContext("2d");Sa.translate(-b/2,-b/2);Sa.scale(b,b);b--;this.domElement=o;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,
+faces:0};this.setSize=function(b,e){p=b;t=e;v=p/2;u=t/2;o.width=p;o.height=t;va.set(-v,-u,v,u);oa.set(-v,-u,v,u);y=1;G=0;Q=D=H=C=z=null};this.setClearColor=function(b,e){B=b;A=e;oa.set(-v,-u,v,u)};this.setClearColorHex=function(b,e){B.setHex(b);A=e;oa.set(-v,-u,v,u)};this.clear=function(){w.setTransform(1,0,0,-1,v,u);if(!oa.isEmpty())oa.inflate(1),oa.minSelf(va),B.hex==0&&A==0?w.clearRect(oa.getX(),oa.getY(),oa.getWidth(),oa.getHeight()):(e(THREE.NormalBlending),c(1),w.fillStyle="rgba("+Math.floor(B.r*
+255)+","+Math.floor(B.g*255)+","+Math.floor(B.b*255)+","+A+")",w.fillRect(oa.getX(),oa.getY(),oa.getWidth(),oa.getHeight())),oa.empty()};this.render=function(b,k){function o(b){var e,c,j,f=b.lights;P.setRGB(0,0,0);Ba.setRGB(0,0,0);V.setRGB(0,0,0);b=0;for(e=f.length;b<e;b++)c=f[b],j=c.color,c instanceof THREE.AmbientLight?(P.r+=j.r,P.g+=j.g,P.b+=j.b):c instanceof THREE.DirectionalLight?(Ba.r+=j.r,Ba.g+=j.g,Ba.b+=j.b):c instanceof THREE.PointLight&&(V.r+=j.r,V.g+=j.g,V.b+=j.b)}function p(b,e,c,j){var f,
+g,h,k,m=b.lights,b=0;for(f=m.length;b<f;b++)g=m[b],h=g.color,g instanceof THREE.DirectionalLight?(k=c.dot(g.position),k<=0||(k*=g.intensity,j.r+=h.r*k,j.g+=h.g*k,j.b+=h.b*k)):g instanceof THREE.PointLight&&(k=c.dot(pa.sub(g.position,e).normalize()),k<=0||(k*=g.distance==0?1:1-Math.min(e.distanceTo(g.position)/g.distance,1),k!=0&&(k*=g.intensity,j.r+=h.r*k,j.g+=h.g*k,j.b+=h.b*k)))}function t(b,j,h){c(h.opacity);e(h.blending);var k,m,n,o,p,V;if(h instanceof THREE.ParticleBasicMaterial){if(h.map)o=h.map.image,
+p=o.width>>1,V=o.height>>1,h=j.scale.x*v,n=j.scale.y*u,k=h*p,m=n*V,R.set(b.x-k,b.y-m,b.x+k,b.y+m),va.instersects(R)&&(w.save(),w.translate(b.x,b.y),w.rotate(-j.rotation),w.scale(h,-n),w.translate(-p,-V),w.drawImage(o,0,0),w.restore())}else h instanceof THREE.ParticleCanvasMaterial&&(k=j.scale.x*v,m=j.scale.y*u,R.set(b.x-k,b.y-m,b.x+k,b.y+m),va.instersects(R)&&(f(h.color),g(h.color),w.save(),w.translate(b.x,b.y),w.rotate(-j.rotation),w.scale(k,m),h.program(w),w.restore()))}function y(b,j,g,h){c(h.opacity);
+e(h.blending);w.beginPath();w.moveTo(b.positionScreen.x,b.positionScreen.y);w.lineTo(j.positionScreen.x,j.positionScreen.y);w.closePath();if(h instanceof THREE.LineBasicMaterial){b=h.linewidth;if(H!=b)w.lineWidth=H=b;b=h.linecap;if(D!=b)w.lineCap=D=b;b=h.linejoin;if(Q!=b)w.lineJoin=Q=b;f(h.color);w.stroke();R.inflate(h.linewidth*2)}}function A(b,f,g,m,n,o,V,t,u){h.data.vertices+=3;h.data.faces++;c(t.opacity);e(t.blending);j=b.positionScreen.x;ca=b.positionScreen.y;T=f.positionScreen.x;Z=f.positionScreen.y;
+N=g.positionScreen.x;da=g.positionScreen.y;z(j,ca,T,Z,N,da);if(t instanceof THREE.MeshBasicMaterial)if(t.map)t.map.mapping instanceof THREE.UVMapping&&(ga=V.uvs[0],Ea(j,ca,T,Z,N,da,t.map.image,ga[m].u,ga[m].v,ga[n].u,ga[n].v,ga[o].u,ga[o].v));else if(t.envMap){if(t.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=k.matrixWorldInverse,pa.copy(V.vertexNormalsWorld[0]),Da=(pa.x*b.n11+pa.y*b.n12+pa.z*b.n13)*0.5+0.5,ua=-(pa.x*b.n21+pa.y*b.n22+pa.z*b.n23)*0.5+0.5,pa.copy(V.vertexNormalsWorld[1]),
+Aa=(pa.x*b.n11+pa.y*b.n12+pa.z*b.n13)*0.5+0.5,xa=-(pa.x*b.n21+pa.y*b.n22+pa.z*b.n23)*0.5+0.5,pa.copy(V.vertexNormalsWorld[2]),qa=(pa.x*b.n11+pa.y*b.n12+pa.z*b.n13)*0.5+0.5,ya=-(pa.x*b.n21+pa.y*b.n22+pa.z*b.n23)*0.5+0.5,Ea(j,ca,T,Z,N,da,t.envMap.image,Da,ua,Aa,xa,qa,ya)}else t.wireframe?C(t.color,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ga(t.color);else if(t instanceof THREE.MeshLambertMaterial)t.map&&!t.wireframe&&(t.map.mapping instanceof THREE.UVMapping&&(ga=V.uvs[0],Ea(j,ca,
+T,Z,N,da,t.map.image,ga[m].u,ga[m].v,ga[n].u,ga[n].v,ga[o].u,ga[o].v)),e(THREE.SubtractiveBlending)),O?!t.wireframe&&t.shading==THREE.SmoothShading&&V.vertexNormalsWorld.length==3?(fa.r=W.r=U.r=P.r,fa.g=W.g=U.g=P.g,fa.b=W.b=U.b=P.b,p(u,V.v1.positionWorld,V.vertexNormalsWorld[0],fa),p(u,V.v2.positionWorld,V.vertexNormalsWorld[1],W),p(u,V.v3.positionWorld,V.vertexNormalsWorld[2],U),$.r=(W.r+U.r)*0.5,$.g=(W.g+U.g)*0.5,$.b=(W.b+U.b)*0.5,la=Ta(fa,W,U,$),Ea(j,ca,T,Z,N,da,la,0,0,1,0,0,1)):(ra.r=P.r,ra.g=
+P.g,ra.b=P.b,p(u,V.centroidWorld,V.normalWorld,ra),L.r=Math.max(0,Math.min(t.color.r*ra.r,1)),L.g=Math.max(0,Math.min(t.color.g*ra.g,1)),L.b=Math.max(0,Math.min(t.color.b*ra.b,1)),L.updateHex(),t.wireframe?C(L,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ga(L)):t.wireframe?C(t.color,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ga(t.color);else if(t instanceof THREE.MeshDepthMaterial)Y=k.near,ka=k.far,fa.r=fa.g=fa.b=1-Ja(b.positionScreen.z,Y,ka),W.r=W.g=W.b=1-Ja(f.positionScreen.z,
+Y,ka),U.r=U.g=U.b=1-Ja(g.positionScreen.z,Y,ka),$.r=(W.r+U.r)*0.5,$.g=(W.g+U.g)*0.5,$.b=(W.b+U.b)*0.5,la=Ta(fa,W,U,$),Ea(j,ca,T,Z,N,da,la,0,0,1,0,0,1);else if(t instanceof THREE.MeshNormalMaterial)L.r=Na(V.normalWorld.x),L.g=Na(V.normalWorld.y),L.b=Na(V.normalWorld.z),L.updateHex(),t.wireframe?C(L,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ga(L)}function B(b,f,g,m,n,o,t,V,u){h.data.vertices+=4;h.data.faces++;c(V.opacity);e(V.blending);if(V.map||V.envMap)A(b,f,m,0,1,3,t,V,u),A(n,
+g,o,1,2,3,t,V,u);else if(j=b.positionScreen.x,ca=b.positionScreen.y,T=f.positionScreen.x,Z=f.positionScreen.y,N=g.positionScreen.x,da=g.positionScreen.y,X=m.positionScreen.x,aa=m.positionScreen.y,ia=n.positionScreen.x,ha=n.positionScreen.y,na=o.positionScreen.x,ja=o.positionScreen.y,V instanceof THREE.MeshBasicMaterial)G(j,ca,T,Z,N,da,X,aa),V.wireframe?C(V.color,V.wireframeLinewidth,V.wireframeLinecap,V.wireframeLinejoin):Ga(V.color);else if(V instanceof THREE.MeshLambertMaterial)O?!V.wireframe&&
+V.shading==THREE.SmoothShading&&t.vertexNormalsWorld.length==4?(fa.r=W.r=U.r=$.r=P.r,fa.g=W.g=U.g=$.g=P.g,fa.b=W.b=U.b=$.b=P.b,p(u,t.v1.positionWorld,t.vertexNormalsWorld[0],fa),p(u,t.v2.positionWorld,t.vertexNormalsWorld[1],W),p(u,t.v4.positionWorld,t.vertexNormalsWorld[3],U),p(u,t.v3.positionWorld,t.vertexNormalsWorld[2],$),la=Ta(fa,W,U,$),z(j,ca,T,Z,X,aa),Ea(j,ca,T,Z,X,aa,la,0,0,1,0,0,1),z(ia,ha,N,da,na,ja),Ea(ia,ha,N,da,na,ja,la,1,0,1,1,0,1)):(ra.r=P.r,ra.g=P.g,ra.b=P.b,p(u,t.centroidWorld,t.normalWorld,
+ra),L.r=Math.max(0,Math.min(V.color.r*ra.r,1)),L.g=Math.max(0,Math.min(V.color.g*ra.g,1)),L.b=Math.max(0,Math.min(V.color.b*ra.b,1)),L.updateHex(),G(j,ca,T,Z,N,da,X,aa),V.wireframe?C(L,V.wireframeLinewidth,V.wireframeLinecap,V.wireframeLinejoin):Ga(L)):(G(j,ca,T,Z,N,da,X,aa),V.wireframe?C(V.color,V.wireframeLinewidth,V.wireframeLinecap,V.wireframeLinejoin):Ga(V.color));else if(V instanceof THREE.MeshNormalMaterial)L.r=Na(t.normalWorld.x),L.g=Na(t.normalWorld.y),L.b=Na(t.normalWorld.z),L.updateHex(),
+G(j,ca,T,Z,N,da,X,aa),V.wireframe?C(L,V.wireframeLinewidth,V.wireframeLinecap,V.wireframeLinejoin):Ga(L);else if(V instanceof THREE.MeshDepthMaterial)Y=k.near,ka=k.far,fa.r=fa.g=fa.b=1-Ja(b.positionScreen.z,Y,ka),W.r=W.g=W.b=1-Ja(f.positionScreen.z,Y,ka),U.r=U.g=U.b=1-Ja(m.positionScreen.z,Y,ka),$.r=$.g=$.b=1-Ja(g.positionScreen.z,Y,ka),la=Ta(fa,W,U,$),z(j,ca,T,Z,X,aa),Ea(j,ca,T,Z,X,aa,la,0,0,1,0,0,1),z(ia,ha,N,da,na,ja),Ea(ia,ha,N,da,na,ja,la,1,0,1,1,0,1)}function z(b,e,c,j,f,g){w.beginPath();w.moveTo(b,
+e);w.lineTo(c,j);w.lineTo(f,g);w.lineTo(b,e);w.closePath()}function G(b,e,c,j,f,g,h,k){w.beginPath();w.moveTo(b,e);w.lineTo(c,j);w.lineTo(f,g);w.lineTo(h,k);w.lineTo(b,e);w.closePath()}function C(b,e,c,j){if(H!=e)w.lineWidth=H=e;if(D!=c)w.lineCap=D=c;if(Q!=j)w.lineJoin=Q=j;f(b);w.stroke();R.inflate(e*2)}function Ga(b){g(b);w.fill()}function Ea(b,e,c,j,f,g,h,k,m,n,V,t,o){var p,u;p=h.width-1;u=h.height-1;k*=p;m*=u;n*=p;V*=u;t*=p;o*=u;c-=b;j-=e;f-=b;g-=e;n-=k;V-=m;t-=k;o-=m;p=n*o-t*V;if(!((p<0?-p:p)<
+1))u=1/p,p=(o*c-V*f)*u,V=(o*j-V*g)*u,c=(n*f-t*c)*u,j=(n*g-t*j)*u,b=b-p*k-c*m,e=e-V*k-j*m,w.save(),w.transform(p,V,c,j,b,e),w.clip(),w.drawImage(h,0,0),w.restore()}function Ta(b,e,c,j){var f=~~(b.r*255),g=~~(b.g*255),b=~~(b.b*255),h=~~(e.r*255),k=~~(e.g*255),e=~~(e.b*255),m=~~(c.r*255),n=~~(c.g*255),c=~~(c.b*255),V=~~(j.r*255),t=~~(j.g*255),j=~~(j.b*255);wa[0]=f<0?0:f>255?255:f;wa[1]=g<0?0:g>255?255:g;wa[2]=b<0?0:b>255?255:b;wa[4]=h<0?0:h>255?255:h;wa[5]=k<0?0:k>255?255:k;wa[6]=e<0?0:e>255?255:e;wa[8]=
+m<0?0:m>255?255:m;wa[9]=n<0?0:n>255?255:n;wa[10]=c<0?0:c>255?255:c;wa[12]=V<0?0:V>255?255:V;wa[13]=t<0?0:t>255?255:t;wa[14]=j<0?0:j>255?255:j;Qa.putImageData(Wa,0,0);Sa.drawImage(Pa,0,0);return Ra}function Ja(b,e,c){b=(b-e)/(c-e);return b*b*(3-2*b)}function Na(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function E(b,e){var c=e.x-b.x,j=e.y-b.y,f=c*c+j*j;f!=0&&(f=1/Math.sqrt(f),c*=f,j*=f,e.x+=c,e.y+=j,b.x-=c,b.y-=j)}var Ua,x,ma,za,Ha,Oa,Va,sa;this.autoClear?this.clear():w.setTransform(1,0,0,-1,v,u);h.data.vertices=
+0;h.data.faces=0;m=n.projectScene(b,k,this.sortElements);(O=b.lights.length>0)&&o(b);Ua=0;for(x=m.length;Ua<x;Ua++){ma=m[Ua];R.empty();if(ma instanceof THREE.RenderableParticle){J=ma;J.x*=v;J.y*=u;za=0;for(Ha=ma.materials.length;za<Ha;)sa=ma.materials[za++],sa.opacity!=0&&t(J,ma,sa,b)}else if(ma instanceof THREE.RenderableLine){if(J=ma.v1,F=ma.v2,J.positionScreen.x*=v,J.positionScreen.y*=u,F.positionScreen.x*=v,F.positionScreen.y*=u,R.addPoint(J.positionScreen.x,J.positionScreen.y),R.addPoint(F.positionScreen.x,
+F.positionScreen.y),va.instersects(R)){za=0;for(Ha=ma.materials.length;za<Ha;)sa=ma.materials[za++],sa.opacity!=0&&y(J,F,ma,sa,b)}}else if(ma instanceof THREE.RenderableFace3){if(J=ma.v1,F=ma.v2,I=ma.v3,J.positionScreen.x*=v,J.positionScreen.y*=u,F.positionScreen.x*=v,F.positionScreen.y*=u,I.positionScreen.x*=v,I.positionScreen.y*=u,ma.overdraw&&(E(J.positionScreen,F.positionScreen),E(F.positionScreen,I.positionScreen),E(I.positionScreen,J.positionScreen)),R.add3Points(J.positionScreen.x,J.positionScreen.y,
+F.positionScreen.x,F.positionScreen.y,I.positionScreen.x,I.positionScreen.y),va.instersects(R)){za=0;for(Ha=ma.meshMaterials.length;za<Ha;)if(sa=ma.meshMaterials[za++],sa instanceof THREE.MeshFaceMaterial){Oa=0;for(Va=ma.faceMaterials.length;Oa<Va;)(sa=ma.faceMaterials[Oa++])&&sa.opacity!=0&&A(J,F,I,0,1,2,ma,sa,b)}else sa.opacity!=0&&A(J,F,I,0,1,2,ma,sa,b)}}else if(ma instanceof THREE.RenderableFace4&&(J=ma.v1,F=ma.v2,I=ma.v3,S=ma.v4,J.positionScreen.x*=v,J.positionScreen.y*=u,F.positionScreen.x*=
+v,F.positionScreen.y*=u,I.positionScreen.x*=v,I.positionScreen.y*=u,S.positionScreen.x*=v,S.positionScreen.y*=u,K.positionScreen.copy(F.positionScreen),ea.positionScreen.copy(S.positionScreen),ma.overdraw&&(E(J.positionScreen,F.positionScreen),E(F.positionScreen,S.positionScreen),E(S.positionScreen,J.positionScreen),E(I.positionScreen,K.positionScreen),E(I.positionScreen,ea.positionScreen)),R.addPoint(J.positionScreen.x,J.positionScreen.y),R.addPoint(F.positionScreen.x,F.positionScreen.y),R.addPoint(I.positionScreen.x,
+I.positionScreen.y),R.addPoint(S.positionScreen.x,S.positionScreen.y),va.instersects(R))){za=0;for(Ha=ma.meshMaterials.length;za<Ha;)if(sa=ma.meshMaterials[za++],sa instanceof THREE.MeshFaceMaterial){Oa=0;for(Va=ma.faceMaterials.length;Oa<Va;)(sa=ma.faceMaterials[Oa++])&&sa.opacity!=0&&B(J,F,I,S,K,ea,ma,sa,b)}else sa.opacity!=0&&B(J,F,I,S,K,ea,ma,sa,b)}oa.addRectangle(R)}w.setTransform(1,0,0,1,0,0)}};
THREE.SVGRenderer=function(){function b(b,e,c){var j,f,g,h;j=0;for(f=b.lights.length;j<f;j++)g=b.lights[j],g instanceof THREE.DirectionalLight?(h=e.normalWorld.dot(g.position)*g.intensity,h>0&&(c.r+=g.color.r*h,c.g+=g.color.g*h,c.b+=g.color.b*h)):g instanceof THREE.PointLight&&(S.sub(g.position,e.centroidWorld),S.normalize(),h=e.normalWorld.dot(S)*g.intensity,h>0&&(c.r+=g.color.r*h,c.g+=g.color.g*h,c.b+=g.color.b*h))}function c(e,c,m,n,t,p){h.data.vertices+=3;h.data.faces++;j=f(ca++);j.setAttribute("d",
"M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+m.positionScreen.x+","+m.positionScreen.y+"z");t instanceof THREE.MeshBasicMaterial?H.hex=t.color.hex:t instanceof THREE.MeshLambertMaterial?C?(D.r=Q.r,D.g=Q.g,D.b=Q.b,b(p,n,D),H.r=Math.max(0,Math.min(t.color.r*D.r,1)),H.g=Math.max(0,Math.min(t.color.g*D.g,1)),H.b=Math.max(0,Math.min(t.color.b*D.b,1)),H.updateHex()):H.hex=t.color.hex:t instanceof THREE.MeshDepthMaterial?(I=1-t.__2near/(t.__farPlusNear-
n.z*t.__farMinusNear),H.setRGB(I,I,I)):t instanceof THREE.MeshNormalMaterial&&H.setRGB(g(n.normalWorld.x),g(n.normalWorld.y),g(n.normalWorld.z));t.wireframe?j.setAttribute("style","fill: none; stroke: #"+k(H.hex.toString(16))+"; stroke-width: "+t.wireframeLinewidth+"; stroke-opacity: "+t.opacity+"; stroke-linecap: "+t.wireframeLinecap+"; stroke-linejoin: "+t.wireframeLinejoin):j.setAttribute("style","fill: #"+k(H.hex.toString(16))+"; fill-opacity: "+t.opacity);o.appendChild(j)}function e(e,c,m,n,
@@ -249,37 +249,37 @@ j.drawElements(j.TRIANGLES,6,j.UNSIGNED_SHORT,0);j.disable(j.STENCIL_TEST);j.ena
0);j.vertexAttribPointer(c.uv,2,j.FLOAT,!1,16,8);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,P.elementBuffer);j.uniformMatrix4fv(h.projectionMatrix,!1,ka);j.activeTexture(j.TEXTURE0);j.uniform1i(h.map,0);c=0;for(f=b.__webglSprites.length;c<f;c++)g=b.__webglSprites[c],g.useScreenCoordinates?g.z=-g.position.z:(g._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,g.matrixWorld,g._modelViewMatrixArray),g.z=-g._modelViewMatrix.n34);b.__webglSprites.sort(u);c=0;for(f=b.__webglSprites.length;c<f;c++)g=b.__webglSprites[c],
g.material===void 0&&g.map&&g.map.image&&g.map.image.width&&(g.useScreenCoordinates?(j.uniform1i(h.useScreenCoordinates,1),j.uniform3f(h.screenPosition,(g.position.x-t)/t,(p-g.position.y)/p,Math.max(0,Math.min(1,g.position.z)))):(j.uniform1i(h.useScreenCoordinates,0),j.uniform1i(h.affectedByDistance,g.affectedByDistance?1:0),j.uniformMatrix4fv(h.modelViewMatrix,!1,g._modelViewMatrixArray)),m=g.map.image.width/(g.scaleByViewport?U:1),n[0]=m*k*g.scale.x,n[1]=m*g.scale.y,j.uniform2f(h.uvScale,g.uvScale.x,
g.uvScale.y),j.uniform2f(h.uvOffset,g.uvOffset.x,g.uvOffset.y),j.uniform2f(h.alignment,g.alignment.x,g.alignment.y),j.uniform1f(h.opacity,g.opacity),j.uniform1f(h.rotation,g.rotation),j.uniform2fv(h.scale,n),g.mergeWith3D&&!o?(j.enable(j.DEPTH_TEST),o=!0):!g.mergeWith3D&&o&&(j.disable(j.DEPTH_TEST),o=!1),D(g.blending),J(g.map,0),j.drawElements(j.TRIANGLES,6,j.UNSIGNED_SHORT,0));j.enable(j.CULL_FACE);j.enable(j.DEPTH_TEST);j.depthMask(N)}function A(b,e){var c,f,g=b.__webglLensFlares.length,h,k,m,n=
-new THREE.Vector3,t=U/W,p=W*0.5,o=U*0.5,u=16/U,v=[u*t,u],w=[1,1,0],y=[1,1],A=O.uniforms;c=O.attributes;j.useProgram(O.program);T=O.program;aa=-1;oa||(j.enableVertexAttribArray(O.attributes.vertex),j.enableVertexAttribArray(O.attributes.uv),oa=!0);j.uniform1i(A.occlusionMap,0);j.uniform1i(A.map,1);j.bindBuffer(j.ARRAY_BUFFER,O.vertexBuffer);j.vertexAttribPointer(c.vertex,2,j.FLOAT,!1,16,0);j.vertexAttribPointer(c.uv,2,j.FLOAT,!1,16,8);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,O.elementBuffer);j.disable(j.CULL_FACE);
+new THREE.Vector3,t=U/W,p=W*0.5,o=U*0.5,u=16/U,v=[u*t,u],w=[1,1,0],y=[1,1],A=O.uniforms;c=O.attributes;j.useProgram(O.program);T=O.program;aa=-1;ra||(j.enableVertexAttribArray(O.attributes.vertex),j.enableVertexAttribArray(O.attributes.uv),ra=!0);j.uniform1i(A.occlusionMap,0);j.uniform1i(A.map,1);j.bindBuffer(j.ARRAY_BUFFER,O.vertexBuffer);j.vertexAttribPointer(c.vertex,2,j.FLOAT,!1,16,0);j.vertexAttribPointer(c.uv,2,j.FLOAT,!1,16,8);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,O.elementBuffer);j.disable(j.CULL_FACE);
j.depthMask(!1);j.activeTexture(j.TEXTURE0);j.bindTexture(j.TEXTURE_2D,O.occlusionTexture);j.activeTexture(j.TEXTURE1);for(f=0;f<g;f++)if(c=b.__webglLensFlares[f].object,n.set(c.matrixWorld.n14,c.matrixWorld.n24,c.matrixWorld.n34),e.matrixWorldInverse.multiplyVector3(n),e.projectionMatrix.multiplyVector3(n),w[0]=n.x,w[1]=n.y,w[2]=n.z,y[0]=w[0]*p+p,y[1]=w[1]*o+o,O.hasVertexTexture||y[0]>0&&y[0]<W&&y[1]>0&&y[1]<U){j.bindTexture(j.TEXTURE_2D,O.tempTexture);j.copyTexImage2D(j.TEXTURE_2D,0,j.RGB,y[0]-
8,y[1]-8,16,16,0);j.uniform1i(A.renderType,0);j.uniform2fv(A.scale,v);j.uniform3fv(A.screenPosition,w);j.disable(j.BLEND);j.enable(j.DEPTH_TEST);j.drawElements(j.TRIANGLES,6,j.UNSIGNED_SHORT,0);j.bindTexture(j.TEXTURE_2D,O.occlusionTexture);j.copyTexImage2D(j.TEXTURE_2D,0,j.RGBA,y[0]-8,y[1]-8,16,16,0);j.uniform1i(A.renderType,1);j.disable(j.DEPTH_TEST);j.bindTexture(j.TEXTURE_2D,O.tempTexture);j.drawElements(j.TRIANGLES,6,j.UNSIGNED_SHORT,0);c.positionScreen.x=w[0];c.positionScreen.y=w[1];c.positionScreen.z=
w[2];c.customUpdateCallback?c.customUpdateCallback(c):c.updateLensFlares();j.uniform1i(A.renderType,2);j.enable(j.BLEND);h=0;for(k=c.lensFlares.length;h<k;h++)if(m=c.lensFlares[h],m.opacity>0.001&&m.scale>0.001)w[0]=m.x,w[1]=m.y,w[2]=m.z,u=m.size*m.scale/U,v[0]=u*t,v[1]=u,j.uniform3fv(A.screenPosition,w),j.uniform2fv(A.scale,v),j.uniform1f(A.rotation,m.rotation),j.uniform1f(A.opacity,m.opacity),D(m.blending),J(m.texture,1),j.drawElements(j.TRIANGLES,6,j.UNSIGNED_SHORT,0)}j.enable(j.CULL_FACE);j.enable(j.DEPTH_TEST);
j.depthMask(N)}function y(b,e){b._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}function G(b){var e,f,g,h;if(b instanceof THREE.Mesh){f=b.geometry;for(e in f.geometryGroups){g=f.geometryGroups[e];a:{for(var k=h=void 0,m=void 0,n=void 0,t=void 0,t=g.__materials,k=0,m=t.length;k<m;k++)if(n=t[k],n.attributes)for(h in n.attributes)if(n.attributes[h].needsUpdate){h=!0;
break a}h=!1}if(f.__dirtyVertices||f.__dirtyMorphTargets||f.__dirtyElements||f.__dirtyUvs||f.__dirtyNormals||f.__dirtyColors||f.__dirtyTangents||h)if(h=g,k=b,m=j.DYNAMIC_DRAW,h.__inittedArrays){var p=t=n=void 0,o=void 0,u=p=void 0,v=void 0,w=void 0,y=void 0,A=void 0,B=void 0,z=void 0,H=void 0,G=void 0,D=void 0,Y=void 0,C=void 0,ka=void 0,E=o=y=o=w=v=void 0,F=void 0,x=F=E=v=void 0,K=void 0,J=x=F=E=p=p=u=y=o=x=F=E=K=x=F=E=K=x=F=E=void 0,I=0,L=0,N=0,P=0,la=0,O=0,ga=0,aa=0,Q=0,M=0,R=0,F=E=0,S=h.__vertexArray,
-ca=h.__uvArray,ea=h.__uv2Array,da=h.__normalArray,T=h.__tangentArray,Z=h.__colorArray,U=h.__skinVertexAArray,W=h.__skinVertexBArray,X=h.__skinIndexArray,$=h.__skinWeightArray,Da=h.__morphTargetsArrays,ia=h.__webglCustomAttributes,x=void 0,fa=h.__faceArray,ha=h.__lineArray,na=h.__needsSmoothNormals,B=h.__vertexColorType,A=h.__uvType,z=h.__normalType,ja=k.geometry,ua=ja.__dirtyVertices,ta=ja.__dirtyElements,oa=ja.__dirtyUvs,qa=ja.__dirtyNormals,Aa=ja.__dirtyTangents,va=ja.__dirtyColors,ya=ja.__dirtyMorphTargets,
+ca=h.__uvArray,ea=h.__uv2Array,da=h.__normalArray,T=h.__tangentArray,Z=h.__colorArray,U=h.__skinVertexAArray,W=h.__skinVertexBArray,X=h.__skinIndexArray,$=h.__skinWeightArray,Da=h.__morphTargetsArrays,ia=h.__webglCustomAttributes,x=void 0,fa=h.__faceArray,ha=h.__lineArray,na=h.__needsSmoothNormals,B=h.__vertexColorType,A=h.__uvType,z=h.__normalType,ja=k.geometry,ua=ja.__dirtyVertices,oa=ja.__dirtyElements,qa=ja.__dirtyUvs,ra=ja.__dirtyNormals,Aa=ja.__dirtyTangents,va=ja.__dirtyColors,ya=ja.__dirtyMorphTargets,
xa=ja.vertices,Ba=h.faces,Za=ja.faces,Xa=ja.faceVertexUvs[0],Ya=ja.faceVertexUvs[1],Ka=ja.skinVerticesA,La=ja.skinVerticesB,Ma=ja.skinIndices,Fa=ja.skinWeights,Ia=k instanceof THREE.ShadowVolume?ja.edgeFaces:void 0,Ca=ja.morphTargets;if(ia)for(J in ia)ia[J].offset=0,ia[J].offsetSrc=0;n=0;for(t=Ba.length;n<t;n++)if(p=Ba[n],o=Za[p],Xa&&(H=Xa[p]),Ya&&(G=Ya[p]),p=o.vertexNormals,u=o.normal,v=o.vertexColors,w=o.color,y=o.vertexTangents,o instanceof THREE.Face3){if(ua)D=xa[o.a].position,Y=xa[o.b].position,
C=xa[o.c].position,S[L]=D.x,S[L+1]=D.y,S[L+2]=D.z,S[L+3]=Y.x,S[L+4]=Y.y,S[L+5]=Y.z,S[L+6]=C.x,S[L+7]=C.y,S[L+8]=C.z,L+=9;if(ia)for(J in ia)if(x=ia[J],x.__original.needsUpdate)E=x.offset,F=x.offsetSrc,x.size===1?(x.boundTo===void 0||x.boundTo==="vertices"?(x.array[E+0]=x.value[o.a],x.array[E+1]=x.value[o.b],x.array[E+2]=x.value[o.c]):x.boundTo==="faces"?(x.array[E+0]=x.value[F],x.array[E+1]=x.value[F],x.array[E+2]=x.value[F],x.offsetSrc++):x.boundTo==="faceVertices"&&(x.array[E+0]=x.value[F+0],x.array[E+
1]=x.value[F+1],x.array[E+2]=x.value[F+2],x.offsetSrc+=3),x.offset+=3):(x.boundTo===void 0||x.boundTo==="vertices"?(D=x.value[o.a],Y=x.value[o.b],C=x.value[o.c]):x.boundTo==="faces"?(D=x.value[F],Y=x.value[F],C=x.value[F],x.offsetSrc++):x.boundTo==="faceVertices"&&(D=x.value[F+0],Y=x.value[F+1],C=x.value[F+2],x.offsetSrc+=3),x.size===2?(x.array[E+0]=D.x,x.array[E+1]=D.y,x.array[E+2]=Y.x,x.array[E+3]=Y.y,x.array[E+4]=C.x,x.array[E+5]=C.y,x.offset+=6):x.size===3?(x.type==="c"?(x.array[E+0]=D.r,x.array[E+
1]=D.g,x.array[E+2]=D.b,x.array[E+3]=Y.r,x.array[E+4]=Y.g,x.array[E+5]=Y.b,x.array[E+6]=C.r,x.array[E+7]=C.g,x.array[E+8]=C.b):(x.array[E+0]=D.x,x.array[E+1]=D.y,x.array[E+2]=D.z,x.array[E+3]=Y.x,x.array[E+4]=Y.y,x.array[E+5]=Y.z,x.array[E+6]=C.x,x.array[E+7]=C.y,x.array[E+8]=C.z),x.offset+=9):(x.array[E+0]=D.x,x.array[E+1]=D.y,x.array[E+2]=D.z,x.array[E+3]=D.w,x.array[E+4]=Y.x,x.array[E+5]=Y.y,x.array[E+6]=Y.z,x.array[E+7]=Y.w,x.array[E+8]=C.x,x.array[E+9]=C.y,x.array[E+10]=C.z,x.array[E+11]=C.w,
x.offset+=12));if(ya){E=0;for(F=Ca.length;E<F;E++)D=Ca[E].vertices[o.a].position,Y=Ca[E].vertices[o.b].position,C=Ca[E].vertices[o.c].position,x=Da[E],x[R+0]=D.x,x[R+1]=D.y,x[R+2]=D.z,x[R+3]=Y.x,x[R+4]=Y.y,x[R+5]=Y.z,x[R+6]=C.x,x[R+7]=C.y,x[R+8]=C.z;R+=9}if(Fa.length)E=Fa[o.a],F=Fa[o.b],x=Fa[o.c],$[M]=E.x,$[M+1]=E.y,$[M+2]=E.z,$[M+3]=E.w,$[M+4]=F.x,$[M+5]=F.y,$[M+6]=F.z,$[M+7]=F.w,$[M+8]=x.x,$[M+9]=x.y,$[M+10]=x.z,$[M+11]=x.w,E=Ma[o.a],F=Ma[o.b],x=Ma[o.c],X[M]=E.x,X[M+1]=E.y,X[M+2]=E.z,X[M+3]=E.w,
X[M+4]=F.x,X[M+5]=F.y,X[M+6]=F.z,X[M+7]=F.w,X[M+8]=x.x,X[M+9]=x.y,X[M+10]=x.z,X[M+11]=x.w,E=Ka[o.a],F=Ka[o.b],x=Ka[o.c],U[M]=E.x,U[M+1]=E.y,U[M+2]=E.z,U[M+3]=1,U[M+4]=F.x,U[M+5]=F.y,U[M+6]=F.z,U[M+7]=1,U[M+8]=x.x,U[M+9]=x.y,U[M+10]=x.z,U[M+11]=1,E=La[o.a],F=La[o.b],x=La[o.c],W[M]=E.x,W[M+1]=E.y,W[M+2]=E.z,W[M+3]=1,W[M+4]=F.x,W[M+5]=F.y,W[M+6]=F.z,W[M+7]=1,W[M+8]=x.x,W[M+9]=x.y,W[M+10]=x.z,W[M+11]=1,M+=12;if(va&&B)v.length==3&&B==THREE.VertexColors?(o=v[0],E=v[1],F=v[2]):F=E=o=w,Z[Q]=o.r,Z[Q+1]=o.g,
-Z[Q+2]=o.b,Z[Q+3]=E.r,Z[Q+4]=E.g,Z[Q+5]=E.b,Z[Q+6]=F.r,Z[Q+7]=F.g,Z[Q+8]=F.b,Q+=9;if(Aa&&ja.hasTangents)v=y[0],w=y[1],o=y[2],T[ga]=v.x,T[ga+1]=v.y,T[ga+2]=v.z,T[ga+3]=v.w,T[ga+4]=w.x,T[ga+5]=w.y,T[ga+6]=w.z,T[ga+7]=w.w,T[ga+8]=o.x,T[ga+9]=o.y,T[ga+10]=o.z,T[ga+11]=o.w,ga+=12;if(qa&&z)if(p.length==3&&na)for(y=0;y<3;y++)u=p[y],da[O]=u.x,da[O+1]=u.y,da[O+2]=u.z,O+=3;else for(y=0;y<3;y++)da[O]=u.x,da[O+1]=u.y,da[O+2]=u.z,O+=3;if(oa&&H!==void 0&&A)for(y=0;y<3;y++)p=H[y],ca[N]=p.u,ca[N+1]=p.v,N+=2;if(oa&&
-G!==void 0&&A)for(y=0;y<3;y++)p=G[y],ea[P]=p.u,ea[P+1]=p.v,P+=2;ta&&(fa[la]=I,fa[la+1]=I+1,fa[la+2]=I+2,la+=3,ha[aa]=I,ha[aa+1]=I+1,ha[aa+2]=I,ha[aa+3]=I+2,ha[aa+4]=I+1,ha[aa+5]=I+2,aa+=6,I+=3)}else if(o instanceof THREE.Face4){if(ua)D=xa[o.a].position,Y=xa[o.b].position,C=xa[o.c].position,ka=xa[o.d].position,S[L]=D.x,S[L+1]=D.y,S[L+2]=D.z,S[L+3]=Y.x,S[L+4]=Y.y,S[L+5]=Y.z,S[L+6]=C.x,S[L+7]=C.y,S[L+8]=C.z,S[L+9]=ka.x,S[L+10]=ka.y,S[L+11]=ka.z,L+=12;if(ia)for(J in ia)if(x=ia[J],x.__original.needsUpdate)E=
+Z[Q+2]=o.b,Z[Q+3]=E.r,Z[Q+4]=E.g,Z[Q+5]=E.b,Z[Q+6]=F.r,Z[Q+7]=F.g,Z[Q+8]=F.b,Q+=9;if(Aa&&ja.hasTangents)v=y[0],w=y[1],o=y[2],T[ga]=v.x,T[ga+1]=v.y,T[ga+2]=v.z,T[ga+3]=v.w,T[ga+4]=w.x,T[ga+5]=w.y,T[ga+6]=w.z,T[ga+7]=w.w,T[ga+8]=o.x,T[ga+9]=o.y,T[ga+10]=o.z,T[ga+11]=o.w,ga+=12;if(ra&&z)if(p.length==3&&na)for(y=0;y<3;y++)u=p[y],da[O]=u.x,da[O+1]=u.y,da[O+2]=u.z,O+=3;else for(y=0;y<3;y++)da[O]=u.x,da[O+1]=u.y,da[O+2]=u.z,O+=3;if(qa&&H!==void 0&&A)for(y=0;y<3;y++)p=H[y],ca[N]=p.u,ca[N+1]=p.v,N+=2;if(qa&&
+G!==void 0&&A)for(y=0;y<3;y++)p=G[y],ea[P]=p.u,ea[P+1]=p.v,P+=2;oa&&(fa[la]=I,fa[la+1]=I+1,fa[la+2]=I+2,la+=3,ha[aa]=I,ha[aa+1]=I+1,ha[aa+2]=I,ha[aa+3]=I+2,ha[aa+4]=I+1,ha[aa+5]=I+2,aa+=6,I+=3)}else if(o instanceof THREE.Face4){if(ua)D=xa[o.a].position,Y=xa[o.b].position,C=xa[o.c].position,ka=xa[o.d].position,S[L]=D.x,S[L+1]=D.y,S[L+2]=D.z,S[L+3]=Y.x,S[L+4]=Y.y,S[L+5]=Y.z,S[L+6]=C.x,S[L+7]=C.y,S[L+8]=C.z,S[L+9]=ka.x,S[L+10]=ka.y,S[L+11]=ka.z,L+=12;if(ia)for(J in ia)if(x=ia[J],x.__original.needsUpdate)E=
x.offset,F=x.offsetSrc,x.size===1?(x.boundTo===void 0||x.boundTo==="vertices"?(x.array[E+0]=x.value[o.a],x.array[E+1]=x.value[o.b],x.array[E+2]=x.value[o.c],x.array[E+3]=x.value[o.d]):x.boundTo==="faces"?(x.array[E+0]=x.value[F],x.array[E+1]=x.value[F],x.array[E+2]=x.value[F],x.array[E+3]=x.value[F],x.offsetSrc++):x.boundTo==="faceVertices"&&(x.array[E+0]=x.value[F+0],x.array[E+1]=x.value[F+1],x.array[E+2]=x.value[F+2],x.array[E+3]=x.value[F+3],x.offsetSrc+=4),x.offset+=4):(x.boundTo===void 0||x.boundTo===
"vertices"?(D=x.value[o.a],Y=x.value[o.b],C=x.value[o.c],ka=x.value[o.d]):x.boundTo==="faces"?(D=x.value[F],Y=x.value[F],C=x.value[F],ka=x.value[F],x.offsetSrc++):x.boundTo==="faceVertices"&&(D=x.value[F+0],Y=x.value[F+1],C=x.value[F+2],ka=x.value[F+3],x.offsetSrc+=4),x.size===2?(x.array[E+0]=D.x,x.array[E+1]=D.y,x.array[E+2]=Y.x,x.array[E+3]=Y.y,x.array[E+4]=C.x,x.array[E+5]=C.y,x.array[E+6]=ka.x,x.array[E+7]=ka.y,x.offset+=8):x.size===3?(x.type==="c"?(x.array[E+0]=D.r,x.array[E+1]=D.g,x.array[E+
2]=D.b,x.array[E+3]=Y.r,x.array[E+4]=Y.g,x.array[E+5]=Y.b,x.array[E+6]=C.r,x.array[E+7]=C.g,x.array[E+8]=C.b,x.array[E+9]=ka.r,x.array[E+10]=ka.g,x.array[E+11]=ka.b):(x.array[E+0]=D.x,x.array[E+1]=D.y,x.array[E+2]=D.z,x.array[E+3]=Y.x,x.array[E+4]=Y.y,x.array[E+5]=Y.z,x.array[E+6]=C.x,x.array[E+7]=C.y,x.array[E+8]=C.z,x.array[E+9]=ka.x,x.array[E+10]=ka.y,x.array[E+11]=ka.z),x.offset+=12):(x.array[E+0]=D.x,x.array[E+1]=D.y,x.array[E+2]=D.z,x.array[E+3]=D.w,x.array[E+4]=Y.x,x.array[E+5]=Y.y,x.array[E+
6]=Y.z,x.array[E+7]=Y.w,x.array[E+8]=C.x,x.array[E+9]=C.y,x.array[E+10]=C.z,x.array[E+11]=C.w,x.array[E+12]=ka.x,x.array[E+13]=ka.y,x.array[E+14]=ka.z,x.array[E+15]=ka.w,x.offset+=16));if(ya){E=0;for(F=Ca.length;E<F;E++)D=Ca[E].vertices[o.a].position,Y=Ca[E].vertices[o.b].position,C=Ca[E].vertices[o.c].position,ka=Ca[E].vertices[o.d].position,x=Da[E],x[R+0]=D.x,x[R+1]=D.y,x[R+2]=D.z,x[R+3]=Y.x,x[R+4]=Y.y,x[R+5]=Y.z,x[R+6]=C.x,x[R+7]=C.y,x[R+8]=C.z,x[R+9]=ka.x,x[R+10]=ka.y,x[R+11]=ka.z;R+=12}if(Fa.length)E=
Fa[o.a],F=Fa[o.b],x=Fa[o.c],K=Fa[o.d],$[M]=E.x,$[M+1]=E.y,$[M+2]=E.z,$[M+3]=E.w,$[M+4]=F.x,$[M+5]=F.y,$[M+6]=F.z,$[M+7]=F.w,$[M+8]=x.x,$[M+9]=x.y,$[M+10]=x.z,$[M+11]=x.w,$[M+12]=K.x,$[M+13]=K.y,$[M+14]=K.z,$[M+15]=K.w,E=Ma[o.a],F=Ma[o.b],x=Ma[o.c],K=Ma[o.d],X[M]=E.x,X[M+1]=E.y,X[M+2]=E.z,X[M+3]=E.w,X[M+4]=F.x,X[M+5]=F.y,X[M+6]=F.z,X[M+7]=F.w,X[M+8]=x.x,X[M+9]=x.y,X[M+10]=x.z,X[M+11]=x.w,X[M+12]=K.x,X[M+13]=K.y,X[M+14]=K.z,X[M+15]=K.w,E=Ka[o.a],F=Ka[o.b],x=Ka[o.c],K=Ka[o.d],U[M]=E.x,U[M+1]=E.y,U[M+
2]=E.z,U[M+3]=1,U[M+4]=F.x,U[M+5]=F.y,U[M+6]=F.z,U[M+7]=1,U[M+8]=x.x,U[M+9]=x.y,U[M+10]=x.z,U[M+11]=1,U[M+12]=K.x,U[M+13]=K.y,U[M+14]=K.z,U[M+15]=1,E=La[o.a],F=La[o.b],x=La[o.c],o=La[o.d],W[M]=E.x,W[M+1]=E.y,W[M+2]=E.z,W[M+3]=1,W[M+4]=F.x,W[M+5]=F.y,W[M+6]=F.z,W[M+7]=1,W[M+8]=x.x,W[M+9]=x.y,W[M+10]=x.z,W[M+11]=1,W[M+12]=o.x,W[M+13]=o.y,W[M+14]=o.z,W[M+15]=1,M+=16;if(va&&B)v.length==4&&B==THREE.VertexColors?(o=v[0],E=v[1],F=v[2],v=v[3]):v=F=E=o=w,Z[Q]=o.r,Z[Q+1]=o.g,Z[Q+2]=o.b,Z[Q+3]=E.r,Z[Q+4]=E.g,
-Z[Q+5]=E.b,Z[Q+6]=F.r,Z[Q+7]=F.g,Z[Q+8]=F.b,Z[Q+9]=v.r,Z[Q+10]=v.g,Z[Q+11]=v.b,Q+=12;if(Aa&&ja.hasTangents)v=y[0],w=y[1],o=y[2],y=y[3],T[ga]=v.x,T[ga+1]=v.y,T[ga+2]=v.z,T[ga+3]=v.w,T[ga+4]=w.x,T[ga+5]=w.y,T[ga+6]=w.z,T[ga+7]=w.w,T[ga+8]=o.x,T[ga+9]=o.y,T[ga+10]=o.z,T[ga+11]=o.w,T[ga+12]=y.x,T[ga+13]=y.y,T[ga+14]=y.z,T[ga+15]=y.w,ga+=16;if(qa&&z)if(p.length==4&&na)for(y=0;y<4;y++)u=p[y],da[O]=u.x,da[O+1]=u.y,da[O+2]=u.z,O+=3;else for(y=0;y<4;y++)da[O]=u.x,da[O+1]=u.y,da[O+2]=u.z,O+=3;if(oa&&H!==void 0&&
-A)for(y=0;y<4;y++)p=H[y],ca[N]=p.u,ca[N+1]=p.v,N+=2;if(oa&&G!==void 0&&A)for(y=0;y<4;y++)p=G[y],ea[P]=p.u,ea[P+1]=p.v,P+=2;ta&&(fa[la]=I,fa[la+1]=I+1,fa[la+2]=I+3,fa[la+3]=I+1,fa[la+4]=I+2,fa[la+5]=I+3,la+=6,ha[aa]=I,ha[aa+1]=I+1,ha[aa+2]=I,ha[aa+3]=I+3,ha[aa+4]=I+1,ha[aa+5]=I+2,ha[aa+6]=I+2,ha[aa+7]=I+3,aa+=8,I+=4)}if(Ia){n=0;for(t=Ia.length;n<t;n++)fa[la]=Ia[n].a,fa[la+1]=Ia[n].b,fa[la+2]=Ia[n].c,fa[la+3]=Ia[n].a,fa[la+4]=Ia[n].c,fa[la+5]=Ia[n].d,la+=6}ua&&(j.bindBuffer(j.ARRAY_BUFFER,h.__webglVertexBuffer),
-j.bufferData(j.ARRAY_BUFFER,S,m));if(ia)for(J in ia)x=ia[J],x.__original.needsUpdate&&(j.bindBuffer(j.ARRAY_BUFFER,x.buffer),j.bufferData(j.ARRAY_BUFFER,x.array,m));if(ya){E=0;for(F=Ca.length;E<F;E++)j.bindBuffer(j.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[E]),j.bufferData(j.ARRAY_BUFFER,Da[E],m)}va&&Q>0&&(j.bindBuffer(j.ARRAY_BUFFER,h.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,Z,m));qa&&(j.bindBuffer(j.ARRAY_BUFFER,h.__webglNormalBuffer),j.bufferData(j.ARRAY_BUFFER,da,m));Aa&&ja.hasTangents&&
-(j.bindBuffer(j.ARRAY_BUFFER,h.__webglTangentBuffer),j.bufferData(j.ARRAY_BUFFER,T,m));oa&&N>0&&(j.bindBuffer(j.ARRAY_BUFFER,h.__webglUVBuffer),j.bufferData(j.ARRAY_BUFFER,ca,m));oa&&P>0&&(j.bindBuffer(j.ARRAY_BUFFER,h.__webglUV2Buffer),j.bufferData(j.ARRAY_BUFFER,ea,m));ta&&(j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),j.bufferData(j.ELEMENT_ARRAY_BUFFER,fa,m),j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer),j.bufferData(j.ELEMENT_ARRAY_BUFFER,ha,m));M>0&&(j.bindBuffer(j.ARRAY_BUFFER,
+Z[Q+5]=E.b,Z[Q+6]=F.r,Z[Q+7]=F.g,Z[Q+8]=F.b,Z[Q+9]=v.r,Z[Q+10]=v.g,Z[Q+11]=v.b,Q+=12;if(Aa&&ja.hasTangents)v=y[0],w=y[1],o=y[2],y=y[3],T[ga]=v.x,T[ga+1]=v.y,T[ga+2]=v.z,T[ga+3]=v.w,T[ga+4]=w.x,T[ga+5]=w.y,T[ga+6]=w.z,T[ga+7]=w.w,T[ga+8]=o.x,T[ga+9]=o.y,T[ga+10]=o.z,T[ga+11]=o.w,T[ga+12]=y.x,T[ga+13]=y.y,T[ga+14]=y.z,T[ga+15]=y.w,ga+=16;if(ra&&z)if(p.length==4&&na)for(y=0;y<4;y++)u=p[y],da[O]=u.x,da[O+1]=u.y,da[O+2]=u.z,O+=3;else for(y=0;y<4;y++)da[O]=u.x,da[O+1]=u.y,da[O+2]=u.z,O+=3;if(qa&&H!==void 0&&
+A)for(y=0;y<4;y++)p=H[y],ca[N]=p.u,ca[N+1]=p.v,N+=2;if(qa&&G!==void 0&&A)for(y=0;y<4;y++)p=G[y],ea[P]=p.u,ea[P+1]=p.v,P+=2;oa&&(fa[la]=I,fa[la+1]=I+1,fa[la+2]=I+3,fa[la+3]=I+1,fa[la+4]=I+2,fa[la+5]=I+3,la+=6,ha[aa]=I,ha[aa+1]=I+1,ha[aa+2]=I,ha[aa+3]=I+3,ha[aa+4]=I+1,ha[aa+5]=I+2,ha[aa+6]=I+2,ha[aa+7]=I+3,aa+=8,I+=4)}if(Ia){n=0;for(t=Ia.length;n<t;n++)fa[la]=Ia[n].a,fa[la+1]=Ia[n].b,fa[la+2]=Ia[n].c,fa[la+3]=Ia[n].a,fa[la+4]=Ia[n].c,fa[la+5]=Ia[n].d,la+=6}ua&&(j.bindBuffer(j.ARRAY_BUFFER,h.__webglVertexBuffer),
+j.bufferData(j.ARRAY_BUFFER,S,m));if(ia)for(J in ia)x=ia[J],x.__original.needsUpdate&&(j.bindBuffer(j.ARRAY_BUFFER,x.buffer),j.bufferData(j.ARRAY_BUFFER,x.array,m));if(ya){E=0;for(F=Ca.length;E<F;E++)j.bindBuffer(j.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[E]),j.bufferData(j.ARRAY_BUFFER,Da[E],m)}va&&Q>0&&(j.bindBuffer(j.ARRAY_BUFFER,h.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,Z,m));ra&&(j.bindBuffer(j.ARRAY_BUFFER,h.__webglNormalBuffer),j.bufferData(j.ARRAY_BUFFER,da,m));Aa&&ja.hasTangents&&
+(j.bindBuffer(j.ARRAY_BUFFER,h.__webglTangentBuffer),j.bufferData(j.ARRAY_BUFFER,T,m));qa&&N>0&&(j.bindBuffer(j.ARRAY_BUFFER,h.__webglUVBuffer),j.bufferData(j.ARRAY_BUFFER,ca,m));qa&&P>0&&(j.bindBuffer(j.ARRAY_BUFFER,h.__webglUV2Buffer),j.bufferData(j.ARRAY_BUFFER,ea,m));oa&&(j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),j.bufferData(j.ELEMENT_ARRAY_BUFFER,fa,m),j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer),j.bufferData(j.ELEMENT_ARRAY_BUFFER,ha,m));M>0&&(j.bindBuffer(j.ARRAY_BUFFER,
h.__webglSkinVertexABuffer),j.bufferData(j.ARRAY_BUFFER,U,m),j.bindBuffer(j.ARRAY_BUFFER,h.__webglSkinVertexBBuffer),j.bufferData(j.ARRAY_BUFFER,W,m),j.bindBuffer(j.ARRAY_BUFFER,h.__webglSkinIndicesBuffer),j.bufferData(j.ARRAY_BUFFER,X,m),j.bindBuffer(j.ARRAY_BUFFER,h.__webglSkinWeightsBuffer),j.bufferData(j.ARRAY_BUFFER,$,m));k.dynamic||(delete h.__inittedArrays,delete h.__colorArray,delete h.__normalArray,delete h.__tangentArray,delete h.__uvArray,delete h.__uv2Array,delete h.__faceArray,delete h.__vertexArray,
-delete h.__lineArray,delete h.__skinVertexAArray,delete h.__skinVertexBArray,delete h.__skinIndexArray,delete h.__skinWeightArray)}}f.__dirtyVertices=!1;f.__dirtyMorphTargets=!1;f.__dirtyElements=!1;f.__dirtyUvs=!1;f.__dirtyNormals=!1;f.__dirtyTangents=!1;f.__dirtyColors=!1;var sa;g=g.__materials;f=0;for(b=g.length;f<b;f++)if(e=g[f],e.attributes)for(sa in e.attributes)e.attributes[sa].needsUpdate=!1}else if(b instanceof THREE.Ribbon){f=b.geometry;if(f.__dirtyVertices||f.__dirtyColors){sa=f;b=j.DYNAMIC_DRAW;
-t=sa.vertices;g=sa.colors;A=t.length;h=g.length;B=sa.__vertexArray;k=sa.__colorArray;z=sa.__dirtyColors;if(sa.__dirtyVertices){for(m=0;m<A;m++)n=t[m].position,e=m*3,B[e]=n.x,B[e+1]=n.y,B[e+2]=n.z;j.bindBuffer(j.ARRAY_BUFFER,sa.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,B,b)}if(z){for(m=0;m<h;m++)color=g[m],e=m*3,k[e]=color.r,k[e+1]=color.g,k[e+2]=color.b;j.bindBuffer(j.ARRAY_BUFFER,sa.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,k,b)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(b instanceof
-THREE.Line){f=b.geometry;if(f.__dirtyVertices||f.__dirtyColors){sa=f;b=j.DYNAMIC_DRAW;t=sa.vertices;g=sa.colors;A=t.length;h=g.length;B=sa.__vertexArray;k=sa.__colorArray;z=sa.__dirtyColors;if(sa.__dirtyVertices){for(m=0;m<A;m++)n=t[m].position,e=m*3,B[e]=n.x,B[e+1]=n.y,B[e+2]=n.z;j.bindBuffer(j.ARRAY_BUFFER,sa.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,B,b)}if(z){for(m=0;m<h;m++)color=g[m],e=m*3,k[e]=color.r,k[e+1]=color.g,k[e+2]=color.b;j.bindBuffer(j.ARRAY_BUFFER,sa.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,
-k,b)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(b instanceof THREE.ParticleSystem)f=b.geometry,(f.__dirtyVertices||f.__dirtyColors||b.sortParticles)&&c(f,j.DYNAMIC_DRAW,b),f.__dirtyVertices=!1,f.__dirtyColors=!1}function z(b,e){var c;for(c=b.length-1;c>=0;c--)b[c].object==e&&b.splice(c,1)}function C(b){function e(b){var h=[];c=0;for(f=b.length;c<f;c++)b[c]==void 0?h.push("undefined"):h.push(b[c].id);return h.join("_")}var c,f,h,g,j,k,m,o,n={},t=b.morphTargets!==void 0?b.morphTargets.length:
-0;b.geometryGroups={};h=0;for(g=b.faces.length;h<g;h++)j=b.faces[h],k=j.materials,m=e(k),n[m]==void 0&&(n[m]={hash:m,counter:0}),o=n[m].hash+"_"+n[m].counter,b.geometryGroups[o]==void 0&&(b.geometryGroups[o]={faces:[],materials:k,vertices:0,numMorphTargets:t}),j=j instanceof THREE.Face3?3:4,b.geometryGroups[o].vertices+j>65535&&(n[m].counter+=1,o=n[m].hash+"_"+n[m].counter,b.geometryGroups[o]==void 0&&(b.geometryGroups[o]={faces:[],materials:k,vertices:0,numMorphTargets:t})),b.geometryGroups[o].faces.push(h),
+delete h.__lineArray,delete h.__skinVertexAArray,delete h.__skinVertexBArray,delete h.__skinIndexArray,delete h.__skinWeightArray)}}f.__dirtyVertices=!1;f.__dirtyMorphTargets=!1;f.__dirtyElements=!1;f.__dirtyUvs=!1;f.__dirtyNormals=!1;f.__dirtyTangents=!1;f.__dirtyColors=!1;var ta;g=g.__materials;f=0;for(b=g.length;f<b;f++)if(e=g[f],e.attributes)for(ta in e.attributes)e.attributes[ta].needsUpdate=!1}else if(b instanceof THREE.Ribbon){f=b.geometry;if(f.__dirtyVertices||f.__dirtyColors){ta=f;b=j.DYNAMIC_DRAW;
+t=ta.vertices;g=ta.colors;A=t.length;h=g.length;B=ta.__vertexArray;k=ta.__colorArray;z=ta.__dirtyColors;if(ta.__dirtyVertices){for(m=0;m<A;m++)n=t[m].position,e=m*3,B[e]=n.x,B[e+1]=n.y,B[e+2]=n.z;j.bindBuffer(j.ARRAY_BUFFER,ta.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,B,b)}if(z){for(m=0;m<h;m++)color=g[m],e=m*3,k[e]=color.r,k[e+1]=color.g,k[e+2]=color.b;j.bindBuffer(j.ARRAY_BUFFER,ta.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,k,b)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(b instanceof
+THREE.Line){f=b.geometry;if(f.__dirtyVertices||f.__dirtyColors){ta=f;b=j.DYNAMIC_DRAW;t=ta.vertices;g=ta.colors;A=t.length;h=g.length;B=ta.__vertexArray;k=ta.__colorArray;z=ta.__dirtyColors;if(ta.__dirtyVertices){for(m=0;m<A;m++)n=t[m].position,e=m*3,B[e]=n.x,B[e+1]=n.y,B[e+2]=n.z;j.bindBuffer(j.ARRAY_BUFFER,ta.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,B,b)}if(z){for(m=0;m<h;m++)color=g[m],e=m*3,k[e]=color.r,k[e+1]=color.g,k[e+2]=color.b;j.bindBuffer(j.ARRAY_BUFFER,ta.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,
+k,b)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(b instanceof THREE.ParticleSystem)f=b.geometry,(f.__dirtyVertices||f.__dirtyColors||b.sortParticles)&&c(f,j.DYNAMIC_DRAW,b),f.__dirtyVertices=!1,f.__dirtyColors=!1}function z(b,e){var c;for(c=b.length-1;c>=0;c--)b[c].object==e&&b.splice(c,1)}function C(b){function e(b){var h=[];c=0;for(f=b.length;c<f;c++)b[c]==void 0?h.push("undefined"):h.push(b[c].id);return h.join("_")}var c,f,h,g,j,k,m,o,n={},p=b.morphTargets!==void 0?b.morphTargets.length:
+0;b.geometryGroups={};h=0;for(g=b.faces.length;h<g;h++)j=b.faces[h],k=j.materials,m=e(k),n[m]==void 0&&(n[m]={hash:m,counter:0}),o=n[m].hash+"_"+n[m].counter,b.geometryGroups[o]==void 0&&(b.geometryGroups[o]={faces:[],materials:k,vertices:0,numMorphTargets:p}),j=j instanceof THREE.Face3?3:4,b.geometryGroups[o].vertices+j>65535&&(n[m].counter+=1,o=n[m].hash+"_"+n[m].counter,b.geometryGroups[o]==void 0&&(b.geometryGroups[o]={faces:[],materials:k,vertices:0,numMorphTargets:p})),b.geometryGroups[o].faces.push(h),
b.geometryGroups[o].vertices+=j}function H(b,e,c){b.push({buffer:e,object:c,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function D(b){if(b!=aa){switch(b){case THREE.AdditiveBlending:j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,j.ONE);break;case THREE.SubtractiveBlending:j.blendEquation(j.FUNC_ADD);j.blendFunc(j.ZERO,j.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:j.blendEquation(j.FUNC_ADD);j.blendFunc(j.ZERO,j.SRC_COLOR);break;default:j.blendEquationSeparate(j.FUNC_ADD,
j.FUNC_ADD),j.blendFuncSeparate(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA,j.ONE,j.ONE_MINUS_SRC_ALPHA)}aa=b}}function Q(b,e,c){(c.width&c.width-1)==0&&(c.height&c.height-1)==0?(j.texParameteri(b,j.TEXTURE_WRAP_S,K(e.wrapS)),j.texParameteri(b,j.TEXTURE_WRAP_T,K(e.wrapT)),j.texParameteri(b,j.TEXTURE_MAG_FILTER,K(e.magFilter)),j.texParameteri(b,j.TEXTURE_MIN_FILTER,K(e.minFilter)),j.generateMipmap(b)):(j.texParameteri(b,j.TEXTURE_WRAP_S,j.CLAMP_TO_EDGE),j.texParameteri(b,j.TEXTURE_WRAP_T,j.CLAMP_TO_EDGE),j.texParameteri(b,
j.TEXTURE_MAG_FILTER,S(e.magFilter)),j.texParameteri(b,j.TEXTURE_MIN_FILTER,S(e.minFilter)))}function J(b,e){if(b.needsUpdate)b.__webglInit?(j.bindTexture(j.TEXTURE_2D,b.__webglTexture),j.texImage2D(j.TEXTURE_2D,0,j.RGBA,j.RGBA,j.UNSIGNED_BYTE,b.image)):(b.__webglTexture=j.createTexture(),j.bindTexture(j.TEXTURE_2D,b.__webglTexture),j.texImage2D(j.TEXTURE_2D,0,j.RGBA,j.RGBA,j.UNSIGNED_BYTE,b.image),b.__webglInit=!0),Q(j.TEXTURE_2D,b,b.image),j.bindTexture(j.TEXTURE_2D,null),b.needsUpdate=!1;j.activeTexture(j.TEXTURE0+
@@ -290,8 +290,8 @@ c=W,b=U);e!=Z&&(j.bindFramebuffer(j.FRAMEBUFFER,e),j.viewport(L,fa,c,b),Z=e)}fun
function K(b){switch(b){case THREE.RepeatWrapping:return j.REPEAT;case THREE.ClampToEdgeWrapping:return j.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return j.MIRRORED_REPEAT;case THREE.NearestFilter:return j.NEAREST;case THREE.NearestMipMapNearestFilter:return j.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return j.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return j.LINEAR;case THREE.LinearMipMapNearestFilter:return j.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return j.LINEAR_MIPMAP_LINEAR;
case THREE.ByteType:return j.BYTE;case THREE.UnsignedByteType:return j.UNSIGNED_BYTE;case THREE.ShortType:return j.SHORT;case THREE.UnsignedShortType:return j.UNSIGNED_SHORT;case THREE.IntType:return j.INT;case THREE.UnsignedShortType:return j.UNSIGNED_INT;case THREE.FloatType:return j.FLOAT;case THREE.AlphaFormat:return j.ALPHA;case THREE.RGBFormat:return j.RGB;case THREE.RGBAFormat:return j.RGBA;case THREE.LuminanceFormat:return j.LUMINANCE;case THREE.LuminanceAlphaFormat:return j.LUMINANCE_ALPHA}return 0}
var ea=this,j,ca=[],T=null,Z=null,N=!0,da=null,X=null,aa=null,ia=null,ha=null,na=null,ja=null,L=0,fa=0,W=0,U=0,$=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Y=new THREE.Matrix4,ka=new Float32Array(16),la=new Float32Array(16),ga=new THREE.Vector4,Da={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},ua=b.canvas!==void 0?b.canvas:document.createElement("canvas"),
-Aa=b.stencil!==void 0?b.stencil:!0,xa=b.antialias!==void 0?b.antialias:!1,ta=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),ya=b.clearAlpha!==void 0?b.clearAlpha:0;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=ua;this.sortObjects=this.autoClear=!0;try{if(!(j=ua.getContext("experimental-webgl",{antialias:xa,stencil:Aa})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+j.getParameter(j.VERSION)+" | "+j.getParameter(j.VENDOR)+
-" | "+j.getParameter(j.RENDERER)+" | "+j.getParameter(j.SHADING_LANGUAGE_VERSION))}catch(va){console.error(va)}j.clearColor(0,0,0,1);j.clearDepth(1);j.enable(j.DEPTH_TEST);j.depthFunc(j.LEQUAL);j.frontFace(j.CCW);j.cullFace(j.BACK);j.enable(j.CULL_FACE);j.enable(j.BLEND);j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA);j.clearColor(ta.r,ta.g,ta.b,ya);this.context=j;var qa=j.getParameter(j.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;if(Aa){var R={};R.vertices=new Float32Array(12);R.faces=
+Aa=b.stencil!==void 0?b.stencil:!0,xa=b.antialias!==void 0?b.antialias:!1,qa=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),ya=b.clearAlpha!==void 0?b.clearAlpha:0;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=ua;this.sortObjects=this.autoClear=!0;try{if(!(j=ua.getContext("experimental-webgl",{antialias:xa,stencil:Aa})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+j.getParameter(j.VERSION)+" | "+j.getParameter(j.VENDOR)+
+" | "+j.getParameter(j.RENDERER)+" | "+j.getParameter(j.SHADING_LANGUAGE_VERSION))}catch(va){console.error(va)}j.clearColor(0,0,0,1);j.clearDepth(1);j.enable(j.DEPTH_TEST);j.depthFunc(j.LEQUAL);j.frontFace(j.CCW);j.cullFace(j.BACK);j.enable(j.CULL_FACE);j.enable(j.BLEND);j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA);j.clearColor(qa.r,qa.g,qa.b,ya);this.context=j;var oa=j.getParameter(j.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;if(Aa){var R={};R.vertices=new Float32Array(12);R.faces=
new Uint16Array(6);R.darkness=0.5;R.vertices[0]=-20;R.vertices[1]=-20;R.vertices[2]=-1;R.vertices[3]=20;R.vertices[4]=-20;R.vertices[5]=-1;R.vertices[6]=20;R.vertices[7]=20;R.vertices[8]=-1;R.vertices[9]=-20;R.vertices[10]=20;R.vertices[11]=-1;R.faces[0]=0;R.faces[1]=1;R.faces[2]=2;R.faces[3]=0;R.faces[4]=2;R.faces[5]=3;R.vertexBuffer=j.createBuffer();R.elementBuffer=j.createBuffer();j.bindBuffer(j.ARRAY_BUFFER,R.vertexBuffer);j.bufferData(j.ARRAY_BUFFER,R.vertices,j.STATIC_DRAW);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,
R.elementBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,R.faces,j.STATIC_DRAW);R.program=j.createProgram();j.attachShader(R.program,I("fragment",THREE.ShaderLib.shadowPost.fragmentShader));j.attachShader(R.program,I("vertex",THREE.ShaderLib.shadowPost.vertexShader));j.linkProgram(R.program);R.vertexLocation=j.getAttribLocation(R.program,"position");R.projectionLocation=j.getUniformLocation(R.program,"projectionMatrix");R.darknessLocation=j.getUniformLocation(R.program,"darkness")}var O={};O.vertices=
new Float32Array(16);O.faces=new Uint16Array(6);b=0;O.vertices[b++]=-1;O.vertices[b++]=-1;O.vertices[b++]=0;O.vertices[b++]=0;O.vertices[b++]=1;O.vertices[b++]=-1;O.vertices[b++]=1;O.vertices[b++]=0;O.vertices[b++]=1;O.vertices[b++]=1;O.vertices[b++]=1;O.vertices[b++]=1;O.vertices[b++]=-1;O.vertices[b++]=1;O.vertices[b++]=0;O.vertices[b++]=1;b=0;O.faces[b++]=0;O.faces[b++]=1;O.faces[b++]=2;O.faces[b++]=0;O.faces[b++]=2;O.faces[b++]=3;O.vertexBuffer=j.createBuffer();O.elementBuffer=j.createBuffer();
@@ -299,21 +299,21 @@ O.tempTexture=j.createTexture();O.occlusionTexture=j.createTexture();j.bindBuffe
j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MAG_FILTER,j.NEAREST);j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MIN_FILTER,j.NEAREST);j.bindTexture(j.TEXTURE_2D,O.occlusionTexture);j.texImage2D(j.TEXTURE_2D,0,j.RGBA,16,16,0,j.RGBA,j.UNSIGNED_BYTE,null);j.texParameteri(j.TEXTURE_2D,j.TEXTURE_WRAP_S,j.CLAMP_TO_EDGE);j.texParameteri(j.TEXTURE_2D,j.TEXTURE_WRAP_T,j.CLAMP_TO_EDGE);j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MAG_FILTER,j.NEAREST);j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MIN_FILTER,j.NEAREST);j.getParameter(j.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=
0?(O.hasVertexTexture=!1,O.program=j.createProgram(),j.attachShader(O.program,I("fragment",THREE.ShaderLib.lensFlare.fragmentShader)),j.attachShader(O.program,I("vertex",THREE.ShaderLib.lensFlare.vertexShader))):(O.hasVertexTexture=!0,O.program=j.createProgram(),j.attachShader(O.program,I("fragment",THREE.ShaderLib.lensFlareVertexTexture.fragmentShader)),j.attachShader(O.program,I("vertex",THREE.ShaderLib.lensFlareVertexTexture.vertexShader)));j.linkProgram(O.program);O.attributes={};O.uniforms={};
O.attributes.vertex=j.getAttribLocation(O.program,"position");O.attributes.uv=j.getAttribLocation(O.program,"UV");O.uniforms.renderType=j.getUniformLocation(O.program,"renderType");O.uniforms.map=j.getUniformLocation(O.program,"map");O.uniforms.occlusionMap=j.getUniformLocation(O.program,"occlusionMap");O.uniforms.opacity=j.getUniformLocation(O.program,"opacity");O.uniforms.scale=j.getUniformLocation(O.program,"scale");O.uniforms.rotation=j.getUniformLocation(O.program,"rotation");O.uniforms.screenPosition=
-j.getUniformLocation(O.program,"screenPosition");var oa=!1,P={};P.vertices=new Float32Array(16);P.faces=new Uint16Array(6);b=0;P.vertices[b++]=-1;P.vertices[b++]=-1;P.vertices[b++]=0;P.vertices[b++]=1;P.vertices[b++]=1;P.vertices[b++]=-1;P.vertices[b++]=1;P.vertices[b++]=1;P.vertices[b++]=1;P.vertices[b++]=1;P.vertices[b++]=1;P.vertices[b++]=0;P.vertices[b++]=-1;P.vertices[b++]=1;P.vertices[b++]=0;b=P.vertices[b++]=0;P.faces[b++]=0;P.faces[b++]=1;P.faces[b++]=2;P.faces[b++]=0;P.faces[b++]=2;P.faces[b++]=
+j.getUniformLocation(O.program,"screenPosition");var ra=!1,P={};P.vertices=new Float32Array(16);P.faces=new Uint16Array(6);b=0;P.vertices[b++]=-1;P.vertices[b++]=-1;P.vertices[b++]=0;P.vertices[b++]=1;P.vertices[b++]=1;P.vertices[b++]=-1;P.vertices[b++]=1;P.vertices[b++]=1;P.vertices[b++]=1;P.vertices[b++]=1;P.vertices[b++]=1;P.vertices[b++]=0;P.vertices[b++]=-1;P.vertices[b++]=1;P.vertices[b++]=0;b=P.vertices[b++]=0;P.faces[b++]=0;P.faces[b++]=1;P.faces[b++]=2;P.faces[b++]=0;P.faces[b++]=2;P.faces[b++]=
3;P.vertexBuffer=j.createBuffer();P.elementBuffer=j.createBuffer();j.bindBuffer(j.ARRAY_BUFFER,P.vertexBuffer);j.bufferData(j.ARRAY_BUFFER,P.vertices,j.STATIC_DRAW);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,P.elementBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,P.faces,j.STATIC_DRAW);P.program=j.createProgram();j.attachShader(P.program,I("fragment",THREE.ShaderLib.sprite.fragmentShader));j.attachShader(P.program,I("vertex",THREE.ShaderLib.sprite.vertexShader));j.linkProgram(P.program);P.attributes={};P.uniforms=
{};P.attributes.position=j.getAttribLocation(P.program,"position");P.attributes.uv=j.getAttribLocation(P.program,"uv");P.uniforms.uvOffset=j.getUniformLocation(P.program,"uvOffset");P.uniforms.uvScale=j.getUniformLocation(P.program,"uvScale");P.uniforms.rotation=j.getUniformLocation(P.program,"rotation");P.uniforms.scale=j.getUniformLocation(P.program,"scale");P.uniforms.alignment=j.getUniformLocation(P.program,"alignment");P.uniforms.map=j.getUniformLocation(P.program,"map");P.uniforms.opacity=j.getUniformLocation(P.program,
"opacity");P.uniforms.useScreenCoordinates=j.getUniformLocation(P.program,"useScreenCoordinates");P.uniforms.affectedByDistance=j.getUniformLocation(P.program,"affectedByDistance");P.uniforms.screenPosition=j.getUniformLocation(P.program,"screenPosition");P.uniforms.modelViewMatrix=j.getUniformLocation(P.program,"modelViewMatrix");P.uniforms.projectionMatrix=j.getUniformLocation(P.program,"projectionMatrix");var Ba=!1;this.setSize=function(b,e){ua.width=b;ua.height=e;this.setViewport(0,0,ua.width,
-ua.height)};this.setViewport=function(b,e,c,f){L=b;fa=e;W=c;U=f;j.viewport(L,fa,W,U)};this.setScissor=function(b,e,c,f){j.scissor(b,e,c,f)};this.enableScissorTest=function(b){b?j.enable(j.SCISSOR_TEST):j.disable(j.SCISSOR_TEST)};this.enableDepthBufferWrite=function(b){N=b;j.depthMask(b)};this.setClearColorHex=function(b,e){ta.setHex(b);ya=e;j.clearColor(ta.r,ta.g,ta.b,ya)};this.setClearColor=function(b,e){ta.copy(b);ya=e;j.clearColor(ta.r,ta.g,ta.b,ya)};this.clear=function(){j.clear(j.COLOR_BUFFER_BIT|
+ua.height)};this.setViewport=function(b,e,c,f){L=b;fa=e;W=c;U=f;j.viewport(L,fa,W,U)};this.setScissor=function(b,e,c,f){j.scissor(b,e,c,f)};this.enableScissorTest=function(b){b?j.enable(j.SCISSOR_TEST):j.disable(j.SCISSOR_TEST)};this.enableDepthBufferWrite=function(b){N=b;j.depthMask(b)};this.setClearColorHex=function(b,e){qa.setHex(b);ya=e;j.clearColor(qa.r,qa.g,qa.b,ya)};this.setClearColor=function(b,e){qa.copy(b);ya=e;j.clearColor(qa.r,qa.g,qa.b,ya)};this.clear=function(){j.clear(j.COLOR_BUFFER_BIT|
j.DEPTH_BUFFER_BIT|j.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(b){R.darkness=b};this.getContext=function(){return j};this.initMaterial=function(b,e,c,f){var h,g,k;b instanceof THREE.MeshDepthMaterial?k="depth":b instanceof THREE.ShadowVolumeDynamicMaterial?k="shadowVolumeDynamic":b instanceof THREE.MeshNormalMaterial?k="normal":b instanceof THREE.MeshBasicMaterial?k="basic":b instanceof THREE.MeshLambertMaterial?k="lambert":b instanceof THREE.MeshPhongMaterial?k="phong":b instanceof
-THREE.LineBasicMaterial?k="basic":b instanceof THREE.ParticleBasicMaterial&&(k="particle_basic");if(k){var m=THREE.ShaderLib[k];b.uniforms=THREE.UniformsUtils.clone(m.uniforms);b.vertexShader=m.vertexShader;b.fragmentShader=m.fragmentShader}var o,n,t;o=t=m=0;for(n=e.length;o<n;o++)g=e[o],g instanceof THREE.DirectionalLight&&t++,g instanceof THREE.PointLight&&m++;m+t<=4?e=t:(e=Math.ceil(4*t/(m+t)),m=4-e);g={directional:e,point:m};t=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)t=f.bones.length;
-var p;a:{o=b.fragmentShader;n=b.vertexShader;var m=b.uniforms,e=b.attributes,c={map:!!b.map,envMap:!!b.envMap,lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:c,sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:g.directional,maxPointLights:g.point,maxBones:t},u;g=[];k?g.push(k):(g.push(o),g.push(n));for(u in c)g.push(u),g.push(c[u]);k=g.join();u=0;for(g=ca.length;u<g;u++)if(ca[u].code==k){p=ca[u].program;break a}u=
-j.createProgram();g=[qa?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#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.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");
-t=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,c.fog?"#define USE_FOG":"",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":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");j.attachShader(u,I("fragment",t+o));j.attachShader(u,I("vertex",g+n));j.linkProgram(u);
+THREE.LineBasicMaterial?k="basic":b instanceof THREE.ParticleBasicMaterial&&(k="particle_basic");if(k){var m=THREE.ShaderLib[k];b.uniforms=THREE.UniformsUtils.clone(m.uniforms);b.vertexShader=m.vertexShader;b.fragmentShader=m.fragmentShader}var o,n,p;o=p=m=0;for(n=e.length;o<n;o++)g=e[o],g instanceof THREE.DirectionalLight&&p++,g instanceof THREE.PointLight&&m++;m+p<=4?e=p:(e=Math.ceil(4*p/(m+p)),m=4-e);g={directional:e,point:m};p=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)p=f.bones.length;
+var t;a:{o=b.fragmentShader;n=b.vertexShader;var m=b.uniforms,e=b.attributes,c={map:!!b.map,envMap:!!b.envMap,lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:c,sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:g.directional,maxPointLights:g.point,maxBones:p},u;g=[];k?g.push(k):(g.push(o),g.push(n));for(u in c)g.push(u),g.push(c[u]);k=g.join();u=0;for(g=ca.length;u<g;u++)if(ca[u].code==k){t=ca[u].program;break a}u=
+j.createProgram();g=[oa?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#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.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");
+p=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,c.fog?"#define USE_FOG":"",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":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");j.attachShader(u,I("fragment",p+o));j.attachShader(u,I("vertex",g+n));j.linkProgram(u);
j.getProgramParameter(u,j.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+j.getProgramParameter(u,j.VALIDATE_STATUS)+", gl error ["+j.getError()+"]");u.uniforms={};u.attributes={};var v;o=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(v in m)o.push(v);v=o;m=0;for(o=v.length;m<o;m++)n=v[m],u.uniforms[n]=j.getUniformLocation(u,n);o=["position","normal",
-"uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(v=0;v<c.maxMorphTargets;v++)o.push("morphTarget"+v);for(p in e)o.push(p);p=o;v=0;for(e=p.length;v<e;v++)c=p[v],u.attributes[c]=j.getAttribLocation(u,c);ca.push({program:u,code:k});p=u}b.program=p;p=b.program.attributes;p.position>=0&&j.enableVertexAttribArray(p.position);p.color>=0&&j.enableVertexAttribArray(p.color);p.normal>=0&&j.enableVertexAttribArray(p.normal);p.tangent>=0&&j.enableVertexAttribArray(p.tangent);
-b.skinning&&p.skinVertexA>=0&&p.skinVertexB>=0&&p.skinIndex>=0&&p.skinWeight>=0&&(j.enableVertexAttribArray(p.skinVertexA),j.enableVertexAttribArray(p.skinVertexB),j.enableVertexAttribArray(p.skinIndex),j.enableVertexAttribArray(p.skinWeight));if(b.attributes)for(h in b.attributes)p[h]!==void 0&&p[h]>=0&&j.enableVertexAttribArray(p[h]);if(b.morphTargets){b.numSupportedMorphTargets=0;p.morphTarget0>=0&&(j.enableVertexAttribArray(p.morphTarget0),b.numSupportedMorphTargets++);p.morphTarget1>=0&&(j.enableVertexAttribArray(p.morphTarget1),
-b.numSupportedMorphTargets++);p.morphTarget2>=0&&(j.enableVertexAttribArray(p.morphTarget2),b.numSupportedMorphTargets++);p.morphTarget3>=0&&(j.enableVertexAttribArray(p.morphTarget3),b.numSupportedMorphTargets++);p.morphTarget4>=0&&(j.enableVertexAttribArray(p.morphTarget4),b.numSupportedMorphTargets++);p.morphTarget5>=0&&(j.enableVertexAttribArray(p.morphTarget5),b.numSupportedMorphTargets++);p.morphTarget6>=0&&(j.enableVertexAttribArray(p.morphTarget6),b.numSupportedMorphTargets++);p.morphTarget7>=
-0&&(j.enableVertexAttribArray(p.morphTarget7),b.numSupportedMorphTargets++);f.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);b=0;for(h=this.maxMorphTargets;b<h;b++)f.__webglMorphTargetInfluences[b]=0}};this.render=function(b,c,p,z){var C,H,G,I,K,L,J,N,O=b.lights,P=b.fog;ea.data.vertices=0;ea.data.faces=0;ea.data.drawCalls=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(la);c.projectionMatrix.flattenToArray(ka);Y.multiply(c.projectionMatrix,
+"uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(v=0;v<c.maxMorphTargets;v++)o.push("morphTarget"+v);for(t in e)o.push(t);t=o;v=0;for(e=t.length;v<e;v++)c=t[v],u.attributes[c]=j.getAttribLocation(u,c);ca.push({program:u,code:k});t=u}b.program=t;t=b.program.attributes;t.position>=0&&j.enableVertexAttribArray(t.position);t.color>=0&&j.enableVertexAttribArray(t.color);t.normal>=0&&j.enableVertexAttribArray(t.normal);t.tangent>=0&&j.enableVertexAttribArray(t.tangent);
+b.skinning&&t.skinVertexA>=0&&t.skinVertexB>=0&&t.skinIndex>=0&&t.skinWeight>=0&&(j.enableVertexAttribArray(t.skinVertexA),j.enableVertexAttribArray(t.skinVertexB),j.enableVertexAttribArray(t.skinIndex),j.enableVertexAttribArray(t.skinWeight));if(b.attributes)for(h in b.attributes)t[h]!==void 0&&t[h]>=0&&j.enableVertexAttribArray(t[h]);if(b.morphTargets){b.numSupportedMorphTargets=0;t.morphTarget0>=0&&(j.enableVertexAttribArray(t.morphTarget0),b.numSupportedMorphTargets++);t.morphTarget1>=0&&(j.enableVertexAttribArray(t.morphTarget1),
+b.numSupportedMorphTargets++);t.morphTarget2>=0&&(j.enableVertexAttribArray(t.morphTarget2),b.numSupportedMorphTargets++);t.morphTarget3>=0&&(j.enableVertexAttribArray(t.morphTarget3),b.numSupportedMorphTargets++);t.morphTarget4>=0&&(j.enableVertexAttribArray(t.morphTarget4),b.numSupportedMorphTargets++);t.morphTarget5>=0&&(j.enableVertexAttribArray(t.morphTarget5),b.numSupportedMorphTargets++);t.morphTarget6>=0&&(j.enableVertexAttribArray(t.morphTarget6),b.numSupportedMorphTargets++);t.morphTarget7>=
+0&&(j.enableVertexAttribArray(t.morphTarget7),b.numSupportedMorphTargets++);f.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);b=0;for(h=this.maxMorphTargets;b<h;b++)f.__webglMorphTargetInfluences[b]=0}};this.render=function(b,c,p,z){var C,H,G,I,K,L,J,N,O=b.lights,P=b.fog;ea.data.vertices=0;ea.data.faces=0;ea.data.drawCalls=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(la);c.projectionMatrix.flattenToArray(ka);Y.multiply(c.projectionMatrix,
c.matrixWorldInverse);n(Y);this.initWebGLObjects(b);F(p);(this.autoClear||z)&&this.clear();K=b.__webglObjects.length;for(z=0;z<K;z++)if(C=b.__webglObjects[z],J=C.object,J.visible)if(!(J instanceof THREE.Mesh)||o(J)){if(J.matrixWorld.flattenToArray(J._objectMatrixArray),y(J,c),v(C),C.render=!0,this.sortObjects)C.object.renderDepth?C.z=C.object.renderDepth:(ga.copy(J.position),Y.multiplyVector3(ga),C.z=ga.z)}else C.render=!1;else C.render=!1;this.sortObjects&&b.__webglObjects.sort(u);L=b.__webglObjectsImmediate.length;
for(z=0;z<L;z++)C=b.__webglObjectsImmediate[z],J=C.object,J.visible&&(J.matrixAutoUpdate&&J.matrixWorld.flattenToArray(J._objectMatrixArray),y(J,c),t(C));if(b.overrideMaterial){h(b.overrideMaterial.depthTest);D(b.overrideMaterial.blending);for(z=0;z<K;z++)if(C=b.__webglObjects[z],C.render)J=C.object,N=C.buffer,k(J),f(c,O,P,b.overrideMaterial,N,J);for(z=0;z<L;z++)C=b.__webglObjectsImmediate[z],J=C.object,J.visible&&(k(J),H=e(c,O,P,b.overrideMaterial,J),J.render(function(e){g(e,H,b.overrideMaterial.shading)}))}else{D(THREE.NormalBlending);
for(z=0;z<K;z++)if(C=b.__webglObjects[z],C.render){J=C.object;N=C.buffer;G=C.opaque;k(J);for(C=0;C<G.count;C++)I=G.list[C],h(I.depthTest),m(I.polygonOffset,I.polygonOffsetFactor,I.polygonOffsetUnits),f(c,O,P,I,N,J)}for(z=0;z<L;z++)if(C=b.__webglObjectsImmediate[z],J=C.object,J.visible){G=C.opaque;k(J);for(C=0;C<G.count;C++)I=G.list[C],h(I.depthTest),m(I.polygonOffset,I.polygonOffsetFactor,I.polygonOffsetUnits),H=e(c,O,P,I,J),J.render(function(b){g(b,H,I.shading)})}for(z=0;z<K;z++)if(C=b.__webglObjects[z],
@@ -321,17 +321,17 @@ C.render){J=C.object;N=C.buffer;G=C.transparent;k(J);for(C=0;C<G.count;C++)I=G.l
b.__webglShadowVolumes.length&&b.lights.length&&w(b);b.__webglLensFlares.length&&A(b,c);p&&p.minFilter!==THREE.NearestFilter&&p.minFilter!==THREE.LinearFilter&&(j.bindTexture(j.TEXTURE_2D,p.__webglTexture),j.generateMipmap(j.TEXTURE_2D),j.bindTexture(j.TEXTURE_2D,null))};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=[],b.__webglShadowVolumes=[],b.__webglLensFlares=[],b.__webglSprites=[];for(;b.__objectsAdded.length;){var e=b.__objectsAdded[0],
c=b,f=void 0,g=void 0,h=void 0;if(e._modelViewMatrix==void 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);if(e instanceof THREE.Mesh)for(f in g=e.geometry,g.geometryGroups==void 0&&C(g),g.geometryGroups){h=g.geometryGroups[f];if(!h.__webglVertexBuffer){var k=h;k.__webglVertexBuffer=j.createBuffer();k.__webglNormalBuffer=j.createBuffer();
k.__webglTangentBuffer=j.createBuffer();k.__webglColorBuffer=j.createBuffer();k.__webglUVBuffer=j.createBuffer();k.__webglUV2Buffer=j.createBuffer();k.__webglSkinVertexABuffer=j.createBuffer();k.__webglSkinVertexBBuffer=j.createBuffer();k.__webglSkinIndicesBuffer=j.createBuffer();k.__webglSkinWeightsBuffer=j.createBuffer();k.__webglFaceBuffer=j.createBuffer();k.__webglLineBuffer=j.createBuffer();if(k.numMorphTargets){var m=void 0,o=void 0;k.__webglMorphTargetsBuffers=[];m=0;for(o=k.numMorphTargets;m<
-o;m++)k.__webglMorphTargetsBuffers.push(j.createBuffer())}for(var k=h,m=e,p=void 0,n=void 0,t=void 0,u=t=void 0,v=void 0,w=void 0,y=w=o=0,A=t=n=void 0,B=A=n=p=void 0,t=void 0,u=m.geometry,v=u.faces,A=k.faces,p=0,n=A.length;p<n;p++)t=A[p],t=v[t],t instanceof THREE.Face3?(o+=3,w+=1,y+=3):t instanceof THREE.Face4&&(o+=4,w+=2,y+=4);for(var p=k,n=m,D=A=v=void 0,F=void 0,D=void 0,t=[],v=0,A=n.materials.length;v<A;v++)if(D=n.materials[v],D instanceof THREE.MeshFaceMaterial){D=0;for(l=p.materials.length;D<
-l;D++)(F=p.materials[D])&&t.push(F)}else(F=D)&&t.push(F);p=t;k.__materials=p;a:{v=n=void 0;A=p.length;for(n=0;n<A;n++)if(v=p[n],v.map||v.lightMap||v instanceof THREE.MeshShaderMaterial){n=!0;break a}n=!1}a:{A=v=void 0;t=p.length;for(v=0;v<t;v++)if(A=p[v],!(A instanceof THREE.MeshBasicMaterial&&!A.envMap||A instanceof THREE.MeshDepthMaterial)){A=A&&A.shading!=void 0&&A.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}A=!1}a:{t=v=void 0;D=p.length;for(v=0;v<D;v++)if(t=p[v],
-t.vertexColors){t=t.vertexColors;break a}t=!1}k.__vertexArray=new Float32Array(o*3);if(A)k.__normalArray=new Float32Array(o*3);if(u.hasTangents)k.__tangentArray=new Float32Array(o*4);if(t)k.__colorArray=new Float32Array(o*3);if(n){if(u.faceUvs.length>0||u.faceVertexUvs.length>0)k.__uvArray=new Float32Array(o*2);if(u.faceUvs.length>1||u.faceVertexUvs.length>1)k.__uv2Array=new Float32Array(o*2)}if(m.geometry.skinWeights.length&&m.geometry.skinIndices.length)k.__skinVertexAArray=new Float32Array(o*4),
-k.__skinVertexBArray=new Float32Array(o*4),k.__skinIndexArray=new Float32Array(o*4),k.__skinWeightArray=new Float32Array(o*4);k.__faceArray=new Uint16Array(w*3+(m.geometry.edgeFaces?m.geometry.edgeFaces.length*6:0));k.__lineArray=new Uint16Array(y*2);if(k.numMorphTargets){k.__morphTargetsArrays=[];u=0;for(v=k.numMorphTargets;u<v;u++)k.__morphTargetsArrays.push(new Float32Array(o*3))}k.__needsSmoothNormals=A==THREE.SmoothShading;k.__uvType=n;k.__vertexColorType=t;k.__normalType=A;k.__webglFaceCount=
-w*3+(m.geometry.edgeFaces?m.geometry.edgeFaces.length*6:0);k.__webglLineCount=y*2;u=0;for(v=p.length;u<v;u++)if(n=p[u],n.attributes)for(a in k.__webglCustomAttributes={},n.attributes){t=n.attributes[a];A={};for(B in t)A[B]=t[B];if(!A.__webglInitialized||A.createUniqueBuffers)A.__webglInitialized=!0,w=1,A.type==="v2"?w=2:A.type==="v3"?w=3:A.type==="v4"?w=4:A.type==="c"&&(w=3),A.size=w,A.array=new Float32Array(o*w),A.buffer=j.createBuffer(),A.buffer.belongsToAttribute=a,t.needsUpdate=!0,A.__original=
-t;k.__webglCustomAttributes[a]=A}k.__inittedArrays=!0;g.__dirtyVertices=!0;g.__dirtyMorphTargets=!0;g.__dirtyElements=!0;g.__dirtyUvs=!0;g.__dirtyNormals=!0;g.__dirtyTangents=!0;g.__dirtyColors=!0}e instanceof THREE.ShadowVolume?H(c.__webglShadowVolumes,h,e):H(c.__webglObjects,h,e)}else if(e instanceof THREE.LensFlare)H(c.__webglLensFlares,void 0,e);else if(e instanceof THREE.Ribbon){g=e.geometry;if(!g.__webglVertexBuffer)f=g,f.__webglVertexBuffer=j.createBuffer(),f.__webglColorBuffer=j.createBuffer(),
+o;m++)k.__webglMorphTargetsBuffers.push(j.createBuffer())}for(var k=h,m=e,n=void 0,t=void 0,p=void 0,u=p=void 0,v=void 0,w=void 0,y=w=o=0,A=p=t=void 0,B=A=t=n=void 0,p=void 0,u=m.geometry,v=u.faces,A=k.faces,n=0,t=A.length;n<t;n++)p=A[n],p=v[p],p instanceof THREE.Face3?(o+=3,w+=1,y+=3):p instanceof THREE.Face4&&(o+=4,w+=2,y+=4);for(var n=k,t=m,D=A=v=void 0,F=void 0,D=void 0,p=[],v=0,A=t.materials.length;v<A;v++)if(D=t.materials[v],D instanceof THREE.MeshFaceMaterial){D=0;for(l=n.materials.length;D<
+l;D++)(F=n.materials[D])&&p.push(F)}else(F=D)&&p.push(F);n=p;k.__materials=n;a:{v=t=void 0;A=n.length;for(t=0;t<A;t++)if(v=n[t],v.map||v.lightMap||v instanceof THREE.MeshShaderMaterial){t=!0;break a}t=!1}a:{A=v=void 0;p=n.length;for(v=0;v<p;v++)if(A=n[v],!(A instanceof THREE.MeshBasicMaterial&&!A.envMap||A instanceof THREE.MeshDepthMaterial)){A=A&&A.shading!=void 0&&A.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}A=!1}a:{p=v=void 0;D=n.length;for(v=0;v<D;v++)if(p=n[v],
+p.vertexColors){p=p.vertexColors;break a}p=!1}k.__vertexArray=new Float32Array(o*3);if(A)k.__normalArray=new Float32Array(o*3);if(u.hasTangents)k.__tangentArray=new Float32Array(o*4);if(p)k.__colorArray=new Float32Array(o*3);if(t){if(u.faceUvs.length>0||u.faceVertexUvs.length>0)k.__uvArray=new Float32Array(o*2);if(u.faceUvs.length>1||u.faceVertexUvs.length>1)k.__uv2Array=new Float32Array(o*2)}if(m.geometry.skinWeights.length&&m.geometry.skinIndices.length)k.__skinVertexAArray=new Float32Array(o*4),
+k.__skinVertexBArray=new Float32Array(o*4),k.__skinIndexArray=new Float32Array(o*4),k.__skinWeightArray=new Float32Array(o*4);k.__faceArray=new Uint16Array(w*3+(m.geometry.edgeFaces?m.geometry.edgeFaces.length*6:0));k.__lineArray=new Uint16Array(y*2);if(k.numMorphTargets){k.__morphTargetsArrays=[];u=0;for(v=k.numMorphTargets;u<v;u++)k.__morphTargetsArrays.push(new Float32Array(o*3))}k.__needsSmoothNormals=A==THREE.SmoothShading;k.__uvType=t;k.__vertexColorType=p;k.__normalType=A;k.__webglFaceCount=
+w*3+(m.geometry.edgeFaces?m.geometry.edgeFaces.length*6:0);k.__webglLineCount=y*2;u=0;for(v=n.length;u<v;u++)if(t=n[u],t.attributes)for(a in k.__webglCustomAttributes={},t.attributes){p=t.attributes[a];A={};for(B in p)A[B]=p[B];if(!A.__webglInitialized||A.createUniqueBuffers)A.__webglInitialized=!0,w=1,A.type==="v2"?w=2:A.type==="v3"?w=3:A.type==="v4"?w=4:A.type==="c"&&(w=3),A.size=w,A.array=new Float32Array(o*w),A.buffer=j.createBuffer(),A.buffer.belongsToAttribute=a,p.needsUpdate=!0,A.__original=
+p;k.__webglCustomAttributes[a]=A}k.__inittedArrays=!0;g.__dirtyVertices=!0;g.__dirtyMorphTargets=!0;g.__dirtyElements=!0;g.__dirtyUvs=!0;g.__dirtyNormals=!0;g.__dirtyTangents=!0;g.__dirtyColors=!0}e instanceof THREE.ShadowVolume?H(c.__webglShadowVolumes,h,e):H(c.__webglObjects,h,e)}else if(e instanceof THREE.LensFlare)H(c.__webglLensFlares,void 0,e);else if(e instanceof THREE.Ribbon){g=e.geometry;if(!g.__webglVertexBuffer)f=g,f.__webglVertexBuffer=j.createBuffer(),f.__webglColorBuffer=j.createBuffer(),
f=g,h=f.vertices.length,f.__vertexArray=new Float32Array(h*3),f.__colorArray=new Float32Array(h*3),f.__webglVertexCount=h,g.__dirtyVertices=!0,g.__dirtyColors=!0;H(c.__webglObjects,g,e)}else if(e instanceof THREE.Line){g=e.geometry;if(!g.__webglVertexBuffer)f=g,f.__webglVertexBuffer=j.createBuffer(),f.__webglColorBuffer=j.createBuffer(),f=g,h=f.vertices.length,f.__vertexArray=new Float32Array(h*3),f.__colorArray=new Float32Array(h*3),f.__webglLineCount=h,g.__dirtyVertices=!0,g.__dirtyColors=!0;H(c.__webglObjects,
g,e)}else if(e instanceof THREE.ParticleSystem){g=e.geometry;if(!g.__webglVertexBuffer)f=g,f.__webglVertexBuffer=j.createBuffer(),f.__webglColorBuffer=j.createBuffer(),f=g,h=f.vertices.length,f.__vertexArray=new Float32Array(h*3),f.__colorArray=new Float32Array(h*3),f.__sortArray=[],f.__webglParticleCount=h,g.__dirtyVertices=!0,g.__dirtyColors=!0;H(c.__webglObjects,g,e)}else THREE.MarchingCubes!==void 0&&e instanceof THREE.MarchingCubes?c.__webglObjectsImmediate.push({object:e,opaque:{list:[],count:0},
transparent:{list:[],count:0}}):e instanceof THREE.Sprite&&c.__webglSprites.push(e);b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;){c=b.__objectsRemoved[0];e=b;if(c instanceof THREE.ShadowVolume)z(e.__webglShadowVolumes,c);else if(c instanceof THREE.Mesh||c instanceof THREE.ParticleSystem||c instanceof THREE.Ribbon||c instanceof THREE.Line)z(e.__webglObjects,c);else if(c instanceof THREE.Sprite){e=e.__webglSprites;g=void 0;for(g=e.length-1;g>=0;g--)e[g]==c&&e.splice(g,1)}else c instanceof
THREE.LensFlare?z(e.__webglLensFlares,c):c instanceof THREE.MarchingCubes&&z(e.__webglObjectsImmediate,c);b.__objectsRemoved.splice(0,1)}e=0;for(c=b.__webglObjects.length;e<c;e++)G(b.__webglObjects[e].object,b);e=0;for(c=b.__webglShadowVolumes.length;e<c;e++)G(b.__webglShadowVolumes[e].object,b);e=0;for(c=b.__webglLensFlares.length;e<c;e++)G(b.__webglLensFlares[e].object,b)};this.setFaceCulling=function(b,e){b?(!e||e=="ccw"?j.frontFace(j.CCW):j.frontFace(j.CW),b=="back"?j.cullFace(j.BACK):b=="front"?
-j.cullFace(j.FRONT):j.cullFace(j.FRONT_AND_BACK),j.enable(j.CULL_FACE)):j.disable(j.CULL_FACE)};this.supportsVertexTextures=function(){return qa}};
+j.cullFace(j.FRONT):j.cullFace(j.FRONT_AND_BACK),j.enable(j.CULL_FACE)):j.disable(j.CULL_FACE)};this.supportsVertexTextures=function(){return oa}};
THREE.WebGLRenderTarget=function(b,c,e){this.width=b;this.height=c;e=e||{};this.wrapS=e.wrapS!==void 0?e.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=e.wrapT!==void 0?e.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=e.magFilter!==void 0?e.magFilter:THREE.LinearFilter;this.minFilter=e.minFilter!==void 0?e.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=e.format!==void 0?e.format:THREE.RGBAFormat;this.type=e.type!==void 0?e.type:
THREE.UnsignedByteType;this.depthBuffer=e.depthBuffer!==void 0?e.depthBuffer:!0;this.stencilBuffer=e.stencilBuffer!==void 0?e.stencilBuffer:!0};THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};THREE.RenderableVertex.prototype.copy=function(b){this.positionWorld.copy(b.positionWorld);this.positionScreen.copy(b.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.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[[]];this.z=null};
View
98 build/custom/ThreeCanvas.js
@@ -14,33 +14,33 @@ THREE.Vector4.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w
a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){a?(this.x/=a,this.y/=a,this.z/=a,this.w/=a):this.set(0,0,0,1);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())},normalize:function(){return this.divideScalar(this.length())},
setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b;return this}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
THREE.Ray.prototype={intersectScene:function(a){return this.intersectObjects(a.objects)},intersectObjects:function(a){var b,c,d=[];b=0;for(c=a.length;b<c;b++)d=d.concat(this.intersectObject(a[b]));d.sort(function(a,b){return a.distance-b.distance});return d},intersectObject:function(a){function b(a,b,c){var d,c=c.matrixWorld.getPosition();d=c.clone().subSelf(a).dot(b);a=a.clone().addSelf(b.clone().multiplyScalar(d));return c.distanceTo(a)}function c(a,b,c,d){var d=d.clone().subSelf(b),c=c.clone().subSelf(b),
-f=a.clone().subSelf(b),a=d.dot(d),b=d.dot(c),d=d.dot(f),e=c.dot(c),c=c.dot(f),f=1/(a*e-b*b),e=(e*d-b*c)*f,a=(a*c-b*d)*f;return e>0&&a>0&&e+a<1}if(a instanceof THREE.Particle){var d=b(this.origin,this.direction,a);if(!d||d>a.scale.x)return[];return[{distance:d,point:a.position,face:null,object:a}]}else if(a instanceof THREE.Mesh){d=b(this.origin,this.direction,a);if(!d||d>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return[];var f,g,e,h,i,l,m,j,n,o,k=a.geometry,
-q=k.vertices,v=[],d=0;for(f=k.faces.length;d<f;d++)if(g=k.faces[d],n=this.origin.clone(),o=this.direction.clone(),l=a.matrixWorld,e=l.multiplyVector3(q[g.a].position.clone()),h=l.multiplyVector3(q[g.b].position.clone()),i=l.multiplyVector3(q[g.c].position.clone()),l=g instanceof THREE.Face4?l.multiplyVector3(q[g.d].position.clone()):null,m=a.matrixRotationWorld.multiplyVector3(g.normal.clone()),j=o.dot(m),a.doubleSided||(a.flipSided?j>0:j<0))if(m=m.dot((new THREE.Vector3).sub(e,n))/j,n=n.addSelf(o.multiplyScalar(m)),
-g instanceof THREE.Face3)c(n,e,h,i)&&(g={distance:this.origin.distanceTo(n),point:n,face:g,object:a},v.push(g));else if(g instanceof THREE.Face4&&(c(n,e,h,l)||c(n,h,i,l)))g={distance:this.origin.distanceTo(n),point:n,face:g,object:a},v.push(g);return v}else return[]}};
-THREE.Rectangle=function(){function a(){g=d-b;e=f-c}var b,c,d,f,g,e,h=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return g};this.getHeight=function(){return e};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return f};this.set=function(e,g,m,j){h=!1;b=e;c=g;d=m;f=j;a()};this.addPoint=function(e,g){h?(h=!1,b=e,c=g,d=e,f=g):(b=b<e?b:e,c=c<g?c:g,d=d>e?d:e,f=f>g?f:g);a()};this.add3Points=
-function(e,g,m,j,n,o){h?(h=!1,b=e<m?e<n?e:n:m<n?m:n,c=g<j?g<o?g:o:j<o?j:o,d=e>m?e>n?e:n:m>n?m:n,f=g>j?g>o?g:o:j>o?j:o):(b=e<m?e<n?e<b?e:b:n<b?n:b:m<n?m<b?m:b:n<b?n:b,c=g<j?g<o?g<c?g:c:o<c?o:c:j<o?j<c?j:c:o<c?o:c,d=e>m?e>n?e>d?e:d:n>d?n:d:m>n?m>d?m:d:n>d?n:d,f=g>j?g>o?g>f?g:f:o>f?o:f:j>o?j>f?j:f:o>f?o:f);a()};this.addRectangle=function(e){h?(h=!1,b=e.getLeft(),c=e.getTop(),d=e.getRight(),f=e.getBottom()):(b=b<e.getLeft()?b:e.getLeft(),c=c<e.getTop()?c:e.getTop(),d=d>e.getRight()?d:e.getRight(),f=f>
+f=a.clone().subSelf(b),a=d.dot(d),b=d.dot(c),d=d.dot(f),e=c.dot(c),c=c.dot(f),f=1/(a*e-b*b),e=(e*d-b*c)*f,a=(a*c-b*d)*f;return e>0&&a>0&&e+a<1}if(a instanceof THREE.Particle){var d=b(this.origin,this.direction,a);if(!d||d>a.scale.x)return[];return[{distance:d,point:a.position,face:null,object:a}]}else if(a instanceof THREE.Mesh){d=b(this.origin,this.direction,a);if(!d||d>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return[];var f,g,e,h,i,l,m,n,j,o,k=a.geometry,
+q=k.vertices,v=[],d=0;for(f=k.faces.length;d<f;d++)if(g=k.faces[d],j=this.origin.clone(),o=this.direction.clone(),l=a.matrixWorld,e=l.multiplyVector3(q[g.a].position.clone()),h=l.multiplyVector3(q[g.b].position.clone()),i=l.multiplyVector3(q[g.c].position.clone()),l=g instanceof THREE.Face4?l.multiplyVector3(q[g.d].position.clone()):null,m=a.matrixRotationWorld.multiplyVector3(g.normal.clone()),n=o.dot(m),a.doubleSided||(a.flipSided?n>0:n<0))if(m=m.dot((new THREE.Vector3).sub(e,j))/n,j=j.addSelf(o.multiplyScalar(m)),
+g instanceof THREE.Face3)c(j,e,h,i)&&(g={distance:this.origin.distanceTo(j),point:j,face:g,object:a},v.push(g));else if(g instanceof THREE.Face4&&(c(j,e,h,l)||c(j,h,i,l)))g={distance:this.origin.distanceTo(j),point:j,face:g,object:a},v.push(g);return v}else return[]}};
+THREE.Rectangle=function(){function a(){g=d-b;e=f-c}var b,c,d,f,g,e,h=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return g};this.getHeight=function(){return e};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return f};this.set=function(e,g,m,n){h=!1;b=e;c=g;d=m;f=n;a()};this.addPoint=function(e,g){h?(h=!1,b=e,c=g,d=e,f=g):(b=b<e?b:e,c=c<g?c:g,d=d>e?d:e,f=f>g?f:g);a()};this.add3Points=
+function(e,g,m,n,j,o){h?(h=!1,b=e<m?e<j?e:j:m<j?m:j,c=g<n?g<o?g:o:n<o?n:o,d=e>m?e>j?e:j:m>j?m:j,f=g>n?g>o?g:o:n>o?n:o):(b=e<m?e<j?e<b?e:b:j<b?j:b:m<j?m<b?m:b:j<b?j:b,c=g<n?g<o?g<c?g:c:o<c?o:c:n<o?n<c?n:c:o<c?o:c,d=e>m?e>j?e>d?e:d:j>d?j:d:m>j?m>d?m:d:j>d?j:d,f=g>n?g>o?g>f?g:f:o>f?o:f:n>o?n>f?n:f:o>f?o:f);a()};this.addRectangle=function(e){h?(h=!1,b=e.getLeft(),c=e.getTop(),d=e.getRight(),f=e.getBottom()):(b=b<e.getLeft()?b:e.getLeft(),c=c<e.getTop()?c:e.getTop(),d=d>e.getRight()?d:e.getRight(),f=f>
e.getBottom()?f:e.getBottom());a()};this.inflate=function(e){b-=e;c-=e;d+=e;f+=e;a()};this.minSelf=function(e){b=b>e.getLeft()?b:e.getLeft();c=c>e.getTop()?c:e.getTop();d=d<e.getRight()?d:e.getRight();f=f<e.getBottom()?f:e.getBottom();a()};this.instersects=function(a){return Math.min(d,a.getRight())-Math.max(b,a.getLeft())>=0&&Math.min(f,a.getBottom())-Math.max(c,a.getTop())>=0};this.empty=function(){h=!0;f=d=c=b=0;a()};this.isEmpty=function(){return h}};THREE.Matrix3=function(){this.m=[]};
-THREE.Matrix3.prototype={transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};THREE.Matrix4=function(a,b,c,d,f,g,e,h,i,l,m,j,n,o,k,q){this.set(a||1,b||0,c||0,d||0,f||0,g||1,e||0,h||0,i||0,l||0,m||1,j||0,n||0,o||0,k||0,q||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={set:function(a,b,c,d,f,g,e,h,i,l,m,j,n,o,k,q){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=f;this.n22=g;this.n23=e;this.n24=h;this.n31=i;this.n32=l;this.n33=m;this.n34=j;this.n41=n;this.n42=o;this.n43=k;this.n44=q;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,
+THREE.Matrix3.prototype={transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};THREE.Matrix4=function(a,b,c,d,f,g,e,h,i,l,m,n,j,o,k,q){this.set(a||1,b||0,c||0,d||0,f||0,g||1,e||0,h||0,i||0,l||0,m||1,n||0,j||0,o||0,k||0,q||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={set:function(a,b,c,d,f,g,e,h,i,l,m,n,j,o,k,q){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=f;this.n22=g;this.n23=e;this.n24=h;this.n31=i;this.n32=l;this.n33=m;this.n34=n;this.n41=j;this.n42=o;this.n43=k;this.n44=q;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,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());f.cross(g,d).normalize();this.n11=d.x;this.n12=f.x;this.n13=g.x;this.n21=d.y;this.n22=f.y;this.n23=g.y;this.n31=d.z;this.n32=f.z;this.n33=g.z;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},multiply:function(a,b){var c=a.n11,d=a.n12,f=a.n13,g=a.n14,e=a.n21,h=a.n22,i=a.n23,l=a.n24,m=a.n31,j=a.n32,n=a.n33,o=a.n34,k=a.n41,q=a.n42,v=a.n43,s=a.n44,J=b.n11,N=b.n12,x=b.n13,B=b.n14,p=b.n21,O=b.n22,
-r=b.n23,u=b.n24,y=b.n31,R=b.n32,$=b.n33,Z=b.n34,C=b.n41,F=b.n42,L=b.n43,D=b.n44;this.n11=c*J+d*p+f*y+g*C;this.n12=c*N+d*O+f*R+g*F;this.n13=c*x+d*r+f*$+g*L;this.n14=c*B+d*u+f*Z+g*D;this.n21=e*J+h*p+i*y+l*C;this.n22=e*N+h*O+i*R+l*F;this.n23=e*x+h*r+i*$+l*L;this.n24=e*B+h*u+i*Z+l*D;this.n31=m*J+j*p+n*y+o*C;this.n32=m*N+j*O+n*R+o*F;this.n33=m*x+j*r+n*$+o*L;this.n34=m*B+j*u+n*Z+o*D;this.n41=k*J+q*p+v*y+s*C;this.n42=k*N+q*O+v*R+s*F;this.n43=k*x+q*r+v*$+s*L;this.n44=k*B+q*u+v*Z+s*D;return this},multiplyToArray:function(a,
+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},multiply:function(a,b){var c=a.n11,d=a.n12,f=a.n13,g=a.n14,e=a.n21,h=a.n22,i=a.n23,l=a.n24,m=a.n31,n=a.n32,j=a.n33,o=a.n34,k=a.n41,q=a.n42,v=a.n43,s=a.n44,J=b.n11,N=b.n12,x=b.n13,B=b.n14,p=b.n21,O=b.n22,
+r=b.n23,u=b.n24,y=b.n31,R=b.n32,aa=b.n33,$=b.n34,C=b.n41,F=b.n42,L=b.n43,D=b.n44;this.n11=c*J+d*p+f*y+g*C;this.n12=c*N+d*O+f*R+g*F;this.n13=c*x+d*r+f*aa+g*L;this.n14=c*B+d*u+f*$+g*D;this.n21=e*J+h*p+i*y+l*C;this.n22=e*N+h*O+i*R+l*F;this.n23=e*x+h*r+i*aa+l*L;this.n24=e*B+h*u+i*$+l*D;this.n31=m*J+n*p+j*y+o*C;this.n32=m*N+n*O+j*R+o*F;this.n33=m*x+n*r+j*aa+o*L;this.n34=m*B+n*u+j*$+o*D;this.n41=k*J+q*p+v*y+s*C;this.n42=k*N+q*O+v*R+s*F;this.n43=k*x+q*r+v*aa+s*L;this.n44=k*B+q*u+v*$+s*D;return this},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},multiplySelf:function(a){this.multiply(this,a);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},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,d=this.n14,f=this.n21,g=this.n22,e=this.n23,h=this.n24,i=this.n31,l=this.n32,m=this.n33,j=this.n34,n=this.n41,o=this.n42,k=this.n43,q=this.n44;return d*e*l*n-c*h*l*n-d*g*m*n+b*h*m*n+c*g*j*n-b*e*j*n-d*e*i*o+c*h*i*o+d*f*m*o-a*h*m*o-c*f*j*o+a*e*j*o+d*g*i*k-b*h*i*k-d*f*l*k+a*h*l*k+b*f*j*k-a*g*j*k-c*g*i*q+b*e*i*q+c*f*l*q-a*e*l*q-b*f*m*q+a*g*m*q},transpose:function(){var a;a=this.n21;this.n21=
+a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,d=this.n14,f=this.n21,g=this.n22,e=this.n23,h=this.n24,i=this.n31,l=this.n32,m=this.n33,n=this.n34,j=this.n41,o=this.n42,k=this.n43,q=this.n44;return d*e*l*j-c*h*l*j-d*g*m*j+b*h*m*j+c*g*n*j-b*e*n*j-d*e*i*o+c*h*i*o+d*f*m*o-a*h*m*o-c*f*n*o+a*e*n*o+d*g*i*k-b*h*i*k-d*f*l*k+a*h*l*k+b*f*n*k-a*g*n*k-c*g*i*q+b*e*i*q+c*f*l*q-a*e*l*q-b*f*m*q+a*g*m*q},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;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=
this.n44;return a},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=
this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,
b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},setScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotationX:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotationY:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotationZ:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,
b){var c=Math.cos(b),d=Math.sin(b),f=1-c,g=a.x,e=a.y,h=a.z,i=f*g,l=f*e;this.set(i*g+c,i*e-d*h,i*h+d*e,0,i*e+d*h,l*e+c,l*h-d*g,0,i*h-d*e,l*h+d*g,f*h*h+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX=new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);
-return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3;this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(a,b){var c=a.x,d=a.y,f=a.z,g=Math.cos(c),c=Math.sin(c),e=Math.cos(d),d=Math.sin(d),h=Math.cos(f),f=Math.sin(f);switch(b){case "YXZ":var i=e*h,l=e*f,m=d*h,j=d*f;this.n11=i+j*c;this.n12=
-m*c-l;this.n13=g*d;this.n21=g*f;this.n22=g*h;this.n23=-c;this.n31=l*c-m;this.n32=j+i*c;this.n33=g*e;break;case "ZXY":i=e*h;l=e*f;m=d*h;j=d*f;this.n11=i-j*c;this.n12=-g*f;this.n13=m+l*c;this.n21=l+m*c;this.n22=g*h;this.n23=j-i*c;this.n31=-g*d;this.n32=c;this.n33=g*e;break;case "ZYX":i=g*h;l=g*f;m=c*h;j=c*f;this.n11=e*h;this.n12=m*d-l;this.n13=i*d+j;this.n21=e*f;this.n22=j*d+i;this.n23=l*d-m;this.n31=-d;this.n32=c*e;this.n33=g*e;break;case "YZX":i=g*e;l=g*d;m=c*e;j=c*d;this.n11=e*h;this.n12=j-i*f;this.n13=
-m*f+l;this.n21=f;this.n22=g*h;this.n23=-c*h;this.n31=-d*h;this.n32=l*f+m;this.n33=i-j*f;break;case "XZY":i=g*e;l=g*d;m=c*e;j=c*d;this.n11=e*h;this.n12=-f;this.n13=d*h;this.n21=i*f+j;this.n22=g*h;this.n23=l*f-m;this.n31=m*f-l;this.n32=c*h;this.n33=j*f+i;break;default:i=g*h,l=g*f,m=c*h,j=c*f,this.n11=e*h,this.n12=-e*f,this.n13=d,this.n21=l+m*d,this.n22=i-j*d,this.n23=-c*e,this.n31=j-i*d,this.n32=m+l*d,this.n33=g*e}return this},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,f=a.w,g=b+b,
+return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3;this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(a,b){var c=a.x,d=a.y,f=a.z,g=Math.cos(c),c=Math.sin(c),e=Math.cos(d),d=Math.sin(d),h=Math.cos(f),f=Math.sin(f);switch(b){case "YXZ":var i=e*h,l=e*f,m=d*h,n=d*f;this.n11=i+n*c;this.n12=
+m*c-l;this.n13=g*d;this.n21=g*f;this.n22=g*h;this.n23=-c;this.n31=l*c-m;this.n32=n+i*c;this.n33=g*e;break;case "ZXY":i=e*h;l=e*f;m=d*h;n=d*f;this.n11=i-n*c;this.n12=-g*f;this.n13=m+l*c;this.n21=l+m*c;this.n22=g*h;this.n23=n-i*c;this.n31=-g*d;this.n32=c;this.n33=g*e;break;case "ZYX":i=g*h;l=g*f;m=c*h;n=c*f;this.n11=e*h;this.n12=m*d-l;this.n13=i*d+n;this.n21=e*f;this.n22=n*d+i;this.n23=l*d-m;this.n31=-d;this.n32=c*e;this.n33=g*e;break;case "YZX":i=g*e;l=g*d;m=c*e;n=c*d;this.n11=e*h;this.n12=n-i*f;this.n13=
+m*f+l;this.n21=f;this.n22=g*h;this.n23=-c*h;this.n31=-d*h;this.n32=l*f+m;this.n33=i-n*f;break;case "XZY":i=g*e;l=g*d;m=c*e;n=c*d;this.n11=e*h;this.n12=-f;this.n13=d*h;this.n21=i*f+n;this.n22=g*h;this.n23=l*f-m;this.n31=m*f-l;this.n32=c*h;this.n33=n*f+i;break;default:i=g*h,l=g*f,m=c*h,n=c*f,this.n11=e*h,this.n12=-e*f,this.n13=d,this.n21=l+m*d,this.n22=i-n*d,this.n23=-c*e,this.n31=n-i*d,this.n32=m+l*d,this.n33=g*e}return this},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,f=a.w,g=b+b,
e=c+c,h=d+d,a=b*g,i=b*e;b*=h;var l=c*e;c*=h;d*=h;g*=f;e*=f;f*=h;this.n11=1-(l+d);this.n12=i-f;this.n13=b+e;this.n21=i+f;this.n22=1-(a+d);this.n23=c-g;this.n31=b-e;this.n32=c+g;this.n33=1-(a+l);return this},scale:function(a){var b=a.x,c=a.y,a=a.z;this.n11*=b;this.n12*=c;this.n13*=a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=a.n34},extractRotation:function(a,
b){var c=1/b.x,d=1/b.y,f=1/b.z;this.n11=a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*d;this.n22=a.n22*d;this.n32=a.n32*d;this.n13=a.n13*f;this.n23=a.n23*f;this.n33=a.n33*f}};
-THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,d=a.n12,f=a.n13,g=a.n14,e=a.n21,h=a.n22,i=a.n23,l=a.n24,m=a.n31,j=a.n32,n=a.n33,o=a.n34,k=a.n41,q=a.n42,v=a.n43,s=a.n44;b===void 0&&(b=new THREE.Matrix4);b.n11=i*o*q-l*n*q+l*j*v-h*o*v-i*j*s+h*n*s;b.n12=g*n*q-f*o*q-g*j*v+d*o*v+f*j*s-d*n*s;b.n13=f*l*q-g*i*q+g*h*v-d*l*v-f*h*s+d*i*s;b.n14=g*i*j-f*l*j-g*h*n+d*l*n+f*h*o-d*i*o;b.n21=l*n*k-i*o*k-l*m*v+e*o*v+i*m*s-e*n*s;b.n22=f*o*k-g*n*k+g*m*v-c*o*v-f*m*s+c*n*s;b.n23=g*i*k-f*l*k-g*e*v+c*l*v+f*e*s-c*i*s;b.n24=
-f*l*m-g*i*m+g*e*n-c*l*n-f*e*o+c*i*o;b.n31=h*o*k-l*j*k+l*m*q-e*o*q-h*m*s+e*j*s;b.n32=g*j*k-d*o*k-g*m*q+c*o*q+d*m*s-c*j*s;b.n33=f*l*k-g*h*k+g*e*q-c*l*q-d*e*s+c*h*s;b.n34=g*h*m-d*l*m-g*e*j+c*l*j+d*e*o-c*h*o;b.n41=i*j*k-h*n*k-i*m*q+e*n*q+h*m*v-e*j*v;b.n42=d*n*k-f*j*k+f*m*q-c*n*q-d*m*v+c*j*v;b.n43=f*h*k-d*i*k-f*e*q+c*i*q+d*e*v-c*h*v;b.n44=d*i*m-f*h*m+f*e*j-c*i*j-d*e*n+c*h*n;b.multiplyScalar(1/a.determinant());return b};
-THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,f=-a.n33*a.n21+a.n31*a.n23,g=a.n32*a.n21-a.n31*a.n22,e=-a.n33*a.n12+a.n32*a.n13,h=a.n33*a.n11-a.n31*a.n13,i=-a.n32*a.n11+a.n31*a.n12,l=a.n23*a.n12-a.n22*a.n13,m=-a.n23*a.n11+a.n21*a.n13,j=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*e+a.n31*l;a==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;c[0]=a*d;c[1]=a*f;c[2]=a*g;c[3]=a*e;c[4]=a*h;c[5]=a*i;c[6]=a*l;c[7]=a*m;c[8]=a*j;return b};
+THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,d=a.n12,f=a.n13,g=a.n14,e=a.n21,h=a.n22,i=a.n23,l=a.n24,m=a.n31,n=a.n32,j=a.n33,o=a.n34,k=a.n41,q=a.n42,v=a.n43,s=a.n44;b===void 0&&(b=new THREE.Matrix4);b.n11=i*o*q-l*j*q+l*n*v-h*o*v-i*n*s+h*j*s;b.n12=g*j*q-f*o*q-g*n*v+d*o*v+f*n*s-d*j*s;b.n13=f*l*q-g*i*q+g*h*v-d*l*v-f*h*s+d*i*s;b.n14=g*i*n-f*l*n-g*h*j+d*l*j+f*h*o-d*i*o;b.n21=l*j*k-i*o*k-l*m*v+e*o*v+i*m*s-e*j*s;b.n22=f*o*k-g*j*k+g*m*v-c*o*v-f*m*s+c*j*s;b.n23=g*i*k-f*l*k-g*e*v+c*l*v+f*e*s-c*i*s;b.n24=
+f*l*m-g*i*m+g*e*j-c*l*j-f*e*o+c*i*o;b.n31=h*o*k-l*n*k+l*m*q-e*o*q-h*m*s+e*n*s;b.n32=g*n*k-d*o*k-g*m*q+c*o*q+d*m*s-c*n*s;b.n33=f*l*k-g*h*k+g*e*q-c*l*q-d*e*s+c*h*s;b.n34=g*h*m-d*l*m-g*e*n+c*l*n+d*e*o-c*h*o;b.n41=i*n*k-h*j*k-i*m*q+e*j*q+h*m*v-e*n*v;b.n42=d*j*k-f*n*k+f*m*q-c*j*q-d*m*v+c*n*v;b.n43=f*h*k-d*i*k-f*e*q+c*i*q+d*e*v-c*h*v;b.n44=d*i*m-f*h*m+f*e*n-c*i*n-d*e*j+c*h*j;b.multiplyScalar(1/a.determinant());return b};
+THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,f=-a.n33*a.n21+a.n31*a.n23,g=a.n32*a.n21-a.n31*a.n22,e=-a.n33*a.n12+a.n32*a.n13,h=a.n33*a.n11-a.n31*a.n13,i=-a.n32*a.n11+a.n31*a.n12,l=a.n23*a.n12-a.n22*a.n13,m=-a.n23*a.n11+a.n21*a.n13,n=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*e+a.n31*l;a==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;c[0]=a*d;c[1]=a*f;c[2]=a*g;c[3]=a*e;c[4]=a*h;c[5]=a*i;c[6]=a*l;c[7]=a*m;c[8]=a*n;return b};
THREE.Matrix4.makeFrustum=function(a,b,c,d,f,g){var e;e=new THREE.Matrix4;e.n11=2*f/(b-a);e.n12=0;e.n13=(b+a)/(b-a);e.n14=0;e.n21=0;e.n22=2*f/(d-c);e.n23=(d+c)/(d-c);e.n24=0;e.n31=0;e.n32=0;e.n33=-(g+f)/(g-f);e.n34=-2*g*f/(g-f);e.n41=0;e.n42=0;e.n43=-1;e.n44=0;return e};THREE.Matrix4.makePerspective=function(a,b,c,d){var f,a=c*Math.tan(a*Math.PI/360);f=-a;return THREE.Matrix4.makeFrustum(f*b,a*b,f,a,c,d)};
THREE.Matrix4.makeOrtho=function(a,b,c,d,f,g){var e,h,i,l;e=new THREE.Matrix4;h=b-a;i=c-d;l=g-f;e.n11=2/h;e.n12=0;e.n13=0;e.n14=-((b+a)/h);e.n21=0;e.n22=2/i;e.n23=0;e.n24=-((c+d)/i);e.n31=0;e.n32=0;e.n33=-2/l;e.n34=-((g+f)/l);e.n41=0;e.n42=0;e.n43=0;e.n44=1;return e};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
THREE.Object3D=function(){this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=!0;this.quaternion=new THREE.Quaternion;
@@ -52,7 +52,7 @@ this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale),this.matri
THREE.Quaternion.prototype={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=0.5*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),g=Math.cos(c),c=Math.sin(c),e=a*b,h=d*f;this.w=e*g-h*c;this.x=e*c+h*g;this.y=d*b*g+a*f*c;this.z=a*f*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},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a==0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},
multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,f=this.w,g=a.x,e=a.y,h=a.z,a=a.w;this.x=b*a+f*g+c*h-d*e;this.y=c*a+f*e+d*g-b*h;this.z=d*a+f*h+b*e-c*g;this.w=f*a-b*g-c*e-d*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,f=a.z,g=this.x,e=this.y,h=this.z,i=this.w,l=i*c+e*f-h*d,m=
-i*d+h*c-g*f,j=i*f+g*d-e*c,c=-g*c-e*d-h*f;b.x=l*i+c*-g+m*-h-j*-e;b.y=m*i+c*-e+j*-g-l*-h;b.z=j*i+c*-h+l*-e-m*-g;return b}};
+i*d+h*c-g*f,n=i*f+g*d-e*c,c=-g*c-e*d-h*f;b.x=l*i+c*-g+m*-h-n*-e;b.y=m*i+c*-e+n*-g-l*-h;b.z=n*i+c*-h+l*-e-m*-g;return b}};
THREE.Quaternion.slerp=function(a,b,c,d){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(f)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var g=Math.acos(f),e=Math.sqrt(1-f*f);if(Math.abs(e)<0.001)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;f=Math.sin((1-d)*g)/e;d=Math.sin(d*g)/e;c.w=a.w*f+b.w*d;c.x=a.x*f+b.x*d;c.y=a.y*f+b.y*d;c.z=a.z*f+b.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
THREE.Face3=function(a,b,c,d,f,g){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};
THREE.Face4=function(a,b,c,d,f,g,e){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=e instanceof Array?e:[e];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.set(a||0,b||0)};
@@ -61,9 +61,9 @@ THREE.Geometry.prototype={computeCentroids:function(){var a,b,c;a=0;for(b=this.f
c.centroid.addSelf(this.vertices[c.d].position),c.centroid.divideScalar(4))},computeFaceNormals:function(a){var b,c,d,f,g,e,h=new THREE.Vector3,i=new THREE.Vector3;d=0;for(f=this.faces.length;d<f;d++){g=this.faces[d];if(a&&g.vertexNormals.length){h.set(0,0,0);b=0;for(c=g.vertexNormals.length;b<c;b++)h.addSelf(g.vertexNormals[b]);h.divideScalar(3)}else b=this.vertices[g.a],c=this.vertices[g.b],e=this.vertices[g.c],h.sub(e.position,c.position),i.sub(b.position,c.position),h.crossSelf(i);h.isZero()||
h.normalize();g.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,f,g,r){h=a.vertices[b].position;i=a.vertices[c].position;l=a.vertices[d].position;m=e[f];j=e[g];n=e[r];o=i.x-h.x;k=l.x-h.x;q=i.y-h.y;v=l.y-h.y;s=i.z-h.z;J=l.z-h.z;N=j.u-m.u;x=n.u-m.u;B=j.v-m.v;p=n.v-m.v;O=1/(N*p-x*B);R.set((p*o-B*k)*
-O,(p*q-B*v)*O,(p*s-B*J)*O);$.set((N*k-x*o)*O,(N*v-x*q)*O,(N*J-x*s)*O);u[b].addSelf(R);u[c].addSelf(R);u[d].addSelf(R);y[b].addSelf($);y[c].addSelf($);y[d].addSelf($)}var b,c,d,f,g,e,h,i,l,m,j,n,o,k,q,v,s,J,N,x,B,p,O,r,u=[],y=[],R=new THREE.Vector3,$=new THREE.Vector3,Z=new THREE.Vector3,C=new THREE.Vector3,F=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)u[b]=new THREE.Vector3,y[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)g=this.faces[b],e=this.faceVertexUvs[0][b],g instanceof
-THREE.Face3?a(this,g.a,g.b,g.c,0,1,2):g instanceof THREE.Face4&&(a(this,g.a,g.b,g.c,0,1,2),a(this,g.a,g.b,g.d,0,1,3));var L=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){g=this.faces[b];for(d=0;d<g.vertexNormals.length;d++)F.copy(g.vertexNormals[d]),f=g[L[d]],r=u[f],Z.copy(r),Z.subSelf(F.multiplyScalar(F.dot(r))).normalize(),C.cross(g.vertexNormals[d],r),f=C.dot(y[f]),f=f<0?-1:1,g.vertexTangents[d]=new THREE.Vector4(Z.x,Z.y,Z.z,f)}this.hasTangents=!0},computeBoundingBox:function(){var 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,f,g,r){h=a.vertices[b].position;i=a.vertices[c].position;l=a.vertices[d].position;m=e[f];n=e[g];j=e[r];o=i.x-h.x;k=l.x-h.x;q=i.y-h.y;v=l.y-h.y;s=i.z-h.z;J=l.z-h.z;N=n.u-m.u;x=j.u-m.u;B=n.v-m.v;p=j.v-m.v;O=1/(N*p-x*B);R.set((p*o-B*k)*
+O,(p*q-B*v)*O,(p*s-B*J)*O);aa.set((N*k-x*o)*O,(N*v-x*q)*O,(N*J-x*s)*O);u[b].addSelf(R);u[c].addSelf(R);u[d].addSelf(R);y[b].addSelf(aa);y[c].addSelf(aa);y[d].addSelf(aa)}var b,c,d,f,g,e,h,i,l,m,n,j,o,k,q,v,s,J,N,x,B,p,O,r,u=[],y=[],R=new THREE.Vector3,aa=new THREE.Vector3,$=new THREE.Vector3,C=new THREE.Vector3,F=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)u[b]=new THREE.Vector3,y[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)g=this.faces[b],e=this.faceVertexUvs[0][b],g instanceof
+THREE.Face3?a(this,g.a,g.b,g.c,0,1,2):g instanceof THREE.Face4&&(a(this,g.a,g.b,g.c,0,1,2),a(this,g.a,g.b,g.d,0,1,3));var L=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){g=this.faces[b];for(d=0;d<g.vertexNormals.length;d++)F.copy(g.vertexNormals[d]),f=g[L[d]],r=u[f],$.copy(r),$.subSelf(F.multiplyScalar(F.dot(r))).normalize(),C.cross(g.vertexNormals[d],r),f=C.dot(y[f]),f=f<0?-1:1,g.vertexTangents[d]=new THREE.Vector4($.x,$.y,$.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}},computeEdgeFaces:function(){function a(a,b){return Math.min(a,b)+"_"+Math.max(a,b)}function b(a,b,c){a[b]===
void 0?(a[b]={set:{},array:[]},a[b].set[c]=1,a[b].array.push(c)):a[b].set[c]===void 0&&(a[b].set[c]=1,a[b].array.push(c))}var c,d,f,g,e,h={};c=0;for(d=this.faces.length;c<d;c++)e=this.faces[c],e instanceof THREE.Face3?(f=a(e.a,e.b),b(h,f,c),f=a(e.b,e.c),b(h,f,c),f=a(e.a,e.c),b(h,f,c)):e instanceof THREE.Face4&&(f=a(e.b,e.d),b(h,f,c),f=a(e.a,e.b),b(h,f,c),f=a(e.a,e.d),b(h,f,c),f=a(e.b,e.c),b(h,f,c),f=a(e.c,e.d),b(h,f,c));c=0;for(d=this.edges.length;c<d;c++){e=this.edges[c];f=e.vertexIndices[0];g=e.vertexIndices[1];
@@ -104,42 +104,42 @@ b,c)};THREE.Bone.prototype.addChild=function(a){if(this.children.indexOf(a)===-1
THREE.Scene.prototype.supr=THREE.Object3D.prototype;THREE.Scene.prototype.addChild=function(a){this.supr.addChild.call(this,a);this.addChildRecurse(a)};THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1)this.objects.push(a),this.__objectsAdded.push(a);for(var b=0;b<a.children.length;b++)this.addChildRecurse(a.children[b])};
THREE.Scene.prototype.removeChild=function(a){this.supr.removeChild.call(this,a);this.removeChildRecurse(a)};THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else a instanceof THREE.Camera||(b=this.objects.indexOf(a),b!==-1&&(this.objects.splice(b,1),this.__objectsRemoved.push(a)));for(b=0;b<a.children.length;b++)this.removeChildRecurse(a.children[b])};THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;
THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;
-THREE.Projector=function(){function a(){var a=i[h]=i[h]||new THREE.RenderableVertex;h++;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,g=[],e,h,i=[],l,m,j=[],n,o=[],k,q,v=[],s,J,N=[],x=new THREE.Vector4,B=new THREE.Vector4,
+THREE.Projector=function(){function a(){var a=i[h]=i[h]||new THREE.RenderableVertex;h++;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,g=[],e,h,i=[],l,m,n=[],j,o=[],k,q,v=[],s,J,N=[],x=new THREE.Vector4,B=new THREE.Vector4,
p=new THREE.Matrix4,O=new THREE.Matrix4,r=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],u=new THREE.Vector4,y=new THREE.Vector4;this.projectVector=function(a,b){p.multiply(b.projectionMatrix,b.matrixWorldInverse);p.multiplyVector3(a);return a};this.unprojectVector=function(a,b){p.multiply(b.matrixWorld,THREE.Matrix4.makeInvert(b.projectionMatrix));p.multiplyVector3(a);return a};this.projectObjects=function(a,c,e){var c=[],h,l,k;f=0;l=
-a.objects;a=0;for(h=l.length;a<h;a++){k=l[a];var i;if(!(i=!k.visible))if(i=k instanceof THREE.Mesh){a:{i=void 0;for(var m=k.matrixWorld,n=-k.geometry.boundingSphere.radius*Math.max(k.scale.x,Math.max(k.scale.y,k.scale.z)),j=0;j<6;j++)if(i=r[j].x*m.n14+r[j].y*m.n24+r[j].z*m.n34+r[j].w,i<=n){i=!1;break a}i=!0}i=!i}if(!i)i=g[f]=g[f]||new THREE.RenderableObject,f++,d=i,x.copy(k.position),p.multiplyVector3(x),d.object=k,d.z=x.z,c.push(d)}e&&c.sort(b);return c};this.projectScene=function(d,f,g){var C=[],
-F=f.near,L=f.far,D,G,z,P,w,M,K,S,x,t,H,E,I,T,W,ca,X;J=q=n=m=0;f.matrixAutoUpdate&&f.update(void 0,!0);d.update(void 0,!1,f);p.multiply(f.projectionMatrix,f.matrixWorldInverse);r[0].set(p.n41-p.n11,p.n42-p.n12,p.n43-p.n13,p.n44-p.n14);r[1].set(p.n41+p.n11,p.n42+p.n12,p.n43+p.n13,p.n44+p.n14);r[2].set(p.n41+p.n21,p.n42+p.n22,p.n43+p.n23,p.n44+p.n24);r[3].set(p.n41-p.n21,p.n42-p.n22,p.n43-p.n23,p.n44-p.n24);r[4].set(p.n41-p.n31,p.n42-p.n32,p.n43-p.n33,p.n44-p.n34);r[5].set(p.n41+p.n31,p.n42+p.n32,p.n43+
-p.n33,p.n44+p.n34);for(D=0;D<6;D++)x=r[D],x.divideScalar(Math.sqrt(x.x*x.x+x.y*x.y+x.z*x.z));x=this.projectObjects(d,f,!0);d=0;for(D=x.length;d<D;d++)if(t=x[d].object,t.visible)if(H=t.matrixWorld,E=t.matrixRotationWorld,I=t.materials,T=t.overdraw,h=0,t instanceof THREE.Mesh){W=t.geometry;P=W.vertices;ca=W.faces;W=W.faceVertexUvs;G=0;for(z=P.length;G<z;G++)e=a(),e.positionWorld.copy(P[G].position),H.multiplyVector3(e.positionWorld),e.positionScreen.copy(e.positionWorld),p.multiplyVector4(e.positionScreen),
-e.positionScreen.x/=e.positionScreen.w,e.positionScreen.y/=e.positionScreen.w,e.visible=e.positionScreen.z>F&&e.positionScreen.z<L;P=0;for(G=ca.length;P<G;P++){z=ca[P];if(z instanceof THREE.Face3)if(w=i[z.a],M=i[z.b],K=i[z.c],w.visible&&M.visible&&K.visible&&(t.doubleSided||t.flipSided!=(K.positionScreen.x-w.positionScreen.x)*(M.positionScreen.y-w.positionScreen.y)-(K.positionScreen.y-w.positionScreen.y)*(M.positionScreen.x-w.positionScreen.x)<0))S=j[m]=j[m]||new THREE.RenderableFace3,m++,l=S,l.v1.copy(w),
+a.objects;a=0;for(h=l.length;a<h;a++){k=l[a];var i;if(!(i=!k.visible))if(i=k instanceof THREE.Mesh){a:{i=void 0;for(var j=k.matrixWorld,m=-k.geometry.boundingSphere.radius*Math.max(k.scale.x,Math.max(k.scale.y,k.scale.z)),n=0;n<6;n++)if(i=r[n].x*j.n14+r[n].y*j.n24+r[n].z*j.n34+r[n].w,i<=m){i=!1;break a}i=!0}i=!i}if(!i)i=g[f]=g[f]||new THREE.RenderableObject,f++,d=i,x.copy(k.position),p.multiplyVector3(x),d.object=k,d.z=x.z,c.push(d)}e&&c.sort(b);return c};this.projectScene=function(d,f,g){var C=[],
+F=f.near,L=f.far,D,G,z,P,w,M,K,S,x,t,H,E,I,T,W,da,X;J=q=j=m=0;f.matrixAutoUpdate&&f.update(void 0,!0);d.update(void 0,!1,f);p.multiply(f.projectionMatrix,f.matrixWorldInverse);r[0].set(p.n41-p.n11,p.n42-p.n12,p.n43-p.n13,p.n44-p.n14);r[1].set(p.n41+p.n11,p.n42+p.n12,p.n43+p.n13,p.n44+p.n14);r[2].set(p.n41+p.n21,p.n42+p.n22,p.n43+p.n23,p.n44+p.n24);r[3].set(p.n41-p.n21,p.n42-p.n22,p.n43-p.n23,p.n44-p.n24);r[4].set(p.n41-p.n31,p.n42-p.n32,p.n43-p.n33,p.n44-p.n34);r[5].set(p.n41+p.n31,p.n42+p.n32,p.n43+
+p.n33,p.n44+p.n34);for(D=0;D<6;D++)x=r[D],x.divideScalar(Math.sqrt(x.x*x.x+x.y*x.y+x.z*x.z));x=this.projectObjects(d,f,!0);d=0;for(D=x.length;d<D;d++)if(t=x[d].object,t.visible)if(H=t.matrixWorld,E=t.matrixRotationWorld,I=t.materials,T=t.overdraw,h=0,t instanceof THREE.Mesh){W=t.geometry;P=W.vertices;da=W.faces;W=W.faceVertexUvs;G=0;for(z=P.length;G<z;G++)e=a(),e.positionWorld.copy(P[G].position),H.multiplyVector3(e.positionWorld),e.positionScreen.copy(e.positionWorld),p.multiplyVector4(e.positionScreen),
+e.positionScreen.x/=e.positionScreen.w,e.positionScreen.y/=e.positionScreen.w,e.visible=e.positionScreen.z>F&&e.positionScreen.z<L;P=0;for(G=da.length;P<G;P++){z=da[P];if(z instanceof THREE.Face3)if(w=i[z.a],M=i[z.b],K=i[z.c],w.visible&&M.visible&&K.visible&&(t.doubleSided||t.flipSided!=(K.positionScreen.x-w.positionScreen.x)*(M.positionScreen.y-w.positionScreen.y)-(K.positionScreen.y-w.positionScreen.y)*(M.positionScreen.x-w.positionScreen.x)<0))S=n[m]=n[m]||new THREE.RenderableFace3,m++,l=S,l.v1.copy(w),
l.v2.copy(M),l.v3.copy(K);else continue;else if(z instanceof THREE.Face4)if(w=i[z.a],M=i[z.b],K=i[z.c],S=i[z.d],w.visible&&M.visible&&K.visible&&S.visible&&(t.doubleSided||t.flipSided!=((S.positionScreen.x-w.positionScreen.x)*(M.positionScreen.y-w.positionScreen.y)-(S.positionScreen.y-w.positionScreen.y)*(M.positionScreen.x-w.positionScreen.x)<0||(M.positionScreen.x-K.positionScreen.x)*(S.positionScreen.y-K.positionScreen.y)-(M.positionScreen.y-K.positionScreen.y)*(S.positionScreen.x-K.positionScreen.x)<
-0)))X=o[n]=o[n]||new THREE.RenderableFace4,n++,l=X,l.v1.copy(w),l.v2.copy(M),l.v3.copy(K),l.v4.copy(S);else continue;l.normalWorld.copy(z.normal);E.multiplyVector3(l.normalWorld);l.centroidWorld.copy(z.centroid);H.multiplyVector3(l.centroidWorld);l.centroidScreen.copy(l.centroidWorld);p.multiplyVector3(l.centroidScreen);K=z.vertexNormals;w=0;for(M=K.length;w<M;w++)S=l.vertexNormalsWorld[w],S.copy(K[w]),E.multiplyVector3(S);w=0;for(M=W.length;w<M;w++)if(X=W[w][P]){K=0;for(S=X.length;K<S;K++)l.uvs[w][K]=
+0)))X=o[j]=o[j]||new THREE.RenderableFace4,j++,l=X,l.v1.copy(w),l.v2.copy(M),l.v3.copy(K),l.v4.copy(S);else continue;l.normalWorld.copy(z.normal);E.multiplyVector3(l.normalWorld);l.centroidWorld.copy(z.centroid);H.multiplyVector3(l.centroidWorld);l.centroidScreen.copy(l.centroidWorld);p.multiplyVector3(l.centroidScreen);K=z.vertexNormals;w=0;for(M=K.length;w<M;w++)S=l.vertexNormalsWorld[w],S.copy(K[w]),E.multiplyVector3(S);w=0;for(M=W.length;w<M;w++)if(X=W[w][P]){K=0;for(S=X.length;K<S;K++)l.uvs[w][K]=
X[K]}l.meshMaterials=I;l.faceMaterials=z.materials;l.overdraw=T;l.z=l.centroidScreen.z;C.push(l)}}else if(t instanceof THREE.Line){O.multiply(p,H);P=t.geometry.vertices;w=a();w.positionScreen.copy(P[0].position);O.multiplyVector4(w.positionScreen);G=1;for(z=P.length;G<z;G++)if(w=a(),w.positionScreen.copy(P[G].position),O.multiplyVector4(w.positionScreen),M=i[h-2],u.copy(w.positionScreen),y.copy(M.positionScreen),c(u,y))u.multiplyScalar(1/u.w),y.multiplyScalar(1/y.w),H=v[q]=v[q]||new THREE.RenderableLine,
q++,k=H,k.v1.positionScreen.copy(u),k.v2.positionScreen.copy(y),k.z=Math.max(u.z,y.z),k.materials=t.materials,C.push(k)}else if(t instanceof THREE.Particle&&(B.set(t.matrixWorld.n14,t.matrixWorld.n24,t.matrixWorld.n34,1),p.multiplyVector4(B),B.z/=B.w,B.z>0&&B.z<1))H=N[J]=N[J]||new THREE.RenderableParticle,J++,s=H,s.x=B.x/B.w,s.y=B.y/B.w,s.z=B.z,s.rotation=t.rotation.z,s.scale.x=t.scale.x*Math.abs(s.x-(B.x+f.projectionMatrix.n11)/(B.w+f.projectionMatrix.n14)),s.scale.y=t.scale.y*Math.abs(s.y-(B.y+
f.projectionMatrix.n22)/(B.w+f.projectionMatrix.n24)),s.materials=t.materials,C.push(s);g&&C.sort(b);return C}};
THREE.CanvasRenderer=function(a){function b(a){if(s!=a)k.globalAlpha=s=a}function c(a){if(J!=a){switch(a){case THREE.NormalBlending:k.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:k.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:k.globalCompositeOperation="darker"}J=a}}function d(a){if(N!=a.hex)N=a.hex,k.strokeStyle="#"+g(N.toString(16))}function f(a){if(x!=a.hex)x=a.hex,k.fillStyle="#"+g(x.toString(16))}function g(a){for(;a.length<6;)a="0"+a;return a}
-var e=this,h=null,i=new THREE.Projector,a=a||{},l=a.canvas!==void 0?a.canvas:document.createElement("canvas"),m,j,n,o,k=l.getContext("2d"),q=new THREE.Color(0),v=0,s=1,J=0,N=null,x=null,B=null,p=null,O=null,r,u,y,R,$=new THREE.RenderableVertex,Z=new THREE.RenderableVertex,C,F,L,D,G,z,P,w,M,K,S,oa,t=new THREE.Color(0),H=new THREE.Color(0),E=new THREE.Color(0),I=new THREE.Color(0),T=new THREE.Color(0),W,ca,X,aa,Ba,Ca,Da,Ea,Fa,Ga,ka=new THREE.Rectangle,da=new THREE.Rectangle,V=new THREE.Rectangle,ya=
-!1,ba=new THREE.Color,Y=new THREE.Color,sa=new THREE.Color,ta=new THREE.Color,Q=new THREE.Vector3,pa,qa,za,ea,ra,ua,a=16;pa=document.createElement("canvas");pa.width=pa.height=2;qa=pa.getContext("2d");qa.fillStyle="rgba(0,0,0,1)";qa.fillRect(0,0,2,2);za=qa.getImageData(0,0,2,2);ea=za.data;ra=document.createElement("canvas");ra.width=ra.height=a;ua=ra.getContext("2d");ua.translate(-a/2,-a/2);ua.scale(a,a);a--;this.domElement=l;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,
-faces:0};this.setSize=function(a,b){m=a;j=b;n=m/2;o=j/2;l.width=m;l.height=j;ka.set(-n,-o,n,o);s=1;J=0;O=p=B=x=N=null};this.setClearColor=function(a,b){q=a;v=b};this.setClearColorHex=function(a,b){q.setHex(a);v=b};this.clear=function(){k.setTransform(1,0,0,-1,n,o);if(!da.isEmpty())da.inflate(1),da.minSelf(ka),q.hex==0&&v==0?k.clearRect(da.getX(),da.getY(),da.getWidth(),da.getHeight()):(c(THREE.NormalBlending),b(1),k.fillStyle="rgba("+Math.floor(q.r*255)+","+Math.floor(q.g*255)+","+Math.floor(q.b*
-255)+","+v+")",k.fillRect(da.getX(),da.getY(),da.getWidth(),da.getHeight())),da.empty()};this.render=function(a,g){function l(a){var b,c,d,f=a.lights;Y.setRGB(0,0,0);sa.setRGB(0,0,0);ta.setRGB(0,0,0);a=0;for(b=f.length;a<b;a++)c=f[a],d=c.color,c instanceof THREE.AmbientLight?(Y.r+=d.r,Y.g+=d.g,Y.b+=d.b):c instanceof THREE.DirectionalLight?(sa.r+=d.r,sa.g+=d.g,sa.b+=d.b):c instanceof THREE.PointLight&&(ta.r+=d.r,ta.g+=d.g,ta.b+=d.b)}function m(a,b,c,d){var f,e,g,h,l=a.lights,a=0;for(f=l.length;a<f;a++)e=
-l[a],g=e.color,e instanceof THREE.DirectionalLight?(h=c.dot(e.position),h<=0||(h*=e.intensity,d.r+=g.r*h,d.g+=g.g*h,d.b+=g.b*h)):e instanceof THREE.PointLight&&(h=c.dot(Q.sub(e.position,b).normalize()),h<=0||(h*=e.distance==0?1:1-Math.min(b.distanceTo(e.position)/e.distance,1),h!=0&&(h*=e.intensity,d.r+=g.r*h,d.g+=g.g*h,d.b+=g.b*h)))}function j(a,e,g){b(g.opacity);c(g.blending);var h,l,i,m,Aa,p;if(g instanceof THREE.ParticleBasicMaterial){if(g.map)m=g.map.image,Aa=m.width>>1,p=m.height>>1,g=e.scale.x*
-n,i=e.scale.y*o,h=g*Aa,l=i*p,V.set(a.x-h,a.y-l,a.x+h,a.y+l),ka.instersects(V)&&(k.save(),k.translate(a.x,a.y),k.rotate(-e.rotation),k.scale(g,-i),k.translate(-Aa,-p),k.drawImage(m,0,0),k.restore())}else g instanceof THREE.ParticleCanvasMaterial&&(h=e.scale.x*n,l=e.scale.y*o,V.set(a.x-h,a.y-l,a.x+h,a.y+l),ka.instersects(V)&&(d(g.color),f(g.color),k.save(),k.translate(a.x,a.y),k.rotate(-e.rotation),k.scale(h,l),g.program(k),k.restore()))}function q(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(B!=a)k.lineWidth=B=a;a=g.linecap;if(p!=a)k.lineCap=p=a;a=g.linejoin;if(O!=a)k.lineJoin=O=a;d(g.color);k.stroke();V.inflate(g.linewidth*2)}}function s(a,d,f,h,l,i,k,j,n){e.data.vertices+=3;e.data.faces++;b(j.opacity);c(j.blending);C=a.positionScreen.x;F=a.positionScreen.y;L=d.positionScreen.x;D=d.positionScreen.y;G=f.positionScreen.x;
-z=f.positionScreen.y;x(C,F,L,D,G,z);if(j instanceof THREE.MeshBasicMaterial)if(j.map)j.map.mapping instanceof THREE.UVMapping&&(aa=k.uvs[0],ga(C,F,L,D,G,z,j.map.image,aa[h].u,aa[h].v,aa[l].u,aa[l].v,aa[i].u,aa[i].v));else if(j.envMap){if(j.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=g.matrixWorldInverse,Q.copy(k.vertexNormalsWorld[0]),Ba=(Q.x*a.n11+Q.y*a.n12+Q.z*a.n13)*0.5+0.5,Ca=-(Q.x*a.n21+Q.y*a.n22+Q.z*a.n23)*0.5+0.5,Q.copy(k.vertexNormalsWorld[1]),Da=(Q.x*a.n11+Q.y*a.n12+Q.z*
-a.n13)*0.5+0.5,Ea=-(Q.x*a.n21+Q.y*a.n22+Q.z*a.n23)*0.5+0.5,Q.copy(k.vertexNormalsWorld[2]),Fa=(Q.x*a.n11+Q.y*a.n12+Q.z*a.n13)*0.5+0.5,Ga=-(Q.x*a.n21+Q.y*a.n22+Q.z*a.n23)*0.5+0.5,ga(C,F,L,D,G,z,j.envMap.image,Ba,Ca,Da,Ea,Fa,Ga)}else j.wireframe?J(j.color,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):ha(j.color);else if(j instanceof THREE.MeshLambertMaterial)j.map&&!j.wireframe&&(j.map.mapping instanceof THREE.UVMapping&&(aa=k.uvs[0],ga(C,F,L,D,G,z,j.map.image,aa[h].u,aa[h].v,aa[l].u,
-aa[l].v,aa[i].u,aa[i].v)),c(THREE.SubtractiveBlending)),ya?!j.wireframe&&j.shading==THREE.SmoothShading&&k.vertexNormalsWorld.length==3?(H.r=E.r=I.r=Y.r,H.g=E.g=I.g=Y.g,H.b=E.b=I.b=Y.b,m(n,k.v1.positionWorld,k.vertexNormalsWorld[0],H),m(n,k.v2.positionWorld,k.vertexNormalsWorld[1],E),m(n,k.v3.positionWorld,k.vertexNormalsWorld[2],I),T.r=(E.r+I.r)*0.5,T.g=(E.g+I.g)*0.5,T.b=(E.b+I.b)*0.5,X=va(H,E,I,T),ga(C,F,L,D,G,z,X,0,0,1,0,0,1)):(ba.r=Y.r,ba.g=Y.g,ba.b=Y.b,m(n,k.centroidWorld,k.normalWorld,ba),t.r=
-Math.max(0,Math.min(j.color.r*ba.r,1)),t.g=Math.max(0,Math.min(j.color.g*ba.g,1)),t.b=Math.max(0,Math.min(j.color.b*ba.b,1)),t.updateHex(),j.wireframe?J(t,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):ha(t)):j.wireframe?J(j.color,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):ha(j.color);else if(j instanceof THREE.MeshDepthMaterial)W=g.near,ca=g.far,H.r=H.g=H.b=1-la(a.positionScreen.z,W,ca),E.r=E.g=E.b=1-la(d.positionScreen.z,W,ca),I.r=I.g=I.b=1-la(f.positionScreen.z,
-W,ca),T.r=(E.r+I.r)*0.5,T.g=(E.g+I.g)*0.5,T.b=(E.b+I.b)*0.5,X=va(H,E,I,T),ga(C,F,L,D,G,z,X,0,0,1,0,0,1);else if(j instanceof THREE.MeshNormalMaterial)t.r=ma(k.normalWorld.x),t.g=ma(k.normalWorld.y),t.b=ma(k.normalWorld.z),t.updateHex(),j.wireframe?J(t,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):ha(t)}function v(a,d,f,h,j,l,k,i,n){e.data.vertices+=4;e.data.faces++;b(i.opacity);c(i.blending);if(i.map||i.envMap)s(a,d,h,0,1,3,k,i,n),s(j,f,l,1,2,3,k,i,n);else if(C=a.positionScreen.x,F=
+var e=this,h=null,i=new THREE.Projector,a=a||{},l=a.canvas!==void 0?a.canvas:document.createElement("canvas"),m,n,j,o,k=l.getContext("2d"),q=new THREE.Color(0),v=0,s=1,J=0,N=null,x=null,B=null,p=null,O=null,r,u,y,R,aa=new THREE.RenderableVertex,$=new THREE.RenderableVertex,C,F,L,D,G,z,P,w,M,K,S,oa,t=new THREE.Color(0),H=new THREE.Color(0),E=new THREE.Color(0),I=new THREE.Color(0),T=new THREE.Color(0),W,da,X,ba,Ba,Ca,Da,Ea,Fa,Ga,ka=new THREE.Rectangle,Y=new THREE.Rectangle,V=new THREE.Rectangle,ya=
+!1,ca=new THREE.Color,Z=new THREE.Color,sa=new THREE.Color,ta=new THREE.Color,Q=new THREE.Vector3,pa,qa,za,ea,ra,ua,a=16;pa=document.createElement("canvas");pa.width=pa.height=2;qa=pa.getContext("2d");qa.fillStyle="rgba(0,0,0,1)";qa.fillRect(0,0,2,2);za=qa.getImageData(0,0,2,2);ea=za.data;ra=document.createElement("canvas");ra.width=ra.height=a;ua=ra.getContext("2d");ua.translate(-a/2,-a/2);ua.scale(a,a);a--;this.domElement=l;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,
+faces:0};this.setSize=function(a,b){m=a;n=b;j=m/2;o=n/2;l.width=m;l.height=n;ka.set(-j,-o,j,o);Y.set(-j,-o,j,o);s=1;J=0;O=p=B=x=N=null};this.setClearColor=function(a,b){q=a;v=b;Y.set(-j,-o,j,o)};this.setClearColorHex=function(a,b){q.setHex(a);v=b;Y.set(-j,-o,j,o)};this.clear=function(){k.setTransform(1,0,0,-1,j,o);if(!Y.isEmpty())Y.inflate(1),Y.minSelf(ka),q.hex==0&&v==0?k.clearRect(Y.getX(),Y.getY(),Y.getWidth(),Y.getHeight()):(c(THREE.NormalBlending),b(1),k.fillStyle="rgba("+Math.floor(q.r*255)+
+","+Math.floor(q.g*255)+","+Math.floor(q.b*255)+","+v+")",k.fillRect(Y.getX(),Y.getY(),Y.getWidth(),Y.getHeight())),Y.empty()};this.render=function(a,g){function l(a){var b,c,d,f=a.lights;Z.setRGB(0,0,0);sa.setRGB(0,0,0);ta.setRGB(0,0,0);a=0;for(b=f.length;a<b;a++)c=f[a],d=c.color,c instanceof THREE.AmbientLight?(Z.r+=d.r,Z.g+=d.g,Z.b+=d.b):c instanceof THREE.DirectionalLight?(sa.r+=d.r,sa.g+=d.g,sa.b+=d.b):c instanceof THREE.PointLight&&(ta.r+=d.r,ta.g+=d.g,ta.b+=d.b)}function m(a,b,c,d){var f,e,
+g,h,l=a.lights,a=0;for(f=l.length;a<f;a++)e=l[a],g=e.color,e instanceof THREE.DirectionalLight?(h=c.dot(e.position),h<=0||(h*=e.intensity,d.r+=g.r*h,d.g+=g.g*h,d.b+=g.b*h)):e instanceof THREE.PointLight&&(h=c.dot(Q.sub(e.position,b).normalize()),h<=0||(h*=e.distance==0?1:1-Math.min(b.distanceTo(e.position)/e.distance,1),h!=0&&(h*=e.intensity,d.r+=g.r*h,d.g+=g.g*h,d.b+=g.b*h)))}function n(a,e,g){b(g.opacity);c(g.blending);var h,l,i,m,Aa,p;if(g instanceof THREE.ParticleBasicMaterial){if(g.map)m=g.map.image,
+Aa=m.width>>1,p=m.height>>1,g=e.scale.x*j,i=e.scale.y*o,h=g*Aa,l=i*p,V.set(a.x-h,a.y-l,a.x+h,a.y+l),ka.instersects(V)&&(k.save(),k.translate(a.x,a.y),k.rotate(-e.rotation),k.scale(g,-i),k.translate(-Aa,-p),k.drawImage(m,0,0),k.restore())}else g instanceof THREE.ParticleCanvasMaterial&&(h=e.scale.x*j,l=e.scale.y*o,V.set(a.x-h,a.y-l,a.x+h,a.y+l),ka.instersects(V)&&(d(g.color),f(g.color),k.save(),k.translate(a.x,a.y),k.rotate(-e.rotation),k.scale(h,l),g.program(k),k.restore()))}function q(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(B!=a)k.lineWidth=B=a;a=g.linecap;if(p!=a)k.lineCap=p=a;a=g.linejoin;if(O!=a)k.lineJoin=O=a;d(g.color);k.stroke();V.inflate(g.linewidth*2)}}function s(a,d,f,h,l,i,k,j,n){e.data.vertices+=3;e.data.faces++;b(j.opacity);c(j.blending);C=a.positionScreen.x;F=a.positionScreen.y;L=d.positionScreen.x;D=d.positionScreen.y;
+G=f.positionScreen.x;z=f.positionScreen.y;x(C,F,L,D,G,z);if(j instanceof THREE.MeshBasicMaterial)if(j.map)j.map.mapping instanceof THREE.UVMapping&&(ba=k.uvs[0],ga(C,F,L,D,G,z,j.map.image,ba[h].u,ba[h].v,ba[l].u,ba[l].v,ba[i].u,ba[i].v));else if(j.envMap){if(j.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=g.matrixWorldInverse,Q.copy(k.vertexNormalsWorld[0]),Ba=(Q.x*a.n11+Q.y*a.n12+Q.z*a.n13)*0.5+0.5,Ca=-(Q.x*a.n21+Q.y*a.n22+Q.z*a.n23)*0.5+0.5,Q.copy(k.vertexNormalsWorld[1]),Da=(Q.x*
+a.n11+Q.y*a.n12+Q.z*a.n13)*0.5+0.5,Ea=-(Q.x*a.n21+Q.y*a.n22+Q.z*a.n23)*0.5+0.5,Q.copy(k.vertexNormalsWorld[2]),Fa=(Q.x*a.n11+Q.y*a.n12+Q.z*a.n13)*0.5+0.5,Ga=-(Q.x*a.n21+Q.y*a.n22+Q.z*a.n23)*0.5+0.5,ga(C,F,L,D,G,z,j.envMap.image,Ba,Ca,Da,Ea,Fa,Ga)}else j.wireframe?J(j.color,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):ha(j.color);else if(j instanceof THREE.MeshLambertMaterial)j.map&&!j.wireframe&&(j.map.mapping instanceof THREE.UVMapping&&(ba=k.uvs[0],ga(C,F,L,D,G,z,j.map.image,ba[h].u,
+ba[h].v,ba[l].u,ba[l].v,ba[i].u,ba[i].v)),c(THREE.SubtractiveBlending)),ya?!j.wireframe&&j.shading==THREE.SmoothShading&&k.vertexNormalsWorld.length==3?(H.r=E.r=I.r=Z.r,H.g=E.g=I.g=Z.g,H.b=E.b=I.b=Z.b,m(n,k.v1.positionWorld,k.vertexNormalsWorld[0],H),m(n,k.v2.positionWorld,k.vertexNormalsWorld[1],E),m(n,k.v3.positionWorld,k.vertexNormalsWorld[2],I),T.r=(E.r+I.r)*0.5,T.g=(E.g+I.g)*0.5,T.b=(E.b+I.b)*0.5,X=va(H,E,I,T),ga(C,F,L,D,G,z,X,0,0,1,0,0,1)):(ca.r=Z.r,ca.g=Z.g,ca.b=Z.b,m(n,k.centroidWorld,k.normalWorld,
+ca),t.r=Math.max(0,Math.min(j.color.r*ca.r,1)),t.g=Math.max(0,Math.min(j.color.g*ca.g,1)),t.b=Math.max(0,Math.min(j.color.b*ca.b,1)),t.updateHex(),j.wireframe?J(t,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):ha(t)):j.wireframe?J(j.color,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):ha(j.color);else if(j instanceof THREE.MeshDepthMaterial)W=g.near,da=g.far,H.r=H.g=H.b=1-la(a.positionScreen.z,W,da),E.r=E.g=E.b=1-la(d.positionScreen.z,W,da),I.r=I.g=I.b=1-la(f.positionScreen.z,
+W,da),T.r=(E.r+I.r)*0.5,T.g=(E.g+I.g)*0.5,T.b=(E.b+I.b)*0.5,X=va(H,E,I,T),ga(C,F,L,D,G,z,X,0,0,1,0,0,1);else if(j instanceof THREE.MeshNormalMaterial)t.r=ma(k.normalWorld.x),t.g=ma(k.normalWorld.y),t.b=ma(k.normalWorld.z),t.updateHex(),j.wireframe?J(t,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):ha(t)}function v(a,d,f,h,j,l,k,i,n){e.data.vertices+=4;e.data.faces++;b(i.opacity);c(i.blending);if(i.map||i.envMap)s(a,d,h,0,1,3,k,i,n),s(j,f,l,1,2,3,k,i,n);else if(C=a.positionScreen.x,F=
a.positionScreen.y,L=d.positionScreen.x,D=d.positionScreen.y,G=f.positionScreen.x,z=f.positionScreen.y,P=h.positionScreen.x,w=h.positionScreen.y,M=j.positionScreen.x,K=j.positionScreen.y,S=l.positionScreen.x,oa=l.positionScreen.y,i instanceof THREE.MeshBasicMaterial)N(C,F,L,D,G,z,P,w),i.wireframe?J(i.color,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):ha(i.color);else if(i instanceof THREE.MeshLambertMaterial)ya?!i.wireframe&&i.shading==THREE.SmoothShading&&k.vertexNormalsWorld.length==
-4?(H.r=E.r=I.r=T.r=Y.r,H.g=E.g=I.g=T.g=Y.g,H.b=E.b=I.b=T.b=Y.b,m(n,k.v1.positionWorld,k.vertexNormalsWorld[0],H),m(n,k.v2.positionWorld,k.vertexNormalsWorld[1],E),m(n,k.v4.positionWorld,k.vertexNormalsWorld[3],I),m(n,k.v3.positionWorld,k.vertexNormalsWorld[2],T),X=va(H,E,I,T),x(C,F,L,D,P,w),ga(C,F,L,D,P,w,X,0,0,1,0,0,1),x(M,K,G,z,S,oa),ga(M,K,G,z,S,oa,X,1,0,1,1,0,1)):(ba.r=Y.r,ba.g=Y.g,ba.b=Y.b,m(n,k.centroidWorld,k.normalWorld,ba),t.r=Math.max(0,Math.min(i.color.r*ba.r,1)),t.g=Math.max(0,Math.min(i.color.g*
-ba.g,1)),t.b=Math.max(0,Math.min(i.color.b*ba.b,1)),t.updateHex(),N(C,F,L,D,G,z,P,w),i.wireframe?J(t,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):ha(t)):(N(C,F,L,D,G,z,P,w),i.wireframe?J(i.color,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):ha(i.color));else if(i instanceof THREE.MeshNormalMaterial)t.r=ma(k.normalWorld.x),t.g=ma(k.normalWorld.y),t.b=ma(k.normalWorld.z),t.updateHex(),N(C,F,L,D,G,z,P,w),i.wireframe?J(t,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):
-ha(t);else if(i instanceof THREE.MeshDepthMaterial)W=g.near,ca=g.far,H.r=H.g=H.b=1-la(a.positionScreen.z,W,ca),E.r=E.g=E.b=1-la(d.positionScreen.z,W,ca),I.r=I.g=I.b=1-la(h.positionScreen.z,W,ca),T.r=T.g=T.b=1-la(f.positionScreen.z,W,ca),X=va(H,E,I,T),x(C,F,L,D,P,w),ga(C,F,L,D,P,w,X,0,0,1,0,0,1),x(M,K,G,z,S,oa),ga(M,K,G,z,S,oa,X,1,0,1,1,0,1)}function x(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 N(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 J(a,b,c,e){if(B!=b)k.lineWidth=B=b;if(p!=c)k.lineCap=p=c;if(O!=e)k.lineJoin=O=e;d(a);k.stroke();V.inflate(b*2)}function ha(a){f(a);k.fill()}function ga(a,b,c,d,e,f,g,h,i,j,l,m,n){var o,p;o=g.width-1;p=g.height-1;h*=o;i*=p;j*=o;l*=p;m*=o;n*=p;c-=a;d-=b;e-=a;f-=b;j-=h;l-=i;m-=h;n-=i;o=j*n-m*l;o!=0&&(p=1/o,o=(n*c-l*e)*p,l=(n*d-l*f)*p,c=(j*e-m*c)*p,d=(j*f-m*d)*p,a=a-o*h-c*i,b=b-l*h-d*i,k.save(),k.transform(o,l,c,d,a,b),
-k.clip(),k.drawImage(g,0,0),k.restore())}function va(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);ea[0]=e<0?0:e>255?255:e;ea[1]=f<0?0:f>255?255:f;ea[2]=a<0?0:a>255?255:a;ea[4]=g<0?0:g>255?255:g;ea[5]=h<0?0:h>255?255:h;ea[6]=b<0?0:b>255?255:b;ea[8]=i<0?0:i>255?255:i;ea[9]=j<0?0:j>255?255:j;ea[10]=c<0?0:c>255?255:c;ea[12]=k<0?0:k>255?255:k;ea[13]=l<0?0:l>255?255:l;
-ea[14]=d<0?0:d>255?255:d;qa.putImageData(za,0,0);ua.drawImage(pa,0,0);return ra}function la(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function ma(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function ia(a,b){var c=b.x-a.x,d=b.y-a.y,e=1/Math.sqrt(c*c+d*d);c*=e;d*=e;b.x+=c;b.y+=d;a.x-=c;a.y-=d}var wa,Ha,A,fa,ja,na,xa,U;this.autoClear?this.clear():k.setTransform(1,0,0,-1,n,o);e.data.vertices=0;e.data.faces=0;h=i.projectScene(a,g,this.sortElements);(ya=a.lights.length>0)&&l(a);wa=0;for(Ha=h.length;wa<Ha;wa++){A=
-h[wa];V.empty();if(A instanceof THREE.RenderableParticle){r=A;r.x*=n;r.y*=o;fa=0;for(ja=A.materials.length;fa<ja;)U=A.materials[fa++],U.opacity!=0&&j(r,A,U,a)}else if(A instanceof THREE.RenderableLine){if(r=A.v1,u=A.v2,r.positionScreen.x*=n,r.positionScreen.y*=o,u.positionScreen.x*=n,u.positionScreen.y*=o,V.addPoint(r.positionScreen.x,r.positionScreen.y),V.addPoint(u.positionScreen.x,u.positionScreen.y),ka.instersects(V)){fa=0;for(ja=A.materials.length;fa<ja;)U=A.materials[fa++],U.opacity!=0&&q(r,
-u,A,U,a)}}else if(A instanceof THREE.RenderableFace3){if(r=A.v1,u=A.v2,y=A.v3,r.positionScreen.x*=n,r.positionScreen.y*=o,u.positionScreen.x*=n,u.positionScreen.y*=o,y.positionScreen.x*=n,y.positionScreen.y*=o,A.overdraw&&(ia(r.positionScreen,u.positionScreen),ia(u.positionScreen,y.positionScreen),ia(y.positionScreen,r.positionScreen)),V.add3Points(r.positionScreen.x,r.positionScreen.y,u.positionScreen.x,u.positionScreen.y,y.positionScreen.x,y.positionScreen.y),ka.instersects(V)){fa=0;for(ja=A.meshMaterials.length;fa<
-ja;)if(U=A.meshMaterials[fa++],U instanceof THREE.MeshFaceMaterial){na=0;for(xa=A.faceMaterials.length;na<xa;)(U=A.faceMaterials[na++])&&U.opacity!=0&&s(r,u,y,0,1,2,A,U,a)}else U.opacity!=0&&s(r,u,y,0,1,2,A,U,a)}}else if(A instanceof THREE.RenderableFace4&&(r=A.v1,u=A.v2,y=A.v3,R=A.v4,r.positionScreen.x*=n,r.positionScreen.y*=o,u.positionScreen.x*=n,u.positionScreen.y*=o,y.positionScreen.x*=n,y.positionScreen.y*=o,R.positionScreen.x*=n,R.positionScreen.y*=o,$.positionScreen.copy(u.positionScreen),
-Z.positionScreen.copy(R.positionScreen),A.overdraw&&(ia(r.positionScreen,u.positionScreen),ia(u.positionScreen,R.positionScreen),ia(R.positionScreen,r.positionScreen),ia(y.positionScreen,$.positionScreen),ia(y.positionScreen,Z.positionScreen)),V.addPoint(r.positionScreen.x,r.positionScreen.y),V.addPoint(u.positionScreen.x,u.positionScreen.y),V.addPoint(y.positionScreen.x,y.positionScreen.y),V.addPoint(R.positionScreen.x,R.positionScreen.y),ka.instersects(V))){fa=0;for(ja=A.meshMaterials.length;fa<
-ja;)if(U=A.meshMaterials[fa++],U instanceof THREE.MeshFaceMaterial){na=0;for(xa=A.faceMaterials.length;na<xa;)(U=A.faceMaterials[na++])&&U.opacity!=0&&v(r,u,y,R,$,Z,A,U,a)}else U.opacity!=0&&v(r,u,y,R,$,Z,A,U,a)}da.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)};
+4?(H.r=E.r=I.r=T.r=Z.r,H.g=E.g=I.g=T.g=Z.g,H.b=E.b=I.b=T.b=Z.b,m(n,k.v1.positionWorld,k.vertexNormalsWorld[0],H),m(n,k.v2.positionWorld,k.vertexNormalsWorld[1],E),m(n,k.v4.positionWorld,k.vertexNormalsWorld[3],I),m(n,k.v3.positionWorld,k.vertexNormalsWorld[2],T),X=va(H,E,I,T),x(C,F,L,D,P,w),ga(C,F,L,D,P,w,X,0,0,1,0,0,1),x(M,K,G,z,S,oa),ga(M,K,G,z,S,oa,X,1,0,1,1,0,1)):(ca.r=Z.r,ca.g=Z.g,ca.b=Z.b,m(n,k.centroidWorld,k.normalWorld,ca),t.r=Math.max(0,Math.min(i.color.r*ca.r,1)),t.g=Math.max(0,Math.min(i.color.g*
+ca.g,1)),t.b=Math.max(0,Math.min(i.color.b*ca.b,1)),t.updateHex(),N(C,F,L,D,G,z,P,w),i.wireframe?J(t,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):ha(t)):(N(C,F,L,D,G,z,P,w),i.wireframe?J(i.color,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):ha(i.color));else if(i instanceof THREE.MeshNormalMaterial)t.r=ma(k.normalWorld.x),t.g=ma(k.normalWorld.y),t.b=ma(k.normalWorld.z),t.updateHex(),N(C,F,L,D,G,z,P,w),i.wireframe?J(t,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):
+ha(t);else if(i instanceof THREE.MeshDepthMaterial)W=g.near,da=g.far,H.r=H.g=H.b=1-la(a.positionScreen.z,W,da),E.r=E.g=E.b=1-la(d.positionScreen.z,W,da),I.r=I.g=I.b=1-la(h.positionScreen.z,W,da),T.r=T.g=T.b=1-la(f.positionScreen.z,W,da),X=va(H,E,I,T),x(C,F,L,D,P,w),ga(C,F,L,D,P,w,X,0,0,1,0,0,1),x(M,K,G,z,S,oa),ga(M,K,G,z,S,oa,X,1,0,1,1,0,1)}function x(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 N(a,b