Răsfoiți Sursa

Added drawCalls property to WebGLRenderer::data object.

Mr.doob 14 ani în urmă
părinte
comite
e457b4f8ae

+ 152 - 152
build/Three.js

@@ -24,7 +24,7 @@ THREE.Matrix4.prototype={set:function(b,d,c,f,g,h,j,k,m,o,p,t,y,u,A,F){this.n11=
 g=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;h.sub(b,d).normalize();if(h.length()===0)h.z=1;f.cross(c,h).normalize();if(f.length()===0){h.x+=1.0E-4;f.cross(c,h).normalize()}g.cross(h,f).normalize();this.n11=f.x;this.n12=g.x;this.n13=h.x;this.n21=f.y;this.n22=g.y;this.n23=h.y;this.n31=f.z;this.n32=g.z;this.n33=h.z;return this},multiplyVector3:function(b){var d=b.x,c=b.y,f=b.z,g=1/(this.n41*d+this.n42*c+this.n43*f+this.n44);b.x=(this.n11*d+this.n12*c+this.n13*f+this.n14)*g;b.y=(this.n21*d+this.n22*c+this.n23*
 f+this.n24)*g;b.z=(this.n31*d+this.n32*c+this.n33*f+this.n34)*g;return b},multiplyVector4:function(b){var d=b.x,c=b.y,f=b.z,g=b.w;b.x=this.n11*d+this.n12*c+this.n13*f+this.n14*g;b.y=this.n21*d+this.n22*c+this.n23*f+this.n24*g;b.z=this.n31*d+this.n32*c+this.n33*f+this.n34*g;b.w=this.n41*d+this.n42*c+this.n43*f+this.n44*g;return b},rotateAxis:function(b){var d=b.x,c=b.y,f=b.z;b.x=d*this.n11+c*this.n12+f*this.n13;b.y=d*this.n21+c*this.n22+f*this.n23;b.z=d*this.n31+c*this.n32+f*this.n33;b.normalize();
 return b},crossVector:function(b){var d=new THREE.Vector4;d.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;d.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;d.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;d.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return d},multiply:function(b,d){var c=b.n11,f=b.n12,g=b.n13,h=b.n14,j=b.n21,k=b.n22,m=b.n23,o=b.n24,p=b.n31,t=b.n32,y=b.n33,u=b.n34,A=b.n41,F=b.n42,J=b.n43,B=b.n44,U=d.n11,C=d.n12,V=d.n13,O=d.n14,M=d.n21,va=d.n22,
-la=d.n23,qa=d.n24,fa=d.n31,ia=d.n32,e=d.n33,oa=d.n34;this.n11=c*U+f*M+g*fa;this.n12=c*C+f*va+g*ia;this.n13=c*V+f*la+g*e;this.n14=c*O+f*qa+g*oa+h;this.n21=j*U+k*M+m*fa;this.n22=j*C+k*va+m*ia;this.n23=j*V+k*la+m*e;this.n24=j*O+k*qa+m*oa+o;this.n31=p*U+t*M+y*fa;this.n32=p*C+t*va+y*ia;this.n33=p*V+t*la+y*e;this.n34=p*O+t*qa+y*oa+u;this.n41=A*U+F*M+J*fa;this.n42=A*C+F*va+J*ia;this.n43=A*V+F*la+J*e;this.n44=A*O+F*qa+J*oa+B;return this},multiplyToArray:function(b,d,c){this.multiply(b,d);c[0]=this.n11;c[1]=
+la=d.n23,qa=d.n24,ga=d.n31,ea=d.n32,e=d.n33,oa=d.n34;this.n11=c*U+f*M+g*ga;this.n12=c*C+f*va+g*ea;this.n13=c*V+f*la+g*e;this.n14=c*O+f*qa+g*oa+h;this.n21=j*U+k*M+m*ga;this.n22=j*C+k*va+m*ea;this.n23=j*V+k*la+m*e;this.n24=j*O+k*qa+m*oa+o;this.n31=p*U+t*M+y*ga;this.n32=p*C+t*va+y*ea;this.n33=p*V+t*la+y*e;this.n34=p*O+t*qa+y*oa+u;this.n41=A*U+F*M+J*ga;this.n42=A*C+F*va+J*ea;this.n43=A*V+F*la+J*e;this.n44=A*O+F*qa+J*oa+B;return this},multiplyToArray:function(b,d,c){this.multiply(b,d);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(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=b;this.n23*=b;this.n24*=b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=
 b;return this},determinant:function(){var b=this.n11,d=this.n12,c=this.n13,f=this.n14,g=this.n21,h=this.n22,j=this.n23,k=this.n24,m=this.n31,o=this.n32,p=this.n33,t=this.n34,y=this.n41,u=this.n42,A=this.n43,F=this.n44;return f*j*o*y-c*k*o*y-f*h*p*y+d*k*p*y+c*h*t*y-d*j*t*y-f*j*m*u+c*k*m*u+f*g*p*u-b*k*p*u-c*g*t*u+b*j*t*u+f*h*m*A-d*k*m*A-f*g*o*A+b*k*o*A+d*g*t*A-b*h*t*A-c*h*m*F+d*j*m*F+c*g*o*F-b*j*o*F-d*g*p*F+b*h*p*F},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=
 this.n13;this.n13=b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32;b.n33=this.n33;b.n34=this.n34;b.n41=this.n41;b.n42=this.n42;b.n43=this.n43;b.n44=this.n44;return b},flatten:function(){this.flat[0]=
@@ -50,7 +50,7 @@ THREE.Quaternion.prototype={set:function(b,d,c,f){this.x=b;this.y=d;this.z=c;thi
 b.y*f;this.z=b.z*f;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 b=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(b==0)this.w=this.z=this.y=this.x=0;else{b=1/b;this.x*=b;this.y*=b;this.z*=b;this.w*=b}return this},
 multiplySelf:function(b){var d=this.x,c=this.y,f=this.z,g=this.w,h=b.x,j=b.y,k=b.z;b=b.w;this.x=d*b+g*h+c*k-f*j;this.y=c*b+g*j+f*h-d*k;this.z=f*b+g*k+d*j-c*h;this.w=g*b-d*h-c*j-f*k;return this},multiply:function(b,d){this.x=b.x*d.w+b.y*d.z-b.z*d.y+b.w*d.x;this.y=-b.x*d.z+b.y*d.w+b.z*d.x+b.w*d.y;this.z=b.x*d.y-b.y*d.x+b.z*d.w+b.w*d.z;this.w=-b.x*d.x-b.y*d.y-b.z*d.z+b.w*d.w;return this},multiplyVector3:function(b,d){d||(d=b);var c=b.x,f=b.y,g=b.z,h=this.x,j=this.y,k=this.z,m=this.w,o=m*c+j*g-k*f,p=
 m*f+k*c-h*g,t=m*g+h*f-j*c;c=-h*c-j*f-k*g;d.x=o*m+c*-h+p*-k-t*-j;d.y=p*m+c*-j+t*-h-o*-k;d.z=t*m+c*-k+o*-j-p*-h;return d}};
-THREE.Quaternion.slerp=function(b,d,c,f){var g=b.w*d.w+b.x*d.x+b.y*d.y+b.z*d.z;if(Math.abs(g)>=1){c.w=b.w;c.x=b.x;c.y=b.y;c.z=b.z;return c}var h=Math.acos(g),j=Math.sqrt(1-g*g);if(Math.abs(j)<0.0010){c.w=0.5*(b.w+d.w);c.x=0.5*(b.x+d.x);c.y=0.5*(b.y+d.y);c.z=0.5*(b.z+d.z);return c}g=Math.sin((1-f)*h)/j;f=Math.sin(f*h)/j;c.w=b.w*g+d.w*f;c.x=b.x*g+d.x*f;c.y=b.y*g+d.y*f;c.z=b.z*g+d.z*f;return c};THREE.Vertex=function(b){this.position=b||new THREE.Vector3};
+THREE.Quaternion.slerp=function(b,d,c,f){var g=b.w*d.w+b.x*d.x+b.y*d.y+b.z*d.z;if(Math.abs(g)>=1){c.w=b.w;c.x=b.x;c.y=b.y;c.z=b.z;return c}var h=Math.acos(g),j=Math.sqrt(1-g*g);if(Math.abs(j)<0.001){c.w=0.5*(b.w+d.w);c.x=0.5*(b.x+d.x);c.y=0.5*(b.y+d.y);c.z=0.5*(b.z+d.z);return c}g=Math.sin((1-f)*h)/j;f=Math.sin(f*h)/j;c.w=b.w*g+d.w*f;c.x=b.x*g+d.x*f;c.y=b.y*g+d.y*f;c.z=b.z*g+d.z*f;return c};THREE.Vertex=function(b){this.position=b||new THREE.Vector3};
 THREE.Face3=function(b,d,c,f,g,h){this.a=b;this.b=d;this.c=c;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=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};
 THREE.Face4=function(b,d,c,f,g,h,j){this.a=b;this.b=d;this.c=c;this.d=f;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=j instanceof Array?j:[j];this.centroid=new THREE.Vector3};THREE.UV=function(b,d){this.set(b||0,d||0)};
 THREE.UV.prototype={set:function(b,d){this.u=b;this.v=d;return this},copy:function(b){this.set(b.u,b.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
@@ -58,9 +58,9 @@ THREE.Geometry.prototype={computeCentroids:function(){var b,d,c;b=0;for(d=this.f
 c.centroid.addSelf(this.vertices[c.d].position);c.centroid.divideScalar(4)}}},computeFaceNormals:function(b){var d,c,f,g,h,j,k=new THREE.Vector3,m=new THREE.Vector3;f=0;for(g=this.faces.length;f<g;f++){h=this.faces[f];if(b&&h.vertexNormals.length){k.set(0,0,0);d=0;for(c=h.vertexNormals.length;d<c;d++)k.addSelf(h.vertexNormals[d]);k.divideScalar(3)}else{d=this.vertices[h.a];c=this.vertices[h.b];j=this.vertices[h.c];k.sub(j.position,c.position);m.sub(d.position,c.position);k.crossSelf(m)}k.isZero()||
 k.normalize();h.normal.copy(k)}},computeVertexNormals:function(){var b,d,c,f;if(this.__tmpVertices==undefined){f=this.__tmpVertices=Array(this.vertices.length);b=0;for(d=this.vertices.length;b<d;b++)f[b]=new THREE.Vector3;b=0;for(d=this.faces.length;b<d;b++){c=this.faces[b];if(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{f=
 this.__tmpVertices;b=0;for(d=this.vertices.length;b<d;b++)f[b].set(0,0,0)}b=0;for(d=this.faces.length;b<d;b++){c=this.faces[b];if(c instanceof THREE.Face3){f[c.a].addSelf(c.normal);f[c.b].addSelf(c.normal);f[c.c].addSelf(c.normal)}else if(c instanceof THREE.Face4){f[c.a].addSelf(c.normal);f[c.b].addSelf(c.normal);f[c.c].addSelf(c.normal);f[c.d].addSelf(c.normal)}}b=0;for(d=this.vertices.length;b<d;b++)f[b].normalize();b=0;for(d=this.faces.length;b<d;b++){c=this.faces[b];if(c instanceof THREE.Face3){c.vertexNormals[0].copy(f[c.a]);
-c.vertexNormals[1].copy(f[c.b]);c.vertexNormals[2].copy(f[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(f[c.a]);c.vertexNormals[1].copy(f[c.b]);c.vertexNormals[2].copy(f[c.c]);c.vertexNormals[3].copy(f[c.d])}}},computeTangents:function(){function b(ea,wa,ta,pa,ca,ka,ma){k=ea.vertices[wa].position;m=ea.vertices[ta].position;o=ea.vertices[pa].position;p=j[ca];t=j[ka];y=j[ma];u=m.x-k.x;A=o.x-k.x;F=m.y-k.y;J=o.y-k.y;B=m.z-k.z;U=o.z-k.z;C=t.u-p.u;V=y.u-p.u;O=t.v-p.v;M=y.v-p.v;va=1/(C*
-M-V*O);ia.set((M*u-O*A)*va,(M*F-O*J)*va,(M*B-O*U)*va);e.set((C*A-V*u)*va,(C*J-V*F)*va,(C*U-V*B)*va);qa[wa].addSelf(ia);qa[ta].addSelf(ia);qa[pa].addSelf(ia);fa[wa].addSelf(e);fa[ta].addSelf(e);fa[pa].addSelf(e)}var d,c,f,g,h,j,k,m,o,p,t,y,u,A,F,J,B,U,C,V,O,M,va,la,qa=[],fa=[],ia=new THREE.Vector3,e=new THREE.Vector3,oa=new THREE.Vector3,Da=new THREE.Vector3,Aa=new THREE.Vector3;d=0;for(c=this.vertices.length;d<c;d++){qa[d]=new THREE.Vector3;fa[d]=new THREE.Vector3}d=0;for(c=this.faces.length;d<c;d++){h=
-this.faces[d];j=this.faceVertexUvs[0][d];if(h instanceof THREE.Face3)b(this,h.a,h.b,h.c,0,1,2);else if(h instanceof THREE.Face4){b(this,h.a,h.b,h.c,0,1,2);b(this,h.a,h.b,h.d,0,1,3)}}var da=["a","b","c","d"];d=0;for(c=this.faces.length;d<c;d++){h=this.faces[d];for(f=0;f<h.vertexNormals.length;f++){Aa.copy(h.vertexNormals[f]);g=h[da[f]];la=qa[g];oa.copy(la);oa.subSelf(Aa.multiplyScalar(Aa.dot(la))).normalize();Da.cross(h.vertexNormals[f],la);g=Da.dot(fa[g]);g=g<0?-1:1;h.vertexTangents[f]=new THREE.Vector4(oa.x,
+c.vertexNormals[1].copy(f[c.b]);c.vertexNormals[2].copy(f[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(f[c.a]);c.vertexNormals[1].copy(f[c.b]);c.vertexNormals[2].copy(f[c.c]);c.vertexNormals[3].copy(f[c.d])}}},computeTangents:function(){function b(fa,wa,ta,pa,ca,ka,ma){k=fa.vertices[wa].position;m=fa.vertices[ta].position;o=fa.vertices[pa].position;p=j[ca];t=j[ka];y=j[ma];u=m.x-k.x;A=o.x-k.x;F=m.y-k.y;J=o.y-k.y;B=m.z-k.z;U=o.z-k.z;C=t.u-p.u;V=y.u-p.u;O=t.v-p.v;M=y.v-p.v;va=1/(C*
+M-V*O);ea.set((M*u-O*A)*va,(M*F-O*J)*va,(M*B-O*U)*va);e.set((C*A-V*u)*va,(C*J-V*F)*va,(C*U-V*B)*va);qa[wa].addSelf(ea);qa[ta].addSelf(ea);qa[pa].addSelf(ea);ga[wa].addSelf(e);ga[ta].addSelf(e);ga[pa].addSelf(e)}var d,c,f,g,h,j,k,m,o,p,t,y,u,A,F,J,B,U,C,V,O,M,va,la,qa=[],ga=[],ea=new THREE.Vector3,e=new THREE.Vector3,oa=new THREE.Vector3,Da=new THREE.Vector3,Aa=new THREE.Vector3;d=0;for(c=this.vertices.length;d<c;d++){qa[d]=new THREE.Vector3;ga[d]=new THREE.Vector3}d=0;for(c=this.faces.length;d<c;d++){h=
+this.faces[d];j=this.faceVertexUvs[0][d];if(h instanceof THREE.Face3)b(this,h.a,h.b,h.c,0,1,2);else if(h instanceof THREE.Face4){b(this,h.a,h.b,h.c,0,1,2);b(this,h.a,h.b,h.d,0,1,3)}}var da=["a","b","c","d"];d=0;for(c=this.faces.length;d<c;d++){h=this.faces[d];for(f=0;f<h.vertexNormals.length;f++){Aa.copy(h.vertexNormals[f]);g=h[da[f]];la=qa[g];oa.copy(la);oa.subSelf(Aa.multiplyScalar(Aa.dot(la))).normalize();Da.cross(h.vertexNormals[f],la);g=Da.dot(ga[g]);g=g<0?-1:1;h.vertexTangents[f]=new THREE.Vector4(oa.x,
 oa.y,oa.z,g)}}this.hasTangents=!0},computeBoundingBox:function(){var b;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 d=1,c=this.vertices.length;d<c;d++){b=this.vertices[d];if(b.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=b.position.x;else if(b.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=b.position.x;
 if(b.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=b.position.y;else if(b.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=b.position.y;if(b.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=b.position.z;else if(b.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=this.boundingSphere===null?0:this.boundingSphere.radius,d=0,c=this.vertices.length;d<c;d++)b=Math.max(b,this.vertices[d].position.length());this.boundingSphere=
 {radius:b}},computeEdgeFaces:function(){function b(m,o){return Math.min(m,o)+"_"+Math.max(m,o)}function d(m,o,p){if(m[o]===undefined){m[o]={set:{},array:[]};m[o].set[p]=1;m[o].array.push(p)}else if(m[o].set[p]===undefined){m[o].set[p]=1;m[o].array.push(p)}}var c,f,g,h,j,k={};c=0;for(f=this.faces.length;c<f;c++){j=this.faces[c];if(j instanceof THREE.Face3){g=b(j.a,j.b);d(k,g,c);g=b(j.b,j.c);d(k,g,c);g=b(j.a,j.c);d(k,g,c)}else if(j instanceof THREE.Face4){g=b(j.b,j.d);d(k,g,c);g=b(j.a,j.b);d(k,g,c);
@@ -137,58 +137,58 @@ THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.c
 THREE.Scene.prototype.addChildRecurse=function(b){if(b instanceof THREE.Light)this.lights.indexOf(b)===-1&&this.lights.push(b);else if(b instanceof THREE.Sound)this.sounds.indexOf(b)===-1&&this.sounds.push(b);else if(!(b instanceof THREE.Camera||b instanceof THREE.Bone)&&this.objects.indexOf(b)===-1){this.objects.push(b);this.__objectsAdded.push(b)}for(var d=0;d<b.children.length;d++)this.addChildRecurse(b.children[d])};
 THREE.Scene.prototype.removeChild=function(b){this.supr.removeChild.call(this,b);this.removeChildRecurse(b)};THREE.Scene.prototype.removeChildRecurse=function(b){if(b instanceof THREE.Light){var d=this.lights.indexOf(b);d!==-1&&this.lights.splice(d,1)}else if(b instanceof THREE.Sound){d=this.sounds.indexOf(b);d!==-1&&this.sounds.splice(d,1)}else if(!(b instanceof THREE.Camera)){d=this.objects.indexOf(b);if(d!==-1){this.objects.splice(d,1);this.__objectsRemoved.push(b)}}for(d=0;d<b.children.length;d++)this.removeChildRecurse(b.children[d])};
 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.Fog=function(b,d,c){this.color=new THREE.Color(b);this.near=d||1;this.far=c||1E3};THREE.FogExp2=function(b,d){this.color=new THREE.Color(b);this.density=d!==undefined?d:2.5E-4};
-THREE.Projector=function(){function b(){var ia=m[k]=m[k]||new THREE.RenderableVertex;k++;return ia}function d(ia,e){return e.z-ia.z}function c(ia,e){var oa=0,Da=1,Aa=ia.z+ia.w,da=e.z+e.w,ea=-ia.z+ia.w,wa=-e.z+e.w;if(Aa>=0&&da>=0&&ea>=0&&wa>=0)return!0;else if(Aa<0&&da<0||ea<0&&wa<0)return!1;else{if(Aa<0)oa=Math.max(oa,Aa/(Aa-da));else da<0&&(Da=Math.min(Da,Aa/(Aa-da)));if(ea<0)oa=Math.max(oa,ea/(ea-wa));else wa<0&&(Da=Math.min(Da,ea/(ea-wa)));if(Da<oa)return!1;else{ia.lerpSelf(e,oa);e.lerpSelf(ia,
-1-Da);return!0}}}var f,g,h=[],j,k,m=[],o,p,t=[],y,u=[],A,F,J=[],B,U,C=[],V=new THREE.Vector4,O=new THREE.Vector4,M=new THREE.Matrix4,va=new THREE.Matrix4,la=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],qa=new THREE.Vector4,fa=new THREE.Vector4;this.projectVector=function(ia,e){M.multiply(e.projectionMatrix,e.matrixWorldInverse);M.multiplyVector3(ia);return ia};this.unprojectVector=function(ia,e){M.multiply(e.matrixWorld,THREE.Matrix4.makeInvert(e.projectionMatrix));
-M.multiplyVector3(ia);return ia};this.projectObjects=function(ia,e,oa){e=[];var Da,Aa,da;g=0;Aa=ia.objects;ia=0;for(Da=Aa.length;ia<Da;ia++){da=Aa[ia];var ea;if(!(ea=!da.visible))if(ea=da instanceof THREE.Mesh){a:{ea=void 0;for(var wa=da.matrixWorld,ta=-da.geometry.boundingSphere.radius*Math.max(da.scale.x,Math.max(da.scale.y,da.scale.z)),pa=0;pa<6;pa++){ea=la[pa].x*wa.n14+la[pa].y*wa.n24+la[pa].z*wa.n34+la[pa].w;if(ea<=ta){ea=!1;break a}}ea=!0}ea=!ea}if(!ea){ea=h[g]=h[g]||new THREE.RenderableObject;
-g++;f=ea;V.copy(da.position);M.multiplyVector3(V);f.object=da;f.z=V.z;e.push(f)}}oa&&e.sort(d);return e};this.projectScene=function(ia,e,oa){var Da=[],Aa=e.near,da=e.far,ea,wa,ta,pa,ca,ka,ma,Fa,ja,ga,Ja,Xa,Za,Ta,R,S,P;U=F=y=p=0;e.matrixAutoUpdate&&e.update(undefined,!0);ia.update(undefined,!1,e);M.multiply(e.projectionMatrix,e.matrixWorldInverse);la[0].set(M.n41-M.n11,M.n42-M.n12,M.n43-M.n13,M.n44-M.n14);la[1].set(M.n41+M.n11,M.n42+M.n12,M.n43+M.n13,M.n44+M.n14);la[2].set(M.n41+M.n21,M.n42+M.n22,
-M.n43+M.n23,M.n44+M.n24);la[3].set(M.n41-M.n21,M.n42-M.n22,M.n43-M.n23,M.n44-M.n24);la[4].set(M.n41-M.n31,M.n42-M.n32,M.n43-M.n33,M.n44-M.n34);la[5].set(M.n41+M.n31,M.n42+M.n32,M.n43+M.n33,M.n44+M.n34);for(ea=0;ea<6;ea++){ja=la[ea];ja.divideScalar(Math.sqrt(ja.x*ja.x+ja.y*ja.y+ja.z*ja.z))}ja=this.projectObjects(ia,e,!0);ia=0;for(ea=ja.length;ia<ea;ia++){ga=ja[ia].object;if(ga.visible){Ja=ga.matrixWorld;Xa=ga.matrixRotationWorld;Za=ga.materials;Ta=ga.overdraw;k=0;if(ga instanceof THREE.Mesh){R=ga.geometry;
+THREE.Projector=function(){function b(){var ea=m[k]=m[k]||new THREE.RenderableVertex;k++;return ea}function d(ea,e){return e.z-ea.z}function c(ea,e){var oa=0,Da=1,Aa=ea.z+ea.w,da=e.z+e.w,fa=-ea.z+ea.w,wa=-e.z+e.w;if(Aa>=0&&da>=0&&fa>=0&&wa>=0)return!0;else if(Aa<0&&da<0||fa<0&&wa<0)return!1;else{if(Aa<0)oa=Math.max(oa,Aa/(Aa-da));else da<0&&(Da=Math.min(Da,Aa/(Aa-da)));if(fa<0)oa=Math.max(oa,fa/(fa-wa));else wa<0&&(Da=Math.min(Da,fa/(fa-wa)));if(Da<oa)return!1;else{ea.lerpSelf(e,oa);e.lerpSelf(ea,
+1-Da);return!0}}}var f,g,h=[],j,k,m=[],o,p,t=[],y,u=[],A,F,J=[],B,U,C=[],V=new THREE.Vector4,O=new THREE.Vector4,M=new THREE.Matrix4,va=new THREE.Matrix4,la=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],qa=new THREE.Vector4,ga=new THREE.Vector4;this.projectVector=function(ea,e){M.multiply(e.projectionMatrix,e.matrixWorldInverse);M.multiplyVector3(ea);return ea};this.unprojectVector=function(ea,e){M.multiply(e.matrixWorld,THREE.Matrix4.makeInvert(e.projectionMatrix));
+M.multiplyVector3(ea);return ea};this.projectObjects=function(ea,e,oa){e=[];var Da,Aa,da;g=0;Aa=ea.objects;ea=0;for(Da=Aa.length;ea<Da;ea++){da=Aa[ea];var fa;if(!(fa=!da.visible))if(fa=da instanceof THREE.Mesh){a:{fa=void 0;for(var wa=da.matrixWorld,ta=-da.geometry.boundingSphere.radius*Math.max(da.scale.x,Math.max(da.scale.y,da.scale.z)),pa=0;pa<6;pa++){fa=la[pa].x*wa.n14+la[pa].y*wa.n24+la[pa].z*wa.n34+la[pa].w;if(fa<=ta){fa=!1;break a}}fa=!0}fa=!fa}if(!fa){fa=h[g]=h[g]||new THREE.RenderableObject;
+g++;f=fa;V.copy(da.position);M.multiplyVector3(V);f.object=da;f.z=V.z;e.push(f)}}oa&&e.sort(d);return e};this.projectScene=function(ea,e,oa){var Da=[],Aa=e.near,da=e.far,fa,wa,ta,pa,ca,ka,ma,Fa,ja,ha,Ja,Xa,Za,Ta,R,S,P;U=F=y=p=0;e.matrixAutoUpdate&&e.update(undefined,!0);ea.update(undefined,!1,e);M.multiply(e.projectionMatrix,e.matrixWorldInverse);la[0].set(M.n41-M.n11,M.n42-M.n12,M.n43-M.n13,M.n44-M.n14);la[1].set(M.n41+M.n11,M.n42+M.n12,M.n43+M.n13,M.n44+M.n14);la[2].set(M.n41+M.n21,M.n42+M.n22,
+M.n43+M.n23,M.n44+M.n24);la[3].set(M.n41-M.n21,M.n42-M.n22,M.n43-M.n23,M.n44-M.n24);la[4].set(M.n41-M.n31,M.n42-M.n32,M.n43-M.n33,M.n44-M.n34);la[5].set(M.n41+M.n31,M.n42+M.n32,M.n43+M.n33,M.n44+M.n34);for(fa=0;fa<6;fa++){ja=la[fa];ja.divideScalar(Math.sqrt(ja.x*ja.x+ja.y*ja.y+ja.z*ja.z))}ja=this.projectObjects(ea,e,!0);ea=0;for(fa=ja.length;ea<fa;ea++){ha=ja[ea].object;if(ha.visible){Ja=ha.matrixWorld;Xa=ha.matrixRotationWorld;Za=ha.materials;Ta=ha.overdraw;k=0;if(ha instanceof THREE.Mesh){R=ha.geometry;
 pa=R.vertices;S=R.faces;R=R.faceVertexUvs;wa=0;for(ta=pa.length;wa<ta;wa++){j=b();j.positionWorld.copy(pa[wa].position);Ja.multiplyVector3(j.positionWorld);j.positionScreen.copy(j.positionWorld);M.multiplyVector4(j.positionScreen);j.positionScreen.x/=j.positionScreen.w;j.positionScreen.y/=j.positionScreen.w;j.visible=j.positionScreen.z>Aa&&j.positionScreen.z<da}pa=0;for(wa=S.length;pa<wa;pa++){ta=S[pa];if(ta instanceof THREE.Face3){ca=m[ta.a];ka=m[ta.b];ma=m[ta.c];if(ca.visible&&ka.visible&&ma.visible&&
-(ga.doubleSided||ga.flipSided!=(ma.positionScreen.x-ca.positionScreen.x)*(ka.positionScreen.y-ca.positionScreen.y)-(ma.positionScreen.y-ca.positionScreen.y)*(ka.positionScreen.x-ca.positionScreen.x)<0)){Fa=t[p]=t[p]||new THREE.RenderableFace3;p++;o=Fa;o.v1.copy(ca);o.v2.copy(ka);o.v3.copy(ma)}else continue}else if(ta instanceof THREE.Face4){ca=m[ta.a];ka=m[ta.b];ma=m[ta.c];Fa=m[ta.d];if(ca.visible&&ka.visible&&ma.visible&&Fa.visible&&(ga.doubleSided||ga.flipSided!=((Fa.positionScreen.x-ca.positionScreen.x)*
+(ha.doubleSided||ha.flipSided!=(ma.positionScreen.x-ca.positionScreen.x)*(ka.positionScreen.y-ca.positionScreen.y)-(ma.positionScreen.y-ca.positionScreen.y)*(ka.positionScreen.x-ca.positionScreen.x)<0)){Fa=t[p]=t[p]||new THREE.RenderableFace3;p++;o=Fa;o.v1.copy(ca);o.v2.copy(ka);o.v3.copy(ma)}else continue}else if(ta instanceof THREE.Face4){ca=m[ta.a];ka=m[ta.b];ma=m[ta.c];Fa=m[ta.d];if(ca.visible&&ka.visible&&ma.visible&&Fa.visible&&(ha.doubleSided||ha.flipSided!=((Fa.positionScreen.x-ca.positionScreen.x)*
 (ka.positionScreen.y-ca.positionScreen.y)-(Fa.positionScreen.y-ca.positionScreen.y)*(ka.positionScreen.x-ca.positionScreen.x)<0||(ka.positionScreen.x-ma.positionScreen.x)*(Fa.positionScreen.y-ma.positionScreen.y)-(ka.positionScreen.y-ma.positionScreen.y)*(Fa.positionScreen.x-ma.positionScreen.x)<0))){P=u[y]=u[y]||new THREE.RenderableFace4;y++;o=P;o.v1.copy(ca);o.v2.copy(ka);o.v3.copy(ma);o.v4.copy(Fa)}else continue}o.normalWorld.copy(ta.normal);Xa.multiplyVector3(o.normalWorld);o.centroidWorld.copy(ta.centroid);
-Ja.multiplyVector3(o.centroidWorld);o.centroidScreen.copy(o.centroidWorld);M.multiplyVector3(o.centroidScreen);ma=ta.vertexNormals;ca=0;for(ka=ma.length;ca<ka;ca++){Fa=o.vertexNormalsWorld[ca];Fa.copy(ma[ca]);Xa.multiplyVector3(Fa)}ca=0;for(ka=R.length;ca<ka;ca++)if(P=R[ca][pa]){ma=0;for(Fa=P.length;ma<Fa;ma++)o.uvs[ca][ma]=P[ma]}o.meshMaterials=Za;o.faceMaterials=ta.materials;o.overdraw=Ta;o.z=o.centroidScreen.z;Da.push(o)}}else if(ga instanceof THREE.Line){va.multiply(M,Ja);pa=ga.geometry.vertices;
-ca=b();ca.positionScreen.copy(pa[0].position);va.multiplyVector4(ca.positionScreen);wa=1;for(ta=pa.length;wa<ta;wa++){ca=b();ca.positionScreen.copy(pa[wa].position);va.multiplyVector4(ca.positionScreen);ka=m[k-2];qa.copy(ca.positionScreen);fa.copy(ka.positionScreen);if(c(qa,fa)){qa.multiplyScalar(1/qa.w);fa.multiplyScalar(1/fa.w);Ja=J[F]=J[F]||new THREE.RenderableLine;F++;A=Ja;A.v1.positionScreen.copy(qa);A.v2.positionScreen.copy(fa);A.z=Math.max(qa.z,fa.z);A.materials=ga.materials;Da.push(A)}}}else if(ga instanceof
-THREE.Particle){O.set(ga.matrixWorld.n14,ga.matrixWorld.n24,ga.matrixWorld.n34,1);M.multiplyVector4(O);O.z/=O.w;if(O.z>0&&O.z<1){Ja=C[U]=C[U]||new THREE.RenderableParticle;U++;B=Ja;B.x=O.x/O.w;B.y=O.y/O.w;B.z=O.z;B.rotation=ga.rotation.z;B.scale.x=ga.scale.x*Math.abs(B.x-(O.x+e.projectionMatrix.n11)/(O.w+e.projectionMatrix.n14));B.scale.y=ga.scale.y*Math.abs(B.y-(O.y+e.projectionMatrix.n22)/(O.w+e.projectionMatrix.n24));B.materials=ga.materials;Da.push(B)}}}}oa&&Da.sort(d);return Da}};
+Ja.multiplyVector3(o.centroidWorld);o.centroidScreen.copy(o.centroidWorld);M.multiplyVector3(o.centroidScreen);ma=ta.vertexNormals;ca=0;for(ka=ma.length;ca<ka;ca++){Fa=o.vertexNormalsWorld[ca];Fa.copy(ma[ca]);Xa.multiplyVector3(Fa)}ca=0;for(ka=R.length;ca<ka;ca++)if(P=R[ca][pa]){ma=0;for(Fa=P.length;ma<Fa;ma++)o.uvs[ca][ma]=P[ma]}o.meshMaterials=Za;o.faceMaterials=ta.materials;o.overdraw=Ta;o.z=o.centroidScreen.z;Da.push(o)}}else if(ha instanceof THREE.Line){va.multiply(M,Ja);pa=ha.geometry.vertices;
+ca=b();ca.positionScreen.copy(pa[0].position);va.multiplyVector4(ca.positionScreen);wa=1;for(ta=pa.length;wa<ta;wa++){ca=b();ca.positionScreen.copy(pa[wa].position);va.multiplyVector4(ca.positionScreen);ka=m[k-2];qa.copy(ca.positionScreen);ga.copy(ka.positionScreen);if(c(qa,ga)){qa.multiplyScalar(1/qa.w);ga.multiplyScalar(1/ga.w);Ja=J[F]=J[F]||new THREE.RenderableLine;F++;A=Ja;A.v1.positionScreen.copy(qa);A.v2.positionScreen.copy(ga);A.z=Math.max(qa.z,ga.z);A.materials=ha.materials;Da.push(A)}}}else if(ha instanceof
+THREE.Particle){O.set(ha.matrixWorld.n14,ha.matrixWorld.n24,ha.matrixWorld.n34,1);M.multiplyVector4(O);O.z/=O.w;if(O.z>0&&O.z<1){Ja=C[U]=C[U]||new THREE.RenderableParticle;U++;B=Ja;B.x=O.x/O.w;B.y=O.y/O.w;B.z=O.z;B.rotation=ha.rotation.z;B.scale.x=ha.scale.x*Math.abs(B.x-(O.x+e.projectionMatrix.n11)/(O.w+e.projectionMatrix.n14));B.scale.y=ha.scale.y*Math.abs(B.y-(O.y+e.projectionMatrix.n22)/(O.w+e.projectionMatrix.n24));B.materials=ha.materials;Da.push(B)}}}}oa&&Da.sort(d);return Da}};
 THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,d=new THREE.Projector,c,f,g,h;this.domElement=document.createElement("div");this.setSize=function(j,k){c=j;f=k;g=c/2;h=f/2};this.render=function(j,k){var m,o,p,t,y,u,A,F;b=d.projectScene(j,k);m=0;for(o=b.length;m<o;m++){y=b[m];if(y instanceof THREE.RenderableParticle){A=y.x*g+g;F=y.y*h+h;p=0;for(t=y.material.length;p<t;p++){u=y.material[p];if(u instanceof THREE.ParticleDOMMaterial){u=u.domElement;u.style.left=A+"px";u.style.top=F+"px"}}}}}};
 THREE.CanvasRenderer=function(){function b(Ga){if(A!=Ga)t.globalAlpha=A=Ga}function d(Ga){if(F!=Ga){switch(Ga){case THREE.NormalBlending:t.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:t.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:t.globalCompositeOperation="darker"}F=Ga}}function c(Ga){if(J!=Ga)t.strokeStyle=J=Ga}var f=this,g=null,h=new THREE.Projector,j=document.createElement("canvas"),k,m,o,p,t=j.getContext("2d"),y=new THREE.Color(0),u=0,A=
-1,F=0,J=null,B=null,U=null,C=null,V=null,O,M,va,la,qa=new THREE.RenderableVertex,fa=new THREE.RenderableVertex,ia,e,oa,Da,Aa,da,ea,wa,ta,pa,ca,ka,ma=new THREE.Color,Fa=new THREE.Color,ja=new THREE.Color,ga=new THREE.Color,Ja=new THREE.Color,Xa,Za,Ta,R,S,P,Ba,La,n,D,x=new THREE.Rectangle,v=new THREE.Rectangle,z=new THREE.Rectangle,Q=!1,K=new THREE.Color,G=new THREE.Color,T=new THREE.Color,H=new THREE.Color,I=new THREE.Vector3,L,Z,Y,ra,Ka,Ca,Ha=16;L=document.createElement("canvas");L.width=L.height=
+1,F=0,J=null,B=null,U=null,C=null,V=null,O,M,va,la,qa=new THREE.RenderableVertex,ga=new THREE.RenderableVertex,ea,e,oa,Da,Aa,da,fa,wa,ta,pa,ca,ka,ma=new THREE.Color,Fa=new THREE.Color,ja=new THREE.Color,ha=new THREE.Color,Ja=new THREE.Color,Xa,Za,Ta,R,S,P,Ba,La,n,D,x=new THREE.Rectangle,v=new THREE.Rectangle,z=new THREE.Rectangle,Q=!1,K=new THREE.Color,G=new THREE.Color,T=new THREE.Color,H=new THREE.Color,I=new THREE.Vector3,L,Z,Y,ra,Ka,Ca,Ha=16;L=document.createElement("canvas");L.width=L.height=
 2;Z=L.getContext("2d");Z.fillStyle="rgba(0,0,0,1)";Z.fillRect(0,0,2,2);Y=Z.getImageData(0,0,2,2);ra=Y.data;Ka=document.createElement("canvas");Ka.width=Ka.height=Ha;Ca=Ka.getContext("2d");Ca.translate(-Ha/2,-Ha/2);Ca.scale(Ha,Ha);Ha--;this.domElement=j;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.data={vertices:0,faces:0};this.setSize=function(Ga,xa){k=Ga;m=xa;o=k/2;p=m/2;j.width=k;j.height=m;x.set(-o,-p,o,p);A=1;F=0;V=C=U=B=J=null};this.setClearColor=function(Ga,xa){y=Ga;u=xa};
-this.setClearColorHex=function(Ga,xa){y.setHex(Ga);u=xa};this.clear=function(){t.setTransform(1,0,0,-1,o,p);if(!v.isEmpty()){v.inflate(1);v.minSelf(x);if(y.hex==0&&u==0)t.clearRect(v.getX(),v.getY(),v.getWidth(),v.getHeight());else{d(THREE.NormalBlending);b(1);t.fillStyle="rgba("+Math.floor(y.r*255)+","+Math.floor(y.g*255)+","+Math.floor(y.b*255)+","+u+")";t.fillRect(v.getX(),v.getY(),v.getWidth(),v.getHeight())}v.empty()}};this.render=function(Ga,xa){function Ea(W){var na,ha,$,ua=W.lights;G.setRGB(0,
-0,0);T.setRGB(0,0,0);H.setRGB(0,0,0);W=0;for(na=ua.length;W<na;W++){ha=ua[W];$=ha.color;if(ha instanceof THREE.AmbientLight){G.r+=$.r;G.g+=$.g;G.b+=$.b}else if(ha instanceof THREE.DirectionalLight){T.r+=$.r;T.g+=$.g;T.b+=$.b}else if(ha instanceof THREE.PointLight){H.r+=$.r;H.g+=$.g;H.b+=$.b}}}function za(W,na,ha,$){var ua,sa,ya,X,Ia=W.lights;W=0;for(ua=Ia.length;W<ua;W++){sa=Ia[W];ya=sa.color;if(sa instanceof THREE.DirectionalLight){X=ha.dot(sa.position);if(!(X<=0)){X*=sa.intensity;$.r+=ya.r*X;$.g+=
-ya.g*X;$.b+=ya.b*X}}else if(sa instanceof THREE.PointLight){X=ha.dot(I.sub(sa.position,na).normalize());if(!(X<=0)){X*=sa.distance==0?1:1-Math.min(na.distanceTo(sa.position)/sa.distance,1);if(X!=0){X*=sa.intensity;$.r+=ya.r*X;$.g+=ya.g*X;$.b+=ya.b*X}}}}}function Ua(W,na,ha){b(ha.opacity);d(ha.blending);var $,ua,sa,ya,X,Ia;if(ha instanceof THREE.ParticleBasicMaterial){if(ha.map){ya=ha.map.image;X=ya.width>>1;Ia=ya.height>>1;ha=na.scale.x*o;sa=na.scale.y*p;$=ha*X;ua=sa*Ia;z.set(W.x-$,W.y-ua,W.x+$,W.y+
-ua);if(x.instersects(z)){t.save();t.translate(W.x,W.y);t.rotate(-na.rotation);t.scale(ha,-sa);t.translate(-X,-Ia);t.drawImage(ya,0,0);t.restore()}}}else if(ha instanceof THREE.ParticleCanvasMaterial){$=na.scale.x*o;ua=na.scale.y*p;z.set(W.x-$,W.y-ua,W.x+$,W.y+ua);if(x.instersects(z)){c(ha.color.__styleString);sa=ha.color.__styleString;if(B!=sa)t.fillStyle=B=sa;t.save();t.translate(W.x,W.y);t.rotate(-na.rotation);t.scale($,ua);ha.program(t);t.restore()}}}function E(W,na,ha,$){b($.opacity);d($.blending);
-t.beginPath();t.moveTo(W.positionScreen.x,W.positionScreen.y);t.lineTo(na.positionScreen.x,na.positionScreen.y);t.closePath();if($ instanceof THREE.LineBasicMaterial){ma.__styleString=$.color.__styleString;W=$.linewidth;if(U!=W)t.lineWidth=U=W;W=$.linecap;if(C!=W)t.lineCap=C=W;W=$.linejoin;if(V!=W)t.lineJoin=V=W;c(ma.__styleString);t.stroke();z.inflate($.linewidth*2)}}function aa(W,na,ha,$,ua,sa,ya,X,Ia){f.data.vertices+=3;f.data.faces++;b(X.opacity);d(X.blending);ia=W.positionScreen.x;e=W.positionScreen.y;
-oa=na.positionScreen.x;Da=na.positionScreen.y;Aa=ha.positionScreen.x;da=ha.positionScreen.y;ab(ia,e,oa,Da,Aa,da);if(X instanceof THREE.MeshBasicMaterial)if(X.map){if(X.map.mapping instanceof THREE.UVMapping){R=ya.uvs[0];cb(ia,e,oa,Da,Aa,da,X.map.image,R[$].u,R[$].v,R[ua].u,R[ua].v,R[sa].u,R[sa].v)}}else if(X.envMap){if(X.envMap.mapping instanceof THREE.SphericalReflectionMapping){W=xa.matrixWorldInverse;I.copy(ya.vertexNormalsWorld[0]);S=(I.x*W.n11+I.y*W.n12+I.z*W.n13)*0.5+0.5;P=-(I.x*W.n21+I.y*W.n22+
-I.z*W.n23)*0.5+0.5;I.copy(ya.vertexNormalsWorld[1]);Ba=(I.x*W.n11+I.y*W.n12+I.z*W.n13)*0.5+0.5;La=-(I.x*W.n21+I.y*W.n22+I.z*W.n23)*0.5+0.5;I.copy(ya.vertexNormalsWorld[2]);n=(I.x*W.n11+I.y*W.n12+I.z*W.n13)*0.5+0.5;D=-(I.x*W.n21+I.y*W.n22+I.z*W.n23)*0.5+0.5;cb(ia,e,oa,Da,Aa,da,X.envMap.image,S,P,Ba,La,n,D)}}else X.wireframe?Oa(X.color.__styleString,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin):Qa(X.color.__styleString);else if(X instanceof THREE.MeshLambertMaterial){if(X.map&&!X.wireframe){if(X.map.mapping instanceof
-THREE.UVMapping){R=ya.uvs[0];cb(ia,e,oa,Da,Aa,da,X.map.image,R[$].u,R[$].v,R[ua].u,R[ua].v,R[sa].u,R[sa].v)}d(THREE.SubtractiveBlending)}if(Q)if(!X.wireframe&&X.shading==THREE.SmoothShading&&ya.vertexNormalsWorld.length==3){Fa.r=ja.r=ga.r=G.r;Fa.g=ja.g=ga.g=G.g;Fa.b=ja.b=ga.b=G.b;za(Ia,ya.v1.positionWorld,ya.vertexNormalsWorld[0],Fa);za(Ia,ya.v2.positionWorld,ya.vertexNormalsWorld[1],ja);za(Ia,ya.v3.positionWorld,ya.vertexNormalsWorld[2],ga);Ja.r=(ja.r+ga.r)*0.5;Ja.g=(ja.g+ga.g)*0.5;Ja.b=(ja.b+ga.b)*
-0.5;Ta=hb(Fa,ja,ga,Ja);cb(ia,e,oa,Da,Aa,da,Ta,0,0,1,0,0,1)}else{K.r=G.r;K.g=G.g;K.b=G.b;za(Ia,ya.centroidWorld,ya.normalWorld,K);ma.r=X.color.r*K.r;ma.g=X.color.g*K.g;ma.b=X.color.b*K.b;ma.updateStyleString();X.wireframe?Oa(ma.__styleString,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin):Qa(ma.__styleString)}else X.wireframe?Oa(X.color.__styleString,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin):Qa(X.color.__styleString)}else if(X instanceof THREE.MeshDepthMaterial){Xa=
-xa.near;Za=xa.far;Fa.r=Fa.g=Fa.b=1-Wa(W.positionScreen.z,Xa,Za);ja.r=ja.g=ja.b=1-Wa(na.positionScreen.z,Xa,Za);ga.r=ga.g=ga.b=1-Wa(ha.positionScreen.z,Xa,Za);Ja.r=(ja.r+ga.r)*0.5;Ja.g=(ja.g+ga.g)*0.5;Ja.b=(ja.b+ga.b)*0.5;Ta=hb(Fa,ja,ga,Ja);cb(ia,e,oa,Da,Aa,da,Ta,0,0,1,0,0,1)}else if(X instanceof THREE.MeshNormalMaterial){ma.r=$a(ya.normalWorld.x);ma.g=$a(ya.normalWorld.y);ma.b=$a(ya.normalWorld.z);ma.updateStyleString();X.wireframe?Oa(ma.__styleString,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin):
-Qa(ma.__styleString)}}function w(W,na,ha,$,ua,sa,ya,X,Ia){f.data.vertices+=4;f.data.faces++;b(X.opacity);d(X.blending);if(X.map||X.envMap){aa(W,na,$,0,1,3,ya,X,Ia);aa(ua,ha,sa,1,2,3,ya,X,Ia)}else{ia=W.positionScreen.x;e=W.positionScreen.y;oa=na.positionScreen.x;Da=na.positionScreen.y;Aa=ha.positionScreen.x;da=ha.positionScreen.y;ea=$.positionScreen.x;wa=$.positionScreen.y;ta=ua.positionScreen.x;pa=ua.positionScreen.y;ca=sa.positionScreen.x;ka=sa.positionScreen.y;if(X instanceof THREE.MeshBasicMaterial){fb(ia,
-e,oa,Da,Aa,da,ea,wa);X.wireframe?Oa(X.color.__styleString,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin):Qa(X.color.__styleString)}else if(X instanceof THREE.MeshLambertMaterial)if(Q)if(!X.wireframe&&X.shading==THREE.SmoothShading&&ya.vertexNormalsWorld.length==4){Fa.r=ja.r=ga.r=Ja.r=G.r;Fa.g=ja.g=ga.g=Ja.g=G.g;Fa.b=ja.b=ga.b=Ja.b=G.b;za(Ia,ya.v1.positionWorld,ya.vertexNormalsWorld[0],Fa);za(Ia,ya.v2.positionWorld,ya.vertexNormalsWorld[1],ja);za(Ia,ya.v4.positionWorld,ya.vertexNormalsWorld[3],
-ga);za(Ia,ya.v3.positionWorld,ya.vertexNormalsWorld[2],Ja);Ta=hb(Fa,ja,ga,Ja);ab(ia,e,oa,Da,ea,wa);cb(ia,e,oa,Da,ea,wa,Ta,0,0,1,0,0,1);ab(ta,pa,Aa,da,ca,ka);cb(ta,pa,Aa,da,ca,ka,Ta,1,0,1,1,0,1)}else{K.r=G.r;K.g=G.g;K.b=G.b;za(Ia,ya.centroidWorld,ya.normalWorld,K);ma.r=X.color.r*K.r;ma.g=X.color.g*K.g;ma.b=X.color.b*K.b;ma.updateStyleString();fb(ia,e,oa,Da,Aa,da,ea,wa);X.wireframe?Oa(ma.__styleString,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin):Qa(ma.__styleString)}else{fb(ia,e,oa,
-Da,Aa,da,ea,wa);X.wireframe?Oa(X.color.__styleString,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin):Qa(X.color.__styleString)}else if(X instanceof THREE.MeshNormalMaterial){ma.r=$a(ya.normalWorld.x);ma.g=$a(ya.normalWorld.y);ma.b=$a(ya.normalWorld.z);ma.updateStyleString();fb(ia,e,oa,Da,Aa,da,ea,wa);X.wireframe?Oa(ma.__styleString,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin):Qa(ma.__styleString)}else if(X instanceof THREE.MeshDepthMaterial){Xa=xa.near;Za=xa.far;Fa.r=
-Fa.g=Fa.b=1-Wa(W.positionScreen.z,Xa,Za);ja.r=ja.g=ja.b=1-Wa(na.positionScreen.z,Xa,Za);ga.r=ga.g=ga.b=1-Wa($.positionScreen.z,Xa,Za);Ja.r=Ja.g=Ja.b=1-Wa(ha.positionScreen.z,Xa,Za);Ta=hb(Fa,ja,ga,Ja);ab(ia,e,oa,Da,ea,wa);cb(ia,e,oa,Da,ea,wa,Ta,0,0,1,0,0,1);ab(ta,pa,Aa,da,ca,ka);cb(ta,pa,Aa,da,ca,ka,Ta,1,0,1,1,0,1)}}}function ab(W,na,ha,$,ua,sa){t.beginPath();t.moveTo(W,na);t.lineTo(ha,$);t.lineTo(ua,sa);t.lineTo(W,na);t.closePath()}function fb(W,na,ha,$,ua,sa,ya,X){t.beginPath();t.moveTo(W,na);t.lineTo(ha,
-$);t.lineTo(ua,sa);t.lineTo(ya,X);t.lineTo(W,na);t.closePath()}function Oa(W,na,ha,$){if(U!=na)t.lineWidth=U=na;if(C!=ha)t.lineCap=C=ha;if(V!=$)t.lineJoin=V=$;c(W);t.stroke();z.inflate(na*2)}function Qa(W){if(B!=W)t.fillStyle=B=W;t.fill()}function cb(W,na,ha,$,ua,sa,ya,X,Ia,Ya,eb,Sa,kb){var gb,db;gb=ya.width-1;db=ya.height-1;X*=gb;Ia*=db;Ya*=gb;eb*=db;Sa*=gb;kb*=db;ha-=W;$-=na;ua-=W;sa-=na;Ya-=X;eb-=Ia;Sa-=X;kb-=Ia;gb=Ya*kb-Sa*eb;if(gb!=0){db=1/gb;gb=(kb*ha-eb*ua)*db;eb=(kb*$-eb*sa)*db;ha=(Ya*ua-
-Sa*ha)*db;$=(Ya*sa-Sa*$)*db;W=W-gb*X-ha*Ia;na=na-eb*X-$*Ia;t.save();t.transform(gb,eb,ha,$,W,na);t.clip();t.drawImage(ya,0,0);t.restore()}}function hb(W,na,ha,$){var ua=~~(W.r*255),sa=~~(W.g*255);W=~~(W.b*255);var ya=~~(na.r*255),X=~~(na.g*255);na=~~(na.b*255);var Ia=~~(ha.r*255),Ya=~~(ha.g*255);ha=~~(ha.b*255);var eb=~~($.r*255),Sa=~~($.g*255);$=~~($.b*255);ra[0]=ua<0?0:ua>255?255:ua;ra[1]=sa<0?0:sa>255?255:sa;ra[2]=W<0?0:W>255?255:W;ra[4]=ya<0?0:ya>255?255:ya;ra[5]=X<0?0:X>255?255:X;ra[6]=na<0?
-0:na>255?255:na;ra[8]=Ia<0?0:Ia>255?255:Ia;ra[9]=Ya<0?0:Ya>255?255:Ya;ra[10]=ha<0?0:ha>255?255:ha;ra[12]=eb<0?0:eb>255?255:eb;ra[13]=Sa<0?0:Sa>255?255:Sa;ra[14]=$<0?0:$>255?255:$;Z.putImageData(Y,0,0);Ca.drawImage(L,0,0);return Ka}function Wa(W,na,ha){W=(W-na)/(ha-na);return W*W*(3-2*W)}function $a(W){W=(W+1)*0.5;return W<0?0:W>1?1:W}function Ma(W,na){var ha=na.x-W.x,$=na.y-W.y,ua=1/Math.sqrt(ha*ha+$*$);ha*=ua;$*=ua;na.x+=ha;na.y+=$;W.x-=ha;W.y-=$}var bb,Va,N,Na,Ra,ib,jb,Pa;this.autoClear?this.clear():
+this.setClearColorHex=function(Ga,xa){y.setHex(Ga);u=xa};this.clear=function(){t.setTransform(1,0,0,-1,o,p);if(!v.isEmpty()){v.inflate(1);v.minSelf(x);if(y.hex==0&&u==0)t.clearRect(v.getX(),v.getY(),v.getWidth(),v.getHeight());else{d(THREE.NormalBlending);b(1);t.fillStyle="rgba("+Math.floor(y.r*255)+","+Math.floor(y.g*255)+","+Math.floor(y.b*255)+","+u+")";t.fillRect(v.getX(),v.getY(),v.getWidth(),v.getHeight())}v.empty()}};this.render=function(Ga,xa){function Ea(W){var na,ia,$,ua=W.lights;G.setRGB(0,
+0,0);T.setRGB(0,0,0);H.setRGB(0,0,0);W=0;for(na=ua.length;W<na;W++){ia=ua[W];$=ia.color;if(ia instanceof THREE.AmbientLight){G.r+=$.r;G.g+=$.g;G.b+=$.b}else if(ia instanceof THREE.DirectionalLight){T.r+=$.r;T.g+=$.g;T.b+=$.b}else if(ia instanceof THREE.PointLight){H.r+=$.r;H.g+=$.g;H.b+=$.b}}}function za(W,na,ia,$){var ua,sa,ya,X,Ia=W.lights;W=0;for(ua=Ia.length;W<ua;W++){sa=Ia[W];ya=sa.color;if(sa instanceof THREE.DirectionalLight){X=ia.dot(sa.position);if(!(X<=0)){X*=sa.intensity;$.r+=ya.r*X;$.g+=
+ya.g*X;$.b+=ya.b*X}}else if(sa instanceof THREE.PointLight){X=ia.dot(I.sub(sa.position,na).normalize());if(!(X<=0)){X*=sa.distance==0?1:1-Math.min(na.distanceTo(sa.position)/sa.distance,1);if(X!=0){X*=sa.intensity;$.r+=ya.r*X;$.g+=ya.g*X;$.b+=ya.b*X}}}}}function Ua(W,na,ia){b(ia.opacity);d(ia.blending);var $,ua,sa,ya,X,Ia;if(ia instanceof THREE.ParticleBasicMaterial){if(ia.map){ya=ia.map.image;X=ya.width>>1;Ia=ya.height>>1;ia=na.scale.x*o;sa=na.scale.y*p;$=ia*X;ua=sa*Ia;z.set(W.x-$,W.y-ua,W.x+$,W.y+
+ua);if(x.instersects(z)){t.save();t.translate(W.x,W.y);t.rotate(-na.rotation);t.scale(ia,-sa);t.translate(-X,-Ia);t.drawImage(ya,0,0);t.restore()}}}else if(ia instanceof THREE.ParticleCanvasMaterial){$=na.scale.x*o;ua=na.scale.y*p;z.set(W.x-$,W.y-ua,W.x+$,W.y+ua);if(x.instersects(z)){c(ia.color.__styleString);sa=ia.color.__styleString;if(B!=sa)t.fillStyle=B=sa;t.save();t.translate(W.x,W.y);t.rotate(-na.rotation);t.scale($,ua);ia.program(t);t.restore()}}}function E(W,na,ia,$){b($.opacity);d($.blending);
+t.beginPath();t.moveTo(W.positionScreen.x,W.positionScreen.y);t.lineTo(na.positionScreen.x,na.positionScreen.y);t.closePath();if($ instanceof THREE.LineBasicMaterial){ma.__styleString=$.color.__styleString;W=$.linewidth;if(U!=W)t.lineWidth=U=W;W=$.linecap;if(C!=W)t.lineCap=C=W;W=$.linejoin;if(V!=W)t.lineJoin=V=W;c(ma.__styleString);t.stroke();z.inflate($.linewidth*2)}}function aa(W,na,ia,$,ua,sa,ya,X,Ia){f.data.vertices+=3;f.data.faces++;b(X.opacity);d(X.blending);ea=W.positionScreen.x;e=W.positionScreen.y;
+oa=na.positionScreen.x;Da=na.positionScreen.y;Aa=ia.positionScreen.x;da=ia.positionScreen.y;ab(ea,e,oa,Da,Aa,da);if(X instanceof THREE.MeshBasicMaterial)if(X.map){if(X.map.mapping instanceof THREE.UVMapping){R=ya.uvs[0];cb(ea,e,oa,Da,Aa,da,X.map.image,R[$].u,R[$].v,R[ua].u,R[ua].v,R[sa].u,R[sa].v)}}else if(X.envMap){if(X.envMap.mapping instanceof THREE.SphericalReflectionMapping){W=xa.matrixWorldInverse;I.copy(ya.vertexNormalsWorld[0]);S=(I.x*W.n11+I.y*W.n12+I.z*W.n13)*0.5+0.5;P=-(I.x*W.n21+I.y*W.n22+
+I.z*W.n23)*0.5+0.5;I.copy(ya.vertexNormalsWorld[1]);Ba=(I.x*W.n11+I.y*W.n12+I.z*W.n13)*0.5+0.5;La=-(I.x*W.n21+I.y*W.n22+I.z*W.n23)*0.5+0.5;I.copy(ya.vertexNormalsWorld[2]);n=(I.x*W.n11+I.y*W.n12+I.z*W.n13)*0.5+0.5;D=-(I.x*W.n21+I.y*W.n22+I.z*W.n23)*0.5+0.5;cb(ea,e,oa,Da,Aa,da,X.envMap.image,S,P,Ba,La,n,D)}}else X.wireframe?Oa(X.color.__styleString,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin):Qa(X.color.__styleString);else if(X instanceof THREE.MeshLambertMaterial){if(X.map&&!X.wireframe){if(X.map.mapping instanceof
+THREE.UVMapping){R=ya.uvs[0];cb(ea,e,oa,Da,Aa,da,X.map.image,R[$].u,R[$].v,R[ua].u,R[ua].v,R[sa].u,R[sa].v)}d(THREE.SubtractiveBlending)}if(Q)if(!X.wireframe&&X.shading==THREE.SmoothShading&&ya.vertexNormalsWorld.length==3){Fa.r=ja.r=ha.r=G.r;Fa.g=ja.g=ha.g=G.g;Fa.b=ja.b=ha.b=G.b;za(Ia,ya.v1.positionWorld,ya.vertexNormalsWorld[0],Fa);za(Ia,ya.v2.positionWorld,ya.vertexNormalsWorld[1],ja);za(Ia,ya.v3.positionWorld,ya.vertexNormalsWorld[2],ha);Ja.r=(ja.r+ha.r)*0.5;Ja.g=(ja.g+ha.g)*0.5;Ja.b=(ja.b+ha.b)*
+0.5;Ta=hb(Fa,ja,ha,Ja);cb(ea,e,oa,Da,Aa,da,Ta,0,0,1,0,0,1)}else{K.r=G.r;K.g=G.g;K.b=G.b;za(Ia,ya.centroidWorld,ya.normalWorld,K);ma.r=X.color.r*K.r;ma.g=X.color.g*K.g;ma.b=X.color.b*K.b;ma.updateStyleString();X.wireframe?Oa(ma.__styleString,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin):Qa(ma.__styleString)}else X.wireframe?Oa(X.color.__styleString,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin):Qa(X.color.__styleString)}else if(X instanceof THREE.MeshDepthMaterial){Xa=
+xa.near;Za=xa.far;Fa.r=Fa.g=Fa.b=1-Wa(W.positionScreen.z,Xa,Za);ja.r=ja.g=ja.b=1-Wa(na.positionScreen.z,Xa,Za);ha.r=ha.g=ha.b=1-Wa(ia.positionScreen.z,Xa,Za);Ja.r=(ja.r+ha.r)*0.5;Ja.g=(ja.g+ha.g)*0.5;Ja.b=(ja.b+ha.b)*0.5;Ta=hb(Fa,ja,ha,Ja);cb(ea,e,oa,Da,Aa,da,Ta,0,0,1,0,0,1)}else if(X instanceof THREE.MeshNormalMaterial){ma.r=$a(ya.normalWorld.x);ma.g=$a(ya.normalWorld.y);ma.b=$a(ya.normalWorld.z);ma.updateStyleString();X.wireframe?Oa(ma.__styleString,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin):
+Qa(ma.__styleString)}}function w(W,na,ia,$,ua,sa,ya,X,Ia){f.data.vertices+=4;f.data.faces++;b(X.opacity);d(X.blending);if(X.map||X.envMap){aa(W,na,$,0,1,3,ya,X,Ia);aa(ua,ia,sa,1,2,3,ya,X,Ia)}else{ea=W.positionScreen.x;e=W.positionScreen.y;oa=na.positionScreen.x;Da=na.positionScreen.y;Aa=ia.positionScreen.x;da=ia.positionScreen.y;fa=$.positionScreen.x;wa=$.positionScreen.y;ta=ua.positionScreen.x;pa=ua.positionScreen.y;ca=sa.positionScreen.x;ka=sa.positionScreen.y;if(X instanceof THREE.MeshBasicMaterial){fb(ea,
+e,oa,Da,Aa,da,fa,wa);X.wireframe?Oa(X.color.__styleString,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin):Qa(X.color.__styleString)}else if(X instanceof THREE.MeshLambertMaterial)if(Q)if(!X.wireframe&&X.shading==THREE.SmoothShading&&ya.vertexNormalsWorld.length==4){Fa.r=ja.r=ha.r=Ja.r=G.r;Fa.g=ja.g=ha.g=Ja.g=G.g;Fa.b=ja.b=ha.b=Ja.b=G.b;za(Ia,ya.v1.positionWorld,ya.vertexNormalsWorld[0],Fa);za(Ia,ya.v2.positionWorld,ya.vertexNormalsWorld[1],ja);za(Ia,ya.v4.positionWorld,ya.vertexNormalsWorld[3],
+ha);za(Ia,ya.v3.positionWorld,ya.vertexNormalsWorld[2],Ja);Ta=hb(Fa,ja,ha,Ja);ab(ea,e,oa,Da,fa,wa);cb(ea,e,oa,Da,fa,wa,Ta,0,0,1,0,0,1);ab(ta,pa,Aa,da,ca,ka);cb(ta,pa,Aa,da,ca,ka,Ta,1,0,1,1,0,1)}else{K.r=G.r;K.g=G.g;K.b=G.b;za(Ia,ya.centroidWorld,ya.normalWorld,K);ma.r=X.color.r*K.r;ma.g=X.color.g*K.g;ma.b=X.color.b*K.b;ma.updateStyleString();fb(ea,e,oa,Da,Aa,da,fa,wa);X.wireframe?Oa(ma.__styleString,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin):Qa(ma.__styleString)}else{fb(ea,e,oa,
+Da,Aa,da,fa,wa);X.wireframe?Oa(X.color.__styleString,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin):Qa(X.color.__styleString)}else if(X instanceof THREE.MeshNormalMaterial){ma.r=$a(ya.normalWorld.x);ma.g=$a(ya.normalWorld.y);ma.b=$a(ya.normalWorld.z);ma.updateStyleString();fb(ea,e,oa,Da,Aa,da,fa,wa);X.wireframe?Oa(ma.__styleString,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin):Qa(ma.__styleString)}else if(X instanceof THREE.MeshDepthMaterial){Xa=xa.near;Za=xa.far;Fa.r=
+Fa.g=Fa.b=1-Wa(W.positionScreen.z,Xa,Za);ja.r=ja.g=ja.b=1-Wa(na.positionScreen.z,Xa,Za);ha.r=ha.g=ha.b=1-Wa($.positionScreen.z,Xa,Za);Ja.r=Ja.g=Ja.b=1-Wa(ia.positionScreen.z,Xa,Za);Ta=hb(Fa,ja,ha,Ja);ab(ea,e,oa,Da,fa,wa);cb(ea,e,oa,Da,fa,wa,Ta,0,0,1,0,0,1);ab(ta,pa,Aa,da,ca,ka);cb(ta,pa,Aa,da,ca,ka,Ta,1,0,1,1,0,1)}}}function ab(W,na,ia,$,ua,sa){t.beginPath();t.moveTo(W,na);t.lineTo(ia,$);t.lineTo(ua,sa);t.lineTo(W,na);t.closePath()}function fb(W,na,ia,$,ua,sa,ya,X){t.beginPath();t.moveTo(W,na);t.lineTo(ia,
+$);t.lineTo(ua,sa);t.lineTo(ya,X);t.lineTo(W,na);t.closePath()}function Oa(W,na,ia,$){if(U!=na)t.lineWidth=U=na;if(C!=ia)t.lineCap=C=ia;if(V!=$)t.lineJoin=V=$;c(W);t.stroke();z.inflate(na*2)}function Qa(W){if(B!=W)t.fillStyle=B=W;t.fill()}function cb(W,na,ia,$,ua,sa,ya,X,Ia,Ya,eb,Sa,kb){var gb,db;gb=ya.width-1;db=ya.height-1;X*=gb;Ia*=db;Ya*=gb;eb*=db;Sa*=gb;kb*=db;ia-=W;$-=na;ua-=W;sa-=na;Ya-=X;eb-=Ia;Sa-=X;kb-=Ia;gb=Ya*kb-Sa*eb;if(gb!=0){db=1/gb;gb=(kb*ia-eb*ua)*db;eb=(kb*$-eb*sa)*db;ia=(Ya*ua-
+Sa*ia)*db;$=(Ya*sa-Sa*$)*db;W=W-gb*X-ia*Ia;na=na-eb*X-$*Ia;t.save();t.transform(gb,eb,ia,$,W,na);t.clip();t.drawImage(ya,0,0);t.restore()}}function hb(W,na,ia,$){var ua=~~(W.r*255),sa=~~(W.g*255);W=~~(W.b*255);var ya=~~(na.r*255),X=~~(na.g*255);na=~~(na.b*255);var Ia=~~(ia.r*255),Ya=~~(ia.g*255);ia=~~(ia.b*255);var eb=~~($.r*255),Sa=~~($.g*255);$=~~($.b*255);ra[0]=ua<0?0:ua>255?255:ua;ra[1]=sa<0?0:sa>255?255:sa;ra[2]=W<0?0:W>255?255:W;ra[4]=ya<0?0:ya>255?255:ya;ra[5]=X<0?0:X>255?255:X;ra[6]=na<0?
+0:na>255?255:na;ra[8]=Ia<0?0:Ia>255?255:Ia;ra[9]=Ya<0?0:Ya>255?255:Ya;ra[10]=ia<0?0:ia>255?255:ia;ra[12]=eb<0?0:eb>255?255:eb;ra[13]=Sa<0?0:Sa>255?255:Sa;ra[14]=$<0?0:$>255?255:$;Z.putImageData(Y,0,0);Ca.drawImage(L,0,0);return Ka}function Wa(W,na,ia){W=(W-na)/(ia-na);return W*W*(3-2*W)}function $a(W){W=(W+1)*0.5;return W<0?0:W>1?1:W}function Ma(W,na){var ia=na.x-W.x,$=na.y-W.y,ua=1/Math.sqrt(ia*ia+$*$);ia*=ua;$*=ua;na.x+=ia;na.y+=$;W.x-=ia;W.y-=$}var bb,Va,N,Na,Ra,ib,jb,Pa;this.autoClear?this.clear():
 t.setTransform(1,0,0,-1,o,p);f.data.vertices=0;f.data.faces=0;g=h.projectScene(Ga,xa,this.sortElements);(Q=Ga.lights.length>0)&&Ea(Ga);bb=0;for(Va=g.length;bb<Va;bb++){N=g[bb];z.empty();if(N instanceof THREE.RenderableParticle){O=N;O.x*=o;O.y*=p;Na=0;for(Ra=N.materials.length;Na<Ra;){Pa=N.materials[Na++];Pa.opacity!=0&&Ua(O,N,Pa,Ga)}}else if(N instanceof THREE.RenderableLine){O=N.v1;M=N.v2;O.positionScreen.x*=o;O.positionScreen.y*=p;M.positionScreen.x*=o;M.positionScreen.y*=p;z.addPoint(O.positionScreen.x,
 O.positionScreen.y);z.addPoint(M.positionScreen.x,M.positionScreen.y);if(x.instersects(z)){Na=0;for(Ra=N.materials.length;Na<Ra;){Pa=N.materials[Na++];Pa.opacity!=0&&E(O,M,N,Pa,Ga)}}}else if(N instanceof THREE.RenderableFace3){O=N.v1;M=N.v2;va=N.v3;O.positionScreen.x*=o;O.positionScreen.y*=p;M.positionScreen.x*=o;M.positionScreen.y*=p;va.positionScreen.x*=o;va.positionScreen.y*=p;if(N.overdraw){Ma(O.positionScreen,M.positionScreen);Ma(M.positionScreen,va.positionScreen);Ma(va.positionScreen,O.positionScreen)}z.add3Points(O.positionScreen.x,
 O.positionScreen.y,M.positionScreen.x,M.positionScreen.y,va.positionScreen.x,va.positionScreen.y);if(x.instersects(z)){Na=0;for(Ra=N.meshMaterials.length;Na<Ra;){Pa=N.meshMaterials[Na++];if(Pa instanceof THREE.MeshFaceMaterial){ib=0;for(jb=N.faceMaterials.length;ib<jb;)(Pa=N.faceMaterials[ib++])&&Pa.opacity!=0&&aa(O,M,va,0,1,2,N,Pa,Ga)}else Pa.opacity!=0&&aa(O,M,va,0,1,2,N,Pa,Ga)}}}else if(N instanceof THREE.RenderableFace4){O=N.v1;M=N.v2;va=N.v3;la=N.v4;O.positionScreen.x*=o;O.positionScreen.y*=
-p;M.positionScreen.x*=o;M.positionScreen.y*=p;va.positionScreen.x*=o;va.positionScreen.y*=p;la.positionScreen.x*=o;la.positionScreen.y*=p;qa.positionScreen.copy(M.positionScreen);fa.positionScreen.copy(la.positionScreen);if(N.overdraw){Ma(O.positionScreen,M.positionScreen);Ma(M.positionScreen,la.positionScreen);Ma(la.positionScreen,O.positionScreen);Ma(va.positionScreen,qa.positionScreen);Ma(va.positionScreen,fa.positionScreen)}z.addPoint(O.positionScreen.x,O.positionScreen.y);z.addPoint(M.positionScreen.x,
-M.positionScreen.y);z.addPoint(va.positionScreen.x,va.positionScreen.y);z.addPoint(la.positionScreen.x,la.positionScreen.y);if(x.instersects(z)){Na=0;for(Ra=N.meshMaterials.length;Na<Ra;){Pa=N.meshMaterials[Na++];if(Pa instanceof THREE.MeshFaceMaterial){ib=0;for(jb=N.faceMaterials.length;ib<jb;)(Pa=N.faceMaterials[ib++])&&Pa.opacity!=0&&w(O,M,va,la,qa,fa,N,Pa,Ga)}else Pa.opacity!=0&&w(O,M,va,la,qa,fa,N,Pa,Ga)}}}v.addRectangle(z)}t.setTransform(1,0,0,1,0,0)}};
-THREE.SVGRenderer=function(){function b(ea,wa,ta){var pa,ca,ka,ma;pa=0;for(ca=ea.lights.length;pa<ca;pa++){ka=ea.lights[pa];if(ka instanceof THREE.DirectionalLight){ma=wa.normalWorld.dot(ka.position)*ka.intensity;if(ma>0){ta.r+=ka.color.r*ma;ta.g+=ka.color.g*ma;ta.b+=ka.color.b*ma}}else if(ka instanceof THREE.PointLight){fa.sub(ka.position,wa.centroidWorld);fa.normalize();ma=wa.normalWorld.dot(fa)*ka.intensity;if(ma>0){ta.r+=ka.color.r*ma;ta.g+=ka.color.g*ma;ta.b+=ka.color.b*ma}}}}function d(ea,wa,
-ta,pa,ca,ka){h.data.vertices+=3;h.data.faces++;oa=f(Da++);oa.setAttribute("d","M "+ea.positionScreen.x+" "+ea.positionScreen.y+" L "+wa.positionScreen.x+" "+wa.positionScreen.y+" L "+ta.positionScreen.x+","+ta.positionScreen.y+"z");if(ca instanceof THREE.MeshBasicMaterial)V.__styleString=ca.color.__styleString;else if(ca instanceof THREE.MeshLambertMaterial)if(C){O.r=M.r;O.g=M.g;O.b=M.b;b(ka,pa,O);V.r=ca.color.r*O.r;V.g=ca.color.g*O.g;V.b=ca.color.b*O.b;V.updateStyleString()}else V.__styleString=
+p;M.positionScreen.x*=o;M.positionScreen.y*=p;va.positionScreen.x*=o;va.positionScreen.y*=p;la.positionScreen.x*=o;la.positionScreen.y*=p;qa.positionScreen.copy(M.positionScreen);ga.positionScreen.copy(la.positionScreen);if(N.overdraw){Ma(O.positionScreen,M.positionScreen);Ma(M.positionScreen,la.positionScreen);Ma(la.positionScreen,O.positionScreen);Ma(va.positionScreen,qa.positionScreen);Ma(va.positionScreen,ga.positionScreen)}z.addPoint(O.positionScreen.x,O.positionScreen.y);z.addPoint(M.positionScreen.x,
+M.positionScreen.y);z.addPoint(va.positionScreen.x,va.positionScreen.y);z.addPoint(la.positionScreen.x,la.positionScreen.y);if(x.instersects(z)){Na=0;for(Ra=N.meshMaterials.length;Na<Ra;){Pa=N.meshMaterials[Na++];if(Pa instanceof THREE.MeshFaceMaterial){ib=0;for(jb=N.faceMaterials.length;ib<jb;)(Pa=N.faceMaterials[ib++])&&Pa.opacity!=0&&w(O,M,va,la,qa,ga,N,Pa,Ga)}else Pa.opacity!=0&&w(O,M,va,la,qa,ga,N,Pa,Ga)}}}v.addRectangle(z)}t.setTransform(1,0,0,1,0,0)}};
+THREE.SVGRenderer=function(){function b(fa,wa,ta){var pa,ca,ka,ma;pa=0;for(ca=fa.lights.length;pa<ca;pa++){ka=fa.lights[pa];if(ka instanceof THREE.DirectionalLight){ma=wa.normalWorld.dot(ka.position)*ka.intensity;if(ma>0){ta.r+=ka.color.r*ma;ta.g+=ka.color.g*ma;ta.b+=ka.color.b*ma}}else if(ka instanceof THREE.PointLight){ga.sub(ka.position,wa.centroidWorld);ga.normalize();ma=wa.normalWorld.dot(ga)*ka.intensity;if(ma>0){ta.r+=ka.color.r*ma;ta.g+=ka.color.g*ma;ta.b+=ka.color.b*ma}}}}function d(fa,wa,
+ta,pa,ca,ka){h.data.vertices+=3;h.data.faces++;oa=f(Da++);oa.setAttribute("d","M "+fa.positionScreen.x+" "+fa.positionScreen.y+" L "+wa.positionScreen.x+" "+wa.positionScreen.y+" L "+ta.positionScreen.x+","+ta.positionScreen.y+"z");if(ca instanceof THREE.MeshBasicMaterial)V.__styleString=ca.color.__styleString;else if(ca instanceof THREE.MeshLambertMaterial)if(C){O.r=M.r;O.g=M.g;O.b=M.b;b(ka,pa,O);V.r=ca.color.r*O.r;V.g=ca.color.g*O.g;V.b=ca.color.b*O.b;V.updateStyleString()}else V.__styleString=
 ca.color.__styleString;else if(ca instanceof THREE.MeshDepthMaterial){qa=1-ca.__2near/(ca.__farPlusNear-pa.z*ca.__farMinusNear);V.setRGB(qa,qa,qa)}else ca instanceof THREE.MeshNormalMaterial&&V.setRGB(g(pa.normalWorld.x),g(pa.normalWorld.y),g(pa.normalWorld.z));ca.wireframe?oa.setAttribute("style","fill: none; stroke: "+V.__styleString+"; stroke-width: "+ca.wireframeLinewidth+"; stroke-opacity: "+ca.opacity+"; stroke-linecap: "+ca.wireframeLinecap+"; stroke-linejoin: "+ca.wireframeLinejoin):oa.setAttribute("style",
-"fill: "+V.__styleString+"; fill-opacity: "+ca.opacity);m.appendChild(oa)}function c(ea,wa,ta,pa,ca,ka,ma){h.data.vertices+=4;h.data.faces++;oa=f(Da++);oa.setAttribute("d","M "+ea.positionScreen.x+" "+ea.positionScreen.y+" L "+wa.positionScreen.x+" "+wa.positionScreen.y+" L "+ta.positionScreen.x+","+ta.positionScreen.y+" L "+pa.positionScreen.x+","+pa.positionScreen.y+"z");if(ka instanceof THREE.MeshBasicMaterial)V.__styleString=ka.color.__styleString;else if(ka instanceof THREE.MeshLambertMaterial)if(C){O.r=
+"fill: "+V.__styleString+"; fill-opacity: "+ca.opacity);m.appendChild(oa)}function c(fa,wa,ta,pa,ca,ka,ma){h.data.vertices+=4;h.data.faces++;oa=f(Da++);oa.setAttribute("d","M "+fa.positionScreen.x+" "+fa.positionScreen.y+" L "+wa.positionScreen.x+" "+wa.positionScreen.y+" L "+ta.positionScreen.x+","+ta.positionScreen.y+" L "+pa.positionScreen.x+","+pa.positionScreen.y+"z");if(ka instanceof THREE.MeshBasicMaterial)V.__styleString=ka.color.__styleString;else if(ka instanceof THREE.MeshLambertMaterial)if(C){O.r=
 M.r;O.g=M.g;O.b=M.b;b(ma,ca,O);V.r=ka.color.r*O.r;V.g=ka.color.g*O.g;V.b=ka.color.b*O.b;V.updateStyleString()}else V.__styleString=ka.color.__styleString;else if(ka instanceof THREE.MeshDepthMaterial){qa=1-ka.__2near/(ka.__farPlusNear-ca.z*ka.__farMinusNear);V.setRGB(qa,qa,qa)}else ka instanceof THREE.MeshNormalMaterial&&V.setRGB(g(ca.normalWorld.x),g(ca.normalWorld.y),g(ca.normalWorld.z));ka.wireframe?oa.setAttribute("style","fill: none; stroke: "+V.__styleString+"; stroke-width: "+ka.wireframeLinewidth+
-"; stroke-opacity: "+ka.opacity+"; stroke-linecap: "+ka.wireframeLinecap+"; stroke-linejoin: "+ka.wireframeLinejoin):oa.setAttribute("style","fill: "+V.__styleString+"; fill-opacity: "+ka.opacity);m.appendChild(oa)}function f(ea){if(ia[ea]==null){ia[ea]=document.createElementNS("http://www.w3.org/2000/svg","path");da==0&&ia[ea].setAttribute("shape-rendering","crispEdges")}return ia[ea]}function g(ea){return ea<0?Math.min((1+ea)*0.5,0.5):0.5+Math.min(ea*0.5,0.5)}var h=this,j=null,k=new THREE.Projector,
-m=document.createElementNS("http://www.w3.org/2000/svg","svg"),o,p,t,y,u,A,F,J,B=new THREE.Rectangle,U=new THREE.Rectangle,C=!1,V=new THREE.Color(16777215),O=new THREE.Color(16777215),M=new THREE.Color(0),va=new THREE.Color(0),la=new THREE.Color(0),qa,fa=new THREE.Vector3,ia=[],e=[],oa,Da,Aa,da=1;this.domElement=m;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.data={vertices:0,faces:0};this.setQuality=function(ea){switch(ea){case "high":da=1;break;case "low":da=0}};this.setSize=function(ea,
-wa){o=ea;p=wa;t=o/2;y=p/2;m.setAttribute("viewBox",-t+" "+-y+" "+o+" "+p);m.setAttribute("width",o);m.setAttribute("height",p);B.set(-t,-y,t,y)};this.clear=function(){for(;m.childNodes.length>0;)m.removeChild(m.childNodes[0])};this.render=function(ea,wa){var ta,pa,ca,ka,ma,Fa,ja,ga;this.autoClear&&this.clear();h.data.vertices=0;h.data.faces=0;j=k.projectScene(ea,wa,this.sortElements);Aa=Da=0;if(C=ea.lights.length>0){ja=ea.lights;M.setRGB(0,0,0);va.setRGB(0,0,0);la.setRGB(0,0,0);ta=0;for(pa=ja.length;ta<
+"; stroke-opacity: "+ka.opacity+"; stroke-linecap: "+ka.wireframeLinecap+"; stroke-linejoin: "+ka.wireframeLinejoin):oa.setAttribute("style","fill: "+V.__styleString+"; fill-opacity: "+ka.opacity);m.appendChild(oa)}function f(fa){if(ea[fa]==null){ea[fa]=document.createElementNS("http://www.w3.org/2000/svg","path");da==0&&ea[fa].setAttribute("shape-rendering","crispEdges")}return ea[fa]}function g(fa){return fa<0?Math.min((1+fa)*0.5,0.5):0.5+Math.min(fa*0.5,0.5)}var h=this,j=null,k=new THREE.Projector,
+m=document.createElementNS("http://www.w3.org/2000/svg","svg"),o,p,t,y,u,A,F,J,B=new THREE.Rectangle,U=new THREE.Rectangle,C=!1,V=new THREE.Color(16777215),O=new THREE.Color(16777215),M=new THREE.Color(0),va=new THREE.Color(0),la=new THREE.Color(0),qa,ga=new THREE.Vector3,ea=[],e=[],oa,Da,Aa,da=1;this.domElement=m;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.data={vertices:0,faces:0};this.setQuality=function(fa){switch(fa){case "high":da=1;break;case "low":da=0}};this.setSize=function(fa,
+wa){o=fa;p=wa;t=o/2;y=p/2;m.setAttribute("viewBox",-t+" "+-y+" "+o+" "+p);m.setAttribute("width",o);m.setAttribute("height",p);B.set(-t,-y,t,y)};this.clear=function(){for(;m.childNodes.length>0;)m.removeChild(m.childNodes[0])};this.render=function(fa,wa){var ta,pa,ca,ka,ma,Fa,ja,ha;this.autoClear&&this.clear();h.data.vertices=0;h.data.faces=0;j=k.projectScene(fa,wa,this.sortElements);Aa=Da=0;if(C=fa.lights.length>0){ja=fa.lights;M.setRGB(0,0,0);va.setRGB(0,0,0);la.setRGB(0,0,0);ta=0;for(pa=ja.length;ta<
 pa;ta++){ca=ja[ta];ka=ca.color;if(ca instanceof THREE.AmbientLight){M.r+=ka.r;M.g+=ka.g;M.b+=ka.b}else if(ca instanceof THREE.DirectionalLight){va.r+=ka.r;va.g+=ka.g;va.b+=ka.b}else if(ca instanceof THREE.PointLight){la.r+=ka.r;la.g+=ka.g;la.b+=ka.b}}}ta=0;for(pa=j.length;ta<pa;ta++){ja=j[ta];U.empty();if(ja instanceof THREE.RenderableParticle){u=ja;u.x*=t;u.y*=-y;ca=0;for(ka=ja.materials.length;ca<ka;)ca++}else if(ja instanceof THREE.RenderableLine){u=ja.v1;A=ja.v2;u.positionScreen.x*=t;u.positionScreen.y*=
--y;A.positionScreen.x*=t;A.positionScreen.y*=-y;U.addPoint(u.positionScreen.x,u.positionScreen.y);U.addPoint(A.positionScreen.x,A.positionScreen.y);if(B.instersects(U)){ca=0;for(ka=ja.materials.length;ca<ka;)if((ga=ja.materials[ca++])&&ga.opacity!=0){ma=u;Fa=A;var Ja=Aa++;if(e[Ja]==null){e[Ja]=document.createElementNS("http://www.w3.org/2000/svg","line");da==0&&e[Ja].setAttribute("shape-rendering","crispEdges")}oa=e[Ja];oa.setAttribute("x1",ma.positionScreen.x);oa.setAttribute("y1",ma.positionScreen.y);
-oa.setAttribute("x2",Fa.positionScreen.x);oa.setAttribute("y2",Fa.positionScreen.y);if(ga instanceof THREE.LineBasicMaterial){V.__styleString=ga.color.__styleString;oa.setAttribute("style","fill: none; stroke: "+V.__styleString+"; stroke-width: "+ga.linewidth+"; stroke-opacity: "+ga.opacity+"; stroke-linecap: "+ga.linecap+"; stroke-linejoin: "+ga.linejoin);m.appendChild(oa)}}}}else if(ja instanceof THREE.RenderableFace3){u=ja.v1;A=ja.v2;F=ja.v3;u.positionScreen.x*=t;u.positionScreen.y*=-y;A.positionScreen.x*=
-t;A.positionScreen.y*=-y;F.positionScreen.x*=t;F.positionScreen.y*=-y;U.addPoint(u.positionScreen.x,u.positionScreen.y);U.addPoint(A.positionScreen.x,A.positionScreen.y);U.addPoint(F.positionScreen.x,F.positionScreen.y);if(B.instersects(U)){ca=0;for(ka=ja.meshMaterials.length;ca<ka;){ga=ja.meshMaterials[ca++];if(ga instanceof THREE.MeshFaceMaterial){ma=0;for(Fa=ja.faceMaterials.length;ma<Fa;)(ga=ja.faceMaterials[ma++])&&ga.opacity!=0&&d(u,A,F,ja,ga,ea)}else ga&&ga.opacity!=0&&d(u,A,F,ja,ga,ea)}}}else if(ja instanceof
-THREE.RenderableFace4){u=ja.v1;A=ja.v2;F=ja.v3;J=ja.v4;u.positionScreen.x*=t;u.positionScreen.y*=-y;A.positionScreen.x*=t;A.positionScreen.y*=-y;F.positionScreen.x*=t;F.positionScreen.y*=-y;J.positionScreen.x*=t;J.positionScreen.y*=-y;U.addPoint(u.positionScreen.x,u.positionScreen.y);U.addPoint(A.positionScreen.x,A.positionScreen.y);U.addPoint(F.positionScreen.x,F.positionScreen.y);U.addPoint(J.positionScreen.x,J.positionScreen.y);if(B.instersects(U)){ca=0;for(ka=ja.meshMaterials.length;ca<ka;){ga=
-ja.meshMaterials[ca++];if(ga instanceof THREE.MeshFaceMaterial){ma=0;for(Fa=ja.faceMaterials.length;ma<Fa;)(ga=ja.faceMaterials[ma++])&&ga.opacity!=0&&c(u,A,F,J,ja,ga,ea)}else ga&&ga.opacity!=0&&c(u,A,F,J,ja,ga,ea)}}}}}};
+-y;A.positionScreen.x*=t;A.positionScreen.y*=-y;U.addPoint(u.positionScreen.x,u.positionScreen.y);U.addPoint(A.positionScreen.x,A.positionScreen.y);if(B.instersects(U)){ca=0;for(ka=ja.materials.length;ca<ka;)if((ha=ja.materials[ca++])&&ha.opacity!=0){ma=u;Fa=A;var Ja=Aa++;if(e[Ja]==null){e[Ja]=document.createElementNS("http://www.w3.org/2000/svg","line");da==0&&e[Ja].setAttribute("shape-rendering","crispEdges")}oa=e[Ja];oa.setAttribute("x1",ma.positionScreen.x);oa.setAttribute("y1",ma.positionScreen.y);
+oa.setAttribute("x2",Fa.positionScreen.x);oa.setAttribute("y2",Fa.positionScreen.y);if(ha instanceof THREE.LineBasicMaterial){V.__styleString=ha.color.__styleString;oa.setAttribute("style","fill: none; stroke: "+V.__styleString+"; stroke-width: "+ha.linewidth+"; stroke-opacity: "+ha.opacity+"; stroke-linecap: "+ha.linecap+"; stroke-linejoin: "+ha.linejoin);m.appendChild(oa)}}}}else if(ja instanceof THREE.RenderableFace3){u=ja.v1;A=ja.v2;F=ja.v3;u.positionScreen.x*=t;u.positionScreen.y*=-y;A.positionScreen.x*=
+t;A.positionScreen.y*=-y;F.positionScreen.x*=t;F.positionScreen.y*=-y;U.addPoint(u.positionScreen.x,u.positionScreen.y);U.addPoint(A.positionScreen.x,A.positionScreen.y);U.addPoint(F.positionScreen.x,F.positionScreen.y);if(B.instersects(U)){ca=0;for(ka=ja.meshMaterials.length;ca<ka;){ha=ja.meshMaterials[ca++];if(ha instanceof THREE.MeshFaceMaterial){ma=0;for(Fa=ja.faceMaterials.length;ma<Fa;)(ha=ja.faceMaterials[ma++])&&ha.opacity!=0&&d(u,A,F,ja,ha,fa)}else ha&&ha.opacity!=0&&d(u,A,F,ja,ha,fa)}}}else if(ja instanceof
+THREE.RenderableFace4){u=ja.v1;A=ja.v2;F=ja.v3;J=ja.v4;u.positionScreen.x*=t;u.positionScreen.y*=-y;A.positionScreen.x*=t;A.positionScreen.y*=-y;F.positionScreen.x*=t;F.positionScreen.y*=-y;J.positionScreen.x*=t;J.positionScreen.y*=-y;U.addPoint(u.positionScreen.x,u.positionScreen.y);U.addPoint(A.positionScreen.x,A.positionScreen.y);U.addPoint(F.positionScreen.x,F.positionScreen.y);U.addPoint(J.positionScreen.x,J.positionScreen.y);if(B.instersects(U)){ca=0;for(ka=ja.meshMaterials.length;ca<ka;){ha=
+ja.meshMaterials[ca++];if(ha instanceof THREE.MeshFaceMaterial){ma=0;for(Fa=ja.faceMaterials.length;ma<Fa;)(ha=ja.faceMaterials[ma++])&&ha.opacity!=0&&c(u,A,F,J,ja,ha,fa)}else ha&&ha.opacity!=0&&c(u,A,F,J,ja,ha,fa)}}}}}};
 THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform int combine;\n#endif",
 envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
 map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\n#endif",map_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\nuniform sampler2D lightMap;\n#endif",
@@ -220,7 +220,7 @@ THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.Shade
 THREE.ShaderChunk.default_vertex,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsLib.particle,fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["uniform float size;\nuniform float scale;",
 THREE.ShaderChunk.color_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;\n}"].join("\n")}};
 THREE.WebGLRenderer=function(b){function d(n,D,x){var v,z,Q,K=n.vertices,G=K.length,T=n.colors,H=T.length,I=n.__vertexArray,L=n.__colorArray,Z=n.__sortArray,Y=n.__dirtyVertices,ra=n.__dirtyColors;if(x.sortParticles){Ja.multiplySelf(x.matrixWorld);for(v=0;v<G;v++){z=K[v].position;Ta.copy(z);Ja.multiplyVector3(Ta);Z[v]=[Ta.z,v]}Z.sort(function(Ka,Ca){return Ca[0]-Ka[0]});for(v=0;v<G;v++){z=K[Z[v][1]].position;Q=v*3;I[Q]=z.x;I[Q+1]=z.y;I[Q+2]=z.z}for(v=0;v<H;v++){Q=v*3;color=T[Z[v][1]];L[Q]=color.r;
-L[Q+1]=color.g;L[Q+2]=color.b}}else{if(Y)for(v=0;v<G;v++){z=K[v].position;Q=v*3;I[Q]=z.x;I[Q+1]=z.y;I[Q+2]=z.z}if(ra)for(v=0;v<H;v++){color=T[v];Q=v*3;L[Q]=color.r;L[Q+1]=color.g;L[Q+2]=color.b}}if(Y||x.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,n.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,I,D)}if(ra||x.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,n.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,L,D)}}function c(n,D,x,v,z){v.program||ia.initMaterial(v,D,x,z);var Q=v.program,K=Q.uniforms,G=v.uniforms;
+L[Q+1]=color.g;L[Q+2]=color.b}}else{if(Y)for(v=0;v<G;v++){z=K[v].position;Q=v*3;I[Q]=z.x;I[Q+1]=z.y;I[Q+2]=z.z}if(ra)for(v=0;v<H;v++){color=T[v];Q=v*3;L[Q]=color.r;L[Q+1]=color.g;L[Q+2]=color.b}}if(Y||x.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,n.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,I,D)}if(ra||x.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,n.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,L,D)}}function c(n,D,x,v,z){v.program||ea.initMaterial(v,D,x,z);var Q=v.program,K=Q.uniforms,G=v.uniforms;
 if(Q!=Aa){e.useProgram(Q);Aa=Q}e.uniformMatrix4fv(K.projectionMatrix,!1,Xa);if(x&&(v instanceof THREE.MeshBasicMaterial||v instanceof THREE.MeshLambertMaterial||v instanceof THREE.MeshPhongMaterial||v instanceof THREE.LineBasicMaterial||v instanceof THREE.ParticleBasicMaterial||v.fog)){G.fogColor.value=x.color;if(x instanceof THREE.Fog){G.fogNear.value=x.near;G.fogFar.value=x.far}else if(x instanceof THREE.FogExp2)G.fogDensity.value=x.density}if(v instanceof THREE.MeshPhongMaterial||v instanceof THREE.MeshLambertMaterial||
 v.lights){var T,H,I=0,L=0,Z=0,Y,ra,Ka,Ca,Ha=R,Ga=Ha.directional.colors,xa=Ha.directional.positions,Ea=Ha.point.colors,za=Ha.point.positions,Ua=Ha.point.distances,E=0,aa=0;x=H=Ca=0;for(T=D.length;x<T;x++){H=D[x];Y=H.color;ra=H.position;Ka=H.intensity;Ca=H.distance;if(H instanceof THREE.AmbientLight){I+=Y.r;L+=Y.g;Z+=Y.b}else if(H instanceof THREE.DirectionalLight){Ca=E*3;Ga[Ca]=Y.r*Ka;Ga[Ca+1]=Y.g*Ka;Ga[Ca+2]=Y.b*Ka;xa[Ca]=ra.x;xa[Ca+1]=ra.y;xa[Ca+2]=ra.z;E+=1}else if(H instanceof THREE.PointLight){H=
 aa*3;Ea[H]=Y.r*Ka;Ea[H+1]=Y.g*Ka;Ea[H+2]=Y.b*Ka;za[H]=ra.x;za[H+1]=ra.y;za[H+2]=ra.z;Ua[aa]=Ca;aa+=1}}for(x=E*3;x<Ga.length;x++)Ga[x]=0;for(x=aa*3;x<Ea.length;x++)Ea[x]=0;Ha.point.length=aa;Ha.directional.length=E;Ha.ambient[0]=I;Ha.ambient[1]=L;Ha.ambient[2]=Z;x=R;G.enableLighting.value=x.directional.length+x.point.length;G.ambientLightColor.value=x.ambient;G.directionalLightColor.value=x.directional.colors;G.directionalLightDirection.value=x.directional.positions;G.pointLightColor.value=x.point.colors;
@@ -236,65 +236,65 @@ e.vertexAttribPointer(D.position,3,e.FLOAT,!1,0,0)}else if(D.position>=0){e.bind
 0){D=v.attributes[K];e.bindBuffer(e.ARRAY_BUFFER,D.buffer);e.vertexAttribPointer(n[K],D.size,e.FLOAT,!1,0,0)}if(n.color>=0){e.bindBuffer(e.ARRAY_BUFFER,z.__webglColorBuffer);e.vertexAttribPointer(n.color,3,e.FLOAT,!1,0,0)}if(n.normal>=0){e.bindBuffer(e.ARRAY_BUFFER,z.__webglNormalBuffer);e.vertexAttribPointer(n.normal,3,e.FLOAT,!1,0,0)}if(n.tangent>=0){e.bindBuffer(e.ARRAY_BUFFER,z.__webglTangentBuffer);e.vertexAttribPointer(n.tangent,4,e.FLOAT,!1,0,0)}if(n.uv>=0)if(z.__webglUVBuffer){e.bindBuffer(e.ARRAY_BUFFER,
 z.__webglUVBuffer);e.vertexAttribPointer(n.uv,2,e.FLOAT,!1,0,0);e.enableVertexAttribArray(n.uv)}else e.disableVertexAttribArray(n.uv);if(n.uv2>=0)if(z.__webglUV2Buffer){e.bindBuffer(e.ARRAY_BUFFER,z.__webglUV2Buffer);e.vertexAttribPointer(n.uv2,2,e.FLOAT,!1,0,0);e.enableVertexAttribArray(n.uv2)}else e.disableVertexAttribArray(n.uv2);if(v.skinning&&n.skinVertexA>=0&&n.skinVertexB>=0&&n.skinIndex>=0&&n.skinWeight>=0){e.bindBuffer(e.ARRAY_BUFFER,z.__webglSkinVertexABuffer);e.vertexAttribPointer(n.skinVertexA,
 4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,z.__webglSkinVertexBBuffer);e.vertexAttribPointer(n.skinVertexB,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,z.__webglSkinIndicesBuffer);e.vertexAttribPointer(n.skinIndex,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,z.__webglSkinWeightsBuffer);e.vertexAttribPointer(n.skinWeight,4,e.FLOAT,!1,0,0)}if(Q instanceof THREE.Mesh){if(v.wireframe){e.lineWidth(v.wireframeLinewidth);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,z.__webglLineBuffer);e.drawElements(e.LINES,
-z.__webglLineCount,e.UNSIGNED_SHORT,0)}else{e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,z.__webglFaceBuffer);e.drawElements(e.TRIANGLES,z.__webglFaceCount,e.UNSIGNED_SHORT,0)}ia.data.vertices+=z.__webglFaceCount;ia.data.faces+=z.__webglFaceCount/3}else if(Q instanceof THREE.Line){Q=Q.type==THREE.LineStrip?e.LINE_STRIP:e.LINES;e.lineWidth(v.linewidth);e.drawArrays(Q,0,z.__webglLineCount)}else if(Q instanceof THREE.ParticleSystem)e.drawArrays(e.POINTS,0,z.__webglParticleCount);else Q instanceof THREE.Ribbon&&
-e.drawArrays(e.TRIANGLE_STRIP,0,z.__webglVertexCount)}}function g(n,D,x){if(!n.__webglVertexBuffer)n.__webglVertexBuffer=e.createBuffer();if(!n.__webglNormalBuffer)n.__webglNormalBuffer=e.createBuffer();if(n.hasPos){e.bindBuffer(e.ARRAY_BUFFER,n.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,n.positionArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(D.attributes.position);e.vertexAttribPointer(D.attributes.position,3,e.FLOAT,!1,0,0)}if(n.hasNormal){e.bindBuffer(e.ARRAY_BUFFER,n.__webglNormalBuffer);
-if(x==THREE.FlatShading){var v,z,Q,K,G,T,H,I,L,Z,Y=n.count*3;for(Z=0;Z<Y;Z+=9){x=n.normalArray;v=x[Z];z=x[Z+1];Q=x[Z+2];K=x[Z+3];T=x[Z+4];I=x[Z+5];G=x[Z+6];H=x[Z+7];L=x[Z+8];v=(v+K+G)/3;z=(z+T+H)/3;Q=(Q+I+L)/3;x[Z]=v;x[Z+1]=z;x[Z+2]=Q;x[Z+3]=v;x[Z+4]=z;x[Z+5]=Q;x[Z+6]=v;x[Z+7]=z;x[Z+8]=Q}}e.bufferData(e.ARRAY_BUFFER,n.normalArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(D.attributes.normal);e.vertexAttribPointer(D.attributes.normal,3,e.FLOAT,!1,0,0)}e.drawArrays(e.TRIANGLES,0,n.count);n.count=0}
-function h(n){if(wa!=n.doubleSided){n.doubleSided?e.disable(e.CULL_FACE):e.enable(e.CULL_FACE);wa=n.doubleSided}if(ta!=n.flipSided){n.flipSided?e.frontFace(e.CW):e.frontFace(e.CCW);ta=n.flipSided}}function j(n){if(ca!=n){n?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST);ca=n}}function k(n){ga[0].set(n.n41-n.n11,n.n42-n.n12,n.n43-n.n13,n.n44-n.n14);ga[1].set(n.n41+n.n11,n.n42+n.n12,n.n43+n.n13,n.n44+n.n14);ga[2].set(n.n41+n.n21,n.n42+n.n22,n.n43+n.n23,n.n44+n.n24);ga[3].set(n.n41-n.n21,n.n42-n.n22,
-n.n43-n.n23,n.n44-n.n24);ga[4].set(n.n41-n.n31,n.n42-n.n32,n.n43-n.n33,n.n44-n.n34);ga[5].set(n.n41+n.n31,n.n42+n.n32,n.n43+n.n33,n.n44+n.n34);var D;for(n=0;n<6;n++){D=ga[n];D.divideScalar(Math.sqrt(D.x*D.x+D.y*D.y+D.z*D.z))}}function m(n){for(var D=n.matrixWorld,x=-n.geometry.boundingSphere.radius*Math.max(n.scale.x,Math.max(n.scale.y,n.scale.z)),v=0;v<6;v++){n=ga[v].x*D.n14+ga[v].y*D.n24+ga[v].z*D.n34+ga[v].w;if(n<=x)return!1}return!0}function o(n,D){n.list[n.count]=D;n.count+=1}function p(n){var D,
-x,v=n.object,z=n.opaque,Q=n.transparent;Q.count=0;n=z.count=0;for(D=v.materials.length;n<D;n++){x=v.materials[n];x.transparent?o(Q,x):o(z,x)}}function t(n){var D,x,v,z,Q=n.object,K=n.buffer,G=n.opaque,T=n.transparent;T.count=0;n=G.count=0;for(v=Q.materials.length;n<v;n++){D=Q.materials[n];if(D instanceof THREE.MeshFaceMaterial){D=0;for(x=K.materials.length;D<x;D++)(z=K.materials[D])&&(z.transparent?o(T,z):o(G,z))}else(z=D)&&(z.transparent?o(T,z):o(G,z))}}function y(n,D){return D.z-n.z}function u(n){e.enable(e.POLYGON_OFFSET_FILL);
-e.polygonOffset(0.1,1);e.enable(e.STENCIL_TEST);e.enable(e.DEPTH_TEST);e.depthMask(!1);e.colorMask(!1,!1,!1,!1);e.stencilFunc(e.ALWAYS,1,255);e.stencilOpSeparate(e.BACK,e.KEEP,e.INCR,e.KEEP);e.stencilOpSeparate(e.FRONT,e.KEEP,e.DECR,e.KEEP);var D,x=n.lights.length,v,z=n.lights,Q=[],K,G,T,H,I,L=n.__webglShadowVolumes.length;for(D=0;D<x;D++){v=n.lights[D];if(v instanceof THREE.DirectionalLight&&v.castShadow){Q[0]=-v.position.x;Q[1]=-v.position.y;Q[2]=-v.position.z;for(I=0;I<L;I++){v=n.__webglShadowVolumes[I].object;
-K=n.__webglShadowVolumes[I].buffer;G=v.materials[0];G.program||ia.initMaterial(G,z,undefined,v);G=G.program;T=G.uniforms;H=G.attributes;if(Aa!==G){e.useProgram(G);Aa=G;e.uniformMatrix4fv(T.projectionMatrix,!1,Xa);e.uniformMatrix4fv(T.viewMatrix,!1,Za);e.uniform3fv(T.directionalLightDirection,Q)}v.matrixWorld.flattenToArray(v._objectMatrixArray);e.uniformMatrix4fv(T.objectMatrix,!1,v._objectMatrixArray);e.bindBuffer(e.ARRAY_BUFFER,K.__webglVertexBuffer);e.vertexAttribPointer(H.position,3,e.FLOAT,!1,
-0,0);e.bindBuffer(e.ARRAY_BUFFER,K.__webglNormalBuffer);e.vertexAttribPointer(H.normal,3,e.FLOAT,!1,0,0);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,K.__webglFaceBuffer);e.cullFace(e.FRONT);e.drawElements(e.TRIANGLES,K.__webglFaceCount,e.UNSIGNED_SHORT,0);e.cullFace(e.BACK);e.drawElements(e.TRIANGLES,K.__webglFaceCount,e.UNSIGNED_SHORT,0)}}}e.disable(e.POLYGON_OFFSET_FILL);e.colorMask(!0,!0,!0,!0);e.stencilFunc(e.NOTEQUAL,0,255);e.stencilOp(e.KEEP,e.KEEP,e.KEEP);e.disable(e.DEPTH_TEST);pa="";Aa=S.program;
-e.useProgram(S.program);e.uniformMatrix4fv(S.projectionLocation,!1,Xa);e.uniform1f(S.darknessLocation,S.darkness);e.bindBuffer(e.ARRAY_BUFFER,S.vertexBuffer);e.vertexAttribPointer(S.vertexLocation,3,e.FLOAT,!1,0,0);e.enableVertexAttribArray(S.vertexLocation);e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA);e.blendEquation(e.FUNC_ADD);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,S.elementBuffer);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0);e.disable(e.STENCIL_TEST);e.enable(e.DEPTH_TEST);e.depthMask(ea)}function A(n,
-D){var x,v,z;x=_sprite.attributes;var Q=_sprite.uniforms,K=ja/Fa,G,T=[],H=Fa*0.5,I=ja*0.5,L=!0;e.useProgram(_sprite.program);Aa=_sprite.program;pa="";if(!La){e.enableVertexAttribArray(_sprite.attributes.position);e.enableVertexAttribArray(_sprite.attributes.uv);La=!0}e.disable(e.CULL_FACE);e.enable(e.BLEND);e.depthMask(!0);e.bindBuffer(e.ARRAY_BUFFER,_sprite.vertexBuffer);e.vertexAttribPointer(x.position,2,e.FLOAT,!1,16,0);e.vertexAttribPointer(x.uv,2,e.FLOAT,!1,16,8);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,
-_sprite.elementBuffer);e.uniformMatrix4fv(Q.projectionMatrix,!1,Xa);e.activeTexture(e.TEXTURE0);e.uniform1i(Q.map,0);x=0;for(v=n.__webglSprites.length;x<v;x++){z=n.__webglSprites[x];if(z.useScreenCoordinates)z.z=-z.position.z;else{z._modelViewMatrix.multiplyToArray(D.matrixWorldInverse,z.matrixWorld,z._modelViewMatrixArray);z.z=-z._modelViewMatrix.n34}}n.__webglSprites.sort(y);x=0;for(v=n.__webglSprites.length;x<v;x++){z=n.__webglSprites[x];if(z.material===undefined&&z.map&&z.map.image&&z.map.image.width){if(z.useScreenCoordinates){e.uniform1i(Q.useScreenCoordinates,
-1);e.uniform3f(Q.screenPosition,(z.position.x-H)/H,(I-z.position.y)/I,Math.max(0,Math.min(1,z.position.z)))}else{e.uniform1i(Q.useScreenCoordinates,0);e.uniform1i(Q.affectedByDistance,z.affectedByDistance?1:0);e.uniformMatrix4fv(Q.modelViewMatrix,!1,z._modelViewMatrixArray)}G=z.map.image.width/(z.affectedByDistance?1:ja);T[0]=G*K*z.scale.x;T[1]=G*z.scale.y;e.uniform2f(Q.uvScale,z.uvScale.x,z.uvScale.y);e.uniform2f(Q.uvOffset,z.uvOffset.x,z.uvOffset.y);e.uniform2f(Q.alignment,z.alignment.x,z.alignment.y);
-e.uniform1f(Q.opacity,z.opacity);e.uniform1f(Q.rotation,z.rotation);e.uniform2fv(Q.scale,T);if(z.mergeWith3D&&!L){e.enable(e.DEPTH_TEST);L=!0}else if(!z.mergeWith3D&&L){e.disable(e.DEPTH_TEST);L=!1}V(z.blending);M(z.map,0);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0)}}e.enable(e.CULL_FACE);e.enable(e.DEPTH_TEST);e.depthMask(ea)}function F(n,D){var x,v,z=n.__webglLensFlares.length,Q,K,G,T=new THREE.Vector3,H=ja/Fa,I=Fa*0.5,L=ja*0.5,Z=16/ja,Y=[Z*H,Z],ra=[1,1,0],Ka=[1,1],Ca=P.uniforms;x=P.attributes;
-e.useProgram(P.program);Aa=P.program;pa="";if(!Ba){e.enableVertexAttribArray(P.attributes.vertex);e.enableVertexAttribArray(P.attributes.uv);Ba=!0}e.uniform1i(Ca.occlusionMap,0);e.uniform1i(Ca.map,1);e.bindBuffer(e.ARRAY_BUFFER,P.vertexBuffer);e.vertexAttribPointer(x.vertex,2,e.FLOAT,!1,16,0);e.vertexAttribPointer(x.uv,2,e.FLOAT,!1,16,8);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,P.elementBuffer);e.disable(e.CULL_FACE);e.depthMask(!1);e.activeTexture(e.TEXTURE0);e.bindTexture(e.TEXTURE_2D,P.occlusionTexture);
-e.activeTexture(e.TEXTURE1);for(v=0;v<z;v++){x=n.__webglLensFlares[v].object;T.set(x.matrixWorld.n14,x.matrixWorld.n24,x.matrixWorld.n34);D.matrixWorldInverse.multiplyVector3(T);D.projectionMatrix.multiplyVector3(T);ra[0]=T.x;ra[1]=T.y;ra[2]=T.z;Ka[0]=ra[0]*I+I;Ka[1]=ra[1]*L+L;if(P.hasVertexTexture||Ka[0]>0&&Ka[0]<Fa&&Ka[1]>0&&Ka[1]<ja){e.bindTexture(e.TEXTURE_2D,P.tempTexture);e.copyTexImage2D(e.TEXTURE_2D,0,e.RGB,Ka[0]-8,Ka[1]-8,16,16,0);e.uniform1i(Ca.renderType,0);e.uniform2fv(Ca.scale,Y);e.uniform3fv(Ca.screenPosition,
-ra);e.disable(e.BLEND);e.enable(e.DEPTH_TEST);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0);e.bindTexture(e.TEXTURE_2D,P.occlusionTexture);e.copyTexImage2D(e.TEXTURE_2D,0,e.RGBA,Ka[0]-8,Ka[1]-8,16,16,0);e.uniform1i(Ca.renderType,1);e.disable(e.DEPTH_TEST);e.bindTexture(e.TEXTURE_2D,P.tempTexture);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0);x.positionScreen.x=ra[0];x.positionScreen.y=ra[1];x.positionScreen.z=ra[2];x.customUpdateCallback?x.customUpdateCallback(x):x.updateLensFlares();e.uniform1i(Ca.renderType,
-2);e.enable(e.BLEND);Q=0;for(K=x.lensFlares.length;Q<K;Q++){G=x.lensFlares[Q];if(G.opacity>0.0010&&G.scale>0.0010){ra[0]=G.x;ra[1]=G.y;ra[2]=G.z;Z=G.size*G.scale/ja;Y[0]=Z*H;Y[1]=Z;e.uniform3fv(Ca.screenPosition,ra);e.uniform2fv(Ca.scale,Y);e.uniform1f(Ca.rotation,G.rotation);e.uniform1f(Ca.opacity,G.opacity);V(G.blending);M(G.texture,1);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0)}}}}e.enable(e.CULL_FACE);e.enable(e.DEPTH_TEST);e.depthMask(ea)}function J(n,D){n._modelViewMatrix.multiplyToArray(D.matrixWorldInverse,
-n.matrixWorld,n._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(n._modelViewMatrix).transposeIntoArray(n._normalMatrixArray)}function B(n){var D,x,v,z,Q;if(n instanceof THREE.Mesh){x=n.geometry;for(D in x.geometryGroups){v=x.geometryGroups[D];Q=!1;for(z in v.__webglCustomAttributes)if(v.__webglCustomAttributes[z].needsUpdate){Q=!0;break}if(x.__dirtyVertices||x.__dirtyMorphTargets||x.__dirtyElements||x.__dirtyUvs||x.__dirtyNormals||x.__dirtyColors||x.__dirtyTangents||Q){Q=e.DYNAMIC_DRAW;var K=void 0,
-G=void 0,T=void 0,H=void 0;T=void 0;var I=void 0,L=void 0,Z=void 0,Y=void 0,ra=void 0,Ka=void 0,Ca=void 0,Ha=void 0,Ga=void 0,xa=void 0,Ea=void 0,za=void 0,Ua=void 0;L=void 0;Z=void 0;H=void 0;Y=void 0;H=void 0;var E=void 0,aa=void 0;L=void 0;E=void 0;aa=void 0;var w=void 0,ab=void 0;E=void 0;aa=void 0;w=void 0;ab=void 0;E=void 0;aa=void 0;w=void 0;ab=void 0;E=void 0;aa=void 0;w=void 0;H=void 0;Y=void 0;I=void 0;T=void 0;T=void 0;E=void 0;aa=void 0;w=void 0;var fb=void 0,Oa=0,Qa=0,cb=0,hb=0,Wa=0,
-$a=0,Ma=0,bb=0,Va=0,N=0,Na=0;aa=E=0;var Ra=v.__vertexArray,ib=v.__uvArray,jb=v.__uv2Array,Pa=v.__normalArray,W=v.__tangentArray,na=v.__colorArray,ha=v.__skinVertexAArray,$=v.__skinVertexBArray,ua=v.__skinIndexArray,sa=v.__skinWeightArray,ya=v.__morphTargetsArrays,X=v.__webglCustomAttributes;w=void 0;var Ia=v.__faceArray,Ya=v.__lineArray,eb=v.__needsSmoothNormals;Ka=v.__vertexColorType;ra=v.__uvType;Ca=v.__normalType;var Sa=n.geometry,kb=Sa.__dirtyVertices,gb=Sa.__dirtyElements,db=Sa.__dirtyUvs,rb=
-Sa.__dirtyNormals,sb=Sa.__dirtyTangents,tb=Sa.__dirtyColors,ub=Sa.__dirtyMorphTargets,nb=Sa.vertices,vb=v.faces,yb=Sa.faces,wb=Sa.faceVertexUvs[0],xb=Sa.faceVertexUvs[1],ob=Sa.skinVerticesA,pb=Sa.skinVerticesB,qb=Sa.skinIndices,lb=Sa.skinWeights,mb=n instanceof THREE.ShadowVolume?Sa.edgeFaces:undefined;morphTargets=Sa.morphTargets;if(X)for(fb in X){X[fb].offset=0;X[fb].offsetSrc=0}K=0;for(G=vb.length;K<G;K++){T=vb[K];H=yb[T];wb&&(Ha=wb[T]);xb&&(Ga=xb[T]);T=H.vertexNormals;I=H.normal;L=H.vertexColors;
-Z=H.color;Y=H.vertexTangents;if(H instanceof THREE.Face3){if(kb){xa=nb[H.a].position;Ea=nb[H.b].position;za=nb[H.c].position;Ra[Qa]=xa.x;Ra[Qa+1]=xa.y;Ra[Qa+2]=xa.z;Ra[Qa+3]=Ea.x;Ra[Qa+4]=Ea.y;Ra[Qa+5]=Ea.z;Ra[Qa+6]=za.x;Ra[Qa+7]=za.y;Ra[Qa+8]=za.z;Qa+=9}if(X)for(fb in X){w=X[fb];if(w.needsUpdate){E=w.offset;aa=w.offsetSrc;if(w.size===1){if(w.boundTo===undefined||w.boundTo==="vertices"){w.array[E+0]=w.value[H.a];w.array[E+1]=w.value[H.b];w.array[E+2]=w.value[H.c]}else if(w.boundTo==="faces"){w.array[E+
-0]=w.value[aa];w.array[E+1]=w.value[aa];w.array[E+2]=w.value[aa];w.offsetSrc++}else if(w.boundTo==="faceVertices"){w.array[E+0]=w.value[aa+0];w.array[E+1]=w.value[aa+1];w.array[E+2]=w.value[aa+2];w.offsetSrc+=3}w.offset+=3}else{if(w.boundTo===undefined||w.boundTo==="vertices"){xa=w.value[H.a];Ea=w.value[H.b];za=w.value[H.c]}else if(w.boundTo==="faces"){xa=w.value[aa];Ea=w.value[aa];za=w.value[aa];w.offsetSrc++}else if(w.boundTo==="faceVertices"){xa=w.value[aa+0];Ea=w.value[aa+1];za=w.value[aa+2];
-w.offsetSrc+=3}if(w.size===2){w.array[E+0]=xa.x;w.array[E+1]=xa.y;w.array[E+2]=Ea.x;w.array[E+3]=Ea.y;w.array[E+4]=za.x;w.array[E+5]=za.y;w.offset+=6}else if(w.size===3){if(w.type==="c"){w.array[E+0]=xa.r;w.array[E+1]=xa.g;w.array[E+2]=xa.b;w.array[E+3]=Ea.r;w.array[E+4]=Ea.g;w.array[E+5]=Ea.b;w.array[E+6]=za.r;w.array[E+7]=za.g;w.array[E+8]=za.b}else{w.array[E+0]=xa.x;w.array[E+1]=xa.y;w.array[E+2]=xa.z;w.array[E+3]=Ea.x;w.array[E+4]=Ea.y;w.array[E+5]=Ea.z;w.array[E+6]=za.x;w.array[E+7]=za.y;w.array[E+
-8]=za.z}w.offset+=9}else{w.array[E+0]=xa.x;w.array[E+1]=xa.y;w.array[E+2]=xa.z;w.array[E+3]=xa.w;w.array[E+4]=Ea.x;w.array[E+5]=Ea.y;w.array[E+6]=Ea.z;w.array[E+7]=Ea.w;w.array[E+8]=za.x;w.array[E+9]=za.y;w.array[E+10]=za.z;w.array[E+11]=za.w;w.offset+=12}}}}if(ub){E=0;for(aa=morphTargets.length;E<aa;E++){xa=morphTargets[E].vertices[H.a].position;Ea=morphTargets[E].vertices[H.b].position;za=morphTargets[E].vertices[H.c].position;w=ya[E];w[Na+0]=xa.x;w[Na+1]=xa.y;w[Na+2]=xa.z;w[Na+3]=Ea.x;w[Na+4]=
-Ea.y;w[Na+5]=Ea.z;w[Na+6]=za.x;w[Na+7]=za.y;w[Na+8]=za.z}Na+=9}if(lb.length){E=lb[H.a];aa=lb[H.b];w=lb[H.c];sa[N]=E.x;sa[N+1]=E.y;sa[N+2]=E.z;sa[N+3]=E.w;sa[N+4]=aa.x;sa[N+5]=aa.y;sa[N+6]=aa.z;sa[N+7]=aa.w;sa[N+8]=w.x;sa[N+9]=w.y;sa[N+10]=w.z;sa[N+11]=w.w;E=qb[H.a];aa=qb[H.b];w=qb[H.c];ua[N]=E.x;ua[N+1]=E.y;ua[N+2]=E.z;ua[N+3]=E.w;ua[N+4]=aa.x;ua[N+5]=aa.y;ua[N+6]=aa.z;ua[N+7]=aa.w;ua[N+8]=w.x;ua[N+9]=w.y;ua[N+10]=w.z;ua[N+11]=w.w;E=ob[H.a];aa=ob[H.b];w=ob[H.c];ha[N]=E.x;ha[N+1]=E.y;ha[N+2]=E.z;ha[N+
-3]=1;ha[N+4]=aa.x;ha[N+5]=aa.y;ha[N+6]=aa.z;ha[N+7]=1;ha[N+8]=w.x;ha[N+9]=w.y;ha[N+10]=w.z;ha[N+11]=1;E=pb[H.a];aa=pb[H.b];w=pb[H.c];$[N]=E.x;$[N+1]=E.y;$[N+2]=E.z;$[N+3]=1;$[N+4]=aa.x;$[N+5]=aa.y;$[N+6]=aa.z;$[N+7]=1;$[N+8]=w.x;$[N+9]=w.y;$[N+10]=w.z;$[N+11]=1;N+=12}if(tb&&Ka){if(L.length==3&&Ka==THREE.VertexColors){H=L[0];E=L[1];aa=L[2]}else aa=E=H=Z;na[Va]=H.r;na[Va+1]=H.g;na[Va+2]=H.b;na[Va+3]=E.r;na[Va+4]=E.g;na[Va+5]=E.b;na[Va+6]=aa.r;na[Va+7]=aa.g;na[Va+8]=aa.b;Va+=9}if(sb&&Sa.hasTangents){L=
-Y[0];Z=Y[1];H=Y[2];W[Ma]=L.x;W[Ma+1]=L.y;W[Ma+2]=L.z;W[Ma+3]=L.w;W[Ma+4]=Z.x;W[Ma+5]=Z.y;W[Ma+6]=Z.z;W[Ma+7]=Z.w;W[Ma+8]=H.x;W[Ma+9]=H.y;W[Ma+10]=H.z;W[Ma+11]=H.w;Ma+=12}if(rb&&Ca)if(T.length==3&&eb)for(Y=0;Y<3;Y++){I=T[Y];Pa[$a]=I.x;Pa[$a+1]=I.y;Pa[$a+2]=I.z;$a+=3}else for(Y=0;Y<3;Y++){Pa[$a]=I.x;Pa[$a+1]=I.y;Pa[$a+2]=I.z;$a+=3}if(db&&Ha!==undefined&&ra)for(Y=0;Y<3;Y++){T=Ha[Y];ib[cb]=T.u;ib[cb+1]=T.v;cb+=2}if(db&&Ga!==undefined&&ra)for(Y=0;Y<3;Y++){T=Ga[Y];jb[hb]=T.u;jb[hb+1]=T.v;hb+=2}if(gb){Ia[Wa]=
-Oa;Ia[Wa+1]=Oa+1;Ia[Wa+2]=Oa+2;Wa+=3;Ya[bb]=Oa;Ya[bb+1]=Oa+1;Ya[bb+2]=Oa;Ya[bb+3]=Oa+2;Ya[bb+4]=Oa+1;Ya[bb+5]=Oa+2;bb+=6;Oa+=3}}else if(H instanceof THREE.Face4){if(kb){xa=nb[H.a].position;Ea=nb[H.b].position;za=nb[H.c].position;Ua=nb[H.d].position;Ra[Qa]=xa.x;Ra[Qa+1]=xa.y;Ra[Qa+2]=xa.z;Ra[Qa+3]=Ea.x;Ra[Qa+4]=Ea.y;Ra[Qa+5]=Ea.z;Ra[Qa+6]=za.x;Ra[Qa+7]=za.y;Ra[Qa+8]=za.z;Ra[Qa+9]=Ua.x;Ra[Qa+10]=Ua.y;Ra[Qa+11]=Ua.z;Qa+=12}if(X)for(fb in X){w=X[fb];if(w.needsUpdate){E=w.offset;aa=w.offsetSrc;if(w.size===
-1){if(w.boundTo===undefined||w.boundTo==="vertices"){w.array[E+0]=w.value[H.a];w.array[E+1]=w.value[H.b];w.array[E+2]=w.value[H.c];w.array[E+2]=w.value[H.d]}else if(w.boundTo==="faces"){w.array[E+0]=w.value[aa];w.array[E+1]=w.value[aa];w.array[E+2]=w.value[aa];w.array[E+2]=w.value[aa];w.offsetSrc++}else if(w.boundTo==="faceVertices"){w.array[E+0]=w.value[aa+0];w.array[E+1]=w.value[aa+1];w.array[E+2]=w.value[aa+2];w.array[E+2]=w.value[aa+3];w.offsetSrc+=4}w.offset+=4}else{if(w.boundTo===undefined||
-w.boundTo==="vertices"){xa=w.value[H.a];Ea=w.value[H.b];za=w.value[H.c];Ua=w.value[H.d]}else if(w.boundTo==="faces"){xa=w.value[aa];Ea=w.value[aa];za=w.value[aa];Ua=w.value[aa];w.offsetSrc++}else if(w.boundTo==="faceVertices"){xa=w.value[aa+0];Ea=w.value[aa+1];za=w.value[aa+2];Ua=w.value[aa+3];w.offsetSrc+=4}if(w.size===2){w.array[E+0]=xa.x;w.array[E+1]=xa.y;w.array[E+2]=Ea.x;w.array[E+3]=Ea.y;w.array[E+4]=za.x;w.array[E+5]=za.y;w.array[E+6]=Ua.x;w.array[E+7]=Ua.y;w.offset+=8}else if(w.size===3){if(w.type===
-"c"){w.array[E+0]=xa.r;w.array[E+1]=xa.g;w.array[E+2]=xa.b;w.array[E+3]=Ea.r;w.array[E+4]=Ea.g;w.array[E+5]=Ea.b;w.array[E+6]=za.r;w.array[E+7]=za.g;w.array[E+8]=za.b;w.array[E+9]=Ua.r;w.array[E+10]=Ua.g;w.array[E+11]=Ua.b}else{w.array[E+0]=xa.x;w.array[E+1]=xa.y;w.array[E+2]=xa.z;w.array[E+3]=Ea.x;w.array[E+4]=Ea.y;w.array[E+5]=Ea.z;w.array[E+6]=za.x;w.array[E+7]=za.y;w.array[E+8]=za.z;w.array[E+9]=Ua.x;w.array[E+10]=Ua.y;w.array[E+11]=Ua.z}w.offset+=12}else{w.array[E+0]=xa.x;w.array[E+1]=xa.y;w.array[E+
-2]=xa.z;w.array[E+3]=xa.w;w.array[E+4]=Ea.x;w.array[E+5]=Ea.y;w.array[E+6]=Ea.z;w.array[E+7]=Ea.w;w.array[E+8]=za.x;w.array[E+9]=za.y;w.array[E+10]=za.z;w.array[E+11]=za.w;w.array[E+12]=Ua.x;w.array[E+13]=Ua.y;w.array[E+14]=Ua.z;w.array[E+15]=Ua.w;w.offset+=16}}}}if(ub){E=0;for(aa=morphTargets.length;E<aa;E++){xa=morphTargets[E].vertices[H.a].position;Ea=morphTargets[E].vertices[H.b].position;za=morphTargets[E].vertices[H.c].position;Ua=morphTargets[E].vertices[H.d].position;w=ya[E];w[Na+0]=xa.x;
-w[Na+1]=xa.y;w[Na+2]=xa.z;w[Na+3]=Ea.x;w[Na+4]=Ea.y;w[Na+5]=Ea.z;w[Na+6]=za.x;w[Na+7]=za.y;w[Na+8]=za.z;w[Na+9]=Ua.x;w[Na+10]=Ua.y;w[Na+11]=Ua.z}Na+=12}if(lb.length){E=lb[H.a];aa=lb[H.b];w=lb[H.c];ab=lb[H.d];sa[N]=E.x;sa[N+1]=E.y;sa[N+2]=E.z;sa[N+3]=E.w;sa[N+4]=aa.x;sa[N+5]=aa.y;sa[N+6]=aa.z;sa[N+7]=aa.w;sa[N+8]=w.x;sa[N+9]=w.y;sa[N+10]=w.z;sa[N+11]=w.w;sa[N+12]=ab.x;sa[N+13]=ab.y;sa[N+14]=ab.z;sa[N+15]=ab.w;E=qb[H.a];aa=qb[H.b];w=qb[H.c];ab=qb[H.d];ua[N]=E.x;ua[N+1]=E.y;ua[N+2]=E.z;ua[N+3]=E.w;ua[N+
-4]=aa.x;ua[N+5]=aa.y;ua[N+6]=aa.z;ua[N+7]=aa.w;ua[N+8]=w.x;ua[N+9]=w.y;ua[N+10]=w.z;ua[N+11]=w.w;ua[N+12]=ab.x;ua[N+13]=ab.y;ua[N+14]=ab.z;ua[N+15]=ab.w;E=ob[H.a];aa=ob[H.b];w=ob[H.c];ab=ob[H.d];ha[N]=E.x;ha[N+1]=E.y;ha[N+2]=E.z;ha[N+3]=1;ha[N+4]=aa.x;ha[N+5]=aa.y;ha[N+6]=aa.z;ha[N+7]=1;ha[N+8]=w.x;ha[N+9]=w.y;ha[N+10]=w.z;ha[N+11]=1;ha[N+12]=ab.x;ha[N+13]=ab.y;ha[N+14]=ab.z;ha[N+15]=1;E=pb[H.a];aa=pb[H.b];w=pb[H.c];H=pb[H.d];$[N]=E.x;$[N+1]=E.y;$[N+2]=E.z;$[N+3]=1;$[N+4]=aa.x;$[N+5]=aa.y;$[N+6]=
-aa.z;$[N+7]=1;$[N+8]=w.x;$[N+9]=w.y;$[N+10]=w.z;$[N+11]=1;$[N+12]=H.x;$[N+13]=H.y;$[N+14]=H.z;$[N+15]=1;N+=16}if(tb&&Ka){if(L.length==4&&Ka==THREE.VertexColors){H=L[0];E=L[1];aa=L[2];L=L[3]}else L=aa=E=H=Z;na[Va]=H.r;na[Va+1]=H.g;na[Va+2]=H.b;na[Va+3]=E.r;na[Va+4]=E.g;na[Va+5]=E.b;na[Va+6]=aa.r;na[Va+7]=aa.g;na[Va+8]=aa.b;na[Va+9]=L.r;na[Va+10]=L.g;na[Va+11]=L.b;Va+=12}if(sb&&Sa.hasTangents){L=Y[0];Z=Y[1];H=Y[2];Y=Y[3];W[Ma]=L.x;W[Ma+1]=L.y;W[Ma+2]=L.z;W[Ma+3]=L.w;W[Ma+4]=Z.x;W[Ma+5]=Z.y;W[Ma+6]=
-Z.z;W[Ma+7]=Z.w;W[Ma+8]=H.x;W[Ma+9]=H.y;W[Ma+10]=H.z;W[Ma+11]=H.w;W[Ma+12]=Y.x;W[Ma+13]=Y.y;W[Ma+14]=Y.z;W[Ma+15]=Y.w;Ma+=16}if(rb&&Ca)if(T.length==4&&eb)for(Y=0;Y<4;Y++){I=T[Y];Pa[$a]=I.x;Pa[$a+1]=I.y;Pa[$a+2]=I.z;$a+=3}else for(Y=0;Y<4;Y++){Pa[$a]=I.x;Pa[$a+1]=I.y;Pa[$a+2]=I.z;$a+=3}if(db&&Ha!==undefined&&ra)for(Y=0;Y<4;Y++){T=Ha[Y];ib[cb]=T.u;ib[cb+1]=T.v;cb+=2}if(db&&Ga!==undefined&&ra)for(Y=0;Y<4;Y++){T=Ga[Y];jb[hb]=T.u;jb[hb+1]=T.v;hb+=2}if(gb){Ia[Wa]=Oa;Ia[Wa+1]=Oa+1;Ia[Wa+2]=Oa+3;Ia[Wa+3]=
-Oa+1;Ia[Wa+4]=Oa+2;Ia[Wa+5]=Oa+3;Wa+=6;Ya[bb]=Oa;Ya[bb+1]=Oa+1;Ya[bb+2]=Oa;Ya[bb+3]=Oa+3;Ya[bb+4]=Oa+1;Ya[bb+5]=Oa+2;Ya[bb+6]=Oa+2;Ya[bb+7]=Oa+3;bb+=8;Oa+=4}}}if(mb){K=0;for(G=mb.length;K<G;K++){Ia[Wa]=mb[K].a;Ia[Wa+1]=mb[K].b;Ia[Wa+2]=mb[K].c;Ia[Wa+3]=mb[K].a;Ia[Wa+4]=mb[K].c;Ia[Wa+5]=mb[K].d;Wa+=6}}if(kb){e.bindBuffer(e.ARRAY_BUFFER,v.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,Ra,Q)}if(X)for(fb in X){w=X[fb];if(w.needsUpdate){e.bindBuffer(e.ARRAY_BUFFER,w.buffer);e.bufferData(e.ARRAY_BUFFER,
-w.array,Q);w.needsUpdate=!1}}if(ub){E=0;for(aa=morphTargets.length;E<aa;E++){e.bindBuffer(e.ARRAY_BUFFER,v.__webglMorphTargetsBuffers[E]);e.bufferData(e.ARRAY_BUFFER,ya[E],Q)}}if(tb&&Va>0){e.bindBuffer(e.ARRAY_BUFFER,v.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,na,Q)}if(rb){e.bindBuffer(e.ARRAY_BUFFER,v.__webglNormalBuffer);e.bufferData(e.ARRAY_BUFFER,Pa,Q)}if(sb&&Sa.hasTangents){e.bindBuffer(e.ARRAY_BUFFER,v.__webglTangentBuffer);e.bufferData(e.ARRAY_BUFFER,W,Q)}if(db&&cb>0){e.bindBuffer(e.ARRAY_BUFFER,
-v.__webglUVBuffer);e.bufferData(e.ARRAY_BUFFER,ib,Q)}if(db&&hb>0){e.bindBuffer(e.ARRAY_BUFFER,v.__webglUV2Buffer);e.bufferData(e.ARRAY_BUFFER,jb,Q)}if(gb){e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,v.__webglFaceBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,Ia,Q);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,v.__webglLineBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,Ya,Q)}if(N>0){e.bindBuffer(e.ARRAY_BUFFER,v.__webglSkinVertexABuffer);e.bufferData(e.ARRAY_BUFFER,ha,Q);e.bindBuffer(e.ARRAY_BUFFER,v.__webglSkinVertexBBuffer);
-e.bufferData(e.ARRAY_BUFFER,$,Q);e.bindBuffer(e.ARRAY_BUFFER,v.__webglSkinIndicesBuffer);e.bufferData(e.ARRAY_BUFFER,ua,Q);e.bindBuffer(e.ARRAY_BUFFER,v.__webglSkinWeightsBuffer);e.bufferData(e.ARRAY_BUFFER,sa,Q)}}}x.__dirtyVertices=!1;x.__dirtyMorphTargets=!1;x.__dirtyElements=!1;x.__dirtyUvs=!1;x.__dirtyNormals=!1;x.__dirtyTangents=!1;x.__dirtyColors=!1}else if(n instanceof THREE.Ribbon){x=n.geometry;if(x.__dirtyVertices||x.__dirtyColors){n=x;D=e.DYNAMIC_DRAW;Ka=n.vertices;v=n.colors;Ca=Ka.length;
-Q=v.length;Ha=n.__vertexArray;K=n.__colorArray;Ga=n.__dirtyColors;if(n.__dirtyVertices){for(G=0;G<Ca;G++){ra=Ka[G].position;z=G*3;Ha[z]=ra.x;Ha[z+1]=ra.y;Ha[z+2]=ra.z}e.bindBuffer(e.ARRAY_BUFFER,n.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,Ha,D)}if(Ga){for(G=0;G<Q;G++){color=v[G];z=G*3;K[z]=color.r;K[z+1]=color.g;K[z+2]=color.b}e.bindBuffer(e.ARRAY_BUFFER,n.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,K,D)}}x.__dirtyVertices=!1;x.__dirtyColors=!1}else if(n instanceof THREE.Line){x=n.geometry;
-if(x.__dirtyVertices||x.__dirtyColors){n=x;D=e.DYNAMIC_DRAW;Ka=n.vertices;v=n.colors;Ca=Ka.length;Q=v.length;Ha=n.__vertexArray;K=n.__colorArray;Ga=n.__dirtyColors;if(n.__dirtyVertices){for(G=0;G<Ca;G++){ra=Ka[G].position;z=G*3;Ha[z]=ra.x;Ha[z+1]=ra.y;Ha[z+2]=ra.z}e.bindBuffer(e.ARRAY_BUFFER,n.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,Ha,D)}if(Ga){for(G=0;G<Q;G++){color=v[G];z=G*3;K[z]=color.r;K[z+1]=color.g;K[z+2]=color.b}e.bindBuffer(e.ARRAY_BUFFER,n.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,
-K,D)}}x.__dirtyVertices=!1;x.__dirtyColors=!1}else if(n instanceof THREE.ParticleSystem){x=n.geometry;(x.__dirtyVertices||x.__dirtyColors||n.sortParticles)&&d(x,e.DYNAMIC_DRAW,n);x.__dirtyVertices=!1;x.__dirtyColors=!1}}function U(n){function D(Z){var Y=[];x=0;for(v=Z.length;x<v;x++)Z[x]==undefined?Y.push("undefined"):Y.push(Z[x].id);return Y.join("_")}var x,v,z,Q,K,G,T,H,I={},L=n.morphTargets!==undefined?n.morphTargets.length:0;n.geometryGroups={};z=0;for(Q=n.faces.length;z<Q;z++){K=n.faces[z];G=
-K.materials;T=D(G);I[T]==undefined&&(I[T]={hash:T,counter:0});H=I[T].hash+"_"+I[T].counter;n.geometryGroups[H]==undefined&&(n.geometryGroups[H]={faces:[],materials:G,vertices:0,numMorphTargets:L});K=K instanceof THREE.Face3?3:4;if(n.geometryGroups[H].vertices+K>65535){I[T].counter+=1;H=I[T].hash+"_"+I[T].counter;n.geometryGroups[H]==undefined&&(n.geometryGroups[H]={faces:[],materials:G,vertices:0,numMorphTargets:L})}n.geometryGroups[H].faces.push(z);n.geometryGroups[H].vertices+=K}}function C(n,D,
-x){n.push({buffer:D,object:x,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function V(n){if(n!=pa){switch(n){case THREE.AdditiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE);break;case THREE.SubtractiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ZERO,e.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ZERO,e.SRC_COLOR);break;default:e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD);e.blendFuncSeparate(e.SRC_ALPHA,
-e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA)}pa=n}}function O(n,D,x){if((x.width&x.width-1)==0&&(x.height&x.height-1)==0){e.texParameteri(n,e.TEXTURE_WRAP_S,fa(D.wrapS));e.texParameteri(n,e.TEXTURE_WRAP_T,fa(D.wrapT));e.texParameteri(n,e.TEXTURE_MAG_FILTER,fa(D.magFilter));e.texParameteri(n,e.TEXTURE_MIN_FILTER,fa(D.minFilter));e.generateMipmap(n)}else{e.texParameteri(n,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE);e.texParameteri(n,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE);e.texParameteri(n,e.TEXTURE_MAG_FILTER,
-qa(D.magFilter));e.texParameteri(n,e.TEXTURE_MIN_FILTER,qa(D.minFilter))}}function M(n,D){if(n.needsUpdate){if(n.__webglInit){e.bindTexture(e.TEXTURE_2D,n.__webglTexture);e.texSubImage2D(e.TEXTURE_2D,0,0,0,e.RGBA,e.UNSIGNED_BYTE,n.image)}else{n.__webglTexture=e.createTexture();e.bindTexture(e.TEXTURE_2D,n.__webglTexture);e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,n.image);n.__webglInit=!0}O(e.TEXTURE_2D,n,n.image);e.bindTexture(e.TEXTURE_2D,null);n.needsUpdate=!1}e.activeTexture(e.TEXTURE0+
-D);e.bindTexture(e.TEXTURE_2D,n.__webglTexture)}function va(n){if(n&&!n.__webglFramebuffer){if(n.depthBuffer===undefined)n.depthBuffer=!0;if(n.stencilBuffer===undefined)n.stencilBuffer=!0;n.__webglFramebuffer=e.createFramebuffer();n.__webglRenderbuffer=e.createRenderbuffer();n.__webglTexture=e.createTexture();e.bindTexture(e.TEXTURE_2D,n.__webglTexture);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,fa(n.wrapS));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,fa(n.wrapT));e.texParameteri(e.TEXTURE_2D,
-e.TEXTURE_MAG_FILTER,fa(n.magFilter));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,fa(n.minFilter));e.texImage2D(e.TEXTURE_2D,0,fa(n.format),n.width,n.height,0,fa(n.format),fa(n.type),null);e.bindRenderbuffer(e.RENDERBUFFER,n.__webglRenderbuffer);e.bindFramebuffer(e.FRAMEBUFFER,n.__webglFramebuffer);e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,n.__webglTexture,0);if(n.depthBuffer&&!n.stencilBuffer){e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_COMPONENT16,n.width,n.height);
-e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,n.__webglRenderbuffer)}else if(n.depthBuffer&&n.stencilBuffer){e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,n.width,n.height);e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,n.__webglRenderbuffer)}else e.renderbufferStorage(e.RENDERBUFFER,e.RGBA4,n.width,n.height);e.bindTexture(e.TEXTURE_2D,null);e.bindRenderbuffer(e.RENDERBUFFER,null);e.bindFramebuffer(e.FRAMEBUFFER,null)}var D,x;if(n){D=
-n.__webglFramebuffer;x=n.width;n=n.height}else{D=null;x=Fa;n=ja}if(D!=da){e.bindFramebuffer(e.FRAMEBUFFER,D);e.viewport(ka,ma,x,n);da=D}}function la(n,D){var x;if(n=="fragment")x=e.createShader(e.FRAGMENT_SHADER);else n=="vertex"&&(x=e.createShader(e.VERTEX_SHADER));e.shaderSource(x,D);e.compileShader(x);if(!e.getShaderParameter(x,e.COMPILE_STATUS)){console.error(e.getShaderInfoLog(x));console.error(D);return null}return x}function qa(n){switch(n){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return e.NEAREST;
-default:return e.LINEAR}}function fa(n){switch(n){case THREE.RepeatWrapping:return e.REPEAT;case THREE.ClampToEdgeWrapping:return e.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return e.MIRRORED_REPEAT;case THREE.NearestFilter:return e.NEAREST;case THREE.NearestMipMapNearestFilter:return e.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return e.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return e.LINEAR;case THREE.LinearMipMapNearestFilter:return e.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return e.LINEAR_MIPMAP_LINEAR;
+z.__webglLineCount,e.UNSIGNED_SHORT,0)}else{e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,z.__webglFaceBuffer);e.drawElements(e.TRIANGLES,z.__webglFaceCount,e.UNSIGNED_SHORT,0)}ea.data.vertices+=z.__webglFaceCount;ea.data.faces+=z.__webglFaceCount/3;ea.data.drawCalls++}else if(Q instanceof THREE.Line){Q=Q.type==THREE.LineStrip?e.LINE_STRIP:e.LINES;e.lineWidth(v.linewidth);e.drawArrays(Q,0,z.__webglLineCount);ea.data.drawCalls++}else if(Q instanceof THREE.ParticleSystem){e.drawArrays(e.POINTS,0,z.__webglParticleCount);
+ea.data.drawCalls++}else if(Q instanceof THREE.Ribbon){e.drawArrays(e.TRIANGLE_STRIP,0,z.__webglVertexCount);ea.data.drawCalls++}}}function g(n,D,x){if(!n.__webglVertexBuffer)n.__webglVertexBuffer=e.createBuffer();if(!n.__webglNormalBuffer)n.__webglNormalBuffer=e.createBuffer();if(n.hasPos){e.bindBuffer(e.ARRAY_BUFFER,n.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,n.positionArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(D.attributes.position);e.vertexAttribPointer(D.attributes.position,3,e.FLOAT,
+!1,0,0)}if(n.hasNormal){e.bindBuffer(e.ARRAY_BUFFER,n.__webglNormalBuffer);if(x==THREE.FlatShading){var v,z,Q,K,G,T,H,I,L,Z,Y=n.count*3;for(Z=0;Z<Y;Z+=9){x=n.normalArray;v=x[Z];z=x[Z+1];Q=x[Z+2];K=x[Z+3];T=x[Z+4];I=x[Z+5];G=x[Z+6];H=x[Z+7];L=x[Z+8];v=(v+K+G)/3;z=(z+T+H)/3;Q=(Q+I+L)/3;x[Z]=v;x[Z+1]=z;x[Z+2]=Q;x[Z+3]=v;x[Z+4]=z;x[Z+5]=Q;x[Z+6]=v;x[Z+7]=z;x[Z+8]=Q}}e.bufferData(e.ARRAY_BUFFER,n.normalArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(D.attributes.normal);e.vertexAttribPointer(D.attributes.normal,
+3,e.FLOAT,!1,0,0)}e.drawArrays(e.TRIANGLES,0,n.count);n.count=0}function h(n){if(wa!=n.doubleSided){n.doubleSided?e.disable(e.CULL_FACE):e.enable(e.CULL_FACE);wa=n.doubleSided}if(ta!=n.flipSided){n.flipSided?e.frontFace(e.CW):e.frontFace(e.CCW);ta=n.flipSided}}function j(n){if(ca!=n){n?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST);ca=n}}function k(n){ha[0].set(n.n41-n.n11,n.n42-n.n12,n.n43-n.n13,n.n44-n.n14);ha[1].set(n.n41+n.n11,n.n42+n.n12,n.n43+n.n13,n.n44+n.n14);ha[2].set(n.n41+n.n21,n.n42+n.n22,
+n.n43+n.n23,n.n44+n.n24);ha[3].set(n.n41-n.n21,n.n42-n.n22,n.n43-n.n23,n.n44-n.n24);ha[4].set(n.n41-n.n31,n.n42-n.n32,n.n43-n.n33,n.n44-n.n34);ha[5].set(n.n41+n.n31,n.n42+n.n32,n.n43+n.n33,n.n44+n.n34);var D;for(n=0;n<6;n++){D=ha[n];D.divideScalar(Math.sqrt(D.x*D.x+D.y*D.y+D.z*D.z))}}function m(n){for(var D=n.matrixWorld,x=-n.geometry.boundingSphere.radius*Math.max(n.scale.x,Math.max(n.scale.y,n.scale.z)),v=0;v<6;v++){n=ha[v].x*D.n14+ha[v].y*D.n24+ha[v].z*D.n34+ha[v].w;if(n<=x)return!1}return!0}function o(n,
+D){n.list[n.count]=D;n.count+=1}function p(n){var D,x,v=n.object,z=n.opaque,Q=n.transparent;Q.count=0;n=z.count=0;for(D=v.materials.length;n<D;n++){x=v.materials[n];x.transparent?o(Q,x):o(z,x)}}function t(n){var D,x,v,z,Q=n.object,K=n.buffer,G=n.opaque,T=n.transparent;T.count=0;n=G.count=0;for(v=Q.materials.length;n<v;n++){D=Q.materials[n];if(D instanceof THREE.MeshFaceMaterial){D=0;for(x=K.materials.length;D<x;D++)(z=K.materials[D])&&(z.transparent?o(T,z):o(G,z))}else(z=D)&&(z.transparent?o(T,z):
+o(G,z))}}function y(n,D){return D.z-n.z}function u(n){e.enable(e.POLYGON_OFFSET_FILL);e.polygonOffset(0.1,1);e.enable(e.STENCIL_TEST);e.enable(e.DEPTH_TEST);e.depthMask(!1);e.colorMask(!1,!1,!1,!1);e.stencilFunc(e.ALWAYS,1,255);e.stencilOpSeparate(e.BACK,e.KEEP,e.INCR,e.KEEP);e.stencilOpSeparate(e.FRONT,e.KEEP,e.DECR,e.KEEP);var D,x=n.lights.length,v,z=n.lights,Q=[],K,G,T,H,I,L=n.__webglShadowVolumes.length;for(D=0;D<x;D++){v=n.lights[D];if(v instanceof THREE.DirectionalLight&&v.castShadow){Q[0]=
+-v.position.x;Q[1]=-v.position.y;Q[2]=-v.position.z;for(I=0;I<L;I++){v=n.__webglShadowVolumes[I].object;K=n.__webglShadowVolumes[I].buffer;G=v.materials[0];G.program||ea.initMaterial(G,z,undefined,v);G=G.program;T=G.uniforms;H=G.attributes;if(Aa!==G){e.useProgram(G);Aa=G;e.uniformMatrix4fv(T.projectionMatrix,!1,Xa);e.uniformMatrix4fv(T.viewMatrix,!1,Za);e.uniform3fv(T.directionalLightDirection,Q)}v.matrixWorld.flattenToArray(v._objectMatrixArray);e.uniformMatrix4fv(T.objectMatrix,!1,v._objectMatrixArray);
+e.bindBuffer(e.ARRAY_BUFFER,K.__webglVertexBuffer);e.vertexAttribPointer(H.position,3,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,K.__webglNormalBuffer);e.vertexAttribPointer(H.normal,3,e.FLOAT,!1,0,0);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,K.__webglFaceBuffer);e.cullFace(e.FRONT);e.drawElements(e.TRIANGLES,K.__webglFaceCount,e.UNSIGNED_SHORT,0);e.cullFace(e.BACK);e.drawElements(e.TRIANGLES,K.__webglFaceCount,e.UNSIGNED_SHORT,0)}}}e.disable(e.POLYGON_OFFSET_FILL);e.colorMask(!0,!0,!0,!0);e.stencilFunc(e.NOTEQUAL,
+0,255);e.stencilOp(e.KEEP,e.KEEP,e.KEEP);e.disable(e.DEPTH_TEST);pa="";Aa=S.program;e.useProgram(S.program);e.uniformMatrix4fv(S.projectionLocation,!1,Xa);e.uniform1f(S.darknessLocation,S.darkness);e.bindBuffer(e.ARRAY_BUFFER,S.vertexBuffer);e.vertexAttribPointer(S.vertexLocation,3,e.FLOAT,!1,0,0);e.enableVertexAttribArray(S.vertexLocation);e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA);e.blendEquation(e.FUNC_ADD);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,S.elementBuffer);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,
+0);e.disable(e.STENCIL_TEST);e.enable(e.DEPTH_TEST);e.depthMask(fa)}function A(n,D){var x,v,z;x=_sprite.attributes;var Q=_sprite.uniforms,K=ja/Fa,G,T=[],H=Fa*0.5,I=ja*0.5,L=!0;e.useProgram(_sprite.program);Aa=_sprite.program;pa="";if(!La){e.enableVertexAttribArray(_sprite.attributes.position);e.enableVertexAttribArray(_sprite.attributes.uv);La=!0}e.disable(e.CULL_FACE);e.enable(e.BLEND);e.depthMask(!0);e.bindBuffer(e.ARRAY_BUFFER,_sprite.vertexBuffer);e.vertexAttribPointer(x.position,2,e.FLOAT,!1,
+16,0);e.vertexAttribPointer(x.uv,2,e.FLOAT,!1,16,8);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,_sprite.elementBuffer);e.uniformMatrix4fv(Q.projectionMatrix,!1,Xa);e.activeTexture(e.TEXTURE0);e.uniform1i(Q.map,0);x=0;for(v=n.__webglSprites.length;x<v;x++){z=n.__webglSprites[x];if(z.useScreenCoordinates)z.z=-z.position.z;else{z._modelViewMatrix.multiplyToArray(D.matrixWorldInverse,z.matrixWorld,z._modelViewMatrixArray);z.z=-z._modelViewMatrix.n34}}n.__webglSprites.sort(y);x=0;for(v=n.__webglSprites.length;x<
+v;x++){z=n.__webglSprites[x];if(z.material===undefined&&z.map&&z.map.image&&z.map.image.width){if(z.useScreenCoordinates){e.uniform1i(Q.useScreenCoordinates,1);e.uniform3f(Q.screenPosition,(z.position.x-H)/H,(I-z.position.y)/I,Math.max(0,Math.min(1,z.position.z)))}else{e.uniform1i(Q.useScreenCoordinates,0);e.uniform1i(Q.affectedByDistance,z.affectedByDistance?1:0);e.uniformMatrix4fv(Q.modelViewMatrix,!1,z._modelViewMatrixArray)}G=z.map.image.width/(z.affectedByDistance?1:ja);T[0]=G*K*z.scale.x;T[1]=
+G*z.scale.y;e.uniform2f(Q.uvScale,z.uvScale.x,z.uvScale.y);e.uniform2f(Q.uvOffset,z.uvOffset.x,z.uvOffset.y);e.uniform2f(Q.alignment,z.alignment.x,z.alignment.y);e.uniform1f(Q.opacity,z.opacity);e.uniform1f(Q.rotation,z.rotation);e.uniform2fv(Q.scale,T);if(z.mergeWith3D&&!L){e.enable(e.DEPTH_TEST);L=!0}else if(!z.mergeWith3D&&L){e.disable(e.DEPTH_TEST);L=!1}V(z.blending);M(z.map,0);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0)}}e.enable(e.CULL_FACE);e.enable(e.DEPTH_TEST);e.depthMask(fa)}function F(n,
+D){var x,v,z=n.__webglLensFlares.length,Q,K,G,T=new THREE.Vector3,H=ja/Fa,I=Fa*0.5,L=ja*0.5,Z=16/ja,Y=[Z*H,Z],ra=[1,1,0],Ka=[1,1],Ca=P.uniforms;x=P.attributes;e.useProgram(P.program);Aa=P.program;pa="";if(!Ba){e.enableVertexAttribArray(P.attributes.vertex);e.enableVertexAttribArray(P.attributes.uv);Ba=!0}e.uniform1i(Ca.occlusionMap,0);e.uniform1i(Ca.map,1);e.bindBuffer(e.ARRAY_BUFFER,P.vertexBuffer);e.vertexAttribPointer(x.vertex,2,e.FLOAT,!1,16,0);e.vertexAttribPointer(x.uv,2,e.FLOAT,!1,16,8);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,
+P.elementBuffer);e.disable(e.CULL_FACE);e.depthMask(!1);e.activeTexture(e.TEXTURE0);e.bindTexture(e.TEXTURE_2D,P.occlusionTexture);e.activeTexture(e.TEXTURE1);for(v=0;v<z;v++){x=n.__webglLensFlares[v].object;T.set(x.matrixWorld.n14,x.matrixWorld.n24,x.matrixWorld.n34);D.matrixWorldInverse.multiplyVector3(T);D.projectionMatrix.multiplyVector3(T);ra[0]=T.x;ra[1]=T.y;ra[2]=T.z;Ka[0]=ra[0]*I+I;Ka[1]=ra[1]*L+L;if(P.hasVertexTexture||Ka[0]>0&&Ka[0]<Fa&&Ka[1]>0&&Ka[1]<ja){e.bindTexture(e.TEXTURE_2D,P.tempTexture);
+e.copyTexImage2D(e.TEXTURE_2D,0,e.RGB,Ka[0]-8,Ka[1]-8,16,16,0);e.uniform1i(Ca.renderType,0);e.uniform2fv(Ca.scale,Y);e.uniform3fv(Ca.screenPosition,ra);e.disable(e.BLEND);e.enable(e.DEPTH_TEST);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0);e.bindTexture(e.TEXTURE_2D,P.occlusionTexture);e.copyTexImage2D(e.TEXTURE_2D,0,e.RGBA,Ka[0]-8,Ka[1]-8,16,16,0);e.uniform1i(Ca.renderType,1);e.disable(e.DEPTH_TEST);e.bindTexture(e.TEXTURE_2D,P.tempTexture);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0);x.positionScreen.x=
+ra[0];x.positionScreen.y=ra[1];x.positionScreen.z=ra[2];x.customUpdateCallback?x.customUpdateCallback(x):x.updateLensFlares();e.uniform1i(Ca.renderType,2);e.enable(e.BLEND);Q=0;for(K=x.lensFlares.length;Q<K;Q++){G=x.lensFlares[Q];if(G.opacity>0.001&&G.scale>0.001){ra[0]=G.x;ra[1]=G.y;ra[2]=G.z;Z=G.size*G.scale/ja;Y[0]=Z*H;Y[1]=Z;e.uniform3fv(Ca.screenPosition,ra);e.uniform2fv(Ca.scale,Y);e.uniform1f(Ca.rotation,G.rotation);e.uniform1f(Ca.opacity,G.opacity);V(G.blending);M(G.texture,1);e.drawElements(e.TRIANGLES,
+6,e.UNSIGNED_SHORT,0)}}}}e.enable(e.CULL_FACE);e.enable(e.DEPTH_TEST);e.depthMask(fa)}function J(n,D){n._modelViewMatrix.multiplyToArray(D.matrixWorldInverse,n.matrixWorld,n._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(n._modelViewMatrix).transposeIntoArray(n._normalMatrixArray)}function B(n){var D,x,v,z,Q;if(n instanceof THREE.Mesh){x=n.geometry;for(D in x.geometryGroups){v=x.geometryGroups[D];Q=!1;for(z in v.__webglCustomAttributes)if(v.__webglCustomAttributes[z].needsUpdate){Q=!0;break}if(x.__dirtyVertices||
+x.__dirtyMorphTargets||x.__dirtyElements||x.__dirtyUvs||x.__dirtyNormals||x.__dirtyColors||x.__dirtyTangents||Q){Q=e.DYNAMIC_DRAW;var K=void 0,G=void 0,T=void 0,H=void 0;T=void 0;var I=void 0,L=void 0,Z=void 0,Y=void 0,ra=void 0,Ka=void 0,Ca=void 0,Ha=void 0,Ga=void 0,xa=void 0,Ea=void 0,za=void 0,Ua=void 0;L=void 0;Z=void 0;H=void 0;Y=void 0;H=void 0;var E=void 0,aa=void 0;L=void 0;E=void 0;aa=void 0;var w=void 0,ab=void 0;E=void 0;aa=void 0;w=void 0;ab=void 0;E=void 0;aa=void 0;w=void 0;ab=void 0;
+E=void 0;aa=void 0;w=void 0;H=void 0;Y=void 0;I=void 0;T=void 0;T=void 0;E=void 0;aa=void 0;w=void 0;var fb=void 0,Oa=0,Qa=0,cb=0,hb=0,Wa=0,$a=0,Ma=0,bb=0,Va=0,N=0,Na=0;aa=E=0;var Ra=v.__vertexArray,ib=v.__uvArray,jb=v.__uv2Array,Pa=v.__normalArray,W=v.__tangentArray,na=v.__colorArray,ia=v.__skinVertexAArray,$=v.__skinVertexBArray,ua=v.__skinIndexArray,sa=v.__skinWeightArray,ya=v.__morphTargetsArrays,X=v.__webglCustomAttributes;w=void 0;var Ia=v.__faceArray,Ya=v.__lineArray,eb=v.__needsSmoothNormals;
+Ka=v.__vertexColorType;ra=v.__uvType;Ca=v.__normalType;var Sa=n.geometry,kb=Sa.__dirtyVertices,gb=Sa.__dirtyElements,db=Sa.__dirtyUvs,rb=Sa.__dirtyNormals,sb=Sa.__dirtyTangents,tb=Sa.__dirtyColors,ub=Sa.__dirtyMorphTargets,nb=Sa.vertices,vb=v.faces,yb=Sa.faces,wb=Sa.faceVertexUvs[0],xb=Sa.faceVertexUvs[1],ob=Sa.skinVerticesA,pb=Sa.skinVerticesB,qb=Sa.skinIndices,lb=Sa.skinWeights,mb=n instanceof THREE.ShadowVolume?Sa.edgeFaces:undefined;morphTargets=Sa.morphTargets;if(X)for(fb in X){X[fb].offset=
+0;X[fb].offsetSrc=0}K=0;for(G=vb.length;K<G;K++){T=vb[K];H=yb[T];wb&&(Ha=wb[T]);xb&&(Ga=xb[T]);T=H.vertexNormals;I=H.normal;L=H.vertexColors;Z=H.color;Y=H.vertexTangents;if(H instanceof THREE.Face3){if(kb){xa=nb[H.a].position;Ea=nb[H.b].position;za=nb[H.c].position;Ra[Qa]=xa.x;Ra[Qa+1]=xa.y;Ra[Qa+2]=xa.z;Ra[Qa+3]=Ea.x;Ra[Qa+4]=Ea.y;Ra[Qa+5]=Ea.z;Ra[Qa+6]=za.x;Ra[Qa+7]=za.y;Ra[Qa+8]=za.z;Qa+=9}if(X)for(fb in X){w=X[fb];if(w.needsUpdate){E=w.offset;aa=w.offsetSrc;if(w.size===1){if(w.boundTo===undefined||
+w.boundTo==="vertices"){w.array[E+0]=w.value[H.a];w.array[E+1]=w.value[H.b];w.array[E+2]=w.value[H.c]}else if(w.boundTo==="faces"){w.array[E+0]=w.value[aa];w.array[E+1]=w.value[aa];w.array[E+2]=w.value[aa];w.offsetSrc++}else if(w.boundTo==="faceVertices"){w.array[E+0]=w.value[aa+0];w.array[E+1]=w.value[aa+1];w.array[E+2]=w.value[aa+2];w.offsetSrc+=3}w.offset+=3}else{if(w.boundTo===undefined||w.boundTo==="vertices"){xa=w.value[H.a];Ea=w.value[H.b];za=w.value[H.c]}else if(w.boundTo==="faces"){xa=w.value[aa];
+Ea=w.value[aa];za=w.value[aa];w.offsetSrc++}else if(w.boundTo==="faceVertices"){xa=w.value[aa+0];Ea=w.value[aa+1];za=w.value[aa+2];w.offsetSrc+=3}if(w.size===2){w.array[E+0]=xa.x;w.array[E+1]=xa.y;w.array[E+2]=Ea.x;w.array[E+3]=Ea.y;w.array[E+4]=za.x;w.array[E+5]=za.y;w.offset+=6}else if(w.size===3){if(w.type==="c"){w.array[E+0]=xa.r;w.array[E+1]=xa.g;w.array[E+2]=xa.b;w.array[E+3]=Ea.r;w.array[E+4]=Ea.g;w.array[E+5]=Ea.b;w.array[E+6]=za.r;w.array[E+7]=za.g;w.array[E+8]=za.b}else{w.array[E+0]=xa.x;
+w.array[E+1]=xa.y;w.array[E+2]=xa.z;w.array[E+3]=Ea.x;w.array[E+4]=Ea.y;w.array[E+5]=Ea.z;w.array[E+6]=za.x;w.array[E+7]=za.y;w.array[E+8]=za.z}w.offset+=9}else{w.array[E+0]=xa.x;w.array[E+1]=xa.y;w.array[E+2]=xa.z;w.array[E+3]=xa.w;w.array[E+4]=Ea.x;w.array[E+5]=Ea.y;w.array[E+6]=Ea.z;w.array[E+7]=Ea.w;w.array[E+8]=za.x;w.array[E+9]=za.y;w.array[E+10]=za.z;w.array[E+11]=za.w;w.offset+=12}}}}if(ub){E=0;for(aa=morphTargets.length;E<aa;E++){xa=morphTargets[E].vertices[H.a].position;Ea=morphTargets[E].vertices[H.b].position;
+za=morphTargets[E].vertices[H.c].position;w=ya[E];w[Na+0]=xa.x;w[Na+1]=xa.y;w[Na+2]=xa.z;w[Na+3]=Ea.x;w[Na+4]=Ea.y;w[Na+5]=Ea.z;w[Na+6]=za.x;w[Na+7]=za.y;w[Na+8]=za.z}Na+=9}if(lb.length){E=lb[H.a];aa=lb[H.b];w=lb[H.c];sa[N]=E.x;sa[N+1]=E.y;sa[N+2]=E.z;sa[N+3]=E.w;sa[N+4]=aa.x;sa[N+5]=aa.y;sa[N+6]=aa.z;sa[N+7]=aa.w;sa[N+8]=w.x;sa[N+9]=w.y;sa[N+10]=w.z;sa[N+11]=w.w;E=qb[H.a];aa=qb[H.b];w=qb[H.c];ua[N]=E.x;ua[N+1]=E.y;ua[N+2]=E.z;ua[N+3]=E.w;ua[N+4]=aa.x;ua[N+5]=aa.y;ua[N+6]=aa.z;ua[N+7]=aa.w;ua[N+8]=
+w.x;ua[N+9]=w.y;ua[N+10]=w.z;ua[N+11]=w.w;E=ob[H.a];aa=ob[H.b];w=ob[H.c];ia[N]=E.x;ia[N+1]=E.y;ia[N+2]=E.z;ia[N+3]=1;ia[N+4]=aa.x;ia[N+5]=aa.y;ia[N+6]=aa.z;ia[N+7]=1;ia[N+8]=w.x;ia[N+9]=w.y;ia[N+10]=w.z;ia[N+11]=1;E=pb[H.a];aa=pb[H.b];w=pb[H.c];$[N]=E.x;$[N+1]=E.y;$[N+2]=E.z;$[N+3]=1;$[N+4]=aa.x;$[N+5]=aa.y;$[N+6]=aa.z;$[N+7]=1;$[N+8]=w.x;$[N+9]=w.y;$[N+10]=w.z;$[N+11]=1;N+=12}if(tb&&Ka){if(L.length==3&&Ka==THREE.VertexColors){H=L[0];E=L[1];aa=L[2]}else aa=E=H=Z;na[Va]=H.r;na[Va+1]=H.g;na[Va+2]=H.b;
+na[Va+3]=E.r;na[Va+4]=E.g;na[Va+5]=E.b;na[Va+6]=aa.r;na[Va+7]=aa.g;na[Va+8]=aa.b;Va+=9}if(sb&&Sa.hasTangents){L=Y[0];Z=Y[1];H=Y[2];W[Ma]=L.x;W[Ma+1]=L.y;W[Ma+2]=L.z;W[Ma+3]=L.w;W[Ma+4]=Z.x;W[Ma+5]=Z.y;W[Ma+6]=Z.z;W[Ma+7]=Z.w;W[Ma+8]=H.x;W[Ma+9]=H.y;W[Ma+10]=H.z;W[Ma+11]=H.w;Ma+=12}if(rb&&Ca)if(T.length==3&&eb)for(Y=0;Y<3;Y++){I=T[Y];Pa[$a]=I.x;Pa[$a+1]=I.y;Pa[$a+2]=I.z;$a+=3}else for(Y=0;Y<3;Y++){Pa[$a]=I.x;Pa[$a+1]=I.y;Pa[$a+2]=I.z;$a+=3}if(db&&Ha!==undefined&&ra)for(Y=0;Y<3;Y++){T=Ha[Y];ib[cb]=
+T.u;ib[cb+1]=T.v;cb+=2}if(db&&Ga!==undefined&&ra)for(Y=0;Y<3;Y++){T=Ga[Y];jb[hb]=T.u;jb[hb+1]=T.v;hb+=2}if(gb){Ia[Wa]=Oa;Ia[Wa+1]=Oa+1;Ia[Wa+2]=Oa+2;Wa+=3;Ya[bb]=Oa;Ya[bb+1]=Oa+1;Ya[bb+2]=Oa;Ya[bb+3]=Oa+2;Ya[bb+4]=Oa+1;Ya[bb+5]=Oa+2;bb+=6;Oa+=3}}else if(H instanceof THREE.Face4){if(kb){xa=nb[H.a].position;Ea=nb[H.b].position;za=nb[H.c].position;Ua=nb[H.d].position;Ra[Qa]=xa.x;Ra[Qa+1]=xa.y;Ra[Qa+2]=xa.z;Ra[Qa+3]=Ea.x;Ra[Qa+4]=Ea.y;Ra[Qa+5]=Ea.z;Ra[Qa+6]=za.x;Ra[Qa+7]=za.y;Ra[Qa+8]=za.z;Ra[Qa+9]=Ua.x;
+Ra[Qa+10]=Ua.y;Ra[Qa+11]=Ua.z;Qa+=12}if(X)for(fb in X){w=X[fb];if(w.needsUpdate){E=w.offset;aa=w.offsetSrc;if(w.size===1){if(w.boundTo===undefined||w.boundTo==="vertices"){w.array[E+0]=w.value[H.a];w.array[E+1]=w.value[H.b];w.array[E+2]=w.value[H.c];w.array[E+2]=w.value[H.d]}else if(w.boundTo==="faces"){w.array[E+0]=w.value[aa];w.array[E+1]=w.value[aa];w.array[E+2]=w.value[aa];w.array[E+2]=w.value[aa];w.offsetSrc++}else if(w.boundTo==="faceVertices"){w.array[E+0]=w.value[aa+0];w.array[E+1]=w.value[aa+
+1];w.array[E+2]=w.value[aa+2];w.array[E+2]=w.value[aa+3];w.offsetSrc+=4}w.offset+=4}else{if(w.boundTo===undefined||w.boundTo==="vertices"){xa=w.value[H.a];Ea=w.value[H.b];za=w.value[H.c];Ua=w.value[H.d]}else if(w.boundTo==="faces"){xa=w.value[aa];Ea=w.value[aa];za=w.value[aa];Ua=w.value[aa];w.offsetSrc++}else if(w.boundTo==="faceVertices"){xa=w.value[aa+0];Ea=w.value[aa+1];za=w.value[aa+2];Ua=w.value[aa+3];w.offsetSrc+=4}if(w.size===2){w.array[E+0]=xa.x;w.array[E+1]=xa.y;w.array[E+2]=Ea.x;w.array[E+
+3]=Ea.y;w.array[E+4]=za.x;w.array[E+5]=za.y;w.array[E+6]=Ua.x;w.array[E+7]=Ua.y;w.offset+=8}else if(w.size===3){if(w.type==="c"){w.array[E+0]=xa.r;w.array[E+1]=xa.g;w.array[E+2]=xa.b;w.array[E+3]=Ea.r;w.array[E+4]=Ea.g;w.array[E+5]=Ea.b;w.array[E+6]=za.r;w.array[E+7]=za.g;w.array[E+8]=za.b;w.array[E+9]=Ua.r;w.array[E+10]=Ua.g;w.array[E+11]=Ua.b}else{w.array[E+0]=xa.x;w.array[E+1]=xa.y;w.array[E+2]=xa.z;w.array[E+3]=Ea.x;w.array[E+4]=Ea.y;w.array[E+5]=Ea.z;w.array[E+6]=za.x;w.array[E+7]=za.y;w.array[E+
+8]=za.z;w.array[E+9]=Ua.x;w.array[E+10]=Ua.y;w.array[E+11]=Ua.z}w.offset+=12}else{w.array[E+0]=xa.x;w.array[E+1]=xa.y;w.array[E+2]=xa.z;w.array[E+3]=xa.w;w.array[E+4]=Ea.x;w.array[E+5]=Ea.y;w.array[E+6]=Ea.z;w.array[E+7]=Ea.w;w.array[E+8]=za.x;w.array[E+9]=za.y;w.array[E+10]=za.z;w.array[E+11]=za.w;w.array[E+12]=Ua.x;w.array[E+13]=Ua.y;w.array[E+14]=Ua.z;w.array[E+15]=Ua.w;w.offset+=16}}}}if(ub){E=0;for(aa=morphTargets.length;E<aa;E++){xa=morphTargets[E].vertices[H.a].position;Ea=morphTargets[E].vertices[H.b].position;
+za=morphTargets[E].vertices[H.c].position;Ua=morphTargets[E].vertices[H.d].position;w=ya[E];w[Na+0]=xa.x;w[Na+1]=xa.y;w[Na+2]=xa.z;w[Na+3]=Ea.x;w[Na+4]=Ea.y;w[Na+5]=Ea.z;w[Na+6]=za.x;w[Na+7]=za.y;w[Na+8]=za.z;w[Na+9]=Ua.x;w[Na+10]=Ua.y;w[Na+11]=Ua.z}Na+=12}if(lb.length){E=lb[H.a];aa=lb[H.b];w=lb[H.c];ab=lb[H.d];sa[N]=E.x;sa[N+1]=E.y;sa[N+2]=E.z;sa[N+3]=E.w;sa[N+4]=aa.x;sa[N+5]=aa.y;sa[N+6]=aa.z;sa[N+7]=aa.w;sa[N+8]=w.x;sa[N+9]=w.y;sa[N+10]=w.z;sa[N+11]=w.w;sa[N+12]=ab.x;sa[N+13]=ab.y;sa[N+14]=ab.z;
+sa[N+15]=ab.w;E=qb[H.a];aa=qb[H.b];w=qb[H.c];ab=qb[H.d];ua[N]=E.x;ua[N+1]=E.y;ua[N+2]=E.z;ua[N+3]=E.w;ua[N+4]=aa.x;ua[N+5]=aa.y;ua[N+6]=aa.z;ua[N+7]=aa.w;ua[N+8]=w.x;ua[N+9]=w.y;ua[N+10]=w.z;ua[N+11]=w.w;ua[N+12]=ab.x;ua[N+13]=ab.y;ua[N+14]=ab.z;ua[N+15]=ab.w;E=ob[H.a];aa=ob[H.b];w=ob[H.c];ab=ob[H.d];ia[N]=E.x;ia[N+1]=E.y;ia[N+2]=E.z;ia[N+3]=1;ia[N+4]=aa.x;ia[N+5]=aa.y;ia[N+6]=aa.z;ia[N+7]=1;ia[N+8]=w.x;ia[N+9]=w.y;ia[N+10]=w.z;ia[N+11]=1;ia[N+12]=ab.x;ia[N+13]=ab.y;ia[N+14]=ab.z;ia[N+15]=1;E=pb[H.a];
+aa=pb[H.b];w=pb[H.c];H=pb[H.d];$[N]=E.x;$[N+1]=E.y;$[N+2]=E.z;$[N+3]=1;$[N+4]=aa.x;$[N+5]=aa.y;$[N+6]=aa.z;$[N+7]=1;$[N+8]=w.x;$[N+9]=w.y;$[N+10]=w.z;$[N+11]=1;$[N+12]=H.x;$[N+13]=H.y;$[N+14]=H.z;$[N+15]=1;N+=16}if(tb&&Ka){if(L.length==4&&Ka==THREE.VertexColors){H=L[0];E=L[1];aa=L[2];L=L[3]}else L=aa=E=H=Z;na[Va]=H.r;na[Va+1]=H.g;na[Va+2]=H.b;na[Va+3]=E.r;na[Va+4]=E.g;na[Va+5]=E.b;na[Va+6]=aa.r;na[Va+7]=aa.g;na[Va+8]=aa.b;na[Va+9]=L.r;na[Va+10]=L.g;na[Va+11]=L.b;Va+=12}if(sb&&Sa.hasTangents){L=Y[0];
+Z=Y[1];H=Y[2];Y=Y[3];W[Ma]=L.x;W[Ma+1]=L.y;W[Ma+2]=L.z;W[Ma+3]=L.w;W[Ma+4]=Z.x;W[Ma+5]=Z.y;W[Ma+6]=Z.z;W[Ma+7]=Z.w;W[Ma+8]=H.x;W[Ma+9]=H.y;W[Ma+10]=H.z;W[Ma+11]=H.w;W[Ma+12]=Y.x;W[Ma+13]=Y.y;W[Ma+14]=Y.z;W[Ma+15]=Y.w;Ma+=16}if(rb&&Ca)if(T.length==4&&eb)for(Y=0;Y<4;Y++){I=T[Y];Pa[$a]=I.x;Pa[$a+1]=I.y;Pa[$a+2]=I.z;$a+=3}else for(Y=0;Y<4;Y++){Pa[$a]=I.x;Pa[$a+1]=I.y;Pa[$a+2]=I.z;$a+=3}if(db&&Ha!==undefined&&ra)for(Y=0;Y<4;Y++){T=Ha[Y];ib[cb]=T.u;ib[cb+1]=T.v;cb+=2}if(db&&Ga!==undefined&&ra)for(Y=0;Y<
+4;Y++){T=Ga[Y];jb[hb]=T.u;jb[hb+1]=T.v;hb+=2}if(gb){Ia[Wa]=Oa;Ia[Wa+1]=Oa+1;Ia[Wa+2]=Oa+3;Ia[Wa+3]=Oa+1;Ia[Wa+4]=Oa+2;Ia[Wa+5]=Oa+3;Wa+=6;Ya[bb]=Oa;Ya[bb+1]=Oa+1;Ya[bb+2]=Oa;Ya[bb+3]=Oa+3;Ya[bb+4]=Oa+1;Ya[bb+5]=Oa+2;Ya[bb+6]=Oa+2;Ya[bb+7]=Oa+3;bb+=8;Oa+=4}}}if(mb){K=0;for(G=mb.length;K<G;K++){Ia[Wa]=mb[K].a;Ia[Wa+1]=mb[K].b;Ia[Wa+2]=mb[K].c;Ia[Wa+3]=mb[K].a;Ia[Wa+4]=mb[K].c;Ia[Wa+5]=mb[K].d;Wa+=6}}if(kb){e.bindBuffer(e.ARRAY_BUFFER,v.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,Ra,Q)}if(X)for(fb in X){w=
+X[fb];if(w.needsUpdate){e.bindBuffer(e.ARRAY_BUFFER,w.buffer);e.bufferData(e.ARRAY_BUFFER,w.array,Q);w.needsUpdate=!1}}if(ub){E=0;for(aa=morphTargets.length;E<aa;E++){e.bindBuffer(e.ARRAY_BUFFER,v.__webglMorphTargetsBuffers[E]);e.bufferData(e.ARRAY_BUFFER,ya[E],Q)}}if(tb&&Va>0){e.bindBuffer(e.ARRAY_BUFFER,v.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,na,Q)}if(rb){e.bindBuffer(e.ARRAY_BUFFER,v.__webglNormalBuffer);e.bufferData(e.ARRAY_BUFFER,Pa,Q)}if(sb&&Sa.hasTangents){e.bindBuffer(e.ARRAY_BUFFER,
+v.__webglTangentBuffer);e.bufferData(e.ARRAY_BUFFER,W,Q)}if(db&&cb>0){e.bindBuffer(e.ARRAY_BUFFER,v.__webglUVBuffer);e.bufferData(e.ARRAY_BUFFER,ib,Q)}if(db&&hb>0){e.bindBuffer(e.ARRAY_BUFFER,v.__webglUV2Buffer);e.bufferData(e.ARRAY_BUFFER,jb,Q)}if(gb){e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,v.__webglFaceBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,Ia,Q);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,v.__webglLineBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,Ya,Q)}if(N>0){e.bindBuffer(e.ARRAY_BUFFER,v.__webglSkinVertexABuffer);
+e.bufferData(e.ARRAY_BUFFER,ia,Q);e.bindBuffer(e.ARRAY_BUFFER,v.__webglSkinVertexBBuffer);e.bufferData(e.ARRAY_BUFFER,$,Q);e.bindBuffer(e.ARRAY_BUFFER,v.__webglSkinIndicesBuffer);e.bufferData(e.ARRAY_BUFFER,ua,Q);e.bindBuffer(e.ARRAY_BUFFER,v.__webglSkinWeightsBuffer);e.bufferData(e.ARRAY_BUFFER,sa,Q)}}}x.__dirtyVertices=!1;x.__dirtyMorphTargets=!1;x.__dirtyElements=!1;x.__dirtyUvs=!1;x.__dirtyNormals=!1;x.__dirtyTangents=!1;x.__dirtyColors=!1}else if(n instanceof THREE.Ribbon){x=n.geometry;if(x.__dirtyVertices||
+x.__dirtyColors){n=x;D=e.DYNAMIC_DRAW;Ka=n.vertices;v=n.colors;Ca=Ka.length;Q=v.length;Ha=n.__vertexArray;K=n.__colorArray;Ga=n.__dirtyColors;if(n.__dirtyVertices){for(G=0;G<Ca;G++){ra=Ka[G].position;z=G*3;Ha[z]=ra.x;Ha[z+1]=ra.y;Ha[z+2]=ra.z}e.bindBuffer(e.ARRAY_BUFFER,n.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,Ha,D)}if(Ga){for(G=0;G<Q;G++){color=v[G];z=G*3;K[z]=color.r;K[z+1]=color.g;K[z+2]=color.b}e.bindBuffer(e.ARRAY_BUFFER,n.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,K,D)}}x.__dirtyVertices=
+!1;x.__dirtyColors=!1}else if(n instanceof THREE.Line){x=n.geometry;if(x.__dirtyVertices||x.__dirtyColors){n=x;D=e.DYNAMIC_DRAW;Ka=n.vertices;v=n.colors;Ca=Ka.length;Q=v.length;Ha=n.__vertexArray;K=n.__colorArray;Ga=n.__dirtyColors;if(n.__dirtyVertices){for(G=0;G<Ca;G++){ra=Ka[G].position;z=G*3;Ha[z]=ra.x;Ha[z+1]=ra.y;Ha[z+2]=ra.z}e.bindBuffer(e.ARRAY_BUFFER,n.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,Ha,D)}if(Ga){for(G=0;G<Q;G++){color=v[G];z=G*3;K[z]=color.r;K[z+1]=color.g;K[z+2]=color.b}e.bindBuffer(e.ARRAY_BUFFER,
+n.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,K,D)}}x.__dirtyVertices=!1;x.__dirtyColors=!1}else if(n instanceof THREE.ParticleSystem){x=n.geometry;(x.__dirtyVertices||x.__dirtyColors||n.sortParticles)&&d(x,e.DYNAMIC_DRAW,n);x.__dirtyVertices=!1;x.__dirtyColors=!1}}function U(n){function D(Z){var Y=[];x=0;for(v=Z.length;x<v;x++)Z[x]==undefined?Y.push("undefined"):Y.push(Z[x].id);return Y.join("_")}var x,v,z,Q,K,G,T,H,I={},L=n.morphTargets!==undefined?n.morphTargets.length:0;n.geometryGroups={};
+z=0;for(Q=n.faces.length;z<Q;z++){K=n.faces[z];G=K.materials;T=D(G);I[T]==undefined&&(I[T]={hash:T,counter:0});H=I[T].hash+"_"+I[T].counter;n.geometryGroups[H]==undefined&&(n.geometryGroups[H]={faces:[],materials:G,vertices:0,numMorphTargets:L});K=K instanceof THREE.Face3?3:4;if(n.geometryGroups[H].vertices+K>65535){I[T].counter+=1;H=I[T].hash+"_"+I[T].counter;n.geometryGroups[H]==undefined&&(n.geometryGroups[H]={faces:[],materials:G,vertices:0,numMorphTargets:L})}n.geometryGroups[H].faces.push(z);
+n.geometryGroups[H].vertices+=K}}function C(n,D,x){n.push({buffer:D,object:x,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function V(n){if(n!=pa){switch(n){case THREE.AdditiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE);break;case THREE.SubtractiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ZERO,e.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ZERO,e.SRC_COLOR);break;default:e.blendEquationSeparate(e.FUNC_ADD,
+e.FUNC_ADD);e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA)}pa=n}}function O(n,D,x){if((x.width&x.width-1)==0&&(x.height&x.height-1)==0){e.texParameteri(n,e.TEXTURE_WRAP_S,ga(D.wrapS));e.texParameteri(n,e.TEXTURE_WRAP_T,ga(D.wrapT));e.texParameteri(n,e.TEXTURE_MAG_FILTER,ga(D.magFilter));e.texParameteri(n,e.TEXTURE_MIN_FILTER,ga(D.minFilter));e.generateMipmap(n)}else{e.texParameteri(n,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE);e.texParameteri(n,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE);
+e.texParameteri(n,e.TEXTURE_MAG_FILTER,qa(D.magFilter));e.texParameteri(n,e.TEXTURE_MIN_FILTER,qa(D.minFilter))}}function M(n,D){if(n.needsUpdate){if(n.__webglInit){e.bindTexture(e.TEXTURE_2D,n.__webglTexture);e.texSubImage2D(e.TEXTURE_2D,0,0,0,e.RGBA,e.UNSIGNED_BYTE,n.image)}else{n.__webglTexture=e.createTexture();e.bindTexture(e.TEXTURE_2D,n.__webglTexture);e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,n.image);n.__webglInit=!0}O(e.TEXTURE_2D,n,n.image);e.bindTexture(e.TEXTURE_2D,null);
+n.needsUpdate=!1}e.activeTexture(e.TEXTURE0+D);e.bindTexture(e.TEXTURE_2D,n.__webglTexture)}function va(n){if(n&&!n.__webglFramebuffer){if(n.depthBuffer===undefined)n.depthBuffer=!0;if(n.stencilBuffer===undefined)n.stencilBuffer=!0;n.__webglFramebuffer=e.createFramebuffer();n.__webglRenderbuffer=e.createRenderbuffer();n.__webglTexture=e.createTexture();e.bindTexture(e.TEXTURE_2D,n.__webglTexture);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,ga(n.wrapS));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,
+ga(n.wrapT));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,ga(n.magFilter));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,ga(n.minFilter));e.texImage2D(e.TEXTURE_2D,0,ga(n.format),n.width,n.height,0,ga(n.format),ga(n.type),null);e.bindRenderbuffer(e.RENDERBUFFER,n.__webglRenderbuffer);e.bindFramebuffer(e.FRAMEBUFFER,n.__webglFramebuffer);e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,n.__webglTexture,0);if(n.depthBuffer&&!n.stencilBuffer){e.renderbufferStorage(e.RENDERBUFFER,
+e.DEPTH_COMPONENT16,n.width,n.height);e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,n.__webglRenderbuffer)}else if(n.depthBuffer&&n.stencilBuffer){e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,n.width,n.height);e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,n.__webglRenderbuffer)}else e.renderbufferStorage(e.RENDERBUFFER,e.RGBA4,n.width,n.height);e.bindTexture(e.TEXTURE_2D,null);e.bindRenderbuffer(e.RENDERBUFFER,null);e.bindFramebuffer(e.FRAMEBUFFER,
+null)}var D,x;if(n){D=n.__webglFramebuffer;x=n.width;n=n.height}else{D=null;x=Fa;n=ja}if(D!=da){e.bindFramebuffer(e.FRAMEBUFFER,D);e.viewport(ka,ma,x,n);da=D}}function la(n,D){var x;if(n=="fragment")x=e.createShader(e.FRAGMENT_SHADER);else n=="vertex"&&(x=e.createShader(e.VERTEX_SHADER));e.shaderSource(x,D);e.compileShader(x);if(!e.getShaderParameter(x,e.COMPILE_STATUS)){console.error(e.getShaderInfoLog(x));console.error(D);return null}return x}function qa(n){switch(n){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return e.NEAREST;
+default:return e.LINEAR}}function ga(n){switch(n){case THREE.RepeatWrapping:return e.REPEAT;case THREE.ClampToEdgeWrapping:return e.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return e.MIRRORED_REPEAT;case THREE.NearestFilter:return e.NEAREST;case THREE.NearestMipMapNearestFilter:return e.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return e.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return e.LINEAR;case THREE.LinearMipMapNearestFilter:return e.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return e.LINEAR_MIPMAP_LINEAR;
 case THREE.ByteType:return e.BYTE;case THREE.UnsignedByteType:return e.UNSIGNED_BYTE;case THREE.ShortType:return e.SHORT;case THREE.UnsignedShortType:return e.UNSIGNED_SHORT;case THREE.IntType:return e.INT;case THREE.UnsignedShortType:return e.UNSIGNED_INT;case THREE.FloatType:return e.FLOAT;case THREE.AlphaFormat:return e.ALPHA;case THREE.RGBFormat:return e.RGB;case THREE.RGBAFormat:return e.RGBA;case THREE.LuminanceFormat:return e.LUMINANCE;case THREE.LuminanceAlphaFormat:return e.LUMINANCE_ALPHA}return 0}
-var ia=this,e,oa=document.createElement("canvas"),Da=[],Aa=null,da=null,ea=!0,wa=null,ta=null,pa=null,ca=null,ka=0,ma=0,Fa=0,ja=0,ga=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Ja=new THREE.Matrix4,Xa=new Float32Array(16),Za=new Float32Array(16),Ta=new THREE.Vector4,R={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}};b=b||{};stencil=b.stencil!==undefined?b.stencil:!0;
-antialias=b.antialias!==undefined?b.antialias:!1;clearColor=b.clearColor!==undefined?new THREE.Color(b.clearColor):new THREE.Color(0);clearAlpha=b.clearAlpha!==undefined?b.clearAlpha:0;this.data={vertices:0,faces:0};this.maxMorphTargets=8;this.domElement=oa;this.autoClear=!0;this.sortObjects=!0;(function(n,D,x,v){try{if(!(e=oa.getContext("experimental-webgl",{antialias:n,stencil:v})))throw"Error creating WebGL context.";}catch(z){console.error(z)}console.log(navigator.userAgent+" | "+e.getParameter(e.VERSION)+
-" | "+e.getParameter(e.VENDOR)+" | "+e.getParameter(e.RENDERER)+" | "+e.getParameter(e.SHADING_LANGUAGE_VERSION));e.clearColor(0,0,0,1);e.clearDepth(1);e.enable(e.DEPTH_TEST);e.depthFunc(e.LEQUAL);e.frontFace(e.CCW);e.cullFace(e.BACK);e.enable(e.CULL_FACE);e.enable(e.BLEND);e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA);e.clearColor(D.r,D.g,D.b,x)})(antialias,clearColor,clearAlpha,stencil);this.context=e;if(stencil){var S={};S.vertices=new Float32Array(12);S.faces=new Uint16Array(6);
-S.darkness=0.5;S.vertices[0]=-20;S.vertices[1]=-20;S.vertices[2]=-1;S.vertices[3]=20;S.vertices[4]=-20;S.vertices[5]=-1;S.vertices[6]=20;S.vertices[7]=20;S.vertices[8]=-1;S.vertices[9]=-20;S.vertices[10]=20;S.vertices[11]=-1;S.faces[0]=0;S.faces[1]=1;S.faces[2]=2;S.faces[3]=0;S.faces[4]=2;S.faces[5]=3;S.vertexBuffer=e.createBuffer();S.elementBuffer=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,S.vertexBuffer);e.bufferData(e.ARRAY_BUFFER,S.vertices,e.STATIC_DRAW);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,
+var ea=this,e,oa=document.createElement("canvas"),Da=[],Aa=null,da=null,fa=!0,wa=null,ta=null,pa=null,ca=null,ka=0,ma=0,Fa=0,ja=0,ha=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Ja=new THREE.Matrix4,Xa=new Float32Array(16),Za=new Float32Array(16),Ta=new THREE.Vector4,R={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}};b=b||{};stencil=b.stencil!==undefined?b.stencil:!0;
+antialias=b.antialias!==undefined?b.antialias:!1;clearColor=b.clearColor!==undefined?new THREE.Color(b.clearColor):new THREE.Color(0);clearAlpha=b.clearAlpha!==undefined?b.clearAlpha:0;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=oa;this.autoClear=!0;this.sortObjects=!0;(function(n,D,x,v){try{if(!(e=oa.getContext("experimental-webgl",{antialias:n,stencil:v})))throw"Error creating WebGL context.";}catch(z){console.error(z)}console.log(navigator.userAgent+" | "+
+e.getParameter(e.VERSION)+" | "+e.getParameter(e.VENDOR)+" | "+e.getParameter(e.RENDERER)+" | "+e.getParameter(e.SHADING_LANGUAGE_VERSION));e.clearColor(0,0,0,1);e.clearDepth(1);e.enable(e.DEPTH_TEST);e.depthFunc(e.LEQUAL);e.frontFace(e.CCW);e.cullFace(e.BACK);e.enable(e.CULL_FACE);e.enable(e.BLEND);e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA);e.clearColor(D.r,D.g,D.b,x)})(antialias,clearColor,clearAlpha,stencil);this.context=e;if(stencil){var S={};S.vertices=new Float32Array(12);
+S.faces=new Uint16Array(6);S.darkness=0.5;S.vertices[0]=-20;S.vertices[1]=-20;S.vertices[2]=-1;S.vertices[3]=20;S.vertices[4]=-20;S.vertices[5]=-1;S.vertices[6]=20;S.vertices[7]=20;S.vertices[8]=-1;S.vertices[9]=-20;S.vertices[10]=20;S.vertices[11]=-1;S.faces[0]=0;S.faces[1]=1;S.faces[2]=2;S.faces[3]=0;S.faces[4]=2;S.faces[5]=3;S.vertexBuffer=e.createBuffer();S.elementBuffer=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,S.vertexBuffer);e.bufferData(e.ARRAY_BUFFER,S.vertices,e.STATIC_DRAW);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,
 S.elementBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,S.faces,e.STATIC_DRAW);S.program=e.createProgram();e.attachShader(S.program,la("fragment",THREE.ShaderLib.shadowPost.fragmentShader));e.attachShader(S.program,la("vertex",THREE.ShaderLib.shadowPost.vertexShader));e.linkProgram(S.program);S.vertexLocation=e.getAttribLocation(S.program,"position");S.projectionLocation=e.getUniformLocation(S.program,"projectionMatrix");S.darknessLocation=e.getUniformLocation(S.program,"darkness")}var 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++]=0;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++]=1;P.vertices[b++]=1;P.vertices[b++]=-1;P.vertices[b++]=1;P.vertices[b++]=0;P.vertices[b++]=1;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=e.createBuffer();P.elementBuffer=e.createBuffer();
 P.tempTexture=e.createTexture();P.occlusionTexture=e.createTexture();e.bindBuffer(e.ARRAY_BUFFER,P.vertexBuffer);e.bufferData(e.ARRAY_BUFFER,P.vertices,e.STATIC_DRAW);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,P.elementBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,P.faces,e.STATIC_DRAW);e.bindTexture(e.TEXTURE_2D,P.tempTexture);e.texImage2D(e.TEXTURE_2D,0,e.RGB,16,16,0,e.RGB,e.UNSIGNED_BYTE,null);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE);
@@ -306,7 +306,7 @@ e.getUniformLocation(P.program,"screenPosition");var Ba=!1;_sprite={};_sprite.ve
 e.attachShader(_sprite.program,la("fragment",THREE.ShaderLib.sprite.fragmentShader));e.attachShader(_sprite.program,la("vertex",THREE.ShaderLib.sprite.vertexShader));e.linkProgram(_sprite.program);_sprite.attributes={};_sprite.uniforms={};_sprite.attributes.position=e.getAttribLocation(_sprite.program,"position");_sprite.attributes.uv=e.getAttribLocation(_sprite.program,"uv");_sprite.uniforms.uvOffset=e.getUniformLocation(_sprite.program,"uvOffset");_sprite.uniforms.uvScale=e.getUniformLocation(_sprite.program,
 "uvScale");_sprite.uniforms.rotation=e.getUniformLocation(_sprite.program,"rotation");_sprite.uniforms.scale=e.getUniformLocation(_sprite.program,"scale");_sprite.uniforms.alignment=e.getUniformLocation(_sprite.program,"alignment");_sprite.uniforms.map=e.getUniformLocation(_sprite.program,"map");_sprite.uniforms.opacity=e.getUniformLocation(_sprite.program,"opacity");_sprite.uniforms.useScreenCoordinates=e.getUniformLocation(_sprite.program,"useScreenCoordinates");_sprite.uniforms.affectedByDistance=
 e.getUniformLocation(_sprite.program,"affectedByDistance");_sprite.uniforms.screenPosition=e.getUniformLocation(_sprite.program,"screenPosition");_sprite.uniforms.modelViewMatrix=e.getUniformLocation(_sprite.program,"modelViewMatrix");_sprite.uniforms.projectionMatrix=e.getUniformLocation(_sprite.program,"projectionMatrix");var La=!1;this.setSize=function(n,D){oa.width=n;oa.height=D;this.setViewport(0,0,oa.width,oa.height)};this.setViewport=function(n,D,x,v){ka=n;ma=D;Fa=x;ja=v;e.viewport(ka,ma,Fa,
-ja)};this.setScissor=function(n,D,x,v){e.scissor(n,D,x,v)};this.enableScissorTest=function(n){n?e.enable(e.SCISSOR_TEST):e.disable(e.SCISSOR_TEST)};this.enableDepthBufferWrite=function(n){ea=n;e.depthMask(n)};this.setClearColorHex=function(n,D){var x=new THREE.Color(n);e.clearColor(x.r,x.g,x.b,D)};this.setClearColor=function(n,D){e.clearColor(n.r,n.g,n.b,D)};this.clear=function(){e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT|e.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(n){S.darkness=
+ja)};this.setScissor=function(n,D,x,v){e.scissor(n,D,x,v)};this.enableScissorTest=function(n){n?e.enable(e.SCISSOR_TEST):e.disable(e.SCISSOR_TEST)};this.enableDepthBufferWrite=function(n){fa=n;e.depthMask(n)};this.setClearColorHex=function(n,D){var x=new THREE.Color(n);e.clearColor(x.r,x.g,x.b,D)};this.setClearColor=function(n,D){e.clearColor(n.r,n.g,n.b,D)};this.clear=function(){e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT|e.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(n){S.darkness=
 n};this.getContext=function(){return e};this.initMaterial=function(n,D,x,v){var z,Q,K;if(n instanceof THREE.MeshDepthMaterial)K="depth";else if(n instanceof THREE.ShadowVolumeDynamicMaterial)K="shadowVolumeDynamic";else if(n instanceof THREE.MeshNormalMaterial)K="normal";else if(n instanceof THREE.MeshBasicMaterial)K="basic";else if(n instanceof THREE.MeshLambertMaterial)K="lambert";else if(n instanceof THREE.MeshPhongMaterial)K="phong";else if(n instanceof THREE.LineBasicMaterial)K="basic";else n instanceof
 THREE.ParticleBasicMaterial&&(K="particle_basic");if(K){var G=THREE.ShaderLib[K];n.uniforms=THREE.UniformsUtils.clone(G.uniforms);n.vertexShader=G.vertexShader;n.fragmentShader=G.fragmentShader}var T,H,I;T=I=G=0;for(H=D.length;T<H;T++){Q=D[T];Q instanceof THREE.DirectionalLight&&I++;Q instanceof THREE.PointLight&&G++}if(G+I<=4)D=I;else{D=Math.ceil(4*I/(G+I));G=4-D}Q={directional:D,point:G};I=50;if(v!==undefined&&v instanceof THREE.SkinnedMesh)I=v.bones.length;var L;a:{T=n.fragmentShader;H=n.vertexShader;
 G=n.uniforms;D=n.attributes;x={map:!!n.map,envMap:!!n.envMap,lightMap:!!n.lightMap,vertexColors:n.vertexColors,fog:x,sizeAttenuation:n.sizeAttenuation,skinning:n.skinning,morphTargets:n.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:Q.directional,maxPointLights:Q.point,maxBones:I};var Z;Q=[];if(K)Q.push(K);else{Q.push(T);Q.push(H)}for(Z in x){Q.push(Z);Q.push(x[Z])}K=Q.join();Z=0;for(Q=Da.length;Z<Q;Z++)if(Da[Z].code==K){L=Da[Z].program;break a}Z=e.createProgram();prefix_fragment=
@@ -316,26 +316,26 @@ e.attachShader(Z,la("fragment",prefix_fragment+T));e.attachShader(Z,la("vertex",
 Y=T;G=0;for(T=Y.length;G<T;G++){H=Y[G];Z.uniforms[H]=e.getUniformLocation(Z,H)}T=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(Y=0;Y<x.maxMorphTargets;Y++)T.push("morphTarget"+Y);for(L in D)T.push(L);L=T;Y=0;for(D=L.length;Y<D;Y++){x=L[Y];Z.attributes[x]=e.getAttribLocation(Z,x)}Da.push({program:Z,code:K});L=Z}n.program=L;L=n.program.attributes;e.enableVertexAttribArray(L.position);L.color>=0&&e.enableVertexAttribArray(L.color);L.normal>=
 0&&e.enableVertexAttribArray(L.normal);L.tangent>=0&&e.enableVertexAttribArray(L.tangent);if(n.skinning&&L.skinVertexA>=0&&L.skinVertexB>=0&&L.skinIndex>=0&&L.skinWeight>=0){e.enableVertexAttribArray(L.skinVertexA);e.enableVertexAttribArray(L.skinVertexB);e.enableVertexAttribArray(L.skinIndex);e.enableVertexAttribArray(L.skinWeight)}for(z in n.attributes)L[z]>=0&&e.enableVertexAttribArray(L[z]);if(n.morphTargets){n.numSupportedMorphTargets=0;if(L.morphTarget0>=0){e.enableVertexAttribArray(L.morphTarget0);
 n.numSupportedMorphTargets++}if(L.morphTarget1>=0){e.enableVertexAttribArray(L.morphTarget1);n.numSupportedMorphTargets++}if(L.morphTarget2>=0){e.enableVertexAttribArray(L.morphTarget2);n.numSupportedMorphTargets++}if(L.morphTarget3>=0){e.enableVertexAttribArray(L.morphTarget3);n.numSupportedMorphTargets++}if(L.morphTarget4>=0){e.enableVertexAttribArray(L.morphTarget4);n.numSupportedMorphTargets++}if(L.morphTarget5>=0){e.enableVertexAttribArray(L.morphTarget5);n.numSupportedMorphTargets++}if(L.morphTarget6>=
-0){e.enableVertexAttribArray(L.morphTarget6);n.numSupportedMorphTargets++}if(L.morphTarget7>=0){e.enableVertexAttribArray(L.morphTarget7);n.numSupportedMorphTargets++}v.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);n=0;for(z=this.maxMorphTargets;n<z;n++)v.__webglMorphTargetInfluences[n]=0}};this.render=function(n,D,x,v){var z,Q,K,G,T,H,I,L,Z=n.lights,Y=n.fog;ia.data.vertices=0;ia.data.faces=0;D.matrixAutoUpdate&&D.update(undefined,!0);n.update(undefined,!1,D);D.matrixWorldInverse.flattenToArray(Za);
-D.projectionMatrix.flattenToArray(Xa);Ja.multiply(D.projectionMatrix,D.matrixWorldInverse);k(Ja);this.initWebGLObjects(n);va(x);(this.autoClear||v)&&this.clear();T=n.__webglObjects.length;for(v=0;v<T;v++){z=n.__webglObjects[v];I=z.object;if(I.visible)if(!(I instanceof THREE.Mesh)||m(I)){I.matrixWorld.flattenToArray(I._objectMatrixArray);J(I,D);t(z);z.render=!0;if(this.sortObjects){Ta.copy(I.position);Ja.multiplyVector3(Ta);z.z=Ta.z}}else z.render=!1;else z.render=!1}this.sortObjects&&n.__webglObjects.sort(y);
-H=n.__webglObjectsImmediate.length;for(v=0;v<H;v++){z=n.__webglObjectsImmediate[v];I=z.object;if(I.visible){I.matrixAutoUpdate&&I.matrixWorld.flattenToArray(I._objectMatrixArray);J(I,D);p(z)}}V(THREE.NormalBlending);for(v=0;v<T;v++){z=n.__webglObjects[v];if(z.render){I=z.object;L=z.buffer;K=z.opaque;h(I);for(z=0;z<K.count;z++){G=K.list[z];j(G.depthTest);f(D,Z,Y,G,L,I)}}}for(v=0;v<H;v++){z=n.__webglObjectsImmediate[v];I=z.object;if(I.visible){K=z.opaque;h(I);for(z=0;z<K.count;z++){G=K.list[z];j(G.depthTest);
-Q=c(D,Z,Y,G,I);I.render(function(ra){g(ra,Q,G.shading)})}}}for(v=0;v<T;v++){z=n.__webglObjects[v];if(z.render){I=z.object;L=z.buffer;K=z.transparent;h(I);for(z=0;z<K.count;z++){G=K.list[z];V(G.blending);j(G.depthTest);f(D,Z,Y,G,L,I)}}}for(v=0;v<H;v++){z=n.__webglObjectsImmediate[v];I=z.object;if(I.visible){K=z.transparent;h(I);for(z=0;z<K.count;z++){G=K.list[z];V(G.blending);j(G.depthTest);Q=c(D,Z,Y,G,I);I.render(function(ra){g(ra,Q,G.shading)})}}}n.__webglSprites.length&&A(n,D);stencil&&n.__webglShadowVolumes.length&&
-n.lights.length&&u(n);n.__webglLensFlares.length&&F(n,D);if(x&&x.minFilter!==THREE.NearestFilter&&x.minFilter!==THREE.LinearFilter){e.bindTexture(e.TEXTURE_2D,x.__webglTexture);e.generateMipmap(e.TEXTURE_2D);e.bindTexture(e.TEXTURE_2D,null)}};this.initWebGLObjects=function(n){if(!n.__webglObjects){n.__webglObjects=[];n.__webglObjectsImmediate=[];n.__webglShadowVolumes=[];n.__webglLensFlares=[];n.__webglSprites=[]}for(;n.__objectsAdded.length;){var D=n.__objectsAdded[0],x=n,v=void 0,z=void 0,Q=void 0;
-if(D._modelViewMatrix==undefined){D._modelViewMatrix=new THREE.Matrix4;D._normalMatrixArray=new Float32Array(9);D._modelViewMatrixArray=new Float32Array(16);D._objectMatrixArray=new Float32Array(16);D.matrixWorld.flattenToArray(D._objectMatrixArray)}if(D instanceof THREE.Mesh){z=D.geometry;z.geometryGroups==undefined&&U(z);for(v in z.geometryGroups){Q=z.geometryGroups[v];if(!Q.__webglVertexBuffer){var K=Q;K.__webglVertexBuffer=e.createBuffer();K.__webglNormalBuffer=e.createBuffer();K.__webglTangentBuffer=
-e.createBuffer();K.__webglColorBuffer=e.createBuffer();K.__webglUVBuffer=e.createBuffer();K.__webglUV2Buffer=e.createBuffer();K.__webglSkinVertexABuffer=e.createBuffer();K.__webglSkinVertexBBuffer=e.createBuffer();K.__webglSkinIndicesBuffer=e.createBuffer();K.__webglSkinWeightsBuffer=e.createBuffer();K.__webglFaceBuffer=e.createBuffer();K.__webglLineBuffer=e.createBuffer();if(K.numMorphTargets){var G=void 0,T=void 0;K.__webglMorphTargetsBuffers=[];G=0;for(T=K.numMorphTargets;G<T;G++)K.__webglMorphTargetsBuffers.push(e.createBuffer())}K=
-Q;G=D;var H=void 0,I=void 0,L=void 0;L=void 0;var Z=void 0,Y=void 0,ra=void 0,Ka=ra=T=0;I=void 0;L=void 0;var Ca=void 0;H=void 0;I=void 0;Z=G.geometry;Ca=Z.faces;Y=K.faces;H=0;for(I=Y.length;H<I;H++){L=Y[H];L=Ca[L];if(L instanceof THREE.Face3){T+=3;ra+=1;Ka+=3}else if(L instanceof THREE.Face4){T+=4;ra+=2;Ka+=4}}H=K;I=G;Ca=void 0;Y=void 0;var Ha=void 0,Ga=void 0;Ha=void 0;L=[];Ca=0;for(Y=I.materials.length;Ca<Y;Ca++){Ha=I.materials[Ca];if(Ha instanceof THREE.MeshFaceMaterial){Ha=0;for(l=H.materials.length;Ha<
-l;Ha++)(Ga=H.materials[Ha])&&L.push(Ga)}else(Ga=Ha)&&L.push(Ga)}H=L;a:{I=void 0;Ca=void 0;Y=H.length;for(I=0;I<Y;I++){Ca=H[I];if(Ca.map||Ca.lightMap||Ca instanceof THREE.MeshShaderMaterial){I=!0;break a}}I=!1}a:{Ca=H;Y=void 0;L=void 0;Ha=Ca.length;for(Y=0;Y<Ha;Y++){L=Ca[Y];if(!(L instanceof THREE.MeshBasicMaterial&&!L.envMap||L instanceof THREE.MeshDepthMaterial)){Ca=L&&L.shading!=undefined&&L.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}}Ca=!1}a:{Y=void 0;L=void 0;Ha=
-H.length;for(Y=0;Y<Ha;Y++){L=H[Y];if(L.vertexColors){L=L.vertexColors;break a}}L=!1}K.__vertexArray=new Float32Array(T*3);if(Ca)K.__normalArray=new Float32Array(T*3);if(Z.hasTangents)K.__tangentArray=new Float32Array(T*4);if(L)K.__colorArray=new Float32Array(T*3);if(I){if(Z.faceUvs.length>0||Z.faceVertexUvs.length>0)K.__uvArray=new Float32Array(T*2);if(Z.faceUvs.length>1||Z.faceVertexUvs.length>1)K.__uv2Array=new Float32Array(T*2)}if(G.geometry.skinWeights.length&&G.geometry.skinIndices.length){K.__skinVertexAArray=
-new Float32Array(T*4);K.__skinVertexBArray=new Float32Array(T*4);K.__skinIndexArray=new Float32Array(T*4);K.__skinWeightArray=new Float32Array(T*4)}K.__faceArray=new Uint16Array(ra*3+(G.geometry.edgeFaces?G.geometry.edgeFaces.length*6:0));K.__lineArray=new Uint16Array(Ka*2);if(K.numMorphTargets){K.__morphTargetsArrays=[];Z=0;for(Y=K.numMorphTargets;Z<Y;Z++)K.__morphTargetsArrays.push(new Float32Array(T*3))}K.__needsSmoothNormals=Ca==THREE.SmoothShading;K.__uvType=I;K.__vertexColorType=L;K.__normalType=
-Ca;K.__webglFaceCount=ra*3+(G.geometry.edgeFaces?G.geometry.edgeFaces.length*6:0);K.__webglLineCount=Ka*2;Z=0;for(Y=H.length;Z<Y;Z++)if(H[Z].attributes){K.__webglCustomAttributes={};for(a in H[Z].attributes){I=H[Z].attributes[a];if(!I.__webglInitialized||I.createUniqueBuffers){I.__webglInitialized=!0;ra=1;if(I.type==="v2")ra=2;else if(I.type==="v3")ra=3;else if(I.type==="v4")ra=4;else I.type==="c"&&(ra=3);I.size=ra;I.needsUpdate=!0;I.array=new Float32Array(T*ra);I.buffer=e.createBuffer();I.buffer.belongsToAttribute=
-a}K.__webglCustomAttributes[a]=I}}z.__dirtyVertices=!0;z.__dirtyMorphTargets=!0;z.__dirtyElements=!0;z.__dirtyUvs=!0;z.__dirtyNormals=!0;z.__dirtyTangents=!0;z.__dirtyColors=!0}D instanceof THREE.ShadowVolume?C(x.__webglShadowVolumes,Q,D):C(x.__webglObjects,Q,D)}}else if(D instanceof THREE.LensFlare)C(x.__webglLensFlares,undefined,D);else if(D instanceof THREE.Ribbon){z=D.geometry;if(!z.__webglVertexBuffer){v=z;v.__webglVertexBuffer=e.createBuffer();v.__webglColorBuffer=e.createBuffer();v=z;Q=v.vertices.length;
-v.__vertexArray=new Float32Array(Q*3);v.__colorArray=new Float32Array(Q*3);v.__webglVertexCount=Q;z.__dirtyVertices=!0;z.__dirtyColors=!0}C(x.__webglObjects,z,D)}else if(D instanceof THREE.Line){z=D.geometry;if(!z.__webglVertexBuffer){v=z;v.__webglVertexBuffer=e.createBuffer();v.__webglColorBuffer=e.createBuffer();v=z;Q=v.vertices.length;v.__vertexArray=new Float32Array(Q*3);v.__colorArray=new Float32Array(Q*3);v.__webglLineCount=Q;z.__dirtyVertices=!0;z.__dirtyColors=!0}C(x.__webglObjects,z,D)}else if(D instanceof
-THREE.ParticleSystem){z=D.geometry;if(!z.__webglVertexBuffer){v=z;v.__webglVertexBuffer=e.createBuffer();v.__webglColorBuffer=e.createBuffer();v=z;Q=v.vertices.length;v.__vertexArray=new Float32Array(Q*3);v.__colorArray=new Float32Array(Q*3);v.__sortArray=[];v.__webglParticleCount=Q;z.__dirtyVertices=!0;z.__dirtyColors=!0}C(x.__webglObjects,z,D)}else if(THREE.MarchingCubes!==undefined&&D instanceof THREE.MarchingCubes)x.__webglObjectsImmediate.push({object:D,opaque:{list:[],count:0},transparent:{list:[],
-count:0}});else D instanceof THREE.Sprite&&x.__webglSprites.push(D);n.__objectsAdded.splice(0,1)}for(;n.__objectsRemoved.length;){D=n.__objectsRemoved[0];x=n;z=void 0;v=void 0;if(D instanceof THREE.Mesh)for(z=x.__webglObjects.length-1;z>=0;z--){v=x.__webglObjects[z].object;if(D==v){x.__webglObjects.splice(z,1);break}}else if(D instanceof THREE.Sprite)for(z=x.__webglSprites.length-1;z>=0;z--){v=x.__webglSprites[z];if(D==v){x.__webglSprites.splice(z,1);break}}n.__objectsRemoved.splice(0,1)}D=0;for(x=
-n.__webglObjects.length;D<x;D++)B(n.__webglObjects[D].object,n);D=0;for(x=n.__webglShadowVolumes.length;D<x;D++)B(n.__webglShadowVolumes[D].object,n);D=0;for(x=n.__webglLensFlares.length;D<x;D++)B(n.__webglLensFlares[D].object,n)};this.setFaceCulling=function(n,D){if(n){!D||D=="ccw"?e.frontFace(e.CCW):e.frontFace(e.CW);if(n=="back")e.cullFace(e.BACK);else n=="front"?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK);e.enable(e.CULL_FACE)}else e.disable(e.CULL_FACE)};this.supportsVertexTextures=function(){return e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>
-0}};
-THREE.WebGLRenderTarget=function(b,d,c){this.width=b;this.height=d;c=c||{};this.wrapS=c.wrapS!==undefined?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=c.wrapT!==undefined?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=c.magFilter!==undefined?c.magFilter:THREE.LinearFilter;this.minFilter=c.minFilter!==undefined?c.minFilter:THREE.LinearMipMapLinearFilter;this.format=c.format!==undefined?c.format:THREE.RGBAFormat;this.type=c.type!==undefined?c.type:THREE.UnsignedByteType;this.depthBuffer=c.depthBuffer!==undefined?
-c.depthBuffer:!0;this.stencilBuffer=c.stencilBuffer!==undefined?c.stencilBuffer:!0};
+0){e.enableVertexAttribArray(L.morphTarget6);n.numSupportedMorphTargets++}if(L.morphTarget7>=0){e.enableVertexAttribArray(L.morphTarget7);n.numSupportedMorphTargets++}v.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);n=0;for(z=this.maxMorphTargets;n<z;n++)v.__webglMorphTargetInfluences[n]=0}};this.render=function(n,D,x,v){var z,Q,K,G,T,H,I,L,Z=n.lights,Y=n.fog;ea.data.vertices=0;ea.data.faces=0;ea.data.drawCalls=0;D.matrixAutoUpdate&&D.update(undefined,!0);n.update(undefined,!1,
+D);D.matrixWorldInverse.flattenToArray(Za);D.projectionMatrix.flattenToArray(Xa);Ja.multiply(D.projectionMatrix,D.matrixWorldInverse);k(Ja);this.initWebGLObjects(n);va(x);(this.autoClear||v)&&this.clear();T=n.__webglObjects.length;for(v=0;v<T;v++){z=n.__webglObjects[v];I=z.object;if(I.visible)if(!(I instanceof THREE.Mesh)||m(I)){I.matrixWorld.flattenToArray(I._objectMatrixArray);J(I,D);t(z);z.render=!0;if(this.sortObjects){Ta.copy(I.position);Ja.multiplyVector3(Ta);z.z=Ta.z}}else z.render=!1;else z.render=
+!1}this.sortObjects&&n.__webglObjects.sort(y);H=n.__webglObjectsImmediate.length;for(v=0;v<H;v++){z=n.__webglObjectsImmediate[v];I=z.object;if(I.visible){I.matrixAutoUpdate&&I.matrixWorld.flattenToArray(I._objectMatrixArray);J(I,D);p(z)}}V(THREE.NormalBlending);for(v=0;v<T;v++){z=n.__webglObjects[v];if(z.render){I=z.object;L=z.buffer;K=z.opaque;h(I);for(z=0;z<K.count;z++){G=K.list[z];j(G.depthTest);f(D,Z,Y,G,L,I)}}}for(v=0;v<H;v++){z=n.__webglObjectsImmediate[v];I=z.object;if(I.visible){K=z.opaque;
+h(I);for(z=0;z<K.count;z++){G=K.list[z];j(G.depthTest);Q=c(D,Z,Y,G,I);I.render(function(ra){g(ra,Q,G.shading)})}}}for(v=0;v<T;v++){z=n.__webglObjects[v];if(z.render){I=z.object;L=z.buffer;K=z.transparent;h(I);for(z=0;z<K.count;z++){G=K.list[z];V(G.blending);j(G.depthTest);f(D,Z,Y,G,L,I)}}}for(v=0;v<H;v++){z=n.__webglObjectsImmediate[v];I=z.object;if(I.visible){K=z.transparent;h(I);for(z=0;z<K.count;z++){G=K.list[z];V(G.blending);j(G.depthTest);Q=c(D,Z,Y,G,I);I.render(function(ra){g(ra,Q,G.shading)})}}}n.__webglSprites.length&&
+A(n,D);stencil&&n.__webglShadowVolumes.length&&n.lights.length&&u(n);n.__webglLensFlares.length&&F(n,D);if(x&&x.minFilter!==THREE.NearestFilter&&x.minFilter!==THREE.LinearFilter){e.bindTexture(e.TEXTURE_2D,x.__webglTexture);e.generateMipmap(e.TEXTURE_2D);e.bindTexture(e.TEXTURE_2D,null)}};this.initWebGLObjects=function(n){if(!n.__webglObjects){n.__webglObjects=[];n.__webglObjectsImmediate=[];n.__webglShadowVolumes=[];n.__webglLensFlares=[];n.__webglSprites=[]}for(;n.__objectsAdded.length;){var D=
+n.__objectsAdded[0],x=n,v=void 0,z=void 0,Q=void 0;if(D._modelViewMatrix==undefined){D._modelViewMatrix=new THREE.Matrix4;D._normalMatrixArray=new Float32Array(9);D._modelViewMatrixArray=new Float32Array(16);D._objectMatrixArray=new Float32Array(16);D.matrixWorld.flattenToArray(D._objectMatrixArray)}if(D instanceof THREE.Mesh){z=D.geometry;z.geometryGroups==undefined&&U(z);for(v in z.geometryGroups){Q=z.geometryGroups[v];if(!Q.__webglVertexBuffer){var K=Q;K.__webglVertexBuffer=e.createBuffer();K.__webglNormalBuffer=
+e.createBuffer();K.__webglTangentBuffer=e.createBuffer();K.__webglColorBuffer=e.createBuffer();K.__webglUVBuffer=e.createBuffer();K.__webglUV2Buffer=e.createBuffer();K.__webglSkinVertexABuffer=e.createBuffer();K.__webglSkinVertexBBuffer=e.createBuffer();K.__webglSkinIndicesBuffer=e.createBuffer();K.__webglSkinWeightsBuffer=e.createBuffer();K.__webglFaceBuffer=e.createBuffer();K.__webglLineBuffer=e.createBuffer();if(K.numMorphTargets){var G=void 0,T=void 0;K.__webglMorphTargetsBuffers=[];G=0;for(T=
+K.numMorphTargets;G<T;G++)K.__webglMorphTargetsBuffers.push(e.createBuffer())}K=Q;G=D;var H=void 0,I=void 0,L=void 0;L=void 0;var Z=void 0,Y=void 0,ra=void 0,Ka=ra=T=0;I=void 0;L=void 0;var Ca=void 0;H=void 0;I=void 0;Z=G.geometry;Ca=Z.faces;Y=K.faces;H=0;for(I=Y.length;H<I;H++){L=Y[H];L=Ca[L];if(L instanceof THREE.Face3){T+=3;ra+=1;Ka+=3}else if(L instanceof THREE.Face4){T+=4;ra+=2;Ka+=4}}H=K;I=G;Ca=void 0;Y=void 0;var Ha=void 0,Ga=void 0;Ha=void 0;L=[];Ca=0;for(Y=I.materials.length;Ca<Y;Ca++){Ha=
+I.materials[Ca];if(Ha instanceof THREE.MeshFaceMaterial){Ha=0;for(l=H.materials.length;Ha<l;Ha++)(Ga=H.materials[Ha])&&L.push(Ga)}else(Ga=Ha)&&L.push(Ga)}H=L;a:{I=void 0;Ca=void 0;Y=H.length;for(I=0;I<Y;I++){Ca=H[I];if(Ca.map||Ca.lightMap||Ca instanceof THREE.MeshShaderMaterial){I=!0;break a}}I=!1}a:{Ca=H;Y=void 0;L=void 0;Ha=Ca.length;for(Y=0;Y<Ha;Y++){L=Ca[Y];if(!(L instanceof THREE.MeshBasicMaterial&&!L.envMap||L instanceof THREE.MeshDepthMaterial)){Ca=L&&L.shading!=undefined&&L.shading==THREE.SmoothShading?
+THREE.SmoothShading:THREE.FlatShading;break a}}Ca=!1}a:{Y=void 0;L=void 0;Ha=H.length;for(Y=0;Y<Ha;Y++){L=H[Y];if(L.vertexColors){L=L.vertexColors;break a}}L=!1}K.__vertexArray=new Float32Array(T*3);if(Ca)K.__normalArray=new Float32Array(T*3);if(Z.hasTangents)K.__tangentArray=new Float32Array(T*4);if(L)K.__colorArray=new Float32Array(T*3);if(I){if(Z.faceUvs.length>0||Z.faceVertexUvs.length>0)K.__uvArray=new Float32Array(T*2);if(Z.faceUvs.length>1||Z.faceVertexUvs.length>1)K.__uv2Array=new Float32Array(T*
+2)}if(G.geometry.skinWeights.length&&G.geometry.skinIndices.length){K.__skinVertexAArray=new Float32Array(T*4);K.__skinVertexBArray=new Float32Array(T*4);K.__skinIndexArray=new Float32Array(T*4);K.__skinWeightArray=new Float32Array(T*4)}K.__faceArray=new Uint16Array(ra*3+(G.geometry.edgeFaces?G.geometry.edgeFaces.length*6:0));K.__lineArray=new Uint16Array(Ka*2);if(K.numMorphTargets){K.__morphTargetsArrays=[];Z=0;for(Y=K.numMorphTargets;Z<Y;Z++)K.__morphTargetsArrays.push(new Float32Array(T*3))}K.__needsSmoothNormals=
+Ca==THREE.SmoothShading;K.__uvType=I;K.__vertexColorType=L;K.__normalType=Ca;K.__webglFaceCount=ra*3+(G.geometry.edgeFaces?G.geometry.edgeFaces.length*6:0);K.__webglLineCount=Ka*2;Z=0;for(Y=H.length;Z<Y;Z++)if(H[Z].attributes){K.__webglCustomAttributes={};for(a in H[Z].attributes){I=H[Z].attributes[a];if(!I.__webglInitialized||I.createUniqueBuffers){I.__webglInitialized=!0;ra=1;if(I.type==="v2")ra=2;else if(I.type==="v3")ra=3;else if(I.type==="v4")ra=4;else I.type==="c"&&(ra=3);I.size=ra;I.needsUpdate=
+!0;I.array=new Float32Array(T*ra);I.buffer=e.createBuffer();I.buffer.belongsToAttribute=a}K.__webglCustomAttributes[a]=I}}z.__dirtyVertices=!0;z.__dirtyMorphTargets=!0;z.__dirtyElements=!0;z.__dirtyUvs=!0;z.__dirtyNormals=!0;z.__dirtyTangents=!0;z.__dirtyColors=!0}D instanceof THREE.ShadowVolume?C(x.__webglShadowVolumes,Q,D):C(x.__webglObjects,Q,D)}}else if(D instanceof THREE.LensFlare)C(x.__webglLensFlares,undefined,D);else if(D instanceof THREE.Ribbon){z=D.geometry;if(!z.__webglVertexBuffer){v=
+z;v.__webglVertexBuffer=e.createBuffer();v.__webglColorBuffer=e.createBuffer();v=z;Q=v.vertices.length;v.__vertexArray=new Float32Array(Q*3);v.__colorArray=new Float32Array(Q*3);v.__webglVertexCount=Q;z.__dirtyVertices=!0;z.__dirtyColors=!0}C(x.__webglObjects,z,D)}else if(D instanceof THREE.Line){z=D.geometry;if(!z.__webglVertexBuffer){v=z;v.__webglVertexBuffer=e.createBuffer();v.__webglColorBuffer=e.createBuffer();v=z;Q=v.vertices.length;v.__vertexArray=new Float32Array(Q*3);v.__colorArray=new Float32Array(Q*
+3);v.__webglLineCount=Q;z.__dirtyVertices=!0;z.__dirtyColors=!0}C(x.__webglObjects,z,D)}else if(D instanceof THREE.ParticleSystem){z=D.geometry;if(!z.__webglVertexBuffer){v=z;v.__webglVertexBuffer=e.createBuffer();v.__webglColorBuffer=e.createBuffer();v=z;Q=v.vertices.length;v.__vertexArray=new Float32Array(Q*3);v.__colorArray=new Float32Array(Q*3);v.__sortArray=[];v.__webglParticleCount=Q;z.__dirtyVertices=!0;z.__dirtyColors=!0}C(x.__webglObjects,z,D)}else if(THREE.MarchingCubes!==undefined&&D instanceof
+THREE.MarchingCubes)x.__webglObjectsImmediate.push({object:D,opaque:{list:[],count:0},transparent:{list:[],count:0}});else D instanceof THREE.Sprite&&x.__webglSprites.push(D);n.__objectsAdded.splice(0,1)}for(;n.__objectsRemoved.length;){D=n.__objectsRemoved[0];x=n;z=void 0;v=void 0;if(D instanceof THREE.Mesh)for(z=x.__webglObjects.length-1;z>=0;z--){v=x.__webglObjects[z].object;if(D==v){x.__webglObjects.splice(z,1);break}}else if(D instanceof THREE.Sprite)for(z=x.__webglSprites.length-1;z>=0;z--){v=
+x.__webglSprites[z];if(D==v){x.__webglSprites.splice(z,1);break}}n.__objectsRemoved.splice(0,1)}D=0;for(x=n.__webglObjects.length;D<x;D++)B(n.__webglObjects[D].object,n);D=0;for(x=n.__webglShadowVolumes.length;D<x;D++)B(n.__webglShadowVolumes[D].object,n);D=0;for(x=n.__webglLensFlares.length;D<x;D++)B(n.__webglLensFlares[D].object,n)};this.setFaceCulling=function(n,D){if(n){!D||D=="ccw"?e.frontFace(e.CCW):e.frontFace(e.CW);if(n=="back")e.cullFace(e.BACK);else n=="front"?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK);
+e.enable(e.CULL_FACE)}else e.disable(e.CULL_FACE)};this.supportsVertexTextures=function(){return e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};
+THREE.WebGLRenderTarget=function(b,d,c){this.width=b;this.height=d;c=c||{};this.wrapS=c.wrapS!==undefined?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=c.wrapT!==undefined?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=c.magFilter!==undefined?c.magFilter:THREE.LinearFilter;this.minFilter=c.minFilter!==undefined?c.minFilter:THREE.LinearMipMapLinearFilter;this.format=c.format!==undefined?c.format:THREE.RGBAFormat;this.type=c.type!==undefined?c.type:THREE.UnsignedByteType;this.depthBuffer=c.depthBuffer!==
+undefined?c.depthBuffer:!0;this.stencilBuffer=c.stencilBuffer!==undefined?c.stencilBuffer:!0};
 THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(b,d,c){c&&b.update(undefined,!1,d);c=b.sounds;var f,g=c.length;for(f=0;f<g;f++){b=c[f];this.soundPosition.set(b.matrixWorld.n14,b.matrixWorld.n24,b.matrixWorld.n34);this.soundPosition.subSelf(d.position);if(b.isPlaying&&b.isLoaded){b.isAddedToDOM||b.addToDOM(this.domElement);b.calculateVolumeAndPan(this.soundPosition)}}}};
 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};
@@ -375,7 +375,7 @@ value:0,texture:null},uImageIncrement:{type:"v2",value:new THREE.Vector2(0.00195
 film:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},time:{type:"f",value:0},nIntensity:{type:"f",value:0.5},sIntensity:{type:"f",value:0.05},sCount:{type:"f",value:4096},grayscale:{type:"i",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float time;\nuniform bool grayscale;\nuniform float nIntensity;\nuniform float sIntensity;\nuniform float sCount;\nvoid main() {\nvec4 cTextureScreen = texture2D( tDiffuse, vUv );\nfloat x = vUv.x * vUv.y * time *  1000.0;\nx = mod( x, 13.0 ) * mod( x, 123.0 );\nfloat dx = mod( x, 0.01 );\nvec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx * 100.0, 0.0, 1.0 );\nvec2 sc = vec2( sin( vUv.y * sCount ), cos( vUv.y * sCount ) );\ncResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * sIntensity;\ncResult = cTextureScreen.rgb + clamp( nIntensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );\nif( grayscale ) {\ncResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );\n}\ngl_FragColor =  vec4( cResult, cTextureScreen.a );\n}"},
 screen:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},opacity:{type:"f",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float opacity;\nvoid main() {\nvec4 texel = texture2D( tDiffuse, vUv );\ngl_FragColor = opacity * texel;\n}"},basic:{uniforms:{},vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",
 fragmentShader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(b){var d,c,f,g,h=2*Math.ceil(b*3)+1;h>25&&(h=25);g=(h-1)*0.5;c=Array(h);for(d=f=0;d<h;++d){c[d]=Math.exp(-((d-g)*(d-g))/(2*b*b));f+=c[d]}for(d=0;d<h;++d)c[d]/=f;return c}};
-THREE.QuakeCamera=function(b){function d(c,f){return function(){f.apply(c,arguments)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=3.14;this.domElement=document;this.lastUpdate=(new Date).getTime();this.tdiff=0;if(b){if(b.movementSpeed!==undefined)this.movementSpeed=
+THREE.QuakeCamera=function(b){function d(c,f){return function(){f.apply(c,arguments)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.movementSpeed=1;this.lookSpeed=0.005;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=3.14;this.domElement=document;this.lastUpdate=(new Date).getTime();this.tdiff=0;if(b){if(b.movementSpeed!==undefined)this.movementSpeed=
 b.movementSpeed;if(b.lookSpeed!==undefined)this.lookSpeed=b.lookSpeed;if(b.noFly!==undefined)this.noFly=b.noFly;if(b.lookVertical!==undefined)this.lookVertical=b.lookVertical;if(b.autoForward!==undefined)this.autoForward=b.autoForward;if(b.activeLook!==undefined)this.activeLook=b.activeLook;if(b.heightSpeed!==undefined)this.heightSpeed=b.heightSpeed;if(b.heightCoef!==undefined)this.heightCoef=b.heightCoef;if(b.heightMin!==undefined)this.heightMin=b.heightMin;if(b.heightMax!==undefined)this.heightMax=
 b.heightMax;if(b.constrainVertical!==undefined)this.constrainVertical=b.constrainVertical;if(b.verticalMin!==undefined)this.verticalMin=b.verticalMin;if(b.verticalMax!==undefined)this.verticalMax=b.verticalMax;if(b.domElement!==undefined)this.domElement=b.domElement}this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor=0;this.moveForward=!1;this.moveBackward=!1;this.moveLeft=!1;this.moveRight=!1;this.freeze=!1;this.mouseDragOn=!1;this.windowHalfX=window.innerWidth/2;this.windowHalfY=
 window.innerHeight/2;this.onMouseDown=function(c){c.preventDefault();c.stopPropagation();if(this.activeLook)switch(c.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(c){c.preventDefault();c.stopPropagation();if(this.activeLook)switch(c.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(c){this.mouseX=c.clientX-this.windowHalfX;this.mouseY=c.clientY-this.windowHalfY};this.onKeyDown=
@@ -387,14 +387,14 @@ this.onMouseMove),!1);this.domElement.addEventListener("mousedown",d(this,this.o
 THREE.QuakeCamera.prototype.translate=function(b,d){this.matrix.rotateAxis(d);if(this.noFly)d.y=0;this.position.addSelf(d.multiplyScalar(b));this.target.position.addSelf(d.multiplyScalar(b))};
 THREE.PathCamera=function(b){function d(o,p,t,y){var u={name:t,fps:0.6,length:y,hierarchy:[]},A,F=p.getControlPointsArray(),J=p.getLength(),B=F.length,U=0;A=B-1;p={parent:-1,keys:[]};p.keys[0]={time:0,pos:F[0],rot:[0,0,0,1],scl:[1,1,1]};p.keys[A]={time:y,pos:F[A],rot:[0,0,0,1],scl:[1,1,1]};for(A=1;A<B-1;A++){U=y*J.chunks[A]/J.total;p.keys[A]={time:U,pos:F[A]}}u.hierarchy[0]=p;THREE.AnimationHandler.add(u);return new THREE.Animation(o,t,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function c(o,p){var t,
 y,u=new THREE.Geometry;for(t=0;t<o.points.length*p;t++){y=t/(o.points.length*p);y=o.getPoint(y);u.vertices[t]=new THREE.Vertex(new THREE.Vector3(y.x,y.y,y.z))}return u}function f(o,p){var t=c(p,10),y=c(p,10),u=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(t,u);particleObj=new THREE.ParticleSystem(y,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);o.addChild(lineObj);particleObj.scale.set(1,1,1);o.addChild(particleObj);y=new THREE.Sphere(1,
-16,8);u=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<p.points.length;i++){t=new THREE.Mesh(y,u);t.position.copy(p.points[i]);t.updateMatrix();o.addChild(t)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.id="PathCamera"+THREE.PathCameraIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookVertical=
+16,8);u=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<p.points.length;i++){t=new THREE.Mesh(y,u);t.position.copy(p.points[i]);t.updateMatrix();o.addChild(t)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.id="PathCamera"+THREE.PathCameraIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.005;this.lookVertical=
 !0;this.lookHorizontal=!0;this.verticalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.horizontalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.domElement=document;if(b){if(b.duration!==undefined)this.duration=b.duration*1E3;if(b.waypoints!==undefined)this.waypoints=b.waypoints;if(b.useConstantSpeed!==undefined)this.useConstantSpeed=b.useConstantSpeed;if(b.resamplingCoef!==undefined)this.resamplingCoef=b.resamplingCoef;if(b.createDebugPath!==undefined)this.createDebugPath=b.createDebugPath;
 if(b.createDebugDummy!==undefined)this.createDebugDummy=b.createDebugDummy;if(b.lookSpeed!==undefined)this.lookSpeed=b.lookSpeed;if(b.lookVertical!==undefined)this.lookVertical=b.lookVertical;if(b.lookHorizontal!==undefined)this.lookHorizontal=b.lookHorizontal;if(b.verticalAngleMap!==undefined)this.verticalAngleMap=b.verticalAngleMap;if(b.horizontalAngleMap!==undefined)this.horizontalAngleMap=b.horizontalAngleMap;if(b.domElement!==undefined)this.domElement=b.domElement}this.theta=this.phi=this.lon=
 this.lat=this.mouseY=this.mouseX=0;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;var g=Math.PI*2,h=Math.PI/180;this.update=function(o,p,t){var y,u;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*h;this.theta=this.lon*h;y=this.phi%g;this.phi=y>=0?y:y+g;y=this.verticalAngleMap.srcRange;u=this.verticalAngleMap.dstRange;
 this.phi=(this.phi-y[0])*(u[1]-u[0])/(y[1]-y[0])+u[0];y=this.horizontalAngleMap.srcRange;u=this.horizontalAngleMap.dstRange;this.theta=(this.theta-y[0])*(u[1]-u[0])/(y[1]-y[0])+u[0];y=this.target.position;y.x=100*Math.sin(this.phi)*Math.cos(this.theta);y.y=100*Math.cos(this.phi);y.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,o,p,t)};this.onMouseMove=function(o){this.mouseX=o.clientX-this.windowHalfX;this.mouseY=o.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);
 this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){b=new THREE.MeshLambertMaterial({color:30719});var j=new THREE.MeshLambertMaterial({color:65280}),k=new THREE.Cube(10,10,20),m=new THREE.Cube(2,2,10);this.animationParent=new THREE.Mesh(k,b);b=new THREE.Mesh(m,j);b.position.set(0,10,0);this.animation=d(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this);this.animationParent.addChild(this.target);this.animationParent.addChild(b)}else{this.animation=
 d(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this.target);this.animationParent.addChild(this)}this.createDebugPath&&f(this.debugPath,this.spline);this.domElement.addEventListener("mousemove",function(o,p){return function(){p.apply(o,arguments)}}(this,this.onMouseMove),!1)};THREE.PathCamera.prototype=new THREE.Camera;THREE.PathCamera.prototype.constructor=THREE.PathCamera;THREE.PathCamera.prototype.supr=THREE.Camera.prototype;THREE.PathCameraIdCounter=0;
-THREE.FlyCamera=function(b){function d(c,f){return function(){f.apply(c,arguments)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.tmpQuaternion=new THREE.Quaternion;this.movementSpeed=1;this.rollSpeed=0.0050;this.dragToLook=!1;this.autoForward=!1;this.domElement=document;if(b){if(b.movementSpeed!==undefined)this.movementSpeed=b.movementSpeed;if(b.rollSpeed!==undefined)this.rollSpeed=b.rollSpeed;if(b.dragToLook!==undefined)this.dragToLook=b.dragToLook;if(b.autoForward!==undefined)this.autoForward=
+THREE.FlyCamera=function(b){function d(c,f){return function(){f.apply(c,arguments)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.tmpQuaternion=new THREE.Quaternion;this.movementSpeed=1;this.rollSpeed=0.005;this.dragToLook=!1;this.autoForward=!1;this.domElement=document;if(b){if(b.movementSpeed!==undefined)this.movementSpeed=b.movementSpeed;if(b.rollSpeed!==undefined)this.rollSpeed=b.rollSpeed;if(b.dragToLook!==undefined)this.dragToLook=b.dragToLook;if(b.autoForward!==undefined)this.autoForward=
 b.autoForward;if(b.domElement!==undefined)this.domElement=b.domElement}this.useTarget=!1;this.useQuaternion=!0;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0,0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.lastUpdate=-1;this.tdiff=0;this.handleEvent=function(c){if(typeof this[c.type]=="function")this[c.type](c)};this.keydown=function(c){if(!c.altKey){switch(c.keyCode){case 16:this.movementSpeedMultiplier=
 0.1;break;case 87:this.moveState.forward=1;break;case 83:this.moveState.back=1;break;case 65:this.moveState.left=1;break;case 68:this.moveState.right=1;break;case 82:this.moveState.up=1;break;case 70:this.moveState.down=1;break;case 38:this.moveState.pitchUp=1;break;case 40:this.moveState.pitchDown=1;break;case 37:this.moveState.yawLeft=1;break;case 39:this.moveState.yawRight=1;break;case 81:this.moveState.rollLeft=1;break;case 69:this.moveState.rollRight=1}this.updateMovementVector();this.updateRotationVector()}};
 this.keyup=function(c){switch(c.keyCode){case 16:this.movementSpeedMultiplier=1;break;case 87:this.moveState.forward=0;break;case 83:this.moveState.back=0;break;case 65:this.moveState.left=0;break;case 68:this.moveState.right=0;break;case 82:this.moveState.up=0;break;case 70:this.moveState.down=0;break;case 38:this.moveState.pitchUp=0;break;case 40:this.moveState.pitchDown=0;break;case 37:this.moveState.yawLeft=0;break;case 39:this.moveState.yawRight=0;break;case 81:this.moveState.rollLeft=0;break;
@@ -412,8 +412,8 @@ this.matrix.n23*B;this.position.z-=this.matrix.n33*B};this.rotateHorizontally=fu
 function(B){u=(B.clientX-F)/window.innerWidth;A=(B.clientY-J)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(B){B.preventDefault();B.stopPropagation();switch(B.button){case 0:p=1;break;case 2:p=-1}},!1);this.domElement.addEventListener("mouseup",function(B){B.preventDefault();B.stopPropagation();switch(B.button){case 0:p=0;break;case 2:p=0}},!1);this.domElement.addEventListener("keydown",function(B){switch(B.keyCode){case 38:case 87:p=1;break;case 37:case 65:t=-1;break;
 case 40:case 83:p=-1;break;case 39:case 68:t=1;break;case 81:m=!0;o=1;break;case 69:m=!0;o=-1;break;case 82:y=1;break;case 70:y=-1}},!1);this.domElement.addEventListener("keyup",function(B){switch(B.keyCode){case 38:case 87:p=0;break;case 37:case 65:t=0;break;case 40:case 83:p=0;break;case 39:case 68:t=0;break;case 81:m=!1;break;case 69:m=!1;break;case 82:y=0;break;case 70:y=0}},!1)};THREE.RollCamera.prototype=new THREE.Camera;THREE.RollCamera.prototype.constructor=THREE.RollCamera;
 THREE.RollCamera.prototype.supr=THREE.Camera.prototype;
-THREE.Cube=function(b,d,c,f,g,h,j,k,m){function o(J,B,U,C,V,O,M,va){var la,qa,fa=f||1,ia=g||1,e=V/2,oa=O/2,Da=p.vertices.length;if(J=="x"&&B=="y"||J=="y"&&B=="x")la="z";else if(J=="x"&&B=="z"||J=="z"&&B=="x"){la="y";ia=h||1}else if(J=="z"&&B=="y"||J=="y"&&B=="z"){la="x";fa=h||1}var Aa=fa+1,da=ia+1;V/=fa;var ea=O/ia;for(qa=0;qa<da;qa++)for(O=0;O<Aa;O++){var wa=new THREE.Vector3;wa[J]=(O*V-e)*U;wa[B]=(qa*ea-oa)*C;wa[la]=M;p.vertices.push(new THREE.Vertex(wa))}for(qa=0;qa<ia;qa++)for(O=0;O<fa;O++){p.faces.push(new THREE.Face4(O+
-Aa*qa+Da,O+Aa*(qa+1)+Da,O+1+Aa*(qa+1)+Da,O+1+Aa*qa+Da,null,null,va));p.faceVertexUvs[0].push([new THREE.UV(O/fa,qa/ia),new THREE.UV(O/fa,(qa+1)/ia),new THREE.UV((O+1)/fa,(qa+1)/ia),new THREE.UV((O+1)/fa,qa/ia)])}}THREE.Geometry.call(this);var p=this,t=b/2,y=d/2,u=c/2;k=k?-1:1;if(j!==undefined)if(j instanceof Array)this.materials=j;else{this.materials=[];for(var A=0;A<6;A++)this.materials.push([j])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(m!=undefined)for(var F in m)this.sides[F]!=
+THREE.Cube=function(b,d,c,f,g,h,j,k,m){function o(J,B,U,C,V,O,M,va){var la,qa,ga=f||1,ea=g||1,e=V/2,oa=O/2,Da=p.vertices.length;if(J=="x"&&B=="y"||J=="y"&&B=="x")la="z";else if(J=="x"&&B=="z"||J=="z"&&B=="x"){la="y";ea=h||1}else if(J=="z"&&B=="y"||J=="y"&&B=="z"){la="x";ga=h||1}var Aa=ga+1,da=ea+1;V/=ga;var fa=O/ea;for(qa=0;qa<da;qa++)for(O=0;O<Aa;O++){var wa=new THREE.Vector3;wa[J]=(O*V-e)*U;wa[B]=(qa*fa-oa)*C;wa[la]=M;p.vertices.push(new THREE.Vertex(wa))}for(qa=0;qa<ea;qa++)for(O=0;O<ga;O++){p.faces.push(new THREE.Face4(O+
+Aa*qa+Da,O+Aa*(qa+1)+Da,O+1+Aa*(qa+1)+Da,O+1+Aa*qa+Da,null,null,va));p.faceVertexUvs[0].push([new THREE.UV(O/ga,qa/ea),new THREE.UV(O/ga,(qa+1)/ea),new THREE.UV((O+1)/ga,(qa+1)/ea),new THREE.UV((O+1)/ga,qa/ea)])}}THREE.Geometry.call(this);var p=this,t=b/2,y=d/2,u=c/2;k=k?-1:1;if(j!==undefined)if(j instanceof Array)this.materials=j;else{this.materials=[];for(var A=0;A<6;A++)this.materials.push([j])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(m!=undefined)for(var F in m)this.sides[F]!=
 undefined&&(this.sides[F]=m[F]);this.sides.px&&o("z","y",1*k,-1,c,d,-t,this.materials[0]);this.sides.nx&&o("z","y",-1*k,-1,c,d,t,this.materials[1]);this.sides.py&&o("x","z",1*k,1,b,c,y,this.materials[2]);this.sides.ny&&o("x","z",1*k,-1,b,c,-y,this.materials[3]);this.sides.pz&&o("x","y",1*k,-1,b,d,u,this.materials[4]);this.sides.nz&&o("x","y",-1*k,-1,b,d,-u,this.materials[5]);(function(){for(var J=[],B=[],U=0,C=p.vertices.length;U<C;U++){for(var V=p.vertices[U],O=!1,M=0,va=J.length;M<va;M++){var la=
 J[M];if(V.position.x==la.position.x&&V.position.y==la.position.y&&V.position.z==la.position.z){B[U]=M;O=!0;break}}if(!O){B[U]=J.length;J.push(new THREE.Vertex(V.position.clone()))}}U=0;for(C=p.faces.length;U<C;U++){V=p.faces[U];V.a=B[V.a];V.b=B[V.b];V.c=B[V.c];V.d=B[V.d]}p.vertices=J})();this.computeCentroids();this.computeFaceNormals()};THREE.Cube.prototype=new THREE.Geometry;THREE.Cube.prototype.constructor=THREE.Cube;
 THREE.Cylinder=function(b,d,c,f,g,h){function j(y,u,A){k.vertices.push(new THREE.Vertex(new THREE.Vector3(y,u,A)))}THREE.Geometry.call(this);var k=this,m,o=Math.PI*2,p=f/2;for(m=0;m<b;m++)j(Math.sin(o*m/b)*d,Math.cos(o*m/b)*d,-p);for(m=0;m<b;m++)j(Math.sin(o*m/b)*c,Math.cos(o*m/b)*c,p);for(m=0;m<b;m++)k.faces.push(new THREE.Face4(m,m+b,b+(m+1)%b,(m+1)%b));if(c>0){j(0,0,-p-(h||0));for(m=b;m<b+b/2;m++)k.faces.push(new THREE.Face4(2*b,(2*m-2*b)%b,(2*m-2*b+1)%b,(2*m-2*b+2)%b))}if(d>0){j(0,0,p+(g||0));
@@ -422,7 +422,7 @@ f));c instanceof THREE.Face4&&d.push(new THREE.UV(0.5+Math.atan2(t.position.x,t.
 THREE.Icosahedron=function(b){function d(t,y,u){var A=Math.sqrt(t*t+y*y+u*u);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(t/A,y/A,u/A)))-1}function c(t,y,u,A){A.faces.push(new THREE.Face3(t,y,u))}function f(t,y){var u=g.vertices[t].position,A=g.vertices[y].position;return d((u.x+A.x)/2,(u.y+A.y)/2,(u.z+A.z)/2)}var g=this,h=new THREE.Geometry,j;this.subdivisions=b||0;THREE.Geometry.call(this);b=(1+Math.sqrt(5))/2;d(-1,b,0);d(1,b,0);d(-1,-b,0);d(1,-b,0);d(0,-1,b);d(0,1,b);d(0,-1,-b);d(0,
 1,-b);d(b,0,-1);d(b,0,1);d(-b,0,-1);d(-b,0,1);c(0,11,5,h);c(0,5,1,h);c(0,1,7,h);c(0,7,10,h);c(0,10,11,h);c(1,5,9,h);c(5,11,4,h);c(11,10,2,h);c(10,7,6,h);c(7,1,8,h);c(3,9,4,h);c(3,4,2,h);c(3,2,6,h);c(3,6,8,h);c(3,8,9,h);c(4,9,5,h);c(2,4,11,h);c(6,2,10,h);c(8,6,7,h);c(9,8,1,h);for(b=0;b<this.subdivisions;b++){j=new THREE.Geometry;for(var k in h.faces){var m=f(h.faces[k].a,h.faces[k].b),o=f(h.faces[k].b,h.faces[k].c),p=f(h.faces[k].c,h.faces[k].a);c(h.faces[k].a,m,p,j);c(h.faces[k].b,o,m,j);c(h.faces[k].c,
 p,o,j);c(m,o,p,j)}h.faces=j.faces}g.faces=h.faces;delete h;delete j;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.Icosahedron.prototype=new THREE.Geometry;THREE.Icosahedron.prototype.constructor=THREE.Icosahedron;
-THREE.Lathe=function(b,d,c){THREE.Geometry.call(this);this.steps=d||12;this.angle=c||2*Math.PI;d=this.angle/this.steps;c=[];for(var f=[],g=[],h=[],j=(new THREE.Matrix4).setRotationZ(d),k=0;k<b.length;k++){this.vertices.push(new THREE.Vertex(b[k]));c[k]=b[k].clone();f[k]=this.vertices.length-1}for(var m=0;m<=this.angle+0.0010;m+=d){for(k=0;k<c.length;k++)if(m<this.angle){c[k]=j.multiplyVector3(c[k].clone());this.vertices.push(new THREE.Vertex(c[k]));g[k]=this.vertices.length-1}else g=h;m==0&&(h=f);
+THREE.Lathe=function(b,d,c){THREE.Geometry.call(this);this.steps=d||12;this.angle=c||2*Math.PI;d=this.angle/this.steps;c=[];for(var f=[],g=[],h=[],j=(new THREE.Matrix4).setRotationZ(d),k=0;k<b.length;k++){this.vertices.push(new THREE.Vertex(b[k]));c[k]=b[k].clone();f[k]=this.vertices.length-1}for(var m=0;m<=this.angle+0.001;m+=d){for(k=0;k<c.length;k++)if(m<this.angle){c[k]=j.multiplyVector3(c[k].clone());this.vertices.push(new THREE.Vertex(c[k]));g[k]=this.vertices.length-1}else g=h;m==0&&(h=f);
 for(k=0;k<f.length-1;k++){this.faces.push(new THREE.Face4(g[k],g[k+1],f[k+1],f[k]));this.faceVertexUvs[0].push([new THREE.UV(1-m/this.angle,k/b.length),new THREE.UV(1-m/this.angle,(k+1)/b.length),new THREE.UV(1-(m-d)/this.angle,(k+1)/b.length),new THREE.UV(1-(m-d)/this.angle,k/b.length)])}f=g;g=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.Lathe.prototype=new THREE.Geometry;THREE.Lathe.prototype.constructor=THREE.Lathe;
 THREE.Plane=function(b,d,c,f){THREE.Geometry.call(this);var g,h=b/2,j=d/2;c=c||1;f=f||1;var k=c+1,m=f+1;b/=c;var o=d/f;for(g=0;g<m;g++)for(d=0;d<k;d++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(d*b-h,-(g*o-j),0)));for(g=0;g<f;g++)for(d=0;d<c;d++){this.faces.push(new THREE.Face4(d+k*g,d+k*(g+1),d+1+k*(g+1),d+1+k*g));this.faceVertexUvs[0].push([new THREE.UV(d/c,g/f),new THREE.UV(d/c,(g+1)/f),new THREE.UV((d+1)/c,(g+1)/f),new THREE.UV((d+1)/c,g/f)])}this.computeCentroids();this.computeFaceNormals()};
 THREE.Plane.prototype=new THREE.Geometry;THREE.Plane.prototype.constructor=THREE.Plane;
@@ -450,39 +450,39 @@ j=b.edges[g+1];f.edges.push(new THREE.Edge(f.vertices[h],f.vertices[j],h,j))}}})
 THREE.BinaryLoader.prototype={load:function(b){var d=b.model,c=b.callback,f=b.texture_path?b.texture_path:THREE.Loader.prototype.extractUrlbase(d),g=b.bin_path?b.bin_path:THREE.Loader.prototype.extractUrlbase(d);b=(new Date).getTime();d=new Worker(d);var h=this.showProgress?THREE.Loader.prototype.updateProgress:null;d.onmessage=function(j){THREE.BinaryLoader.prototype.loadAjaxBuffers(j.data.buffers,j.data.materials,c,g,f,h)};d.onerror=function(j){alert("worker.onerror: "+j.message+"\n"+j.data);j.preventDefault()};
 d.postMessage(b)},loadAjaxBuffers:function(b,d,c,f,g,h){var j=new XMLHttpRequest,k=f+"/"+b,m=0;j.onreadystatechange=function(){if(j.readyState==4)j.status==200||j.status==0?THREE.BinaryLoader.prototype.createBinModel(j.responseText,c,g,d):alert("Couldn't load ["+k+"] ["+j.status+"]");else if(j.readyState==3){if(h){m==0&&(m=j.getResponseHeader("Content-Length"));h({total:m,loaded:j.responseText.length})}}else j.readyState==2&&(m=j.getResponseHeader("Content-Length"))};j.open("GET",k,!0);j.overrideMimeType("text/plain; charset=x-user-defined");
 j.setRequestHeader("Content-Type","text/plain");j.send(null)},createBinModel:function(b,d,c,f){var g=function(h){function j(R,S){var P=p(R,S),Ba=p(R,S+1),La=p(R,S+2),n=p(R,S+3),D=(n<<1&255|La>>7)-127;P|=(La&127)<<16|Ba<<8;if(P==0&&D==-127)return 0;return(1-2*(n>>7))*(1+P*Math.pow(2,-23))*Math.pow(2,D)}function k(R,S){var P=p(R,S),Ba=p(R,S+1),La=p(R,S+2);return(p(R,S+3)<<24)+(La<<16)+(Ba<<8)+P}function m(R,S){var P=p(R,S);return(p(R,S+1)<<8)+P}function o(R,S){var P=p(R,S);return P>127?P-256:P}function p(R,
-S){return R.charCodeAt(S)&255}function t(R){var S,P,Ba;S=k(b,R);P=k(b,R+M);Ba=k(b,R+va);R=m(b,R+la);THREE.BinaryLoader.prototype.f3(B,S,P,Ba,R)}function y(R){var S,P,Ba,La,n,D;S=k(b,R);P=k(b,R+M);Ba=k(b,R+va);La=m(b,R+la);n=k(b,R+qa);D=k(b,R+fa);R=k(b,R+ia);THREE.BinaryLoader.prototype.f3n(B,V,S,P,Ba,La,n,D,R)}function u(R){var S,P,Ba,La;S=k(b,R);P=k(b,R+e);Ba=k(b,R+oa);La=k(b,R+Da);R=m(b,R+Aa);THREE.BinaryLoader.prototype.f4(B,S,P,Ba,La,R)}function A(R){var S,P,Ba,La,n,D,x,v;S=k(b,R);P=k(b,R+e);
-Ba=k(b,R+oa);La=k(b,R+Da);n=m(b,R+Aa);D=k(b,R+da);x=k(b,R+ea);v=k(b,R+wa);R=k(b,R+ta);THREE.BinaryLoader.prototype.f4n(B,V,S,P,Ba,La,n,D,x,v,R)}function F(R){var S,P;S=k(b,R);P=k(b,R+pa);R=k(b,R+ca);THREE.BinaryLoader.prototype.uv3(B.faceVertexUvs[0],O[S*2],O[S*2+1],O[P*2],O[P*2+1],O[R*2],O[R*2+1])}function J(R){var S,P,Ba;S=k(b,R);P=k(b,R+ka);Ba=k(b,R+ma);R=k(b,R+Fa);THREE.BinaryLoader.prototype.uv4(B.faceVertexUvs[0],O[S*2],O[S*2+1],O[P*2],O[P*2+1],O[Ba*2],O[Ba*2+1],O[R*2],O[R*2+1])}var B=this,
-U=0,C,V=[],O=[],M,va,la,qa,fa,ia,e,oa,Da,Aa,da,ea,wa,ta,pa,ca,ka,ma,Fa,ja,ga,Ja,Xa,Za,Ta;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(B,f,h);C={signature:b.substr(U,8),header_bytes:p(b,U+8),vertex_coordinate_bytes:p(b,U+9),normal_coordinate_bytes:p(b,U+10),uv_coordinate_bytes:p(b,U+11),vertex_index_bytes:p(b,U+12),normal_index_bytes:p(b,U+13),uv_index_bytes:p(b,U+14),material_index_bytes:p(b,U+15),nvertices:k(b,U+16),nnormals:k(b,U+16+4),nuvs:k(b,U+16+8),ntri_flat:k(b,U+16+12),
-ntri_smooth:k(b,U+16+16),ntri_flat_uv:k(b,U+16+20),ntri_smooth_uv:k(b,U+16+24),nquad_flat:k(b,U+16+28),nquad_smooth:k(b,U+16+32),nquad_flat_uv:k(b,U+16+36),nquad_smooth_uv:k(b,U+16+40)};U+=C.header_bytes;M=C.vertex_index_bytes;va=C.vertex_index_bytes*2;la=C.vertex_index_bytes*3;qa=C.vertex_index_bytes*3+C.material_index_bytes;fa=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes;ia=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes*2;e=C.vertex_index_bytes;oa=C.vertex_index_bytes*
-2;Da=C.vertex_index_bytes*3;Aa=C.vertex_index_bytes*4;da=C.vertex_index_bytes*4+C.material_index_bytes;ea=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes;wa=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*2;ta=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*3;pa=C.uv_index_bytes;ca=C.uv_index_bytes*2;ka=C.uv_index_bytes;ma=C.uv_index_bytes*2;Fa=C.uv_index_bytes*3;h=C.vertex_index_bytes*3+C.material_index_bytes;Ta=C.vertex_index_bytes*4+C.material_index_bytes;
-ja=C.ntri_flat*h;ga=C.ntri_smooth*(h+C.normal_index_bytes*3);Ja=C.ntri_flat_uv*(h+C.uv_index_bytes*3);Xa=C.ntri_smooth_uv*(h+C.normal_index_bytes*3+C.uv_index_bytes*3);Za=C.nquad_flat*Ta;h=C.nquad_smooth*(Ta+C.normal_index_bytes*4);Ta=C.nquad_flat_uv*(Ta+C.uv_index_bytes*4);U+=function(R){for(var S,P,Ba,La=C.vertex_coordinate_bytes*3,n=R+C.nvertices*La;R<n;R+=La){S=j(b,R);P=j(b,R+C.vertex_coordinate_bytes);Ba=j(b,R+C.vertex_coordinate_bytes*2);THREE.BinaryLoader.prototype.v(B,S,P,Ba)}return C.nvertices*
-La}(U);U+=function(R){for(var S,P,Ba,La=C.normal_coordinate_bytes*3,n=R+C.nnormals*La;R<n;R+=La){S=o(b,R);P=o(b,R+C.normal_coordinate_bytes);Ba=o(b,R+C.normal_coordinate_bytes*2);V.push(S/127,P/127,Ba/127)}return C.nnormals*La}(U);U+=function(R){for(var S,P,Ba=C.uv_coordinate_bytes*2,La=R+C.nuvs*Ba;R<La;R+=Ba){S=j(b,R);P=j(b,R+C.uv_coordinate_bytes);O.push(S,P)}return C.nuvs*Ba}(U);ja=U+ja;ga=ja+ga;Ja=ga+Ja;Xa=Ja+Xa;Za=Xa+Za;h=Za+h;Ta=h+Ta;(function(R){var S,P=C.vertex_index_bytes*3+C.material_index_bytes,
-Ba=P+C.uv_index_bytes*3,La=R+C.ntri_flat_uv*Ba;for(S=R;S<La;S+=Ba){t(S);F(S+P)}return La-R})(ga);(function(R){var S,P=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes*3,Ba=P+C.uv_index_bytes*3,La=R+C.ntri_smooth_uv*Ba;for(S=R;S<La;S+=Ba){y(S);F(S+P)}return La-R})(Ja);(function(R){var S,P=C.vertex_index_bytes*4+C.material_index_bytes,Ba=P+C.uv_index_bytes*4,La=R+C.nquad_flat_uv*Ba;for(S=R;S<La;S+=Ba){u(S);J(S+P)}return La-R})(h);(function(R){var S,P=C.vertex_index_bytes*4+C.material_index_bytes+
+S){return R.charCodeAt(S)&255}function t(R){var S,P,Ba;S=k(b,R);P=k(b,R+M);Ba=k(b,R+va);R=m(b,R+la);THREE.BinaryLoader.prototype.f3(B,S,P,Ba,R)}function y(R){var S,P,Ba,La,n,D;S=k(b,R);P=k(b,R+M);Ba=k(b,R+va);La=m(b,R+la);n=k(b,R+qa);D=k(b,R+ga);R=k(b,R+ea);THREE.BinaryLoader.prototype.f3n(B,V,S,P,Ba,La,n,D,R)}function u(R){var S,P,Ba,La;S=k(b,R);P=k(b,R+e);Ba=k(b,R+oa);La=k(b,R+Da);R=m(b,R+Aa);THREE.BinaryLoader.prototype.f4(B,S,P,Ba,La,R)}function A(R){var S,P,Ba,La,n,D,x,v;S=k(b,R);P=k(b,R+e);
+Ba=k(b,R+oa);La=k(b,R+Da);n=m(b,R+Aa);D=k(b,R+da);x=k(b,R+fa);v=k(b,R+wa);R=k(b,R+ta);THREE.BinaryLoader.prototype.f4n(B,V,S,P,Ba,La,n,D,x,v,R)}function F(R){var S,P;S=k(b,R);P=k(b,R+pa);R=k(b,R+ca);THREE.BinaryLoader.prototype.uv3(B.faceVertexUvs[0],O[S*2],O[S*2+1],O[P*2],O[P*2+1],O[R*2],O[R*2+1])}function J(R){var S,P,Ba;S=k(b,R);P=k(b,R+ka);Ba=k(b,R+ma);R=k(b,R+Fa);THREE.BinaryLoader.prototype.uv4(B.faceVertexUvs[0],O[S*2],O[S*2+1],O[P*2],O[P*2+1],O[Ba*2],O[Ba*2+1],O[R*2],O[R*2+1])}var B=this,
+U=0,C,V=[],O=[],M,va,la,qa,ga,ea,e,oa,Da,Aa,da,fa,wa,ta,pa,ca,ka,ma,Fa,ja,ha,Ja,Xa,Za,Ta;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(B,f,h);C={signature:b.substr(U,8),header_bytes:p(b,U+8),vertex_coordinate_bytes:p(b,U+9),normal_coordinate_bytes:p(b,U+10),uv_coordinate_bytes:p(b,U+11),vertex_index_bytes:p(b,U+12),normal_index_bytes:p(b,U+13),uv_index_bytes:p(b,U+14),material_index_bytes:p(b,U+15),nvertices:k(b,U+16),nnormals:k(b,U+16+4),nuvs:k(b,U+16+8),ntri_flat:k(b,U+16+12),
+ntri_smooth:k(b,U+16+16),ntri_flat_uv:k(b,U+16+20),ntri_smooth_uv:k(b,U+16+24),nquad_flat:k(b,U+16+28),nquad_smooth:k(b,U+16+32),nquad_flat_uv:k(b,U+16+36),nquad_smooth_uv:k(b,U+16+40)};U+=C.header_bytes;M=C.vertex_index_bytes;va=C.vertex_index_bytes*2;la=C.vertex_index_bytes*3;qa=C.vertex_index_bytes*3+C.material_index_bytes;ga=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes;ea=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes*2;e=C.vertex_index_bytes;oa=C.vertex_index_bytes*
+2;Da=C.vertex_index_bytes*3;Aa=C.vertex_index_bytes*4;da=C.vertex_index_bytes*4+C.material_index_bytes;fa=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes;wa=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*2;ta=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*3;pa=C.uv_index_bytes;ca=C.uv_index_bytes*2;ka=C.uv_index_bytes;ma=C.uv_index_bytes*2;Fa=C.uv_index_bytes*3;h=C.vertex_index_bytes*3+C.material_index_bytes;Ta=C.vertex_index_bytes*4+C.material_index_bytes;
+ja=C.ntri_flat*h;ha=C.ntri_smooth*(h+C.normal_index_bytes*3);Ja=C.ntri_flat_uv*(h+C.uv_index_bytes*3);Xa=C.ntri_smooth_uv*(h+C.normal_index_bytes*3+C.uv_index_bytes*3);Za=C.nquad_flat*Ta;h=C.nquad_smooth*(Ta+C.normal_index_bytes*4);Ta=C.nquad_flat_uv*(Ta+C.uv_index_bytes*4);U+=function(R){for(var S,P,Ba,La=C.vertex_coordinate_bytes*3,n=R+C.nvertices*La;R<n;R+=La){S=j(b,R);P=j(b,R+C.vertex_coordinate_bytes);Ba=j(b,R+C.vertex_coordinate_bytes*2);THREE.BinaryLoader.prototype.v(B,S,P,Ba)}return C.nvertices*
+La}(U);U+=function(R){for(var S,P,Ba,La=C.normal_coordinate_bytes*3,n=R+C.nnormals*La;R<n;R+=La){S=o(b,R);P=o(b,R+C.normal_coordinate_bytes);Ba=o(b,R+C.normal_coordinate_bytes*2);V.push(S/127,P/127,Ba/127)}return C.nnormals*La}(U);U+=function(R){for(var S,P,Ba=C.uv_coordinate_bytes*2,La=R+C.nuvs*Ba;R<La;R+=Ba){S=j(b,R);P=j(b,R+C.uv_coordinate_bytes);O.push(S,P)}return C.nuvs*Ba}(U);ja=U+ja;ha=ja+ha;Ja=ha+Ja;Xa=Ja+Xa;Za=Xa+Za;h=Za+h;Ta=h+Ta;(function(R){var S,P=C.vertex_index_bytes*3+C.material_index_bytes,
+Ba=P+C.uv_index_bytes*3,La=R+C.ntri_flat_uv*Ba;for(S=R;S<La;S+=Ba){t(S);F(S+P)}return La-R})(ha);(function(R){var S,P=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes*3,Ba=P+C.uv_index_bytes*3,La=R+C.ntri_smooth_uv*Ba;for(S=R;S<La;S+=Ba){y(S);F(S+P)}return La-R})(Ja);(function(R){var S,P=C.vertex_index_bytes*4+C.material_index_bytes,Ba=P+C.uv_index_bytes*4,La=R+C.nquad_flat_uv*Ba;for(S=R;S<La;S+=Ba){u(S);J(S+P)}return La-R})(h);(function(R){var S,P=C.vertex_index_bytes*4+C.material_index_bytes+
 C.normal_index_bytes*4,Ba=P+C.uv_index_bytes*4,La=R+C.nquad_smooth_uv*Ba;for(S=R;S<La;S+=Ba){A(S);J(S+P)}return La-R})(Ta);(function(R){var S,P=C.vertex_index_bytes*3+C.material_index_bytes,Ba=R+C.ntri_flat*P;for(S=R;S<Ba;S+=P)t(S);return Ba-R})(U);(function(R){var S,P=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes*3,Ba=R+C.ntri_smooth*P;for(S=R;S<Ba;S+=P)y(S);return Ba-R})(ja);(function(R){var S,P=C.vertex_index_bytes*4+C.material_index_bytes,Ba=R+C.nquad_flat*P;for(S=R;S<Ba;S+=
 P)u(S);return Ba-R})(Xa);(function(R){var S,P=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*4,Ba=R+C.nquad_smooth*P;for(S=R;S<Ba;S+=P)A(S);return Ba-R})(Za);this.computeCentroids();this.computeFaceNormals()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;d(new g(c))},v:function(b,d,c,f){b.vertices.push(new THREE.Vertex(new THREE.Vector3(d,c,f)))},f3:function(b,d,c,f,g){b.faces.push(new THREE.Face3(d,c,f,null,null,b.materials[g]))},f4:function(b,d,c,f,g,h){b.faces.push(new THREE.Face4(d,
 c,f,g,null,null,b.materials[h]))},f3n:function(b,d,c,f,g,h,j,k,m){h=b.materials[h];var o=d[k*3],p=d[k*3+1];k=d[k*3+2];var t=d[m*3],y=d[m*3+1];m=d[m*3+2];b.faces.push(new THREE.Face3(c,f,g,[new THREE.Vector3(d[j*3],d[j*3+1],d[j*3+2]),new THREE.Vector3(o,p,k),new THREE.Vector3(t,y,m)],null,h))},f4n:function(b,d,c,f,g,h,j,k,m,o,p){j=b.materials[j];var t=d[m*3],y=d[m*3+1];m=d[m*3+2];var u=d[o*3],A=d[o*3+1];o=d[o*3+2];var F=d[p*3],J=d[p*3+1];p=d[p*3+2];b.faces.push(new THREE.Face4(c,f,g,h,[new THREE.Vector3(d[k*
 3],d[k*3+1],d[k*3+2]),new THREE.Vector3(t,y,m),new THREE.Vector3(u,A,o),new THREE.Vector3(F,J,p)],null,j))},uv3:function(b,d,c,f,g,h,j){var k=[];k.push(new THREE.UV(d,c));k.push(new THREE.UV(f,g));k.push(new THREE.UV(h,j));b.push(k)},uv4:function(b,d,c,f,g,h,j,k,m){var o=[];o.push(new THREE.UV(d,c));o.push(new THREE.UV(f,g));o.push(new THREE.UV(h,j));o.push(new THREE.UV(k,m));b.push(o)}};
 THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
-THREE.SceneLoader.prototype={load:function(b,d){var c=this,f=new Worker(b);f.postMessage(0);var g=THREE.Loader.prototype.extractUrlbase(b);f.onmessage=function(h){function j(pa,ca){return ca=="relativeToHTML"?pa:g+"/"+pa}function k(){for(u in fa.objects)if(!da.objects[u]){U=fa.objects[u];if(U.geometry!==undefined){if(M=da.geometries[U.geometry]){qa=[];for(ta=0;ta<U.materials.length;ta++)qa[ta]=da.materials[U.materials[ta]];C=U.position;r=U.rotation;q=U.quaternion;s=U.scale;q=0;qa.length==0&&(qa[0]=
+THREE.SceneLoader.prototype={load:function(b,d){var c=this,f=new Worker(b);f.postMessage(0);var g=THREE.Loader.prototype.extractUrlbase(b);f.onmessage=function(h){function j(pa,ca){return ca=="relativeToHTML"?pa:g+"/"+pa}function k(){for(u in ga.objects)if(!da.objects[u]){U=ga.objects[u];if(U.geometry!==undefined){if(M=da.geometries[U.geometry]){qa=[];for(ta=0;ta<U.materials.length;ta++)qa[ta]=da.materials[U.materials[ta]];C=U.position;r=U.rotation;q=U.quaternion;s=U.scale;q=0;qa.length==0&&(qa[0]=
 new THREE.MeshFaceMaterial);qa.length>1&&(qa=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(M,qa);object.name=u;object.position.set(C[0],C[1],C[2]);if(q){object.quaternion.set(q[0],q[1],q[2],q[3]);object.useQuaternion=!0}else object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=U.visible;da.scene.addObject(object);da.objects[u]=object;if(U.meshCollider){var pa=THREE.CollisionUtils.MeshColliderWBox(object);da.scene.collisions.colliders.push(pa)}if(U.castsShadow){pa=
 new THREE.ShadowVolume(M);da.scene.addChild(pa);pa.position=object.position;pa.rotation=object.rotation;pa.scale=object.scale}U.trigger&&U.trigger.toLowerCase()!="none"&&(da.triggers[object.name]={type:U.trigger,object:U})}}else{C=U.position;r=U.rotation;q=U.quaternion;s=U.scale;q=0;object=new THREE.Object3D;object.name=u;object.position.set(C[0],C[1],C[2]);if(q){object.quaternion.set(q[0],q[1],q[2],q[3]);object.useQuaternion=!0}else object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],
-s[2]);object.visible=U.visible!==undefined?U.visible:!1;da.scene.addObject(object);da.objects[u]=object;da.empties[u]=object}}}function m(pa){return function(ca){da.geometries[pa]=ca;k();e-=1;c.onLoadComplete();p()}}function o(pa){return function(ca){da.geometries[pa]=ca}}function p(){c.callbackProgress({totalModels:Da,totalTextures:Aa,loadedModels:Da-e,loadedTextures:Aa-oa},da);c.onLoadProgress();e==0&&oa==0&&d(da)}var t,y,u,A,F,J,B,U,C,V,O,M,va,la,qa,fa,ia,e,oa,Da,Aa,da;fa=h.data;h=new THREE.BinaryLoader;
-ia=new THREE.JSONLoader;oa=e=0;da={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};var ea=!1;for(u in fa.objects){U=fa.objects[u];if(U.meshCollider){ea=!0;break}}if(ea)da.scene.collisions=new THREE.CollisionSystem;if(fa.transform){ea=fa.transform.position;V=fa.transform.rotation;var wa=fa.transform.scale;ea&&da.scene.position.set(ea[0],ea[1],ea[2]);V&&da.scene.rotation.set(V[0],V[1],V[2]);wa&&da.scene.scale.set(wa[0],wa[1],
-wa[2]);(ea||V||wa)&&da.scene.updateMatrix()}ea=function(){oa-=1;p();c.onLoadComplete()};for(F in fa.cameras){V=fa.cameras[F];if(V.type=="perspective")va=new THREE.Camera(V.fov,V.aspect,V.near,V.far);else if(V.type=="ortho"){va=new THREE.Camera;va.projectionMatrix=THREE.Matrix4.makeOrtho(V.left,V.right,V.top,V.bottom,V.near,V.far)}C=V.position;V=V.target;va.position.set(C[0],C[1],C[2]);va.target.position.set(V[0],V[1],V[2]);da.cameras[F]=va}for(A in fa.lights){F=fa.lights[A];va=F.color!==undefined?
-F.color:16777215;V=F.intensity!==undefined?F.intensity:1;if(F.type=="directional"){C=F.direction;light=new THREE.DirectionalLight(va,V);light.position.set(C[0],C[1],C[2]);light.position.normalize()}else if(F.type=="point"){C=F.position;light=new THREE.PointLight(va,V);light.position.set(C[0],C[1],C[2])}da.scene.addLight(light);da.lights[A]=light}for(J in fa.fogs){A=fa.fogs[J];if(A.type=="linear")la=new THREE.Fog(0,A.near,A.far);else A.type=="exp2"&&(la=new THREE.FogExp2(0,A.density));V=A.color;la.color.setRGB(V[0],
-V[1],V[2]);da.fogs[J]=la}if(da.cameras&&fa.defaults.camera)da.currentCamera=da.cameras[fa.defaults.camera];if(da.fogs&&fa.defaults.fog)da.scene.fog=da.fogs[fa.defaults.fog];V=fa.defaults.bgcolor;da.bgColor=new THREE.Color;da.bgColor.setRGB(V[0],V[1],V[2]);da.bgColorAlpha=fa.defaults.bgalpha;for(t in fa.geometries){J=fa.geometries[t];if(J.type=="bin_mesh"||J.type=="ascii_mesh"){e+=1;c.onLoadStart()}}Da=e;for(t in fa.geometries){J=fa.geometries[t];if(J.type=="cube"){M=new THREE.Cube(J.width,J.height,
+s[2]);object.visible=U.visible!==undefined?U.visible:!1;da.scene.addObject(object);da.objects[u]=object;da.empties[u]=object}}}function m(pa){return function(ca){da.geometries[pa]=ca;k();e-=1;c.onLoadComplete();p()}}function o(pa){return function(ca){da.geometries[pa]=ca}}function p(){c.callbackProgress({totalModels:Da,totalTextures:Aa,loadedModels:Da-e,loadedTextures:Aa-oa},da);c.onLoadProgress();e==0&&oa==0&&d(da)}var t,y,u,A,F,J,B,U,C,V,O,M,va,la,qa,ga,ea,e,oa,Da,Aa,da;ga=h.data;h=new THREE.BinaryLoader;
+ea=new THREE.JSONLoader;oa=e=0;da={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};var fa=!1;for(u in ga.objects){U=ga.objects[u];if(U.meshCollider){fa=!0;break}}if(fa)da.scene.collisions=new THREE.CollisionSystem;if(ga.transform){fa=ga.transform.position;V=ga.transform.rotation;var wa=ga.transform.scale;fa&&da.scene.position.set(fa[0],fa[1],fa[2]);V&&da.scene.rotation.set(V[0],V[1],V[2]);wa&&da.scene.scale.set(wa[0],wa[1],
+wa[2]);(fa||V||wa)&&da.scene.updateMatrix()}fa=function(){oa-=1;p();c.onLoadComplete()};for(F in ga.cameras){V=ga.cameras[F];if(V.type=="perspective")va=new THREE.Camera(V.fov,V.aspect,V.near,V.far);else if(V.type=="ortho"){va=new THREE.Camera;va.projectionMatrix=THREE.Matrix4.makeOrtho(V.left,V.right,V.top,V.bottom,V.near,V.far)}C=V.position;V=V.target;va.position.set(C[0],C[1],C[2]);va.target.position.set(V[0],V[1],V[2]);da.cameras[F]=va}for(A in ga.lights){F=ga.lights[A];va=F.color!==undefined?
+F.color:16777215;V=F.intensity!==undefined?F.intensity:1;if(F.type=="directional"){C=F.direction;light=new THREE.DirectionalLight(va,V);light.position.set(C[0],C[1],C[2]);light.position.normalize()}else if(F.type=="point"){C=F.position;light=new THREE.PointLight(va,V);light.position.set(C[0],C[1],C[2])}da.scene.addLight(light);da.lights[A]=light}for(J in ga.fogs){A=ga.fogs[J];if(A.type=="linear")la=new THREE.Fog(0,A.near,A.far);else A.type=="exp2"&&(la=new THREE.FogExp2(0,A.density));V=A.color;la.color.setRGB(V[0],
+V[1],V[2]);da.fogs[J]=la}if(da.cameras&&ga.defaults.camera)da.currentCamera=da.cameras[ga.defaults.camera];if(da.fogs&&ga.defaults.fog)da.scene.fog=da.fogs[ga.defaults.fog];V=ga.defaults.bgcolor;da.bgColor=new THREE.Color;da.bgColor.setRGB(V[0],V[1],V[2]);da.bgColorAlpha=ga.defaults.bgalpha;for(t in ga.geometries){J=ga.geometries[t];if(J.type=="bin_mesh"||J.type=="ascii_mesh"){e+=1;c.onLoadStart()}}Da=e;for(t in ga.geometries){J=ga.geometries[t];if(J.type=="cube"){M=new THREE.Cube(J.width,J.height,
 J.depth,J.segmentsWidth,J.segmentsHeight,J.segmentsDepth,null,J.flipped,J.sides);da.geometries[t]=M}else if(J.type=="plane"){M=new THREE.Plane(J.width,J.height,J.segmentsWidth,J.segmentsHeight);da.geometries[t]=M}else if(J.type=="sphere"){M=new THREE.Sphere(J.radius,J.segmentsWidth,J.segmentsHeight);da.geometries[t]=M}else if(J.type=="cylinder"){M=new THREE.Cylinder(J.numSegs,J.topRad,J.botRad,J.height,J.topOffset,J.botOffset);da.geometries[t]=M}else if(J.type=="torus"){M=new THREE.Torus(J.radius,
-J.tube,J.segmentsR,J.segmentsT);da.geometries[t]=M}else if(J.type=="icosahedron"){M=new THREE.Icosahedron(J.subdivisions);da.geometries[t]=M}else if(J.type=="bin_mesh")h.load({model:j(J.url,fa.urlBaseType),callback:m(t)});else if(J.type=="ascii_mesh")ia.load({model:j(J.url,fa.urlBaseType),callback:m(t)});else if(J.type=="embedded_mesh")(J=fa.embeds[J.id])&&ia.createModel(J,o(t),"")}for(B in fa.textures){t=fa.textures[B];if(t.url instanceof Array){oa+=t.url.length;for(h=0;h<t.url.length;h++)c.onLoadStart()}else{oa+=
-1;c.onLoadStart()}}Aa=oa;for(B in fa.textures){t=fa.textures[B];if(t.mapping!=undefined&&THREE[t.mapping]!=undefined)t.mapping=new THREE[t.mapping];if(t.url instanceof Array){h=[];for(var ta=0;ta<t.url.length;ta++)h[ta]=j(t.url[ta],fa.urlBaseType);h=THREE.ImageUtils.loadTextureCube(h,t.mapping,ea)}else{h=THREE.ImageUtils.loadTexture(j(t.url,fa.urlBaseType),t.mapping,ea);if(THREE[t.minFilter]!=undefined)h.minFilter=THREE[t.minFilter];if(THREE[t.magFilter]!=undefined)h.magFilter=THREE[t.magFilter]}da.textures[B]=
-h}for(y in fa.materials){B=fa.materials[y];for(O in B.parameters)if(O=="envMap"||O=="map"||O=="lightMap")B.parameters[O]=da.textures[B.parameters[O]];else if(O=="shading")B.parameters[O]=B.parameters[O]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(O=="blending")B.parameters[O]=THREE[B.parameters[O]]?THREE[B.parameters[O]]:THREE.NormalBlending;else if(O=="combine")B.parameters[O]=B.parameters[O]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(O=="vertexColors")if(B.parameters[O]==
+J.tube,J.segmentsR,J.segmentsT);da.geometries[t]=M}else if(J.type=="icosahedron"){M=new THREE.Icosahedron(J.subdivisions);da.geometries[t]=M}else if(J.type=="bin_mesh")h.load({model:j(J.url,ga.urlBaseType),callback:m(t)});else if(J.type=="ascii_mesh")ea.load({model:j(J.url,ga.urlBaseType),callback:m(t)});else if(J.type=="embedded_mesh")(J=ga.embeds[J.id])&&ea.createModel(J,o(t),"")}for(B in ga.textures){t=ga.textures[B];if(t.url instanceof Array){oa+=t.url.length;for(h=0;h<t.url.length;h++)c.onLoadStart()}else{oa+=
+1;c.onLoadStart()}}Aa=oa;for(B in ga.textures){t=ga.textures[B];if(t.mapping!=undefined&&THREE[t.mapping]!=undefined)t.mapping=new THREE[t.mapping];if(t.url instanceof Array){h=[];for(var ta=0;ta<t.url.length;ta++)h[ta]=j(t.url[ta],ga.urlBaseType);h=THREE.ImageUtils.loadTextureCube(h,t.mapping,fa)}else{h=THREE.ImageUtils.loadTexture(j(t.url,ga.urlBaseType),t.mapping,fa);if(THREE[t.minFilter]!=undefined)h.minFilter=THREE[t.minFilter];if(THREE[t.magFilter]!=undefined)h.magFilter=THREE[t.magFilter]}da.textures[B]=
+h}for(y in ga.materials){B=ga.materials[y];for(O in B.parameters)if(O=="envMap"||O=="map"||O=="lightMap")B.parameters[O]=da.textures[B.parameters[O]];else if(O=="shading")B.parameters[O]=B.parameters[O]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(O=="blending")B.parameters[O]=THREE[B.parameters[O]]?THREE[B.parameters[O]]:THREE.NormalBlending;else if(O=="combine")B.parameters[O]=B.parameters[O]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(O=="vertexColors")if(B.parameters[O]==
 "face")B.parameters[O]=THREE.FaceColors;else if(B.parameters[O])B.parameters[O]=THREE.VertexColors;if(B.parameters.opacity!==undefined&&B.parameters.opacity<1)B.parameters.transparent=!0;B=new THREE[B.type](B.parameters);da.materials[y]=B}k();c.callbackSync(da)}}};
 THREE.MarchingCubes=function(b,d){THREE.Object3D.call(this);this.materials=d instanceof Array?d:[d];this.init=function(c){this.isolation=80;this.size=c;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
 0;this.hasPos=!1;this.hasNormal=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(c,f,g){return c+(f-c)*g};this.VIntX=function(c,f,g,h,j,k,m,o,p,t){j=(j-p)/(t-p);p=this.normal_cache;f[h]=k+j*this.delta;f[h+1]=m;f[h+2]=o;g[h]=this.lerp(p[c],p[c+3],j);g[h+1]=this.lerp(p[c+1],p[c+4],j);g[h+2]=this.lerp(p[c+2],p[c+5],j)};this.VIntY=function(c,f,g,h,j,k,m,o,p,t){j=(j-p)/(t-p);p=this.normal_cache;f[h]=k;f[h+1]=m+j*this.delta;f[h+
 2]=o;f=c+this.yd*3;g[h]=this.lerp(p[c],p[f],j);g[h+1]=this.lerp(p[c+1],p[f+1],j);g[h+2]=this.lerp(p[c+2],p[f+2],j)};this.VIntZ=function(c,f,g,h,j,k,m,o,p,t){j=(j-p)/(t-p);p=this.normal_cache;f[h]=k;f[h+1]=m;f[h+2]=o+j*this.delta;f=c+this.zd*3;g[h]=this.lerp(p[c],p[f],j);g[h+1]=this.lerp(p[c+1],p[f+1],j);g[h+2]=this.lerp(p[c+2],p[f+2],j)};this.compNorm=function(c){var f=c*3;if(this.normal_cache[f]==0){this.normal_cache[f]=this.field[c-1]-this.field[c+1];this.normal_cache[f+1]=this.field[c-this.yd]-
 this.field[c+this.yd];this.normal_cache[f+2]=this.field[c-this.zd]-this.field[c+this.zd]}};this.polygonize=function(c,f,g,h,j,k){var m=h+1,o=h+this.yd,p=h+this.zd,t=m+this.yd,y=m+this.zd,u=h+this.yd+this.zd,A=m+this.yd+this.zd,F=0,J=this.field[h],B=this.field[m],U=this.field[o],C=this.field[t],V=this.field[p],O=this.field[y],M=this.field[u],va=this.field[A];J<j&&(F|=1);B<j&&(F|=2);U<j&&(F|=8);C<j&&(F|=4);V<j&&(F|=16);O<j&&(F|=32);M<j&&(F|=128);va<j&&(F|=64);var la=THREE.edgeTable[F];if(la==0)return 0;
-var qa=this.delta,fa=c+qa,ia=f+qa;qa=g+qa;if(la&1){this.compNorm(h);this.compNorm(m);this.VIntX(h*3,this.vlist,this.nlist,0,j,c,f,g,J,B)}if(la&2){this.compNorm(m);this.compNorm(t);this.VIntY(m*3,this.vlist,this.nlist,3,j,fa,f,g,B,C)}if(la&4){this.compNorm(o);this.compNorm(t);this.VIntX(o*3,this.vlist,this.nlist,6,j,c,ia,g,U,C)}if(la&8){this.compNorm(h);this.compNorm(o);this.VIntY(h*3,this.vlist,this.nlist,9,j,c,f,g,J,U)}if(la&16){this.compNorm(p);this.compNorm(y);this.VIntX(p*3,this.vlist,this.nlist,
-12,j,c,f,qa,V,O)}if(la&32){this.compNorm(y);this.compNorm(A);this.VIntY(y*3,this.vlist,this.nlist,15,j,fa,f,qa,O,va)}if(la&64){this.compNorm(u);this.compNorm(A);this.VIntX(u*3,this.vlist,this.nlist,18,j,c,ia,qa,M,va)}if(la&128){this.compNorm(p);this.compNorm(u);this.VIntY(p*3,this.vlist,this.nlist,21,j,c,f,qa,V,M)}if(la&256){this.compNorm(h);this.compNorm(p);this.VIntZ(h*3,this.vlist,this.nlist,24,j,c,f,g,J,V)}if(la&512){this.compNorm(m);this.compNorm(y);this.VIntZ(m*3,this.vlist,this.nlist,27,j,
-fa,f,g,B,O)}if(la&1024){this.compNorm(t);this.compNorm(A);this.VIntZ(t*3,this.vlist,this.nlist,30,j,fa,ia,g,C,va)}if(la&2048){this.compNorm(o);this.compNorm(u);this.VIntZ(o*3,this.vlist,this.nlist,33,j,c,ia,g,U,M)}F<<=4;for(j=h=0;THREE.triTable[F+j]!=-1;){c=F+j;f=c+1;g=c+2;this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[c],3*THREE.triTable[f],3*THREE.triTable[g],k);j+=3;h++}return h};this.posnormtriv=function(c,f,g,h,j,k){var m=this.count*3;this.positionArray[m]=c[g];this.positionArray[m+
+var qa=this.delta,ga=c+qa,ea=f+qa;qa=g+qa;if(la&1){this.compNorm(h);this.compNorm(m);this.VIntX(h*3,this.vlist,this.nlist,0,j,c,f,g,J,B)}if(la&2){this.compNorm(m);this.compNorm(t);this.VIntY(m*3,this.vlist,this.nlist,3,j,ga,f,g,B,C)}if(la&4){this.compNorm(o);this.compNorm(t);this.VIntX(o*3,this.vlist,this.nlist,6,j,c,ea,g,U,C)}if(la&8){this.compNorm(h);this.compNorm(o);this.VIntY(h*3,this.vlist,this.nlist,9,j,c,f,g,J,U)}if(la&16){this.compNorm(p);this.compNorm(y);this.VIntX(p*3,this.vlist,this.nlist,
+12,j,c,f,qa,V,O)}if(la&32){this.compNorm(y);this.compNorm(A);this.VIntY(y*3,this.vlist,this.nlist,15,j,ga,f,qa,O,va)}if(la&64){this.compNorm(u);this.compNorm(A);this.VIntX(u*3,this.vlist,this.nlist,18,j,c,ea,qa,M,va)}if(la&128){this.compNorm(p);this.compNorm(u);this.VIntY(p*3,this.vlist,this.nlist,21,j,c,f,qa,V,M)}if(la&256){this.compNorm(h);this.compNorm(p);this.VIntZ(h*3,this.vlist,this.nlist,24,j,c,f,g,J,V)}if(la&512){this.compNorm(m);this.compNorm(y);this.VIntZ(m*3,this.vlist,this.nlist,27,j,
+ga,f,g,B,O)}if(la&1024){this.compNorm(t);this.compNorm(A);this.VIntZ(t*3,this.vlist,this.nlist,30,j,ga,ea,g,C,va)}if(la&2048){this.compNorm(o);this.compNorm(u);this.VIntZ(o*3,this.vlist,this.nlist,33,j,c,ea,g,U,M)}F<<=4;for(j=h=0;THREE.triTable[F+j]!=-1;){c=F+j;f=c+1;g=c+2;this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[c],3*THREE.triTable[f],3*THREE.triTable[g],k);j+=3;h++}return h};this.posnormtriv=function(c,f,g,h,j,k){var m=this.count*3;this.positionArray[m]=c[g];this.positionArray[m+
 1]=c[g+1];this.positionArray[m+2]=c[g+2];this.positionArray[m+3]=c[h];this.positionArray[m+4]=c[h+1];this.positionArray[m+5]=c[h+2];this.positionArray[m+6]=c[j];this.positionArray[m+7]=c[j+1];this.positionArray[m+8]=c[j+2];this.normalArray[m]=f[g];this.normalArray[m+1]=f[g+1];this.normalArray[m+2]=f[g+2];this.normalArray[m+3]=f[h];this.normalArray[m+4]=f[h+1];this.normalArray[m+5]=f[h+2];this.normalArray[m+6]=f[j];this.normalArray[m+7]=f[j+1];this.normalArray[m+8]=f[j+2];this.hasPos=!0;this.hasNormal=
 !0;this.count+=3;this.count>=this.maxCount-3&&k(this)};this.begin=function(){this.count=0;this.hasPos=!1;this.hasNormal=!1};this.end=function(c){if(this.count!=0){for(var f=this.count*3;f<this.positionArray.length;f++)this.positionArray[f]=0;c(this)}};this.addBall=function(c,f,g,h,j){var k=this.size*Math.sqrt(h/j),m=g*this.size,o=f*this.size,p=c*this.size,t=Math.floor(m-k);t<1&&(t=1);m=Math.floor(m+k);m>this.size-1&&(m=this.size-1);var y=Math.floor(o-k);y<1&&(y=1);o=Math.floor(o+k);o>this.size-1&&
 (o=this.size-1);var u=Math.floor(p-k);u<1&&(u=1);k=Math.floor(p+k);k>this.size-1&&(k=this.size-1);for(var A,F,J,B,U,C;t<m;t++){p=this.size2*t;F=t/this.size-g;U=F*F;for(F=y;F<o;F++){J=p+this.size*F;A=F/this.size-f;C=A*A;for(A=u;A<k;A++){B=A/this.size-c;B=h/(1.0E-6+B*B+C+U)-j;B>0&&(this.field[J+A]+=B)}}}};this.addPlaneX=function(c,f){var g,h,j,k,m,o=this.size,p=this.yd,t=this.zd,y=this.field,u=o*Math.sqrt(c/f);u>o&&(u=o);for(g=0;g<u;g++){h=g/o;h*=h;k=c/(1.0E-4+h)-f;if(k>0)for(h=0;h<o;h++){m=g+h*p;for(j=

+ 1 - 1
build/custom/ThreeCanvas.js

@@ -50,7 +50,7 @@ THREE.Quaternion.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;thi
 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);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},
 multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,h=a.x,f=a.y,k=a.z;a=a.w;this.x=b*a+e*h+c*k-d*f;this.y=c*a+e*f+d*h-b*k;this.z=d*a+e*k+b*f-c*h;this.w=e*a-b*h-c*f-d*k;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,h=this.x,f=this.y,k=this.z,g=this.w,i=g*c+f*e-k*d,n=
 g*d+k*c-h*e,j=g*e+h*d-f*c;c=-h*c-f*d-k*e;b.x=i*g+c*-h+n*-k-j*-f;b.y=n*g+c*-f+j*-h-i*-k;b.z=j*g+c*-k+i*-f-n*-h;return b}};
-THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var h=Math.acos(e),f=Math.sqrt(1-e*e);if(Math.abs(f)<0.0010){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);return c}e=Math.sin((1-d)*h)/f;d=Math.sin(d*h)/f;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
+THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var h=Math.acos(e),f=Math.sqrt(1-e*e);if(Math.abs(f)<0.001){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);return c}e=Math.sin((1-d)*h)/f;d=Math.sin(d*h)/f;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
 THREE.Face3=function(a,b,c,d,e,h){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};
 THREE.Face4=function(a,b,c,d,e,h,f){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=f instanceof Array?f:[f];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.set(a||0,b||0)};
 THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};

+ 1 - 1
build/custom/ThreeDOM.js

@@ -50,7 +50,7 @@ THREE.Quaternion.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;thi
 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);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},
 multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,h=a.x,f=a.y,j=a.z;a=a.w;this.x=b*a+e*h+c*j-d*f;this.y=c*a+e*f+d*h-b*j;this.z=d*a+e*j+b*f-c*h;this.w=e*a-b*h-c*f-d*j;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,h=this.x,f=this.y,j=this.z,g=this.w,i=g*c+f*e-j*d,l=
 g*d+j*c-h*e,k=g*e+h*d-f*c;c=-h*c-f*d-j*e;b.x=i*g+c*-h+l*-j-k*-f;b.y=l*g+c*-f+k*-h-i*-j;b.z=k*g+c*-j+i*-f-l*-h;return b}};
-THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var h=Math.acos(e),f=Math.sqrt(1-e*e);if(Math.abs(f)<0.0010){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);return c}e=Math.sin((1-d)*h)/f;d=Math.sin(d*h)/f;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
+THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var h=Math.acos(e),f=Math.sqrt(1-e*e);if(Math.abs(f)<0.001){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);return c}e=Math.sin((1-d)*h)/f;d=Math.sin(d*h)/f;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
 THREE.Face3=function(a,b,c,d,e,h){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};
 THREE.Face4=function(a,b,c,d,e,h,f){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=f instanceof Array?f:[f];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.set(a||0,b||0)};
 THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Camera=function(a,b,c,d,e){THREE.Object3D.call(this);this.fov=a||50;this.aspect=b||1;this.near=c||0.1;this.far=d||2E3;this.target=e||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;

+ 4 - 4
build/custom/ThreeExtras.js

@@ -33,7 +33,7 @@ value:0,texture:null},uImageIncrement:{type:"v2",value:new THREE.Vector2(0.00195
 film:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},time:{type:"f",value:0},nIntensity:{type:"f",value:0.5},sIntensity:{type:"f",value:0.05},sCount:{type:"f",value:4096},grayscale:{type:"i",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float time;\nuniform bool grayscale;\nuniform float nIntensity;\nuniform float sIntensity;\nuniform float sCount;\nvoid main() {\nvec4 cTextureScreen = texture2D( tDiffuse, vUv );\nfloat x = vUv.x * vUv.y * time *  1000.0;\nx = mod( x, 13.0 ) * mod( x, 123.0 );\nfloat dx = mod( x, 0.01 );\nvec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx * 100.0, 0.0, 1.0 );\nvec2 sc = vec2( sin( vUv.y * sCount ), cos( vUv.y * sCount ) );\ncResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * sIntensity;\ncResult = cTextureScreen.rgb + clamp( nIntensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );\nif( grayscale ) {\ncResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );\n}\ngl_FragColor =  vec4( cResult, cTextureScreen.a );\n}"},
 screen:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},opacity:{type:"f",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float opacity;\nvoid main() {\nvec4 texel = texture2D( tDiffuse, vUv );\ngl_FragColor = opacity * texel;\n}"},basic:{uniforms:{},vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",
 fragmentShader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(a){var d,b,e,c,f=2*Math.ceil(a*3)+1;f>25&&(f=25);c=(f-1)*0.5;b=Array(f);for(d=e=0;d<f;++d){b[d]=Math.exp(-((d-c)*(d-c))/(2*a*a));e+=b[d]}for(d=0;d<f;++d)b[d]/=e;return b}};
-THREE.QuakeCamera=function(a){function d(b,e){return function(){e.apply(b,arguments)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=3.14;this.domElement=document;this.lastUpdate=(new Date).getTime();this.tdiff=0;if(a){if(a.movementSpeed!==undefined)this.movementSpeed=
+THREE.QuakeCamera=function(a){function d(b,e){return function(){e.apply(b,arguments)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.movementSpeed=1;this.lookSpeed=0.005;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=3.14;this.domElement=document;this.lastUpdate=(new Date).getTime();this.tdiff=0;if(a){if(a.movementSpeed!==undefined)this.movementSpeed=
 a.movementSpeed;if(a.lookSpeed!==undefined)this.lookSpeed=a.lookSpeed;if(a.noFly!==undefined)this.noFly=a.noFly;if(a.lookVertical!==undefined)this.lookVertical=a.lookVertical;if(a.autoForward!==undefined)this.autoForward=a.autoForward;if(a.activeLook!==undefined)this.activeLook=a.activeLook;if(a.heightSpeed!==undefined)this.heightSpeed=a.heightSpeed;if(a.heightCoef!==undefined)this.heightCoef=a.heightCoef;if(a.heightMin!==undefined)this.heightMin=a.heightMin;if(a.heightMax!==undefined)this.heightMax=
 a.heightMax;if(a.constrainVertical!==undefined)this.constrainVertical=a.constrainVertical;if(a.verticalMin!==undefined)this.verticalMin=a.verticalMin;if(a.verticalMax!==undefined)this.verticalMax=a.verticalMax;if(a.domElement!==undefined)this.domElement=a.domElement}this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor=0;this.moveForward=!1;this.moveBackward=!1;this.moveLeft=!1;this.moveRight=!1;this.freeze=!1;this.mouseDragOn=!1;this.windowHalfX=window.innerWidth/2;this.windowHalfY=
 window.innerHeight/2;this.onMouseDown=function(b){b.preventDefault();b.stopPropagation();if(this.activeLook)switch(b.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(b){b.preventDefault();b.stopPropagation();if(this.activeLook)switch(b.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(b){this.mouseX=b.clientX-this.windowHalfX;this.mouseY=b.clientY-this.windowHalfY};this.onKeyDown=
@@ -45,14 +45,14 @@ this.onMouseMove),!1);this.domElement.addEventListener("mousedown",d(this,this.o
 THREE.QuakeCamera.prototype.translate=function(a,d){this.matrix.rotateAxis(d);if(this.noFly)d.y=0;this.position.addSelf(d.multiplyScalar(a));this.target.position.addSelf(d.multiplyScalar(a))};
 THREE.PathCamera=function(a){function d(l,k,m,p){var o={name:m,fps:0.6,length:p,hierarchy:[]},y,x=k.getControlPointsArray(),v=k.getLength(),u=x.length,z=0;y=u-1;k={parent:-1,keys:[]};k.keys[0]={time:0,pos:x[0],rot:[0,0,0,1],scl:[1,1,1]};k.keys[y]={time:p,pos:x[y],rot:[0,0,0,1],scl:[1,1,1]};for(y=1;y<u-1;y++){z=p*v.chunks[y]/v.total;k.keys[y]={time:z,pos:x[y]}}o.hierarchy[0]=k;THREE.AnimationHandler.add(o);return new THREE.Animation(l,m,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function b(l,k){var m,
 p,o=new THREE.Geometry;for(m=0;m<l.points.length*k;m++){p=m/(l.points.length*k);p=l.getPoint(p);o.vertices[m]=new THREE.Vertex(new THREE.Vector3(p.x,p.y,p.z))}return o}function e(l,k){var m=b(k,10),p=b(k,10),o=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(m,o);particleObj=new THREE.ParticleSystem(p,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);l.addChild(lineObj);particleObj.scale.set(1,1,1);l.addChild(particleObj);p=new THREE.Sphere(1,
-16,8);o=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<k.points.length;i++){m=new THREE.Mesh(p,o);m.position.copy(k.points[i]);m.updateMatrix();l.addChild(m)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.id="PathCamera"+THREE.PathCameraIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookVertical=
+16,8);o=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<k.points.length;i++){m=new THREE.Mesh(p,o);m.position.copy(k.points[i]);m.updateMatrix();l.addChild(m)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.id="PathCamera"+THREE.PathCameraIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.005;this.lookVertical=
 !0;this.lookHorizontal=!0;this.verticalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.horizontalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.domElement=document;if(a){if(a.duration!==undefined)this.duration=a.duration*1E3;if(a.waypoints!==undefined)this.waypoints=a.waypoints;if(a.useConstantSpeed!==undefined)this.useConstantSpeed=a.useConstantSpeed;if(a.resamplingCoef!==undefined)this.resamplingCoef=a.resamplingCoef;if(a.createDebugPath!==undefined)this.createDebugPath=a.createDebugPath;
 if(a.createDebugDummy!==undefined)this.createDebugDummy=a.createDebugDummy;if(a.lookSpeed!==undefined)this.lookSpeed=a.lookSpeed;if(a.lookVertical!==undefined)this.lookVertical=a.lookVertical;if(a.lookHorizontal!==undefined)this.lookHorizontal=a.lookHorizontal;if(a.verticalAngleMap!==undefined)this.verticalAngleMap=a.verticalAngleMap;if(a.horizontalAngleMap!==undefined)this.horizontalAngleMap=a.horizontalAngleMap;if(a.domElement!==undefined)this.domElement=a.domElement}this.theta=this.phi=this.lon=
 this.lat=this.mouseY=this.mouseX=0;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;var c=Math.PI*2,f=Math.PI/180;this.update=function(l,k,m){var p,o;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*f;this.theta=this.lon*f;p=this.phi%c;this.phi=p>=0?p:p+c;p=this.verticalAngleMap.srcRange;o=this.verticalAngleMap.dstRange;
 this.phi=(this.phi-p[0])*(o[1]-o[0])/(p[1]-p[0])+o[0];p=this.horizontalAngleMap.srcRange;o=this.horizontalAngleMap.dstRange;this.theta=(this.theta-p[0])*(o[1]-o[0])/(p[1]-p[0])+o[0];p=this.target.position;p.x=100*Math.sin(this.phi)*Math.cos(this.theta);p.y=100*Math.cos(this.phi);p.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,l,k,m)};this.onMouseMove=function(l){this.mouseX=l.clientX-this.windowHalfX;this.mouseY=l.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);
 this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){a=new THREE.MeshLambertMaterial({color:30719});var g=new THREE.MeshLambertMaterial({color:65280}),h=new THREE.Cube(10,10,20),j=new THREE.Cube(2,2,10);this.animationParent=new THREE.Mesh(h,a);a=new THREE.Mesh(j,g);a.position.set(0,10,0);this.animation=d(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this);this.animationParent.addChild(this.target);this.animationParent.addChild(a)}else{this.animation=
 d(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this.target);this.animationParent.addChild(this)}this.createDebugPath&&e(this.debugPath,this.spline);this.domElement.addEventListener("mousemove",function(l,k){return function(){k.apply(l,arguments)}}(this,this.onMouseMove),!1)};THREE.PathCamera.prototype=new THREE.Camera;THREE.PathCamera.prototype.constructor=THREE.PathCamera;THREE.PathCamera.prototype.supr=THREE.Camera.prototype;THREE.PathCameraIdCounter=0;
-THREE.FlyCamera=function(a){function d(b,e){return function(){e.apply(b,arguments)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.tmpQuaternion=new THREE.Quaternion;this.movementSpeed=1;this.rollSpeed=0.0050;this.dragToLook=!1;this.autoForward=!1;this.domElement=document;if(a){if(a.movementSpeed!==undefined)this.movementSpeed=a.movementSpeed;if(a.rollSpeed!==undefined)this.rollSpeed=a.rollSpeed;if(a.dragToLook!==undefined)this.dragToLook=a.dragToLook;if(a.autoForward!==undefined)this.autoForward=
+THREE.FlyCamera=function(a){function d(b,e){return function(){e.apply(b,arguments)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.tmpQuaternion=new THREE.Quaternion;this.movementSpeed=1;this.rollSpeed=0.005;this.dragToLook=!1;this.autoForward=!1;this.domElement=document;if(a){if(a.movementSpeed!==undefined)this.movementSpeed=a.movementSpeed;if(a.rollSpeed!==undefined)this.rollSpeed=a.rollSpeed;if(a.dragToLook!==undefined)this.dragToLook=a.dragToLook;if(a.autoForward!==undefined)this.autoForward=
 a.autoForward;if(a.domElement!==undefined)this.domElement=a.domElement}this.useTarget=!1;this.useQuaternion=!0;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0,0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.lastUpdate=-1;this.tdiff=0;this.handleEvent=function(b){if(typeof this[b.type]=="function")this[b.type](b)};this.keydown=function(b){if(!b.altKey){switch(b.keyCode){case 16:this.movementSpeedMultiplier=
 0.1;break;case 87:this.moveState.forward=1;break;case 83:this.moveState.back=1;break;case 65:this.moveState.left=1;break;case 68:this.moveState.right=1;break;case 82:this.moveState.up=1;break;case 70:this.moveState.down=1;break;case 38:this.moveState.pitchUp=1;break;case 40:this.moveState.pitchDown=1;break;case 37:this.moveState.yawLeft=1;break;case 39:this.moveState.yawRight=1;break;case 81:this.moveState.rollLeft=1;break;case 69:this.moveState.rollRight=1}this.updateMovementVector();this.updateRotationVector()}};
 this.keyup=function(b){switch(b.keyCode){case 16:this.movementSpeedMultiplier=1;break;case 87:this.moveState.forward=0;break;case 83:this.moveState.back=0;break;case 65:this.moveState.left=0;break;case 68:this.moveState.right=0;break;case 82:this.moveState.up=0;break;case 70:this.moveState.down=0;break;case 38:this.moveState.pitchUp=0;break;case 40:this.moveState.pitchDown=0;break;case 37:this.moveState.yawLeft=0;break;case 39:this.moveState.yawRight=0;break;case 81:this.moveState.rollLeft=0;break;
@@ -80,7 +80,7 @@ e));b instanceof THREE.Face4&&d.push(new THREE.UV(0.5+Math.atan2(m.position.x,m.
 THREE.Icosahedron=function(a){function d(m,p,o){var y=Math.sqrt(m*m+p*p+o*o);return c.vertices.push(new THREE.Vertex(new THREE.Vector3(m/y,p/y,o/y)))-1}function b(m,p,o,y){y.faces.push(new THREE.Face3(m,p,o))}function e(m,p){var o=c.vertices[m].position,y=c.vertices[p].position;return d((o.x+y.x)/2,(o.y+y.y)/2,(o.z+y.z)/2)}var c=this,f=new THREE.Geometry,g;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;d(-1,a,0);d(1,a,0);d(-1,-a,0);d(1,-a,0);d(0,-1,a);d(0,1,a);d(0,-1,-a);d(0,
 1,-a);d(a,0,-1);d(a,0,1);d(-a,0,-1);d(-a,0,1);b(0,11,5,f);b(0,5,1,f);b(0,1,7,f);b(0,7,10,f);b(0,10,11,f);b(1,5,9,f);b(5,11,4,f);b(11,10,2,f);b(10,7,6,f);b(7,1,8,f);b(3,9,4,f);b(3,4,2,f);b(3,2,6,f);b(3,6,8,f);b(3,8,9,f);b(4,9,5,f);b(2,4,11,f);b(6,2,10,f);b(8,6,7,f);b(9,8,1,f);for(a=0;a<this.subdivisions;a++){g=new THREE.Geometry;for(var h in f.faces){var j=e(f.faces[h].a,f.faces[h].b),l=e(f.faces[h].b,f.faces[h].c),k=e(f.faces[h].c,f.faces[h].a);b(f.faces[h].a,j,k,g);b(f.faces[h].b,l,j,g);b(f.faces[h].c,
 k,l,g);b(j,l,k,g)}f.faces=g.faces}c.faces=f.faces;delete f;delete g;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.Icosahedron.prototype=new THREE.Geometry;THREE.Icosahedron.prototype.constructor=THREE.Icosahedron;
-THREE.Lathe=function(a,d,b){THREE.Geometry.call(this);this.steps=d||12;this.angle=b||2*Math.PI;d=this.angle/this.steps;b=[];for(var e=[],c=[],f=[],g=(new THREE.Matrix4).setRotationZ(d),h=0;h<a.length;h++){this.vertices.push(new THREE.Vertex(a[h]));b[h]=a[h].clone();e[h]=this.vertices.length-1}for(var j=0;j<=this.angle+0.0010;j+=d){for(h=0;h<b.length;h++)if(j<this.angle){b[h]=g.multiplyVector3(b[h].clone());this.vertices.push(new THREE.Vertex(b[h]));c[h]=this.vertices.length-1}else c=f;j==0&&(f=e);
+THREE.Lathe=function(a,d,b){THREE.Geometry.call(this);this.steps=d||12;this.angle=b||2*Math.PI;d=this.angle/this.steps;b=[];for(var e=[],c=[],f=[],g=(new THREE.Matrix4).setRotationZ(d),h=0;h<a.length;h++){this.vertices.push(new THREE.Vertex(a[h]));b[h]=a[h].clone();e[h]=this.vertices.length-1}for(var j=0;j<=this.angle+0.001;j+=d){for(h=0;h<b.length;h++)if(j<this.angle){b[h]=g.multiplyVector3(b[h].clone());this.vertices.push(new THREE.Vertex(b[h]));c[h]=this.vertices.length-1}else c=f;j==0&&(f=e);
 for(h=0;h<e.length-1;h++){this.faces.push(new THREE.Face4(c[h],c[h+1],e[h+1],e[h]));this.faceVertexUvs[0].push([new THREE.UV(1-j/this.angle,h/a.length),new THREE.UV(1-j/this.angle,(h+1)/a.length),new THREE.UV(1-(j-d)/this.angle,(h+1)/a.length),new THREE.UV(1-(j-d)/this.angle,h/a.length)])}e=c;c=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.Lathe.prototype=new THREE.Geometry;THREE.Lathe.prototype.constructor=THREE.Lathe;
 THREE.Plane=function(a,d,b,e){THREE.Geometry.call(this);var c,f=a/2,g=d/2;b=b||1;e=e||1;var h=b+1,j=e+1;a/=b;var l=d/e;for(c=0;c<j;c++)for(d=0;d<h;d++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(d*a-f,-(c*l-g),0)));for(c=0;c<e;c++)for(d=0;d<b;d++){this.faces.push(new THREE.Face4(d+h*c,d+h*(c+1),d+1+h*(c+1),d+1+h*c));this.faceVertexUvs[0].push([new THREE.UV(d/b,c/e),new THREE.UV(d/b,(c+1)/e),new THREE.UV((d+1)/b,(c+1)/e),new THREE.UV((d+1)/b,c/e)])}this.computeCentroids();this.computeFaceNormals()};
 THREE.Plane.prototype=new THREE.Geometry;THREE.Plane.prototype.constructor=THREE.Plane;

+ 1 - 1
build/custom/ThreeSVG.js

@@ -50,7 +50,7 @@ THREE.Quaternion.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;thi
 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);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},
 multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,h=a.x,f=a.y,i=a.z;a=a.w;this.x=b*a+e*h+c*i-d*f;this.y=c*a+e*f+d*h-b*i;this.z=d*a+e*i+b*f-c*h;this.w=e*a-b*h-c*f-d*i;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,h=this.x,f=this.y,i=this.z,g=this.w,j=g*c+f*e-i*d,m=
 g*d+i*c-h*e,k=g*e+h*d-f*c;c=-h*c-f*d-i*e;b.x=j*g+c*-h+m*-i-k*-f;b.y=m*g+c*-f+k*-h-j*-i;b.z=k*g+c*-i+j*-f-m*-h;return b}};
-THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var h=Math.acos(e),f=Math.sqrt(1-e*e);if(Math.abs(f)<0.0010){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);return c}e=Math.sin((1-d)*h)/f;d=Math.sin(d*h)/f;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
+THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var h=Math.acos(e),f=Math.sqrt(1-e*e);if(Math.abs(f)<0.001){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);return c}e=Math.sin((1-d)*h)/f;d=Math.sin(d*h)/f;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
 THREE.Face3=function(a,b,c,d,e,h){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};
 THREE.Face4=function(a,b,c,d,e,h,f){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=f instanceof Array?f:[f];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.set(a||0,b||0)};
 THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};

+ 75 - 75
build/custom/ThreeWebGL.js

@@ -12,7 +12,7 @@ this.length();b>0?this.multiplyScalar(1/b):this.set(0,0,0);return this},setPosit
 1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(b,d,e,g){this.set(b||0,d||0,e||0,g||1)};
 THREE.Vector4.prototype={set:function(b,d,e,g){this.x=b;this.y=d;this.z=e;this.w=g;return this},copy:function(b){this.set(b.x,b.y,b.z,b.w||1);return this},add:function(b,d){this.set(b.x+d.x,b.y+d.y,b.z+d.z,b.w+d.w);return this},addSelf:function(b){this.set(this.x+b.x,this.y+b.y,this.z+b.z,this.w+b.w);return this},sub:function(b,d){this.set(b.x-d.x,b.y-d.y,b.z-d.z,b.w-d.w);return this},subSelf:function(b){this.set(this.x-b.x,this.y-b.y,this.z-b.z,this.w-b.w);return this},multiplyScalar:function(b){this.set(this.x*
 b,this.y*b,this.z*b,this.w*b);return this},divideScalar:function(b){this.set(this.x/b,this.y/b,this.z/b,this.w/b);return this},lerpSelf:function(b,d){this.set(this.x+(b.x-this.x)*d,this.y+(b.y-this.y)*d,this.z+(b.z-this.z)*d,this.w+(b.w-this.w)*d)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(b,d){this.origin=b||new THREE.Vector3;this.direction=d||new THREE.Vector3};
-THREE.Ray.prototype={intersectScene:function(b){var d,e,g=b.objects,h=[];b=0;for(d=g.length;b<d;b++){e=g[b];e instanceof THREE.Mesh&&(h=h.concat(this.intersectObject(e)))}h.sort(function(o,n){return o.distance-n.distance});return h},intersectObject:function(b){function d(U,L,ra,da){da=da.clone().subSelf(L);ra=ra.clone().subSelf(L);var pa=U.clone().subSelf(L);U=da.dot(da);L=da.dot(ra);da=da.dot(pa);var $=ra.dot(ra);ra=ra.dot(pa);pa=1/(U*$-L*L);$=($*da-L*ra)*pa;U=(U*ra-L*da)*pa;return $>0&&U>0&&$+U<
+THREE.Ray.prototype={intersectScene:function(b){var d,e,g=b.objects,h=[];b=0;for(d=g.length;b<d;b++){e=g[b];e instanceof THREE.Mesh&&(h=h.concat(this.intersectObject(e)))}h.sort(function(o,n){return o.distance-n.distance});return h},intersectObject:function(b){function d(V,L,ra,da){da=da.clone().subSelf(L);ra=ra.clone().subSelf(L);var pa=V.clone().subSelf(L);V=da.dot(da);L=da.dot(ra);da=da.dot(pa);var $=ra.dot(ra);ra=ra.dot(pa);pa=1/(V*$-L*L);$=($*da-L*ra)*pa;V=(V*ra-L*da)*pa;return $>0&&V>0&&$+V<
 1}var e,g,h,o,n,q,r,v,E,F,H,I=b.geometry,M=I.vertices,N=[];e=0;for(g=I.faces.length;e<g;e++){h=I.faces[e];F=this.origin.clone();H=this.direction.clone();r=b.matrixWorld;o=r.multiplyVector3(M[h.a].position.clone());n=r.multiplyVector3(M[h.b].position.clone());q=r.multiplyVector3(M[h.c].position.clone());r=h instanceof THREE.Face4?r.multiplyVector3(M[h.d].position.clone()):null;v=b.matrixRotationWorld.multiplyVector3(h.normal.clone());E=H.dot(v);if(b.doubleSided||(b.flipSided?E>0:E<0)){v=v.dot((new THREE.Vector3).sub(o,
 F))/E;F=F.addSelf(H.multiplyScalar(v));if(h instanceof THREE.Face3){if(d(F,o,n,q)){h={distance:this.origin.distanceTo(F),point:F,face:h,object:b};N.push(h)}}else if(h instanceof THREE.Face4&&(d(F,o,n,r)||d(F,n,q,r))){h={distance:this.origin.distanceTo(F),point:F,face:h,object:b};N.push(h)}}}return N}};
 THREE.Rectangle=function(){function b(){o=g-d;n=h-e}var d,e,g,h,o,n,q=!0;this.getX=function(){return d};this.getY=function(){return e};this.getWidth=function(){return o};this.getHeight=function(){return n};this.getLeft=function(){return d};this.getTop=function(){return e};this.getRight=function(){return g};this.getBottom=function(){return h};this.set=function(r,v,E,F){q=!1;d=r;e=v;g=E;h=F;b()};this.addPoint=function(r,v){if(q){q=!1;d=r;e=v;g=r;h=v}else{d=d<r?d:r;e=e<v?e:v;g=g>r?g:r;h=h>v?h:v}b()};
@@ -23,8 +23,8 @@ THREE.Matrix4=function(b,d,e,g,h,o,n,q,r,v,E,F,H,I,M,N){this.set(b||1,d||0,e||0,
 THREE.Matrix4.prototype={set:function(b,d,e,g,h,o,n,q,r,v,E,F,H,I,M,N){this.n11=b;this.n12=d;this.n13=e;this.n14=g;this.n21=h;this.n22=o;this.n23=n;this.n24=q;this.n31=r;this.n32=v;this.n33=E;this.n34=F;this.n41=H;this.n42=I;this.n43=M;this.n44=N;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(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,d,e){var g=THREE.Matrix4.__v1,
 h=THREE.Matrix4.__v2,o=THREE.Matrix4.__v3;o.sub(b,d).normalize();if(o.length()===0)o.z=1;g.cross(e,o).normalize();if(g.length()===0){o.x+=1.0E-4;g.cross(e,o).normalize()}h.cross(o,g).normalize();this.n11=g.x;this.n12=h.x;this.n13=o.x;this.n21=g.y;this.n22=h.y;this.n23=o.y;this.n31=g.z;this.n32=h.z;this.n33=o.z;return this},multiplyVector3:function(b){var d=b.x,e=b.y,g=b.z,h=1/(this.n41*d+this.n42*e+this.n43*g+this.n44);b.x=(this.n11*d+this.n12*e+this.n13*g+this.n14)*h;b.y=(this.n21*d+this.n22*e+this.n23*
 g+this.n24)*h;b.z=(this.n31*d+this.n32*e+this.n33*g+this.n34)*h;return b},multiplyVector4:function(b){var d=b.x,e=b.y,g=b.z,h=b.w;b.x=this.n11*d+this.n12*e+this.n13*g+this.n14*h;b.y=this.n21*d+this.n22*e+this.n23*g+this.n24*h;b.z=this.n31*d+this.n32*e+this.n33*g+this.n34*h;b.w=this.n41*d+this.n42*e+this.n43*g+this.n44*h;return b},rotateAxis:function(b){var d=b.x,e=b.y,g=b.z;b.x=d*this.n11+e*this.n12+g*this.n13;b.y=d*this.n21+e*this.n22+g*this.n23;b.z=d*this.n31+e*this.n32+g*this.n33;b.normalize();
-return b},crossVector:function(b){var d=new THREE.Vector4;d.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;d.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;d.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;d.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return d},multiply:function(b,d){var e=b.n11,g=b.n12,h=b.n13,o=b.n14,n=b.n21,q=b.n22,r=b.n23,v=b.n24,E=b.n31,F=b.n32,H=b.n33,I=b.n34,M=b.n41,N=b.n42,U=b.n43,L=b.n44,ra=d.n11,da=d.n12,pa=d.n13,$=d.n14,K=d.n21,Ia=d.n22,
-ca=d.n23,Fa=d.n24,fa=d.n31,V=d.n32,c=d.n33,ga=d.n34;this.n11=e*ra+g*K+h*fa;this.n12=e*da+g*Ia+h*V;this.n13=e*pa+g*ca+h*c;this.n14=e*$+g*Fa+h*ga+o;this.n21=n*ra+q*K+r*fa;this.n22=n*da+q*Ia+r*V;this.n23=n*pa+q*ca+r*c;this.n24=n*$+q*Fa+r*ga+v;this.n31=E*ra+F*K+H*fa;this.n32=E*da+F*Ia+H*V;this.n33=E*pa+F*ca+H*c;this.n34=E*$+F*Fa+H*ga+I;this.n41=M*ra+N*K+U*fa;this.n42=M*da+N*Ia+U*V;this.n43=M*pa+N*ca+U*c;this.n44=M*$+N*Fa+U*ga+L;return this},multiplyToArray:function(b,d,e){this.multiply(b,d);e[0]=this.n11;
+return b},crossVector:function(b){var d=new THREE.Vector4;d.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;d.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;d.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;d.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return d},multiply:function(b,d){var e=b.n11,g=b.n12,h=b.n13,o=b.n14,n=b.n21,q=b.n22,r=b.n23,v=b.n24,E=b.n31,F=b.n32,H=b.n33,I=b.n34,M=b.n41,N=b.n42,V=b.n43,L=b.n44,ra=d.n11,da=d.n12,pa=d.n13,$=d.n14,K=d.n21,Ia=d.n22,
+ca=d.n23,Fa=d.n24,fa=d.n31,R=d.n32,c=d.n33,ga=d.n34;this.n11=e*ra+g*K+h*fa;this.n12=e*da+g*Ia+h*R;this.n13=e*pa+g*ca+h*c;this.n14=e*$+g*Fa+h*ga+o;this.n21=n*ra+q*K+r*fa;this.n22=n*da+q*Ia+r*R;this.n23=n*pa+q*ca+r*c;this.n24=n*$+q*Fa+r*ga+v;this.n31=E*ra+F*K+H*fa;this.n32=E*da+F*Ia+H*R;this.n33=E*pa+F*ca+H*c;this.n34=E*$+F*Fa+H*ga+I;this.n41=M*ra+N*K+V*fa;this.n42=M*da+N*Ia+V*R;this.n43=M*pa+N*ca+V*c;this.n44=M*$+N*Fa+V*ga+L;return this},multiplyToArray:function(b,d,e){this.multiply(b,d);e[0]=this.n11;
 e[1]=this.n21;e[2]=this.n31;e[3]=this.n41;e[4]=this.n12;e[5]=this.n22;e[6]=this.n32;e[7]=this.n42;e[8]=this.n13;e[9]=this.n23;e[10]=this.n33;e[11]=this.n43;e[12]=this.n14;e[13]=this.n24;e[14]=this.n34;e[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=b;this.n23*=b;this.n24*=b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=
 b;return this},determinant:function(){var b=this.n11,d=this.n12,e=this.n13,g=this.n14,h=this.n21,o=this.n22,n=this.n23,q=this.n24,r=this.n31,v=this.n32,E=this.n33,F=this.n34,H=this.n41,I=this.n42,M=this.n43,N=this.n44;return g*n*v*H-e*q*v*H-g*o*E*H+d*q*E*H+e*o*F*H-d*n*F*H-g*n*r*I+e*q*r*I+g*h*E*I-b*q*E*I-e*h*F*I+b*n*F*I+g*o*r*M-d*q*r*M-g*h*v*M+b*q*v*M+d*h*F*M-b*o*F*M-e*o*r*N+d*n*r*N+e*h*v*N-b*n*v*N-d*h*E*N+b*o*E*N},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=
 this.n13;this.n13=b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32;b.n33=this.n33;b.n34=this.n34;b.n41=this.n41;b.n42=this.n42;b.n43=this.n43;b.n44=this.n44;return b},flatten:function(){this.flat[0]=
@@ -35,8 +35,8 @@ b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=t
 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(b){var d=b.x,e=b.y,g=b.z;b=Math.cos(d);d=Math.sin(d);var h=Math.cos(e);e=Math.sin(e);var o=Math.cos(g);g=Math.sin(g);var n=b*e,q=d*e;this.n11=h*o;this.n12=-h*g;this.n13=e;this.n21=q*o+b*g;this.n22=-q*g+b*o;this.n23=-d*h;this.n31=-n*o+d*g;this.n32=n*g+
 d*o;this.n33=b*h;return this},setRotationFromQuaternion:function(b){var d=b.x,e=b.y,g=b.z,h=b.w,o=d+d,n=e+e,q=g+g;b=d*o;var r=d*n;d*=q;var v=e*n;e*=q;g*=q;o*=h;n*=h;h*=q;this.n11=1-(v+g);this.n12=r-h;this.n13=d+n;this.n21=r+h;this.n22=1-(b+g);this.n23=e-o;this.n31=d-n;this.n32=e+o;this.n33=1-(b+v);return this},scale:function(b){var d=b.x,e=b.y;b=b.z;this.n11*=d;this.n12*=e;this.n13*=b;this.n21*=d;this.n22*=e;this.n23*=b;this.n31*=d;this.n32*=e;this.n33*=b;this.n41*=d;this.n42*=e;this.n43*=b;return this},
 extractPosition:function(b){this.n14=b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,d){var e=1/d.x,g=1/d.y,h=1/d.z;this.n11=b.n11*e;this.n21=b.n21*e;this.n31=b.n31*e;this.n12=b.n12*g;this.n22=b.n22*g;this.n32=b.n32*g;this.n13=b.n13*h;this.n23=b.n23*h;this.n33=b.n33*h}};
-THREE.Matrix4.makeInvert=function(b,d){var e=b.n11,g=b.n12,h=b.n13,o=b.n14,n=b.n21,q=b.n22,r=b.n23,v=b.n24,E=b.n31,F=b.n32,H=b.n33,I=b.n34,M=b.n41,N=b.n42,U=b.n43,L=b.n44;d===undefined&&(d=new THREE.Matrix4);d.n11=r*I*N-v*H*N+v*F*U-q*I*U-r*F*L+q*H*L;d.n12=o*H*N-h*I*N-o*F*U+g*I*U+h*F*L-g*H*L;d.n13=h*v*N-o*r*N+o*q*U-g*v*U-h*q*L+g*r*L;d.n14=o*r*F-h*v*F-o*q*H+g*v*H+h*q*I-g*r*I;d.n21=v*H*M-r*I*M-v*E*U+n*I*U+r*E*L-n*H*L;d.n22=h*I*M-o*H*M+o*E*U-e*I*U-h*E*L+e*H*L;d.n23=o*r*M-h*v*M-o*n*U+e*v*U+h*n*L-e*r*L;
-d.n24=h*v*E-o*r*E+o*n*H-e*v*H-h*n*I+e*r*I;d.n31=q*I*M-v*F*M+v*E*N-n*I*N-q*E*L+n*F*L;d.n32=o*F*M-g*I*M-o*E*N+e*I*N+g*E*L-e*F*L;d.n33=h*v*M-o*q*M+o*n*N-e*v*N-g*n*L+e*q*L;d.n34=o*q*E-g*v*E-o*n*F+e*v*F+g*n*I-e*q*I;d.n41=r*F*M-q*H*M-r*E*N+n*H*N+q*E*U-n*F*U;d.n42=g*H*M-h*F*M+h*E*N-e*H*N-g*E*U+e*F*U;d.n43=h*q*M-g*r*M-h*n*N+e*r*N+g*n*U-e*q*U;d.n44=g*r*E-h*q*E+h*n*F-e*r*F-g*n*H+e*q*H;d.multiplyScalar(1/b.determinant());return d};
+THREE.Matrix4.makeInvert=function(b,d){var e=b.n11,g=b.n12,h=b.n13,o=b.n14,n=b.n21,q=b.n22,r=b.n23,v=b.n24,E=b.n31,F=b.n32,H=b.n33,I=b.n34,M=b.n41,N=b.n42,V=b.n43,L=b.n44;d===undefined&&(d=new THREE.Matrix4);d.n11=r*I*N-v*H*N+v*F*V-q*I*V-r*F*L+q*H*L;d.n12=o*H*N-h*I*N-o*F*V+g*I*V+h*F*L-g*H*L;d.n13=h*v*N-o*r*N+o*q*V-g*v*V-h*q*L+g*r*L;d.n14=o*r*F-h*v*F-o*q*H+g*v*H+h*q*I-g*r*I;d.n21=v*H*M-r*I*M-v*E*V+n*I*V+r*E*L-n*H*L;d.n22=h*I*M-o*H*M+o*E*V-e*I*V-h*E*L+e*H*L;d.n23=o*r*M-h*v*M-o*n*V+e*v*V+h*n*L-e*r*L;
+d.n24=h*v*E-o*r*E+o*n*H-e*v*H-h*n*I+e*r*I;d.n31=q*I*M-v*F*M+v*E*N-n*I*N-q*E*L+n*F*L;d.n32=o*F*M-g*I*M-o*E*N+e*I*N+g*E*L-e*F*L;d.n33=h*v*M-o*q*M+o*n*N-e*v*N-g*n*L+e*q*L;d.n34=o*q*E-g*v*E-o*n*F+e*v*F+g*n*I-e*q*I;d.n41=r*F*M-q*H*M-r*E*N+n*H*N+q*E*V-n*F*V;d.n42=g*H*M-h*F*M+h*E*N-e*H*N-g*E*V+e*F*V;d.n43=h*q*M-g*r*M-h*n*N+e*r*N+g*n*V-e*q*V;d.n44=g*r*E-h*q*E+h*n*F-e*r*F-g*n*H+e*q*H;d.multiplyScalar(1/b.determinant());return d};
 THREE.Matrix4.makeInvert3x3=function(b){var d=b.m33,e=d.m,g=b.n33*b.n22-b.n32*b.n23,h=-b.n33*b.n21+b.n31*b.n23,o=b.n32*b.n21-b.n31*b.n22,n=-b.n33*b.n12+b.n32*b.n13,q=b.n33*b.n11-b.n31*b.n13,r=-b.n32*b.n11+b.n31*b.n12,v=b.n23*b.n12-b.n22*b.n13,E=-b.n23*b.n11+b.n21*b.n13,F=b.n22*b.n11-b.n21*b.n12;b=b.n11*g+b.n21*n+b.n31*v;if(b==0)throw"matrix not invertible";b=1/b;e[0]=b*g;e[1]=b*h;e[2]=b*o;e[3]=b*n;e[4]=b*q;e[5]=b*r;e[6]=b*v;e[7]=b*E;e[8]=b*F;return d};
 THREE.Matrix4.makeFrustum=function(b,d,e,g,h,o){var n;n=new THREE.Matrix4;n.n11=2*h/(d-b);n.n12=0;n.n13=(d+b)/(d-b);n.n14=0;n.n21=0;n.n22=2*h/(g-e);n.n23=(g+e)/(g-e);n.n24=0;n.n31=0;n.n32=0;n.n33=-(o+h)/(o-h);n.n34=-2*o*h/(o-h);n.n41=0;n.n42=0;n.n43=-1;n.n44=0;return n};THREE.Matrix4.makePerspective=function(b,d,e,g){var h;b=e*Math.tan(b*Math.PI/360);h=-b;return THREE.Matrix4.makeFrustum(h*d,b*d,h,b,e,g)};
 THREE.Matrix4.makeOrtho=function(b,d,e,g,h,o){var n,q,r,v;n=new THREE.Matrix4;q=d-b;r=e-g;v=o-h;n.n11=2/q;n.n12=0;n.n13=0;n.n14=-((d+b)/q);n.n21=0;n.n22=2/r;n.n23=0;n.n24=-((e+g)/r);n.n31=0;n.n32=0;n.n33=-2/v;n.n34=-((o+h)/v);n.n41=0;n.n42=0;n.n43=0;n.n44=1;return n};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
@@ -50,7 +50,7 @@ THREE.Quaternion.prototype={set:function(b,d,e,g){this.x=b;this.y=d;this.z=e;thi
 b.y*g;this.z=b.z*g;this.w=Math.cos(e);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 b=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(b==0)this.w=this.z=this.y=this.x=0;else{b=1/b;this.x*=b;this.y*=b;this.z*=b;this.w*=b}return this},
 multiplySelf:function(b){var d=this.x,e=this.y,g=this.z,h=this.w,o=b.x,n=b.y,q=b.z;b=b.w;this.x=d*b+h*o+e*q-g*n;this.y=e*b+h*n+g*o-d*q;this.z=g*b+h*q+d*n-e*o;this.w=h*b-d*o-e*n-g*q;return this},multiply:function(b,d){this.x=b.x*d.w+b.y*d.z-b.z*d.y+b.w*d.x;this.y=-b.x*d.z+b.y*d.w+b.z*d.x+b.w*d.y;this.z=b.x*d.y-b.y*d.x+b.z*d.w+b.w*d.z;this.w=-b.x*d.x-b.y*d.y-b.z*d.z+b.w*d.w;return this},multiplyVector3:function(b,d){d||(d=b);var e=b.x,g=b.y,h=b.z,o=this.x,n=this.y,q=this.z,r=this.w,v=r*e+n*h-q*g,E=
 r*g+q*e-o*h,F=r*h+o*g-n*e;e=-o*e-n*g-q*h;d.x=v*r+e*-o+E*-q-F*-n;d.y=E*r+e*-n+F*-o-v*-q;d.z=F*r+e*-q+v*-n-E*-o;return d}};
-THREE.Quaternion.slerp=function(b,d,e,g){var h=b.w*d.w+b.x*d.x+b.y*d.y+b.z*d.z;if(Math.abs(h)>=1){e.w=b.w;e.x=b.x;e.y=b.y;e.z=b.z;return e}var o=Math.acos(h),n=Math.sqrt(1-h*h);if(Math.abs(n)<0.0010){e.w=0.5*(b.w+d.w);e.x=0.5*(b.x+d.x);e.y=0.5*(b.y+d.y);e.z=0.5*(b.z+d.z);return e}h=Math.sin((1-g)*o)/n;g=Math.sin(g*o)/n;e.w=b.w*h+d.w*g;e.x=b.x*h+d.x*g;e.y=b.y*h+d.y*g;e.z=b.z*h+d.z*g;return e};THREE.Vertex=function(b){this.position=b||new THREE.Vector3};
+THREE.Quaternion.slerp=function(b,d,e,g){var h=b.w*d.w+b.x*d.x+b.y*d.y+b.z*d.z;if(Math.abs(h)>=1){e.w=b.w;e.x=b.x;e.y=b.y;e.z=b.z;return e}var o=Math.acos(h),n=Math.sqrt(1-h*h);if(Math.abs(n)<0.001){e.w=0.5*(b.w+d.w);e.x=0.5*(b.x+d.x);e.y=0.5*(b.y+d.y);e.z=0.5*(b.z+d.z);return e}h=Math.sin((1-g)*o)/n;g=Math.sin(g*o)/n;e.w=b.w*h+d.w*g;e.x=b.x*h+d.x*g;e.y=b.y*h+d.y*g;e.z=b.z*h+d.z*g;return e};THREE.Vertex=function(b){this.position=b||new THREE.Vector3};
 THREE.Face3=function(b,d,e,g,h,o){this.a=b;this.b=d;this.c=e;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=o instanceof Array?o:[o];this.centroid=new THREE.Vector3};
 THREE.Face4=function(b,d,e,g,h,o,n){this.a=b;this.b=d;this.c=e;this.d=g;this.normal=h instanceof THREE.Vector3?h:new THREE.Vector3;this.vertexNormals=h instanceof Array?h:[];this.color=o instanceof THREE.Color?o:new THREE.Color;this.vertexColors=o instanceof Array?o:[];this.vertexTangents=[];this.materials=n instanceof Array?n:[n];this.centroid=new THREE.Vector3};THREE.UV=function(b,d){this.set(b||0,d||0)};
 THREE.UV.prototype={set:function(b,d){this.u=b;this.v=d;return this},copy:function(b){this.set(b.u,b.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
@@ -58,8 +58,8 @@ THREE.Geometry.prototype={computeCentroids:function(){var b,d,e;b=0;for(d=this.f
 e.centroid.addSelf(this.vertices[e.d].position);e.centroid.divideScalar(4)}}},computeFaceNormals:function(b){var d,e,g,h,o,n,q=new THREE.Vector3,r=new THREE.Vector3;g=0;for(h=this.faces.length;g<h;g++){o=this.faces[g];if(b&&o.vertexNormals.length){q.set(0,0,0);d=0;for(e=o.vertexNormals.length;d<e;d++)q.addSelf(o.vertexNormals[d]);q.divideScalar(3)}else{d=this.vertices[o.a];e=this.vertices[o.b];n=this.vertices[o.c];q.sub(n.position,e.position);r.sub(d.position,e.position);q.crossSelf(r)}q.isZero()||
 q.normalize();o.normal.copy(q)}},computeVertexNormals:function(){var b,d,e,g;if(this.__tmpVertices==undefined){g=this.__tmpVertices=Array(this.vertices.length);b=0;for(d=this.vertices.length;b<d;b++)g[b]=new THREE.Vector3;b=0;for(d=this.faces.length;b<d;b++){e=this.faces[b];if(e instanceof THREE.Face3)e.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(e instanceof THREE.Face4)e.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{g=
 this.__tmpVertices;b=0;for(d=this.vertices.length;b<d;b++)g[b].set(0,0,0)}b=0;for(d=this.faces.length;b<d;b++){e=this.faces[b];if(e instanceof THREE.Face3){g[e.a].addSelf(e.normal);g[e.b].addSelf(e.normal);g[e.c].addSelf(e.normal)}else if(e instanceof THREE.Face4){g[e.a].addSelf(e.normal);g[e.b].addSelf(e.normal);g[e.c].addSelf(e.normal);g[e.d].addSelf(e.normal)}}b=0;for(d=this.vertices.length;b<d;b++)g[b].normalize();b=0;for(d=this.faces.length;b<d;b++){e=this.faces[b];if(e instanceof THREE.Face3){e.vertexNormals[0].copy(g[e.a]);
-e.vertexNormals[1].copy(g[e.b]);e.vertexNormals[2].copy(g[e.c])}else if(e instanceof THREE.Face4){e.vertexNormals[0].copy(g[e.a]);e.vertexNormals[1].copy(g[e.b]);e.vertexNormals[2].copy(g[e.c]);e.vertexNormals[3].copy(g[e.d])}}},computeTangents:function(){function b(Y,na,oa,ha,Z,va,qa){q=Y.vertices[na].position;r=Y.vertices[oa].position;v=Y.vertices[ha].position;E=n[Z];F=n[va];H=n[qa];I=r.x-q.x;M=v.x-q.x;N=r.y-q.y;U=v.y-q.y;L=r.z-q.z;ra=v.z-q.z;da=F.u-E.u;pa=H.u-E.u;$=F.v-E.v;K=H.v-E.v;Ia=1/(da*K-
-pa*$);V.set((K*I-$*M)*Ia,(K*N-$*U)*Ia,(K*L-$*ra)*Ia);c.set((da*M-pa*I)*Ia,(da*U-pa*N)*Ia,(da*ra-pa*L)*Ia);Fa[na].addSelf(V);Fa[oa].addSelf(V);Fa[ha].addSelf(V);fa[na].addSelf(c);fa[oa].addSelf(c);fa[ha].addSelf(c)}var d,e,g,h,o,n,q,r,v,E,F,H,I,M,N,U,L,ra,da,pa,$,K,Ia,ca,Fa=[],fa=[],V=new THREE.Vector3,c=new THREE.Vector3,ga=new THREE.Vector3,xa=new THREE.Vector3,sa=new THREE.Vector3;d=0;for(e=this.vertices.length;d<e;d++){Fa[d]=new THREE.Vector3;fa[d]=new THREE.Vector3}d=0;for(e=this.faces.length;d<
+e.vertexNormals[1].copy(g[e.b]);e.vertexNormals[2].copy(g[e.c])}else if(e instanceof THREE.Face4){e.vertexNormals[0].copy(g[e.a]);e.vertexNormals[1].copy(g[e.b]);e.vertexNormals[2].copy(g[e.c]);e.vertexNormals[3].copy(g[e.d])}}},computeTangents:function(){function b(Y,na,oa,ha,Z,va,qa){q=Y.vertices[na].position;r=Y.vertices[oa].position;v=Y.vertices[ha].position;E=n[Z];F=n[va];H=n[qa];I=r.x-q.x;M=v.x-q.x;N=r.y-q.y;V=v.y-q.y;L=r.z-q.z;ra=v.z-q.z;da=F.u-E.u;pa=H.u-E.u;$=F.v-E.v;K=H.v-E.v;Ia=1/(da*K-
+pa*$);R.set((K*I-$*M)*Ia,(K*N-$*V)*Ia,(K*L-$*ra)*Ia);c.set((da*M-pa*I)*Ia,(da*V-pa*N)*Ia,(da*ra-pa*L)*Ia);Fa[na].addSelf(R);Fa[oa].addSelf(R);Fa[ha].addSelf(R);fa[na].addSelf(c);fa[oa].addSelf(c);fa[ha].addSelf(c)}var d,e,g,h,o,n,q,r,v,E,F,H,I,M,N,V,L,ra,da,pa,$,K,Ia,ca,Fa=[],fa=[],R=new THREE.Vector3,c=new THREE.Vector3,ga=new THREE.Vector3,xa=new THREE.Vector3,sa=new THREE.Vector3;d=0;for(e=this.vertices.length;d<e;d++){Fa[d]=new THREE.Vector3;fa[d]=new THREE.Vector3}d=0;for(e=this.faces.length;d<
 e;d++){o=this.faces[d];n=this.faceVertexUvs[0][d];if(o instanceof THREE.Face3)b(this,o.a,o.b,o.c,0,1,2);else if(o instanceof THREE.Face4){b(this,o.a,o.b,o.c,0,1,2);b(this,o.a,o.b,o.d,0,1,3)}}var ya=["a","b","c","d"];d=0;for(e=this.faces.length;d<e;d++){o=this.faces[d];for(g=0;g<o.vertexNormals.length;g++){sa.copy(o.vertexNormals[g]);h=o[ya[g]];ca=Fa[h];ga.copy(ca);ga.subSelf(sa.multiplyScalar(sa.dot(ca))).normalize();xa.cross(o.vertexNormals[g],ca);h=xa.dot(fa[h]);h=h<0?-1:1;o.vertexTangents[g]=new THREE.Vector4(ga.x,
 ga.y,ga.z,h)}}this.hasTangents=!0},computeBoundingBox:function(){var b;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 d=1,e=this.vertices.length;d<e;d++){b=this.vertices[d];if(b.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=b.position.x;else if(b.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=b.position.x;
 if(b.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=b.position.y;else if(b.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=b.position.y;if(b.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=b.position.z;else if(b.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=this.boundingSphere===null?0:this.boundingSphere.radius,d=0,e=this.vertices.length;d<e;d++)b=Math.max(b,this.vertices[d].position.length());this.boundingSphere=
@@ -118,26 +118,26 @@ THREE.LOD.prototype.supr=THREE.Object3D.prototype;THREE.LOD.prototype.add=functi
 THREE.LOD.prototype.update=function(b,d,e){this.matrixAutoUpdate&&(d|=this.updateMatrix());if(d||this.matrixWorldNeedsUpdate){b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;d=!0}if(this.LODs.length>1){b=e.matrixWorldInverse;b=-(b.n31*this.position.x+b.n32*this.position.y+b.n33*this.position.z+b.n34);this.LODs[0].object3D.visible=!0;for(var g=1;g<this.LODs.length;g++)if(b>=this.LODs[g].visibleAtDistance){this.LODs[g-1].object3D.visible=
 !1;this.LODs[g].object3D.visible=!0}else break;for(;g<this.LODs.length;g++)this.LODs[g].object3D.visible=!1}for(b=0;b<this.children.length;b++)this.children[b].update(this.matrixWorld,d,e)};THREE.ShadowVolume=function(b,d){if(b instanceof THREE.Mesh){THREE.Mesh.call(this,b.geometry,d?[new THREE.ShadowVolumeDynamicMaterial]:[new THREE.ShadowVolumeDynamicMaterial]);b.addChild(this)}else THREE.Mesh.call(this,b,d?[new THREE.ShadowVolumeDynamicMaterial]:[new THREE.ShadowVolumeDynamicMaterial]);this.calculateShadowVolumeGeometry()};
 THREE.ShadowVolume.prototype=new THREE.Mesh;THREE.ShadowVolume.prototype.constructor=THREE.ShadowVolume;THREE.ShadowVolume.prototype.supr=THREE.Mesh.prototype;
-THREE.ShadowVolume.prototype.calculateShadowVolumeGeometry=function(){if(this.geometry.edges&&this.geometry.edges.length){var b,d,e,g,h,o,n,q,r,v,E,F,H,I,M=new THREE.Geometry;M.vertices=this.geometry.vertices;g=M.faces=this.geometry.faces;var N=M.egdes=this.geometry.edges,U=M.edgeFaces=[];h=0;var L=[];b=0;for(d=g.length;b<d;b++){e=g[b];L.push(h);h+=e instanceof THREE.Face3?3:4;e.vertexNormals[0]=e.normal;e.vertexNormals[1]=e.normal;e.vertexNormals[2]=e.normal;if(e instanceof THREE.Face4)e.vertexNormals[3]=
+THREE.ShadowVolume.prototype.calculateShadowVolumeGeometry=function(){if(this.geometry.edges&&this.geometry.edges.length){var b,d,e,g,h,o,n,q,r,v,E,F,H,I,M=new THREE.Geometry;M.vertices=this.geometry.vertices;g=M.faces=this.geometry.faces;var N=M.egdes=this.geometry.edges,V=M.edgeFaces=[];h=0;var L=[];b=0;for(d=g.length;b<d;b++){e=g[b];L.push(h);h+=e instanceof THREE.Face3?3:4;e.vertexNormals[0]=e.normal;e.vertexNormals[1]=e.normal;e.vertexNormals[2]=e.normal;if(e instanceof THREE.Face4)e.vertexNormals[3]=
 e.normal}b=0;for(d=N.length;b<d;b++){q=N[b];e=q.faces[0];g=q.faces[1];h=q.faceIndices[0];o=q.faceIndices[1];n=q.vertexIndices[0];q=q.vertexIndices[1];if(e.a===n){r="a";E=L[h]+0}else if(e.b===n){r="b";E=L[h]+1}else if(e.c===n){r="c";E=L[h]+2}else if(e.d===n){r="d";E=L[h]+3}if(e.a===q){r+="a";F=L[h]+0}else if(e.b===q){r+="b";F=L[h]+1}else if(e.c===q){r+="c";F=L[h]+2}else if(e.d===q){r+="d";F=L[h]+3}if(g.a===n){v="a";H=L[o]+0}else if(g.b===n){v="b";H=L[o]+1}else if(g.c===n){v="c";H=L[o]+2}else if(g.d===
-n){v="d";H=L[o]+3}if(g.a===q){v+="a";I=L[o]+0}else if(g.b===q){v+="b";I=L[o]+1}else if(g.c===q){v+="c";I=L[o]+2}else if(g.d===q){v+="d";I=L[o]+3}if(r==="ac"||r==="ad"||r==="ca"||r==="da"){if(E>F){e=E;E=F;F=e}}else if(E<F){e=E;E=F;F=e}if(v==="ac"||v==="ad"||v==="ca"||v==="da"){if(H>I){e=H;H=I;I=e}}else if(H<I){e=H;H=I;I=e}e=new THREE.Face4(E,F,H,I);e.normal.set(1,0,0);U.push(e)}this.geometry=M}else this.calculateShadowVolumeGeometryWithoutEdgeInfo(this.geometry)};
+n){v="d";H=L[o]+3}if(g.a===q){v+="a";I=L[o]+0}else if(g.b===q){v+="b";I=L[o]+1}else if(g.c===q){v+="c";I=L[o]+2}else if(g.d===q){v+="d";I=L[o]+3}if(r==="ac"||r==="ad"||r==="ca"||r==="da"){if(E>F){e=E;E=F;F=e}}else if(E<F){e=E;E=F;F=e}if(v==="ac"||v==="ad"||v==="ca"||v==="da"){if(H>I){e=H;H=I;I=e}}else if(H<I){e=H;H=I;I=e}e=new THREE.Face4(E,F,H,I);e.normal.set(1,0,0);V.push(e)}this.geometry=M}else this.calculateShadowVolumeGeometryWithoutEdgeInfo(this.geometry)};
 THREE.ShadowVolume.prototype.calculateShadowVolumeGeometryWithoutEdgeInfo=function(b){this.geometry=new THREE.Geometry;this.geometry.boundingSphere=b.boundingSphere;this.geometry.edgeFaces=[];var d=this.geometry.vertices,e=this.geometry.faces,g=this.geometry.edgeFaces,h=b.faces;b=b.vertices;var o=h.length,n,q,r,v,E,F=["a","b","c","d"];for(r=0;r<o;r++){q=d.length;n=h[r];if(n instanceof THREE.Face4){v=4;q=new THREE.Face4(q,q+1,q+2,q+3)}else{v=3;q=new THREE.Face3(q,q+1,q+2)}q.normal.copy(n.normal);e.push(q);
 for(q=0;q<v;q++){E=b[n[F[q]]];d.push(new THREE.Vertex(E.position.clone()))}}for(o=0;o<h.length-1;o++){b=e[o];for(n=o+1;n<h.length;n++){q=e[n];q=this.facesShareEdge(d,b,q);if(q!==undefined){q=new THREE.Face4(q.indices[0],q.indices[3],q.indices[2],q.indices[1]);q.normal.set(1,0,0);g.push(q)}}}};
-THREE.ShadowVolume.prototype.facesShareEdge=function(b,d,e){var g,h,o,n,q,r,v,E,F,H,I,M,N,U=0,L=["a","b","c","d"];g=d instanceof THREE.Face4?4:3;h=e instanceof THREE.Face4?4:3;for(M=0;M<g;M++){o=d[L[M]];q=b[o];for(N=0;N<h;N++){n=e[L[N]];r=b[n];if(Math.abs(q.position.x-r.position.x)<1.0E-4&&Math.abs(q.position.y-r.position.y)<1.0E-4&&Math.abs(q.position.z-r.position.z)<1.0E-4){U++;if(U===1){v=q;E=r;F=o;H=n;I=L[M]}if(U===2){I+=L[M];return I==="ad"||I==="ac"?{faces:[d,e],vertices:[v,E,r,q],indices:[F,
+THREE.ShadowVolume.prototype.facesShareEdge=function(b,d,e){var g,h,o,n,q,r,v,E,F,H,I,M,N,V=0,L=["a","b","c","d"];g=d instanceof THREE.Face4?4:3;h=e instanceof THREE.Face4?4:3;for(M=0;M<g;M++){o=d[L[M]];q=b[o];for(N=0;N<h;N++){n=e[L[N]];r=b[n];if(Math.abs(q.position.x-r.position.x)<1.0E-4&&Math.abs(q.position.y-r.position.y)<1.0E-4&&Math.abs(q.position.z-r.position.z)<1.0E-4){V++;if(V===1){v=q;E=r;F=o;H=n;I=L[M]}if(V===2){I+=L[M];return I==="ad"||I==="ac"?{faces:[d,e],vertices:[v,E,r,q],indices:[F,
 H,n,o],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[d,e],vertices:[v,q,r,E],indices:[F,o,n,H],vertexTypes:[1,1,2,2],extrudable:!0}}}}}};THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.collisions=this.fog=null;this.objects=[];this.lights=[];this.sounds=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;
 THREE.Scene.prototype.addChild=function(b){this.supr.addChild.call(this,b);this.addChildRecurse(b)};THREE.Scene.prototype.addChildRecurse=function(b){if(b instanceof THREE.Light)this.lights.indexOf(b)===-1&&this.lights.push(b);else if(b instanceof THREE.Sound)this.sounds.indexOf(b)===-1&&this.sounds.push(b);else if(!(b instanceof THREE.Camera||b instanceof THREE.Bone)&&this.objects.indexOf(b)===-1){this.objects.push(b);this.__objectsAdded.push(b)}for(var d=0;d<b.children.length;d++)this.addChildRecurse(b.children[d])};
 THREE.Scene.prototype.removeChild=function(b){this.supr.removeChild.call(this,b);this.removeChildRecurse(b)};THREE.Scene.prototype.removeChildRecurse=function(b){if(b instanceof THREE.Light){var d=this.lights.indexOf(b);d!==-1&&this.lights.splice(d,1)}else if(b instanceof THREE.Sound){d=this.sounds.indexOf(b);d!==-1&&this.sounds.splice(d,1)}else if(!(b instanceof THREE.Camera)){d=this.objects.indexOf(b);if(d!==-1){this.objects.splice(d,1);this.__objectsRemoved.push(b)}}for(d=0;d<b.children.length;d++)this.removeChildRecurse(b.children[d])};
 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.Fog=function(b,d,e){this.color=new THREE.Color(b);this.near=d||1;this.far=e||1E3};THREE.FogExp2=function(b,d){this.color=new THREE.Color(b);this.density=d!==undefined?d:2.5E-4};
-THREE.Projector=function(){function b(){var V=r[q]=r[q]||new THREE.RenderableVertex;q++;return V}function d(V,c){return c.z-V.z}function e(V,c){var ga=0,xa=1,sa=V.z+V.w,ya=c.z+c.w,Y=-V.z+V.w,na=-c.z+c.w;if(sa>=0&&ya>=0&&Y>=0&&na>=0)return!0;else if(sa<0&&ya<0||Y<0&&na<0)return!1;else{if(sa<0)ga=Math.max(ga,sa/(sa-ya));else ya<0&&(xa=Math.min(xa,sa/(sa-ya)));if(Y<0)ga=Math.max(ga,Y/(Y-na));else na<0&&(xa=Math.min(xa,Y/(Y-na)));if(xa<ga)return!1;else{V.lerpSelf(c,ga);c.lerpSelf(V,1-xa);return!0}}}var g,
-h,o=[],n,q,r=[],v,E,F=[],H,I=[],M,N,U=[],L,ra,da=[],pa=new THREE.Vector4,$=new THREE.Vector4,K=new THREE.Matrix4,Ia=new THREE.Matrix4,ca=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Fa=new THREE.Vector4,fa=new THREE.Vector4;this.projectVector=function(V,c){K.multiply(c.projectionMatrix,c.matrixWorldInverse);K.multiplyVector3(V);return V};this.unprojectVector=function(V,c){K.multiply(c.matrixWorld,THREE.Matrix4.makeInvert(c.projectionMatrix));
-K.multiplyVector3(V);return V};this.projectObjects=function(V,c,ga){c=[];var xa,sa,ya;h=0;sa=V.objects;V=0;for(xa=sa.length;V<xa;V++){ya=sa[V];var Y;if(!(Y=!ya.visible))if(Y=ya instanceof THREE.Mesh){a:{Y=void 0;for(var na=ya.matrixWorld,oa=-ya.geometry.boundingSphere.radius*Math.max(ya.scale.x,Math.max(ya.scale.y,ya.scale.z)),ha=0;ha<6;ha++){Y=ca[ha].x*na.n14+ca[ha].y*na.n24+ca[ha].z*na.n34+ca[ha].w;if(Y<=oa){Y=!1;break a}}Y=!0}Y=!Y}if(!Y){Y=o[h]=o[h]||new THREE.RenderableObject;h++;g=Y;pa.copy(ya.position);
-K.multiplyVector3(pa);g.object=ya;g.z=pa.z;c.push(g)}}ga&&c.sort(d);return c};this.projectScene=function(V,c,ga){var xa=[],sa=c.near,ya=c.far,Y,na,oa,ha,Z,va,qa,za,Aa,aa,Pa,Ta,Xa,Ua,Sa,R,J;ra=N=H=E=0;c.matrixAutoUpdate&&c.update(undefined,!0);V.update(undefined,!1,c);K.multiply(c.projectionMatrix,c.matrixWorldInverse);ca[0].set(K.n41-K.n11,K.n42-K.n12,K.n43-K.n13,K.n44-K.n14);ca[1].set(K.n41+K.n11,K.n42+K.n12,K.n43+K.n13,K.n44+K.n14);ca[2].set(K.n41+K.n21,K.n42+K.n22,K.n43+K.n23,K.n44+K.n24);ca[3].set(K.n41-
-K.n21,K.n42-K.n22,K.n43-K.n23,K.n44-K.n24);ca[4].set(K.n41-K.n31,K.n42-K.n32,K.n43-K.n33,K.n44-K.n34);ca[5].set(K.n41+K.n31,K.n42+K.n32,K.n43+K.n33,K.n44+K.n34);for(Y=0;Y<6;Y++){Aa=ca[Y];Aa.divideScalar(Math.sqrt(Aa.x*Aa.x+Aa.y*Aa.y+Aa.z*Aa.z))}Aa=this.projectObjects(V,c,!0);V=0;for(Y=Aa.length;V<Y;V++){aa=Aa[V].object;if(aa.visible){Pa=aa.matrixWorld;Ta=aa.matrixRotationWorld;Xa=aa.materials;Ua=aa.overdraw;q=0;if(aa instanceof THREE.Mesh){Sa=aa.geometry;ha=Sa.vertices;R=Sa.faces;Sa=Sa.faceVertexUvs;
-na=0;for(oa=ha.length;na<oa;na++){n=b();n.positionWorld.copy(ha[na].position);Pa.multiplyVector3(n.positionWorld);n.positionScreen.copy(n.positionWorld);K.multiplyVector4(n.positionScreen);n.positionScreen.x/=n.positionScreen.w;n.positionScreen.y/=n.positionScreen.w;n.visible=n.positionScreen.z>sa&&n.positionScreen.z<ya}ha=0;for(na=R.length;ha<na;ha++){oa=R[ha];if(oa instanceof THREE.Face3){Z=r[oa.a];va=r[oa.b];qa=r[oa.c];if(Z.visible&&va.visible&&qa.visible&&(aa.doubleSided||aa.flipSided!=(qa.positionScreen.x-
+THREE.Projector=function(){function b(){var R=r[q]=r[q]||new THREE.RenderableVertex;q++;return R}function d(R,c){return c.z-R.z}function e(R,c){var ga=0,xa=1,sa=R.z+R.w,ya=c.z+c.w,Y=-R.z+R.w,na=-c.z+c.w;if(sa>=0&&ya>=0&&Y>=0&&na>=0)return!0;else if(sa<0&&ya<0||Y<0&&na<0)return!1;else{if(sa<0)ga=Math.max(ga,sa/(sa-ya));else ya<0&&(xa=Math.min(xa,sa/(sa-ya)));if(Y<0)ga=Math.max(ga,Y/(Y-na));else na<0&&(xa=Math.min(xa,Y/(Y-na)));if(xa<ga)return!1;else{R.lerpSelf(c,ga);c.lerpSelf(R,1-xa);return!0}}}var g,
+h,o=[],n,q,r=[],v,E,F=[],H,I=[],M,N,V=[],L,ra,da=[],pa=new THREE.Vector4,$=new THREE.Vector4,K=new THREE.Matrix4,Ia=new THREE.Matrix4,ca=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Fa=new THREE.Vector4,fa=new THREE.Vector4;this.projectVector=function(R,c){K.multiply(c.projectionMatrix,c.matrixWorldInverse);K.multiplyVector3(R);return R};this.unprojectVector=function(R,c){K.multiply(c.matrixWorld,THREE.Matrix4.makeInvert(c.projectionMatrix));
+K.multiplyVector3(R);return R};this.projectObjects=function(R,c,ga){c=[];var xa,sa,ya;h=0;sa=R.objects;R=0;for(xa=sa.length;R<xa;R++){ya=sa[R];var Y;if(!(Y=!ya.visible))if(Y=ya instanceof THREE.Mesh){a:{Y=void 0;for(var na=ya.matrixWorld,oa=-ya.geometry.boundingSphere.radius*Math.max(ya.scale.x,Math.max(ya.scale.y,ya.scale.z)),ha=0;ha<6;ha++){Y=ca[ha].x*na.n14+ca[ha].y*na.n24+ca[ha].z*na.n34+ca[ha].w;if(Y<=oa){Y=!1;break a}}Y=!0}Y=!Y}if(!Y){Y=o[h]=o[h]||new THREE.RenderableObject;h++;g=Y;pa.copy(ya.position);
+K.multiplyVector3(pa);g.object=ya;g.z=pa.z;c.push(g)}}ga&&c.sort(d);return c};this.projectScene=function(R,c,ga){var xa=[],sa=c.near,ya=c.far,Y,na,oa,ha,Z,va,qa,za,Aa,aa,Pa,Ta,Xa,Ua,Sa,S,J;ra=N=H=E=0;c.matrixAutoUpdate&&c.update(undefined,!0);R.update(undefined,!1,c);K.multiply(c.projectionMatrix,c.matrixWorldInverse);ca[0].set(K.n41-K.n11,K.n42-K.n12,K.n43-K.n13,K.n44-K.n14);ca[1].set(K.n41+K.n11,K.n42+K.n12,K.n43+K.n13,K.n44+K.n14);ca[2].set(K.n41+K.n21,K.n42+K.n22,K.n43+K.n23,K.n44+K.n24);ca[3].set(K.n41-
+K.n21,K.n42-K.n22,K.n43-K.n23,K.n44-K.n24);ca[4].set(K.n41-K.n31,K.n42-K.n32,K.n43-K.n33,K.n44-K.n34);ca[5].set(K.n41+K.n31,K.n42+K.n32,K.n43+K.n33,K.n44+K.n34);for(Y=0;Y<6;Y++){Aa=ca[Y];Aa.divideScalar(Math.sqrt(Aa.x*Aa.x+Aa.y*Aa.y+Aa.z*Aa.z))}Aa=this.projectObjects(R,c,!0);R=0;for(Y=Aa.length;R<Y;R++){aa=Aa[R].object;if(aa.visible){Pa=aa.matrixWorld;Ta=aa.matrixRotationWorld;Xa=aa.materials;Ua=aa.overdraw;q=0;if(aa instanceof THREE.Mesh){Sa=aa.geometry;ha=Sa.vertices;S=Sa.faces;Sa=Sa.faceVertexUvs;
+na=0;for(oa=ha.length;na<oa;na++){n=b();n.positionWorld.copy(ha[na].position);Pa.multiplyVector3(n.positionWorld);n.positionScreen.copy(n.positionWorld);K.multiplyVector4(n.positionScreen);n.positionScreen.x/=n.positionScreen.w;n.positionScreen.y/=n.positionScreen.w;n.visible=n.positionScreen.z>sa&&n.positionScreen.z<ya}ha=0;for(na=S.length;ha<na;ha++){oa=S[ha];if(oa instanceof THREE.Face3){Z=r[oa.a];va=r[oa.b];qa=r[oa.c];if(Z.visible&&va.visible&&qa.visible&&(aa.doubleSided||aa.flipSided!=(qa.positionScreen.x-
 Z.positionScreen.x)*(va.positionScreen.y-Z.positionScreen.y)-(qa.positionScreen.y-Z.positionScreen.y)*(va.positionScreen.x-Z.positionScreen.x)<0)){za=F[E]=F[E]||new THREE.RenderableFace3;E++;v=za;v.v1.copy(Z);v.v2.copy(va);v.v3.copy(qa)}else continue}else if(oa instanceof THREE.Face4){Z=r[oa.a];va=r[oa.b];qa=r[oa.c];za=r[oa.d];if(Z.visible&&va.visible&&qa.visible&&za.visible&&(aa.doubleSided||aa.flipSided!=((za.positionScreen.x-Z.positionScreen.x)*(va.positionScreen.y-Z.positionScreen.y)-(za.positionScreen.y-
 Z.positionScreen.y)*(va.positionScreen.x-Z.positionScreen.x)<0||(va.positionScreen.x-qa.positionScreen.x)*(za.positionScreen.y-qa.positionScreen.y)-(va.positionScreen.y-qa.positionScreen.y)*(za.positionScreen.x-qa.positionScreen.x)<0))){J=I[H]=I[H]||new THREE.RenderableFace4;H++;v=J;v.v1.copy(Z);v.v2.copy(va);v.v3.copy(qa);v.v4.copy(za)}else continue}v.normalWorld.copy(oa.normal);Ta.multiplyVector3(v.normalWorld);v.centroidWorld.copy(oa.centroid);Pa.multiplyVector3(v.centroidWorld);v.centroidScreen.copy(v.centroidWorld);
 K.multiplyVector3(v.centroidScreen);qa=oa.vertexNormals;Z=0;for(va=qa.length;Z<va;Z++){za=v.vertexNormalsWorld[Z];za.copy(qa[Z]);Ta.multiplyVector3(za)}Z=0;for(va=Sa.length;Z<va;Z++)if(J=Sa[Z][ha]){qa=0;for(za=J.length;qa<za;qa++)v.uvs[Z][qa]=J[qa]}v.meshMaterials=Xa;v.faceMaterials=oa.materials;v.overdraw=Ua;v.z=v.centroidScreen.z;xa.push(v)}}else if(aa instanceof THREE.Line){Ia.multiply(K,Pa);ha=aa.geometry.vertices;Z=b();Z.positionScreen.copy(ha[0].position);Ia.multiplyVector4(Z.positionScreen);
-na=1;for(oa=ha.length;na<oa;na++){Z=b();Z.positionScreen.copy(ha[na].position);Ia.multiplyVector4(Z.positionScreen);va=r[q-2];Fa.copy(Z.positionScreen);fa.copy(va.positionScreen);if(e(Fa,fa)){Fa.multiplyScalar(1/Fa.w);fa.multiplyScalar(1/fa.w);Pa=U[N]=U[N]||new THREE.RenderableLine;N++;M=Pa;M.v1.positionScreen.copy(Fa);M.v2.positionScreen.copy(fa);M.z=Math.max(Fa.z,fa.z);M.materials=aa.materials;xa.push(M)}}}else if(aa instanceof THREE.Particle){$.set(aa.matrixWorld.n14,aa.matrixWorld.n24,aa.matrixWorld.n34,
+na=1;for(oa=ha.length;na<oa;na++){Z=b();Z.positionScreen.copy(ha[na].position);Ia.multiplyVector4(Z.positionScreen);va=r[q-2];Fa.copy(Z.positionScreen);fa.copy(va.positionScreen);if(e(Fa,fa)){Fa.multiplyScalar(1/Fa.w);fa.multiplyScalar(1/fa.w);Pa=V[N]=V[N]||new THREE.RenderableLine;N++;M=Pa;M.v1.positionScreen.copy(Fa);M.v2.positionScreen.copy(fa);M.z=Math.max(Fa.z,fa.z);M.materials=aa.materials;xa.push(M)}}}else if(aa instanceof THREE.Particle){$.set(aa.matrixWorld.n14,aa.matrixWorld.n24,aa.matrixWorld.n34,
 1);K.multiplyVector4($);$.z/=$.w;if($.z>0&&$.z<1){Pa=da[ra]=da[ra]||new THREE.RenderableParticle;ra++;L=Pa;L.x=$.x/$.w;L.y=$.y/$.w;L.z=$.z;L.rotation=aa.rotation.z;L.scale.x=aa.scale.x*Math.abs(L.x-($.x+c.projectionMatrix.n11)/($.w+c.projectionMatrix.n14));L.scale.y=aa.scale.y*Math.abs(L.y-($.y+c.projectionMatrix.n22)/($.w+c.projectionMatrix.n24));L.materials=aa.materials;xa.push(L)}}}}ga&&xa.sort(d);return xa}};
 THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(b,d,e){e&&b.update(undefined,!1,d);e=b.sounds;var g,h=e.length;for(g=0;g<h;g++){b=e[g];this.soundPosition.set(b.matrixWorld.n14,b.matrixWorld.n24,b.matrixWorld.n34);this.soundPosition.subSelf(d.position);if(b.isPlaying&&b.isLoaded){b.isAddedToDOM||b.addToDOM(this.domElement);b.calculateVolumeAndPan(this.soundPosition)}}}};
 THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",
@@ -172,10 +172,10 @@ THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.Shade
 THREE.ShaderChunk.default_vertex,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsLib.particle,fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["uniform float size;\nuniform float scale;",
 THREE.ShaderChunk.color_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;\n}"].join("\n")}};
 THREE.WebGLRenderer=function(b){function d(f,p,j){var k,m,x,y=f.vertices,u=y.length,A=f.colors,t=A.length,w=f.__vertexArray,z=f.__colorArray,D=f.__sortArray,B=f.__dirtyVertices,O=f.__dirtyColors;if(j.sortParticles){Pa.multiplySelf(j.matrixWorld);for(k=0;k<u;k++){m=y[k].position;Ua.copy(m);Pa.multiplyVector3(Ua);D[k]=[Ua.z,k]}D.sort(function(W,P){return P[0]-W[0]});for(k=0;k<u;k++){m=y[D[k][1]].position;x=k*3;w[x]=m.x;w[x+1]=m.y;w[x+2]=m.z}for(k=0;k<t;k++){x=k*3;color=A[D[k][1]];z[x]=color.r;z[x+1]=
-color.g;z[x+2]=color.b}}else{if(B)for(k=0;k<u;k++){m=y[k].position;x=k*3;w[x]=m.x;w[x+1]=m.y;w[x+2]=m.z}if(O)for(k=0;k<t;k++){color=A[k];x=k*3;z[x]=color.r;z[x+1]=color.g;z[x+2]=color.b}}if(B||j.sortParticles){c.bindBuffer(c.ARRAY_BUFFER,f.__webglVertexBuffer);c.bufferData(c.ARRAY_BUFFER,w,p)}if(O||j.sortParticles){c.bindBuffer(c.ARRAY_BUFFER,f.__webglColorBuffer);c.bufferData(c.ARRAY_BUFFER,z,p)}}function e(f,p,j,k,m){k.program||V.initMaterial(k,p,j,m);var x=k.program,y=x.uniforms,u=k.uniforms;if(x!=
+color.g;z[x+2]=color.b}}else{if(B)for(k=0;k<u;k++){m=y[k].position;x=k*3;w[x]=m.x;w[x+1]=m.y;w[x+2]=m.z}if(O)for(k=0;k<t;k++){color=A[k];x=k*3;z[x]=color.r;z[x+1]=color.g;z[x+2]=color.b}}if(B||j.sortParticles){c.bindBuffer(c.ARRAY_BUFFER,f.__webglVertexBuffer);c.bufferData(c.ARRAY_BUFFER,w,p)}if(O||j.sortParticles){c.bindBuffer(c.ARRAY_BUFFER,f.__webglColorBuffer);c.bufferData(c.ARRAY_BUFFER,z,p)}}function e(f,p,j,k,m){k.program||R.initMaterial(k,p,j,m);var x=k.program,y=x.uniforms,u=k.uniforms;if(x!=
 sa){c.useProgram(x);sa=x}c.uniformMatrix4fv(y.projectionMatrix,!1,Ta);if(j&&(k instanceof THREE.MeshBasicMaterial||k instanceof THREE.MeshLambertMaterial||k instanceof THREE.MeshPhongMaterial||k instanceof THREE.LineBasicMaterial||k instanceof THREE.ParticleBasicMaterial||k.fog)){u.fogColor.value=j.color;if(j instanceof THREE.Fog){u.fogNear.value=j.near;u.fogFar.value=j.far}else if(j instanceof THREE.FogExp2)u.fogDensity.value=j.density}if(k instanceof THREE.MeshPhongMaterial||k instanceof THREE.MeshLambertMaterial||
-k.lights){var A,t,w=0,z=0,D=0,B,O,W,P,X=Sa,Ga=X.directional.colors,S=X.directional.positions,Q=X.point.colors,T=X.point.positions,ta=X.point.distances,s=0,G=0;j=t=P=0;for(A=p.length;j<A;j++){t=p[j];B=t.color;O=t.position;W=t.intensity;P=t.distance;if(t instanceof THREE.AmbientLight){w+=B.r;z+=B.g;D+=B.b}else if(t instanceof THREE.DirectionalLight){P=s*3;Ga[P]=B.r*W;Ga[P+1]=B.g*W;Ga[P+2]=B.b*W;S[P]=O.x;S[P+1]=O.y;S[P+2]=O.z;s+=1}else if(t instanceof THREE.PointLight){t=G*3;Q[t]=B.r*W;Q[t+1]=B.g*W;
-Q[t+2]=B.b*W;T[t]=O.x;T[t+1]=O.y;T[t+2]=O.z;ta[G]=P;G+=1}}for(j=s*3;j<Ga.length;j++)Ga[j]=0;for(j=G*3;j<Q.length;j++)Q[j]=0;X.point.length=G;X.directional.length=s;X.ambient[0]=w;X.ambient[1]=z;X.ambient[2]=D;j=Sa;u.enableLighting.value=j.directional.length+j.point.length;u.ambientLightColor.value=j.ambient;u.directionalLightColor.value=j.directional.colors;u.directionalLightDirection.value=j.directional.positions;u.pointLightColor.value=j.point.colors;u.pointLightPosition.value=j.point.positions;
+k.lights){var A,t,w=0,z=0,D=0,B,O,W,P,X=Sa,Ga=X.directional.colors,T=X.directional.positions,Q=X.point.colors,U=X.point.positions,ta=X.point.distances,s=0,G=0;j=t=P=0;for(A=p.length;j<A;j++){t=p[j];B=t.color;O=t.position;W=t.intensity;P=t.distance;if(t instanceof THREE.AmbientLight){w+=B.r;z+=B.g;D+=B.b}else if(t instanceof THREE.DirectionalLight){P=s*3;Ga[P]=B.r*W;Ga[P+1]=B.g*W;Ga[P+2]=B.b*W;T[P]=O.x;T[P+1]=O.y;T[P+2]=O.z;s+=1}else if(t instanceof THREE.PointLight){t=G*3;Q[t]=B.r*W;Q[t+1]=B.g*W;
+Q[t+2]=B.b*W;U[t]=O.x;U[t+1]=O.y;U[t+2]=O.z;ta[G]=P;G+=1}}for(j=s*3;j<Ga.length;j++)Ga[j]=0;for(j=G*3;j<Q.length;j++)Q[j]=0;X.point.length=G;X.directional.length=s;X.ambient[0]=w;X.ambient[1]=z;X.ambient[2]=D;j=Sa;u.enableLighting.value=j.directional.length+j.point.length;u.ambientLightColor.value=j.ambient;u.directionalLightColor.value=j.directional.colors;u.directionalLightDirection.value=j.directional.positions;u.pointLightColor.value=j.point.colors;u.pointLightPosition.value=j.point.positions;
 u.pointLightDistance.value=j.point.distances}if(k instanceof THREE.MeshBasicMaterial||k instanceof THREE.MeshLambertMaterial||k instanceof THREE.MeshPhongMaterial){u.diffuse.value=k.color;u.opacity.value=k.opacity;u.map.texture=k.map;u.lightMap.texture=k.lightMap;u.envMap.texture=k.envMap;u.reflectivity.value=k.reflectivity;u.refractionRatio.value=k.refractionRatio;u.combine.value=k.combine;u.useRefract.value=k.envMap&&k.envMap.mapping instanceof THREE.CubeRefractionMapping}if(k instanceof THREE.LineBasicMaterial){u.diffuse.value=
 k.color;u.opacity.value=k.opacity}else if(k instanceof THREE.ParticleBasicMaterial){u.psColor.value=k.color;u.opacity.value=k.opacity;u.size.value=k.size;u.scale.value=ga.height/2;u.map.texture=k.map}else if(k instanceof THREE.MeshPhongMaterial){u.ambient.value=k.ambient;u.specular.value=k.specular;u.shininess.value=k.shininess}else if(k instanceof THREE.MeshDepthMaterial){u.mNear.value=f.near;u.mFar.value=f.far;u.opacity.value=k.opacity}else if(k instanceof THREE.MeshNormalMaterial)u.opacity.value=
 k.opacity;for(var i in u)if(z=x.uniforms[i]){A=u[i];w=A.type;j=A.value;if(w=="i")c.uniform1i(z,j);else if(w=="f")c.uniform1f(z,j);else if(w=="fv1")c.uniform1fv(z,j);else if(w=="fv")c.uniform3fv(z,j);else if(w=="v2")c.uniform2f(z,j.x,j.y);else if(w=="v3")c.uniform3f(z,j.x,j.y,j.z);else if(w=="v4")c.uniform4f(z,j.x,j.y,j.z,j.w);else if(w=="c")c.uniform3f(z,j.r,j.g,j.b);else if(w=="t"){c.uniform1i(z,j);if(A=A.texture)if(A.image instanceof Array&&A.image.length==6){if(A.image.length==6){if(A.needsUpdate){if(A.__webglInit){c.bindTexture(c.TEXTURE_CUBE_MAP,
@@ -188,40 +188,40 @@ m.__webglVertexBuffer);c.vertexAttribPointer(p.position,3,c.FLOAT,!1,0,0)}if(x.m
 p.size,c.FLOAT,!1,0,0)}if(f.color>=0){c.bindBuffer(c.ARRAY_BUFFER,m.__webglColorBuffer);c.vertexAttribPointer(f.color,3,c.FLOAT,!1,0,0)}if(f.normal>=0){c.bindBuffer(c.ARRAY_BUFFER,m.__webglNormalBuffer);c.vertexAttribPointer(f.normal,3,c.FLOAT,!1,0,0)}if(f.tangent>=0){c.bindBuffer(c.ARRAY_BUFFER,m.__webglTangentBuffer);c.vertexAttribPointer(f.tangent,4,c.FLOAT,!1,0,0)}if(f.uv>=0)if(m.__webglUVBuffer){c.bindBuffer(c.ARRAY_BUFFER,m.__webglUVBuffer);c.vertexAttribPointer(f.uv,2,c.FLOAT,!1,0,0);c.enableVertexAttribArray(f.uv)}else c.disableVertexAttribArray(f.uv);
 if(f.uv2>=0)if(m.__webglUV2Buffer){c.bindBuffer(c.ARRAY_BUFFER,m.__webglUV2Buffer);c.vertexAttribPointer(f.uv2,2,c.FLOAT,!1,0,0);c.enableVertexAttribArray(f.uv2)}else c.disableVertexAttribArray(f.uv2);if(k.skinning&&f.skinVertexA>=0&&f.skinVertexB>=0&&f.skinIndex>=0&&f.skinWeight>=0){c.bindBuffer(c.ARRAY_BUFFER,m.__webglSkinVertexABuffer);c.vertexAttribPointer(f.skinVertexA,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,m.__webglSkinVertexBBuffer);c.vertexAttribPointer(f.skinVertexB,4,c.FLOAT,!1,0,
 0);c.bindBuffer(c.ARRAY_BUFFER,m.__webglSkinIndicesBuffer);c.vertexAttribPointer(f.skinIndex,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,m.__webglSkinWeightsBuffer);c.vertexAttribPointer(f.skinWeight,4,c.FLOAT,!1,0,0)}if(x instanceof THREE.Mesh){if(k.wireframe){c.lineWidth(k.wireframeLinewidth);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,m.__webglLineBuffer);c.drawElements(c.LINES,m.__webglLineCount,c.UNSIGNED_SHORT,0)}else{c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,m.__webglFaceBuffer);c.drawElements(c.TRIANGLES,
-m.__webglFaceCount,c.UNSIGNED_SHORT,0)}V.data.vertices+=m.__webglFaceCount;V.data.faces+=m.__webglFaceCount/3}else if(x instanceof THREE.Line){x=x.type==THREE.LineStrip?c.LINE_STRIP:c.LINES;c.lineWidth(k.linewidth);c.drawArrays(x,0,m.__webglLineCount)}else if(x instanceof THREE.ParticleSystem)c.drawArrays(c.POINTS,0,m.__webglParticleCount);else x instanceof THREE.Ribbon&&c.drawArrays(c.TRIANGLE_STRIP,0,m.__webglVertexCount)}}function h(f,p,j){if(!f.__webglVertexBuffer)f.__webglVertexBuffer=c.createBuffer();
-if(!f.__webglNormalBuffer)f.__webglNormalBuffer=c.createBuffer();if(f.hasPos){c.bindBuffer(c.ARRAY_BUFFER,f.__webglVertexBuffer);c.bufferData(c.ARRAY_BUFFER,f.positionArray,c.DYNAMIC_DRAW);c.enableVertexAttribArray(p.attributes.position);c.vertexAttribPointer(p.attributes.position,3,c.FLOAT,!1,0,0)}if(f.hasNormal){c.bindBuffer(c.ARRAY_BUFFER,f.__webglNormalBuffer);if(j==THREE.FlatShading){var k,m,x,y,u,A,t,w,z,D,B=f.count*3;for(D=0;D<B;D+=9){j=f.normalArray;k=j[D];m=j[D+1];x=j[D+2];y=j[D+3];A=j[D+
-4];w=j[D+5];u=j[D+6];t=j[D+7];z=j[D+8];k=(k+y+u)/3;m=(m+A+t)/3;x=(x+w+z)/3;j[D]=k;j[D+1]=m;j[D+2]=x;j[D+3]=k;j[D+4]=m;j[D+5]=x;j[D+6]=k;j[D+7]=m;j[D+8]=x}}c.bufferData(c.ARRAY_BUFFER,f.normalArray,c.DYNAMIC_DRAW);c.enableVertexAttribArray(p.attributes.normal);c.vertexAttribPointer(p.attributes.normal,3,c.FLOAT,!1,0,0)}c.drawArrays(c.TRIANGLES,0,f.count);f.count=0}function o(f){if(na!=f.doubleSided){f.doubleSided?c.disable(c.CULL_FACE):c.enable(c.CULL_FACE);na=f.doubleSided}if(oa!=f.flipSided){f.flipSided?
-c.frontFace(c.CW):c.frontFace(c.CCW);oa=f.flipSided}}function n(f){if(Z!=f){f?c.enable(c.DEPTH_TEST):c.disable(c.DEPTH_TEST);Z=f}}function q(f){aa[0].set(f.n41-f.n11,f.n42-f.n12,f.n43-f.n13,f.n44-f.n14);aa[1].set(f.n41+f.n11,f.n42+f.n12,f.n43+f.n13,f.n44+f.n14);aa[2].set(f.n41+f.n21,f.n42+f.n22,f.n43+f.n23,f.n44+f.n24);aa[3].set(f.n41-f.n21,f.n42-f.n22,f.n43-f.n23,f.n44-f.n24);aa[4].set(f.n41-f.n31,f.n42-f.n32,f.n43-f.n33,f.n44-f.n34);aa[5].set(f.n41+f.n31,f.n42+f.n32,f.n43+f.n33,f.n44+f.n34);var p;
-for(f=0;f<6;f++){p=aa[f];p.divideScalar(Math.sqrt(p.x*p.x+p.y*p.y+p.z*p.z))}}function r(f){for(var p=f.matrixWorld,j=-f.geometry.boundingSphere.radius*Math.max(f.scale.x,Math.max(f.scale.y,f.scale.z)),k=0;k<6;k++){f=aa[k].x*p.n14+aa[k].y*p.n24+aa[k].z*p.n34+aa[k].w;if(f<=j)return!1}return!0}function v(f,p){f.list[f.count]=p;f.count+=1}function E(f){var p,j,k=f.object,m=f.opaque,x=f.transparent;x.count=0;f=m.count=0;for(p=k.materials.length;f<p;f++){j=k.materials[f];j.transparent?v(x,j):v(m,j)}}function F(f){var p,
-j,k,m,x=f.object,y=f.buffer,u=f.opaque,A=f.transparent;A.count=0;f=u.count=0;for(k=x.materials.length;f<k;f++){p=x.materials[f];if(p instanceof THREE.MeshFaceMaterial){p=0;for(j=y.materials.length;p<j;p++)(m=y.materials[p])&&(m.transparent?v(A,m):v(u,m))}else(m=p)&&(m.transparent?v(A,m):v(u,m))}}function H(f,p){return p.z-f.z}function I(f){c.enable(c.POLYGON_OFFSET_FILL);c.polygonOffset(0.1,1);c.enable(c.STENCIL_TEST);c.enable(c.DEPTH_TEST);c.depthMask(!1);c.colorMask(!1,!1,!1,!1);c.stencilFunc(c.ALWAYS,
-1,255);c.stencilOpSeparate(c.BACK,c.KEEP,c.INCR,c.KEEP);c.stencilOpSeparate(c.FRONT,c.KEEP,c.DECR,c.KEEP);var p,j=f.lights.length,k,m=f.lights,x=[],y,u,A,t,w,z=f.__webglShadowVolumes.length;for(p=0;p<j;p++){k=f.lights[p];if(k instanceof THREE.DirectionalLight&&k.castShadow){x[0]=-k.position.x;x[1]=-k.position.y;x[2]=-k.position.z;for(w=0;w<z;w++){k=f.__webglShadowVolumes[w].object;y=f.__webglShadowVolumes[w].buffer;u=k.materials[0];u.program||V.initMaterial(u,m,undefined,k);u=u.program;A=u.uniforms;
-t=u.attributes;if(sa!==u){c.useProgram(u);sa=u;c.uniformMatrix4fv(A.projectionMatrix,!1,Ta);c.uniformMatrix4fv(A.viewMatrix,!1,Xa);c.uniform3fv(A.directionalLightDirection,x)}k.matrixWorld.flattenToArray(k._objectMatrixArray);c.uniformMatrix4fv(A.objectMatrix,!1,k._objectMatrixArray);c.bindBuffer(c.ARRAY_BUFFER,y.__webglVertexBuffer);c.vertexAttribPointer(t.position,3,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,y.__webglNormalBuffer);c.vertexAttribPointer(t.normal,3,c.FLOAT,!1,0,0);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,
-y.__webglFaceBuffer);c.cullFace(c.FRONT);c.drawElements(c.TRIANGLES,y.__webglFaceCount,c.UNSIGNED_SHORT,0);c.cullFace(c.BACK);c.drawElements(c.TRIANGLES,y.__webglFaceCount,c.UNSIGNED_SHORT,0)}}}c.disable(c.POLYGON_OFFSET_FILL);c.colorMask(!0,!0,!0,!0);c.stencilFunc(c.NOTEQUAL,0,255);c.stencilOp(c.KEEP,c.KEEP,c.KEEP);c.disable(c.DEPTH_TEST);ha="";sa=R.program;c.useProgram(R.program);c.uniformMatrix4fv(R.projectionLocation,!1,Ta);c.uniform1f(R.darknessLocation,R.darkness);c.bindBuffer(c.ARRAY_BUFFER,
-R.vertexBuffer);c.vertexAttribPointer(R.vertexLocation,3,c.FLOAT,!1,0,0);c.enableVertexAttribArray(R.vertexLocation);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA);c.blendEquation(c.FUNC_ADD);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,R.elementBuffer);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0);c.disable(c.STENCIL_TEST);c.enable(c.DEPTH_TEST);c.depthMask(Y)}function M(f,p){var j,k,m;j=_sprite.attributes;var x=_sprite.uniforms,y=Aa/za,u,A=[],t=za*0.5,w=Aa*0.5,z=!0;c.useProgram(_sprite.program);sa=_sprite.program;
-ha="";if(!ob){c.enableVertexAttribArray(_sprite.attributes.position);c.enableVertexAttribArray(_sprite.attributes.uv);ob=!0}c.disable(c.CULL_FACE);c.enable(c.BLEND);c.depthMask(!0);c.bindBuffer(c.ARRAY_BUFFER,_sprite.vertexBuffer);c.vertexAttribPointer(j.position,2,c.FLOAT,!1,16,0);c.vertexAttribPointer(j.uv,2,c.FLOAT,!1,16,8);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,_sprite.elementBuffer);c.uniformMatrix4fv(x.projectionMatrix,!1,Ta);c.activeTexture(c.TEXTURE0);c.uniform1i(x.map,0);j=0;for(k=f.__webglSprites.length;j<
-k;j++){m=f.__webglSprites[j];if(m.useScreenCoordinates)m.z=-m.position.z;else{m._modelViewMatrix.multiplyToArray(p.matrixWorldInverse,m.matrixWorld,m._modelViewMatrixArray);m.z=-m._modelViewMatrix.n34}}f.__webglSprites.sort(H);j=0;for(k=f.__webglSprites.length;j<k;j++){m=f.__webglSprites[j];if(m.material===undefined&&m.map&&m.map.image&&m.map.image.width){if(m.useScreenCoordinates){c.uniform1i(x.useScreenCoordinates,1);c.uniform3f(x.screenPosition,(m.position.x-t)/t,(w-m.position.y)/w,Math.max(0,
-Math.min(1,m.position.z)))}else{c.uniform1i(x.useScreenCoordinates,0);c.uniform1i(x.affectedByDistance,m.affectedByDistance?1:0);c.uniformMatrix4fv(x.modelViewMatrix,!1,m._modelViewMatrixArray)}u=m.map.image.width/(m.affectedByDistance?1:Aa);A[0]=u*y*m.scale.x;A[1]=u*m.scale.y;c.uniform2f(x.uvScale,m.uvScale.x,m.uvScale.y);c.uniform2f(x.uvOffset,m.uvOffset.x,m.uvOffset.y);c.uniform2f(x.alignment,m.alignment.x,m.alignment.y);c.uniform1f(x.opacity,m.opacity);c.uniform1f(x.rotation,m.rotation);c.uniform2fv(x.scale,
-A);if(m.mergeWith3D&&!z){c.enable(c.DEPTH_TEST);z=!0}else if(!m.mergeWith3D&&z){c.disable(c.DEPTH_TEST);z=!1}pa(m.blending);K(m.map,0);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0)}}c.enable(c.CULL_FACE);c.enable(c.DEPTH_TEST);c.depthMask(Y)}function N(f,p){var j,k,m=f.__webglLensFlares.length,x,y,u,A=new THREE.Vector3,t=Aa/za,w=za*0.5,z=Aa*0.5,D=16/Aa,B=[D*t,D],O=[1,1,0],W=[1,1],P=J.uniforms;j=J.attributes;c.useProgram(J.program);sa=J.program;ha="";if(!pb){c.enableVertexAttribArray(J.attributes.vertex);
+m.__webglFaceCount,c.UNSIGNED_SHORT,0)}R.data.vertices+=m.__webglFaceCount;R.data.faces+=m.__webglFaceCount/3;R.data.drawCalls++}else if(x instanceof THREE.Line){x=x.type==THREE.LineStrip?c.LINE_STRIP:c.LINES;c.lineWidth(k.linewidth);c.drawArrays(x,0,m.__webglLineCount);R.data.drawCalls++}else if(x instanceof THREE.ParticleSystem){c.drawArrays(c.POINTS,0,m.__webglParticleCount);R.data.drawCalls++}else if(x instanceof THREE.Ribbon){c.drawArrays(c.TRIANGLE_STRIP,0,m.__webglVertexCount);R.data.drawCalls++}}}
+function h(f,p,j){if(!f.__webglVertexBuffer)f.__webglVertexBuffer=c.createBuffer();if(!f.__webglNormalBuffer)f.__webglNormalBuffer=c.createBuffer();if(f.hasPos){c.bindBuffer(c.ARRAY_BUFFER,f.__webglVertexBuffer);c.bufferData(c.ARRAY_BUFFER,f.positionArray,c.DYNAMIC_DRAW);c.enableVertexAttribArray(p.attributes.position);c.vertexAttribPointer(p.attributes.position,3,c.FLOAT,!1,0,0)}if(f.hasNormal){c.bindBuffer(c.ARRAY_BUFFER,f.__webglNormalBuffer);if(j==THREE.FlatShading){var k,m,x,y,u,A,t,w,z,D,B=
+f.count*3;for(D=0;D<B;D+=9){j=f.normalArray;k=j[D];m=j[D+1];x=j[D+2];y=j[D+3];A=j[D+4];w=j[D+5];u=j[D+6];t=j[D+7];z=j[D+8];k=(k+y+u)/3;m=(m+A+t)/3;x=(x+w+z)/3;j[D]=k;j[D+1]=m;j[D+2]=x;j[D+3]=k;j[D+4]=m;j[D+5]=x;j[D+6]=k;j[D+7]=m;j[D+8]=x}}c.bufferData(c.ARRAY_BUFFER,f.normalArray,c.DYNAMIC_DRAW);c.enableVertexAttribArray(p.attributes.normal);c.vertexAttribPointer(p.attributes.normal,3,c.FLOAT,!1,0,0)}c.drawArrays(c.TRIANGLES,0,f.count);f.count=0}function o(f){if(na!=f.doubleSided){f.doubleSided?c.disable(c.CULL_FACE):
+c.enable(c.CULL_FACE);na=f.doubleSided}if(oa!=f.flipSided){f.flipSided?c.frontFace(c.CW):c.frontFace(c.CCW);oa=f.flipSided}}function n(f){if(Z!=f){f?c.enable(c.DEPTH_TEST):c.disable(c.DEPTH_TEST);Z=f}}function q(f){aa[0].set(f.n41-f.n11,f.n42-f.n12,f.n43-f.n13,f.n44-f.n14);aa[1].set(f.n41+f.n11,f.n42+f.n12,f.n43+f.n13,f.n44+f.n14);aa[2].set(f.n41+f.n21,f.n42+f.n22,f.n43+f.n23,f.n44+f.n24);aa[3].set(f.n41-f.n21,f.n42-f.n22,f.n43-f.n23,f.n44-f.n24);aa[4].set(f.n41-f.n31,f.n42-f.n32,f.n43-f.n33,f.n44-
+f.n34);aa[5].set(f.n41+f.n31,f.n42+f.n32,f.n43+f.n33,f.n44+f.n34);var p;for(f=0;f<6;f++){p=aa[f];p.divideScalar(Math.sqrt(p.x*p.x+p.y*p.y+p.z*p.z))}}function r(f){for(var p=f.matrixWorld,j=-f.geometry.boundingSphere.radius*Math.max(f.scale.x,Math.max(f.scale.y,f.scale.z)),k=0;k<6;k++){f=aa[k].x*p.n14+aa[k].y*p.n24+aa[k].z*p.n34+aa[k].w;if(f<=j)return!1}return!0}function v(f,p){f.list[f.count]=p;f.count+=1}function E(f){var p,j,k=f.object,m=f.opaque,x=f.transparent;x.count=0;f=m.count=0;for(p=k.materials.length;f<
+p;f++){j=k.materials[f];j.transparent?v(x,j):v(m,j)}}function F(f){var p,j,k,m,x=f.object,y=f.buffer,u=f.opaque,A=f.transparent;A.count=0;f=u.count=0;for(k=x.materials.length;f<k;f++){p=x.materials[f];if(p instanceof THREE.MeshFaceMaterial){p=0;for(j=y.materials.length;p<j;p++)(m=y.materials[p])&&(m.transparent?v(A,m):v(u,m))}else(m=p)&&(m.transparent?v(A,m):v(u,m))}}function H(f,p){return p.z-f.z}function I(f){c.enable(c.POLYGON_OFFSET_FILL);c.polygonOffset(0.1,1);c.enable(c.STENCIL_TEST);c.enable(c.DEPTH_TEST);
+c.depthMask(!1);c.colorMask(!1,!1,!1,!1);c.stencilFunc(c.ALWAYS,1,255);c.stencilOpSeparate(c.BACK,c.KEEP,c.INCR,c.KEEP);c.stencilOpSeparate(c.FRONT,c.KEEP,c.DECR,c.KEEP);var p,j=f.lights.length,k,m=f.lights,x=[],y,u,A,t,w,z=f.__webglShadowVolumes.length;for(p=0;p<j;p++){k=f.lights[p];if(k instanceof THREE.DirectionalLight&&k.castShadow){x[0]=-k.position.x;x[1]=-k.position.y;x[2]=-k.position.z;for(w=0;w<z;w++){k=f.__webglShadowVolumes[w].object;y=f.__webglShadowVolumes[w].buffer;u=k.materials[0];u.program||
+R.initMaterial(u,m,undefined,k);u=u.program;A=u.uniforms;t=u.attributes;if(sa!==u){c.useProgram(u);sa=u;c.uniformMatrix4fv(A.projectionMatrix,!1,Ta);c.uniformMatrix4fv(A.viewMatrix,!1,Xa);c.uniform3fv(A.directionalLightDirection,x)}k.matrixWorld.flattenToArray(k._objectMatrixArray);c.uniformMatrix4fv(A.objectMatrix,!1,k._objectMatrixArray);c.bindBuffer(c.ARRAY_BUFFER,y.__webglVertexBuffer);c.vertexAttribPointer(t.position,3,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,y.__webglNormalBuffer);c.vertexAttribPointer(t.normal,
+3,c.FLOAT,!1,0,0);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,y.__webglFaceBuffer);c.cullFace(c.FRONT);c.drawElements(c.TRIANGLES,y.__webglFaceCount,c.UNSIGNED_SHORT,0);c.cullFace(c.BACK);c.drawElements(c.TRIANGLES,y.__webglFaceCount,c.UNSIGNED_SHORT,0)}}}c.disable(c.POLYGON_OFFSET_FILL);c.colorMask(!0,!0,!0,!0);c.stencilFunc(c.NOTEQUAL,0,255);c.stencilOp(c.KEEP,c.KEEP,c.KEEP);c.disable(c.DEPTH_TEST);ha="";sa=S.program;c.useProgram(S.program);c.uniformMatrix4fv(S.projectionLocation,!1,Ta);c.uniform1f(S.darknessLocation,
+S.darkness);c.bindBuffer(c.ARRAY_BUFFER,S.vertexBuffer);c.vertexAttribPointer(S.vertexLocation,3,c.FLOAT,!1,0,0);c.enableVertexAttribArray(S.vertexLocation);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA);c.blendEquation(c.FUNC_ADD);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,S.elementBuffer);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0);c.disable(c.STENCIL_TEST);c.enable(c.DEPTH_TEST);c.depthMask(Y)}function M(f,p){var j,k,m;j=_sprite.attributes;var x=_sprite.uniforms,y=Aa/za,u,A=[],t=za*0.5,w=Aa*0.5,z=!0;c.useProgram(_sprite.program);
+sa=_sprite.program;ha="";if(!ob){c.enableVertexAttribArray(_sprite.attributes.position);c.enableVertexAttribArray(_sprite.attributes.uv);ob=!0}c.disable(c.CULL_FACE);c.enable(c.BLEND);c.depthMask(!0);c.bindBuffer(c.ARRAY_BUFFER,_sprite.vertexBuffer);c.vertexAttribPointer(j.position,2,c.FLOAT,!1,16,0);c.vertexAttribPointer(j.uv,2,c.FLOAT,!1,16,8);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,_sprite.elementBuffer);c.uniformMatrix4fv(x.projectionMatrix,!1,Ta);c.activeTexture(c.TEXTURE0);c.uniform1i(x.map,0);
+j=0;for(k=f.__webglSprites.length;j<k;j++){m=f.__webglSprites[j];if(m.useScreenCoordinates)m.z=-m.position.z;else{m._modelViewMatrix.multiplyToArray(p.matrixWorldInverse,m.matrixWorld,m._modelViewMatrixArray);m.z=-m._modelViewMatrix.n34}}f.__webglSprites.sort(H);j=0;for(k=f.__webglSprites.length;j<k;j++){m=f.__webglSprites[j];if(m.material===undefined&&m.map&&m.map.image&&m.map.image.width){if(m.useScreenCoordinates){c.uniform1i(x.useScreenCoordinates,1);c.uniform3f(x.screenPosition,(m.position.x-
+t)/t,(w-m.position.y)/w,Math.max(0,Math.min(1,m.position.z)))}else{c.uniform1i(x.useScreenCoordinates,0);c.uniform1i(x.affectedByDistance,m.affectedByDistance?1:0);c.uniformMatrix4fv(x.modelViewMatrix,!1,m._modelViewMatrixArray)}u=m.map.image.width/(m.affectedByDistance?1:Aa);A[0]=u*y*m.scale.x;A[1]=u*m.scale.y;c.uniform2f(x.uvScale,m.uvScale.x,m.uvScale.y);c.uniform2f(x.uvOffset,m.uvOffset.x,m.uvOffset.y);c.uniform2f(x.alignment,m.alignment.x,m.alignment.y);c.uniform1f(x.opacity,m.opacity);c.uniform1f(x.rotation,
+m.rotation);c.uniform2fv(x.scale,A);if(m.mergeWith3D&&!z){c.enable(c.DEPTH_TEST);z=!0}else if(!m.mergeWith3D&&z){c.disable(c.DEPTH_TEST);z=!1}pa(m.blending);K(m.map,0);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0)}}c.enable(c.CULL_FACE);c.enable(c.DEPTH_TEST);c.depthMask(Y)}function N(f,p){var j,k,m=f.__webglLensFlares.length,x,y,u,A=new THREE.Vector3,t=Aa/za,w=za*0.5,z=Aa*0.5,D=16/Aa,B=[D*t,D],O=[1,1,0],W=[1,1],P=J.uniforms;j=J.attributes;c.useProgram(J.program);sa=J.program;ha="";if(!pb){c.enableVertexAttribArray(J.attributes.vertex);
 c.enableVertexAttribArray(J.attributes.uv);pb=!0}c.uniform1i(P.occlusionMap,0);c.uniform1i(P.map,1);c.bindBuffer(c.ARRAY_BUFFER,J.vertexBuffer);c.vertexAttribPointer(j.vertex,2,c.FLOAT,!1,16,0);c.vertexAttribPointer(j.uv,2,c.FLOAT,!1,16,8);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,J.elementBuffer);c.disable(c.CULL_FACE);c.depthMask(!1);c.activeTexture(c.TEXTURE0);c.bindTexture(c.TEXTURE_2D,J.occlusionTexture);c.activeTexture(c.TEXTURE1);for(k=0;k<m;k++){j=f.__webglLensFlares[k].object;A.set(j.matrixWorld.n14,
 j.matrixWorld.n24,j.matrixWorld.n34);p.matrixWorldInverse.multiplyVector3(A);p.projectionMatrix.multiplyVector3(A);O[0]=A.x;O[1]=A.y;O[2]=A.z;W[0]=O[0]*w+w;W[1]=O[1]*z+z;if(J.hasVertexTexture||W[0]>0&&W[0]<za&&W[1]>0&&W[1]<Aa){c.bindTexture(c.TEXTURE_2D,J.tempTexture);c.copyTexImage2D(c.TEXTURE_2D,0,c.RGB,W[0]-8,W[1]-8,16,16,0);c.uniform1i(P.renderType,0);c.uniform2fv(P.scale,B);c.uniform3fv(P.screenPosition,O);c.disable(c.BLEND);c.enable(c.DEPTH_TEST);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,
 0);c.bindTexture(c.TEXTURE_2D,J.occlusionTexture);c.copyTexImage2D(c.TEXTURE_2D,0,c.RGBA,W[0]-8,W[1]-8,16,16,0);c.uniform1i(P.renderType,1);c.disable(c.DEPTH_TEST);c.bindTexture(c.TEXTURE_2D,J.tempTexture);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0);j.positionScreen.x=O[0];j.positionScreen.y=O[1];j.positionScreen.z=O[2];j.customUpdateCallback?j.customUpdateCallback(j):j.updateLensFlares();c.uniform1i(P.renderType,2);c.enable(c.BLEND);x=0;for(y=j.lensFlares.length;x<y;x++){u=j.lensFlares[x];if(u.opacity>
-0.0010&&u.scale>0.0010){O[0]=u.x;O[1]=u.y;O[2]=u.z;D=u.size*u.scale/Aa;B[0]=D*t;B[1]=D;c.uniform3fv(P.screenPosition,O);c.uniform2fv(P.scale,B);c.uniform1f(P.rotation,u.rotation);c.uniform1f(P.opacity,u.opacity);pa(u.blending);K(u.texture,1);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0)}}}}c.enable(c.CULL_FACE);c.enable(c.DEPTH_TEST);c.depthMask(Y)}function U(f,p){f._modelViewMatrix.multiplyToArray(p.matrixWorldInverse,f.matrixWorld,f._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(f._modelViewMatrix).transposeIntoArray(f._normalMatrixArray)}
+0.001&&u.scale>0.001){O[0]=u.x;O[1]=u.y;O[2]=u.z;D=u.size*u.scale/Aa;B[0]=D*t;B[1]=D;c.uniform3fv(P.screenPosition,O);c.uniform2fv(P.scale,B);c.uniform1f(P.rotation,u.rotation);c.uniform1f(P.opacity,u.opacity);pa(u.blending);K(u.texture,1);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0)}}}}c.enable(c.CULL_FACE);c.enable(c.DEPTH_TEST);c.depthMask(Y)}function V(f,p){f._modelViewMatrix.multiplyToArray(p.matrixWorldInverse,f.matrixWorld,f._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(f._modelViewMatrix).transposeIntoArray(f._normalMatrixArray)}
 function L(f){var p,j,k,m,x;if(f instanceof THREE.Mesh){j=f.geometry;for(p in j.geometryGroups){k=j.geometryGroups[p];x=!1;for(m in k.__webglCustomAttributes)if(k.__webglCustomAttributes[m].needsUpdate){x=!0;break}if(j.__dirtyVertices||j.__dirtyMorphTargets||j.__dirtyElements||j.__dirtyUvs||j.__dirtyNormals||j.__dirtyColors||j.__dirtyTangents||x){x=c.DYNAMIC_DRAW;var y=void 0,u=void 0,A=void 0,t=void 0;A=void 0;var w=void 0,z=void 0,D=void 0,B=void 0,O=void 0,W=void 0,P=void 0,X=void 0,Ga=void 0,
-S=void 0,Q=void 0,T=void 0,ta=void 0;z=void 0;D=void 0;t=void 0;B=void 0;t=void 0;var s=void 0,G=void 0;z=void 0;s=void 0;G=void 0;var i=void 0,Ka=void 0;s=void 0;G=void 0;i=void 0;Ka=void 0;s=void 0;G=void 0;i=void 0;Ka=void 0;s=void 0;G=void 0;i=void 0;t=void 0;B=void 0;w=void 0;A=void 0;A=void 0;s=void 0;G=void 0;i=void 0;var Va=void 0,ua=0,Ba=0,Za=0,$a=0,Ja=0,La=0,ea=0,Ma=0,wa=0,C=0,Ca=0;G=s=0;var Da=k.__vertexArray,fb=k.__uvArray,gb=k.__uv2Array,Qa=k.__normalArray,ia=k.__tangentArray,Ea=k.__colorArray,
+T=void 0,Q=void 0,U=void 0,ta=void 0;z=void 0;D=void 0;t=void 0;B=void 0;t=void 0;var s=void 0,G=void 0;z=void 0;s=void 0;G=void 0;var i=void 0,Ka=void 0;s=void 0;G=void 0;i=void 0;Ka=void 0;s=void 0;G=void 0;i=void 0;Ka=void 0;s=void 0;G=void 0;i=void 0;t=void 0;B=void 0;w=void 0;A=void 0;A=void 0;s=void 0;G=void 0;i=void 0;var Va=void 0,ua=0,Ba=0,Za=0,$a=0,Ja=0,La=0,ea=0,Ma=0,wa=0,C=0,Ca=0;G=s=0;var Da=k.__vertexArray,fb=k.__uvArray,gb=k.__uv2Array,Qa=k.__normalArray,ia=k.__tangentArray,Ea=k.__colorArray,
 ja=k.__skinVertexAArray,ka=k.__skinVertexBArray,la=k.__skinIndexArray,ma=k.__skinWeightArray,hb=k.__morphTargetsArrays,Ra=k.__webglCustomAttributes;i=void 0;var Na=k.__faceArray,Oa=k.__lineArray,qb=k.__needsSmoothNormals;W=k.__vertexColorType;O=k.__uvType;P=k.__normalType;var Ha=f.geometry,ib=Ha.__dirtyVertices,jb=Ha.__dirtyElements,eb=Ha.__dirtyUvs,kb=Ha.__dirtyNormals,lb=Ha.__dirtyTangents,mb=Ha.__dirtyColors,nb=Ha.__dirtyMorphTargets,ab=Ha.vertices,rb=k.faces,ub=Ha.faces,sb=Ha.faceVertexUvs[0],
-tb=Ha.faceVertexUvs[1],bb=Ha.skinVerticesA,cb=Ha.skinVerticesB,db=Ha.skinIndices,Wa=Ha.skinWeights,Ya=f instanceof THREE.ShadowVolume?Ha.edgeFaces:undefined;morphTargets=Ha.morphTargets;if(Ra)for(Va in Ra){Ra[Va].offset=0;Ra[Va].offsetSrc=0}y=0;for(u=rb.length;y<u;y++){A=rb[y];t=ub[A];sb&&(X=sb[A]);tb&&(Ga=tb[A]);A=t.vertexNormals;w=t.normal;z=t.vertexColors;D=t.color;B=t.vertexTangents;if(t instanceof THREE.Face3){if(ib){S=ab[t.a].position;Q=ab[t.b].position;T=ab[t.c].position;Da[Ba]=S.x;Da[Ba+1]=
-S.y;Da[Ba+2]=S.z;Da[Ba+3]=Q.x;Da[Ba+4]=Q.y;Da[Ba+5]=Q.z;Da[Ba+6]=T.x;Da[Ba+7]=T.y;Da[Ba+8]=T.z;Ba+=9}if(Ra)for(Va in Ra){i=Ra[Va];if(i.needsUpdate){s=i.offset;G=i.offsetSrc;if(i.size===1){if(i.boundTo===undefined||i.boundTo==="vertices"){i.array[s+0]=i.value[t.a];i.array[s+1]=i.value[t.b];i.array[s+2]=i.value[t.c]}else if(i.boundTo==="faces"){i.array[s+0]=i.value[G];i.array[s+1]=i.value[G];i.array[s+2]=i.value[G];i.offsetSrc++}else if(i.boundTo==="faceVertices"){i.array[s+0]=i.value[G+0];i.array[s+
-1]=i.value[G+1];i.array[s+2]=i.value[G+2];i.offsetSrc+=3}i.offset+=3}else{if(i.boundTo===undefined||i.boundTo==="vertices"){S=i.value[t.a];Q=i.value[t.b];T=i.value[t.c]}else if(i.boundTo==="faces"){S=i.value[G];Q=i.value[G];T=i.value[G];i.offsetSrc++}else if(i.boundTo==="faceVertices"){S=i.value[G+0];Q=i.value[G+1];T=i.value[G+2];i.offsetSrc+=3}if(i.size===2){i.array[s+0]=S.x;i.array[s+1]=S.y;i.array[s+2]=Q.x;i.array[s+3]=Q.y;i.array[s+4]=T.x;i.array[s+5]=T.y;i.offset+=6}else if(i.size===3){if(i.type===
-"c"){i.array[s+0]=S.r;i.array[s+1]=S.g;i.array[s+2]=S.b;i.array[s+3]=Q.r;i.array[s+4]=Q.g;i.array[s+5]=Q.b;i.array[s+6]=T.r;i.array[s+7]=T.g;i.array[s+8]=T.b}else{i.array[s+0]=S.x;i.array[s+1]=S.y;i.array[s+2]=S.z;i.array[s+3]=Q.x;i.array[s+4]=Q.y;i.array[s+5]=Q.z;i.array[s+6]=T.x;i.array[s+7]=T.y;i.array[s+8]=T.z}i.offset+=9}else{i.array[s+0]=S.x;i.array[s+1]=S.y;i.array[s+2]=S.z;i.array[s+3]=S.w;i.array[s+4]=Q.x;i.array[s+5]=Q.y;i.array[s+6]=Q.z;i.array[s+7]=Q.w;i.array[s+8]=T.x;i.array[s+9]=T.y;
-i.array[s+10]=T.z;i.array[s+11]=T.w;i.offset+=12}}}}if(nb){s=0;for(G=morphTargets.length;s<G;s++){S=morphTargets[s].vertices[t.a].position;Q=morphTargets[s].vertices[t.b].position;T=morphTargets[s].vertices[t.c].position;i=hb[s];i[Ca+0]=S.x;i[Ca+1]=S.y;i[Ca+2]=S.z;i[Ca+3]=Q.x;i[Ca+4]=Q.y;i[Ca+5]=Q.z;i[Ca+6]=T.x;i[Ca+7]=T.y;i[Ca+8]=T.z}Ca+=9}if(Wa.length){s=Wa[t.a];G=Wa[t.b];i=Wa[t.c];ma[C]=s.x;ma[C+1]=s.y;ma[C+2]=s.z;ma[C+3]=s.w;ma[C+4]=G.x;ma[C+5]=G.y;ma[C+6]=G.z;ma[C+7]=G.w;ma[C+8]=i.x;ma[C+9]=
+tb=Ha.faceVertexUvs[1],bb=Ha.skinVerticesA,cb=Ha.skinVerticesB,db=Ha.skinIndices,Wa=Ha.skinWeights,Ya=f instanceof THREE.ShadowVolume?Ha.edgeFaces:undefined;morphTargets=Ha.morphTargets;if(Ra)for(Va in Ra){Ra[Va].offset=0;Ra[Va].offsetSrc=0}y=0;for(u=rb.length;y<u;y++){A=rb[y];t=ub[A];sb&&(X=sb[A]);tb&&(Ga=tb[A]);A=t.vertexNormals;w=t.normal;z=t.vertexColors;D=t.color;B=t.vertexTangents;if(t instanceof THREE.Face3){if(ib){T=ab[t.a].position;Q=ab[t.b].position;U=ab[t.c].position;Da[Ba]=T.x;Da[Ba+1]=
+T.y;Da[Ba+2]=T.z;Da[Ba+3]=Q.x;Da[Ba+4]=Q.y;Da[Ba+5]=Q.z;Da[Ba+6]=U.x;Da[Ba+7]=U.y;Da[Ba+8]=U.z;Ba+=9}if(Ra)for(Va in Ra){i=Ra[Va];if(i.needsUpdate){s=i.offset;G=i.offsetSrc;if(i.size===1){if(i.boundTo===undefined||i.boundTo==="vertices"){i.array[s+0]=i.value[t.a];i.array[s+1]=i.value[t.b];i.array[s+2]=i.value[t.c]}else if(i.boundTo==="faces"){i.array[s+0]=i.value[G];i.array[s+1]=i.value[G];i.array[s+2]=i.value[G];i.offsetSrc++}else if(i.boundTo==="faceVertices"){i.array[s+0]=i.value[G+0];i.array[s+
+1]=i.value[G+1];i.array[s+2]=i.value[G+2];i.offsetSrc+=3}i.offset+=3}else{if(i.boundTo===undefined||i.boundTo==="vertices"){T=i.value[t.a];Q=i.value[t.b];U=i.value[t.c]}else if(i.boundTo==="faces"){T=i.value[G];Q=i.value[G];U=i.value[G];i.offsetSrc++}else if(i.boundTo==="faceVertices"){T=i.value[G+0];Q=i.value[G+1];U=i.value[G+2];i.offsetSrc+=3}if(i.size===2){i.array[s+0]=T.x;i.array[s+1]=T.y;i.array[s+2]=Q.x;i.array[s+3]=Q.y;i.array[s+4]=U.x;i.array[s+5]=U.y;i.offset+=6}else if(i.size===3){if(i.type===
+"c"){i.array[s+0]=T.r;i.array[s+1]=T.g;i.array[s+2]=T.b;i.array[s+3]=Q.r;i.array[s+4]=Q.g;i.array[s+5]=Q.b;i.array[s+6]=U.r;i.array[s+7]=U.g;i.array[s+8]=U.b}else{i.array[s+0]=T.x;i.array[s+1]=T.y;i.array[s+2]=T.z;i.array[s+3]=Q.x;i.array[s+4]=Q.y;i.array[s+5]=Q.z;i.array[s+6]=U.x;i.array[s+7]=U.y;i.array[s+8]=U.z}i.offset+=9}else{i.array[s+0]=T.x;i.array[s+1]=T.y;i.array[s+2]=T.z;i.array[s+3]=T.w;i.array[s+4]=Q.x;i.array[s+5]=Q.y;i.array[s+6]=Q.z;i.array[s+7]=Q.w;i.array[s+8]=U.x;i.array[s+9]=U.y;
+i.array[s+10]=U.z;i.array[s+11]=U.w;i.offset+=12}}}}if(nb){s=0;for(G=morphTargets.length;s<G;s++){T=morphTargets[s].vertices[t.a].position;Q=morphTargets[s].vertices[t.b].position;U=morphTargets[s].vertices[t.c].position;i=hb[s];i[Ca+0]=T.x;i[Ca+1]=T.y;i[Ca+2]=T.z;i[Ca+3]=Q.x;i[Ca+4]=Q.y;i[Ca+5]=Q.z;i[Ca+6]=U.x;i[Ca+7]=U.y;i[Ca+8]=U.z}Ca+=9}if(Wa.length){s=Wa[t.a];G=Wa[t.b];i=Wa[t.c];ma[C]=s.x;ma[C+1]=s.y;ma[C+2]=s.z;ma[C+3]=s.w;ma[C+4]=G.x;ma[C+5]=G.y;ma[C+6]=G.z;ma[C+7]=G.w;ma[C+8]=i.x;ma[C+9]=
 i.y;ma[C+10]=i.z;ma[C+11]=i.w;s=db[t.a];G=db[t.b];i=db[t.c];la[C]=s.x;la[C+1]=s.y;la[C+2]=s.z;la[C+3]=s.w;la[C+4]=G.x;la[C+5]=G.y;la[C+6]=G.z;la[C+7]=G.w;la[C+8]=i.x;la[C+9]=i.y;la[C+10]=i.z;la[C+11]=i.w;s=bb[t.a];G=bb[t.b];i=bb[t.c];ja[C]=s.x;ja[C+1]=s.y;ja[C+2]=s.z;ja[C+3]=1;ja[C+4]=G.x;ja[C+5]=G.y;ja[C+6]=G.z;ja[C+7]=1;ja[C+8]=i.x;ja[C+9]=i.y;ja[C+10]=i.z;ja[C+11]=1;s=cb[t.a];G=cb[t.b];i=cb[t.c];ka[C]=s.x;ka[C+1]=s.y;ka[C+2]=s.z;ka[C+3]=1;ka[C+4]=G.x;ka[C+5]=G.y;ka[C+6]=G.z;ka[C+7]=1;ka[C+8]=i.x;
 ka[C+9]=i.y;ka[C+10]=i.z;ka[C+11]=1;C+=12}if(mb&&W){if(z.length==3&&W==THREE.VertexColors){t=z[0];s=z[1];G=z[2]}else G=s=t=D;Ea[wa]=t.r;Ea[wa+1]=t.g;Ea[wa+2]=t.b;Ea[wa+3]=s.r;Ea[wa+4]=s.g;Ea[wa+5]=s.b;Ea[wa+6]=G.r;Ea[wa+7]=G.g;Ea[wa+8]=G.b;wa+=9}if(lb&&Ha.hasTangents){z=B[0];D=B[1];t=B[2];ia[ea]=z.x;ia[ea+1]=z.y;ia[ea+2]=z.z;ia[ea+3]=z.w;ia[ea+4]=D.x;ia[ea+5]=D.y;ia[ea+6]=D.z;ia[ea+7]=D.w;ia[ea+8]=t.x;ia[ea+9]=t.y;ia[ea+10]=t.z;ia[ea+11]=t.w;ea+=12}if(kb&&P)if(A.length==3&&qb)for(B=0;B<3;B++){w=A[B];
-Qa[La]=w.x;Qa[La+1]=w.y;Qa[La+2]=w.z;La+=3}else for(B=0;B<3;B++){Qa[La]=w.x;Qa[La+1]=w.y;Qa[La+2]=w.z;La+=3}if(eb&&X!==undefined&&O)for(B=0;B<3;B++){A=X[B];fb[Za]=A.u;fb[Za+1]=A.v;Za+=2}if(eb&&Ga!==undefined&&O)for(B=0;B<3;B++){A=Ga[B];gb[$a]=A.u;gb[$a+1]=A.v;$a+=2}if(jb){Na[Ja]=ua;Na[Ja+1]=ua+1;Na[Ja+2]=ua+2;Ja+=3;Oa[Ma]=ua;Oa[Ma+1]=ua+1;Oa[Ma+2]=ua;Oa[Ma+3]=ua+2;Oa[Ma+4]=ua+1;Oa[Ma+5]=ua+2;Ma+=6;ua+=3}}else if(t instanceof THREE.Face4){if(ib){S=ab[t.a].position;Q=ab[t.b].position;T=ab[t.c].position;
-ta=ab[t.d].position;Da[Ba]=S.x;Da[Ba+1]=S.y;Da[Ba+2]=S.z;Da[Ba+3]=Q.x;Da[Ba+4]=Q.y;Da[Ba+5]=Q.z;Da[Ba+6]=T.x;Da[Ba+7]=T.y;Da[Ba+8]=T.z;Da[Ba+9]=ta.x;Da[Ba+10]=ta.y;Da[Ba+11]=ta.z;Ba+=12}if(Ra)for(Va in Ra){i=Ra[Va];if(i.needsUpdate){s=i.offset;G=i.offsetSrc;if(i.size===1){if(i.boundTo===undefined||i.boundTo==="vertices"){i.array[s+0]=i.value[t.a];i.array[s+1]=i.value[t.b];i.array[s+2]=i.value[t.c];i.array[s+2]=i.value[t.d]}else if(i.boundTo==="faces"){i.array[s+0]=i.value[G];i.array[s+1]=i.value[G];
-i.array[s+2]=i.value[G];i.array[s+2]=i.value[G];i.offsetSrc++}else if(i.boundTo==="faceVertices"){i.array[s+0]=i.value[G+0];i.array[s+1]=i.value[G+1];i.array[s+2]=i.value[G+2];i.array[s+2]=i.value[G+3];i.offsetSrc+=4}i.offset+=4}else{if(i.boundTo===undefined||i.boundTo==="vertices"){S=i.value[t.a];Q=i.value[t.b];T=i.value[t.c];ta=i.value[t.d]}else if(i.boundTo==="faces"){S=i.value[G];Q=i.value[G];T=i.value[G];ta=i.value[G];i.offsetSrc++}else if(i.boundTo==="faceVertices"){S=i.value[G+0];Q=i.value[G+
-1];T=i.value[G+2];ta=i.value[G+3];i.offsetSrc+=4}if(i.size===2){i.array[s+0]=S.x;i.array[s+1]=S.y;i.array[s+2]=Q.x;i.array[s+3]=Q.y;i.array[s+4]=T.x;i.array[s+5]=T.y;i.array[s+6]=ta.x;i.array[s+7]=ta.y;i.offset+=8}else if(i.size===3){if(i.type==="c"){i.array[s+0]=S.r;i.array[s+1]=S.g;i.array[s+2]=S.b;i.array[s+3]=Q.r;i.array[s+4]=Q.g;i.array[s+5]=Q.b;i.array[s+6]=T.r;i.array[s+7]=T.g;i.array[s+8]=T.b;i.array[s+9]=ta.r;i.array[s+10]=ta.g;i.array[s+11]=ta.b}else{i.array[s+0]=S.x;i.array[s+1]=S.y;i.array[s+
-2]=S.z;i.array[s+3]=Q.x;i.array[s+4]=Q.y;i.array[s+5]=Q.z;i.array[s+6]=T.x;i.array[s+7]=T.y;i.array[s+8]=T.z;i.array[s+9]=ta.x;i.array[s+10]=ta.y;i.array[s+11]=ta.z}i.offset+=12}else{i.array[s+0]=S.x;i.array[s+1]=S.y;i.array[s+2]=S.z;i.array[s+3]=S.w;i.array[s+4]=Q.x;i.array[s+5]=Q.y;i.array[s+6]=Q.z;i.array[s+7]=Q.w;i.array[s+8]=T.x;i.array[s+9]=T.y;i.array[s+10]=T.z;i.array[s+11]=T.w;i.array[s+12]=ta.x;i.array[s+13]=ta.y;i.array[s+14]=ta.z;i.array[s+15]=ta.w;i.offset+=16}}}}if(nb){s=0;for(G=morphTargets.length;s<
-G;s++){S=morphTargets[s].vertices[t.a].position;Q=morphTargets[s].vertices[t.b].position;T=morphTargets[s].vertices[t.c].position;ta=morphTargets[s].vertices[t.d].position;i=hb[s];i[Ca+0]=S.x;i[Ca+1]=S.y;i[Ca+2]=S.z;i[Ca+3]=Q.x;i[Ca+4]=Q.y;i[Ca+5]=Q.z;i[Ca+6]=T.x;i[Ca+7]=T.y;i[Ca+8]=T.z;i[Ca+9]=ta.x;i[Ca+10]=ta.y;i[Ca+11]=ta.z}Ca+=12}if(Wa.length){s=Wa[t.a];G=Wa[t.b];i=Wa[t.c];Ka=Wa[t.d];ma[C]=s.x;ma[C+1]=s.y;ma[C+2]=s.z;ma[C+3]=s.w;ma[C+4]=G.x;ma[C+5]=G.y;ma[C+6]=G.z;ma[C+7]=G.w;ma[C+8]=i.x;ma[C+
+Qa[La]=w.x;Qa[La+1]=w.y;Qa[La+2]=w.z;La+=3}else for(B=0;B<3;B++){Qa[La]=w.x;Qa[La+1]=w.y;Qa[La+2]=w.z;La+=3}if(eb&&X!==undefined&&O)for(B=0;B<3;B++){A=X[B];fb[Za]=A.u;fb[Za+1]=A.v;Za+=2}if(eb&&Ga!==undefined&&O)for(B=0;B<3;B++){A=Ga[B];gb[$a]=A.u;gb[$a+1]=A.v;$a+=2}if(jb){Na[Ja]=ua;Na[Ja+1]=ua+1;Na[Ja+2]=ua+2;Ja+=3;Oa[Ma]=ua;Oa[Ma+1]=ua+1;Oa[Ma+2]=ua;Oa[Ma+3]=ua+2;Oa[Ma+4]=ua+1;Oa[Ma+5]=ua+2;Ma+=6;ua+=3}}else if(t instanceof THREE.Face4){if(ib){T=ab[t.a].position;Q=ab[t.b].position;U=ab[t.c].position;
+ta=ab[t.d].position;Da[Ba]=T.x;Da[Ba+1]=T.y;Da[Ba+2]=T.z;Da[Ba+3]=Q.x;Da[Ba+4]=Q.y;Da[Ba+5]=Q.z;Da[Ba+6]=U.x;Da[Ba+7]=U.y;Da[Ba+8]=U.z;Da[Ba+9]=ta.x;Da[Ba+10]=ta.y;Da[Ba+11]=ta.z;Ba+=12}if(Ra)for(Va in Ra){i=Ra[Va];if(i.needsUpdate){s=i.offset;G=i.offsetSrc;if(i.size===1){if(i.boundTo===undefined||i.boundTo==="vertices"){i.array[s+0]=i.value[t.a];i.array[s+1]=i.value[t.b];i.array[s+2]=i.value[t.c];i.array[s+2]=i.value[t.d]}else if(i.boundTo==="faces"){i.array[s+0]=i.value[G];i.array[s+1]=i.value[G];
+i.array[s+2]=i.value[G];i.array[s+2]=i.value[G];i.offsetSrc++}else if(i.boundTo==="faceVertices"){i.array[s+0]=i.value[G+0];i.array[s+1]=i.value[G+1];i.array[s+2]=i.value[G+2];i.array[s+2]=i.value[G+3];i.offsetSrc+=4}i.offset+=4}else{if(i.boundTo===undefined||i.boundTo==="vertices"){T=i.value[t.a];Q=i.value[t.b];U=i.value[t.c];ta=i.value[t.d]}else if(i.boundTo==="faces"){T=i.value[G];Q=i.value[G];U=i.value[G];ta=i.value[G];i.offsetSrc++}else if(i.boundTo==="faceVertices"){T=i.value[G+0];Q=i.value[G+
+1];U=i.value[G+2];ta=i.value[G+3];i.offsetSrc+=4}if(i.size===2){i.array[s+0]=T.x;i.array[s+1]=T.y;i.array[s+2]=Q.x;i.array[s+3]=Q.y;i.array[s+4]=U.x;i.array[s+5]=U.y;i.array[s+6]=ta.x;i.array[s+7]=ta.y;i.offset+=8}else if(i.size===3){if(i.type==="c"){i.array[s+0]=T.r;i.array[s+1]=T.g;i.array[s+2]=T.b;i.array[s+3]=Q.r;i.array[s+4]=Q.g;i.array[s+5]=Q.b;i.array[s+6]=U.r;i.array[s+7]=U.g;i.array[s+8]=U.b;i.array[s+9]=ta.r;i.array[s+10]=ta.g;i.array[s+11]=ta.b}else{i.array[s+0]=T.x;i.array[s+1]=T.y;i.array[s+
+2]=T.z;i.array[s+3]=Q.x;i.array[s+4]=Q.y;i.array[s+5]=Q.z;i.array[s+6]=U.x;i.array[s+7]=U.y;i.array[s+8]=U.z;i.array[s+9]=ta.x;i.array[s+10]=ta.y;i.array[s+11]=ta.z}i.offset+=12}else{i.array[s+0]=T.x;i.array[s+1]=T.y;i.array[s+2]=T.z;i.array[s+3]=T.w;i.array[s+4]=Q.x;i.array[s+5]=Q.y;i.array[s+6]=Q.z;i.array[s+7]=Q.w;i.array[s+8]=U.x;i.array[s+9]=U.y;i.array[s+10]=U.z;i.array[s+11]=U.w;i.array[s+12]=ta.x;i.array[s+13]=ta.y;i.array[s+14]=ta.z;i.array[s+15]=ta.w;i.offset+=16}}}}if(nb){s=0;for(G=morphTargets.length;s<
+G;s++){T=morphTargets[s].vertices[t.a].position;Q=morphTargets[s].vertices[t.b].position;U=morphTargets[s].vertices[t.c].position;ta=morphTargets[s].vertices[t.d].position;i=hb[s];i[Ca+0]=T.x;i[Ca+1]=T.y;i[Ca+2]=T.z;i[Ca+3]=Q.x;i[Ca+4]=Q.y;i[Ca+5]=Q.z;i[Ca+6]=U.x;i[Ca+7]=U.y;i[Ca+8]=U.z;i[Ca+9]=ta.x;i[Ca+10]=ta.y;i[Ca+11]=ta.z}Ca+=12}if(Wa.length){s=Wa[t.a];G=Wa[t.b];i=Wa[t.c];Ka=Wa[t.d];ma[C]=s.x;ma[C+1]=s.y;ma[C+2]=s.z;ma[C+3]=s.w;ma[C+4]=G.x;ma[C+5]=G.y;ma[C+6]=G.z;ma[C+7]=G.w;ma[C+8]=i.x;ma[C+
 9]=i.y;ma[C+10]=i.z;ma[C+11]=i.w;ma[C+12]=Ka.x;ma[C+13]=Ka.y;ma[C+14]=Ka.z;ma[C+15]=Ka.w;s=db[t.a];G=db[t.b];i=db[t.c];Ka=db[t.d];la[C]=s.x;la[C+1]=s.y;la[C+2]=s.z;la[C+3]=s.w;la[C+4]=G.x;la[C+5]=G.y;la[C+6]=G.z;la[C+7]=G.w;la[C+8]=i.x;la[C+9]=i.y;la[C+10]=i.z;la[C+11]=i.w;la[C+12]=Ka.x;la[C+13]=Ka.y;la[C+14]=Ka.z;la[C+15]=Ka.w;s=bb[t.a];G=bb[t.b];i=bb[t.c];Ka=bb[t.d];ja[C]=s.x;ja[C+1]=s.y;ja[C+2]=s.z;ja[C+3]=1;ja[C+4]=G.x;ja[C+5]=G.y;ja[C+6]=G.z;ja[C+7]=1;ja[C+8]=i.x;ja[C+9]=i.y;ja[C+10]=i.z;ja[C+
 11]=1;ja[C+12]=Ka.x;ja[C+13]=Ka.y;ja[C+14]=Ka.z;ja[C+15]=1;s=cb[t.a];G=cb[t.b];i=cb[t.c];t=cb[t.d];ka[C]=s.x;ka[C+1]=s.y;ka[C+2]=s.z;ka[C+3]=1;ka[C+4]=G.x;ka[C+5]=G.y;ka[C+6]=G.z;ka[C+7]=1;ka[C+8]=i.x;ka[C+9]=i.y;ka[C+10]=i.z;ka[C+11]=1;ka[C+12]=t.x;ka[C+13]=t.y;ka[C+14]=t.z;ka[C+15]=1;C+=16}if(mb&&W){if(z.length==4&&W==THREE.VertexColors){t=z[0];s=z[1];G=z[2];z=z[3]}else z=G=s=t=D;Ea[wa]=t.r;Ea[wa+1]=t.g;Ea[wa+2]=t.b;Ea[wa+3]=s.r;Ea[wa+4]=s.g;Ea[wa+5]=s.b;Ea[wa+6]=G.r;Ea[wa+7]=G.g;Ea[wa+8]=G.b;Ea[wa+
 9]=z.r;Ea[wa+10]=z.g;Ea[wa+11]=z.b;wa+=12}if(lb&&Ha.hasTangents){z=B[0];D=B[1];t=B[2];B=B[3];ia[ea]=z.x;ia[ea+1]=z.y;ia[ea+2]=z.z;ia[ea+3]=z.w;ia[ea+4]=D.x;ia[ea+5]=D.y;ia[ea+6]=D.z;ia[ea+7]=D.w;ia[ea+8]=t.x;ia[ea+9]=t.y;ia[ea+10]=t.z;ia[ea+11]=t.w;ia[ea+12]=B.x;ia[ea+13]=B.y;ia[ea+14]=B.z;ia[ea+15]=B.w;ea+=16}if(kb&&P)if(A.length==4&&qb)for(B=0;B<4;B++){w=A[B];Qa[La]=w.x;Qa[La+1]=w.y;Qa[La+2]=w.z;La+=3}else for(B=0;B<4;B++){Qa[La]=w.x;Qa[La+1]=w.y;Qa[La+2]=w.z;La+=3}if(eb&&X!==undefined&&O)for(B=
@@ -242,12 +242,12 @@ c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,fa(f.wrapT));c.texParameteri(c.TEX
 null);c.bindRenderbuffer(c.RENDERBUFFER,null);c.bindFramebuffer(c.FRAMEBUFFER,null)}var p,j;if(f){p=f.__webglFramebuffer;j=f.width;f=f.height}else{p=null;j=za;f=Aa}if(p!=ya){c.bindFramebuffer(c.FRAMEBUFFER,p);c.viewport(va,qa,j,f);ya=p}}function ca(f,p){var j;if(f=="fragment")j=c.createShader(c.FRAGMENT_SHADER);else f=="vertex"&&(j=c.createShader(c.VERTEX_SHADER));c.shaderSource(j,p);c.compileShader(j);if(!c.getShaderParameter(j,c.COMPILE_STATUS)){console.error(c.getShaderInfoLog(j));console.error(p);
 return null}return j}function Fa(f){switch(f){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return c.NEAREST;default:return c.LINEAR}}function fa(f){switch(f){case THREE.RepeatWrapping:return c.REPEAT;case THREE.ClampToEdgeWrapping:return c.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return c.MIRRORED_REPEAT;case THREE.NearestFilter:return c.NEAREST;case THREE.NearestMipMapNearestFilter:return c.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return c.NEAREST_MIPMAP_LINEAR;
 case THREE.LinearFilter:return c.LINEAR;case THREE.LinearMipMapNearestFilter:return c.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return c.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return c.BYTE;case THREE.UnsignedByteType:return c.UNSIGNED_BYTE;case THREE.ShortType:return c.SHORT;case THREE.UnsignedShortType:return c.UNSIGNED_SHORT;case THREE.IntType:return c.INT;case THREE.UnsignedShortType:return c.UNSIGNED_INT;case THREE.FloatType:return c.FLOAT;case THREE.AlphaFormat:return c.ALPHA;
-case THREE.RGBFormat:return c.RGB;case THREE.RGBAFormat:return c.RGBA;case THREE.LuminanceFormat:return c.LUMINANCE;case THREE.LuminanceAlphaFormat:return c.LUMINANCE_ALPHA}return 0}var V=this,c,ga=document.createElement("canvas"),xa=[],sa=null,ya=null,Y=!0,na=null,oa=null,ha=null,Z=null,va=0,qa=0,za=0,Aa=0,aa=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Pa=new THREE.Matrix4,Ta=new Float32Array(16),Xa=new Float32Array(16),Ua=new THREE.Vector4,
-Sa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}};b=b||{};stencil=b.stencil!==undefined?b.stencil:!0;antialias=b.antialias!==undefined?b.antialias:!1;clearColor=b.clearColor!==undefined?new THREE.Color(b.clearColor):new THREE.Color(0);clearAlpha=b.clearAlpha!==undefined?b.clearAlpha:0;this.data={vertices:0,faces:0};this.maxMorphTargets=8;this.domElement=ga;this.autoClear=!0;this.sortObjects=!0;(function(f,p,j,k){try{if(!(c=ga.getContext("experimental-webgl",
-{antialias:f,stencil:k})))throw"Error creating WebGL context.";}catch(m){console.error(m)}console.log(navigator.userAgent+" | "+c.getParameter(c.VERSION)+" | "+c.getParameter(c.VENDOR)+" | "+c.getParameter(c.RENDERER)+" | "+c.getParameter(c.SHADING_LANGUAGE_VERSION));c.clearColor(0,0,0,1);c.clearDepth(1);c.enable(c.DEPTH_TEST);c.depthFunc(c.LEQUAL);c.frontFace(c.CCW);c.cullFace(c.BACK);c.enable(c.CULL_FACE);c.enable(c.BLEND);c.blendEquation(c.FUNC_ADD);c.blendFunc(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA);
-c.clearColor(p.r,p.g,p.b,j)})(antialias,clearColor,clearAlpha,stencil);this.context=c;if(stencil){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=c.createBuffer();
-R.elementBuffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,R.vertexBuffer);c.bufferData(c.ARRAY_BUFFER,R.vertices,c.STATIC_DRAW);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,R.elementBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,R.faces,c.STATIC_DRAW);R.program=c.createProgram();c.attachShader(R.program,ca("fragment",THREE.ShaderLib.shadowPost.fragmentShader));c.attachShader(R.program,ca("vertex",THREE.ShaderLib.shadowPost.vertexShader));c.linkProgram(R.program);R.vertexLocation=c.getAttribLocation(R.program,
-"position");R.projectionLocation=c.getUniformLocation(R.program,"projectionMatrix");R.darknessLocation=c.getUniformLocation(R.program,"darkness")}var J={};J.vertices=new Float32Array(16);J.faces=new Uint16Array(6);b=0;J.vertices[b++]=-1;J.vertices[b++]=-1;J.vertices[b++]=0;J.vertices[b++]=0;J.vertices[b++]=1;J.vertices[b++]=-1;J.vertices[b++]=1;J.vertices[b++]=0;J.vertices[b++]=1;J.vertices[b++]=1;J.vertices[b++]=1;J.vertices[b++]=1;J.vertices[b++]=-1;J.vertices[b++]=1;J.vertices[b++]=0;J.vertices[b++]=
+case THREE.RGBFormat:return c.RGB;case THREE.RGBAFormat:return c.RGBA;case THREE.LuminanceFormat:return c.LUMINANCE;case THREE.LuminanceAlphaFormat:return c.LUMINANCE_ALPHA}return 0}var R=this,c,ga=document.createElement("canvas"),xa=[],sa=null,ya=null,Y=!0,na=null,oa=null,ha=null,Z=null,va=0,qa=0,za=0,Aa=0,aa=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Pa=new THREE.Matrix4,Ta=new Float32Array(16),Xa=new Float32Array(16),Ua=new THREE.Vector4,
+Sa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}};b=b||{};stencil=b.stencil!==undefined?b.stencil:!0;antialias=b.antialias!==undefined?b.antialias:!1;clearColor=b.clearColor!==undefined?new THREE.Color(b.clearColor):new THREE.Color(0);clearAlpha=b.clearAlpha!==undefined?b.clearAlpha:0;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=ga;this.autoClear=!0;this.sortObjects=!0;(function(f,p,j,k){try{if(!(c=
+ga.getContext("experimental-webgl",{antialias:f,stencil:k})))throw"Error creating WebGL context.";}catch(m){console.error(m)}console.log(navigator.userAgent+" | "+c.getParameter(c.VERSION)+" | "+c.getParameter(c.VENDOR)+" | "+c.getParameter(c.RENDERER)+" | "+c.getParameter(c.SHADING_LANGUAGE_VERSION));c.clearColor(0,0,0,1);c.clearDepth(1);c.enable(c.DEPTH_TEST);c.depthFunc(c.LEQUAL);c.frontFace(c.CCW);c.cullFace(c.BACK);c.enable(c.CULL_FACE);c.enable(c.BLEND);c.blendEquation(c.FUNC_ADD);c.blendFunc(c.SRC_ALPHA,
+c.ONE_MINUS_SRC_ALPHA);c.clearColor(p.r,p.g,p.b,j)})(antialias,clearColor,clearAlpha,stencil);this.context=c;if(stencil){var S={};S.vertices=new Float32Array(12);S.faces=new Uint16Array(6);S.darkness=0.5;S.vertices[0]=-20;S.vertices[1]=-20;S.vertices[2]=-1;S.vertices[3]=20;S.vertices[4]=-20;S.vertices[5]=-1;S.vertices[6]=20;S.vertices[7]=20;S.vertices[8]=-1;S.vertices[9]=-20;S.vertices[10]=20;S.vertices[11]=-1;S.faces[0]=0;S.faces[1]=1;S.faces[2]=2;S.faces[3]=0;S.faces[4]=2;S.faces[5]=3;S.vertexBuffer=
+c.createBuffer();S.elementBuffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,S.vertexBuffer);c.bufferData(c.ARRAY_BUFFER,S.vertices,c.STATIC_DRAW);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,S.elementBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,S.faces,c.STATIC_DRAW);S.program=c.createProgram();c.attachShader(S.program,ca("fragment",THREE.ShaderLib.shadowPost.fragmentShader));c.attachShader(S.program,ca("vertex",THREE.ShaderLib.shadowPost.vertexShader));c.linkProgram(S.program);S.vertexLocation=c.getAttribLocation(S.program,
+"position");S.projectionLocation=c.getUniformLocation(S.program,"projectionMatrix");S.darknessLocation=c.getUniformLocation(S.program,"darkness")}var J={};J.vertices=new Float32Array(16);J.faces=new Uint16Array(6);b=0;J.vertices[b++]=-1;J.vertices[b++]=-1;J.vertices[b++]=0;J.vertices[b++]=0;J.vertices[b++]=1;J.vertices[b++]=-1;J.vertices[b++]=1;J.vertices[b++]=0;J.vertices[b++]=1;J.vertices[b++]=1;J.vertices[b++]=1;J.vertices[b++]=1;J.vertices[b++]=-1;J.vertices[b++]=1;J.vertices[b++]=0;J.vertices[b++]=
 1;b=0;J.faces[b++]=0;J.faces[b++]=1;J.faces[b++]=2;J.faces[b++]=0;J.faces[b++]=2;J.faces[b++]=3;J.vertexBuffer=c.createBuffer();J.elementBuffer=c.createBuffer();J.tempTexture=c.createTexture();J.occlusionTexture=c.createTexture();c.bindBuffer(c.ARRAY_BUFFER,J.vertexBuffer);c.bufferData(c.ARRAY_BUFFER,J.vertices,c.STATIC_DRAW);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,J.elementBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,J.faces,c.STATIC_DRAW);c.bindTexture(c.TEXTURE_2D,J.tempTexture);c.texImage2D(c.TEXTURE_2D,
 0,c.RGB,16,16,0,c.RGB,c.UNSIGNED_BYTE,null);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,c.NEAREST);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,c.NEAREST);c.bindTexture(c.TEXTURE_2D,J.occlusionTexture);c.texImage2D(c.TEXTURE_2D,0,c.RGBA,16,16,0,c.RGBA,c.UNSIGNED_BYTE,null);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_2D,
 c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,c.NEAREST);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,c.NEAREST);if(c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0){J.hasVertexTexture=!1;J.program=c.createProgram();c.attachShader(J.program,ca("fragment",THREE.ShaderLib.lensFlare.fragmentShader));c.attachShader(J.program,ca("vertex",THREE.ShaderLib.lensFlare.vertexShader))}else{J.hasVertexTexture=!0;J.program=c.createProgram();c.attachShader(J.program,
@@ -258,7 +258,7 @@ c.bufferData(c.ARRAY_BUFFER,_sprite.vertices,c.STATIC_DRAW);c.bindBuffer(c.ELEME
 "position");_sprite.attributes.uv=c.getAttribLocation(_sprite.program,"uv");_sprite.uniforms.uvOffset=c.getUniformLocation(_sprite.program,"uvOffset");_sprite.uniforms.uvScale=c.getUniformLocation(_sprite.program,"uvScale");_sprite.uniforms.rotation=c.getUniformLocation(_sprite.program,"rotation");_sprite.uniforms.scale=c.getUniformLocation(_sprite.program,"scale");_sprite.uniforms.alignment=c.getUniformLocation(_sprite.program,"alignment");_sprite.uniforms.map=c.getUniformLocation(_sprite.program,
 "map");_sprite.uniforms.opacity=c.getUniformLocation(_sprite.program,"opacity");_sprite.uniforms.useScreenCoordinates=c.getUniformLocation(_sprite.program,"useScreenCoordinates");_sprite.uniforms.affectedByDistance=c.getUniformLocation(_sprite.program,"affectedByDistance");_sprite.uniforms.screenPosition=c.getUniformLocation(_sprite.program,"screenPosition");_sprite.uniforms.modelViewMatrix=c.getUniformLocation(_sprite.program,"modelViewMatrix");_sprite.uniforms.projectionMatrix=c.getUniformLocation(_sprite.program,
 "projectionMatrix");var ob=!1;this.setSize=function(f,p){ga.width=f;ga.height=p;this.setViewport(0,0,ga.width,ga.height)};this.setViewport=function(f,p,j,k){va=f;qa=p;za=j;Aa=k;c.viewport(va,qa,za,Aa)};this.setScissor=function(f,p,j,k){c.scissor(f,p,j,k)};this.enableScissorTest=function(f){f?c.enable(c.SCISSOR_TEST):c.disable(c.SCISSOR_TEST)};this.enableDepthBufferWrite=function(f){Y=f;c.depthMask(f)};this.setClearColorHex=function(f,p){var j=new THREE.Color(f);c.clearColor(j.r,j.g,j.b,p)};this.setClearColor=
-function(f,p){c.clearColor(f.r,f.g,f.b,p)};this.clear=function(){c.clear(c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT|c.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(f){R.darkness=f};this.getContext=function(){return c};this.initMaterial=function(f,p,j,k){var m,x,y;if(f instanceof THREE.MeshDepthMaterial)y="depth";else if(f instanceof THREE.ShadowVolumeDynamicMaterial)y="shadowVolumeDynamic";else if(f instanceof THREE.MeshNormalMaterial)y="normal";else if(f instanceof THREE.MeshBasicMaterial)y=
+function(f,p){c.clearColor(f.r,f.g,f.b,p)};this.clear=function(){c.clear(c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT|c.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(f){S.darkness=f};this.getContext=function(){return c};this.initMaterial=function(f,p,j,k){var m,x,y;if(f instanceof THREE.MeshDepthMaterial)y="depth";else if(f instanceof THREE.ShadowVolumeDynamicMaterial)y="shadowVolumeDynamic";else if(f instanceof THREE.MeshNormalMaterial)y="normal";else if(f instanceof THREE.MeshBasicMaterial)y=
 "basic";else if(f instanceof THREE.MeshLambertMaterial)y="lambert";else if(f instanceof THREE.MeshPhongMaterial)y="phong";else if(f instanceof THREE.LineBasicMaterial)y="basic";else f instanceof THREE.ParticleBasicMaterial&&(y="particle_basic");if(y){var u=THREE.ShaderLib[y];f.uniforms=THREE.UniformsUtils.clone(u.uniforms);f.vertexShader=u.vertexShader;f.fragmentShader=u.fragmentShader}var A,t,w;A=w=u=0;for(t=p.length;A<t;A++){x=p[A];x instanceof THREE.DirectionalLight&&w++;x instanceof THREE.PointLight&&
 u++}if(u+w<=4)p=w;else{p=Math.ceil(4*w/(u+w));u=4-p}x={directional:p,point:u};w=50;if(k!==undefined&&k instanceof THREE.SkinnedMesh)w=k.bones.length;var z;a:{A=f.fragmentShader;t=f.vertexShader;u=f.uniforms;p=f.attributes;j={map:!!f.map,envMap:!!f.envMap,lightMap:!!f.lightMap,vertexColors:f.vertexColors,fog:j,sizeAttenuation:f.sizeAttenuation,skinning:f.skinning,morphTargets:f.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:x.directional,maxPointLights:x.point,maxBones:w};var D;x=[];
 if(y)x.push(y);else{x.push(A);x.push(t)}for(D in j){x.push(D);x.push(j[D])}y=x.join();D=0;for(x=xa.length;D<x;D++)if(xa[D].code==y){z=xa[D].program;break a}D=c.createProgram();prefix_fragment=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+j.maxDirLights,"#define MAX_POINT_LIGHTS "+j.maxPointLights,j.fog?"#define USE_FOG":"",j.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",j.map?"#define USE_MAP":"",j.envMap?"#define USE_ENVMAP":"",j.lightMap?"#define USE_LIGHTMAP":"",
@@ -268,23 +268,23 @@ c.attachShader(D,ca("fragment",prefix_fragment+A));c.attachShader(D,ca("vertex",
 B=A;u=0;for(A=B.length;u<A;u++){t=B[u];D.uniforms[t]=c.getUniformLocation(D,t)}A=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(B=0;B<j.maxMorphTargets;B++)A.push("morphTarget"+B);for(z in p)A.push(z);z=A;B=0;for(p=z.length;B<p;B++){j=z[B];D.attributes[j]=c.getAttribLocation(D,j)}xa.push({program:D,code:y});z=D}f.program=z;z=f.program.attributes;c.enableVertexAttribArray(z.position);z.color>=0&&c.enableVertexAttribArray(z.color);z.normal>=
 0&&c.enableVertexAttribArray(z.normal);z.tangent>=0&&c.enableVertexAttribArray(z.tangent);if(f.skinning&&z.skinVertexA>=0&&z.skinVertexB>=0&&z.skinIndex>=0&&z.skinWeight>=0){c.enableVertexAttribArray(z.skinVertexA);c.enableVertexAttribArray(z.skinVertexB);c.enableVertexAttribArray(z.skinIndex);c.enableVertexAttribArray(z.skinWeight)}for(m in f.attributes)z[m]>=0&&c.enableVertexAttribArray(z[m]);if(f.morphTargets){f.numSupportedMorphTargets=0;if(z.morphTarget0>=0){c.enableVertexAttribArray(z.morphTarget0);
 f.numSupportedMorphTargets++}if(z.morphTarget1>=0){c.enableVertexAttribArray(z.morphTarget1);f.numSupportedMorphTargets++}if(z.morphTarget2>=0){c.enableVertexAttribArray(z.morphTarget2);f.numSupportedMorphTargets++}if(z.morphTarget3>=0){c.enableVertexAttribArray(z.morphTarget3);f.numSupportedMorphTargets++}if(z.morphTarget4>=0){c.enableVertexAttribArray(z.morphTarget4);f.numSupportedMorphTargets++}if(z.morphTarget5>=0){c.enableVertexAttribArray(z.morphTarget5);f.numSupportedMorphTargets++}if(z.morphTarget6>=
-0){c.enableVertexAttribArray(z.morphTarget6);f.numSupportedMorphTargets++}if(z.morphTarget7>=0){c.enableVertexAttribArray(z.morphTarget7);f.numSupportedMorphTargets++}k.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);f=0;for(m=this.maxMorphTargets;f<m;f++)k.__webglMorphTargetInfluences[f]=0}};this.render=function(f,p,j,k){var m,x,y,u,A,t,w,z,D=f.lights,B=f.fog;V.data.vertices=0;V.data.faces=0;p.matrixAutoUpdate&&p.update(undefined,!0);f.update(undefined,!1,p);p.matrixWorldInverse.flattenToArray(Xa);
-p.projectionMatrix.flattenToArray(Ta);Pa.multiply(p.projectionMatrix,p.matrixWorldInverse);q(Pa);this.initWebGLObjects(f);Ia(j);(this.autoClear||k)&&this.clear();A=f.__webglObjects.length;for(k=0;k<A;k++){m=f.__webglObjects[k];w=m.object;if(w.visible)if(!(w instanceof THREE.Mesh)||r(w)){w.matrixWorld.flattenToArray(w._objectMatrixArray);U(w,p);F(m);m.render=!0;if(this.sortObjects){Ua.copy(w.position);Pa.multiplyVector3(Ua);m.z=Ua.z}}else m.render=!1;else m.render=!1}this.sortObjects&&f.__webglObjects.sort(H);
-t=f.__webglObjectsImmediate.length;for(k=0;k<t;k++){m=f.__webglObjectsImmediate[k];w=m.object;if(w.visible){w.matrixAutoUpdate&&w.matrixWorld.flattenToArray(w._objectMatrixArray);U(w,p);E(m)}}pa(THREE.NormalBlending);for(k=0;k<A;k++){m=f.__webglObjects[k];if(m.render){w=m.object;z=m.buffer;y=m.opaque;o(w);for(m=0;m<y.count;m++){u=y.list[m];n(u.depthTest);g(p,D,B,u,z,w)}}}for(k=0;k<t;k++){m=f.__webglObjectsImmediate[k];w=m.object;if(w.visible){y=m.opaque;o(w);for(m=0;m<y.count;m++){u=y.list[m];n(u.depthTest);
-x=e(p,D,B,u,w);w.render(function(O){h(O,x,u.shading)})}}}for(k=0;k<A;k++){m=f.__webglObjects[k];if(m.render){w=m.object;z=m.buffer;y=m.transparent;o(w);for(m=0;m<y.count;m++){u=y.list[m];pa(u.blending);n(u.depthTest);g(p,D,B,u,z,w)}}}for(k=0;k<t;k++){m=f.__webglObjectsImmediate[k];w=m.object;if(w.visible){y=m.transparent;o(w);for(m=0;m<y.count;m++){u=y.list[m];pa(u.blending);n(u.depthTest);x=e(p,D,B,u,w);w.render(function(O){h(O,x,u.shading)})}}}f.__webglSprites.length&&M(f,p);stencil&&f.__webglShadowVolumes.length&&
-f.lights.length&&I(f);f.__webglLensFlares.length&&N(f,p);if(j&&j.minFilter!==THREE.NearestFilter&&j.minFilter!==THREE.LinearFilter){c.bindTexture(c.TEXTURE_2D,j.__webglTexture);c.generateMipmap(c.TEXTURE_2D);c.bindTexture(c.TEXTURE_2D,null)}};this.initWebGLObjects=function(f){if(!f.__webglObjects){f.__webglObjects=[];f.__webglObjectsImmediate=[];f.__webglShadowVolumes=[];f.__webglLensFlares=[];f.__webglSprites=[]}for(;f.__objectsAdded.length;){var p=f.__objectsAdded[0],j=f,k=void 0,m=void 0,x=void 0;
-if(p._modelViewMatrix==undefined){p._modelViewMatrix=new THREE.Matrix4;p._normalMatrixArray=new Float32Array(9);p._modelViewMatrixArray=new Float32Array(16);p._objectMatrixArray=new Float32Array(16);p.matrixWorld.flattenToArray(p._objectMatrixArray)}if(p instanceof THREE.Mesh){m=p.geometry;m.geometryGroups==undefined&&ra(m);for(k in m.geometryGroups){x=m.geometryGroups[k];if(!x.__webglVertexBuffer){var y=x;y.__webglVertexBuffer=c.createBuffer();y.__webglNormalBuffer=c.createBuffer();y.__webglTangentBuffer=
-c.createBuffer();y.__webglColorBuffer=c.createBuffer();y.__webglUVBuffer=c.createBuffer();y.__webglUV2Buffer=c.createBuffer();y.__webglSkinVertexABuffer=c.createBuffer();y.__webglSkinVertexBBuffer=c.createBuffer();y.__webglSkinIndicesBuffer=c.createBuffer();y.__webglSkinWeightsBuffer=c.createBuffer();y.__webglFaceBuffer=c.createBuffer();y.__webglLineBuffer=c.createBuffer();if(y.numMorphTargets){var u=void 0,A=void 0;y.__webglMorphTargetsBuffers=[];u=0;for(A=y.numMorphTargets;u<A;u++)y.__webglMorphTargetsBuffers.push(c.createBuffer())}y=
-x;u=p;var t=void 0,w=void 0,z=void 0;z=void 0;var D=void 0,B=void 0,O=void 0,W=O=A=0;w=void 0;z=void 0;var P=void 0;t=void 0;w=void 0;D=u.geometry;P=D.faces;B=y.faces;t=0;for(w=B.length;t<w;t++){z=B[t];z=P[z];if(z instanceof THREE.Face3){A+=3;O+=1;W+=3}else if(z instanceof THREE.Face4){A+=4;O+=2;W+=4}}t=y;w=u;P=void 0;B=void 0;var X=void 0,Ga=void 0;X=void 0;z=[];P=0;for(B=w.materials.length;P<B;P++){X=w.materials[P];if(X instanceof THREE.MeshFaceMaterial){X=0;for(l=t.materials.length;X<l;X++)(Ga=
-t.materials[X])&&z.push(Ga)}else(Ga=X)&&z.push(Ga)}t=z;a:{w=void 0;P=void 0;B=t.length;for(w=0;w<B;w++){P=t[w];if(P.map||P.lightMap||P instanceof THREE.MeshShaderMaterial){w=!0;break a}}w=!1}a:{P=void 0;B=void 0;z=t.length;for(P=0;P<z;P++){B=t[P];if(!(B instanceof THREE.MeshBasicMaterial&&!B.envMap||B instanceof THREE.MeshDepthMaterial)){P=B&&B.shading!=undefined&&B.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}}P=!1}a:{B=void 0;z=void 0;X=t.length;for(B=0;B<X;B++){z=
-t[B];if(z.vertexColors){z=z.vertexColors;break a}}z=!1}y.__vertexArray=new Float32Array(A*3);if(P)y.__normalArray=new Float32Array(A*3);if(D.hasTangents)y.__tangentArray=new Float32Array(A*4);if(z)y.__colorArray=new Float32Array(A*3);if(w){if(D.faceUvs.length>0||D.faceVertexUvs.length>0)y.__uvArray=new Float32Array(A*2);if(D.faceUvs.length>1||D.faceVertexUvs.length>1)y.__uv2Array=new Float32Array(A*2)}if(u.geometry.skinWeights.length&&u.geometry.skinIndices.length){y.__skinVertexAArray=new Float32Array(A*
-4);y.__skinVertexBArray=new Float32Array(A*4);y.__skinIndexArray=new Float32Array(A*4);y.__skinWeightArray=new Float32Array(A*4)}y.__faceArray=new Uint16Array(O*3+(u.geometry.edgeFaces?u.geometry.edgeFaces.length*6:0));y.__lineArray=new Uint16Array(W*2);if(y.numMorphTargets){y.__morphTargetsArrays=[];D=0;for(B=y.numMorphTargets;D<B;D++)y.__morphTargetsArrays.push(new Float32Array(A*3))}y.__needsSmoothNormals=P==THREE.SmoothShading;y.__uvType=w;y.__vertexColorType=z;y.__normalType=P;y.__webglFaceCount=
-O*3+(u.geometry.edgeFaces?u.geometry.edgeFaces.length*6:0);y.__webglLineCount=W*2;D=0;for(B=t.length;D<B;D++)if(t[D].attributes){y.__webglCustomAttributes={};for(a in t[D].attributes){w=t[D].attributes[a];if(!w.__webglInitialized||w.createUniqueBuffers){w.__webglInitialized=!0;O=1;if(w.type==="v2")O=2;else if(w.type==="v3")O=3;else if(w.type==="v4")O=4;else w.type==="c"&&(O=3);w.size=O;w.needsUpdate=!0;w.array=new Float32Array(A*O);w.buffer=c.createBuffer();w.buffer.belongsToAttribute=a}y.__webglCustomAttributes[a]=
-w}}m.__dirtyVertices=!0;m.__dirtyMorphTargets=!0;m.__dirtyElements=!0;m.__dirtyUvs=!0;m.__dirtyNormals=!0;m.__dirtyTangents=!0;m.__dirtyColors=!0}p instanceof THREE.ShadowVolume?da(j.__webglShadowVolumes,x,p):da(j.__webglObjects,x,p)}}else if(p instanceof THREE.LensFlare)da(j.__webglLensFlares,undefined,p);else if(p instanceof THREE.Ribbon){m=p.geometry;if(!m.__webglVertexBuffer){k=m;k.__webglVertexBuffer=c.createBuffer();k.__webglColorBuffer=c.createBuffer();k=m;x=k.vertices.length;k.__vertexArray=
-new Float32Array(x*3);k.__colorArray=new Float32Array(x*3);k.__webglVertexCount=x;m.__dirtyVertices=!0;m.__dirtyColors=!0}da(j.__webglObjects,m,p)}else if(p instanceof THREE.Line){m=p.geometry;if(!m.__webglVertexBuffer){k=m;k.__webglVertexBuffer=c.createBuffer();k.__webglColorBuffer=c.createBuffer();k=m;x=k.vertices.length;k.__vertexArray=new Float32Array(x*3);k.__colorArray=new Float32Array(x*3);k.__webglLineCount=x;m.__dirtyVertices=!0;m.__dirtyColors=!0}da(j.__webglObjects,m,p)}else if(p instanceof
-THREE.ParticleSystem){m=p.geometry;if(!m.__webglVertexBuffer){k=m;k.__webglVertexBuffer=c.createBuffer();k.__webglColorBuffer=c.createBuffer();k=m;x=k.vertices.length;k.__vertexArray=new Float32Array(x*3);k.__colorArray=new Float32Array(x*3);k.__sortArray=[];k.__webglParticleCount=x;m.__dirtyVertices=!0;m.__dirtyColors=!0}da(j.__webglObjects,m,p)}else if(THREE.MarchingCubes!==undefined&&p instanceof THREE.MarchingCubes)j.__webglObjectsImmediate.push({object:p,opaque:{list:[],count:0},transparent:{list:[],
-count:0}});else p instanceof THREE.Sprite&&j.__webglSprites.push(p);f.__objectsAdded.splice(0,1)}for(;f.__objectsRemoved.length;){p=f.__objectsRemoved[0];j=f;m=void 0;k=void 0;if(p instanceof THREE.Mesh)for(m=j.__webglObjects.length-1;m>=0;m--){k=j.__webglObjects[m].object;if(p==k){j.__webglObjects.splice(m,1);break}}else if(p instanceof THREE.Sprite)for(m=j.__webglSprites.length-1;m>=0;m--){k=j.__webglSprites[m];if(p==k){j.__webglSprites.splice(m,1);break}}f.__objectsRemoved.splice(0,1)}p=0;for(j=
-f.__webglObjects.length;p<j;p++)L(f.__webglObjects[p].object,f);p=0;for(j=f.__webglShadowVolumes.length;p<j;p++)L(f.__webglShadowVolumes[p].object,f);p=0;for(j=f.__webglLensFlares.length;p<j;p++)L(f.__webglLensFlares[p].object,f)};this.setFaceCulling=function(f,p){if(f){!p||p=="ccw"?c.frontFace(c.CCW):c.frontFace(c.CW);if(f=="back")c.cullFace(c.BACK);else f=="front"?c.cullFace(c.FRONT):c.cullFace(c.FRONT_AND_BACK);c.enable(c.CULL_FACE)}else c.disable(c.CULL_FACE)};this.supportsVertexTextures=function(){return c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>
-0}};
-THREE.WebGLRenderTarget=function(b,d,e){this.width=b;this.height=d;e=e||{};this.wrapS=e.wrapS!==undefined?e.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=e.wrapT!==undefined?e.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=e.magFilter!==undefined?e.magFilter:THREE.LinearFilter;this.minFilter=e.minFilter!==undefined?e.minFilter:THREE.LinearMipMapLinearFilter;this.format=e.format!==undefined?e.format:THREE.RGBAFormat;this.type=e.type!==undefined?e.type:THREE.UnsignedByteType;this.depthBuffer=e.depthBuffer!==undefined?
-e.depthBuffer:!0;this.stencilBuffer=e.stencilBuffer!==undefined?e.stencilBuffer:!0};
+0){c.enableVertexAttribArray(z.morphTarget6);f.numSupportedMorphTargets++}if(z.morphTarget7>=0){c.enableVertexAttribArray(z.morphTarget7);f.numSupportedMorphTargets++}k.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);f=0;for(m=this.maxMorphTargets;f<m;f++)k.__webglMorphTargetInfluences[f]=0}};this.render=function(f,p,j,k){var m,x,y,u,A,t,w,z,D=f.lights,B=f.fog;R.data.vertices=0;R.data.faces=0;R.data.drawCalls=0;p.matrixAutoUpdate&&p.update(undefined,!0);f.update(undefined,!1,p);
+p.matrixWorldInverse.flattenToArray(Xa);p.projectionMatrix.flattenToArray(Ta);Pa.multiply(p.projectionMatrix,p.matrixWorldInverse);q(Pa);this.initWebGLObjects(f);Ia(j);(this.autoClear||k)&&this.clear();A=f.__webglObjects.length;for(k=0;k<A;k++){m=f.__webglObjects[k];w=m.object;if(w.visible)if(!(w instanceof THREE.Mesh)||r(w)){w.matrixWorld.flattenToArray(w._objectMatrixArray);V(w,p);F(m);m.render=!0;if(this.sortObjects){Ua.copy(w.position);Pa.multiplyVector3(Ua);m.z=Ua.z}}else m.render=!1;else m.render=
+!1}this.sortObjects&&f.__webglObjects.sort(H);t=f.__webglObjectsImmediate.length;for(k=0;k<t;k++){m=f.__webglObjectsImmediate[k];w=m.object;if(w.visible){w.matrixAutoUpdate&&w.matrixWorld.flattenToArray(w._objectMatrixArray);V(w,p);E(m)}}pa(THREE.NormalBlending);for(k=0;k<A;k++){m=f.__webglObjects[k];if(m.render){w=m.object;z=m.buffer;y=m.opaque;o(w);for(m=0;m<y.count;m++){u=y.list[m];n(u.depthTest);g(p,D,B,u,z,w)}}}for(k=0;k<t;k++){m=f.__webglObjectsImmediate[k];w=m.object;if(w.visible){y=m.opaque;
+o(w);for(m=0;m<y.count;m++){u=y.list[m];n(u.depthTest);x=e(p,D,B,u,w);w.render(function(O){h(O,x,u.shading)})}}}for(k=0;k<A;k++){m=f.__webglObjects[k];if(m.render){w=m.object;z=m.buffer;y=m.transparent;o(w);for(m=0;m<y.count;m++){u=y.list[m];pa(u.blending);n(u.depthTest);g(p,D,B,u,z,w)}}}for(k=0;k<t;k++){m=f.__webglObjectsImmediate[k];w=m.object;if(w.visible){y=m.transparent;o(w);for(m=0;m<y.count;m++){u=y.list[m];pa(u.blending);n(u.depthTest);x=e(p,D,B,u,w);w.render(function(O){h(O,x,u.shading)})}}}f.__webglSprites.length&&
+M(f,p);stencil&&f.__webglShadowVolumes.length&&f.lights.length&&I(f);f.__webglLensFlares.length&&N(f,p);if(j&&j.minFilter!==THREE.NearestFilter&&j.minFilter!==THREE.LinearFilter){c.bindTexture(c.TEXTURE_2D,j.__webglTexture);c.generateMipmap(c.TEXTURE_2D);c.bindTexture(c.TEXTURE_2D,null)}};this.initWebGLObjects=function(f){if(!f.__webglObjects){f.__webglObjects=[];f.__webglObjectsImmediate=[];f.__webglShadowVolumes=[];f.__webglLensFlares=[];f.__webglSprites=[]}for(;f.__objectsAdded.length;){var p=
+f.__objectsAdded[0],j=f,k=void 0,m=void 0,x=void 0;if(p._modelViewMatrix==undefined){p._modelViewMatrix=new THREE.Matrix4;p._normalMatrixArray=new Float32Array(9);p._modelViewMatrixArray=new Float32Array(16);p._objectMatrixArray=new Float32Array(16);p.matrixWorld.flattenToArray(p._objectMatrixArray)}if(p instanceof THREE.Mesh){m=p.geometry;m.geometryGroups==undefined&&ra(m);for(k in m.geometryGroups){x=m.geometryGroups[k];if(!x.__webglVertexBuffer){var y=x;y.__webglVertexBuffer=c.createBuffer();y.__webglNormalBuffer=
+c.createBuffer();y.__webglTangentBuffer=c.createBuffer();y.__webglColorBuffer=c.createBuffer();y.__webglUVBuffer=c.createBuffer();y.__webglUV2Buffer=c.createBuffer();y.__webglSkinVertexABuffer=c.createBuffer();y.__webglSkinVertexBBuffer=c.createBuffer();y.__webglSkinIndicesBuffer=c.createBuffer();y.__webglSkinWeightsBuffer=c.createBuffer();y.__webglFaceBuffer=c.createBuffer();y.__webglLineBuffer=c.createBuffer();if(y.numMorphTargets){var u=void 0,A=void 0;y.__webglMorphTargetsBuffers=[];u=0;for(A=
+y.numMorphTargets;u<A;u++)y.__webglMorphTargetsBuffers.push(c.createBuffer())}y=x;u=p;var t=void 0,w=void 0,z=void 0;z=void 0;var D=void 0,B=void 0,O=void 0,W=O=A=0;w=void 0;z=void 0;var P=void 0;t=void 0;w=void 0;D=u.geometry;P=D.faces;B=y.faces;t=0;for(w=B.length;t<w;t++){z=B[t];z=P[z];if(z instanceof THREE.Face3){A+=3;O+=1;W+=3}else if(z instanceof THREE.Face4){A+=4;O+=2;W+=4}}t=y;w=u;P=void 0;B=void 0;var X=void 0,Ga=void 0;X=void 0;z=[];P=0;for(B=w.materials.length;P<B;P++){X=w.materials[P];
+if(X instanceof THREE.MeshFaceMaterial){X=0;for(l=t.materials.length;X<l;X++)(Ga=t.materials[X])&&z.push(Ga)}else(Ga=X)&&z.push(Ga)}t=z;a:{w=void 0;P=void 0;B=t.length;for(w=0;w<B;w++){P=t[w];if(P.map||P.lightMap||P instanceof THREE.MeshShaderMaterial){w=!0;break a}}w=!1}a:{P=void 0;B=void 0;z=t.length;for(P=0;P<z;P++){B=t[P];if(!(B instanceof THREE.MeshBasicMaterial&&!B.envMap||B instanceof THREE.MeshDepthMaterial)){P=B&&B.shading!=undefined&&B.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;
+break a}}P=!1}a:{B=void 0;z=void 0;X=t.length;for(B=0;B<X;B++){z=t[B];if(z.vertexColors){z=z.vertexColors;break a}}z=!1}y.__vertexArray=new Float32Array(A*3);if(P)y.__normalArray=new Float32Array(A*3);if(D.hasTangents)y.__tangentArray=new Float32Array(A*4);if(z)y.__colorArray=new Float32Array(A*3);if(w){if(D.faceUvs.length>0||D.faceVertexUvs.length>0)y.__uvArray=new Float32Array(A*2);if(D.faceUvs.length>1||D.faceVertexUvs.length>1)y.__uv2Array=new Float32Array(A*2)}if(u.geometry.skinWeights.length&&
+u.geometry.skinIndices.length){y.__skinVertexAArray=new Float32Array(A*4);y.__skinVertexBArray=new Float32Array(A*4);y.__skinIndexArray=new Float32Array(A*4);y.__skinWeightArray=new Float32Array(A*4)}y.__faceArray=new Uint16Array(O*3+(u.geometry.edgeFaces?u.geometry.edgeFaces.length*6:0));y.__lineArray=new Uint16Array(W*2);if(y.numMorphTargets){y.__morphTargetsArrays=[];D=0;for(B=y.numMorphTargets;D<B;D++)y.__morphTargetsArrays.push(new Float32Array(A*3))}y.__needsSmoothNormals=P==THREE.SmoothShading;
+y.__uvType=w;y.__vertexColorType=z;y.__normalType=P;y.__webglFaceCount=O*3+(u.geometry.edgeFaces?u.geometry.edgeFaces.length*6:0);y.__webglLineCount=W*2;D=0;for(B=t.length;D<B;D++)if(t[D].attributes){y.__webglCustomAttributes={};for(a in t[D].attributes){w=t[D].attributes[a];if(!w.__webglInitialized||w.createUniqueBuffers){w.__webglInitialized=!0;O=1;if(w.type==="v2")O=2;else if(w.type==="v3")O=3;else if(w.type==="v4")O=4;else w.type==="c"&&(O=3);w.size=O;w.needsUpdate=!0;w.array=new Float32Array(A*
+O);w.buffer=c.createBuffer();w.buffer.belongsToAttribute=a}y.__webglCustomAttributes[a]=w}}m.__dirtyVertices=!0;m.__dirtyMorphTargets=!0;m.__dirtyElements=!0;m.__dirtyUvs=!0;m.__dirtyNormals=!0;m.__dirtyTangents=!0;m.__dirtyColors=!0}p instanceof THREE.ShadowVolume?da(j.__webglShadowVolumes,x,p):da(j.__webglObjects,x,p)}}else if(p instanceof THREE.LensFlare)da(j.__webglLensFlares,undefined,p);else if(p instanceof THREE.Ribbon){m=p.geometry;if(!m.__webglVertexBuffer){k=m;k.__webglVertexBuffer=c.createBuffer();
+k.__webglColorBuffer=c.createBuffer();k=m;x=k.vertices.length;k.__vertexArray=new Float32Array(x*3);k.__colorArray=new Float32Array(x*3);k.__webglVertexCount=x;m.__dirtyVertices=!0;m.__dirtyColors=!0}da(j.__webglObjects,m,p)}else if(p instanceof THREE.Line){m=p.geometry;if(!m.__webglVertexBuffer){k=m;k.__webglVertexBuffer=c.createBuffer();k.__webglColorBuffer=c.createBuffer();k=m;x=k.vertices.length;k.__vertexArray=new Float32Array(x*3);k.__colorArray=new Float32Array(x*3);k.__webglLineCount=x;m.__dirtyVertices=
+!0;m.__dirtyColors=!0}da(j.__webglObjects,m,p)}else if(p instanceof THREE.ParticleSystem){m=p.geometry;if(!m.__webglVertexBuffer){k=m;k.__webglVertexBuffer=c.createBuffer();k.__webglColorBuffer=c.createBuffer();k=m;x=k.vertices.length;k.__vertexArray=new Float32Array(x*3);k.__colorArray=new Float32Array(x*3);k.__sortArray=[];k.__webglParticleCount=x;m.__dirtyVertices=!0;m.__dirtyColors=!0}da(j.__webglObjects,m,p)}else if(THREE.MarchingCubes!==undefined&&p instanceof THREE.MarchingCubes)j.__webglObjectsImmediate.push({object:p,
+opaque:{list:[],count:0},transparent:{list:[],count:0}});else p instanceof THREE.Sprite&&j.__webglSprites.push(p);f.__objectsAdded.splice(0,1)}for(;f.__objectsRemoved.length;){p=f.__objectsRemoved[0];j=f;m=void 0;k=void 0;if(p instanceof THREE.Mesh)for(m=j.__webglObjects.length-1;m>=0;m--){k=j.__webglObjects[m].object;if(p==k){j.__webglObjects.splice(m,1);break}}else if(p instanceof THREE.Sprite)for(m=j.__webglSprites.length-1;m>=0;m--){k=j.__webglSprites[m];if(p==k){j.__webglSprites.splice(m,1);
+break}}f.__objectsRemoved.splice(0,1)}p=0;for(j=f.__webglObjects.length;p<j;p++)L(f.__webglObjects[p].object,f);p=0;for(j=f.__webglShadowVolumes.length;p<j;p++)L(f.__webglShadowVolumes[p].object,f);p=0;for(j=f.__webglLensFlares.length;p<j;p++)L(f.__webglLensFlares[p].object,f)};this.setFaceCulling=function(f,p){if(f){!p||p=="ccw"?c.frontFace(c.CCW):c.frontFace(c.CW);if(f=="back")c.cullFace(c.BACK);else f=="front"?c.cullFace(c.FRONT):c.cullFace(c.FRONT_AND_BACK);c.enable(c.CULL_FACE)}else c.disable(c.CULL_FACE)};
+this.supportsVertexTextures=function(){return c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};
+THREE.WebGLRenderTarget=function(b,d,e){this.width=b;this.height=d;e=e||{};this.wrapS=e.wrapS!==undefined?e.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=e.wrapT!==undefined?e.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=e.magFilter!==undefined?e.magFilter:THREE.LinearFilter;this.minFilter=e.minFilter!==undefined?e.minFilter:THREE.LinearMipMapLinearFilter;this.format=e.format!==undefined?e.format:THREE.RGBAFormat;this.type=e.type!==undefined?e.type:THREE.UnsignedByteType;this.depthBuffer=e.depthBuffer!==
+undefined?e.depthBuffer:!0;this.stencilBuffer=e.stencilBuffer!==undefined?e.stencilBuffer:!0};

+ 1 - 1
src/renderers/WebGLRenderTarget.js

@@ -17,7 +17,7 @@ THREE.WebGLRenderTarget = function ( width, height, options ) {
 
 	this.format = options.format !== undefined ? options.format : THREE.RGBAFormat;
 	this.type = options.type !== undefined ? options.type : THREE.UnsignedByteType;
-	
+
 	this.depthBuffer = options.depthBuffer !== undefined ? options.depthBuffer : true;
 	this.stencilBuffer = options.stencilBuffer !== undefined ? options.stencilBuffer : true;
 

+ 10 - 1
src/renderers/WebGLRenderer.js

@@ -80,7 +80,8 @@ THREE.WebGLRenderer = function ( parameters ) {
 	this.data = {
 
 		vertices: 0,
-		faces: 0
+		faces: 0,
+		drawCalls: 0
 
 	};
 
@@ -2626,6 +2627,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 			_this.data.vertices += geometryGroup.__webglFaceCount;
 			_this.data.faces += geometryGroup.__webglFaceCount / 3;
+			_this.data.drawCalls ++;
 
 		// render lines
 
@@ -2636,18 +2638,24 @@ THREE.WebGLRenderer = function ( parameters ) {
 			_gl.lineWidth( material.linewidth );
 			_gl.drawArrays( primitives, 0, geometryGroup.__webglLineCount );
 
+			_this.data.drawCalls ++;
+
 		// render particles
 
 		} else if ( object instanceof THREE.ParticleSystem ) {
 
 			_gl.drawArrays( _gl.POINTS, 0, geometryGroup.__webglParticleCount );
 
+			_this.data.drawCalls ++;
+
 		// render ribbon
 
 		} else if ( object instanceof THREE.Ribbon ) {
 
 			_gl.drawArrays( _gl.TRIANGLE_STRIP, 0, geometryGroup.__webglVertexCount );
 
+			_this.data.drawCalls ++;
+
 		}
 
 	};
@@ -2982,6 +2990,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 		_this.data.vertices = 0;
 		_this.data.faces = 0;
+		_this.data.drawCalls = 0;
 
 		camera.matrixAutoUpdate && camera.update( undefined, true );