Pārlūkot izejas kodu

Fixed delays when loading multiple models.

Problem was having too many concurrent workers opened at once. Garbage collection apparently works very slowly on workers. Solution was to close them manually, after model data is sent to main thread.

Also some progress with Blender scene exporter. Some scenes now export correctly, though monkey test scene got worse, even with less hacky code.
alteredq 14 gadi atpakaļ
vecāks
revīzija
5fa19e8460

+ 204 - 200
build/Three.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,c,d,f){this.set(b||0,c||0,d||0,f||1)};
 THREE.Vector4.prototype={set:function(b,c,d,f){this.x=b;this.y=c;this.z=d;this.w=f;return this},copy:function(b){this.set(b.x,b.y,b.z,b.w||1);return this},add:function(b,c){this.set(b.x+c.x,b.y+c.y,b.z+c.z,b.w+c.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,c){this.set(b.x-c.x,b.y-c.y,b.z-c.z,b.w-c.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,c){this.set(this.x+(b.x-this.x)*c,this.y+(b.y-this.y)*c,this.z+(b.z-this.z)*c,this.w+(b.w-this.w)*c)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(b,c){this.origin=b||new THREE.Vector3;this.direction=c||new THREE.Vector3};
-THREE.Ray.prototype={intersectScene:function(b){var c,d,f=b.objects,g=[];b=0;for(c=f.length;b<c;b++){d=f[b];d instanceof THREE.Mesh&&(g=g.concat(this.intersectObject(d)))}g.sort(function(h,j){return h.distance-j.distance});return g},intersectObject:function(b){function c(G,K,V,z){z=z.clone().subSelf(K);V=V.clone().subSelf(K);var O=G.clone().subSelf(K);G=z.dot(z);K=z.dot(V);z=z.dot(O);var P=V.dot(V);V=V.dot(O);O=1/(G*P-K*K);P=(P*z-K*V)*O;G=(G*V-K*z)*O;return P>0&&G>0&&P+G<1}var d,f,g,h,j,k,n,p,o,w,
+THREE.Ray.prototype={intersectScene:function(b){var c,d,f=b.objects,g=[];b=0;for(c=f.length;b<c;b++){d=f[b];d instanceof THREE.Mesh&&(g=g.concat(this.intersectObject(d)))}g.sort(function(h,j){return h.distance-j.distance});return g},intersectObject:function(b){function c(G,L,V,z){z=z.clone().subSelf(L);V=V.clone().subSelf(L);var K=G.clone().subSelf(L);G=z.dot(z);L=z.dot(V);z=z.dot(K);var P=V.dot(V);V=V.dot(K);K=1/(G*P-L*L);P=(P*z-L*V)*K;G=(G*V-L*z)*K;return P>0&&G>0&&P+G<1}var d,f,g,h,j,k,n,p,o,w,
 y,v=b.geometry,A=v.vertices,F=[];d=0;for(f=v.faces.length;d<f;d++){g=v.faces[d];w=this.origin.clone();y=this.direction.clone();n=b.matrixWorld;h=n.multiplyVector3(A[g.a].position.clone());j=n.multiplyVector3(A[g.b].position.clone());k=n.multiplyVector3(A[g.c].position.clone());n=g instanceof THREE.Face4?n.multiplyVector3(A[g.d].position.clone()):null;p=b.matrixRotationWorld.multiplyVector3(g.normal.clone());o=y.dot(p);if(b.doubleSided||(b.flipSided?o>0:o<0)){p=p.dot((new THREE.Vector3).sub(h,w))/
 o;w=w.addSelf(y.multiplyScalar(p));if(g instanceof THREE.Face3){if(c(w,h,j,k)){g={distance:this.origin.distanceTo(w),point:w,face:g,object:b};F.push(g)}}else if(g instanceof THREE.Face4&&(c(w,h,j,n)||c(w,j,k,n))){g={distance:this.origin.distanceTo(w),point:w,face:g,object:b};F.push(g)}}}return F}};
 THREE.Rectangle=function(){function b(){h=f-c;j=g-d}var c,d,f,g,h,j,k=!0;this.getX=function(){return c};this.getY=function(){return d};this.getWidth=function(){return h};this.getHeight=function(){return j};this.getLeft=function(){return c};this.getTop=function(){return d};this.getRight=function(){return f};this.getBottom=function(){return g};this.set=function(n,p,o,w){k=!1;c=n;d=p;f=o;g=w;b()};this.addPoint=function(n,p){if(k){k=!1;c=n;d=p;f=n;g=p}else{c=c<n?c:n;d=d<p?d:p;f=f>n?f:n;g=g>p?g:p}b()};
@@ -23,8 +23,8 @@ THREE.Matrix4=function(b,c,d,f,g,h,j,k,n,p,o,w,y,v,A,F){this.set(b||1,c||0,d||0,
 THREE.Matrix4.prototype={set:function(b,c,d,f,g,h,j,k,n,p,o,w,y,v,A,F){this.n11=b;this.n12=c;this.n13=d;this.n14=f;this.n21=g;this.n22=h;this.n23=j;this.n24=k;this.n31=n;this.n32=p;this.n33=o;this.n34=w;this.n41=y;this.n42=v;this.n43=A;this.n44=F;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,c,d){var f=THREE.Matrix4.__v1,
 g=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;h.sub(b,c).normalize();if(h.length()===0)h.z=1;f.cross(d,h).normalize();if(f.length()===0){h.x+=1.0E-4;f.cross(d,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 c=b.x,d=b.y,f=b.z,g=1/(this.n41*c+this.n42*d+this.n43*f+this.n44);b.x=(this.n11*c+this.n12*d+this.n13*f+this.n14)*g;b.y=(this.n21*c+this.n22*d+this.n23*
 f+this.n24)*g;b.z=(this.n31*c+this.n32*d+this.n33*f+this.n34)*g;return b},multiplyVector4:function(b){var c=b.x,d=b.y,f=b.z,g=b.w;b.x=this.n11*c+this.n12*d+this.n13*f+this.n14*g;b.y=this.n21*c+this.n22*d+this.n23*f+this.n24*g;b.z=this.n31*c+this.n32*d+this.n33*f+this.n34*g;b.w=this.n41*c+this.n42*d+this.n43*f+this.n44*g;return b},rotateAxis:function(b){var c=b.x,d=b.y,f=b.z;b.x=c*this.n11+d*this.n12+f*this.n13;b.y=c*this.n21+d*this.n22+f*this.n23;b.z=c*this.n31+d*this.n32+f*this.n33;b.normalize();
-return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var d=b.n11,f=b.n12,g=b.n13,h=b.n14,j=b.n21,k=b.n22,n=b.n23,p=b.n24,o=b.n31,w=b.n32,y=b.n33,v=b.n34,A=b.n41,F=b.n42,G=b.n43,K=b.n44,V=c.n11,z=c.n12,O=c.n13,P=c.n14,S=c.n21,wa=c.n22,
-sa=c.n23,qa=c.n24,e=c.n31,ga=c.n32,ea=c.n33,xa=c.n34;this.n11=d*V+f*S+g*e;this.n12=d*z+f*wa+g*ga;this.n13=d*O+f*sa+g*ea;this.n14=d*P+f*qa+g*xa+h;this.n21=j*V+k*S+n*e;this.n22=j*z+k*wa+n*ga;this.n23=j*O+k*sa+n*ea;this.n24=j*P+k*qa+n*xa+p;this.n31=o*V+w*S+y*e;this.n32=o*z+w*wa+y*ga;this.n33=o*O+w*sa+y*ea;this.n34=o*P+w*qa+y*xa+v;this.n41=A*V+F*S+G*e;this.n42=A*z+F*wa+G*ga;this.n43=A*O+F*sa+G*ea;this.n44=A*P+F*qa+G*xa+K;return this},multiplyToArray:function(b,c,d){this.multiply(b,c);d[0]=this.n11;d[1]=
+return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var d=b.n11,f=b.n12,g=b.n13,h=b.n14,j=b.n21,k=b.n22,n=b.n23,p=b.n24,o=b.n31,w=b.n32,y=b.n33,v=b.n34,A=b.n41,F=b.n42,G=b.n43,L=b.n44,V=c.n11,z=c.n12,K=c.n13,P=c.n14,S=c.n21,xa=c.n22,
+ra=c.n23,pa=c.n24,e=c.n31,fa=c.n32,ca=c.n33,ya=c.n34;this.n11=d*V+f*S+g*e;this.n12=d*z+f*xa+g*fa;this.n13=d*K+f*ra+g*ca;this.n14=d*P+f*pa+g*ya+h;this.n21=j*V+k*S+n*e;this.n22=j*z+k*xa+n*fa;this.n23=j*K+k*ra+n*ca;this.n24=j*P+k*pa+n*ya+p;this.n31=o*V+w*S+y*e;this.n32=o*z+w*xa+y*fa;this.n33=o*K+w*ra+y*ca;this.n34=o*P+w*pa+y*ya+v;this.n41=A*V+F*S+G*e;this.n42=A*z+F*xa+G*fa;this.n43=A*K+F*ra+G*ca;this.n44=A*P+F*pa+G*ya+L;return this},multiplyToArray:function(b,c,d){this.multiply(b,c);d[0]=this.n11;d[1]=
 this.n21;d[2]=this.n31;d[3]=this.n41;d[4]=this.n12;d[5]=this.n22;d[6]=this.n32;d[7]=this.n42;d[8]=this.n13;d[9]=this.n23;d[10]=this.n33;d[11]=this.n43;d[12]=this.n14;d[13]=this.n24;d[14]=this.n34;d[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,c=this.n12,d=this.n13,f=this.n14,g=this.n21,h=this.n22,j=this.n23,k=this.n24,n=this.n31,p=this.n32,o=this.n33,w=this.n34,y=this.n41,v=this.n42,A=this.n43,F=this.n44;return f*j*p*y-d*k*p*y-f*h*o*y+c*k*o*y+d*h*w*y-c*j*w*y-f*j*n*v+d*k*n*v+f*g*o*v-b*k*o*v-d*g*w*v+b*j*w*v+f*h*n*A-c*k*n*A-f*g*p*A+b*k*p*A+c*g*w*A-b*h*w*A-d*h*n*F+c*j*n*F+d*g*p*F-b*j*p*F-c*g*o*F+b*h*o*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]=
@@ -34,8 +34,8 @@ b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=t
 1-d,h=b.x,j=b.y,k=b.z,n=g*h,p=g*j;this.set(n*h+d,n*j-f*k,n*k+f*j,0,n*j+f*k,p*j+d,p*k-f*h,0,n*k-f*j,p*k+f*h,g*k*k+d,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},setRotationFromEuler:function(b){var c=b.x,d=b.y,f=b.z;b=Math.cos(c);c=Math.sin(c);var g=Math.cos(d);d=Math.sin(d);var h=Math.cos(f);f=Math.sin(f);var j=b*d,k=c*d;this.n11=g*h;this.n12=-g*f;this.n13=d;this.n21=k*h+b*f;this.n22=-k*f+b*h;this.n23=-c*g;this.n31=-j*h+c*f;this.n32=j*f+c*h;this.n33=
 b*g;return this},setRotationFromQuaternion:function(b){var c=b.x,d=b.y,f=b.z,g=b.w,h=c+c,j=d+d,k=f+f;b=c*h;var n=c*j;c*=k;var p=d*j;d*=k;f*=k;h*=g;j*=g;g*=k;this.n11=1-(p+f);this.n12=n-g;this.n13=c+j;this.n21=n+g;this.n22=1-(b+f);this.n23=d-h;this.n31=c-j;this.n32=d+h;this.n33=1-(b+p);return this},scale:function(b){var c=b.x,d=b.y;b=b.z;this.n11*=c;this.n12*=d;this.n13*=b;this.n21*=c;this.n22*=d;this.n23*=b;this.n31*=c;this.n32*=d;this.n33*=b;this.n41*=c;this.n42*=d;this.n43*=b;return this},extractPosition:function(b){this.n14=
 b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,c){var d=1/c.x,f=1/c.y,g=1/c.z;this.n11=b.n11*d;this.n21=b.n21*d;this.n31=b.n31*d;this.n12=b.n12*f;this.n22=b.n22*f;this.n32=b.n32*f;this.n13=b.n13*g;this.n23=b.n23*g;this.n33=b.n33*g}};
-THREE.Matrix4.makeInvert=function(b,c){var d=b.n11,f=b.n12,g=b.n13,h=b.n14,j=b.n21,k=b.n22,n=b.n23,p=b.n24,o=b.n31,w=b.n32,y=b.n33,v=b.n34,A=b.n41,F=b.n42,G=b.n43,K=b.n44;c===undefined&&(c=new THREE.Matrix4);c.n11=n*v*F-p*y*F+p*w*G-k*v*G-n*w*K+k*y*K;c.n12=h*y*F-g*v*F-h*w*G+f*v*G+g*w*K-f*y*K;c.n13=g*p*F-h*n*F+h*k*G-f*p*G-g*k*K+f*n*K;c.n14=h*n*w-g*p*w-h*k*y+f*p*y+g*k*v-f*n*v;c.n21=p*y*A-n*v*A-p*o*G+j*v*G+n*o*K-j*y*K;c.n22=g*v*A-h*y*A+h*o*G-d*v*G-g*o*K+d*y*K;c.n23=h*n*A-g*p*A-h*j*G+d*p*G+g*j*K-d*n*K;
-c.n24=g*p*o-h*n*o+h*j*y-d*p*y-g*j*v+d*n*v;c.n31=k*v*A-p*w*A+p*o*F-j*v*F-k*o*K+j*w*K;c.n32=h*w*A-f*v*A-h*o*F+d*v*F+f*o*K-d*w*K;c.n33=g*p*A-h*k*A+h*j*F-d*p*F-f*j*K+d*k*K;c.n34=h*k*o-f*p*o-h*j*w+d*p*w+f*j*v-d*k*v;c.n41=n*w*A-k*y*A-n*o*F+j*y*F+k*o*G-j*w*G;c.n42=f*y*A-g*w*A+g*o*F-d*y*F-f*o*G+d*w*G;c.n43=g*k*A-f*n*A-g*j*F+d*n*F+f*j*G-d*k*G;c.n44=f*n*o-g*k*o+g*j*w-d*n*w-f*j*y+d*k*y;c.multiplyScalar(1/b.determinant());return c};
+THREE.Matrix4.makeInvert=function(b,c){var d=b.n11,f=b.n12,g=b.n13,h=b.n14,j=b.n21,k=b.n22,n=b.n23,p=b.n24,o=b.n31,w=b.n32,y=b.n33,v=b.n34,A=b.n41,F=b.n42,G=b.n43,L=b.n44;c===undefined&&(c=new THREE.Matrix4);c.n11=n*v*F-p*y*F+p*w*G-k*v*G-n*w*L+k*y*L;c.n12=h*y*F-g*v*F-h*w*G+f*v*G+g*w*L-f*y*L;c.n13=g*p*F-h*n*F+h*k*G-f*p*G-g*k*L+f*n*L;c.n14=h*n*w-g*p*w-h*k*y+f*p*y+g*k*v-f*n*v;c.n21=p*y*A-n*v*A-p*o*G+j*v*G+n*o*L-j*y*L;c.n22=g*v*A-h*y*A+h*o*G-d*v*G-g*o*L+d*y*L;c.n23=h*n*A-g*p*A-h*j*G+d*p*G+g*j*L-d*n*L;
+c.n24=g*p*o-h*n*o+h*j*y-d*p*y-g*j*v+d*n*v;c.n31=k*v*A-p*w*A+p*o*F-j*v*F-k*o*L+j*w*L;c.n32=h*w*A-f*v*A-h*o*F+d*v*F+f*o*L-d*w*L;c.n33=g*p*A-h*k*A+h*j*F-d*p*F-f*j*L+d*k*L;c.n34=h*k*o-f*p*o-h*j*w+d*p*w+f*j*v-d*k*v;c.n41=n*w*A-k*y*A-n*o*F+j*y*F+k*o*G-j*w*G;c.n42=f*y*A-g*w*A+g*o*F-d*y*F-f*o*G+d*w*G;c.n43=g*k*A-f*n*A-g*j*F+d*n*F+f*j*G-d*k*G;c.n44=f*n*o-g*k*o+g*j*w-d*n*w-f*j*y+d*k*y;c.multiplyScalar(1/b.determinant());return c};
 THREE.Matrix4.makeInvert3x3=function(b){var c=b.m33,d=c.m,f=b.n33*b.n22-b.n32*b.n23,g=-b.n33*b.n21+b.n31*b.n23,h=b.n32*b.n21-b.n31*b.n22,j=-b.n33*b.n12+b.n32*b.n13,k=b.n33*b.n11-b.n31*b.n13,n=-b.n32*b.n11+b.n31*b.n12,p=b.n23*b.n12-b.n22*b.n13,o=-b.n23*b.n11+b.n21*b.n13,w=b.n22*b.n11-b.n21*b.n12;b=b.n11*f+b.n21*j+b.n31*p;if(b==0)throw"matrix not invertible";b=1/b;d[0]=b*f;d[1]=b*g;d[2]=b*h;d[3]=b*j;d[4]=b*k;d[5]=b*n;d[6]=b*p;d[7]=b*o;d[8]=b*w;return c};
 THREE.Matrix4.makeFrustum=function(b,c,d,f,g,h){var j;j=new THREE.Matrix4;j.n11=2*g/(c-b);j.n12=0;j.n13=(c+b)/(c-b);j.n14=0;j.n21=0;j.n22=2*g/(f-d);j.n23=(f+d)/(f-d);j.n24=0;j.n31=0;j.n32=0;j.n33=-(h+g)/(h-g);j.n34=-2*h*g/(h-g);j.n41=0;j.n42=0;j.n43=-1;j.n44=0;return j};THREE.Matrix4.makePerspective=function(b,c,d,f){var g;b=d*Math.tan(b*Math.PI/360);g=-b;return THREE.Matrix4.makeFrustum(g*c,b*c,g,b,d,f)};
 THREE.Matrix4.makeOrtho=function(b,c,d,f,g,h){var j,k,n,p;j=new THREE.Matrix4;k=c-b;n=d-f;p=h-g;j.n11=2/k;j.n12=0;j.n13=0;j.n14=-((c+b)/k);j.n21=0;j.n22=2/n;j.n23=0;j.n24=-((d+f)/n);j.n31=0;j.n32=0;j.n33=-2/p;j.n34=-((h+g)/p);j.n41=0;j.n42=0;j.n43=0;j.n44=1;return j};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
@@ -56,17 +56,17 @@ THREE.Geometry.prototype={computeCentroids:function(){var b,c,d;b=0;for(c=this.f
 d.centroid.addSelf(this.vertices[d.d].position);d.centroid.divideScalar(4)}}},computeFaceNormals:function(b){var c,d,f,g,h,j,k=new THREE.Vector3,n=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);c=0;for(d=h.vertexNormals.length;c<d;c++)k.addSelf(h.vertexNormals[c]);k.divideScalar(3)}else{c=this.vertices[h.a];d=this.vertices[h.b];j=this.vertices[h.c];k.sub(j.position,d.position);n.sub(c.position,d.position);k.crossSelf(n)}k.isZero()||
 k.normalize();h.normal.copy(k)}},computeVertexNormals:function(){var b,c,d,f;if(this.__tmpVertices==undefined){f=this.__tmpVertices=Array(this.vertices.length);b=0;for(c=this.vertices.length;b<c;b++)f[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++){d=this.faces[b];if(d instanceof THREE.Face3)d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(d instanceof THREE.Face4)d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{f=
 this.__tmpVertices;b=0;for(c=this.vertices.length;b<c;b++)f[b].set(0,0,0)}b=0;for(c=this.faces.length;b<c;b++){d=this.faces[b];if(d instanceof THREE.Face3){f[d.a].addSelf(d.normal);f[d.b].addSelf(d.normal);f[d.c].addSelf(d.normal)}else if(d instanceof THREE.Face4){f[d.a].addSelf(d.normal);f[d.b].addSelf(d.normal);f[d.c].addSelf(d.normal);f[d.d].addSelf(d.normal)}}b=0;for(c=this.vertices.length;b<c;b++)f[b].normalize();b=0;for(c=this.faces.length;b<c;b++){d=this.faces[b];if(d instanceof THREE.Face3){d.vertexNormals[0].copy(f[d.a]);
-d.vertexNormals[1].copy(f[d.b]);d.vertexNormals[2].copy(f[d.c])}else if(d instanceof THREE.Face4){d.vertexNormals[0].copy(f[d.a]);d.vertexNormals[1].copy(f[d.b]);d.vertexNormals[2].copy(f[d.c]);d.vertexNormals[3].copy(f[d.d])}}},computeTangents:function(){function b(aa,pa,ya,ja,Y,na,Ba){k=aa.vertices[pa].position;n=aa.vertices[ya].position;p=aa.vertices[ja].position;o=j[Y];w=j[na];y=j[Ba];v=n.x-k.x;A=p.x-k.x;F=n.y-k.y;G=p.y-k.y;K=n.z-k.z;V=p.z-k.z;z=w.u-o.u;O=y.u-o.u;P=w.v-o.v;S=y.v-o.v;wa=1/(z*S-
-O*P);ga.set((S*v-P*A)*wa,(S*F-P*G)*wa,(S*K-P*V)*wa);ea.set((z*A-O*v)*wa,(z*G-O*F)*wa,(z*V-O*K)*wa);qa[pa].addSelf(ga);qa[ya].addSelf(ga);qa[ja].addSelf(ga);e[pa].addSelf(ea);e[ya].addSelf(ea);e[ja].addSelf(ea)}var c,d,f,g,h,j,k,n,p,o,w,y,v,A,F,G,K,V,z,O,P,S,wa,sa,qa=[],e=[],ga=new THREE.Vector3,ea=new THREE.Vector3,xa=new THREE.Vector3,Ea=new THREE.Vector3,Fa=new THREE.Vector3;c=0;for(d=this.vertices.length;c<d;c++){qa[c]=new THREE.Vector3;e[c]=new THREE.Vector3}c=0;for(d=this.faces.length;c<d;c++){h=
-this.faces[c];j=this.faceVertexUvs[0][c];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 ra=["a","b","c","d"];c=0;for(d=this.faces.length;c<d;c++){h=this.faces[c];for(f=0;f<h.vertexNormals.length;f++){Fa.copy(h.vertexNormals[f]);g=h[ra[f]];sa=qa[g];xa.copy(sa);xa.subSelf(Fa.multiplyScalar(Fa.dot(sa))).normalize();Ea.cross(h.vertexNormals[f],sa);g=Ea.dot(e[g]);g=g<0?-1:1;h.vertexTangents[f]=new THREE.Vector4(xa.x,
-xa.y,xa.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 c=1,d=this.vertices.length;c<d;c++){b=this.vertices[c];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;
+d.vertexNormals[1].copy(f[d.b]);d.vertexNormals[2].copy(f[d.c])}else if(d instanceof THREE.Face4){d.vertexNormals[0].copy(f[d.a]);d.vertexNormals[1].copy(f[d.b]);d.vertexNormals[2].copy(f[d.c]);d.vertexNormals[3].copy(f[d.d])}}},computeTangents:function(){function b(qa,ta,va,ia,Z,na,Ba){k=qa.vertices[ta].position;n=qa.vertices[va].position;p=qa.vertices[ia].position;o=j[Z];w=j[na];y=j[Ba];v=n.x-k.x;A=p.x-k.x;F=n.y-k.y;G=p.y-k.y;L=n.z-k.z;V=p.z-k.z;z=w.u-o.u;K=y.u-o.u;P=w.v-o.v;S=y.v-o.v;xa=1/(z*S-
+K*P);fa.set((S*v-P*A)*xa,(S*F-P*G)*xa,(S*L-P*V)*xa);ca.set((z*A-K*v)*xa,(z*G-K*F)*xa,(z*V-K*L)*xa);pa[ta].addSelf(fa);pa[va].addSelf(fa);pa[ia].addSelf(fa);e[ta].addSelf(ca);e[va].addSelf(ca);e[ia].addSelf(ca)}var c,d,f,g,h,j,k,n,p,o,w,y,v,A,F,G,L,V,z,K,P,S,xa,ra,pa=[],e=[],fa=new THREE.Vector3,ca=new THREE.Vector3,ya=new THREE.Vector3,Fa=new THREE.Vector3,Ea=new THREE.Vector3;c=0;for(d=this.vertices.length;c<d;c++){pa[c]=new THREE.Vector3;e[c]=new THREE.Vector3}c=0;for(d=this.faces.length;c<d;c++){h=
+this.faces[c];j=this.faceVertexUvs[0][c];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 Y=["a","b","c","d"];c=0;for(d=this.faces.length;c<d;c++){h=this.faces[c];for(f=0;f<h.vertexNormals.length;f++){Ea.copy(h.vertexNormals[f]);g=h[Y[f]];ra=pa[g];ya.copy(ra);ya.subSelf(Ea.multiplyScalar(Ea.dot(ra))).normalize();Fa.cross(h.vertexNormals[f],ra);g=Fa.dot(e[g]);g=g<0?-1:1;h.vertexTangents[f]=new THREE.Vector4(ya.x,
+ya.y,ya.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 c=1,d=this.vertices.length;c<d;c++){b=this.vertices[c];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,c=0,d=this.vertices.length;c<d;c++)b=Math.max(b,this.vertices[c].position.length());this.boundingSphere=
 {radius:b}},computeEdgeFaces:function(){function b(n,p){return Math.min(n,p)+"_"+Math.max(n,p)}function c(n,p,o){if(n[p]===undefined){n[p]={set:{},array:[]};n[p].set[o]=1;n[p].array.push(o)}else if(n[p].set[o]===undefined){n[p].set[o]=1;n[p].array.push(o)}}var d,f,g,h,j,k={};d=0;for(f=this.faces.length;d<f;d++){j=this.faces[d];if(j instanceof THREE.Face3){g=b(j.a,j.b);c(k,g,d);g=b(j.b,j.c);c(k,g,d);g=b(j.a,j.c);c(k,g,d)}else if(j instanceof THREE.Face4){g=b(j.b,j.d);c(k,g,d);g=b(j.a,j.b);c(k,g,d);
 g=b(j.a,j.d);c(k,g,d);g=b(j.b,j.c);c(k,g,d);g=b(j.c,j.d);c(k,g,d)}}d=0;for(f=this.edges.length;d<f;d++){j=this.edges[d];g=j.vertexIndices[0];h=j.vertexIndices[1];j.faceIndices=k[b(g,h)].array;for(g=0;g<j.faceIndices.length;g++){h=j.faceIndices[g];j.faces.push(this.faces[h])}}}};THREE.GeometryIdCounter=0;
-THREE.Spline=function(b){function c(v,A,F,G,K,V,z){v=(F-v)*0.5;G=(G-A)*0.5;return(2*(A-F)+v+G)*z+(-3*(A-F)-2*v-G)*V+v*K+A}this.points=b;var d=[],f={x:0,y:0,z:0},g,h,j,k,n,p,o,w,y;this.initFromArray=function(v){this.points=[];for(var A=0;A<v.length;A++)this.points[A]={x:v[A][0],y:v[A][1],z:v[A][2]}};this.getPoint=function(v){g=(this.points.length-1)*v;h=Math.floor(g);j=g-h;d[0]=h==0?h:h-1;d[1]=h;d[2]=h>this.points.length-2?h:h+1;d[3]=h>this.points.length-3?h:h+2;p=this.points[d[0]];o=this.points[d[1]];
-w=this.points[d[2]];y=this.points[d[3]];k=j*j;n=j*k;f.x=c(p.x,o.x,w.x,y.x,j,k,n);f.y=c(p.y,o.y,w.y,y.y,j,k,n);f.z=c(p.z,o.z,w.z,y.z,j,k,n);return f};this.getControlPointsArray=function(){var v,A,F=this.points.length,G=[];for(v=0;v<F;v++){A=this.points[v];G[v]=[A.x,A.y,A.z]}return G};this.getLength=function(v){var A,F,G=A=A=0,K=new THREE.Vector3,V=new THREE.Vector3,z=[],O=0;z[0]=0;v||(v=100);F=this.points.length*v;K.copy(this.points[0]);for(v=1;v<F;v++){A=v/F;position=this.getPoint(A);V.copy(position);
-O+=V.distanceTo(K);K.copy(position);A*=this.points.length-1;A=Math.floor(A);if(A!=G){z[A]=O;G=A}}z[z.length]=O;return{chunks:z,total:O}};this.reparametrizeByArcLength=function(v){var A,F,G,K,V,z,O=[],P=new THREE.Vector3,S=this.getLength();O.push(P.copy(this.points[0]).clone());for(A=1;A<this.points.length;A++){F=S.chunks[A]-S.chunks[A-1];z=Math.ceil(v*F/S.total);K=(A-1)/(this.points.length-1);V=A/(this.points.length-1);for(F=1;F<z-1;F++){G=K+F*(1/z)*(V-K);position=this.getPoint(G);O.push(P.copy(position).clone())}O.push(P.copy(this.points[A]).clone())}this.points=
-O}};THREE.Edge=function(b,c,d,f){this.vertices=[b,c];this.vertexIndices=[d,f];this.faces=[];this.faceIndices=[]};
+THREE.Spline=function(b){function c(v,A,F,G,L,V,z){v=(F-v)*0.5;G=(G-A)*0.5;return(2*(A-F)+v+G)*z+(-3*(A-F)-2*v-G)*V+v*L+A}this.points=b;var d=[],f={x:0,y:0,z:0},g,h,j,k,n,p,o,w,y;this.initFromArray=function(v){this.points=[];for(var A=0;A<v.length;A++)this.points[A]={x:v[A][0],y:v[A][1],z:v[A][2]}};this.getPoint=function(v){g=(this.points.length-1)*v;h=Math.floor(g);j=g-h;d[0]=h==0?h:h-1;d[1]=h;d[2]=h>this.points.length-2?h:h+1;d[3]=h>this.points.length-3?h:h+2;p=this.points[d[0]];o=this.points[d[1]];
+w=this.points[d[2]];y=this.points[d[3]];k=j*j;n=j*k;f.x=c(p.x,o.x,w.x,y.x,j,k,n);f.y=c(p.y,o.y,w.y,y.y,j,k,n);f.z=c(p.z,o.z,w.z,y.z,j,k,n);return f};this.getControlPointsArray=function(){var v,A,F=this.points.length,G=[];for(v=0;v<F;v++){A=this.points[v];G[v]=[A.x,A.y,A.z]}return G};this.getLength=function(v){var A,F,G=A=A=0,L=new THREE.Vector3,V=new THREE.Vector3,z=[],K=0;z[0]=0;v||(v=100);F=this.points.length*v;L.copy(this.points[0]);for(v=1;v<F;v++){A=v/F;position=this.getPoint(A);V.copy(position);
+K+=V.distanceTo(L);L.copy(position);A*=this.points.length-1;A=Math.floor(A);if(A!=G){z[A]=K;G=A}}z[z.length]=K;return{chunks:z,total:K}};this.reparametrizeByArcLength=function(v){var A,F,G,L,V,z,K=[],P=new THREE.Vector3,S=this.getLength();K.push(P.copy(this.points[0]).clone());for(A=1;A<this.points.length;A++){F=S.chunks[A]-S.chunks[A-1];z=Math.ceil(v*F/S.total);L=(A-1)/(this.points.length-1);V=A/(this.points.length-1);for(F=1;F<z-1;F++){G=L+F*(1/z)*(V-L);position=this.getPoint(G);K.push(P.copy(position).clone())}K.push(P.copy(this.points[A]).clone())}this.points=
+K}};THREE.Edge=function(b,c,d,f){this.vertices=[b,c];this.vertexIndices=[d,f];this.faces=[];this.faceIndices=[]};
 THREE.AnimationHandler=function(){var b=[],c={},d={};d.update=function(g){for(var h=0;h<b.length;h++)b[h].update(g)};d.addToUpdate=function(g){b.indexOf(g)===-1&&b.push(g)};d.removeFromUpdate=function(g){g=b.indexOf(g);g!==-1&&b.splice(g,1)};d.add=function(g){c[g.name]!==undefined&&console.log("THREE.AnimationHandler.add: Warning! "+g.name+" already exists in library. Overwriting.");c[g.name]=g;if(g.initialized!==!0){for(var h=0;h<g.hierarchy.length;h++){for(var j=0;j<g.hierarchy[h].keys.length;j++){if(g.hierarchy[h].keys[j].time<
 0)g.hierarchy[h].keys[j].time=0;if(g.hierarchy[h].keys[j].rot!==undefined&&!(g.hierarchy[h].keys[j].rot instanceof THREE.Quaternion)){var k=g.hierarchy[h].keys[j].rot;g.hierarchy[h].keys[j].rot=new THREE.Quaternion(k[0],k[1],k[2],k[3])}}if(g.hierarchy[h].keys[0].morphTargets!==undefined){k={};for(j=0;j<g.hierarchy[h].keys.length;j++)for(var n=0;n<g.hierarchy[h].keys[j].morphTargets.length;n++){var p=g.hierarchy[h].keys[j].morphTargets[n];k[p]=-1}g.hierarchy[h].usedMorphTargets=k;for(j=0;j<g.hierarchy[h].keys.length;j++){var o=
 {};for(p in k){for(n=0;n<g.hierarchy[h].keys[j].morphTargets.length;n++)if(g.hierarchy[h].keys[j].morphTargets[n]===p){o[p]=g.hierarchy[h].keys[j].morphTargetsInfluences[n];break}n===g.hierarchy[h].keys[j].morphTargets.length&&(o[p]=0)}g.hierarchy[h].keys[j].morphTargetsInfluences=o}}for(j=1;j<g.hierarchy[h].keys.length;j++)if(g.hierarchy[h].keys[j].time===g.hierarchy[h].keys[j-1].time){g.hierarchy[h].keys.splice(j,1);j--}for(j=1;j<g.hierarchy[h].keys.length;j++)g.hierarchy[h].keys[j].index=j}j=parseInt(g.length*
@@ -141,63 +141,63 @@ THREE.LOD.prototype.update=function(b,c,d){this.matrixAutoUpdate&&(c|=this.updat
 THREE.ShadowVolume.prototype.supr=THREE.Mesh.prototype;
 THREE.ShadowVolume.prototype.calculateShadowVolumeGeometry=function(b){this.geometry=new THREE.Geometry;this.geometry.boundingSphere=b.boundingSphere;this.geometry.edgeFaces=[];var c=this.geometry.vertices,d=this.geometry.faces,f=this.geometry.edgeFaces,g=b.faces;b=b.vertices;var h=g.length,j,k,n,p,o,w=["a","b","c","d"];for(n=0;n<h;n++){k=c.length;j=g[n];if(j instanceof THREE.Face4){p=4;k=new THREE.Face4(k,k+1,k+2,k+3)}else{p=3;k=new THREE.Face3(k,k+1,k+2)}k.normal.copy(j.normal);d.push(k);for(k=
 0;k<p;k++){o=b[j[w[k]]];c.push(new THREE.Vertex(o.position.clone()))}}for(h=0;h<g.length-1;h++){b=d[h];for(j=h+1;j<g.length;j++){k=d[j];k=this.facesShareEdge(c,b,k);if(k!==undefined){k=new THREE.Face4(k.indices[0],k.indices[3],k.indices[2],k.indices[1]);k.normal.set(1,0,0);f.push(k)}}}};
-THREE.ShadowVolume.prototype.facesShareEdge=function(b,c,d){var f,g,h,j,k,n,p,o,w,y,v,A,F,G=0,K=["a","b","c","d"];f=c instanceof THREE.Face4?4:3;g=d instanceof THREE.Face4?4:3;for(A=0;A<f;A++){h=c[K[A]];k=b[h];for(F=0;F<g;F++){j=d[K[F]];n=b[j];if(Math.abs(k.position.x-n.position.x)<1.0E-4&&Math.abs(k.position.y-n.position.y)<1.0E-4&&Math.abs(k.position.z-n.position.z)<1.0E-4){G++;if(G===1){p=k;o=n;w=h;y=j;v=K[A]}if(G===2){v+=K[A];return v==="ad"||v==="ac"?{faces:[c,d],vertices:[p,o,n,k],indices:[w,
+THREE.ShadowVolume.prototype.facesShareEdge=function(b,c,d){var f,g,h,j,k,n,p,o,w,y,v,A,F,G=0,L=["a","b","c","d"];f=c instanceof THREE.Face4?4:3;g=d instanceof THREE.Face4?4:3;for(A=0;A<f;A++){h=c[L[A]];k=b[h];for(F=0;F<g;F++){j=d[L[F]];n=b[j];if(Math.abs(k.position.x-n.position.x)<1.0E-4&&Math.abs(k.position.y-n.position.y)<1.0E-4&&Math.abs(k.position.z-n.position.z)<1.0E-4){G++;if(G===1){p=k;o=n;w=h;y=j;v=L[A]}if(G===2){v+=L[A];return v==="ad"||v==="ac"?{faces:[c,d],vertices:[p,o,n,k],indices:[w,
 y,j,h],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[c,d],vertices:[p,k,n,o],indices:[w,h,j,y],vertexTypes:[1,1,2,2],extrudable:!0}}}}}};THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;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 c=0;c<b.children.length;c++)this.addChildRecurse(b.children[c])};
 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 c=this.lights.indexOf(b);c!==-1&&this.lights.splice(c,1)}else if(b instanceof THREE.Sound){c=this.sounds.indexOf(b);c!==-1&&this.sounds.splice(c,1)}else if(!(b instanceof THREE.Camera)){c=this.objects.indexOf(b);if(c!==-1){this.objects.splice(c,1);this.__objectsRemoved.push(b)}}for(c=0;c<b.children.length;c++)this.removeChildRecurse(b.children[c])};
 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,c,d){this.color=new THREE.Color(b);this.near=c||1;this.far=d||1E3};THREE.FogExp2=function(b,c){this.color=new THREE.Color(b);this.density=c!==undefined?c:2.5E-4};
-THREE.Projector=function(){function b(){var ga=n[k]=n[k]||new THREE.RenderableVertex;k++;return ga}function c(ga,ea){return ea.z-ga.z}function d(ga,ea){var xa=0,Ea=1,Fa=ga.z+ga.w,ra=ea.z+ea.w,aa=-ga.z+ga.w,pa=-ea.z+ea.w;if(Fa>=0&&ra>=0&&aa>=0&&pa>=0)return!0;else if(Fa<0&&ra<0||aa<0&&pa<0)return!1;else{if(Fa<0)xa=Math.max(xa,Fa/(Fa-ra));else ra<0&&(Ea=Math.min(Ea,Fa/(Fa-ra)));if(aa<0)xa=Math.max(xa,aa/(aa-pa));else pa<0&&(Ea=Math.min(Ea,aa/(aa-pa)));if(Ea<xa)return!1;else{ga.lerpSelf(ea,xa);ea.lerpSelf(ga,
-1-Ea);return!0}}}var f,g,h=[],j,k,n=[],p,o,w=[],y,v=[],A,F,G=[],K,V,z=[],O=new THREE.Vector4,P=new THREE.Vector4,S=new THREE.Matrix4,wa=new THREE.Matrix4,sa=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],qa=new THREE.Vector4,e=new THREE.Vector4;this.projectVector=function(ga,ea){S.multiply(ea.projectionMatrix,ea.matrixWorldInverse);S.multiplyVector3(ga);return ga};this.unprojectVector=function(ga,ea){S.multiply(ea.matrixWorld,THREE.Matrix4.makeInvert(ea.projectionMatrix));
-S.multiplyVector3(ga);return ga};this.projectObjects=function(ga,ea,xa){ea=[];var Ea,Fa,ra;g=0;Fa=ga.objects;ga=0;for(Ea=Fa.length;ga<Ea;ga++){ra=Fa[ga];var aa;if(!(aa=!ra.visible))if(aa=ra instanceof THREE.Mesh){a:{aa=void 0;for(var pa=ra.matrixWorld,ya=-ra.geometry.boundingSphere.radius*Math.max(ra.scale.x,Math.max(ra.scale.y,ra.scale.z)),ja=0;ja<6;ja++){aa=sa[ja].x*pa.n14+sa[ja].y*pa.n24+sa[ja].z*pa.n34+sa[ja].w;if(aa<=ya){aa=!1;break a}}aa=!0}aa=!aa}if(!aa){aa=h[g]=h[g]||new THREE.RenderableObject;
-g++;f=aa;O.copy(ra.position);S.multiplyVector3(O);f.object=ra;f.z=O.z;ea.push(f)}}xa&&ea.sort(c);return ea};this.projectScene=function(ga,ea,xa){var Ea=[],Fa=ea.near,ra=ea.far,aa,pa,ya,ja,Y,na,Ba,ka,la,Da,Sa,$a,Ya,Ta,R,$,oa;V=F=y=o=0;ea.matrixAutoUpdate&&ea.updateMatrix();ga.update(undefined,!1,ea);S.multiply(ea.projectionMatrix,ea.matrixWorldInverse);sa[0].set(S.n41-S.n11,S.n42-S.n12,S.n43-S.n13,S.n44-S.n14);sa[1].set(S.n41+S.n11,S.n42+S.n12,S.n43+S.n13,S.n44+S.n14);sa[2].set(S.n41+S.n21,S.n42+S.n22,
-S.n43+S.n23,S.n44+S.n24);sa[3].set(S.n41-S.n21,S.n42-S.n22,S.n43-S.n23,S.n44-S.n24);sa[4].set(S.n41-S.n31,S.n42-S.n32,S.n43-S.n33,S.n44-S.n34);sa[5].set(S.n41+S.n31,S.n42+S.n32,S.n43+S.n33,S.n44+S.n34);for(aa=0;aa<6;aa++){la=sa[aa];la.divideScalar(Math.sqrt(la.x*la.x+la.y*la.y+la.z*la.z))}la=this.projectObjects(ga,ea,!0);ga=0;for(aa=la.length;ga<aa;ga++){Da=la[ga].object;if(Da.visible){Sa=Da.matrixWorld;$a=Da.matrixRotationWorld;Ya=Da.materials;Ta=Da.overdraw;k=0;if(Da instanceof THREE.Mesh){R=Da.geometry;
-ja=R.vertices;$=R.faces;R=R.faceVertexUvs;pa=0;for(ya=ja.length;pa<ya;pa++){j=b();j.positionWorld.copy(ja[pa].position);Sa.multiplyVector3(j.positionWorld);j.positionScreen.copy(j.positionWorld);S.multiplyVector4(j.positionScreen);j.positionScreen.x/=j.positionScreen.w;j.positionScreen.y/=j.positionScreen.w;j.visible=j.positionScreen.z>Fa&&j.positionScreen.z<ra}ja=0;for(pa=$.length;ja<pa;ja++){ya=$[ja];if(ya instanceof THREE.Face3){Y=n[ya.a];na=n[ya.b];Ba=n[ya.c];if(Y.visible&&na.visible&&Ba.visible&&
-(Da.doubleSided||Da.flipSided!=(Ba.positionScreen.x-Y.positionScreen.x)*(na.positionScreen.y-Y.positionScreen.y)-(Ba.positionScreen.y-Y.positionScreen.y)*(na.positionScreen.x-Y.positionScreen.x)<0)){ka=w[o]=w[o]||new THREE.RenderableFace3;o++;p=ka;p.v1.copy(Y);p.v2.copy(na);p.v3.copy(Ba)}else continue}else if(ya instanceof THREE.Face4){Y=n[ya.a];na=n[ya.b];Ba=n[ya.c];ka=n[ya.d];if(Y.visible&&na.visible&&Ba.visible&&ka.visible&&(Da.doubleSided||Da.flipSided!=((ka.positionScreen.x-Y.positionScreen.x)*
-(na.positionScreen.y-Y.positionScreen.y)-(ka.positionScreen.y-Y.positionScreen.y)*(na.positionScreen.x-Y.positionScreen.x)<0||(na.positionScreen.x-Ba.positionScreen.x)*(ka.positionScreen.y-Ba.positionScreen.y)-(na.positionScreen.y-Ba.positionScreen.y)*(ka.positionScreen.x-Ba.positionScreen.x)<0))){oa=v[y]=v[y]||new THREE.RenderableFace4;y++;p=oa;p.v1.copy(Y);p.v2.copy(na);p.v3.copy(Ba);p.v4.copy(ka)}else continue}p.normalWorld.copy(ya.normal);$a.multiplyVector3(p.normalWorld);p.centroidWorld.copy(ya.centroid);
-Sa.multiplyVector3(p.centroidWorld);p.centroidScreen.copy(p.centroidWorld);S.multiplyVector3(p.centroidScreen);Ba=ya.vertexNormals;Y=0;for(na=Ba.length;Y<na;Y++){ka=p.vertexNormalsWorld[Y];ka.copy(Ba[Y]);$a.multiplyVector3(ka)}Y=0;for(na=R.length;Y<na;Y++)if(oa=R[Y][ja]){Ba=0;for(ka=oa.length;Ba<ka;Ba++)p.uvs[Y][Ba]=oa[Ba]}p.meshMaterials=Ya;p.faceMaterials=ya.materials;p.overdraw=Ta;p.z=p.centroidScreen.z;Ea.push(p)}}else if(Da instanceof THREE.Line){wa.multiply(S,Sa);ja=Da.geometry.vertices;Y=b();
-Y.positionScreen.copy(ja[0].position);wa.multiplyVector4(Y.positionScreen);pa=1;for(ya=ja.length;pa<ya;pa++){Y=b();Y.positionScreen.copy(ja[pa].position);wa.multiplyVector4(Y.positionScreen);na=n[k-2];qa.copy(Y.positionScreen);e.copy(na.positionScreen);if(d(qa,e)){qa.multiplyScalar(1/qa.w);e.multiplyScalar(1/e.w);Sa=G[F]=G[F]||new THREE.RenderableLine;F++;A=Sa;A.v1.positionScreen.copy(qa);A.v2.positionScreen.copy(e);A.z=Math.max(qa.z,e.z);A.materials=Da.materials;Ea.push(A)}}}else if(Da instanceof
-THREE.Particle){P.set(Da.position.x,Da.position.y,Da.position.z,1);S.multiplyVector4(P);P.z/=P.w;if(P.z>0&&P.z<1){Sa=z[V]=z[V]||new THREE.RenderableParticle;V++;K=Sa;K.x=P.x/P.w;K.y=P.y/P.w;K.z=P.z;K.rotation=Da.rotation.z;K.scale.x=Da.scale.x*Math.abs(K.x-(P.x+ea.projectionMatrix.n11)/(P.w+ea.projectionMatrix.n14));K.scale.y=Da.scale.y*Math.abs(K.y-(P.y+ea.projectionMatrix.n22)/(P.w+ea.projectionMatrix.n24));K.materials=Da.materials;Ea.push(K)}}}}xa&&Ea.sort(c);return Ea}};
+THREE.Projector=function(){function b(){var fa=n[k]=n[k]||new THREE.RenderableVertex;k++;return fa}function c(fa,ca){return ca.z-fa.z}function d(fa,ca){var ya=0,Fa=1,Ea=fa.z+fa.w,Y=ca.z+ca.w,qa=-fa.z+fa.w,ta=-ca.z+ca.w;if(Ea>=0&&Y>=0&&qa>=0&&ta>=0)return!0;else if(Ea<0&&Y<0||qa<0&&ta<0)return!1;else{if(Ea<0)ya=Math.max(ya,Ea/(Ea-Y));else Y<0&&(Fa=Math.min(Fa,Ea/(Ea-Y)));if(qa<0)ya=Math.max(ya,qa/(qa-ta));else ta<0&&(Fa=Math.min(Fa,qa/(qa-ta)));if(Fa<ya)return!1;else{fa.lerpSelf(ca,ya);ca.lerpSelf(fa,
+1-Fa);return!0}}}var f,g,h=[],j,k,n=[],p,o,w=[],y,v=[],A,F,G=[],L,V,z=[],K=new THREE.Vector4,P=new THREE.Vector4,S=new THREE.Matrix4,xa=new THREE.Matrix4,ra=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],pa=new THREE.Vector4,e=new THREE.Vector4;this.projectVector=function(fa,ca){S.multiply(ca.projectionMatrix,ca.matrixWorldInverse);S.multiplyVector3(fa);return fa};this.unprojectVector=function(fa,ca){S.multiply(ca.matrixWorld,THREE.Matrix4.makeInvert(ca.projectionMatrix));
+S.multiplyVector3(fa);return fa};this.projectObjects=function(fa,ca,ya){ca=[];var Fa,Ea,Y;g=0;Ea=fa.objects;fa=0;for(Fa=Ea.length;fa<Fa;fa++){Y=Ea[fa];var qa;if(!(qa=!Y.visible))if(qa=Y instanceof THREE.Mesh){a:{qa=void 0;for(var ta=Y.matrixWorld,va=-Y.geometry.boundingSphere.radius*Math.max(Y.scale.x,Math.max(Y.scale.y,Y.scale.z)),ia=0;ia<6;ia++){qa=ra[ia].x*ta.n14+ra[ia].y*ta.n24+ra[ia].z*ta.n34+ra[ia].w;if(qa<=va){qa=!1;break a}}qa=!0}qa=!qa}if(!qa){qa=h[g]=h[g]||new THREE.RenderableObject;g++;
+f=qa;K.copy(Y.position);S.multiplyVector3(K);f.object=Y;f.z=K.z;ca.push(f)}}ya&&ca.sort(c);return ca};this.projectScene=function(fa,ca,ya){var Fa=[],Ea=ca.near,Y=ca.far,qa,ta,va,ia,Z,na,Ba,ka,la,Da,Sa,$a,Ya,Ta,R,aa,oa;V=F=y=o=0;ca.matrixAutoUpdate&&ca.updateMatrix();fa.update(undefined,!1,ca);S.multiply(ca.projectionMatrix,ca.matrixWorldInverse);ra[0].set(S.n41-S.n11,S.n42-S.n12,S.n43-S.n13,S.n44-S.n14);ra[1].set(S.n41+S.n11,S.n42+S.n12,S.n43+S.n13,S.n44+S.n14);ra[2].set(S.n41+S.n21,S.n42+S.n22,S.n43+
+S.n23,S.n44+S.n24);ra[3].set(S.n41-S.n21,S.n42-S.n22,S.n43-S.n23,S.n44-S.n24);ra[4].set(S.n41-S.n31,S.n42-S.n32,S.n43-S.n33,S.n44-S.n34);ra[5].set(S.n41+S.n31,S.n42+S.n32,S.n43+S.n33,S.n44+S.n34);for(qa=0;qa<6;qa++){la=ra[qa];la.divideScalar(Math.sqrt(la.x*la.x+la.y*la.y+la.z*la.z))}la=this.projectObjects(fa,ca,!0);fa=0;for(qa=la.length;fa<qa;fa++){Da=la[fa].object;if(Da.visible){Sa=Da.matrixWorld;$a=Da.matrixRotationWorld;Ya=Da.materials;Ta=Da.overdraw;k=0;if(Da instanceof THREE.Mesh){R=Da.geometry;
+ia=R.vertices;aa=R.faces;R=R.faceVertexUvs;ta=0;for(va=ia.length;ta<va;ta++){j=b();j.positionWorld.copy(ia[ta].position);Sa.multiplyVector3(j.positionWorld);j.positionScreen.copy(j.positionWorld);S.multiplyVector4(j.positionScreen);j.positionScreen.x/=j.positionScreen.w;j.positionScreen.y/=j.positionScreen.w;j.visible=j.positionScreen.z>Ea&&j.positionScreen.z<Y}ia=0;for(ta=aa.length;ia<ta;ia++){va=aa[ia];if(va instanceof THREE.Face3){Z=n[va.a];na=n[va.b];Ba=n[va.c];if(Z.visible&&na.visible&&Ba.visible&&
+(Da.doubleSided||Da.flipSided!=(Ba.positionScreen.x-Z.positionScreen.x)*(na.positionScreen.y-Z.positionScreen.y)-(Ba.positionScreen.y-Z.positionScreen.y)*(na.positionScreen.x-Z.positionScreen.x)<0)){ka=w[o]=w[o]||new THREE.RenderableFace3;o++;p=ka;p.v1.copy(Z);p.v2.copy(na);p.v3.copy(Ba)}else continue}else if(va instanceof THREE.Face4){Z=n[va.a];na=n[va.b];Ba=n[va.c];ka=n[va.d];if(Z.visible&&na.visible&&Ba.visible&&ka.visible&&(Da.doubleSided||Da.flipSided!=((ka.positionScreen.x-Z.positionScreen.x)*
+(na.positionScreen.y-Z.positionScreen.y)-(ka.positionScreen.y-Z.positionScreen.y)*(na.positionScreen.x-Z.positionScreen.x)<0||(na.positionScreen.x-Ba.positionScreen.x)*(ka.positionScreen.y-Ba.positionScreen.y)-(na.positionScreen.y-Ba.positionScreen.y)*(ka.positionScreen.x-Ba.positionScreen.x)<0))){oa=v[y]=v[y]||new THREE.RenderableFace4;y++;p=oa;p.v1.copy(Z);p.v2.copy(na);p.v3.copy(Ba);p.v4.copy(ka)}else continue}p.normalWorld.copy(va.normal);$a.multiplyVector3(p.normalWorld);p.centroidWorld.copy(va.centroid);
+Sa.multiplyVector3(p.centroidWorld);p.centroidScreen.copy(p.centroidWorld);S.multiplyVector3(p.centroidScreen);Ba=va.vertexNormals;Z=0;for(na=Ba.length;Z<na;Z++){ka=p.vertexNormalsWorld[Z];ka.copy(Ba[Z]);$a.multiplyVector3(ka)}Z=0;for(na=R.length;Z<na;Z++)if(oa=R[Z][ia]){Ba=0;for(ka=oa.length;Ba<ka;Ba++)p.uvs[Z][Ba]=oa[Ba]}p.meshMaterials=Ya;p.faceMaterials=va.materials;p.overdraw=Ta;p.z=p.centroidScreen.z;Fa.push(p)}}else if(Da instanceof THREE.Line){xa.multiply(S,Sa);ia=Da.geometry.vertices;Z=b();
+Z.positionScreen.copy(ia[0].position);xa.multiplyVector4(Z.positionScreen);ta=1;for(va=ia.length;ta<va;ta++){Z=b();Z.positionScreen.copy(ia[ta].position);xa.multiplyVector4(Z.positionScreen);na=n[k-2];pa.copy(Z.positionScreen);e.copy(na.positionScreen);if(d(pa,e)){pa.multiplyScalar(1/pa.w);e.multiplyScalar(1/e.w);Sa=G[F]=G[F]||new THREE.RenderableLine;F++;A=Sa;A.v1.positionScreen.copy(pa);A.v2.positionScreen.copy(e);A.z=Math.max(pa.z,e.z);A.materials=Da.materials;Fa.push(A)}}}else if(Da instanceof
+THREE.Particle){P.set(Da.position.x,Da.position.y,Da.position.z,1);S.multiplyVector4(P);P.z/=P.w;if(P.z>0&&P.z<1){Sa=z[V]=z[V]||new THREE.RenderableParticle;V++;L=Sa;L.x=P.x/P.w;L.y=P.y/P.w;L.z=P.z;L.rotation=Da.rotation.z;L.scale.x=Da.scale.x*Math.abs(L.x-(P.x+ca.projectionMatrix.n11)/(P.w+ca.projectionMatrix.n14));L.scale.y=Da.scale.y*Math.abs(L.y-(P.y+ca.projectionMatrix.n22)/(P.w+ca.projectionMatrix.n24));L.materials=Da.materials;Fa.push(L)}}}}ya&&Fa.sort(c);return Fa}};
 THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,c=new THREE.Projector,d,f,g,h;this.domElement=document.createElement("div");this.setSize=function(j,k){d=j;f=k;g=d/2;h=f/2};this.render=function(j,k){var n,p,o,w,y,v,A,F;b=c.projectScene(j,k);n=0;for(p=b.length;n<p;n++){y=b[n];if(y instanceof THREE.RenderableParticle){A=y.x*g+g;F=y.y*h+h;o=0;for(w=y.material.length;o<w;o++){v=y.material[o];if(v instanceof THREE.ParticleDOMMaterial){v=v.domElement;v.style.left=A+"px";v.style.top=F+"px"}}}}}};
 THREE.CanvasRenderer=function(){function b(ma){if(v!=ma)o.globalAlpha=v=ma}function c(ma){if(A!=ma){switch(ma){case THREE.NormalBlending:o.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:o.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:o.globalCompositeOperation="darker"}A=ma}}function d(ma){if(F!=ma)o.strokeStyle=F=ma}var f=null,g=new THREE.Projector,h=document.createElement("canvas"),j,k,n,p,o=h.getContext("2d"),w=new THREE.Color(0),y=0,v=1,A=0,
-F=null,G=null,K=null,V=null,z=null,O,P,S,wa,sa=new THREE.RenderableVertex,qa=new THREE.RenderableVertex,e,ga,ea,xa,Ea,Fa,ra,aa,pa,ya,ja,Y,na=new THREE.Color,Ba=new THREE.Color,ka=new THREE.Color,la=new THREE.Color,Da=new THREE.Color,Sa,$a,Ya,Ta,R,$,oa,Ca,ia,da,m=new THREE.Rectangle,C=new THREE.Rectangle,u=new THREE.Rectangle,x=!1,B=new THREE.Color,J=new THREE.Color,L=new THREE.Color,H=new THREE.Color,I=new THREE.Vector3,E,M,N,W,U,za,Ka=16;E=document.createElement("canvas");E.width=E.height=2;M=E.getContext("2d");
-M.fillStyle="rgba(0,0,0,1)";M.fillRect(0,0,2,2);N=M.getImageData(0,0,2,2);W=N.data;U=document.createElement("canvas");U.width=U.height=Ka;za=U.getContext("2d");za.translate(-Ka/2,-Ka/2);za.scale(Ka,Ka);Ka--;this.domElement=h;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setSize=function(ma,Ha){j=ma;k=Ha;n=j/2;p=k/2;h.width=j;h.height=k;m.set(-n,-p,n,p);v=1;A=0;z=V=K=G=F=null};this.setClearColor=function(ma,Ha){w=ma;y=Ha};this.setClearColorHex=function(ma,Ha){w.setHex(ma);y=Ha};this.clear=
-function(){o.setTransform(1,0,0,-1,n,p);if(!C.isEmpty()){C.inflate(1);C.minSelf(m);if(w.hex==0&&y==0)o.clearRect(C.getX(),C.getY(),C.getWidth(),C.getHeight());else{c(THREE.NormalBlending);b(1);o.fillStyle="rgba("+Math.floor(w.r*255)+","+Math.floor(w.g*255)+","+Math.floor(w.b*255)+","+y+")";o.fillRect(C.getX(),C.getY(),C.getWidth(),C.getHeight())}C.empty()}};this.render=function(ma,Ha){function db(X){var ta,fa,ca,va=X.lights;J.setRGB(0,0,0);L.setRGB(0,0,0);H.setRGB(0,0,0);X=0;for(ta=va.length;X<ta;X++){fa=
-va[X];ca=fa.color;if(fa instanceof THREE.AmbientLight){J.r+=ca.r;J.g+=ca.g;J.b+=ca.b}else if(fa instanceof THREE.DirectionalLight){L.r+=ca.r;L.g+=ca.g;L.b+=ca.b}else if(fa instanceof THREE.PointLight){H.r+=ca.r;H.g+=ca.g;H.b+=ca.b}}}function Aa(X,ta,fa,ca){var va,ua,ha,Q,Na=X.lights;X=0;for(va=Na.length;X<va;X++){ua=Na[X];ha=ua.color;if(ua instanceof THREE.DirectionalLight){Q=fa.dot(ua.position);if(!(Q<=0)){Q*=ua.intensity;ca.r+=ha.r*Q;ca.g+=ha.g*Q;ca.b+=ha.b*Q}}else if(ua instanceof THREE.PointLight){Q=
-fa.dot(I.sub(ua.position,ta).normalize());if(!(Q<=0)){Q*=ua.distance==0?1:1-Math.min(ta.distanceTo(ua.position)/ua.distance,1);if(Q!=0){Q*=ua.intensity;ca.r+=ha.r*Q;ca.g+=ha.g*Q;ca.b+=ha.b*Q}}}}}function Ga(X,ta,fa){b(fa.opacity);c(fa.blending);var ca,va,ua,ha,Q,Na;if(fa instanceof THREE.ParticleBasicMaterial){if(fa.map){ha=fa.map.image;Q=ha.width>>1;Na=ha.height>>1;fa=ta.scale.x*n;ua=ta.scale.y*p;ca=fa*Q;va=ua*Na;u.set(X.x-ca,X.y-va,X.x+ca,X.y+va);if(m.instersects(u)){o.save();o.translate(X.x,X.y);
-o.rotate(-ta.rotation);o.scale(fa,-ua);o.translate(-Q,-Na);o.drawImage(ha,0,0);o.restore()}}}else if(fa instanceof THREE.ParticleCanvasMaterial){ca=ta.scale.x*n;va=ta.scale.y*p;u.set(X.x-ca,X.y-va,X.x+ca,X.y+va);if(m.instersects(u)){d(fa.color.__styleString);ua=fa.color.__styleString;if(G!=ua)o.fillStyle=G=ua;o.save();o.translate(X.x,X.y);o.rotate(-ta.rotation);o.scale(ca,va);fa.program(o);o.restore()}}}function Ia(X,ta,fa,ca){b(ca.opacity);c(ca.blending);o.beginPath();o.moveTo(X.positionScreen.x,
-X.positionScreen.y);o.lineTo(ta.positionScreen.x,ta.positionScreen.y);o.closePath();if(ca instanceof THREE.LineBasicMaterial){na.__styleString=ca.color.__styleString;X=ca.linewidth;if(K!=X)o.lineWidth=K=X;X=ca.linecap;if(V!=X)o.lineCap=V=X;X=ca.linejoin;if(z!=X)o.lineJoin=z=X;d(na.__styleString);o.stroke();u.inflate(ca.linewidth*2)}}function Qa(X,ta,fa,ca,va,ua,ha,Q,Na){b(Q.opacity);c(Q.blending);e=X.positionScreen.x;ga=X.positionScreen.y;ea=ta.positionScreen.x;xa=ta.positionScreen.y;Ea=fa.positionScreen.x;
-Fa=fa.positionScreen.y;Z(e,ga,ea,xa,Ea,Fa);if(Q instanceof THREE.MeshBasicMaterial)if(Q.map){if(Q.map.mapping instanceof THREE.UVMapping){Ta=ha.uvs[0];Ma(e,ga,ea,xa,Ea,Fa,Q.map.image,Ta[ca].u,Ta[ca].v,Ta[va].u,Ta[va].v,Ta[ua].u,Ta[ua].v)}}else if(Q.envMap){if(Q.envMap.mapping instanceof THREE.SphericalReflectionMapping){X=Ha.matrixWorldInverse;I.copy(ha.vertexNormalsWorld[0]);R=(I.x*X.n11+I.y*X.n12+I.z*X.n13)*0.5+0.5;$=-(I.x*X.n21+I.y*X.n22+I.z*X.n23)*0.5+0.5;I.copy(ha.vertexNormalsWorld[1]);oa=(I.x*
-X.n11+I.y*X.n12+I.z*X.n13)*0.5+0.5;Ca=-(I.x*X.n21+I.y*X.n22+I.z*X.n23)*0.5+0.5;I.copy(ha.vertexNormalsWorld[2]);ia=(I.x*X.n11+I.y*X.n12+I.z*X.n13)*0.5+0.5;da=-(I.x*X.n21+I.y*X.n22+I.z*X.n23)*0.5+0.5;Ma(e,ga,ea,xa,Ea,Fa,Q.envMap.image,R,$,oa,Ca,ia,da)}}else Q.wireframe?ab(Q.color.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):fb(Q.color.__styleString);else if(Q instanceof THREE.MeshLambertMaterial){if(Q.map&&!Q.wireframe){if(Q.map.mapping instanceof THREE.UVMapping){Ta=
-ha.uvs[0];Ma(e,ga,ea,xa,Ea,Fa,Q.map.image,Ta[ca].u,Ta[ca].v,Ta[va].u,Ta[va].v,Ta[ua].u,Ta[ua].v)}c(THREE.SubtractiveBlending)}if(x)if(!Q.wireframe&&Q.shading==THREE.SmoothShading&&ha.vertexNormalsWorld.length==3){Ba.r=ka.r=la.r=J.r;Ba.g=ka.g=la.g=J.g;Ba.b=ka.b=la.b=J.b;Aa(Na,ha.v1.positionWorld,ha.vertexNormalsWorld[0],Ba);Aa(Na,ha.v2.positionWorld,ha.vertexNormalsWorld[1],ka);Aa(Na,ha.v3.positionWorld,ha.vertexNormalsWorld[2],la);Da.r=(ka.r+la.r)*0.5;Da.g=(ka.g+la.g)*0.5;Da.b=(ka.b+la.b)*0.5;Ya=
-Va(Ba,ka,la,Da);Ma(e,ga,ea,xa,Ea,Fa,Ya,0,0,1,0,0,1)}else{B.r=J.r;B.g=J.g;B.b=J.b;Aa(Na,ha.centroidWorld,ha.normalWorld,B);na.r=Q.color.r*B.r;na.g=Q.color.g*B.g;na.b=Q.color.b*B.b;na.updateStyleString();Q.wireframe?ab(na.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):fb(na.__styleString)}else Q.wireframe?ab(Q.color.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):fb(Q.color.__styleString)}else if(Q instanceof THREE.MeshDepthMaterial){Sa=Ha.near;
-$a=Ha.far;Ba.r=Ba.g=Ba.b=1-gb(X.positionScreen.z,Sa,$a);ka.r=ka.g=ka.b=1-gb(ta.positionScreen.z,Sa,$a);la.r=la.g=la.b=1-gb(fa.positionScreen.z,Sa,$a);Da.r=(ka.r+la.r)*0.5;Da.g=(ka.g+la.g)*0.5;Da.b=(ka.b+la.b)*0.5;Ya=Va(Ba,ka,la,Da);Ma(e,ga,ea,xa,Ea,Fa,Ya,0,0,1,0,0,1)}else if(Q instanceof THREE.MeshNormalMaterial){na.r=hb(ha.normalWorld.x);na.g=hb(ha.normalWorld.y);na.b=hb(ha.normalWorld.z);na.updateStyleString();Q.wireframe?ab(na.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):
-fb(na.__styleString)}}function D(X,ta,fa,ca,va,ua,ha,Q,Na){b(Q.opacity);c(Q.blending);if(Q.map||Q.envMap){Qa(X,ta,ca,0,1,3,ha,Q,Na);Qa(va,fa,ua,1,2,3,ha,Q,Na)}else{e=X.positionScreen.x;ga=X.positionScreen.y;ea=ta.positionScreen.x;xa=ta.positionScreen.y;Ea=fa.positionScreen.x;Fa=fa.positionScreen.y;ra=ca.positionScreen.x;aa=ca.positionScreen.y;pa=va.positionScreen.x;ya=va.positionScreen.y;ja=ua.positionScreen.x;Y=ua.positionScreen.y;if(Q instanceof THREE.MeshBasicMaterial){t(e,ga,ea,xa,Ea,Fa,ra,aa);
+F=null,G=null,L=null,V=null,z=null,K,P,S,xa,ra=new THREE.RenderableVertex,pa=new THREE.RenderableVertex,e,fa,ca,ya,Fa,Ea,Y,qa,ta,va,ia,Z,na=new THREE.Color,Ba=new THREE.Color,ka=new THREE.Color,la=new THREE.Color,Da=new THREE.Color,Sa,$a,Ya,Ta,R,aa,oa,Ca,ja,ga,m=new THREE.Rectangle,C=new THREE.Rectangle,u=new THREE.Rectangle,x=!1,B=new THREE.Color,J=new THREE.Color,M=new THREE.Color,H=new THREE.Color,I=new THREE.Vector3,E,N,O,W,U,za,Ka=16;E=document.createElement("canvas");E.width=E.height=2;N=E.getContext("2d");
+N.fillStyle="rgba(0,0,0,1)";N.fillRect(0,0,2,2);O=N.getImageData(0,0,2,2);W=O.data;U=document.createElement("canvas");U.width=U.height=Ka;za=U.getContext("2d");za.translate(-Ka/2,-Ka/2);za.scale(Ka,Ka);Ka--;this.domElement=h;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setSize=function(ma,Ha){j=ma;k=Ha;n=j/2;p=k/2;h.width=j;h.height=k;m.set(-n,-p,n,p);v=1;A=0;z=V=L=G=F=null};this.setClearColor=function(ma,Ha){w=ma;y=Ha};this.setClearColorHex=function(ma,Ha){w.setHex(ma);y=Ha};this.clear=
+function(){o.setTransform(1,0,0,-1,n,p);if(!C.isEmpty()){C.inflate(1);C.minSelf(m);if(w.hex==0&&y==0)o.clearRect(C.getX(),C.getY(),C.getWidth(),C.getHeight());else{c(THREE.NormalBlending);b(1);o.fillStyle="rgba("+Math.floor(w.r*255)+","+Math.floor(w.g*255)+","+Math.floor(w.b*255)+","+y+")";o.fillRect(C.getX(),C.getY(),C.getWidth(),C.getHeight())}C.empty()}};this.render=function(ma,Ha){function db(X){var sa,ea,da,wa=X.lights;J.setRGB(0,0,0);M.setRGB(0,0,0);H.setRGB(0,0,0);X=0;for(sa=wa.length;X<sa;X++){ea=
+wa[X];da=ea.color;if(ea instanceof THREE.AmbientLight){J.r+=da.r;J.g+=da.g;J.b+=da.b}else if(ea instanceof THREE.DirectionalLight){M.r+=da.r;M.g+=da.g;M.b+=da.b}else if(ea instanceof THREE.PointLight){H.r+=da.r;H.g+=da.g;H.b+=da.b}}}function Aa(X,sa,ea,da){var wa,ua,ha,Q,Na=X.lights;X=0;for(wa=Na.length;X<wa;X++){ua=Na[X];ha=ua.color;if(ua instanceof THREE.DirectionalLight){Q=ea.dot(ua.position);if(!(Q<=0)){Q*=ua.intensity;da.r+=ha.r*Q;da.g+=ha.g*Q;da.b+=ha.b*Q}}else if(ua instanceof THREE.PointLight){Q=
+ea.dot(I.sub(ua.position,sa).normalize());if(!(Q<=0)){Q*=ua.distance==0?1:1-Math.min(sa.distanceTo(ua.position)/ua.distance,1);if(Q!=0){Q*=ua.intensity;da.r+=ha.r*Q;da.g+=ha.g*Q;da.b+=ha.b*Q}}}}}function Ga(X,sa,ea){b(ea.opacity);c(ea.blending);var da,wa,ua,ha,Q,Na;if(ea instanceof THREE.ParticleBasicMaterial){if(ea.map){ha=ea.map.image;Q=ha.width>>1;Na=ha.height>>1;ea=sa.scale.x*n;ua=sa.scale.y*p;da=ea*Q;wa=ua*Na;u.set(X.x-da,X.y-wa,X.x+da,X.y+wa);if(m.instersects(u)){o.save();o.translate(X.x,X.y);
+o.rotate(-sa.rotation);o.scale(ea,-ua);o.translate(-Q,-Na);o.drawImage(ha,0,0);o.restore()}}}else if(ea instanceof THREE.ParticleCanvasMaterial){da=sa.scale.x*n;wa=sa.scale.y*p;u.set(X.x-da,X.y-wa,X.x+da,X.y+wa);if(m.instersects(u)){d(ea.color.__styleString);ua=ea.color.__styleString;if(G!=ua)o.fillStyle=G=ua;o.save();o.translate(X.x,X.y);o.rotate(-sa.rotation);o.scale(da,wa);ea.program(o);o.restore()}}}function Ia(X,sa,ea,da){b(da.opacity);c(da.blending);o.beginPath();o.moveTo(X.positionScreen.x,
+X.positionScreen.y);o.lineTo(sa.positionScreen.x,sa.positionScreen.y);o.closePath();if(da instanceof THREE.LineBasicMaterial){na.__styleString=da.color.__styleString;X=da.linewidth;if(L!=X)o.lineWidth=L=X;X=da.linecap;if(V!=X)o.lineCap=V=X;X=da.linejoin;if(z!=X)o.lineJoin=z=X;d(na.__styleString);o.stroke();u.inflate(da.linewidth*2)}}function Qa(X,sa,ea,da,wa,ua,ha,Q,Na){b(Q.opacity);c(Q.blending);e=X.positionScreen.x;fa=X.positionScreen.y;ca=sa.positionScreen.x;ya=sa.positionScreen.y;Fa=ea.positionScreen.x;
+Ea=ea.positionScreen.y;$(e,fa,ca,ya,Fa,Ea);if(Q instanceof THREE.MeshBasicMaterial)if(Q.map){if(Q.map.mapping instanceof THREE.UVMapping){Ta=ha.uvs[0];Ma(e,fa,ca,ya,Fa,Ea,Q.map.image,Ta[da].u,Ta[da].v,Ta[wa].u,Ta[wa].v,Ta[ua].u,Ta[ua].v)}}else if(Q.envMap){if(Q.envMap.mapping instanceof THREE.SphericalReflectionMapping){X=Ha.matrixWorldInverse;I.copy(ha.vertexNormalsWorld[0]);R=(I.x*X.n11+I.y*X.n12+I.z*X.n13)*0.5+0.5;aa=-(I.x*X.n21+I.y*X.n22+I.z*X.n23)*0.5+0.5;I.copy(ha.vertexNormalsWorld[1]);oa=
+(I.x*X.n11+I.y*X.n12+I.z*X.n13)*0.5+0.5;Ca=-(I.x*X.n21+I.y*X.n22+I.z*X.n23)*0.5+0.5;I.copy(ha.vertexNormalsWorld[2]);ja=(I.x*X.n11+I.y*X.n12+I.z*X.n13)*0.5+0.5;ga=-(I.x*X.n21+I.y*X.n22+I.z*X.n23)*0.5+0.5;Ma(e,fa,ca,ya,Fa,Ea,Q.envMap.image,R,aa,oa,Ca,ja,ga)}}else Q.wireframe?ab(Q.color.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):fb(Q.color.__styleString);else if(Q instanceof THREE.MeshLambertMaterial){if(Q.map&&!Q.wireframe){if(Q.map.mapping instanceof THREE.UVMapping){Ta=
+ha.uvs[0];Ma(e,fa,ca,ya,Fa,Ea,Q.map.image,Ta[da].u,Ta[da].v,Ta[wa].u,Ta[wa].v,Ta[ua].u,Ta[ua].v)}c(THREE.SubtractiveBlending)}if(x)if(!Q.wireframe&&Q.shading==THREE.SmoothShading&&ha.vertexNormalsWorld.length==3){Ba.r=ka.r=la.r=J.r;Ba.g=ka.g=la.g=J.g;Ba.b=ka.b=la.b=J.b;Aa(Na,ha.v1.positionWorld,ha.vertexNormalsWorld[0],Ba);Aa(Na,ha.v2.positionWorld,ha.vertexNormalsWorld[1],ka);Aa(Na,ha.v3.positionWorld,ha.vertexNormalsWorld[2],la);Da.r=(ka.r+la.r)*0.5;Da.g=(ka.g+la.g)*0.5;Da.b=(ka.b+la.b)*0.5;Ya=
+Va(Ba,ka,la,Da);Ma(e,fa,ca,ya,Fa,Ea,Ya,0,0,1,0,0,1)}else{B.r=J.r;B.g=J.g;B.b=J.b;Aa(Na,ha.centroidWorld,ha.normalWorld,B);na.r=Q.color.r*B.r;na.g=Q.color.g*B.g;na.b=Q.color.b*B.b;na.updateStyleString();Q.wireframe?ab(na.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):fb(na.__styleString)}else Q.wireframe?ab(Q.color.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):fb(Q.color.__styleString)}else if(Q instanceof THREE.MeshDepthMaterial){Sa=Ha.near;
+$a=Ha.far;Ba.r=Ba.g=Ba.b=1-gb(X.positionScreen.z,Sa,$a);ka.r=ka.g=ka.b=1-gb(sa.positionScreen.z,Sa,$a);la.r=la.g=la.b=1-gb(ea.positionScreen.z,Sa,$a);Da.r=(ka.r+la.r)*0.5;Da.g=(ka.g+la.g)*0.5;Da.b=(ka.b+la.b)*0.5;Ya=Va(Ba,ka,la,Da);Ma(e,fa,ca,ya,Fa,Ea,Ya,0,0,1,0,0,1)}else if(Q instanceof THREE.MeshNormalMaterial){na.r=hb(ha.normalWorld.x);na.g=hb(ha.normalWorld.y);na.b=hb(ha.normalWorld.z);na.updateStyleString();Q.wireframe?ab(na.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):
+fb(na.__styleString)}}function D(X,sa,ea,da,wa,ua,ha,Q,Na){b(Q.opacity);c(Q.blending);if(Q.map||Q.envMap){Qa(X,sa,da,0,1,3,ha,Q,Na);Qa(wa,ea,ua,1,2,3,ha,Q,Na)}else{e=X.positionScreen.x;fa=X.positionScreen.y;ca=sa.positionScreen.x;ya=sa.positionScreen.y;Fa=ea.positionScreen.x;Ea=ea.positionScreen.y;Y=da.positionScreen.x;qa=da.positionScreen.y;ta=wa.positionScreen.x;va=wa.positionScreen.y;ia=ua.positionScreen.x;Z=ua.positionScreen.y;if(Q instanceof THREE.MeshBasicMaterial){t(e,fa,ca,ya,Fa,Ea,Y,qa);
 Q.wireframe?ab(Q.color.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):fb(Q.color.__styleString)}else if(Q instanceof THREE.MeshLambertMaterial)if(x)if(!Q.wireframe&&Q.shading==THREE.SmoothShading&&ha.vertexNormalsWorld.length==4){Ba.r=ka.r=la.r=Da.r=J.r;Ba.g=ka.g=la.g=Da.g=J.g;Ba.b=ka.b=la.b=Da.b=J.b;Aa(Na,ha.v1.positionWorld,ha.vertexNormalsWorld[0],Ba);Aa(Na,ha.v2.positionWorld,ha.vertexNormalsWorld[1],ka);Aa(Na,ha.v4.positionWorld,ha.vertexNormalsWorld[3],la);Aa(Na,
-ha.v3.positionWorld,ha.vertexNormalsWorld[2],Da);Ya=Va(Ba,ka,la,Da);Z(e,ga,ea,xa,ra,aa);Ma(e,ga,ea,xa,ra,aa,Ya,0,0,1,0,0,1);Z(pa,ya,Ea,Fa,ja,Y);Ma(pa,ya,Ea,Fa,ja,Y,Ya,1,0,1,1,0,1)}else{B.r=J.r;B.g=J.g;B.b=J.b;Aa(Na,ha.centroidWorld,ha.normalWorld,B);na.r=Q.color.r*B.r;na.g=Q.color.g*B.g;na.b=Q.color.b*B.b;na.updateStyleString();t(e,ga,ea,xa,Ea,Fa,ra,aa);Q.wireframe?ab(na.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):fb(na.__styleString)}else{t(e,ga,ea,xa,Ea,Fa,ra,aa);
-Q.wireframe?ab(Q.color.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):fb(Q.color.__styleString)}else if(Q instanceof THREE.MeshNormalMaterial){na.r=hb(ha.normalWorld.x);na.g=hb(ha.normalWorld.y);na.b=hb(ha.normalWorld.z);na.updateStyleString();t(e,ga,ea,xa,Ea,Fa,ra,aa);Q.wireframe?ab(na.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):fb(na.__styleString)}else if(Q instanceof THREE.MeshDepthMaterial){Sa=Ha.near;$a=Ha.far;Ba.r=Ba.g=Ba.b=1-gb(X.positionScreen.z,
-Sa,$a);ka.r=ka.g=ka.b=1-gb(ta.positionScreen.z,Sa,$a);la.r=la.g=la.b=1-gb(ca.positionScreen.z,Sa,$a);Da.r=Da.g=Da.b=1-gb(fa.positionScreen.z,Sa,$a);Ya=Va(Ba,ka,la,Da);Z(e,ga,ea,xa,ra,aa);Ma(e,ga,ea,xa,ra,aa,Ya,0,0,1,0,0,1);Z(pa,ya,Ea,Fa,ja,Y);Ma(pa,ya,Ea,Fa,ja,Y,Ya,1,0,1,1,0,1)}}}function Z(X,ta,fa,ca,va,ua){o.beginPath();o.moveTo(X,ta);o.lineTo(fa,ca);o.lineTo(va,ua);o.lineTo(X,ta);o.closePath()}function t(X,ta,fa,ca,va,ua,ha,Q){o.beginPath();o.moveTo(X,ta);o.lineTo(fa,ca);o.lineTo(va,ua);o.lineTo(ha,
-Q);o.lineTo(X,ta);o.closePath()}function ab(X,ta,fa,ca){if(K!=ta)o.lineWidth=K=ta;if(V!=fa)o.lineCap=V=fa;if(z!=ca)o.lineJoin=z=ca;d(X);o.stroke();u.inflate(ta*2)}function fb(X){if(G!=X)o.fillStyle=G=X;o.fill()}function Ma(X,ta,fa,ca,va,ua,ha,Q,Na,cb,Ua,bb,lb){var Pa,ib;Pa=ha.width-1;ib=ha.height-1;Q*=Pa;Na*=ib;cb*=Pa;Ua*=ib;bb*=Pa;lb*=ib;fa-=X;ca-=ta;va-=X;ua-=ta;cb-=Q;Ua-=Na;bb-=Q;lb-=Na;Pa=cb*lb-bb*Ua;if(Pa!=0){ib=1/Pa;Pa=(lb*fa-Ua*va)*ib;Ua=(lb*ca-Ua*ua)*ib;fa=(cb*va-bb*fa)*ib;ca=(cb*ua-bb*ca)*
-ib;X=X-Pa*Q-fa*Na;ta=ta-Ua*Q-ca*Na;o.save();o.transform(Pa,Ua,fa,ca,X,ta);o.clip();o.drawImage(ha,0,0);o.restore()}}function Va(X,ta,fa,ca){var va=~~(X.r*255),ua=~~(X.g*255);X=~~(X.b*255);var ha=~~(ta.r*255),Q=~~(ta.g*255);ta=~~(ta.b*255);var Na=~~(fa.r*255),cb=~~(fa.g*255);fa=~~(fa.b*255);var Ua=~~(ca.r*255),bb=~~(ca.g*255);ca=~~(ca.b*255);W[0]=va<0?0:va>255?255:va;W[1]=ua<0?0:ua>255?255:ua;W[2]=X<0?0:X>255?255:X;W[4]=ha<0?0:ha>255?255:ha;W[5]=Q<0?0:Q>255?255:Q;W[6]=ta<0?0:ta>255?255:ta;W[8]=Na<
-0?0:Na>255?255:Na;W[9]=cb<0?0:cb>255?255:cb;W[10]=fa<0?0:fa>255?255:fa;W[12]=Ua<0?0:Ua>255?255:Ua;W[13]=bb<0?0:bb>255?255:bb;W[14]=ca<0?0:ca>255?255:ca;M.putImageData(N,0,0);za.drawImage(E,0,0);return U}function gb(X,ta,fa){X=(X-ta)/(fa-ta);return X*X*(3-2*X)}function hb(X){X=(X+1)*0.5;return X<0?0:X>1?1:X}function Wa(X,ta){var fa=ta.x-X.x,ca=ta.y-X.y,va=1/Math.sqrt(fa*fa+ca*ca);fa*=va;ca*=va;ta.x+=fa;ta.y+=ca;X.x-=fa;X.y-=ca}var eb,Oa,Ja,La,T,Ra,Xa,Za;this.autoClear?this.clear():o.setTransform(1,
-0,0,-1,n,p);f=g.projectScene(ma,Ha,this.sortElements);(x=ma.lights.length>0)&&db(ma);eb=0;for(Oa=f.length;eb<Oa;eb++){Ja=f[eb];u.empty();if(Ja instanceof THREE.RenderableParticle){O=Ja;O.x*=n;O.y*=p;La=0;for(T=Ja.materials.length;La<T;){Za=Ja.materials[La++];Za.opacity!=0&&Ga(O,Ja,Za,ma)}}else if(Ja instanceof THREE.RenderableLine){O=Ja.v1;P=Ja.v2;O.positionScreen.x*=n;O.positionScreen.y*=p;P.positionScreen.x*=n;P.positionScreen.y*=p;u.addPoint(O.positionScreen.x,O.positionScreen.y);u.addPoint(P.positionScreen.x,
-P.positionScreen.y);if(m.instersects(u)){La=0;for(T=Ja.materials.length;La<T;){Za=Ja.materials[La++];Za.opacity!=0&&Ia(O,P,Ja,Za,ma)}}}else if(Ja instanceof THREE.RenderableFace3){O=Ja.v1;P=Ja.v2;S=Ja.v3;O.positionScreen.x*=n;O.positionScreen.y*=p;P.positionScreen.x*=n;P.positionScreen.y*=p;S.positionScreen.x*=n;S.positionScreen.y*=p;if(Ja.overdraw){Wa(O.positionScreen,P.positionScreen);Wa(P.positionScreen,S.positionScreen);Wa(S.positionScreen,O.positionScreen)}u.add3Points(O.positionScreen.x,O.positionScreen.y,
-P.positionScreen.x,P.positionScreen.y,S.positionScreen.x,S.positionScreen.y);if(m.instersects(u)){La=0;for(T=Ja.meshMaterials.length;La<T;){Za=Ja.meshMaterials[La++];if(Za instanceof THREE.MeshFaceMaterial){Ra=0;for(Xa=Ja.faceMaterials.length;Ra<Xa;)(Za=Ja.faceMaterials[Ra++])&&Za.opacity!=0&&Qa(O,P,S,0,1,2,Ja,Za,ma)}else Za.opacity!=0&&Qa(O,P,S,0,1,2,Ja,Za,ma)}}}else if(Ja instanceof THREE.RenderableFace4){O=Ja.v1;P=Ja.v2;S=Ja.v3;wa=Ja.v4;O.positionScreen.x*=n;O.positionScreen.y*=p;P.positionScreen.x*=
-n;P.positionScreen.y*=p;S.positionScreen.x*=n;S.positionScreen.y*=p;wa.positionScreen.x*=n;wa.positionScreen.y*=p;sa.positionScreen.copy(P.positionScreen);qa.positionScreen.copy(wa.positionScreen);if(Ja.overdraw){Wa(O.positionScreen,P.positionScreen);Wa(P.positionScreen,wa.positionScreen);Wa(wa.positionScreen,O.positionScreen);Wa(S.positionScreen,sa.positionScreen);Wa(S.positionScreen,qa.positionScreen)}u.addPoint(O.positionScreen.x,O.positionScreen.y);u.addPoint(P.positionScreen.x,P.positionScreen.y);
-u.addPoint(S.positionScreen.x,S.positionScreen.y);u.addPoint(wa.positionScreen.x,wa.positionScreen.y);if(m.instersects(u)){La=0;for(T=Ja.meshMaterials.length;La<T;){Za=Ja.meshMaterials[La++];if(Za instanceof THREE.MeshFaceMaterial){Ra=0;for(Xa=Ja.faceMaterials.length;Ra<Xa;)(Za=Ja.faceMaterials[Ra++])&&Za.opacity!=0&&D(O,P,S,wa,sa,qa,Ja,Za,ma)}else Za.opacity!=0&&D(O,P,S,wa,sa,qa,Ja,Za,ma)}}}C.addRectangle(u)}o.setTransform(1,0,0,1,0,0)}};
-THREE.SVGRenderer=function(){function b(ra,aa,pa){var ya,ja,Y,na;ya=0;for(ja=ra.lights.length;ya<ja;ya++){Y=ra.lights[ya];if(Y instanceof THREE.DirectionalLight){na=aa.normalWorld.dot(Y.position)*Y.intensity;if(na>0){pa.r+=Y.color.r*na;pa.g+=Y.color.g*na;pa.b+=Y.color.b*na}}else if(Y instanceof THREE.PointLight){qa.sub(Y.position,aa.centroidWorld);qa.normalize();na=aa.normalWorld.dot(qa)*Y.intensity;if(na>0){pa.r+=Y.color.r*na;pa.g+=Y.color.g*na;pa.b+=Y.color.b*na}}}}function c(ra,aa,pa,ya,ja,Y){ea=
-f(xa++);ea.setAttribute("d","M "+ra.positionScreen.x+" "+ra.positionScreen.y+" L "+aa.positionScreen.x+" "+aa.positionScreen.y+" L "+pa.positionScreen.x+","+pa.positionScreen.y+"z");if(ja instanceof THREE.MeshBasicMaterial)z.__styleString=ja.color.__styleString;else if(ja instanceof THREE.MeshLambertMaterial)if(V){O.r=P.r;O.g=P.g;O.b=P.b;b(Y,ya,O);z.r=ja.color.r*O.r;z.g=ja.color.g*O.g;z.b=ja.color.b*O.b;z.updateStyleString()}else z.__styleString=ja.color.__styleString;else if(ja instanceof THREE.MeshDepthMaterial){sa=
-1-ja.__2near/(ja.__farPlusNear-ya.z*ja.__farMinusNear);z.setRGB(sa,sa,sa)}else ja instanceof THREE.MeshNormalMaterial&&z.setRGB(g(ya.normalWorld.x),g(ya.normalWorld.y),g(ya.normalWorld.z));ja.wireframe?ea.setAttribute("style","fill: none; stroke: "+z.__styleString+"; stroke-width: "+ja.wireframeLinewidth+"; stroke-opacity: "+ja.opacity+"; stroke-linecap: "+ja.wireframeLinecap+"; stroke-linejoin: "+ja.wireframeLinejoin):ea.setAttribute("style","fill: "+z.__styleString+"; fill-opacity: "+ja.opacity);
-k.appendChild(ea)}function d(ra,aa,pa,ya,ja,Y,na){ea=f(xa++);ea.setAttribute("d","M "+ra.positionScreen.x+" "+ra.positionScreen.y+" L "+aa.positionScreen.x+" "+aa.positionScreen.y+" L "+pa.positionScreen.x+","+pa.positionScreen.y+" L "+ya.positionScreen.x+","+ya.positionScreen.y+"z");if(Y instanceof THREE.MeshBasicMaterial)z.__styleString=Y.color.__styleString;else if(Y instanceof THREE.MeshLambertMaterial)if(V){O.r=P.r;O.g=P.g;O.b=P.b;b(na,ja,O);z.r=Y.color.r*O.r;z.g=Y.color.g*O.g;z.b=Y.color.b*
-O.b;z.updateStyleString()}else z.__styleString=Y.color.__styleString;else if(Y instanceof THREE.MeshDepthMaterial){sa=1-Y.__2near/(Y.__farPlusNear-ja.z*Y.__farMinusNear);z.setRGB(sa,sa,sa)}else Y instanceof THREE.MeshNormalMaterial&&z.setRGB(g(ja.normalWorld.x),g(ja.normalWorld.y),g(ja.normalWorld.z));Y.wireframe?ea.setAttribute("style","fill: none; stroke: "+z.__styleString+"; stroke-width: "+Y.wireframeLinewidth+"; stroke-opacity: "+Y.opacity+"; stroke-linecap: "+Y.wireframeLinecap+"; stroke-linejoin: "+
-Y.wireframeLinejoin):ea.setAttribute("style","fill: "+z.__styleString+"; fill-opacity: "+Y.opacity);k.appendChild(ea)}function f(ra){if(e[ra]==null){e[ra]=document.createElementNS("http://www.w3.org/2000/svg","path");Fa==0&&e[ra].setAttribute("shape-rendering","crispEdges")}return e[ra]}function g(ra){return ra<0?Math.min((1+ra)*0.5,0.5):0.5+Math.min(ra*0.5,0.5)}var h=null,j=new THREE.Projector,k=document.createElementNS("http://www.w3.org/2000/svg","svg"),n,p,o,w,y,v,A,F,G=new THREE.Rectangle,K=
-new THREE.Rectangle,V=!1,z=new THREE.Color(16777215),O=new THREE.Color(16777215),P=new THREE.Color(0),S=new THREE.Color(0),wa=new THREE.Color(0),sa,qa=new THREE.Vector3,e=[],ga=[],ea,xa,Ea,Fa=1;this.domElement=k;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(ra){switch(ra){case "high":Fa=1;break;case "low":Fa=0}};this.setSize=function(ra,aa){n=ra;p=aa;o=n/2;w=p/2;k.setAttribute("viewBox",-o+" "+-w+" "+n+" "+p);k.setAttribute("width",n);k.setAttribute("height",
-p);G.set(-o,-w,o,w)};this.clear=function(){for(;k.childNodes.length>0;)k.removeChild(k.childNodes[0])};this.render=function(ra,aa){var pa,ya,ja,Y,na,Ba,ka,la;this.autoClear&&this.clear();h=j.projectScene(ra,aa,this.sortElements);Ea=xa=0;if(V=ra.lights.length>0){ka=ra.lights;P.setRGB(0,0,0);S.setRGB(0,0,0);wa.setRGB(0,0,0);pa=0;for(ya=ka.length;pa<ya;pa++){ja=ka[pa];Y=ja.color;if(ja instanceof THREE.AmbientLight){P.r+=Y.r;P.g+=Y.g;P.b+=Y.b}else if(ja instanceof THREE.DirectionalLight){S.r+=Y.r;S.g+=
-Y.g;S.b+=Y.b}else if(ja instanceof THREE.PointLight){wa.r+=Y.r;wa.g+=Y.g;wa.b+=Y.b}}}pa=0;for(ya=h.length;pa<ya;pa++){ka=h[pa];K.empty();if(ka instanceof THREE.RenderableParticle){y=ka;y.x*=o;y.y*=-w;ja=0;for(Y=ka.materials.length;ja<Y;)ja++}else if(ka instanceof THREE.RenderableLine){y=ka.v1;v=ka.v2;y.positionScreen.x*=o;y.positionScreen.y*=-w;v.positionScreen.x*=o;v.positionScreen.y*=-w;K.addPoint(y.positionScreen.x,y.positionScreen.y);K.addPoint(v.positionScreen.x,v.positionScreen.y);if(G.instersects(K)){ja=
-0;for(Y=ka.materials.length;ja<Y;)if((la=ka.materials[ja++])&&la.opacity!=0){na=y;Ba=v;var Da=Ea++;if(ga[Da]==null){ga[Da]=document.createElementNS("http://www.w3.org/2000/svg","line");Fa==0&&ga[Da].setAttribute("shape-rendering","crispEdges")}ea=ga[Da];ea.setAttribute("x1",na.positionScreen.x);ea.setAttribute("y1",na.positionScreen.y);ea.setAttribute("x2",Ba.positionScreen.x);ea.setAttribute("y2",Ba.positionScreen.y);if(la instanceof THREE.LineBasicMaterial){z.__styleString=la.color.__styleString;
-ea.setAttribute("style","fill: none; stroke: "+z.__styleString+"; stroke-width: "+la.linewidth+"; stroke-opacity: "+la.opacity+"; stroke-linecap: "+la.linecap+"; stroke-linejoin: "+la.linejoin);k.appendChild(ea)}}}}else if(ka instanceof THREE.RenderableFace3){y=ka.v1;v=ka.v2;A=ka.v3;y.positionScreen.x*=o;y.positionScreen.y*=-w;v.positionScreen.x*=o;v.positionScreen.y*=-w;A.positionScreen.x*=o;A.positionScreen.y*=-w;K.addPoint(y.positionScreen.x,y.positionScreen.y);K.addPoint(v.positionScreen.x,v.positionScreen.y);
-K.addPoint(A.positionScreen.x,A.positionScreen.y);if(G.instersects(K)){ja=0;for(Y=ka.meshMaterials.length;ja<Y;){la=ka.meshMaterials[ja++];if(la instanceof THREE.MeshFaceMaterial){na=0;for(Ba=ka.faceMaterials.length;na<Ba;)(la=ka.faceMaterials[na++])&&la.opacity!=0&&c(y,v,A,ka,la,ra)}else la&&la.opacity!=0&&c(y,v,A,ka,la,ra)}}}else if(ka instanceof THREE.RenderableFace4){y=ka.v1;v=ka.v2;A=ka.v3;F=ka.v4;y.positionScreen.x*=o;y.positionScreen.y*=-w;v.positionScreen.x*=o;v.positionScreen.y*=-w;A.positionScreen.x*=
-o;A.positionScreen.y*=-w;F.positionScreen.x*=o;F.positionScreen.y*=-w;K.addPoint(y.positionScreen.x,y.positionScreen.y);K.addPoint(v.positionScreen.x,v.positionScreen.y);K.addPoint(A.positionScreen.x,A.positionScreen.y);K.addPoint(F.positionScreen.x,F.positionScreen.y);if(G.instersects(K)){ja=0;for(Y=ka.meshMaterials.length;ja<Y;){la=ka.meshMaterials[ja++];if(la instanceof THREE.MeshFaceMaterial){na=0;for(Ba=ka.faceMaterials.length;na<Ba;)(la=ka.faceMaterials[na++])&&la.opacity!=0&&d(y,v,A,F,ka,la,
-ra)}else la&&la.opacity!=0&&d(y,v,A,F,ka,la,ra)}}}}}};
+ha.v3.positionWorld,ha.vertexNormalsWorld[2],Da);Ya=Va(Ba,ka,la,Da);$(e,fa,ca,ya,Y,qa);Ma(e,fa,ca,ya,Y,qa,Ya,0,0,1,0,0,1);$(ta,va,Fa,Ea,ia,Z);Ma(ta,va,Fa,Ea,ia,Z,Ya,1,0,1,1,0,1)}else{B.r=J.r;B.g=J.g;B.b=J.b;Aa(Na,ha.centroidWorld,ha.normalWorld,B);na.r=Q.color.r*B.r;na.g=Q.color.g*B.g;na.b=Q.color.b*B.b;na.updateStyleString();t(e,fa,ca,ya,Fa,Ea,Y,qa);Q.wireframe?ab(na.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):fb(na.__styleString)}else{t(e,fa,ca,ya,Fa,Ea,Y,qa);Q.wireframe?
+ab(Q.color.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):fb(Q.color.__styleString)}else if(Q instanceof THREE.MeshNormalMaterial){na.r=hb(ha.normalWorld.x);na.g=hb(ha.normalWorld.y);na.b=hb(ha.normalWorld.z);na.updateStyleString();t(e,fa,ca,ya,Fa,Ea,Y,qa);Q.wireframe?ab(na.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):fb(na.__styleString)}else if(Q instanceof THREE.MeshDepthMaterial){Sa=Ha.near;$a=Ha.far;Ba.r=Ba.g=Ba.b=1-gb(X.positionScreen.z,
+Sa,$a);ka.r=ka.g=ka.b=1-gb(sa.positionScreen.z,Sa,$a);la.r=la.g=la.b=1-gb(da.positionScreen.z,Sa,$a);Da.r=Da.g=Da.b=1-gb(ea.positionScreen.z,Sa,$a);Ya=Va(Ba,ka,la,Da);$(e,fa,ca,ya,Y,qa);Ma(e,fa,ca,ya,Y,qa,Ya,0,0,1,0,0,1);$(ta,va,Fa,Ea,ia,Z);Ma(ta,va,Fa,Ea,ia,Z,Ya,1,0,1,1,0,1)}}}function $(X,sa,ea,da,wa,ua){o.beginPath();o.moveTo(X,sa);o.lineTo(ea,da);o.lineTo(wa,ua);o.lineTo(X,sa);o.closePath()}function t(X,sa,ea,da,wa,ua,ha,Q){o.beginPath();o.moveTo(X,sa);o.lineTo(ea,da);o.lineTo(wa,ua);o.lineTo(ha,
+Q);o.lineTo(X,sa);o.closePath()}function ab(X,sa,ea,da){if(L!=sa)o.lineWidth=L=sa;if(V!=ea)o.lineCap=V=ea;if(z!=da)o.lineJoin=z=da;d(X);o.stroke();u.inflate(sa*2)}function fb(X){if(G!=X)o.fillStyle=G=X;o.fill()}function Ma(X,sa,ea,da,wa,ua,ha,Q,Na,cb,Ua,bb,lb){var Pa,ib;Pa=ha.width-1;ib=ha.height-1;Q*=Pa;Na*=ib;cb*=Pa;Ua*=ib;bb*=Pa;lb*=ib;ea-=X;da-=sa;wa-=X;ua-=sa;cb-=Q;Ua-=Na;bb-=Q;lb-=Na;Pa=cb*lb-bb*Ua;if(Pa!=0){ib=1/Pa;Pa=(lb*ea-Ua*wa)*ib;Ua=(lb*da-Ua*ua)*ib;ea=(cb*wa-bb*ea)*ib;da=(cb*ua-bb*da)*
+ib;X=X-Pa*Q-ea*Na;sa=sa-Ua*Q-da*Na;o.save();o.transform(Pa,Ua,ea,da,X,sa);o.clip();o.drawImage(ha,0,0);o.restore()}}function Va(X,sa,ea,da){var wa=~~(X.r*255),ua=~~(X.g*255);X=~~(X.b*255);var ha=~~(sa.r*255),Q=~~(sa.g*255);sa=~~(sa.b*255);var Na=~~(ea.r*255),cb=~~(ea.g*255);ea=~~(ea.b*255);var Ua=~~(da.r*255),bb=~~(da.g*255);da=~~(da.b*255);W[0]=wa<0?0:wa>255?255:wa;W[1]=ua<0?0:ua>255?255:ua;W[2]=X<0?0:X>255?255:X;W[4]=ha<0?0:ha>255?255:ha;W[5]=Q<0?0:Q>255?255:Q;W[6]=sa<0?0:sa>255?255:sa;W[8]=Na<
+0?0:Na>255?255:Na;W[9]=cb<0?0:cb>255?255:cb;W[10]=ea<0?0:ea>255?255:ea;W[12]=Ua<0?0:Ua>255?255:Ua;W[13]=bb<0?0:bb>255?255:bb;W[14]=da<0?0:da>255?255:da;N.putImageData(O,0,0);za.drawImage(E,0,0);return U}function gb(X,sa,ea){X=(X-sa)/(ea-sa);return X*X*(3-2*X)}function hb(X){X=(X+1)*0.5;return X<0?0:X>1?1:X}function Wa(X,sa){var ea=sa.x-X.x,da=sa.y-X.y,wa=1/Math.sqrt(ea*ea+da*da);ea*=wa;da*=wa;sa.x+=ea;sa.y+=da;X.x-=ea;X.y-=da}var eb,Oa,Ja,La,T,Ra,Xa,Za;this.autoClear?this.clear():o.setTransform(1,
+0,0,-1,n,p);f=g.projectScene(ma,Ha,this.sortElements);(x=ma.lights.length>0)&&db(ma);eb=0;for(Oa=f.length;eb<Oa;eb++){Ja=f[eb];u.empty();if(Ja instanceof THREE.RenderableParticle){K=Ja;K.x*=n;K.y*=p;La=0;for(T=Ja.materials.length;La<T;){Za=Ja.materials[La++];Za.opacity!=0&&Ga(K,Ja,Za,ma)}}else if(Ja instanceof THREE.RenderableLine){K=Ja.v1;P=Ja.v2;K.positionScreen.x*=n;K.positionScreen.y*=p;P.positionScreen.x*=n;P.positionScreen.y*=p;u.addPoint(K.positionScreen.x,K.positionScreen.y);u.addPoint(P.positionScreen.x,
+P.positionScreen.y);if(m.instersects(u)){La=0;for(T=Ja.materials.length;La<T;){Za=Ja.materials[La++];Za.opacity!=0&&Ia(K,P,Ja,Za,ma)}}}else if(Ja instanceof THREE.RenderableFace3){K=Ja.v1;P=Ja.v2;S=Ja.v3;K.positionScreen.x*=n;K.positionScreen.y*=p;P.positionScreen.x*=n;P.positionScreen.y*=p;S.positionScreen.x*=n;S.positionScreen.y*=p;if(Ja.overdraw){Wa(K.positionScreen,P.positionScreen);Wa(P.positionScreen,S.positionScreen);Wa(S.positionScreen,K.positionScreen)}u.add3Points(K.positionScreen.x,K.positionScreen.y,
+P.positionScreen.x,P.positionScreen.y,S.positionScreen.x,S.positionScreen.y);if(m.instersects(u)){La=0;for(T=Ja.meshMaterials.length;La<T;){Za=Ja.meshMaterials[La++];if(Za instanceof THREE.MeshFaceMaterial){Ra=0;for(Xa=Ja.faceMaterials.length;Ra<Xa;)(Za=Ja.faceMaterials[Ra++])&&Za.opacity!=0&&Qa(K,P,S,0,1,2,Ja,Za,ma)}else Za.opacity!=0&&Qa(K,P,S,0,1,2,Ja,Za,ma)}}}else if(Ja instanceof THREE.RenderableFace4){K=Ja.v1;P=Ja.v2;S=Ja.v3;xa=Ja.v4;K.positionScreen.x*=n;K.positionScreen.y*=p;P.positionScreen.x*=
+n;P.positionScreen.y*=p;S.positionScreen.x*=n;S.positionScreen.y*=p;xa.positionScreen.x*=n;xa.positionScreen.y*=p;ra.positionScreen.copy(P.positionScreen);pa.positionScreen.copy(xa.positionScreen);if(Ja.overdraw){Wa(K.positionScreen,P.positionScreen);Wa(P.positionScreen,xa.positionScreen);Wa(xa.positionScreen,K.positionScreen);Wa(S.positionScreen,ra.positionScreen);Wa(S.positionScreen,pa.positionScreen)}u.addPoint(K.positionScreen.x,K.positionScreen.y);u.addPoint(P.positionScreen.x,P.positionScreen.y);
+u.addPoint(S.positionScreen.x,S.positionScreen.y);u.addPoint(xa.positionScreen.x,xa.positionScreen.y);if(m.instersects(u)){La=0;for(T=Ja.meshMaterials.length;La<T;){Za=Ja.meshMaterials[La++];if(Za instanceof THREE.MeshFaceMaterial){Ra=0;for(Xa=Ja.faceMaterials.length;Ra<Xa;)(Za=Ja.faceMaterials[Ra++])&&Za.opacity!=0&&D(K,P,S,xa,ra,pa,Ja,Za,ma)}else Za.opacity!=0&&D(K,P,S,xa,ra,pa,Ja,Za,ma)}}}C.addRectangle(u)}o.setTransform(1,0,0,1,0,0)}};
+THREE.SVGRenderer=function(){function b(Y,qa,ta){var va,ia,Z,na;va=0;for(ia=Y.lights.length;va<ia;va++){Z=Y.lights[va];if(Z instanceof THREE.DirectionalLight){na=qa.normalWorld.dot(Z.position)*Z.intensity;if(na>0){ta.r+=Z.color.r*na;ta.g+=Z.color.g*na;ta.b+=Z.color.b*na}}else if(Z instanceof THREE.PointLight){pa.sub(Z.position,qa.centroidWorld);pa.normalize();na=qa.normalWorld.dot(pa)*Z.intensity;if(na>0){ta.r+=Z.color.r*na;ta.g+=Z.color.g*na;ta.b+=Z.color.b*na}}}}function c(Y,qa,ta,va,ia,Z){ca=f(ya++);
+ca.setAttribute("d","M "+Y.positionScreen.x+" "+Y.positionScreen.y+" L "+qa.positionScreen.x+" "+qa.positionScreen.y+" L "+ta.positionScreen.x+","+ta.positionScreen.y+"z");if(ia instanceof THREE.MeshBasicMaterial)z.__styleString=ia.color.__styleString;else if(ia instanceof THREE.MeshLambertMaterial)if(V){K.r=P.r;K.g=P.g;K.b=P.b;b(Z,va,K);z.r=ia.color.r*K.r;z.g=ia.color.g*K.g;z.b=ia.color.b*K.b;z.updateStyleString()}else z.__styleString=ia.color.__styleString;else if(ia instanceof THREE.MeshDepthMaterial){ra=
+1-ia.__2near/(ia.__farPlusNear-va.z*ia.__farMinusNear);z.setRGB(ra,ra,ra)}else ia instanceof THREE.MeshNormalMaterial&&z.setRGB(g(va.normalWorld.x),g(va.normalWorld.y),g(va.normalWorld.z));ia.wireframe?ca.setAttribute("style","fill: none; stroke: "+z.__styleString+"; stroke-width: "+ia.wireframeLinewidth+"; stroke-opacity: "+ia.opacity+"; stroke-linecap: "+ia.wireframeLinecap+"; stroke-linejoin: "+ia.wireframeLinejoin):ca.setAttribute("style","fill: "+z.__styleString+"; fill-opacity: "+ia.opacity);
+k.appendChild(ca)}function d(Y,qa,ta,va,ia,Z,na){ca=f(ya++);ca.setAttribute("d","M "+Y.positionScreen.x+" "+Y.positionScreen.y+" L "+qa.positionScreen.x+" "+qa.positionScreen.y+" L "+ta.positionScreen.x+","+ta.positionScreen.y+" L "+va.positionScreen.x+","+va.positionScreen.y+"z");if(Z instanceof THREE.MeshBasicMaterial)z.__styleString=Z.color.__styleString;else if(Z instanceof THREE.MeshLambertMaterial)if(V){K.r=P.r;K.g=P.g;K.b=P.b;b(na,ia,K);z.r=Z.color.r*K.r;z.g=Z.color.g*K.g;z.b=Z.color.b*K.b;
+z.updateStyleString()}else z.__styleString=Z.color.__styleString;else if(Z instanceof THREE.MeshDepthMaterial){ra=1-Z.__2near/(Z.__farPlusNear-ia.z*Z.__farMinusNear);z.setRGB(ra,ra,ra)}else Z instanceof THREE.MeshNormalMaterial&&z.setRGB(g(ia.normalWorld.x),g(ia.normalWorld.y),g(ia.normalWorld.z));Z.wireframe?ca.setAttribute("style","fill: none; stroke: "+z.__styleString+"; stroke-width: "+Z.wireframeLinewidth+"; stroke-opacity: "+Z.opacity+"; stroke-linecap: "+Z.wireframeLinecap+"; stroke-linejoin: "+
+Z.wireframeLinejoin):ca.setAttribute("style","fill: "+z.__styleString+"; fill-opacity: "+Z.opacity);k.appendChild(ca)}function f(Y){if(e[Y]==null){e[Y]=document.createElementNS("http://www.w3.org/2000/svg","path");Ea==0&&e[Y].setAttribute("shape-rendering","crispEdges")}return e[Y]}function g(Y){return Y<0?Math.min((1+Y)*0.5,0.5):0.5+Math.min(Y*0.5,0.5)}var h=null,j=new THREE.Projector,k=document.createElementNS("http://www.w3.org/2000/svg","svg"),n,p,o,w,y,v,A,F,G=new THREE.Rectangle,L=new THREE.Rectangle,
+V=!1,z=new THREE.Color(16777215),K=new THREE.Color(16777215),P=new THREE.Color(0),S=new THREE.Color(0),xa=new THREE.Color(0),ra,pa=new THREE.Vector3,e=[],fa=[],ca,ya,Fa,Ea=1;this.domElement=k;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(Y){switch(Y){case "high":Ea=1;break;case "low":Ea=0}};this.setSize=function(Y,qa){n=Y;p=qa;o=n/2;w=p/2;k.setAttribute("viewBox",-o+" "+-w+" "+n+" "+p);k.setAttribute("width",n);k.setAttribute("height",p);G.set(-o,-w,o,w)};this.clear=
+function(){for(;k.childNodes.length>0;)k.removeChild(k.childNodes[0])};this.render=function(Y,qa){var ta,va,ia,Z,na,Ba,ka,la;this.autoClear&&this.clear();h=j.projectScene(Y,qa,this.sortElements);Fa=ya=0;if(V=Y.lights.length>0){ka=Y.lights;P.setRGB(0,0,0);S.setRGB(0,0,0);xa.setRGB(0,0,0);ta=0;for(va=ka.length;ta<va;ta++){ia=ka[ta];Z=ia.color;if(ia instanceof THREE.AmbientLight){P.r+=Z.r;P.g+=Z.g;P.b+=Z.b}else if(ia instanceof THREE.DirectionalLight){S.r+=Z.r;S.g+=Z.g;S.b+=Z.b}else if(ia instanceof
+THREE.PointLight){xa.r+=Z.r;xa.g+=Z.g;xa.b+=Z.b}}}ta=0;for(va=h.length;ta<va;ta++){ka=h[ta];L.empty();if(ka instanceof THREE.RenderableParticle){y=ka;y.x*=o;y.y*=-w;ia=0;for(Z=ka.materials.length;ia<Z;)ia++}else if(ka instanceof THREE.RenderableLine){y=ka.v1;v=ka.v2;y.positionScreen.x*=o;y.positionScreen.y*=-w;v.positionScreen.x*=o;v.positionScreen.y*=-w;L.addPoint(y.positionScreen.x,y.positionScreen.y);L.addPoint(v.positionScreen.x,v.positionScreen.y);if(G.instersects(L)){ia=0;for(Z=ka.materials.length;ia<
+Z;)if((la=ka.materials[ia++])&&la.opacity!=0){na=y;Ba=v;var Da=Fa++;if(fa[Da]==null){fa[Da]=document.createElementNS("http://www.w3.org/2000/svg","line");Ea==0&&fa[Da].setAttribute("shape-rendering","crispEdges")}ca=fa[Da];ca.setAttribute("x1",na.positionScreen.x);ca.setAttribute("y1",na.positionScreen.y);ca.setAttribute("x2",Ba.positionScreen.x);ca.setAttribute("y2",Ba.positionScreen.y);if(la instanceof THREE.LineBasicMaterial){z.__styleString=la.color.__styleString;ca.setAttribute("style","fill: none; stroke: "+
+z.__styleString+"; stroke-width: "+la.linewidth+"; stroke-opacity: "+la.opacity+"; stroke-linecap: "+la.linecap+"; stroke-linejoin: "+la.linejoin);k.appendChild(ca)}}}}else if(ka instanceof THREE.RenderableFace3){y=ka.v1;v=ka.v2;A=ka.v3;y.positionScreen.x*=o;y.positionScreen.y*=-w;v.positionScreen.x*=o;v.positionScreen.y*=-w;A.positionScreen.x*=o;A.positionScreen.y*=-w;L.addPoint(y.positionScreen.x,y.positionScreen.y);L.addPoint(v.positionScreen.x,v.positionScreen.y);L.addPoint(A.positionScreen.x,
+A.positionScreen.y);if(G.instersects(L)){ia=0;for(Z=ka.meshMaterials.length;ia<Z;){la=ka.meshMaterials[ia++];if(la instanceof THREE.MeshFaceMaterial){na=0;for(Ba=ka.faceMaterials.length;na<Ba;)(la=ka.faceMaterials[na++])&&la.opacity!=0&&c(y,v,A,ka,la,Y)}else la&&la.opacity!=0&&c(y,v,A,ka,la,Y)}}}else if(ka instanceof THREE.RenderableFace4){y=ka.v1;v=ka.v2;A=ka.v3;F=ka.v4;y.positionScreen.x*=o;y.positionScreen.y*=-w;v.positionScreen.x*=o;v.positionScreen.y*=-w;A.positionScreen.x*=o;A.positionScreen.y*=
+-w;F.positionScreen.x*=o;F.positionScreen.y*=-w;L.addPoint(y.positionScreen.x,y.positionScreen.y);L.addPoint(v.positionScreen.x,v.positionScreen.y);L.addPoint(A.positionScreen.x,A.positionScreen.y);L.addPoint(F.positionScreen.x,F.positionScreen.y);if(G.instersects(L)){ia=0;for(Z=ka.meshMaterials.length;ia<Z;){la=ka.meshMaterials[ia++];if(la instanceof THREE.MeshFaceMaterial){na=0;for(Ba=ka.faceMaterials.length;na<Ba;)(la=ka.faceMaterials[na++])&&la.opacity!=0&&d(y,v,A,F,ka,la,Y)}else la&&la.opacity!=
+0&&d(y,v,A,F,ka,la,Y)}}}}}};
 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",
@@ -210,9 +210,10 @@ default_vertex:"#ifndef USE_MORPHTARGETS\n#ifndef USE_SKINNING\ngl_Position = pr
 THREE.UniformsLib={common:{diffuse:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:0,texture:null},lightMap:{type:"t",value:2,texture:null},envMap:{type:"t",value:1,texture:null},useRefract:{type:"i",value:0},reflectivity:{type:"f",value:1},refractionRatio:{type:"f",value:0.98},combine:{type:"i",value:0},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)},morphTargetInfluences:{type:"f",
 value:0}},lights:{enableLighting:{type:"i",value:1},ambientLightColor:{type:"fv",value:[]},directionalLightDirection:{type:"fv",value:[]},directionalLightColor:{type:"fv",value:[]},pointLightColor:{type:"fv",value:[]},pointLightPosition:{type:"fv",value:[]},pointLightDistance:{type:"fv1",value:[]}},particle:{psColor:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},size:{type:"f",value:1},scale:{type:"f",value:1},map:{type:"t",value:0,texture:null},fogDensity:{type:"f",value:2.5E-4},
 fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}}};
-THREE.ShaderLib={lensFlareVertexTexture:{vertexShader:"uniform \tvec3 \tscreenPosition;\nuniform\tvec2\tscale;\nuniform\tfloat\trotation;\nuniform    int     renderType;\nuniform\tsampler2D\tocclusionMap;\nattribute \tvec2 \tposition;\nattribute  vec2\tUV;\nvarying\tvec2\tvUV;\nvarying\tfloat\tvVisibility;\nvoid main(void)\n{\nvUV = UV;\nvec2 pos = position;\nif( renderType == 2 ) {\nvec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 )) +\ntexture2D( occlusionMap, vec2( 0.5, 0.1 )) +\ntexture2D( occlusionMap, vec2( 0.9, 0.1 )) +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 )) +\ntexture2D( occlusionMap, vec2( 0.9, 0.9 )) +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 )) +\ntexture2D( occlusionMap, vec2( 0.1, 0.9 )) +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 )) +\ntexture2D( occlusionMap, vec2( 0.5, 0.5 ));\nvVisibility = (       visibility.r / 9.0 ) *\n( 1.0 - visibility.g / 9.0 ) *\n(       visibility.b / 9.0 ) *\n( 1.0 - visibility.a / 9.0 );\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4(( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",fragmentShader:"#ifdef GL_ES\nprecision highp float;\n#endif\nuniform\tsampler2D\tmap;\nuniform\tfloat\t\topacity;\nuniform    int         renderType;\nvarying\tvec2\t\tvUV;\nvarying\tfloat\t\tvVisibility;\nvoid main( void )\n{\nif( renderType == 0 ) {\ngl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nvec4 color = texture2D( map, vUV );\ncolor.a *= opacity * vVisibility;\ngl_FragColor = color;\n}\n}"},
+THREE.ShaderLib={lensFlareVertexTexture:{vertexShader:"uniform \tvec3 \tscreenPosition;\nuniform\tvec2\tscale;\nuniform\tfloat\trotation;\nuniform    int     renderType;\nuniform\tsampler2D\tocclusionMap;\nattribute \tvec2 \tposition;\nattribute  vec2\tUV;\nvarying\tvec2\tvUV;\nvarying\tfloat\tvVisibility;\nvoid main(void)\n{\nvUV = UV;\nvec2 pos = position;\nif( renderType == 2 ) {\nvec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 )) +\ntexture2D( occlusionMap, vec2( 0.5, 0.1 )) +\ntexture2D( occlusionMap, vec2( 0.9, 0.1 )) +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 )) +\ntexture2D( occlusionMap, vec2( 0.9, 0.9 )) +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 )) +\ntexture2D( occlusionMap, vec2( 0.1, 0.9 )) +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 )) +\ntexture2D( occlusionMap, vec2( 0.5, 0.5 ));\nvVisibility = ( 1.0 - visibility.a / 9.0 );\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4(( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",fragmentShader:"#ifdef GL_ES\nprecision highp float;\n#endif\nuniform\tsampler2D\tmap;\nuniform\tfloat\t\topacity;\nuniform    int         renderType;\nvarying\tvec2\t\tvUV;\nvarying\tfloat\t\tvVisibility;\nvoid main( void )\n{\nif( renderType == 0 ) {\ngl_FragColor = vec4( texture2D( map, vUV ).rgb, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nvec4 color = texture2D( map, vUV );\ncolor.a *= opacity * vVisibility;\ngl_FragColor = color;\n}\n}"},
 lensFlare:{vertexShader:"uniform \tvec3 \tscreenPosition;\nuniform\tvec2\tscale;\nuniform\tfloat\trotation;\nuniform    int     renderType;\nattribute \tvec2 \tposition;\nattribute  vec2\tUV;\nvarying\tvec2\tvUV;\nvoid main(void)\n{\nvUV = UV;\nvec2 pos = position;\nif( renderType == 2 ) {\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4(( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",
-fragmentShader:"#ifdef GL_ES\nprecision highp float;\n#endif\nuniform\tsampler2D\tmap;\nuniform\tsampler2D\tocclusionMap;\nuniform\tfloat\t\topacity;\nuniform    int         renderType;\nvarying\tvec2\t\tvUV;\nvoid main( void )\n{\nif( renderType == 0 ) {\ngl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nfloat visibility = texture2D( occlusionMap, vec2( 0.5, 0.1 )).a +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 )).a +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 )).a +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 )).a;\nvisibility = ( 1.0 - visibility / 4.0 );\nvec4 color = texture2D( map, vUV );\ncolor.a *= opacity * visibility;\ngl_FragColor = color;\n}\n}"},
+fragmentShader:"#ifdef GL_ES\nprecision highp float;\n#endif\nuniform\tsampler2D\tmap;\nuniform\tsampler2D\tocclusionMap;\nuniform\tfloat\t\topacity;\nuniform    int         renderType;\nvarying\tvec2\t\tvUV;\nvoid main( void )\n{\nif( renderType == 0 ) {\ngl_FragColor = vec4( texture2D( map, vUV ).rgb, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nfloat visibility = texture2D( occlusionMap, vec2( 0.5, 0.1 )).a +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 )).a +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 )).a +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 )).a;\nvisibility = ( 1.0 - visibility / 4.0 );\nvec4 color = texture2D( map, vUV );\ncolor.a *= opacity * visibility;\ngl_FragColor = color;\n}\n}"},
+sprite:{vertexShader:"uniform \tvec3 \tscreenPosition;\nuniform\tvec2\tscale;\nuniform\tfloat\trotation;\nattribute \tvec2 \tposition;\nattribute  vec2\tUV;\nvarying\tvec2\tvUV;\nvoid main(void)\n{\nvUV = UV;\nvec2 pos;\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\ngl_Position = vec4(( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",fragmentShader:"#ifdef GL_ES\nprecision highp float;\n#endif\nuniform\tsampler2D\tmap;\nuniform\tfloat\t\topacity;\nvarying\tvec2\t\tvUV;\nvoid main( void )\n{\nvec4 color = texture2D( map, vUV );\ncolor.a *= opacity;\ngl_FragColor = color;\n}"},
 shadowPost:{vertexShader:"uniform \tmat4 \tprojectionMatrix;\nattribute \tvec3 \tposition;\nvoid main(void)\n{\ngl_Position = projectionMatrix * vec4( position, 1.0 );\n}",fragmentShader:"#ifdef GL_ES\nprecision highp float;\n#endif\nuniform \tfloat \tdarkness;\nvoid main( void )\n{\ngl_FragColor = vec4( 0, 0, 0, darkness );\n}"},shadowVolumeDynamic:{uniforms:{directionalLightDirection:{type:"fv",value:[]}},vertexShader:"uniform \tvec3 \tdirectionalLightDirection;\nvoid main() {\nvec4 pos      = objectMatrix * vec4( position, 1.0 );\nvec3 norm     = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nvec4 extruded = vec4( directionalLightDirection * 5000.0 * step( 0.0, dot( directionalLightDirection, norm )), 0.0 );\ngl_Position   = projectionMatrix * viewMatrix * ( pos + extruded );\n}",
 fragmentShader:"void main() {\ngl_FragColor = vec4( 1, 1, 1, 1 );\n}"},depth:{uniforms:{mNear:{type:"f",value:1},mFar:{type:"f",value:2E3},opacity:{type:"f",value:1}},fragmentShader:"uniform float mNear;\nuniform float mFar;\nuniform float opacity;\nvoid main() {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat color = 1.0 - smoothstep( mNear, mFar, depth );\ngl_FragColor = vec4( vec3( color ), opacity );\n}",vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}"},
 normal:{uniforms:{opacity:{type:"f",value:1}},fragmentShader:"uniform float opacity;\nvarying vec3 vNormal;\nvoid main() {\ngl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, opacity );\n}",vertexShader:"varying vec3 vNormal;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvNormal = normalize( normalMatrix * normal );\ngl_Position = projectionMatrix * mvPosition;\n}"},basic:{uniforms:THREE.UniformsLib.common,fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;",
@@ -225,111 +226,114 @@ THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.
 vertexShader:["#define PHONG\nvarying vec3 vLightWeighting;\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.lights_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,
 THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.color_vertex,"#ifndef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\n#endif\nvViewPosition = cameraPosition - mPosition.xyz;\nvec3 transformedNormal = normalize( normalMatrix * normal );\nvNormal = transformedNormal;",THREE.ShaderChunk.lights_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,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 c(m,C,u){var x,B,J,L=m.vertices,H=L.length,I=m.colors,E=I.length,M=m.__vertexArray,N=m.__colorArray,W=m.__sortArray,U=m.__dirtyVertices,za=m.__dirtyColors;if(u.sortParticles){Da.multiplySelf(u.matrixWorld);for(x=0;x<H;x++){B=L[x].position;Ya.copy(B);Da.multiplyVector3(Ya);W[x]=[Ya.z,x]}W.sort(function(Ka,ma){return ma[0]-Ka[0]});for(x=0;x<H;x++){B=L[W[x][1]].position;J=x*3;M[J]=B.x;M[J+1]=B.y;M[J+2]=B.z}for(x=0;x<E;x++){J=x*3;color=I[W[x][1]];N[J]=color.r;
-N[J+1]=color.g;N[J+2]=color.b}}else{if(U)for(x=0;x<H;x++){B=L[x].position;J=x*3;M[J]=B.x;M[J+1]=B.y;M[J+2]=B.z}if(za)for(x=0;x<E;x++){color=I[x];J=x*3;N[J]=color.r;N[J+1]=color.g;N[J+2]=color.b}}if(U||u.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,m.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,M,C)}if(za||u.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,m.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,N,C)}}function d(m,C,u,x,B){x.program||ra.initMaterial(x,C,u,B);var J=x.program,L=J.uniforms,H=x.uniforms;
-if(J!=xa){e.useProgram(J);xa=J}e.uniformMatrix4fv(L.projectionMatrix,!1,Sa);if(u&&(x instanceof THREE.MeshBasicMaterial||x instanceof THREE.MeshLambertMaterial||x instanceof THREE.MeshPhongMaterial||x instanceof THREE.LineBasicMaterial||x instanceof THREE.ParticleBasicMaterial||x.fog)){H.fogColor.value.setHex(u.color.hex);if(u instanceof THREE.Fog){H.fogNear.value=u.near;H.fogFar.value=u.far}else if(u instanceof THREE.FogExp2)H.fogDensity.value=u.density}if(x instanceof THREE.MeshPhongMaterial||x instanceof
-THREE.MeshLambertMaterial||x.lights){var I,E,M=0,N=0,W=0,U,za,Ka,ma,Ha=Ta,db=Ha.directional.colors,Aa=Ha.directional.positions,Ga=Ha.point.colors,Ia=Ha.point.positions,Qa=Ha.point.distances,D=0,Z=0;u=E=ma=0;for(I=C.length;u<I;u++){E=C[u];U=E.color;za=E.position;Ka=E.intensity;ma=E.distance;if(E instanceof THREE.AmbientLight){M+=U.r;N+=U.g;W+=U.b}else if(E instanceof THREE.DirectionalLight){ma=D*3;db[ma]=U.r*Ka;db[ma+1]=U.g*Ka;db[ma+2]=U.b*Ka;Aa[ma]=za.x;Aa[ma+1]=za.y;Aa[ma+2]=za.z;D+=1}else if(E instanceof
-THREE.PointLight){E=Z*3;Ga[E]=U.r*Ka;Ga[E+1]=U.g*Ka;Ga[E+2]=U.b*Ka;Ia[E]=za.x;Ia[E+1]=za.y;Ia[E+2]=za.z;Qa[Z]=ma;Z+=1}}for(u=D*3;u<db.length;u++)db[u]=0;for(u=Z*3;u<Ga.length;u++)Ga[u]=0;Ha.point.length=Z;Ha.directional.length=D;Ha.ambient[0]=M;Ha.ambient[1]=N;Ha.ambient[2]=W;u=Ta;H.enableLighting.value=u.directional.length+u.point.length;H.ambientLightColor.value=u.ambient;H.directionalLightColor.value=u.directional.colors;H.directionalLightDirection.value=u.directional.positions;H.pointLightColor.value=
+THREE.WebGLRenderer=function(b){function c(m,C,u){var x,B,J,M=m.vertices,H=M.length,I=m.colors,E=I.length,N=m.__vertexArray,O=m.__colorArray,W=m.__sortArray,U=m.__dirtyVertices,za=m.__dirtyColors;if(u.sortParticles){Da.multiplySelf(u.matrixWorld);for(x=0;x<H;x++){B=M[x].position;Ya.copy(B);Da.multiplyVector3(Ya);W[x]=[Ya.z,x]}W.sort(function(Ka,ma){return ma[0]-Ka[0]});for(x=0;x<H;x++){B=M[W[x][1]].position;J=x*3;N[J]=B.x;N[J+1]=B.y;N[J+2]=B.z}for(x=0;x<E;x++){J=x*3;color=I[W[x][1]];O[J]=color.r;
+O[J+1]=color.g;O[J+2]=color.b}}else{if(U)for(x=0;x<H;x++){B=M[x].position;J=x*3;N[J]=B.x;N[J+1]=B.y;N[J+2]=B.z}if(za)for(x=0;x<E;x++){color=I[x];J=x*3;O[J]=color.r;O[J+1]=color.g;O[J+2]=color.b}}if(U||u.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,m.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,N,C)}if(za||u.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,m.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,O,C)}}function d(m,C,u,x,B){x.program||Y.initMaterial(x,C,u,B);var J=x.program,M=J.uniforms,H=x.uniforms;
+if(J!=ya){e.useProgram(J);ya=J}e.uniformMatrix4fv(M.projectionMatrix,!1,Sa);if(u&&(x instanceof THREE.MeshBasicMaterial||x instanceof THREE.MeshLambertMaterial||x instanceof THREE.MeshPhongMaterial||x instanceof THREE.LineBasicMaterial||x instanceof THREE.ParticleBasicMaterial||x.fog)){H.fogColor.value.setHex(u.color.hex);if(u instanceof THREE.Fog){H.fogNear.value=u.near;H.fogFar.value=u.far}else if(u instanceof THREE.FogExp2)H.fogDensity.value=u.density}if(x instanceof THREE.MeshPhongMaterial||x instanceof
+THREE.MeshLambertMaterial||x.lights){var I,E,N=0,O=0,W=0,U,za,Ka,ma,Ha=Ta,db=Ha.directional.colors,Aa=Ha.directional.positions,Ga=Ha.point.colors,Ia=Ha.point.positions,Qa=Ha.point.distances,D=0,$=0;u=E=ma=0;for(I=C.length;u<I;u++){E=C[u];U=E.color;za=E.position;Ka=E.intensity;ma=E.distance;if(E instanceof THREE.AmbientLight){N+=U.r;O+=U.g;W+=U.b}else if(E instanceof THREE.DirectionalLight){ma=D*3;db[ma]=U.r*Ka;db[ma+1]=U.g*Ka;db[ma+2]=U.b*Ka;Aa[ma]=za.x;Aa[ma+1]=za.y;Aa[ma+2]=za.z;D+=1}else if(E instanceof
+THREE.PointLight){E=$*3;Ga[E]=U.r*Ka;Ga[E+1]=U.g*Ka;Ga[E+2]=U.b*Ka;Ia[E]=za.x;Ia[E+1]=za.y;Ia[E+2]=za.z;Qa[$]=ma;$+=1}}for(u=D*3;u<db.length;u++)db[u]=0;for(u=$*3;u<Ga.length;u++)Ga[u]=0;Ha.point.length=$;Ha.directional.length=D;Ha.ambient[0]=N;Ha.ambient[1]=O;Ha.ambient[2]=W;u=Ta;H.enableLighting.value=u.directional.length+u.point.length;H.ambientLightColor.value=u.ambient;H.directionalLightColor.value=u.directional.colors;H.directionalLightDirection.value=u.directional.positions;H.pointLightColor.value=
 u.point.colors;H.pointLightPosition.value=u.point.positions;H.pointLightDistance.value=u.point.distances}if(x instanceof THREE.MeshBasicMaterial||x instanceof THREE.MeshLambertMaterial||x instanceof THREE.MeshPhongMaterial){H.diffuse.value.setRGB(x.color.r,x.color.g,x.color.b);H.opacity.value=x.opacity;H.map.texture=x.map;H.lightMap.texture=x.lightMap;H.envMap.texture=x.envMap;H.reflectivity.value=x.reflectivity;H.refractionRatio.value=x.refractionRatio;H.combine.value=x.combine;H.useRefract.value=
-x.envMap&&x.envMap.mapping instanceof THREE.CubeRefractionMapping}if(x instanceof THREE.LineBasicMaterial){H.diffuse.value.setRGB(x.color.r,x.color.g,x.color.b);H.opacity.value=x.opacity}else if(x instanceof THREE.ParticleBasicMaterial){H.psColor.value.setRGB(x.color.r,x.color.g,x.color.b);H.opacity.value=x.opacity;H.size.value=x.size;H.scale.value=ga.height/2;H.map.texture=x.map}else if(x instanceof THREE.MeshPhongMaterial){H.ambient.value.setRGB(x.ambient.r,x.ambient.g,x.ambient.b);H.specular.value.setRGB(x.specular.r,
-x.specular.g,x.specular.b);H.shininess.value=x.shininess}else if(x instanceof THREE.MeshDepthMaterial){H.mNear.value=m.near;H.mFar.value=m.far;H.opacity.value=x.opacity}else if(x instanceof THREE.MeshNormalMaterial)H.opacity.value=x.opacity;for(var t in H)if(N=J.uniforms[t]){I=H[t];M=I.type;u=I.value;if(M=="i")e.uniform1i(N,u);else if(M=="f")e.uniform1f(N,u);else if(M=="fv1")e.uniform1fv(N,u);else if(M=="fv")e.uniform3fv(N,u);else if(M=="v2")e.uniform2f(N,u.x,u.y);else if(M=="v3")e.uniform3f(N,u.x,
-u.y,u.z);else if(M=="v4")e.uniform4f(N,u.x,u.y,u.z,u.w);else if(M=="c")e.uniform3f(N,u.r,u.g,u.b);else if(M=="t"){e.uniform1i(N,u);if(I=I.texture)if(I.image instanceof Array&&I.image.length==6){if(I.image.length==6){if(I.needsUpdate){if(I.__webglInit){e.bindTexture(e.TEXTURE_CUBE_MAP,I.image.__webglTextureCube);for(M=0;M<6;++M)e.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+M,0,0,0,e.RGBA,e.UNSIGNED_BYTE,I.image[M])}else{I.image.__webglTextureCube=e.createTexture();e.bindTexture(e.TEXTURE_CUBE_MAP,
-I.image.__webglTextureCube);for(M=0;M<6;++M)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+M,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,I.image[M]);I.__webglInit=!0}O(e.TEXTURE_CUBE_MAP,I,I.image[0]);e.bindTexture(e.TEXTURE_CUBE_MAP,null);I.needsUpdate=!1}e.activeTexture(e.TEXTURE0+u);e.bindTexture(e.TEXTURE_CUBE_MAP,I.image.__webglTextureCube)}}else P(I,u)}}e.uniformMatrix4fv(L.modelViewMatrix,!1,B._modelViewMatrixArray);e.uniformMatrix3fv(L.normalMatrix,!1,B._normalMatrixArray);(x instanceof THREE.MeshShaderMaterial||
-x instanceof THREE.MeshPhongMaterial||x.envMap)&&e.uniform3f(L.cameraPosition,m.position.x,m.position.y,m.position.z);(x instanceof THREE.MeshShaderMaterial||x.envMap||x.skinning)&&e.uniformMatrix4fv(L.objectMatrix,!1,B._objectMatrixArray);(x instanceof THREE.MeshPhongMaterial||x instanceof THREE.MeshLambertMaterial||x instanceof THREE.MeshShaderMaterial||x.skinning)&&e.uniformMatrix4fv(L.viewMatrix,!1,$a);if(x instanceof THREE.ShadowVolumeDynamicMaterial){m=H.directionalLightDirection.value;m[0]=
--C.position.x;m[1]=-C.position.y;m[2]=-C.position.z;e.uniform3fv(L.directionalLightDirection,m);e.uniformMatrix4fv(L.objectMatrix,!1,B._objectMatrixArray);e.uniformMatrix4fv(L.viewMatrix,!1,$a)}if(x.skinning){e.uniformMatrix4fv(L.cameraInverseMatrix,!1,$a);e.uniformMatrix4fv(L.boneGlobalMatrices,!1,B.boneMatrices)}return J}function f(m,C,u,x,B,J){if(x.opacity!=0){var L;m=d(m,C,u,x,J).attributes;if(x.morphTargets){C=x.program.attributes;J.morphTargetBase!==-1?e.bindBuffer(e.ARRAY_BUFFER,B.__webglMorphTargetsBuffers[J.morphTargetBase]):
-e.bindBuffer(e.ARRAY_BUFFER,B.__webglVertexBuffer);e.vertexAttribPointer(C.position,3,e.FLOAT,!1,0,0);if(J.morphTargetForcedOrder.length){u=0;for(var H=J.morphTargetForcedOrder,I=J.morphTargetInfluences;u<x.numSupportedMorphTargets&&u<H.length;){e.bindBuffer(e.ARRAY_BUFFER,B.__webglMorphTargetsBuffers[H[u]]);e.vertexAttribPointer(C["morphTarget"+u],3,e.FLOAT,!1,0,0);J.__webglMorphTargetInfluences[u]=I[H[u]];u++}}else{H=[];var E=-1,M=0;I=J.morphTargetInfluences;var N,W=I.length;u=0;for(J.morphTargetBase!==
--1&&(H[J.morphTargetBase]=!0);u<x.numSupportedMorphTargets;){for(N=0;N<W;N++)if(!H[N]&&I[N]>E){M=N;E=I[M]}e.bindBuffer(e.ARRAY_BUFFER,B.__webglMorphTargetsBuffers[M]);e.vertexAttribPointer(C["morphTarget"+u],3,e.FLOAT,!1,0,0);J.__webglMorphTargetInfluences[u]=E;H[M]=1;E=-1;u++}}e.uniform1fv(x.program.uniforms.morphTargetInfluences,J.__webglMorphTargetInfluences)}else{e.bindBuffer(e.ARRAY_BUFFER,B.__webglVertexBuffer);e.vertexAttribPointer(m.position,3,e.FLOAT,!1,0,0)}if(B.__webglCustomAttributes)for(L in B.__webglCustomAttributes)if(m[L]>=
-0){C=B.__webglCustomAttributes[L];e.bindBuffer(e.ARRAY_BUFFER,C.buffer);e.vertexAttribPointer(m[L],C.size,e.FLOAT,!1,0,0)}if(m.color>=0){e.bindBuffer(e.ARRAY_BUFFER,B.__webglColorBuffer);e.vertexAttribPointer(m.color,3,e.FLOAT,!1,0,0)}if(m.normal>=0){e.bindBuffer(e.ARRAY_BUFFER,B.__webglNormalBuffer);e.vertexAttribPointer(m.normal,3,e.FLOAT,!1,0,0)}if(m.tangent>=0){e.bindBuffer(e.ARRAY_BUFFER,B.__webglTangentBuffer);e.vertexAttribPointer(m.tangent,4,e.FLOAT,!1,0,0)}if(m.uv>=0)if(B.__webglUVBuffer){e.bindBuffer(e.ARRAY_BUFFER,
+x.envMap&&x.envMap.mapping instanceof THREE.CubeRefractionMapping}if(x instanceof THREE.LineBasicMaterial){H.diffuse.value.setRGB(x.color.r,x.color.g,x.color.b);H.opacity.value=x.opacity}else if(x instanceof THREE.ParticleBasicMaterial){H.psColor.value.setRGB(x.color.r,x.color.g,x.color.b);H.opacity.value=x.opacity;H.size.value=x.size;H.scale.value=fa.height/2;H.map.texture=x.map}else if(x instanceof THREE.MeshPhongMaterial){H.ambient.value.setRGB(x.ambient.r,x.ambient.g,x.ambient.b);H.specular.value.setRGB(x.specular.r,
+x.specular.g,x.specular.b);H.shininess.value=x.shininess}else if(x instanceof THREE.MeshDepthMaterial){H.mNear.value=m.near;H.mFar.value=m.far;H.opacity.value=x.opacity}else if(x instanceof THREE.MeshNormalMaterial)H.opacity.value=x.opacity;for(var t in H)if(O=J.uniforms[t]){I=H[t];N=I.type;u=I.value;if(N=="i")e.uniform1i(O,u);else if(N=="f")e.uniform1f(O,u);else if(N=="fv1")e.uniform1fv(O,u);else if(N=="fv")e.uniform3fv(O,u);else if(N=="v2")e.uniform2f(O,u.x,u.y);else if(N=="v3")e.uniform3f(O,u.x,
+u.y,u.z);else if(N=="v4")e.uniform4f(O,u.x,u.y,u.z,u.w);else if(N=="c")e.uniform3f(O,u.r,u.g,u.b);else if(N=="t"){e.uniform1i(O,u);if(I=I.texture)if(I.image instanceof Array&&I.image.length==6){if(I.image.length==6){if(I.needsUpdate){if(I.__webglInit){e.bindTexture(e.TEXTURE_CUBE_MAP,I.image.__webglTextureCube);for(N=0;N<6;++N)e.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+N,0,0,0,e.RGBA,e.UNSIGNED_BYTE,I.image[N])}else{I.image.__webglTextureCube=e.createTexture();e.bindTexture(e.TEXTURE_CUBE_MAP,
+I.image.__webglTextureCube);for(N=0;N<6;++N)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+N,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,I.image[N]);I.__webglInit=!0}K(e.TEXTURE_CUBE_MAP,I,I.image[0]);e.bindTexture(e.TEXTURE_CUBE_MAP,null);I.needsUpdate=!1}e.activeTexture(e.TEXTURE0+u);e.bindTexture(e.TEXTURE_CUBE_MAP,I.image.__webglTextureCube)}}else P(I,u)}}e.uniformMatrix4fv(M.modelViewMatrix,!1,B._modelViewMatrixArray);e.uniformMatrix3fv(M.normalMatrix,!1,B._normalMatrixArray);(x instanceof THREE.MeshShaderMaterial||
+x instanceof THREE.MeshPhongMaterial||x.envMap)&&e.uniform3f(M.cameraPosition,m.position.x,m.position.y,m.position.z);(x instanceof THREE.MeshShaderMaterial||x.envMap||x.skinning)&&e.uniformMatrix4fv(M.objectMatrix,!1,B._objectMatrixArray);(x instanceof THREE.MeshPhongMaterial||x instanceof THREE.MeshLambertMaterial||x instanceof THREE.MeshShaderMaterial||x.skinning)&&e.uniformMatrix4fv(M.viewMatrix,!1,$a);if(x instanceof THREE.ShadowVolumeDynamicMaterial){m=H.directionalLightDirection.value;m[0]=
+-C.position.x;m[1]=-C.position.y;m[2]=-C.position.z;e.uniform3fv(M.directionalLightDirection,m);e.uniformMatrix4fv(M.objectMatrix,!1,B._objectMatrixArray);e.uniformMatrix4fv(M.viewMatrix,!1,$a)}if(x.skinning){e.uniformMatrix4fv(M.cameraInverseMatrix,!1,$a);e.uniformMatrix4fv(M.boneGlobalMatrices,!1,B.boneMatrices)}return J}function f(m,C,u,x,B,J){if(x.opacity!=0){var M;m=d(m,C,u,x,J).attributes;if(x.morphTargets){C=x.program.attributes;J.morphTargetBase!==-1?e.bindBuffer(e.ARRAY_BUFFER,B.__webglMorphTargetsBuffers[J.morphTargetBase]):
+e.bindBuffer(e.ARRAY_BUFFER,B.__webglVertexBuffer);e.vertexAttribPointer(C.position,3,e.FLOAT,!1,0,0);if(J.morphTargetForcedOrder.length){u=0;for(var H=J.morphTargetForcedOrder,I=J.morphTargetInfluences;u<x.numSupportedMorphTargets&&u<H.length;){e.bindBuffer(e.ARRAY_BUFFER,B.__webglMorphTargetsBuffers[H[u]]);e.vertexAttribPointer(C["morphTarget"+u],3,e.FLOAT,!1,0,0);J.__webglMorphTargetInfluences[u]=I[H[u]];u++}}else{H=[];var E=-1,N=0;I=J.morphTargetInfluences;var O,W=I.length;u=0;for(J.morphTargetBase!==
+-1&&(H[J.morphTargetBase]=!0);u<x.numSupportedMorphTargets;){for(O=0;O<W;O++)if(!H[O]&&I[O]>E){N=O;E=I[N]}e.bindBuffer(e.ARRAY_BUFFER,B.__webglMorphTargetsBuffers[N]);e.vertexAttribPointer(C["morphTarget"+u],3,e.FLOAT,!1,0,0);J.__webglMorphTargetInfluences[u]=E;H[N]=1;E=-1;u++}}e.uniform1fv(x.program.uniforms.morphTargetInfluences,J.__webglMorphTargetInfluences)}else{e.bindBuffer(e.ARRAY_BUFFER,B.__webglVertexBuffer);e.vertexAttribPointer(m.position,3,e.FLOAT,!1,0,0)}if(B.__webglCustomAttributes)for(M in B.__webglCustomAttributes)if(m[M]>=
+0){C=B.__webglCustomAttributes[M];e.bindBuffer(e.ARRAY_BUFFER,C.buffer);e.vertexAttribPointer(m[M],C.size,e.FLOAT,!1,0,0)}if(m.color>=0){e.bindBuffer(e.ARRAY_BUFFER,B.__webglColorBuffer);e.vertexAttribPointer(m.color,3,e.FLOAT,!1,0,0)}if(m.normal>=0){e.bindBuffer(e.ARRAY_BUFFER,B.__webglNormalBuffer);e.vertexAttribPointer(m.normal,3,e.FLOAT,!1,0,0)}if(m.tangent>=0){e.bindBuffer(e.ARRAY_BUFFER,B.__webglTangentBuffer);e.vertexAttribPointer(m.tangent,4,e.FLOAT,!1,0,0)}if(m.uv>=0)if(B.__webglUVBuffer){e.bindBuffer(e.ARRAY_BUFFER,
 B.__webglUVBuffer);e.vertexAttribPointer(m.uv,2,e.FLOAT,!1,0,0);e.enableVertexAttribArray(m.uv)}else e.disableVertexAttribArray(m.uv);if(m.uv2>=0)if(B.__webglUV2Buffer){e.bindBuffer(e.ARRAY_BUFFER,B.__webglUV2Buffer);e.vertexAttribPointer(m.uv2,2,e.FLOAT,!1,0,0);e.enableVertexAttribArray(m.uv2)}else e.disableVertexAttribArray(m.uv2);if(x.skinning&&m.skinVertexA>=0&&m.skinVertexB>=0&&m.skinIndex>=0&&m.skinWeight>=0){e.bindBuffer(e.ARRAY_BUFFER,B.__webglSkinVertexABuffer);e.vertexAttribPointer(m.skinVertexA,
 4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,B.__webglSkinVertexBBuffer);e.vertexAttribPointer(m.skinVertexB,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,B.__webglSkinIndicesBuffer);e.vertexAttribPointer(m.skinIndex,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,B.__webglSkinWeightsBuffer);e.vertexAttribPointer(m.skinWeight,4,e.FLOAT,!1,0,0)}if(J instanceof THREE.Mesh)if(x.wireframe){e.lineWidth(x.wireframeLinewidth);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,B.__webglLineBuffer);e.drawElements(e.LINES,
 B.__webglLineCount,e.UNSIGNED_SHORT,0)}else{e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,B.__webglFaceBuffer);e.drawElements(e.TRIANGLES,B.__webglFaceCount,e.UNSIGNED_SHORT,0)}else if(J instanceof THREE.Line){J=J.type==THREE.LineStrip?e.LINE_STRIP:e.LINES;e.lineWidth(x.linewidth);e.drawArrays(J,0,B.__webglLineCount)}else if(J instanceof THREE.ParticleSystem)e.drawArrays(e.POINTS,0,B.__webglParticleCount);else J instanceof THREE.Ribbon&&e.drawArrays(e.TRIANGLE_STRIP,0,B.__webglVertexCount)}}function g(m,C,
-u){if(!m.__webglVertexBuffer)m.__webglVertexBuffer=e.createBuffer();if(!m.__webglNormalBuffer)m.__webglNormalBuffer=e.createBuffer();if(m.hasPos){e.bindBuffer(e.ARRAY_BUFFER,m.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,m.positionArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(C.attributes.position);e.vertexAttribPointer(C.attributes.position,3,e.FLOAT,!1,0,0)}if(m.hasNormal){e.bindBuffer(e.ARRAY_BUFFER,m.__webglNormalBuffer);if(u==THREE.FlatShading){var x,B,J,L,H,I,E,M,N,W,U=m.count*3;for(W=
-0;W<U;W+=9){u=m.normalArray;x=u[W];B=u[W+1];J=u[W+2];L=u[W+3];I=u[W+4];M=u[W+5];H=u[W+6];E=u[W+7];N=u[W+8];x=(x+L+H)/3;B=(B+I+E)/3;J=(J+M+N)/3;u[W]=x;u[W+1]=B;u[W+2]=J;u[W+3]=x;u[W+4]=B;u[W+5]=J;u[W+6]=x;u[W+7]=B;u[W+8]=J}}e.bufferData(e.ARRAY_BUFFER,m.normalArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(C.attributes.normal);e.vertexAttribPointer(C.attributes.normal,3,e.FLOAT,!1,0,0)}e.drawArrays(e.TRIANGLES,0,m.count);m.count=0}function h(m){if(aa!=m.doubleSided){m.doubleSided?e.disable(e.CULL_FACE):
-e.enable(e.CULL_FACE);aa=m.doubleSided}if(pa!=m.flipSided){m.flipSided?e.frontFace(e.CW):e.frontFace(e.CCW);pa=m.flipSided}}function j(m){if(ja!=m){m?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST);ja=m}}function k(m){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-
+u){if(!m.__webglVertexBuffer)m.__webglVertexBuffer=e.createBuffer();if(!m.__webglNormalBuffer)m.__webglNormalBuffer=e.createBuffer();if(m.hasPos){e.bindBuffer(e.ARRAY_BUFFER,m.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,m.positionArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(C.attributes.position);e.vertexAttribPointer(C.attributes.position,3,e.FLOAT,!1,0,0)}if(m.hasNormal){e.bindBuffer(e.ARRAY_BUFFER,m.__webglNormalBuffer);if(u==THREE.FlatShading){var x,B,J,M,H,I,E,N,O,W,U=m.count*3;for(W=
+0;W<U;W+=9){u=m.normalArray;x=u[W];B=u[W+1];J=u[W+2];M=u[W+3];I=u[W+4];N=u[W+5];H=u[W+6];E=u[W+7];O=u[W+8];x=(x+M+H)/3;B=(B+I+E)/3;J=(J+N+O)/3;u[W]=x;u[W+1]=B;u[W+2]=J;u[W+3]=x;u[W+4]=B;u[W+5]=J;u[W+6]=x;u[W+7]=B;u[W+8]=J}}e.bufferData(e.ARRAY_BUFFER,m.normalArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(C.attributes.normal);e.vertexAttribPointer(C.attributes.normal,3,e.FLOAT,!1,0,0)}e.drawArrays(e.TRIANGLES,0,m.count);m.count=0}function h(m){if(qa!=m.doubleSided){m.doubleSided?e.disable(e.CULL_FACE):
+e.enable(e.CULL_FACE);qa=m.doubleSided}if(ta!=m.flipSided){m.flipSided?e.frontFace(e.CW):e.frontFace(e.CCW);ta=m.flipSided}}function j(m){if(ia!=m){m?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST);ia=m}}function k(m){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);var C;for(m=0;m<6;m++){C=la[m];C.divideScalar(Math.sqrt(C.x*C.x+C.y*C.y+C.z*C.z))}}function n(m){for(var C=m.matrixWorld,u=-m.geometry.boundingSphere.radius*Math.max(m.scale.x,Math.max(m.scale.y,m.scale.z)),x=0;x<6;x++){m=la[x].x*C.n14+la[x].y*C.n24+la[x].z*C.n34+la[x].w;if(m<=u)return!1}return!0}function p(m,C){m.list[m.count]=C;m.count+=1}function o(m){var C,u,x=m.object,B=m.opaque,J=m.transparent;J.count=0;m=B.count=0;for(C=x.materials.length;m<
-C;m++){u=x.materials[m];u.transparent?p(J,u):p(B,u)}}function w(m){var C,u,x,B,J=m.object,L=m.buffer,H=m.opaque,I=m.transparent;I.count=0;m=H.count=0;for(x=J.materials.length;m<x;m++){C=J.materials[m];if(C instanceof THREE.MeshFaceMaterial){C=0;for(u=L.materials.length;C<u;C++)(B=L.materials[C])&&(B.transparent?p(I,B):p(H,B))}else(B=C)&&(B.transparent?p(I,B):p(H,B))}}function y(m,C){return C.z-m.z}function v(m){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 C,u=m.lights.length,x,B=m.lights,J=[],L,H,I,E,M,N=m.__webglShadowVolumes.length;for(C=0;C<u;C++){x=m.lights[C];if(x instanceof THREE.DirectionalLight){J[0]=-x.position.x;J[1]=-x.position.y;J[2]=-x.position.z;for(M=0;M<N;M++){x=m.__webglShadowVolumes[M].object;L=m.__webglShadowVolumes[M].buffer;H=x.materials[0];H.program||ra.initMaterial(H,
-B,undefined,x);H=H.program;I=H.uniforms;E=H.attributes;if(xa!==H){e.useProgram(H);xa=H;e.uniformMatrix4fv(I.projectionMatrix,!1,Sa);e.uniformMatrix4fv(I.viewMatrix,!1,$a);e.uniform3fv(I.directionalLightDirection,J)}x.matrixWorld.flattenToArray(x._objectMatrixArray);e.uniformMatrix4fv(I.objectMatrix,!1,x._objectMatrixArray);e.bindBuffer(e.ARRAY_BUFFER,L.__webglVertexBuffer);e.vertexAttribPointer(E.position,3,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,L.__webglNormalBuffer);e.vertexAttribPointer(E.normal,
-3,e.FLOAT,!1,0,0);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,L.__webglFaceBuffer);e.cullFace(e.FRONT);e.drawElements(e.TRIANGLES,L.__webglFaceCount,e.UNSIGNED_SHORT,0);e.cullFace(e.BACK);e.drawElements(e.TRIANGLES,L.__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);ya="";xa=ia.program;e.useProgram(ia.program);e.uniformMatrix4fv(ia.projectionLocation,!1,Sa);e.uniform1f(ia.darknessLocation,
-ia.darkness);e.bindBuffer(e.ARRAY_BUFFER,ia.vertexBuffer);e.vertexAttribPointer(ia.vertexLocation,3,e.FLOAT,!1,0,0);e.enableVertexAttribArray(ia.vertexLocation);e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA);e.blendEquation(e.FUNC_ADD);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,ia.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(m,C){var u,x,B=m.__webglLensFlares.length,J,L,H,I=new THREE.Vector3,E=ka/Ba,M=Ba*0.5,N=ka*0.5,
-W=16/ka,U=[W*E,W],za=[1,1,0],Ka=[1,1],ma=da.uniforms;u=da.attributes;e.useProgram(da.program);xa=da.program;ya="";e.uniform1i(ma.occlusionMap,0);e.uniform1i(ma.map,1);e.bindBuffer(e.ARRAY_BUFFER,da.vertexBuffer);e.vertexAttribPointer(u.vertex,2,e.FLOAT,!1,16,0);e.vertexAttribPointer(u.uv,2,e.FLOAT,!1,16,8);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,da.elementBuffer);e.disable(e.CULL_FACE);e.depthMask(!1);e.activeTexture(e.TEXTURE0);e.bindTexture(e.TEXTURE_2D,da.occlusionTexture);e.activeTexture(e.TEXTURE1);
-e.bindTexture(e.TEXTURE_2D,da.tempTexture);for(x=0;x<B;x++){u=m.__webglLensFlares[x].object;I.set(u.matrixWorld.n14,u.matrixWorld.n24,u.matrixWorld.n34);C.matrixWorldInverse.multiplyVector3(I);C.projectionMatrix.multiplyVector3(I);za[0]=I.x;za[1]=I.y;za[2]=I.z;Ka[0]=za[0]*M+M;Ka[1]=za[1]*N+N;if(da.hasVertexTexture||Ka[0]>0&&Ka[0]<Ba&&Ka[1]>0&&Ka[1]<ka){e.bindTexture(e.TEXTURE_2D,da.tempTexture);e.copyTexSubImage2D(e.TEXTURE_2D,0,0,0,Ka[0]-8,Ka[1]-8,16,16);e.uniform1i(ma.renderType,0);e.uniform2fv(ma.scale,
-U);e.uniform3fv(ma.screenPosition,za);e.disable(e.BLEND);e.enable(e.DEPTH_TEST);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0);e.bindTexture(e.TEXTURE_2D,da.occlusionTexture);e.copyTexSubImage2D(e.TEXTURE_2D,0,0,0,Ka[0]-8,Ka[1]-8,16,16);e.uniform1i(ma.renderType,1);e.disable(e.DEPTH_TEST);e.bindTexture(e.TEXTURE_2D,da.tempTexture);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0);u.positionScreen.x=za[0];u.positionScreen.y=za[1];u.positionScreen.z=za[2];u.customUpdateCallback?u.customUpdateCallback(u):
-u.updateLensFlares();e.uniform1i(ma.renderType,2);e.enable(e.BLEND);J=0;for(L=u.lensFlares.length;J<L;J++){H=u.lensFlares[J];if(H.opacity>0.0010&&H.scale>0.0010){za[0]=H.x;za[1]=H.y;za[2]=H.z;W=H.size*H.scale/ka;U[0]=W*E;U[1]=W;e.uniform3fv(ma.screenPosition,za);e.uniform2fv(ma.scale,U);e.uniform1f(ma.rotation,H.rotation);e.uniform1f(ma.opacity,H.opacity);z(H.blending);P(H.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 F(m,
-C){m._modelViewMatrix.multiplyToArray(C.matrixWorldInverse,m.matrixWorld,m._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(m._modelViewMatrix).transposeIntoArray(m._normalMatrixArray)}function G(m){var C,u,x,B,J;if(m instanceof THREE.Mesh){u=m.geometry;for(C in u.geometryGroups){x=u.geometryGroups[C];J=!1;for(B in x.__webglCustomAttributes)if(x.__webglCustomAttributes[B].needsUpdate){J=!0;break}if(u.__dirtyVertices||u.__dirtyMorphTargets||u.__dirtyElements||u.__dirtyUvs||u.__dirtyNormals||u.__dirtyColors||
-u.__dirtyTangents||J){J=e.DYNAMIC_DRAW;var L=void 0,H=void 0,I=void 0,E=void 0;I=void 0;var M=void 0,N=void 0,W=void 0,U=void 0,za=void 0,Ka=void 0,ma=void 0,Ha=void 0,db=void 0,Aa=void 0,Ga=void 0,Ia=void 0,Qa=void 0;N=void 0;W=void 0;E=void 0;U=void 0;E=void 0;var D=void 0,Z=void 0;N=void 0;D=void 0;Z=void 0;var t=void 0,ab=void 0;D=void 0;Z=void 0;t=void 0;ab=void 0;D=void 0;Z=void 0;t=void 0;ab=void 0;D=void 0;Z=void 0;t=void 0;E=void 0;U=void 0;M=void 0;I=void 0;I=void 0;D=void 0;Z=void 0;t=
-void 0;var fb=void 0,Ma=0,Va=0,gb=0,hb=0,Wa=0,eb=0,Oa=0,Ja=0,La=0,T=0,Ra=0;Z=D=0;var Xa=x.__vertexArray,Za=x.__uvArray,X=x.__uv2Array,ta=x.__normalArray,fa=x.__tangentArray,ca=x.__colorArray,va=x.__skinVertexAArray,ua=x.__skinVertexBArray,ha=x.__skinIndexArray,Q=x.__skinWeightArray,Na=x.__morphTargetsArrays,cb=x.__webglCustomAttributes;t=void 0;var Ua=x.__faceArray,bb=x.__lineArray,lb=x.__needsSmoothNormals;Ka=x.__vertexColorType;za=x.__uvType;ma=x.__normalType;var Pa=m.geometry,ib=Pa.__dirtyVertices,
-sb=Pa.__dirtyElements,rb=Pa.__dirtyUvs,tb=Pa.__dirtyNormals,ub=Pa.__dirtyTangents,vb=Pa.__dirtyColors,wb=Pa.__dirtyMorphTargets,nb=Pa.vertices,xb=x.faces,Ab=Pa.faces,yb=Pa.faceVertexUvs[0],zb=Pa.faceVertexUvs[1],ob=Pa.skinVerticesA,pb=Pa.skinVerticesB,qb=Pa.skinIndices,kb=Pa.skinWeights,mb=Pa.edgeFaces,jb=Pa.morphTargets;if(cb)for(fb in cb){cb[fb].offset=0;cb[fb].offsetSrc=0}L=0;for(H=xb.length;L<H;L++){I=xb[L];E=Ab[I];yb&&(Ha=yb[I]);zb&&(db=zb[I]);I=E.vertexNormals;M=E.normal;N=E.vertexColors;W=
-E.color;U=E.vertexTangents;if(E instanceof THREE.Face3){if(ib){Aa=nb[E.a].position;Ga=nb[E.b].position;Ia=nb[E.c].position;Xa[Va]=Aa.x;Xa[Va+1]=Aa.y;Xa[Va+2]=Aa.z;Xa[Va+3]=Ga.x;Xa[Va+4]=Ga.y;Xa[Va+5]=Ga.z;Xa[Va+6]=Ia.x;Xa[Va+7]=Ia.y;Xa[Va+8]=Ia.z;Va+=9}if(cb)for(fb in cb){t=cb[fb];if(t.needsUpdate){D=t.offset;Z=t.offsetSrc;if(t.size===1){if(t.boundTo===undefined||t.boundTo==="vertices"){t.array[D+0]=t.value[E.a];t.array[D+1]=t.value[E.b];t.array[D+2]=t.value[E.c]}else if(t.boundTo==="faces"){t.array[D+
-0]=t.value[Z];t.array[D+1]=t.value[Z];t.array[D+2]=t.value[Z];t.offsetSrc++}else if(t.boundTo==="faceVertices"){t.array[D+0]=t.value[Z+0];t.array[D+1]=t.value[Z+1];t.array[D+2]=t.value[Z+2];t.offsetSrc+=3}t.offset+=3}else{if(t.boundTo===undefined||t.boundTo==="vertices"){Aa=t.value[E.a];Ga=t.value[E.b];Ia=t.value[E.c]}else if(t.boundTo==="faces"){Aa=t.value[Z];Ga=t.value[Z];Ia=t.value[Z];t.offsetSrc++}else if(t.boundTo==="faceVertices"){Aa=t.value[Z+0];Ga=t.value[Z+1];Ia=t.value[Z+2];t.offsetSrc+=
-3}if(t.size===2){t.array[D+0]=Aa.x;t.array[D+1]=Aa.y;t.array[D+2]=Ga.x;t.array[D+3]=Ga.y;t.array[D+4]=Ia.x;t.array[D+5]=Ia.y;t.offset+=6}else if(t.size===3){if(t.type==="c"){t.array[D+0]=Aa.r;t.array[D+1]=Aa.g;t.array[D+2]=Aa.b;t.array[D+3]=Ga.r;t.array[D+4]=Ga.g;t.array[D+5]=Ga.b;t.array[D+6]=Ia.r;t.array[D+7]=Ia.g;t.array[D+8]=Ia.b}else{t.array[D+0]=Aa.x;t.array[D+1]=Aa.y;t.array[D+2]=Aa.z;t.array[D+3]=Ga.x;t.array[D+4]=Ga.y;t.array[D+5]=Ga.z;t.array[D+6]=Ia.x;t.array[D+7]=Ia.y;t.array[D+8]=Ia.z}t.offset+=
-9}else{t.array[D+0]=Aa.x;t.array[D+1]=Aa.y;t.array[D+2]=Aa.z;t.array[D+3]=Aa.w;t.array[D+4]=Ga.x;t.array[D+5]=Ga.y;t.array[D+6]=Ga.z;t.array[D+7]=Ga.w;t.array[D+8]=Ia.x;t.array[D+9]=Ia.y;t.array[D+10]=Ia.z;t.array[D+11]=Ia.w;t.offset+=12}}}}if(wb){D=0;for(Z=jb.length;D<Z;D++){Aa=jb[D].vertices[E.a].position;Ga=jb[D].vertices[E.b].position;Ia=jb[D].vertices[E.c].position;t=Na[D];t[Ra+0]=Aa.x;t[Ra+1]=Aa.y;t[Ra+2]=Aa.z;t[Ra+3]=Ga.x;t[Ra+4]=Ga.y;t[Ra+5]=Ga.z;t[Ra+6]=Ia.x;t[Ra+7]=Ia.y;t[Ra+8]=Ia.z}Ra+=
-9}if(kb.length){D=kb[E.a];Z=kb[E.b];t=kb[E.c];Q[T]=D.x;Q[T+1]=D.y;Q[T+2]=D.z;Q[T+3]=D.w;Q[T+4]=Z.x;Q[T+5]=Z.y;Q[T+6]=Z.z;Q[T+7]=Z.w;Q[T+8]=t.x;Q[T+9]=t.y;Q[T+10]=t.z;Q[T+11]=t.w;D=qb[E.a];Z=qb[E.b];t=qb[E.c];ha[T]=D.x;ha[T+1]=D.y;ha[T+2]=D.z;ha[T+3]=D.w;ha[T+4]=Z.x;ha[T+5]=Z.y;ha[T+6]=Z.z;ha[T+7]=Z.w;ha[T+8]=t.x;ha[T+9]=t.y;ha[T+10]=t.z;ha[T+11]=t.w;D=ob[E.a];Z=ob[E.b];t=ob[E.c];va[T]=D.x;va[T+1]=D.y;va[T+2]=D.z;va[T+3]=1;va[T+4]=Z.x;va[T+5]=Z.y;va[T+6]=Z.z;va[T+7]=1;va[T+8]=t.x;va[T+9]=t.y;va[T+
-10]=t.z;va[T+11]=1;D=pb[E.a];Z=pb[E.b];t=pb[E.c];ua[T]=D.x;ua[T+1]=D.y;ua[T+2]=D.z;ua[T+3]=1;ua[T+4]=Z.x;ua[T+5]=Z.y;ua[T+6]=Z.z;ua[T+7]=1;ua[T+8]=t.x;ua[T+9]=t.y;ua[T+10]=t.z;ua[T+11]=1;T+=12}if(vb&&Ka){if(N.length==3&&Ka==THREE.VertexColors){E=N[0];D=N[1];Z=N[2]}else Z=D=E=W;ca[La]=E.r;ca[La+1]=E.g;ca[La+2]=E.b;ca[La+3]=D.r;ca[La+4]=D.g;ca[La+5]=D.b;ca[La+6]=Z.r;ca[La+7]=Z.g;ca[La+8]=Z.b;La+=9}if(ub&&Pa.hasTangents){N=U[0];W=U[1];E=U[2];fa[Oa]=N.x;fa[Oa+1]=N.y;fa[Oa+2]=N.z;fa[Oa+3]=N.w;fa[Oa+4]=
-W.x;fa[Oa+5]=W.y;fa[Oa+6]=W.z;fa[Oa+7]=W.w;fa[Oa+8]=E.x;fa[Oa+9]=E.y;fa[Oa+10]=E.z;fa[Oa+11]=E.w;Oa+=12}if(tb&&ma)if(I.length==3&&lb)for(U=0;U<3;U++){M=I[U];ta[eb]=M.x;ta[eb+1]=M.y;ta[eb+2]=M.z;eb+=3}else for(U=0;U<3;U++){ta[eb]=M.x;ta[eb+1]=M.y;ta[eb+2]=M.z;eb+=3}if(rb&&Ha!==undefined&&za)for(U=0;U<3;U++){I=Ha[U];Za[gb]=I.u;Za[gb+1]=I.v;gb+=2}if(rb&&db!==undefined&&za)for(U=0;U<3;U++){I=db[U];X[hb]=I.u;X[hb+1]=I.v;hb+=2}if(sb){Ua[Wa]=Ma;Ua[Wa+1]=Ma+1;Ua[Wa+2]=Ma+2;Wa+=3;bb[Ja]=Ma;bb[Ja+1]=Ma+1;bb[Ja+
-2]=Ma;bb[Ja+3]=Ma+2;bb[Ja+4]=Ma+1;bb[Ja+5]=Ma+2;Ja+=6;Ma+=3}}else if(E instanceof THREE.Face4){if(ib){Aa=nb[E.a].position;Ga=nb[E.b].position;Ia=nb[E.c].position;Qa=nb[E.d].position;Xa[Va]=Aa.x;Xa[Va+1]=Aa.y;Xa[Va+2]=Aa.z;Xa[Va+3]=Ga.x;Xa[Va+4]=Ga.y;Xa[Va+5]=Ga.z;Xa[Va+6]=Ia.x;Xa[Va+7]=Ia.y;Xa[Va+8]=Ia.z;Xa[Va+9]=Qa.x;Xa[Va+10]=Qa.y;Xa[Va+11]=Qa.z;Va+=12}if(cb)for(fb in cb){t=cb[fb];if(t.needsUpdate){D=t.offset;Z=t.offsetSrc;if(t.size===1){if(t.boundTo===undefined||t.boundTo==="vertices"){t.array[D+
-0]=t.value[E.a];t.array[D+1]=t.value[E.b];t.array[D+2]=t.value[E.c];t.array[D+2]=t.value[E.d]}else if(t.boundTo==="faces"){t.array[D+0]=t.value[Z];t.array[D+1]=t.value[Z];t.array[D+2]=t.value[Z];t.array[D+2]=t.value[Z];t.offsetSrc++}else if(t.boundTo==="faceVertices"){t.array[D+0]=t.value[Z+0];t.array[D+1]=t.value[Z+1];t.array[D+2]=t.value[Z+2];t.array[D+2]=t.value[Z+3];t.offsetSrc+=4}t.offset+=4}else{if(t.boundTo===undefined||t.boundTo==="vertices"){Aa=t.value[E.a];Ga=t.value[E.b];Ia=t.value[E.c];
-Qa=t.value[E.d]}else if(t.boundTo==="faces"){Aa=t.value[Z];Ga=t.value[Z];Ia=t.value[Z];Qa=t.value[Z];t.offsetSrc++}else if(t.boundTo==="faceVertices"){Aa=t.value[Z+0];Ga=t.value[Z+1];Ia=t.value[Z+2];Qa=t.value[Z+3];t.offsetSrc+=4}if(t.size===2){t.array[D+0]=Aa.x;t.array[D+1]=Aa.y;t.array[D+2]=Ga.x;t.array[D+3]=Ga.y;t.array[D+4]=Ia.x;t.array[D+5]=Ia.y;t.array[D+6]=Qa.x;t.array[D+7]=Qa.y;t.offset+=8}else if(t.size===3){if(t.type==="c"){t.array[D+0]=Aa.r;t.array[D+1]=Aa.g;t.array[D+2]=Aa.b;t.array[D+
-3]=Ga.r;t.array[D+4]=Ga.g;t.array[D+5]=Ga.b;t.array[D+6]=Ia.r;t.array[D+7]=Ia.g;t.array[D+8]=Ia.b;t.array[D+9]=Qa.r;t.array[D+10]=Qa.g;t.array[D+11]=Qa.b}else{t.array[D+0]=Aa.x;t.array[D+1]=Aa.y;t.array[D+2]=Aa.z;t.array[D+3]=Ga.x;t.array[D+4]=Ga.y;t.array[D+5]=Ga.z;t.array[D+6]=Ia.x;t.array[D+7]=Ia.y;t.array[D+8]=Ia.z;t.array[D+9]=Qa.x;t.array[D+10]=Qa.y;t.array[D+11]=Qa.z}t.offset+=12}else{t.array[D+0]=Aa.x;t.array[D+1]=Aa.y;t.array[D+2]=Aa.z;t.array[D+3]=Aa.w;t.array[D+4]=Ga.x;t.array[D+5]=Ga.y;
-t.array[D+6]=Ga.z;t.array[D+7]=Ga.w;t.array[D+8]=Ia.x;t.array[D+9]=Ia.y;t.array[D+10]=Ia.z;t.array[D+11]=Ia.w;t.array[D+12]=Qa.x;t.array[D+13]=Qa.y;t.array[D+14]=Qa.z;t.array[D+15]=Qa.w;t.offset+=16}}}}if(wb){D=0;for(Z=jb.length;D<Z;D++){Aa=jb[D].vertices[E.a].position;Ga=jb[D].vertices[E.b].position;Ia=jb[D].vertices[E.c].position;Qa=jb[D].vertices[E.d].position;t=Na[D];t[Ra+0]=Aa.x;t[Ra+1]=Aa.y;t[Ra+2]=Aa.z;t[Ra+3]=Ga.x;t[Ra+4]=Ga.y;t[Ra+5]=Ga.z;t[Ra+6]=Ia.x;t[Ra+7]=Ia.y;t[Ra+8]=Ia.z;t[Ra+9]=Qa.x;
-t[Ra+10]=Qa.y;t[Ra+11]=Qa.z}Ra+=12}if(kb.length){D=kb[E.a];Z=kb[E.b];t=kb[E.c];ab=kb[E.d];Q[T]=D.x;Q[T+1]=D.y;Q[T+2]=D.z;Q[T+3]=D.w;Q[T+4]=Z.x;Q[T+5]=Z.y;Q[T+6]=Z.z;Q[T+7]=Z.w;Q[T+8]=t.x;Q[T+9]=t.y;Q[T+10]=t.z;Q[T+11]=t.w;Q[T+12]=ab.x;Q[T+13]=ab.y;Q[T+14]=ab.z;Q[T+15]=ab.w;D=qb[E.a];Z=qb[E.b];t=qb[E.c];ab=qb[E.d];ha[T]=D.x;ha[T+1]=D.y;ha[T+2]=D.z;ha[T+3]=D.w;ha[T+4]=Z.x;ha[T+5]=Z.y;ha[T+6]=Z.z;ha[T+7]=Z.w;ha[T+8]=t.x;ha[T+9]=t.y;ha[T+10]=t.z;ha[T+11]=t.w;ha[T+12]=ab.x;ha[T+13]=ab.y;ha[T+14]=ab.z;
-ha[T+15]=ab.w;D=ob[E.a];Z=ob[E.b];t=ob[E.c];ab=ob[E.d];va[T]=D.x;va[T+1]=D.y;va[T+2]=D.z;va[T+3]=1;va[T+4]=Z.x;va[T+5]=Z.y;va[T+6]=Z.z;va[T+7]=1;va[T+8]=t.x;va[T+9]=t.y;va[T+10]=t.z;va[T+11]=1;va[T+12]=ab.x;va[T+13]=ab.y;va[T+14]=ab.z;va[T+15]=1;D=pb[E.a];Z=pb[E.b];t=pb[E.c];E=pb[E.d];ua[T]=D.x;ua[T+1]=D.y;ua[T+2]=D.z;ua[T+3]=1;ua[T+4]=Z.x;ua[T+5]=Z.y;ua[T+6]=Z.z;ua[T+7]=1;ua[T+8]=t.x;ua[T+9]=t.y;ua[T+10]=t.z;ua[T+11]=1;ua[T+12]=E.x;ua[T+13]=E.y;ua[T+14]=E.z;ua[T+15]=1;T+=16}if(vb&&Ka){if(N.length==
-4&&Ka==THREE.VertexColors){E=N[0];D=N[1];Z=N[2];N=N[3]}else N=Z=D=E=W;ca[La]=E.r;ca[La+1]=E.g;ca[La+2]=E.b;ca[La+3]=D.r;ca[La+4]=D.g;ca[La+5]=D.b;ca[La+6]=Z.r;ca[La+7]=Z.g;ca[La+8]=Z.b;ca[La+9]=N.r;ca[La+10]=N.g;ca[La+11]=N.b;La+=12}if(ub&&Pa.hasTangents){N=U[0];W=U[1];E=U[2];U=U[3];fa[Oa]=N.x;fa[Oa+1]=N.y;fa[Oa+2]=N.z;fa[Oa+3]=N.w;fa[Oa+4]=W.x;fa[Oa+5]=W.y;fa[Oa+6]=W.z;fa[Oa+7]=W.w;fa[Oa+8]=E.x;fa[Oa+9]=E.y;fa[Oa+10]=E.z;fa[Oa+11]=E.w;fa[Oa+12]=U.x;fa[Oa+13]=U.y;fa[Oa+14]=U.z;fa[Oa+15]=U.w;Oa+=16}if(tb&&
-ma)if(I.length==4&&lb)for(U=0;U<4;U++){M=I[U];ta[eb]=M.x;ta[eb+1]=M.y;ta[eb+2]=M.z;eb+=3}else for(U=0;U<4;U++){ta[eb]=M.x;ta[eb+1]=M.y;ta[eb+2]=M.z;eb+=3}if(rb&&Ha!==undefined&&za)for(U=0;U<4;U++){I=Ha[U];Za[gb]=I.u;Za[gb+1]=I.v;gb+=2}if(rb&&db!==undefined&&za)for(U=0;U<4;U++){I=db[U];X[hb]=I.u;X[hb+1]=I.v;hb+=2}if(sb){Ua[Wa]=Ma;Ua[Wa+1]=Ma+1;Ua[Wa+2]=Ma+3;Ua[Wa+3]=Ma+1;Ua[Wa+4]=Ma+2;Ua[Wa+5]=Ma+3;Wa+=6;bb[Ja]=Ma;bb[Ja+1]=Ma+1;bb[Ja+2]=Ma;bb[Ja+3]=Ma+3;bb[Ja+4]=Ma+1;bb[Ja+5]=Ma+2;bb[Ja+6]=Ma+2;bb[Ja+
-7]=Ma+3;Ja+=8;Ma+=4}}}if(mb){L=0;for(H=mb.length;L<H;L++){Ua[Wa]=mb[L].a;Ua[Wa+1]=mb[L].b;Ua[Wa+2]=mb[L].c;Ua[Wa+3]=mb[L].a;Ua[Wa+4]=mb[L].c;Ua[Wa+5]=mb[L].d;Wa+=6}}if(ib){e.bindBuffer(e.ARRAY_BUFFER,x.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,Xa,J)}if(cb)for(fb in cb){t=cb[fb];if(t.needsUpdate){e.bindBuffer(e.ARRAY_BUFFER,t.buffer);e.bufferData(e.ARRAY_BUFFER,t.array,J);t.needsUpdate=!1}}if(wb){D=0;for(Z=jb.length;D<Z;D++){e.bindBuffer(e.ARRAY_BUFFER,x.__webglMorphTargetsBuffers[D]);e.bufferData(e.ARRAY_BUFFER,
-Na[D],J)}}if(vb&&La>0){e.bindBuffer(e.ARRAY_BUFFER,x.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,ca,J)}if(tb){e.bindBuffer(e.ARRAY_BUFFER,x.__webglNormalBuffer);e.bufferData(e.ARRAY_BUFFER,ta,J)}if(ub&&Pa.hasTangents){e.bindBuffer(e.ARRAY_BUFFER,x.__webglTangentBuffer);e.bufferData(e.ARRAY_BUFFER,fa,J)}if(rb&&gb>0){e.bindBuffer(e.ARRAY_BUFFER,x.__webglUVBuffer);e.bufferData(e.ARRAY_BUFFER,Za,J)}if(rb&&hb>0){e.bindBuffer(e.ARRAY_BUFFER,x.__webglUV2Buffer);e.bufferData(e.ARRAY_BUFFER,X,J)}if(sb){e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,
-x.__webglFaceBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,Ua,J);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,x.__webglLineBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,bb,J)}if(T>0){e.bindBuffer(e.ARRAY_BUFFER,x.__webglSkinVertexABuffer);e.bufferData(e.ARRAY_BUFFER,va,J);e.bindBuffer(e.ARRAY_BUFFER,x.__webglSkinVertexBBuffer);e.bufferData(e.ARRAY_BUFFER,ua,J);e.bindBuffer(e.ARRAY_BUFFER,x.__webglSkinIndicesBuffer);e.bufferData(e.ARRAY_BUFFER,ha,J);e.bindBuffer(e.ARRAY_BUFFER,x.__webglSkinWeightsBuffer);e.bufferData(e.ARRAY_BUFFER,
-Q,J)}}}u.__dirtyVertices=!1;u.__dirtyMorphTargets=!1;u.__dirtyElements=!1;u.__dirtyUvs=!1;u.__dirtyNormals=!1;u.__dirtyTangents=!1;u.__dirtyColors=!1}else if(m instanceof THREE.Ribbon){u=m.geometry;if(u.__dirtyVertices||u.__dirtyColors){m=u;C=e.DYNAMIC_DRAW;Ka=m.vertices;x=m.colors;ma=Ka.length;J=x.length;Ha=m.__vertexArray;L=m.__colorArray;db=m.__dirtyColors;if(m.__dirtyVertices){for(H=0;H<ma;H++){za=Ka[H].position;B=H*3;Ha[B]=za.x;Ha[B+1]=za.y;Ha[B+2]=za.z}e.bindBuffer(e.ARRAY_BUFFER,m.__webglVertexBuffer);
-e.bufferData(e.ARRAY_BUFFER,Ha,C)}if(db){for(H=0;H<J;H++){color=x[H];B=H*3;L[B]=color.r;L[B+1]=color.g;L[B+2]=color.b}e.bindBuffer(e.ARRAY_BUFFER,m.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,L,C)}}u.__dirtyVertices=!1;u.__dirtyColors=!1}else if(m instanceof THREE.Line){u=m.geometry;if(u.__dirtyVertices||u.__dirtyColors){m=u;C=e.DYNAMIC_DRAW;Ka=m.vertices;x=m.colors;ma=Ka.length;J=x.length;Ha=m.__vertexArray;L=m.__colorArray;db=m.__dirtyColors;if(m.__dirtyVertices){for(H=0;H<ma;H++){za=Ka[H].position;
-B=H*3;Ha[B]=za.x;Ha[B+1]=za.y;Ha[B+2]=za.z}e.bindBuffer(e.ARRAY_BUFFER,m.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,Ha,C)}if(db){for(H=0;H<J;H++){color=x[H];B=H*3;L[B]=color.r;L[B+1]=color.g;L[B+2]=color.b}e.bindBuffer(e.ARRAY_BUFFER,m.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,L,C)}}u.__dirtyVertices=!1;u.__dirtyColors=!1}else if(m instanceof THREE.ParticleSystem){u=m.geometry;(u.__dirtyVertices||u.__dirtyColors||m.sortParticles)&&c(u,e.DYNAMIC_DRAW,m);u.__dirtyVertices=!1;u.__dirtyColors=
-!1}}function K(m){function C(W){var U=[];u=0;for(x=W.length;u<x;u++)W[u]==undefined?U.push("undefined"):U.push(W[u].id);return U.join("_")}var u,x,B,J,L,H,I,E,M={},N=m.morphTargets!==undefined?m.morphTargets.length:0;m.geometryGroups={};B=0;for(J=m.faces.length;B<J;B++){L=m.faces[B];H=L.materials;I=C(H);M[I]==undefined&&(M[I]={hash:I,counter:0});E=M[I].hash+"_"+M[I].counter;m.geometryGroups[E]==undefined&&(m.geometryGroups[E]={faces:[],materials:H,vertices:0,numMorphTargets:N});L=L instanceof THREE.Face3?
-3:4;if(m.geometryGroups[E].vertices+L>65535){M[I].counter+=1;E=M[I].hash+"_"+M[I].counter;m.geometryGroups[E]==undefined&&(m.geometryGroups[E]={faces:[],materials:H,vertices:0,numMorphTargets:N})}m.geometryGroups[E].faces.push(B);m.geometryGroups[E].vertices+=L}}function V(m,C,u){m.push({buffer:C,object:u,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function z(m){if(m!=ya){switch(m){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)}ya=m}}function O(m,C,u){if((u.width&u.width-1)==0&&(u.height&u.height-1)==0){e.texParameteri(m,e.TEXTURE_WRAP_S,qa(C.wrapS));e.texParameteri(m,e.TEXTURE_WRAP_T,qa(C.wrapT));e.texParameteri(m,e.TEXTURE_MAG_FILTER,qa(C.magFilter));
-e.texParameteri(m,e.TEXTURE_MIN_FILTER,qa(C.minFilter));e.generateMipmap(m)}else{e.texParameteri(m,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE);e.texParameteri(m,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE);e.texParameteri(m,e.TEXTURE_MAG_FILTER,sa(C.magFilter));e.texParameteri(m,e.TEXTURE_MIN_FILTER,sa(C.minFilter))}}function P(m,C){if(m.needsUpdate){if(m.__webglInit){e.bindTexture(e.TEXTURE_2D,m.__webglTexture);e.texSubImage2D(e.TEXTURE_2D,0,0,0,e.RGBA,e.UNSIGNED_BYTE,m.image)}else{m.__webglTexture=e.createTexture();
-e.bindTexture(e.TEXTURE_2D,m.__webglTexture);e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,m.image);m.__webglInit=!0}O(e.TEXTURE_2D,m,m.image);e.bindTexture(e.TEXTURE_2D,null);m.needsUpdate=!1}e.activeTexture(e.TEXTURE0+C);e.bindTexture(e.TEXTURE_2D,m.__webglTexture)}function S(m){if(m&&!m.__webglFramebuffer){if(m.depthBuffer===undefined)m.depthBuffer=!0;if(m.stencilBuffer===undefined)m.stencilBuffer=!0;m.__webglFramebuffer=e.createFramebuffer();m.__webglRenderbuffer=e.createRenderbuffer();
-m.__webglTexture=e.createTexture();e.bindTexture(e.TEXTURE_2D,m.__webglTexture);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,qa(m.wrapS));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,qa(m.wrapT));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,qa(m.magFilter));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,qa(m.minFilter));e.texImage2D(e.TEXTURE_2D,0,qa(m.format),m.width,m.height,0,qa(m.format),qa(m.type),null);e.bindRenderbuffer(e.RENDERBUFFER,m.__webglRenderbuffer);e.bindFramebuffer(e.FRAMEBUFFER,
+C;m++){u=x.materials[m];u.transparent?p(J,u):p(B,u)}}function w(m){var C,u,x,B,J=m.object,M=m.buffer,H=m.opaque,I=m.transparent;I.count=0;m=H.count=0;for(x=J.materials.length;m<x;m++){C=J.materials[m];if(C instanceof THREE.MeshFaceMaterial){C=0;for(u=M.materials.length;C<u;C++)(B=M.materials[C])&&(B.transparent?p(I,B):p(H,B))}else(B=C)&&(B.transparent?p(I,B):p(H,B))}}function y(m,C){return C.z-m.z}function v(m){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 C,u=m.lights.length,x,B=m.lights,J=[],M,H,I,E,N,O=m.__webglShadowVolumes.length;for(C=0;C<u;C++){x=m.lights[C];if(x instanceof THREE.DirectionalLight){J[0]=-x.position.x;J[1]=-x.position.y;J[2]=-x.position.z;for(N=0;N<O;N++){x=m.__webglShadowVolumes[N].object;M=m.__webglShadowVolumes[N].buffer;H=x.materials[0];H.program||Y.initMaterial(H,
+B,undefined,x);H=H.program;I=H.uniforms;E=H.attributes;if(ya!==H){e.useProgram(H);ya=H;e.uniformMatrix4fv(I.projectionMatrix,!1,Sa);e.uniformMatrix4fv(I.viewMatrix,!1,$a);e.uniform3fv(I.directionalLightDirection,J)}x.matrixWorld.flattenToArray(x._objectMatrixArray);e.uniformMatrix4fv(I.objectMatrix,!1,x._objectMatrixArray);e.bindBuffer(e.ARRAY_BUFFER,M.__webglVertexBuffer);e.vertexAttribPointer(E.position,3,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,M.__webglNormalBuffer);e.vertexAttribPointer(E.normal,
+3,e.FLOAT,!1,0,0);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,M.__webglFaceBuffer);e.cullFace(e.FRONT);e.drawElements(e.TRIANGLES,M.__webglFaceCount,e.UNSIGNED_SHORT,0);e.cullFace(e.BACK);e.drawElements(e.TRIANGLES,M.__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);va="";ya=ja.program;e.useProgram(ja.program);e.uniformMatrix4fv(ja.projectionLocation,!1,Sa);e.uniform1f(ja.darknessLocation,
+ja.darkness);e.bindBuffer(e.ARRAY_BUFFER,ja.vertexBuffer);e.vertexAttribPointer(ja.vertexLocation,3,e.FLOAT,!1,0,0);e.enableVertexAttribArray(ja.vertexLocation);e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA);e.blendEquation(e.FUNC_ADD);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,ja.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(m,C){var u,x,B=m.__webglLensFlares.length,J,M,H,I=new THREE.Vector3,E=ka/Ba,N=Ba*0.5,O=ka*0.5,
+W=16/ka,U=[W*E,W],za=[1,1,0],Ka=[1,1],ma=ga.uniforms;u=ga.attributes;e.useProgram(ga.program);ya=ga.program;va="";e.uniform1i(ma.occlusionMap,0);e.uniform1i(ma.map,1);e.bindBuffer(e.ARRAY_BUFFER,ga.vertexBuffer);e.vertexAttribPointer(u.vertex,2,e.FLOAT,!1,16,0);e.vertexAttribPointer(u.uv,2,e.FLOAT,!1,16,8);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,ga.elementBuffer);e.disable(e.CULL_FACE);e.depthMask(!1);e.activeTexture(e.TEXTURE0);e.bindTexture(e.TEXTURE_2D,ga.occlusionTexture);e.activeTexture(e.TEXTURE1);
+for(x=0;x<B;x++){u=m.__webglLensFlares[x].object;I.set(u.matrixWorld.n14,u.matrixWorld.n24,u.matrixWorld.n34);C.matrixWorldInverse.multiplyVector3(I);C.projectionMatrix.multiplyVector3(I);za[0]=I.x;za[1]=I.y;za[2]=I.z;Ka[0]=za[0]*N+N;Ka[1]=za[1]*O+O;if(Ka[0]>0&&Ka[0]<Ba&&Ka[1]>0&&Ka[1]<ka){e.bindTexture(e.TEXTURE_2D,ga.tempTexture);e.copyTexSubImage2D(e.TEXTURE_2D,0,0,0,Ka[0]-8,Ka[1]-8,16,16);e.uniform1i(ma.renderType,0);e.uniform2fv(ma.scale,U);e.uniform3fv(ma.screenPosition,za);e.disable(e.BLEND);
+e.enable(e.DEPTH_TEST);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0);e.bindTexture(e.TEXTURE_2D,ga.occlusionTexture);e.copyTexSubImage2D(e.TEXTURE_2D,0,0,0,Ka[0]-8,Ka[1]-8,16,16);e.uniform1i(ma.renderType,1);e.disable(e.DEPTH_TEST);e.bindTexture(e.TEXTURE_2D,ga.tempTexture);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0);u.positionScreen.x=za[0];u.positionScreen.y=za[1];u.positionScreen.z=za[2];u.customUpdateCallback?u.customUpdateCallback(u):u.updateLensFlares();e.uniform1i(ma.renderType,2);
+e.enable(e.BLEND);J=0;for(M=u.lensFlares.length;J<M;J++){H=u.lensFlares[J];if(H.opacity>0.0010&&H.scale>0.0010){za[0]=H.x;za[1]=H.y;za[2]=H.z;W=H.size*H.scale/ka;U[0]=W*E;U[1]=W;e.uniform3fv(ma.screenPosition,za);e.uniform2fv(ma.scale,U);e.uniform1f(ma.rotation,H.rotation);e.uniform1f(ma.opacity,H.opacity);z(H.blending);P(H.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 F(m,C){m._modelViewMatrix.multiplyToArray(C.matrixWorldInverse,
+m.matrixWorld,m._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(m._modelViewMatrix).transposeIntoArray(m._normalMatrixArray)}function G(m){var C,u,x,B,J;if(m instanceof THREE.Mesh){u=m.geometry;for(C in u.geometryGroups){x=u.geometryGroups[C];J=!1;for(B in x.__webglCustomAttributes)if(x.__webglCustomAttributes[B].needsUpdate){J=!0;break}if(u.__dirtyVertices||u.__dirtyMorphTargets||u.__dirtyElements||u.__dirtyUvs||u.__dirtyNormals||u.__dirtyColors||u.__dirtyTangents||J){J=e.DYNAMIC_DRAW;var M=void 0,
+H=void 0,I=void 0,E=void 0;I=void 0;var N=void 0,O=void 0,W=void 0,U=void 0,za=void 0,Ka=void 0,ma=void 0,Ha=void 0,db=void 0,Aa=void 0,Ga=void 0,Ia=void 0,Qa=void 0;O=void 0;W=void 0;E=void 0;U=void 0;E=void 0;var D=void 0,$=void 0;O=void 0;D=void 0;$=void 0;var t=void 0,ab=void 0;D=void 0;$=void 0;t=void 0;ab=void 0;D=void 0;$=void 0;t=void 0;ab=void 0;D=void 0;$=void 0;t=void 0;E=void 0;U=void 0;N=void 0;I=void 0;I=void 0;D=void 0;$=void 0;t=void 0;var fb=void 0,Ma=0,Va=0,gb=0,hb=0,Wa=0,eb=0,Oa=
+0,Ja=0,La=0,T=0,Ra=0;$=D=0;var Xa=x.__vertexArray,Za=x.__uvArray,X=x.__uv2Array,sa=x.__normalArray,ea=x.__tangentArray,da=x.__colorArray,wa=x.__skinVertexAArray,ua=x.__skinVertexBArray,ha=x.__skinIndexArray,Q=x.__skinWeightArray,Na=x.__morphTargetsArrays,cb=x.__webglCustomAttributes;t=void 0;var Ua=x.__faceArray,bb=x.__lineArray,lb=x.__needsSmoothNormals;Ka=x.__vertexColorType;za=x.__uvType;ma=x.__normalType;var Pa=m.geometry,ib=Pa.__dirtyVertices,sb=Pa.__dirtyElements,rb=Pa.__dirtyUvs,tb=Pa.__dirtyNormals,
+ub=Pa.__dirtyTangents,vb=Pa.__dirtyColors,wb=Pa.__dirtyMorphTargets,nb=Pa.vertices,xb=x.faces,Ab=Pa.faces,yb=Pa.faceVertexUvs[0],zb=Pa.faceVertexUvs[1],ob=Pa.skinVerticesA,pb=Pa.skinVerticesB,qb=Pa.skinIndices,kb=Pa.skinWeights,mb=Pa.edgeFaces,jb=Pa.morphTargets;if(cb)for(fb in cb){cb[fb].offset=0;cb[fb].offsetSrc=0}M=0;for(H=xb.length;M<H;M++){I=xb[M];E=Ab[I];yb&&(Ha=yb[I]);zb&&(db=zb[I]);I=E.vertexNormals;N=E.normal;O=E.vertexColors;W=E.color;U=E.vertexTangents;if(E instanceof THREE.Face3){if(ib){Aa=
+nb[E.a].position;Ga=nb[E.b].position;Ia=nb[E.c].position;Xa[Va]=Aa.x;Xa[Va+1]=Aa.y;Xa[Va+2]=Aa.z;Xa[Va+3]=Ga.x;Xa[Va+4]=Ga.y;Xa[Va+5]=Ga.z;Xa[Va+6]=Ia.x;Xa[Va+7]=Ia.y;Xa[Va+8]=Ia.z;Va+=9}if(cb)for(fb in cb){t=cb[fb];if(t.needsUpdate){D=t.offset;$=t.offsetSrc;if(t.size===1){if(t.boundTo===undefined||t.boundTo==="vertices"){t.array[D+0]=t.value[E.a];t.array[D+1]=t.value[E.b];t.array[D+2]=t.value[E.c]}else if(t.boundTo==="faces"){t.array[D+0]=t.value[$];t.array[D+1]=t.value[$];t.array[D+2]=t.value[$];
+t.offsetSrc++}else if(t.boundTo==="faceVertices"){t.array[D+0]=t.value[$+0];t.array[D+1]=t.value[$+1];t.array[D+2]=t.value[$+2];t.offsetSrc+=3}t.offset+=3}else{if(t.boundTo===undefined||t.boundTo==="vertices"){Aa=t.value[E.a];Ga=t.value[E.b];Ia=t.value[E.c]}else if(t.boundTo==="faces"){Aa=t.value[$];Ga=t.value[$];Ia=t.value[$];t.offsetSrc++}else if(t.boundTo==="faceVertices"){Aa=t.value[$+0];Ga=t.value[$+1];Ia=t.value[$+2];t.offsetSrc+=3}if(t.size===2){t.array[D+0]=Aa.x;t.array[D+1]=Aa.y;t.array[D+
+2]=Ga.x;t.array[D+3]=Ga.y;t.array[D+4]=Ia.x;t.array[D+5]=Ia.y;t.offset+=6}else if(t.size===3){if(t.type==="c"){t.array[D+0]=Aa.r;t.array[D+1]=Aa.g;t.array[D+2]=Aa.b;t.array[D+3]=Ga.r;t.array[D+4]=Ga.g;t.array[D+5]=Ga.b;t.array[D+6]=Ia.r;t.array[D+7]=Ia.g;t.array[D+8]=Ia.b}else{t.array[D+0]=Aa.x;t.array[D+1]=Aa.y;t.array[D+2]=Aa.z;t.array[D+3]=Ga.x;t.array[D+4]=Ga.y;t.array[D+5]=Ga.z;t.array[D+6]=Ia.x;t.array[D+7]=Ia.y;t.array[D+8]=Ia.z}t.offset+=9}else{t.array[D+0]=Aa.x;t.array[D+1]=Aa.y;t.array[D+
+2]=Aa.z;t.array[D+3]=Aa.w;t.array[D+4]=Ga.x;t.array[D+5]=Ga.y;t.array[D+6]=Ga.z;t.array[D+7]=Ga.w;t.array[D+8]=Ia.x;t.array[D+9]=Ia.y;t.array[D+10]=Ia.z;t.array[D+11]=Ia.w;t.offset+=12}}}}if(wb){D=0;for($=jb.length;D<$;D++){Aa=jb[D].vertices[E.a].position;Ga=jb[D].vertices[E.b].position;Ia=jb[D].vertices[E.c].position;t=Na[D];t[Ra+0]=Aa.x;t[Ra+1]=Aa.y;t[Ra+2]=Aa.z;t[Ra+3]=Ga.x;t[Ra+4]=Ga.y;t[Ra+5]=Ga.z;t[Ra+6]=Ia.x;t[Ra+7]=Ia.y;t[Ra+8]=Ia.z}Ra+=9}if(kb.length){D=kb[E.a];$=kb[E.b];t=kb[E.c];Q[T]=D.x;
+Q[T+1]=D.y;Q[T+2]=D.z;Q[T+3]=D.w;Q[T+4]=$.x;Q[T+5]=$.y;Q[T+6]=$.z;Q[T+7]=$.w;Q[T+8]=t.x;Q[T+9]=t.y;Q[T+10]=t.z;Q[T+11]=t.w;D=qb[E.a];$=qb[E.b];t=qb[E.c];ha[T]=D.x;ha[T+1]=D.y;ha[T+2]=D.z;ha[T+3]=D.w;ha[T+4]=$.x;ha[T+5]=$.y;ha[T+6]=$.z;ha[T+7]=$.w;ha[T+8]=t.x;ha[T+9]=t.y;ha[T+10]=t.z;ha[T+11]=t.w;D=ob[E.a];$=ob[E.b];t=ob[E.c];wa[T]=D.x;wa[T+1]=D.y;wa[T+2]=D.z;wa[T+3]=1;wa[T+4]=$.x;wa[T+5]=$.y;wa[T+6]=$.z;wa[T+7]=1;wa[T+8]=t.x;wa[T+9]=t.y;wa[T+10]=t.z;wa[T+11]=1;D=pb[E.a];$=pb[E.b];t=pb[E.c];ua[T]=
+D.x;ua[T+1]=D.y;ua[T+2]=D.z;ua[T+3]=1;ua[T+4]=$.x;ua[T+5]=$.y;ua[T+6]=$.z;ua[T+7]=1;ua[T+8]=t.x;ua[T+9]=t.y;ua[T+10]=t.z;ua[T+11]=1;T+=12}if(vb&&Ka){if(O.length==3&&Ka==THREE.VertexColors){E=O[0];D=O[1];$=O[2]}else $=D=E=W;da[La]=E.r;da[La+1]=E.g;da[La+2]=E.b;da[La+3]=D.r;da[La+4]=D.g;da[La+5]=D.b;da[La+6]=$.r;da[La+7]=$.g;da[La+8]=$.b;La+=9}if(ub&&Pa.hasTangents){O=U[0];W=U[1];E=U[2];ea[Oa]=O.x;ea[Oa+1]=O.y;ea[Oa+2]=O.z;ea[Oa+3]=O.w;ea[Oa+4]=W.x;ea[Oa+5]=W.y;ea[Oa+6]=W.z;ea[Oa+7]=W.w;ea[Oa+8]=E.x;
+ea[Oa+9]=E.y;ea[Oa+10]=E.z;ea[Oa+11]=E.w;Oa+=12}if(tb&&ma)if(I.length==3&&lb)for(U=0;U<3;U++){N=I[U];sa[eb]=N.x;sa[eb+1]=N.y;sa[eb+2]=N.z;eb+=3}else for(U=0;U<3;U++){sa[eb]=N.x;sa[eb+1]=N.y;sa[eb+2]=N.z;eb+=3}if(rb&&Ha!==undefined&&za)for(U=0;U<3;U++){I=Ha[U];Za[gb]=I.u;Za[gb+1]=I.v;gb+=2}if(rb&&db!==undefined&&za)for(U=0;U<3;U++){I=db[U];X[hb]=I.u;X[hb+1]=I.v;hb+=2}if(sb){Ua[Wa]=Ma;Ua[Wa+1]=Ma+1;Ua[Wa+2]=Ma+2;Wa+=3;bb[Ja]=Ma;bb[Ja+1]=Ma+1;bb[Ja+2]=Ma;bb[Ja+3]=Ma+2;bb[Ja+4]=Ma+1;bb[Ja+5]=Ma+2;Ja+=
+6;Ma+=3}}else if(E instanceof THREE.Face4){if(ib){Aa=nb[E.a].position;Ga=nb[E.b].position;Ia=nb[E.c].position;Qa=nb[E.d].position;Xa[Va]=Aa.x;Xa[Va+1]=Aa.y;Xa[Va+2]=Aa.z;Xa[Va+3]=Ga.x;Xa[Va+4]=Ga.y;Xa[Va+5]=Ga.z;Xa[Va+6]=Ia.x;Xa[Va+7]=Ia.y;Xa[Va+8]=Ia.z;Xa[Va+9]=Qa.x;Xa[Va+10]=Qa.y;Xa[Va+11]=Qa.z;Va+=12}if(cb)for(fb in cb){t=cb[fb];if(t.needsUpdate){D=t.offset;$=t.offsetSrc;if(t.size===1){if(t.boundTo===undefined||t.boundTo==="vertices"){t.array[D+0]=t.value[E.a];t.array[D+1]=t.value[E.b];t.array[D+
+2]=t.value[E.c];t.array[D+2]=t.value[E.d]}else if(t.boundTo==="faces"){t.array[D+0]=t.value[$];t.array[D+1]=t.value[$];t.array[D+2]=t.value[$];t.array[D+2]=t.value[$];t.offsetSrc++}else if(t.boundTo==="faceVertices"){t.array[D+0]=t.value[$+0];t.array[D+1]=t.value[$+1];t.array[D+2]=t.value[$+2];t.array[D+2]=t.value[$+3];t.offsetSrc+=4}t.offset+=4}else{if(t.boundTo===undefined||t.boundTo==="vertices"){Aa=t.value[E.a];Ga=t.value[E.b];Ia=t.value[E.c];Qa=t.value[E.d]}else if(t.boundTo==="faces"){Aa=t.value[$];
+Ga=t.value[$];Ia=t.value[$];Qa=t.value[$];t.offsetSrc++}else if(t.boundTo==="faceVertices"){Aa=t.value[$+0];Ga=t.value[$+1];Ia=t.value[$+2];Qa=t.value[$+3];t.offsetSrc+=4}if(t.size===2){t.array[D+0]=Aa.x;t.array[D+1]=Aa.y;t.array[D+2]=Ga.x;t.array[D+3]=Ga.y;t.array[D+4]=Ia.x;t.array[D+5]=Ia.y;t.array[D+6]=Qa.x;t.array[D+7]=Qa.y;t.offset+=8}else if(t.size===3){if(t.type==="c"){t.array[D+0]=Aa.r;t.array[D+1]=Aa.g;t.array[D+2]=Aa.b;t.array[D+3]=Ga.r;t.array[D+4]=Ga.g;t.array[D+5]=Ga.b;t.array[D+6]=Ia.r;
+t.array[D+7]=Ia.g;t.array[D+8]=Ia.b;t.array[D+9]=Qa.r;t.array[D+10]=Qa.g;t.array[D+11]=Qa.b}else{t.array[D+0]=Aa.x;t.array[D+1]=Aa.y;t.array[D+2]=Aa.z;t.array[D+3]=Ga.x;t.array[D+4]=Ga.y;t.array[D+5]=Ga.z;t.array[D+6]=Ia.x;t.array[D+7]=Ia.y;t.array[D+8]=Ia.z;t.array[D+9]=Qa.x;t.array[D+10]=Qa.y;t.array[D+11]=Qa.z}t.offset+=12}else{t.array[D+0]=Aa.x;t.array[D+1]=Aa.y;t.array[D+2]=Aa.z;t.array[D+3]=Aa.w;t.array[D+4]=Ga.x;t.array[D+5]=Ga.y;t.array[D+6]=Ga.z;t.array[D+7]=Ga.w;t.array[D+8]=Ia.x;t.array[D+
+9]=Ia.y;t.array[D+10]=Ia.z;t.array[D+11]=Ia.w;t.array[D+12]=Qa.x;t.array[D+13]=Qa.y;t.array[D+14]=Qa.z;t.array[D+15]=Qa.w;t.offset+=16}}}}if(wb){D=0;for($=jb.length;D<$;D++){Aa=jb[D].vertices[E.a].position;Ga=jb[D].vertices[E.b].position;Ia=jb[D].vertices[E.c].position;Qa=jb[D].vertices[E.d].position;t=Na[D];t[Ra+0]=Aa.x;t[Ra+1]=Aa.y;t[Ra+2]=Aa.z;t[Ra+3]=Ga.x;t[Ra+4]=Ga.y;t[Ra+5]=Ga.z;t[Ra+6]=Ia.x;t[Ra+7]=Ia.y;t[Ra+8]=Ia.z;t[Ra+9]=Qa.x;t[Ra+10]=Qa.y;t[Ra+11]=Qa.z}Ra+=12}if(kb.length){D=kb[E.a];$=
+kb[E.b];t=kb[E.c];ab=kb[E.d];Q[T]=D.x;Q[T+1]=D.y;Q[T+2]=D.z;Q[T+3]=D.w;Q[T+4]=$.x;Q[T+5]=$.y;Q[T+6]=$.z;Q[T+7]=$.w;Q[T+8]=t.x;Q[T+9]=t.y;Q[T+10]=t.z;Q[T+11]=t.w;Q[T+12]=ab.x;Q[T+13]=ab.y;Q[T+14]=ab.z;Q[T+15]=ab.w;D=qb[E.a];$=qb[E.b];t=qb[E.c];ab=qb[E.d];ha[T]=D.x;ha[T+1]=D.y;ha[T+2]=D.z;ha[T+3]=D.w;ha[T+4]=$.x;ha[T+5]=$.y;ha[T+6]=$.z;ha[T+7]=$.w;ha[T+8]=t.x;ha[T+9]=t.y;ha[T+10]=t.z;ha[T+11]=t.w;ha[T+12]=ab.x;ha[T+13]=ab.y;ha[T+14]=ab.z;ha[T+15]=ab.w;D=ob[E.a];$=ob[E.b];t=ob[E.c];ab=ob[E.d];wa[T]=
+D.x;wa[T+1]=D.y;wa[T+2]=D.z;wa[T+3]=1;wa[T+4]=$.x;wa[T+5]=$.y;wa[T+6]=$.z;wa[T+7]=1;wa[T+8]=t.x;wa[T+9]=t.y;wa[T+10]=t.z;wa[T+11]=1;wa[T+12]=ab.x;wa[T+13]=ab.y;wa[T+14]=ab.z;wa[T+15]=1;D=pb[E.a];$=pb[E.b];t=pb[E.c];E=pb[E.d];ua[T]=D.x;ua[T+1]=D.y;ua[T+2]=D.z;ua[T+3]=1;ua[T+4]=$.x;ua[T+5]=$.y;ua[T+6]=$.z;ua[T+7]=1;ua[T+8]=t.x;ua[T+9]=t.y;ua[T+10]=t.z;ua[T+11]=1;ua[T+12]=E.x;ua[T+13]=E.y;ua[T+14]=E.z;ua[T+15]=1;T+=16}if(vb&&Ka){if(O.length==4&&Ka==THREE.VertexColors){E=O[0];D=O[1];$=O[2];O=O[3]}else O=
+$=D=E=W;da[La]=E.r;da[La+1]=E.g;da[La+2]=E.b;da[La+3]=D.r;da[La+4]=D.g;da[La+5]=D.b;da[La+6]=$.r;da[La+7]=$.g;da[La+8]=$.b;da[La+9]=O.r;da[La+10]=O.g;da[La+11]=O.b;La+=12}if(ub&&Pa.hasTangents){O=U[0];W=U[1];E=U[2];U=U[3];ea[Oa]=O.x;ea[Oa+1]=O.y;ea[Oa+2]=O.z;ea[Oa+3]=O.w;ea[Oa+4]=W.x;ea[Oa+5]=W.y;ea[Oa+6]=W.z;ea[Oa+7]=W.w;ea[Oa+8]=E.x;ea[Oa+9]=E.y;ea[Oa+10]=E.z;ea[Oa+11]=E.w;ea[Oa+12]=U.x;ea[Oa+13]=U.y;ea[Oa+14]=U.z;ea[Oa+15]=U.w;Oa+=16}if(tb&&ma)if(I.length==4&&lb)for(U=0;U<4;U++){N=I[U];sa[eb]=
+N.x;sa[eb+1]=N.y;sa[eb+2]=N.z;eb+=3}else for(U=0;U<4;U++){sa[eb]=N.x;sa[eb+1]=N.y;sa[eb+2]=N.z;eb+=3}if(rb&&Ha!==undefined&&za)for(U=0;U<4;U++){I=Ha[U];Za[gb]=I.u;Za[gb+1]=I.v;gb+=2}if(rb&&db!==undefined&&za)for(U=0;U<4;U++){I=db[U];X[hb]=I.u;X[hb+1]=I.v;hb+=2}if(sb){Ua[Wa]=Ma;Ua[Wa+1]=Ma+1;Ua[Wa+2]=Ma+3;Ua[Wa+3]=Ma+1;Ua[Wa+4]=Ma+2;Ua[Wa+5]=Ma+3;Wa+=6;bb[Ja]=Ma;bb[Ja+1]=Ma+1;bb[Ja+2]=Ma;bb[Ja+3]=Ma+3;bb[Ja+4]=Ma+1;bb[Ja+5]=Ma+2;bb[Ja+6]=Ma+2;bb[Ja+7]=Ma+3;Ja+=8;Ma+=4}}}if(mb){M=0;for(H=mb.length;M<
+H;M++){Ua[Wa]=mb[M].a;Ua[Wa+1]=mb[M].b;Ua[Wa+2]=mb[M].c;Ua[Wa+3]=mb[M].a;Ua[Wa+4]=mb[M].c;Ua[Wa+5]=mb[M].d;Wa+=6}}if(ib){e.bindBuffer(e.ARRAY_BUFFER,x.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,Xa,J)}if(cb)for(fb in cb){t=cb[fb];if(t.needsUpdate){e.bindBuffer(e.ARRAY_BUFFER,t.buffer);e.bufferData(e.ARRAY_BUFFER,t.array,J);t.needsUpdate=!1}}if(wb){D=0;for($=jb.length;D<$;D++){e.bindBuffer(e.ARRAY_BUFFER,x.__webglMorphTargetsBuffers[D]);e.bufferData(e.ARRAY_BUFFER,Na[D],J)}}if(vb&&La>0){e.bindBuffer(e.ARRAY_BUFFER,
+x.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,da,J)}if(tb){e.bindBuffer(e.ARRAY_BUFFER,x.__webglNormalBuffer);e.bufferData(e.ARRAY_BUFFER,sa,J)}if(ub&&Pa.hasTangents){e.bindBuffer(e.ARRAY_BUFFER,x.__webglTangentBuffer);e.bufferData(e.ARRAY_BUFFER,ea,J)}if(rb&&gb>0){e.bindBuffer(e.ARRAY_BUFFER,x.__webglUVBuffer);e.bufferData(e.ARRAY_BUFFER,Za,J)}if(rb&&hb>0){e.bindBuffer(e.ARRAY_BUFFER,x.__webglUV2Buffer);e.bufferData(e.ARRAY_BUFFER,X,J)}if(sb){e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,x.__webglFaceBuffer);
+e.bufferData(e.ELEMENT_ARRAY_BUFFER,Ua,J);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,x.__webglLineBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,bb,J)}if(T>0){e.bindBuffer(e.ARRAY_BUFFER,x.__webglSkinVertexABuffer);e.bufferData(e.ARRAY_BUFFER,wa,J);e.bindBuffer(e.ARRAY_BUFFER,x.__webglSkinVertexBBuffer);e.bufferData(e.ARRAY_BUFFER,ua,J);e.bindBuffer(e.ARRAY_BUFFER,x.__webglSkinIndicesBuffer);e.bufferData(e.ARRAY_BUFFER,ha,J);e.bindBuffer(e.ARRAY_BUFFER,x.__webglSkinWeightsBuffer);e.bufferData(e.ARRAY_BUFFER,
+Q,J)}}}u.__dirtyVertices=!1;u.__dirtyMorphTargets=!1;u.__dirtyElements=!1;u.__dirtyUvs=!1;u.__dirtyNormals=!1;u.__dirtyTangents=!1;u.__dirtyColors=!1}else if(m instanceof THREE.Ribbon){u=m.geometry;if(u.__dirtyVertices||u.__dirtyColors){m=u;C=e.DYNAMIC_DRAW;Ka=m.vertices;x=m.colors;ma=Ka.length;J=x.length;Ha=m.__vertexArray;M=m.__colorArray;db=m.__dirtyColors;if(m.__dirtyVertices){for(H=0;H<ma;H++){za=Ka[H].position;B=H*3;Ha[B]=za.x;Ha[B+1]=za.y;Ha[B+2]=za.z}e.bindBuffer(e.ARRAY_BUFFER,m.__webglVertexBuffer);
+e.bufferData(e.ARRAY_BUFFER,Ha,C)}if(db){for(H=0;H<J;H++){color=x[H];B=H*3;M[B]=color.r;M[B+1]=color.g;M[B+2]=color.b}e.bindBuffer(e.ARRAY_BUFFER,m.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,M,C)}}u.__dirtyVertices=!1;u.__dirtyColors=!1}else if(m instanceof THREE.Line){u=m.geometry;if(u.__dirtyVertices||u.__dirtyColors){m=u;C=e.DYNAMIC_DRAW;Ka=m.vertices;x=m.colors;ma=Ka.length;J=x.length;Ha=m.__vertexArray;M=m.__colorArray;db=m.__dirtyColors;if(m.__dirtyVertices){for(H=0;H<ma;H++){za=Ka[H].position;
+B=H*3;Ha[B]=za.x;Ha[B+1]=za.y;Ha[B+2]=za.z}e.bindBuffer(e.ARRAY_BUFFER,m.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,Ha,C)}if(db){for(H=0;H<J;H++){color=x[H];B=H*3;M[B]=color.r;M[B+1]=color.g;M[B+2]=color.b}e.bindBuffer(e.ARRAY_BUFFER,m.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,M,C)}}u.__dirtyVertices=!1;u.__dirtyColors=!1}else if(m instanceof THREE.ParticleSystem){u=m.geometry;(u.__dirtyVertices||u.__dirtyColors||m.sortParticles)&&c(u,e.DYNAMIC_DRAW,m);u.__dirtyVertices=!1;u.__dirtyColors=
+!1}}function L(m){function C(W){var U=[];u=0;for(x=W.length;u<x;u++)W[u]==undefined?U.push("undefined"):U.push(W[u].id);return U.join("_")}var u,x,B,J,M,H,I,E,N={},O=m.morphTargets!==undefined?m.morphTargets.length:0;m.geometryGroups={};B=0;for(J=m.faces.length;B<J;B++){M=m.faces[B];H=M.materials;I=C(H);N[I]==undefined&&(N[I]={hash:I,counter:0});E=N[I].hash+"_"+N[I].counter;m.geometryGroups[E]==undefined&&(m.geometryGroups[E]={faces:[],materials:H,vertices:0,numMorphTargets:O});M=M instanceof THREE.Face3?
+3:4;if(m.geometryGroups[E].vertices+M>65535){N[I].counter+=1;E=N[I].hash+"_"+N[I].counter;m.geometryGroups[E]==undefined&&(m.geometryGroups[E]={faces:[],materials:H,vertices:0,numMorphTargets:O})}m.geometryGroups[E].faces.push(B);m.geometryGroups[E].vertices+=M}}function V(m,C,u){m.push({buffer:C,object:u,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function z(m){if(m!=va){switch(m){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)}va=m}}function K(m,C,u){if((u.width&u.width-1)==0&&(u.height&u.height-1)==0){e.texParameteri(m,e.TEXTURE_WRAP_S,pa(C.wrapS));e.texParameteri(m,e.TEXTURE_WRAP_T,pa(C.wrapT));e.texParameteri(m,e.TEXTURE_MAG_FILTER,pa(C.magFilter));
+e.texParameteri(m,e.TEXTURE_MIN_FILTER,pa(C.minFilter));e.generateMipmap(m)}else{e.texParameteri(m,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE);e.texParameteri(m,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE);e.texParameteri(m,e.TEXTURE_MAG_FILTER,ra(C.magFilter));e.texParameteri(m,e.TEXTURE_MIN_FILTER,ra(C.minFilter))}}function P(m,C){if(m.needsUpdate){if(m.__webglInit){e.bindTexture(e.TEXTURE_2D,m.__webglTexture);e.texSubImage2D(e.TEXTURE_2D,0,0,0,e.RGBA,e.UNSIGNED_BYTE,m.image)}else{m.__webglTexture=e.createTexture();
+e.bindTexture(e.TEXTURE_2D,m.__webglTexture);e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,m.image);m.__webglInit=!0}K(e.TEXTURE_2D,m,m.image);e.bindTexture(e.TEXTURE_2D,null);m.needsUpdate=!1}e.activeTexture(e.TEXTURE0+C);e.bindTexture(e.TEXTURE_2D,m.__webglTexture)}function S(m){if(m&&!m.__webglFramebuffer){if(m.depthBuffer===undefined)m.depthBuffer=!0;if(m.stencilBuffer===undefined)m.stencilBuffer=!0;m.__webglFramebuffer=e.createFramebuffer();m.__webglRenderbuffer=e.createRenderbuffer();
+m.__webglTexture=e.createTexture();e.bindTexture(e.TEXTURE_2D,m.__webglTexture);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,pa(m.wrapS));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,pa(m.wrapT));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,pa(m.magFilter));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,pa(m.minFilter));e.texImage2D(e.TEXTURE_2D,0,pa(m.format),m.width,m.height,0,pa(m.format),pa(m.type),null);e.bindRenderbuffer(e.RENDERBUFFER,m.__webglRenderbuffer);e.bindFramebuffer(e.FRAMEBUFFER,
 m.__webglFramebuffer);e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,m.__webglTexture,0);if(m.depthBuffer&&!m.stencilBuffer){e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_COMPONENT16,m.width,m.height);e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,m.__webglRenderbuffer)}else if(m.depthBuffer&&m.stencilBuffer){e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,m.width,m.height);e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,
-m.__webglRenderbuffer)}else e.renderbufferStorage(e.RENDERBUFFER,e.RGBA4,m.width,m.height);e.bindTexture(e.TEXTURE_2D,null);e.bindRenderbuffer(e.RENDERBUFFER,null);e.bindFramebuffer(e.FRAMEBUFFER,null)}var C,u;if(m){C=m.__webglFramebuffer;u=m.width;m=m.height}else{C=null;u=Ba;m=ka}if(C!=Ea){e.bindFramebuffer(e.FRAMEBUFFER,C);e.viewport(Y,na,u,m);Ea=C}}function wa(m,C){var u;if(m=="fragment")u=e.createShader(e.FRAGMENT_SHADER);else m=="vertex"&&(u=e.createShader(e.VERTEX_SHADER));e.shaderSource(u,
-C);e.compileShader(u);if(!e.getShaderParameter(u,e.COMPILE_STATUS)){console.error(e.getShaderInfoLog(u));console.error(C);return null}return u}function sa(m){switch(m){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return e.NEAREST;default:return e.LINEAR}}function qa(m){switch(m){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;
+m.__webglRenderbuffer)}else e.renderbufferStorage(e.RENDERBUFFER,e.RGBA4,m.width,m.height);e.bindTexture(e.TEXTURE_2D,null);e.bindRenderbuffer(e.RENDERBUFFER,null);e.bindFramebuffer(e.FRAMEBUFFER,null)}var C,u;if(m){C=m.__webglFramebuffer;u=m.width;m=m.height}else{C=null;u=Ba;m=ka}if(C!=Fa){e.bindFramebuffer(e.FRAMEBUFFER,C);e.viewport(Z,na,u,m);Fa=C}}function xa(m,C){var u;if(m=="fragment")u=e.createShader(e.FRAGMENT_SHADER);else m=="vertex"&&(u=e.createShader(e.VERTEX_SHADER));e.shaderSource(u,
+C);e.compileShader(u);if(!e.getShaderParameter(u,e.COMPILE_STATUS)){console.error(e.getShaderInfoLog(u));console.error(C);return null}return u}function ra(m){switch(m){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return e.NEAREST;default:return e.LINEAR}}function pa(m){switch(m){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 e,ga=document.createElement("canvas"),ea=[],xa=null,Ea=null,Fa=!0,ra=this,aa=null,pa=null,ya=null,ja=null,Y=0,na=0,Ba=0,ka=0,la=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,
-new THREE.Vector4,new THREE.Vector4],Da=new THREE.Matrix4,Sa=new Float32Array(16),$a=new Float32Array(16),Ya=new THREE.Vector4,Ta={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},R=!0,$=!0,oa=new THREE.Color(0),Ca=0;if(b){if(b.stencil!=undefined)R=b.stencil;if(b.antialias!==undefined)$=b.antialias;b.clearColor!==undefined&&oa.setHex(b.clearColor);if(b.clearAlpha!==undefined)Ca=b.clearAlpha}this.maxMorphTargets=8;this.domElement=ga;
-this.autoClear=!0;this.sortObjects=!0;(function(m,C,u,x){try{if(!(e=ga.getContext("experimental-webgl",{antialias:m,stencil:x})))throw"Error creating WebGL context.";}catch(B){console.error(B)}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(C.r,C.g,C.b,u)})($,oa,Ca,R);this.context=e;if(R){var ia={};
-ia.vertices=new Float32Array(12);ia.faces=new Uint16Array(6);ia.darkness=0.5;ia.vertices[0]=-20;ia.vertices[1]=-20;ia.vertices[2]=-1;ia.vertices[3]=20;ia.vertices[4]=-20;ia.vertices[5]=-1;ia.vertices[6]=20;ia.vertices[7]=20;ia.vertices[8]=-1;ia.vertices[9]=-20;ia.vertices[10]=20;ia.vertices[11]=-1;ia.faces[0]=0;ia.faces[1]=1;ia.faces[2]=2;ia.faces[3]=0;ia.faces[4]=2;ia.faces[5]=3;ia.vertexBuffer=e.createBuffer();ia.elementBuffer=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,ia.vertexBuffer);e.bufferData(e.ARRAY_BUFFER,
-ia.vertices,e.STATIC_DRAW);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,ia.elementBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,ia.faces,e.STATIC_DRAW);ia.program=e.createProgram();e.attachShader(ia.program,wa("fragment",THREE.ShaderLib.shadowPost.fragmentShader));e.attachShader(ia.program,wa("vertex",THREE.ShaderLib.shadowPost.vertexShader));e.linkProgram(ia.program);ia.vertexLocation=e.getAttribLocation(ia.program,"position");ia.projectionLocation=e.getUniformLocation(ia.program,"projectionMatrix");ia.darknessLocation=
-e.getUniformLocation(ia.program,"darkness")}var da={};da.vertices=new Float32Array(16);da.faces=new Uint16Array(6);da.transparency=0.5;b=0;da.vertices[b++]=-1;da.vertices[b++]=-1;da.vertices[b++]=0;da.vertices[b++]=0;da.vertices[b++]=1;da.vertices[b++]=-1;da.vertices[b++]=1;da.vertices[b++]=0;da.vertices[b++]=1;da.vertices[b++]=1;da.vertices[b++]=1;da.vertices[b++]=1;da.vertices[b++]=-1;da.vertices[b++]=1;da.vertices[b++]=0;da.vertices[b++]=1;b=0;da.faces[b++]=0;da.faces[b++]=1;da.faces[b++]=2;da.faces[b++]=
-0;da.faces[b++]=2;da.faces[b++]=3;da.vertexBuffer=e.createBuffer();da.elementBuffer=e.createBuffer();da.tempTexture=e.createTexture();da.occlusionTexture=e.createTexture();e.bindBuffer(e.ARRAY_BUFFER,da.vertexBuffer);e.bufferData(e.ARRAY_BUFFER,da.vertices,e.STATIC_DRAW);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,da.elementBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,da.faces,e.STATIC_DRAW);e.bindTexture(e.TEXTURE_2D,da.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);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST);e.bindTexture(e.TEXTURE_2D,da.occlusionTexture);e.texImage2D(e.TEXTURE_2D,0,e.RGBA,16,16,0,e.RGBA,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);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,
-e.NEAREST);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST);if(e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0){da.hasVertexTexture=!1;da.program=e.createProgram();e.attachShader(da.program,wa("fragment",THREE.ShaderLib.lensFlare.fragmentShader));e.attachShader(da.program,wa("vertex",THREE.ShaderLib.lensFlare.vertexShader))}else{da.hasVertexTexture=!0;da.program=e.createProgram();e.attachShader(da.program,wa("fragment",THREE.ShaderLib.lensFlareVertexTexture.fragmentShader));e.attachShader(da.program,
-wa("vertex",THREE.ShaderLib.lensFlareVertexTexture.vertexShader))}e.linkProgram(da.program);da.attributes={};da.uniforms={};da.attributes.vertex=e.getAttribLocation(da.program,"position");da.attributes.uv=e.getAttribLocation(da.program,"UV");da.uniforms.renderType=e.getUniformLocation(da.program,"renderType");da.uniforms.map=e.getUniformLocation(da.program,"map");da.uniforms.occlusionMap=e.getUniformLocation(da.program,"occlusionMap");da.uniforms.opacity=e.getUniformLocation(da.program,"opacity");
-da.uniforms.scale=e.getUniformLocation(da.program,"scale");da.uniforms.rotation=e.getUniformLocation(da.program,"rotation");da.uniforms.screenPosition=e.getUniformLocation(da.program,"screenPosition");this.setSize=function(m,C){ga.width=m;ga.height=C;this.setViewport(0,0,ga.width,ga.height)};this.setViewport=function(m,C,u,x){Y=m;na=C;Ba=u;ka=x;e.viewport(Y,na,Ba,ka)};this.setScissor=function(m,C,u,x){e.scissor(m,C,u,x)};this.enableScissorTest=function(m){m?e.enable(e.SCISSOR_TEST):e.disable(e.SCISSOR_TEST)};
-this.enableDepthBufferWrite=function(m){Fa=m;e.depthMask(m)};this.setClearColorHex=function(m,C){var u=new THREE.Color(m);e.clearColor(u.r,u.g,u.b,C)};this.setClearColor=function(m,C){e.clearColor(m.r,m.g,m.b,C)};this.clear=function(){e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT|e.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(m){ia.darkness=m};this.initMaterial=function(m,C,u,x){var B,J,L;if(m instanceof THREE.MeshDepthMaterial)L="depth";else if(m instanceof THREE.ShadowVolumeDynamicMaterial)L=
-"shadowVolumeDynamic";else if(m instanceof THREE.MeshNormalMaterial)L="normal";else if(m instanceof THREE.MeshBasicMaterial)L="basic";else if(m instanceof THREE.MeshLambertMaterial)L="lambert";else if(m instanceof THREE.MeshPhongMaterial)L="phong";else if(m instanceof THREE.LineBasicMaterial)L="basic";else m instanceof THREE.ParticleBasicMaterial&&(L="particle_basic");if(L){var H=THREE.ShaderLib[L];m.uniforms=Uniforms.clone(H.uniforms);m.vertexShader=H.vertexShader;m.fragmentShader=H.fragmentShader}var I,
-E,M;I=M=H=0;for(E=C.length;I<E;I++){J=C[I];J instanceof THREE.DirectionalLight&&M++;J instanceof THREE.PointLight&&H++}if(H+M<=4)C=M;else{C=Math.ceil(4*M/(H+M));H=4-C}J={directional:C,point:H};M=50;if(x!==undefined&&x instanceof THREE.SkinnedMesh)M=x.bones.length;var N;a:{I=m.fragmentShader;E=m.vertexShader;H=m.uniforms;C=m.attributes;u={map:!!m.map,envMap:!!m.envMap,lightMap:!!m.lightMap,vertexColors:m.vertexColors,fog:u,sizeAttenuation:m.sizeAttenuation,skinning:m.skinning,morphTargets:m.morphTargets,
-maxMorphTargets:this.maxMorphTargets,maxDirLights:J.directional,maxPointLights:J.point,maxBones:M};var W;J=[];if(L)J.push(L);else{J.push(I);J.push(E)}for(W in u){J.push(W);J.push(u[W])}L=J.join();W=0;for(J=ea.length;W<J;W++)if(ea[W].code==L){N=ea[W].program;break a}W=e.createProgram();prefix_fragment=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+u.maxDirLights,"#define MAX_POINT_LIGHTS "+u.maxPointLights,u.fog?"#define USE_FOG":"",u.fog instanceof THREE.FogExp2?"#define FOG_EXP2":
-"",u.map?"#define USE_MAP":"",u.envMap?"#define USE_ENVMAP":"",u.lightMap?"#define USE_LIGHTMAP":"",u.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");prefix_vertex=[e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+u.maxDirLights,"#define MAX_POINT_LIGHTS "+u.maxPointLights,"#define MAX_BONES "+u.maxBones,u.map?"#define USE_MAP":"",u.envMap?"#define USE_ENVMAP":"",u.lightMap?"#define USE_LIGHTMAP":
-"",u.vertexColors?"#define USE_COLOR":"",u.skinning?"#define USE_SKINNING":"",u.morphTargets?"#define USE_MORPHTARGETS":"",u.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
-e.attachShader(W,wa("fragment",prefix_fragment+I));e.attachShader(W,wa("vertex",prefix_vertex+E));e.linkProgram(W);e.getProgramParameter(W,e.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+e.getProgramParameter(W,e.VALIDATE_STATUS)+", gl error ["+e.getError()+"]");W.uniforms={};W.attributes={};var U;I=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(U in H)I.push(U);
-U=I;H=0;for(I=U.length;H<I;H++){E=U[H];W.uniforms[E]=e.getUniformLocation(W,E)}I=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(U=0;U<u.maxMorphTargets;U++)I.push("morphTarget"+U);for(N in C)I.push(N);N=I;U=0;for(C=N.length;U<C;U++){u=N[U];W.attributes[u]=e.getAttribLocation(W,u)}ea.push({program:W,code:L});N=W}m.program=N;N=m.program.attributes;e.enableVertexAttribArray(N.position);N.color>=0&&e.enableVertexAttribArray(N.color);N.normal>=
-0&&e.enableVertexAttribArray(N.normal);N.tangent>=0&&e.enableVertexAttribArray(N.tangent);if(m.skinning&&N.skinVertexA>=0&&N.skinVertexB>=0&&N.skinIndex>=0&&N.skinWeight>=0){e.enableVertexAttribArray(N.skinVertexA);e.enableVertexAttribArray(N.skinVertexB);e.enableVertexAttribArray(N.skinIndex);e.enableVertexAttribArray(N.skinWeight)}for(B in m.attributes)N[B]>=0&&e.enableVertexAttribArray(N[B]);if(m.morphTargets){m.numSupportedMorphTargets=0;if(N.morphTarget0>=0){e.enableVertexAttribArray(N.morphTarget0);
-m.numSupportedMorphTargets++}if(N.morphTarget1>=0){e.enableVertexAttribArray(N.morphTarget1);m.numSupportedMorphTargets++}if(N.morphTarget2>=0){e.enableVertexAttribArray(N.morphTarget2);m.numSupportedMorphTargets++}if(N.morphTarget3>=0){e.enableVertexAttribArray(N.morphTarget3);m.numSupportedMorphTargets++}if(N.morphTarget4>=0){e.enableVertexAttribArray(N.morphTarget4);m.numSupportedMorphTargets++}if(N.morphTarget5>=0){e.enableVertexAttribArray(N.morphTarget5);m.numSupportedMorphTargets++}if(N.morphTarget6>=
-0){e.enableVertexAttribArray(N.morphTarget6);m.numSupportedMorphTargets++}if(N.morphTarget7>=0){e.enableVertexAttribArray(N.morphTarget7);m.numSupportedMorphTargets++}x.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);m=0;for(B=this.maxMorphTargets;m<B;m++)x.__webglMorphTargetInfluences[m]=0}};this.render=function(m,C,u,x){var B,J,L,H,I,E,M,N,W=m.lights,U=m.fog;C.matrixAutoUpdate&&C.updateMatrix();m.update(undefined,!1,C);C.matrixWorldInverse.flattenToArray($a);C.projectionMatrix.flattenToArray(Sa);
-Da.multiply(C.projectionMatrix,C.matrixWorldInverse);k(Da);this.initWebGLObjects(m);S(u);(this.autoClear||x)&&this.clear();I=m.__webglObjects.length;for(x=0;x<I;x++){B=m.__webglObjects[x];M=B.object;if(M.visible)if(!(M instanceof THREE.Mesh)||n(M)){M.matrixWorld.flattenToArray(M._objectMatrixArray);F(M,C);w(B);B.render=!0;if(this.sortObjects){Ya.copy(M.position);Da.multiplyVector3(Ya);B.z=Ya.z}}else B.render=!1;else B.render=!1}this.sortObjects&&m.__webglObjects.sort(y);E=m.__webglObjectsImmediate.length;
-for(x=0;x<E;x++){B=m.__webglObjectsImmediate[x];M=B.object;if(M.visible){M.matrixAutoUpdate&&M.matrixWorld.flattenToArray(M._objectMatrixArray);F(M,C);o(B)}}z(THREE.NormalBlending);for(x=0;x<I;x++){B=m.__webglObjects[x];if(B.render){M=B.object;N=B.buffer;L=B.opaque;h(M);for(B=0;B<L.count;B++){H=L.list[B];j(H.depthTest);f(C,W,U,H,N,M)}}}for(x=0;x<E;x++){B=m.__webglObjectsImmediate[x];M=B.object;if(M.visible){L=B.opaque;h(M);for(B=0;B<L.count;B++){H=L.list[B];j(H.depthTest);J=d(C,W,U,H,M);M.render(function(za){g(za,
-J,H.shading)})}}}for(x=0;x<I;x++){B=m.__webglObjects[x];if(B.render){M=B.object;N=B.buffer;L=B.transparent;h(M);for(B=0;B<L.count;B++){H=L.list[B];z(H.blending);j(H.depthTest);f(C,W,U,H,N,M)}}}for(x=0;x<E;x++){B=m.__webglObjectsImmediate[x];M=B.object;if(M.visible){L=B.transparent;h(M);for(B=0;B<L.count;B++){H=L.list[B];z(H.blending);j(H.depthTest);J=d(C,W,U,H,M);M.render(function(za){g(za,J,H.shading)})}}}R&&m.__webglShadowVolumes.length&&m.lights.length&&v(m);m.__webglLensFlares.length&&A(m,C);
-if(u&&u.minFilter!==THREE.NearestFilter&&u.minFilter!==THREE.LinearFilter){e.bindTexture(e.TEXTURE_2D,u.__webglTexture);e.generateMipmap(e.TEXTURE_2D);e.bindTexture(e.TEXTURE_2D,null)}};this.initWebGLObjects=function(m){if(!m.__webglObjects){m.__webglObjects=[];m.__webglObjectsImmediate=[];m.__webglShadowVolumes=[];m.__webglLensFlares=[]}for(;m.__objectsAdded.length;){var C=m.__objectsAdded[0],u=m,x=void 0,B=void 0,J=void 0;if(C._modelViewMatrix==undefined){C._modelViewMatrix=new THREE.Matrix4;C._normalMatrixArray=
-new Float32Array(9);C._modelViewMatrixArray=new Float32Array(16);C._objectMatrixArray=new Float32Array(16);C.matrixWorld.flattenToArray(C._objectMatrixArray)}if(C instanceof THREE.Mesh){B=C.geometry;B.geometryGroups==undefined&&K(B);for(x in B.geometryGroups){J=B.geometryGroups[x];if(!J.__webglVertexBuffer){var L=J;L.__webglVertexBuffer=e.createBuffer();L.__webglNormalBuffer=e.createBuffer();L.__webglTangentBuffer=e.createBuffer();L.__webglColorBuffer=e.createBuffer();L.__webglUVBuffer=e.createBuffer();
-L.__webglUV2Buffer=e.createBuffer();L.__webglSkinVertexABuffer=e.createBuffer();L.__webglSkinVertexBBuffer=e.createBuffer();L.__webglSkinIndicesBuffer=e.createBuffer();L.__webglSkinWeightsBuffer=e.createBuffer();L.__webglFaceBuffer=e.createBuffer();L.__webglLineBuffer=e.createBuffer();if(L.numMorphTargets){var H=void 0,I=void 0;L.__webglMorphTargetsBuffers=[];H=0;for(I=L.numMorphTargets;H<I;H++)L.__webglMorphTargetsBuffers.push(e.createBuffer())}L=J;H=C;var E=void 0,M=void 0,N=void 0;N=void 0;var W=
-void 0,U=void 0,za=void 0,Ka=za=I=0;M=void 0;N=void 0;var ma=void 0;E=void 0;M=void 0;W=H.geometry;ma=W.faces;U=L.faces;E=0;for(M=U.length;E<M;E++){N=U[E];N=ma[N];if(N instanceof THREE.Face3){I+=3;za+=1;Ka+=3}else if(N instanceof THREE.Face4){I+=4;za+=2;Ka+=4}}E=L;M=H;ma=void 0;U=void 0;var Ha=void 0,db=void 0;Ha=void 0;N=[];ma=0;for(U=M.materials.length;ma<U;ma++){Ha=M.materials[ma];if(Ha instanceof THREE.MeshFaceMaterial){Ha=0;for(l=E.materials.length;Ha<l;Ha++)(db=E.materials[Ha])&&N.push(db)}else(db=
-Ha)&&N.push(db)}E=N;a:{M=void 0;ma=void 0;U=E.length;for(M=0;M<U;M++){ma=E[M];if(ma.map||ma.lightMap||ma instanceof THREE.MeshShaderMaterial){M=!0;break a}}M=!1}a:{ma=E;U=void 0;N=void 0;Ha=ma.length;for(U=0;U<Ha;U++){N=ma[U];if(!(N instanceof THREE.MeshBasicMaterial&&!N.envMap||N instanceof THREE.MeshDepthMaterial)){ma=N&&N.shading!=undefined&&N.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}}ma=!1}a:{U=void 0;N=void 0;Ha=E.length;for(U=0;U<Ha;U++){N=E[U];if(N.vertexColors){N=
-N.vertexColors;break a}}N=!1}L.__vertexArray=new Float32Array(I*3);if(ma)L.__normalArray=new Float32Array(I*3);if(W.hasTangents)L.__tangentArray=new Float32Array(I*4);if(N)L.__colorArray=new Float32Array(I*3);if(M){if(W.faceUvs.length>0||W.faceVertexUvs.length>0)L.__uvArray=new Float32Array(I*2);if(W.faceUvs.length>1||W.faceVertexUvs.length>1)L.__uv2Array=new Float32Array(I*2)}if(H.geometry.skinWeights.length&&H.geometry.skinIndices.length){L.__skinVertexAArray=new Float32Array(I*4);L.__skinVertexBArray=
-new Float32Array(I*4);L.__skinIndexArray=new Float32Array(I*4);L.__skinWeightArray=new Float32Array(I*4)}L.__faceArray=new Uint16Array(za*3+(H.geometry.edgeFaces?H.geometry.edgeFaces.length*6:0));L.__lineArray=new Uint16Array(Ka*2);if(L.numMorphTargets){L.__morphTargetsArrays=[];W=0;for(U=L.numMorphTargets;W<U;W++)L.__morphTargetsArrays.push(new Float32Array(I*3))}L.__needsSmoothNormals=ma==THREE.SmoothShading;L.__uvType=M;L.__vertexColorType=N;L.__normalType=ma;L.__webglFaceCount=za*3+(H.geometry.edgeFaces?
-H.geometry.edgeFaces.length*6:0);L.__webglLineCount=Ka*2;W=0;for(U=E.length;W<U;W++)if(E[W].attributes){L.__webglCustomAttributes={};for(a in E[W].attributes){M=E[W].attributes[a];za=1;if(M.type==="v2")za=2;else if(M.type==="v3")za=3;else if(M.type==="v4")za=4;else M.type==="c"&&(za=3);M.size=za;M.needsUpdate=!0;M.array=new Float32Array(I*za);M.buffer=e.createBuffer();L.__webglCustomAttributes[a]=M}}B.__dirtyVertices=!0;B.__dirtyMorphTargets=!0;B.__dirtyElements=!0;B.__dirtyUvs=!0;B.__dirtyNormals=
-!0;B.__dirtyTangents=!0;B.__dirtyColors=!0}C instanceof THREE.ShadowVolume?V(u.__webglShadowVolumes,J,C):V(u.__webglObjects,J,C)}}else if(C instanceof THREE.LensFlare)V(u.__webglLensFlares,undefined,C);else if(C instanceof THREE.Ribbon){B=C.geometry;if(!B.__webglVertexBuffer){x=B;x.__webglVertexBuffer=e.createBuffer();x.__webglColorBuffer=e.createBuffer();x=B;J=x.vertices.length;x.__vertexArray=new Float32Array(J*3);x.__colorArray=new Float32Array(J*3);x.__webglVertexCount=J;B.__dirtyVertices=!0;
-B.__dirtyColors=!0}V(u.__webglObjects,B,C)}else if(C instanceof THREE.Line){B=C.geometry;if(!B.__webglVertexBuffer){x=B;x.__webglVertexBuffer=e.createBuffer();x.__webglColorBuffer=e.createBuffer();x=B;J=x.vertices.length;x.__vertexArray=new Float32Array(J*3);x.__colorArray=new Float32Array(J*3);x.__webglLineCount=J;B.__dirtyVertices=!0;B.__dirtyColors=!0}V(u.__webglObjects,B,C)}else if(C instanceof THREE.ParticleSystem){B=C.geometry;if(!B.__webglVertexBuffer){x=B;x.__webglVertexBuffer=e.createBuffer();
-x.__webglColorBuffer=e.createBuffer();x=B;J=x.vertices.length;x.__vertexArray=new Float32Array(J*3);x.__colorArray=new Float32Array(J*3);x.__sortArray=[];x.__webglParticleCount=J;B.__dirtyVertices=!0;B.__dirtyColors=!0}V(u.__webglObjects,B,C)}else THREE.MarchingCubes!==undefined&&C instanceof THREE.MarchingCubes&&u.__webglObjectsImmediate.push({object:C,opaque:{list:[],count:0},transparent:{list:[],count:0}});m.__objectsAdded.splice(0,1)}for(;m.__objectsRemoved.length;){C=m.__objectsRemoved[0];u=
-m;B=void 0;x=void 0;for(B=u.__webglObjects.length-1;B>=0;B--){x=u.__webglObjects[B].object;C==x&&u.__webglObjects.splice(B,1)}m.__objectsRemoved.splice(0,1)}C=0;for(u=m.__webglObjects.length;C<u;C++)G(m.__webglObjects[C].object,m);C=0;for(u=m.__webglShadowVolumes.length;C<u;C++)G(m.__webglShadowVolumes[C].object,m);C=0;for(u=m.__webglLensFlares.length;C<u;C++)G(m.__webglLensFlares[C].object,m)};this.setFaceCulling=function(m,C){if(m){!C||C=="ccw"?e.frontFace(e.CCW):e.frontFace(e.CW);if(m=="back")e.cullFace(e.BACK);
-else m=="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}};
+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 e,fa=document.createElement("canvas"),ca=[],ya=null,Fa=null,Ea=!0,Y=this,qa=null,ta=null,va=null,ia=null,Z=0,na=0,Ba=0,ka=0,la=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,
+new THREE.Vector4,new THREE.Vector4],Da=new THREE.Matrix4,Sa=new Float32Array(16),$a=new Float32Array(16),Ya=new THREE.Vector4,Ta={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},R=!0,aa=!0,oa=new THREE.Color(0),Ca=0;if(b){if(b.stencil!=undefined)R=b.stencil;if(b.antialias!==undefined)aa=b.antialias;b.clearColor!==undefined&&oa.setHex(b.clearColor);if(b.clearAlpha!==undefined)Ca=b.clearAlpha}this.maxMorphTargets=8;this.domElement=
+fa;this.autoClear=!0;this.sortObjects=!0;(function(m,C,u,x){try{if(!(e=fa.getContext("experimental-webgl",{antialias:m,stencil:x})))throw"Error creating WebGL context.";}catch(B){console.error(B)}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(C.r,C.g,C.b,u)})(aa,oa,Ca,R);this.context=e;if(R){var ja=
+{};ja.vertices=new Float32Array(12);ja.faces=new Uint16Array(6);ja.darkness=0.5;ja.vertices[0]=-20;ja.vertices[1]=-20;ja.vertices[2]=-1;ja.vertices[3]=20;ja.vertices[4]=-20;ja.vertices[5]=-1;ja.vertices[6]=20;ja.vertices[7]=20;ja.vertices[8]=-1;ja.vertices[9]=-20;ja.vertices[10]=20;ja.vertices[11]=-1;ja.faces[0]=0;ja.faces[1]=1;ja.faces[2]=2;ja.faces[3]=0;ja.faces[4]=2;ja.faces[5]=3;ja.vertexBuffer=e.createBuffer();ja.elementBuffer=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,ja.vertexBuffer);e.bufferData(e.ARRAY_BUFFER,
+ja.vertices,e.STATIC_DRAW);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,ja.elementBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,ja.faces,e.STATIC_DRAW);ja.program=e.createProgram();e.attachShader(ja.program,xa("fragment",THREE.ShaderLib.shadowPost.fragmentShader));e.attachShader(ja.program,xa("vertex",THREE.ShaderLib.shadowPost.vertexShader));e.linkProgram(ja.program);ja.vertexLocation=e.getAttribLocation(ja.program,"position");ja.projectionLocation=e.getUniformLocation(ja.program,"projectionMatrix");ja.darknessLocation=
+e.getUniformLocation(ja.program,"darkness")}var ga={};ga.vertices=new Float32Array(16);ga.faces=new Uint16Array(6);b=0;ga.vertices[b++]=-1;ga.vertices[b++]=-1;ga.vertices[b++]=0;ga.vertices[b++]=0;ga.vertices[b++]=1;ga.vertices[b++]=-1;ga.vertices[b++]=1;ga.vertices[b++]=0;ga.vertices[b++]=1;ga.vertices[b++]=1;ga.vertices[b++]=1;ga.vertices[b++]=1;ga.vertices[b++]=-1;ga.vertices[b++]=1;ga.vertices[b++]=0;ga.vertices[b++]=1;b=0;ga.faces[b++]=0;ga.faces[b++]=1;ga.faces[b++]=2;ga.faces[b++]=0;ga.faces[b++]=
+2;ga.faces[b++]=3;ga.vertexBuffer=e.createBuffer();ga.elementBuffer=e.createBuffer();ga.tempTexture=e.createTexture();ga.occlusionTexture=e.createTexture();e.bindBuffer(e.ARRAY_BUFFER,ga.vertexBuffer);e.bufferData(e.ARRAY_BUFFER,ga.vertices,e.STATIC_DRAW);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,ga.elementBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,ga.faces,e.STATIC_DRAW);e.bindTexture(e.TEXTURE_2D,ga.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);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST);e.bindTexture(e.TEXTURE_2D,ga.occlusionTexture);e.texImage2D(e.TEXTURE_2D,0,e.RGBA,16,16,0,e.RGBA,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);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,
+e.NEAREST);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST);if(e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0){ga.hasVertexTexture=!1;ga.program=e.createProgram();e.attachShader(ga.program,xa("fragment",THREE.ShaderLib.lensFlare.fragmentShader));e.attachShader(ga.program,xa("vertex",THREE.ShaderLib.lensFlare.vertexShader))}else{ga.hasVertexTexture=!0;ga.program=e.createProgram();e.attachShader(ga.program,xa("fragment",THREE.ShaderLib.lensFlareVertexTexture.fragmentShader));e.attachShader(ga.program,
+xa("vertex",THREE.ShaderLib.lensFlareVertexTexture.vertexShader))}e.linkProgram(ga.program);ga.attributes={};ga.uniforms={};ga.attributes.vertex=e.getAttribLocation(ga.program,"position");ga.attributes.uv=e.getAttribLocation(ga.program,"UV");ga.uniforms.renderType=e.getUniformLocation(ga.program,"renderType");ga.uniforms.map=e.getUniformLocation(ga.program,"map");ga.uniforms.occlusionMap=e.getUniformLocation(ga.program,"occlusionMap");ga.uniforms.opacity=e.getUniformLocation(ga.program,"opacity");
+ga.uniforms.scale=e.getUniformLocation(ga.program,"scale");ga.uniforms.rotation=e.getUniformLocation(ga.program,"rotation");ga.uniforms.screenPosition=e.getUniformLocation(ga.program,"screenPosition");_sprite={};_sprite.vertices=new Float32Array(16);_sprite.faces=new Uint16Array(6);b=0;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=0;_sprite.vertices[b++]=0;_sprite.vertices[b++]=1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=0;_sprite.vertices[b++]=
+1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=0;_sprite.vertices[b++]=1;b=0;_sprite.faces[b++]=0;_sprite.faces[b++]=1;_sprite.faces[b++]=2;_sprite.faces[b++]=0;_sprite.faces[b++]=2;_sprite.faces[b++]=3;_sprite.vertexBuffer=e.createBuffer();_sprite.elementBuffer=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,_sprite.vertexBuffer);e.bufferData(e.ARRAY_BUFFER,_sprite.vertices,e.STATIC_DRAW);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,
+_sprite.elementBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,_sprite.faces,e.STATIC_DRAW);_sprite.program=e.createProgram();e.attachShader(_sprite.program,xa("fragment",THREE.ShaderLib.sprite.fragmentShader));e.attachShader(_sprite.program,xa("vertex",THREE.ShaderLib.sprite.vertexShader));e.linkProgram(_sprite.program);_sprite.attributes={};_sprite.uniforms={};_sprite.attributes.vertex=e.getAttribLocation(_sprite.program,"position");_sprite.attributes.uv=e.getAttribLocation(_sprite.program,"UV");_sprite.uniforms.map=
+e.getUniformLocation(_sprite.program,"map");_sprite.uniforms.opacity=e.getUniformLocation(_sprite.program,"opacity");_sprite.uniforms.scale=e.getUniformLocation(_sprite.program,"scale");_sprite.uniforms.rotation=e.getUniformLocation(_sprite.program,"rotation");_sprite.uniforms.screenPosition=e.getUniformLocation(_sprite.program,"screenPosition");this.setSize=function(m,C){fa.width=m;fa.height=C;this.setViewport(0,0,fa.width,fa.height)};this.setViewport=function(m,C,u,x){Z=m;na=C;Ba=u;ka=x;e.viewport(Z,
+na,Ba,ka)};this.setScissor=function(m,C,u,x){e.scissor(m,C,u,x)};this.enableScissorTest=function(m){m?e.enable(e.SCISSOR_TEST):e.disable(e.SCISSOR_TEST)};this.enableDepthBufferWrite=function(m){Ea=m;e.depthMask(m)};this.setClearColorHex=function(m,C){var u=new THREE.Color(m);e.clearColor(u.r,u.g,u.b,C)};this.setClearColor=function(m,C){e.clearColor(m.r,m.g,m.b,C)};this.clear=function(){e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT|e.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(m){ja.darkness=
+m};this.initMaterial=function(m,C,u,x){var B,J,M;if(m instanceof THREE.MeshDepthMaterial)M="depth";else if(m instanceof THREE.ShadowVolumeDynamicMaterial)M="shadowVolumeDynamic";else if(m instanceof THREE.MeshNormalMaterial)M="normal";else if(m instanceof THREE.MeshBasicMaterial)M="basic";else if(m instanceof THREE.MeshLambertMaterial)M="lambert";else if(m instanceof THREE.MeshPhongMaterial)M="phong";else if(m instanceof THREE.LineBasicMaterial)M="basic";else m instanceof THREE.ParticleBasicMaterial&&
+(M="particle_basic");if(M){var H=THREE.ShaderLib[M];m.uniforms=Uniforms.clone(H.uniforms);m.vertexShader=H.vertexShader;m.fragmentShader=H.fragmentShader}var I,E,N;I=N=H=0;for(E=C.length;I<E;I++){J=C[I];J instanceof THREE.DirectionalLight&&N++;J instanceof THREE.PointLight&&H++}if(H+N<=4)C=N;else{C=Math.ceil(4*N/(H+N));H=4-C}J={directional:C,point:H};N=50;if(x!==undefined&&x instanceof THREE.SkinnedMesh)N=x.bones.length;var O;a:{I=m.fragmentShader;E=m.vertexShader;H=m.uniforms;C=m.attributes;u={map:!!m.map,
+envMap:!!m.envMap,lightMap:!!m.lightMap,vertexColors:m.vertexColors,fog:u,sizeAttenuation:m.sizeAttenuation,skinning:m.skinning,morphTargets:m.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:J.directional,maxPointLights:J.point,maxBones:N};var W;J=[];if(M)J.push(M);else{J.push(I);J.push(E)}for(W in u){J.push(W);J.push(u[W])}M=J.join();W=0;for(J=ca.length;W<J;W++)if(ca[W].code==M){O=ca[W].program;break a}W=e.createProgram();prefix_fragment=["#ifdef GL_ES\nprecision highp float;\n#endif",
+"#define MAX_DIR_LIGHTS "+u.maxDirLights,"#define MAX_POINT_LIGHTS "+u.maxPointLights,u.fog?"#define USE_FOG":"",u.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",u.map?"#define USE_MAP":"",u.envMap?"#define USE_ENVMAP":"",u.lightMap?"#define USE_LIGHTMAP":"",u.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");prefix_vertex=[e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+u.maxDirLights,
+"#define MAX_POINT_LIGHTS "+u.maxPointLights,"#define MAX_BONES "+u.maxBones,u.map?"#define USE_MAP":"",u.envMap?"#define USE_ENVMAP":"",u.lightMap?"#define USE_LIGHTMAP":"",u.vertexColors?"#define USE_COLOR":"",u.skinning?"#define USE_SKINNING":"",u.morphTargets?"#define USE_MORPHTARGETS":"",u.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
+e.attachShader(W,xa("fragment",prefix_fragment+I));e.attachShader(W,xa("vertex",prefix_vertex+E));e.linkProgram(W);e.getProgramParameter(W,e.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+e.getProgramParameter(W,e.VALIDATE_STATUS)+", gl error ["+e.getError()+"]");W.uniforms={};W.attributes={};var U;I=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(U in H)I.push(U);
+U=I;H=0;for(I=U.length;H<I;H++){E=U[H];W.uniforms[E]=e.getUniformLocation(W,E)}I=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(U=0;U<u.maxMorphTargets;U++)I.push("morphTarget"+U);for(O in C)I.push(O);O=I;U=0;for(C=O.length;U<C;U++){u=O[U];W.attributes[u]=e.getAttribLocation(W,u)}ca.push({program:W,code:M});O=W}m.program=O;O=m.program.attributes;e.enableVertexAttribArray(O.position);O.color>=0&&e.enableVertexAttribArray(O.color);O.normal>=
+0&&e.enableVertexAttribArray(O.normal);O.tangent>=0&&e.enableVertexAttribArray(O.tangent);if(m.skinning&&O.skinVertexA>=0&&O.skinVertexB>=0&&O.skinIndex>=0&&O.skinWeight>=0){e.enableVertexAttribArray(O.skinVertexA);e.enableVertexAttribArray(O.skinVertexB);e.enableVertexAttribArray(O.skinIndex);e.enableVertexAttribArray(O.skinWeight)}for(B in m.attributes)O[B]>=0&&e.enableVertexAttribArray(O[B]);if(m.morphTargets){m.numSupportedMorphTargets=0;if(O.morphTarget0>=0){e.enableVertexAttribArray(O.morphTarget0);
+m.numSupportedMorphTargets++}if(O.morphTarget1>=0){e.enableVertexAttribArray(O.morphTarget1);m.numSupportedMorphTargets++}if(O.morphTarget2>=0){e.enableVertexAttribArray(O.morphTarget2);m.numSupportedMorphTargets++}if(O.morphTarget3>=0){e.enableVertexAttribArray(O.morphTarget3);m.numSupportedMorphTargets++}if(O.morphTarget4>=0){e.enableVertexAttribArray(O.morphTarget4);m.numSupportedMorphTargets++}if(O.morphTarget5>=0){e.enableVertexAttribArray(O.morphTarget5);m.numSupportedMorphTargets++}if(O.morphTarget6>=
+0){e.enableVertexAttribArray(O.morphTarget6);m.numSupportedMorphTargets++}if(O.morphTarget7>=0){e.enableVertexAttribArray(O.morphTarget7);m.numSupportedMorphTargets++}x.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);m=0;for(B=this.maxMorphTargets;m<B;m++)x.__webglMorphTargetInfluences[m]=0}};this.render=function(m,C,u,x){var B,J,M,H,I,E,N,O,W=m.lights,U=m.fog;C.matrixAutoUpdate&&C.updateMatrix();m.update(undefined,!1,C);C.matrixWorldInverse.flattenToArray($a);C.projectionMatrix.flattenToArray(Sa);
+Da.multiply(C.projectionMatrix,C.matrixWorldInverse);k(Da);this.initWebGLObjects(m);S(u);(this.autoClear||x)&&this.clear();I=m.__webglObjects.length;for(x=0;x<I;x++){B=m.__webglObjects[x];N=B.object;if(N.visible)if(!(N instanceof THREE.Mesh)||n(N)){N.matrixWorld.flattenToArray(N._objectMatrixArray);F(N,C);w(B);B.render=!0;if(this.sortObjects){Ya.copy(N.position);Da.multiplyVector3(Ya);B.z=Ya.z}}else B.render=!1;else B.render=!1}this.sortObjects&&m.__webglObjects.sort(y);E=m.__webglObjectsImmediate.length;
+for(x=0;x<E;x++){B=m.__webglObjectsImmediate[x];N=B.object;if(N.visible){N.matrixAutoUpdate&&N.matrixWorld.flattenToArray(N._objectMatrixArray);F(N,C);o(B)}}z(THREE.NormalBlending);for(x=0;x<I;x++){B=m.__webglObjects[x];if(B.render){N=B.object;O=B.buffer;M=B.opaque;h(N);for(B=0;B<M.count;B++){H=M.list[B];j(H.depthTest);f(C,W,U,H,O,N)}}}for(x=0;x<E;x++){B=m.__webglObjectsImmediate[x];N=B.object;if(N.visible){M=B.opaque;h(N);for(B=0;B<M.count;B++){H=M.list[B];j(H.depthTest);J=d(C,W,U,H,N);N.render(function(za){g(za,
+J,H.shading)})}}}for(x=0;x<I;x++){B=m.__webglObjects[x];if(B.render){N=B.object;O=B.buffer;M=B.transparent;h(N);for(B=0;B<M.count;B++){H=M.list[B];z(H.blending);j(H.depthTest);f(C,W,U,H,O,N)}}}for(x=0;x<E;x++){B=m.__webglObjectsImmediate[x];N=B.object;if(N.visible){M=B.transparent;h(N);for(B=0;B<M.count;B++){H=M.list[B];z(H.blending);j(H.depthTest);J=d(C,W,U,H,N);N.render(function(za){g(za,J,H.shading)})}}}m.__webglSprites.length&&renderSprites(m);R&&m.__webglShadowVolumes.length&&m.lights.length&&
+v(m);m.__webglLensFlares.length&&A(m,C);if(u&&u.minFilter!==THREE.NearestFilter&&u.minFilter!==THREE.LinearFilter){e.bindTexture(e.TEXTURE_2D,u.__webglTexture);e.generateMipmap(e.TEXTURE_2D);e.bindTexture(e.TEXTURE_2D,null)}};this.initWebGLObjects=function(m){if(!m.__webglObjects){m.__webglObjects=[];m.__webglObjectsImmediate=[];m.__webglShadowVolumes=[];m.__webglLensFlares=[];m.__webglSprites=[]}for(;m.__objectsAdded.length;){var C=m.__objectsAdded[0],u=m,x=void 0,B=void 0,J=void 0;if(C._modelViewMatrix==
+undefined){C._modelViewMatrix=new THREE.Matrix4;C._normalMatrixArray=new Float32Array(9);C._modelViewMatrixArray=new Float32Array(16);C._objectMatrixArray=new Float32Array(16);C.matrixWorld.flattenToArray(C._objectMatrixArray)}if(C instanceof THREE.Mesh){B=C.geometry;B.geometryGroups==undefined&&L(B);for(x in B.geometryGroups){J=B.geometryGroups[x];if(!J.__webglVertexBuffer){var M=J;M.__webglVertexBuffer=e.createBuffer();M.__webglNormalBuffer=e.createBuffer();M.__webglTangentBuffer=e.createBuffer();
+M.__webglColorBuffer=e.createBuffer();M.__webglUVBuffer=e.createBuffer();M.__webglUV2Buffer=e.createBuffer();M.__webglSkinVertexABuffer=e.createBuffer();M.__webglSkinVertexBBuffer=e.createBuffer();M.__webglSkinIndicesBuffer=e.createBuffer();M.__webglSkinWeightsBuffer=e.createBuffer();M.__webglFaceBuffer=e.createBuffer();M.__webglLineBuffer=e.createBuffer();if(M.numMorphTargets){var H=void 0,I=void 0;M.__webglMorphTargetsBuffers=[];H=0;for(I=M.numMorphTargets;H<I;H++)M.__webglMorphTargetsBuffers.push(e.createBuffer())}M=
+J;H=C;var E=void 0,N=void 0,O=void 0;O=void 0;var W=void 0,U=void 0,za=void 0,Ka=za=I=0;N=void 0;O=void 0;var ma=void 0;E=void 0;N=void 0;W=H.geometry;ma=W.faces;U=M.faces;E=0;for(N=U.length;E<N;E++){O=U[E];O=ma[O];if(O instanceof THREE.Face3){I+=3;za+=1;Ka+=3}else if(O instanceof THREE.Face4){I+=4;za+=2;Ka+=4}}E=M;N=H;ma=void 0;U=void 0;var Ha=void 0,db=void 0;Ha=void 0;O=[];ma=0;for(U=N.materials.length;ma<U;ma++){Ha=N.materials[ma];if(Ha instanceof THREE.MeshFaceMaterial){Ha=0;for(l=E.materials.length;Ha<
+l;Ha++)(db=E.materials[Ha])&&O.push(db)}else(db=Ha)&&O.push(db)}E=O;a:{N=void 0;ma=void 0;U=E.length;for(N=0;N<U;N++){ma=E[N];if(ma.map||ma.lightMap||ma instanceof THREE.MeshShaderMaterial){N=!0;break a}}N=!1}a:{ma=E;U=void 0;O=void 0;Ha=ma.length;for(U=0;U<Ha;U++){O=ma[U];if(!(O instanceof THREE.MeshBasicMaterial&&!O.envMap||O instanceof THREE.MeshDepthMaterial)){ma=O&&O.shading!=undefined&&O.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}}ma=!1}a:{U=void 0;O=void 0;Ha=
+E.length;for(U=0;U<Ha;U++){O=E[U];if(O.vertexColors){O=O.vertexColors;break a}}O=!1}M.__vertexArray=new Float32Array(I*3);if(ma)M.__normalArray=new Float32Array(I*3);if(W.hasTangents)M.__tangentArray=new Float32Array(I*4);if(O)M.__colorArray=new Float32Array(I*3);if(N){if(W.faceUvs.length>0||W.faceVertexUvs.length>0)M.__uvArray=new Float32Array(I*2);if(W.faceUvs.length>1||W.faceVertexUvs.length>1)M.__uv2Array=new Float32Array(I*2)}if(H.geometry.skinWeights.length&&H.geometry.skinIndices.length){M.__skinVertexAArray=
+new Float32Array(I*4);M.__skinVertexBArray=new Float32Array(I*4);M.__skinIndexArray=new Float32Array(I*4);M.__skinWeightArray=new Float32Array(I*4)}M.__faceArray=new Uint16Array(za*3+(H.geometry.edgeFaces?H.geometry.edgeFaces.length*6:0));M.__lineArray=new Uint16Array(Ka*2);if(M.numMorphTargets){M.__morphTargetsArrays=[];W=0;for(U=M.numMorphTargets;W<U;W++)M.__morphTargetsArrays.push(new Float32Array(I*3))}M.__needsSmoothNormals=ma==THREE.SmoothShading;M.__uvType=N;M.__vertexColorType=O;M.__normalType=
+ma;M.__webglFaceCount=za*3+(H.geometry.edgeFaces?H.geometry.edgeFaces.length*6:0);M.__webglLineCount=Ka*2;W=0;for(U=E.length;W<U;W++)if(E[W].attributes){M.__webglCustomAttributes={};for(a in E[W].attributes){N=E[W].attributes[a];za=1;if(N.type==="v2")za=2;else if(N.type==="v3")za=3;else if(N.type==="v4")za=4;else N.type==="c"&&(za=3);N.size=za;N.needsUpdate=!0;N.array=new Float32Array(I*za);N.buffer=e.createBuffer();M.__webglCustomAttributes[a]=N}}B.__dirtyVertices=!0;B.__dirtyMorphTargets=!0;B.__dirtyElements=
+!0;B.__dirtyUvs=!0;B.__dirtyNormals=!0;B.__dirtyTangents=!0;B.__dirtyColors=!0}C instanceof THREE.ShadowVolume?V(u.__webglShadowVolumes,J,C):V(u.__webglObjects,J,C)}}else if(C instanceof THREE.LensFlare)V(u.__webglLensFlares,undefined,C);else if(C instanceof THREE.Ribbon){B=C.geometry;if(!B.__webglVertexBuffer){x=B;x.__webglVertexBuffer=e.createBuffer();x.__webglColorBuffer=e.createBuffer();x=B;J=x.vertices.length;x.__vertexArray=new Float32Array(J*3);x.__colorArray=new Float32Array(J*3);x.__webglVertexCount=
+J;B.__dirtyVertices=!0;B.__dirtyColors=!0}V(u.__webglObjects,B,C)}else if(C instanceof THREE.Line){B=C.geometry;if(!B.__webglVertexBuffer){x=B;x.__webglVertexBuffer=e.createBuffer();x.__webglColorBuffer=e.createBuffer();x=B;J=x.vertices.length;x.__vertexArray=new Float32Array(J*3);x.__colorArray=new Float32Array(J*3);x.__webglLineCount=J;B.__dirtyVertices=!0;B.__dirtyColors=!0}V(u.__webglObjects,B,C)}else if(C instanceof THREE.ParticleSystem){B=C.geometry;if(!B.__webglVertexBuffer){x=B;x.__webglVertexBuffer=
+e.createBuffer();x.__webglColorBuffer=e.createBuffer();x=B;J=x.vertices.length;x.__vertexArray=new Float32Array(J*3);x.__colorArray=new Float32Array(J*3);x.__sortArray=[];x.__webglParticleCount=J;B.__dirtyVertices=!0;B.__dirtyColors=!0}V(u.__webglObjects,B,C)}else THREE.MarchingCubes!==undefined&&C instanceof THREE.MarchingCubes&&u.__webglObjectsImmediate.push({object:C,opaque:{list:[],count:0},transparent:{list:[],count:0}});m.__objectsAdded.splice(0,1)}for(;m.__objectsRemoved.length;){C=m.__objectsRemoved[0];
+u=m;B=void 0;x=void 0;for(B=u.__webglObjects.length-1;B>=0;B--){x=u.__webglObjects[B].object;C==x&&u.__webglObjects.splice(B,1)}m.__objectsRemoved.splice(0,1)}C=0;for(u=m.__webglObjects.length;C<u;C++)G(m.__webglObjects[C].object,m);C=0;for(u=m.__webglShadowVolumes.length;C<u;C++)G(m.__webglShadowVolumes[C].object,m);C=0;for(u=m.__webglLensFlares.length;C<u;C++)G(m.__webglLensFlares[C].object,m);C=0;for(u=m.__webglSprites.length;C<u;C++)G(m.__webglSprites[C].object,m)};this.setFaceCulling=function(m,
+C){if(m){!C||C=="ccw"?e.frontFace(e.CCW):e.frontFace(e.CW);if(m=="back")e.cullFace(e.BACK);else m=="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,c,d){this.width=b;this.height=c;d=d||{};this.wrapS=d.wrapS!==undefined?d.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=d.wrapT!==undefined?d.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=d.magFilter!==undefined?d.magFilter:THREE.LinearFilter;this.minFilter=d.minFilter!==undefined?d.minFilter:THREE.LinearMipMapLinearFilter;this.format=d.format!==undefined?d.format:THREE.RGBFormat;this.type=d.type!==undefined?d.type:THREE.UnsignedByteType;this.depthBuffer=d.depthBuffer!==
 undefined?d.depthBuffer:!0;this.stencilBuffer=d.stencilBuffer!==undefined?d.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,c,d){d&&b.update(undefined,!1,c);d=b.sounds;var f,g=d.length;for(f=0;f<g;f++){b=d[f];this.soundPosition.set(b.matrixWorld.n14,b.matrixWorld.n24,b.matrixWorld.n34);this.soundPosition.subSelf(c.position);if(b.isPlaying&&b.isLoaded){b.isAddedToDOM||b.addToDOM(this.domElement);b.calculateVolumeAndPan(this.soundPosition)}}}};
@@ -376,7 +380,7 @@ this.heightMax?this.heightMax:this.position.y)-this.heightMin)*this.heightCoef:0
 (90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;var f=this.target.position,g=this.position;f.x=g.x+100*Math.sin(this.phi)*Math.cos(this.theta);f.y=g.y+100*Math.cos(this.phi);f.z=g.z+100*Math.sin(this.phi)*Math.sin(this.theta)}this.lon+=this.mouseX*d;this.lookVertical&&(this.lat-=this.mouseY*d);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi=(this.phi-0)*(this.verticalMax-this.verticalMin)/
 3.14+this.verticalMin;f=this.target.position;g=this.position;f.x=g.x+100*Math.sin(this.phi)*Math.cos(this.theta);f.y=g.y+100*Math.cos(this.phi);f.z=g.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListener("contextmenu",function(d){d.preventDefault()},!1);this.domElement.addEventListener("mousemove",c(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",c(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",c(this,
 this.onMouseUp),!1);this.domElement.addEventListener("keydown",c(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",c(this,this.onKeyUp),!1)};THREE.QuakeCamera.prototype=new THREE.Camera;THREE.QuakeCamera.prototype.constructor=THREE.QuakeCamera;THREE.QuakeCamera.prototype.supr=THREE.Camera.prototype;THREE.QuakeCamera.prototype.translate=function(b,c){this.matrix.rotateAxis(c);if(this.noFly)c.y=0;this.position.addSelf(c.multiplyScalar(b));this.target.position.addSelf(c.multiplyScalar(b))};
-THREE.PathCamera=function(b){function c(p,o,w,y){var v={name:w,fps:0.6,length:y,hierarchy:[]},A,F=o.getControlPointsArray(),G=o.getLength(),K=F.length,V=0;A=K-1;o={parent:-1,keys:[]};o.keys[0]={time:0,pos:F[0],rot:[0,0,0,1],scl:[1,1,1]};o.keys[A]={time:y,pos:F[A],rot:[0,0,0,1],scl:[1,1,1]};for(A=1;A<K-1;A++){V=y*G.chunks[A]/G.total;o.keys[A]={time:V,pos:F[A]}}v.hierarchy[0]=o;THREE.AnimationHandler.add(v);return new THREE.Animation(p,w,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function d(p,o){var w,
+THREE.PathCamera=function(b){function c(p,o,w,y){var v={name:w,fps:0.6,length:y,hierarchy:[]},A,F=o.getControlPointsArray(),G=o.getLength(),L=F.length,V=0;A=L-1;o={parent:-1,keys:[]};o.keys[0]={time:0,pos:F[0],rot:[0,0,0,1],scl:[1,1,1]};o.keys[A]={time:y,pos:F[A],rot:[0,0,0,1],scl:[1,1,1]};for(A=1;A<L-1;A++){V=y*G.chunks[A]/G.total;o.keys[A]={time:V,pos:F[A]}}v.hierarchy[0]=o;THREE.AnimationHandler.add(v);return new THREE.Animation(p,w,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function d(p,o){var w,
 y,v=new THREE.Geometry;for(w=0;w<p.points.length*o;w++){y=w/(p.points.length*o);y=p.getPoint(y);v.vertices[w]=new THREE.Vertex(new THREE.Vector3(y.x,y.y,y.z))}return v}function f(p,o){var w=d(o,10),y=d(o,10),v=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(w,v);particleObj=new THREE.ParticleSystem(y,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);p.addChild(lineObj);particleObj.scale.set(1,1,1);p.addChild(particleObj);y=new Sphere(1,
 16,8);v=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<o.points.length;i++){w=new THREE.Mesh(y,v);w.position.copy(o.points[i]);w.updateMatrix();p.addChild(w)}}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=
 !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;
@@ -385,10 +389,10 @@ this.lat=this.mouseY=this.mouseX=0;this.windowHalfX=window.innerWidth/2;this.win
 this.phi=(this.phi-y[0])*(v[1]-v[0])/(y[1]-y[0])+v[0];y=this.horizontalAngleMap.srcRange;v=this.horizontalAngleMap.dstRange;this.theta=(this.theta-y[0])*(v[1]-v[0])/(y[1]-y[0])+v[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,p,o,w)};this.onMouseMove=function(p){this.mouseX=p.clientX-this.windowHalfX;this.mouseY=p.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 Cube(10,10,20),n=new Cube(2,2,10);this.animationParent=new THREE.Mesh(k,b);b=new THREE.Mesh(n,j);b.position.set(0,10,0);this.animation=c(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this);this.animationParent.addChild(this.target);this.animationParent.addChild(b)}else{this.animation=
 c(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(p,o){return function(){o.apply(p,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;
-var Cube=function(b,c,d,f,g,h,j,k,n){function p(G,K,V,z,O,P,S,wa){var sa,qa,e=f||1,ga=g||1,ea=O/2,xa=P/2,Ea=o.vertices.length;if(G=="x"&&K=="y"||G=="y"&&K=="x")sa="z";else if(G=="x"&&K=="z"||G=="z"&&K=="x"){sa="y";ga=h||1}else if(G=="z"&&K=="y"||G=="y"&&K=="z"){sa="x";e=h||1}var Fa=e+1,ra=ga+1;O/=e;var aa=P/ga;for(qa=0;qa<ra;qa++)for(P=0;P<Fa;P++){var pa=new THREE.Vector3;pa[G]=(P*O-ea)*V;pa[K]=(qa*aa-xa)*z;pa[sa]=S;o.vertices.push(new THREE.Vertex(pa))}for(qa=0;qa<ga;qa++)for(P=0;P<e;P++){o.faces.push(new THREE.Face4(P+
-Fa*qa+Ea,P+Fa*(qa+1)+Ea,P+1+Fa*(qa+1)+Ea,P+1+Fa*qa+Ea,null,null,wa));o.faceVertexUvs[0].push([new THREE.UV(P/e,qa/ga),new THREE.UV(P/e,(qa+1)/ga),new THREE.UV((P+1)/e,(qa+1)/ga),new THREE.UV((P+1)/e,qa/ga)])}}THREE.Geometry.call(this);var o=this,w=b/2,y=c/2,v=d/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(n!=undefined)for(var F in n)this.sides[F]!=
-undefined&&(this.sides[F]=n[F]);this.sides.px&&p("z","y",1*k,-1,d,c,-w,this.materials[0]);this.sides.nx&&p("z","y",-1*k,-1,d,c,w,this.materials[1]);this.sides.py&&p("x","z",1*k,1,b,d,y,this.materials[2]);this.sides.ny&&p("x","z",1*k,-1,b,d,-y,this.materials[3]);this.sides.pz&&p("x","y",1*k,-1,b,c,v,this.materials[4]);this.sides.nz&&p("x","y",-1*k,-1,b,c,-v,this.materials[5]);(function(){for(var G=[],K=[],V=0,z=o.vertices.length;V<z;V++){for(var O=o.vertices[V],P=!1,S=0,wa=G.length;S<wa;S++){var sa=
-G[S];if(O.position.x==sa.position.x&&O.position.y==sa.position.y&&O.position.z==sa.position.z){K[V]=S;P=!0;break}}if(!P){K[V]=G.length;G.push(new THREE.Vertex(O.position.clone()))}}V=0;for(z=o.faces.length;V<z;V++){O=o.faces[V];O.a=K[O.a];O.b=K[O.b];O.c=K[O.c];O.d=K[O.d]}o.vertices=G})();this.computeCentroids();this.computeFaceNormals()};Cube.prototype=new THREE.Geometry;Cube.prototype.constructor=Cube;
+var Cube=function(b,c,d,f,g,h,j,k,n){function p(G,L,V,z,K,P,S,xa){var ra,pa,e=f||1,fa=g||1,ca=K/2,ya=P/2,Fa=o.vertices.length;if(G=="x"&&L=="y"||G=="y"&&L=="x")ra="z";else if(G=="x"&&L=="z"||G=="z"&&L=="x"){ra="y";fa=h||1}else if(G=="z"&&L=="y"||G=="y"&&L=="z"){ra="x";e=h||1}var Ea=e+1,Y=fa+1;K/=e;var qa=P/fa;for(pa=0;pa<Y;pa++)for(P=0;P<Ea;P++){var ta=new THREE.Vector3;ta[G]=(P*K-ca)*V;ta[L]=(pa*qa-ya)*z;ta[ra]=S;o.vertices.push(new THREE.Vertex(ta))}for(pa=0;pa<fa;pa++)for(P=0;P<e;P++){o.faces.push(new THREE.Face4(P+
+Ea*pa+Fa,P+Ea*(pa+1)+Fa,P+1+Ea*(pa+1)+Fa,P+1+Ea*pa+Fa,null,null,xa));o.faceVertexUvs[0].push([new THREE.UV(P/e,pa/fa),new THREE.UV(P/e,(pa+1)/fa),new THREE.UV((P+1)/e,(pa+1)/fa),new THREE.UV((P+1)/e,pa/fa)])}}THREE.Geometry.call(this);var o=this,w=b/2,y=c/2,v=d/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(n!=undefined)for(var F in n)this.sides[F]!=
+undefined&&(this.sides[F]=n[F]);this.sides.px&&p("z","y",1*k,-1,d,c,-w,this.materials[0]);this.sides.nx&&p("z","y",-1*k,-1,d,c,w,this.materials[1]);this.sides.py&&p("x","z",1*k,1,b,d,y,this.materials[2]);this.sides.ny&&p("x","z",1*k,-1,b,d,-y,this.materials[3]);this.sides.pz&&p("x","y",1*k,-1,b,c,v,this.materials[4]);this.sides.nz&&p("x","y",-1*k,-1,b,c,-v,this.materials[5]);(function(){for(var G=[],L=[],V=0,z=o.vertices.length;V<z;V++){for(var K=o.vertices[V],P=!1,S=0,xa=G.length;S<xa;S++){var ra=
+G[S];if(K.position.x==ra.position.x&&K.position.y==ra.position.y&&K.position.z==ra.position.z){L[V]=S;P=!0;break}}if(!P){L[V]=G.length;G.push(new THREE.Vertex(K.position.clone()))}}V=0;for(z=o.faces.length;V<z;V++){K=o.faces[V];K.a=L[K.a];K.b=L[K.b];K.c=L[K.c];K.d=L[K.d]}o.vertices=G})();this.computeCentroids();this.computeFaceNormals()};Cube.prototype=new THREE.Geometry;Cube.prototype.constructor=Cube;
 var Cylinder=function(b,c,d,f,g,h){function j(o,w,y){k.vertices.push(new THREE.Vertex(new THREE.Vector3(o,w,y)))}THREE.Geometry.call(this);var k=this,n=Math.PI,p=f/2;for(f=0;f<b;f++)j(Math.sin(2*n*f/b)*c,Math.cos(2*n*f/b)*c,-p);for(f=0;f<b;f++)j(Math.sin(2*n*f/b)*d,Math.cos(2*n*f/b)*d,p);for(f=0;f<b;f++)k.faces.push(new THREE.Face4(f,f+b,b+(f+1)%b,(f+1)%b));if(d>0){j(0,0,-p-(h||0));for(f=b;f<b+b/2;f++)k.faces.push(new THREE.Face4(2*b,(2*f-2*b)%b,(2*f-2*b+1)%b,(2*f-2*b+2)%b))}if(c>0){j(0,0,p+(g||0));
 for(f=b+b/2;f<2*b;f++)k.faces.push(new THREE.Face4(2*b+1,(2*f-2*b+2)%b+b,(2*f-2*b+1)%b+b,(2*f-2*b)%b+b))}this.computeCentroids();this.computeFaceNormals()};Cylinder.prototype=new THREE.Geometry;Cylinder.prototype.constructor=Cylinder;
 var Icosahedron=function(b){function c(w,y,v){var A=Math.sqrt(w*w+y*y+v*v);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(w/A,y/A,v/A)))-1}function d(w,y,v,A){A.faces.push(new THREE.Face3(w,y,v))}function f(w,y){var v=g.vertices[w].position,A=g.vertices[y].position;return c((v.x+A.x)/2,(v.y+A.y)/2,(v.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;c(-1,b,0);c(1,b,0);c(-1,-b,0);c(1,-b,0);c(0,-1,b);c(0,1,b);c(0,-1,-b);c(0,
@@ -413,48 +417,48 @@ Math.LN2));k.image.width=o;k.image.height=w;k.image.getContext("2d").drawImage(t
 "Multiply")h.blending=THREE.MultiplyBlending;if(b.transparent!==undefined)h.transparent=b.transparent;if(b.depthTest!==undefined)h.depthTest=b.depthTest;if(b.vertexColors!==undefined)if(b.vertexColors=="face")h.vertexColors=THREE.FaceColors;else if(b.vertexColors)h.vertexColors=THREE.VertexColors;if(b.mapDiffuse&&c){j=document.createElement("canvas");h.map=new THREE.Texture(j);h.map.sourceFile=b.mapDiffuse;f(h.map,c+"/"+b.mapDiffuse)}else if(b.colorDiffuse){j=(b.colorDiffuse[0]*255<<16)+(b.colorDiffuse[1]*
 255<<8)+b.colorDiffuse[2]*255;h.color=j;h.opacity=b.transparency}else if(b.DbgColor)h.color=b.DbgColor;if(b.mapLightmap&&c){j=document.createElement("canvas");h.lightMap=new THREE.Texture(j);h.lightMap.sourceFile=b.mapLightmap;f(h.lightMap,c+"/"+b.mapLightmap)}return new THREE[g](h)}};THREE.JSONLoader=function(b){THREE.Loader.call(this,b)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
 THREE.JSONLoader.prototype.load=function(b){var c=this,d=b.model,f=b.callback,g=b.texture_path?b.texture_path:this.extractUrlbase(d);b=new Worker(d);b.onmessage=function(h){c.createModel(h.data,f,g);c.onLoadComplete()};this.onLoadStart();b.postMessage((new Date).getTime())};
-THREE.JSONLoader.prototype.createModel=function(b,c,d){var f=new THREE.Geometry;this.init_materials(f,b.materials,d);(function(){if(b.version===undefined||b.version!=2)console.error("Deprecated file format.");else{var g,h,j,k,n,p,o,w,y,v,A,F,G,K,V,z=b.faces;v=b.vertices;var O=b.normals,P=b.colors;p=b.scale!==undefined?b.scale:1;var S=0;for(g=0;g<b.uvs.length;g++)b.uvs[g].length&&S++;for(g=0;g<S;g++){f.faceUvs[g]=[];f.faceVertexUvs[g]=[]}k=0;for(n=v.length;k<n;){o=new THREE.Vertex;o.position.x=v[k++]/
-p;o.position.y=v[k++]/p;o.position.z=v[k++]/p;f.vertices.push(o)}k=0;for(n=z.length;k<n;){v=z[k++];p=v&1;j=v&2;g=v&4;h=v&8;w=v&16;o=v&32;A=v&64;v&=128;if(p){F=new THREE.Face4;F.a=z[k++];F.b=z[k++];F.c=z[k++];F.d=z[k++];p=4}else{F=new THREE.Face3;F.a=z[k++];F.b=z[k++];F.c=z[k++];p=3}if(j){j=z[k++];F.materials=f.materials[j]}j=f.faces.length;if(g)for(g=0;g<S;g++){G=b.uvs[g];y=z[k++];V=G[y*2];y=G[y*2+1];f.faceUvs[g][j]=new THREE.UV(V,y)}if(h)for(g=0;g<S;g++){G=b.uvs[g];K=[];for(h=0;h<p;h++){y=z[k++];
-V=G[y*2];y=G[y*2+1];K[h]=new THREE.UV(V,y)}f.faceVertexUvs[g][j]=K}if(w){w=z[k++]*3;h=new THREE.Vector3;h.x=O[w++];h.y=O[w++];h.z=O[w];F.normal=h}if(o)for(g=0;g<p;g++){w=z[k++]*3;h=new THREE.Vector3;h.x=O[w++];h.y=O[w++];h.z=O[w];F.vertexNormals.push(h)}if(A){o=z[k++];o=new THREE.Color(P[o]);F.color=o}if(v)for(g=0;g<p;g++){o=z[k++];o=new THREE.Color(P[o]);F.vertexColors.push(o)}f.faces.push(F)}}})();(function(){var g,h,j,k;if(b.skinWeights){g=0;for(h=b.skinWeights.length;g<h;g+=2){j=b.skinWeights[g];
+THREE.JSONLoader.prototype.createModel=function(b,c,d){var f=new THREE.Geometry;this.init_materials(f,b.materials,d);(function(){if(b.version===undefined||b.version!=2)console.error("Deprecated file format.");else{var g,h,j,k,n,p,o,w,y,v,A,F,G,L,V,z=b.faces;v=b.vertices;var K=b.normals,P=b.colors;p=b.scale!==undefined?b.scale:1;var S=0;for(g=0;g<b.uvs.length;g++)b.uvs[g].length&&S++;for(g=0;g<S;g++){f.faceUvs[g]=[];f.faceVertexUvs[g]=[]}k=0;for(n=v.length;k<n;){o=new THREE.Vertex;o.position.x=v[k++]/
+p;o.position.y=v[k++]/p;o.position.z=v[k++]/p;f.vertices.push(o)}k=0;for(n=z.length;k<n;){v=z[k++];p=v&1;j=v&2;g=v&4;h=v&8;w=v&16;o=v&32;A=v&64;v&=128;if(p){F=new THREE.Face4;F.a=z[k++];F.b=z[k++];F.c=z[k++];F.d=z[k++];p=4}else{F=new THREE.Face3;F.a=z[k++];F.b=z[k++];F.c=z[k++];p=3}if(j){j=z[k++];F.materials=f.materials[j]}j=f.faces.length;if(g)for(g=0;g<S;g++){G=b.uvs[g];y=z[k++];V=G[y*2];y=G[y*2+1];f.faceUvs[g][j]=new THREE.UV(V,y)}if(h)for(g=0;g<S;g++){G=b.uvs[g];L=[];for(h=0;h<p;h++){y=z[k++];
+V=G[y*2];y=G[y*2+1];L[h]=new THREE.UV(V,y)}f.faceVertexUvs[g][j]=L}if(w){w=z[k++]*3;h=new THREE.Vector3;h.x=K[w++];h.y=K[w++];h.z=K[w];F.normal=h}if(o)for(g=0;g<p;g++){w=z[k++]*3;h=new THREE.Vector3;h.x=K[w++];h.y=K[w++];h.z=K[w];F.vertexNormals.push(h)}if(A){o=z[k++];o=new THREE.Color(P[o]);F.color=o}if(v)for(g=0;g<p;g++){o=z[k++];o=new THREE.Color(P[o]);F.vertexColors.push(o)}f.faces.push(F)}}})();(function(){var g,h,j,k;if(b.skinWeights){g=0;for(h=b.skinWeights.length;g<h;g+=2){j=b.skinWeights[g];
 k=b.skinWeights[g+1];f.skinWeights.push(new THREE.Vector4(j,k,0,0))}}if(b.skinIndices){g=0;for(h=b.skinIndices.length;g<h;g+=2){j=b.skinIndices[g];k=b.skinIndices[g+1];f.skinIndices.push(new THREE.Vector4(j,k,0,0))}}f.bones=b.bones;f.animation=b.animation})();(function(){if(b.morphTargets!==undefined){var g,h,j,k,n,p;g=0;for(h=b.morphTargets.length;g<h;g++){f.morphTargets[g]={};f.morphTargets[g].name=b.morphTargets[g].name;f.morphTargets[g].vertices=[];n=f.morphTargets[g].vertices;p=b.morphTargets[g].vertices;
 j=0;for(k=p.length;j<k;j+=3)n.push(new THREE.Vertex(new THREE.Vector3(p[j],p[j+1],p[j+2])))}}if(b.morphColors!==undefined){var o,w;g=0;for(h=b.morphColors.length;g<h;g++){f.morphColors[g]={};f.morphColors[g].name=b.morphColors[g].name;f.morphColors[g].colors=[];p=f.morphColors[g].colors;o=b.morphColors[g].colors;k=0;for(n=o.length;k<n;k+=3){w=new THREE.Color(16755200);w.setRGB(o[j],o[j+1],o[j+2]);p.push(w)}}}})();(function(){if(b.edges!==undefined){var g,h,j;for(g=0;g<b.edges.length;g+=2){h=b.edges[g];
 j=b.edges[g+1];f.edges.push(new THREE.Edge(f.vertices[h],f.vertices[j],h,j))}}})();f.computeCentroids();f.computeFaceNormals();f.computeEdgeFaces();c(f)};THREE.BinaryLoader=function(b){THREE.Loader.call(this,b)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
 THREE.BinaryLoader.prototype={load:function(b){var c=b.model,d=b.callback,f=b.texture_path?b.texture_path:THREE.Loader.prototype.extractUrlbase(c),g=b.bin_path?b.bin_path:THREE.Loader.prototype.extractUrlbase(c);b=(new Date).getTime();c=new Worker(c);var h=this.showProgress?THREE.Loader.prototype.updateProgress:null;c.onmessage=function(j){THREE.BinaryLoader.prototype.loadAjaxBuffers(j.data.buffers,j.data.materials,d,g,f,h)};c.onerror=function(j){alert("worker.onerror: "+j.message+"\n"+j.data);j.preventDefault()};
 c.postMessage(b)},loadAjaxBuffers:function(b,c,d,f,g,h){var j=new XMLHttpRequest,k=f+"/"+b,n=0;j.onreadystatechange=function(){if(j.readyState==4)j.status==200||j.status==0?THREE.BinaryLoader.prototype.createBinModel(j.responseText,d,g,c):alert("Couldn't load ["+k+"] ["+j.status+"]");else if(j.readyState==3){if(h){n==0&&(n=j.getResponseHeader("Content-Length"));h({total:n,loaded:j.responseText.length})}}else j.readyState==2&&(n=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,c,d,f){var g=function(h){function j(R,$){var oa=o(R,$),Ca=o(R,$+1),ia=o(R,$+2),da=o(R,$+3),m=(da<<1&255|ia>>7)-127;oa|=(ia&127)<<16|Ca<<8;if(oa==0&&m==-127)return 0;return(1-2*(da>>7))*(1+oa*Math.pow(2,-23))*Math.pow(2,m)}function k(R,$){var oa=o(R,$),Ca=o(R,$+1),ia=o(R,$+2);return(o(R,$+3)<<24)+(ia<<16)+(Ca<<8)+oa}function n(R,$){var oa=o(R,$);return(o(R,$+1)<<8)+oa}function p(R,$){var oa=o(R,$);return oa>127?
-oa-256:oa}function o(R,$){return R.charCodeAt($)&255}function w(R){var $,oa,Ca;$=k(b,R);oa=k(b,R+S);Ca=k(b,R+wa);R=n(b,R+sa);THREE.BinaryLoader.prototype.f3(K,$,oa,Ca,R)}function y(R){var $,oa,Ca,ia,da,m;$=k(b,R);oa=k(b,R+S);Ca=k(b,R+wa);ia=n(b,R+sa);da=k(b,R+qa);m=k(b,R+e);R=k(b,R+ga);THREE.BinaryLoader.prototype.f3n(K,O,$,oa,Ca,ia,da,m,R)}function v(R){var $,oa,Ca,ia;$=k(b,R);oa=k(b,R+ea);Ca=k(b,R+xa);ia=k(b,R+Ea);R=n(b,R+Fa);THREE.BinaryLoader.prototype.f4(K,$,oa,Ca,ia,R)}function A(R){var $,oa,
-Ca,ia,da,m,C,u;$=k(b,R);oa=k(b,R+ea);Ca=k(b,R+xa);ia=k(b,R+Ea);da=n(b,R+Fa);m=k(b,R+ra);C=k(b,R+aa);u=k(b,R+pa);R=k(b,R+ya);THREE.BinaryLoader.prototype.f4n(K,O,$,oa,Ca,ia,da,m,C,u,R)}function F(R){var $,oa;$=k(b,R);oa=k(b,R+ja);R=k(b,R+Y);THREE.BinaryLoader.prototype.uv3(K.faceVertexUvs[0],P[$*2],P[$*2+1],P[oa*2],P[oa*2+1],P[R*2],P[R*2+1])}function G(R){var $,oa,Ca;$=k(b,R);oa=k(b,R+na);Ca=k(b,R+Ba);R=k(b,R+ka);THREE.BinaryLoader.prototype.uv4(K.faceVertexUvs[0],P[$*2],P[$*2+1],P[oa*2],P[oa*2+1],
-P[Ca*2],P[Ca*2+1],P[R*2],P[R*2+1])}var K=this,V=0,z,O=[],P=[],S,wa,sa,qa,e,ga,ea,xa,Ea,Fa,ra,aa,pa,ya,ja,Y,na,Ba,ka,la,Da,Sa,$a,Ya,Ta;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(K,f,h);z={signature:b.substr(V,8),header_bytes:o(b,V+8),vertex_coordinate_bytes:o(b,V+9),normal_coordinate_bytes:o(b,V+10),uv_coordinate_bytes:o(b,V+11),vertex_index_bytes:o(b,V+12),normal_index_bytes:o(b,V+13),uv_index_bytes:o(b,V+14),material_index_bytes:o(b,V+15),nvertices:k(b,V+16),nnormals:k(b,V+16+
-4),nuvs:k(b,V+16+8),ntri_flat:k(b,V+16+12),ntri_smooth:k(b,V+16+16),ntri_flat_uv:k(b,V+16+20),ntri_smooth_uv:k(b,V+16+24),nquad_flat:k(b,V+16+28),nquad_smooth:k(b,V+16+32),nquad_flat_uv:k(b,V+16+36),nquad_smooth_uv:k(b,V+16+40)};V+=z.header_bytes;S=z.vertex_index_bytes;wa=z.vertex_index_bytes*2;sa=z.vertex_index_bytes*3;qa=z.vertex_index_bytes*3+z.material_index_bytes;e=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes;ga=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes*
-2;ea=z.vertex_index_bytes;xa=z.vertex_index_bytes*2;Ea=z.vertex_index_bytes*3;Fa=z.vertex_index_bytes*4;ra=z.vertex_index_bytes*4+z.material_index_bytes;aa=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes;pa=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes*2;ya=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes*3;ja=z.uv_index_bytes;Y=z.uv_index_bytes*2;na=z.uv_index_bytes;Ba=z.uv_index_bytes*2;ka=z.uv_index_bytes*3;h=z.vertex_index_bytes*3+z.material_index_bytes;
-Ta=z.vertex_index_bytes*4+z.material_index_bytes;la=z.ntri_flat*h;Da=z.ntri_smooth*(h+z.normal_index_bytes*3);Sa=z.ntri_flat_uv*(h+z.uv_index_bytes*3);$a=z.ntri_smooth_uv*(h+z.normal_index_bytes*3+z.uv_index_bytes*3);Ya=z.nquad_flat*Ta;h=z.nquad_smooth*(Ta+z.normal_index_bytes*4);Ta=z.nquad_flat_uv*(Ta+z.uv_index_bytes*4);V+=function(R){for(var $,oa,Ca,ia=z.vertex_coordinate_bytes*3,da=R+z.nvertices*ia;R<da;R+=ia){$=j(b,R);oa=j(b,R+z.vertex_coordinate_bytes);Ca=j(b,R+z.vertex_coordinate_bytes*2);
-THREE.BinaryLoader.prototype.v(K,$,oa,Ca)}return z.nvertices*ia}(V);V+=function(R){for(var $,oa,Ca,ia=z.normal_coordinate_bytes*3,da=R+z.nnormals*ia;R<da;R+=ia){$=p(b,R);oa=p(b,R+z.normal_coordinate_bytes);Ca=p(b,R+z.normal_coordinate_bytes*2);O.push($/127,oa/127,Ca/127)}return z.nnormals*ia}(V);V+=function(R){for(var $,oa,Ca=z.uv_coordinate_bytes*2,ia=R+z.nuvs*Ca;R<ia;R+=Ca){$=j(b,R);oa=j(b,R+z.uv_coordinate_bytes);P.push($,oa)}return z.nuvs*Ca}(V);la=V+la;Da=la+Da;Sa=Da+Sa;$a=Sa+$a;Ya=$a+Ya;h=Ya+
-h;Ta=h+Ta;(function(R){var $,oa=z.vertex_index_bytes*3+z.material_index_bytes,Ca=oa+z.uv_index_bytes*3,ia=R+z.ntri_flat_uv*Ca;for($=R;$<ia;$+=Ca){w($);F($+oa)}return ia-R})(Da);(function(R){var $,oa=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes*3,Ca=oa+z.uv_index_bytes*3,ia=R+z.ntri_smooth_uv*Ca;for($=R;$<ia;$+=Ca){y($);F($+oa)}return ia-R})(Sa);(function(R){var $,oa=z.vertex_index_bytes*4+z.material_index_bytes,Ca=oa+z.uv_index_bytes*4,ia=R+z.nquad_flat_uv*Ca;for($=R;$<ia;$+=
-Ca){v($);G($+oa)}return ia-R})(h);(function(R){var $,oa=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes*4,Ca=oa+z.uv_index_bytes*4,ia=R+z.nquad_smooth_uv*Ca;for($=R;$<ia;$+=Ca){A($);G($+oa)}return ia-R})(Ta);(function(R){var $,oa=z.vertex_index_bytes*3+z.material_index_bytes,Ca=R+z.ntri_flat*oa;for($=R;$<Ca;$+=oa)w($);return Ca-R})(V);(function(R){var $,oa=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes*3,Ca=R+z.ntri_smooth*oa;for($=R;$<Ca;$+=oa)y($);return Ca-
-R})(la);(function(R){var $,oa=z.vertex_index_bytes*4+z.material_index_bytes,Ca=R+z.nquad_flat*oa;for($=R;$<Ca;$+=oa)v($);return Ca-R})($a);(function(R){var $,oa=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes*4,Ca=R+z.nquad_smooth*oa;for($=R;$<Ca;$+=oa)A($);return Ca-R})(Ya);this.computeCentroids();this.computeFaceNormals()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;c(new g(d))},v:function(b,c,d,f){b.vertices.push(new THREE.Vertex(new THREE.Vector3(c,d,f)))},f3:function(b,
-c,d,f,g){b.faces.push(new THREE.Face3(c,d,f,null,null,b.materials[g]))},f4:function(b,c,d,f,g,h){b.faces.push(new THREE.Face4(c,d,f,g,null,null,b.materials[h]))},f3n:function(b,c,d,f,g,h,j,k,n){h=b.materials[h];var p=c[k*3],o=c[k*3+1];k=c[k*3+2];var w=c[n*3],y=c[n*3+1];n=c[n*3+2];b.faces.push(new THREE.Face3(d,f,g,[new THREE.Vector3(c[j*3],c[j*3+1],c[j*3+2]),new THREE.Vector3(p,o,k),new THREE.Vector3(w,y,n)],null,h))},f4n:function(b,c,d,f,g,h,j,k,n,p,o){j=b.materials[j];var w=c[n*3],y=c[n*3+1];n=
-c[n*3+2];var v=c[p*3],A=c[p*3+1];p=c[p*3+2];var F=c[o*3],G=c[o*3+1];o=c[o*3+2];b.faces.push(new THREE.Face4(d,f,g,h,[new THREE.Vector3(c[k*3],c[k*3+1],c[k*3+2]),new THREE.Vector3(w,y,n),new THREE.Vector3(v,A,p),new THREE.Vector3(F,G,o)],null,j))},uv3:function(b,c,d,f,g,h,j){var k=[];k.push(new THREE.UV(c,d));k.push(new THREE.UV(f,g));k.push(new THREE.UV(h,j));b.push(k)},uv4:function(b,c,d,f,g,h,j,k,n){var p=[];p.push(new THREE.UV(c,d));p.push(new THREE.UV(f,g));p.push(new THREE.UV(h,j));p.push(new THREE.UV(k,
-n));b.push(p)}};THREE.SceneLoader=function(){};
-THREE.SceneLoader.prototype={load:function(b,c,d,f){var g=new Worker(b);g.postMessage(0);var h=THREE.Loader.prototype.extractUrlbase(b);g.onmessage=function(j){function k(ya,ja){return ja=="relativeToHTML"?ya:h+"/"+ya}function n(){for(v in e.objects)if(!aa.objects[v]){V=e.objects[v];if(S=aa.geometries[V.geometry]){qa=[];for(pa=0;pa<V.materials.length;pa++)qa[pa]=aa.materials[V.materials[pa]];z=V.position;r=V.rotation;q=V.quaternion;s=V.scale;q=0;qa.length==0&&(qa[0]=new THREE.MeshFaceMaterial);object=
-new THREE.Mesh(S,qa);object.position.set(z[0],z[1],z[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=V.visible;aa.scene.addObject(object);aa.objects[v]=object}}}function p(ya){return function(ja){aa.geometries[ya]=ja;n();xa-=1;o()}}function o(){f({total_models:Fa,total_textures:ra,loaded_models:Fa-xa,loaded_textures:ra-Ea},aa);xa==0&&Ea==0&&d(aa)}var w,y,v,A,F,G,K,V,z,O,P,S,wa,sa,
-qa,e,ga,ea,xa,Ea,Fa,ra,aa;e=j.data;ga=new THREE.BinaryLoader;ea=new THREE.JSONLoader;Ea=xa=0;aa={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{}};j=function(){Ea-=1;o()};for(F in e.cameras){O=e.cameras[F];if(O.type=="perspective")wa=new THREE.Camera(O.fov,O.aspect,O.near,O.far);else if(O.type=="ortho"){wa=new THREE.Camera;wa.projectionMatrix=THREE.Matrix4.makeOrtho(O.left,O.right,O.top,O.bottom,O.near,O.far)}z=O.position;O=O.target;wa.position.set(z[0],
-z[1],z[2]);wa.target.position.set(O[0],O[1],O[2]);aa.cameras[F]=wa}for(A in e.lights){F=e.lights[A];wa=F.color!==undefined?F.color:16777215;O=F.intensity!==undefined?F.intensity:1;if(F.type=="directional"){z=F.direction;light=new THREE.DirectionalLight(wa,O);light.position.set(z[0],z[1],z[2]);light.position.normalize()}else if(F.type=="point"){z=F.position;light=new THREE.PointLight(wa,O);light.position.set(z[0],z[1],z[2])}aa.scene.addLight(light);aa.lights[A]=light}for(G in e.fogs){A=e.fogs[G];if(A.type==
-"linear")sa=new THREE.Fog(0,A.near,A.far);else A.type=="exp2"&&(sa=new THREE.FogExp2(0,A.density));O=A.color;sa.color.setRGB(O[0],O[1],O[2]);aa.fogs[G]=sa}if(aa.cameras&&e.defaults.camera)aa.currentCamera=aa.cameras[e.defaults.camera];if(aa.fogs&&e.defaults.fog)aa.scene.fog=aa.fogs[e.defaults.fog];O=e.defaults.bgcolor;aa.bgColor=new THREE.Color;aa.bgColor.setRGB(O[0],O[1],O[2]);aa.bgColorAlpha=e.defaults.bgalpha;for(w in e.geometries){G=e.geometries[w];if(G.type=="bin_mesh"||G.type=="ascii_mesh")xa+=
-1}Fa=xa;for(w in e.geometries){G=e.geometries[w];if(G.type=="cube"){S=new Cube(G.width,G.height,G.depth,G.segmentsWidth,G.segmentsHeight,G.segmentsDepth,null,G.flipped,G.sides);aa.geometries[w]=S}else if(G.type=="plane"){S=new Plane(G.width,G.height,G.segmentsWidth,G.segmentsHeight);aa.geometries[w]=S}else if(G.type=="sphere"){S=new Sphere(G.radius,G.segmentsWidth,G.segmentsHeight);aa.geometries[w]=S}else if(G.type=="cylinder"){S=new Cylinder(G.numSegs,G.topRad,G.botRad,G.height,G.topOffset,G.botOffset);
-aa.geometries[w]=S}else if(G.type=="torus"){S=new Torus(G.radius,G.tube,G.segmentsR,G.segmentsT);aa.geometries[w]=S}else if(G.type=="icosahedron"){S=new Icosahedron(G.subdivisions);aa.geometries[w]=S}else if(G.type=="bin_mesh")ga.load({model:k(G.url,e.urlBaseType),callback:p(w)});else G.type=="ascii_mesh"&&ea.load({model:k(G.url,e.urlBaseType),callback:p(w)})}for(K in e.textures){w=e.textures[K];Ea+=w.url instanceof Array?w.url.length:1}ra=Ea;for(K in e.textures){w=e.textures[K];if(w.mapping!=undefined&&
-THREE[w.mapping]!=undefined)w.mapping=new THREE[w.mapping];if(w.url instanceof Array){G=[];for(var pa=0;pa<w.url.length;pa++)G[pa]=k(w.url[pa],e.urlBaseType);G=ImageUtils.loadTextureCube(G,w.mapping,j)}else{G=ImageUtils.loadTexture(k(w.url,e.urlBaseType),w.mapping,j);if(THREE[w.minFilter]!=undefined)G.minFilter=THREE[w.minFilter];if(THREE[w.magFilter]!=undefined)G.magFilter=THREE[w.magFilter]}aa.textures[K]=G}for(y in e.materials){K=e.materials[y];for(P in K.parameters)if(P=="envMap"||P=="map"||P==
-"lightMap")K.parameters[P]=aa.textures[K.parameters[P]];else if(P=="shading")K.parameters[P]=K.parameters[P]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(P=="blending")K.parameters[P]=THREE[K.parameters[P]]?THREE[K.parameters[P]]:THREE.NormalBlending;else P=="combine"&&(K.parameters[P]=K.parameters[P]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation);K=new THREE[K.type](K.parameters);aa.materials[y]=K}n();c(aa)}}};
-if(!window.Int32Array){window.Int32Array=Array;window.Float32Array=Array}
+j.setRequestHeader("Content-Type","text/plain");j.send(null)},createBinModel:function(b,c,d,f){var g=function(h){function j(R,aa){var oa=o(R,aa),Ca=o(R,aa+1),ja=o(R,aa+2),ga=o(R,aa+3),m=(ga<<1&255|ja>>7)-127;oa|=(ja&127)<<16|Ca<<8;if(oa==0&&m==-127)return 0;return(1-2*(ga>>7))*(1+oa*Math.pow(2,-23))*Math.pow(2,m)}function k(R,aa){var oa=o(R,aa),Ca=o(R,aa+1),ja=o(R,aa+2);return(o(R,aa+3)<<24)+(ja<<16)+(Ca<<8)+oa}function n(R,aa){var oa=o(R,aa);return(o(R,aa+1)<<8)+oa}function p(R,aa){var oa=o(R,aa);
+return oa>127?oa-256:oa}function o(R,aa){return R.charCodeAt(aa)&255}function w(R){var aa,oa,Ca;aa=k(b,R);oa=k(b,R+S);Ca=k(b,R+xa);R=n(b,R+ra);THREE.BinaryLoader.prototype.f3(L,aa,oa,Ca,R)}function y(R){var aa,oa,Ca,ja,ga,m;aa=k(b,R);oa=k(b,R+S);Ca=k(b,R+xa);ja=n(b,R+ra);ga=k(b,R+pa);m=k(b,R+e);R=k(b,R+fa);THREE.BinaryLoader.prototype.f3n(L,K,aa,oa,Ca,ja,ga,m,R)}function v(R){var aa,oa,Ca,ja;aa=k(b,R);oa=k(b,R+ca);Ca=k(b,R+ya);ja=k(b,R+Fa);R=n(b,R+Ea);THREE.BinaryLoader.prototype.f4(L,aa,oa,Ca,ja,
+R)}function A(R){var aa,oa,Ca,ja,ga,m,C,u;aa=k(b,R);oa=k(b,R+ca);Ca=k(b,R+ya);ja=k(b,R+Fa);ga=n(b,R+Ea);m=k(b,R+Y);C=k(b,R+qa);u=k(b,R+ta);R=k(b,R+va);THREE.BinaryLoader.prototype.f4n(L,K,aa,oa,Ca,ja,ga,m,C,u,R)}function F(R){var aa,oa;aa=k(b,R);oa=k(b,R+ia);R=k(b,R+Z);THREE.BinaryLoader.prototype.uv3(L.faceVertexUvs[0],P[aa*2],P[aa*2+1],P[oa*2],P[oa*2+1],P[R*2],P[R*2+1])}function G(R){var aa,oa,Ca;aa=k(b,R);oa=k(b,R+na);Ca=k(b,R+Ba);R=k(b,R+ka);THREE.BinaryLoader.prototype.uv4(L.faceVertexUvs[0],
+P[aa*2],P[aa*2+1],P[oa*2],P[oa*2+1],P[Ca*2],P[Ca*2+1],P[R*2],P[R*2+1])}var L=this,V=0,z,K=[],P=[],S,xa,ra,pa,e,fa,ca,ya,Fa,Ea,Y,qa,ta,va,ia,Z,na,Ba,ka,la,Da,Sa,$a,Ya,Ta;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(L,f,h);z={signature:b.substr(V,8),header_bytes:o(b,V+8),vertex_coordinate_bytes:o(b,V+9),normal_coordinate_bytes:o(b,V+10),uv_coordinate_bytes:o(b,V+11),vertex_index_bytes:o(b,V+12),normal_index_bytes:o(b,V+13),uv_index_bytes:o(b,V+14),material_index_bytes:o(b,V+15),nvertices:k(b,
+V+16),nnormals:k(b,V+16+4),nuvs:k(b,V+16+8),ntri_flat:k(b,V+16+12),ntri_smooth:k(b,V+16+16),ntri_flat_uv:k(b,V+16+20),ntri_smooth_uv:k(b,V+16+24),nquad_flat:k(b,V+16+28),nquad_smooth:k(b,V+16+32),nquad_flat_uv:k(b,V+16+36),nquad_smooth_uv:k(b,V+16+40)};V+=z.header_bytes;S=z.vertex_index_bytes;xa=z.vertex_index_bytes*2;ra=z.vertex_index_bytes*3;pa=z.vertex_index_bytes*3+z.material_index_bytes;e=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes;fa=z.vertex_index_bytes*3+z.material_index_bytes+
+z.normal_index_bytes*2;ca=z.vertex_index_bytes;ya=z.vertex_index_bytes*2;Fa=z.vertex_index_bytes*3;Ea=z.vertex_index_bytes*4;Y=z.vertex_index_bytes*4+z.material_index_bytes;qa=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes;ta=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes*2;va=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes*3;ia=z.uv_index_bytes;Z=z.uv_index_bytes*2;na=z.uv_index_bytes;Ba=z.uv_index_bytes*2;ka=z.uv_index_bytes*3;h=z.vertex_index_bytes*
+3+z.material_index_bytes;Ta=z.vertex_index_bytes*4+z.material_index_bytes;la=z.ntri_flat*h;Da=z.ntri_smooth*(h+z.normal_index_bytes*3);Sa=z.ntri_flat_uv*(h+z.uv_index_bytes*3);$a=z.ntri_smooth_uv*(h+z.normal_index_bytes*3+z.uv_index_bytes*3);Ya=z.nquad_flat*Ta;h=z.nquad_smooth*(Ta+z.normal_index_bytes*4);Ta=z.nquad_flat_uv*(Ta+z.uv_index_bytes*4);V+=function(R){for(var aa,oa,Ca,ja=z.vertex_coordinate_bytes*3,ga=R+z.nvertices*ja;R<ga;R+=ja){aa=j(b,R);oa=j(b,R+z.vertex_coordinate_bytes);Ca=j(b,R+z.vertex_coordinate_bytes*
+2);THREE.BinaryLoader.prototype.v(L,aa,oa,Ca)}return z.nvertices*ja}(V);V+=function(R){for(var aa,oa,Ca,ja=z.normal_coordinate_bytes*3,ga=R+z.nnormals*ja;R<ga;R+=ja){aa=p(b,R);oa=p(b,R+z.normal_coordinate_bytes);Ca=p(b,R+z.normal_coordinate_bytes*2);K.push(aa/127,oa/127,Ca/127)}return z.nnormals*ja}(V);V+=function(R){for(var aa,oa,Ca=z.uv_coordinate_bytes*2,ja=R+z.nuvs*Ca;R<ja;R+=Ca){aa=j(b,R);oa=j(b,R+z.uv_coordinate_bytes);P.push(aa,oa)}return z.nuvs*Ca}(V);la=V+la;Da=la+Da;Sa=Da+Sa;$a=Sa+$a;Ya=
+$a+Ya;h=Ya+h;Ta=h+Ta;(function(R){var aa,oa=z.vertex_index_bytes*3+z.material_index_bytes,Ca=oa+z.uv_index_bytes*3,ja=R+z.ntri_flat_uv*Ca;for(aa=R;aa<ja;aa+=Ca){w(aa);F(aa+oa)}return ja-R})(Da);(function(R){var aa,oa=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes*3,Ca=oa+z.uv_index_bytes*3,ja=R+z.ntri_smooth_uv*Ca;for(aa=R;aa<ja;aa+=Ca){y(aa);F(aa+oa)}return ja-R})(Sa);(function(R){var aa,oa=z.vertex_index_bytes*4+z.material_index_bytes,Ca=oa+z.uv_index_bytes*4,ja=R+z.nquad_flat_uv*
+Ca;for(aa=R;aa<ja;aa+=Ca){v(aa);G(aa+oa)}return ja-R})(h);(function(R){var aa,oa=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes*4,Ca=oa+z.uv_index_bytes*4,ja=R+z.nquad_smooth_uv*Ca;for(aa=R;aa<ja;aa+=Ca){A(aa);G(aa+oa)}return ja-R})(Ta);(function(R){var aa,oa=z.vertex_index_bytes*3+z.material_index_bytes,Ca=R+z.ntri_flat*oa;for(aa=R;aa<Ca;aa+=oa)w(aa);return Ca-R})(V);(function(R){var aa,oa=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes*3,Ca=R+z.ntri_smooth*
+oa;for(aa=R;aa<Ca;aa+=oa)y(aa);return Ca-R})(la);(function(R){var aa,oa=z.vertex_index_bytes*4+z.material_index_bytes,Ca=R+z.nquad_flat*oa;for(aa=R;aa<Ca;aa+=oa)v(aa);return Ca-R})($a);(function(R){var aa,oa=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes*4,Ca=R+z.nquad_smooth*oa;for(aa=R;aa<Ca;aa+=oa)A(aa);return Ca-R})(Ya);this.computeCentroids();this.computeFaceNormals()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;c(new g(d))},v:function(b,c,d,f){b.vertices.push(new THREE.Vertex(new THREE.Vector3(c,
+d,f)))},f3:function(b,c,d,f,g){b.faces.push(new THREE.Face3(c,d,f,null,null,b.materials[g]))},f4:function(b,c,d,f,g,h){b.faces.push(new THREE.Face4(c,d,f,g,null,null,b.materials[h]))},f3n:function(b,c,d,f,g,h,j,k,n){h=b.materials[h];var p=c[k*3],o=c[k*3+1];k=c[k*3+2];var w=c[n*3],y=c[n*3+1];n=c[n*3+2];b.faces.push(new THREE.Face3(d,f,g,[new THREE.Vector3(c[j*3],c[j*3+1],c[j*3+2]),new THREE.Vector3(p,o,k),new THREE.Vector3(w,y,n)],null,h))},f4n:function(b,c,d,f,g,h,j,k,n,p,o){j=b.materials[j];var w=
+c[n*3],y=c[n*3+1];n=c[n*3+2];var v=c[p*3],A=c[p*3+1];p=c[p*3+2];var F=c[o*3],G=c[o*3+1];o=c[o*3+2];b.faces.push(new THREE.Face4(d,f,g,h,[new THREE.Vector3(c[k*3],c[k*3+1],c[k*3+2]),new THREE.Vector3(w,y,n),new THREE.Vector3(v,A,p),new THREE.Vector3(F,G,o)],null,j))},uv3:function(b,c,d,f,g,h,j){var k=[];k.push(new THREE.UV(c,d));k.push(new THREE.UV(f,g));k.push(new THREE.UV(h,j));b.push(k)},uv4:function(b,c,d,f,g,h,j,k,n){var p=[];p.push(new THREE.UV(c,d));p.push(new THREE.UV(f,g));p.push(new THREE.UV(h,
+j));p.push(new THREE.UV(k,n));b.push(p)}};THREE.SceneLoader=function(){};
+THREE.SceneLoader.prototype={load:function(b,c,d,f){var g=new Worker(b);g.postMessage(0);var h=THREE.Loader.prototype.extractUrlbase(b);g.onmessage=function(j){function k(ia,Z){return Z=="relativeToHTML"?ia:h+"/"+ia}function n(){for(v in e.objects)if(!Y.objects[v]){V=e.objects[v];if(S=Y.geometries[V.geometry]){pa=[];for(va=0;va<V.materials.length;va++)pa[va]=Y.materials[V.materials[va]];z=V.position;r=V.rotation;q=V.quaternion;s=V.scale;q=0;pa.length==0&&(pa[0]=new THREE.MeshFaceMaterial);object=
+new THREE.Mesh(S,pa);object.position.set(z[0],z[1],z[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=V.visible;Y.scene.addObject(object);Y.objects[v]=object}}}function p(ia){return function(Z){Y.geometries[ia]=Z;n();ca-=1;o()}}function o(){f({total_models:Fa,total_textures:Ea,loaded_models:Fa-ca,loaded_textures:Ea-ya},Y);ca==0&&ya==0&&d(Y)}var w,y,v,A,F,G,L,V,z,K,P,S,xa,ra,pa,e,fa,
+ca,ya,Fa,Ea,Y;e=j.data;j=new THREE.BinaryLoader;fa=new THREE.JSONLoader;ya=ca=0;Y={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{}};if(e.transform){var qa=e.transform.position;K=e.transform.rotation;var ta=e.transform.scale;qa&&Y.scene.position.set(qa[0],qa[1],qa[2]);K&&Y.scene.rotation.set(K[0],K[1],K[2]);ta&&Y.scene.scale.set(ta[0],ta[1],ta[2]);(qa||K||ta)&&Y.scene.updateMatrix()}qa=function(){ya-=1;o()};for(F in e.cameras){K=e.cameras[F];if(K.type==
+"perspective")xa=new THREE.Camera(K.fov,K.aspect,K.near,K.far);else if(K.type=="ortho"){xa=new THREE.Camera;xa.projectionMatrix=THREE.Matrix4.makeOrtho(K.left,K.right,K.top,K.bottom,K.near,K.far)}z=K.position;K=K.target;xa.position.set(z[0],z[1],z[2]);xa.target.position.set(K[0],K[1],K[2]);Y.cameras[F]=xa}for(A in e.lights){F=e.lights[A];xa=F.color!==undefined?F.color:16777215;K=F.intensity!==undefined?F.intensity:1;if(F.type=="directional"){z=F.direction;light=new THREE.DirectionalLight(xa,K);light.position.set(z[0],
+z[1],z[2]);light.position.normalize()}else if(F.type=="point"){z=F.position;light=new THREE.PointLight(xa,K);light.position.set(z[0],z[1],z[2])}Y.scene.addLight(light);Y.lights[A]=light}for(G in e.fogs){A=e.fogs[G];if(A.type=="linear")ra=new THREE.Fog(0,A.near,A.far);else A.type=="exp2"&&(ra=new THREE.FogExp2(0,A.density));K=A.color;ra.color.setRGB(K[0],K[1],K[2]);Y.fogs[G]=ra}if(Y.cameras&&e.defaults.camera)Y.currentCamera=Y.cameras[e.defaults.camera];if(Y.fogs&&e.defaults.fog)Y.scene.fog=Y.fogs[e.defaults.fog];
+K=e.defaults.bgcolor;Y.bgColor=new THREE.Color;Y.bgColor.setRGB(K[0],K[1],K[2]);Y.bgColorAlpha=e.defaults.bgalpha;for(w in e.geometries){G=e.geometries[w];if(G.type=="bin_mesh"||G.type=="ascii_mesh")ca+=1}Fa=ca;for(w in e.geometries){G=e.geometries[w];if(G.type=="cube"){S=new Cube(G.width,G.height,G.depth,G.segmentsWidth,G.segmentsHeight,G.segmentsDepth,null,G.flipped,G.sides);Y.geometries[w]=S}else if(G.type=="plane"){S=new Plane(G.width,G.height,G.segmentsWidth,G.segmentsHeight);Y.geometries[w]=
+S}else if(G.type=="sphere"){S=new Sphere(G.radius,G.segmentsWidth,G.segmentsHeight);Y.geometries[w]=S}else if(G.type=="cylinder"){S=new Cylinder(G.numSegs,G.topRad,G.botRad,G.height,G.topOffset,G.botOffset);Y.geometries[w]=S}else if(G.type=="torus"){S=new Torus(G.radius,G.tube,G.segmentsR,G.segmentsT);Y.geometries[w]=S}else if(G.type=="icosahedron"){S=new Icosahedron(G.subdivisions);Y.geometries[w]=S}else if(G.type=="bin_mesh")j.load({model:k(G.url,e.urlBaseType),callback:p(w)});else G.type=="ascii_mesh"&&
+fa.load({model:k(G.url,e.urlBaseType),callback:p(w)})}for(L in e.textures){w=e.textures[L];ya+=w.url instanceof Array?w.url.length:1}Ea=ya;for(L in e.textures){w=e.textures[L];if(w.mapping!=undefined&&THREE[w.mapping]!=undefined)w.mapping=new THREE[w.mapping];if(w.url instanceof Array){G=[];for(var va=0;va<w.url.length;va++)G[va]=k(w.url[va],e.urlBaseType);G=ImageUtils.loadTextureCube(G,w.mapping,qa)}else{G=ImageUtils.loadTexture(k(w.url,e.urlBaseType),w.mapping,qa);if(THREE[w.minFilter]!=undefined)G.minFilter=
+THREE[w.minFilter];if(THREE[w.magFilter]!=undefined)G.magFilter=THREE[w.magFilter]}Y.textures[L]=G}for(y in e.materials){L=e.materials[y];for(P in L.parameters)if(P=="envMap"||P=="map"||P=="lightMap")L.parameters[P]=Y.textures[L.parameters[P]];else if(P=="shading")L.parameters[P]=L.parameters[P]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(P=="blending")L.parameters[P]=THREE[L.parameters[P]]?THREE[L.parameters[P]]:THREE.NormalBlending;else P=="combine"&&(L.parameters[P]=L.parameters[P]==
+"MixOperation"?THREE.MixOperation:THREE.MultiplyOperation);L=new THREE[L.type](L.parameters);Y.materials[y]=L}n();c(Y)}}};if(!window.Int32Array){window.Int32Array=Array;window.Float32Array=Array}
 THREE.MarchingCubes=function(b,c){THREE.Object3D.call(this);this.materials=c instanceof Array?c:[c];this.init=function(d){this.isolation=80;this.size=d;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(d,f,g){return d+(f-d)*g};this.VIntX=function(d,f,g,h,j,k,n,p,o,w){j=(j-o)/(w-o);o=this.normal_cache;f[h]=k+j*this.delta;f[h+1]=n;f[h+2]=p;g[h]=this.lerp(o[d],o[d+3],j);g[h+1]=this.lerp(o[d+1],o[d+4],j);g[h+2]=this.lerp(o[d+2],o[d+5],j)};this.VIntY=function(d,f,g,h,j,k,n,p,o,w){j=(j-o)/(w-o);o=this.normal_cache;f[h]=k;f[h+1]=n+j*this.delta;f[h+
 2]=p;f=d+this.yd*3;g[h]=this.lerp(o[d],o[f],j);g[h+1]=this.lerp(o[d+1],o[f+1],j);g[h+2]=this.lerp(o[d+2],o[f+2],j)};this.VIntZ=function(d,f,g,h,j,k,n,p,o,w){j=(j-o)/(w-o);o=this.normal_cache;f[h]=k;f[h+1]=n;f[h+2]=p+j*this.delta;f=d+this.zd*3;g[h]=this.lerp(o[d],o[f],j);g[h+1]=this.lerp(o[d+1],o[f+1],j);g[h+2]=this.lerp(o[d+2],o[f+2],j)};this.compNorm=function(d){var f=d*3;if(this.normal_cache[f]==0){this.normal_cache[f]=this.field[d-1]-this.field[d+1];this.normal_cache[f+1]=this.field[d-this.yd]-
-this.field[d+this.yd];this.normal_cache[f+2]=this.field[d-this.zd]-this.field[d+this.zd]}};this.polygonize=function(d,f,g,h,j,k){var n=h+1,p=h+this.yd,o=h+this.zd,w=n+this.yd,y=n+this.zd,v=h+this.yd+this.zd,A=n+this.yd+this.zd,F=0,G=this.field[h],K=this.field[n],V=this.field[p],z=this.field[w],O=this.field[o],P=this.field[y],S=this.field[v],wa=this.field[A];G<j&&(F|=1);K<j&&(F|=2);V<j&&(F|=8);z<j&&(F|=4);O<j&&(F|=16);P<j&&(F|=32);S<j&&(F|=128);wa<j&&(F|=64);var sa=THREE.edgeTable[F];if(sa==0)return 0;
-var qa=this.delta,e=d+qa,ga=f+qa;qa=g+qa;if(sa&1){this.compNorm(h);this.compNorm(n);this.VIntX(h*3,this.vlist,this.nlist,0,j,d,f,g,G,K)}if(sa&2){this.compNorm(n);this.compNorm(w);this.VIntY(n*3,this.vlist,this.nlist,3,j,e,f,g,K,z)}if(sa&4){this.compNorm(p);this.compNorm(w);this.VIntX(p*3,this.vlist,this.nlist,6,j,d,ga,g,V,z)}if(sa&8){this.compNorm(h);this.compNorm(p);this.VIntY(h*3,this.vlist,this.nlist,9,j,d,f,g,G,V)}if(sa&16){this.compNorm(o);this.compNorm(y);this.VIntX(o*3,this.vlist,this.nlist,
-12,j,d,f,qa,O,P)}if(sa&32){this.compNorm(y);this.compNorm(A);this.VIntY(y*3,this.vlist,this.nlist,15,j,e,f,qa,P,wa)}if(sa&64){this.compNorm(v);this.compNorm(A);this.VIntX(v*3,this.vlist,this.nlist,18,j,d,ga,qa,S,wa)}if(sa&128){this.compNorm(o);this.compNorm(v);this.VIntY(o*3,this.vlist,this.nlist,21,j,d,f,qa,O,S)}if(sa&256){this.compNorm(h);this.compNorm(o);this.VIntZ(h*3,this.vlist,this.nlist,24,j,d,f,g,G,O)}if(sa&512){this.compNorm(n);this.compNorm(y);this.VIntZ(n*3,this.vlist,this.nlist,27,j,e,
-f,g,K,P)}if(sa&1024){this.compNorm(w);this.compNorm(A);this.VIntZ(w*3,this.vlist,this.nlist,30,j,e,ga,g,z,wa)}if(sa&2048){this.compNorm(p);this.compNorm(v);this.VIntZ(p*3,this.vlist,this.nlist,33,j,d,ga,g,V,S)}F<<=4;for(j=h=0;THREE.triTable[F+j]!=-1;){d=F+j;f=d+1;g=d+2;this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[d],3*THREE.triTable[f],3*THREE.triTable[g],k);j+=3;h++}return h};this.posnormtriv=function(d,f,g,h,j,k){var n=this.count*3;this.positionArray[n]=d[g];this.positionArray[n+1]=d[g+
+this.field[d+this.yd];this.normal_cache[f+2]=this.field[d-this.zd]-this.field[d+this.zd]}};this.polygonize=function(d,f,g,h,j,k){var n=h+1,p=h+this.yd,o=h+this.zd,w=n+this.yd,y=n+this.zd,v=h+this.yd+this.zd,A=n+this.yd+this.zd,F=0,G=this.field[h],L=this.field[n],V=this.field[p],z=this.field[w],K=this.field[o],P=this.field[y],S=this.field[v],xa=this.field[A];G<j&&(F|=1);L<j&&(F|=2);V<j&&(F|=8);z<j&&(F|=4);K<j&&(F|=16);P<j&&(F|=32);S<j&&(F|=128);xa<j&&(F|=64);var ra=THREE.edgeTable[F];if(ra==0)return 0;
+var pa=this.delta,e=d+pa,fa=f+pa;pa=g+pa;if(ra&1){this.compNorm(h);this.compNorm(n);this.VIntX(h*3,this.vlist,this.nlist,0,j,d,f,g,G,L)}if(ra&2){this.compNorm(n);this.compNorm(w);this.VIntY(n*3,this.vlist,this.nlist,3,j,e,f,g,L,z)}if(ra&4){this.compNorm(p);this.compNorm(w);this.VIntX(p*3,this.vlist,this.nlist,6,j,d,fa,g,V,z)}if(ra&8){this.compNorm(h);this.compNorm(p);this.VIntY(h*3,this.vlist,this.nlist,9,j,d,f,g,G,V)}if(ra&16){this.compNorm(o);this.compNorm(y);this.VIntX(o*3,this.vlist,this.nlist,
+12,j,d,f,pa,K,P)}if(ra&32){this.compNorm(y);this.compNorm(A);this.VIntY(y*3,this.vlist,this.nlist,15,j,e,f,pa,P,xa)}if(ra&64){this.compNorm(v);this.compNorm(A);this.VIntX(v*3,this.vlist,this.nlist,18,j,d,fa,pa,S,xa)}if(ra&128){this.compNorm(o);this.compNorm(v);this.VIntY(o*3,this.vlist,this.nlist,21,j,d,f,pa,K,S)}if(ra&256){this.compNorm(h);this.compNorm(o);this.VIntZ(h*3,this.vlist,this.nlist,24,j,d,f,g,G,K)}if(ra&512){this.compNorm(n);this.compNorm(y);this.VIntZ(n*3,this.vlist,this.nlist,27,j,e,
+f,g,L,P)}if(ra&1024){this.compNorm(w);this.compNorm(A);this.VIntZ(w*3,this.vlist,this.nlist,30,j,e,fa,g,z,xa)}if(ra&2048){this.compNorm(p);this.compNorm(v);this.VIntZ(p*3,this.vlist,this.nlist,33,j,d,fa,g,V,S)}F<<=4;for(j=h=0;THREE.triTable[F+j]!=-1;){d=F+j;f=d+1;g=d+2;this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[d],3*THREE.triTable[f],3*THREE.triTable[g],k);j+=3;h++}return h};this.posnormtriv=function(d,f,g,h,j,k){var n=this.count*3;this.positionArray[n]=d[g];this.positionArray[n+1]=d[g+
 1];this.positionArray[n+2]=d[g+2];this.positionArray[n+3]=d[h];this.positionArray[n+4]=d[h+1];this.positionArray[n+5]=d[h+2];this.positionArray[n+6]=d[j];this.positionArray[n+7]=d[j+1];this.positionArray[n+8]=d[j+2];this.normalArray[n]=f[g];this.normalArray[n+1]=f[g+1];this.normalArray[n+2]=f[g+2];this.normalArray[n+3]=f[h];this.normalArray[n+4]=f[h+1];this.normalArray[n+5]=f[h+2];this.normalArray[n+6]=f[j];this.normalArray[n+7]=f[j+1];this.normalArray[n+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(d){if(this.count!=0){for(var f=this.count*3;f<this.positionArray.length;f++)this.positionArray[f]=0;d(this)}};this.addBall=function(d,f,g,h,j){var k=this.size*Math.sqrt(h/j),n=g*this.size,p=f*this.size,o=d*this.size,w=Math.floor(n-k);w<1&&(w=1);n=Math.floor(n+k);n>this.size-1&&(n=this.size-1);var y=Math.floor(p-k);y<1&&(y=1);p=Math.floor(p+k);p>this.size-1&&(p=
-this.size-1);var v=Math.floor(o-k);v<1&&(v=1);k=Math.floor(o+k);k>this.size-1&&(k=this.size-1);for(var A,F,G,K,V,z;w<n;w++){o=this.size2*w;F=w/this.size-g;V=F*F;for(F=y;F<p;F++){G=o+this.size*F;A=F/this.size-f;z=A*A;for(A=v;A<k;A++){K=A/this.size-d;K=h/(1.0E-6+K*K+z+V)-j;K>0&&(this.field[G+A]+=K)}}}};this.addPlaneX=function(d,f){var g,h,j,k,n,p=this.size,o=this.yd,w=this.zd,y=this.field,v=p*Math.sqrt(d/f);v>p&&(v=p);for(g=0;g<v;g++){h=g/p;h*=h;k=d/(1.0E-4+h)-f;if(k>0)for(h=0;h<p;h++){n=g+h*o;for(j=
+this.size-1);var v=Math.floor(o-k);v<1&&(v=1);k=Math.floor(o+k);k>this.size-1&&(k=this.size-1);for(var A,F,G,L,V,z;w<n;w++){o=this.size2*w;F=w/this.size-g;V=F*F;for(F=y;F<p;F++){G=o+this.size*F;A=F/this.size-f;z=A*A;for(A=v;A<k;A++){L=A/this.size-d;L=h/(1.0E-6+L*L+z+V)-j;L>0&&(this.field[G+A]+=L)}}}};this.addPlaneX=function(d,f){var g,h,j,k,n,p=this.size,o=this.yd,w=this.zd,y=this.field,v=p*Math.sqrt(d/f);v>p&&(v=p);for(g=0;g<v;g++){h=g/p;h*=h;k=d/(1.0E-4+h)-f;if(k>0)for(h=0;h<p;h++){n=g+h*o;for(j=
 0;j<p;j++)y[w*j+n]+=k}}};this.addPlaneY=function(d,f){var g,h,j,k,n,p,o=this.size,w=this.yd,y=this.zd,v=this.field,A=o*Math.sqrt(d/f);A>o&&(A=o);for(h=0;h<A;h++){g=h/o;g*=g;k=d/(1.0E-4+g)-f;if(k>0){n=h*w;for(g=0;g<o;g++){p=n+g;for(j=0;j<o;j++)v[y*j+p]+=k}}}};this.addPlaneZ=function(d,f){var g,h,j,k,n,p;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(d/f);dist>size&&(dist=size);for(j=0;j<dist;j++){g=j/size;g*=g;k=d/(1.0E-4+g)-f;if(k>0){n=zd*j;for(h=0;h<size;h++){p=n+h*yd;
 for(g=0;g<size;g++)field[p+g]+=k}}}};this.reset=function(){var d;for(d=0;d<this.size3;d++){this.normal_cache[d*3]=0;this.field[d]=0}};this.render=function(d){this.begin();var f,g,h,j,k,n,p,o,w,y=this.size-2;for(j=1;j<y;j++){w=this.size2*j;p=(j-this.halfsize)/this.halfsize;for(h=1;h<y;h++){o=w+this.size*h;n=(h-this.halfsize)/this.halfsize;for(g=1;g<y;g++){k=(g-this.halfsize)/this.halfsize;f=o+g;this.polygonize(k,n,p,f,this.isolation,d)}}}this.end(d)};this.generateGeometry=function(){var d=0,f=new THREE.Geometry,
 g=[];this.render(function(h){var j,k,n,p,o,w,y,v;for(j=0;j<h.count;j++){y=j*3;o=y+1;v=y+2;k=h.positionArray[y];n=h.positionArray[o];p=h.positionArray[v];w=new THREE.Vector3(k,n,p);k=h.normalArray[y];n=h.normalArray[o];p=h.normalArray[v];y=new THREE.Vector3(k,n,p);y.normalize();o=new THREE.Vertex(w);f.vertices.push(o);g.push(y)}nfaces=h.count/3;for(j=0;j<nfaces;j++){y=(d+j)*3;o=y+1;v=y+2;w=g[y];k=g[o];n=g[v];y=new THREE.Face3(y,o,v,[w,k,n]);f.faces.push(y)}d+=nfaces;h.count=0});return f};this.init(b)};

+ 34 - 33
build/custom/ThreeExtras.js

@@ -24,7 +24,7 @@ this.heightMax?this.heightMax:this.position.y)-this.heightMin)*this.heightCoef:0
 (90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;var c=this.target.position,d=this.position;c.x=d.x+100*Math.sin(this.phi)*Math.cos(this.theta);c.y=d.y+100*Math.cos(this.phi);c.z=d.z+100*Math.sin(this.phi)*Math.sin(this.theta)}this.lon+=this.mouseX*b;this.lookVertical&&(this.lat-=this.mouseY*b);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi=(this.phi-0)*(this.verticalMax-this.verticalMin)/
 3.14+this.verticalMin;c=this.target.position;d=this.position;c.x=d.x+100*Math.sin(this.phi)*Math.cos(this.theta);c.y=d.y+100*Math.cos(this.phi);c.z=d.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",f(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",f(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",f(this,
 this.onMouseUp),!1);this.domElement.addEventListener("keydown",f(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",f(this,this.onKeyUp),!1)};THREE.QuakeCamera.prototype=new THREE.Camera;THREE.QuakeCamera.prototype.constructor=THREE.QuakeCamera;THREE.QuakeCamera.prototype.supr=THREE.Camera.prototype;THREE.QuakeCamera.prototype.translate=function(a,f){this.matrix.rotateAxis(f);if(this.noFly)f.y=0;this.position.addSelf(f.multiplyScalar(a));this.target.position.addSelf(f.multiplyScalar(a))};
-THREE.PathCamera=function(a){function f(l,j,n,p){var t={name:n,fps:0.6,length:p,hierarchy:[]},x,w=j.getControlPointsArray(),u=j.getLength(),B=w.length,y=0;x=B-1;j={parent:-1,keys:[]};j.keys[0]={time:0,pos:w[0],rot:[0,0,0,1],scl:[1,1,1]};j.keys[x]={time:p,pos:w[x],rot:[0,0,0,1],scl:[1,1,1]};for(x=1;x<B-1;x++){y=p*u.chunks[x]/u.total;j.keys[x]={time:y,pos:w[x]}}t.hierarchy[0]=j;THREE.AnimationHandler.add(t);return new THREE.Animation(l,n,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function b(l,j){var n,
+THREE.PathCamera=function(a){function f(l,j,n,p){var t={name:n,fps:0.6,length:p,hierarchy:[]},x,w=j.getControlPointsArray(),u=j.getLength(),B=w.length,z=0;x=B-1;j={parent:-1,keys:[]};j.keys[0]={time:0,pos:w[0],rot:[0,0,0,1],scl:[1,1,1]};j.keys[x]={time:p,pos:w[x],rot:[0,0,0,1],scl:[1,1,1]};for(x=1;x<B-1;x++){z=p*u.chunks[x]/u.total;j.keys[x]={time:z,pos:w[x]}}t.hierarchy[0]=j;THREE.AnimationHandler.add(t);return new THREE.Animation(l,n,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function b(l,j){var n,
 p,t=new THREE.Geometry;for(n=0;n<l.points.length*j;n++){p=n/(l.points.length*j);p=l.getPoint(p);t.vertices[n]=new THREE.Vertex(new THREE.Vector3(p.x,p.y,p.z))}return t}function c(l,j){var n=b(j,10),p=b(j,10),t=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(n,t);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 Sphere(1,
 16,8);t=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<j.points.length;i++){n=new THREE.Mesh(p,t);n.position.copy(j.points[i]);n.updateMatrix();l.addChild(n)}}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=
 !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;
@@ -33,10 +33,10 @@ this.lat=this.mouseY=this.mouseX=0;this.windowHalfX=window.innerWidth/2;this.win
 this.phi=(this.phi-p[0])*(t[1]-t[0])/(p[1]-p[0])+t[0];p=this.horizontalAngleMap.srcRange;t=this.horizontalAngleMap.dstRange;this.theta=(this.theta-p[0])*(t[1]-t[0])/(p[1]-p[0])+t[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,j,n)};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 Cube(10,10,20),k=new Cube(2,2,10);this.animationParent=new THREE.Mesh(h,a);a=new THREE.Mesh(k,g);a.position.set(0,10,0);this.animation=f(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this);this.animationParent.addChild(this.target);this.animationParent.addChild(a)}else{this.animation=
 f(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this.target);this.animationParent.addChild(this)}this.createDebugPath&&c(this.debugPath,this.spline);this.domElement.addEventListener("mousemove",function(l,j){return function(){j.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;
-var Cube=function(a,f,b,c,d,e,g,h,k){function l(u,B,y,m,z,C,G,K){var J,I,E=c||1,L=d||1,R=z/2,P=C/2,N=j.vertices.length;if(u=="x"&&B=="y"||u=="y"&&B=="x")J="z";else if(u=="x"&&B=="z"||u=="z"&&B=="x"){J="y";L=e||1}else if(u=="z"&&B=="y"||u=="y"&&B=="z"){J="x";E=e||1}var O=E+1,S=L+1;z/=E;var F=C/L;for(I=0;I<S;I++)for(C=0;C<O;C++){var M=new THREE.Vector3;M[u]=(C*z-R)*y;M[B]=(I*F-P)*m;M[J]=G;j.vertices.push(new THREE.Vertex(M))}for(I=0;I<L;I++)for(C=0;C<E;C++){j.faces.push(new THREE.Face4(C+O*I+N,C+O*
-(I+1)+N,C+1+O*(I+1)+N,C+1+O*I+N,null,null,K));j.faceVertexUvs[0].push([new THREE.UV(C/E,I/L),new THREE.UV(C/E,(I+1)/L),new THREE.UV((C+1)/E,(I+1)/L),new THREE.UV((C+1)/E,I/L)])}}THREE.Geometry.call(this);var j=this,n=a/2,p=f/2,t=b/2;h=h?-1:1;if(g!==undefined)if(g instanceof Array)this.materials=g;else{this.materials=[];for(var x=0;x<6;x++)this.materials.push([g])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(k!=undefined)for(var w in k)this.sides[w]!=undefined&&(this.sides[w]=
-k[w]);this.sides.px&&l("z","y",1*h,-1,b,f,-n,this.materials[0]);this.sides.nx&&l("z","y",-1*h,-1,b,f,n,this.materials[1]);this.sides.py&&l("x","z",1*h,1,a,b,p,this.materials[2]);this.sides.ny&&l("x","z",1*h,-1,a,b,-p,this.materials[3]);this.sides.pz&&l("x","y",1*h,-1,a,f,t,this.materials[4]);this.sides.nz&&l("x","y",-1*h,-1,a,f,-t,this.materials[5]);(function(){for(var u=[],B=[],y=0,m=j.vertices.length;y<m;y++){for(var z=j.vertices[y],C=!1,G=0,K=u.length;G<K;G++){var J=u[G];if(z.position.x==J.position.x&&
-z.position.y==J.position.y&&z.position.z==J.position.z){B[y]=G;C=!0;break}}if(!C){B[y]=u.length;u.push(new THREE.Vertex(z.position.clone()))}}y=0;for(m=j.faces.length;y<m;y++){z=j.faces[y];z.a=B[z.a];z.b=B[z.b];z.c=B[z.c];z.d=B[z.d]}j.vertices=u})();this.computeCentroids();this.computeFaceNormals()};Cube.prototype=new THREE.Geometry;Cube.prototype.constructor=Cube;
+var Cube=function(a,f,b,c,d,e,g,h,k){function l(u,B,z,m,y,C,G,K){var J,I,E=c||1,L=d||1,P=y/2,Q=C/2,R=j.vertices.length;if(u=="x"&&B=="y"||u=="y"&&B=="x")J="z";else if(u=="x"&&B=="z"||u=="z"&&B=="x"){J="y";L=e||1}else if(u=="z"&&B=="y"||u=="y"&&B=="z"){J="x";E=e||1}var M=E+1,F=L+1;y/=E;var N=C/L;for(I=0;I<F;I++)for(C=0;C<M;C++){var O=new THREE.Vector3;O[u]=(C*y-P)*z;O[B]=(I*N-Q)*m;O[J]=G;j.vertices.push(new THREE.Vertex(O))}for(I=0;I<L;I++)for(C=0;C<E;C++){j.faces.push(new THREE.Face4(C+M*I+R,C+M*
+(I+1)+R,C+1+M*(I+1)+R,C+1+M*I+R,null,null,K));j.faceVertexUvs[0].push([new THREE.UV(C/E,I/L),new THREE.UV(C/E,(I+1)/L),new THREE.UV((C+1)/E,(I+1)/L),new THREE.UV((C+1)/E,I/L)])}}THREE.Geometry.call(this);var j=this,n=a/2,p=f/2,t=b/2;h=h?-1:1;if(g!==undefined)if(g instanceof Array)this.materials=g;else{this.materials=[];for(var x=0;x<6;x++)this.materials.push([g])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(k!=undefined)for(var w in k)this.sides[w]!=undefined&&(this.sides[w]=
+k[w]);this.sides.px&&l("z","y",1*h,-1,b,f,-n,this.materials[0]);this.sides.nx&&l("z","y",-1*h,-1,b,f,n,this.materials[1]);this.sides.py&&l("x","z",1*h,1,a,b,p,this.materials[2]);this.sides.ny&&l("x","z",1*h,-1,a,b,-p,this.materials[3]);this.sides.pz&&l("x","y",1*h,-1,a,f,t,this.materials[4]);this.sides.nz&&l("x","y",-1*h,-1,a,f,-t,this.materials[5]);(function(){for(var u=[],B=[],z=0,m=j.vertices.length;z<m;z++){for(var y=j.vertices[z],C=!1,G=0,K=u.length;G<K;G++){var J=u[G];if(y.position.x==J.position.x&&
+y.position.y==J.position.y&&y.position.z==J.position.z){B[z]=G;C=!0;break}}if(!C){B[z]=u.length;u.push(new THREE.Vertex(y.position.clone()))}}z=0;for(m=j.faces.length;z<m;z++){y=j.faces[z];y.a=B[y.a];y.b=B[y.b];y.c=B[y.c];y.d=B[y.d]}j.vertices=u})();this.computeCentroids();this.computeFaceNormals()};Cube.prototype=new THREE.Geometry;Cube.prototype.constructor=Cube;
 var Cylinder=function(a,f,b,c,d,e){function g(j,n,p){h.vertices.push(new THREE.Vertex(new THREE.Vector3(j,n,p)))}THREE.Geometry.call(this);var h=this,k=Math.PI,l=c/2;for(c=0;c<a;c++)g(Math.sin(2*k*c/a)*f,Math.cos(2*k*c/a)*f,-l);for(c=0;c<a;c++)g(Math.sin(2*k*c/a)*b,Math.cos(2*k*c/a)*b,l);for(c=0;c<a;c++)h.faces.push(new THREE.Face4(c,c+a,a+(c+1)%a,(c+1)%a));if(b>0){g(0,0,-l-(e||0));for(c=a;c<a+a/2;c++)h.faces.push(new THREE.Face4(2*a,(2*c-2*a)%a,(2*c-2*a+1)%a,(2*c-2*a+2)%a))}if(f>0){g(0,0,l+(d||0));
 for(c=a+a/2;c<2*a;c++)h.faces.push(new THREE.Face4(2*a+1,(2*c-2*a+2)%a+a,(2*c-2*a+1)%a+a,(2*c-2*a)%a+a))}this.computeCentroids();this.computeFaceNormals()};Cylinder.prototype=new THREE.Geometry;Cylinder.prototype.constructor=Cylinder;
 var Icosahedron=function(a){function f(n,p,t){var x=Math.sqrt(n*n+p*p+t*t);return d.vertices.push(new THREE.Vertex(new THREE.Vector3(n/x,p/x,t/x)))-1}function b(n,p,t,x){x.faces.push(new THREE.Face3(n,p,t))}function c(n,p){var t=d.vertices[n].position,x=d.vertices[p].position;return f((t.x+x.x)/2,(t.y+x.y)/2,(t.z+x.z)/2)}var d=this,e=new THREE.Geometry,g;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;f(-1,a,0);f(1,a,0);f(-1,-a,0);f(1,-a,0);f(0,-1,a);f(0,1,a);f(0,-1,-a);f(0,
@@ -61,46 +61,47 @@ Math.LN2));h.image.width=j;h.image.height=n;h.image.getContext("2d").drawImage(t
 "Multiply")e.blending=THREE.MultiplyBlending;if(a.transparent!==undefined)e.transparent=a.transparent;if(a.depthTest!==undefined)e.depthTest=a.depthTest;if(a.vertexColors!==undefined)if(a.vertexColors=="face")e.vertexColors=THREE.FaceColors;else if(a.vertexColors)e.vertexColors=THREE.VertexColors;if(a.mapDiffuse&&f){g=document.createElement("canvas");e.map=new THREE.Texture(g);e.map.sourceFile=a.mapDiffuse;c(e.map,f+"/"+a.mapDiffuse)}else if(a.colorDiffuse){g=(a.colorDiffuse[0]*255<<16)+(a.colorDiffuse[1]*
 255<<8)+a.colorDiffuse[2]*255;e.color=g;e.opacity=a.transparency}else if(a.DbgColor)e.color=a.DbgColor;if(a.mapLightmap&&f){g=document.createElement("canvas");e.lightMap=new THREE.Texture(g);e.lightMap.sourceFile=a.mapLightmap;c(e.lightMap,f+"/"+a.mapLightmap)}return new THREE[d](e)}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
 THREE.JSONLoader.prototype.load=function(a){var f=this,b=a.model,c=a.callback,d=a.texture_path?a.texture_path:this.extractUrlbase(b);a=new Worker(b);a.onmessage=function(e){f.createModel(e.data,c,d);f.onLoadComplete()};this.onLoadStart();a.postMessage((new Date).getTime())};
-THREE.JSONLoader.prototype.createModel=function(a,f,b){var c=new THREE.Geometry;this.init_materials(c,a.materials,b);(function(){if(a.version===undefined||a.version!=2)console.error("Deprecated file format.");else{var d,e,g,h,k,l,j,n,p,t,x,w,u,B,y,m=a.faces;t=a.vertices;var z=a.normals,C=a.colors;l=a.scale!==undefined?a.scale:1;var G=0;for(d=0;d<a.uvs.length;d++)a.uvs[d].length&&G++;for(d=0;d<G;d++){c.faceUvs[d]=[];c.faceVertexUvs[d]=[]}h=0;for(k=t.length;h<k;){j=new THREE.Vertex;j.position.x=t[h++]/
-l;j.position.y=t[h++]/l;j.position.z=t[h++]/l;c.vertices.push(j)}h=0;for(k=m.length;h<k;){t=m[h++];l=t&1;g=t&2;d=t&4;e=t&8;n=t&16;j=t&32;x=t&64;t&=128;if(l){w=new THREE.Face4;w.a=m[h++];w.b=m[h++];w.c=m[h++];w.d=m[h++];l=4}else{w=new THREE.Face3;w.a=m[h++];w.b=m[h++];w.c=m[h++];l=3}if(g){g=m[h++];w.materials=c.materials[g]}g=c.faces.length;if(d)for(d=0;d<G;d++){u=a.uvs[d];p=m[h++];y=u[p*2];p=u[p*2+1];c.faceUvs[d][g]=new THREE.UV(y,p)}if(e)for(d=0;d<G;d++){u=a.uvs[d];B=[];for(e=0;e<l;e++){p=m[h++];
-y=u[p*2];p=u[p*2+1];B[e]=new THREE.UV(y,p)}c.faceVertexUvs[d][g]=B}if(n){n=m[h++]*3;e=new THREE.Vector3;e.x=z[n++];e.y=z[n++];e.z=z[n];w.normal=e}if(j)for(d=0;d<l;d++){n=m[h++]*3;e=new THREE.Vector3;e.x=z[n++];e.y=z[n++];e.z=z[n];w.vertexNormals.push(e)}if(x){j=m[h++];j=new THREE.Color(C[j]);w.color=j}if(t)for(d=0;d<l;d++){j=m[h++];j=new THREE.Color(C[j]);w.vertexColors.push(j)}c.faces.push(w)}}})();(function(){var d,e,g,h;if(a.skinWeights){d=0;for(e=a.skinWeights.length;d<e;d+=2){g=a.skinWeights[d];
+THREE.JSONLoader.prototype.createModel=function(a,f,b){var c=new THREE.Geometry;this.init_materials(c,a.materials,b);(function(){if(a.version===undefined||a.version!=2)console.error("Deprecated file format.");else{var d,e,g,h,k,l,j,n,p,t,x,w,u,B,z,m=a.faces;t=a.vertices;var y=a.normals,C=a.colors;l=a.scale!==undefined?a.scale:1;var G=0;for(d=0;d<a.uvs.length;d++)a.uvs[d].length&&G++;for(d=0;d<G;d++){c.faceUvs[d]=[];c.faceVertexUvs[d]=[]}h=0;for(k=t.length;h<k;){j=new THREE.Vertex;j.position.x=t[h++]/
+l;j.position.y=t[h++]/l;j.position.z=t[h++]/l;c.vertices.push(j)}h=0;for(k=m.length;h<k;){t=m[h++];l=t&1;g=t&2;d=t&4;e=t&8;n=t&16;j=t&32;x=t&64;t&=128;if(l){w=new THREE.Face4;w.a=m[h++];w.b=m[h++];w.c=m[h++];w.d=m[h++];l=4}else{w=new THREE.Face3;w.a=m[h++];w.b=m[h++];w.c=m[h++];l=3}if(g){g=m[h++];w.materials=c.materials[g]}g=c.faces.length;if(d)for(d=0;d<G;d++){u=a.uvs[d];p=m[h++];z=u[p*2];p=u[p*2+1];c.faceUvs[d][g]=new THREE.UV(z,p)}if(e)for(d=0;d<G;d++){u=a.uvs[d];B=[];for(e=0;e<l;e++){p=m[h++];
+z=u[p*2];p=u[p*2+1];B[e]=new THREE.UV(z,p)}c.faceVertexUvs[d][g]=B}if(n){n=m[h++]*3;e=new THREE.Vector3;e.x=y[n++];e.y=y[n++];e.z=y[n];w.normal=e}if(j)for(d=0;d<l;d++){n=m[h++]*3;e=new THREE.Vector3;e.x=y[n++];e.y=y[n++];e.z=y[n];w.vertexNormals.push(e)}if(x){j=m[h++];j=new THREE.Color(C[j]);w.color=j}if(t)for(d=0;d<l;d++){j=m[h++];j=new THREE.Color(C[j]);w.vertexColors.push(j)}c.faces.push(w)}}})();(function(){var d,e,g,h;if(a.skinWeights){d=0;for(e=a.skinWeights.length;d<e;d+=2){g=a.skinWeights[d];
 h=a.skinWeights[d+1];c.skinWeights.push(new THREE.Vector4(g,h,0,0))}}if(a.skinIndices){d=0;for(e=a.skinIndices.length;d<e;d+=2){g=a.skinIndices[d];h=a.skinIndices[d+1];c.skinIndices.push(new THREE.Vector4(g,h,0,0))}}c.bones=a.bones;c.animation=a.animation})();(function(){if(a.morphTargets!==undefined){var d,e,g,h,k,l;d=0;for(e=a.morphTargets.length;d<e;d++){c.morphTargets[d]={};c.morphTargets[d].name=a.morphTargets[d].name;c.morphTargets[d].vertices=[];k=c.morphTargets[d].vertices;l=a.morphTargets[d].vertices;
 g=0;for(h=l.length;g<h;g+=3)k.push(new THREE.Vertex(new THREE.Vector3(l[g],l[g+1],l[g+2])))}}if(a.morphColors!==undefined){var j,n;d=0;for(e=a.morphColors.length;d<e;d++){c.morphColors[d]={};c.morphColors[d].name=a.morphColors[d].name;c.morphColors[d].colors=[];l=c.morphColors[d].colors;j=a.morphColors[d].colors;h=0;for(k=j.length;h<k;h+=3){n=new THREE.Color(16755200);n.setRGB(j[g],j[g+1],j[g+2]);l.push(n)}}}})();(function(){if(a.edges!==undefined){var d,e,g;for(d=0;d<a.edges.length;d+=2){e=a.edges[d];
 g=a.edges[d+1];c.edges.push(new THREE.Edge(c.vertices[e],c.vertices[g],e,g))}}})();c.computeCentroids();c.computeFaceNormals();c.computeEdgeFaces();f(c)};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
 THREE.BinaryLoader.prototype={load:function(a){var f=a.model,b=a.callback,c=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(f),d=a.bin_path?a.bin_path:THREE.Loader.prototype.extractUrlbase(f);a=(new Date).getTime();f=new Worker(f);var e=this.showProgress?THREE.Loader.prototype.updateProgress:null;f.onmessage=function(g){THREE.BinaryLoader.prototype.loadAjaxBuffers(g.data.buffers,g.data.materials,b,d,c,e)};f.onerror=function(g){alert("worker.onerror: "+g.message+"\n"+g.data);g.preventDefault()};
 f.postMessage(a)},loadAjaxBuffers:function(a,f,b,c,d,e){var g=new XMLHttpRequest,h=c+"/"+a,k=0;g.onreadystatechange=function(){if(g.readyState==4)g.status==200||g.status==0?THREE.BinaryLoader.prototype.createBinModel(g.responseText,b,d,f):alert("Couldn't load ["+h+"] ["+g.status+"]");else if(g.readyState==3){if(e){k==0&&(k=g.getResponseHeader("Content-Length"));e({total:k,loaded:g.responseText.length})}}else g.readyState==2&&(k=g.getResponseHeader("Content-Length"))};g.open("GET",h,!0);g.overrideMimeType("text/plain; charset=x-user-defined");
-g.setRequestHeader("Content-Type","text/plain");g.send(null)},createBinModel:function(a,f,b,c){var d=function(e){function g(o,v){var A=j(o,v),D=j(o,v+1),H=j(o,v+2),Q=j(o,v+3),T=(Q<<1&255|H>>7)-127;A|=(H&127)<<16|D<<8;if(A==0&&T==-127)return 0;return(1-2*(Q>>7))*(1+A*Math.pow(2,-23))*Math.pow(2,T)}function h(o,v){var A=j(o,v),D=j(o,v+1),H=j(o,v+2);return(j(o,v+3)<<24)+(H<<16)+(D<<8)+A}function k(o,v){var A=j(o,v);return(j(o,v+1)<<8)+A}function l(o,v){var A=j(o,v);return A>127?A-256:A}function j(o,
-v){return o.charCodeAt(v)&255}function n(o){var v,A,D;v=h(a,o);A=h(a,o+G);D=h(a,o+K);o=k(a,o+J);THREE.BinaryLoader.prototype.f3(B,v,A,D,o)}function p(o){var v,A,D,H,Q,T;v=h(a,o);A=h(a,o+G);D=h(a,o+K);H=k(a,o+J);Q=h(a,o+I);T=h(a,o+E);o=h(a,o+L);THREE.BinaryLoader.prototype.f3n(B,z,v,A,D,H,Q,T,o)}function t(o){var v,A,D,H;v=h(a,o);A=h(a,o+R);D=h(a,o+P);H=h(a,o+N);o=k(a,o+O);THREE.BinaryLoader.prototype.f4(B,v,A,D,H,o)}function x(o){var v,A,D,H,Q,T,ba,ca;v=h(a,o);A=h(a,o+R);D=h(a,o+P);H=h(a,o+N);Q=k(a,
-o+O);T=h(a,o+S);ba=h(a,o+F);ca=h(a,o+M);o=h(a,o+V);THREE.BinaryLoader.prototype.f4n(B,z,v,A,D,H,Q,T,ba,ca,o)}function w(o){var v,A;v=h(a,o);A=h(a,o+W);o=h(a,o+da);THREE.BinaryLoader.prototype.uv3(B.faceVertexUvs[0],C[v*2],C[v*2+1],C[A*2],C[A*2+1],C[o*2],C[o*2+1])}function u(o){var v,A,D;v=h(a,o);A=h(a,o+ea);D=h(a,o+fa);o=h(a,o+ga);THREE.BinaryLoader.prototype.uv4(B.faceVertexUvs[0],C[v*2],C[v*2+1],C[A*2],C[A*2+1],C[D*2],C[D*2+1],C[o*2],C[o*2+1])}var B=this,y=0,m,z=[],C=[],G,K,J,I,E,L,R,P,N,O,S,F,
-M,V,W,da,ea,fa,ga,X,Y,Z,$,aa,U;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(B,c,e);m={signature:a.substr(y,8),header_bytes:j(a,y+8),vertex_coordinate_bytes:j(a,y+9),normal_coordinate_bytes:j(a,y+10),uv_coordinate_bytes:j(a,y+11),vertex_index_bytes:j(a,y+12),normal_index_bytes:j(a,y+13),uv_index_bytes:j(a,y+14),material_index_bytes:j(a,y+15),nvertices:h(a,y+16),nnormals:h(a,y+16+4),nuvs:h(a,y+16+8),ntri_flat:h(a,y+16+12),ntri_smooth:h(a,y+16+16),ntri_flat_uv:h(a,y+16+20),ntri_smooth_uv:h(a,
-y+16+24),nquad_flat:h(a,y+16+28),nquad_smooth:h(a,y+16+32),nquad_flat_uv:h(a,y+16+36),nquad_smooth_uv:h(a,y+16+40)};y+=m.header_bytes;G=m.vertex_index_bytes;K=m.vertex_index_bytes*2;J=m.vertex_index_bytes*3;I=m.vertex_index_bytes*3+m.material_index_bytes;E=m.vertex_index_bytes*3+m.material_index_bytes+m.normal_index_bytes;L=m.vertex_index_bytes*3+m.material_index_bytes+m.normal_index_bytes*2;R=m.vertex_index_bytes;P=m.vertex_index_bytes*2;N=m.vertex_index_bytes*3;O=m.vertex_index_bytes*4;S=m.vertex_index_bytes*
-4+m.material_index_bytes;F=m.vertex_index_bytes*4+m.material_index_bytes+m.normal_index_bytes;M=m.vertex_index_bytes*4+m.material_index_bytes+m.normal_index_bytes*2;V=m.vertex_index_bytes*4+m.material_index_bytes+m.normal_index_bytes*3;W=m.uv_index_bytes;da=m.uv_index_bytes*2;ea=m.uv_index_bytes;fa=m.uv_index_bytes*2;ga=m.uv_index_bytes*3;e=m.vertex_index_bytes*3+m.material_index_bytes;U=m.vertex_index_bytes*4+m.material_index_bytes;X=m.ntri_flat*e;Y=m.ntri_smooth*(e+m.normal_index_bytes*3);Z=m.ntri_flat_uv*
-(e+m.uv_index_bytes*3);$=m.ntri_smooth_uv*(e+m.normal_index_bytes*3+m.uv_index_bytes*3);aa=m.nquad_flat*U;e=m.nquad_smooth*(U+m.normal_index_bytes*4);U=m.nquad_flat_uv*(U+m.uv_index_bytes*4);y+=function(o){for(var v,A,D,H=m.vertex_coordinate_bytes*3,Q=o+m.nvertices*H;o<Q;o+=H){v=g(a,o);A=g(a,o+m.vertex_coordinate_bytes);D=g(a,o+m.vertex_coordinate_bytes*2);THREE.BinaryLoader.prototype.v(B,v,A,D)}return m.nvertices*H}(y);y+=function(o){for(var v,A,D,H=m.normal_coordinate_bytes*3,Q=o+m.nnormals*H;o<
-Q;o+=H){v=l(a,o);A=l(a,o+m.normal_coordinate_bytes);D=l(a,o+m.normal_coordinate_bytes*2);z.push(v/127,A/127,D/127)}return m.nnormals*H}(y);y+=function(o){for(var v,A,D=m.uv_coordinate_bytes*2,H=o+m.nuvs*D;o<H;o+=D){v=g(a,o);A=g(a,o+m.uv_coordinate_bytes);C.push(v,A)}return m.nuvs*D}(y);X=y+X;Y=X+Y;Z=Y+Z;$=Z+$;aa=$+aa;e=aa+e;U=e+U;(function(o){var v,A=m.vertex_index_bytes*3+m.material_index_bytes,D=A+m.uv_index_bytes*3,H=o+m.ntri_flat_uv*D;for(v=o;v<H;v+=D){n(v);w(v+A)}return H-o})(Y);(function(o){var v,
-A=m.vertex_index_bytes*3+m.material_index_bytes+m.normal_index_bytes*3,D=A+m.uv_index_bytes*3,H=o+m.ntri_smooth_uv*D;for(v=o;v<H;v+=D){p(v);w(v+A)}return H-o})(Z);(function(o){var v,A=m.vertex_index_bytes*4+m.material_index_bytes,D=A+m.uv_index_bytes*4,H=o+m.nquad_flat_uv*D;for(v=o;v<H;v+=D){t(v);u(v+A)}return H-o})(e);(function(o){var v,A=m.vertex_index_bytes*4+m.material_index_bytes+m.normal_index_bytes*4,D=A+m.uv_index_bytes*4,H=o+m.nquad_smooth_uv*D;for(v=o;v<H;v+=D){x(v);u(v+A)}return H-o})(U);
-(function(o){var v,A=m.vertex_index_bytes*3+m.material_index_bytes,D=o+m.ntri_flat*A;for(v=o;v<D;v+=A)n(v);return D-o})(y);(function(o){var v,A=m.vertex_index_bytes*3+m.material_index_bytes+m.normal_index_bytes*3,D=o+m.ntri_smooth*A;for(v=o;v<D;v+=A)p(v);return D-o})(X);(function(o){var v,A=m.vertex_index_bytes*4+m.material_index_bytes,D=o+m.nquad_flat*A;for(v=o;v<D;v+=A)t(v);return D-o})($);(function(o){var v,A=m.vertex_index_bytes*4+m.material_index_bytes+m.normal_index_bytes*4,D=o+m.nquad_smooth*
-A;for(v=o;v<D;v+=A)x(v);return D-o})(aa);this.computeCentroids();this.computeFaceNormals()};d.prototype=new THREE.Geometry;d.prototype.constructor=d;f(new d(b))},v:function(a,f,b,c){a.vertices.push(new THREE.Vertex(new THREE.Vector3(f,b,c)))},f3:function(a,f,b,c,d){a.faces.push(new THREE.Face3(f,b,c,null,null,a.materials[d]))},f4:function(a,f,b,c,d,e){a.faces.push(new THREE.Face4(f,b,c,d,null,null,a.materials[e]))},f3n:function(a,f,b,c,d,e,g,h,k){e=a.materials[e];var l=f[h*3],j=f[h*3+1];h=f[h*3+2];
+g.setRequestHeader("Content-Type","text/plain");g.send(null)},createBinModel:function(a,f,b,c){var d=function(e){function g(o,v){var A=j(o,v),D=j(o,v+1),H=j(o,v+2),S=j(o,v+3),U=(S<<1&255|H>>7)-127;A|=(H&127)<<16|D<<8;if(A==0&&U==-127)return 0;return(1-2*(S>>7))*(1+A*Math.pow(2,-23))*Math.pow(2,U)}function h(o,v){var A=j(o,v),D=j(o,v+1),H=j(o,v+2);return(j(o,v+3)<<24)+(H<<16)+(D<<8)+A}function k(o,v){var A=j(o,v);return(j(o,v+1)<<8)+A}function l(o,v){var A=j(o,v);return A>127?A-256:A}function j(o,
+v){return o.charCodeAt(v)&255}function n(o){var v,A,D;v=h(a,o);A=h(a,o+G);D=h(a,o+K);o=k(a,o+J);THREE.BinaryLoader.prototype.f3(B,v,A,D,o)}function p(o){var v,A,D,H,S,U;v=h(a,o);A=h(a,o+G);D=h(a,o+K);H=k(a,o+J);S=h(a,o+I);U=h(a,o+E);o=h(a,o+L);THREE.BinaryLoader.prototype.f3n(B,y,v,A,D,H,S,U,o)}function t(o){var v,A,D,H;v=h(a,o);A=h(a,o+P);D=h(a,o+Q);H=h(a,o+R);o=k(a,o+M);THREE.BinaryLoader.prototype.f4(B,v,A,D,H,o)}function x(o){var v,A,D,H,S,U,ca,da;v=h(a,o);A=h(a,o+P);D=h(a,o+Q);H=h(a,o+R);S=k(a,
+o+M);U=h(a,o+F);ca=h(a,o+N);da=h(a,o+O);o=h(a,o+T);THREE.BinaryLoader.prototype.f4n(B,y,v,A,D,H,S,U,ca,da,o)}function w(o){var v,A;v=h(a,o);A=h(a,o+W);o=h(a,o+X);THREE.BinaryLoader.prototype.uv3(B.faceVertexUvs[0],C[v*2],C[v*2+1],C[A*2],C[A*2+1],C[o*2],C[o*2+1])}function u(o){var v,A,D;v=h(a,o);A=h(a,o+ea);D=h(a,o+fa);o=h(a,o+ga);THREE.BinaryLoader.prototype.uv4(B.faceVertexUvs[0],C[v*2],C[v*2+1],C[A*2],C[A*2+1],C[D*2],C[D*2+1],C[o*2],C[o*2+1])}var B=this,z=0,m,y=[],C=[],G,K,J,I,E,L,P,Q,R,M,F,N,O,
+T,W,X,ea,fa,ga,Y,Z,$,aa,ba,V;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(B,c,e);m={signature:a.substr(z,8),header_bytes:j(a,z+8),vertex_coordinate_bytes:j(a,z+9),normal_coordinate_bytes:j(a,z+10),uv_coordinate_bytes:j(a,z+11),vertex_index_bytes:j(a,z+12),normal_index_bytes:j(a,z+13),uv_index_bytes:j(a,z+14),material_index_bytes:j(a,z+15),nvertices:h(a,z+16),nnormals:h(a,z+16+4),nuvs:h(a,z+16+8),ntri_flat:h(a,z+16+12),ntri_smooth:h(a,z+16+16),ntri_flat_uv:h(a,z+16+20),ntri_smooth_uv:h(a,
+z+16+24),nquad_flat:h(a,z+16+28),nquad_smooth:h(a,z+16+32),nquad_flat_uv:h(a,z+16+36),nquad_smooth_uv:h(a,z+16+40)};z+=m.header_bytes;G=m.vertex_index_bytes;K=m.vertex_index_bytes*2;J=m.vertex_index_bytes*3;I=m.vertex_index_bytes*3+m.material_index_bytes;E=m.vertex_index_bytes*3+m.material_index_bytes+m.normal_index_bytes;L=m.vertex_index_bytes*3+m.material_index_bytes+m.normal_index_bytes*2;P=m.vertex_index_bytes;Q=m.vertex_index_bytes*2;R=m.vertex_index_bytes*3;M=m.vertex_index_bytes*4;F=m.vertex_index_bytes*
+4+m.material_index_bytes;N=m.vertex_index_bytes*4+m.material_index_bytes+m.normal_index_bytes;O=m.vertex_index_bytes*4+m.material_index_bytes+m.normal_index_bytes*2;T=m.vertex_index_bytes*4+m.material_index_bytes+m.normal_index_bytes*3;W=m.uv_index_bytes;X=m.uv_index_bytes*2;ea=m.uv_index_bytes;fa=m.uv_index_bytes*2;ga=m.uv_index_bytes*3;e=m.vertex_index_bytes*3+m.material_index_bytes;V=m.vertex_index_bytes*4+m.material_index_bytes;Y=m.ntri_flat*e;Z=m.ntri_smooth*(e+m.normal_index_bytes*3);$=m.ntri_flat_uv*
+(e+m.uv_index_bytes*3);aa=m.ntri_smooth_uv*(e+m.normal_index_bytes*3+m.uv_index_bytes*3);ba=m.nquad_flat*V;e=m.nquad_smooth*(V+m.normal_index_bytes*4);V=m.nquad_flat_uv*(V+m.uv_index_bytes*4);z+=function(o){for(var v,A,D,H=m.vertex_coordinate_bytes*3,S=o+m.nvertices*H;o<S;o+=H){v=g(a,o);A=g(a,o+m.vertex_coordinate_bytes);D=g(a,o+m.vertex_coordinate_bytes*2);THREE.BinaryLoader.prototype.v(B,v,A,D)}return m.nvertices*H}(z);z+=function(o){for(var v,A,D,H=m.normal_coordinate_bytes*3,S=o+m.nnormals*H;o<
+S;o+=H){v=l(a,o);A=l(a,o+m.normal_coordinate_bytes);D=l(a,o+m.normal_coordinate_bytes*2);y.push(v/127,A/127,D/127)}return m.nnormals*H}(z);z+=function(o){for(var v,A,D=m.uv_coordinate_bytes*2,H=o+m.nuvs*D;o<H;o+=D){v=g(a,o);A=g(a,o+m.uv_coordinate_bytes);C.push(v,A)}return m.nuvs*D}(z);Y=z+Y;Z=Y+Z;$=Z+$;aa=$+aa;ba=aa+ba;e=ba+e;V=e+V;(function(o){var v,A=m.vertex_index_bytes*3+m.material_index_bytes,D=A+m.uv_index_bytes*3,H=o+m.ntri_flat_uv*D;for(v=o;v<H;v+=D){n(v);w(v+A)}return H-o})(Z);(function(o){var v,
+A=m.vertex_index_bytes*3+m.material_index_bytes+m.normal_index_bytes*3,D=A+m.uv_index_bytes*3,H=o+m.ntri_smooth_uv*D;for(v=o;v<H;v+=D){p(v);w(v+A)}return H-o})($);(function(o){var v,A=m.vertex_index_bytes*4+m.material_index_bytes,D=A+m.uv_index_bytes*4,H=o+m.nquad_flat_uv*D;for(v=o;v<H;v+=D){t(v);u(v+A)}return H-o})(e);(function(o){var v,A=m.vertex_index_bytes*4+m.material_index_bytes+m.normal_index_bytes*4,D=A+m.uv_index_bytes*4,H=o+m.nquad_smooth_uv*D;for(v=o;v<H;v+=D){x(v);u(v+A)}return H-o})(V);
+(function(o){var v,A=m.vertex_index_bytes*3+m.material_index_bytes,D=o+m.ntri_flat*A;for(v=o;v<D;v+=A)n(v);return D-o})(z);(function(o){var v,A=m.vertex_index_bytes*3+m.material_index_bytes+m.normal_index_bytes*3,D=o+m.ntri_smooth*A;for(v=o;v<D;v+=A)p(v);return D-o})(Y);(function(o){var v,A=m.vertex_index_bytes*4+m.material_index_bytes,D=o+m.nquad_flat*A;for(v=o;v<D;v+=A)t(v);return D-o})(aa);(function(o){var v,A=m.vertex_index_bytes*4+m.material_index_bytes+m.normal_index_bytes*4,D=o+m.nquad_smooth*
+A;for(v=o;v<D;v+=A)x(v);return D-o})(ba);this.computeCentroids();this.computeFaceNormals()};d.prototype=new THREE.Geometry;d.prototype.constructor=d;f(new d(b))},v:function(a,f,b,c){a.vertices.push(new THREE.Vertex(new THREE.Vector3(f,b,c)))},f3:function(a,f,b,c,d){a.faces.push(new THREE.Face3(f,b,c,null,null,a.materials[d]))},f4:function(a,f,b,c,d,e){a.faces.push(new THREE.Face4(f,b,c,d,null,null,a.materials[e]))},f3n:function(a,f,b,c,d,e,g,h,k){e=a.materials[e];var l=f[h*3],j=f[h*3+1];h=f[h*3+2];
 var n=f[k*3],p=f[k*3+1];k=f[k*3+2];a.faces.push(new THREE.Face3(b,c,d,[new THREE.Vector3(f[g*3],f[g*3+1],f[g*3+2]),new THREE.Vector3(l,j,h),new THREE.Vector3(n,p,k)],null,e))},f4n:function(a,f,b,c,d,e,g,h,k,l,j){g=a.materials[g];var n=f[k*3],p=f[k*3+1];k=f[k*3+2];var t=f[l*3],x=f[l*3+1];l=f[l*3+2];var w=f[j*3],u=f[j*3+1];j=f[j*3+2];a.faces.push(new THREE.Face4(b,c,d,e,[new THREE.Vector3(f[h*3],f[h*3+1],f[h*3+2]),new THREE.Vector3(n,p,k),new THREE.Vector3(t,x,l),new THREE.Vector3(w,u,j)],null,g))},
 uv3:function(a,f,b,c,d,e,g){var h=[];h.push(new THREE.UV(f,b));h.push(new THREE.UV(c,d));h.push(new THREE.UV(e,g));a.push(h)},uv4:function(a,f,b,c,d,e,g,h,k){var l=[];l.push(new THREE.UV(f,b));l.push(new THREE.UV(c,d));l.push(new THREE.UV(e,g));l.push(new THREE.UV(h,k));a.push(l)}};THREE.SceneLoader=function(){};
-THREE.SceneLoader.prototype={load:function(a,f,b,c){var d=new Worker(a);d.postMessage(0);var e=THREE.Loader.prototype.extractUrlbase(a);d.onmessage=function(g){function h(V,W){return W=="relativeToHTML"?V:e+"/"+V}function k(){for(t in E.objects)if(!F.objects[t]){y=E.objects[t];if(G=F.geometries[y.geometry]){I=[];for(M=0;M<y.materials.length;M++)I[M]=F.materials[y.materials[M]];m=y.position;r=y.rotation;q=y.quaternion;s=y.scale;q=0;I.length==0&&(I[0]=new THREE.MeshFaceMaterial);object=new THREE.Mesh(G,
-I);object.position.set(m[0],m[1],m[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=y.visible;F.scene.addObject(object);F.objects[t]=object}}}function l(V){return function(W){F.geometries[V]=W;k();P-=1;j()}}function j(){c({total_models:O,total_textures:S,loaded_models:O-P,loaded_textures:S-N},F);P==0&&N==0&&b(F)}var n,p,t,x,w,u,B,y,m,z,C,G,K,J,I,E,L,R,P,N,O,S,F;E=g.data;L=new THREE.BinaryLoader;
-R=new THREE.JSONLoader;N=P=0;F={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{}};g=function(){N-=1;j()};for(w in E.cameras){z=E.cameras[w];if(z.type=="perspective")K=new THREE.Camera(z.fov,z.aspect,z.near,z.far);else if(z.type=="ortho"){K=new THREE.Camera;K.projectionMatrix=THREE.Matrix4.makeOrtho(z.left,z.right,z.top,z.bottom,z.near,z.far)}m=z.position;z=z.target;K.position.set(m[0],m[1],m[2]);K.target.position.set(z[0],z[1],z[2]);F.cameras[w]=
-K}for(x in E.lights){w=E.lights[x];K=w.color!==undefined?w.color:16777215;z=w.intensity!==undefined?w.intensity:1;if(w.type=="directional"){m=w.direction;light=new THREE.DirectionalLight(K,z);light.position.set(m[0],m[1],m[2]);light.position.normalize()}else if(w.type=="point"){m=w.position;light=new THREE.PointLight(K,z);light.position.set(m[0],m[1],m[2])}F.scene.addLight(light);F.lights[x]=light}for(u in E.fogs){x=E.fogs[u];if(x.type=="linear")J=new THREE.Fog(0,x.near,x.far);else x.type=="exp2"&&
-(J=new THREE.FogExp2(0,x.density));z=x.color;J.color.setRGB(z[0],z[1],z[2]);F.fogs[u]=J}if(F.cameras&&E.defaults.camera)F.currentCamera=F.cameras[E.defaults.camera];if(F.fogs&&E.defaults.fog)F.scene.fog=F.fogs[E.defaults.fog];z=E.defaults.bgcolor;F.bgColor=new THREE.Color;F.bgColor.setRGB(z[0],z[1],z[2]);F.bgColorAlpha=E.defaults.bgalpha;for(n in E.geometries){u=E.geometries[n];if(u.type=="bin_mesh"||u.type=="ascii_mesh")P+=1}O=P;for(n in E.geometries){u=E.geometries[n];if(u.type=="cube"){G=new Cube(u.width,
-u.height,u.depth,u.segmentsWidth,u.segmentsHeight,u.segmentsDepth,null,u.flipped,u.sides);F.geometries[n]=G}else if(u.type=="plane"){G=new Plane(u.width,u.height,u.segmentsWidth,u.segmentsHeight);F.geometries[n]=G}else if(u.type=="sphere"){G=new Sphere(u.radius,u.segmentsWidth,u.segmentsHeight);F.geometries[n]=G}else if(u.type=="cylinder"){G=new Cylinder(u.numSegs,u.topRad,u.botRad,u.height,u.topOffset,u.botOffset);F.geometries[n]=G}else if(u.type=="torus"){G=new Torus(u.radius,u.tube,u.segmentsR,
-u.segmentsT);F.geometries[n]=G}else if(u.type=="icosahedron"){G=new Icosahedron(u.subdivisions);F.geometries[n]=G}else if(u.type=="bin_mesh")L.load({model:h(u.url,E.urlBaseType),callback:l(n)});else u.type=="ascii_mesh"&&R.load({model:h(u.url,E.urlBaseType),callback:l(n)})}for(B in E.textures){n=E.textures[B];N+=n.url instanceof Array?n.url.length:1}S=N;for(B in E.textures){n=E.textures[B];if(n.mapping!=undefined&&THREE[n.mapping]!=undefined)n.mapping=new THREE[n.mapping];if(n.url instanceof Array){u=
-[];for(var M=0;M<n.url.length;M++)u[M]=h(n.url[M],E.urlBaseType);u=ImageUtils.loadTextureCube(u,n.mapping,g)}else{u=ImageUtils.loadTexture(h(n.url,E.urlBaseType),n.mapping,g);if(THREE[n.minFilter]!=undefined)u.minFilter=THREE[n.minFilter];if(THREE[n.magFilter]!=undefined)u.magFilter=THREE[n.magFilter]}F.textures[B]=u}for(p in E.materials){B=E.materials[p];for(C in B.parameters)if(C=="envMap"||C=="map"||C=="lightMap")B.parameters[C]=F.textures[B.parameters[C]];else if(C=="shading")B.parameters[C]=
-B.parameters[C]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(C=="blending")B.parameters[C]=THREE[B.parameters[C]]?THREE[B.parameters[C]]:THREE.NormalBlending;else C=="combine"&&(B.parameters[C]=B.parameters[C]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation);B=new THREE[B.type](B.parameters);F.materials[p]=B}k();f(F)}}};if(!window.Int32Array){window.Int32Array=Array;window.Float32Array=Array}
+THREE.SceneLoader.prototype={load:function(a,f,b,c){var d=new Worker(a);d.postMessage(0);var e=THREE.Loader.prototype.extractUrlbase(a);d.onmessage=function(g){function h(W,X){return X=="relativeToHTML"?W:e+"/"+W}function k(){for(t in E.objects)if(!F.objects[t]){z=E.objects[t];if(G=F.geometries[z.geometry]){I=[];for(T=0;T<z.materials.length;T++)I[T]=F.materials[z.materials[T]];m=z.position;r=z.rotation;q=z.quaternion;s=z.scale;q=0;I.length==0&&(I[0]=new THREE.MeshFaceMaterial);object=new THREE.Mesh(G,
+I);object.position.set(m[0],m[1],m[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=z.visible;F.scene.addObject(object);F.objects[t]=object}}}function l(W){return function(X){F.geometries[W]=X;k();P-=1;j()}}function j(){c({total_models:R,total_textures:M,loaded_models:R-P,loaded_textures:M-Q},F);P==0&&Q==0&&b(F)}var n,p,t,x,w,u,B,z,m,y,C,G,K,J,I,E,L,P,Q,R,M,F;E=g.data;g=new THREE.BinaryLoader;
+L=new THREE.JSONLoader;Q=P=0;F={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{}};if(E.transform){var N=E.transform.position;y=E.transform.rotation;var O=E.transform.scale;N&&F.scene.position.set(N[0],N[1],N[2]);y&&F.scene.rotation.set(y[0],y[1],y[2]);O&&F.scene.scale.set(O[0],O[1],O[2]);(N||y||O)&&F.scene.updateMatrix()}N=function(){Q-=1;j()};for(w in E.cameras){y=E.cameras[w];if(y.type=="perspective")K=new THREE.Camera(y.fov,y.aspect,y.near,y.far);
+else if(y.type=="ortho"){K=new THREE.Camera;K.projectionMatrix=THREE.Matrix4.makeOrtho(y.left,y.right,y.top,y.bottom,y.near,y.far)}m=y.position;y=y.target;K.position.set(m[0],m[1],m[2]);K.target.position.set(y[0],y[1],y[2]);F.cameras[w]=K}for(x in E.lights){w=E.lights[x];K=w.color!==undefined?w.color:16777215;y=w.intensity!==undefined?w.intensity:1;if(w.type=="directional"){m=w.direction;light=new THREE.DirectionalLight(K,y);light.position.set(m[0],m[1],m[2]);light.position.normalize()}else if(w.type==
+"point"){m=w.position;light=new THREE.PointLight(K,y);light.position.set(m[0],m[1],m[2])}F.scene.addLight(light);F.lights[x]=light}for(u in E.fogs){x=E.fogs[u];if(x.type=="linear")J=new THREE.Fog(0,x.near,x.far);else x.type=="exp2"&&(J=new THREE.FogExp2(0,x.density));y=x.color;J.color.setRGB(y[0],y[1],y[2]);F.fogs[u]=J}if(F.cameras&&E.defaults.camera)F.currentCamera=F.cameras[E.defaults.camera];if(F.fogs&&E.defaults.fog)F.scene.fog=F.fogs[E.defaults.fog];y=E.defaults.bgcolor;F.bgColor=new THREE.Color;
+F.bgColor.setRGB(y[0],y[1],y[2]);F.bgColorAlpha=E.defaults.bgalpha;for(n in E.geometries){u=E.geometries[n];if(u.type=="bin_mesh"||u.type=="ascii_mesh")P+=1}R=P;for(n in E.geometries){u=E.geometries[n];if(u.type=="cube"){G=new Cube(u.width,u.height,u.depth,u.segmentsWidth,u.segmentsHeight,u.segmentsDepth,null,u.flipped,u.sides);F.geometries[n]=G}else if(u.type=="plane"){G=new Plane(u.width,u.height,u.segmentsWidth,u.segmentsHeight);F.geometries[n]=G}else if(u.type=="sphere"){G=new Sphere(u.radius,
+u.segmentsWidth,u.segmentsHeight);F.geometries[n]=G}else if(u.type=="cylinder"){G=new Cylinder(u.numSegs,u.topRad,u.botRad,u.height,u.topOffset,u.botOffset);F.geometries[n]=G}else if(u.type=="torus"){G=new Torus(u.radius,u.tube,u.segmentsR,u.segmentsT);F.geometries[n]=G}else if(u.type=="icosahedron"){G=new Icosahedron(u.subdivisions);F.geometries[n]=G}else if(u.type=="bin_mesh")g.load({model:h(u.url,E.urlBaseType),callback:l(n)});else u.type=="ascii_mesh"&&L.load({model:h(u.url,E.urlBaseType),callback:l(n)})}for(B in E.textures){n=
+E.textures[B];Q+=n.url instanceof Array?n.url.length:1}M=Q;for(B in E.textures){n=E.textures[B];if(n.mapping!=undefined&&THREE[n.mapping]!=undefined)n.mapping=new THREE[n.mapping];if(n.url instanceof Array){u=[];for(var T=0;T<n.url.length;T++)u[T]=h(n.url[T],E.urlBaseType);u=ImageUtils.loadTextureCube(u,n.mapping,N)}else{u=ImageUtils.loadTexture(h(n.url,E.urlBaseType),n.mapping,N);if(THREE[n.minFilter]!=undefined)u.minFilter=THREE[n.minFilter];if(THREE[n.magFilter]!=undefined)u.magFilter=THREE[n.magFilter]}F.textures[B]=
+u}for(p in E.materials){B=E.materials[p];for(C in B.parameters)if(C=="envMap"||C=="map"||C=="lightMap")B.parameters[C]=F.textures[B.parameters[C]];else if(C=="shading")B.parameters[C]=B.parameters[C]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(C=="blending")B.parameters[C]=THREE[B.parameters[C]]?THREE[B.parameters[C]]:THREE.NormalBlending;else C=="combine"&&(B.parameters[C]=B.parameters[C]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation);B=new THREE[B.type](B.parameters);F.materials[p]=
+B}k();f(F)}}};if(!window.Int32Array){window.Int32Array=Array;window.Float32Array=Array}
 THREE.MarchingCubes=function(a,f){THREE.Object3D.call(this);this.materials=f instanceof Array?f:[f];this.init=function(b){this.isolation=80;this.size=b;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(b,c,d){return b+(c-b)*d};this.VIntX=function(b,c,d,e,g,h,k,l,j,n){g=(g-j)/(n-j);j=this.normal_cache;c[e]=h+g*this.delta;c[e+1]=k;c[e+2]=l;d[e]=this.lerp(j[b],j[b+3],g);d[e+1]=this.lerp(j[b+1],j[b+4],g);d[e+2]=this.lerp(j[b+2],j[b+5],g)};this.VIntY=function(b,c,d,e,g,h,k,l,j,n){g=(g-j)/(n-j);j=this.normal_cache;c[e]=h;c[e+1]=k+g*this.delta;c[e+
 2]=l;c=b+this.yd*3;d[e]=this.lerp(j[b],j[c],g);d[e+1]=this.lerp(j[b+1],j[c+1],g);d[e+2]=this.lerp(j[b+2],j[c+2],g)};this.VIntZ=function(b,c,d,e,g,h,k,l,j,n){g=(g-j)/(n-j);j=this.normal_cache;c[e]=h;c[e+1]=k;c[e+2]=l+g*this.delta;c=b+this.zd*3;d[e]=this.lerp(j[b],j[c],g);d[e+1]=this.lerp(j[b+1],j[c+1],g);d[e+2]=this.lerp(j[b+2],j[c+2],g)};this.compNorm=function(b){var c=b*3;if(this.normal_cache[c]==0){this.normal_cache[c]=this.field[b-1]-this.field[b+1];this.normal_cache[c+1]=this.field[b-this.yd]-
-this.field[b+this.yd];this.normal_cache[c+2]=this.field[b-this.zd]-this.field[b+this.zd]}};this.polygonize=function(b,c,d,e,g,h){var k=e+1,l=e+this.yd,j=e+this.zd,n=k+this.yd,p=k+this.zd,t=e+this.yd+this.zd,x=k+this.yd+this.zd,w=0,u=this.field[e],B=this.field[k],y=this.field[l],m=this.field[n],z=this.field[j],C=this.field[p],G=this.field[t],K=this.field[x];u<g&&(w|=1);B<g&&(w|=2);y<g&&(w|=8);m<g&&(w|=4);z<g&&(w|=16);C<g&&(w|=32);G<g&&(w|=128);K<g&&(w|=64);var J=THREE.edgeTable[w];if(J==0)return 0;
-var I=this.delta,E=b+I,L=c+I;I=d+I;if(J&1){this.compNorm(e);this.compNorm(k);this.VIntX(e*3,this.vlist,this.nlist,0,g,b,c,d,u,B)}if(J&2){this.compNorm(k);this.compNorm(n);this.VIntY(k*3,this.vlist,this.nlist,3,g,E,c,d,B,m)}if(J&4){this.compNorm(l);this.compNorm(n);this.VIntX(l*3,this.vlist,this.nlist,6,g,b,L,d,y,m)}if(J&8){this.compNorm(e);this.compNorm(l);this.VIntY(e*3,this.vlist,this.nlist,9,g,b,c,d,u,y)}if(J&16){this.compNorm(j);this.compNorm(p);this.VIntX(j*3,this.vlist,this.nlist,12,g,b,c,I,
-z,C)}if(J&32){this.compNorm(p);this.compNorm(x);this.VIntY(p*3,this.vlist,this.nlist,15,g,E,c,I,C,K)}if(J&64){this.compNorm(t);this.compNorm(x);this.VIntX(t*3,this.vlist,this.nlist,18,g,b,L,I,G,K)}if(J&128){this.compNorm(j);this.compNorm(t);this.VIntY(j*3,this.vlist,this.nlist,21,g,b,c,I,z,G)}if(J&256){this.compNorm(e);this.compNorm(j);this.VIntZ(e*3,this.vlist,this.nlist,24,g,b,c,d,u,z)}if(J&512){this.compNorm(k);this.compNorm(p);this.VIntZ(k*3,this.vlist,this.nlist,27,g,E,c,d,B,C)}if(J&1024){this.compNorm(n);
-this.compNorm(x);this.VIntZ(n*3,this.vlist,this.nlist,30,g,E,L,d,m,K)}if(J&2048){this.compNorm(l);this.compNorm(t);this.VIntZ(l*3,this.vlist,this.nlist,33,g,b,L,d,y,G)}w<<=4;for(g=e=0;THREE.triTable[w+g]!=-1;){b=w+g;c=b+1;d=b+2;this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[c],3*THREE.triTable[d],h);g+=3;e++}return e};this.posnormtriv=function(b,c,d,e,g,h){var k=this.count*3;this.positionArray[k]=b[d];this.positionArray[k+1]=b[d+1];this.positionArray[k+2]=b[d+2];this.positionArray[k+
+this.field[b+this.yd];this.normal_cache[c+2]=this.field[b-this.zd]-this.field[b+this.zd]}};this.polygonize=function(b,c,d,e,g,h){var k=e+1,l=e+this.yd,j=e+this.zd,n=k+this.yd,p=k+this.zd,t=e+this.yd+this.zd,x=k+this.yd+this.zd,w=0,u=this.field[e],B=this.field[k],z=this.field[l],m=this.field[n],y=this.field[j],C=this.field[p],G=this.field[t],K=this.field[x];u<g&&(w|=1);B<g&&(w|=2);z<g&&(w|=8);m<g&&(w|=4);y<g&&(w|=16);C<g&&(w|=32);G<g&&(w|=128);K<g&&(w|=64);var J=THREE.edgeTable[w];if(J==0)return 0;
+var I=this.delta,E=b+I,L=c+I;I=d+I;if(J&1){this.compNorm(e);this.compNorm(k);this.VIntX(e*3,this.vlist,this.nlist,0,g,b,c,d,u,B)}if(J&2){this.compNorm(k);this.compNorm(n);this.VIntY(k*3,this.vlist,this.nlist,3,g,E,c,d,B,m)}if(J&4){this.compNorm(l);this.compNorm(n);this.VIntX(l*3,this.vlist,this.nlist,6,g,b,L,d,z,m)}if(J&8){this.compNorm(e);this.compNorm(l);this.VIntY(e*3,this.vlist,this.nlist,9,g,b,c,d,u,z)}if(J&16){this.compNorm(j);this.compNorm(p);this.VIntX(j*3,this.vlist,this.nlist,12,g,b,c,I,
+y,C)}if(J&32){this.compNorm(p);this.compNorm(x);this.VIntY(p*3,this.vlist,this.nlist,15,g,E,c,I,C,K)}if(J&64){this.compNorm(t);this.compNorm(x);this.VIntX(t*3,this.vlist,this.nlist,18,g,b,L,I,G,K)}if(J&128){this.compNorm(j);this.compNorm(t);this.VIntY(j*3,this.vlist,this.nlist,21,g,b,c,I,y,G)}if(J&256){this.compNorm(e);this.compNorm(j);this.VIntZ(e*3,this.vlist,this.nlist,24,g,b,c,d,u,y)}if(J&512){this.compNorm(k);this.compNorm(p);this.VIntZ(k*3,this.vlist,this.nlist,27,g,E,c,d,B,C)}if(J&1024){this.compNorm(n);
+this.compNorm(x);this.VIntZ(n*3,this.vlist,this.nlist,30,g,E,L,d,m,K)}if(J&2048){this.compNorm(l);this.compNorm(t);this.VIntZ(l*3,this.vlist,this.nlist,33,g,b,L,d,z,G)}w<<=4;for(g=e=0;THREE.triTable[w+g]!=-1;){b=w+g;c=b+1;d=b+2;this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[c],3*THREE.triTable[d],h);g+=3;e++}return e};this.posnormtriv=function(b,c,d,e,g,h){var k=this.count*3;this.positionArray[k]=b[d];this.positionArray[k+1]=b[d+1];this.positionArray[k+2]=b[d+2];this.positionArray[k+
 3]=b[e];this.positionArray[k+4]=b[e+1];this.positionArray[k+5]=b[e+2];this.positionArray[k+6]=b[g];this.positionArray[k+7]=b[g+1];this.positionArray[k+8]=b[g+2];this.normalArray[k]=c[d];this.normalArray[k+1]=c[d+1];this.normalArray[k+2]=c[d+2];this.normalArray[k+3]=c[e];this.normalArray[k+4]=c[e+1];this.normalArray[k+5]=c[e+2];this.normalArray[k+6]=c[g];this.normalArray[k+7]=c[g+1];this.normalArray[k+8]=c[g+2];this.hasPos=!0;this.hasNormal=!0;this.count+=3;this.count>=this.maxCount-3&&h(this)};this.begin=
 function(){this.count=0;this.hasPos=!1;this.hasNormal=!1};this.end=function(b){if(this.count!=0){for(var c=this.count*3;c<this.positionArray.length;c++)this.positionArray[c]=0;b(this)}};this.addBall=function(b,c,d,e,g){var h=this.size*Math.sqrt(e/g),k=d*this.size,l=c*this.size,j=b*this.size,n=Math.floor(k-h);n<1&&(n=1);k=Math.floor(k+h);k>this.size-1&&(k=this.size-1);var p=Math.floor(l-h);p<1&&(p=1);l=Math.floor(l+h);l>this.size-1&&(l=this.size-1);var t=Math.floor(j-h);t<1&&(t=1);h=Math.floor(j+h);
-h>this.size-1&&(h=this.size-1);for(var x,w,u,B,y,m;n<k;n++){j=this.size2*n;w=n/this.size-d;y=w*w;for(w=p;w<l;w++){u=j+this.size*w;x=w/this.size-c;m=x*x;for(x=t;x<h;x++){B=x/this.size-b;B=e/(1.0E-6+B*B+m+y)-g;B>0&&(this.field[u+x]+=B)}}}};this.addPlaneX=function(b,c){var d,e,g,h,k,l=this.size,j=this.yd,n=this.zd,p=this.field,t=l*Math.sqrt(b/c);t>l&&(t=l);for(d=0;d<t;d++){e=d/l;e*=e;h=b/(1.0E-4+e)-c;if(h>0)for(e=0;e<l;e++){k=d+e*j;for(g=0;g<l;g++)p[n*g+k]+=h}}};this.addPlaneY=function(b,c){var d,e,
+h>this.size-1&&(h=this.size-1);for(var x,w,u,B,z,m;n<k;n++){j=this.size2*n;w=n/this.size-d;z=w*w;for(w=p;w<l;w++){u=j+this.size*w;x=w/this.size-c;m=x*x;for(x=t;x<h;x++){B=x/this.size-b;B=e/(1.0E-6+B*B+m+z)-g;B>0&&(this.field[u+x]+=B)}}}};this.addPlaneX=function(b,c){var d,e,g,h,k,l=this.size,j=this.yd,n=this.zd,p=this.field,t=l*Math.sqrt(b/c);t>l&&(t=l);for(d=0;d<t;d++){e=d/l;e*=e;h=b/(1.0E-4+e)-c;if(h>0)for(e=0;e<l;e++){k=d+e*j;for(g=0;g<l;g++)p[n*g+k]+=h}}};this.addPlaneY=function(b,c){var d,e,
 g,h,k,l,j=this.size,n=this.yd,p=this.zd,t=this.field,x=j*Math.sqrt(b/c);x>j&&(x=j);for(e=0;e<x;e++){d=e/j;d*=d;h=b/(1.0E-4+d)-c;if(h>0){k=e*n;for(d=0;d<j;d++){l=k+d;for(g=0;g<j;g++)t[p*g+l]+=h}}}};this.addPlaneZ=function(b,c){var d,e,g,h,k,l;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(b/c);dist>size&&(dist=size);for(g=0;g<dist;g++){d=g/size;d*=d;h=b/(1.0E-4+d)-c;if(h>0){k=zd*g;for(e=0;e<size;e++){l=k+e*yd;for(d=0;d<size;d++)field[l+d]+=h}}}};this.reset=function(){var b;
 for(b=0;b<this.size3;b++){this.normal_cache[b*3]=0;this.field[b]=0}};this.render=function(b){this.begin();var c,d,e,g,h,k,l,j,n,p=this.size-2;for(g=1;g<p;g++){n=this.size2*g;l=(g-this.halfsize)/this.halfsize;for(e=1;e<p;e++){j=n+this.size*e;k=(e-this.halfsize)/this.halfsize;for(d=1;d<p;d++){h=(d-this.halfsize)/this.halfsize;c=j+d;this.polygonize(h,k,l,c,this.isolation,b)}}}this.end(b)};this.generateGeometry=function(){var b=0,c=new THREE.Geometry,d=[];this.render(function(e){var g,h,k,l,j,n,p,t;for(g=
 0;g<e.count;g++){p=g*3;j=p+1;t=p+2;h=e.positionArray[p];k=e.positionArray[j];l=e.positionArray[t];n=new THREE.Vector3(h,k,l);h=e.normalArray[p];k=e.normalArray[j];l=e.normalArray[t];p=new THREE.Vector3(h,k,l);p.normalize();j=new THREE.Vertex(n);c.vertices.push(j);d.push(p)}nfaces=e.count/3;for(g=0;g<nfaces;g++){p=(b+g)*3;j=p+1;t=p+2;n=d[p];h=d[j];k=d[t];p=new THREE.Face3(p,j,t,[n,h,k]);c.faces.push(p)}b+=nfaces;e.count=0});return c};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;

+ 99 - 95
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,h){this.set(b||0,d||0,e||0,h||1)};
 THREE.Vector4.prototype={set:function(b,d,e,h){this.x=b;this.y=d;this.z=e;this.w=h;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,h=b.objects,g=[];b=0;for(d=h.length;b<d;b++){e=h[b];e instanceof THREE.Mesh&&(g=g.concat(this.intersectObject(e)))}g.sort(function(k,j){return k.distance-j.distance});return g},intersectObject:function(b){function d(W,P,ca,na){na=na.clone().subSelf(P);ca=ca.clone().subSelf(P);var xa=W.clone().subSelf(P);W=na.dot(na);P=na.dot(ca);na=na.dot(xa);var $=ca.dot(ca);ca=ca.dot(xa);xa=1/(W*$-P*P);$=($*na-P*ca)*xa;W=(W*ca-P*na)*xa;return $>0&&W>0&&$+W<
+THREE.Ray.prototype={intersectScene:function(b){var d,e,h=b.objects,g=[];b=0;for(d=h.length;b<d;b++){e=h[b];e instanceof THREE.Mesh&&(g=g.concat(this.intersectObject(e)))}g.sort(function(k,j){return k.distance-j.distance});return g},intersectObject:function(b){function d(T,P,ca,na){na=na.clone().subSelf(P);ca=ca.clone().subSelf(P);var xa=T.clone().subSelf(P);T=na.dot(na);P=na.dot(ca);na=na.dot(xa);var $=ca.dot(ca);ca=ca.dot(xa);xa=1/(T*$-P*P);$=($*na-P*ca)*xa;T=(T*ca-P*na)*xa;return $>0&&T>0&&$+T<
 1}var e,h,g,k,j,o,p,v,E,G,I,H=b.geometry,L=H.vertices,M=[];e=0;for(h=H.faces.length;e<h;e++){g=H.faces[e];G=this.origin.clone();I=this.direction.clone();p=b.matrixWorld;k=p.multiplyVector3(L[g.a].position.clone());j=p.multiplyVector3(L[g.b].position.clone());o=p.multiplyVector3(L[g.c].position.clone());p=g instanceof THREE.Face4?p.multiplyVector3(L[g.d].position.clone()):null;v=b.matrixRotationWorld.multiplyVector3(g.normal.clone());E=I.dot(v);if(b.doubleSided||(b.flipSided?E>0:E<0)){v=v.dot((new THREE.Vector3).sub(k,
 G))/E;G=G.addSelf(I.multiplyScalar(v));if(g instanceof THREE.Face3){if(d(G,k,j,o)){g={distance:this.origin.distanceTo(G),point:G,face:g,object:b};M.push(g)}}else if(g instanceof THREE.Face4&&(d(G,k,j,p)||d(G,j,o,p))){g={distance:this.origin.distanceTo(G),point:G,face:g,object:b};M.push(g)}}}return M}};
 THREE.Rectangle=function(){function b(){k=h-d;j=g-e}var d,e,h,g,k,j,o=!0;this.getX=function(){return d};this.getY=function(){return e};this.getWidth=function(){return k};this.getHeight=function(){return j};this.getLeft=function(){return d};this.getTop=function(){return e};this.getRight=function(){return h};this.getBottom=function(){return g};this.set=function(p,v,E,G){o=!1;d=p;e=v;h=E;g=G;b()};this.addPoint=function(p,v){if(o){o=!1;d=p;e=v;h=p;g=v}else{d=d<p?d:p;e=e<v?e:v;h=h>p?h:p;g=g>v?g:v}b()};
@@ -23,8 +23,8 @@ THREE.Matrix4=function(b,d,e,h,g,k,j,o,p,v,E,G,I,H,L,M){this.set(b||1,d||0,e||0,
 THREE.Matrix4.prototype={set:function(b,d,e,h,g,k,j,o,p,v,E,G,I,H,L,M){this.n11=b;this.n12=d;this.n13=e;this.n14=h;this.n21=g;this.n22=k;this.n23=j;this.n24=o;this.n31=p;this.n32=v;this.n33=E;this.n34=G;this.n41=I;this.n42=H;this.n43=L;this.n44=M;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 h=THREE.Matrix4.__v1,
 g=THREE.Matrix4.__v2,k=THREE.Matrix4.__v3;k.sub(b,d).normalize();if(k.length()===0)k.z=1;h.cross(e,k).normalize();if(h.length()===0){k.x+=1.0E-4;h.cross(e,k).normalize()}g.cross(k,h).normalize();this.n11=h.x;this.n12=g.x;this.n13=k.x;this.n21=h.y;this.n22=g.y;this.n23=k.y;this.n31=h.z;this.n32=g.z;this.n33=k.z;return this},multiplyVector3:function(b){var d=b.x,e=b.y,h=b.z,g=1/(this.n41*d+this.n42*e+this.n43*h+this.n44);b.x=(this.n11*d+this.n12*e+this.n13*h+this.n14)*g;b.y=(this.n21*d+this.n22*e+this.n23*
 h+this.n24)*g;b.z=(this.n31*d+this.n32*e+this.n33*h+this.n34)*g;return b},multiplyVector4:function(b){var d=b.x,e=b.y,h=b.z,g=b.w;b.x=this.n11*d+this.n12*e+this.n13*h+this.n14*g;b.y=this.n21*d+this.n22*e+this.n23*h+this.n24*g;b.z=this.n31*d+this.n32*e+this.n33*h+this.n34*g;b.w=this.n41*d+this.n42*e+this.n43*h+this.n44*g;return b},rotateAxis:function(b){var d=b.x,e=b.y,h=b.z;b.x=d*this.n11+e*this.n12+h*this.n13;b.y=d*this.n21+e*this.n22+h*this.n23;b.z=d*this.n31+e*this.n32+h*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,h=b.n12,g=b.n13,k=b.n14,j=b.n21,o=b.n22,p=b.n23,v=b.n24,E=b.n31,G=b.n32,I=b.n33,H=b.n34,L=b.n41,M=b.n42,W=b.n43,P=b.n44,ca=d.n11,na=d.n12,xa=d.n13,$=d.n14,K=d.n21,ra=d.n22,
-ua=d.n23,ea=d.n24,c=d.n31,T=d.n32,U=d.n33,oa=d.n34;this.n11=e*ca+h*K+g*c;this.n12=e*na+h*ra+g*T;this.n13=e*xa+h*ua+g*U;this.n14=e*$+h*ea+g*oa+k;this.n21=j*ca+o*K+p*c;this.n22=j*na+o*ra+p*T;this.n23=j*xa+o*ua+p*U;this.n24=j*$+o*ea+p*oa+v;this.n31=E*ca+G*K+I*c;this.n32=E*na+G*ra+I*T;this.n33=E*xa+G*ua+I*U;this.n34=E*$+G*ea+I*oa+H;this.n41=L*ca+M*K+W*c;this.n42=L*na+M*ra+W*T;this.n43=L*xa+M*ua+W*U;this.n44=L*$+M*ea+W*oa+P;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,h=b.n12,g=b.n13,k=b.n14,j=b.n21,o=b.n22,p=b.n23,v=b.n24,E=b.n31,G=b.n32,I=b.n33,H=b.n34,L=b.n41,M=b.n42,T=b.n43,P=b.n44,ca=d.n11,na=d.n12,xa=d.n13,$=d.n14,K=d.n21,pa=d.n22,
+ua=d.n23,ea=d.n24,c=d.n31,U=d.n32,V=d.n33,oa=d.n34;this.n11=e*ca+h*K+g*c;this.n12=e*na+h*pa+g*U;this.n13=e*xa+h*ua+g*V;this.n14=e*$+h*ea+g*oa+k;this.n21=j*ca+o*K+p*c;this.n22=j*na+o*pa+p*U;this.n23=j*xa+o*ua+p*V;this.n24=j*$+o*ea+p*oa+v;this.n31=E*ca+G*K+I*c;this.n32=E*na+G*pa+I*U;this.n33=E*xa+G*ua+I*V;this.n34=E*$+G*ea+I*oa+H;this.n41=L*ca+M*K+T*c;this.n42=L*na+M*pa+T*U;this.n43=L*xa+M*ua+T*V;this.n44=L*$+M*ea+T*oa+P;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,h=this.n14,g=this.n21,k=this.n22,j=this.n23,o=this.n24,p=this.n31,v=this.n32,E=this.n33,G=this.n34,I=this.n41,H=this.n42,L=this.n43,M=this.n44;return h*j*v*I-e*o*v*I-h*k*E*I+d*o*E*I+e*k*G*I-d*j*G*I-h*j*p*H+e*o*p*H+h*g*E*H-b*o*E*H-e*g*G*H+b*j*G*H+h*k*p*L-d*o*p*L-h*g*v*L+b*o*v*L+d*g*G*L-b*k*G*L-e*k*p*M+d*j*p*M+e*g*v*M-b*j*v*M-d*g*E*M+b*k*E*M},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]=
@@ -34,8 +34,8 @@ b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=t
 1-e,k=b.x,j=b.y,o=b.z,p=g*k,v=g*j;this.set(p*k+e,p*j-h*o,p*o+h*j,0,p*j+h*o,v*j+e,v*o-h*k,0,p*o-h*j,v*o+h*k,g*o*o+e,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},setRotationFromEuler:function(b){var d=b.x,e=b.y,h=b.z;b=Math.cos(d);d=Math.sin(d);var g=Math.cos(e);e=Math.sin(e);var k=Math.cos(h);h=Math.sin(h);var j=b*e,o=d*e;this.n11=g*k;this.n12=-g*h;this.n13=e;this.n21=o*k+b*h;this.n22=-o*h+b*k;this.n23=-d*g;this.n31=-j*k+d*h;this.n32=j*h+d*k;this.n33=
 b*g;return this},setRotationFromQuaternion:function(b){var d=b.x,e=b.y,h=b.z,g=b.w,k=d+d,j=e+e,o=h+h;b=d*k;var p=d*j;d*=o;var v=e*j;e*=o;h*=o;k*=g;j*=g;g*=o;this.n11=1-(v+h);this.n12=p-g;this.n13=d+j;this.n21=p+g;this.n22=1-(b+h);this.n23=e-k;this.n31=d-j;this.n32=e+k;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,h=1/d.y,g=1/d.z;this.n11=b.n11*e;this.n21=b.n21*e;this.n31=b.n31*e;this.n12=b.n12*h;this.n22=b.n22*h;this.n32=b.n32*h;this.n13=b.n13*g;this.n23=b.n23*g;this.n33=b.n33*g}};
-THREE.Matrix4.makeInvert=function(b,d){var e=b.n11,h=b.n12,g=b.n13,k=b.n14,j=b.n21,o=b.n22,p=b.n23,v=b.n24,E=b.n31,G=b.n32,I=b.n33,H=b.n34,L=b.n41,M=b.n42,W=b.n43,P=b.n44;d===undefined&&(d=new THREE.Matrix4);d.n11=p*H*M-v*I*M+v*G*W-o*H*W-p*G*P+o*I*P;d.n12=k*I*M-g*H*M-k*G*W+h*H*W+g*G*P-h*I*P;d.n13=g*v*M-k*p*M+k*o*W-h*v*W-g*o*P+h*p*P;d.n14=k*p*G-g*v*G-k*o*I+h*v*I+g*o*H-h*p*H;d.n21=v*I*L-p*H*L-v*E*W+j*H*W+p*E*P-j*I*P;d.n22=g*H*L-k*I*L+k*E*W-e*H*W-g*E*P+e*I*P;d.n23=k*p*L-g*v*L-k*j*W+e*v*W+g*j*P-e*p*P;
-d.n24=g*v*E-k*p*E+k*j*I-e*v*I-g*j*H+e*p*H;d.n31=o*H*L-v*G*L+v*E*M-j*H*M-o*E*P+j*G*P;d.n32=k*G*L-h*H*L-k*E*M+e*H*M+h*E*P-e*G*P;d.n33=g*v*L-k*o*L+k*j*M-e*v*M-h*j*P+e*o*P;d.n34=k*o*E-h*v*E-k*j*G+e*v*G+h*j*H-e*o*H;d.n41=p*G*L-o*I*L-p*E*M+j*I*M+o*E*W-j*G*W;d.n42=h*I*L-g*G*L+g*E*M-e*I*M-h*E*W+e*G*W;d.n43=g*o*L-h*p*L-g*j*M+e*p*M+h*j*W-e*o*W;d.n44=h*p*E-g*o*E+g*j*G-e*p*G-h*j*I+e*o*I;d.multiplyScalar(1/b.determinant());return d};
+THREE.Matrix4.makeInvert=function(b,d){var e=b.n11,h=b.n12,g=b.n13,k=b.n14,j=b.n21,o=b.n22,p=b.n23,v=b.n24,E=b.n31,G=b.n32,I=b.n33,H=b.n34,L=b.n41,M=b.n42,T=b.n43,P=b.n44;d===undefined&&(d=new THREE.Matrix4);d.n11=p*H*M-v*I*M+v*G*T-o*H*T-p*G*P+o*I*P;d.n12=k*I*M-g*H*M-k*G*T+h*H*T+g*G*P-h*I*P;d.n13=g*v*M-k*p*M+k*o*T-h*v*T-g*o*P+h*p*P;d.n14=k*p*G-g*v*G-k*o*I+h*v*I+g*o*H-h*p*H;d.n21=v*I*L-p*H*L-v*E*T+j*H*T+p*E*P-j*I*P;d.n22=g*H*L-k*I*L+k*E*T-e*H*T-g*E*P+e*I*P;d.n23=k*p*L-g*v*L-k*j*T+e*v*T+g*j*P-e*p*P;
+d.n24=g*v*E-k*p*E+k*j*I-e*v*I-g*j*H+e*p*H;d.n31=o*H*L-v*G*L+v*E*M-j*H*M-o*E*P+j*G*P;d.n32=k*G*L-h*H*L-k*E*M+e*H*M+h*E*P-e*G*P;d.n33=g*v*L-k*o*L+k*j*M-e*v*M-h*j*P+e*o*P;d.n34=k*o*E-h*v*E-k*j*G+e*v*G+h*j*H-e*o*H;d.n41=p*G*L-o*I*L-p*E*M+j*I*M+o*E*T-j*G*T;d.n42=h*I*L-g*G*L+g*E*M-e*I*M-h*E*T+e*G*T;d.n43=g*o*L-h*p*L-g*j*M+e*p*M+h*j*T-e*o*T;d.n44=h*p*E-g*o*E+g*j*G-e*p*G-h*j*I+e*o*I;d.multiplyScalar(1/b.determinant());return d};
 THREE.Matrix4.makeInvert3x3=function(b){var d=b.m33,e=d.m,h=b.n33*b.n22-b.n32*b.n23,g=-b.n33*b.n21+b.n31*b.n23,k=b.n32*b.n21-b.n31*b.n22,j=-b.n33*b.n12+b.n32*b.n13,o=b.n33*b.n11-b.n31*b.n13,p=-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,G=b.n22*b.n11-b.n21*b.n12;b=b.n11*h+b.n21*j+b.n31*v;if(b==0)throw"matrix not invertible";b=1/b;e[0]=b*h;e[1]=b*g;e[2]=b*k;e[3]=b*j;e[4]=b*o;e[5]=b*p;e[6]=b*v;e[7]=b*E;e[8]=b*G;return d};
 THREE.Matrix4.makeFrustum=function(b,d,e,h,g,k){var j;j=new THREE.Matrix4;j.n11=2*g/(d-b);j.n12=0;j.n13=(d+b)/(d-b);j.n14=0;j.n21=0;j.n22=2*g/(h-e);j.n23=(h+e)/(h-e);j.n24=0;j.n31=0;j.n32=0;j.n33=-(k+g)/(k-g);j.n34=-2*k*g/(k-g);j.n41=0;j.n42=0;j.n43=-1;j.n44=0;return j};THREE.Matrix4.makePerspective=function(b,d,e,h){var g;b=e*Math.tan(b*Math.PI/360);g=-b;return THREE.Matrix4.makeFrustum(g*d,b*d,g,b,e,h)};
 THREE.Matrix4.makeOrtho=function(b,d,e,h,g,k){var j,o,p,v;j=new THREE.Matrix4;o=d-b;p=e-h;v=k-g;j.n11=2/o;j.n12=0;j.n13=0;j.n14=-((d+b)/o);j.n21=0;j.n22=2/p;j.n23=0;j.n24=-((e+h)/p);j.n31=0;j.n32=0;j.n33=-2/v;j.n34=-((k+g)/v);j.n41=0;j.n42=0;j.n43=0;j.n44=1;return j};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
@@ -56,8 +56,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,h,g,k,j,o=new THREE.Vector3,p=new THREE.Vector3;h=0;for(g=this.faces.length;h<g;h++){k=this.faces[h];if(b&&k.vertexNormals.length){o.set(0,0,0);d=0;for(e=k.vertexNormals.length;d<e;d++)o.addSelf(k.vertexNormals[d]);o.divideScalar(3)}else{d=this.vertices[k.a];e=this.vertices[k.b];j=this.vertices[k.c];o.sub(j.position,e.position);p.sub(d.position,e.position);o.crossSelf(p)}o.isZero()||
 o.normalize();k.normal.copy(o)}},computeVertexNormals:function(){var b,d,e,h;if(this.__tmpVertices==undefined){h=this.__tmpVertices=Array(this.vertices.length);b=0;for(d=this.vertices.length;b<d;b++)h[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{h=
 this.__tmpVertices;b=0;for(d=this.vertices.length;b<d;b++)h[b].set(0,0,0)}b=0;for(d=this.faces.length;b<d;b++){e=this.faces[b];if(e instanceof THREE.Face3){h[e.a].addSelf(e.normal);h[e.b].addSelf(e.normal);h[e.c].addSelf(e.normal)}else if(e instanceof THREE.Face4){h[e.a].addSelf(e.normal);h[e.b].addSelf(e.normal);h[e.c].addSelf(e.normal);h[e.d].addSelf(e.normal)}}b=0;for(d=this.vertices.length;b<d;b++)h[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(h[e.a]);
-e.vertexNormals[1].copy(h[e.b]);e.vertexNormals[2].copy(h[e.c])}else if(e instanceof THREE.Face4){e.vertexNormals[0].copy(h[e.a]);e.vertexNormals[1].copy(h[e.b]);e.vertexNormals[2].copy(h[e.c]);e.vertexNormals[3].copy(h[e.d])}}},computeTangents:function(){function b(aa,pa,fa,qa,X,va,ga){o=aa.vertices[pa].position;p=aa.vertices[fa].position;v=aa.vertices[qa].position;E=j[X];G=j[va];I=j[ga];H=p.x-o.x;L=v.x-o.x;M=p.y-o.y;W=v.y-o.y;P=p.z-o.z;ca=v.z-o.z;na=G.u-E.u;xa=I.u-E.u;$=G.v-E.v;K=I.v-E.v;ra=1/(na*
-K-xa*$);T.set((K*H-$*L)*ra,(K*M-$*W)*ra,(K*P-$*ca)*ra);U.set((na*L-xa*H)*ra,(na*W-xa*M)*ra,(na*ca-xa*P)*ra);ea[pa].addSelf(T);ea[fa].addSelf(T);ea[qa].addSelf(T);c[pa].addSelf(U);c[fa].addSelf(U);c[qa].addSelf(U)}var d,e,h,g,k,j,o,p,v,E,G,I,H,L,M,W,P,ca,na,xa,$,K,ra,ua,ea=[],c=[],T=new THREE.Vector3,U=new THREE.Vector3,oa=new THREE.Vector3,Fa=new THREE.Vector3,Ga=new THREE.Vector3;d=0;for(e=this.vertices.length;d<e;d++){ea[d]=new THREE.Vector3;c[d]=new THREE.Vector3}d=0;for(e=this.faces.length;d<
+e.vertexNormals[1].copy(h[e.b]);e.vertexNormals[2].copy(h[e.c])}else if(e instanceof THREE.Face4){e.vertexNormals[0].copy(h[e.a]);e.vertexNormals[1].copy(h[e.b]);e.vertexNormals[2].copy(h[e.c]);e.vertexNormals[3].copy(h[e.d])}}},computeTangents:function(){function b(aa,qa,fa,ra,X,va,ga){o=aa.vertices[qa].position;p=aa.vertices[fa].position;v=aa.vertices[ra].position;E=j[X];G=j[va];I=j[ga];H=p.x-o.x;L=v.x-o.x;M=p.y-o.y;T=v.y-o.y;P=p.z-o.z;ca=v.z-o.z;na=G.u-E.u;xa=I.u-E.u;$=G.v-E.v;K=I.v-E.v;pa=1/(na*
+K-xa*$);U.set((K*H-$*L)*pa,(K*M-$*T)*pa,(K*P-$*ca)*pa);V.set((na*L-xa*H)*pa,(na*T-xa*M)*pa,(na*ca-xa*P)*pa);ea[qa].addSelf(U);ea[fa].addSelf(U);ea[ra].addSelf(U);c[qa].addSelf(V);c[fa].addSelf(V);c[ra].addSelf(V)}var d,e,h,g,k,j,o,p,v,E,G,I,H,L,M,T,P,ca,na,xa,$,K,pa,ua,ea=[],c=[],U=new THREE.Vector3,V=new THREE.Vector3,oa=new THREE.Vector3,Fa=new THREE.Vector3,Ga=new THREE.Vector3;d=0;for(e=this.vertices.length;d<e;d++){ea[d]=new THREE.Vector3;c[d]=new THREE.Vector3}d=0;for(e=this.faces.length;d<
 e;d++){k=this.faces[d];j=this.faceVertexUvs[0][d];if(k instanceof THREE.Face3)b(this,k.a,k.b,k.c,0,1,2);else if(k instanceof THREE.Face4){b(this,k.a,k.b,k.c,0,1,2);b(this,k.a,k.b,k.d,0,1,3)}}var ya=["a","b","c","d"];d=0;for(e=this.faces.length;d<e;d++){k=this.faces[d];for(h=0;h<k.vertexNormals.length;h++){Ga.copy(k.vertexNormals[h]);g=k[ya[h]];ua=ea[g];oa.copy(ua);oa.subSelf(Ga.multiplyScalar(Ga.dot(ua))).normalize();Fa.cross(k.vertexNormals[h],ua);g=Fa.dot(c[g]);g=g<0?-1:1;k.vertexTangents[h]=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,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=
@@ -133,22 +133,22 @@ THREE.LOD.prototype.update=function(b,d,e){this.matrixAutoUpdate&&(d|=this.updat
 THREE.ShadowVolume.prototype.supr=THREE.Mesh.prototype;
 THREE.ShadowVolume.prototype.calculateShadowVolumeGeometry=function(b){this.geometry=new THREE.Geometry;this.geometry.boundingSphere=b.boundingSphere;this.geometry.edgeFaces=[];var d=this.geometry.vertices,e=this.geometry.faces,h=this.geometry.edgeFaces,g=b.faces;b=b.vertices;var k=g.length,j,o,p,v,E,G=["a","b","c","d"];for(p=0;p<k;p++){o=d.length;j=g[p];if(j instanceof THREE.Face4){v=4;o=new THREE.Face4(o,o+1,o+2,o+3)}else{v=3;o=new THREE.Face3(o,o+1,o+2)}o.normal.copy(j.normal);e.push(o);for(o=
 0;o<v;o++){E=b[j[G[o]]];d.push(new THREE.Vertex(E.position.clone()))}}for(k=0;k<g.length-1;k++){b=e[k];for(j=k+1;j<g.length;j++){o=e[j];o=this.facesShareEdge(d,b,o);if(o!==undefined){o=new THREE.Face4(o.indices[0],o.indices[3],o.indices[2],o.indices[1]);o.normal.set(1,0,0);h.push(o)}}}};
-THREE.ShadowVolume.prototype.facesShareEdge=function(b,d,e){var h,g,k,j,o,p,v,E,G,I,H,L,M,W=0,P=["a","b","c","d"];h=d instanceof THREE.Face4?4:3;g=e instanceof THREE.Face4?4:3;for(L=0;L<h;L++){k=d[P[L]];o=b[k];for(M=0;M<g;M++){j=e[P[M]];p=b[j];if(Math.abs(o.position.x-p.position.x)<1.0E-4&&Math.abs(o.position.y-p.position.y)<1.0E-4&&Math.abs(o.position.z-p.position.z)<1.0E-4){W++;if(W===1){v=o;E=p;G=k;I=j;H=P[L]}if(W===2){H+=P[L];return H==="ad"||H==="ac"?{faces:[d,e],vertices:[v,E,p,o],indices:[G,
+THREE.ShadowVolume.prototype.facesShareEdge=function(b,d,e){var h,g,k,j,o,p,v,E,G,I,H,L,M,T=0,P=["a","b","c","d"];h=d instanceof THREE.Face4?4:3;g=e instanceof THREE.Face4?4:3;for(L=0;L<h;L++){k=d[P[L]];o=b[k];for(M=0;M<g;M++){j=e[P[M]];p=b[j];if(Math.abs(o.position.x-p.position.x)<1.0E-4&&Math.abs(o.position.y-p.position.y)<1.0E-4&&Math.abs(o.position.z-p.position.z)<1.0E-4){T++;if(T===1){v=o;E=p;G=k;I=j;H=P[L]}if(T===2){H+=P[L];return H==="ad"||H==="ac"?{faces:[d,e],vertices:[v,E,p,o],indices:[G,
 I,j,k],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[d,e],vertices:[v,o,p,E],indices:[G,k,j,I],vertexTypes:[1,1,2,2],extrudable:!0}}}}}};THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;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 T=p[o]=p[o]||new THREE.RenderableVertex;o++;return T}function d(T,U){return U.z-T.z}function e(T,U){var oa=0,Fa=1,Ga=T.z+T.w,ya=U.z+U.w,aa=-T.z+T.w,pa=-U.z+U.w;if(Ga>=0&&ya>=0&&aa>=0&&pa>=0)return!0;else if(Ga<0&&ya<0||aa<0&&pa<0)return!1;else{if(Ga<0)oa=Math.max(oa,Ga/(Ga-ya));else ya<0&&(Fa=Math.min(Fa,Ga/(Ga-ya)));if(aa<0)oa=Math.max(oa,aa/(aa-pa));else pa<0&&(Fa=Math.min(Fa,aa/(aa-pa)));if(Fa<oa)return!1;else{T.lerpSelf(U,oa);U.lerpSelf(T,1-Fa);return!0}}}
-var h,g,k=[],j,o,p=[],v,E,G=[],I,H=[],L,M,W=[],P,ca,na=[],xa=new THREE.Vector4,$=new THREE.Vector4,K=new THREE.Matrix4,ra=new THREE.Matrix4,ua=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ea=new THREE.Vector4,c=new THREE.Vector4;this.projectVector=function(T,U){K.multiply(U.projectionMatrix,U.matrixWorldInverse);K.multiplyVector3(T);return T};this.unprojectVector=function(T,U){K.multiply(U.matrixWorld,THREE.Matrix4.makeInvert(U.projectionMatrix));
-K.multiplyVector3(T);return T};this.projectObjects=function(T,U,oa){U=[];var Fa,Ga,ya;g=0;Ga=T.objects;T=0;for(Fa=Ga.length;T<Fa;T++){ya=Ga[T];var aa;if(!(aa=!ya.visible))if(aa=ya instanceof THREE.Mesh){a:{aa=void 0;for(var pa=ya.matrixWorld,fa=-ya.geometry.boundingSphere.radius*Math.max(ya.scale.x,Math.max(ya.scale.y,ya.scale.z)),qa=0;qa<6;qa++){aa=ua[qa].x*pa.n14+ua[qa].y*pa.n24+ua[qa].z*pa.n34+ua[qa].w;if(aa<=fa){aa=!1;break a}}aa=!0}aa=!aa}if(!aa){aa=k[g]=k[g]||new THREE.RenderableObject;g++;
-h=aa;xa.copy(ya.position);K.multiplyVector3(xa);h.object=ya;h.z=xa.z;U.push(h)}}oa&&U.sort(d);return U};this.projectScene=function(T,U,oa){var Fa=[],Ga=U.near,ya=U.far,aa,pa,fa,qa,X,va,ga,za,Aa,ha,Pa,Ua,Va,hb,Sa,fb,Ya;ca=M=I=E=0;U.matrixAutoUpdate&&U.updateMatrix();T.update(undefined,!1,U);K.multiply(U.projectionMatrix,U.matrixWorldInverse);ua[0].set(K.n41-K.n11,K.n42-K.n12,K.n43-K.n13,K.n44-K.n14);ua[1].set(K.n41+K.n11,K.n42+K.n12,K.n43+K.n13,K.n44+K.n14);ua[2].set(K.n41+K.n21,K.n42+K.n22,K.n43+
-K.n23,K.n44+K.n24);ua[3].set(K.n41-K.n21,K.n42-K.n22,K.n43-K.n23,K.n44-K.n24);ua[4].set(K.n41-K.n31,K.n42-K.n32,K.n43-K.n33,K.n44-K.n34);ua[5].set(K.n41+K.n31,K.n42+K.n32,K.n43+K.n33,K.n44+K.n34);for(aa=0;aa<6;aa++){Aa=ua[aa];Aa.divideScalar(Math.sqrt(Aa.x*Aa.x+Aa.y*Aa.y+Aa.z*Aa.z))}Aa=this.projectObjects(T,U,!0);T=0;for(aa=Aa.length;T<aa;T++){ha=Aa[T].object;if(ha.visible){Pa=ha.matrixWorld;Ua=ha.matrixRotationWorld;Va=ha.materials;hb=ha.overdraw;o=0;if(ha instanceof THREE.Mesh){Sa=ha.geometry;qa=
-Sa.vertices;fb=Sa.faces;Sa=Sa.faceVertexUvs;pa=0;for(fa=qa.length;pa<fa;pa++){j=b();j.positionWorld.copy(qa[pa].position);Pa.multiplyVector3(j.positionWorld);j.positionScreen.copy(j.positionWorld);K.multiplyVector4(j.positionScreen);j.positionScreen.x/=j.positionScreen.w;j.positionScreen.y/=j.positionScreen.w;j.visible=j.positionScreen.z>Ga&&j.positionScreen.z<ya}qa=0;for(pa=fb.length;qa<pa;qa++){fa=fb[qa];if(fa instanceof THREE.Face3){X=p[fa.a];va=p[fa.b];ga=p[fa.c];if(X.visible&&va.visible&&ga.visible&&
+THREE.Projector=function(){function b(){var U=p[o]=p[o]||new THREE.RenderableVertex;o++;return U}function d(U,V){return V.z-U.z}function e(U,V){var oa=0,Fa=1,Ga=U.z+U.w,ya=V.z+V.w,aa=-U.z+U.w,qa=-V.z+V.w;if(Ga>=0&&ya>=0&&aa>=0&&qa>=0)return!0;else if(Ga<0&&ya<0||aa<0&&qa<0)return!1;else{if(Ga<0)oa=Math.max(oa,Ga/(Ga-ya));else ya<0&&(Fa=Math.min(Fa,Ga/(Ga-ya)));if(aa<0)oa=Math.max(oa,aa/(aa-qa));else qa<0&&(Fa=Math.min(Fa,aa/(aa-qa)));if(Fa<oa)return!1;else{U.lerpSelf(V,oa);V.lerpSelf(U,1-Fa);return!0}}}
+var h,g,k=[],j,o,p=[],v,E,G=[],I,H=[],L,M,T=[],P,ca,na=[],xa=new THREE.Vector4,$=new THREE.Vector4,K=new THREE.Matrix4,pa=new THREE.Matrix4,ua=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ea=new THREE.Vector4,c=new THREE.Vector4;this.projectVector=function(U,V){K.multiply(V.projectionMatrix,V.matrixWorldInverse);K.multiplyVector3(U);return U};this.unprojectVector=function(U,V){K.multiply(V.matrixWorld,THREE.Matrix4.makeInvert(V.projectionMatrix));
+K.multiplyVector3(U);return U};this.projectObjects=function(U,V,oa){V=[];var Fa,Ga,ya;g=0;Ga=U.objects;U=0;for(Fa=Ga.length;U<Fa;U++){ya=Ga[U];var aa;if(!(aa=!ya.visible))if(aa=ya instanceof THREE.Mesh){a:{aa=void 0;for(var qa=ya.matrixWorld,fa=-ya.geometry.boundingSphere.radius*Math.max(ya.scale.x,Math.max(ya.scale.y,ya.scale.z)),ra=0;ra<6;ra++){aa=ua[ra].x*qa.n14+ua[ra].y*qa.n24+ua[ra].z*qa.n34+ua[ra].w;if(aa<=fa){aa=!1;break a}}aa=!0}aa=!aa}if(!aa){aa=k[g]=k[g]||new THREE.RenderableObject;g++;
+h=aa;xa.copy(ya.position);K.multiplyVector3(xa);h.object=ya;h.z=xa.z;V.push(h)}}oa&&V.sort(d);return V};this.projectScene=function(U,V,oa){var Fa=[],Ga=V.near,ya=V.far,aa,qa,fa,ra,X,va,ga,za,Aa,ha,Pa,Ua,Va,hb,Sa,fb,Ya;ca=M=I=E=0;V.matrixAutoUpdate&&V.updateMatrix();U.update(undefined,!1,V);K.multiply(V.projectionMatrix,V.matrixWorldInverse);ua[0].set(K.n41-K.n11,K.n42-K.n12,K.n43-K.n13,K.n44-K.n14);ua[1].set(K.n41+K.n11,K.n42+K.n12,K.n43+K.n13,K.n44+K.n14);ua[2].set(K.n41+K.n21,K.n42+K.n22,K.n43+
+K.n23,K.n44+K.n24);ua[3].set(K.n41-K.n21,K.n42-K.n22,K.n43-K.n23,K.n44-K.n24);ua[4].set(K.n41-K.n31,K.n42-K.n32,K.n43-K.n33,K.n44-K.n34);ua[5].set(K.n41+K.n31,K.n42+K.n32,K.n43+K.n33,K.n44+K.n34);for(aa=0;aa<6;aa++){Aa=ua[aa];Aa.divideScalar(Math.sqrt(Aa.x*Aa.x+Aa.y*Aa.y+Aa.z*Aa.z))}Aa=this.projectObjects(U,V,!0);U=0;for(aa=Aa.length;U<aa;U++){ha=Aa[U].object;if(ha.visible){Pa=ha.matrixWorld;Ua=ha.matrixRotationWorld;Va=ha.materials;hb=ha.overdraw;o=0;if(ha instanceof THREE.Mesh){Sa=ha.geometry;ra=
+Sa.vertices;fb=Sa.faces;Sa=Sa.faceVertexUvs;qa=0;for(fa=ra.length;qa<fa;qa++){j=b();j.positionWorld.copy(ra[qa].position);Pa.multiplyVector3(j.positionWorld);j.positionScreen.copy(j.positionWorld);K.multiplyVector4(j.positionScreen);j.positionScreen.x/=j.positionScreen.w;j.positionScreen.y/=j.positionScreen.w;j.visible=j.positionScreen.z>Ga&&j.positionScreen.z<ya}ra=0;for(qa=fb.length;ra<qa;ra++){fa=fb[ra];if(fa instanceof THREE.Face3){X=p[fa.a];va=p[fa.b];ga=p[fa.c];if(X.visible&&va.visible&&ga.visible&&
 (ha.doubleSided||ha.flipSided!=(ga.positionScreen.x-X.positionScreen.x)*(va.positionScreen.y-X.positionScreen.y)-(ga.positionScreen.y-X.positionScreen.y)*(va.positionScreen.x-X.positionScreen.x)<0)){za=G[E]=G[E]||new THREE.RenderableFace3;E++;v=za;v.v1.copy(X);v.v2.copy(va);v.v3.copy(ga)}else continue}else if(fa instanceof THREE.Face4){X=p[fa.a];va=p[fa.b];ga=p[fa.c];za=p[fa.d];if(X.visible&&va.visible&&ga.visible&&za.visible&&(ha.doubleSided||ha.flipSided!=((za.positionScreen.x-X.positionScreen.x)*
 (va.positionScreen.y-X.positionScreen.y)-(za.positionScreen.y-X.positionScreen.y)*(va.positionScreen.x-X.positionScreen.x)<0||(va.positionScreen.x-ga.positionScreen.x)*(za.positionScreen.y-ga.positionScreen.y)-(va.positionScreen.y-ga.positionScreen.y)*(za.positionScreen.x-ga.positionScreen.x)<0))){Ya=H[I]=H[I]||new THREE.RenderableFace4;I++;v=Ya;v.v1.copy(X);v.v2.copy(va);v.v3.copy(ga);v.v4.copy(za)}else continue}v.normalWorld.copy(fa.normal);Ua.multiplyVector3(v.normalWorld);v.centroidWorld.copy(fa.centroid);
-Pa.multiplyVector3(v.centroidWorld);v.centroidScreen.copy(v.centroidWorld);K.multiplyVector3(v.centroidScreen);ga=fa.vertexNormals;X=0;for(va=ga.length;X<va;X++){za=v.vertexNormalsWorld[X];za.copy(ga[X]);Ua.multiplyVector3(za)}X=0;for(va=Sa.length;X<va;X++)if(Ya=Sa[X][qa]){ga=0;for(za=Ya.length;ga<za;ga++)v.uvs[X][ga]=Ya[ga]}v.meshMaterials=Va;v.faceMaterials=fa.materials;v.overdraw=hb;v.z=v.centroidScreen.z;Fa.push(v)}}else if(ha instanceof THREE.Line){ra.multiply(K,Pa);qa=ha.geometry.vertices;X=
-b();X.positionScreen.copy(qa[0].position);ra.multiplyVector4(X.positionScreen);pa=1;for(fa=qa.length;pa<fa;pa++){X=b();X.positionScreen.copy(qa[pa].position);ra.multiplyVector4(X.positionScreen);va=p[o-2];ea.copy(X.positionScreen);c.copy(va.positionScreen);if(e(ea,c)){ea.multiplyScalar(1/ea.w);c.multiplyScalar(1/c.w);Pa=W[M]=W[M]||new THREE.RenderableLine;M++;L=Pa;L.v1.positionScreen.copy(ea);L.v2.positionScreen.copy(c);L.z=Math.max(ea.z,c.z);L.materials=ha.materials;Fa.push(L)}}}else if(ha instanceof
-THREE.Particle){$.set(ha.position.x,ha.position.y,ha.position.z,1);K.multiplyVector4($);$.z/=$.w;if($.z>0&&$.z<1){Pa=na[ca]=na[ca]||new THREE.RenderableParticle;ca++;P=Pa;P.x=$.x/$.w;P.y=$.y/$.w;P.z=$.z;P.rotation=ha.rotation.z;P.scale.x=ha.scale.x*Math.abs(P.x-($.x+U.projectionMatrix.n11)/($.w+U.projectionMatrix.n14));P.scale.y=ha.scale.y*Math.abs(P.y-($.y+U.projectionMatrix.n22)/($.w+U.projectionMatrix.n24));P.materials=ha.materials;Fa.push(P)}}}}oa&&Fa.sort(d);return Fa}};
+Pa.multiplyVector3(v.centroidWorld);v.centroidScreen.copy(v.centroidWorld);K.multiplyVector3(v.centroidScreen);ga=fa.vertexNormals;X=0;for(va=ga.length;X<va;X++){za=v.vertexNormalsWorld[X];za.copy(ga[X]);Ua.multiplyVector3(za)}X=0;for(va=Sa.length;X<va;X++)if(Ya=Sa[X][ra]){ga=0;for(za=Ya.length;ga<za;ga++)v.uvs[X][ga]=Ya[ga]}v.meshMaterials=Va;v.faceMaterials=fa.materials;v.overdraw=hb;v.z=v.centroidScreen.z;Fa.push(v)}}else if(ha instanceof THREE.Line){pa.multiply(K,Pa);ra=ha.geometry.vertices;X=
+b();X.positionScreen.copy(ra[0].position);pa.multiplyVector4(X.positionScreen);qa=1;for(fa=ra.length;qa<fa;qa++){X=b();X.positionScreen.copy(ra[qa].position);pa.multiplyVector4(X.positionScreen);va=p[o-2];ea.copy(X.positionScreen);c.copy(va.positionScreen);if(e(ea,c)){ea.multiplyScalar(1/ea.w);c.multiplyScalar(1/c.w);Pa=T[M]=T[M]||new THREE.RenderableLine;M++;L=Pa;L.v1.positionScreen.copy(ea);L.v2.positionScreen.copy(c);L.z=Math.max(ea.z,c.z);L.materials=ha.materials;Fa.push(L)}}}else if(ha instanceof
+THREE.Particle){$.set(ha.position.x,ha.position.y,ha.position.z,1);K.multiplyVector4($);$.z/=$.w;if($.z>0&&$.z<1){Pa=na[ca]=na[ca]||new THREE.RenderableParticle;ca++;P=Pa;P.x=$.x/$.w;P.y=$.y/$.w;P.z=$.z;P.rotation=ha.rotation.z;P.scale.x=ha.scale.x*Math.abs(P.x-($.x+V.projectionMatrix.n11)/($.w+V.projectionMatrix.n14));P.scale.y=ha.scale.y*Math.abs(P.y-($.y+V.projectionMatrix.n22)/($.w+V.projectionMatrix.n24));P.materials=ha.materials;Fa.push(P)}}}}oa&&Fa.sort(d);return Fa}};
 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 h,g=e.length;for(h=0;h<g;h++){b=e[h];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",
 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",
@@ -163,9 +163,10 @@ default_vertex:"#ifndef USE_MORPHTARGETS\n#ifndef USE_SKINNING\ngl_Position = pr
 THREE.UniformsLib={common:{diffuse:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:0,texture:null},lightMap:{type:"t",value:2,texture:null},envMap:{type:"t",value:1,texture:null},useRefract:{type:"i",value:0},reflectivity:{type:"f",value:1},refractionRatio:{type:"f",value:0.98},combine:{type:"i",value:0},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)},morphTargetInfluences:{type:"f",
 value:0}},lights:{enableLighting:{type:"i",value:1},ambientLightColor:{type:"fv",value:[]},directionalLightDirection:{type:"fv",value:[]},directionalLightColor:{type:"fv",value:[]},pointLightColor:{type:"fv",value:[]},pointLightPosition:{type:"fv",value:[]},pointLightDistance:{type:"fv1",value:[]}},particle:{psColor:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},size:{type:"f",value:1},scale:{type:"f",value:1},map:{type:"t",value:0,texture:null},fogDensity:{type:"f",value:2.5E-4},
 fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}}};
-THREE.ShaderLib={lensFlareVertexTexture:{vertexShader:"uniform \tvec3 \tscreenPosition;\nuniform\tvec2\tscale;\nuniform\tfloat\trotation;\nuniform    int     renderType;\nuniform\tsampler2D\tocclusionMap;\nattribute \tvec2 \tposition;\nattribute  vec2\tUV;\nvarying\tvec2\tvUV;\nvarying\tfloat\tvVisibility;\nvoid main(void)\n{\nvUV = UV;\nvec2 pos = position;\nif( renderType == 2 ) {\nvec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 )) +\ntexture2D( occlusionMap, vec2( 0.5, 0.1 )) +\ntexture2D( occlusionMap, vec2( 0.9, 0.1 )) +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 )) +\ntexture2D( occlusionMap, vec2( 0.9, 0.9 )) +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 )) +\ntexture2D( occlusionMap, vec2( 0.1, 0.9 )) +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 )) +\ntexture2D( occlusionMap, vec2( 0.5, 0.5 ));\nvVisibility = (       visibility.r / 9.0 ) *\n( 1.0 - visibility.g / 9.0 ) *\n(       visibility.b / 9.0 ) *\n( 1.0 - visibility.a / 9.0 );\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4(( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",fragmentShader:"#ifdef GL_ES\nprecision highp float;\n#endif\nuniform\tsampler2D\tmap;\nuniform\tfloat\t\topacity;\nuniform    int         renderType;\nvarying\tvec2\t\tvUV;\nvarying\tfloat\t\tvVisibility;\nvoid main( void )\n{\nif( renderType == 0 ) {\ngl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nvec4 color = texture2D( map, vUV );\ncolor.a *= opacity * vVisibility;\ngl_FragColor = color;\n}\n}"},
+THREE.ShaderLib={lensFlareVertexTexture:{vertexShader:"uniform \tvec3 \tscreenPosition;\nuniform\tvec2\tscale;\nuniform\tfloat\trotation;\nuniform    int     renderType;\nuniform\tsampler2D\tocclusionMap;\nattribute \tvec2 \tposition;\nattribute  vec2\tUV;\nvarying\tvec2\tvUV;\nvarying\tfloat\tvVisibility;\nvoid main(void)\n{\nvUV = UV;\nvec2 pos = position;\nif( renderType == 2 ) {\nvec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 )) +\ntexture2D( occlusionMap, vec2( 0.5, 0.1 )) +\ntexture2D( occlusionMap, vec2( 0.9, 0.1 )) +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 )) +\ntexture2D( occlusionMap, vec2( 0.9, 0.9 )) +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 )) +\ntexture2D( occlusionMap, vec2( 0.1, 0.9 )) +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 )) +\ntexture2D( occlusionMap, vec2( 0.5, 0.5 ));\nvVisibility = ( 1.0 - visibility.a / 9.0 );\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4(( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",fragmentShader:"#ifdef GL_ES\nprecision highp float;\n#endif\nuniform\tsampler2D\tmap;\nuniform\tfloat\t\topacity;\nuniform    int         renderType;\nvarying\tvec2\t\tvUV;\nvarying\tfloat\t\tvVisibility;\nvoid main( void )\n{\nif( renderType == 0 ) {\ngl_FragColor = vec4( texture2D( map, vUV ).rgb, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nvec4 color = texture2D( map, vUV );\ncolor.a *= opacity * vVisibility;\ngl_FragColor = color;\n}\n}"},
 lensFlare:{vertexShader:"uniform \tvec3 \tscreenPosition;\nuniform\tvec2\tscale;\nuniform\tfloat\trotation;\nuniform    int     renderType;\nattribute \tvec2 \tposition;\nattribute  vec2\tUV;\nvarying\tvec2\tvUV;\nvoid main(void)\n{\nvUV = UV;\nvec2 pos = position;\nif( renderType == 2 ) {\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4(( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",
-fragmentShader:"#ifdef GL_ES\nprecision highp float;\n#endif\nuniform\tsampler2D\tmap;\nuniform\tsampler2D\tocclusionMap;\nuniform\tfloat\t\topacity;\nuniform    int         renderType;\nvarying\tvec2\t\tvUV;\nvoid main( void )\n{\nif( renderType == 0 ) {\ngl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nfloat visibility = texture2D( occlusionMap, vec2( 0.5, 0.1 )).a +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 )).a +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 )).a +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 )).a;\nvisibility = ( 1.0 - visibility / 4.0 );\nvec4 color = texture2D( map, vUV );\ncolor.a *= opacity * visibility;\ngl_FragColor = color;\n}\n}"},
+fragmentShader:"#ifdef GL_ES\nprecision highp float;\n#endif\nuniform\tsampler2D\tmap;\nuniform\tsampler2D\tocclusionMap;\nuniform\tfloat\t\topacity;\nuniform    int         renderType;\nvarying\tvec2\t\tvUV;\nvoid main( void )\n{\nif( renderType == 0 ) {\ngl_FragColor = vec4( texture2D( map, vUV ).rgb, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nfloat visibility = texture2D( occlusionMap, vec2( 0.5, 0.1 )).a +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 )).a +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 )).a +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 )).a;\nvisibility = ( 1.0 - visibility / 4.0 );\nvec4 color = texture2D( map, vUV );\ncolor.a *= opacity * visibility;\ngl_FragColor = color;\n}\n}"},
+sprite:{vertexShader:"uniform \tvec3 \tscreenPosition;\nuniform\tvec2\tscale;\nuniform\tfloat\trotation;\nattribute \tvec2 \tposition;\nattribute  vec2\tUV;\nvarying\tvec2\tvUV;\nvoid main(void)\n{\nvUV = UV;\nvec2 pos;\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\ngl_Position = vec4(( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",fragmentShader:"#ifdef GL_ES\nprecision highp float;\n#endif\nuniform\tsampler2D\tmap;\nuniform\tfloat\t\topacity;\nvarying\tvec2\t\tvUV;\nvoid main( void )\n{\nvec4 color = texture2D( map, vUV );\ncolor.a *= opacity;\ngl_FragColor = color;\n}"},
 shadowPost:{vertexShader:"uniform \tmat4 \tprojectionMatrix;\nattribute \tvec3 \tposition;\nvoid main(void)\n{\ngl_Position = projectionMatrix * vec4( position, 1.0 );\n}",fragmentShader:"#ifdef GL_ES\nprecision highp float;\n#endif\nuniform \tfloat \tdarkness;\nvoid main( void )\n{\ngl_FragColor = vec4( 0, 0, 0, darkness );\n}"},shadowVolumeDynamic:{uniforms:{directionalLightDirection:{type:"fv",value:[]}},vertexShader:"uniform \tvec3 \tdirectionalLightDirection;\nvoid main() {\nvec4 pos      = objectMatrix * vec4( position, 1.0 );\nvec3 norm     = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nvec4 extruded = vec4( directionalLightDirection * 5000.0 * step( 0.0, dot( directionalLightDirection, norm )), 0.0 );\ngl_Position   = projectionMatrix * viewMatrix * ( pos + extruded );\n}",
 fragmentShader:"void main() {\ngl_FragColor = vec4( 1, 1, 1, 1 );\n}"},depth:{uniforms:{mNear:{type:"f",value:1},mFar:{type:"f",value:2E3},opacity:{type:"f",value:1}},fragmentShader:"uniform float mNear;\nuniform float mFar;\nuniform float opacity;\nvoid main() {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat color = 1.0 - smoothstep( mNear, mFar, depth );\ngl_FragColor = vec4( vec3( color ), opacity );\n}",vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}"},
 normal:{uniforms:{opacity:{type:"f",value:1}},fragmentShader:"uniform float opacity;\nvarying vec3 vNormal;\nvoid main() {\ngl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, opacity );\n}",vertexShader:"varying vec3 vNormal;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvNormal = normalize( normalMatrix * normal );\ngl_Position = projectionMatrix * mvPosition;\n}"},basic:{uniforms:THREE.UniformsLib.common,fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;",
@@ -184,7 +185,7 @@ if(z!=oa){c.useProgram(z);oa=z}c.uniformMatrix4fv(w.projectionMatrix,!1,Pa);if(n
 THREE.MeshLambertMaterial||m.lights){var A,t,x=0,y=0,D=0,B,N,Y,O,Z=hb,Ha=Z.directional.colors,R=Z.directional.positions,Q=Z.point.colors,S=Z.point.positions,sa=Z.point.distances,q=0,F=0;n=t=O=0;for(A=s.length;n<A;n++){t=s[n];B=t.color;N=t.position;Y=t.intensity;O=t.distance;if(t instanceof THREE.AmbientLight){x+=B.r;y+=B.g;D+=B.b}else if(t instanceof THREE.DirectionalLight){O=q*3;Ha[O]=B.r*Y;Ha[O+1]=B.g*Y;Ha[O+2]=B.b*Y;R[O]=N.x;R[O+1]=N.y;R[O+2]=N.z;q+=1}else if(t instanceof THREE.PointLight){t=F*
 3;Q[t]=B.r*Y;Q[t+1]=B.g*Y;Q[t+2]=B.b*Y;S[t]=N.x;S[t+1]=N.y;S[t+2]=N.z;sa[F]=O;F+=1}}for(n=q*3;n<Ha.length;n++)Ha[n]=0;for(n=F*3;n<Q.length;n++)Q[n]=0;Z.point.length=F;Z.directional.length=q;Z.ambient[0]=x;Z.ambient[1]=y;Z.ambient[2]=D;n=hb;u.enableLighting.value=n.directional.length+n.point.length;u.ambientLightColor.value=n.ambient;u.directionalLightColor.value=n.directional.colors;u.directionalLightDirection.value=n.directional.positions;u.pointLightColor.value=n.point.colors;u.pointLightPosition.value=
 n.point.positions;u.pointLightDistance.value=n.point.distances}if(m instanceof THREE.MeshBasicMaterial||m instanceof THREE.MeshLambertMaterial||m instanceof THREE.MeshPhongMaterial){u.diffuse.value.setRGB(m.color.r,m.color.g,m.color.b);u.opacity.value=m.opacity;u.map.texture=m.map;u.lightMap.texture=m.lightMap;u.envMap.texture=m.envMap;u.reflectivity.value=m.reflectivity;u.refractionRatio.value=m.refractionRatio;u.combine.value=m.combine;u.useRefract.value=m.envMap&&m.envMap.mapping instanceof THREE.CubeRefractionMapping}if(m instanceof
-THREE.LineBasicMaterial){u.diffuse.value.setRGB(m.color.r,m.color.g,m.color.b);u.opacity.value=m.opacity}else if(m instanceof THREE.ParticleBasicMaterial){u.psColor.value.setRGB(m.color.r,m.color.g,m.color.b);u.opacity.value=m.opacity;u.size.value=m.size;u.scale.value=T.height/2;u.map.texture=m.map}else if(m instanceof THREE.MeshPhongMaterial){u.ambient.value.setRGB(m.ambient.r,m.ambient.g,m.ambient.b);u.specular.value.setRGB(m.specular.r,m.specular.g,m.specular.b);u.shininess.value=m.shininess}else if(m instanceof
+THREE.LineBasicMaterial){u.diffuse.value.setRGB(m.color.r,m.color.g,m.color.b);u.opacity.value=m.opacity}else if(m instanceof THREE.ParticleBasicMaterial){u.psColor.value.setRGB(m.color.r,m.color.g,m.color.b);u.opacity.value=m.opacity;u.size.value=m.size;u.scale.value=U.height/2;u.map.texture=m.map}else if(m instanceof THREE.MeshPhongMaterial){u.ambient.value.setRGB(m.ambient.r,m.ambient.g,m.ambient.b);u.specular.value.setRGB(m.specular.r,m.specular.g,m.specular.b);u.shininess.value=m.shininess}else if(m instanceof
 THREE.MeshDepthMaterial){u.mNear.value=f.near;u.mFar.value=f.far;u.opacity.value=m.opacity}else if(m instanceof THREE.MeshNormalMaterial)u.opacity.value=m.opacity;for(var i in u)if(y=z.uniforms[i]){A=u[i];x=A.type;n=A.value;if(x=="i")c.uniform1i(y,n);else if(x=="f")c.uniform1f(y,n);else if(x=="fv1")c.uniform1fv(y,n);else if(x=="fv")c.uniform3fv(y,n);else if(x=="v2")c.uniform2f(y,n.x,n.y);else if(x=="v3")c.uniform3f(y,n.x,n.y,n.z);else if(x=="v4")c.uniform4f(y,n.x,n.y,n.z,n.w);else if(x=="c")c.uniform3f(y,
 n.r,n.g,n.b);else if(x=="t"){c.uniform1i(y,n);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,A.image.__webglTextureCube);for(x=0;x<6;++x)c.texSubImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+x,0,0,0,c.RGBA,c.UNSIGNED_BYTE,A.image[x])}else{A.image.__webglTextureCube=c.createTexture();c.bindTexture(c.TEXTURE_CUBE_MAP,A.image.__webglTextureCube);for(x=0;x<6;++x)c.texImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+
 x,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,A.image[x]);A.__webglInit=!0}xa(c.TEXTURE_CUBE_MAP,A,A.image[0]);c.bindTexture(c.TEXTURE_CUBE_MAP,null);A.needsUpdate=!1}c.activeTexture(c.TEXTURE0+n);c.bindTexture(c.TEXTURE_CUBE_MAP,A.image.__webglTextureCube)}}else $(A,n)}}c.uniformMatrix4fv(w.modelViewMatrix,!1,r._modelViewMatrixArray);c.uniformMatrix3fv(w.normalMatrix,!1,r._normalMatrixArray);(m instanceof THREE.MeshShaderMaterial||m instanceof THREE.MeshPhongMaterial||m.envMap)&&c.uniform3f(w.cameraPosition,
@@ -197,90 +198,93 @@ s.buffer);c.vertexAttribPointer(f[w],s.size,c.FLOAT,!1,0,0)}if(f.color>=0){c.bin
 r.__webglSkinVertexBBuffer);c.vertexAttribPointer(f.skinVertexB,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,r.__webglSkinIndicesBuffer);c.vertexAttribPointer(f.skinIndex,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,r.__webglSkinWeightsBuffer);c.vertexAttribPointer(f.skinWeight,4,c.FLOAT,!1,0,0)}if(z instanceof THREE.Mesh)if(m.wireframe){c.lineWidth(m.wireframeLinewidth);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,r.__webglLineBuffer);c.drawElements(c.LINES,r.__webglLineCount,c.UNSIGNED_SHORT,0)}else{c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,
 r.__webglFaceBuffer);c.drawElements(c.TRIANGLES,r.__webglFaceCount,c.UNSIGNED_SHORT,0)}else if(z instanceof THREE.Line){z=z.type==THREE.LineStrip?c.LINE_STRIP:c.LINES;c.lineWidth(m.linewidth);c.drawArrays(z,0,r.__webglLineCount)}else if(z instanceof THREE.ParticleSystem)c.drawArrays(c.POINTS,0,r.__webglParticleCount);else z instanceof THREE.Ribbon&&c.drawArrays(c.TRIANGLE_STRIP,0,r.__webglVertexCount)}}function g(f,s,n){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(s.attributes.position);c.vertexAttribPointer(s.attributes.position,3,c.FLOAT,!1,0,0)}if(f.hasNormal){c.bindBuffer(c.ARRAY_BUFFER,f.__webglNormalBuffer);if(n==THREE.FlatShading){var m,r,z,w,u,A,t,x,y,D,B=f.count*3;for(D=0;D<B;D+=9){n=f.normalArray;m=n[D];r=n[D+1];z=n[D+2];w=n[D+3];A=n[D+4];x=n[D+5];u=n[D+6];t=n[D+7];y=n[D+8];m=(m+w+u)/
-3;r=(r+A+t)/3;z=(z+x+y)/3;n[D]=m;n[D+1]=r;n[D+2]=z;n[D+3]=m;n[D+4]=r;n[D+5]=z;n[D+6]=m;n[D+7]=r;n[D+8]=z}}c.bufferData(c.ARRAY_BUFFER,f.normalArray,c.DYNAMIC_DRAW);c.enableVertexAttribArray(s.attributes.normal);c.vertexAttribPointer(s.attributes.normal,3,c.FLOAT,!1,0,0)}c.drawArrays(c.TRIANGLES,0,f.count);f.count=0}function k(f){if(aa!=f.doubleSided){f.doubleSided?c.disable(c.CULL_FACE):c.enable(c.CULL_FACE);aa=f.doubleSided}if(pa!=f.flipSided){f.flipSided?c.frontFace(c.CW):c.frontFace(c.CCW);pa=
-f.flipSided}}function j(f){if(qa!=f){f?c.enable(c.DEPTH_TEST):c.disable(c.DEPTH_TEST);qa=f}}function o(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 s;for(f=0;f<6;f++){s=Aa[f];s.divideScalar(Math.sqrt(s.x*
+3;r=(r+A+t)/3;z=(z+x+y)/3;n[D]=m;n[D+1]=r;n[D+2]=z;n[D+3]=m;n[D+4]=r;n[D+5]=z;n[D+6]=m;n[D+7]=r;n[D+8]=z}}c.bufferData(c.ARRAY_BUFFER,f.normalArray,c.DYNAMIC_DRAW);c.enableVertexAttribArray(s.attributes.normal);c.vertexAttribPointer(s.attributes.normal,3,c.FLOAT,!1,0,0)}c.drawArrays(c.TRIANGLES,0,f.count);f.count=0}function k(f){if(aa!=f.doubleSided){f.doubleSided?c.disable(c.CULL_FACE):c.enable(c.CULL_FACE);aa=f.doubleSided}if(qa!=f.flipSided){f.flipSided?c.frontFace(c.CW):c.frontFace(c.CCW);qa=
+f.flipSided}}function j(f){if(ra!=f){f?c.enable(c.DEPTH_TEST):c.disable(c.DEPTH_TEST);ra=f}}function o(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 s;for(f=0;f<6;f++){s=Aa[f];s.divideScalar(Math.sqrt(s.x*
 s.x+s.y*s.y+s.z*s.z))}}function p(f){for(var s=f.matrixWorld,n=-f.geometry.boundingSphere.radius*Math.max(f.scale.x,Math.max(f.scale.y,f.scale.z)),m=0;m<6;m++){f=Aa[m].x*s.n14+Aa[m].y*s.n24+Aa[m].z*s.n34+Aa[m].w;if(f<=n)return!1}return!0}function v(f,s){f.list[f.count]=s;f.count+=1}function E(f){var s,n,m=f.object,r=f.opaque,z=f.transparent;z.count=0;f=r.count=0;for(s=m.materials.length;f<s;f++){n=m.materials[f];n.transparent?v(z,n):v(r,n)}}function G(f){var s,n,m,r,z=f.object,w=f.buffer,u=f.opaque,
 A=f.transparent;A.count=0;f=u.count=0;for(m=z.materials.length;f<m;f++){s=z.materials[f];if(s instanceof THREE.MeshFaceMaterial){s=0;for(n=w.materials.length;s<n;s++)(r=w.materials[s])&&(r.transparent?v(A,r):v(u,r))}else(r=s)&&(r.transparent?v(A,r):v(u,r))}}function I(f,s){return s.z-f.z}function H(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 s,n=f.lights.length,m,r=f.lights,z=[],w,u,A,t,x,y=f.__webglShadowVolumes.length;for(s=0;s<n;s++){m=f.lights[s];if(m instanceof THREE.DirectionalLight){z[0]=-m.position.x;z[1]=-m.position.y;z[2]=-m.position.z;for(x=0;x<y;x++){m=f.__webglShadowVolumes[x].object;w=f.__webglShadowVolumes[x].buffer;u=m.materials[0];u.program||ya.initMaterial(u,r,undefined,m);u=u.program;A=u.uniforms;t=u.attributes;if(oa!==u){c.useProgram(u);oa=
 u;c.uniformMatrix4fv(A.projectionMatrix,!1,Pa);c.uniformMatrix4fv(A.viewMatrix,!1,Ua);c.uniform3fv(A.directionalLightDirection,z)}m.matrixWorld.flattenToArray(m._objectMatrixArray);c.uniformMatrix4fv(A.objectMatrix,!1,m._objectMatrixArray);c.bindBuffer(c.ARRAY_BUFFER,w.__webglVertexBuffer);c.vertexAttribPointer(t.position,3,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,w.__webglNormalBuffer);c.vertexAttribPointer(t.normal,3,c.FLOAT,!1,0,0);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,w.__webglFaceBuffer);c.cullFace(c.FRONT);
-c.drawElements(c.TRIANGLES,w.__webglFaceCount,c.UNSIGNED_SHORT,0);c.cullFace(c.BACK);c.drawElements(c.TRIANGLES,w.__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);fa="";oa=V.program;c.useProgram(V.program);c.uniformMatrix4fv(V.projectionLocation,!1,Pa);c.uniform1f(V.darknessLocation,V.darkness);c.bindBuffer(c.ARRAY_BUFFER,V.vertexBuffer);c.vertexAttribPointer(V.vertexLocation,
-3,c.FLOAT,!1,0,0);c.enableVertexAttribArray(V.vertexLocation);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA);c.blendEquation(c.FUNC_ADD);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,V.elementBuffer);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0);c.disable(c.STENCIL_TEST);c.enable(c.DEPTH_TEST);c.depthMask(Ga)}function L(f,s){var n,m,r=f.__webglLensFlares.length,z,w,u,A=new THREE.Vector3,t=za/ga,x=ga*0.5,y=za*0.5,D=16/za,B=[D*t,D],N=[1,1,0],Y=[1,1],O=J.uniforms;n=J.attributes;c.useProgram(J.program);oa=J.program;
-fa="";c.uniform1i(O.occlusionMap,0);c.uniform1i(O.map,1);c.bindBuffer(c.ARRAY_BUFFER,J.vertexBuffer);c.vertexAttribPointer(n.vertex,2,c.FLOAT,!1,16,0);c.vertexAttribPointer(n.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);c.bindTexture(c.TEXTURE_2D,J.tempTexture);for(m=0;m<r;m++){n=f.__webglLensFlares[m].object;A.set(n.matrixWorld.n14,
-n.matrixWorld.n24,n.matrixWorld.n34);s.matrixWorldInverse.multiplyVector3(A);s.projectionMatrix.multiplyVector3(A);N[0]=A.x;N[1]=A.y;N[2]=A.z;Y[0]=N[0]*x+x;Y[1]=N[1]*y+y;if(J.hasVertexTexture||Y[0]>0&&Y[0]<ga&&Y[1]>0&&Y[1]<za){c.bindTexture(c.TEXTURE_2D,J.tempTexture);c.copyTexSubImage2D(c.TEXTURE_2D,0,0,0,Y[0]-8,Y[1]-8,16,16);c.uniform1i(O.renderType,0);c.uniform2fv(O.scale,B);c.uniform3fv(O.screenPosition,N);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.copyTexSubImage2D(c.TEXTURE_2D,0,0,0,Y[0]-8,Y[1]-8,16,16);c.uniform1i(O.renderType,1);c.disable(c.DEPTH_TEST);c.bindTexture(c.TEXTURE_2D,J.tempTexture);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0);n.positionScreen.x=N[0];n.positionScreen.y=N[1];n.positionScreen.z=N[2];n.customUpdateCallback?n.customUpdateCallback(n):n.updateLensFlares();c.uniform1i(O.renderType,2);c.enable(c.BLEND);z=0;for(w=n.lensFlares.length;z<w;z++){u=n.lensFlares[z];if(u.opacity>
-0.0010&&u.scale>0.0010){N[0]=u.x;N[1]=u.y;N[2]=u.z;D=u.size*u.scale/za;B[0]=D*t;B[1]=D;c.uniform3fv(O.screenPosition,N);c.uniform2fv(O.scale,B);c.uniform1f(O.rotation,u.rotation);c.uniform1f(O.opacity,u.opacity);na(u.blending);$(u.texture,1);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0)}}}}c.enable(c.CULL_FACE);c.enable(c.DEPTH_TEST);c.depthMask(Ga)}function M(f,s){f._modelViewMatrix.multiplyToArray(s.matrixWorldInverse,f.matrixWorld,f._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(f._modelViewMatrix).transposeIntoArray(f._normalMatrixArray)}
-function W(f){var s,n,m,r,z;if(f instanceof THREE.Mesh){n=f.geometry;for(s in n.geometryGroups){m=n.geometryGroups[s];z=!1;for(r in m.__webglCustomAttributes)if(m.__webglCustomAttributes[r].needsUpdate){z=!0;break}if(n.__dirtyVertices||n.__dirtyMorphTargets||n.__dirtyElements||n.__dirtyUvs||n.__dirtyNormals||n.__dirtyColors||n.__dirtyTangents||z){z=c.DYNAMIC_DRAW;var w=void 0,u=void 0,A=void 0,t=void 0;A=void 0;var x=void 0,y=void 0,D=void 0,B=void 0,N=void 0,Y=void 0,O=void 0,Z=void 0,Ha=void 0,
-R=void 0,Q=void 0,S=void 0,sa=void 0;y=void 0;D=void 0;t=void 0;B=void 0;t=void 0;var q=void 0,F=void 0;y=void 0;q=void 0;F=void 0;var i=void 0,Ka=void 0;q=void 0;F=void 0;i=void 0;Ka=void 0;q=void 0;F=void 0;i=void 0;Ka=void 0;q=void 0;F=void 0;i=void 0;t=void 0;B=void 0;x=void 0;A=void 0;A=void 0;q=void 0;F=void 0;i=void 0;var Wa=void 0,ta=0,Ba=0,$a=0,ab=0,Ja=0,La=0,da=0,Ma=0,wa=0,C=0,Ca=0;F=q=0;var Da=m.__vertexArray,ib=m.__uvArray,jb=m.__uv2Array,Qa=m.__normalArray,ia=m.__tangentArray,Ea=m.__colorArray,
-ja=m.__skinVertexAArray,ka=m.__skinVertexBArray,la=m.__skinIndexArray,ma=m.__skinWeightArray,kb=m.__morphTargetsArrays,Ra=m.__webglCustomAttributes;i=void 0;var Na=m.__faceArray,Oa=m.__lineArray,rb=m.__needsSmoothNormals;Y=m.__vertexColorType;N=m.__uvType;O=m.__normalType;var Ia=f.geometry,lb=Ia.__dirtyVertices,mb=Ia.__dirtyElements,gb=Ia.__dirtyUvs,nb=Ia.__dirtyNormals,ob=Ia.__dirtyTangents,pb=Ia.__dirtyColors,qb=Ia.__dirtyMorphTargets,bb=Ia.vertices,sb=m.faces,wb=Ia.faces,tb=Ia.faceVertexUvs[0],
-ub=Ia.faceVertexUvs[1],cb=Ia.skinVerticesA,db=Ia.skinVerticesB,eb=Ia.skinIndices,Xa=Ia.skinWeights,Za=Ia.edgeFaces,Ta=Ia.morphTargets;if(Ra)for(Wa in Ra){Ra[Wa].offset=0;Ra[Wa].offsetSrc=0}w=0;for(u=sb.length;w<u;w++){A=sb[w];t=wb[A];tb&&(Z=tb[A]);ub&&(Ha=ub[A]);A=t.vertexNormals;x=t.normal;y=t.vertexColors;D=t.color;B=t.vertexTangents;if(t instanceof THREE.Face3){if(lb){R=bb[t.a].position;Q=bb[t.b].position;S=bb[t.c].position;Da[Ba]=R.x;Da[Ba+1]=R.y;Da[Ba+2]=R.z;Da[Ba+3]=Q.x;Da[Ba+4]=Q.y;Da[Ba+5]=
-Q.z;Da[Ba+6]=S.x;Da[Ba+7]=S.y;Da[Ba+8]=S.z;Ba+=9}if(Ra)for(Wa in Ra){i=Ra[Wa];if(i.needsUpdate){q=i.offset;F=i.offsetSrc;if(i.size===1){if(i.boundTo===undefined||i.boundTo==="vertices"){i.array[q+0]=i.value[t.a];i.array[q+1]=i.value[t.b];i.array[q+2]=i.value[t.c]}else if(i.boundTo==="faces"){i.array[q+0]=i.value[F];i.array[q+1]=i.value[F];i.array[q+2]=i.value[F];i.offsetSrc++}else if(i.boundTo==="faceVertices"){i.array[q+0]=i.value[F+0];i.array[q+1]=i.value[F+1];i.array[q+2]=i.value[F+2];i.offsetSrc+=
-3}i.offset+=3}else{if(i.boundTo===undefined||i.boundTo==="vertices"){R=i.value[t.a];Q=i.value[t.b];S=i.value[t.c]}else if(i.boundTo==="faces"){R=i.value[F];Q=i.value[F];S=i.value[F];i.offsetSrc++}else if(i.boundTo==="faceVertices"){R=i.value[F+0];Q=i.value[F+1];S=i.value[F+2];i.offsetSrc+=3}if(i.size===2){i.array[q+0]=R.x;i.array[q+1]=R.y;i.array[q+2]=Q.x;i.array[q+3]=Q.y;i.array[q+4]=S.x;i.array[q+5]=S.y;i.offset+=6}else if(i.size===3){if(i.type==="c"){i.array[q+0]=R.r;i.array[q+1]=R.g;i.array[q+
-2]=R.b;i.array[q+3]=Q.r;i.array[q+4]=Q.g;i.array[q+5]=Q.b;i.array[q+6]=S.r;i.array[q+7]=S.g;i.array[q+8]=S.b}else{i.array[q+0]=R.x;i.array[q+1]=R.y;i.array[q+2]=R.z;i.array[q+3]=Q.x;i.array[q+4]=Q.y;i.array[q+5]=Q.z;i.array[q+6]=S.x;i.array[q+7]=S.y;i.array[q+8]=S.z}i.offset+=9}else{i.array[q+0]=R.x;i.array[q+1]=R.y;i.array[q+2]=R.z;i.array[q+3]=R.w;i.array[q+4]=Q.x;i.array[q+5]=Q.y;i.array[q+6]=Q.z;i.array[q+7]=Q.w;i.array[q+8]=S.x;i.array[q+9]=S.y;i.array[q+10]=S.z;i.array[q+11]=S.w;i.offset+=12}}}}if(qb){q=
-0;for(F=Ta.length;q<F;q++){R=Ta[q].vertices[t.a].position;Q=Ta[q].vertices[t.b].position;S=Ta[q].vertices[t.c].position;i=kb[q];i[Ca+0]=R.x;i[Ca+1]=R.y;i[Ca+2]=R.z;i[Ca+3]=Q.x;i[Ca+4]=Q.y;i[Ca+5]=Q.z;i[Ca+6]=S.x;i[Ca+7]=S.y;i[Ca+8]=S.z}Ca+=9}if(Xa.length){q=Xa[t.a];F=Xa[t.b];i=Xa[t.c];ma[C]=q.x;ma[C+1]=q.y;ma[C+2]=q.z;ma[C+3]=q.w;ma[C+4]=F.x;ma[C+5]=F.y;ma[C+6]=F.z;ma[C+7]=F.w;ma[C+8]=i.x;ma[C+9]=i.y;ma[C+10]=i.z;ma[C+11]=i.w;q=eb[t.a];F=eb[t.b];i=eb[t.c];la[C]=q.x;la[C+1]=q.y;la[C+2]=q.z;la[C+3]=
-q.w;la[C+4]=F.x;la[C+5]=F.y;la[C+6]=F.z;la[C+7]=F.w;la[C+8]=i.x;la[C+9]=i.y;la[C+10]=i.z;la[C+11]=i.w;q=cb[t.a];F=cb[t.b];i=cb[t.c];ja[C]=q.x;ja[C+1]=q.y;ja[C+2]=q.z;ja[C+3]=1;ja[C+4]=F.x;ja[C+5]=F.y;ja[C+6]=F.z;ja[C+7]=1;ja[C+8]=i.x;ja[C+9]=i.y;ja[C+10]=i.z;ja[C+11]=1;q=db[t.a];F=db[t.b];i=db[t.c];ka[C]=q.x;ka[C+1]=q.y;ka[C+2]=q.z;ka[C+3]=1;ka[C+4]=F.x;ka[C+5]=F.y;ka[C+6]=F.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(pb&&Y){if(y.length==3&&Y==THREE.VertexColors){t=y[0];q=
-y[1];F=y[2]}else F=q=t=D;Ea[wa]=t.r;Ea[wa+1]=t.g;Ea[wa+2]=t.b;Ea[wa+3]=q.r;Ea[wa+4]=q.g;Ea[wa+5]=q.b;Ea[wa+6]=F.r;Ea[wa+7]=F.g;Ea[wa+8]=F.b;wa+=9}if(ob&&Ia.hasTangents){y=B[0];D=B[1];t=B[2];ia[da]=y.x;ia[da+1]=y.y;ia[da+2]=y.z;ia[da+3]=y.w;ia[da+4]=D.x;ia[da+5]=D.y;ia[da+6]=D.z;ia[da+7]=D.w;ia[da+8]=t.x;ia[da+9]=t.y;ia[da+10]=t.z;ia[da+11]=t.w;da+=12}if(nb&&O)if(A.length==3&&rb)for(B=0;B<3;B++){x=A[B];Qa[La]=x.x;Qa[La+1]=x.y;Qa[La+2]=x.z;La+=3}else for(B=0;B<3;B++){Qa[La]=x.x;Qa[La+1]=x.y;Qa[La+2]=
-x.z;La+=3}if(gb&&Z!==undefined&&N)for(B=0;B<3;B++){A=Z[B];ib[$a]=A.u;ib[$a+1]=A.v;$a+=2}if(gb&&Ha!==undefined&&N)for(B=0;B<3;B++){A=Ha[B];jb[ab]=A.u;jb[ab+1]=A.v;ab+=2}if(mb){Na[Ja]=ta;Na[Ja+1]=ta+1;Na[Ja+2]=ta+2;Ja+=3;Oa[Ma]=ta;Oa[Ma+1]=ta+1;Oa[Ma+2]=ta;Oa[Ma+3]=ta+2;Oa[Ma+4]=ta+1;Oa[Ma+5]=ta+2;Ma+=6;ta+=3}}else if(t instanceof THREE.Face4){if(lb){R=bb[t.a].position;Q=bb[t.b].position;S=bb[t.c].position;sa=bb[t.d].position;Da[Ba]=R.x;Da[Ba+1]=R.y;Da[Ba+2]=R.z;Da[Ba+3]=Q.x;Da[Ba+4]=Q.y;Da[Ba+5]=Q.z;
-Da[Ba+6]=S.x;Da[Ba+7]=S.y;Da[Ba+8]=S.z;Da[Ba+9]=sa.x;Da[Ba+10]=sa.y;Da[Ba+11]=sa.z;Ba+=12}if(Ra)for(Wa in Ra){i=Ra[Wa];if(i.needsUpdate){q=i.offset;F=i.offsetSrc;if(i.size===1){if(i.boundTo===undefined||i.boundTo==="vertices"){i.array[q+0]=i.value[t.a];i.array[q+1]=i.value[t.b];i.array[q+2]=i.value[t.c];i.array[q+2]=i.value[t.d]}else if(i.boundTo==="faces"){i.array[q+0]=i.value[F];i.array[q+1]=i.value[F];i.array[q+2]=i.value[F];i.array[q+2]=i.value[F];i.offsetSrc++}else if(i.boundTo==="faceVertices"){i.array[q+
-0]=i.value[F+0];i.array[q+1]=i.value[F+1];i.array[q+2]=i.value[F+2];i.array[q+2]=i.value[F+3];i.offsetSrc+=4}i.offset+=4}else{if(i.boundTo===undefined||i.boundTo==="vertices"){R=i.value[t.a];Q=i.value[t.b];S=i.value[t.c];sa=i.value[t.d]}else if(i.boundTo==="faces"){R=i.value[F];Q=i.value[F];S=i.value[F];sa=i.value[F];i.offsetSrc++}else if(i.boundTo==="faceVertices"){R=i.value[F+0];Q=i.value[F+1];S=i.value[F+2];sa=i.value[F+3];i.offsetSrc+=4}if(i.size===2){i.array[q+0]=R.x;i.array[q+1]=R.y;i.array[q+
-2]=Q.x;i.array[q+3]=Q.y;i.array[q+4]=S.x;i.array[q+5]=S.y;i.array[q+6]=sa.x;i.array[q+7]=sa.y;i.offset+=8}else if(i.size===3){if(i.type==="c"){i.array[q+0]=R.r;i.array[q+1]=R.g;i.array[q+2]=R.b;i.array[q+3]=Q.r;i.array[q+4]=Q.g;i.array[q+5]=Q.b;i.array[q+6]=S.r;i.array[q+7]=S.g;i.array[q+8]=S.b;i.array[q+9]=sa.r;i.array[q+10]=sa.g;i.array[q+11]=sa.b}else{i.array[q+0]=R.x;i.array[q+1]=R.y;i.array[q+2]=R.z;i.array[q+3]=Q.x;i.array[q+4]=Q.y;i.array[q+5]=Q.z;i.array[q+6]=S.x;i.array[q+7]=S.y;i.array[q+
-8]=S.z;i.array[q+9]=sa.x;i.array[q+10]=sa.y;i.array[q+11]=sa.z}i.offset+=12}else{i.array[q+0]=R.x;i.array[q+1]=R.y;i.array[q+2]=R.z;i.array[q+3]=R.w;i.array[q+4]=Q.x;i.array[q+5]=Q.y;i.array[q+6]=Q.z;i.array[q+7]=Q.w;i.array[q+8]=S.x;i.array[q+9]=S.y;i.array[q+10]=S.z;i.array[q+11]=S.w;i.array[q+12]=sa.x;i.array[q+13]=sa.y;i.array[q+14]=sa.z;i.array[q+15]=sa.w;i.offset+=16}}}}if(qb){q=0;for(F=Ta.length;q<F;q++){R=Ta[q].vertices[t.a].position;Q=Ta[q].vertices[t.b].position;S=Ta[q].vertices[t.c].position;
-sa=Ta[q].vertices[t.d].position;i=kb[q];i[Ca+0]=R.x;i[Ca+1]=R.y;i[Ca+2]=R.z;i[Ca+3]=Q.x;i[Ca+4]=Q.y;i[Ca+5]=Q.z;i[Ca+6]=S.x;i[Ca+7]=S.y;i[Ca+8]=S.z;i[Ca+9]=sa.x;i[Ca+10]=sa.y;i[Ca+11]=sa.z}Ca+=12}if(Xa.length){q=Xa[t.a];F=Xa[t.b];i=Xa[t.c];Ka=Xa[t.d];ma[C]=q.x;ma[C+1]=q.y;ma[C+2]=q.z;ma[C+3]=q.w;ma[C+4]=F.x;ma[C+5]=F.y;ma[C+6]=F.z;ma[C+7]=F.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;q=eb[t.a];F=eb[t.b];i=eb[t.c];Ka=eb[t.d];la[C]=q.x;
-la[C+1]=q.y;la[C+2]=q.z;la[C+3]=q.w;la[C+4]=F.x;la[C+5]=F.y;la[C+6]=F.z;la[C+7]=F.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;q=cb[t.a];F=cb[t.b];i=cb[t.c];Ka=cb[t.d];ja[C]=q.x;ja[C+1]=q.y;ja[C+2]=q.z;ja[C+3]=1;ja[C+4]=F.x;ja[C+5]=F.y;ja[C+6]=F.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;q=db[t.a];F=db[t.b];i=db[t.c];t=db[t.d];ka[C]=q.x;ka[C+1]=q.y;ka[C+2]=q.z;ka[C+
-3]=1;ka[C+4]=F.x;ka[C+5]=F.y;ka[C+6]=F.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(pb&&Y){if(y.length==4&&Y==THREE.VertexColors){t=y[0];q=y[1];F=y[2];y=y[3]}else y=F=q=t=D;Ea[wa]=t.r;Ea[wa+1]=t.g;Ea[wa+2]=t.b;Ea[wa+3]=q.r;Ea[wa+4]=q.g;Ea[wa+5]=q.b;Ea[wa+6]=F.r;Ea[wa+7]=F.g;Ea[wa+8]=F.b;Ea[wa+9]=y.r;Ea[wa+10]=y.g;Ea[wa+11]=y.b;wa+=12}if(ob&&Ia.hasTangents){y=B[0];D=B[1];t=B[2];B=B[3];ia[da]=y.x;ia[da+1]=y.y;ia[da+2]=y.z;ia[da+
-3]=y.w;ia[da+4]=D.x;ia[da+5]=D.y;ia[da+6]=D.z;ia[da+7]=D.w;ia[da+8]=t.x;ia[da+9]=t.y;ia[da+10]=t.z;ia[da+11]=t.w;ia[da+12]=B.x;ia[da+13]=B.y;ia[da+14]=B.z;ia[da+15]=B.w;da+=16}if(nb&&O)if(A.length==4&&rb)for(B=0;B<4;B++){x=A[B];Qa[La]=x.x;Qa[La+1]=x.y;Qa[La+2]=x.z;La+=3}else for(B=0;B<4;B++){Qa[La]=x.x;Qa[La+1]=x.y;Qa[La+2]=x.z;La+=3}if(gb&&Z!==undefined&&N)for(B=0;B<4;B++){A=Z[B];ib[$a]=A.u;ib[$a+1]=A.v;$a+=2}if(gb&&Ha!==undefined&&N)for(B=0;B<4;B++){A=Ha[B];jb[ab]=A.u;jb[ab+1]=A.v;ab+=2}if(mb){Na[Ja]=
-ta;Na[Ja+1]=ta+1;Na[Ja+2]=ta+3;Na[Ja+3]=ta+1;Na[Ja+4]=ta+2;Na[Ja+5]=ta+3;Ja+=6;Oa[Ma]=ta;Oa[Ma+1]=ta+1;Oa[Ma+2]=ta;Oa[Ma+3]=ta+3;Oa[Ma+4]=ta+1;Oa[Ma+5]=ta+2;Oa[Ma+6]=ta+2;Oa[Ma+7]=ta+3;Ma+=8;ta+=4}}}if(Za){w=0;for(u=Za.length;w<u;w++){Na[Ja]=Za[w].a;Na[Ja+1]=Za[w].b;Na[Ja+2]=Za[w].c;Na[Ja+3]=Za[w].a;Na[Ja+4]=Za[w].c;Na[Ja+5]=Za[w].d;Ja+=6}}if(lb){c.bindBuffer(c.ARRAY_BUFFER,m.__webglVertexBuffer);c.bufferData(c.ARRAY_BUFFER,Da,z)}if(Ra)for(Wa in Ra){i=Ra[Wa];if(i.needsUpdate){c.bindBuffer(c.ARRAY_BUFFER,
-i.buffer);c.bufferData(c.ARRAY_BUFFER,i.array,z);i.needsUpdate=!1}}if(qb){q=0;for(F=Ta.length;q<F;q++){c.bindBuffer(c.ARRAY_BUFFER,m.__webglMorphTargetsBuffers[q]);c.bufferData(c.ARRAY_BUFFER,kb[q],z)}}if(pb&&wa>0){c.bindBuffer(c.ARRAY_BUFFER,m.__webglColorBuffer);c.bufferData(c.ARRAY_BUFFER,Ea,z)}if(nb){c.bindBuffer(c.ARRAY_BUFFER,m.__webglNormalBuffer);c.bufferData(c.ARRAY_BUFFER,Qa,z)}if(ob&&Ia.hasTangents){c.bindBuffer(c.ARRAY_BUFFER,m.__webglTangentBuffer);c.bufferData(c.ARRAY_BUFFER,ia,z)}if(gb&&
-$a>0){c.bindBuffer(c.ARRAY_BUFFER,m.__webglUVBuffer);c.bufferData(c.ARRAY_BUFFER,ib,z)}if(gb&&ab>0){c.bindBuffer(c.ARRAY_BUFFER,m.__webglUV2Buffer);c.bufferData(c.ARRAY_BUFFER,jb,z)}if(mb){c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,m.__webglFaceBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,Na,z);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,m.__webglLineBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,Oa,z)}if(C>0){c.bindBuffer(c.ARRAY_BUFFER,m.__webglSkinVertexABuffer);c.bufferData(c.ARRAY_BUFFER,ja,z);c.bindBuffer(c.ARRAY_BUFFER,
-m.__webglSkinVertexBBuffer);c.bufferData(c.ARRAY_BUFFER,ka,z);c.bindBuffer(c.ARRAY_BUFFER,m.__webglSkinIndicesBuffer);c.bufferData(c.ARRAY_BUFFER,la,z);c.bindBuffer(c.ARRAY_BUFFER,m.__webglSkinWeightsBuffer);c.bufferData(c.ARRAY_BUFFER,ma,z)}}}n.__dirtyVertices=!1;n.__dirtyMorphTargets=!1;n.__dirtyElements=!1;n.__dirtyUvs=!1;n.__dirtyNormals=!1;n.__dirtyTangents=!1;n.__dirtyColors=!1}else if(f instanceof THREE.Ribbon){n=f.geometry;if(n.__dirtyVertices||n.__dirtyColors){f=n;s=c.DYNAMIC_DRAW;Y=f.vertices;
-m=f.colors;O=Y.length;z=m.length;Z=f.__vertexArray;w=f.__colorArray;Ha=f.__dirtyColors;if(f.__dirtyVertices){for(u=0;u<O;u++){N=Y[u].position;r=u*3;Z[r]=N.x;Z[r+1]=N.y;Z[r+2]=N.z}c.bindBuffer(c.ARRAY_BUFFER,f.__webglVertexBuffer);c.bufferData(c.ARRAY_BUFFER,Z,s)}if(Ha){for(u=0;u<z;u++){color=m[u];r=u*3;w[r]=color.r;w[r+1]=color.g;w[r+2]=color.b}c.bindBuffer(c.ARRAY_BUFFER,f.__webglColorBuffer);c.bufferData(c.ARRAY_BUFFER,w,s)}}n.__dirtyVertices=!1;n.__dirtyColors=!1}else if(f instanceof THREE.Line){n=
-f.geometry;if(n.__dirtyVertices||n.__dirtyColors){f=n;s=c.DYNAMIC_DRAW;Y=f.vertices;m=f.colors;O=Y.length;z=m.length;Z=f.__vertexArray;w=f.__colorArray;Ha=f.__dirtyColors;if(f.__dirtyVertices){for(u=0;u<O;u++){N=Y[u].position;r=u*3;Z[r]=N.x;Z[r+1]=N.y;Z[r+2]=N.z}c.bindBuffer(c.ARRAY_BUFFER,f.__webglVertexBuffer);c.bufferData(c.ARRAY_BUFFER,Z,s)}if(Ha){for(u=0;u<z;u++){color=m[u];r=u*3;w[r]=color.r;w[r+1]=color.g;w[r+2]=color.b}c.bindBuffer(c.ARRAY_BUFFER,f.__webglColorBuffer);c.bufferData(c.ARRAY_BUFFER,
-w,s)}}n.__dirtyVertices=!1;n.__dirtyColors=!1}else if(f instanceof THREE.ParticleSystem){n=f.geometry;(n.__dirtyVertices||n.__dirtyColors||f.sortParticles)&&d(n,c.DYNAMIC_DRAW,f);n.__dirtyVertices=!1;n.__dirtyColors=!1}}function P(f){function s(D){var B=[];n=0;for(m=D.length;n<m;n++)D[n]==undefined?B.push("undefined"):B.push(D[n].id);return B.join("_")}var n,m,r,z,w,u,A,t,x={},y=f.morphTargets!==undefined?f.morphTargets.length:0;f.geometryGroups={};r=0;for(z=f.faces.length;r<z;r++){w=f.faces[r];u=
-w.materials;A=s(u);x[A]==undefined&&(x[A]={hash:A,counter:0});t=x[A].hash+"_"+x[A].counter;f.geometryGroups[t]==undefined&&(f.geometryGroups[t]={faces:[],materials:u,vertices:0,numMorphTargets:y});w=w instanceof THREE.Face3?3:4;if(f.geometryGroups[t].vertices+w>65535){x[A].counter+=1;t=x[A].hash+"_"+x[A].counter;f.geometryGroups[t]==undefined&&(f.geometryGroups[t]={faces:[],materials:u,vertices:0,numMorphTargets:y})}f.geometryGroups[t].faces.push(r);f.geometryGroups[t].vertices+=w}}function ca(f,
-s,n){f.push({buffer:s,object:n,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function na(f){if(f!=fa){switch(f){case THREE.AdditiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.SRC_ALPHA,c.ONE);break;case THREE.SubtractiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ZERO,c.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ZERO,c.SRC_COLOR);break;default:c.blendEquationSeparate(c.FUNC_ADD,c.FUNC_ADD);c.blendFuncSeparate(c.SRC_ALPHA,
-c.ONE_MINUS_SRC_ALPHA,c.ONE,c.ONE_MINUS_SRC_ALPHA)}fa=f}}function xa(f,s,n){if((n.width&n.width-1)==0&&(n.height&n.height-1)==0){c.texParameteri(f,c.TEXTURE_WRAP_S,ea(s.wrapS));c.texParameteri(f,c.TEXTURE_WRAP_T,ea(s.wrapT));c.texParameteri(f,c.TEXTURE_MAG_FILTER,ea(s.magFilter));c.texParameteri(f,c.TEXTURE_MIN_FILTER,ea(s.minFilter));c.generateMipmap(f)}else{c.texParameteri(f,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(f,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);c.texParameteri(f,c.TEXTURE_MAG_FILTER,
-ua(s.magFilter));c.texParameteri(f,c.TEXTURE_MIN_FILTER,ua(s.minFilter))}}function $(f,s){if(f.needsUpdate){if(f.__webglInit){c.bindTexture(c.TEXTURE_2D,f.__webglTexture);c.texSubImage2D(c.TEXTURE_2D,0,0,0,c.RGBA,c.UNSIGNED_BYTE,f.image)}else{f.__webglTexture=c.createTexture();c.bindTexture(c.TEXTURE_2D,f.__webglTexture);c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,f.image);f.__webglInit=!0}xa(c.TEXTURE_2D,f,f.image);c.bindTexture(c.TEXTURE_2D,null);f.needsUpdate=!1}c.activeTexture(c.TEXTURE0+
-s);c.bindTexture(c.TEXTURE_2D,f.__webglTexture)}function K(f){if(f&&!f.__webglFramebuffer){if(f.depthBuffer===undefined)f.depthBuffer=!0;if(f.stencilBuffer===undefined)f.stencilBuffer=!0;f.__webglFramebuffer=c.createFramebuffer();f.__webglRenderbuffer=c.createRenderbuffer();f.__webglTexture=c.createTexture();c.bindTexture(c.TEXTURE_2D,f.__webglTexture);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,ea(f.wrapS));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,ea(f.wrapT));c.texParameteri(c.TEXTURE_2D,
-c.TEXTURE_MAG_FILTER,ea(f.magFilter));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,ea(f.minFilter));c.texImage2D(c.TEXTURE_2D,0,ea(f.format),f.width,f.height,0,ea(f.format),ea(f.type),null);c.bindRenderbuffer(c.RENDERBUFFER,f.__webglRenderbuffer);c.bindFramebuffer(c.FRAMEBUFFER,f.__webglFramebuffer);c.framebufferTexture2D(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,c.TEXTURE_2D,f.__webglTexture,0);if(f.depthBuffer&&!f.stencilBuffer){c.renderbufferStorage(c.RENDERBUFFER,c.DEPTH_COMPONENT16,f.width,f.height);
-c.framebufferRenderbuffer(c.FRAMEBUFFER,c.DEPTH_ATTACHMENT,c.RENDERBUFFER,f.__webglRenderbuffer)}else if(f.depthBuffer&&f.stencilBuffer){c.renderbufferStorage(c.RENDERBUFFER,c.DEPTH_STENCIL,f.width,f.height);c.framebufferRenderbuffer(c.FRAMEBUFFER,c.DEPTH_STENCIL_ATTACHMENT,c.RENDERBUFFER,f.__webglRenderbuffer)}else c.renderbufferStorage(c.RENDERBUFFER,c.RGBA4,f.width,f.height);c.bindTexture(c.TEXTURE_2D,null);c.bindRenderbuffer(c.RENDERBUFFER,null);c.bindFramebuffer(c.FRAMEBUFFER,null)}var s,n;if(f){s=
-f.__webglFramebuffer;n=f.width;f=f.height}else{s=null;n=ga;f=za}if(s!=Fa){c.bindFramebuffer(c.FRAMEBUFFER,s);c.viewport(X,va,n,f);Fa=s}}function ra(f,s){var n;if(f=="fragment")n=c.createShader(c.FRAGMENT_SHADER);else f=="vertex"&&(n=c.createShader(c.VERTEX_SHADER));c.shaderSource(n,s);c.compileShader(n);if(!c.getShaderParameter(n,c.COMPILE_STATUS)){console.error(c.getShaderInfoLog(n));console.error(s);return null}return n}function ua(f){switch(f){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return c.NEAREST;
-default:return c.LINEAR}}function ea(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;
+c.drawElements(c.TRIANGLES,w.__webglFaceCount,c.UNSIGNED_SHORT,0);c.cullFace(c.BACK);c.drawElements(c.TRIANGLES,w.__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);fa="";oa=W.program;c.useProgram(W.program);c.uniformMatrix4fv(W.projectionLocation,!1,Pa);c.uniform1f(W.darknessLocation,W.darkness);c.bindBuffer(c.ARRAY_BUFFER,W.vertexBuffer);c.vertexAttribPointer(W.vertexLocation,
+3,c.FLOAT,!1,0,0);c.enableVertexAttribArray(W.vertexLocation);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA);c.blendEquation(c.FUNC_ADD);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,W.elementBuffer);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0);c.disable(c.STENCIL_TEST);c.enable(c.DEPTH_TEST);c.depthMask(Ga)}function L(f,s){var n,m,r=f.__webglLensFlares.length,z,w,u,A=new THREE.Vector3,t=za/ga,x=ga*0.5,y=za*0.5,D=16/za,B=[D*t,D],N=[1,1,0],Y=[1,1],O=J.uniforms;n=J.attributes;c.useProgram(J.program);oa=J.program;
+fa="";c.uniform1i(O.occlusionMap,0);c.uniform1i(O.map,1);c.bindBuffer(c.ARRAY_BUFFER,J.vertexBuffer);c.vertexAttribPointer(n.vertex,2,c.FLOAT,!1,16,0);c.vertexAttribPointer(n.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(m=0;m<r;m++){n=f.__webglLensFlares[m].object;A.set(n.matrixWorld.n14,n.matrixWorld.n24,n.matrixWorld.n34);
+s.matrixWorldInverse.multiplyVector3(A);s.projectionMatrix.multiplyVector3(A);N[0]=A.x;N[1]=A.y;N[2]=A.z;Y[0]=N[0]*x+x;Y[1]=N[1]*y+y;if(Y[0]>0&&Y[0]<ga&&Y[1]>0&&Y[1]<za){c.bindTexture(c.TEXTURE_2D,J.tempTexture);c.copyTexSubImage2D(c.TEXTURE_2D,0,0,0,Y[0]-8,Y[1]-8,16,16);c.uniform1i(O.renderType,0);c.uniform2fv(O.scale,B);c.uniform3fv(O.screenPosition,N);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.copyTexSubImage2D(c.TEXTURE_2D,
+0,0,0,Y[0]-8,Y[1]-8,16,16);c.uniform1i(O.renderType,1);c.disable(c.DEPTH_TEST);c.bindTexture(c.TEXTURE_2D,J.tempTexture);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0);n.positionScreen.x=N[0];n.positionScreen.y=N[1];n.positionScreen.z=N[2];n.customUpdateCallback?n.customUpdateCallback(n):n.updateLensFlares();c.uniform1i(O.renderType,2);c.enable(c.BLEND);z=0;for(w=n.lensFlares.length;z<w;z++){u=n.lensFlares[z];if(u.opacity>0.0010&&u.scale>0.0010){N[0]=u.x;N[1]=u.y;N[2]=u.z;D=u.size*u.scale/za;B[0]=
+D*t;B[1]=D;c.uniform3fv(O.screenPosition,N);c.uniform2fv(O.scale,B);c.uniform1f(O.rotation,u.rotation);c.uniform1f(O.opacity,u.opacity);na(u.blending);$(u.texture,1);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0)}}}}c.enable(c.CULL_FACE);c.enable(c.DEPTH_TEST);c.depthMask(Ga)}function M(f,s){f._modelViewMatrix.multiplyToArray(s.matrixWorldInverse,f.matrixWorld,f._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(f._modelViewMatrix).transposeIntoArray(f._normalMatrixArray)}function T(f){var s,n,
+m,r,z;if(f instanceof THREE.Mesh){n=f.geometry;for(s in n.geometryGroups){m=n.geometryGroups[s];z=!1;for(r in m.__webglCustomAttributes)if(m.__webglCustomAttributes[r].needsUpdate){z=!0;break}if(n.__dirtyVertices||n.__dirtyMorphTargets||n.__dirtyElements||n.__dirtyUvs||n.__dirtyNormals||n.__dirtyColors||n.__dirtyTangents||z){z=c.DYNAMIC_DRAW;var w=void 0,u=void 0,A=void 0,t=void 0;A=void 0;var x=void 0,y=void 0,D=void 0,B=void 0,N=void 0,Y=void 0,O=void 0,Z=void 0,Ha=void 0,R=void 0,Q=void 0,S=void 0,
+sa=void 0;y=void 0;D=void 0;t=void 0;B=void 0;t=void 0;var q=void 0,F=void 0;y=void 0;q=void 0;F=void 0;var i=void 0,Ka=void 0;q=void 0;F=void 0;i=void 0;Ka=void 0;q=void 0;F=void 0;i=void 0;Ka=void 0;q=void 0;F=void 0;i=void 0;t=void 0;B=void 0;x=void 0;A=void 0;A=void 0;q=void 0;F=void 0;i=void 0;var Wa=void 0,ta=0,Ba=0,$a=0,ab=0,Ja=0,La=0,da=0,Ma=0,wa=0,C=0,Ca=0;F=q=0;var Da=m.__vertexArray,ib=m.__uvArray,jb=m.__uv2Array,Qa=m.__normalArray,ia=m.__tangentArray,Ea=m.__colorArray,ja=m.__skinVertexAArray,
+ka=m.__skinVertexBArray,la=m.__skinIndexArray,ma=m.__skinWeightArray,kb=m.__morphTargetsArrays,Ra=m.__webglCustomAttributes;i=void 0;var Na=m.__faceArray,Oa=m.__lineArray,rb=m.__needsSmoothNormals;Y=m.__vertexColorType;N=m.__uvType;O=m.__normalType;var Ia=f.geometry,lb=Ia.__dirtyVertices,mb=Ia.__dirtyElements,gb=Ia.__dirtyUvs,nb=Ia.__dirtyNormals,ob=Ia.__dirtyTangents,pb=Ia.__dirtyColors,qb=Ia.__dirtyMorphTargets,bb=Ia.vertices,sb=m.faces,wb=Ia.faces,tb=Ia.faceVertexUvs[0],ub=Ia.faceVertexUvs[1],
+cb=Ia.skinVerticesA,db=Ia.skinVerticesB,eb=Ia.skinIndices,Xa=Ia.skinWeights,Za=Ia.edgeFaces,Ta=Ia.morphTargets;if(Ra)for(Wa in Ra){Ra[Wa].offset=0;Ra[Wa].offsetSrc=0}w=0;for(u=sb.length;w<u;w++){A=sb[w];t=wb[A];tb&&(Z=tb[A]);ub&&(Ha=ub[A]);A=t.vertexNormals;x=t.normal;y=t.vertexColors;D=t.color;B=t.vertexTangents;if(t instanceof THREE.Face3){if(lb){R=bb[t.a].position;Q=bb[t.b].position;S=bb[t.c].position;Da[Ba]=R.x;Da[Ba+1]=R.y;Da[Ba+2]=R.z;Da[Ba+3]=Q.x;Da[Ba+4]=Q.y;Da[Ba+5]=Q.z;Da[Ba+6]=S.x;Da[Ba+
+7]=S.y;Da[Ba+8]=S.z;Ba+=9}if(Ra)for(Wa in Ra){i=Ra[Wa];if(i.needsUpdate){q=i.offset;F=i.offsetSrc;if(i.size===1){if(i.boundTo===undefined||i.boundTo==="vertices"){i.array[q+0]=i.value[t.a];i.array[q+1]=i.value[t.b];i.array[q+2]=i.value[t.c]}else if(i.boundTo==="faces"){i.array[q+0]=i.value[F];i.array[q+1]=i.value[F];i.array[q+2]=i.value[F];i.offsetSrc++}else if(i.boundTo==="faceVertices"){i.array[q+0]=i.value[F+0];i.array[q+1]=i.value[F+1];i.array[q+2]=i.value[F+2];i.offsetSrc+=3}i.offset+=3}else{if(i.boundTo===
+undefined||i.boundTo==="vertices"){R=i.value[t.a];Q=i.value[t.b];S=i.value[t.c]}else if(i.boundTo==="faces"){R=i.value[F];Q=i.value[F];S=i.value[F];i.offsetSrc++}else if(i.boundTo==="faceVertices"){R=i.value[F+0];Q=i.value[F+1];S=i.value[F+2];i.offsetSrc+=3}if(i.size===2){i.array[q+0]=R.x;i.array[q+1]=R.y;i.array[q+2]=Q.x;i.array[q+3]=Q.y;i.array[q+4]=S.x;i.array[q+5]=S.y;i.offset+=6}else if(i.size===3){if(i.type==="c"){i.array[q+0]=R.r;i.array[q+1]=R.g;i.array[q+2]=R.b;i.array[q+3]=Q.r;i.array[q+
+4]=Q.g;i.array[q+5]=Q.b;i.array[q+6]=S.r;i.array[q+7]=S.g;i.array[q+8]=S.b}else{i.array[q+0]=R.x;i.array[q+1]=R.y;i.array[q+2]=R.z;i.array[q+3]=Q.x;i.array[q+4]=Q.y;i.array[q+5]=Q.z;i.array[q+6]=S.x;i.array[q+7]=S.y;i.array[q+8]=S.z}i.offset+=9}else{i.array[q+0]=R.x;i.array[q+1]=R.y;i.array[q+2]=R.z;i.array[q+3]=R.w;i.array[q+4]=Q.x;i.array[q+5]=Q.y;i.array[q+6]=Q.z;i.array[q+7]=Q.w;i.array[q+8]=S.x;i.array[q+9]=S.y;i.array[q+10]=S.z;i.array[q+11]=S.w;i.offset+=12}}}}if(qb){q=0;for(F=Ta.length;q<
+F;q++){R=Ta[q].vertices[t.a].position;Q=Ta[q].vertices[t.b].position;S=Ta[q].vertices[t.c].position;i=kb[q];i[Ca+0]=R.x;i[Ca+1]=R.y;i[Ca+2]=R.z;i[Ca+3]=Q.x;i[Ca+4]=Q.y;i[Ca+5]=Q.z;i[Ca+6]=S.x;i[Ca+7]=S.y;i[Ca+8]=S.z}Ca+=9}if(Xa.length){q=Xa[t.a];F=Xa[t.b];i=Xa[t.c];ma[C]=q.x;ma[C+1]=q.y;ma[C+2]=q.z;ma[C+3]=q.w;ma[C+4]=F.x;ma[C+5]=F.y;ma[C+6]=F.z;ma[C+7]=F.w;ma[C+8]=i.x;ma[C+9]=i.y;ma[C+10]=i.z;ma[C+11]=i.w;q=eb[t.a];F=eb[t.b];i=eb[t.c];la[C]=q.x;la[C+1]=q.y;la[C+2]=q.z;la[C+3]=q.w;la[C+4]=F.x;la[C+
+5]=F.y;la[C+6]=F.z;la[C+7]=F.w;la[C+8]=i.x;la[C+9]=i.y;la[C+10]=i.z;la[C+11]=i.w;q=cb[t.a];F=cb[t.b];i=cb[t.c];ja[C]=q.x;ja[C+1]=q.y;ja[C+2]=q.z;ja[C+3]=1;ja[C+4]=F.x;ja[C+5]=F.y;ja[C+6]=F.z;ja[C+7]=1;ja[C+8]=i.x;ja[C+9]=i.y;ja[C+10]=i.z;ja[C+11]=1;q=db[t.a];F=db[t.b];i=db[t.c];ka[C]=q.x;ka[C+1]=q.y;ka[C+2]=q.z;ka[C+3]=1;ka[C+4]=F.x;ka[C+5]=F.y;ka[C+6]=F.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(pb&&Y){if(y.length==3&&Y==THREE.VertexColors){t=y[0];q=y[1];F=y[2]}else F=q=
+t=D;Ea[wa]=t.r;Ea[wa+1]=t.g;Ea[wa+2]=t.b;Ea[wa+3]=q.r;Ea[wa+4]=q.g;Ea[wa+5]=q.b;Ea[wa+6]=F.r;Ea[wa+7]=F.g;Ea[wa+8]=F.b;wa+=9}if(ob&&Ia.hasTangents){y=B[0];D=B[1];t=B[2];ia[da]=y.x;ia[da+1]=y.y;ia[da+2]=y.z;ia[da+3]=y.w;ia[da+4]=D.x;ia[da+5]=D.y;ia[da+6]=D.z;ia[da+7]=D.w;ia[da+8]=t.x;ia[da+9]=t.y;ia[da+10]=t.z;ia[da+11]=t.w;da+=12}if(nb&&O)if(A.length==3&&rb)for(B=0;B<3;B++){x=A[B];Qa[La]=x.x;Qa[La+1]=x.y;Qa[La+2]=x.z;La+=3}else for(B=0;B<3;B++){Qa[La]=x.x;Qa[La+1]=x.y;Qa[La+2]=x.z;La+=3}if(gb&&Z!==
+undefined&&N)for(B=0;B<3;B++){A=Z[B];ib[$a]=A.u;ib[$a+1]=A.v;$a+=2}if(gb&&Ha!==undefined&&N)for(B=0;B<3;B++){A=Ha[B];jb[ab]=A.u;jb[ab+1]=A.v;ab+=2}if(mb){Na[Ja]=ta;Na[Ja+1]=ta+1;Na[Ja+2]=ta+2;Ja+=3;Oa[Ma]=ta;Oa[Ma+1]=ta+1;Oa[Ma+2]=ta;Oa[Ma+3]=ta+2;Oa[Ma+4]=ta+1;Oa[Ma+5]=ta+2;Ma+=6;ta+=3}}else if(t instanceof THREE.Face4){if(lb){R=bb[t.a].position;Q=bb[t.b].position;S=bb[t.c].position;sa=bb[t.d].position;Da[Ba]=R.x;Da[Ba+1]=R.y;Da[Ba+2]=R.z;Da[Ba+3]=Q.x;Da[Ba+4]=Q.y;Da[Ba+5]=Q.z;Da[Ba+6]=S.x;Da[Ba+
+7]=S.y;Da[Ba+8]=S.z;Da[Ba+9]=sa.x;Da[Ba+10]=sa.y;Da[Ba+11]=sa.z;Ba+=12}if(Ra)for(Wa in Ra){i=Ra[Wa];if(i.needsUpdate){q=i.offset;F=i.offsetSrc;if(i.size===1){if(i.boundTo===undefined||i.boundTo==="vertices"){i.array[q+0]=i.value[t.a];i.array[q+1]=i.value[t.b];i.array[q+2]=i.value[t.c];i.array[q+2]=i.value[t.d]}else if(i.boundTo==="faces"){i.array[q+0]=i.value[F];i.array[q+1]=i.value[F];i.array[q+2]=i.value[F];i.array[q+2]=i.value[F];i.offsetSrc++}else if(i.boundTo==="faceVertices"){i.array[q+0]=i.value[F+
+0];i.array[q+1]=i.value[F+1];i.array[q+2]=i.value[F+2];i.array[q+2]=i.value[F+3];i.offsetSrc+=4}i.offset+=4}else{if(i.boundTo===undefined||i.boundTo==="vertices"){R=i.value[t.a];Q=i.value[t.b];S=i.value[t.c];sa=i.value[t.d]}else if(i.boundTo==="faces"){R=i.value[F];Q=i.value[F];S=i.value[F];sa=i.value[F];i.offsetSrc++}else if(i.boundTo==="faceVertices"){R=i.value[F+0];Q=i.value[F+1];S=i.value[F+2];sa=i.value[F+3];i.offsetSrc+=4}if(i.size===2){i.array[q+0]=R.x;i.array[q+1]=R.y;i.array[q+2]=Q.x;i.array[q+
+3]=Q.y;i.array[q+4]=S.x;i.array[q+5]=S.y;i.array[q+6]=sa.x;i.array[q+7]=sa.y;i.offset+=8}else if(i.size===3){if(i.type==="c"){i.array[q+0]=R.r;i.array[q+1]=R.g;i.array[q+2]=R.b;i.array[q+3]=Q.r;i.array[q+4]=Q.g;i.array[q+5]=Q.b;i.array[q+6]=S.r;i.array[q+7]=S.g;i.array[q+8]=S.b;i.array[q+9]=sa.r;i.array[q+10]=sa.g;i.array[q+11]=sa.b}else{i.array[q+0]=R.x;i.array[q+1]=R.y;i.array[q+2]=R.z;i.array[q+3]=Q.x;i.array[q+4]=Q.y;i.array[q+5]=Q.z;i.array[q+6]=S.x;i.array[q+7]=S.y;i.array[q+8]=S.z;i.array[q+
+9]=sa.x;i.array[q+10]=sa.y;i.array[q+11]=sa.z}i.offset+=12}else{i.array[q+0]=R.x;i.array[q+1]=R.y;i.array[q+2]=R.z;i.array[q+3]=R.w;i.array[q+4]=Q.x;i.array[q+5]=Q.y;i.array[q+6]=Q.z;i.array[q+7]=Q.w;i.array[q+8]=S.x;i.array[q+9]=S.y;i.array[q+10]=S.z;i.array[q+11]=S.w;i.array[q+12]=sa.x;i.array[q+13]=sa.y;i.array[q+14]=sa.z;i.array[q+15]=sa.w;i.offset+=16}}}}if(qb){q=0;for(F=Ta.length;q<F;q++){R=Ta[q].vertices[t.a].position;Q=Ta[q].vertices[t.b].position;S=Ta[q].vertices[t.c].position;sa=Ta[q].vertices[t.d].position;
+i=kb[q];i[Ca+0]=R.x;i[Ca+1]=R.y;i[Ca+2]=R.z;i[Ca+3]=Q.x;i[Ca+4]=Q.y;i[Ca+5]=Q.z;i[Ca+6]=S.x;i[Ca+7]=S.y;i[Ca+8]=S.z;i[Ca+9]=sa.x;i[Ca+10]=sa.y;i[Ca+11]=sa.z}Ca+=12}if(Xa.length){q=Xa[t.a];F=Xa[t.b];i=Xa[t.c];Ka=Xa[t.d];ma[C]=q.x;ma[C+1]=q.y;ma[C+2]=q.z;ma[C+3]=q.w;ma[C+4]=F.x;ma[C+5]=F.y;ma[C+6]=F.z;ma[C+7]=F.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;q=eb[t.a];F=eb[t.b];i=eb[t.c];Ka=eb[t.d];la[C]=q.x;la[C+1]=q.y;la[C+2]=q.z;la[C+3]=
+q.w;la[C+4]=F.x;la[C+5]=F.y;la[C+6]=F.z;la[C+7]=F.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;q=cb[t.a];F=cb[t.b];i=cb[t.c];Ka=cb[t.d];ja[C]=q.x;ja[C+1]=q.y;ja[C+2]=q.z;ja[C+3]=1;ja[C+4]=F.x;ja[C+5]=F.y;ja[C+6]=F.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;q=db[t.a];F=db[t.b];i=db[t.c];t=db[t.d];ka[C]=q.x;ka[C+1]=q.y;ka[C+2]=q.z;ka[C+3]=1;ka[C+4]=F.x;ka[C+5]=F.y;ka[C+
+6]=F.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(pb&&Y){if(y.length==4&&Y==THREE.VertexColors){t=y[0];q=y[1];F=y[2];y=y[3]}else y=F=q=t=D;Ea[wa]=t.r;Ea[wa+1]=t.g;Ea[wa+2]=t.b;Ea[wa+3]=q.r;Ea[wa+4]=q.g;Ea[wa+5]=q.b;Ea[wa+6]=F.r;Ea[wa+7]=F.g;Ea[wa+8]=F.b;Ea[wa+9]=y.r;Ea[wa+10]=y.g;Ea[wa+11]=y.b;wa+=12}if(ob&&Ia.hasTangents){y=B[0];D=B[1];t=B[2];B=B[3];ia[da]=y.x;ia[da+1]=y.y;ia[da+2]=y.z;ia[da+3]=y.w;ia[da+4]=D.x;ia[da+5]=D.y;
+ia[da+6]=D.z;ia[da+7]=D.w;ia[da+8]=t.x;ia[da+9]=t.y;ia[da+10]=t.z;ia[da+11]=t.w;ia[da+12]=B.x;ia[da+13]=B.y;ia[da+14]=B.z;ia[da+15]=B.w;da+=16}if(nb&&O)if(A.length==4&&rb)for(B=0;B<4;B++){x=A[B];Qa[La]=x.x;Qa[La+1]=x.y;Qa[La+2]=x.z;La+=3}else for(B=0;B<4;B++){Qa[La]=x.x;Qa[La+1]=x.y;Qa[La+2]=x.z;La+=3}if(gb&&Z!==undefined&&N)for(B=0;B<4;B++){A=Z[B];ib[$a]=A.u;ib[$a+1]=A.v;$a+=2}if(gb&&Ha!==undefined&&N)for(B=0;B<4;B++){A=Ha[B];jb[ab]=A.u;jb[ab+1]=A.v;ab+=2}if(mb){Na[Ja]=ta;Na[Ja+1]=ta+1;Na[Ja+2]=
+ta+3;Na[Ja+3]=ta+1;Na[Ja+4]=ta+2;Na[Ja+5]=ta+3;Ja+=6;Oa[Ma]=ta;Oa[Ma+1]=ta+1;Oa[Ma+2]=ta;Oa[Ma+3]=ta+3;Oa[Ma+4]=ta+1;Oa[Ma+5]=ta+2;Oa[Ma+6]=ta+2;Oa[Ma+7]=ta+3;Ma+=8;ta+=4}}}if(Za){w=0;for(u=Za.length;w<u;w++){Na[Ja]=Za[w].a;Na[Ja+1]=Za[w].b;Na[Ja+2]=Za[w].c;Na[Ja+3]=Za[w].a;Na[Ja+4]=Za[w].c;Na[Ja+5]=Za[w].d;Ja+=6}}if(lb){c.bindBuffer(c.ARRAY_BUFFER,m.__webglVertexBuffer);c.bufferData(c.ARRAY_BUFFER,Da,z)}if(Ra)for(Wa in Ra){i=Ra[Wa];if(i.needsUpdate){c.bindBuffer(c.ARRAY_BUFFER,i.buffer);c.bufferData(c.ARRAY_BUFFER,
+i.array,z);i.needsUpdate=!1}}if(qb){q=0;for(F=Ta.length;q<F;q++){c.bindBuffer(c.ARRAY_BUFFER,m.__webglMorphTargetsBuffers[q]);c.bufferData(c.ARRAY_BUFFER,kb[q],z)}}if(pb&&wa>0){c.bindBuffer(c.ARRAY_BUFFER,m.__webglColorBuffer);c.bufferData(c.ARRAY_BUFFER,Ea,z)}if(nb){c.bindBuffer(c.ARRAY_BUFFER,m.__webglNormalBuffer);c.bufferData(c.ARRAY_BUFFER,Qa,z)}if(ob&&Ia.hasTangents){c.bindBuffer(c.ARRAY_BUFFER,m.__webglTangentBuffer);c.bufferData(c.ARRAY_BUFFER,ia,z)}if(gb&&$a>0){c.bindBuffer(c.ARRAY_BUFFER,
+m.__webglUVBuffer);c.bufferData(c.ARRAY_BUFFER,ib,z)}if(gb&&ab>0){c.bindBuffer(c.ARRAY_BUFFER,m.__webglUV2Buffer);c.bufferData(c.ARRAY_BUFFER,jb,z)}if(mb){c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,m.__webglFaceBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,Na,z);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,m.__webglLineBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,Oa,z)}if(C>0){c.bindBuffer(c.ARRAY_BUFFER,m.__webglSkinVertexABuffer);c.bufferData(c.ARRAY_BUFFER,ja,z);c.bindBuffer(c.ARRAY_BUFFER,m.__webglSkinVertexBBuffer);
+c.bufferData(c.ARRAY_BUFFER,ka,z);c.bindBuffer(c.ARRAY_BUFFER,m.__webglSkinIndicesBuffer);c.bufferData(c.ARRAY_BUFFER,la,z);c.bindBuffer(c.ARRAY_BUFFER,m.__webglSkinWeightsBuffer);c.bufferData(c.ARRAY_BUFFER,ma,z)}}}n.__dirtyVertices=!1;n.__dirtyMorphTargets=!1;n.__dirtyElements=!1;n.__dirtyUvs=!1;n.__dirtyNormals=!1;n.__dirtyTangents=!1;n.__dirtyColors=!1}else if(f instanceof THREE.Ribbon){n=f.geometry;if(n.__dirtyVertices||n.__dirtyColors){f=n;s=c.DYNAMIC_DRAW;Y=f.vertices;m=f.colors;O=Y.length;
+z=m.length;Z=f.__vertexArray;w=f.__colorArray;Ha=f.__dirtyColors;if(f.__dirtyVertices){for(u=0;u<O;u++){N=Y[u].position;r=u*3;Z[r]=N.x;Z[r+1]=N.y;Z[r+2]=N.z}c.bindBuffer(c.ARRAY_BUFFER,f.__webglVertexBuffer);c.bufferData(c.ARRAY_BUFFER,Z,s)}if(Ha){for(u=0;u<z;u++){color=m[u];r=u*3;w[r]=color.r;w[r+1]=color.g;w[r+2]=color.b}c.bindBuffer(c.ARRAY_BUFFER,f.__webglColorBuffer);c.bufferData(c.ARRAY_BUFFER,w,s)}}n.__dirtyVertices=!1;n.__dirtyColors=!1}else if(f instanceof THREE.Line){n=f.geometry;if(n.__dirtyVertices||
+n.__dirtyColors){f=n;s=c.DYNAMIC_DRAW;Y=f.vertices;m=f.colors;O=Y.length;z=m.length;Z=f.__vertexArray;w=f.__colorArray;Ha=f.__dirtyColors;if(f.__dirtyVertices){for(u=0;u<O;u++){N=Y[u].position;r=u*3;Z[r]=N.x;Z[r+1]=N.y;Z[r+2]=N.z}c.bindBuffer(c.ARRAY_BUFFER,f.__webglVertexBuffer);c.bufferData(c.ARRAY_BUFFER,Z,s)}if(Ha){for(u=0;u<z;u++){color=m[u];r=u*3;w[r]=color.r;w[r+1]=color.g;w[r+2]=color.b}c.bindBuffer(c.ARRAY_BUFFER,f.__webglColorBuffer);c.bufferData(c.ARRAY_BUFFER,w,s)}}n.__dirtyVertices=!1;
+n.__dirtyColors=!1}else if(f instanceof THREE.ParticleSystem){n=f.geometry;(n.__dirtyVertices||n.__dirtyColors||f.sortParticles)&&d(n,c.DYNAMIC_DRAW,f);n.__dirtyVertices=!1;n.__dirtyColors=!1}}function P(f){function s(D){var B=[];n=0;for(m=D.length;n<m;n++)D[n]==undefined?B.push("undefined"):B.push(D[n].id);return B.join("_")}var n,m,r,z,w,u,A,t,x={},y=f.morphTargets!==undefined?f.morphTargets.length:0;f.geometryGroups={};r=0;for(z=f.faces.length;r<z;r++){w=f.faces[r];u=w.materials;A=s(u);x[A]==undefined&&
+(x[A]={hash:A,counter:0});t=x[A].hash+"_"+x[A].counter;f.geometryGroups[t]==undefined&&(f.geometryGroups[t]={faces:[],materials:u,vertices:0,numMorphTargets:y});w=w instanceof THREE.Face3?3:4;if(f.geometryGroups[t].vertices+w>65535){x[A].counter+=1;t=x[A].hash+"_"+x[A].counter;f.geometryGroups[t]==undefined&&(f.geometryGroups[t]={faces:[],materials:u,vertices:0,numMorphTargets:y})}f.geometryGroups[t].faces.push(r);f.geometryGroups[t].vertices+=w}}function ca(f,s,n){f.push({buffer:s,object:n,opaque:{list:[],
+count:0},transparent:{list:[],count:0}})}function na(f){if(f!=fa){switch(f){case THREE.AdditiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.SRC_ALPHA,c.ONE);break;case THREE.SubtractiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ZERO,c.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ZERO,c.SRC_COLOR);break;default:c.blendEquationSeparate(c.FUNC_ADD,c.FUNC_ADD);c.blendFuncSeparate(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA,c.ONE,c.ONE_MINUS_SRC_ALPHA)}fa=
+f}}function xa(f,s,n){if((n.width&n.width-1)==0&&(n.height&n.height-1)==0){c.texParameteri(f,c.TEXTURE_WRAP_S,ea(s.wrapS));c.texParameteri(f,c.TEXTURE_WRAP_T,ea(s.wrapT));c.texParameteri(f,c.TEXTURE_MAG_FILTER,ea(s.magFilter));c.texParameteri(f,c.TEXTURE_MIN_FILTER,ea(s.minFilter));c.generateMipmap(f)}else{c.texParameteri(f,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(f,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);c.texParameteri(f,c.TEXTURE_MAG_FILTER,ua(s.magFilter));c.texParameteri(f,c.TEXTURE_MIN_FILTER,
+ua(s.minFilter))}}function $(f,s){if(f.needsUpdate){if(f.__webglInit){c.bindTexture(c.TEXTURE_2D,f.__webglTexture);c.texSubImage2D(c.TEXTURE_2D,0,0,0,c.RGBA,c.UNSIGNED_BYTE,f.image)}else{f.__webglTexture=c.createTexture();c.bindTexture(c.TEXTURE_2D,f.__webglTexture);c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,f.image);f.__webglInit=!0}xa(c.TEXTURE_2D,f,f.image);c.bindTexture(c.TEXTURE_2D,null);f.needsUpdate=!1}c.activeTexture(c.TEXTURE0+s);c.bindTexture(c.TEXTURE_2D,f.__webglTexture)}
+function K(f){if(f&&!f.__webglFramebuffer){if(f.depthBuffer===undefined)f.depthBuffer=!0;if(f.stencilBuffer===undefined)f.stencilBuffer=!0;f.__webglFramebuffer=c.createFramebuffer();f.__webglRenderbuffer=c.createRenderbuffer();f.__webglTexture=c.createTexture();c.bindTexture(c.TEXTURE_2D,f.__webglTexture);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,ea(f.wrapS));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,ea(f.wrapT));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,ea(f.magFilter));c.texParameteri(c.TEXTURE_2D,
+c.TEXTURE_MIN_FILTER,ea(f.minFilter));c.texImage2D(c.TEXTURE_2D,0,ea(f.format),f.width,f.height,0,ea(f.format),ea(f.type),null);c.bindRenderbuffer(c.RENDERBUFFER,f.__webglRenderbuffer);c.bindFramebuffer(c.FRAMEBUFFER,f.__webglFramebuffer);c.framebufferTexture2D(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,c.TEXTURE_2D,f.__webglTexture,0);if(f.depthBuffer&&!f.stencilBuffer){c.renderbufferStorage(c.RENDERBUFFER,c.DEPTH_COMPONENT16,f.width,f.height);c.framebufferRenderbuffer(c.FRAMEBUFFER,c.DEPTH_ATTACHMENT,c.RENDERBUFFER,
+f.__webglRenderbuffer)}else if(f.depthBuffer&&f.stencilBuffer){c.renderbufferStorage(c.RENDERBUFFER,c.DEPTH_STENCIL,f.width,f.height);c.framebufferRenderbuffer(c.FRAMEBUFFER,c.DEPTH_STENCIL_ATTACHMENT,c.RENDERBUFFER,f.__webglRenderbuffer)}else c.renderbufferStorage(c.RENDERBUFFER,c.RGBA4,f.width,f.height);c.bindTexture(c.TEXTURE_2D,null);c.bindRenderbuffer(c.RENDERBUFFER,null);c.bindFramebuffer(c.FRAMEBUFFER,null)}var s,n;if(f){s=f.__webglFramebuffer;n=f.width;f=f.height}else{s=null;n=ga;f=za}if(s!=
+Fa){c.bindFramebuffer(c.FRAMEBUFFER,s);c.viewport(X,va,n,f);Fa=s}}function pa(f,s){var n;if(f=="fragment")n=c.createShader(c.FRAGMENT_SHADER);else f=="vertex"&&(n=c.createShader(c.VERTEX_SHADER));c.shaderSource(n,s);c.compileShader(n);if(!c.getShaderParameter(n,c.COMPILE_STATUS)){console.error(c.getShaderInfoLog(n));console.error(s);return null}return n}function ua(f){switch(f){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return c.NEAREST;default:return c.LINEAR}}
+function ea(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 c,T=document.createElement("canvas"),U=[],oa=null,Fa=null,Ga=!0,ya=this,aa=null,pa=null,fa=null,qa=null,X=0,va=0,ga=0,za=0,Aa=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ha=new THREE.Matrix4,Pa=new Float32Array(16),Ua=new Float32Array(16),Va=new THREE.Vector4,hb={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},Sa=!0,fb=!0,Ya=new THREE.Color(0),vb=0;if(b){if(b.stencil!=
-undefined)Sa=b.stencil;if(b.antialias!==undefined)fb=b.antialias;b.clearColor!==undefined&&Ya.setHex(b.clearColor);if(b.clearAlpha!==undefined)vb=b.clearAlpha}this.maxMorphTargets=8;this.domElement=T;this.autoClear=!0;this.sortObjects=!0;(function(f,s,n,m){try{if(!(c=T.getContext("experimental-webgl",{antialias:f,stencil:m})))throw"Error creating WebGL context.";}catch(r){console.error(r)}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(s.r,s.g,s.b,n)})(fb,Ya,vb,Sa);this.context=c;if(Sa){var V={};V.vertices=new Float32Array(12);V.faces=new Uint16Array(6);V.darkness=0.5;V.vertices[0]=-20;V.vertices[1]=-20;V.vertices[2]=-1;V.vertices[3]=20;V.vertices[4]=-20;V.vertices[5]=-1;V.vertices[6]=20;V.vertices[7]=20;V.vertices[8]=-1;V.vertices[9]=-20;V.vertices[10]=20;V.vertices[11]=-1;V.faces[0]=0;V.faces[1]=1;V.faces[2]=
-2;V.faces[3]=0;V.faces[4]=2;V.faces[5]=3;V.vertexBuffer=c.createBuffer();V.elementBuffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,V.vertexBuffer);c.bufferData(c.ARRAY_BUFFER,V.vertices,c.STATIC_DRAW);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,V.elementBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,V.faces,c.STATIC_DRAW);V.program=c.createProgram();c.attachShader(V.program,ra("fragment",THREE.ShaderLib.shadowPost.fragmentShader));c.attachShader(V.program,ra("vertex",THREE.ShaderLib.shadowPost.vertexShader));
-c.linkProgram(V.program);V.vertexLocation=c.getAttribLocation(V.program,"position");V.projectionLocation=c.getUniformLocation(V.program,"projectionMatrix");V.darknessLocation=c.getUniformLocation(V.program,"darkness")}var J={};J.vertices=new Float32Array(16);J.faces=new Uint16Array(6);J.transparency=0.5;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,ra("fragment",THREE.ShaderLib.lensFlare.fragmentShader));c.attachShader(J.program,ra("vertex",THREE.ShaderLib.lensFlare.vertexShader))}else{J.hasVertexTexture=
-!0;J.program=c.createProgram();c.attachShader(J.program,ra("fragment",THREE.ShaderLib.lensFlareVertexTexture.fragmentShader));c.attachShader(J.program,ra("vertex",THREE.ShaderLib.lensFlareVertexTexture.vertexShader))}c.linkProgram(J.program);J.attributes={};J.uniforms={};J.attributes.vertex=c.getAttribLocation(J.program,"position");J.attributes.uv=c.getAttribLocation(J.program,"UV");J.uniforms.renderType=c.getUniformLocation(J.program,"renderType");J.uniforms.map=c.getUniformLocation(J.program,"map");
-J.uniforms.occlusionMap=c.getUniformLocation(J.program,"occlusionMap");J.uniforms.opacity=c.getUniformLocation(J.program,"opacity");J.uniforms.scale=c.getUniformLocation(J.program,"scale");J.uniforms.rotation=c.getUniformLocation(J.program,"rotation");J.uniforms.screenPosition=c.getUniformLocation(J.program,"screenPosition");this.setSize=function(f,s){T.width=f;T.height=s;this.setViewport(0,0,T.width,T.height)};this.setViewport=function(f,s,n,m){X=f;va=s;ga=n;za=m;c.viewport(X,va,ga,za)};this.setScissor=
-function(f,s,n,m){c.scissor(f,s,n,m)};this.enableScissorTest=function(f){f?c.enable(c.SCISSOR_TEST):c.disable(c.SCISSOR_TEST)};this.enableDepthBufferWrite=function(f){Ga=f;c.depthMask(f)};this.setClearColorHex=function(f,s){var n=new THREE.Color(f);c.clearColor(n.r,n.g,n.b,s)};this.setClearColor=function(f,s){c.clearColor(f.r,f.g,f.b,s)};this.clear=function(){c.clear(c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT|c.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(f){V.darkness=f};this.initMaterial=
-function(f,s,n,m){var r,z,w;if(f instanceof THREE.MeshDepthMaterial)w="depth";else if(f instanceof THREE.ShadowVolumeDynamicMaterial)w="shadowVolumeDynamic";else if(f instanceof THREE.MeshNormalMaterial)w="normal";else if(f instanceof THREE.MeshBasicMaterial)w="basic";else if(f instanceof THREE.MeshLambertMaterial)w="lambert";else if(f instanceof THREE.MeshPhongMaterial)w="phong";else if(f instanceof THREE.LineBasicMaterial)w="basic";else f instanceof THREE.ParticleBasicMaterial&&(w="particle_basic");
-if(w){var u=THREE.ShaderLib[w];f.uniforms=Uniforms.clone(u.uniforms);f.vertexShader=u.vertexShader;f.fragmentShader=u.fragmentShader}var A,t,x;A=x=u=0;for(t=s.length;A<t;A++){z=s[A];z instanceof THREE.DirectionalLight&&x++;z instanceof THREE.PointLight&&u++}if(u+x<=4)s=x;else{s=Math.ceil(4*x/(u+x));u=4-s}z={directional:s,point:u};x=50;if(m!==undefined&&m instanceof THREE.SkinnedMesh)x=m.bones.length;var y;a:{A=f.fragmentShader;t=f.vertexShader;u=f.uniforms;s=f.attributes;n={map:!!f.map,envMap:!!f.envMap,
-lightMap:!!f.lightMap,vertexColors:f.vertexColors,fog:n,sizeAttenuation:f.sizeAttenuation,skinning:f.skinning,morphTargets:f.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:z.directional,maxPointLights:z.point,maxBones:x};var D;z=[];if(w)z.push(w);else{z.push(A);z.push(t)}for(D in n){z.push(D);z.push(n[D])}w=z.join();D=0;for(z=U.length;D<z;D++)if(U[D].code==w){y=U[D].program;break a}D=c.createProgram();prefix_fragment=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+
-n.maxDirLights,"#define MAX_POINT_LIGHTS "+n.maxPointLights,n.fog?"#define USE_FOG":"",n.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.lightMap?"#define USE_LIGHTMAP":"",n.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");prefix_vertex=[c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+n.maxDirLights,"#define MAX_POINT_LIGHTS "+
-n.maxPointLights,"#define MAX_BONES "+n.maxBones,n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.lightMap?"#define USE_LIGHTMAP":"",n.vertexColors?"#define USE_COLOR":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
-c.attachShader(D,ra("fragment",prefix_fragment+A));c.attachShader(D,ra("vertex",prefix_vertex+t));c.linkProgram(D);c.getProgramParameter(D,c.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+c.getProgramParameter(D,c.VALIDATE_STATUS)+", gl error ["+c.getError()+"]");D.uniforms={};D.attributes={};var B;A=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(B in u)A.push(B);
-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<n.maxMorphTargets;B++)A.push("morphTarget"+B);for(y in s)A.push(y);y=A;B=0;for(s=y.length;B<s;B++){n=y[B];D.attributes[n]=c.getAttribLocation(D,n)}U.push({program:D,code:w});y=D}f.program=y;y=f.program.attributes;c.enableVertexAttribArray(y.position);y.color>=0&&c.enableVertexAttribArray(y.color);y.normal>=
+var c,U=document.createElement("canvas"),V=[],oa=null,Fa=null,Ga=!0,ya=this,aa=null,qa=null,fa=null,ra=null,X=0,va=0,ga=0,za=0,Aa=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ha=new THREE.Matrix4,Pa=new Float32Array(16),Ua=new Float32Array(16),Va=new THREE.Vector4,hb={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},Sa=!0,fb=!0,Ya=new THREE.Color(0),vb=0;if(b){if(b.stencil!=
+undefined)Sa=b.stencil;if(b.antialias!==undefined)fb=b.antialias;b.clearColor!==undefined&&Ya.setHex(b.clearColor);if(b.clearAlpha!==undefined)vb=b.clearAlpha}this.maxMorphTargets=8;this.domElement=U;this.autoClear=!0;this.sortObjects=!0;(function(f,s,n,m){try{if(!(c=U.getContext("experimental-webgl",{antialias:f,stencil:m})))throw"Error creating WebGL context.";}catch(r){console.error(r)}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(s.r,s.g,s.b,n)})(fb,Ya,vb,Sa);this.context=c;if(Sa){var W={};W.vertices=new Float32Array(12);W.faces=new Uint16Array(6);W.darkness=0.5;W.vertices[0]=-20;W.vertices[1]=-20;W.vertices[2]=-1;W.vertices[3]=20;W.vertices[4]=-20;W.vertices[5]=-1;W.vertices[6]=20;W.vertices[7]=20;W.vertices[8]=-1;W.vertices[9]=-20;W.vertices[10]=20;W.vertices[11]=-1;W.faces[0]=0;W.faces[1]=1;W.faces[2]=
+2;W.faces[3]=0;W.faces[4]=2;W.faces[5]=3;W.vertexBuffer=c.createBuffer();W.elementBuffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,W.vertexBuffer);c.bufferData(c.ARRAY_BUFFER,W.vertices,c.STATIC_DRAW);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,W.elementBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,W.faces,c.STATIC_DRAW);W.program=c.createProgram();c.attachShader(W.program,pa("fragment",THREE.ShaderLib.shadowPost.fragmentShader));c.attachShader(W.program,pa("vertex",THREE.ShaderLib.shadowPost.vertexShader));
+c.linkProgram(W.program);W.vertexLocation=c.getAttribLocation(W.program,"position");W.projectionLocation=c.getUniformLocation(W.program,"projectionMatrix");W.darknessLocation=c.getUniformLocation(W.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,pa("fragment",THREE.ShaderLib.lensFlare.fragmentShader));c.attachShader(J.program,pa("vertex",THREE.ShaderLib.lensFlare.vertexShader))}else{J.hasVertexTexture=
+!0;J.program=c.createProgram();c.attachShader(J.program,pa("fragment",THREE.ShaderLib.lensFlareVertexTexture.fragmentShader));c.attachShader(J.program,pa("vertex",THREE.ShaderLib.lensFlareVertexTexture.vertexShader))}c.linkProgram(J.program);J.attributes={};J.uniforms={};J.attributes.vertex=c.getAttribLocation(J.program,"position");J.attributes.uv=c.getAttribLocation(J.program,"UV");J.uniforms.renderType=c.getUniformLocation(J.program,"renderType");J.uniforms.map=c.getUniformLocation(J.program,"map");
+J.uniforms.occlusionMap=c.getUniformLocation(J.program,"occlusionMap");J.uniforms.opacity=c.getUniformLocation(J.program,"opacity");J.uniforms.scale=c.getUniformLocation(J.program,"scale");J.uniforms.rotation=c.getUniformLocation(J.program,"rotation");J.uniforms.screenPosition=c.getUniformLocation(J.program,"screenPosition");_sprite={};_sprite.vertices=new Float32Array(16);_sprite.faces=new Uint16Array(6);b=0;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=0;_sprite.vertices[b++]=
+0;_sprite.vertices[b++]=1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=0;_sprite.vertices[b++]=1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=0;_sprite.vertices[b++]=1;b=0;_sprite.faces[b++]=0;_sprite.faces[b++]=1;_sprite.faces[b++]=2;_sprite.faces[b++]=0;_sprite.faces[b++]=2;_sprite.faces[b++]=3;_sprite.vertexBuffer=c.createBuffer();_sprite.elementBuffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,
+_sprite.vertexBuffer);c.bufferData(c.ARRAY_BUFFER,_sprite.vertices,c.STATIC_DRAW);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,_sprite.elementBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,_sprite.faces,c.STATIC_DRAW);_sprite.program=c.createProgram();c.attachShader(_sprite.program,pa("fragment",THREE.ShaderLib.sprite.fragmentShader));c.attachShader(_sprite.program,pa("vertex",THREE.ShaderLib.sprite.vertexShader));c.linkProgram(_sprite.program);_sprite.attributes={};_sprite.uniforms={};_sprite.attributes.vertex=
+c.getAttribLocation(_sprite.program,"position");_sprite.attributes.uv=c.getAttribLocation(_sprite.program,"UV");_sprite.uniforms.map=c.getUniformLocation(_sprite.program,"map");_sprite.uniforms.opacity=c.getUniformLocation(_sprite.program,"opacity");_sprite.uniforms.scale=c.getUniformLocation(_sprite.program,"scale");_sprite.uniforms.rotation=c.getUniformLocation(_sprite.program,"rotation");_sprite.uniforms.screenPosition=c.getUniformLocation(_sprite.program,"screenPosition");this.setSize=function(f,
+s){U.width=f;U.height=s;this.setViewport(0,0,U.width,U.height)};this.setViewport=function(f,s,n,m){X=f;va=s;ga=n;za=m;c.viewport(X,va,ga,za)};this.setScissor=function(f,s,n,m){c.scissor(f,s,n,m)};this.enableScissorTest=function(f){f?c.enable(c.SCISSOR_TEST):c.disable(c.SCISSOR_TEST)};this.enableDepthBufferWrite=function(f){Ga=f;c.depthMask(f)};this.setClearColorHex=function(f,s){var n=new THREE.Color(f);c.clearColor(n.r,n.g,n.b,s)};this.setClearColor=function(f,s){c.clearColor(f.r,f.g,f.b,s)};this.clear=
+function(){c.clear(c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT|c.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(f){W.darkness=f};this.initMaterial=function(f,s,n,m){var r,z,w;if(f instanceof THREE.MeshDepthMaterial)w="depth";else if(f instanceof THREE.ShadowVolumeDynamicMaterial)w="shadowVolumeDynamic";else if(f instanceof THREE.MeshNormalMaterial)w="normal";else if(f instanceof THREE.MeshBasicMaterial)w="basic";else if(f instanceof THREE.MeshLambertMaterial)w="lambert";else if(f instanceof
+THREE.MeshPhongMaterial)w="phong";else if(f instanceof THREE.LineBasicMaterial)w="basic";else f instanceof THREE.ParticleBasicMaterial&&(w="particle_basic");if(w){var u=THREE.ShaderLib[w];f.uniforms=Uniforms.clone(u.uniforms);f.vertexShader=u.vertexShader;f.fragmentShader=u.fragmentShader}var A,t,x;A=x=u=0;for(t=s.length;A<t;A++){z=s[A];z instanceof THREE.DirectionalLight&&x++;z instanceof THREE.PointLight&&u++}if(u+x<=4)s=x;else{s=Math.ceil(4*x/(u+x));u=4-s}z={directional:s,point:u};x=50;if(m!==
+undefined&&m instanceof THREE.SkinnedMesh)x=m.bones.length;var y;a:{A=f.fragmentShader;t=f.vertexShader;u=f.uniforms;s=f.attributes;n={map:!!f.map,envMap:!!f.envMap,lightMap:!!f.lightMap,vertexColors:f.vertexColors,fog:n,sizeAttenuation:f.sizeAttenuation,skinning:f.skinning,morphTargets:f.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:z.directional,maxPointLights:z.point,maxBones:x};var D;z=[];if(w)z.push(w);else{z.push(A);z.push(t)}for(D in n){z.push(D);z.push(n[D])}w=z.join();D=
+0;for(z=V.length;D<z;D++)if(V[D].code==w){y=V[D].program;break a}D=c.createProgram();prefix_fragment=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+n.maxDirLights,"#define MAX_POINT_LIGHTS "+n.maxPointLights,n.fog?"#define USE_FOG":"",n.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.lightMap?"#define USE_LIGHTMAP":"",n.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");
+prefix_vertex=[c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+n.maxDirLights,"#define MAX_POINT_LIGHTS "+n.maxPointLights,"#define MAX_BONES "+n.maxBones,n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.lightMap?"#define USE_LIGHTMAP":"",n.vertexColors?"#define USE_COLOR":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
+c.attachShader(D,pa("fragment",prefix_fragment+A));c.attachShader(D,pa("vertex",prefix_vertex+t));c.linkProgram(D);c.getProgramParameter(D,c.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+c.getProgramParameter(D,c.VALIDATE_STATUS)+", gl error ["+c.getError()+"]");D.uniforms={};D.attributes={};var B;A=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(B in u)A.push(B);
+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<n.maxMorphTargets;B++)A.push("morphTarget"+B);for(y in s)A.push(y);y=A;B=0;for(s=y.length;B<s;B++){n=y[B];D.attributes[n]=c.getAttribLocation(D,n)}V.push({program:D,code:w});y=D}f.program=y;y=f.program.attributes;c.enableVertexAttribArray(y.position);y.color>=0&&c.enableVertexAttribArray(y.color);y.normal>=
 0&&c.enableVertexAttribArray(y.normal);y.tangent>=0&&c.enableVertexAttribArray(y.tangent);if(f.skinning&&y.skinVertexA>=0&&y.skinVertexB>=0&&y.skinIndex>=0&&y.skinWeight>=0){c.enableVertexAttribArray(y.skinVertexA);c.enableVertexAttribArray(y.skinVertexB);c.enableVertexAttribArray(y.skinIndex);c.enableVertexAttribArray(y.skinWeight)}for(r in f.attributes)y[r]>=0&&c.enableVertexAttribArray(y[r]);if(f.morphTargets){f.numSupportedMorphTargets=0;if(y.morphTarget0>=0){c.enableVertexAttribArray(y.morphTarget0);
 f.numSupportedMorphTargets++}if(y.morphTarget1>=0){c.enableVertexAttribArray(y.morphTarget1);f.numSupportedMorphTargets++}if(y.morphTarget2>=0){c.enableVertexAttribArray(y.morphTarget2);f.numSupportedMorphTargets++}if(y.morphTarget3>=0){c.enableVertexAttribArray(y.morphTarget3);f.numSupportedMorphTargets++}if(y.morphTarget4>=0){c.enableVertexAttribArray(y.morphTarget4);f.numSupportedMorphTargets++}if(y.morphTarget5>=0){c.enableVertexAttribArray(y.morphTarget5);f.numSupportedMorphTargets++}if(y.morphTarget6>=
 0){c.enableVertexAttribArray(y.morphTarget6);f.numSupportedMorphTargets++}if(y.morphTarget7>=0){c.enableVertexAttribArray(y.morphTarget7);f.numSupportedMorphTargets++}m.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);f=0;for(r=this.maxMorphTargets;f<r;f++)m.__webglMorphTargetInfluences[f]=0}};this.render=function(f,s,n,m){var r,z,w,u,A,t,x,y,D=f.lights,B=f.fog;s.matrixAutoUpdate&&s.updateMatrix();f.update(undefined,!1,s);s.matrixWorldInverse.flattenToArray(Ua);s.projectionMatrix.flattenToArray(Pa);
 ha.multiply(s.projectionMatrix,s.matrixWorldInverse);o(ha);this.initWebGLObjects(f);K(n);(this.autoClear||m)&&this.clear();A=f.__webglObjects.length;for(m=0;m<A;m++){r=f.__webglObjects[m];x=r.object;if(x.visible)if(!(x instanceof THREE.Mesh)||p(x)){x.matrixWorld.flattenToArray(x._objectMatrixArray);M(x,s);G(r);r.render=!0;if(this.sortObjects){Va.copy(x.position);ha.multiplyVector3(Va);r.z=Va.z}}else r.render=!1;else r.render=!1}this.sortObjects&&f.__webglObjects.sort(I);t=f.__webglObjectsImmediate.length;
 for(m=0;m<t;m++){r=f.__webglObjectsImmediate[m];x=r.object;if(x.visible){x.matrixAutoUpdate&&x.matrixWorld.flattenToArray(x._objectMatrixArray);M(x,s);E(r)}}na(THREE.NormalBlending);for(m=0;m<A;m++){r=f.__webglObjects[m];if(r.render){x=r.object;y=r.buffer;w=r.opaque;k(x);for(r=0;r<w.count;r++){u=w.list[r];j(u.depthTest);h(s,D,B,u,y,x)}}}for(m=0;m<t;m++){r=f.__webglObjectsImmediate[m];x=r.object;if(x.visible){w=r.opaque;k(x);for(r=0;r<w.count;r++){u=w.list[r];j(u.depthTest);z=e(s,D,B,u,x);x.render(function(N){g(N,
-z,u.shading)})}}}for(m=0;m<A;m++){r=f.__webglObjects[m];if(r.render){x=r.object;y=r.buffer;w=r.transparent;k(x);for(r=0;r<w.count;r++){u=w.list[r];na(u.blending);j(u.depthTest);h(s,D,B,u,y,x)}}}for(m=0;m<t;m++){r=f.__webglObjectsImmediate[m];x=r.object;if(x.visible){w=r.transparent;k(x);for(r=0;r<w.count;r++){u=w.list[r];na(u.blending);j(u.depthTest);z=e(s,D,B,u,x);x.render(function(N){g(N,z,u.shading)})}}}Sa&&f.__webglShadowVolumes.length&&f.lights.length&&H(f);f.__webglLensFlares.length&&L(f,s);
-if(n&&n.minFilter!==THREE.NearestFilter&&n.minFilter!==THREE.LinearFilter){c.bindTexture(c.TEXTURE_2D,n.__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=[]}for(;f.__objectsAdded.length;){var s=f.__objectsAdded[0],n=f,m=void 0,r=void 0,z=void 0;if(s._modelViewMatrix==undefined){s._modelViewMatrix=new THREE.Matrix4;s._normalMatrixArray=
-new Float32Array(9);s._modelViewMatrixArray=new Float32Array(16);s._objectMatrixArray=new Float32Array(16);s.matrixWorld.flattenToArray(s._objectMatrixArray)}if(s instanceof THREE.Mesh){r=s.geometry;r.geometryGroups==undefined&&P(r);for(m in r.geometryGroups){z=r.geometryGroups[m];if(!z.__webglVertexBuffer){var w=z;w.__webglVertexBuffer=c.createBuffer();w.__webglNormalBuffer=c.createBuffer();w.__webglTangentBuffer=c.createBuffer();w.__webglColorBuffer=c.createBuffer();w.__webglUVBuffer=c.createBuffer();
-w.__webglUV2Buffer=c.createBuffer();w.__webglSkinVertexABuffer=c.createBuffer();w.__webglSkinVertexBBuffer=c.createBuffer();w.__webglSkinIndicesBuffer=c.createBuffer();w.__webglSkinWeightsBuffer=c.createBuffer();w.__webglFaceBuffer=c.createBuffer();w.__webglLineBuffer=c.createBuffer();if(w.numMorphTargets){var u=void 0,A=void 0;w.__webglMorphTargetsBuffers=[];u=0;for(A=w.numMorphTargets;u<A;u++)w.__webglMorphTargetsBuffers.push(c.createBuffer())}w=z;u=s;var t=void 0,x=void 0,y=void 0;y=void 0;var D=
-void 0,B=void 0,N=void 0,Y=N=A=0;x=void 0;y=void 0;var O=void 0;t=void 0;x=void 0;D=u.geometry;O=D.faces;B=w.faces;t=0;for(x=B.length;t<x;t++){y=B[t];y=O[y];if(y instanceof THREE.Face3){A+=3;N+=1;Y+=3}else if(y instanceof THREE.Face4){A+=4;N+=2;Y+=4}}t=w;x=u;O=void 0;B=void 0;var Z=void 0,Ha=void 0;Z=void 0;y=[];O=0;for(B=x.materials.length;O<B;O++){Z=x.materials[O];if(Z instanceof THREE.MeshFaceMaterial){Z=0;for(l=t.materials.length;Z<l;Z++)(Ha=t.materials[Z])&&y.push(Ha)}else(Ha=Z)&&y.push(Ha)}t=
-y;a:{x=void 0;O=void 0;B=t.length;for(x=0;x<B;x++){O=t[x];if(O.map||O.lightMap||O instanceof THREE.MeshShaderMaterial){x=!0;break a}}x=!1}a:{O=void 0;B=void 0;y=t.length;for(O=0;O<y;O++){B=t[O];if(!(B instanceof THREE.MeshBasicMaterial&&!B.envMap||B instanceof THREE.MeshDepthMaterial)){O=B&&B.shading!=undefined&&B.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}}O=!1}a:{B=void 0;y=void 0;Z=t.length;for(B=0;B<Z;B++){y=t[B];if(y.vertexColors){y=y.vertexColors;break a}}y=!1}w.__vertexArray=
-new Float32Array(A*3);if(O)w.__normalArray=new Float32Array(A*3);if(D.hasTangents)w.__tangentArray=new Float32Array(A*4);if(y)w.__colorArray=new Float32Array(A*3);if(x){if(D.faceUvs.length>0||D.faceVertexUvs.length>0)w.__uvArray=new Float32Array(A*2);if(D.faceUvs.length>1||D.faceVertexUvs.length>1)w.__uv2Array=new Float32Array(A*2)}if(u.geometry.skinWeights.length&&u.geometry.skinIndices.length){w.__skinVertexAArray=new Float32Array(A*4);w.__skinVertexBArray=new Float32Array(A*4);w.__skinIndexArray=
-new Float32Array(A*4);w.__skinWeightArray=new Float32Array(A*4)}w.__faceArray=new Uint16Array(N*3+(u.geometry.edgeFaces?u.geometry.edgeFaces.length*6:0));w.__lineArray=new Uint16Array(Y*2);if(w.numMorphTargets){w.__morphTargetsArrays=[];D=0;for(B=w.numMorphTargets;D<B;D++)w.__morphTargetsArrays.push(new Float32Array(A*3))}w.__needsSmoothNormals=O==THREE.SmoothShading;w.__uvType=x;w.__vertexColorType=y;w.__normalType=O;w.__webglFaceCount=N*3+(u.geometry.edgeFaces?u.geometry.edgeFaces.length*6:0);w.__webglLineCount=
-Y*2;D=0;for(B=t.length;D<B;D++)if(t[D].attributes){w.__webglCustomAttributes={};for(a in t[D].attributes){x=t[D].attributes[a];N=1;if(x.type==="v2")N=2;else if(x.type==="v3")N=3;else if(x.type==="v4")N=4;else x.type==="c"&&(N=3);x.size=N;x.needsUpdate=!0;x.array=new Float32Array(A*N);x.buffer=c.createBuffer();w.__webglCustomAttributes[a]=x}}r.__dirtyVertices=!0;r.__dirtyMorphTargets=!0;r.__dirtyElements=!0;r.__dirtyUvs=!0;r.__dirtyNormals=!0;r.__dirtyTangents=!0;r.__dirtyColors=!0}s instanceof THREE.ShadowVolume?
-ca(n.__webglShadowVolumes,z,s):ca(n.__webglObjects,z,s)}}else if(s instanceof THREE.LensFlare)ca(n.__webglLensFlares,undefined,s);else if(s instanceof THREE.Ribbon){r=s.geometry;if(!r.__webglVertexBuffer){m=r;m.__webglVertexBuffer=c.createBuffer();m.__webglColorBuffer=c.createBuffer();m=r;z=m.vertices.length;m.__vertexArray=new Float32Array(z*3);m.__colorArray=new Float32Array(z*3);m.__webglVertexCount=z;r.__dirtyVertices=!0;r.__dirtyColors=!0}ca(n.__webglObjects,r,s)}else if(s instanceof THREE.Line){r=
-s.geometry;if(!r.__webglVertexBuffer){m=r;m.__webglVertexBuffer=c.createBuffer();m.__webglColorBuffer=c.createBuffer();m=r;z=m.vertices.length;m.__vertexArray=new Float32Array(z*3);m.__colorArray=new Float32Array(z*3);m.__webglLineCount=z;r.__dirtyVertices=!0;r.__dirtyColors=!0}ca(n.__webglObjects,r,s)}else if(s instanceof THREE.ParticleSystem){r=s.geometry;if(!r.__webglVertexBuffer){m=r;m.__webglVertexBuffer=c.createBuffer();m.__webglColorBuffer=c.createBuffer();m=r;z=m.vertices.length;m.__vertexArray=
-new Float32Array(z*3);m.__colorArray=new Float32Array(z*3);m.__sortArray=[];m.__webglParticleCount=z;r.__dirtyVertices=!0;r.__dirtyColors=!0}ca(n.__webglObjects,r,s)}else THREE.MarchingCubes!==undefined&&s instanceof THREE.MarchingCubes&&n.__webglObjectsImmediate.push({object:s,opaque:{list:[],count:0},transparent:{list:[],count:0}});f.__objectsAdded.splice(0,1)}for(;f.__objectsRemoved.length;){s=f.__objectsRemoved[0];n=f;r=void 0;m=void 0;for(r=n.__webglObjects.length-1;r>=0;r--){m=n.__webglObjects[r].object;
-s==m&&n.__webglObjects.splice(r,1)}f.__objectsRemoved.splice(0,1)}s=0;for(n=f.__webglObjects.length;s<n;s++)W(f.__webglObjects[s].object,f);s=0;for(n=f.__webglShadowVolumes.length;s<n;s++)W(f.__webglShadowVolumes[s].object,f);s=0;for(n=f.__webglLensFlares.length;s<n;s++)W(f.__webglLensFlares[s].object,f)};this.setFaceCulling=function(f,s){if(f){!s||s=="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}};
+z,u.shading)})}}}for(m=0;m<A;m++){r=f.__webglObjects[m];if(r.render){x=r.object;y=r.buffer;w=r.transparent;k(x);for(r=0;r<w.count;r++){u=w.list[r];na(u.blending);j(u.depthTest);h(s,D,B,u,y,x)}}}for(m=0;m<t;m++){r=f.__webglObjectsImmediate[m];x=r.object;if(x.visible){w=r.transparent;k(x);for(r=0;r<w.count;r++){u=w.list[r];na(u.blending);j(u.depthTest);z=e(s,D,B,u,x);x.render(function(N){g(N,z,u.shading)})}}}f.__webglSprites.length&&renderSprites(f);Sa&&f.__webglShadowVolumes.length&&f.lights.length&&
+H(f);f.__webglLensFlares.length&&L(f,s);if(n&&n.minFilter!==THREE.NearestFilter&&n.minFilter!==THREE.LinearFilter){c.bindTexture(c.TEXTURE_2D,n.__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 s=f.__objectsAdded[0],n=f,m=void 0,r=void 0,z=void 0;if(s._modelViewMatrix==
+undefined){s._modelViewMatrix=new THREE.Matrix4;s._normalMatrixArray=new Float32Array(9);s._modelViewMatrixArray=new Float32Array(16);s._objectMatrixArray=new Float32Array(16);s.matrixWorld.flattenToArray(s._objectMatrixArray)}if(s instanceof THREE.Mesh){r=s.geometry;r.geometryGroups==undefined&&P(r);for(m in r.geometryGroups){z=r.geometryGroups[m];if(!z.__webglVertexBuffer){var w=z;w.__webglVertexBuffer=c.createBuffer();w.__webglNormalBuffer=c.createBuffer();w.__webglTangentBuffer=c.createBuffer();
+w.__webglColorBuffer=c.createBuffer();w.__webglUVBuffer=c.createBuffer();w.__webglUV2Buffer=c.createBuffer();w.__webglSkinVertexABuffer=c.createBuffer();w.__webglSkinVertexBBuffer=c.createBuffer();w.__webglSkinIndicesBuffer=c.createBuffer();w.__webglSkinWeightsBuffer=c.createBuffer();w.__webglFaceBuffer=c.createBuffer();w.__webglLineBuffer=c.createBuffer();if(w.numMorphTargets){var u=void 0,A=void 0;w.__webglMorphTargetsBuffers=[];u=0;for(A=w.numMorphTargets;u<A;u++)w.__webglMorphTargetsBuffers.push(c.createBuffer())}w=
+z;u=s;var t=void 0,x=void 0,y=void 0;y=void 0;var D=void 0,B=void 0,N=void 0,Y=N=A=0;x=void 0;y=void 0;var O=void 0;t=void 0;x=void 0;D=u.geometry;O=D.faces;B=w.faces;t=0;for(x=B.length;t<x;t++){y=B[t];y=O[y];if(y instanceof THREE.Face3){A+=3;N+=1;Y+=3}else if(y instanceof THREE.Face4){A+=4;N+=2;Y+=4}}t=w;x=u;O=void 0;B=void 0;var Z=void 0,Ha=void 0;Z=void 0;y=[];O=0;for(B=x.materials.length;O<B;O++){Z=x.materials[O];if(Z instanceof THREE.MeshFaceMaterial){Z=0;for(l=t.materials.length;Z<l;Z++)(Ha=
+t.materials[Z])&&y.push(Ha)}else(Ha=Z)&&y.push(Ha)}t=y;a:{x=void 0;O=void 0;B=t.length;for(x=0;x<B;x++){O=t[x];if(O.map||O.lightMap||O instanceof THREE.MeshShaderMaterial){x=!0;break a}}x=!1}a:{O=void 0;B=void 0;y=t.length;for(O=0;O<y;O++){B=t[O];if(!(B instanceof THREE.MeshBasicMaterial&&!B.envMap||B instanceof THREE.MeshDepthMaterial)){O=B&&B.shading!=undefined&&B.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}}O=!1}a:{B=void 0;y=void 0;Z=t.length;for(B=0;B<Z;B++){y=
+t[B];if(y.vertexColors){y=y.vertexColors;break a}}y=!1}w.__vertexArray=new Float32Array(A*3);if(O)w.__normalArray=new Float32Array(A*3);if(D.hasTangents)w.__tangentArray=new Float32Array(A*4);if(y)w.__colorArray=new Float32Array(A*3);if(x){if(D.faceUvs.length>0||D.faceVertexUvs.length>0)w.__uvArray=new Float32Array(A*2);if(D.faceUvs.length>1||D.faceVertexUvs.length>1)w.__uv2Array=new Float32Array(A*2)}if(u.geometry.skinWeights.length&&u.geometry.skinIndices.length){w.__skinVertexAArray=new Float32Array(A*
+4);w.__skinVertexBArray=new Float32Array(A*4);w.__skinIndexArray=new Float32Array(A*4);w.__skinWeightArray=new Float32Array(A*4)}w.__faceArray=new Uint16Array(N*3+(u.geometry.edgeFaces?u.geometry.edgeFaces.length*6:0));w.__lineArray=new Uint16Array(Y*2);if(w.numMorphTargets){w.__morphTargetsArrays=[];D=0;for(B=w.numMorphTargets;D<B;D++)w.__morphTargetsArrays.push(new Float32Array(A*3))}w.__needsSmoothNormals=O==THREE.SmoothShading;w.__uvType=x;w.__vertexColorType=y;w.__normalType=O;w.__webglFaceCount=
+N*3+(u.geometry.edgeFaces?u.geometry.edgeFaces.length*6:0);w.__webglLineCount=Y*2;D=0;for(B=t.length;D<B;D++)if(t[D].attributes){w.__webglCustomAttributes={};for(a in t[D].attributes){x=t[D].attributes[a];N=1;if(x.type==="v2")N=2;else if(x.type==="v3")N=3;else if(x.type==="v4")N=4;else x.type==="c"&&(N=3);x.size=N;x.needsUpdate=!0;x.array=new Float32Array(A*N);x.buffer=c.createBuffer();w.__webglCustomAttributes[a]=x}}r.__dirtyVertices=!0;r.__dirtyMorphTargets=!0;r.__dirtyElements=!0;r.__dirtyUvs=
+!0;r.__dirtyNormals=!0;r.__dirtyTangents=!0;r.__dirtyColors=!0}s instanceof THREE.ShadowVolume?ca(n.__webglShadowVolumes,z,s):ca(n.__webglObjects,z,s)}}else if(s instanceof THREE.LensFlare)ca(n.__webglLensFlares,undefined,s);else if(s instanceof THREE.Ribbon){r=s.geometry;if(!r.__webglVertexBuffer){m=r;m.__webglVertexBuffer=c.createBuffer();m.__webglColorBuffer=c.createBuffer();m=r;z=m.vertices.length;m.__vertexArray=new Float32Array(z*3);m.__colorArray=new Float32Array(z*3);m.__webglVertexCount=
+z;r.__dirtyVertices=!0;r.__dirtyColors=!0}ca(n.__webglObjects,r,s)}else if(s instanceof THREE.Line){r=s.geometry;if(!r.__webglVertexBuffer){m=r;m.__webglVertexBuffer=c.createBuffer();m.__webglColorBuffer=c.createBuffer();m=r;z=m.vertices.length;m.__vertexArray=new Float32Array(z*3);m.__colorArray=new Float32Array(z*3);m.__webglLineCount=z;r.__dirtyVertices=!0;r.__dirtyColors=!0}ca(n.__webglObjects,r,s)}else if(s instanceof THREE.ParticleSystem){r=s.geometry;if(!r.__webglVertexBuffer){m=r;m.__webglVertexBuffer=
+c.createBuffer();m.__webglColorBuffer=c.createBuffer();m=r;z=m.vertices.length;m.__vertexArray=new Float32Array(z*3);m.__colorArray=new Float32Array(z*3);m.__sortArray=[];m.__webglParticleCount=z;r.__dirtyVertices=!0;r.__dirtyColors=!0}ca(n.__webglObjects,r,s)}else THREE.MarchingCubes!==undefined&&s instanceof THREE.MarchingCubes&&n.__webglObjectsImmediate.push({object:s,opaque:{list:[],count:0},transparent:{list:[],count:0}});f.__objectsAdded.splice(0,1)}for(;f.__objectsRemoved.length;){s=f.__objectsRemoved[0];
+n=f;r=void 0;m=void 0;for(r=n.__webglObjects.length-1;r>=0;r--){m=n.__webglObjects[r].object;s==m&&n.__webglObjects.splice(r,1)}f.__objectsRemoved.splice(0,1)}s=0;for(n=f.__webglObjects.length;s<n;s++)T(f.__webglObjects[s].object,f);s=0;for(n=f.__webglShadowVolumes.length;s<n;s++)T(f.__webglShadowVolumes[s].object,f);s=0;for(n=f.__webglLensFlares.length;s<n;s++)T(f.__webglLensFlares[s].object,f);s=0;for(n=f.__webglSprites.length;s<n;s++)T(f.__webglSprites[s].object,f)};this.setFaceCulling=function(f,
+s){if(f){!s||s=="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.RGBFormat;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};

+ 8 - 3
examples/obj/blenderscene/scene.Cube.js

@@ -8,6 +8,7 @@
  * uvs: 0
  * colors: 0
  * materials: 1
+ * edges: 0
  *
  */
 
@@ -15,6 +16,8 @@ var model = {
 
     "version" : 2,
     
+    "scale" : 1.000000,
+    
     "materials": [	{
 	"DbgColor" : 15658734,
 	"DbgIndex" : 0,
@@ -22,13 +25,12 @@ var model = {
 	"colorAmbient" : [0.0, 0.0, 0.0],
 	"colorDiffuse" : [0.6400000190734865, 0.10179081114814892, 0.126246120426746],
 	"colorSpecular" : [0.5, 0.5, 0.5],
-	"shading" : "Phong",
 	"specularCoef" : 50,
 	"transparency" : 1.0,
 	"vertexColors" : false
 	}],
 
-    "vertices": [1.000000,-1.000000,-1.000000,1.000000,-1.000000,1.000000,-1.000000,-1.000000,1.000000,-1.000000,-1.000000,-1.000000,1.000000,1.000000,-1.000000,0.999999,1.000000,1.000001,-1.000000,1.000000,1.000000,-1.000000,1.000000,-1.000000],
+    "vertices": [1.000000,1.000000,-1.000000,1.000000,-1.000000,-1.000000,-1.000000,-1.000000,-1.000000,-1.000000,1.000000,-1.000000,1.000000,1.000000,1.000000,0.999999,-1.000001,1.000000,-1.000000,-1.000000,1.000000,-1.000000,1.000000,1.000000],
 
     "morphTargets": [],
 
@@ -38,8 +40,11 @@ var model = {
 
     "uvs": [[]],
 
-    "faces": [3,0,1,2,3,0,3,4,7,6,5,0,3,0,4,5,1,0,3,1,5,6,2,0,3,2,6,7,3,0,3,4,0,3,7,0]
+    "faces": [3,0,1,2,3,0,3,4,7,6,5,0,3,0,4,5,1,0,3,1,5,6,2,0,3,2,6,7,3,0,3,4,0,3,7,0],
+
+    "edges" : []
 
 };
 
 postMessage( model );
+close();

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 3 - 1
examples/obj/blenderscene/scene.Monkey.js


+ 8 - 3
examples/obj/blenderscene/scene.Plane.js

@@ -8,6 +8,7 @@
  * uvs: 0
  * colors: 0
  * materials: 1
+ * edges: 0
  *
  */
 
@@ -15,6 +16,8 @@ var model = {
 
     "version" : 2,
     
+    "scale" : 1.000000,
+    
     "materials": [	{
 	"DbgColor" : 15658734,
 	"DbgIndex" : 0,
@@ -22,13 +25,12 @@ var model = {
 	"colorAmbient" : [0.0, 0.0, 0.0],
 	"colorDiffuse" : [0.14462547517754842, 0.6400000190734865, 0.24541190036254967],
 	"colorSpecular" : [0.5, 0.5, 0.5],
-	"shading" : "Phong",
 	"specularCoef" : 50,
 	"transparency" : 1.0,
 	"vertexColors" : false
 	}],
 
-    "vertices": [1.000000,-0.000000,-1.000000,1.000000,0.000000,1.000000,-1.000000,0.000000,1.000000,-1.000000,-0.000000,-1.000000],
+    "vertices": [1.000000,1.000000,0.000000,1.000000,-1.000000,0.000000,-1.000000,-1.000000,0.000000,-1.000000,1.000000,0.000000],
 
     "morphTargets": [],
 
@@ -38,8 +40,11 @@ var model = {
 
     "uvs": [[]],
 
-    "faces": [3,0,3,2,1,0]
+    "faces": [3,0,3,2,1,0],
+
+    "edges" : []
 
 };
 
 postMessage( model );
+close();

+ 127 - 114
examples/obj/blenderscene/scene.js

@@ -1,7 +1,13 @@
-// Converted from: scene.blend
-//  File generated with Blender 2.56 Exporter
-//  https://github.com/alteredq/three.js/tree/master/utils/exporters/blender/
-
+/* Converted from: scene.blend
+ *
+ * File generated with Blender 2.56 Exporter
+ * https://github.com/alteredq/three.js/tree/master/utils/exporters/blender/
+ *
+ * objects:    27
+ * geometries: 3
+ * materials:  3
+ * textures:   0
+ */  
 
 var scene = {
 
@@ -15,10 +21,10 @@ var scene = {
         "geometry"  : "geo_Cube",
         "groups"    : [  ],
         "materials" : [ "Material" ],
-        "position"  : [ 10.623673, 3.370784, -0.321692 ],
-        "rotation"  : [ 0.005265, -0.056306, 4.717181 ],
-        "quaternion": [ 1.000000, 0.000000, 0.000000, 0.000000 ],
-        "scale"	    : [ 8.310000, 4.930000, 0.120000 ],
+        "position"  : [ 10.623673, 0.321692, 3.370784 ],
+        "rotation"  : [ 0.005265, 0.056306, 1.566005 ],
+        "quaternion": [ 0.708568, -0.017992, 0.021809, 0.705076 ],
+        "scale"     : [ 8.310001, 0.120000, 4.930000 ],
         "visible"       : true,
         "castsShadow"   : false,
         "meshCollider"  : false
@@ -28,10 +34,10 @@ var scene = {
         "geometry"  : "geo_Monkey",
         "groups"    : [  ],
         "materials" : [ "Material.002" ],
-        "position"  : [ 1.702659, 0.680278, 5.860421 ],
-        "rotation"  : [ 1.413516, 0.081378, -3.204182 ],
-        "quaternion": [ 0.942751, 0.314982, 0.105460, -0.029764 ],
-        "scale"	    : [ 0.435837, 0.435837, 0.435837 ],
+        "position"  : [ 1.702659, -5.860421, 0.680278 ],
+        "rotation"  : [ 1.413516, -0.081378, -3.079003 ],
+        "quaternion": [ 0.050177, -0.010617, -0.649485, -0.758643 ],
+        "scale"     : [ 0.435837, 0.435837, 0.435837 ],
         "visible"       : true,
         "castsShadow"   : false,
         "meshCollider"  : false
@@ -41,10 +47,10 @@ var scene = {
         "geometry"  : "geo_Monkey",
         "groups"    : [  ],
         "materials" : [ "Material.002" ],
-        "position"  : [ 0.081295, 0.639505, 5.808783 ],
-        "rotation"  : [ 1.413516, 0.081378, -3.204182 ],
-        "quaternion": [ 0.942751, 0.314982, 0.105460, -0.029764 ],
-        "scale"	    : [ 0.435837, 0.435837, 0.435837 ],
+        "position"  : [ 0.081295, -5.808783, 0.639505 ],
+        "rotation"  : [ 1.413516, -0.081378, -3.079003 ],
+        "quaternion": [ 0.050177, -0.010617, -0.649485, -0.758643 ],
+        "scale"     : [ 0.435837, 0.435837, 0.435837 ],
         "visible"       : true,
         "castsShadow"   : false,
         "meshCollider"  : false
@@ -54,10 +60,10 @@ var scene = {
         "geometry"  : "geo_Monkey",
         "groups"    : [  ],
         "materials" : [ "Material.002" ],
-        "position"  : [ -1.569030, 0.619385, 5.747240 ],
-        "rotation"  : [ 1.413516, 0.081378, -3.204182 ],
-        "quaternion": [ 0.942751, 0.314982, 0.105460, -0.029764 ],
-        "scale"	    : [ 0.435837, 0.435837, 0.435837 ],
+        "position"  : [ -1.569030, -5.747240, 0.619385 ],
+        "rotation"  : [ 1.413516, -0.081378, -3.079003 ],
+        "quaternion": [ 0.050177, -0.010617, -0.649485, -0.758643 ],
+        "scale"     : [ 0.435837, 0.435837, 0.435837 ],
         "visible"       : true,
         "castsShadow"   : false,
         "meshCollider"  : false
@@ -67,10 +73,10 @@ var scene = {
         "geometry"  : "geo_Monkey",
         "groups"    : [  ],
         "materials" : [ "Material.002" ],
-        "position"  : [ -3.129120, 0.552267, 5.709269 ],
-        "rotation"  : [ 1.413516, 0.081378, -3.204182 ],
-        "quaternion": [ 0.942751, 0.314982, 0.105460, -0.029764 ],
-        "scale"	    : [ 0.435837, 0.435837, 0.435837 ],
+        "position"  : [ -3.129120, -5.709269, 0.552267 ],
+        "rotation"  : [ 1.413516, -0.081378, -3.079003 ],
+        "quaternion": [ 0.050177, -0.010617, -0.649485, -0.758643 ],
+        "scale"     : [ 0.435837, 0.435837, 0.435837 ],
         "visible"       : true,
         "castsShadow"   : false,
         "meshCollider"  : false
@@ -80,10 +86,10 @@ var scene = {
         "geometry"  : "geo_Monkey",
         "groups"    : [  ],
         "materials" : [ "Material.002" ],
-        "position"  : [ -6.386331, 0.382167, 3.004400 ],
-        "rotation"  : [ 1.646237, -0.058425, -1.670593 ],
-        "quaternion": [ 0.942751, 0.314982, 0.105460, -0.029764 ],
-        "scale"	    : [ 0.435837, 0.435837, 0.435837 ],
+        "position"  : [ -6.386331, -3.004400, 0.382167 ],
+        "rotation"  : [ 1.646237, 0.058425, 1.670594 ],
+        "quaternion": [ 0.471896, 0.477057, 0.556810, 0.489585 ],
+        "scale"     : [ 0.435837, 0.435837, 0.435837 ],
         "visible"       : true,
         "castsShadow"   : false,
         "meshCollider"  : false
@@ -93,10 +99,10 @@ var scene = {
         "geometry"  : "geo_Monkey",
         "groups"    : [  ],
         "materials" : [ "Material.002" ],
-        "position"  : [ -6.499331, 0.471640, 1.593073 ],
-        "rotation"  : [ 1.646237, -0.058425, -1.670593 ],
-        "quaternion": [ 0.942751, 0.314982, 0.105460, -0.029764 ],
-        "scale"	    : [ 0.435837, 0.435837, 0.435837 ],
+        "position"  : [ -6.499331, -1.593073, 0.471640 ],
+        "rotation"  : [ 1.646237, 0.058425, 1.670594 ],
+        "quaternion": [ 0.471896, 0.477057, 0.556810, 0.489585 ],
+        "scale"     : [ 0.435837, 0.435837, 0.435837 ],
         "visible"       : true,
         "castsShadow"   : false,
         "meshCollider"  : false
@@ -106,10 +112,10 @@ var scene = {
         "geometry"  : "geo_Monkey",
         "groups"    : [  ],
         "materials" : [ "Material.002" ],
-        "position"  : [ -6.629794, 0.533840, 0.234131 ],
-        "rotation"  : [ 1.646237, -0.058425, -1.670593 ],
-        "quaternion": [ 0.942751, 0.314982, 0.105460, -0.029764 ],
-        "scale"	    : [ 0.435837, 0.435837, 0.435837 ],
+        "position"  : [ -6.629794, -0.234131, 0.533840 ],
+        "rotation"  : [ 1.646237, 0.058425, 1.670594 ],
+        "quaternion": [ 0.471896, 0.477057, 0.556810, 0.489585 ],
+        "scale"     : [ 0.435837, 0.435837, 0.435837 ],
         "visible"       : true,
         "castsShadow"   : false,
         "meshCollider"  : false
@@ -119,10 +125,10 @@ var scene = {
         "geometry"  : "geo_Monkey",
         "groups"    : [  ],
         "materials" : [ "Material.002" ],
-        "position"  : [ -6.713673, 0.629835, -1.008146 ],
-        "rotation"  : [ 1.646237, -0.058425, -1.670593 ],
-        "quaternion": [ 0.942751, 0.314982, 0.105460, -0.029764 ],
-        "scale"	    : [ 0.435837, 0.435837, 0.435837 ],
+        "position"  : [ -6.713673, 1.008146, 0.629835 ],
+        "rotation"  : [ 1.646237, 0.058425, 1.670594 ],
+        "quaternion": [ 0.471896, 0.477057, 0.556810, 0.489585 ],
+        "scale"     : [ 0.435837, 0.435837, 0.435837 ],
         "visible"       : true,
         "castsShadow"   : false,
         "meshCollider"  : false
@@ -132,10 +138,10 @@ var scene = {
         "geometry"  : "geo_Monkey",
         "groups"    : [  ],
         "materials" : [ "Material.002" ],
-        "position"  : [ -2.010442, 1.387332, 24.343616 ],
-        "rotation"  : [ 1.520470, 0.191726, -3.004622 ],
-        "quaternion": [ -0.587711, 0.550951, 0.566613, 0.173203 ],
-        "scale"	    : [ 9.160007, 9.160007, 9.160008 ],
+        "position"  : [ -2.010442, -24.343616, 1.387332 ],
+        "rotation"  : [ -1.621122, -2.949867, -0.136972 ],
+        "quaternion": [ 0.016439, -0.116140, -0.679574, -0.724169 ],
+        "scale"     : [ 9.160008, 9.160007, 9.160007 ],
         "visible"       : true,
         "castsShadow"   : false,
         "meshCollider"  : false
@@ -145,10 +151,10 @@ var scene = {
         "geometry"  : "geo_Monkey",
         "groups"    : [  ],
         "materials" : [ "Material.002" ],
-        "position"  : [ -4.292194, 1.826282, -7.975398 ],
-        "rotation"  : [ 1.594819, 0.080713, -0.213986 ],
-        "quaternion": [ 0.942751, 0.314982, 0.105460, -0.029764 ],
-        "scale"	    : [ 1.000000, 1.000000, 1.000000 ],
+        "position"  : [ -4.292194, 7.975398, 1.826282 ],
+        "rotation"  : [ 1.594819, -0.080713, 0.213986 ],
+        "quaternion": [ 0.690920, 0.713888, 0.048328, 0.103242 ],
+        "scale"     : [ 1.000000, 1.000000, 1.000000 ],
         "visible"       : true,
         "castsShadow"   : false,
         "meshCollider"  : false
@@ -158,10 +164,10 @@ var scene = {
         "geometry"  : "geo_Monkey",
         "groups"    : [  ],
         "materials" : [ "Material.002" ],
-        "position"  : [ 2.151757, 1.891882, -8.065320 ],
-        "rotation"  : [ 1.594819, 0.080713, -0.213986 ],
-        "quaternion": [ 0.942751, 0.314982, 0.105460, -0.029764 ],
-        "scale"	    : [ 1.000000, 1.000000, 1.000000 ],
+        "position"  : [ 2.151757, 8.065320, 1.891882 ],
+        "rotation"  : [ 1.594819, -0.080713, 0.213986 ],
+        "quaternion": [ 0.690920, 0.713888, 0.048328, 0.103242 ],
+        "scale"     : [ 1.000000, 1.000000, 1.000000 ],
         "visible"       : true,
         "castsShadow"   : false,
         "meshCollider"  : false
@@ -171,10 +177,10 @@ var scene = {
         "geometry"  : "geo_Monkey",
         "groups"    : [  ],
         "materials" : [ "Material.002" ],
-        "position"  : [ -0.712512, 2.115002, -8.097841 ],
-        "rotation"  : [ 1.594819, 0.080713, -0.213986 ],
-        "quaternion": [ 0.942751, 0.314982, 0.105460, -0.029764 ],
-        "scale"	    : [ 1.000000, 1.000000, 1.000000 ],
+        "position"  : [ -0.712512, 8.097841, 2.115002 ],
+        "rotation"  : [ 1.594819, -0.080713, 0.213986 ],
+        "quaternion": [ 0.690920, 0.713888, 0.048328, 0.103242 ],
+        "scale"     : [ 1.000000, 1.000000, 1.000000 ],
         "visible"       : true,
         "castsShadow"   : false,
         "meshCollider"  : false
@@ -184,10 +190,10 @@ var scene = {
         "geometry"  : "geo_Cube",
         "groups"    : [  ],
         "materials" : [ "Material" ],
-        "position"  : [ -1.000975, 1.319482, -8.755547 ],
-        "rotation"  : [ 0.000000, 0.000000, -0.000000 ],
+        "position"  : [ -1.000975, 8.755547, 1.319482 ],
+        "rotation"  : [ 0.000000, -0.000000, 0.000000 ],
         "quaternion": [ 1.000000, 0.000000, 0.000000, 0.000000 ],
-        "scale"	    : [ 6.130000, 1.690000, 0.070000 ],
+        "scale"     : [ 6.130000, 0.070000, 1.690000 ],
         "visible"       : true,
         "castsShadow"   : false,
         "meshCollider"  : false
@@ -197,10 +203,10 @@ var scene = {
         "geometry"  : "geo_Cube",
         "groups"    : [  ],
         "materials" : [ "Material" ],
-        "position"  : [ 2.484517, 2.724846, 7.486932 ],
-        "rotation"  : [ 0.220417, -0.075224, 0.181029 ],
-        "quaternion": [ 0.988791, 0.112836, 0.027288, -0.093898 ],
-        "scale"	    : [ 0.350000, 3.310000, 0.890000 ],
+        "position"  : [ 2.484517, -7.486932, 2.724846 ],
+        "rotation"  : [ 0.220417, 0.075224, -0.181029 ],
+        "quaternion": [ 0.988790, 0.112836, 0.027288, -0.093898 ],
+        "scale"     : [ 0.350000, 0.890000, 3.309999 ],
         "visible"       : true,
         "castsShadow"   : false,
         "meshCollider"  : false
@@ -210,10 +216,10 @@ var scene = {
         "geometry"  : "geo_Monkey",
         "groups"    : [  ],
         "materials" : [ "Material.002" ],
-        "position"  : [ 7.724935, 1.694883, -7.123103 ],
-        "rotation"  : [ 1.835590, 0.083161, -2.048913 ],
-        "quaternion": [ -0.587711, 0.550951, 0.566613, 0.173203 ],
-        "scale"	    : [ 1.000000, 1.000000, 1.000000 ],
+        "position"  : [ 7.724935, 7.123103, 1.694883 ],
+        "rotation"  : [ 1.835590, -0.083161, 2.048913 ],
+        "quaternion": [ 0.287189, 0.433893, 0.664936, 0.535835 ],
+        "scale"     : [ 1.000000, 1.000000, 1.000000 ],
         "visible"       : true,
         "castsShadow"   : false,
         "meshCollider"  : false
@@ -223,10 +229,10 @@ var scene = {
         "geometry"  : "geo_Monkey",
         "groups"    : [  ],
         "materials" : [ "Material.002" ],
-        "position"  : [ -6.334642, 0.566791, -6.636147 ],
-        "rotation"  : [ 1.327136, -0.032561, -4.135900 ],
-        "quaternion": [ -0.587711, 0.550951, 0.566613, 0.173203 ],
-        "scale"	    : [ 1.000000, 1.000000, 1.000000 ],
+        "position"  : [ -6.334642, 6.636147, 0.566791 ],
+        "rotation"  : [ 1.327136, 0.032561, -2.147285 ],
+        "quaternion": [ 0.366859, 0.304988, -0.535181, -0.697122 ],
+        "scale"     : [ 1.000000, 1.000000, 1.000000 ],
         "visible"       : true,
         "castsShadow"   : false,
         "meshCollider"  : false
@@ -236,10 +242,10 @@ var scene = {
         "geometry"  : "geo_Monkey",
         "groups"    : [  ],
         "materials" : [ "Material.002" ],
-        "position"  : [ -5.384042, 0.444915, 6.194087 ],
-        "rotation"  : [ 0.991213, 0.181430, -5.246078 ],
-        "quaternion": [ -0.587711, 0.550951, 0.566613, 0.173203 ],
-        "scale"	    : [ 1.000000, 1.000000, 1.000000 ],
+        "position"  : [ -5.384042, -6.194087, 0.444915 ],
+        "rotation"  : [ 0.991213, -0.181430, -1.037108 ],
+        "quaternion": [ 0.782246, 0.371851, -0.303947, -0.396780 ],
+        "scale"     : [ 1.000000, 1.000000, 1.000000 ],
         "visible"       : true,
         "castsShadow"   : false,
         "meshCollider"  : false
@@ -249,10 +255,10 @@ var scene = {
         "geometry"  : "geo_Monkey",
         "groups"    : [  ],
         "materials" : [ "Material.002" ],
-        "position"  : [ 3.147747, 1.014840, 4.230884 ],
-        "rotation"  : [ 1.719311, -0.307044, -3.355401 ],
-        "quaternion": [ -0.587711, 0.550951, 0.566613, 0.173203 ],
-        "scale"	    : [ 1.000000, 1.000000, 1.000000 ],
+        "position"  : [ 3.147747, -4.230884, 1.014840 ],
+        "rotation"  : [ -1.422281, 2.834549, 0.213809 ],
+        "quaternion": [ 0.046369, -0.179128, 0.733783, 0.653701 ],
+        "scale"     : [ 1.000000, 1.000000, 1.000000 ],
         "visible"       : true,
         "castsShadow"   : false,
         "meshCollider"  : false
@@ -262,10 +268,10 @@ var scene = {
         "geometry"  : "geo_Monkey",
         "groups"    : [  ],
         "materials" : [ "Material.002" ],
-        "position"  : [ -2.668043, 3.008879, 2.153389 ],
-        "rotation"  : [ 1.881970, 0.457870, 4.066133 ],
-        "quaternion": [ 0.942751, 0.314982, 0.105460, -0.029764 ],
-        "scale"	    : [ 1.000000, 1.000000, 1.000000 ],
+        "position"  : [ -2.668043, -2.153389, 3.008879 ],
+        "rotation"  : [ 1.881970, -0.457870, 2.217052 ],
+        "quaternion": [ 0.091675, 0.470648, 0.644833, 0.595211 ],
+        "scale"     : [ 1.000000, 1.000000, 1.000000 ],
         "visible"       : true,
         "castsShadow"   : false,
         "meshCollider"  : false
@@ -275,10 +281,10 @@ var scene = {
         "geometry"  : "geo_Cube",
         "groups"    : [  ],
         "materials" : [ "Material" ],
-        "position"  : [ -3.031251, 0.702044, 1.943665 ],
-        "rotation"  : [ -1.300741, -1.330343, 3.282723 ],
-        "quaternion": [ 1.000000, 0.000000, 0.000000, 0.000000 ],
-        "scale"	    : [ 1.781142, 0.231142, 0.361142 ],
+        "position"  : [ -3.031251, -1.943665, 0.702044 ],
+        "rotation"  : [ 1.840851, 1.811250, -0.141131 ],
+        "quaternion": [ 0.328619, 0.523567, 0.440581, -0.650981 ],
+        "scale"     : [ 1.781142, 0.361142, 0.231142 ],
         "visible"       : true,
         "castsShadow"   : false,
         "meshCollider"  : false
@@ -288,10 +294,10 @@ var scene = {
         "geometry"  : "geo_Monkey",
         "groups"    : [  ],
         "materials" : [ "Material.002" ],
-        "position"  : [ 1.245307, 0.620196, -0.137285 ],
-        "rotation"  : [ 2.339869, -0.286025, -1.394760 ],
-        "quaternion": [ -0.587711, 0.550951, 0.566613, 0.173203 ],
-        "scale"	    : [ 1.000000, 1.000000, 1.000000 ],
+        "position"  : [ 1.245307, 0.137285, 0.620196 ],
+        "rotation"  : [ 2.339869, 0.286025, 1.394760 ],
+        "quaternion": [ 0.380330, 0.662839, 0.627894, 0.147451 ],
+        "scale"     : [ 1.000000, 1.000000, 1.000000 ],
         "visible"       : true,
         "castsShadow"   : false,
         "meshCollider"  : false
@@ -301,10 +307,10 @@ var scene = {
         "geometry"  : "geo_Monkey",
         "groups"    : [  ],
         "materials" : [ "Material.002" ],
-        "position"  : [ -0.282500, 1.813606, -4.272932 ],
-        "rotation"  : [ 0.646062, -0.219349, -0.010569 ],
+        "position"  : [ -0.282500, 4.272932, 1.813606 ],
+        "rotation"  : [ 0.646062, 0.219349, 0.010569 ],
         "quaternion": [ 0.942751, 0.314982, 0.105460, -0.029764 ],
-        "scale"	    : [ 1.000000, 1.000000, 1.000000 ],
+        "scale"     : [ 1.000000, 1.000000, 1.000000 ],
         "visible"       : true,
         "castsShadow"   : false,
         "meshCollider"  : false
@@ -314,10 +320,10 @@ var scene = {
         "geometry"  : "geo_Cube",
         "groups"    : [  ],
         "materials" : [ "Material" ],
-        "position"  : [ 0.042212, 5.536832, -0.199037 ],
-        "rotation"  : [ 0.000000, 0.000000, -0.000000 ],
+        "position"  : [ 0.042212, 0.199037, 5.536832 ],
+        "rotation"  : [ 0.000000, -0.000000, 0.000000 ],
         "quaternion": [ 1.000000, 0.000000, 0.000000, 0.000000 ],
-        "scale"	    : [ 1.000000, 1.000000, 1.000000 ],
+        "scale"     : [ 1.000000, 1.000000, 1.000000 ],
         "visible"       : true,
         "castsShadow"   : false,
         "meshCollider"  : false
@@ -327,10 +333,10 @@ var scene = {
         "geometry"  : "geo_Cube",
         "groups"    : [  ],
         "materials" : [ "Material" ],
-        "position"  : [ -0.395497, 1.009696, -3.944532 ],
-        "rotation"  : [ 0.000000, 0.000000, -0.000000 ],
+        "position"  : [ -0.395497, 3.944532, 1.009696 ],
+        "rotation"  : [ 0.000000, -0.000000, 0.000000 ],
         "quaternion": [ 1.000000, 0.000000, 0.000000, 0.000000 ],
-        "scale"	    : [ 1.000000, 1.000000, 1.000000 ],
+        "scale"     : [ 1.000000, 1.000000, 1.000000 ],
         "visible"       : true,
         "castsShadow"   : false,
         "meshCollider"  : false
@@ -340,10 +346,10 @@ var scene = {
         "geometry"  : "geo_Plane",
         "groups"    : [  ],
         "materials" : [ "Material.001" ],
-        "position"  : [ 0.000000, 0.000000, 0.118260 ],
-        "rotation"  : [ 0.000000, 0.000000, -0.000000 ],
+        "position"  : [ 0.000000, -0.118260, 0.000000 ],
+        "rotation"  : [ 0.000000, -0.000000, 0.000000 ],
         "quaternion": [ 1.000000, 0.000000, 0.000000, 0.000000 ],
-        "scale"	    : [ 7.922787, 7.922787, 7.922787 ],
+        "scale"     : [ 7.922787, 7.922787, 7.922787 ],
         "visible"       : true,
         "castsShadow"   : false,
         "meshCollider"  : false
@@ -353,10 +359,10 @@ var scene = {
         "geometry"  : "geo_Cube",
         "groups"    : [  ],
         "materials" : [ "Material" ],
-        "position"  : [ 3.651978, 1.071144, 0.000000 ],
-        "rotation"  : [ 0.220417, -0.075224, 0.181029 ],
-        "quaternion": [ 0.988791, 0.112836, 0.027288, -0.093898 ],
-        "scale"	    : [ 1.000000, 1.000000, 1.000000 ],
+        "position"  : [ 3.651978, -0.000000, 1.071144 ],
+        "rotation"  : [ 0.220417, 0.075224, -0.181029 ],
+        "quaternion": [ 0.988790, 0.112836, 0.027288, -0.093898 ],
+        "scale"     : [ 1.000000, 1.000000, 1.000000 ],
         "visible"       : true,
         "castsShadow"   : false,
         "meshCollider"  : false
@@ -418,15 +424,22 @@ var scene = {
 
 "lights" : 
 {
-	"default_light": {
-		"type"		 : "directional",
-		"direction"	 : [ 0.000000, 1.000000, 1.000000 ],
-		"color" 	 : 16777215,
-		"intensity"	 : 0.80
-	}
+    "default_light": {
+        "type"		 : "directional",
+        "direction"	 : [ 0.000000, 1.000000, 1.000000 ],
+        "color" 	 : 16777215,
+        "intensity"	 : 0.80
+    }
 },
 
 
+"transform" : 
+{
+    "position"  : [ 0.000000, 0.000000, 0.000000 ],
+    "rotation"  : [ -1.570796, 0.000000, 0.000000 ],
+    "scale"     : [ 1.000000, 1.000000, 1.000000 ],
+},
+
 "defaults" : 
 {
     "bgcolor" : [ 0.000000, 0.000000, 0.000000 ],
@@ -437,4 +450,4 @@ var scene = {
 }
 
 postMessage( scene );
-
+close();

+ 81 - 78
examples/obj/camaro/CamaroNoUv_bin.js

@@ -1,133 +1,136 @@
 // Converted from: ../../examples/obj/camaro/CamaroNoUv.obj
 //  vertices: 53139
-//  faces: 93251 
+//  faces: 93251
 //  materials: 9
 //
 //  Generated with OBJ -> Three.js converter
-//  http://github.com/alteredq/three.js/blob/master/utils/exporters/convert_obj_threejs_slim.py
+//  http://github.com/alteredq/three.js/blob/master/utils/exporters/convert_obj_three.py
 
 
 var model = {
-    'materials': [	{
-	"a_dbg_color" : 0xeeeeee,
-	"a_dbg_index" : 0,
-	"a_dbg_name" : "Body",
-	"col_ambient" : [0.0, 0.0, 0.0],
-	"col_diffuse" : [0.22700000000000001, 0.40799999999999997, 0.46300000000000002],
-	"col_specular" : [2.0, 2.0, 2.0],
+
+    "version" : 1,
+
+    "materials": [	{
+	"DbgColor" : 15658734,
+	"DbgIndex" : 0,
+	"DbgName" : "Body",
+	"colorAmbient" : [0.0, 0.0, 0.0],
+	"colorDiffuse" : [0.22700000000000001, 0.40799999999999997, 0.46300000000000002],
+	"colorSpecular" : [2.0, 2.0, 2.0],
 	"illumination" : 2,
-	"optical_density" : 1.0,
-	"specular_coef" : 782.352941,
+	"opticalDensity" : 1.0,
+	"specularCoef" : 782.352941,
 	"transparency" : 1.0
 	},
 
 	{
-	"a_dbg_color" : 0xee0000,
-	"a_dbg_index" : 1,
-	"a_dbg_name" : "mirror",
-	"col_ambient" : [0.0, 0.0, 0.0],
-	"col_diffuse" : [0.29999999999999999, 0.29999999999999999, 0.29999999999999999],
-	"col_specular" : [2.0, 2.0, 2.0],
+	"DbgColor" : 15597568,
+	"DbgIndex" : 1,
+	"DbgName" : "mirror",
+	"colorAmbient" : [0.0, 0.0, 0.0],
+	"colorDiffuse" : [0.29999999999999999, 0.29999999999999999, 0.29999999999999999],
+	"colorSpecular" : [2.0, 2.0, 2.0],
 	"illumination" : 2,
-	"optical_density" : 1.0,
-	"specular_coef" : 782.352941,
+	"opticalDensity" : 1.0,
+	"specularCoef" : 782.352941,
 	"transparency" : 1.0
 	},
 
 	{
-	"a_dbg_color" : 0x00ee00,
-	"a_dbg_index" : 2,
-	"a_dbg_name" : "black",
-	"col_ambient" : [0.0, 0.0, 0.0],
-	"col_diffuse" : [0.10199999999999999, 0.10199999999999999, 0.10199999999999999],
-	"col_specular" : [0.20000000000000001, 0.20000000000000001, 0.20000000000000001],
+	"DbgColor" : 60928,
+	"DbgIndex" : 2,
+	"DbgName" : "black",
+	"colorAmbient" : [0.0, 0.0, 0.0],
+	"colorDiffuse" : [0.10199999999999999, 0.10199999999999999, 0.10199999999999999],
+	"colorSpecular" : [0.20000000000000001, 0.20000000000000001, 0.20000000000000001],
 	"illumination" : 2,
-	"optical_density" : 1.0,
-	"specular_coef" : 7.843137,
+	"opticalDensity" : 1.0,
+	"specularCoef" : 7.843137,
 	"transparency" : 1.0
 	},
 
 	{
-	"a_dbg_color" : 0x0000ee,
-	"a_dbg_index" : 3,
-	"a_dbg_name" : "mizo",
-	"col_ambient" : [0.0, 0.0, 0.0],
-	"col_diffuse" : [0.0, 0.0, 0.0],
-	"col_specular" : [0.0, 0.0, 0.0],
+	"DbgColor" : 238,
+	"DbgIndex" : 3,
+	"DbgName" : "mizo",
+	"colorAmbient" : [0.0, 0.0, 0.0],
+	"colorDiffuse" : [0.0, 0.0, 0.0],
+	"colorSpecular" : [0.0, 0.0, 0.0],
 	"illumination" : 1,
-	"optical_density" : 1.0,
-	"specular_coef" : 0.0,
+	"opticalDensity" : 1.0,
+	"specularCoef" : 0.0,
 	"transparency" : 1.0
 	},
 
 	{
-	"a_dbg_color" : 0xeeee00,
-	"a_dbg_index" : 4,
-	"a_dbg_name" : "glass",
-	"col_ambient" : [0.0, 0.0, 0.0],
-	"col_diffuse" : [0.20000000000000001, 0.31, 0.30599999999999999],
-	"col_specular" : [2.0, 2.0, 2.0],
+	"DbgColor" : 15658496,
+	"DbgIndex" : 4,
+	"DbgName" : "glass",
+	"colorAmbient" : [0.0, 0.0, 0.0],
+	"colorDiffuse" : [0.20000000000000001, 0.31, 0.30599999999999999],
+	"colorSpecular" : [2.0, 2.0, 2.0],
 	"illumination" : 2,
-	"optical_density" : 1.0,
-	"specular_coef" : 782.352941,
+	"opticalDensity" : 1.0,
+	"specularCoef" : 782.352941,
 	"transparency" : 0.34
 	},
 
 	{
-	"a_dbg_color" : 0x00eeee,
-	"a_dbg_index" : 5,
-	"a_dbg_name" : "Interieur",
-	"col_ambient" : [0.0, 0.0, 0.0],
-	"col_diffuse" : [0.10199999999999999, 0.10199999999999999, 0.10199999999999999],
-	"col_specular" : [0.44, 0.44, 0.44],
+	"DbgColor" : 61166,
+	"DbgIndex" : 5,
+	"DbgName" : "Interieur",
+	"colorAmbient" : [0.0, 0.0, 0.0],
+	"colorDiffuse" : [0.10199999999999999, 0.10199999999999999, 0.10199999999999999],
+	"colorSpecular" : [0.44, 0.44, 0.44],
 	"illumination" : 2,
-	"optical_density" : 1.0,
-	"specular_coef" : 98.039216,
+	"opticalDensity" : 1.0,
+	"specularCoef" : 98.039216,
 	"transparency" : 1.0
 	},
 
 	{
-	"a_dbg_color" : 0xee00ee,
-	"a_dbg_index" : 6,
-	"a_dbg_name" : "tire",
-	"col_ambient" : [0.0, 0.0, 0.0],
-	"col_diffuse" : [0.27100000000000002, 0.27100000000000002, 0.26300000000000001],
-	"col_specular" : [0.10000000000000001, 0.10000000000000001, 0.10000000000000001],
+	"DbgColor" : 15597806,
+	"DbgIndex" : 6,
+	"DbgName" : "tire",
+	"colorAmbient" : [0.0, 0.0, 0.0],
+	"colorDiffuse" : [0.27100000000000002, 0.27100000000000002, 0.26300000000000001],
+	"colorSpecular" : [0.10000000000000001, 0.10000000000000001, 0.10000000000000001],
 	"illumination" : 2,
-	"optical_density" : 1.0,
-	"specular_coef" : 17.647059,
+	"opticalDensity" : 1.0,
+	"specularCoef" : 17.647059,
 	"transparency" : 1.0
 	},
 
 	{
-	"a_dbg_color" : 0x392456,
-	"a_dbg_index" : 7,
-	"a_dbg_name" : "tireling",
-	"col_ambient" : [0.0, 0.0, 0.0],
-	"col_diffuse" : [0.5, 0.5, 0.5],
-	"col_specular" : [0.20000000000000001, 0.20000000000000001, 0.20000000000000001],
+	"DbgColor" : 3744854,
+	"DbgIndex" : 7,
+	"DbgName" : "tireling",
+	"colorAmbient" : [0.0, 0.0, 0.0],
+	"colorDiffuse" : [0.5, 0.5, 0.5],
+	"colorSpecular" : [0.20000000000000001, 0.20000000000000001, 0.20000000000000001],
 	"illumination" : 2,
-	"optical_density" : 1.0,
-	"specular_coef" : 17.647059,
+	"opticalDensity" : 1.0,
+	"specularCoef" : 17.647059,
 	"transparency" : 1.0
 	},
 
 	{
-	"a_dbg_color" : 0x466852,
-	"a_dbg_index" : 8,
-	"a_dbg_name" : "black2",
-	"col_ambient" : [0.0, 0.0, 0.0],
-	"col_diffuse" : [0.0, 0.0, 0.0],
-	"col_specular" : [0.0, 0.0, 0.0],
+	"DbgColor" : 4614226,
+	"DbgIndex" : 8,
+	"DbgName" : "black2",
+	"colorAmbient" : [0.0, 0.0, 0.0],
+	"colorDiffuse" : [0.0, 0.0, 0.0],
+	"colorSpecular" : [0.0, 0.0, 0.0],
 	"illumination" : 1,
-	"optical_density" : 1.0,
-	"specular_coef" : 0.0,
+	"opticalDensity" : 1.0,
+	"specularCoef" : 0.0,
 	"transparency" : 1.0
 	}],
 
-    'buffers': 'CamaroNoUv_bin.bin',
+    "buffers": "CamaroNoUv_bin.bin"
 
-    'end': (new Date).getTime()
-    }
+};
     
 postMessage( model );
+close();

BIN
examples/obj/cubecolors/cube_fvc.blend


+ 8 - 3
examples/obj/cubecolors/cube_fvc.js

@@ -8,6 +8,7 @@
  * uvs: 0
  * colors: 22
  * materials: 1
+ * edges: 0
  *
  */
 
@@ -15,6 +16,8 @@ var model = {
 
     "version" : 2,
     
+    "scale" : 1.000000,
+    
     "materials": [	{
 	"DbgColor" : 15658734,
 	"DbgIndex" : 0,
@@ -22,13 +25,12 @@ var model = {
 	"colorAmbient" : [0.0, 0.0, 0.0],
 	"colorDiffuse" : [0.800000011920929, 0.800000011920929, 0.800000011920929],
 	"colorSpecular" : [0.5, 0.5, 0.5],
-	"shading" : "Phong",
 	"specularCoef" : 50,
 	"transparency" : 1.0,
 	"vertexColors" : true
 	}],
 
-    "vertices": [1.000000,-1.000000,-1.000000,1.000000,-1.000000,1.000000,-1.000000,-1.000000,1.000000,-1.000000,-1.000000,-1.000000,1.000000,1.000000,-1.000000,0.999999,1.000000,1.000000,-1.000000,1.000000,0.999999,-1.000000,1.000000,-1.000000],
+    "vertices": [1.000000,-1.000000,-1.000000,1.000000,-1.000000,1.000000,-1.000000,-1.000000,1.000000,-1.000000,-1.000000,-1.000000,1.000000,1.000000,-1.000000,0.999999,1.000000,1.000001,-1.000000,1.000000,1.000000,-1.000000,1.000000,-1.000000],
 
     "morphTargets": [],
 
@@ -38,8 +40,11 @@ var model = {
 
     "uvs": [[]],
 
-    "faces": [131,0,1,2,3,0,0,1,2,3,131,4,7,6,5,0,4,5,6,7,131,0,4,5,1,0,0,8,9,10,131,1,5,6,2,0,0,11,12,13,131,2,6,7,3,0,14,15,16,17,131,4,0,3,7,0,18,19,20,21]
+    "faces": [131,0,1,2,3,0,0,1,2,3,131,4,7,6,5,0,4,5,6,7,131,0,4,5,1,0,0,8,9,10,131,1,5,6,2,0,0,11,12,13,131,2,6,7,3,0,14,15,16,17,131,4,0,3,7,0,18,19,20,21],
+
+    "edges" : []
 
 };
 
 postMessage( model );
+close();

BIN
examples/obj/cubecolors/cubecolors.blend


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 3 - 1
examples/obj/cubecolors/cubecolors.js


+ 209 - 206
examples/obj/f50/F50NoUv_bin.js

@@ -1,341 +1,344 @@
 // Converted from: ../../examples/obj/f50/F50NoUv.obj
 //  vertices: 67006
-//  faces: 97474 
+//  faces: 97474
 //  materials: 25
 //
 //  Generated with OBJ -> Three.js converter
-//  http://github.com/alteredq/three.js/blob/master/utils/exporters/convert_obj_threejs_slim.py
+//  http://github.com/alteredq/three.js/blob/master/utils/exporters/convert_obj_three.py
 
 
 var model = {
-    'materials': [	{
-	"a_dbg_color" : 0xeeeeee,
-	"a_dbg_index" : 0,
-	"a_dbg_name" : "F50NEGRO",
-	"col_ambient" : [0.0, 0.0, 0.0],
-	"col_diffuse" : [0.15376000000000001, 0.10983999999999999, 0.037679999999999998],
-	"col_specular" : [0.025000000000000001, 0.025000000000000001, 0.025000000000000001],
+
+    "version" : 1,
+
+    "materials": [	{
+	"DbgColor" : 15658734,
+	"DbgIndex" : 0,
+	"DbgName" : "F50NEGRO",
+	"colorAmbient" : [0.0, 0.0, 0.0],
+	"colorDiffuse" : [0.15376000000000001, 0.10983999999999999, 0.037679999999999998],
+	"colorSpecular" : [0.025000000000000001, 0.025000000000000001, 0.025000000000000001],
 	"illumination" : 2,
-	"optical_density" : 1.0,
-	"specular_coef" : 98.039216,
+	"opticalDensity" : 1.0,
+	"specularCoef" : 98.039216,
 	"transparency" : 1.0
 	},
 
 	{
-	"a_dbg_color" : 0xee0000,
-	"a_dbg_index" : 1,
-	"a_dbg_name" : "F50CROMO",
-	"col_ambient" : [0.0, 0.0, 0.0],
-	"col_diffuse" : [0.1004, 0.10352, 0.062719999999999998],
-	"col_specular" : [0.025000000000000001, 0.025000000000000001, 0.025000000000000001],
+	"DbgColor" : 15597568,
+	"DbgIndex" : 1,
+	"DbgName" : "F50CROMO",
+	"colorAmbient" : [0.0, 0.0, 0.0],
+	"colorDiffuse" : [0.1004, 0.10352, 0.062719999999999998],
+	"colorSpecular" : [0.025000000000000001, 0.025000000000000001, 0.025000000000000001],
 	"illumination" : 2,
-	"optical_density" : 1.0,
-	"specular_coef" : 17.647059,
+	"opticalDensity" : 1.0,
+	"specularCoef" : 17.647059,
 	"transparency" : 1.0
 	},
 
 	{
-	"a_dbg_color" : 0x00ee00,
-	"a_dbg_index" : 2,
-	"a_dbg_name" : "F50CRIST",
-	"col_ambient" : [0.0, 0.0, 0.0],
-	"col_diffuse" : [0.040800000000000003, 0.15687999999999999, 0.0031199999999999999],
-	"col_specular" : [0.025000000000000001, 0.025000000000000001, 0.025000000000000001],
+	"DbgColor" : 60928,
+	"DbgIndex" : 2,
+	"DbgName" : "F50CRIST",
+	"colorAmbient" : [0.0, 0.0, 0.0],
+	"colorDiffuse" : [0.040800000000000003, 0.15687999999999999, 0.0031199999999999999],
+	"colorSpecular" : [0.025000000000000001, 0.025000000000000001, 0.025000000000000001],
 	"illumination" : 2,
-	"optical_density" : 1.0,
-	"specular_coef" : 98.039216,
+	"opticalDensity" : 1.0,
+	"specularCoef" : 98.039216,
 	"transparency" : 0.4
 	},
 
 	{
-	"a_dbg_color" : 0x0000ee,
-	"a_dbg_index" : 3,
-	"a_dbg_name" : "F50ROJO",
-	"col_ambient" : [0.0, 0.0, 0.0],
-	"col_diffuse" : [0.56159999999999999, 0.043920000000000001, 0.069040000000000004],
-	"col_specular" : [0.025000000000000001, 0.025000000000000001, 0.025000000000000001],
+	"DbgColor" : 238,
+	"DbgIndex" : 3,
+	"DbgName" : "F50ROJO",
+	"colorAmbient" : [0.0, 0.0, 0.0],
+	"colorDiffuse" : [0.56159999999999999, 0.043920000000000001, 0.069040000000000004],
+	"colorSpecular" : [0.025000000000000001, 0.025000000000000001, 0.025000000000000001],
 	"illumination" : 2,
-	"optical_density" : 1.0,
-	"specular_coef" : 98.039216,
+	"opticalDensity" : 1.0,
+	"specularCoef" : 98.039216,
 	"transparency" : 1.0
 	},
 
 	{
-	"a_dbg_color" : 0xeeee00,
-	"a_dbg_index" : 4,
-	"a_dbg_name" : "F50NEGRO1",
-	"col_ambient" : [0.0, 0.0, 0.0],
-	"col_diffuse" : [0.15376000000000001, 0.10983999999999999, 0.037679999999999998],
-	"col_specular" : [0.025000000000000001, 0.025000000000000001, 0.025000000000000001],
+	"DbgColor" : 15658496,
+	"DbgIndex" : 4,
+	"DbgName" : "F50NEGRO1",
+	"colorAmbient" : [0.0, 0.0, 0.0],
+	"colorDiffuse" : [0.15376000000000001, 0.10983999999999999, 0.037679999999999998],
+	"colorSpecular" : [0.025000000000000001, 0.025000000000000001, 0.025000000000000001],
 	"illumination" : 2,
-	"optical_density" : 1.0,
-	"specular_coef" : 98.039216,
+	"opticalDensity" : 1.0,
+	"specularCoef" : 98.039216,
 	"transparency" : 1.0
 	},
 
 	{
-	"a_dbg_color" : 0x00eeee,
-	"a_dbg_index" : 5,
-	"a_dbg_name" : "F50ALFO",
-	"col_ambient" : [0.0, 0.0, 0.0],
-	"col_diffuse" : [0.15376000000000001, 0.10983999999999999, 0.037679999999999998],
-	"col_specular" : [0.025000000000000001, 0.025000000000000001, 0.025000000000000001],
+	"DbgColor" : 61166,
+	"DbgIndex" : 5,
+	"DbgName" : "F50ALFO",
+	"colorAmbient" : [0.0, 0.0, 0.0],
+	"colorDiffuse" : [0.15376000000000001, 0.10983999999999999, 0.037679999999999998],
+	"colorSpecular" : [0.025000000000000001, 0.025000000000000001, 0.025000000000000001],
 	"illumination" : 2,
-	"optical_density" : 1.0,
-	"specular_coef" : 98.039216,
+	"opticalDensity" : 1.0,
+	"specularCoef" : 98.039216,
 	"transparency" : 1.0
 	},
 
 	{
-	"a_dbg_color" : 0xee00ee,
-	"a_dbg_index" : 6,
-	"a_dbg_name" : "F50REJIL",
-	"col_ambient" : [0.0, 0.0, 0.0],
-	"col_diffuse" : [0.15376000000000001, 0.10983999999999999, 0.037679999999999998],
-	"col_specular" : [0.025000000000000001, 0.025000000000000001, 0.025000000000000001],
+	"DbgColor" : 15597806,
+	"DbgIndex" : 6,
+	"DbgName" : "F50REJIL",
+	"colorAmbient" : [0.0, 0.0, 0.0],
+	"colorDiffuse" : [0.15376000000000001, 0.10983999999999999, 0.037679999999999998],
+	"colorSpecular" : [0.025000000000000001, 0.025000000000000001, 0.025000000000000001],
 	"illumination" : 2,
-	"optical_density" : 1.0,
-	"specular_coef" : 98.039216,
+	"opticalDensity" : 1.0,
+	"specularCoef" : 98.039216,
 	"transparency" : 1.0
 	},
 
 	{
-	"a_dbg_color" : 0xcf36d4,
-	"a_dbg_index" : 7,
-	"a_dbg_name" : "F50RIGHT",
-	"col_ambient" : [0.0, 0.0, 0.0],
-	"col_diffuse" : [0.56159999999999999, 0.043920000000000001, 0.069040000000000004],
-	"col_specular" : [0.025000000000000001, 0.025000000000000001, 0.025000000000000001],
+	"DbgColor" : 13579988,
+	"DbgIndex" : 7,
+	"DbgName" : "F50RIGHT",
+	"colorAmbient" : [0.0, 0.0, 0.0],
+	"colorDiffuse" : [0.56159999999999999, 0.043920000000000001, 0.069040000000000004],
+	"colorSpecular" : [0.025000000000000001, 0.025000000000000001, 0.025000000000000001],
 	"illumination" : 2,
-	"optical_density" : 1.0,
-	"specular_coef" : 98.039216,
+	"opticalDensity" : 1.0,
+	"specularCoef" : 98.039216,
 	"transparency" : 1.0
 	},
 
 	{
-	"a_dbg_color" : 0x571aa8,
-	"a_dbg_index" : 8,
-	"a_dbg_name" : "F50CAPO1",
-	"col_ambient" : [0.0, 0.0, 0.0],
-	"col_diffuse" : [0.56159999999999999, 0.043920000000000001, 0.069040000000000004],
-	"col_specular" : [0.025000000000000001, 0.025000000000000001, 0.025000000000000001],
+	"DbgColor" : 5708456,
+	"DbgIndex" : 8,
+	"DbgName" : "F50CAPO1",
+	"colorAmbient" : [0.0, 0.0, 0.0],
+	"colorDiffuse" : [0.56159999999999999, 0.043920000000000001, 0.069040000000000004],
+	"colorSpecular" : [0.025000000000000001, 0.025000000000000001, 0.025000000000000001],
 	"illumination" : 2,
-	"optical_density" : 1.0,
-	"specular_coef" : 98.039216,
+	"opticalDensity" : 1.0,
+	"specularCoef" : 98.039216,
 	"transparency" : 1.0
 	},
 
 	{
-	"a_dbg_color" : 0xf91e1c,
-	"a_dbg_index" : 9,
-	"a_dbg_name" : "F50CAPO",
-	"col_ambient" : [0.0, 0.0, 0.0],
-	"col_diffuse" : [0.56159999999999999, 0.043920000000000001, 0.069040000000000004],
-	"col_specular" : [0.025000000000000001, 0.025000000000000001, 0.025000000000000001],
+	"DbgColor" : 16326172,
+	"DbgIndex" : 9,
+	"DbgName" : "F50CAPO",
+	"colorAmbient" : [0.0, 0.0, 0.0],
+	"colorDiffuse" : [0.56159999999999999, 0.043920000000000001, 0.069040000000000004],
+	"colorSpecular" : [0.025000000000000001, 0.025000000000000001, 0.025000000000000001],
 	"illumination" : 2,
-	"optical_density" : 1.0,
-	"specular_coef" : 98.039216,
+	"opticalDensity" : 1.0,
+	"specularCoef" : 98.039216,
 	"transparency" : 1.0
 	},
 
 	{
-	"a_dbg_color" : 0x562b0f,
-	"a_dbg_index" : 10,
-	"a_dbg_name" : "F50LEFT",
-	"col_ambient" : [0.0, 0.0, 0.0],
-	"col_diffuse" : [0.56159999999999999, 0.043920000000000001, 0.069040000000000004],
-	"col_specular" : [0.025000000000000001, 0.025000000000000001, 0.025000000000000001],
+	"DbgColor" : 5647119,
+	"DbgIndex" : 10,
+	"DbgName" : "F50LEFT",
+	"colorAmbient" : [0.0, 0.0, 0.0],
+	"colorDiffuse" : [0.56159999999999999, 0.043920000000000001, 0.069040000000000004],
+	"colorSpecular" : [0.025000000000000001, 0.025000000000000001, 0.025000000000000001],
 	"illumination" : 2,
-	"optical_density" : 1.0,
-	"specular_coef" : 98.039216,
+	"opticalDensity" : 1.0,
+	"specularCoef" : 98.039216,
 	"transparency" : 1.0
 	},
 
 	{
-	"a_dbg_color" : 0x17be30,
-	"a_dbg_index" : 11,
-	"a_dbg_name" : "F50MOTOR",
-	"col_ambient" : [0.0, 0.0, 0.0],
-	"col_diffuse" : [0.1004, 0.10352, 0.062719999999999998],
-	"col_specular" : [0.025000000000000001, 0.025000000000000001, 0.025000000000000001],
+	"DbgColor" : 1556016,
+	"DbgIndex" : 11,
+	"DbgName" : "F50MOTOR",
+	"colorAmbient" : [0.0, 0.0, 0.0],
+	"colorDiffuse" : [0.1004, 0.10352, 0.062719999999999998],
+	"colorSpecular" : [0.025000000000000001, 0.025000000000000001, 0.025000000000000001],
 	"illumination" : 2,
-	"optical_density" : 1.0,
-	"specular_coef" : 17.647059,
+	"opticalDensity" : 1.0,
+	"specularCoef" : 17.647059,
 	"transparency" : 1.0
 	},
 
 	{
-	"a_dbg_color" : 0x27cd80,
-	"a_dbg_index" : 12,
-	"a_dbg_name" : "F50GOOD",
-	"col_ambient" : [0.0, 0.0, 0.0],
-	"col_diffuse" : [0.15376000000000001, 0.10983999999999999, 0.037679999999999998],
-	"col_specular" : [0.025000000000000001, 0.025000000000000001, 0.025000000000000001],
+	"DbgColor" : 2608512,
+	"DbgIndex" : 12,
+	"DbgName" : "F50GOOD",
+	"colorAmbient" : [0.0, 0.0, 0.0],
+	"colorDiffuse" : [0.15376000000000001, 0.10983999999999999, 0.037679999999999998],
+	"colorSpecular" : [0.025000000000000001, 0.025000000000000001, 0.025000000000000001],
 	"illumination" : 2,
-	"optical_density" : 1.0,
-	"specular_coef" : 17.647059,
+	"opticalDensity" : 1.0,
+	"specularCoef" : 17.647059,
 	"transparency" : 1.0
 	},
 
 	{
-	"a_dbg_color" : 0xce9ff4,
-	"a_dbg_index" : 13,
-	"a_dbg_name" : "F50RUEDA",
-	"col_ambient" : [0.0, 0.0, 0.0],
-	"col_diffuse" : [0.15376000000000001, 0.10983999999999999, 0.037679999999999998],
-	"col_specular" : [0.025000000000000001, 0.025000000000000001, 0.025000000000000001],
+	"DbgColor" : 13541364,
+	"DbgIndex" : 13,
+	"DbgName" : "F50RUEDA",
+	"colorAmbient" : [0.0, 0.0, 0.0],
+	"colorDiffuse" : [0.15376000000000001, 0.10983999999999999, 0.037679999999999998],
+	"colorSpecular" : [0.025000000000000001, 0.025000000000000001, 0.025000000000000001],
 	"illumination" : 2,
-	"optical_density" : 1.0,
-	"specular_coef" : 17.647059,
+	"opticalDensity" : 1.0,
+	"specularCoef" : 17.647059,
 	"transparency" : 1.0
 	},
 
 	{
-	"a_dbg_color" : 0xf50be9,
-	"a_dbg_index" : 14,
-	"a_dbg_name" : "F50SUELO",
-	"col_ambient" : [0.0, 0.0, 0.0],
-	"col_diffuse" : [0.15376000000000001, 0.10983999999999999, 0.037679999999999998],
-	"col_specular" : [0.025000000000000001, 0.025000000000000001, 0.025000000000000001],
+	"DbgColor" : 16059369,
+	"DbgIndex" : 14,
+	"DbgName" : "F50SUELO",
+	"colorAmbient" : [0.0, 0.0, 0.0],
+	"colorDiffuse" : [0.15376000000000001, 0.10983999999999999, 0.037679999999999998],
+	"colorSpecular" : [0.025000000000000001, 0.025000000000000001, 0.025000000000000001],
 	"illumination" : 2,
-	"optical_density" : 1.0,
-	"specular_coef" : 98.039216,
+	"opticalDensity" : 1.0,
+	"specularCoef" : 98.039216,
 	"transparency" : 1.0
 	},
 
 	{
-	"a_dbg_color" : 0x01a9e7,
-	"a_dbg_index" : 15,
-	"a_dbg_name" : "F50DISCO",
-	"col_ambient" : [0.0, 0.0, 0.0],
-	"col_diffuse" : [0.41095999999999999, 0.36080000000000001, 0.25728000000000001],
-	"col_specular" : [0.025000000000000001, 0.025000000000000001, 0.025000000000000001],
+	"DbgColor" : 109031,
+	"DbgIndex" : 15,
+	"DbgName" : "F50DISCO",
+	"colorAmbient" : [0.0, 0.0, 0.0],
+	"colorDiffuse" : [0.41095999999999999, 0.36080000000000001, 0.25728000000000001],
+	"colorSpecular" : [0.025000000000000001, 0.025000000000000001, 0.025000000000000001],
 	"illumination" : 2,
-	"optical_density" : 1.0,
-	"specular_coef" : 17.647059,
+	"opticalDensity" : 1.0,
+	"specularCoef" : 17.647059,
 	"transparency" : 1.0
 	},
 
 	{
-	"a_dbg_color" : 0x9a8dc9,
-	"a_dbg_index" : 16,
-	"a_dbg_name" : "F50FARYE",
-	"col_ambient" : [0.0, 0.0, 0.0],
-	"col_diffuse" : [0.79056000000000004, 0.41095999999999999, 0.0062399999999999999],
-	"col_specular" : [0.025000000000000001, 0.025000000000000001, 0.025000000000000001],
+	"DbgColor" : 10128841,
+	"DbgIndex" : 16,
+	"DbgName" : "F50FARYE",
+	"colorAmbient" : [0.0, 0.0, 0.0],
+	"colorDiffuse" : [0.79056000000000004, 0.41095999999999999, 0.0062399999999999999],
+	"colorSpecular" : [0.025000000000000001, 0.025000000000000001, 0.025000000000000001],
 	"illumination" : 2,
-	"optical_density" : 1.0,
-	"specular_coef" : 98.039216,
+	"opticalDensity" : 1.0,
+	"specularCoef" : 98.039216,
 	"transparency" : 0.6
 	},
 
 	{
-	"a_dbg_color" : 0x60e7a0,
-	"a_dbg_index" : 17,
-	"a_dbg_name" : "F5OLOGO",
-	"col_ambient" : [0.0, 0.0, 0.0],
-	"col_diffuse" : [0.41095999999999999, 0.36080000000000001, 0.25728000000000001],
-	"col_specular" : [0.025000000000000001, 0.025000000000000001, 0.025000000000000001],
+	"DbgColor" : 6350752,
+	"DbgIndex" : 17,
+	"DbgName" : "F5OLOGO",
+	"colorAmbient" : [0.0, 0.0, 0.0],
+	"colorDiffuse" : [0.41095999999999999, 0.36080000000000001, 0.25728000000000001],
+	"colorSpecular" : [0.025000000000000001, 0.025000000000000001, 0.025000000000000001],
 	"illumination" : 2,
-	"optical_density" : 1.0,
-	"specular_coef" : 17.647059,
+	"opticalDensity" : 1.0,
+	"specularCoef" : 17.647059,
 	"transparency" : 1.0
 	},
 
 	{
-	"a_dbg_color" : 0x8d5288,
-	"a_dbg_index" : 18,
-	"a_dbg_name" : "F50FARED",
-	"col_ambient" : [0.0, 0.0, 0.0],
-	"col_diffuse" : [0.63056000000000001, 0.07528, 0.050160000000000003],
-	"col_specular" : [0.025000000000000001, 0.025000000000000001, 0.025000000000000001],
+	"DbgColor" : 9261704,
+	"DbgIndex" : 18,
+	"DbgName" : "F50FARED",
+	"colorAmbient" : [0.0, 0.0, 0.0],
+	"colorDiffuse" : [0.63056000000000001, 0.07528, 0.050160000000000003],
+	"colorSpecular" : [0.025000000000000001, 0.025000000000000001, 0.025000000000000001],
 	"illumination" : 2,
-	"optical_density" : 1.0,
-	"specular_coef" : 98.039216,
+	"opticalDensity" : 1.0,
+	"specularCoef" : 98.039216,
 	"transparency" : 0.7
 	},
 
 	{
-	"a_dbg_color" : 0x18c267,
-	"a_dbg_index" : 19,
-	"a_dbg_name" : "F50FARWD",
-	"col_ambient" : [0.0, 0.0, 0.0],
-	"col_diffuse" : [0.40472000000000002, 0.40472000000000002, 0.40472000000000002],
-	"col_specular" : [0.025000000000000001, 0.025000000000000001, 0.025000000000000001],
+	"DbgColor" : 1622631,
+	"DbgIndex" : 19,
+	"DbgName" : "F50FARWD",
+	"colorAmbient" : [0.0, 0.0, 0.0],
+	"colorDiffuse" : [0.40472000000000002, 0.40472000000000002, 0.40472000000000002],
+	"colorSpecular" : [0.025000000000000001, 0.025000000000000001, 0.025000000000000001],
 	"illumination" : 2,
-	"optical_density" : 1.0,
-	"specular_coef" : 98.039216,
+	"opticalDensity" : 1.0,
+	"specularCoef" : 98.039216,
 	"transparency" : 0.7
 	},
 
 	{
-	"a_dbg_color" : 0xbacfb3,
-	"a_dbg_index" : 20,
-	"a_dbg_name" : "F50ASIEN",
-	"col_ambient" : [0.0, 0.0, 0.0],
-	"col_diffuse" : [0.56159999999999999, 0.043920000000000001, 0.069040000000000004],
-	"col_specular" : [0.025000000000000001, 0.025000000000000001, 0.025000000000000001],
+	"DbgColor" : 12242867,
+	"DbgIndex" : 20,
+	"DbgName" : "F50ASIEN",
+	"colorAmbient" : [0.0, 0.0, 0.0],
+	"colorDiffuse" : [0.56159999999999999, 0.043920000000000001, 0.069040000000000004],
+	"colorSpecular" : [0.025000000000000001, 0.025000000000000001, 0.025000000000000001],
 	"illumination" : 2,
-	"optical_density" : 1.0,
-	"specular_coef" : 98.039216,
+	"opticalDensity" : 1.0,
+	"specularCoef" : 98.039216,
 	"transparency" : 1.0
 	},
 
 	{
-	"a_dbg_color" : 0xce4a2a,
-	"a_dbg_index" : 21,
-	"a_dbg_name" : "F50MATR",
-	"col_ambient" : [0.0, 0.0, 0.0],
-	"col_diffuse" : [0.59919999999999995, 0.58984000000000003, 0.56472],
-	"col_specular" : [0.025000000000000001, 0.025000000000000001, 0.025000000000000001],
+	"DbgColor" : 13519402,
+	"DbgIndex" : 21,
+	"DbgName" : "F50MATR",
+	"colorAmbient" : [0.0, 0.0, 0.0],
+	"colorDiffuse" : [0.59919999999999995, 0.58984000000000003, 0.56472],
+	"colorSpecular" : [0.025000000000000001, 0.025000000000000001, 0.025000000000000001],
 	"illumination" : 2,
-	"optical_density" : 1.0,
-	"specular_coef" : 98.039216,
+	"opticalDensity" : 1.0,
+	"specularCoef" : 98.039216,
 	"transparency" : 1.0
 	},
 
 	{
-	"a_dbg_color" : 0x89463d,
-	"a_dbg_index" : 22,
-	"a_dbg_name" : "F50AIRE",
-	"col_ambient" : [0.0, 0.0, 0.0],
-	"col_diffuse" : [0.15376000000000001, 0.10983999999999999, 0.037679999999999998],
-	"col_specular" : [0.025000000000000001, 0.025000000000000001, 0.025000000000000001],
+	"DbgColor" : 8996413,
+	"DbgIndex" : 22,
+	"DbgName" : "F50AIRE",
+	"colorAmbient" : [0.0, 0.0, 0.0],
+	"colorDiffuse" : [0.15376000000000001, 0.10983999999999999, 0.037679999999999998],
+	"colorSpecular" : [0.025000000000000001, 0.025000000000000001, 0.025000000000000001],
 	"illumination" : 2,
-	"optical_density" : 1.0,
-	"specular_coef" : 98.039216,
+	"opticalDensity" : 1.0,
+	"specularCoef" : 98.039216,
 	"transparency" : 1.0
 	},
 
 	{
-	"a_dbg_color" : 0xb2b942,
-	"a_dbg_index" : 23,
-	"a_dbg_name" : "F50TOPAL",
-	"col_ambient" : [0.0, 0.0, 0.0],
-	"col_diffuse" : [0.56159999999999999, 0.043920000000000001, 0.069040000000000004],
-	"col_specular" : [0.025000000000000001, 0.025000000000000001, 0.025000000000000001],
+	"DbgColor" : 11712834,
+	"DbgIndex" : 23,
+	"DbgName" : "F50TOPAL",
+	"colorAmbient" : [0.0, 0.0, 0.0],
+	"colorDiffuse" : [0.56159999999999999, 0.043920000000000001, 0.069040000000000004],
+	"colorSpecular" : [0.025000000000000001, 0.025000000000000001, 0.025000000000000001],
 	"illumination" : 2,
-	"optical_density" : 1.0,
-	"specular_coef" : 98.039216,
+	"opticalDensity" : 1.0,
+	"specularCoef" : 98.039216,
 	"transparency" : 1.0
 	},
 
 	{
-	"a_dbg_color" : 0xd8f563,
-	"a_dbg_index" : 24,
-	"a_dbg_name" : "F50TOPAL1",
-	"col_ambient" : [0.0, 0.0, 0.0],
-	"col_diffuse" : [0.56159999999999999, 0.043920000000000001, 0.069040000000000004],
-	"col_specular" : [0.025000000000000001, 0.025000000000000001, 0.025000000000000001],
+	"DbgColor" : 14218595,
+	"DbgIndex" : 24,
+	"DbgName" : "F50TOPAL1",
+	"colorAmbient" : [0.0, 0.0, 0.0],
+	"colorDiffuse" : [0.56159999999999999, 0.043920000000000001, 0.069040000000000004],
+	"colorSpecular" : [0.025000000000000001, 0.025000000000000001, 0.025000000000000001],
 	"illumination" : 2,
-	"optical_density" : 1.0,
-	"specular_coef" : 98.039216,
+	"opticalDensity" : 1.0,
+	"specularCoef" : 98.039216,
 	"transparency" : 1.0
 	}],
 
-    'buffers': 'F50NoUv_bin.bin',
+    "buffers": "F50NoUv_bin.bin"
 
-    'end': (new Date).getTime()
-    }
+};
     
 postMessage( model );
+close();

+ 1 - 0
examples/obj/female02/Female02_bin.js

@@ -100,3 +100,4 @@ var model = {
 };
     
 postMessage( model );
+close();

+ 1 - 0
examples/obj/female02/Female02_slim.js

@@ -118,3 +118,4 @@ var model = {
 };
 
 postMessage( model );
+close();

+ 65 - 62
examples/obj/gallardo/GallardoNoUv_bin.js

@@ -1,107 +1,110 @@
 // Converted from: ../../examples/obj/gallardo/GallardoNoUv.obj
 //  vertices: 77815
-//  faces: 75573 
+//  faces: 75573
 //  materials: 7
 //
 //  Generated with OBJ -> Three.js converter
-//  http://github.com/alteredq/three.js/blob/master/utils/exporters/convert_obj_threejs_slim.py
+//  http://github.com/alteredq/three.js/blob/master/utils/exporters/convert_obj_three.py
 
 
 var model = {
-    'materials': [	{
-	"a_dbg_color" : 0xeeeeee,
-	"a_dbg_index" : 0,
-	"a_dbg_name" : "wire_255255255",
-	"col_ambient" : [0.0, 0.0, 0.0],
-	"col_diffuse" : [0.80000000000000004, 0.80000000000000004, 0.80000000000000004],
-	"col_specular" : [0.17499999999999999, 0.17499999999999999, 0.17499999999999999],
+
+    "version" : 1,
+
+    "materials": [	{
+	"DbgColor" : 15658734,
+	"DbgIndex" : 0,
+	"DbgName" : "wire_255255255",
+	"colorAmbient" : [0.0, 0.0, 0.0],
+	"colorDiffuse" : [0.80000000000000004, 0.80000000000000004, 0.80000000000000004],
+	"colorSpecular" : [0.17499999999999999, 0.17499999999999999, 0.17499999999999999],
 	"illumination" : 2,
-	"optical_density" : 1.0,
-	"specular_coef" : 29.411765,
+	"opticalDensity" : 1.0,
+	"specularCoef" : 29.411765,
 	"transparency" : 1.0
 	},
 
 	{
-	"a_dbg_color" : 0xee0000,
-	"a_dbg_index" : 1,
-	"a_dbg_name" : "wire_115115115",
-	"col_ambient" : [0.0, 0.0, 0.0],
-	"col_diffuse" : [0.36080000000000001, 0.36080000000000001, 0.36080000000000001],
-	"col_specular" : [0.17499999999999999, 0.17499999999999999, 0.17499999999999999],
+	"DbgColor" : 15597568,
+	"DbgIndex" : 1,
+	"DbgName" : "wire_115115115",
+	"colorAmbient" : [0.0, 0.0, 0.0],
+	"colorDiffuse" : [0.36080000000000001, 0.36080000000000001, 0.36080000000000001],
+	"colorSpecular" : [0.17499999999999999, 0.17499999999999999, 0.17499999999999999],
 	"illumination" : 2,
-	"optical_density" : 1.0,
-	"specular_coef" : 29.411765,
+	"opticalDensity" : 1.0,
+	"specularCoef" : 29.411765,
 	"transparency" : 1.0
 	},
 
 	{
-	"a_dbg_color" : 0x00ee00,
-	"a_dbg_index" : 2,
-	"a_dbg_name" : "03___Default",
-	"col_ambient" : [0.0, 0.0, 0.0],
-	"col_diffuse" : [0.13175999999999999, 0.13175999999999999, 0.13175999999999999],
-	"col_specular" : [0.0, 0.0, 0.0],
+	"DbgColor" : 60928,
+	"DbgIndex" : 2,
+	"DbgName" : "03___Default",
+	"colorAmbient" : [0.0, 0.0, 0.0],
+	"colorDiffuse" : [0.13175999999999999, 0.13175999999999999, 0.13175999999999999],
+	"colorSpecular" : [0.0, 0.0, 0.0],
 	"illumination" : 2,
-	"optical_density" : 1.0,
-	"specular_coef" : 7.843137,
+	"opticalDensity" : 1.0,
+	"specularCoef" : 7.843137,
 	"transparency" : 1.0
 	},
 
 	{
-	"a_dbg_color" : 0x0000ee,
-	"a_dbg_index" : 3,
-	"a_dbg_name" : "02___Default",
-	"col_ambient" : [0.0, 0.0, 0.0],
-	"col_diffuse" : [0.80000000000000004, 0.0, 0.0],
-	"col_specular" : [0.65249999999999997, 0.65249999999999997, 0.65249999999999997],
+	"DbgColor" : 238,
+	"DbgIndex" : 3,
+	"DbgName" : "02___Default",
+	"colorAmbient" : [0.0, 0.0, 0.0],
+	"colorDiffuse" : [0.80000000000000004, 0.0, 0.0],
+	"colorSpecular" : [0.65249999999999997, 0.65249999999999997, 0.65249999999999997],
 	"illumination" : 2,
-	"optical_density" : 1.0,
-	"specular_coef" : 25.490196,
+	"opticalDensity" : 1.0,
+	"specularCoef" : 25.490196,
 	"transparency" : 1.0
 	},
 
 	{
-	"a_dbg_color" : 0xeeee00,
-	"a_dbg_index" : 4,
-	"a_dbg_name" : "wire_255000000",
-	"col_ambient" : [0.0, 0.0, 0.0],
-	"col_diffuse" : [0.80000000000000004, 0.0, 0.0],
-	"col_specular" : [0.17499999999999999, 0.17499999999999999, 0.17499999999999999],
+	"DbgColor" : 15658496,
+	"DbgIndex" : 4,
+	"DbgName" : "wire_255000000",
+	"colorAmbient" : [0.0, 0.0, 0.0],
+	"colorDiffuse" : [0.80000000000000004, 0.0, 0.0],
+	"colorSpecular" : [0.17499999999999999, 0.17499999999999999, 0.17499999999999999],
 	"illumination" : 2,
-	"optical_density" : 1.0,
-	"specular_coef" : 29.411765,
+	"opticalDensity" : 1.0,
+	"specularCoef" : 29.411765,
 	"transparency" : 1.0
 	},
 
 	{
-	"a_dbg_color" : 0x00eeee,
-	"a_dbg_index" : 5,
-	"a_dbg_name" : "wire_252252000",
-	"col_ambient" : [0.0, 0.0, 0.0],
-	"col_diffuse" : [0.79056000000000004, 0.79056000000000004, 0.0],
-	"col_specular" : [0.17499999999999999, 0.17499999999999999, 0.17499999999999999],
+	"DbgColor" : 61166,
+	"DbgIndex" : 5,
+	"DbgName" : "wire_252252000",
+	"colorAmbient" : [0.0, 0.0, 0.0],
+	"colorDiffuse" : [0.79056000000000004, 0.79056000000000004, 0.0],
+	"colorSpecular" : [0.17499999999999999, 0.17499999999999999, 0.17499999999999999],
 	"illumination" : 2,
-	"optical_density" : 1.0,
-	"specular_coef" : 29.411765,
+	"opticalDensity" : 1.0,
+	"specularCoef" : 29.411765,
 	"transparency" : 1.0
 	},
 
 	{
-	"a_dbg_color" : 0xee00ee,
-	"a_dbg_index" : 6,
-	"a_dbg_name" : "wire_132132132",
-	"col_ambient" : [0.0, 0.0, 0.0],
-	"col_diffuse" : [0.41408, 0.41408, 0.41408],
-	"col_specular" : [0.17499999999999999, 0.17499999999999999, 0.17499999999999999],
+	"DbgColor" : 15597806,
+	"DbgIndex" : 6,
+	"DbgName" : "wire_132132132",
+	"colorAmbient" : [0.0, 0.0, 0.0],
+	"colorDiffuse" : [0.41408, 0.41408, 0.41408],
+	"colorSpecular" : [0.17499999999999999, 0.17499999999999999, 0.17499999999999999],
 	"illumination" : 2,
-	"optical_density" : 1.0,
-	"specular_coef" : 29.411765,
+	"opticalDensity" : 1.0,
+	"specularCoef" : 29.411765,
 	"transparency" : 1.0
 	}],
 
-    'buffers': 'GallardoNoUv_bin.bin',
+    "buffers": "GallardoNoUv_bin.bin"
 
-    'end': (new Date).getTime()
-    }
+};
     
 postMessage( model );
+close();

+ 1 - 0
examples/obj/leeperrysmith/LeePerrySmith.js

@@ -44,3 +44,4 @@ var model = {
 };
 
 postMessage( model );
+close();

+ 1 - 0
examples/obj/lucy/Lucy100k_bin.js

@@ -22,3 +22,4 @@ var model = {
 };
     
 postMessage( model );
+close();

+ 1 - 0
examples/obj/lucy/Lucy100k_slim.js

@@ -40,3 +40,4 @@ var model = {
 };
 
 postMessage( model );
+close();

+ 1 - 0
examples/obj/male02/Male02_bin.js

@@ -86,3 +86,4 @@ var model = {
 };
     
 postMessage( model );
+close();

+ 1 - 0
examples/obj/male02/Male02_slim.js

@@ -104,3 +104,4 @@ var model = {
 };
 
 postMessage( model );
+close();

+ 1 - 0
examples/obj/ninja/NinjaLo_bin.js

@@ -22,3 +22,4 @@ var model = {
 };
     
 postMessage( model );
+close();

+ 1 - 0
examples/obj/torus/Torus_bin.js

@@ -22,3 +22,4 @@ var model = {
 };
     
 postMessage( model );
+close();

+ 1 - 0
examples/obj/torus/Torus_slim.js

@@ -40,3 +40,4 @@ var model = {
 };
 
 postMessage( model );
+close();

+ 73 - 70
examples/obj/veyron/VeyronNoUv_bin.js

@@ -1,120 +1,123 @@
 // Converted from: ../../examples/obj/veyron/VeyronNoUv.obj
 //  vertices: 36210
-//  faces: 33034 
+//  faces: 33034
 //  materials: 8
 //
 //  Generated with OBJ -> Three.js converter
-//  http://github.com/alteredq/three.js/blob/master/utils/exporters/convert_obj_threejs_slim.py
+//  http://github.com/alteredq/three.js/blob/master/utils/exporters/convert_obj_three.py
 
 
 var model = {
-    'materials': [	{
-	"a_dbg_color" : 0xeeeeee,
-	"a_dbg_index" : 0,
-	"a_dbg_name" : "08___Default",
-	"col_ambient" : [0.0, 0.0, 0.0],
-	"col_diffuse" : [0.18823999999999999, 0.18823999999999999, 0.18823999999999999],
-	"col_specular" : [0.14824999999999999, 0.14824999999999999, 0.14824999999999999],
+
+    "version" : 1,
+
+    "materials": [	{
+	"DbgColor" : 15658734,
+	"DbgIndex" : 0,
+	"DbgName" : "08___Default",
+	"colorAmbient" : [0.0, 0.0, 0.0],
+	"colorDiffuse" : [0.18823999999999999, 0.18823999999999999, 0.18823999999999999],
+	"colorSpecular" : [0.14824999999999999, 0.14824999999999999, 0.14824999999999999],
 	"illumination" : 2,
-	"optical_density" : 1.0,
-	"specular_coef" : 17.647059,
+	"opticalDensity" : 1.0,
+	"specularCoef" : 17.647059,
 	"transparency" : 1.0
 	},
 
 	{
-	"a_dbg_color" : 0xee0000,
-	"a_dbg_index" : 1,
-	"a_dbg_name" : "03___Default",
-	"col_ambient" : [0.0, 0.0, 0.0],
-	"col_diffuse" : [0.52703999999999995, 0.52703999999999995, 0.52703999999999995],
-	"col_specular" : [0.59999999999999998, 0.59999999999999998, 0.59999999999999998],
+	"DbgColor" : 15597568,
+	"DbgIndex" : 1,
+	"DbgName" : "03___Default",
+	"colorAmbient" : [0.0, 0.0, 0.0],
+	"colorDiffuse" : [0.52703999999999995, 0.52703999999999995, 0.52703999999999995],
+	"colorSpecular" : [0.59999999999999998, 0.59999999999999998, 0.59999999999999998],
 	"illumination" : 2,
-	"optical_density" : 1.0,
-	"specular_coef" : 37.254902,
+	"opticalDensity" : 1.0,
+	"specularCoef" : 37.254902,
 	"transparency" : 1.0
 	},
 
 	{
-	"a_dbg_color" : 0x00ee00,
-	"a_dbg_index" : 2,
-	"a_dbg_name" : "ColorBlack",
-	"col_ambient" : [0.0, 0.0, 0.0],
-	"col_diffuse" : [0.21648000000000001, 0.21648000000000001, 0.21648000000000001],
-	"col_specular" : [0.75, 0.75, 0.75],
+	"DbgColor" : 60928,
+	"DbgIndex" : 2,
+	"DbgName" : "ColorBlack",
+	"colorAmbient" : [0.0, 0.0, 0.0],
+	"colorDiffuse" : [0.21648000000000001, 0.21648000000000001, 0.21648000000000001],
+	"colorSpecular" : [0.75, 0.75, 0.75],
 	"illumination" : 2,
-	"optical_density" : 1.0,
-	"specular_coef" : 56.862745,
+	"opticalDensity" : 1.0,
+	"specularCoef" : 56.862745,
 	"transparency" : 1.0
 	},
 
 	{
-	"a_dbg_color" : 0x0000ee,
-	"a_dbg_index" : 3,
-	"a_dbg_name" : "04___Default",
-	"col_ambient" : [0.0, 0.0, 0.0],
-	"col_diffuse" : [0.54271999999999998, 0.57408000000000003, 0.58984000000000003],
-	"col_specular" : [0.75, 0.75, 0.75],
+	"DbgColor" : 238,
+	"DbgIndex" : 3,
+	"DbgName" : "04___Default",
+	"colorAmbient" : [0.0, 0.0, 0.0],
+	"colorDiffuse" : [0.54271999999999998, 0.57408000000000003, 0.58984000000000003],
+	"colorSpecular" : [0.75, 0.75, 0.75],
 	"illumination" : 2,
-	"optical_density" : 1.0,
-	"specular_coef" : 66.666667,
+	"opticalDensity" : 1.0,
+	"specularCoef" : 66.666667,
 	"transparency" : 0.5
 	},
 
 	{
-	"a_dbg_color" : 0xeeee00,
-	"a_dbg_index" : 4,
-	"a_dbg_name" : "02___Default",
-	"col_ambient" : [0.0, 0.0, 0.0],
-	"col_diffuse" : [0.48311999999999999, 0.0, 0.0],
-	"col_specular" : [0.75, 0.75, 0.75],
+	"DbgColor" : 15658496,
+	"DbgIndex" : 4,
+	"DbgName" : "02___Default",
+	"colorAmbient" : [0.0, 0.0, 0.0],
+	"colorDiffuse" : [0.48311999999999999, 0.0, 0.0],
+	"colorSpecular" : [0.75, 0.75, 0.75],
 	"illumination" : 2,
-	"optical_density" : 1.0,
-	"specular_coef" : 56.862745,
+	"opticalDensity" : 1.0,
+	"specularCoef" : 56.862745,
 	"transparency" : 1.0
 	},
 
 	{
-	"a_dbg_color" : 0x00eeee,
-	"a_dbg_index" : 5,
-	"a_dbg_name" : "Aluminium",
-	"col_ambient" : [0.0, 0.0, 0.0],
-	"col_diffuse" : [0.47055999999999998, 0.47055999999999998, 0.47055999999999998],
-	"col_specular" : [0.40000000000000002, 0.40000000000000002, 0.40000000000000002],
+	"DbgColor" : 61166,
+	"DbgIndex" : 5,
+	"DbgName" : "Aluminium",
+	"colorAmbient" : [0.0, 0.0, 0.0],
+	"colorDiffuse" : [0.47055999999999998, 0.47055999999999998, 0.47055999999999998],
+	"colorSpecular" : [0.40000000000000002, 0.40000000000000002, 0.40000000000000002],
 	"illumination" : 2,
-	"optical_density" : 1.0,
-	"specular_coef" : 17.647059,
+	"opticalDensity" : 1.0,
+	"specularCoef" : 17.647059,
 	"transparency" : 1.0
 	},
 
 	{
-	"a_dbg_color" : 0xee00ee,
-	"a_dbg_index" : 6,
-	"a_dbg_name" : "glassRed",
-	"col_ambient" : [0.0, 0.0, 0.0],
-	"col_diffuse" : [0.57408000000000003, 0.0, 0.0],
-	"col_specular" : [0.75, 0.75, 0.75],
+	"DbgColor" : 15597806,
+	"DbgIndex" : 6,
+	"DbgName" : "glassRed",
+	"colorAmbient" : [0.0, 0.0, 0.0],
+	"colorDiffuse" : [0.57408000000000003, 0.0, 0.0],
+	"colorSpecular" : [0.75, 0.75, 0.75],
 	"illumination" : 2,
-	"optical_density" : 1.0,
-	"specular_coef" : 66.666667,
+	"opticalDensity" : 1.0,
+	"specularCoef" : 66.666667,
 	"transparency" : 0.5
 	},
 
 	{
-	"a_dbg_color" : 0x06671a,
-	"a_dbg_index" : 7,
-	"a_dbg_name" : "glassOranje",
-	"col_ambient" : [0.0, 0.0, 0.0],
-	"col_diffuse" : [0.80000000000000004, 0.49568000000000001, 0.1004],
-	"col_specular" : [0.75, 0.75, 0.75],
+	"DbgColor" : 419610,
+	"DbgIndex" : 7,
+	"DbgName" : "glassOranje",
+	"colorAmbient" : [0.0, 0.0, 0.0],
+	"colorDiffuse" : [0.80000000000000004, 0.49568000000000001, 0.1004],
+	"colorSpecular" : [0.75, 0.75, 0.75],
 	"illumination" : 2,
-	"optical_density" : 1.0,
-	"specular_coef" : 66.666667,
+	"opticalDensity" : 1.0,
+	"specularCoef" : 66.666667,
 	"transparency" : 0.5
 	}],
 
-    'buffers': 'VeyronNoUv_bin.bin',
+    "buffers": "VeyronNoUv_bin.bin"
 
-    'end': (new Date).getTime()
-    }
+};
     
 postMessage( model );
+close();

+ 1 - 0
examples/obj/walt/WaltHead_bin.js

@@ -29,3 +29,4 @@ var model = {
 };
     
 postMessage( model );
+close();

+ 1 - 0
examples/obj/walt/WaltHead_slim.js

@@ -47,3 +47,4 @@ var model = {
 };
 
 postMessage( model );
+close();

+ 1 - 0
examples/scenes/test_scene.js

@@ -441,3 +441,4 @@ var scene = {
 };
 
 postMessage( scene );
+close();

+ 31 - 10
src/extras/io/SceneLoader.js

@@ -27,6 +27,7 @@ THREE.SceneLoader.prototype = {
 				result;
 
 			data = event.data;
+
 			binLoader = new THREE.BinaryLoader();
 			jsonLoader = new THREE.JSONLoader();
 
@@ -46,6 +47,26 @@ THREE.SceneLoader.prototype = {
 
 			};
 
+			if ( data.transform ) {
+
+				var position = data.transform.position,
+					rotation = data.transform.rotation,
+					scale = data.transform.scale;
+
+				if ( position )
+					result.scene.position.set( position[ 0 ], position[ 1 ], position [ 2 ] );
+
+				if ( rotation )
+					result.scene.rotation.set( rotation[ 0 ], rotation[ 1 ], rotation [ 2 ] );
+
+				if ( scale )
+					result.scene.scale.set( scale[ 0 ], scale[ 1 ], scale [ 2 ] );
+
+				if ( position || rotation || scale )
+					result.scene.updateMatrix();
+
+			}
+			
 			function get_url( source_url, url_type ) {
 				
 				if ( url_type == "relativeToHTML" ) {
@@ -83,31 +104,31 @@ THREE.SceneLoader.prototype = {
 							r = o.rotation;
 							q = o.quaternion;
 							s = o.scale;
-							
+
 							// turn off quaternions, for the moment
-							
+
 							q = 0;
 
 							if ( materials.length == 0 ) {
-								
+
 								materials[ 0 ] = new THREE.MeshFaceMaterial();
-								
+
 							}
-							
+
 							object = new THREE.Mesh( geometry, materials );
 							object.position.set( p[0], p[1], p[2] );
-							
+
 							if ( q ) {
-								
+
 								object.quaternion.set( q[0], q[1], q[2], q[3] );
 								object.useQuaternion = true;
-								
+
 							} else {
 
 								object.rotation.set( r[0], r[1], r[2] );
-								
+
 							}
-							
+
 							object.scale.set( s[0], s[1], s[2] );
 							object.visible = o.visible;
 

+ 66 - 44
utils/exporters/blender/2.56/scripts/op/io_mesh_threejs/export_threejs.py

@@ -45,6 +45,10 @@ DEFAULTS = {
 "bgcolor" : [0, 0, 0],
 "bgalpha" : 1.0,
 
+"position" : [0, 0, 0],
+"rotation" : [-math.pi/2, 0, 0],
+"scale"    : [1, 1, 1],
+
 "camera"  : 
     {
         "name" : "default_camera",
@@ -61,9 +65,9 @@ DEFAULTS = {
  {
     "name"       : "default_light",
     "type"       : "directional",
-    "direction"	 : [0,1,1],
-    "color" 	 : [1,1,1],
-    "intensity"	 : 0.8
+    "direction"  : [0, 1, 1],
+    "color"      : [1, 1, 1],
+    "intensity"  : 0.8
  }
 }
 
@@ -77,10 +81,16 @@ COLORS = [0xeeeeee, 0xee0000, 0x00ee00, 0x0000ee, 0xeeee00, 0x00eeee, 0xee00ee]
 # #####################################################
 
 TEMPLATE_SCENE_ASCII = """\
-// Converted from: %(fname)s
-//  File generated with Blender 2.56 Exporter
-//  https://github.com/alteredq/three.js/tree/master/utils/exporters/blender/
-
+/* Converted from: %(fname)s
+ *
+ * File generated with Blender 2.56 Exporter
+ * https://github.com/alteredq/three.js/tree/master/utils/exporters/blender/
+ *
+ * objects:    %(nobjects)s
+ * geometries: %(ngeometries)s
+ * materials:  %(nmaterials)s
+ * textures:   %(ntextures)s
+ */  
 
 var scene = {
 
@@ -89,6 +99,13 @@ var scene = {
 
 %(sections)s
 
+"transform" : 
+{
+    "position"  : %(position)s,
+    "rotation"  : %(rotation)s,
+    "scale"     : %(scale)s,
+},
+
 "defaults" : 
 {
     "bgcolor" : %(bgcolor)s,
@@ -99,7 +116,7 @@ var scene = {
 }
 
 postMessage( scene );
-
+close();
 """
 
 TEMPLATE_SECTION = """
@@ -117,7 +134,7 @@ TEMPLATE_OBJECT = """\
         "position"  : %(position)s,
         "rotation"  : %(rotation)s,
         "quaternion": %(quaternion)s,
-        "scale"	    : %(scale)s,
+        "scale"     : %(scale)s,
         "visible"       : true,
         "castsShadow"   : %(castsShadow)s,
         "meshCollider"  : %(meshCollider)s
@@ -230,6 +247,7 @@ var model = {
 };
 
 postMessage( model );
+close();
 """
 
 TEMPLATE_VERTEX = "%f,%f,%f"
@@ -648,7 +666,7 @@ def value2string(v):
         return str(v).lower()
     return str(v)
 
-def generate_materials(mtl, materials, use_colors, draw_type):
+def generate_materials(mtl, materials, draw_type):
     """Generate JS array of materials objects
     """
 
@@ -663,7 +681,6 @@ def generate_materials(mtl, materials, use_colors, draw_type):
         mtl[m]['DbgName'] = m
         mtl[m]['DbgIndex'] = index
         mtl[m]['DbgColor'] = generate_color(index)
-        mtl[m]['vertexColors'] = use_colors and mtl[m]["useVertexColors"]
 
         if draw_type in [ "BOUNDS", "WIRE" ]:
             mtl[m]['wireframe'] = True
@@ -675,7 +692,7 @@ def generate_materials(mtl, materials, use_colors, draw_type):
 
     return ",\n\n".join([m for i,m in sorted(mtl_array)]), len(mtl_array)
 
-def extract_materials(mesh, scene):
+def extract_materials(mesh, scene, use_colors):
     world = scene.world
 
     materials = {}
@@ -701,6 +718,7 @@ def extract_materials(mesh, scene):
             # not sure about mapping values to Blinn-Phong shader
             # Blender uses INT from [1,511] with default 0
             # http://www.blender.org/documentation/blender_python_api_2_54_0/bpy.types.Material.html#bpy.types.Material.specular_hardness
+
             material["specularCoef"] = m.specular_hardness
 
             if m.active_texture and m.active_texture.type == 'IMAGE' and m.active_texture.image:
@@ -708,8 +726,8 @@ def extract_materials(mesh, scene):
                 fn = os.path.normpath(fn)
                 fn_strip = os.path.basename(fn)
                 material['mapDiffuse'] = fn_strip
-                
-            material["useVertexColors"] = m.THREE_useVertexColors
+
+            material["vertexColors"] = m.THREE_useVertexColors and use_colors
             
             # can't really use this reliably to tell apart Phong from Lambert
             # as Blender defaults to non-zero specular color
@@ -742,9 +760,9 @@ def generate_materials_string(mesh, scene, use_colors, draw_type):
 
     # extract real materials from the mesh
     
-    mtl.update(extract_materials(mesh, scene))
+    mtl.update(extract_materials(mesh, scene, use_colors))
 
-    return generate_materials(mtl, materials, use_colors, draw_type)
+    return generate_materials(mtl, materials, draw_type)
 
 # #####################################################
 # ASCII model generator
@@ -834,7 +852,6 @@ def export_mesh(obj, scene, filepath,
 
     """Export single mesh"""
 
-
     # collapse modifiers into mesh
     
     mesh = obj.create_mesh(scene, True, 'RENDER')
@@ -845,17 +862,14 @@ def export_mesh(obj, scene, filepath,
     # that's what Blender's native export_obj.py does
     # to flip YZ
 
-    X_ROT = mathutils.Matrix.Rotation(-math.pi/2, 4, 'X')
-
     if export_single_model:
+        X_ROT = mathutils.Matrix.Rotation(-math.pi/2, 4, 'X')
         mesh.transform(X_ROT * obj.matrix_world)
-    else:
-        mesh.transform(X_ROT)
-
-    mesh.transform(mathutils.Matrix.Scale(option_scale, 4))
 
     mesh.calc_normals()
 
+    mesh.transform(mathutils.Matrix.Scale(option_scale, 4))
+
     faceUV = (len(mesh.uv_textures) > 0)
     vertexUV = (len(mesh.sticky) > 0)
     vertexColors = len(mesh.vertex_colors) > 0
@@ -958,27 +972,20 @@ def generate_objects(data):
     for obj in data["objects"]:
         if obj.type == "MESH":
             object_id = obj.name
-            
+
             if len(obj.modifiers) > 0:
                 geo_name = obj.name
             else:
                 geo_name = obj.data.name
 
             geometry_id = "geo_%s" % geo_name
-            
+
             material_ids = generate_material_id_list(obj.material_slots)
             group_ids = generate_group_id_list(obj)
 
-            #position = obj.location
-            #rotation = obj.rotation_euler
-            scale = obj.scale
-            quaternion = obj.rotation_quaternion
-            
-            position = [obj.location.x, obj.location.z, -obj.location.y]
-            rotation = [obj.rotation_euler.x, -obj.rotation_euler.y, -obj.rotation_euler.z]
-            #quaternion = obj.rotation_euler.to_quat()
-            scale = [obj.scale.x, obj.scale.z, obj.scale.y]
-            
+            position, quaternion, scale = obj.matrix_world.decompose()
+            rotation = quaternion.to_euler("XYZ")
+
             material_string = ""
             if len(material_ids) > 0:
                 material_string = generate_string_list(material_ids)
@@ -995,16 +1002,18 @@ def generate_objects(data):
             "geometry_id" : generate_string(geometry_id),
             "group_id"    : group_string,
             "material_id" : material_string,
+
             "position"    : generate_vec3(position),
             "rotation"    : generate_vec3(rotation),
             "quaternion"  : generate_vec4(quaternion),
             "scale"       : generate_vec3(scale),
+
             "castsShadow"  : castsShadow,
             "meshCollider" : meshCollider
             }
             chunks.append(object_string)
         
-    return ",\n\n".join(chunks)
+    return ",\n\n".join(chunks), len(chunks)
     
 # #####################################################
 # Scene exporter - geometries
@@ -1036,7 +1045,7 @@ def generate_geometries(data):
                 
                 geo_set.add(name)
         
-    return ",\n\n".join(chunks)
+    return ",\n\n".join(chunks), len(chunks)
     
 # #####################################################
 # Scene exporter - textures
@@ -1058,7 +1067,7 @@ def generate_textures_scene(data):
         }
         chunks.append(texture_string)
 
-    return ",\n\n".join(chunks)
+    return ",\n\n".join(chunks), len(chunks)
 
 def extract_texture_filename(image):
     fn = bpy.path.abspath(image.filepath)
@@ -1176,7 +1185,7 @@ def generate_materials_scene(data):
         material_string = generate_material_string(material)
         chunks.append(material_string)
 
-    return ",\n\n".join(chunks)
+    return ",\n\n".join(chunks), len(chunks)
 
 # #####################################################
 # Scene exporter - cameras
@@ -1257,10 +1266,12 @@ def generate_lights(data):
 # #####################################################
 
 def generate_ascii_scene(data):
-    objects = generate_objects(data)
-    geometries = generate_geometries(data)
-    textures = generate_textures_scene(data)
-    materials = generate_materials_scene(data)
+
+    objects, nobjects = generate_objects(data)
+    geometries, ngeometries = generate_geometries(data)
+    textures, ntextures = generate_textures_scene(data)
+    materials, nmaterials = generate_materials_scene(data)
+
     cameras = generate_cameras(data)
     lights = generate_lights(data)
     
@@ -1284,10 +1295,21 @@ def generate_ascii_scene(data):
     
     parameters = {
     "fname"     : data["source_file"],
+
     "sections"  : sections_string,
+
     "bgcolor"   : generate_vec3(DEFAULTS["bgcolor"]),
     "bgalpha"   : DEFAULTS["bgalpha"],
-    "defcamera" : generate_string(default_camera)
+    "defcamera" : generate_string(default_camera),
+
+    "nobjects"      : nobjects,
+    "ngeometries"   : ngeometries,
+    "ntextures"     : ntextures,
+    "nmaterials"    : nmaterials,
+    
+    "position"      : generate_vec3(DEFAULTS["position"]),
+    "rotation"      : generate_vec3(DEFAULTS["rotation"]),
+    "scale"         : generate_vec3(DEFAULTS["scale"])
     }
 
     text = TEMPLATE_SCENE_ASCII % parameters

+ 2 - 0
utils/exporters/convert_obj_three.py

@@ -196,6 +196,7 @@ var model = {
 };
 
 postMessage( model );
+close();
 """
 
 TEMPLATE_FILE_BIN = u"""\
@@ -219,6 +220,7 @@ var model = {
 };
     
 postMessage( model );
+close();
 """
 
 TEMPLATE_VERTEX = "%f,%f,%f"

Daži faili netika attēloti, jo izmaiņu fails ir pārāk liels