Przeglądaj źródła

Fixes for holes first characters

zz85 14 lat temu
rodzic
commit
4983327011

+ 335 - 330
build/Three.js

@@ -1,7 +1,7 @@
 // Three.js r41/ROME - http://github.com/mrdoob/three.js
 var THREE=THREE||{};if(!window.Int32Array)window.Int32Array=Array,window.Float32Array=Array;THREE.Color=function(b){this.setHex(b)};
-THREE.Color.prototype={copy:function(b){this.r=b.r;this.g=b.g;this.b=b.b;this.hex=b.hex},setHex:function(b){this.hex=~~b&16777215;this.updateRGB()},setRGB:function(b,c,e){this.r=b;this.g=c;this.b=e;this.updateHex()},setHSV:function(b,c,e){var f,g,h,k,m,n;if(e==0)f=g=h=0;else switch(k=Math.floor(b*6),m=b*6-k,b=e*(1-c),n=e*(1-c*m),c=e*(1-c*(1-m)),k){case 1:f=n;g=e;h=b;break;case 2:f=b;g=e;h=c;break;case 3:f=b;g=n;h=e;break;case 4:f=c;g=b;h=e;break;case 5:f=e;g=b;h=n;break;case 6:case 0:f=e,g=c,h=b}this.setRGB(f,
-g,h)},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},clone:function(){return new THREE.Color(this.hex)}};THREE.Vector2=function(b,c){this.set(b||0,c||0)};
+THREE.Color.prototype={copy:function(b){this.r=b.r;this.g=b.g;this.b=b.b;this.hex=b.hex},setHex:function(b){this.hex=~~b&16777215;this.updateRGB()},setRGB:function(b,c,e){this.r=b;this.g=c;this.b=e;this.updateHex()},setHSV:function(b,c,e){var f,g,j,k,m,n;if(e==0)f=g=j=0;else switch(k=Math.floor(b*6),m=b*6-k,b=e*(1-c),n=e*(1-c*m),c=e*(1-c*(1-m)),k){case 1:f=n;g=e;j=b;break;case 2:f=b;g=e;j=c;break;case 3:f=b;g=n;j=e;break;case 4:f=c;g=b;j=e;break;case 5:f=e;g=b;j=n;break;case 6:case 0:f=e,g=c,j=b}this.setRGB(f,
+g,j)},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},clone:function(){return new THREE.Color(this.hex)}};THREE.Vector2=function(b,c){this.set(b||0,c||0)};
 THREE.Vector2.prototype={set:function(b,c){this.x=b;this.y=c;return this},copy:function(b){this.x=b.x;this.y=b.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},add:function(b,c){this.x=b.x+c.x;this.y=b.y+c.y;return this},addSelf:function(b){this.x+=b.x;this.y+=b.y;return this},sub:function(b,c){this.x=b.x-c.x;this.y=b.y-c.y;return this},subSelf:function(b){this.x-=b.x;this.y-=b.y;return this},multiplyScalar:function(b){this.x*=b;this.y*=b;return this},divideScalar:function(b){b?
 (this.x/=b,this.y/=b):this.set(0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(b){return this.x*b.x+this.y*b.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.lengthSq())},normalize:function(){return this.divideScalar(this.length())},distanceTo:function(b){return Math.sqrt(this.distanceToSquared(b))},distanceToSquared:function(b){var c=this.x-b.x,b=this.y-b.y;return c*c+b*b},setLength:function(b){return this.normalize().multiplyScalar(b)},
 unit:function(){return this.normalize()},equals:function(b){return b.x==this.x&&b.y==this.y}};THREE.Vector3=function(b,c,e){this.set(b||0,c||0,e||0)};
@@ -14,63 +14,65 @@ THREE.Vector4.prototype={set:function(b,c,e,f){this.x=b;this.y=c;this.z=e;this.w
 b.x;this.y-=b.y;this.z-=b.z;this.w-=b.w;return this},multiplyScalar:function(b){this.x*=b;this.y*=b;this.z*=b;this.w*=b;return this},divideScalar:function(b){b?(this.x/=b,this.y/=b,this.z/=b,this.w/=b):this.set(0,0,0,1);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(b){return this.x*b.x+this.y*b.y+this.z*b.z+this.w*b.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())},normalize:function(){return this.divideScalar(this.length())},
 setLength:function(b){return this.normalize().multiplyScalar(b)},lerpSelf:function(b,c){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;return this}};THREE.Ray=function(b,c){this.origin=b||new THREE.Vector3;this.direction=c||new THREE.Vector3};
 THREE.Ray.prototype={intersectScene:function(b){return this.intersectObjects(b.objects)},intersectObjects:function(b){var c,e,f=[];c=0;for(e=b.length;c<e;c++)f=f.concat(this.intersectObject(b[c]));f.sort(function(b,e){return b.distance-e.distance});return f},intersectObject:function(b){function c(b,e,c){var f;f=c.position.clone().subSelf(b).dot(e);if(f<0)return!1;b=b.clone().addSelf(e.clone().multiplyScalar(f));return c.position.distanceTo(b)}function e(b,e,c,f){var f=f.clone().subSelf(e),c=c.clone().subSelf(e),
-g=b.clone().subSelf(e),b=f.dot(f),e=f.dot(c),f=f.dot(g),h=c.dot(c),c=c.dot(g),g=1/(b*h-e*e),h=(h*f-e*c)*g,b=(b*c-e*f)*g;return h>0&&b>0&&h+b<1}if(b instanceof THREE.Particle){var f=c(this.origin,this.direction,b);if(!f||f>b.scale.x)return[];return[{distance:f,point:b.position,face:null,object:b}]}else if(b instanceof THREE.Mesh){f=c(this.origin,this.direction,b);if(!f||f>b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)))return[];var g,h,k,m,n,o,p,t,v,u,w=b.geometry,
-E=w.vertices,H=[],f=0;for(g=w.faces.length;f<g;f++)if(h=w.faces[f],v=this.origin.clone(),u=this.direction.clone(),o=b.matrixWorld,k=o.multiplyVector3(E[h.a].position.clone()),m=o.multiplyVector3(E[h.b].position.clone()),n=o.multiplyVector3(E[h.c].position.clone()),o=h instanceof THREE.Face4?o.multiplyVector3(E[h.d].position.clone()):null,p=b.matrixRotationWorld.multiplyVector3(h.normal.clone()),t=u.dot(p),b.doubleSided||(b.flipSided?t>0:t<0))if(p=p.dot((new THREE.Vector3).sub(k,v))/t,v=v.addSelf(u.multiplyScalar(p)),
-h instanceof THREE.Face3)e(v,k,m,n)&&(h={distance:this.origin.distanceTo(v),point:v,face:h,object:b},H.push(h));else if(h instanceof THREE.Face4&&(e(v,k,m,o)||e(v,m,n,o)))h={distance:this.origin.distanceTo(v),point:v,face:h,object:b},H.push(h);return H}else return[]}};
-THREE.Rectangle=function(){function b(){h=f-c;k=g-e}var c,e,f,g,h,k,m=!0;this.getX=function(){return c};this.getY=function(){return e};this.getWidth=function(){return h};this.getHeight=function(){return k};this.getLeft=function(){return c};this.getTop=function(){return e};this.getRight=function(){return f};this.getBottom=function(){return g};this.set=function(h,k,p,t){m=!1;c=h;e=k;f=p;g=t;b()};this.addPoint=function(h,k){m?(m=!1,c=h,e=k,f=h,g=k):(c=c<h?c:h,e=e<k?e:k,f=f>h?f:h,g=g>k?g:k);b()};this.add3Points=
-function(h,k,p,t,v,u){m?(m=!1,c=h<p?h<v?h:v:p<v?p:v,e=k<t?k<u?k:u:t<u?t:u,f=h>p?h>v?h:v:p>v?p:v,g=k>t?k>u?k:u:t>u?t:u):(c=h<p?h<v?h<c?h:c:v<c?v:c:p<v?p<c?p:c:v<c?v:c,e=k<t?k<u?k<e?k:e:u<e?u:e:t<u?t<e?t:e:u<e?u:e,f=h>p?h>v?h>f?h:f:v>f?v:f:p>v?p>f?p:f:v>f?v:f,g=k>t?k>u?k>g?k:g:u>g?u:g:t>u?t>g?t:g:u>g?u:g);b()};this.addRectangle=function(h){m?(m=!1,c=h.getLeft(),e=h.getTop(),f=h.getRight(),g=h.getBottom()):(c=c<h.getLeft()?c:h.getLeft(),e=e<h.getTop()?e:h.getTop(),f=f>h.getRight()?f:h.getRight(),g=g>
-h.getBottom()?g:h.getBottom());b()};this.inflate=function(h){c-=h;e-=h;f+=h;g+=h;b()};this.minSelf=function(h){c=c>h.getLeft()?c:h.getLeft();e=e>h.getTop()?e:h.getTop();f=f<h.getRight()?f:h.getRight();g=g<h.getBottom()?g:h.getBottom();b()};this.instersects=function(b){return Math.min(f,b.getRight())-Math.max(c,b.getLeft())>=0&&Math.min(g,b.getBottom())-Math.max(e,b.getTop())>=0};this.empty=function(){m=!0;g=f=e=c=0;b()};this.isEmpty=function(){return m}};THREE.Matrix3=function(){this.m=[]};
-THREE.Matrix3.prototype={transpose:function(){var b,c=this.m;b=c[1];c[1]=c[3];c[3]=b;b=c[2];c[2]=c[6];c[6]=b;b=c[5];c[5]=c[7];c[7]=b;return this},transposeIntoArray:function(b){var c=this.m;b[0]=c[0];b[1]=c[3];b[2]=c[6];b[3]=c[1];b[4]=c[4];b[5]=c[7];b[6]=c[2];b[7]=c[5];b[8]=c[8];return this}};THREE.Matrix4=function(b,c,e,f,g,h,k,m,n,o,p,t,v,u,w,E){this.set(b||1,c||0,e||0,f||0,g||0,h||1,k||0,m||0,n||0,o||0,p||1,t||0,v||0,u||0,w||0,E||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={set:function(b,c,e,f,g,h,k,m,n,o,p,t,v,u,w,E){this.n11=b;this.n12=c;this.n13=e;this.n14=f;this.n21=g;this.n22=h;this.n23=k;this.n24=m;this.n31=n;this.n32=o;this.n33=p;this.n34=t;this.n41=v;this.n42=u;this.n43=w;this.n44=E;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,e){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(e,h).normalize();f.length()===0&&(h.x+=1.0E-4,f.cross(e,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,e=b.y,f=b.z,g=1/(this.n41*c+this.n42*e+this.n43*f+this.n44);b.x=(this.n11*c+this.n12*e+this.n13*f+this.n14)*g;b.y=(this.n21*c+this.n22*e+this.n23*
+g=b.clone().subSelf(e),b=f.dot(f),e=f.dot(c),f=f.dot(g),j=c.dot(c),c=c.dot(g),g=1/(b*j-e*e),j=(j*f-e*c)*g,b=(b*c-e*f)*g;return j>0&&b>0&&j+b<1}if(b instanceof THREE.Particle){var f=c(this.origin,this.direction,b);if(!f||f>b.scale.x)return[];return[{distance:f,point:b.position,face:null,object:b}]}else if(b instanceof THREE.Mesh){f=c(this.origin,this.direction,b);if(!f||f>b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)))return[];var g,j,k,m,n,o,p,t,u,v,w=b.geometry,
+E=w.vertices,I=[],f=0;for(g=w.faces.length;f<g;f++)if(j=w.faces[f],u=this.origin.clone(),v=this.direction.clone(),o=b.matrixWorld,k=o.multiplyVector3(E[j.a].position.clone()),m=o.multiplyVector3(E[j.b].position.clone()),n=o.multiplyVector3(E[j.c].position.clone()),o=j instanceof THREE.Face4?o.multiplyVector3(E[j.d].position.clone()):null,p=b.matrixRotationWorld.multiplyVector3(j.normal.clone()),t=v.dot(p),b.doubleSided||(b.flipSided?t>0:t<0))if(p=p.dot((new THREE.Vector3).sub(k,u))/t,u=u.addSelf(v.multiplyScalar(p)),
+j instanceof THREE.Face3)e(u,k,m,n)&&(j={distance:this.origin.distanceTo(u),point:u,face:j,object:b},I.push(j));else if(j instanceof THREE.Face4&&(e(u,k,m,o)||e(u,m,n,o)))j={distance:this.origin.distanceTo(u),point:u,face:j,object:b},I.push(j);return I}else return[]}};
+THREE.Rectangle=function(){function b(){j=f-c;k=g-e}var c,e,f,g,j,k,m=!0;this.getX=function(){return c};this.getY=function(){return e};this.getWidth=function(){return j};this.getHeight=function(){return k};this.getLeft=function(){return c};this.getTop=function(){return e};this.getRight=function(){return f};this.getBottom=function(){return g};this.set=function(j,k,p,t){m=!1;c=j;e=k;f=p;g=t;b()};this.addPoint=function(j,k){m?(m=!1,c=j,e=k,f=j,g=k):(c=c<j?c:j,e=e<k?e:k,f=f>j?f:j,g=g>k?g:k);b()};this.add3Points=
+function(j,k,p,t,u,v){m?(m=!1,c=j<p?j<u?j:u:p<u?p:u,e=k<t?k<v?k:v:t<v?t:v,f=j>p?j>u?j:u:p>u?p:u,g=k>t?k>v?k:v:t>v?t:v):(c=j<p?j<u?j<c?j:c:u<c?u:c:p<u?p<c?p:c:u<c?u:c,e=k<t?k<v?k<e?k:e:v<e?v:e:t<v?t<e?t:e:v<e?v:e,f=j>p?j>u?j>f?j:f:u>f?u:f:p>u?p>f?p:f:u>f?u:f,g=k>t?k>v?k>g?k:g:v>g?v:g:t>v?t>g?t:g:v>g?v:g);b()};this.addRectangle=function(j){m?(m=!1,c=j.getLeft(),e=j.getTop(),f=j.getRight(),g=j.getBottom()):(c=c<j.getLeft()?c:j.getLeft(),e=e<j.getTop()?e:j.getTop(),f=f>j.getRight()?f:j.getRight(),g=g>
+j.getBottom()?g:j.getBottom());b()};this.inflate=function(j){c-=j;e-=j;f+=j;g+=j;b()};this.minSelf=function(j){c=c>j.getLeft()?c:j.getLeft();e=e>j.getTop()?e:j.getTop();f=f<j.getRight()?f:j.getRight();g=g<j.getBottom()?g:j.getBottom();b()};this.instersects=function(b){return Math.min(f,b.getRight())-Math.max(c,b.getLeft())>=0&&Math.min(g,b.getBottom())-Math.max(e,b.getTop())>=0};this.empty=function(){m=!0;g=f=e=c=0;b()};this.isEmpty=function(){return m}};THREE.Matrix3=function(){this.m=[]};
+THREE.Matrix3.prototype={transpose:function(){var b,c=this.m;b=c[1];c[1]=c[3];c[3]=b;b=c[2];c[2]=c[6];c[6]=b;b=c[5];c[5]=c[7];c[7]=b;return this},transposeIntoArray:function(b){var c=this.m;b[0]=c[0];b[1]=c[3];b[2]=c[6];b[3]=c[1];b[4]=c[4];b[5]=c[7];b[6]=c[2];b[7]=c[5];b[8]=c[8];return this}};THREE.Matrix4=function(b,c,e,f,g,j,k,m,n,o,p,t,u,v,w,E){this.set(b||1,c||0,e||0,f||0,g||0,j||1,k||0,m||0,n||0,o||0,p||1,t||0,u||0,v||0,w||0,E||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={set:function(b,c,e,f,g,j,k,m,n,o,p,t,u,v,w,E){this.n11=b;this.n12=c;this.n13=e;this.n14=f;this.n21=g;this.n22=j;this.n23=k;this.n24=m;this.n31=n;this.n32=o;this.n33=p;this.n34=t;this.n41=u;this.n42=v;this.n43=w;this.n44=E;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,e){var f=THREE.Matrix4.__v1,
+g=THREE.Matrix4.__v2,j=THREE.Matrix4.__v3;j.sub(b,c).normalize();if(j.length()===0)j.z=1;f.cross(e,j).normalize();f.length()===0&&(j.x+=1.0E-4,f.cross(e,j).normalize());g.cross(j,f).normalize();this.n11=f.x;this.n12=g.x;this.n13=j.x;this.n21=f.y;this.n22=g.y;this.n23=j.y;this.n31=f.z;this.n32=g.z;this.n33=j.z;return this},multiplyVector3:function(b){var c=b.x,e=b.y,f=b.z,g=1/(this.n41*c+this.n42*e+this.n43*f+this.n44);b.x=(this.n11*c+this.n12*e+this.n13*f+this.n14)*g;b.y=(this.n21*c+this.n22*e+this.n23*
 f+this.n24)*g;b.z=(this.n31*c+this.n32*e+this.n33*f+this.n34)*g;return b},multiplyVector4:function(b){var c=b.x,e=b.y,f=b.z,g=b.w;b.x=this.n11*c+this.n12*e+this.n13*f+this.n14*g;b.y=this.n21*c+this.n22*e+this.n23*f+this.n24*g;b.z=this.n31*c+this.n32*e+this.n33*f+this.n34*g;b.w=this.n41*c+this.n42*e+this.n43*f+this.n44*g;return b},rotateAxis:function(b){var c=b.x,e=b.y,f=b.z;b.x=c*this.n11+e*this.n12+f*this.n13;b.y=c*this.n21+e*this.n22+f*this.n23;b.z=c*this.n31+e*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 e=b.n11,f=b.n12,g=b.n13,h=b.n14,k=b.n21,m=b.n22,n=b.n23,o=b.n24,p=b.n31,t=b.n32,v=b.n33,u=b.n34,w=b.n41,E=b.n42,H=b.n43,B=b.n44,K=c.n11,A=c.n12,I=c.n13,G=c.n14,C=c.n21,R=c.n22,
-D=c.n23,N=c.n24,J=c.n31,V=c.n32,j=c.n33,X=c.n34;this.n11=e*K+f*C+g*J;this.n12=e*A+f*R+g*V;this.n13=e*I+f*D+g*j;this.n14=e*G+f*N+g*X+h;this.n21=k*K+m*C+n*J;this.n22=k*A+m*R+n*V;this.n23=k*I+m*D+n*j;this.n24=k*G+m*N+n*X+o;this.n31=p*K+t*C+v*J;this.n32=p*A+t*R+v*V;this.n33=p*I+t*D+v*j;this.n34=p*G+t*N+v*X+u;this.n41=w*K+E*C+H*J;this.n42=w*A+E*R+H*V;this.n43=w*I+E*D+H*j;this.n44=w*G+E*N+H*X+B;return this},multiplyToArray:function(b,c,e){this.multiply(b,c);e[0]=this.n11;e[1]=this.n21;e[2]=this.n31;e[3]=
+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 e=b.n11,f=b.n12,g=b.n13,j=b.n14,k=b.n21,m=b.n22,n=b.n23,o=b.n24,p=b.n31,t=b.n32,u=b.n33,v=b.n34,w=b.n41,E=b.n42,I=b.n43,B=b.n44,H=c.n11,A=c.n12,K=c.n13,G=c.n14,C=c.n21,R=c.n22,
+D=c.n23,N=c.n24,J=c.n31,V=c.n32,h=c.n33,X=c.n34;this.n11=e*H+f*C+g*J;this.n12=e*A+f*R+g*V;this.n13=e*K+f*D+g*h;this.n14=e*G+f*N+g*X+j;this.n21=k*H+m*C+n*J;this.n22=k*A+m*R+n*V;this.n23=k*K+m*D+n*h;this.n24=k*G+m*N+n*X+o;this.n31=p*H+t*C+u*J;this.n32=p*A+t*R+u*V;this.n33=p*K+t*D+u*h;this.n34=p*G+t*N+u*X+v;this.n41=w*H+E*C+I*J;this.n42=w*A+E*R+I*V;this.n43=w*K+E*D+I*h;this.n44=w*G+E*N+I*X+B;return this},multiplyToArray:function(b,c,e){this.multiply(b,c);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,c=this.n12,e=this.n13,f=this.n14,g=this.n21,h=this.n22,k=this.n23,m=this.n24,n=this.n31,o=this.n32,p=this.n33,t=this.n34,v=this.n41,u=this.n42,w=this.n43,E=this.n44;return f*k*o*v-e*m*o*v-f*h*p*v+c*m*p*v+e*h*t*v-c*k*t*v-f*k*n*u+e*m*n*u+f*g*p*u-b*m*p*u-e*g*t*u+b*k*t*u+f*h*n*w-c*m*n*w-f*g*o*w+b*m*o*w+c*g*t*w-b*h*t*w-e*h*n*E+c*k*n*E+e*g*o*E-b*k*o*E-c*g*p*E+b*h*p*E},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.n11,c=this.n12,e=this.n13,f=this.n14,g=this.n21,j=this.n22,k=this.n23,m=this.n24,n=this.n31,o=this.n32,p=this.n33,t=this.n34,u=this.n41,v=this.n42,w=this.n43,E=this.n44;return f*k*o*u-e*m*o*u-f*j*p*u+c*m*p*u+e*j*t*u-c*k*t*u-f*k*n*v+e*m*n*v+f*g*p*v-b*m*p*v-e*g*t*v+b*k*t*v+f*j*n*w-c*m*n*w-f*g*o*w+b*m*o*w+c*g*t*w-b*j*t*w-e*j*n*E+c*k*n*E+e*g*o*E-b*k*o*E-c*g*p*E+b*j*p*E},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]=this.n11;this.flat[1]=this.n21;
 this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(b){b[0]=this.n11;b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;b[8]=this.n13;b[9]=this.n23;b[10]=
 this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return b},flattenToArrayOffset:function(b,c){b[c]=this.n11;b[c+1]=this.n21;b[c+2]=this.n31;b[c+3]=this.n41;b[c+4]=this.n12;b[c+5]=this.n22;b[c+6]=this.n32;b[c+7]=this.n42;b[c+8]=this.n13;b[c+9]=this.n23;b[c+10]=this.n33;b[c+11]=this.n43;b[c+12]=this.n14;b[c+13]=this.n24;b[c+14]=this.n34;b[c+15]=this.n44;return b},setTranslation:function(b,c,e){this.set(1,0,0,b,0,1,0,c,0,0,1,e,0,0,0,1);return this},setScale:function(b,
-c,e){this.set(b,0,0,0,0,c,0,0,0,0,e,0,0,0,0,1);return this},setRotationX:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(1,0,0,0,0,c,-b,0,0,b,c,0,0,0,0,1);return this},setRotationY:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(c,0,b,0,0,1,0,0,-b,0,c,0,0,0,0,1);return this},setRotationZ:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(c,-b,0,0,b,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,c){var e=Math.cos(c),f=Math.sin(c),g=1-e,h=b.x,k=b.y,m=b.z,n=g*h,o=g*k;this.set(n*
-h+e,n*k-f*m,n*m+f*k,0,n*k+f*m,o*k+e,o*m-f*h,0,n*m-f*k,o*m+f*h,g*m*m+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},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX=new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3;
-this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(b){var c=b.x,e=b.y,f=b.z,b=Math.cos(c),c=Math.sin(c),g=Math.cos(e),e=Math.sin(e),h=Math.cos(f),f=Math.sin(f),k=b*e,m=c*e;this.n11=g*h;this.n12=-g*f;this.n13=e;this.n21=m*h+b*f;this.n22=-m*f+b*h;this.n23=-c*g;this.n31=-k*h+c*f;this.n32=k*f+c*h;this.n33=b*g;return this},
-setRotationFromQuaternion:function(b){var c=b.x,e=b.y,f=b.z,g=b.w,h=c+c,k=e+e,m=f+f,b=c*h,n=c*k;c*=m;var o=e*k;e*=m;f*=m;h*=g;k*=g;g*=m;this.n11=1-(o+f);this.n12=n-g;this.n13=c+k;this.n21=n+g;this.n22=1-(b+f);this.n23=e-h;this.n31=c-k;this.n32=e+h;this.n33=1-(b+o);return this},scale:function(b){var c=b.x,e=b.y,b=b.z;this.n11*=c;this.n12*=e;this.n13*=b;this.n21*=c;this.n22*=e;this.n23*=b;this.n31*=c;this.n32*=e;this.n33*=b;this.n41*=c;this.n42*=e;this.n43*=b;return this},extractPosition:function(b){this.n14=
+c,e){this.set(b,0,0,0,0,c,0,0,0,0,e,0,0,0,0,1);return this},setRotationX:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(1,0,0,0,0,c,-b,0,0,b,c,0,0,0,0,1);return this},setRotationY:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(c,0,b,0,0,1,0,0,-b,0,c,0,0,0,0,1);return this},setRotationZ:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(c,-b,0,0,b,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,c){var e=Math.cos(c),f=Math.sin(c),g=1-e,j=b.x,k=b.y,m=b.z,n=g*j,o=g*k;this.set(n*
+j+e,n*k-f*m,n*m+f*k,0,n*k+f*m,o*k+e,o*m-f*j,0,n*m-f*k,o*m+f*j,g*m*m+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},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX=new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3;
+this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(b){var c=b.x,e=b.y,f=b.z,b=Math.cos(c),c=Math.sin(c),g=Math.cos(e),e=Math.sin(e),j=Math.cos(f),f=Math.sin(f),k=b*e,m=c*e;this.n11=g*j;this.n12=-g*f;this.n13=e;this.n21=m*j+b*f;this.n22=-m*f+b*j;this.n23=-c*g;this.n31=-k*j+c*f;this.n32=k*f+c*j;this.n33=b*g;return this},
+setRotationFromQuaternion:function(b){var c=b.x,e=b.y,f=b.z,g=b.w,j=c+c,k=e+e,m=f+f,b=c*j,n=c*k;c*=m;var o=e*k;e*=m;f*=m;j*=g;k*=g;g*=m;this.n11=1-(o+f);this.n12=n-g;this.n13=c+k;this.n21=n+g;this.n22=1-(b+f);this.n23=e-j;this.n31=c-k;this.n32=e+j;this.n33=1-(b+o);return this},scale:function(b){var c=b.x,e=b.y,b=b.z;this.n11*=c;this.n12*=e;this.n13*=b;this.n21*=c;this.n22*=e;this.n23*=b;this.n31*=c;this.n32*=e;this.n33*=b;this.n41*=c;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,c){var e=1/c.x,f=1/c.y,g=1/c.z;this.n11=b.n11*e;this.n21=b.n21*e;this.n31=b.n31*e;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 e=b.n11,f=b.n12,g=b.n13,h=b.n14,k=b.n21,m=b.n22,n=b.n23,o=b.n24,p=b.n31,t=b.n32,v=b.n33,u=b.n34,w=b.n41,E=b.n42,H=b.n43,B=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=n*u*E-o*v*E+o*t*H-m*u*H-n*t*B+m*v*B;c.n12=h*v*E-g*u*E-h*t*H+f*u*H+g*t*B-f*v*B;c.n13=g*o*E-h*n*E+h*m*H-f*o*H-g*m*B+f*n*B;c.n14=h*n*t-g*o*t-h*m*v+f*o*v+g*m*u-f*n*u;c.n21=o*v*w-n*u*w-o*p*H+k*u*H+n*p*B-k*v*B;c.n22=g*u*w-h*v*w+h*p*H-e*u*H-g*p*B+e*v*B;c.n23=h*n*w-g*o*w-h*k*H+e*o*H+g*k*B-e*n*B;c.n24=
-g*o*p-h*n*p+h*k*v-e*o*v-g*k*u+e*n*u;c.n31=m*u*w-o*t*w+o*p*E-k*u*E-m*p*B+k*t*B;c.n32=h*t*w-f*u*w-h*p*E+e*u*E+f*p*B-e*t*B;c.n33=g*o*w-h*m*w+h*k*E-e*o*E-f*k*B+e*m*B;c.n34=h*m*p-f*o*p-h*k*t+e*o*t+f*k*u-e*m*u;c.n41=n*t*w-m*v*w-n*p*E+k*v*E+m*p*H-k*t*H;c.n42=f*v*w-g*t*w+g*p*E-e*v*E-f*p*H+e*t*H;c.n43=g*m*w-f*n*w-g*k*E+e*n*E+f*k*H-e*m*H;c.n44=f*n*p-g*m*p+g*k*t-e*n*t-f*k*v+e*m*v;c.multiplyScalar(1/b.determinant());return c};
-THREE.Matrix4.makeInvert3x3=function(b){var c=b.m33,e=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,k=-b.n33*b.n12+b.n32*b.n13,m=b.n33*b.n11-b.n31*b.n13,n=-b.n32*b.n11+b.n31*b.n12,o=b.n23*b.n12-b.n22*b.n13,p=-b.n23*b.n11+b.n21*b.n13,t=b.n22*b.n11-b.n21*b.n12,b=b.n11*f+b.n21*k+b.n31*o;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;e[0]=b*f;e[1]=b*g;e[2]=b*h;e[3]=b*k;e[4]=b*m;e[5]=b*n;e[6]=b*o;e[7]=b*p;e[8]=b*t;return c};
-THREE.Matrix4.makeFrustum=function(b,c,e,f,g,h){var k;k=new THREE.Matrix4;k.n11=2*g/(c-b);k.n12=0;k.n13=(c+b)/(c-b);k.n14=0;k.n21=0;k.n22=2*g/(f-e);k.n23=(f+e)/(f-e);k.n24=0;k.n31=0;k.n32=0;k.n33=-(h+g)/(h-g);k.n34=-2*h*g/(h-g);k.n41=0;k.n42=0;k.n43=-1;k.n44=0;return k};THREE.Matrix4.makePerspective=function(b,c,e,f){var g,b=e*Math.tan(b*Math.PI/360);g=-b;return THREE.Matrix4.makeFrustum(g*c,b*c,g,b,e,f)};
-THREE.Matrix4.makeOrtho=function(b,c,e,f,g,h){var k,m,n,o;k=new THREE.Matrix4;m=c-b;n=e-f;o=h-g;k.n11=2/m;k.n12=0;k.n13=0;k.n14=-((c+b)/m);k.n21=0;k.n22=2/n;k.n23=0;k.n24=-((e+f)/n);k.n31=0;k.n32=0;k.n33=-2/o;k.n34=-((h+g)/o);k.n41=0;k.n42=0;k.n43=0;k.n44=1;return k};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
-THREE.Object3D=function(){this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.dynamic=!1;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;
-this.visible=!0;this._vector=new THREE.Vector3;this.name=""};
+THREE.Matrix4.makeInvert=function(b,c){var e=b.n11,f=b.n12,g=b.n13,j=b.n14,k=b.n21,m=b.n22,n=b.n23,o=b.n24,p=b.n31,t=b.n32,u=b.n33,v=b.n34,w=b.n41,E=b.n42,I=b.n43,B=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=n*v*E-o*u*E+o*t*I-m*v*I-n*t*B+m*u*B;c.n12=j*u*E-g*v*E-j*t*I+f*v*I+g*t*B-f*u*B;c.n13=g*o*E-j*n*E+j*m*I-f*o*I-g*m*B+f*n*B;c.n14=j*n*t-g*o*t-j*m*u+f*o*u+g*m*v-f*n*v;c.n21=o*u*w-n*v*w-o*p*I+k*v*I+n*p*B-k*u*B;c.n22=g*v*w-j*u*w+j*p*I-e*v*I-g*p*B+e*u*B;c.n23=j*n*w-g*o*w-j*k*I+e*o*I+g*k*B-e*n*B;c.n24=
+g*o*p-j*n*p+j*k*u-e*o*u-g*k*v+e*n*v;c.n31=m*v*w-o*t*w+o*p*E-k*v*E-m*p*B+k*t*B;c.n32=j*t*w-f*v*w-j*p*E+e*v*E+f*p*B-e*t*B;c.n33=g*o*w-j*m*w+j*k*E-e*o*E-f*k*B+e*m*B;c.n34=j*m*p-f*o*p-j*k*t+e*o*t+f*k*v-e*m*v;c.n41=n*t*w-m*u*w-n*p*E+k*u*E+m*p*I-k*t*I;c.n42=f*u*w-g*t*w+g*p*E-e*u*E-f*p*I+e*t*I;c.n43=g*m*w-f*n*w-g*k*E+e*n*E+f*k*I-e*m*I;c.n44=f*n*p-g*m*p+g*k*t-e*n*t-f*k*u+e*m*u;c.multiplyScalar(1/b.determinant());return c};
+THREE.Matrix4.makeInvert3x3=function(b){var c=b.m33,e=c.m,f=b.n33*b.n22-b.n32*b.n23,g=-b.n33*b.n21+b.n31*b.n23,j=b.n32*b.n21-b.n31*b.n22,k=-b.n33*b.n12+b.n32*b.n13,m=b.n33*b.n11-b.n31*b.n13,n=-b.n32*b.n11+b.n31*b.n12,o=b.n23*b.n12-b.n22*b.n13,p=-b.n23*b.n11+b.n21*b.n13,t=b.n22*b.n11-b.n21*b.n12,b=b.n11*f+b.n21*k+b.n31*o;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;e[0]=b*f;e[1]=b*g;e[2]=b*j;e[3]=b*k;e[4]=b*m;e[5]=b*n;e[6]=b*o;e[7]=b*p;e[8]=b*t;return c};
+THREE.Matrix4.makeFrustum=function(b,c,e,f,g,j){var k;k=new THREE.Matrix4;k.n11=2*g/(c-b);k.n12=0;k.n13=(c+b)/(c-b);k.n14=0;k.n21=0;k.n22=2*g/(f-e);k.n23=(f+e)/(f-e);k.n24=0;k.n31=0;k.n32=0;k.n33=-(j+g)/(j-g);k.n34=-2*j*g/(j-g);k.n41=0;k.n42=0;k.n43=-1;k.n44=0;return k};THREE.Matrix4.makePerspective=function(b,c,e,f){var g,b=e*Math.tan(b*Math.PI/360);g=-b;return THREE.Matrix4.makeFrustum(g*c,b*c,g,b,e,f)};
+THREE.Matrix4.makeOrtho=function(b,c,e,f,g,j){var k,m,n,o;k=new THREE.Matrix4;m=c-b;n=e-f;o=j-g;k.n11=2/m;k.n12=0;k.n13=0;k.n14=-((c+b)/m);k.n21=0;k.n22=2/n;k.n23=0;k.n24=-((e+f)/n);k.n31=0;k.n32=0;k.n33=-2/o;k.n34=-((j+g)/o);k.n41=0;k.n42=0;k.n43=0;k.n44=1;return k};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
+THREE.Object3D=function(){this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=
+0;this.boundRadiusScale=1;this.visible=!0;this._vector=new THREE.Vector3;this.name=""};
 THREE.Object3D.prototype={translate:function(b,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(b))},translateX:function(b){this.translate(b,this._vector.set(1,0,0))},translateY:function(b){this.translate(b,this._vector.set(0,1,0))},translateZ:function(b){this.translate(b,this._vector.set(0,0,1))},lookAt:function(b){this.matrix.lookAt(b,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(b){if(this.children.indexOf(b)===
 -1){b.parent!==void 0&&b.parent.removeChild(b);b.parent=this;this.children.push(b);for(var c=this;c.parent!==void 0;)c=c.parent;c!==void 0&&c instanceof THREE.Scene&&c.addChildRecurse(b)}},removeChild:function(b){var c=this.children.indexOf(b);if(c!==-1)b.parent=void 0,this.children.splice(c,1)},getChildByName:function(b,c){var e,f,g;e=0;for(f=this.children.length;e<f;e++){g=this.children[e];if(g.name===b)return g;if(c&&(g=g.getChildByName(b,c),g!==void 0))return g}},updateMatrix:function(){this.matrix.setPosition(this.position);
 this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},update:function(b,c,e){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||c)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixRotationWorld.extractRotation(this.matrixWorld,
 this.scale),this.matrixWorldNeedsUpdate=!1,c=!0;for(var b=0,f=this.children.length;b<f;b++)this.children[b].update(this.matrixWorld,c,e)}};THREE.Quaternion=function(b,c,e,f){this.set(b||0,c||0,e||0,f!==void 0?f:1)};
-THREE.Quaternion.prototype={set:function(b,c,e,f){this.x=b;this.y=c;this.z=e;this.w=f;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;this.w=b.w;return this},setFromEuler:function(b){var c=0.5*Math.PI/360,e=b.x*c,f=b.y*c,g=b.z*c,b=Math.cos(f),f=Math.sin(f),c=Math.cos(-g),g=Math.sin(-g),h=Math.cos(e),e=Math.sin(e),k=b*c,m=f*g;this.w=k*h-m*e;this.x=k*e+m*h;this.y=f*c*h+b*g*e;this.z=b*g*h-f*c*e;return this},setFromAxisAngle:function(b,c){var e=c/2,f=Math.sin(e);this.x=b.x*f;this.y=b.y*
+THREE.Quaternion.prototype={set:function(b,c,e,f){this.x=b;this.y=c;this.z=e;this.w=f;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;this.w=b.w;return this},setFromEuler:function(b){var c=0.5*Math.PI/360,e=b.x*c,f=b.y*c,g=b.z*c,b=Math.cos(f),f=Math.sin(f),c=Math.cos(-g),g=Math.sin(-g),j=Math.cos(e),e=Math.sin(e),k=b*c,m=f*g;this.w=k*j-m*e;this.x=k*e+m*j;this.y=f*c*j+b*g*e;this.z=b*g*j-f*c*e;return this},setFromAxisAngle:function(b,c){var e=c/2,f=Math.sin(e);this.x=b.x*f;this.y=b.y*
 f;this.z=b.z*f;this.w=Math.cos(e);return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var b=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);b==0?this.w=this.z=this.y=this.x=0:(b=1/b,this.x*=b,this.y*=b,this.z*=b,this.w*=b);return this},
-multiplySelf:function(b){var c=this.x,e=this.y,f=this.z,g=this.w,h=b.x,k=b.y,m=b.z,b=b.w;this.x=c*b+g*h+e*m-f*k;this.y=e*b+g*k+f*h-c*m;this.z=f*b+g*m+c*k-e*h;this.w=g*b-c*h-e*k-f*m;return this},multiply:function(b,c){this.x=b.x*c.w+b.y*c.z-b.z*c.y+b.w*c.x;this.y=-b.x*c.z+b.y*c.w+b.z*c.x+b.w*c.y;this.z=b.x*c.y-b.y*c.x+b.z*c.w+b.w*c.z;this.w=-b.x*c.x-b.y*c.y-b.z*c.z+b.w*c.w;return this},multiplyVector3:function(b,c){c||(c=b);var e=b.x,f=b.y,g=b.z,h=this.x,k=this.y,m=this.z,n=this.w,o=n*e+k*g-m*f,p=
-n*f+m*e-h*g,t=n*g+h*f-k*e,e=-h*e-k*f-m*g;c.x=o*n+e*-h+p*-m-t*-k;c.y=p*n+e*-k+t*-h-o*-m;c.z=t*n+e*-m+o*-k-p*-h;return c}};
-THREE.Quaternion.slerp=function(b,c,e,f){var g=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(g)>=1)return e.w=b.w,e.x=b.x,e.y=b.y,e.z=b.z,e;var h=Math.acos(g),k=Math.sqrt(1-g*g);if(Math.abs(k)<0.0010)return e.w=0.5*(b.w+c.w),e.x=0.5*(b.x+c.x),e.y=0.5*(b.y+c.y),e.z=0.5*(b.z+c.z),e;g=Math.sin((1-f)*h)/k;f=Math.sin(f*h)/k;e.w=b.w*g+c.w*f;e.x=b.x*g+c.x*f;e.y=b.y*g+c.y*f;e.z=b.z*g+c.z*f;return e};THREE.Vertex=function(b){this.position=b||new THREE.Vector3};
-THREE.Face3=function(b,c,e,f,g,h){this.a=b;this.b=c;this.c=e;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};
-THREE.Face4=function(b,c,e,f,g,h,k){this.a=b;this.b=c;this.c=e;this.d=f;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=k instanceof Array?k:[k];this.centroid=new THREE.Vector3};THREE.UV=function(b,c){this.set(b||0,c||0)};
+multiplySelf:function(b){var c=this.x,e=this.y,f=this.z,g=this.w,j=b.x,k=b.y,m=b.z,b=b.w;this.x=c*b+g*j+e*m-f*k;this.y=e*b+g*k+f*j-c*m;this.z=f*b+g*m+c*k-e*j;this.w=g*b-c*j-e*k-f*m;return this},multiply:function(b,c){this.x=b.x*c.w+b.y*c.z-b.z*c.y+b.w*c.x;this.y=-b.x*c.z+b.y*c.w+b.z*c.x+b.w*c.y;this.z=b.x*c.y-b.y*c.x+b.z*c.w+b.w*c.z;this.w=-b.x*c.x-b.y*c.y-b.z*c.z+b.w*c.w;return this},multiplyVector3:function(b,c){c||(c=b);var e=b.x,f=b.y,g=b.z,j=this.x,k=this.y,m=this.z,n=this.w,o=n*e+k*g-m*f,p=
+n*f+m*e-j*g,t=n*g+j*f-k*e,e=-j*e-k*f-m*g;c.x=o*n+e*-j+p*-m-t*-k;c.y=p*n+e*-k+t*-j-o*-m;c.z=t*n+e*-m+o*-k-p*-j;return c}};
+THREE.Quaternion.slerp=function(b,c,e,f){var g=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(g)>=1)return e.w=b.w,e.x=b.x,e.y=b.y,e.z=b.z,e;var j=Math.acos(g),k=Math.sqrt(1-g*g);if(Math.abs(k)<0.0010)return e.w=0.5*(b.w+c.w),e.x=0.5*(b.x+c.x),e.y=0.5*(b.y+c.y),e.z=0.5*(b.z+c.z),e;g=Math.sin((1-f)*j)/k;f=Math.sin(f*j)/k;e.w=b.w*g+c.w*f;e.x=b.x*g+c.x*f;e.y=b.y*g+c.y*f;e.z=b.z*g+c.z*f;return e};THREE.Vertex=function(b){this.position=b||new THREE.Vector3};
+THREE.Face3=function(b,c,e,f,g,j){this.a=b;this.b=c;this.c=e;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=j instanceof Array?j:[j];this.centroid=new THREE.Vector3};
+THREE.Face4=function(b,c,e,f,g,j,k){this.a=b;this.b=c;this.c=e;this.d=f;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.color=j instanceof THREE.Color?j:new THREE.Color;this.vertexColors=j instanceof Array?j:[];this.vertexTangents=[];this.materials=k instanceof Array?k:[k];this.centroid=new THREE.Vector3};THREE.UV=function(b,c){this.set(b||0,c||0)};
 THREE.UV.prototype={set:function(b,c){this.u=b;this.v=c;return this},copy:function(b){this.set(b.u,b.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
 THREE.Geometry.prototype={computeCentroids:function(){var b,c,e;b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],e.centroid.set(0,0,0),e instanceof THREE.Face3?(e.centroid.addSelf(this.vertices[e.a].position),e.centroid.addSelf(this.vertices[e.b].position),e.centroid.addSelf(this.vertices[e.c].position),e.centroid.divideScalar(3)):e instanceof THREE.Face4&&(e.centroid.addSelf(this.vertices[e.a].position),e.centroid.addSelf(this.vertices[e.b].position),e.centroid.addSelf(this.vertices[e.c].position),
-e.centroid.addSelf(this.vertices[e.d].position),e.centroid.divideScalar(4))},computeFaceNormals:function(b){var c,e,f,g,h,k,m=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){m.set(0,0,0);c=0;for(e=h.vertexNormals.length;c<e;c++)m.addSelf(h.vertexNormals[c]);m.divideScalar(3)}else c=this.vertices[h.a],e=this.vertices[h.b],k=this.vertices[h.c],m.sub(k.position,e.position),n.sub(c.position,e.position),m.crossSelf(n);m.isZero()||
-m.normalize();h.normal.copy(m)}},computeVertexNormals:function(){var b,c,e,f;if(this.__tmpVertices==void 0){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++)if(e=this.faces[b],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{f=
+e.centroid.addSelf(this.vertices[e.d].position),e.centroid.divideScalar(4))},computeFaceNormals:function(b){var c,e,f,g,j,k,m=new THREE.Vector3,n=new THREE.Vector3;f=0;for(g=this.faces.length;f<g;f++){j=this.faces[f];if(b&&j.vertexNormals.length){m.set(0,0,0);c=0;for(e=j.vertexNormals.length;c<e;c++)m.addSelf(j.vertexNormals[c]);m.divideScalar(3)}else c=this.vertices[j.a],e=this.vertices[j.b],k=this.vertices[j.c],m.sub(k.position,e.position),n.sub(c.position,e.position),m.crossSelf(n);m.isZero()||
+m.normalize();j.normal.copy(m)}},computeVertexNormals:function(){var b,c,e,f;if(this.__tmpVertices==void 0){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++)if(e=this.faces[b],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{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++)e=this.faces[b],e instanceof THREE.Face3?(f[e.a].addSelf(e.normal),f[e.b].addSelf(e.normal),f[e.c].addSelf(e.normal)):e instanceof THREE.Face4&&(f[e.a].addSelf(e.normal),f[e.b].addSelf(e.normal),f[e.c].addSelf(e.normal),f[e.d].addSelf(e.normal));b=0;for(c=this.vertices.length;b<c;b++)f[b].normalize();b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],e instanceof THREE.Face3?(e.vertexNormals[0].copy(f[e.a]),
-e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c])):e instanceof THREE.Face4&&(e.vertexNormals[0].copy(f[e.a]),e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c]),e.vertexNormals[3].copy(f[e.d]))},computeTangents:function(){function b(b,e,c,f,h,g,D){m=b.vertices[e].position;n=b.vertices[c].position;o=b.vertices[f].position;p=k[h];t=k[g];v=k[D];u=n.x-m.x;w=o.x-m.x;E=n.y-m.y;H=o.y-m.y;B=n.z-m.z;K=o.z-m.z;A=t.u-p.u;I=v.u-p.u;G=t.v-p.v;C=v.v-p.v;R=1/(A*C-I*G);V.set((C*u-G*w)*
-R,(C*E-G*H)*R,(C*B-G*K)*R);j.set((A*w-I*u)*R,(A*H-I*E)*R,(A*K-I*B)*R);N[e].addSelf(V);N[c].addSelf(V);N[f].addSelf(V);J[e].addSelf(j);J[c].addSelf(j);J[f].addSelf(j)}var c,e,f,g,h,k,m,n,o,p,t,v,u,w,E,H,B,K,A,I,G,C,R,D,N=[],J=[],V=new THREE.Vector3,j=new THREE.Vector3,X=new THREE.Vector3,O=new THREE.Vector3,$=new THREE.Vector3;c=0;for(e=this.vertices.length;c<e;c++)N[c]=new THREE.Vector3,J[c]=new THREE.Vector3;c=0;for(e=this.faces.length;c<e;c++)h=this.faces[c],k=this.faceVertexUvs[0][c],h instanceof
-THREE.Face3?b(this,h.a,h.b,h.c,0,1,2):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 M=["a","b","c","d"];c=0;for(e=this.faces.length;c<e;c++){h=this.faces[c];for(f=0;f<h.vertexNormals.length;f++)$.copy(h.vertexNormals[f]),g=h[M[f]],D=N[g],X.copy(D),X.subSelf($.multiplyScalar($.dot(D))).normalize(),O.cross(h.vertexNormals[f],D),g=O.dot(J[g]),g=g<0?-1:1,h.vertexTangents[f]=new THREE.Vector4(X.x,X.y,X.z,g)}this.hasTangents=!0},computeBoundingBox:function(){var b;
+e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c])):e instanceof THREE.Face4&&(e.vertexNormals[0].copy(f[e.a]),e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c]),e.vertexNormals[3].copy(f[e.d]))},computeTangents:function(){function b(b,e,c,f,j,g,D){m=b.vertices[e].position;n=b.vertices[c].position;o=b.vertices[f].position;p=k[j];t=k[g];u=k[D];v=n.x-m.x;w=o.x-m.x;E=n.y-m.y;I=o.y-m.y;B=n.z-m.z;H=o.z-m.z;A=t.u-p.u;K=u.u-p.u;G=t.v-p.v;C=u.v-p.v;R=1/(A*C-K*G);V.set((C*v-G*w)*
+R,(C*E-G*I)*R,(C*B-G*H)*R);h.set((A*w-K*v)*R,(A*I-K*E)*R,(A*H-K*B)*R);N[e].addSelf(V);N[c].addSelf(V);N[f].addSelf(V);J[e].addSelf(h);J[c].addSelf(h);J[f].addSelf(h)}var c,e,f,g,j,k,m,n,o,p,t,u,v,w,E,I,B,H,A,K,G,C,R,D,N=[],J=[],V=new THREE.Vector3,h=new THREE.Vector3,X=new THREE.Vector3,O=new THREE.Vector3,$=new THREE.Vector3;c=0;for(e=this.vertices.length;c<e;c++)N[c]=new THREE.Vector3,J[c]=new THREE.Vector3;c=0;for(e=this.faces.length;c<e;c++)j=this.faces[c],k=this.faceVertexUvs[0][c],j instanceof
+THREE.Face3?b(this,j.a,j.b,j.c,0,1,2):j instanceof THREE.Face4&&(b(this,j.a,j.b,j.c,0,1,2),b(this,j.a,j.b,j.d,0,1,3));var M=["a","b","c","d"];c=0;for(e=this.faces.length;c<e;c++){j=this.faces[c];for(f=0;f<j.vertexNormals.length;f++)$.copy(j.vertexNormals[f]),g=j[M[f]],D=N[g],X.copy(D),X.subSelf($.multiplyScalar($.dot(D))).normalize(),O.cross(j.vertexNormals[f],D),g=O.dot(J[g]),g=g<0?-1:1,j.vertexTangents[f]=new THREE.Vector4(X.x,X.y,X.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,e=this.vertices.length;c<e;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=0,c=0,e=this.vertices.length;c<e;c++)b=Math.max(b,this.vertices[c].position.length());this.boundingSphere={radius:b}},computeEdgeFaces:function(){function b(b,e){return Math.min(b,e)+"_"+Math.max(b,e)}function c(b,e,c){b[e]===
-void 0?(b[e]={set:{},array:[]},b[e].set[c]=1,b[e].array.push(c)):b[e].set[c]===void 0&&(b[e].set[c]=1,b[e].array.push(c))}var e,f,g,h,k,m={};e=0;for(f=this.faces.length;e<f;e++)k=this.faces[e],k instanceof THREE.Face3?(g=b(k.a,k.b),c(m,g,e),g=b(k.b,k.c),c(m,g,e),g=b(k.a,k.c),c(m,g,e)):k instanceof THREE.Face4&&(g=b(k.b,k.d),c(m,g,e),g=b(k.a,k.b),c(m,g,e),g=b(k.a,k.d),c(m,g,e),g=b(k.b,k.c),c(m,g,e),g=b(k.c,k.d),c(m,g,e));e=0;for(f=this.edges.length;e<f;e++){k=this.edges[e];g=k.vertexIndices[0];h=k.vertexIndices[1];
-k.faceIndices=m[b(g,h)].array;for(g=0;g<k.faceIndices.length;g++)h=k.faceIndices[g],k.faces.push(this.faces[h])}}};THREE.GeometryIdCounter=0;
-THREE.Spline=function(b){function c(b,e,c,f,h,g,k){b=(c-b)*0.5;f=(f-e)*0.5;return(2*(e-c)+b+f)*k+(-3*(e-c)-2*b-f)*g+b*h+e}this.points=b;var e=[],f={x:0,y:0,z:0},g,h,k,m,n,o,p,t,v;this.initFromArray=function(b){this.points=[];for(var e=0;e<b.length;e++)this.points[e]={x:b[e][0],y:b[e][1],z:b[e][2]}};this.getPoint=function(b){g=(this.points.length-1)*b;h=Math.floor(g);k=g-h;e[0]=h==0?h:h-1;e[1]=h;e[2]=h>this.points.length-2?h:h+1;e[3]=h>this.points.length-3?h:h+2;o=this.points[e[0]];p=this.points[e[1]];
-t=this.points[e[2]];v=this.points[e[3]];m=k*k;n=k*m;f.x=c(o.x,p.x,t.x,v.x,k,m,n);f.y=c(o.y,p.y,t.y,v.y,k,m,n);f.z=c(o.z,p.z,t.z,v.z,k,m,n);return f};this.getControlPointsArray=function(){var b,e,c=this.points.length,f=[];for(b=0;b<c;b++)e=this.points[b],f[b]=[e.x,e.y,e.z];return f};this.getLength=function(b){var e,c,f=e=e=0,h=new THREE.Vector3,g=new THREE.Vector3,k=[],m=0;k[0]=0;b||(b=100);c=this.points.length*b;h.copy(this.points[0]);for(b=1;b<c;b++)e=b/c,position=this.getPoint(e),g.copy(position),
-m+=g.distanceTo(h),h.copy(position),e*=this.points.length-1,e=Math.floor(e),e!=f&&(k[e]=m,f=e);k[k.length]=m;return{chunks:k,total:m}};this.reparametrizeByArcLength=function(b){var e,c,f,h,g,k,m=[],n=new THREE.Vector3,o=this.getLength();m.push(n.copy(this.points[0]).clone());for(e=1;e<this.points.length;e++){c=o.chunks[e]-o.chunks[e-1];k=Math.ceil(b*c/o.total);h=(e-1)/(this.points.length-1);g=e/(this.points.length-1);for(c=1;c<k-1;c++)f=h+c*(1/k)*(g-h),position=this.getPoint(f),m.push(n.copy(position).clone());
+void 0?(b[e]={set:{},array:[]},b[e].set[c]=1,b[e].array.push(c)):b[e].set[c]===void 0&&(b[e].set[c]=1,b[e].array.push(c))}var e,f,g,j,k,m={};e=0;for(f=this.faces.length;e<f;e++)k=this.faces[e],k instanceof THREE.Face3?(g=b(k.a,k.b),c(m,g,e),g=b(k.b,k.c),c(m,g,e),g=b(k.a,k.c),c(m,g,e)):k instanceof THREE.Face4&&(g=b(k.b,k.d),c(m,g,e),g=b(k.a,k.b),c(m,g,e),g=b(k.a,k.d),c(m,g,e),g=b(k.b,k.c),c(m,g,e),g=b(k.c,k.d),c(m,g,e));e=0;for(f=this.edges.length;e<f;e++){k=this.edges[e];g=k.vertexIndices[0];j=k.vertexIndices[1];
+k.faceIndices=m[b(g,j)].array;for(g=0;g<k.faceIndices.length;g++)j=k.faceIndices[g],k.faces.push(this.faces[j])}}};THREE.GeometryIdCounter=0;
+THREE.Spline=function(b){function c(b,e,c,f,j,g,k){b=(c-b)*0.5;f=(f-e)*0.5;return(2*(e-c)+b+f)*k+(-3*(e-c)-2*b-f)*g+b*j+e}this.points=b;var e=[],f={x:0,y:0,z:0},g,j,k,m,n,o,p,t,u;this.initFromArray=function(b){this.points=[];for(var e=0;e<b.length;e++)this.points[e]={x:b[e][0],y:b[e][1],z:b[e][2]}};this.getPoint=function(b){g=(this.points.length-1)*b;j=Math.floor(g);k=g-j;e[0]=j==0?j:j-1;e[1]=j;e[2]=j>this.points.length-2?j:j+1;e[3]=j>this.points.length-3?j:j+2;o=this.points[e[0]];p=this.points[e[1]];
+t=this.points[e[2]];u=this.points[e[3]];m=k*k;n=k*m;f.x=c(o.x,p.x,t.x,u.x,k,m,n);f.y=c(o.y,p.y,t.y,u.y,k,m,n);f.z=c(o.z,p.z,t.z,u.z,k,m,n);return f};this.getControlPointsArray=function(){var b,e,c=this.points.length,f=[];for(b=0;b<c;b++)e=this.points[b],f[b]=[e.x,e.y,e.z];return f};this.getLength=function(b){var e,c,f=e=e=0,j=new THREE.Vector3,g=new THREE.Vector3,k=[],m=0;k[0]=0;b||(b=100);c=this.points.length*b;j.copy(this.points[0]);for(b=1;b<c;b++)e=b/c,position=this.getPoint(e),g.copy(position),
+m+=g.distanceTo(j),j.copy(position),e*=this.points.length-1,e=Math.floor(e),e!=f&&(k[e]=m,f=e);k[k.length]=m;return{chunks:k,total:m}};this.reparametrizeByArcLength=function(b){var e,c,f,j,g,k,m=[],n=new THREE.Vector3,o=this.getLength();m.push(n.copy(this.points[0]).clone());for(e=1;e<this.points.length;e++){c=o.chunks[e]-o.chunks[e-1];k=Math.ceil(b*c/o.total);j=(e-1)/(this.points.length-1);g=e/(this.points.length-1);for(c=1;c<k-1;c++)f=j+c*(1/k)*(g-j),position=this.getPoint(f),m.push(n.copy(position).clone());
 m.push(n.copy(this.points[e]).clone())}this.points=m}};THREE.Edge=function(b,c,e,f){this.vertices=[b,c];this.vertexIndices=[e,f];this.faces=[];this.faceIndices=[]};THREE.Camera=function(b,c,e,f,g){THREE.Object3D.call(this);this.fov=b||50;this.aspect=c||1;this.near=e||0.1;this.far=f||2E3;this.target=g||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;
-THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;THREE.Camera.prototype.translate=function(b,c){this.matrix.rotateAxis(c);c.multiplyScalar(b);this.position.addSelf(c);this.target.position.addSelf(c)};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};
+THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;THREE.Camera.prototype.translate=function(b,c){this.matrix.rotateAxis(c);c.multiplyScalar(b);this.position.addSelf(c);this.target.position.addSelf(c)};
+THREE.Camera.prototype.updateProjectionMatrix=function(){if(this.fullWidth){var b=this.fullWidth/this.fullHeight,c=Math.tan(this.fov*Math.PI/360)*this.near,e=-c,f=b*e,b=Math.abs(b*c-f),e=Math.abs(c-e);this.projectionMatrix=THREE.Matrix4.makeFrustum(f+this.x*b/this.fullWidth,f+(this.x+this.width)*b/this.fullWidth,c-(this.y+this.height)*e/this.fullHeight,c-this.y*e/this.fullHeight,this.near,this.far)}else this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};
+THREE.Camera.prototype.setViewOffset=function(b,c,e,f,g,j){this.fullWidth=b;this.fullHeight=c;this.x=e;this.y=f;this.width=g;this.height=j;this.updateProjectionMatrix()};
 THREE.Camera.prototype.update=function(b,c,e){if(this.useTarget)this.matrix.lookAt(this.position,this.target.position,this.up),this.matrix.setPosition(this.position),b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse),c=!0;else if(this.matrixAutoUpdate&&this.updateMatrix(),c||this.matrixWorldNeedsUpdate)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=
 !1,c=!0,THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);for(b=0;b<this.children.length;b++)this.children[b].update(this.matrixWorld,c,e)};THREE.Light=function(b){THREE.Object3D.call(this);this.color=new THREE.Color(b)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(b){THREE.Light.call(this,b)};THREE.AmbientLight.prototype=new THREE.Light;
 THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(b,c,e,f){THREE.Light.call(this,b);this.position=new THREE.Vector3(0,1,0);this.intensity=c||1;this.distance=e||0;this.castShadow=f!==void 0?f:!1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(b,c,e){THREE.Light.call(this,b);this.position=new THREE.Vector3;this.intensity=c||1;this.distance=e||0};
@@ -98,23 +100,23 @@ void 0?b.shading:THREE.SmoothShading;this.wireframe=b.wireframe!==void 0?b.wiref
 THREE.ShadowVolumeDynamicMaterial.prototype=new THREE.Material;THREE.ShadowVolumeDynamicMaterial.prototype.constructor=THREE.ShadowVolumeDynamicMaterial;
 THREE.ParticleBasicMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.color=b.color!==void 0?new THREE.Color(b.color):new THREE.Color(16777215);this.map=b.map!==void 0?b.map:null;this.size=b.size!==void 0?b.size:1;this.sizeAttenuation=b.sizeAttenuation!==void 0?b.sizeAttenuation:!0;this.vertexColors=b.vertexColors!==void 0?b.vertexColors:!1};THREE.ParticleBasicMaterial.prototype=new THREE.Material;THREE.ParticleBasicMaterial.prototype.constructor=THREE.ParticleBasicMaterial;
 THREE.ParticleCanvasMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.color=b.color!==void 0?new THREE.Color(b.color):new THREE.Color(16777215);this.program=b.program!==void 0?b.program:function(){}};THREE.ParticleCanvasMaterial.prototype=new THREE.Material;THREE.ParticleCanvasMaterial.prototype.constructor=THREE.ParticleCanvasMaterial;THREE.ParticleDOMMaterial=function(b){THREE.Material.call(this);this.domElement=b};
-THREE.Texture=function(b,c,e,f,g,h){this.image=b;this.mapping=c!==void 0?c:new THREE.UVMapping;this.wrapS=e!==void 0?e:THREE.ClampToEdgeWrapping;this.wrapT=f!==void 0?f:THREE.ClampToEdgeWrapping;this.magFilter=g!==void 0?g:THREE.LinearFilter;this.minFilter=h!==void 0?h:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.needsUpdate=!1};
+THREE.Texture=function(b,c,e,f,g,j){this.image=b;this.mapping=c!==void 0?c:new THREE.UVMapping;this.wrapS=e!==void 0?e:THREE.ClampToEdgeWrapping;this.wrapT=f!==void 0?f:THREE.ClampToEdgeWrapping;this.magFilter=g!==void 0?g:THREE.LinearFilter;this.minFilter=j!==void 0?j:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.needsUpdate=!1};
 THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter)}};THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;
 THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;THREE.Particle=function(b){THREE.Object3D.call(this);this.materials=b instanceof Array?b:[b]};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;
 THREE.ParticleSystem=function(b,c){THREE.Object3D.call(this);this.geometry=b;this.materials=c instanceof Array?c:[c];this.sortParticles=!1};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;THREE.Line=function(b,c,e){THREE.Object3D.call(this);this.geometry=b;this.materials=c instanceof Array?c:[c];this.type=e!=void 0?e:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;
 THREE.Line.prototype.constructor=THREE.Line;
-THREE.Mesh=function(b,c){THREE.Object3D.call(this);this.geometry=b;this.materials=c&&c.length?c:[c];this.overdraw=this.doubleSided=this.flipSided=!1;if(this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere(),this.boundRadius=b.boundingSphere.radius,this.geometry.morphTargets.length)){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var e=0;e<this.geometry.morphTargets.length;e++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[this.geometry.morphTargets[e].name]=
+THREE.Mesh=function(b,c){THREE.Object3D.call(this);this.geometry=b;this.materials=c&&c.length?c:[c];this.overdraw=!1;if(this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere(),this.boundRadius=b.boundingSphere.radius,this.geometry.morphTargets.length)){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var e=0;e<this.geometry.morphTargets.length;e++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[this.geometry.morphTargets[e].name]=
 e}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;THREE.Mesh.prototype.getMorphTargetIndexByName=function(b){if(this.morphTargetDictionary[b]!==void 0)return this.morphTargetDictionary[b];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+b+" does not exist. Returning 0.");return 0};
 THREE.Bone=function(b){THREE.Object3D.call(this);this.skin=b;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
 THREE.Bone.prototype.update=function(b,c,e){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate)b?this.skinMatrix.multiply(b,this.matrix):this.skinMatrix.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,c=!0;var f,g=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(f=0;f<g;f++)b=this.children[f],b instanceof THREE.Bone?b.update(this.skinMatrix,c,e):b.update(this.matrixWorld,!0,e)}else for(f=0;f<g;f++)this.children[f].update(this.skinMatrix,
 c,e)};THREE.Bone.prototype.addChild=function(b){if(this.children.indexOf(b)===-1&&(b.parent!==void 0&&b.parent.removeChild(b),b.parent=this,this.children.push(b),!(b instanceof THREE.Bone)))this.hasNoneBoneChildren=!0};
-THREE.SkinnedMesh=function(b,c){THREE.Mesh.call(this,b,c);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var e,f,g,h,k,m;if(this.geometry.bones!==void 0){for(e=0;e<this.geometry.bones.length;e++)g=this.geometry.bones[e],h=g.pos,k=g.rotq,m=g.scl,f=this.addBone(),f.name=g.name,f.position.set(h[0],h[1],h[2]),f.quaternion.set(k[0],k[1],k[2],k[3]),f.useQuaternion=!0,m!==void 0?f.scale.set(m[0],m[1],m[2]):f.scale.set(1,1,1);for(e=0;e<this.bones.length;e++)g=this.geometry.bones[e],
+THREE.SkinnedMesh=function(b,c){THREE.Mesh.call(this,b,c);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var e,f,g,j,k,m;if(this.geometry.bones!==void 0){for(e=0;e<this.geometry.bones.length;e++)g=this.geometry.bones[e],j=g.pos,k=g.rotq,m=g.scl,f=this.addBone(),f.name=g.name,f.position.set(j[0],j[1],j[2]),f.quaternion.set(k[0],k[1],k[2],k[3]),f.useQuaternion=!0,m!==void 0?f.scale.set(m[0],m[1],m[2]):f.scale.set(1,1,1);for(e=0;e<this.bones.length;e++)g=this.geometry.bones[e],
 f=this.bones[e],g.parent===-1?this.addChild(f):this.bones[g.parent].addChild(f);this.boneMatrices=new Float32Array(16*this.bones.length);this.pose()}};THREE.SkinnedMesh.prototype=new THREE.Mesh;THREE.SkinnedMesh.prototype.constructor=THREE.SkinnedMesh;
 THREE.SkinnedMesh.prototype.update=function(b,c,e){if(this.visible){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,c=!0;var f,g=this.children.length;for(f=0;f<g;f++)b=this.children[f],b instanceof THREE.Bone?b.update(this.identityMatrix,!1,e):b.update(this.matrixWorld,c,e);e=this.bones.length;ba=this.bones;bm=this.boneMatrices;for(c=0;c<e;c++)ba[c].skinMatrix.flattenToArrayOffset(bm,
 c*16)}};THREE.SkinnedMesh.prototype.addBone=function(b){b===void 0&&(b=new THREE.Bone(this));this.bones.push(b);return b};
-THREE.SkinnedMesh.prototype.pose=function(){this.update(void 0,!0);for(var b,c=[],e=0;e<this.bones.length;e++)b=this.bones[e],c.push(THREE.Matrix4.makeInvert(b.skinMatrix)),b.skinMatrix.flattenToArrayOffset(this.boneMatrices,e*16);if(this.geometry.skinVerticesA===void 0){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];var f;for(b=0;b<this.geometry.skinIndices.length;b++){var e=this.geometry.vertices[b].position,g=this.geometry.skinIndices[b].x,h=this.geometry.skinIndices[b].y;f=new THREE.Vector3(e.x,
-e.y,e.z);this.geometry.skinVerticesA.push(c[g].multiplyVector3(f));f=new THREE.Vector3(e.x,e.y,e.z);this.geometry.skinVerticesB.push(c[h].multiplyVector3(f));this.geometry.skinWeights[b].x+this.geometry.skinWeights[b].y!==1&&(e=(1-(this.geometry.skinWeights[b].x+this.geometry.skinWeights[b].y))*0.5,this.geometry.skinWeights[b].x+=e,this.geometry.skinWeights[b].y+=e)}}};
-THREE.Ribbon=function(b,c){THREE.Object3D.call(this);this.geometry=b;this.materials=c instanceof Array?c:[c];this.doubleSided=this.flipSided=!1};THREE.Ribbon.prototype=new THREE.Object3D;THREE.Ribbon.prototype.constructor=THREE.Ribbon;
+THREE.SkinnedMesh.prototype.pose=function(){this.update(void 0,!0);for(var b,c=[],e=0;e<this.bones.length;e++)b=this.bones[e],c.push(THREE.Matrix4.makeInvert(b.skinMatrix)),b.skinMatrix.flattenToArrayOffset(this.boneMatrices,e*16);if(this.geometry.skinVerticesA===void 0){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];var f;for(b=0;b<this.geometry.skinIndices.length;b++){var e=this.geometry.vertices[b].position,g=this.geometry.skinIndices[b].x,j=this.geometry.skinIndices[b].y;f=new THREE.Vector3(e.x,
+e.y,e.z);this.geometry.skinVerticesA.push(c[g].multiplyVector3(f));f=new THREE.Vector3(e.x,e.y,e.z);this.geometry.skinVerticesB.push(c[j].multiplyVector3(f));this.geometry.skinWeights[b].x+this.geometry.skinWeights[b].y!==1&&(e=(1-(this.geometry.skinWeights[b].x+this.geometry.skinWeights[b].y))*0.5,this.geometry.skinWeights[b].x+=e,this.geometry.skinWeights[b].y+=e)}}};THREE.Ribbon=function(b,c){THREE.Object3D.call(this);this.geometry=b;this.materials=c instanceof Array?c:[c]};
+THREE.Ribbon.prototype=new THREE.Object3D;THREE.Ribbon.prototype.constructor=THREE.Ribbon;
 THREE.Sound=function(b,c,e,f){THREE.Object3D.call(this);this.isPlaying=this.isAddedToDOM=this.isLoaded=!1;this.duration=-1;this.radius=c!==void 0?Math.abs(c):100;this.volume=Math.min(1,Math.max(0,e!==void 0?e:1));this.domElement=document.createElement("audio");this.domElement.volume=0;this.domElement.pan=0;this.domElement.loop=f!==void 0?f:!0;this.sources=b instanceof Array?b:[b];for(var g,e=this.sources.length,b=0;b<e;b++)if(c=this.sources[b],c.toLowerCase(),c.indexOf(".mp3")!==-1?g="audio/mpeg":
 c.indexOf(".ogg")!==-1?g="audio/ogg":c.indexOf(".wav")!==-1&&(g="audio/wav"),this.domElement.canPlayType(g)){g=document.createElement("source");g.src=this.sources[b];this.domElement.THREESound=this;this.domElement.appendChild(g);this.domElement.addEventListener("canplay",this.onLoad,!0);this.domElement.load();break}};THREE.Sound.prototype=new THREE.Object3D;THREE.Sound.prototype.constructor=THREE.Sound;THREE.Sound.prototype.supr=THREE.Object3D.prototype;
 THREE.Sound.prototype.onLoad=function(){var b=this.THREESound;if(!b.isLoaded)this.removeEventListener("canplay",this.onLoad,!0),b.isLoaded=!0,b.duration=this.duration,b.isPlaying&&b.play()};THREE.Sound.prototype.addToDOM=function(b){this.isAddedToDOM=!0;b.appendChild(this.domElement)};THREE.Sound.prototype.play=function(b){this.isPlaying=!0;if(this.isLoaded&&(this.domElement.play(),b))this.domElement.currentTime=b%this.duration};THREE.Sound.prototype.pause=function(){this.isPlaying=!1;this.domElement.pause()};
@@ -124,13 +126,13 @@ THREE.LOD.prototype.supr=THREE.Object3D.prototype;THREE.LOD.prototype.add=functi
 THREE.LOD.prototype.update=function(b,c,e){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,c=!0;if(this.LODs.length>1){b=e.matrixWorldInverse;b=-(b.n31*this.position.x+b.n32*this.position.y+b.n33*this.position.z+b.n34);this.LODs[0].object3D.visible=!0;for(var f=1;f<this.LODs.length;f++)if(b>=this.LODs[f].visibleAtDistance)this.LODs[f-1].object3D.visible=!1,
 this.LODs[f].object3D.visible=!0;else break;for(;f<this.LODs.length;f++)this.LODs[f].object3D.visible=!1}for(b=0;b<this.children.length;b++)this.children[b].update(this.matrixWorld,c,e)};THREE.ShadowVolume=function(b,c){b instanceof THREE.Mesh?(THREE.Mesh.call(this,b.geometry,c?[new THREE.ShadowVolumeDynamicMaterial]:[new THREE.ShadowVolumeDynamicMaterial]),b.addChild(this)):THREE.Mesh.call(this,b,c?[new THREE.ShadowVolumeDynamicMaterial]:[new THREE.ShadowVolumeDynamicMaterial]);this.calculateShadowVolumeGeometry()};
 THREE.ShadowVolume.prototype=new THREE.Mesh;THREE.ShadowVolume.prototype.constructor=THREE.ShadowVolume;THREE.ShadowVolume.prototype.supr=THREE.Mesh.prototype;
-THREE.ShadowVolume.prototype.calculateShadowVolumeGeometry=function(){if(this.geometry.edges&&this.geometry.edges.length){var b,c,e,f,g,h,k,m,n,o,p,t,v,u,w=new THREE.Geometry;w.vertices=this.geometry.vertices;f=w.faces=this.geometry.faces;var E=w.egdes=this.geometry.edges,H=w.edgeFaces=[];g=0;var B=[];b=0;for(c=f.length;b<c;b++)if(e=f[b],B.push(g),g+=e instanceof THREE.Face3?3:4,e.vertexNormals[0]=e.normal,e.vertexNormals[1]=e.normal,e.vertexNormals[2]=e.normal,e instanceof THREE.Face4)e.vertexNormals[3]=
-e.normal;b=0;for(c=E.length;b<c;b++)m=E[b],e=m.faces[0],f=m.faces[1],g=m.faceIndices[0],h=m.faceIndices[1],k=m.vertexIndices[0],m=m.vertexIndices[1],e.a===k?(n="a",p=B[g]+0):e.b===k?(n="b",p=B[g]+1):e.c===k?(n="c",p=B[g]+2):e.d===k&&(n="d",p=B[g]+3),e.a===m?(n+="a",t=B[g]+0):e.b===m?(n+="b",t=B[g]+1):e.c===m?(n+="c",t=B[g]+2):e.d===m&&(n+="d",t=B[g]+3),f.a===k?(o="a",v=B[h]+0):f.b===k?(o="b",v=B[h]+1):f.c===k?(o="c",v=B[h]+2):f.d===k&&(o="d",v=B[h]+3),f.a===m?(o+="a",u=B[h]+0):f.b===m?(o+="b",u=B[h]+
-1):f.c===m?(o+="c",u=B[h]+2):f.d===m&&(o+="d",u=B[h]+3),n==="ac"||n==="ad"||n==="ca"||n==="da"?p>t&&(e=p,p=t,t=e):p<t&&(e=p,p=t,t=e),o==="ac"||o==="ad"||o==="ca"||o==="da"?v>u&&(e=v,v=u,u=e):v<u&&(e=v,v=u,u=e),e=new THREE.Face4(p,t,v,u),e.normal.set(1,0,0),H.push(e);this.geometry=w}else this.calculateShadowVolumeGeometryWithoutEdgeInfo(this.geometry)};
-THREE.ShadowVolume.prototype.calculateShadowVolumeGeometryWithoutEdgeInfo=function(b){this.geometry=new THREE.Geometry;this.geometry.boundingSphere=b.boundingSphere;this.geometry.edgeFaces=[];var c=this.geometry.vertices,e=this.geometry.faces,f=this.geometry.edgeFaces,g=b.faces,b=b.vertices,h=g.length,k,m,n,o,p,t=["a","b","c","d"];for(n=0;n<h;n++){m=c.length;k=g[n];k instanceof THREE.Face4?(o=4,m=new THREE.Face4(m,m+1,m+2,m+3)):(o=3,m=new THREE.Face3(m,m+1,m+2));m.normal.copy(k.normal);e.push(m);
-for(m=0;m<o;m++)p=b[k[t[m]]],c.push(new THREE.Vertex(p.position.clone()))}for(h=0;h<g.length-1;h++){b=e[h];for(k=h+1;k<g.length;k++)m=e[k],m=this.facesShareEdge(c,b,m),m!==void 0&&(m=new THREE.Face4(m.indices[0],m.indices[3],m.indices[2],m.indices[1]),m.normal.set(1,0,0),f.push(m))}};
-THREE.ShadowVolume.prototype.facesShareEdge=function(b,c,e){var f,g,h,k,m,n,o,p,t,v,u,w,E,H=0,B=["a","b","c","d"];f=c instanceof THREE.Face4?4:3;g=e instanceof THREE.Face4?4:3;for(w=0;w<f;w++){h=c[B[w]];m=b[h];for(E=0;E<g;E++)if(k=e[B[E]],n=b[k],Math.abs(m.position.x-n.position.x)<1.0E-4&&Math.abs(m.position.y-n.position.y)<1.0E-4&&Math.abs(m.position.z-n.position.z)<1.0E-4&&(H++,H===1&&(o=m,p=n,t=h,v=k,u=B[w]),H===2))return u+=B[w],u==="ad"||u==="ac"?{faces:[c,e],vertices:[o,p,n,m],indices:[t,v,
-k,h],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[c,e],vertices:[o,m,n,p],indices:[t,h,k,v],vertexTypes:[1,1,2,2],extrudable:!0}}};
+THREE.ShadowVolume.prototype.calculateShadowVolumeGeometry=function(){if(this.geometry.edges&&this.geometry.edges.length){var b,c,e,f,g,j,k,m,n,o,p,t,u,v,w=new THREE.Geometry;w.vertices=this.geometry.vertices;f=w.faces=this.geometry.faces;var E=w.egdes=this.geometry.edges,I=w.edgeFaces=[];g=0;var B=[];b=0;for(c=f.length;b<c;b++)if(e=f[b],B.push(g),g+=e instanceof THREE.Face3?3:4,e.vertexNormals[0]=e.normal,e.vertexNormals[1]=e.normal,e.vertexNormals[2]=e.normal,e instanceof THREE.Face4)e.vertexNormals[3]=
+e.normal;b=0;for(c=E.length;b<c;b++)m=E[b],e=m.faces[0],f=m.faces[1],g=m.faceIndices[0],j=m.faceIndices[1],k=m.vertexIndices[0],m=m.vertexIndices[1],e.a===k?(n="a",p=B[g]+0):e.b===k?(n="b",p=B[g]+1):e.c===k?(n="c",p=B[g]+2):e.d===k&&(n="d",p=B[g]+3),e.a===m?(n+="a",t=B[g]+0):e.b===m?(n+="b",t=B[g]+1):e.c===m?(n+="c",t=B[g]+2):e.d===m&&(n+="d",t=B[g]+3),f.a===k?(o="a",u=B[j]+0):f.b===k?(o="b",u=B[j]+1):f.c===k?(o="c",u=B[j]+2):f.d===k&&(o="d",u=B[j]+3),f.a===m?(o+="a",v=B[j]+0):f.b===m?(o+="b",v=B[j]+
+1):f.c===m?(o+="c",v=B[j]+2):f.d===m&&(o+="d",v=B[j]+3),n==="ac"||n==="ad"||n==="ca"||n==="da"?p>t&&(e=p,p=t,t=e):p<t&&(e=p,p=t,t=e),o==="ac"||o==="ad"||o==="ca"||o==="da"?u>v&&(e=u,u=v,v=e):u<v&&(e=u,u=v,v=e),e=new THREE.Face4(p,t,u,v),e.normal.set(1,0,0),I.push(e);this.geometry=w}else this.calculateShadowVolumeGeometryWithoutEdgeInfo(this.geometry)};
+THREE.ShadowVolume.prototype.calculateShadowVolumeGeometryWithoutEdgeInfo=function(b){this.geometry=new THREE.Geometry;this.geometry.boundingSphere=b.boundingSphere;this.geometry.edgeFaces=[];var c=this.geometry.vertices,e=this.geometry.faces,f=this.geometry.edgeFaces,g=b.faces,b=b.vertices,j=g.length,k,m,n,o,p,t=["a","b","c","d"];for(n=0;n<j;n++){m=c.length;k=g[n];k instanceof THREE.Face4?(o=4,m=new THREE.Face4(m,m+1,m+2,m+3)):(o=3,m=new THREE.Face3(m,m+1,m+2));m.normal.copy(k.normal);e.push(m);
+for(m=0;m<o;m++)p=b[k[t[m]]],c.push(new THREE.Vertex(p.position.clone()))}for(j=0;j<g.length-1;j++){b=e[j];for(k=j+1;k<g.length;k++)m=e[k],m=this.facesShareEdge(c,b,m),m!==void 0&&(m=new THREE.Face4(m.indices[0],m.indices[3],m.indices[2],m.indices[1]),m.normal.set(1,0,0),f.push(m))}};
+THREE.ShadowVolume.prototype.facesShareEdge=function(b,c,e){var f,g,j,k,m,n,o,p,t,u,v,w,E,I=0,B=["a","b","c","d"];f=c instanceof THREE.Face4?4:3;g=e instanceof THREE.Face4?4:3;for(w=0;w<f;w++){j=c[B[w]];m=b[j];for(E=0;E<g;E++)if(k=e[B[E]],n=b[k],Math.abs(m.position.x-n.position.x)<1.0E-4&&Math.abs(m.position.y-n.position.y)<1.0E-4&&Math.abs(m.position.z-n.position.z)<1.0E-4&&(I++,I===1&&(o=m,p=n,t=j,u=k,v=B[w]),I===2))return v+=B[w],v==="ad"||v==="ac"?{faces:[c,e],vertices:[o,p,n,m],indices:[t,u,
+k,j],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[c,e],vertices:[o,m,n,p],indices:[t,j,k,u],vertexTypes:[1,1,2,2],extrudable:!0}}};
 THREE.Sprite=function(b){THREE.Object3D.call(this);if(b.material!==void 0)this.material=b.material,this.map=void 0,this.blending=material.blending;else if(b.map!==void 0)this.map=b.map instanceof THREE.Texture?b.map:ImageUtils.loadTexture(b.map),this.material=void 0,this.blending=b.blending!==void 0?b.blending:THREE.NormalBlending;this.useScreenCoordinates=b.useScreenCoordinates!==void 0?b.useScreenCoordinates:!0;this.mergeWith3D=b.mergeWith3D!==void 0?b.mergeWith3D:!this.useScreenCoordinates;this.affectedByDistance=
 b.affectedByDistance!==void 0?b.affectedByDistance:!this.useScreenCoordinates;this.alignment=b.alignment instanceof THREE.Vector2?b.alignment:THREE.SpriteAlignment.center;this.rotation3d=this.rotation;this.rotation=0;this.opacity=1;this.uvOffset=new THREE.Vector2(0,0);this.uvScale=new THREE.Vector2(1,1)};THREE.Sprite.prototype=new THREE.Object3D;THREE.Sprite.prototype.constructor=THREE.Sprite;THREE.Sprite.prototype.supr=THREE.Object3D.prototype;
 THREE.Sprite.prototype.updateMatrix=function(){this.matrix.setPosition(this.position);this.rotation3d.set(0,0,this.rotation);this.matrix.setRotationFromEuler(this.rotation3d);if(this.scale.x!==1||this.scale.y!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,this.scale.y);this.matrixWorldNeedsUpdate=!0};THREE.SpriteAlignment={};THREE.SpriteAlignment.topLeft=new THREE.Vector2(1,-1);THREE.SpriteAlignment.topCenter=new THREE.Vector2(0,-1);
@@ -139,56 +141,56 @@ THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.c
 THREE.Scene.prototype.addChildRecurse=function(b){if(b instanceof THREE.Light)this.lights.indexOf(b)===-1&&this.lights.push(b);else if(b instanceof THREE.Sound)this.sounds.indexOf(b)===-1&&this.sounds.push(b);else if(!(b instanceof THREE.Camera||b instanceof THREE.Bone)&&this.objects.indexOf(b)===-1)this.objects.push(b),this.__objectsAdded.push(b);for(var 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 b instanceof THREE.Sound?(c=this.sounds.indexOf(b),c!==-1&&this.sounds.splice(c,1)):b instanceof THREE.Camera||(c=this.objects.indexOf(b),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,e){this.color=new THREE.Color(b);this.near=c||1;this.far=e||1E3};THREE.FogExp2=function(b,c){this.color=new THREE.Color(b);this.density=c!==void 0?c:2.5E-4};
-THREE.Projector=function(){function b(){var b=n[m]=n[m]||new THREE.RenderableVertex;m++;return b}function c(b,e){return e.z-b.z}function e(b,e){var c=0,f=1,h=b.z+b.w,g=e.z+e.w,k=-b.z+b.w,m=-e.z+e.w;return h>=0&&g>=0&&k>=0&&m>=0?!0:h<0&&g<0||k<0&&m<0?!1:(h<0?c=Math.max(c,h/(h-g)):g<0&&(f=Math.min(f,h/(h-g))),k<0?c=Math.max(c,k/(k-m)):m<0&&(f=Math.min(f,k/(k-m))),f<c?!1:(b.lerpSelf(e,c),e.lerpSelf(b,1-f),!0))}var f,g,h=[],k,m,n=[],o,p,t=[],v,u=[],w,E,H=[],B,K,A=[],I=new THREE.Vector4,G=new THREE.Vector4,
+THREE.Projector=function(){function b(){var b=n[m]=n[m]||new THREE.RenderableVertex;m++;return b}function c(b,e){return e.z-b.z}function e(b,e){var c=0,f=1,j=b.z+b.w,g=e.z+e.w,k=-b.z+b.w,m=-e.z+e.w;return j>=0&&g>=0&&k>=0&&m>=0?!0:j<0&&g<0||k<0&&m<0?!1:(j<0?c=Math.max(c,j/(j-g)):g<0&&(f=Math.min(f,j/(j-g))),k<0?c=Math.max(c,k/(k-m)):m<0&&(f=Math.min(f,k/(k-m))),f<c?!1:(b.lerpSelf(e,c),e.lerpSelf(b,1-f),!0))}var f,g,j=[],k,m,n=[],o,p,t=[],u,v=[],w,E,I=[],B,H,A=[],K=new THREE.Vector4,G=new THREE.Vector4,
 C=new THREE.Matrix4,R=new THREE.Matrix4,D=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],N=new THREE.Vector4,J=new THREE.Vector4;this.projectVector=function(b,e){C.multiply(e.projectionMatrix,e.matrixWorldInverse);C.multiplyVector3(b);return b};this.unprojectVector=function(b,e){C.multiply(e.matrixWorld,THREE.Matrix4.makeInvert(e.projectionMatrix));C.multiplyVector3(b);return b};this.projectObjects=function(b,e,k){var e=[],m,n,o;g=0;n=
-b.objects;b=0;for(m=n.length;b<m;b++){o=n[b];var p;if(!(p=!o.visible))if(p=o instanceof THREE.Mesh){a:{p=void 0;for(var t=o.matrixWorld,v=-o.geometry.boundingSphere.radius*Math.max(o.scale.x,Math.max(o.scale.y,o.scale.z)),u=0;u<6;u++)if(p=D[u].x*t.n14+D[u].y*t.n24+D[u].z*t.n34+D[u].w,p<=v){p=!1;break a}p=!0}p=!p}if(!p)p=h[g]=h[g]||new THREE.RenderableObject,g++,f=p,I.copy(o.position),C.multiplyVector3(I),f.object=o,f.z=I.z,e.push(f)}k&&e.sort(c);return e};this.projectScene=function(f,j,h){var g=[],
-I=j.near,M=j.far,ca,U,S,ja,W,fa,Y,ga,ea,Q,T,Z,ka,na,aa,ma,ia;K=E=v=p=0;j.matrixAutoUpdate&&j.update(void 0,!0);f.update(void 0,!1,j);C.multiply(j.projectionMatrix,j.matrixWorldInverse);D[0].set(C.n41-C.n11,C.n42-C.n12,C.n43-C.n13,C.n44-C.n14);D[1].set(C.n41+C.n11,C.n42+C.n12,C.n43+C.n13,C.n44+C.n14);D[2].set(C.n41+C.n21,C.n42+C.n22,C.n43+C.n23,C.n44+C.n24);D[3].set(C.n41-C.n21,C.n42-C.n22,C.n43-C.n23,C.n44-C.n24);D[4].set(C.n41-C.n31,C.n42-C.n32,C.n43-C.n33,C.n44-C.n34);D[5].set(C.n41+C.n31,C.n42+
-C.n32,C.n43+C.n33,C.n44+C.n34);for(ca=0;ca<6;ca++)ea=D[ca],ea.divideScalar(Math.sqrt(ea.x*ea.x+ea.y*ea.y+ea.z*ea.z));ea=this.projectObjects(f,j,!0);f=0;for(ca=ea.length;f<ca;f++)if(Q=ea[f].object,Q.visible)if(T=Q.matrixWorld,Z=Q.matrixRotationWorld,ka=Q.materials,na=Q.overdraw,m=0,Q instanceof THREE.Mesh){aa=Q.geometry;ja=aa.vertices;ma=aa.faces;aa=aa.faceVertexUvs;U=0;for(S=ja.length;U<S;U++)k=b(),k.positionWorld.copy(ja[U].position),T.multiplyVector3(k.positionWorld),k.positionScreen.copy(k.positionWorld),
-C.multiplyVector4(k.positionScreen),k.positionScreen.x/=k.positionScreen.w,k.positionScreen.y/=k.positionScreen.w,k.visible=k.positionScreen.z>I&&k.positionScreen.z<M;ja=0;for(U=ma.length;ja<U;ja++){S=ma[ja];if(S instanceof THREE.Face3)if(W=n[S.a],fa=n[S.b],Y=n[S.c],W.visible&&fa.visible&&Y.visible&&(Q.doubleSided||Q.flipSided!=(Y.positionScreen.x-W.positionScreen.x)*(fa.positionScreen.y-W.positionScreen.y)-(Y.positionScreen.y-W.positionScreen.y)*(fa.positionScreen.x-W.positionScreen.x)<0))ga=t[p]=
-t[p]||new THREE.RenderableFace3,p++,o=ga,o.v1.copy(W),o.v2.copy(fa),o.v3.copy(Y);else continue;else if(S instanceof THREE.Face4)if(W=n[S.a],fa=n[S.b],Y=n[S.c],ga=n[S.d],W.visible&&fa.visible&&Y.visible&&ga.visible&&(Q.doubleSided||Q.flipSided!=((ga.positionScreen.x-W.positionScreen.x)*(fa.positionScreen.y-W.positionScreen.y)-(ga.positionScreen.y-W.positionScreen.y)*(fa.positionScreen.x-W.positionScreen.x)<0||(fa.positionScreen.x-Y.positionScreen.x)*(ga.positionScreen.y-Y.positionScreen.y)-(fa.positionScreen.y-
-Y.positionScreen.y)*(ga.positionScreen.x-Y.positionScreen.x)<0)))ia=u[v]=u[v]||new THREE.RenderableFace4,v++,o=ia,o.v1.copy(W),o.v2.copy(fa),o.v3.copy(Y),o.v4.copy(ga);else continue;o.normalWorld.copy(S.normal);Z.multiplyVector3(o.normalWorld);o.centroidWorld.copy(S.centroid);T.multiplyVector3(o.centroidWorld);o.centroidScreen.copy(o.centroidWorld);C.multiplyVector3(o.centroidScreen);Y=S.vertexNormals;W=0;for(fa=Y.length;W<fa;W++)ga=o.vertexNormalsWorld[W],ga.copy(Y[W]),Z.multiplyVector3(ga);W=0;
-for(fa=aa.length;W<fa;W++)if(ia=aa[W][ja]){Y=0;for(ga=ia.length;Y<ga;Y++)o.uvs[W][Y]=ia[Y]}o.meshMaterials=ka;o.faceMaterials=S.materials;o.overdraw=na;o.z=o.centroidScreen.z;g.push(o)}}else if(Q instanceof THREE.Line){R.multiply(C,T);ja=Q.geometry.vertices;W=b();W.positionScreen.copy(ja[0].position);R.multiplyVector4(W.positionScreen);U=1;for(S=ja.length;U<S;U++)if(W=b(),W.positionScreen.copy(ja[U].position),R.multiplyVector4(W.positionScreen),fa=n[m-2],N.copy(W.positionScreen),J.copy(fa.positionScreen),
-e(N,J))N.multiplyScalar(1/N.w),J.multiplyScalar(1/J.w),T=H[E]=H[E]||new THREE.RenderableLine,E++,w=T,w.v1.positionScreen.copy(N),w.v2.positionScreen.copy(J),w.z=Math.max(N.z,J.z),w.materials=Q.materials,g.push(w)}else if(Q instanceof THREE.Particle&&(G.set(Q.matrixWorld.n14,Q.matrixWorld.n24,Q.matrixWorld.n34,1),C.multiplyVector4(G),G.z/=G.w,G.z>0&&G.z<1))T=A[K]=A[K]||new THREE.RenderableParticle,K++,B=T,B.x=G.x/G.w,B.y=G.y/G.w,B.z=G.z,B.rotation=Q.rotation.z,B.scale.x=Q.scale.x*Math.abs(B.x-(G.x+
-j.projectionMatrix.n11)/(G.w+j.projectionMatrix.n14)),B.scale.y=Q.scale.y*Math.abs(B.y-(G.y+j.projectionMatrix.n22)/(G.w+j.projectionMatrix.n24)),B.materials=Q.materials,g.push(B);h&&g.sort(c);return g}};
-THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,c=new THREE.Projector,e,f,g,h;this.domElement=document.createElement("div");this.setSize=function(b,c){e=b;f=c;g=e/2;h=f/2};this.render=function(e,f){var n,o,p,t,v,u,w,E;b=c.projectScene(e,f);n=0;for(o=b.length;n<o;n++)if(v=b[n],v instanceof THREE.RenderableParticle){w=v.x*g+g;E=v.y*h+h;p=0;for(t=v.material.length;p<t;p++)if(u=v.material[p],u instanceof THREE.ParticleDOMMaterial)u=u.domElement,u.style.left=w+"px",u.style.top=E+"px"}}};
-THREE.CanvasRenderer=function(b){function c(b){if(B!=b)w.globalAlpha=B=b}function e(b){if(K!=b){switch(b){case THREE.NormalBlending:w.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:w.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:w.globalCompositeOperation="darker"}K=b}}function f(b){if(A!=b.hex)A=b.hex,w.strokeStyle="#"+h(A.toString(16))}function g(b){if(I!=b.hex)I=b.hex,w.fillStyle="#"+h(I.toString(16))}function h(b){for(;b.length<6;)b="0"+b;return b}
-var k=this,m=null,n=new THREE.Projector,b=b||{},o=b.canvas!==void 0?b.canvas:document.createElement("canvas"),p,t,v,u,w=o.getContext("2d"),E=new THREE.Color(0),H=0,B=1,K=0,A=null,I=null,G=null,C=null,R=null,D,N,J,V,j=new THREE.RenderableVertex,X=new THREE.RenderableVertex,O,$,M,ca,U,S,ja,W,fa,Y,ga,ea,Q=new THREE.Color(0),T=new THREE.Color(0),Z=new THREE.Color(0),ka=new THREE.Color(0),na=new THREE.Color(0),aa,ma,ia,pa,la,Ba,ya,da,P,za,ta=new THREE.Rectangle,ha=new THREE.Rectangle,sa=new THREE.Rectangle,
-Va=!1,va=new THREE.Color,ua=new THREE.Color,Pa=new THREE.Color,Qa=new THREE.Color,qa=new THREE.Vector3,Ma,Na,Wa,wa,Oa,Ra,b=16;Ma=document.createElement("canvas");Ma.width=Ma.height=2;Na=Ma.getContext("2d");Na.fillStyle="rgba(0,0,0,1)";Na.fillRect(0,0,2,2);Wa=Na.getImageData(0,0,2,2);wa=Wa.data;Oa=document.createElement("canvas");Oa.width=Oa.height=b;Ra=Oa.getContext("2d");Ra.translate(-b/2,-b/2);Ra.scale(b,b);b--;this.domElement=o;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,
-faces:0};this.setSize=function(b,e){p=b;t=e;v=p/2;u=t/2;o.width=p;o.height=t;ta.set(-v,-u,v,u);B=1;K=0;R=C=G=I=A=null};this.setClearColor=function(b,e){E=b;H=e};this.setClearColorHex=function(b,e){E.setHex(b);H=e};this.clear=function(){w.setTransform(1,0,0,-1,v,u);if(!ha.isEmpty())ha.inflate(1),ha.minSelf(ta),E.hex==0&&H==0?w.clearRect(ha.getX(),ha.getY(),ha.getWidth(),ha.getHeight()):(e(THREE.NormalBlending),c(1),w.fillStyle="rgba("+Math.floor(E.r*255)+","+Math.floor(E.g*255)+","+Math.floor(E.b*
-255)+","+H+")",w.fillRect(ha.getX(),ha.getY(),ha.getWidth(),ha.getHeight())),ha.empty()};this.render=function(b,h){function o(b){var e,c,f,j=b.lights;ua.setRGB(0,0,0);Pa.setRGB(0,0,0);Qa.setRGB(0,0,0);b=0;for(e=j.length;b<e;b++)c=j[b],f=c.color,c instanceof THREE.AmbientLight?(ua.r+=f.r,ua.g+=f.g,ua.b+=f.b):c instanceof THREE.DirectionalLight?(Pa.r+=f.r,Pa.g+=f.g,Pa.b+=f.b):c instanceof THREE.PointLight&&(Qa.r+=f.r,Qa.g+=f.g,Qa.b+=f.b)}function p(b,e,c,f){var j,h,g,k,m=b.lights,b=0;for(j=m.length;b<
-j;b++)h=m[b],g=h.color,h instanceof THREE.DirectionalLight?(k=c.dot(h.position),k<=0||(k*=h.intensity,f.r+=g.r*k,f.g+=g.g*k,f.b+=g.b*k)):h instanceof THREE.PointLight&&(k=c.dot(qa.sub(h.position,e).normalize()),k<=0||(k*=h.distance==0?1:1-Math.min(e.distanceTo(h.position)/h.distance,1),k!=0&&(k*=h.intensity,f.r+=g.r*k,f.g+=g.g*k,f.b+=g.b*k)))}function t(b,j,h){c(h.opacity);e(h.blending);var k,m,ha,n,o,p;if(h instanceof THREE.ParticleBasicMaterial){if(h.map)n=h.map.image,o=n.width>>1,p=n.height>>1,
-h=j.scale.x*v,ha=j.scale.y*u,k=h*o,m=ha*p,sa.set(b.x-k,b.y-m,b.x+k,b.y+m),ta.instersects(sa)&&(w.save(),w.translate(b.x,b.y),w.rotate(-j.rotation),w.scale(h,-ha),w.translate(-o,-p),w.drawImage(n,0,0),w.restore())}else h instanceof THREE.ParticleCanvasMaterial&&(k=j.scale.x*v,m=j.scale.y*u,sa.set(b.x-k,b.y-m,b.x+k,b.y+m),ta.instersects(sa)&&(f(h.color),g(h.color),w.save(),w.translate(b.x,b.y),w.rotate(-j.rotation),w.scale(k,m),h.program(w),w.restore()))}function B(b,j,h,g){c(g.opacity);e(g.blending);
-w.beginPath();w.moveTo(b.positionScreen.x,b.positionScreen.y);w.lineTo(j.positionScreen.x,j.positionScreen.y);w.closePath();if(g instanceof THREE.LineBasicMaterial){b=g.linewidth;if(G!=b)w.lineWidth=G=b;b=g.linecap;if(C!=b)w.lineCap=C=b;b=g.linejoin;if(R!=b)w.lineJoin=R=b;f(g.color);w.stroke();sa.inflate(g.linewidth*2)}}function A(b,f,j,g,m,n,ha,o,t){k.data.vertices+=3;k.data.faces++;c(o.opacity);e(o.blending);O=b.positionScreen.x;$=b.positionScreen.y;M=f.positionScreen.x;ca=f.positionScreen.y;U=
-j.positionScreen.x;S=j.positionScreen.y;H(O,$,M,ca,U,S);if(o instanceof THREE.MeshBasicMaterial)if(o.map)o.map.mapping instanceof THREE.UVMapping&&(pa=ha.uvs[0],z(O,$,M,ca,U,S,o.map.image,pa[g].u,pa[g].v,pa[m].u,pa[m].v,pa[n].u,pa[n].v));else if(o.envMap){if(o.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=h.matrixWorldInverse,qa.copy(ha.vertexNormalsWorld[0]),la=(qa.x*b.n11+qa.y*b.n12+qa.z*b.n13)*0.5+0.5,Ba=-(qa.x*b.n21+qa.y*b.n22+qa.z*b.n23)*0.5+0.5,qa.copy(ha.vertexNormalsWorld[1]),
-ya=(qa.x*b.n11+qa.y*b.n12+qa.z*b.n13)*0.5+0.5,da=-(qa.x*b.n21+qa.y*b.n22+qa.z*b.n23)*0.5+0.5,qa.copy(ha.vertexNormalsWorld[2]),P=(qa.x*b.n11+qa.y*b.n12+qa.z*b.n13)*0.5+0.5,za=-(qa.x*b.n21+qa.y*b.n22+qa.z*b.n23)*0.5+0.5,z(O,$,M,ca,U,S,o.envMap.image,la,Ba,ya,da,P,za)}else o.wireframe?F(o.color,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):I(o.color);else if(o instanceof THREE.MeshLambertMaterial)o.map&&!o.wireframe&&(o.map.mapping instanceof THREE.UVMapping&&(pa=ha.uvs[0],z(O,$,M,ca,
-U,S,o.map.image,pa[g].u,pa[g].v,pa[m].u,pa[m].v,pa[n].u,pa[n].v)),e(THREE.SubtractiveBlending)),Va?!o.wireframe&&o.shading==THREE.SmoothShading&&ha.vertexNormalsWorld.length==3?(T.r=Z.r=ka.r=ua.r,T.g=Z.g=ka.g=ua.g,T.b=Z.b=ka.b=ua.b,p(t,ha.v1.positionWorld,ha.vertexNormalsWorld[0],T),p(t,ha.v2.positionWorld,ha.vertexNormalsWorld[1],Z),p(t,ha.v3.positionWorld,ha.vertexNormalsWorld[2],ka),na.r=(Z.r+ka.r)*0.5,na.g=(Z.g+ka.g)*0.5,na.b=(Z.b+ka.b)*0.5,ia=Sa(T,Z,ka,na),z(O,$,M,ca,U,S,ia,0,0,1,0,0,1)):(va.r=
-ua.r,va.g=ua.g,va.b=ua.b,p(t,ha.centroidWorld,ha.normalWorld,va),Q.r=Math.max(0,Math.min(o.color.r*va.r,1)),Q.g=Math.max(0,Math.min(o.color.g*va.g,1)),Q.b=Math.max(0,Math.min(o.color.b*va.b,1)),Q.updateHex(),o.wireframe?F(Q,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):I(Q)):o.wireframe?F(o.color,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):I(o.color);else if(o instanceof THREE.MeshDepthMaterial)aa=h.near,ma=h.far,T.r=T.g=T.b=1-Fa(b.positionScreen.z,aa,ma),Z.r=Z.g=Z.b=
-1-Fa(f.positionScreen.z,aa,ma),ka.r=ka.g=ka.b=1-Fa(j.positionScreen.z,aa,ma),na.r=(Z.r+ka.r)*0.5,na.g=(Z.g+ka.g)*0.5,na.b=(Z.b+ka.b)*0.5,ia=Sa(T,Z,ka,na),z(O,$,M,ca,U,S,ia,0,0,1,0,0,1);else if(o instanceof THREE.MeshNormalMaterial)Q.r=Ka(ha.normalWorld.x),Q.g=Ka(ha.normalWorld.y),Q.b=Ka(ha.normalWorld.z),Q.updateHex(),o.wireframe?F(Q,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):I(Q)}function E(b,f,j,g,m,ha,n,o,t){k.data.vertices+=4;k.data.faces++;c(o.opacity);e(o.blending);if(o.map||
-o.envMap)A(b,f,g,0,1,3,n,o,t),A(m,j,ha,1,2,3,n,o,t);else if(O=b.positionScreen.x,$=b.positionScreen.y,M=f.positionScreen.x,ca=f.positionScreen.y,U=j.positionScreen.x,S=j.positionScreen.y,ja=g.positionScreen.x,W=g.positionScreen.y,fa=m.positionScreen.x,Y=m.positionScreen.y,ga=ha.positionScreen.x,ea=ha.positionScreen.y,o instanceof THREE.MeshBasicMaterial)K(O,$,M,ca,U,S,ja,W),o.wireframe?F(o.color,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):I(o.color);else if(o instanceof THREE.MeshLambertMaterial)Va?
-!o.wireframe&&o.shading==THREE.SmoothShading&&n.vertexNormalsWorld.length==4?(T.r=Z.r=ka.r=na.r=ua.r,T.g=Z.g=ka.g=na.g=ua.g,T.b=Z.b=ka.b=na.b=ua.b,p(t,n.v1.positionWorld,n.vertexNormalsWorld[0],T),p(t,n.v2.positionWorld,n.vertexNormalsWorld[1],Z),p(t,n.v4.positionWorld,n.vertexNormalsWorld[3],ka),p(t,n.v3.positionWorld,n.vertexNormalsWorld[2],na),ia=Sa(T,Z,ka,na),H(O,$,M,ca,ja,W),z(O,$,M,ca,ja,W,ia,0,0,1,0,0,1),H(fa,Y,U,S,ga,ea),z(fa,Y,U,S,ga,ea,ia,1,0,1,1,0,1)):(va.r=ua.r,va.g=ua.g,va.b=ua.b,p(t,
-n.centroidWorld,n.normalWorld,va),Q.r=Math.max(0,Math.min(o.color.r*va.r,1)),Q.g=Math.max(0,Math.min(o.color.g*va.g,1)),Q.b=Math.max(0,Math.min(o.color.b*va.b,1)),Q.updateHex(),K(O,$,M,ca,U,S,ja,W),o.wireframe?F(Q,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):I(Q)):(K(O,$,M,ca,U,S,ja,W),o.wireframe?F(o.color,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):I(o.color));else if(o instanceof THREE.MeshNormalMaterial)Q.r=Ka(n.normalWorld.x),Q.g=Ka(n.normalWorld.y),Q.b=Ka(n.normalWorld.z),
-Q.updateHex(),K(O,$,M,ca,U,S,ja,W),o.wireframe?F(Q,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):I(Q);else if(o instanceof THREE.MeshDepthMaterial)aa=h.near,ma=h.far,T.r=T.g=T.b=1-Fa(b.positionScreen.z,aa,ma),Z.r=Z.g=Z.b=1-Fa(f.positionScreen.z,aa,ma),ka.r=ka.g=ka.b=1-Fa(g.positionScreen.z,aa,ma),na.r=na.g=na.b=1-Fa(j.positionScreen.z,aa,ma),ia=Sa(T,Z,ka,na),H(O,$,M,ca,ja,W),z(O,$,M,ca,ja,W,ia,0,0,1,0,0,1),H(fa,Y,U,S,ga,ea),z(fa,Y,U,S,ga,ea,ia,1,0,1,1,0,1)}function H(b,e,c,f,j,h){w.beginPath();
-w.moveTo(b,e);w.lineTo(c,f);w.lineTo(j,h);w.lineTo(b,e);w.closePath()}function K(b,e,c,f,j,h,g,k){w.beginPath();w.moveTo(b,e);w.lineTo(c,f);w.lineTo(j,h);w.lineTo(g,k);w.lineTo(b,e);w.closePath()}function F(b,e,c,j){if(G!=e)w.lineWidth=G=e;if(C!=c)w.lineCap=C=c;if(R!=j)w.lineJoin=R=j;f(b);w.stroke();sa.inflate(e*2)}function I(b){g(b);w.fill()}function z(b,e,c,f,j,h,g,k,m,o,n,ha,p){var t,u;t=g.width-1;u=g.height-1;k*=t;m*=u;o*=t;n*=u;ha*=t;p*=u;c-=b;f-=e;j-=b;h-=e;o-=k;n-=m;ha-=k;p-=m;t=o*p-ha*n;t!=
-0&&(u=1/t,t=(p*c-n*j)*u,n=(p*f-n*h)*u,c=(o*j-ha*c)*u,f=(o*h-ha*f)*u,b=b-t*k-c*m,e=e-n*k-f*m,w.save(),w.transform(t,n,c,f,b,e),w.clip(),w.drawImage(g,0,0),w.restore())}function Sa(b,e,c,f){var j=~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),g=~~(e.r*255),k=~~(e.g*255),e=~~(e.b*255),m=~~(c.r*255),o=~~(c.g*255),c=~~(c.b*255),n=~~(f.r*255),ha=~~(f.g*255),f=~~(f.b*255);wa[0]=j<0?0:j>255?255:j;wa[1]=h<0?0:h>255?255:h;wa[2]=b<0?0:b>255?255:b;wa[4]=g<0?0:g>255?255:g;wa[5]=k<0?0:k>255?255:k;wa[6]=e<0?0:e>255?255:
-e;wa[8]=m<0?0:m>255?255:m;wa[9]=o<0?0:o>255?255:o;wa[10]=c<0?0:c>255?255:c;wa[12]=n<0?0:n>255?255:n;wa[13]=ha<0?0:ha>255?255:ha;wa[14]=f<0?0:f>255?255:f;Na.putImageData(Wa,0,0);Ra.drawImage(Ma,0,0);return Oa}function Fa(b,e,c){b=(b-e)/(c-e);return b*b*(3-2*b)}function Ka(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function Ca(b,e){var c=e.x-b.x,f=e.y-b.y,j=1/Math.sqrt(c*c+f*f);c*=j;f*=j;e.x+=c;e.y+=f;b.x-=c;b.y-=f}var Ta,$a,oa,xa,Da,La,Ua,L;this.autoClear?this.clear():w.setTransform(1,0,0,-1,v,u);k.data.vertices=
-0;k.data.faces=0;m=n.projectScene(b,h,this.sortElements);(Va=b.lights.length>0)&&o(b);Ta=0;for($a=m.length;Ta<$a;Ta++){oa=m[Ta];sa.empty();if(oa instanceof THREE.RenderableParticle){D=oa;D.x*=v;D.y*=u;xa=0;for(Da=oa.materials.length;xa<Da;)L=oa.materials[xa++],L.opacity!=0&&t(D,oa,L,b)}else if(oa instanceof THREE.RenderableLine){if(D=oa.v1,N=oa.v2,D.positionScreen.x*=v,D.positionScreen.y*=u,N.positionScreen.x*=v,N.positionScreen.y*=u,sa.addPoint(D.positionScreen.x,D.positionScreen.y),sa.addPoint(N.positionScreen.x,
-N.positionScreen.y),ta.instersects(sa)){xa=0;for(Da=oa.materials.length;xa<Da;)L=oa.materials[xa++],L.opacity!=0&&B(D,N,oa,L,b)}}else if(oa instanceof THREE.RenderableFace3){if(D=oa.v1,N=oa.v2,J=oa.v3,D.positionScreen.x*=v,D.positionScreen.y*=u,N.positionScreen.x*=v,N.positionScreen.y*=u,J.positionScreen.x*=v,J.positionScreen.y*=u,oa.overdraw&&(Ca(D.positionScreen,N.positionScreen),Ca(N.positionScreen,J.positionScreen),Ca(J.positionScreen,D.positionScreen)),sa.add3Points(D.positionScreen.x,D.positionScreen.y,
-N.positionScreen.x,N.positionScreen.y,J.positionScreen.x,J.positionScreen.y),ta.instersects(sa)){xa=0;for(Da=oa.meshMaterials.length;xa<Da;)if(L=oa.meshMaterials[xa++],L instanceof THREE.MeshFaceMaterial){La=0;for(Ua=oa.faceMaterials.length;La<Ua;)(L=oa.faceMaterials[La++])&&L.opacity!=0&&A(D,N,J,0,1,2,oa,L,b)}else L.opacity!=0&&A(D,N,J,0,1,2,oa,L,b)}}else if(oa instanceof THREE.RenderableFace4&&(D=oa.v1,N=oa.v2,J=oa.v3,V=oa.v4,D.positionScreen.x*=v,D.positionScreen.y*=u,N.positionScreen.x*=v,N.positionScreen.y*=
-u,J.positionScreen.x*=v,J.positionScreen.y*=u,V.positionScreen.x*=v,V.positionScreen.y*=u,j.positionScreen.copy(N.positionScreen),X.positionScreen.copy(V.positionScreen),oa.overdraw&&(Ca(D.positionScreen,N.positionScreen),Ca(N.positionScreen,V.positionScreen),Ca(V.positionScreen,D.positionScreen),Ca(J.positionScreen,j.positionScreen),Ca(J.positionScreen,X.positionScreen)),sa.addPoint(D.positionScreen.x,D.positionScreen.y),sa.addPoint(N.positionScreen.x,N.positionScreen.y),sa.addPoint(J.positionScreen.x,
-J.positionScreen.y),sa.addPoint(V.positionScreen.x,V.positionScreen.y),ta.instersects(sa))){xa=0;for(Da=oa.meshMaterials.length;xa<Da;)if(L=oa.meshMaterials[xa++],L instanceof THREE.MeshFaceMaterial){La=0;for(Ua=oa.faceMaterials.length;La<Ua;)(L=oa.faceMaterials[La++])&&L.opacity!=0&&E(D,N,J,V,j,X,oa,L,b)}else L.opacity!=0&&E(D,N,J,V,j,X,oa,L,b)}ha.addRectangle(sa)}w.setTransform(1,0,0,1,0,0)}};
-THREE.SVGRenderer=function(){function b(b,e,c){var f,j,h,g;f=0;for(j=b.lights.length;f<j;f++)h=b.lights[f],h instanceof THREE.DirectionalLight?(g=e.normalWorld.dot(h.position)*h.intensity,g>0&&(c.r+=h.color.r*g,c.g+=h.color.g*g,c.b+=h.color.b*g)):h instanceof THREE.PointLight&&(V.sub(h.position,e.centroidWorld),V.normalize(),g=e.normalWorld.dot(V)*h.intensity,g>0&&(c.r+=h.color.r*g,c.g+=h.color.g*g,c.b+=h.color.b*g))}function c(e,c,j,m,n,p){k.data.vertices+=3;k.data.faces++;O=f($++);O.setAttribute("d",
-"M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+j.positionScreen.x+","+j.positionScreen.y+"z");n instanceof THREE.MeshBasicMaterial?G.hex=n.color.hex:n instanceof THREE.MeshLambertMaterial?I?(C.r=R.r,C.g=R.g,C.b=R.b,b(p,m,C),G.r=Math.max(0,Math.min(n.color.r*C.r,1)),G.g=Math.max(0,Math.min(n.color.g*C.g,1)),G.b=Math.max(0,Math.min(n.color.b*C.b,1)),G.updateHex()):G.hex=n.color.hex:n instanceof THREE.MeshDepthMaterial?(J=1-n.__2near/(n.__farPlusNear-
-m.z*n.__farMinusNear),G.setRGB(J,J,J)):n instanceof THREE.MeshNormalMaterial&&G.setRGB(g(m.normalWorld.x),g(m.normalWorld.y),g(m.normalWorld.z));n.wireframe?O.setAttribute("style","fill: none; stroke: #"+h(G.hex.toString(16))+"; stroke-width: "+n.wireframeLinewidth+"; stroke-opacity: "+n.opacity+"; stroke-linecap: "+n.wireframeLinecap+"; stroke-linejoin: "+n.wireframeLinejoin):O.setAttribute("style","fill: #"+h(G.hex.toString(16))+"; fill-opacity: "+n.opacity);o.appendChild(O)}function e(e,c,j,m,
-n,p,t){k.data.vertices+=4;k.data.faces++;O=f($++);O.setAttribute("d","M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+j.positionScreen.x+","+j.positionScreen.y+" L "+m.positionScreen.x+","+m.positionScreen.y+"z");p instanceof THREE.MeshBasicMaterial?G.hex=p.color.hex:p instanceof THREE.MeshLambertMaterial?I?(C.r=R.r,C.g=R.g,C.b=R.b,b(t,n,C),G.r=Math.max(0,Math.min(p.color.r*C.r,1)),G.g=Math.max(0,Math.min(p.color.g*C.g,1)),G.b=Math.max(0,Math.min(p.color.b*
-C.b,1)),G.updateHex()):G.hex=p.color.hex:p instanceof THREE.MeshDepthMaterial?(J=1-p.__2near/(p.__farPlusNear-n.z*p.__farMinusNear),G.setRGB(J,J,J)):p instanceof THREE.MeshNormalMaterial&&G.setRGB(g(n.normalWorld.x),g(n.normalWorld.y),g(n.normalWorld.z));p.wireframe?O.setAttribute("style","fill: none; stroke: #"+h(G.hex.toString(16))+"; stroke-width: "+p.wireframeLinewidth+"; stroke-opacity: "+p.opacity+"; stroke-linecap: "+p.wireframeLinecap+"; stroke-linejoin: "+p.wireframeLinejoin):O.setAttribute("style",
-"fill: #"+h(G.hex.toString(16))+"; fill-opacity: "+p.opacity);o.appendChild(O)}function f(b){j[b]==null&&(j[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),ca==0&&j[b].setAttribute("shape-rendering","crispEdges"));return j[b]}function g(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function h(b){for(;b.length<6;)b="0"+b;return b}var k=this,m=null,n=new THREE.Projector,o=document.createElementNS("http://www.w3.org/2000/svg","svg"),p,t,v,u,w,E,H,B,K=new THREE.Rectangle,A=new THREE.Rectangle,
-I=!1,G=new THREE.Color(16777215),C=new THREE.Color(16777215),R=new THREE.Color(0),D=new THREE.Color(0),N=new THREE.Color(0),J,V=new THREE.Vector3,j=[],X=[],O,$,M,ca=1;this.domElement=o;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,faces:0};this.setQuality=function(b){switch(b){case "high":ca=1;break;case "low":ca=0}};this.setSize=function(b,e){p=b;t=e;v=p/2;u=t/2;o.setAttribute("viewBox",-v+" "+-u+" "+p+" "+t);o.setAttribute("width",p);o.setAttribute("height",t);K.set(-v,
--u,v,u)};this.clear=function(){for(;o.childNodes.length>0;)o.removeChild(o.childNodes[0])};this.render=function(b,f){var j,g,p,t,C,G,J,T;this.autoClear&&this.clear();k.data.vertices=0;k.data.faces=0;m=n.projectScene(b,f,this.sortElements);M=$=0;if(I=b.lights.length>0){J=b.lights;R.setRGB(0,0,0);D.setRGB(0,0,0);N.setRGB(0,0,0);j=0;for(g=J.length;j<g;j++)p=J[j],t=p.color,p instanceof THREE.AmbientLight?(R.r+=t.r,R.g+=t.g,R.b+=t.b):p instanceof THREE.DirectionalLight?(D.r+=t.r,D.g+=t.g,D.b+=t.b):p instanceof
-THREE.PointLight&&(N.r+=t.r,N.g+=t.g,N.b+=t.b)}j=0;for(g=m.length;j<g;j++)if(J=m[j],A.empty(),J instanceof THREE.RenderableParticle){w=J;w.x*=v;w.y*=-u;p=0;for(t=J.materials.length;p<t;)p++}else if(J instanceof THREE.RenderableLine){if(w=J.v1,E=J.v2,w.positionScreen.x*=v,w.positionScreen.y*=-u,E.positionScreen.x*=v,E.positionScreen.y*=-u,A.addPoint(w.positionScreen.x,w.positionScreen.y),A.addPoint(E.positionScreen.x,E.positionScreen.y),K.instersects(A)){p=0;for(t=J.materials.length;p<t;)if((T=J.materials[p++])&&
-T.opacity!=0){C=w;G=E;var V=M++;X[V]==null&&(X[V]=document.createElementNS("http://www.w3.org/2000/svg","line"),ca==0&&X[V].setAttribute("shape-rendering","crispEdges"));O=X[V];O.setAttribute("x1",C.positionScreen.x);O.setAttribute("y1",C.positionScreen.y);O.setAttribute("x2",G.positionScreen.x);O.setAttribute("y2",G.positionScreen.y);T instanceof THREE.LineBasicMaterial&&(O.setAttribute("style","fill: none; stroke: ##"+h(T.color.hex.toString(16))+"; stroke-width: "+T.linewidth+"; stroke-opacity: "+
-T.opacity+"; stroke-linecap: "+T.linecap+"; stroke-linejoin: "+T.linejoin),o.appendChild(O))}}}else if(J instanceof THREE.RenderableFace3){if(w=J.v1,E=J.v2,H=J.v3,w.positionScreen.x*=v,w.positionScreen.y*=-u,E.positionScreen.x*=v,E.positionScreen.y*=-u,H.positionScreen.x*=v,H.positionScreen.y*=-u,A.addPoint(w.positionScreen.x,w.positionScreen.y),A.addPoint(E.positionScreen.x,E.positionScreen.y),A.addPoint(H.positionScreen.x,H.positionScreen.y),K.instersects(A)){p=0;for(t=J.meshMaterials.length;p<
-t;)if(T=J.meshMaterials[p++],T instanceof THREE.MeshFaceMaterial){C=0;for(G=J.faceMaterials.length;C<G;)(T=J.faceMaterials[C++])&&T.opacity!=0&&c(w,E,H,J,T,b)}else T&&T.opacity!=0&&c(w,E,H,J,T,b)}}else if(J instanceof THREE.RenderableFace4&&(w=J.v1,E=J.v2,H=J.v3,B=J.v4,w.positionScreen.x*=v,w.positionScreen.y*=-u,E.positionScreen.x*=v,E.positionScreen.y*=-u,H.positionScreen.x*=v,H.positionScreen.y*=-u,B.positionScreen.x*=v,B.positionScreen.y*=-u,A.addPoint(w.positionScreen.x,w.positionScreen.y),A.addPoint(E.positionScreen.x,
-E.positionScreen.y),A.addPoint(H.positionScreen.x,H.positionScreen.y),A.addPoint(B.positionScreen.x,B.positionScreen.y),K.instersects(A))){p=0;for(t=J.meshMaterials.length;p<t;)if(T=J.meshMaterials[p++],T instanceof THREE.MeshFaceMaterial){C=0;for(G=J.faceMaterials.length;C<G;)(T=J.faceMaterials[C++])&&T.opacity!=0&&e(w,E,H,B,J,T,b)}else T&&T.opacity!=0&&e(w,E,H,B,J,T,b)}}};
+b.objects;b=0;for(m=n.length;b<m;b++){o=n[b];var t;if(!(t=!o.visible))if(t=o instanceof THREE.Mesh){a:{t=void 0;for(var p=o.matrixWorld,v=-o.geometry.boundingSphere.radius*Math.max(o.scale.x,Math.max(o.scale.y,o.scale.z)),u=0;u<6;u++)if(t=D[u].x*p.n14+D[u].y*p.n24+D[u].z*p.n34+D[u].w,t<=v){t=!1;break a}t=!0}t=!t}if(!t)t=j[g]=j[g]||new THREE.RenderableObject,g++,f=t,K.copy(o.position),C.multiplyVector3(K),f.object=o,f.z=K.z,e.push(f)}k&&e.sort(c);return e};this.projectScene=function(f,h,j){var g=[],
+K=h.near,M=h.far,ca,U,S,ja,W,fa,Y,ha,ea,Q,T,Z,ka,na,aa,ma,ia;H=E=u=p=0;h.matrixAutoUpdate&&h.update(void 0,!0);f.update(void 0,!1,h);C.multiply(h.projectionMatrix,h.matrixWorldInverse);D[0].set(C.n41-C.n11,C.n42-C.n12,C.n43-C.n13,C.n44-C.n14);D[1].set(C.n41+C.n11,C.n42+C.n12,C.n43+C.n13,C.n44+C.n14);D[2].set(C.n41+C.n21,C.n42+C.n22,C.n43+C.n23,C.n44+C.n24);D[3].set(C.n41-C.n21,C.n42-C.n22,C.n43-C.n23,C.n44-C.n24);D[4].set(C.n41-C.n31,C.n42-C.n32,C.n43-C.n33,C.n44-C.n34);D[5].set(C.n41+C.n31,C.n42+
+C.n32,C.n43+C.n33,C.n44+C.n34);for(ca=0;ca<6;ca++)ea=D[ca],ea.divideScalar(Math.sqrt(ea.x*ea.x+ea.y*ea.y+ea.z*ea.z));ea=this.projectObjects(f,h,!0);f=0;for(ca=ea.length;f<ca;f++)if(Q=ea[f].object,Q.visible)if(T=Q.matrixWorld,Z=Q.matrixRotationWorld,ka=Q.materials,na=Q.overdraw,m=0,Q instanceof THREE.Mesh){aa=Q.geometry;ja=aa.vertices;ma=aa.faces;aa=aa.faceVertexUvs;U=0;for(S=ja.length;U<S;U++)k=b(),k.positionWorld.copy(ja[U].position),T.multiplyVector3(k.positionWorld),k.positionScreen.copy(k.positionWorld),
+C.multiplyVector4(k.positionScreen),k.positionScreen.x/=k.positionScreen.w,k.positionScreen.y/=k.positionScreen.w,k.visible=k.positionScreen.z>K&&k.positionScreen.z<M;ja=0;for(U=ma.length;ja<U;ja++){S=ma[ja];if(S instanceof THREE.Face3)if(W=n[S.a],fa=n[S.b],Y=n[S.c],W.visible&&fa.visible&&Y.visible&&(Q.doubleSided||Q.flipSided!=(Y.positionScreen.x-W.positionScreen.x)*(fa.positionScreen.y-W.positionScreen.y)-(Y.positionScreen.y-W.positionScreen.y)*(fa.positionScreen.x-W.positionScreen.x)<0))ha=t[p]=
+t[p]||new THREE.RenderableFace3,p++,o=ha,o.v1.copy(W),o.v2.copy(fa),o.v3.copy(Y);else continue;else if(S instanceof THREE.Face4)if(W=n[S.a],fa=n[S.b],Y=n[S.c],ha=n[S.d],W.visible&&fa.visible&&Y.visible&&ha.visible&&(Q.doubleSided||Q.flipSided!=((ha.positionScreen.x-W.positionScreen.x)*(fa.positionScreen.y-W.positionScreen.y)-(ha.positionScreen.y-W.positionScreen.y)*(fa.positionScreen.x-W.positionScreen.x)<0||(fa.positionScreen.x-Y.positionScreen.x)*(ha.positionScreen.y-Y.positionScreen.y)-(fa.positionScreen.y-
+Y.positionScreen.y)*(ha.positionScreen.x-Y.positionScreen.x)<0)))ia=v[u]=v[u]||new THREE.RenderableFace4,u++,o=ia,o.v1.copy(W),o.v2.copy(fa),o.v3.copy(Y),o.v4.copy(ha);else continue;o.normalWorld.copy(S.normal);Z.multiplyVector3(o.normalWorld);o.centroidWorld.copy(S.centroid);T.multiplyVector3(o.centroidWorld);o.centroidScreen.copy(o.centroidWorld);C.multiplyVector3(o.centroidScreen);Y=S.vertexNormals;W=0;for(fa=Y.length;W<fa;W++)ha=o.vertexNormalsWorld[W],ha.copy(Y[W]),Z.multiplyVector3(ha);W=0;
+for(fa=aa.length;W<fa;W++)if(ia=aa[W][ja]){Y=0;for(ha=ia.length;Y<ha;Y++)o.uvs[W][Y]=ia[Y]}o.meshMaterials=ka;o.faceMaterials=S.materials;o.overdraw=na;o.z=o.centroidScreen.z;g.push(o)}}else if(Q instanceof THREE.Line){R.multiply(C,T);ja=Q.geometry.vertices;W=b();W.positionScreen.copy(ja[0].position);R.multiplyVector4(W.positionScreen);U=1;for(S=ja.length;U<S;U++)if(W=b(),W.positionScreen.copy(ja[U].position),R.multiplyVector4(W.positionScreen),fa=n[m-2],N.copy(W.positionScreen),J.copy(fa.positionScreen),
+e(N,J))N.multiplyScalar(1/N.w),J.multiplyScalar(1/J.w),T=I[E]=I[E]||new THREE.RenderableLine,E++,w=T,w.v1.positionScreen.copy(N),w.v2.positionScreen.copy(J),w.z=Math.max(N.z,J.z),w.materials=Q.materials,g.push(w)}else if(Q instanceof THREE.Particle&&(G.set(Q.matrixWorld.n14,Q.matrixWorld.n24,Q.matrixWorld.n34,1),C.multiplyVector4(G),G.z/=G.w,G.z>0&&G.z<1))T=A[H]=A[H]||new THREE.RenderableParticle,H++,B=T,B.x=G.x/G.w,B.y=G.y/G.w,B.z=G.z,B.rotation=Q.rotation.z,B.scale.x=Q.scale.x*Math.abs(B.x-(G.x+
+h.projectionMatrix.n11)/(G.w+h.projectionMatrix.n14)),B.scale.y=Q.scale.y*Math.abs(B.y-(G.y+h.projectionMatrix.n22)/(G.w+h.projectionMatrix.n24)),B.materials=Q.materials,g.push(B);j&&g.sort(c);return g}};
+THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,c=new THREE.Projector,e,f,g,j;this.domElement=document.createElement("div");this.setSize=function(b,c){e=b;f=c;g=e/2;j=f/2};this.render=function(e,f){var n,o,p,t,u,v,w,E;b=c.projectScene(e,f);n=0;for(o=b.length;n<o;n++)if(u=b[n],u instanceof THREE.RenderableParticle){w=u.x*g+g;E=u.y*j+j;p=0;for(t=u.material.length;p<t;p++)if(v=u.material[p],v instanceof THREE.ParticleDOMMaterial)v=v.domElement,v.style.left=w+"px",v.style.top=E+"px"}}};
+THREE.CanvasRenderer=function(b){function c(b){if(B!=b)w.globalAlpha=B=b}function e(b){if(H!=b){switch(b){case THREE.NormalBlending:w.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:w.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:w.globalCompositeOperation="darker"}H=b}}function f(b){if(A!=b.hex)A=b.hex,w.strokeStyle="#"+j(A.toString(16))}function g(b){if(K!=b.hex)K=b.hex,w.fillStyle="#"+j(K.toString(16))}function j(b){for(;b.length<6;)b="0"+b;return b}
+var k=this,m=null,n=new THREE.Projector,b=b||{},o=b.canvas!==void 0?b.canvas:document.createElement("canvas"),p,t,u,v,w=o.getContext("2d"),E=new THREE.Color(0),I=0,B=1,H=0,A=null,K=null,G=null,C=null,R=null,D,N,J,V,h=new THREE.RenderableVertex,X=new THREE.RenderableVertex,O,$,M,ca,U,S,ja,W,fa,Y,ha,ea,Q=new THREE.Color(0),T=new THREE.Color(0),Z=new THREE.Color(0),ka=new THREE.Color(0),na=new THREE.Color(0),aa,ma,ia,pa,la,Ca,za,da,P,Aa,ta=new THREE.Rectangle,ga=new THREE.Rectangle,sa=new THREE.Rectangle,
+Wa=!1,va=new THREE.Color,ua=new THREE.Color,Qa=new THREE.Color,Ra=new THREE.Color,qa=new THREE.Vector3,Na,Oa,Xa,wa,Pa,Sa,b=16;Na=document.createElement("canvas");Na.width=Na.height=2;Oa=Na.getContext("2d");Oa.fillStyle="rgba(0,0,0,1)";Oa.fillRect(0,0,2,2);Xa=Oa.getImageData(0,0,2,2);wa=Xa.data;Pa=document.createElement("canvas");Pa.width=Pa.height=b;Sa=Pa.getContext("2d");Sa.translate(-b/2,-b/2);Sa.scale(b,b);b--;this.domElement=o;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,
+faces:0};this.setSize=function(b,e){p=b;t=e;u=p/2;v=t/2;o.width=p;o.height=t;ta.set(-u,-v,u,v);B=1;H=0;R=C=G=K=A=null};this.setClearColor=function(b,e){E=b;I=e};this.setClearColorHex=function(b,e){E.setHex(b);I=e};this.clear=function(){w.setTransform(1,0,0,-1,u,v);if(!ga.isEmpty())ga.inflate(1),ga.minSelf(ta),E.hex==0&&I==0?w.clearRect(ga.getX(),ga.getY(),ga.getWidth(),ga.getHeight()):(e(THREE.NormalBlending),c(1),w.fillStyle="rgba("+Math.floor(E.r*255)+","+Math.floor(E.g*255)+","+Math.floor(E.b*
+255)+","+I+")",w.fillRect(ga.getX(),ga.getY(),ga.getWidth(),ga.getHeight())),ga.empty()};this.render=function(b,j){function o(b){var e,c,f,h=b.lights;ua.setRGB(0,0,0);Qa.setRGB(0,0,0);Ra.setRGB(0,0,0);b=0;for(e=h.length;b<e;b++)c=h[b],f=c.color,c instanceof THREE.AmbientLight?(ua.r+=f.r,ua.g+=f.g,ua.b+=f.b):c instanceof THREE.DirectionalLight?(Qa.r+=f.r,Qa.g+=f.g,Qa.b+=f.b):c instanceof THREE.PointLight&&(Ra.r+=f.r,Ra.g+=f.g,Ra.b+=f.b)}function t(b,e,c,f){var h,j,g,k,m=b.lights,b=0;for(h=m.length;b<
+h;b++)j=m[b],g=j.color,j instanceof THREE.DirectionalLight?(k=c.dot(j.position),k<=0||(k*=j.intensity,f.r+=g.r*k,f.g+=g.g*k,f.b+=g.b*k)):j instanceof THREE.PointLight&&(k=c.dot(qa.sub(j.position,e).normalize()),k<=0||(k*=j.distance==0?1:1-Math.min(e.distanceTo(j.position)/j.distance,1),k!=0&&(k*=j.intensity,f.r+=g.r*k,f.g+=g.g*k,f.b+=g.b*k)))}function p(b,h,j){c(j.opacity);e(j.blending);var k,m,n,ga,o,t;if(j instanceof THREE.ParticleBasicMaterial){if(j.map)ga=j.map.image,o=ga.width>>1,t=ga.height>>
+1,j=h.scale.x*u,n=h.scale.y*v,k=j*o,m=n*t,sa.set(b.x-k,b.y-m,b.x+k,b.y+m),ta.instersects(sa)&&(w.save(),w.translate(b.x,b.y),w.rotate(-h.rotation),w.scale(j,-n),w.translate(-o,-t),w.drawImage(ga,0,0),w.restore())}else j instanceof THREE.ParticleCanvasMaterial&&(k=h.scale.x*u,m=h.scale.y*v,sa.set(b.x-k,b.y-m,b.x+k,b.y+m),ta.instersects(sa)&&(f(j.color),g(j.color),w.save(),w.translate(b.x,b.y),w.rotate(-h.rotation),w.scale(k,m),j.program(w),w.restore()))}function B(b,h,j,g){c(g.opacity);e(g.blending);
+w.beginPath();w.moveTo(b.positionScreen.x,b.positionScreen.y);w.lineTo(h.positionScreen.x,h.positionScreen.y);w.closePath();if(g instanceof THREE.LineBasicMaterial){b=g.linewidth;if(G!=b)w.lineWidth=G=b;b=g.linecap;if(C!=b)w.lineCap=C=b;b=g.linejoin;if(R!=b)w.lineJoin=R=b;f(g.color);w.stroke();sa.inflate(g.linewidth*2)}}function A(b,f,h,g,m,n,ga,o,p){k.data.vertices+=3;k.data.faces++;c(o.opacity);e(o.blending);O=b.positionScreen.x;$=b.positionScreen.y;M=f.positionScreen.x;ca=f.positionScreen.y;U=
+h.positionScreen.x;S=h.positionScreen.y;I(O,$,M,ca,U,S);if(o instanceof THREE.MeshBasicMaterial)if(o.map)o.map.mapping instanceof THREE.UVMapping&&(pa=ga.uvs[0],z(O,$,M,ca,U,S,o.map.image,pa[g].u,pa[g].v,pa[m].u,pa[m].v,pa[n].u,pa[n].v));else if(o.envMap){if(o.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=j.matrixWorldInverse,qa.copy(ga.vertexNormalsWorld[0]),la=(qa.x*b.n11+qa.y*b.n12+qa.z*b.n13)*0.5+0.5,Ca=-(qa.x*b.n21+qa.y*b.n22+qa.z*b.n23)*0.5+0.5,qa.copy(ga.vertexNormalsWorld[1]),
+za=(qa.x*b.n11+qa.y*b.n12+qa.z*b.n13)*0.5+0.5,da=-(qa.x*b.n21+qa.y*b.n22+qa.z*b.n23)*0.5+0.5,qa.copy(ga.vertexNormalsWorld[2]),P=(qa.x*b.n11+qa.y*b.n12+qa.z*b.n13)*0.5+0.5,Aa=-(qa.x*b.n21+qa.y*b.n22+qa.z*b.n23)*0.5+0.5,z(O,$,M,ca,U,S,o.envMap.image,la,Ca,za,da,P,Aa)}else o.wireframe?F(o.color,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):K(o.color);else if(o instanceof THREE.MeshLambertMaterial)o.map&&!o.wireframe&&(o.map.mapping instanceof THREE.UVMapping&&(pa=ga.uvs[0],z(O,$,M,ca,
+U,S,o.map.image,pa[g].u,pa[g].v,pa[m].u,pa[m].v,pa[n].u,pa[n].v)),e(THREE.SubtractiveBlending)),Wa?!o.wireframe&&o.shading==THREE.SmoothShading&&ga.vertexNormalsWorld.length==3?(T.r=Z.r=ka.r=ua.r,T.g=Z.g=ka.g=ua.g,T.b=Z.b=ka.b=ua.b,t(p,ga.v1.positionWorld,ga.vertexNormalsWorld[0],T),t(p,ga.v2.positionWorld,ga.vertexNormalsWorld[1],Z),t(p,ga.v3.positionWorld,ga.vertexNormalsWorld[2],ka),na.r=(Z.r+ka.r)*0.5,na.g=(Z.g+ka.g)*0.5,na.b=(Z.b+ka.b)*0.5,ia=Ta(T,Z,ka,na),z(O,$,M,ca,U,S,ia,0,0,1,0,0,1)):(va.r=
+ua.r,va.g=ua.g,va.b=ua.b,t(p,ga.centroidWorld,ga.normalWorld,va),Q.r=Math.max(0,Math.min(o.color.r*va.r,1)),Q.g=Math.max(0,Math.min(o.color.g*va.g,1)),Q.b=Math.max(0,Math.min(o.color.b*va.b,1)),Q.updateHex(),o.wireframe?F(Q,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):K(Q)):o.wireframe?F(o.color,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):K(o.color);else if(o instanceof THREE.MeshDepthMaterial)aa=j.near,ma=j.far,T.r=T.g=T.b=1-Ga(b.positionScreen.z,aa,ma),Z.r=Z.g=Z.b=
+1-Ga(f.positionScreen.z,aa,ma),ka.r=ka.g=ka.b=1-Ga(h.positionScreen.z,aa,ma),na.r=(Z.r+ka.r)*0.5,na.g=(Z.g+ka.g)*0.5,na.b=(Z.b+ka.b)*0.5,ia=Ta(T,Z,ka,na),z(O,$,M,ca,U,S,ia,0,0,1,0,0,1);else if(o instanceof THREE.MeshNormalMaterial)Q.r=La(ga.normalWorld.x),Q.g=La(ga.normalWorld.y),Q.b=La(ga.normalWorld.z),Q.updateHex(),o.wireframe?F(Q,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):K(Q)}function E(b,f,h,g,m,ga,o,n,p){k.data.vertices+=4;k.data.faces++;c(n.opacity);e(n.blending);if(n.map||
+n.envMap)A(b,f,g,0,1,3,o,n,p),A(m,h,ga,1,2,3,o,n,p);else if(O=b.positionScreen.x,$=b.positionScreen.y,M=f.positionScreen.x,ca=f.positionScreen.y,U=h.positionScreen.x,S=h.positionScreen.y,ja=g.positionScreen.x,W=g.positionScreen.y,fa=m.positionScreen.x,Y=m.positionScreen.y,ha=ga.positionScreen.x,ea=ga.positionScreen.y,n instanceof THREE.MeshBasicMaterial)H(O,$,M,ca,U,S,ja,W),n.wireframe?F(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):K(n.color);else if(n instanceof THREE.MeshLambertMaterial)Wa?
+!n.wireframe&&n.shading==THREE.SmoothShading&&o.vertexNormalsWorld.length==4?(T.r=Z.r=ka.r=na.r=ua.r,T.g=Z.g=ka.g=na.g=ua.g,T.b=Z.b=ka.b=na.b=ua.b,t(p,o.v1.positionWorld,o.vertexNormalsWorld[0],T),t(p,o.v2.positionWorld,o.vertexNormalsWorld[1],Z),t(p,o.v4.positionWorld,o.vertexNormalsWorld[3],ka),t(p,o.v3.positionWorld,o.vertexNormalsWorld[2],na),ia=Ta(T,Z,ka,na),I(O,$,M,ca,ja,W),z(O,$,M,ca,ja,W,ia,0,0,1,0,0,1),I(fa,Y,U,S,ha,ea),z(fa,Y,U,S,ha,ea,ia,1,0,1,1,0,1)):(va.r=ua.r,va.g=ua.g,va.b=ua.b,t(p,
+o.centroidWorld,o.normalWorld,va),Q.r=Math.max(0,Math.min(n.color.r*va.r,1)),Q.g=Math.max(0,Math.min(n.color.g*va.g,1)),Q.b=Math.max(0,Math.min(n.color.b*va.b,1)),Q.updateHex(),H(O,$,M,ca,U,S,ja,W),n.wireframe?F(Q,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):K(Q)):(H(O,$,M,ca,U,S,ja,W),n.wireframe?F(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):K(n.color));else if(n instanceof THREE.MeshNormalMaterial)Q.r=La(o.normalWorld.x),Q.g=La(o.normalWorld.y),Q.b=La(o.normalWorld.z),
+Q.updateHex(),H(O,$,M,ca,U,S,ja,W),n.wireframe?F(Q,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):K(Q);else if(n instanceof THREE.MeshDepthMaterial)aa=j.near,ma=j.far,T.r=T.g=T.b=1-Ga(b.positionScreen.z,aa,ma),Z.r=Z.g=Z.b=1-Ga(f.positionScreen.z,aa,ma),ka.r=ka.g=ka.b=1-Ga(g.positionScreen.z,aa,ma),na.r=na.g=na.b=1-Ga(h.positionScreen.z,aa,ma),ia=Ta(T,Z,ka,na),I(O,$,M,ca,ja,W),z(O,$,M,ca,ja,W,ia,0,0,1,0,0,1),I(fa,Y,U,S,ha,ea),z(fa,Y,U,S,ha,ea,ia,1,0,1,1,0,1)}function I(b,e,c,f,h,j){w.beginPath();
+w.moveTo(b,e);w.lineTo(c,f);w.lineTo(h,j);w.lineTo(b,e);w.closePath()}function H(b,e,c,f,h,j,g,k){w.beginPath();w.moveTo(b,e);w.lineTo(c,f);w.lineTo(h,j);w.lineTo(g,k);w.lineTo(b,e);w.closePath()}function F(b,e,c,h){if(G!=e)w.lineWidth=G=e;if(C!=c)w.lineCap=C=c;if(R!=h)w.lineJoin=R=h;f(b);w.stroke();sa.inflate(e*2)}function K(b){g(b);w.fill()}function z(b,e,c,f,h,j,g,k,m,n,o,ga,t){var p,u;p=g.width-1;u=g.height-1;k*=p;m*=u;n*=p;o*=u;ga*=p;t*=u;c-=b;f-=e;h-=b;j-=e;n-=k;o-=m;ga-=k;t-=m;p=n*t-ga*o;p!=
+0&&(u=1/p,p=(t*c-o*h)*u,o=(t*f-o*j)*u,c=(n*h-ga*c)*u,f=(n*j-ga*f)*u,b=b-p*k-c*m,e=e-o*k-f*m,w.save(),w.transform(p,o,c,f,b,e),w.clip(),w.drawImage(g,0,0),w.restore())}function Ta(b,e,c,f){var h=~~(b.r*255),j=~~(b.g*255),b=~~(b.b*255),g=~~(e.r*255),k=~~(e.g*255),e=~~(e.b*255),m=~~(c.r*255),n=~~(c.g*255),c=~~(c.b*255),o=~~(f.r*255),ga=~~(f.g*255),f=~~(f.b*255);wa[0]=h<0?0:h>255?255:h;wa[1]=j<0?0:j>255?255:j;wa[2]=b<0?0:b>255?255:b;wa[4]=g<0?0:g>255?255:g;wa[5]=k<0?0:k>255?255:k;wa[6]=e<0?0:e>255?255:
+e;wa[8]=m<0?0:m>255?255:m;wa[9]=n<0?0:n>255?255:n;wa[10]=c<0?0:c>255?255:c;wa[12]=o<0?0:o>255?255:o;wa[13]=ga<0?0:ga>255?255:ga;wa[14]=f<0?0:f>255?255:f;Oa.putImageData(Xa,0,0);Sa.drawImage(Na,0,0);return Pa}function Ga(b,e,c){b=(b-e)/(c-e);return b*b*(3-2*b)}function La(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function Da(b,e){var c=e.x-b.x,f=e.y-b.y,h=1/Math.sqrt(c*c+f*f);c*=h;f*=h;e.x+=c;e.y+=f;b.x-=c;b.y-=f}var Ua,ab,oa,xa,Ea,Ma,Va,L;this.autoClear?this.clear():w.setTransform(1,0,0,-1,u,v);k.data.vertices=
+0;k.data.faces=0;m=n.projectScene(b,j,this.sortElements);(Wa=b.lights.length>0)&&o(b);Ua=0;for(ab=m.length;Ua<ab;Ua++){oa=m[Ua];sa.empty();if(oa instanceof THREE.RenderableParticle){D=oa;D.x*=u;D.y*=v;xa=0;for(Ea=oa.materials.length;xa<Ea;)L=oa.materials[xa++],L.opacity!=0&&p(D,oa,L,b)}else if(oa instanceof THREE.RenderableLine){if(D=oa.v1,N=oa.v2,D.positionScreen.x*=u,D.positionScreen.y*=v,N.positionScreen.x*=u,N.positionScreen.y*=v,sa.addPoint(D.positionScreen.x,D.positionScreen.y),sa.addPoint(N.positionScreen.x,
+N.positionScreen.y),ta.instersects(sa)){xa=0;for(Ea=oa.materials.length;xa<Ea;)L=oa.materials[xa++],L.opacity!=0&&B(D,N,oa,L,b)}}else if(oa instanceof THREE.RenderableFace3){if(D=oa.v1,N=oa.v2,J=oa.v3,D.positionScreen.x*=u,D.positionScreen.y*=v,N.positionScreen.x*=u,N.positionScreen.y*=v,J.positionScreen.x*=u,J.positionScreen.y*=v,oa.overdraw&&(Da(D.positionScreen,N.positionScreen),Da(N.positionScreen,J.positionScreen),Da(J.positionScreen,D.positionScreen)),sa.add3Points(D.positionScreen.x,D.positionScreen.y,
+N.positionScreen.x,N.positionScreen.y,J.positionScreen.x,J.positionScreen.y),ta.instersects(sa)){xa=0;for(Ea=oa.meshMaterials.length;xa<Ea;)if(L=oa.meshMaterials[xa++],L instanceof THREE.MeshFaceMaterial){Ma=0;for(Va=oa.faceMaterials.length;Ma<Va;)(L=oa.faceMaterials[Ma++])&&L.opacity!=0&&A(D,N,J,0,1,2,oa,L,b)}else L.opacity!=0&&A(D,N,J,0,1,2,oa,L,b)}}else if(oa instanceof THREE.RenderableFace4&&(D=oa.v1,N=oa.v2,J=oa.v3,V=oa.v4,D.positionScreen.x*=u,D.positionScreen.y*=v,N.positionScreen.x*=u,N.positionScreen.y*=
+v,J.positionScreen.x*=u,J.positionScreen.y*=v,V.positionScreen.x*=u,V.positionScreen.y*=v,h.positionScreen.copy(N.positionScreen),X.positionScreen.copy(V.positionScreen),oa.overdraw&&(Da(D.positionScreen,N.positionScreen),Da(N.positionScreen,V.positionScreen),Da(V.positionScreen,D.positionScreen),Da(J.positionScreen,h.positionScreen),Da(J.positionScreen,X.positionScreen)),sa.addPoint(D.positionScreen.x,D.positionScreen.y),sa.addPoint(N.positionScreen.x,N.positionScreen.y),sa.addPoint(J.positionScreen.x,
+J.positionScreen.y),sa.addPoint(V.positionScreen.x,V.positionScreen.y),ta.instersects(sa))){xa=0;for(Ea=oa.meshMaterials.length;xa<Ea;)if(L=oa.meshMaterials[xa++],L instanceof THREE.MeshFaceMaterial){Ma=0;for(Va=oa.faceMaterials.length;Ma<Va;)(L=oa.faceMaterials[Ma++])&&L.opacity!=0&&E(D,N,J,V,h,X,oa,L,b)}else L.opacity!=0&&E(D,N,J,V,h,X,oa,L,b)}ga.addRectangle(sa)}w.setTransform(1,0,0,1,0,0)}};
+THREE.SVGRenderer=function(){function b(b,e,c){var f,h,j,g;f=0;for(h=b.lights.length;f<h;f++)j=b.lights[f],j instanceof THREE.DirectionalLight?(g=e.normalWorld.dot(j.position)*j.intensity,g>0&&(c.r+=j.color.r*g,c.g+=j.color.g*g,c.b+=j.color.b*g)):j instanceof THREE.PointLight&&(V.sub(j.position,e.centroidWorld),V.normalize(),g=e.normalWorld.dot(V)*j.intensity,g>0&&(c.r+=j.color.r*g,c.g+=j.color.g*g,c.b+=j.color.b*g))}function c(e,c,h,m,n,t){k.data.vertices+=3;k.data.faces++;O=f($++);O.setAttribute("d",
+"M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+h.positionScreen.x+","+h.positionScreen.y+"z");n instanceof THREE.MeshBasicMaterial?G.hex=n.color.hex:n instanceof THREE.MeshLambertMaterial?K?(C.r=R.r,C.g=R.g,C.b=R.b,b(t,m,C),G.r=Math.max(0,Math.min(n.color.r*C.r,1)),G.g=Math.max(0,Math.min(n.color.g*C.g,1)),G.b=Math.max(0,Math.min(n.color.b*C.b,1)),G.updateHex()):G.hex=n.color.hex:n instanceof THREE.MeshDepthMaterial?(J=1-n.__2near/(n.__farPlusNear-
+m.z*n.__farMinusNear),G.setRGB(J,J,J)):n instanceof THREE.MeshNormalMaterial&&G.setRGB(g(m.normalWorld.x),g(m.normalWorld.y),g(m.normalWorld.z));n.wireframe?O.setAttribute("style","fill: none; stroke: #"+j(G.hex.toString(16))+"; stroke-width: "+n.wireframeLinewidth+"; stroke-opacity: "+n.opacity+"; stroke-linecap: "+n.wireframeLinecap+"; stroke-linejoin: "+n.wireframeLinejoin):O.setAttribute("style","fill: #"+j(G.hex.toString(16))+"; fill-opacity: "+n.opacity);o.appendChild(O)}function e(e,c,h,m,
+n,t,p){k.data.vertices+=4;k.data.faces++;O=f($++);O.setAttribute("d","M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+h.positionScreen.x+","+h.positionScreen.y+" L "+m.positionScreen.x+","+m.positionScreen.y+"z");t instanceof THREE.MeshBasicMaterial?G.hex=t.color.hex:t instanceof THREE.MeshLambertMaterial?K?(C.r=R.r,C.g=R.g,C.b=R.b,b(p,n,C),G.r=Math.max(0,Math.min(t.color.r*C.r,1)),G.g=Math.max(0,Math.min(t.color.g*C.g,1)),G.b=Math.max(0,Math.min(t.color.b*
+C.b,1)),G.updateHex()):G.hex=t.color.hex:t instanceof THREE.MeshDepthMaterial?(J=1-t.__2near/(t.__farPlusNear-n.z*t.__farMinusNear),G.setRGB(J,J,J)):t instanceof THREE.MeshNormalMaterial&&G.setRGB(g(n.normalWorld.x),g(n.normalWorld.y),g(n.normalWorld.z));t.wireframe?O.setAttribute("style","fill: none; stroke: #"+j(G.hex.toString(16))+"; stroke-width: "+t.wireframeLinewidth+"; stroke-opacity: "+t.opacity+"; stroke-linecap: "+t.wireframeLinecap+"; stroke-linejoin: "+t.wireframeLinejoin):O.setAttribute("style",
+"fill: #"+j(G.hex.toString(16))+"; fill-opacity: "+t.opacity);o.appendChild(O)}function f(b){h[b]==null&&(h[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),ca==0&&h[b].setAttribute("shape-rendering","crispEdges"));return h[b]}function g(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function j(b){for(;b.length<6;)b="0"+b;return b}var k=this,m=null,n=new THREE.Projector,o=document.createElementNS("http://www.w3.org/2000/svg","svg"),p,t,u,v,w,E,I,B,H=new THREE.Rectangle,A=new THREE.Rectangle,
+K=!1,G=new THREE.Color(16777215),C=new THREE.Color(16777215),R=new THREE.Color(0),D=new THREE.Color(0),N=new THREE.Color(0),J,V=new THREE.Vector3,h=[],X=[],O,$,M,ca=1;this.domElement=o;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,faces:0};this.setQuality=function(b){switch(b){case "high":ca=1;break;case "low":ca=0}};this.setSize=function(b,e){p=b;t=e;u=p/2;v=t/2;o.setAttribute("viewBox",-u+" "+-v+" "+p+" "+t);o.setAttribute("width",p);o.setAttribute("height",t);H.set(-u,
+-v,u,v)};this.clear=function(){for(;o.childNodes.length>0;)o.removeChild(o.childNodes[0])};this.render=function(b,f){var h,g,t,p,C,G,J,T;this.autoClear&&this.clear();k.data.vertices=0;k.data.faces=0;m=n.projectScene(b,f,this.sortElements);M=$=0;if(K=b.lights.length>0){J=b.lights;R.setRGB(0,0,0);D.setRGB(0,0,0);N.setRGB(0,0,0);h=0;for(g=J.length;h<g;h++)t=J[h],p=t.color,t instanceof THREE.AmbientLight?(R.r+=p.r,R.g+=p.g,R.b+=p.b):t instanceof THREE.DirectionalLight?(D.r+=p.r,D.g+=p.g,D.b+=p.b):t instanceof
+THREE.PointLight&&(N.r+=p.r,N.g+=p.g,N.b+=p.b)}h=0;for(g=m.length;h<g;h++)if(J=m[h],A.empty(),J instanceof THREE.RenderableParticle){w=J;w.x*=u;w.y*=-v;t=0;for(p=J.materials.length;t<p;)t++}else if(J instanceof THREE.RenderableLine){if(w=J.v1,E=J.v2,w.positionScreen.x*=u,w.positionScreen.y*=-v,E.positionScreen.x*=u,E.positionScreen.y*=-v,A.addPoint(w.positionScreen.x,w.positionScreen.y),A.addPoint(E.positionScreen.x,E.positionScreen.y),H.instersects(A)){t=0;for(p=J.materials.length;t<p;)if((T=J.materials[t++])&&
+T.opacity!=0){C=w;G=E;var V=M++;X[V]==null&&(X[V]=document.createElementNS("http://www.w3.org/2000/svg","line"),ca==0&&X[V].setAttribute("shape-rendering","crispEdges"));O=X[V];O.setAttribute("x1",C.positionScreen.x);O.setAttribute("y1",C.positionScreen.y);O.setAttribute("x2",G.positionScreen.x);O.setAttribute("y2",G.positionScreen.y);T instanceof THREE.LineBasicMaterial&&(O.setAttribute("style","fill: none; stroke: ##"+j(T.color.hex.toString(16))+"; stroke-width: "+T.linewidth+"; stroke-opacity: "+
+T.opacity+"; stroke-linecap: "+T.linecap+"; stroke-linejoin: "+T.linejoin),o.appendChild(O))}}}else if(J instanceof THREE.RenderableFace3){if(w=J.v1,E=J.v2,I=J.v3,w.positionScreen.x*=u,w.positionScreen.y*=-v,E.positionScreen.x*=u,E.positionScreen.y*=-v,I.positionScreen.x*=u,I.positionScreen.y*=-v,A.addPoint(w.positionScreen.x,w.positionScreen.y),A.addPoint(E.positionScreen.x,E.positionScreen.y),A.addPoint(I.positionScreen.x,I.positionScreen.y),H.instersects(A)){t=0;for(p=J.meshMaterials.length;t<
+p;)if(T=J.meshMaterials[t++],T instanceof THREE.MeshFaceMaterial){C=0;for(G=J.faceMaterials.length;C<G;)(T=J.faceMaterials[C++])&&T.opacity!=0&&c(w,E,I,J,T,b)}else T&&T.opacity!=0&&c(w,E,I,J,T,b)}}else if(J instanceof THREE.RenderableFace4&&(w=J.v1,E=J.v2,I=J.v3,B=J.v4,w.positionScreen.x*=u,w.positionScreen.y*=-v,E.positionScreen.x*=u,E.positionScreen.y*=-v,I.positionScreen.x*=u,I.positionScreen.y*=-v,B.positionScreen.x*=u,B.positionScreen.y*=-v,A.addPoint(w.positionScreen.x,w.positionScreen.y),A.addPoint(E.positionScreen.x,
+E.positionScreen.y),A.addPoint(I.positionScreen.x,I.positionScreen.y),A.addPoint(B.positionScreen.x,B.positionScreen.y),H.instersects(A))){t=0;for(p=J.meshMaterials.length;t<p;)if(T=J.meshMaterials[t++],T instanceof THREE.MeshFaceMaterial){C=0;for(G=J.faceMaterials.length;C<G;)(T=J.faceMaterials[C++])&&T.opacity!=0&&e(w,E,I,B,J,T,b)}else T&&T.opacity!=0&&e(w,E,I,B,J,T,b)}}};
 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",
@@ -220,118 +222,118 @@ THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.Shade
 "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(b,e,c){var f,h,g,k=b.vertices,m=k.length,n=b.colors,o=n.length,p=b.__vertexArray,t=b.__colorArray,u=b.__sortArray,v=b.__dirtyVertices,w=b.__dirtyColors;if(c.sortParticles){Q.multiplySelf(c.matrixWorld);for(f=0;f<m;f++)h=k[f].position,ka.copy(h),Q.multiplyVector3(ka),u[f]=[ka.z,f];u.sort(function(b,e){return e[0]-b[0]});for(f=0;f<m;f++)h=k[u[f][1]].position,g=f*3,p[g]=h.x,p[g+1]=h.y,p[g+2]=h.z;for(f=0;f<o;f++)g=f*3,color=n[u[f][1]],t[g]=color.r,t[g+1]=color.g,
-t[g+2]=color.b}else{if(v)for(f=0;f<m;f++)h=k[f].position,g=f*3,p[g]=h.x,p[g+1]=h.y,p[g+2]=h.z;if(w)for(f=0;f<o;f++)color=n[f],g=f*3,t[g]=color.r,t[g+1]=color.g,t[g+2]=color.b}if(v||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,b.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,p,e);if(w||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,b.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,t,e)}function e(b,e,c,f,h){f.program||V.initMaterial(f,e,c,h);var g=f.program,k=g.uniforms,m=f.uniforms;g!=O&&(j.useProgram(g),
-O=g);j.uniformMatrix4fv(k.projectionMatrix,!1,T);if(c&&(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial||f instanceof THREE.LineBasicMaterial||f instanceof THREE.ParticleBasicMaterial||f.fog))if(m.fogColor.value=c.color,c instanceof THREE.Fog)m.fogNear.value=c.near,m.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)m.fogDensity.value=c.density;if(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f.lights){var n,
-o,p=0,t=0,u=0,v,w,B,A,E=na,H=E.directional.colors,J=E.directional.positions,I=E.point.colors,K=E.point.positions,ma=E.point.distances,D=0,F=0,c=o=A=0;for(n=e.length;c<n;c++)if(o=e[c],v=o.color,w=o.position,B=o.intensity,A=o.distance,o instanceof THREE.AmbientLight)p+=v.r,t+=v.g,u+=v.b;else if(o instanceof THREE.DirectionalLight)A=D*3,H[A]=v.r*B,H[A+1]=v.g*B,H[A+2]=v.b*B,J[A]=w.x,J[A+1]=w.y,J[A+2]=w.z,D+=1;else if(o instanceof THREE.PointLight)o=F*3,I[o]=v.r*B,I[o+1]=v.g*B,I[o+2]=v.b*B,K[o]=w.x,K[o+
-1]=w.y,K[o+2]=w.z,ma[F]=A,F+=1;for(c=D*3;c<H.length;c++)H[c]=0;for(c=F*3;c<I.length;c++)I[c]=0;E.point.length=F;E.directional.length=D;E.ambient[0]=p;E.ambient[1]=t;E.ambient[2]=u;c=na;m.enableLighting.value=c.directional.length+c.point.length;m.ambientLightColor.value=c.ambient;m.directionalLightColor.value=c.directional.colors;m.directionalLightDirection.value=c.directional.positions;m.pointLightColor.value=c.point.colors;m.pointLightPosition.value=c.point.positions;m.pointLightDistance.value=c.point.distances}if(f instanceof
+THREE.WebGLRenderer=function(b){function c(b,e,c){var f,j,g,k=b.vertices,m=k.length,n=b.colors,o=n.length,t=b.__vertexArray,p=b.__colorArray,u=b.__sortArray,v=b.__dirtyVertices,w=b.__dirtyColors;if(c.sortParticles){Q.multiplySelf(c.matrixWorld);for(f=0;f<m;f++)j=k[f].position,ka.copy(j),Q.multiplyVector3(ka),u[f]=[ka.z,f];u.sort(function(b,e){return e[0]-b[0]});for(f=0;f<m;f++)j=k[u[f][1]].position,g=f*3,t[g]=j.x,t[g+1]=j.y,t[g+2]=j.z;for(f=0;f<o;f++)g=f*3,color=n[u[f][1]],p[g]=color.r,p[g+1]=color.g,
+p[g+2]=color.b}else{if(v)for(f=0;f<m;f++)j=k[f].position,g=f*3,t[g]=j.x,t[g+1]=j.y,t[g+2]=j.z;if(w)for(f=0;f<o;f++)color=n[f],g=f*3,p[g]=color.r,p[g+1]=color.g,p[g+2]=color.b}if(v||c.sortParticles)h.bindBuffer(h.ARRAY_BUFFER,b.__webglVertexBuffer),h.bufferData(h.ARRAY_BUFFER,t,e);if(w||c.sortParticles)h.bindBuffer(h.ARRAY_BUFFER,b.__webglColorBuffer),h.bufferData(h.ARRAY_BUFFER,p,e)}function e(b,e,c,f,j){f.program||V.initMaterial(f,e,c,j);var g=f.program,k=g.uniforms,m=f.uniforms;g!=O&&(h.useProgram(g),
+O=g);h.uniformMatrix4fv(k.projectionMatrix,!1,T);if(c&&(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial||f instanceof THREE.LineBasicMaterial||f instanceof THREE.ParticleBasicMaterial||f.fog))if(m.fogColor.value=c.color,c instanceof THREE.Fog)m.fogNear.value=c.near,m.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)m.fogDensity.value=c.density;if(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f.lights){var n,
+o,t=0,p=0,u=0,v,w,B,A,E=na,I=E.directional.colors,J=E.directional.positions,H=E.point.colors,K=E.point.positions,ma=E.point.distances,D=0,F=0,c=o=A=0;for(n=e.length;c<n;c++)if(o=e[c],v=o.color,w=o.position,B=o.intensity,A=o.distance,o instanceof THREE.AmbientLight)t+=v.r,p+=v.g,u+=v.b;else if(o instanceof THREE.DirectionalLight)A=D*3,I[A]=v.r*B,I[A+1]=v.g*B,I[A+2]=v.b*B,J[A]=w.x,J[A+1]=w.y,J[A+2]=w.z,D+=1;else if(o instanceof THREE.PointLight)o=F*3,H[o]=v.r*B,H[o+1]=v.g*B,H[o+2]=v.b*B,K[o]=w.x,K[o+
+1]=w.y,K[o+2]=w.z,ma[F]=A,F+=1;for(c=D*3;c<I.length;c++)I[c]=0;for(c=F*3;c<H.length;c++)H[c]=0;E.point.length=F;E.directional.length=D;E.ambient[0]=t;E.ambient[1]=p;E.ambient[2]=u;c=na;m.enableLighting.value=c.directional.length+c.point.length;m.ambientLightColor.value=c.ambient;m.directionalLightColor.value=c.directional.colors;m.directionalLightDirection.value=c.directional.positions;m.pointLightColor.value=c.point.colors;m.pointLightPosition.value=c.point.positions;m.pointLightDistance.value=c.point.distances}if(f instanceof
 THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial)m.diffuse.value=f.color,m.opacity.value=f.opacity,(m.map.texture=f.map)&&m.offsetRepeat.value.set(f.map.offset.x,f.map.offset.y,f.map.repeat.x,f.map.repeat.y),m.lightMap.texture=f.lightMap,m.envMap.texture=f.envMap,m.reflectivity.value=f.reflectivity,m.refractionRatio.value=f.refractionRatio,m.combine.value=f.combine,m.useRefract.value=f.envMap&&f.envMap.mapping instanceof THREE.CubeRefractionMapping;
 if(f instanceof THREE.LineBasicMaterial)m.diffuse.value=f.color,m.opacity.value=f.opacity;else if(f instanceof THREE.ParticleBasicMaterial)m.psColor.value=f.color,m.opacity.value=f.opacity,m.size.value=f.size,m.scale.value=aa.height/2,m.map.texture=f.map;else if(f instanceof THREE.MeshPhongMaterial)m.ambient.value=f.ambient,m.specular.value=f.specular,m.shininess.value=f.shininess;else if(f instanceof THREE.MeshDepthMaterial)m.mNear.value=b.near,m.mFar.value=b.far,m.opacity.value=f.opacity;else if(f instanceof
-THREE.MeshNormalMaterial)m.opacity.value=f.opacity;for(var N in m)if(t=g.uniforms[N])if(n=m[N],p=n.type,c=n.value,p=="i")j.uniform1i(t,c);else if(p=="f")j.uniform1f(t,c);else if(p=="fv1")j.uniform1fv(t,c);else if(p=="fv")j.uniform3fv(t,c);else if(p=="v2")j.uniform2f(t,c.x,c.y);else if(p=="v3")j.uniform3f(t,c.x,c.y,c.z);else if(p=="v4")j.uniform4f(t,c.x,c.y,c.z,c.w);else if(p=="c")j.uniform3f(t,c.r,c.g,c.b);else if(p=="t"&&(j.uniform1i(t,c),n=n.texture))if(n.image instanceof Array&&n.image.length==
-6){if(n.image.length==6){if(n.needsUpdate){if(n.__webglInit){j.bindTexture(j.TEXTURE_CUBE_MAP,n.image.__webglTextureCube);for(p=0;p<6;++p)j.texSubImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+p,0,0,0,j.RGBA,j.UNSIGNED_BYTE,n.image[p])}else{n.image.__webglTextureCube=j.createTexture();j.bindTexture(j.TEXTURE_CUBE_MAP,n.image.__webglTextureCube);for(p=0;p<6;++p)j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+p,0,j.RGBA,j.RGBA,j.UNSIGNED_BYTE,n.image[p]);n.__webglInit=!0}G(j.TEXTURE_CUBE_MAP,n,n.image[0]);j.bindTexture(j.TEXTURE_CUBE_MAP,
-null);n.needsUpdate=!1}j.activeTexture(j.TEXTURE0+c);j.bindTexture(j.TEXTURE_CUBE_MAP,n.image.__webglTextureCube)}}else C(n,c);j.uniformMatrix4fv(k.modelViewMatrix,!1,h._modelViewMatrixArray);j.uniformMatrix3fv(k.normalMatrix,!1,h._normalMatrixArray);(f instanceof THREE.MeshShaderMaterial||f instanceof THREE.MeshPhongMaterial||f.envMap)&&k.cameraPosition!==null&&j.uniform3f(k.cameraPosition,b.position.x,b.position.y,b.position.z);(f instanceof THREE.MeshShaderMaterial||f.envMap||f.skinning)&&k.objectMatrix!==
-null&&j.uniformMatrix4fv(k.objectMatrix,!1,h._objectMatrixArray);(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshShaderMaterial||f.skinning)&&k.viewMatrix!==null&&j.uniformMatrix4fv(k.viewMatrix,!1,Z);if(f instanceof THREE.ShadowVolumeDynamicMaterial)b=m.directionalLightDirection.value,b[0]=-e[1].position.x,b[1]=-e[1].position.y,b[2]=-e[1].position.z,j.uniform3fv(k.directionalLightDirection,b),j.uniformMatrix4fv(k.objectMatrix,!1,h._objectMatrixArray),
-j.uniformMatrix4fv(k.viewMatrix,!1,Z);f.skinning&&(j.uniformMatrix4fv(k.cameraInverseMatrix,!1,Z),j.uniformMatrix4fv(k.boneGlobalMatrices,!1,h.boneMatrices));return g}function f(b,c,f,h,g,k){if(h.opacity!=0){var m,b=e(b,c,f,h,k).attributes;if(!h.morphTargets&&b.position>=0)j.bindBuffer(j.ARRAY_BUFFER,g.__webglVertexBuffer),j.vertexAttribPointer(b.position,3,j.FLOAT,!1,0,0);else{c=h.program.attributes;k.morphTargetBase!==-1?(j.bindBuffer(j.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[k.morphTargetBase]),
-j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0)):c.position>=0&&(j.bindBuffer(j.ARRAY_BUFFER,g.__webglVertexBuffer),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0));if(k.morphTargetForcedOrder.length)for(var f=0,n=k.morphTargetForcedOrder,o=k.morphTargetInfluences;f<h.numSupportedMorphTargets&&f<n.length;)j.bindBuffer(j.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[n[f]]),j.vertexAttribPointer(c["morphTarget"+f],3,j.FLOAT,!1,0,0),k.__webglMorphTargetInfluences[f]=o[n[f]],f++;else{var n=[],p=-1,
-t=0,o=k.morphTargetInfluences,u,v=o.length,f=0;for(k.morphTargetBase!==-1&&(n[k.morphTargetBase]=!0);f<h.numSupportedMorphTargets;){for(u=0;u<v;u++)!n[u]&&o[u]>p&&(t=u,p=o[t]);j.bindBuffer(j.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[t]);j.vertexAttribPointer(c["morphTarget"+f],3,j.FLOAT,!1,0,0);k.__webglMorphTargetInfluences[f]=p;n[t]=1;p=-1;f++}}h.program.uniforms.morphTargetInfluences!==null&&j.uniform1fv(h.program.uniforms.morphTargetInfluences,k.__webglMorphTargetInfluences)}if(g.__webglCustomAttributes)for(m in g.__webglCustomAttributes)b[m]>=
-0&&(c=g.__webglCustomAttributes[m],j.bindBuffer(j.ARRAY_BUFFER,c.buffer),j.vertexAttribPointer(b[m],c.size,j.FLOAT,!1,0,0));b.color>=0&&(j.bindBuffer(j.ARRAY_BUFFER,g.__webglColorBuffer),j.vertexAttribPointer(b.color,3,j.FLOAT,!1,0,0));b.normal>=0&&(j.bindBuffer(j.ARRAY_BUFFER,g.__webglNormalBuffer),j.vertexAttribPointer(b.normal,3,j.FLOAT,!1,0,0));b.tangent>=0&&(j.bindBuffer(j.ARRAY_BUFFER,g.__webglTangentBuffer),j.vertexAttribPointer(b.tangent,4,j.FLOAT,!1,0,0));b.uv>=0&&(g.__webglUVBuffer?(j.bindBuffer(j.ARRAY_BUFFER,
-g.__webglUVBuffer),j.vertexAttribPointer(b.uv,2,j.FLOAT,!1,0,0),j.enableVertexAttribArray(b.uv)):j.disableVertexAttribArray(b.uv));b.uv2>=0&&(g.__webglUV2Buffer?(j.bindBuffer(j.ARRAY_BUFFER,g.__webglUV2Buffer),j.vertexAttribPointer(b.uv2,2,j.FLOAT,!1,0,0),j.enableVertexAttribArray(b.uv2)):j.disableVertexAttribArray(b.uv2));h.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(j.bindBuffer(j.ARRAY_BUFFER,g.__webglSkinVertexABuffer),j.vertexAttribPointer(b.skinVertexA,4,
-j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,g.__webglSkinVertexBBuffer),j.vertexAttribPointer(b.skinVertexB,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,g.__webglSkinIndicesBuffer),j.vertexAttribPointer(b.skinIndex,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,g.__webglSkinWeightsBuffer),j.vertexAttribPointer(b.skinWeight,4,j.FLOAT,!1,0,0));k instanceof THREE.Mesh?(h.wireframe?(j.lineWidth(h.wireframeLinewidth),j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,g.__webglLineBuffer),j.drawElements(j.LINES,g.__webglLineCount,
-j.UNSIGNED_SHORT,0)):(j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,g.__webglFaceBuffer),j.drawElements(j.TRIANGLES,g.__webglFaceCount,j.UNSIGNED_SHORT,0)),V.data.vertices+=g.__webglFaceCount,V.data.faces+=g.__webglFaceCount/3,V.data.drawCalls++):k instanceof THREE.Line?(k=k.type==THREE.LineStrip?j.LINE_STRIP:j.LINES,j.lineWidth(h.linewidth),j.drawArrays(k,0,g.__webglLineCount),V.data.drawCalls++):k instanceof THREE.ParticleSystem?(j.drawArrays(j.POINTS,0,g.__webglParticleCount),V.data.drawCalls++):k instanceof
-THREE.Ribbon&&(j.drawArrays(j.TRIANGLE_STRIP,0,g.__webglVertexCount),V.data.drawCalls++)}}function g(b,e,c){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=j.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=j.createBuffer();b.hasPos&&(j.bindBuffer(j.ARRAY_BUFFER,b.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,b.positionArray,j.DYNAMIC_DRAW),j.enableVertexAttribArray(e.attributes.position),j.vertexAttribPointer(e.attributes.position,3,j.FLOAT,!1,0,0));if(b.hasNormal){j.bindBuffer(j.ARRAY_BUFFER,
-b.__webglNormalBuffer);if(c==THREE.FlatShading){var f,h,g,k,m,n,o,p,t,u,v=b.count*3;for(u=0;u<v;u+=9)c=b.normalArray,f=c[u],h=c[u+1],g=c[u+2],k=c[u+3],n=c[u+4],p=c[u+5],m=c[u+6],o=c[u+7],t=c[u+8],f=(f+k+m)/3,h=(h+n+o)/3,g=(g+p+t)/3,c[u]=f,c[u+1]=h,c[u+2]=g,c[u+3]=f,c[u+4]=h,c[u+5]=g,c[u+6]=f,c[u+7]=h,c[u+8]=g}j.bufferData(j.ARRAY_BUFFER,b.normalArray,j.DYNAMIC_DRAW);j.enableVertexAttribArray(e.attributes.normal);j.vertexAttribPointer(e.attributes.normal,3,j.FLOAT,!1,0,0)}j.drawArrays(j.TRIANGLES,
-0,b.count);b.count=0}function h(b){if(ca!=b.doubleSided)b.doubleSided?j.disable(j.CULL_FACE):j.enable(j.CULL_FACE),ca=b.doubleSided;if(U!=b.flipSided)b.flipSided?j.frontFace(j.CW):j.frontFace(j.CCW),U=b.flipSided}function k(b){ja!=b&&(b?j.enable(j.DEPTH_TEST):j.disable(j.DEPTH_TEST),ja=b)}function m(b){ea[0].set(b.n41-b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-b.n14);ea[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);ea[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);ea[3].set(b.n41-b.n21,
+THREE.MeshNormalMaterial)m.opacity.value=f.opacity;for(var N in m)if(p=g.uniforms[N])if(n=m[N],t=n.type,c=n.value,t=="i")h.uniform1i(p,c);else if(t=="f")h.uniform1f(p,c);else if(t=="fv1")h.uniform1fv(p,c);else if(t=="fv")h.uniform3fv(p,c);else if(t=="v2")h.uniform2f(p,c.x,c.y);else if(t=="v3")h.uniform3f(p,c.x,c.y,c.z);else if(t=="v4")h.uniform4f(p,c.x,c.y,c.z,c.w);else if(t=="c")h.uniform3f(p,c.r,c.g,c.b);else if(t=="t"&&(h.uniform1i(p,c),n=n.texture))if(n.image instanceof Array&&n.image.length==
+6){if(n.image.length==6){if(n.needsUpdate){if(n.__webglInit){h.bindTexture(h.TEXTURE_CUBE_MAP,n.image.__webglTextureCube);for(t=0;t<6;++t)h.texSubImage2D(h.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,0,0,h.RGBA,h.UNSIGNED_BYTE,n.image[t])}else{n.image.__webglTextureCube=h.createTexture();h.bindTexture(h.TEXTURE_CUBE_MAP,n.image.__webglTextureCube);for(t=0;t<6;++t)h.texImage2D(h.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,h.RGBA,h.RGBA,h.UNSIGNED_BYTE,n.image[t]);n.__webglInit=!0}G(h.TEXTURE_CUBE_MAP,n,n.image[0]);h.bindTexture(h.TEXTURE_CUBE_MAP,
+null);n.needsUpdate=!1}h.activeTexture(h.TEXTURE0+c);h.bindTexture(h.TEXTURE_CUBE_MAP,n.image.__webglTextureCube)}}else C(n,c);h.uniformMatrix4fv(k.modelViewMatrix,!1,j._modelViewMatrixArray);h.uniformMatrix3fv(k.normalMatrix,!1,j._normalMatrixArray);(f instanceof THREE.MeshShaderMaterial||f instanceof THREE.MeshPhongMaterial||f.envMap)&&k.cameraPosition!==null&&h.uniform3f(k.cameraPosition,b.position.x,b.position.y,b.position.z);(f instanceof THREE.MeshShaderMaterial||f.envMap||f.skinning)&&k.objectMatrix!==
+null&&h.uniformMatrix4fv(k.objectMatrix,!1,j._objectMatrixArray);(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshShaderMaterial||f.skinning)&&k.viewMatrix!==null&&h.uniformMatrix4fv(k.viewMatrix,!1,Z);if(f instanceof THREE.ShadowVolumeDynamicMaterial)b=m.directionalLightDirection.value,b[0]=-e[1].position.x,b[1]=-e[1].position.y,b[2]=-e[1].position.z,h.uniform3fv(k.directionalLightDirection,b),h.uniformMatrix4fv(k.objectMatrix,!1,j._objectMatrixArray),
+h.uniformMatrix4fv(k.viewMatrix,!1,Z);f.skinning&&(h.uniformMatrix4fv(k.cameraInverseMatrix,!1,Z),h.uniformMatrix4fv(k.boneGlobalMatrices,!1,j.boneMatrices));return g}function f(b,c,f,j,g,k){if(j.opacity!=0){var m,b=e(b,c,f,j,k).attributes;if(!j.morphTargets&&b.position>=0)h.bindBuffer(h.ARRAY_BUFFER,g.__webglVertexBuffer),h.vertexAttribPointer(b.position,3,h.FLOAT,!1,0,0);else{c=j.program.attributes;k.morphTargetBase!==-1?(h.bindBuffer(h.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[k.morphTargetBase]),
+h.vertexAttribPointer(c.position,3,h.FLOAT,!1,0,0)):c.position>=0&&(h.bindBuffer(h.ARRAY_BUFFER,g.__webglVertexBuffer),h.vertexAttribPointer(c.position,3,h.FLOAT,!1,0,0));if(k.morphTargetForcedOrder.length)for(var f=0,n=k.morphTargetForcedOrder,o=k.morphTargetInfluences;f<j.numSupportedMorphTargets&&f<n.length;)h.bindBuffer(h.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[n[f]]),h.vertexAttribPointer(c["morphTarget"+f],3,h.FLOAT,!1,0,0),k.__webglMorphTargetInfluences[f]=o[n[f]],f++;else{var n=[],t=-1,
+p=0,o=k.morphTargetInfluences,u,v=o.length,f=0;for(k.morphTargetBase!==-1&&(n[k.morphTargetBase]=!0);f<j.numSupportedMorphTargets;){for(u=0;u<v;u++)!n[u]&&o[u]>t&&(p=u,t=o[p]);h.bindBuffer(h.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[p]);h.vertexAttribPointer(c["morphTarget"+f],3,h.FLOAT,!1,0,0);k.__webglMorphTargetInfluences[f]=t;n[p]=1;t=-1;f++}}j.program.uniforms.morphTargetInfluences!==null&&h.uniform1fv(j.program.uniforms.morphTargetInfluences,k.__webglMorphTargetInfluences)}if(g.__webglCustomAttributes)for(m in g.__webglCustomAttributes)b[m]>=
+0&&(c=g.__webglCustomAttributes[m],h.bindBuffer(h.ARRAY_BUFFER,c.buffer),h.vertexAttribPointer(b[m],c.size,h.FLOAT,!1,0,0));b.color>=0&&(h.bindBuffer(h.ARRAY_BUFFER,g.__webglColorBuffer),h.vertexAttribPointer(b.color,3,h.FLOAT,!1,0,0));b.normal>=0&&(h.bindBuffer(h.ARRAY_BUFFER,g.__webglNormalBuffer),h.vertexAttribPointer(b.normal,3,h.FLOAT,!1,0,0));b.tangent>=0&&(h.bindBuffer(h.ARRAY_BUFFER,g.__webglTangentBuffer),h.vertexAttribPointer(b.tangent,4,h.FLOAT,!1,0,0));b.uv>=0&&(g.__webglUVBuffer?(h.bindBuffer(h.ARRAY_BUFFER,
+g.__webglUVBuffer),h.vertexAttribPointer(b.uv,2,h.FLOAT,!1,0,0),h.enableVertexAttribArray(b.uv)):h.disableVertexAttribArray(b.uv));b.uv2>=0&&(g.__webglUV2Buffer?(h.bindBuffer(h.ARRAY_BUFFER,g.__webglUV2Buffer),h.vertexAttribPointer(b.uv2,2,h.FLOAT,!1,0,0),h.enableVertexAttribArray(b.uv2)):h.disableVertexAttribArray(b.uv2));j.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(h.bindBuffer(h.ARRAY_BUFFER,g.__webglSkinVertexABuffer),h.vertexAttribPointer(b.skinVertexA,4,
+h.FLOAT,!1,0,0),h.bindBuffer(h.ARRAY_BUFFER,g.__webglSkinVertexBBuffer),h.vertexAttribPointer(b.skinVertexB,4,h.FLOAT,!1,0,0),h.bindBuffer(h.ARRAY_BUFFER,g.__webglSkinIndicesBuffer),h.vertexAttribPointer(b.skinIndex,4,h.FLOAT,!1,0,0),h.bindBuffer(h.ARRAY_BUFFER,g.__webglSkinWeightsBuffer),h.vertexAttribPointer(b.skinWeight,4,h.FLOAT,!1,0,0));k instanceof THREE.Mesh?(j.wireframe?(h.lineWidth(j.wireframeLinewidth),h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,g.__webglLineBuffer),h.drawElements(h.LINES,g.__webglLineCount,
+h.UNSIGNED_SHORT,0)):(h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,g.__webglFaceBuffer),h.drawElements(h.TRIANGLES,g.__webglFaceCount,h.UNSIGNED_SHORT,0)),V.data.vertices+=g.__webglFaceCount,V.data.faces+=g.__webglFaceCount/3,V.data.drawCalls++):k instanceof THREE.Line?(k=k.type==THREE.LineStrip?h.LINE_STRIP:h.LINES,h.lineWidth(j.linewidth),h.drawArrays(k,0,g.__webglLineCount),V.data.drawCalls++):k instanceof THREE.ParticleSystem?(h.drawArrays(h.POINTS,0,g.__webglParticleCount),V.data.drawCalls++):k instanceof
+THREE.Ribbon&&(h.drawArrays(h.TRIANGLE_STRIP,0,g.__webglVertexCount),V.data.drawCalls++)}}function g(b,e,c){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=h.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=h.createBuffer();b.hasPos&&(h.bindBuffer(h.ARRAY_BUFFER,b.__webglVertexBuffer),h.bufferData(h.ARRAY_BUFFER,b.positionArray,h.DYNAMIC_DRAW),h.enableVertexAttribArray(e.attributes.position),h.vertexAttribPointer(e.attributes.position,3,h.FLOAT,!1,0,0));if(b.hasNormal){h.bindBuffer(h.ARRAY_BUFFER,
+b.__webglNormalBuffer);if(c==THREE.FlatShading){var f,g,j,k,m,n,o,t,p,u,v=b.count*3;for(u=0;u<v;u+=9)c=b.normalArray,f=c[u],g=c[u+1],j=c[u+2],k=c[u+3],n=c[u+4],t=c[u+5],m=c[u+6],o=c[u+7],p=c[u+8],f=(f+k+m)/3,g=(g+n+o)/3,j=(j+t+p)/3,c[u]=f,c[u+1]=g,c[u+2]=j,c[u+3]=f,c[u+4]=g,c[u+5]=j,c[u+6]=f,c[u+7]=g,c[u+8]=j}h.bufferData(h.ARRAY_BUFFER,b.normalArray,h.DYNAMIC_DRAW);h.enableVertexAttribArray(e.attributes.normal);h.vertexAttribPointer(e.attributes.normal,3,h.FLOAT,!1,0,0)}h.drawArrays(h.TRIANGLES,
+0,b.count);b.count=0}function j(b){if(ca!=b.doubleSided)b.doubleSided?h.disable(h.CULL_FACE):h.enable(h.CULL_FACE),ca=b.doubleSided;if(U!=b.flipSided)b.flipSided?h.frontFace(h.CW):h.frontFace(h.CCW),U=b.flipSided}function k(b){ja!=b&&(b?h.enable(h.DEPTH_TEST):h.disable(h.DEPTH_TEST),ja=b)}function m(b){ea[0].set(b.n41-b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-b.n14);ea[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);ea[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);ea[3].set(b.n41-b.n21,
 b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);ea[4].set(b.n41-b.n31,b.n42-b.n32,b.n43-b.n33,b.n44-b.n34);ea[5].set(b.n41+b.n31,b.n42+b.n32,b.n43+b.n33,b.n44+b.n34);for(var e,b=0;b<6;b++)e=ea[b],e.divideScalar(Math.sqrt(e.x*e.x+e.y*e.y+e.z*e.z))}function n(b){for(var e=b.matrixWorld,c=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),f=0;f<6;f++)if(b=ea[f].x*e.n14+ea[f].y*e.n24+ea[f].z*e.n34+ea[f].w,b<=c)return!1;return!0}function o(b,e){b.list[b.count]=e;b.count+=1}function p(b){var e,
-c,f=b.object,j=b.opaque,h=b.transparent;h.count=0;b=j.count=0;for(e=f.materials.length;b<e;b++)c=f.materials[b],c.transparent?o(h,c):o(j,c)}function t(b){var e,c,f,j,h=b.object,g=b.buffer,k=b.opaque,m=b.transparent;m.count=0;b=k.count=0;for(f=h.materials.length;b<f;b++)if(e=h.materials[b],e instanceof THREE.MeshFaceMaterial){e=0;for(c=g.materials.length;e<c;e++)(j=g.materials[e])&&(j.transparent?o(m,j):o(k,j))}else(j=e)&&(j.transparent?o(m,j):o(k,j))}function v(b,e){return e.z-b.z}function u(b){j.enable(j.POLYGON_OFFSET_FILL);
-j.polygonOffset(0.1,1);j.enable(j.STENCIL_TEST);j.enable(j.DEPTH_TEST);j.depthMask(!1);j.colorMask(!1,!1,!1,!1);j.stencilFunc(j.ALWAYS,1,255);j.stencilOpSeparate(j.BACK,j.KEEP,j.INCR,j.KEEP);j.stencilOpSeparate(j.FRONT,j.KEEP,j.DECR,j.KEEP);var e,c=b.lights.length,f,h=b.lights,g=[],k,m,n,o,p,t=b.__webglShadowVolumes.length;for(e=0;e<c;e++)if(f=b.lights[e],f instanceof THREE.DirectionalLight&&f.castShadow){g[0]=-f.position.x;g[1]=-f.position.y;g[2]=-f.position.z;for(p=0;p<t;p++)f=b.__webglShadowVolumes[p].object,
-k=b.__webglShadowVolumes[p].buffer,m=f.materials[0],m.program||V.initMaterial(m,h,void 0,f),m=m.program,n=m.uniforms,o=m.attributes,O!==m&&(j.useProgram(m),O=m,j.uniformMatrix4fv(n.projectionMatrix,!1,T),j.uniformMatrix4fv(n.viewMatrix,!1,Z),j.uniform3fv(n.directionalLightDirection,g)),f.matrixWorld.flattenToArray(f._objectMatrixArray),j.uniformMatrix4fv(n.objectMatrix,!1,f._objectMatrixArray),j.bindBuffer(j.ARRAY_BUFFER,k.__webglVertexBuffer),j.vertexAttribPointer(o.position,3,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,
-k.__webglNormalBuffer),j.vertexAttribPointer(o.normal,3,j.FLOAT,!1,0,0),j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,k.__webglFaceBuffer),j.cullFace(j.FRONT),j.drawElements(j.TRIANGLES,k.__webglFaceCount,j.UNSIGNED_SHORT,0),j.cullFace(j.BACK),j.drawElements(j.TRIANGLES,k.__webglFaceCount,j.UNSIGNED_SHORT,0)}j.disable(j.POLYGON_OFFSET_FILL);j.colorMask(!0,!0,!0,!0);j.stencilFunc(j.NOTEQUAL,0,255);j.stencilOp(j.KEEP,j.KEEP,j.KEEP);j.disable(j.DEPTH_TEST);S=-1;O=da.program;j.useProgram(da.program);j.uniformMatrix4fv(da.projectionLocation,
-!1,T);j.uniform1f(da.darknessLocation,da.darkness);j.bindBuffer(j.ARRAY_BUFFER,da.vertexBuffer);j.vertexAttribPointer(da.vertexLocation,3,j.FLOAT,!1,0,0);j.enableVertexAttribArray(da.vertexLocation);j.blendFunc(j.ONE,j.ONE_MINUS_SRC_ALPHA);j.blendEquation(j.FUNC_ADD);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,da.elementBuffer);j.drawElements(j.TRIANGLES,6,j.UNSIGNED_SHORT,0);j.disable(j.STENCIL_TEST);j.enable(j.DEPTH_TEST);j.depthMask(M)}function w(b,e){var c,f,h;c=_sprite.attributes;var g=_sprite.uniforms,
-k=ga/Y,m,n=[],o=Y*0.5,p=ga*0.5,t=!0;j.useProgram(_sprite.program);O=_sprite.program;S=-1;ta||(j.enableVertexAttribArray(_sprite.attributes.position),j.enableVertexAttribArray(_sprite.attributes.uv),ta=!0);j.disable(j.CULL_FACE);j.enable(j.BLEND);j.depthMask(!0);j.bindBuffer(j.ARRAY_BUFFER,_sprite.vertexBuffer);j.vertexAttribPointer(c.position,2,j.FLOAT,!1,16,0);j.vertexAttribPointer(c.uv,2,j.FLOAT,!1,16,8);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,_sprite.elementBuffer);j.uniformMatrix4fv(g.projectionMatrix,
-!1,T);j.activeTexture(j.TEXTURE0);j.uniform1i(g.map,0);c=0;for(f=b.__webglSprites.length;c<f;c++)h=b.__webglSprites[c],h.useScreenCoordinates?h.z=-h.position.z:(h._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,h.matrixWorld,h._modelViewMatrixArray),h.z=-h._modelViewMatrix.n34);b.__webglSprites.sort(v);c=0;for(f=b.__webglSprites.length;c<f;c++)h=b.__webglSprites[c],h.material===void 0&&h.map&&h.map.image&&h.map.image.width&&(h.useScreenCoordinates?(j.uniform1i(g.useScreenCoordinates,1),j.uniform3f(g.screenPosition,
-(h.position.x-o)/o,(p-h.position.y)/p,Math.max(0,Math.min(1,h.position.z)))):(j.uniform1i(g.useScreenCoordinates,0),j.uniform1i(g.affectedByDistance,h.affectedByDistance?1:0),j.uniformMatrix4fv(g.modelViewMatrix,!1,h._modelViewMatrixArray)),m=h.map.image.width/(h.affectedByDistance?1:ga),n[0]=m*k*h.scale.x,n[1]=m*h.scale.y,j.uniform2f(g.uvScale,h.uvScale.x,h.uvScale.y),j.uniform2f(g.uvOffset,h.uvOffset.x,h.uvOffset.y),j.uniform2f(g.alignment,h.alignment.x,h.alignment.y),j.uniform1f(g.opacity,h.opacity),
-j.uniform1f(g.rotation,h.rotation),j.uniform2fv(g.scale,n),h.mergeWith3D&&!t?(j.enable(j.DEPTH_TEST),t=!0):!h.mergeWith3D&&t&&(j.disable(j.DEPTH_TEST),t=!1),I(h.blending),C(h.map,0),j.drawElements(j.TRIANGLES,6,j.UNSIGNED_SHORT,0));j.enable(j.CULL_FACE);j.enable(j.DEPTH_TEST);j.depthMask(M)}function E(b,e){var c,f,h=b.__webglLensFlares.length,g,k,m,n=new THREE.Vector3,o=ga/Y,p=Y*0.5,t=ga*0.5,u=16/ga,v=[u*o,u],w=[1,1,0],B=[1,1],A=P.uniforms;c=P.attributes;j.useProgram(P.program);O=P.program;S=-1;za||
-(j.enableVertexAttribArray(P.attributes.vertex),j.enableVertexAttribArray(P.attributes.uv),za=!0);j.uniform1i(A.occlusionMap,0);j.uniform1i(A.map,1);j.bindBuffer(j.ARRAY_BUFFER,P.vertexBuffer);j.vertexAttribPointer(c.vertex,2,j.FLOAT,!1,16,0);j.vertexAttribPointer(c.uv,2,j.FLOAT,!1,16,8);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,P.elementBuffer);j.disable(j.CULL_FACE);j.depthMask(!1);j.activeTexture(j.TEXTURE0);j.bindTexture(j.TEXTURE_2D,P.occlusionTexture);j.activeTexture(j.TEXTURE1);for(f=0;f<h;f++)if(c=
-b.__webglLensFlares[f].object,n.set(c.matrixWorld.n14,c.matrixWorld.n24,c.matrixWorld.n34),e.matrixWorldInverse.multiplyVector3(n),e.projectionMatrix.multiplyVector3(n),w[0]=n.x,w[1]=n.y,w[2]=n.z,B[0]=w[0]*p+p,B[1]=w[1]*t+t,P.hasVertexTexture||B[0]>0&&B[0]<Y&&B[1]>0&&B[1]<ga){j.bindTexture(j.TEXTURE_2D,P.tempTexture);j.copyTexImage2D(j.TEXTURE_2D,0,j.RGB,B[0]-8,B[1]-8,16,16,0);j.uniform1i(A.renderType,0);j.uniform2fv(A.scale,v);j.uniform3fv(A.screenPosition,w);j.disable(j.BLEND);j.enable(j.DEPTH_TEST);
-j.drawElements(j.TRIANGLES,6,j.UNSIGNED_SHORT,0);j.bindTexture(j.TEXTURE_2D,P.occlusionTexture);j.copyTexImage2D(j.TEXTURE_2D,0,j.RGBA,B[0]-8,B[1]-8,16,16,0);j.uniform1i(A.renderType,1);j.disable(j.DEPTH_TEST);j.bindTexture(j.TEXTURE_2D,P.tempTexture);j.drawElements(j.TRIANGLES,6,j.UNSIGNED_SHORT,0);c.positionScreen.x=w[0];c.positionScreen.y=w[1];c.positionScreen.z=w[2];c.customUpdateCallback?c.customUpdateCallback(c):c.updateLensFlares();j.uniform1i(A.renderType,2);j.enable(j.BLEND);g=0;for(k=c.lensFlares.length;g<
-k;g++)if(m=c.lensFlares[g],m.opacity>0.0010&&m.scale>0.0010)w[0]=m.x,w[1]=m.y,w[2]=m.z,u=m.size*m.scale/ga,v[0]=u*o,v[1]=u,j.uniform3fv(A.screenPosition,w),j.uniform2fv(A.scale,v),j.uniform1f(A.rotation,m.rotation),j.uniform1f(A.opacity,m.opacity),I(m.blending),C(m.texture,1),j.drawElements(j.TRIANGLES,6,j.UNSIGNED_SHORT,0)}j.enable(j.CULL_FACE);j.enable(j.DEPTH_TEST);j.depthMask(M)}function H(b,e){b._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}
-function B(b){var e,f,h,g,k;if(b instanceof THREE.Mesh){f=b.geometry;for(e in f.geometryGroups){h=f.geometryGroups[e];k=!1;for(g in h.__webglCustomAttributes)if(h.__webglCustomAttributes[g].needsUpdate){k=!0;break}if(f.__dirtyVertices||f.__dirtyMorphTargets||f.__dirtyElements||f.__dirtyUvs||f.__dirtyNormals||f.__dirtyColors||f.__dirtyTangents||k){k=b;var m=j.DYNAMIC_DRAW;if(h.__inittedArrays){var n=void 0,o=void 0,p=void 0,t=void 0,u=p=void 0,v=void 0,w=void 0,B=void 0,A=void 0,E=void 0,H=void 0,
-J=void 0,aa=void 0,C=void 0,G=void 0,I=void 0,K=void 0,F=t=B=t=w=v=void 0,D=void 0,z=D=F=v=void 0,ma=void 0,N=z=D=F=p=p=u=B=t=z=D=F=ma=z=D=F=ma=z=D=F=void 0,M=0,ia=0,P=0,pa=0,R=0,V=0,O=0,T=0,Q=0,L=0,S=0,D=F=0,W=h.__vertexArray,da=h.__uvArray,ca=h.__uv2Array,ja=h.__normalArray,U=h.__tangentArray,$=h.__colorArray,la=h.__skinVertexAArray,X=h.__skinVertexBArray,Y=h.__skinIndexArray,Z=h.__skinWeightArray,ka=h.__morphTargetsArrays,ga=h.__webglCustomAttributes,z=void 0,ea=h.__faceArray,fa=h.__lineArray,
-na=h.__needsSmoothNormals,E=h.__vertexColorType,A=h.__uvType,H=h.__normalType,ra=k.geometry,Ba=ra.__dirtyVertices,ya=ra.__dirtyElements,ta=ra.__dirtyUvs,za=ra.__dirtyNormals,Xa=ra.__dirtyTangents,Ya=ra.__dirtyColors,Za=ra.__dirtyMorphTargets,Ga=ra.vertices,ab=h.faces,db=ra.faces,bb=ra.faceVertexUvs[0],cb=ra.faceVertexUvs[1],Ha=ra.skinVerticesA,Ia=ra.skinVerticesB,Ja=ra.skinIndices,Aa=ra.skinWeights,Ea=k instanceof THREE.ShadowVolume?ra.edgeFaces:void 0;morphTargets=ra.morphTargets;if(ga)for(N in ga)ga[N].offset=
-0,ga[N].offsetSrc=0;n=0;for(o=ab.length;n<o;n++)if(p=ab[n],t=db[p],bb&&(J=bb[p]),cb&&(aa=cb[p]),p=t.vertexNormals,u=t.normal,v=t.vertexColors,w=t.color,B=t.vertexTangents,t instanceof THREE.Face3){if(Ba)C=Ga[t.a].position,G=Ga[t.b].position,I=Ga[t.c].position,W[ia]=C.x,W[ia+1]=C.y,W[ia+2]=C.z,W[ia+3]=G.x,W[ia+4]=G.y,W[ia+5]=G.z,W[ia+6]=I.x,W[ia+7]=I.y,W[ia+8]=I.z,ia+=9;if(ga)for(N in ga)if(z=ga[N],z.needsUpdate)F=z.offset,D=z.offsetSrc,z.size===1?(z.boundTo===void 0||z.boundTo==="vertices"?(z.array[F+
-0]=z.value[t.a],z.array[F+1]=z.value[t.b],z.array[F+2]=z.value[t.c]):z.boundTo==="faces"?(z.array[F+0]=z.value[D],z.array[F+1]=z.value[D],z.array[F+2]=z.value[D],z.offsetSrc++):z.boundTo==="faceVertices"&&(z.array[F+0]=z.value[D+0],z.array[F+1]=z.value[D+1],z.array[F+2]=z.value[D+2],z.offsetSrc+=3),z.offset+=3):(z.boundTo===void 0||z.boundTo==="vertices"?(C=z.value[t.a],G=z.value[t.b],I=z.value[t.c]):z.boundTo==="faces"?(C=z.value[D],G=z.value[D],I=z.value[D],z.offsetSrc++):z.boundTo==="faceVertices"&&
-(C=z.value[D+0],G=z.value[D+1],I=z.value[D+2],z.offsetSrc+=3),z.size===2?(z.array[F+0]=C.x,z.array[F+1]=C.y,z.array[F+2]=G.x,z.array[F+3]=G.y,z.array[F+4]=I.x,z.array[F+5]=I.y,z.offset+=6):z.size===3?(z.type==="c"?(z.array[F+0]=C.r,z.array[F+1]=C.g,z.array[F+2]=C.b,z.array[F+3]=G.r,z.array[F+4]=G.g,z.array[F+5]=G.b,z.array[F+6]=I.r,z.array[F+7]=I.g,z.array[F+8]=I.b):(z.array[F+0]=C.x,z.array[F+1]=C.y,z.array[F+2]=C.z,z.array[F+3]=G.x,z.array[F+4]=G.y,z.array[F+5]=G.z,z.array[F+6]=I.x,z.array[F+7]=
-I.y,z.array[F+8]=I.z),z.offset+=9):(z.array[F+0]=C.x,z.array[F+1]=C.y,z.array[F+2]=C.z,z.array[F+3]=C.w,z.array[F+4]=G.x,z.array[F+5]=G.y,z.array[F+6]=G.z,z.array[F+7]=G.w,z.array[F+8]=I.x,z.array[F+9]=I.y,z.array[F+10]=I.z,z.array[F+11]=I.w,z.offset+=12));if(Za){F=0;for(D=morphTargets.length;F<D;F++)C=morphTargets[F].vertices[t.a].position,G=morphTargets[F].vertices[t.b].position,I=morphTargets[F].vertices[t.c].position,z=ka[F],z[S+0]=C.x,z[S+1]=C.y,z[S+2]=C.z,z[S+3]=G.x,z[S+4]=G.y,z[S+5]=G.z,z[S+
-6]=I.x,z[S+7]=I.y,z[S+8]=I.z;S+=9}if(Aa.length)F=Aa[t.a],D=Aa[t.b],z=Aa[t.c],Z[L]=F.x,Z[L+1]=F.y,Z[L+2]=F.z,Z[L+3]=F.w,Z[L+4]=D.x,Z[L+5]=D.y,Z[L+6]=D.z,Z[L+7]=D.w,Z[L+8]=z.x,Z[L+9]=z.y,Z[L+10]=z.z,Z[L+11]=z.w,F=Ja[t.a],D=Ja[t.b],z=Ja[t.c],Y[L]=F.x,Y[L+1]=F.y,Y[L+2]=F.z,Y[L+3]=F.w,Y[L+4]=D.x,Y[L+5]=D.y,Y[L+6]=D.z,Y[L+7]=D.w,Y[L+8]=z.x,Y[L+9]=z.y,Y[L+10]=z.z,Y[L+11]=z.w,F=Ha[t.a],D=Ha[t.b],z=Ha[t.c],la[L]=F.x,la[L+1]=F.y,la[L+2]=F.z,la[L+3]=1,la[L+4]=D.x,la[L+5]=D.y,la[L+6]=D.z,la[L+7]=1,la[L+8]=z.x,
-la[L+9]=z.y,la[L+10]=z.z,la[L+11]=1,F=Ia[t.a],D=Ia[t.b],z=Ia[t.c],X[L]=F.x,X[L+1]=F.y,X[L+2]=F.z,X[L+3]=1,X[L+4]=D.x,X[L+5]=D.y,X[L+6]=D.z,X[L+7]=1,X[L+8]=z.x,X[L+9]=z.y,X[L+10]=z.z,X[L+11]=1,L+=12;if(Ya&&E)v.length==3&&E==THREE.VertexColors?(t=v[0],F=v[1],D=v[2]):D=F=t=w,$[Q]=t.r,$[Q+1]=t.g,$[Q+2]=t.b,$[Q+3]=F.r,$[Q+4]=F.g,$[Q+5]=F.b,$[Q+6]=D.r,$[Q+7]=D.g,$[Q+8]=D.b,Q+=9;if(Xa&&ra.hasTangents)v=B[0],w=B[1],t=B[2],U[O]=v.x,U[O+1]=v.y,U[O+2]=v.z,U[O+3]=v.w,U[O+4]=w.x,U[O+5]=w.y,U[O+6]=w.z,U[O+7]=w.w,
-U[O+8]=t.x,U[O+9]=t.y,U[O+10]=t.z,U[O+11]=t.w,O+=12;if(za&&H)if(p.length==3&&na)for(B=0;B<3;B++)u=p[B],ja[V]=u.x,ja[V+1]=u.y,ja[V+2]=u.z,V+=3;else for(B=0;B<3;B++)ja[V]=u.x,ja[V+1]=u.y,ja[V+2]=u.z,V+=3;if(ta&&J!==void 0&&A)for(B=0;B<3;B++)p=J[B],da[P]=p.u,da[P+1]=p.v,P+=2;if(ta&&aa!==void 0&&A)for(B=0;B<3;B++)p=aa[B],ca[pa]=p.u,ca[pa+1]=p.v,pa+=2;ya&&(ea[R]=M,ea[R+1]=M+1,ea[R+2]=M+2,R+=3,fa[T]=M,fa[T+1]=M+1,fa[T+2]=M,fa[T+3]=M+2,fa[T+4]=M+1,fa[T+5]=M+2,T+=6,M+=3)}else if(t instanceof THREE.Face4){if(Ba)C=
-Ga[t.a].position,G=Ga[t.b].position,I=Ga[t.c].position,K=Ga[t.d].position,W[ia]=C.x,W[ia+1]=C.y,W[ia+2]=C.z,W[ia+3]=G.x,W[ia+4]=G.y,W[ia+5]=G.z,W[ia+6]=I.x,W[ia+7]=I.y,W[ia+8]=I.z,W[ia+9]=K.x,W[ia+10]=K.y,W[ia+11]=K.z,ia+=12;if(ga)for(N in ga)if(z=ga[N],z.needsUpdate)F=z.offset,D=z.offsetSrc,z.size===1?(z.boundTo===void 0||z.boundTo==="vertices"?(z.array[F+0]=z.value[t.a],z.array[F+1]=z.value[t.b],z.array[F+2]=z.value[t.c],z.array[F+3]=z.value[t.d]):z.boundTo==="faces"?(z.array[F+0]=z.value[D],z.array[F+
-1]=z.value[D],z.array[F+2]=z.value[D],z.array[F+3]=z.value[D],z.offsetSrc++):z.boundTo==="faceVertices"&&(z.array[F+0]=z.value[D+0],z.array[F+1]=z.value[D+1],z.array[F+2]=z.value[D+2],z.array[F+3]=z.value[D+3],z.offsetSrc+=4),z.offset+=4):(z.boundTo===void 0||z.boundTo==="vertices"?(C=z.value[t.a],G=z.value[t.b],I=z.value[t.c],K=z.value[t.d]):z.boundTo==="faces"?(C=z.value[D],G=z.value[D],I=z.value[D],K=z.value[D],z.offsetSrc++):z.boundTo==="faceVertices"&&(C=z.value[D+0],G=z.value[D+1],I=z.value[D+
-2],K=z.value[D+3],z.offsetSrc+=4),z.size===2?(z.array[F+0]=C.x,z.array[F+1]=C.y,z.array[F+2]=G.x,z.array[F+3]=G.y,z.array[F+4]=I.x,z.array[F+5]=I.y,z.array[F+6]=K.x,z.array[F+7]=K.y,z.offset+=8):z.size===3?(z.type==="c"?(z.array[F+0]=C.r,z.array[F+1]=C.g,z.array[F+2]=C.b,z.array[F+3]=G.r,z.array[F+4]=G.g,z.array[F+5]=G.b,z.array[F+6]=I.r,z.array[F+7]=I.g,z.array[F+8]=I.b,z.array[F+9]=K.r,z.array[F+10]=K.g,z.array[F+11]=K.b):(z.array[F+0]=C.x,z.array[F+1]=C.y,z.array[F+2]=C.z,z.array[F+3]=G.x,z.array[F+
-4]=G.y,z.array[F+5]=G.z,z.array[F+6]=I.x,z.array[F+7]=I.y,z.array[F+8]=I.z,z.array[F+9]=K.x,z.array[F+10]=K.y,z.array[F+11]=K.z),z.offset+=12):(z.array[F+0]=C.x,z.array[F+1]=C.y,z.array[F+2]=C.z,z.array[F+3]=C.w,z.array[F+4]=G.x,z.array[F+5]=G.y,z.array[F+6]=G.z,z.array[F+7]=G.w,z.array[F+8]=I.x,z.array[F+9]=I.y,z.array[F+10]=I.z,z.array[F+11]=I.w,z.array[F+12]=K.x,z.array[F+13]=K.y,z.array[F+14]=K.z,z.array[F+15]=K.w,z.offset+=16));if(Za){F=0;for(D=morphTargets.length;F<D;F++)C=morphTargets[F].vertices[t.a].position,
-G=morphTargets[F].vertices[t.b].position,I=morphTargets[F].vertices[t.c].position,K=morphTargets[F].vertices[t.d].position,z=ka[F],z[S+0]=C.x,z[S+1]=C.y,z[S+2]=C.z,z[S+3]=G.x,z[S+4]=G.y,z[S+5]=G.z,z[S+6]=I.x,z[S+7]=I.y,z[S+8]=I.z,z[S+9]=K.x,z[S+10]=K.y,z[S+11]=K.z;S+=12}if(Aa.length)F=Aa[t.a],D=Aa[t.b],z=Aa[t.c],ma=Aa[t.d],Z[L]=F.x,Z[L+1]=F.y,Z[L+2]=F.z,Z[L+3]=F.w,Z[L+4]=D.x,Z[L+5]=D.y,Z[L+6]=D.z,Z[L+7]=D.w,Z[L+8]=z.x,Z[L+9]=z.y,Z[L+10]=z.z,Z[L+11]=z.w,Z[L+12]=ma.x,Z[L+13]=ma.y,Z[L+14]=ma.z,Z[L+15]=
-ma.w,F=Ja[t.a],D=Ja[t.b],z=Ja[t.c],ma=Ja[t.d],Y[L]=F.x,Y[L+1]=F.y,Y[L+2]=F.z,Y[L+3]=F.w,Y[L+4]=D.x,Y[L+5]=D.y,Y[L+6]=D.z,Y[L+7]=D.w,Y[L+8]=z.x,Y[L+9]=z.y,Y[L+10]=z.z,Y[L+11]=z.w,Y[L+12]=ma.x,Y[L+13]=ma.y,Y[L+14]=ma.z,Y[L+15]=ma.w,F=Ha[t.a],D=Ha[t.b],z=Ha[t.c],ma=Ha[t.d],la[L]=F.x,la[L+1]=F.y,la[L+2]=F.z,la[L+3]=1,la[L+4]=D.x,la[L+5]=D.y,la[L+6]=D.z,la[L+7]=1,la[L+8]=z.x,la[L+9]=z.y,la[L+10]=z.z,la[L+11]=1,la[L+12]=ma.x,la[L+13]=ma.y,la[L+14]=ma.z,la[L+15]=1,F=Ia[t.a],D=Ia[t.b],z=Ia[t.c],t=Ia[t.d],
-X[L]=F.x,X[L+1]=F.y,X[L+2]=F.z,X[L+3]=1,X[L+4]=D.x,X[L+5]=D.y,X[L+6]=D.z,X[L+7]=1,X[L+8]=z.x,X[L+9]=z.y,X[L+10]=z.z,X[L+11]=1,X[L+12]=t.x,X[L+13]=t.y,X[L+14]=t.z,X[L+15]=1,L+=16;if(Ya&&E)v.length==4&&E==THREE.VertexColors?(t=v[0],F=v[1],D=v[2],v=v[3]):v=D=F=t=w,$[Q]=t.r,$[Q+1]=t.g,$[Q+2]=t.b,$[Q+3]=F.r,$[Q+4]=F.g,$[Q+5]=F.b,$[Q+6]=D.r,$[Q+7]=D.g,$[Q+8]=D.b,$[Q+9]=v.r,$[Q+10]=v.g,$[Q+11]=v.b,Q+=12;if(Xa&&ra.hasTangents)v=B[0],w=B[1],t=B[2],B=B[3],U[O]=v.x,U[O+1]=v.y,U[O+2]=v.z,U[O+3]=v.w,U[O+4]=w.x,
-U[O+5]=w.y,U[O+6]=w.z,U[O+7]=w.w,U[O+8]=t.x,U[O+9]=t.y,U[O+10]=t.z,U[O+11]=t.w,U[O+12]=B.x,U[O+13]=B.y,U[O+14]=B.z,U[O+15]=B.w,O+=16;if(za&&H)if(p.length==4&&na)for(B=0;B<4;B++)u=p[B],ja[V]=u.x,ja[V+1]=u.y,ja[V+2]=u.z,V+=3;else for(B=0;B<4;B++)ja[V]=u.x,ja[V+1]=u.y,ja[V+2]=u.z,V+=3;if(ta&&J!==void 0&&A)for(B=0;B<4;B++)p=J[B],da[P]=p.u,da[P+1]=p.v,P+=2;if(ta&&aa!==void 0&&A)for(B=0;B<4;B++)p=aa[B],ca[pa]=p.u,ca[pa+1]=p.v,pa+=2;ya&&(ea[R]=M,ea[R+1]=M+1,ea[R+2]=M+3,ea[R+3]=M+1,ea[R+4]=M+2,ea[R+5]=M+
-3,R+=6,fa[T]=M,fa[T+1]=M+1,fa[T+2]=M,fa[T+3]=M+3,fa[T+4]=M+1,fa[T+5]=M+2,fa[T+6]=M+2,fa[T+7]=M+3,T+=8,M+=4)}if(Ea){n=0;for(o=Ea.length;n<o;n++)ea[R]=Ea[n].a,ea[R+1]=Ea[n].b,ea[R+2]=Ea[n].c,ea[R+3]=Ea[n].a,ea[R+4]=Ea[n].c,ea[R+5]=Ea[n].d,R+=6}Ba&&(j.bindBuffer(j.ARRAY_BUFFER,h.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,W,m));if(ga)for(N in ga)if(z=ga[N],z.needsUpdate)j.bindBuffer(j.ARRAY_BUFFER,z.buffer),j.bufferData(j.ARRAY_BUFFER,z.array,m),z.needsUpdate=!1;if(Za){F=0;for(D=morphTargets.length;F<
-D;F++)j.bindBuffer(j.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[F]),j.bufferData(j.ARRAY_BUFFER,ka[F],m)}Ya&&Q>0&&(j.bindBuffer(j.ARRAY_BUFFER,h.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,$,m));za&&(j.bindBuffer(j.ARRAY_BUFFER,h.__webglNormalBuffer),j.bufferData(j.ARRAY_BUFFER,ja,m));Xa&&ra.hasTangents&&(j.bindBuffer(j.ARRAY_BUFFER,h.__webglTangentBuffer),j.bufferData(j.ARRAY_BUFFER,U,m));ta&&P>0&&(j.bindBuffer(j.ARRAY_BUFFER,h.__webglUVBuffer),j.bufferData(j.ARRAY_BUFFER,da,m));ta&&pa>0&&(j.bindBuffer(j.ARRAY_BUFFER,
-h.__webglUV2Buffer),j.bufferData(j.ARRAY_BUFFER,ca,m));ya&&(j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),j.bufferData(j.ELEMENT_ARRAY_BUFFER,ea,m),j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer),j.bufferData(j.ELEMENT_ARRAY_BUFFER,fa,m));L>0&&(j.bindBuffer(j.ARRAY_BUFFER,h.__webglSkinVertexABuffer),j.bufferData(j.ARRAY_BUFFER,la,m),j.bindBuffer(j.ARRAY_BUFFER,h.__webglSkinVertexBBuffer),j.bufferData(j.ARRAY_BUFFER,X,m),j.bindBuffer(j.ARRAY_BUFFER,h.__webglSkinIndicesBuffer),j.bufferData(j.ARRAY_BUFFER,
-Y,m),j.bindBuffer(j.ARRAY_BUFFER,h.__webglSkinWeightsBuffer),j.bufferData(j.ARRAY_BUFFER,Z,m));k.dynamic||(delete h.__inittedArrays,delete h.__colorArray,delete h.__normalArray,delete h.__tangentArray,delete h.__uvArray,delete h.__uv2Array,delete h.__faceArray,delete h.__vertexArray,delete h.__lineArray,delete h.__skinVertexAArray,delete h.__skinVertexBArray,delete h.__skinIndexArray,delete h.__skinWeightArray)}}}f.__dirtyVertices=!1;f.__dirtyMorphTargets=!1;f.__dirtyElements=!1;f.__dirtyUvs=!1;f.__dirtyNormals=
-!1;f.__dirtyTangents=!1;f.__dirtyColors=!1}else if(b instanceof THREE.Ribbon){f=b.geometry;if(f.__dirtyVertices||f.__dirtyColors){b=f;e=j.DYNAMIC_DRAW;A=b.vertices;h=b.colors;E=A.length;k=h.length;H=b.__vertexArray;m=b.__colorArray;J=b.__dirtyColors;if(b.__dirtyVertices){for(n=0;n<E;n++)o=A[n].position,g=n*3,H[g]=o.x,H[g+1]=o.y,H[g+2]=o.z;j.bindBuffer(j.ARRAY_BUFFER,b.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,H,e)}if(J){for(n=0;n<k;n++)color=h[n],g=n*3,m[g]=color.r,m[g+1]=color.g,m[g+2]=color.b;
-j.bindBuffer(j.ARRAY_BUFFER,b.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,m,e)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(b instanceof THREE.Line){f=b.geometry;if(f.__dirtyVertices||f.__dirtyColors){b=f;e=j.DYNAMIC_DRAW;A=b.vertices;h=b.colors;E=A.length;k=h.length;H=b.__vertexArray;m=b.__colorArray;J=b.__dirtyColors;if(b.__dirtyVertices){for(n=0;n<E;n++)o=A[n].position,g=n*3,H[g]=o.x,H[g+1]=o.y,H[g+2]=o.z;j.bindBuffer(j.ARRAY_BUFFER,b.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,H,
-e)}if(J){for(n=0;n<k;n++)color=h[n],g=n*3,m[g]=color.r,m[g+1]=color.g,m[g+2]=color.b;j.bindBuffer(j.ARRAY_BUFFER,b.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,m,e)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(b instanceof THREE.ParticleSystem)f=b.geometry,(f.__dirtyVertices||f.__dirtyColors||b.sortParticles)&&c(f,j.DYNAMIC_DRAW,b),f.__dirtyVertices=!1,f.__dirtyColors=!1}function K(b){function e(b){var h=[];c=0;for(f=b.length;c<f;c++)b[c]==void 0?h.push("undefined"):h.push(b[c].id);return h.join("_")}
-var c,f,h,j,g,k,m,n,t={},o=b.morphTargets!==void 0?b.morphTargets.length:0;b.geometryGroups={};h=0;for(j=b.faces.length;h<j;h++)g=b.faces[h],k=g.materials,m=e(k),t[m]==void 0&&(t[m]={hash:m,counter:0}),n=t[m].hash+"_"+t[m].counter,b.geometryGroups[n]==void 0&&(b.geometryGroups[n]={faces:[],materials:k,vertices:0,numMorphTargets:o}),g=g instanceof THREE.Face3?3:4,b.geometryGroups[n].vertices+g>65535&&(t[m].counter+=1,n=t[m].hash+"_"+t[m].counter,b.geometryGroups[n]==void 0&&(b.geometryGroups[n]={faces:[],
-materials:k,vertices:0,numMorphTargets:o})),b.geometryGroups[n].faces.push(h),b.geometryGroups[n].vertices+=g}function A(b,e,c){b.push({buffer:e,object:c,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function I(b){if(b!=S){switch(b){case THREE.AdditiveBlending:j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,j.ONE);break;case THREE.SubtractiveBlending:j.blendEquation(j.FUNC_ADD);j.blendFunc(j.ZERO,j.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:j.blendEquation(j.FUNC_ADD);j.blendFunc(j.ZERO,
-j.SRC_COLOR);break;default:j.blendEquationSeparate(j.FUNC_ADD,j.FUNC_ADD),j.blendFuncSeparate(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA,j.ONE,j.ONE_MINUS_SRC_ALPHA)}S=b}}function G(b,e,c){(c.width&c.width-1)==0&&(c.height&c.height-1)==0?(j.texParameteri(b,j.TEXTURE_WRAP_S,J(e.wrapS)),j.texParameteri(b,j.TEXTURE_WRAP_T,J(e.wrapT)),j.texParameteri(b,j.TEXTURE_MAG_FILTER,J(e.magFilter)),j.texParameteri(b,j.TEXTURE_MIN_FILTER,J(e.minFilter)),j.generateMipmap(b)):(j.texParameteri(b,j.TEXTURE_WRAP_S,j.CLAMP_TO_EDGE),
-j.texParameteri(b,j.TEXTURE_WRAP_T,j.CLAMP_TO_EDGE),j.texParameteri(b,j.TEXTURE_MAG_FILTER,N(e.magFilter)),j.texParameteri(b,j.TEXTURE_MIN_FILTER,N(e.minFilter)))}function C(b,e){if(b.needsUpdate){if(b.__webglTexture)b.__webglTexture=j.deleteTexture(b.__webglTexture);b.__webglTexture=j.createTexture();j.bindTexture(j.TEXTURE_2D,b.__webglTexture);j.texImage2D(j.TEXTURE_2D,0,j.RGBA,j.RGBA,j.UNSIGNED_BYTE,b.image);G(j.TEXTURE_2D,b,b.image);j.bindTexture(j.TEXTURE_2D,null);b.needsUpdate=!1}j.activeTexture(j.TEXTURE0+
-e);j.bindTexture(j.TEXTURE_2D,b.__webglTexture)}function R(b){if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglFramebuffer=j.createFramebuffer();b.__webglRenderbuffer=j.createRenderbuffer();b.__webglTexture=j.createTexture();j.bindTexture(j.TEXTURE_2D,b.__webglTexture);j.texParameteri(j.TEXTURE_2D,j.TEXTURE_WRAP_S,J(b.wrapS));j.texParameteri(j.TEXTURE_2D,j.TEXTURE_WRAP_T,J(b.wrapT));j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MAG_FILTER,
-J(b.magFilter));j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MIN_FILTER,J(b.minFilter));j.texImage2D(j.TEXTURE_2D,0,J(b.format),b.width,b.height,0,J(b.format),J(b.type),null);j.bindRenderbuffer(j.RENDERBUFFER,b.__webglRenderbuffer);j.bindFramebuffer(j.FRAMEBUFFER,b.__webglFramebuffer);j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,j.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_COMPONENT16,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,
-j.DEPTH_ATTACHMENT,j.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_STENCIL,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_STENCIL_ATTACHMENT,j.RENDERBUFFER,b.__webglRenderbuffer)):j.renderbufferStorage(j.RENDERBUFFER,j.RGBA4,b.width,b.height);j.bindTexture(j.TEXTURE_2D,null);j.bindRenderbuffer(j.RENDERBUFFER,null);j.bindFramebuffer(j.FRAMEBUFFER,null)}var e,c;b?(e=b.__webglFramebuffer,c=b.width,b=b.height):(e=null,
-c=Y,b=ga);e!=$&&(j.bindFramebuffer(j.FRAMEBUFFER,e),j.viewport(W,fa,c,b),$=e)}function D(b,e){var c;b=="fragment"?c=j.createShader(j.FRAGMENT_SHADER):b=="vertex"&&(c=j.createShader(j.VERTEX_SHADER));j.shaderSource(c,e);j.compileShader(c);if(!j.getShaderParameter(c,j.COMPILE_STATUS))return console.error(j.getShaderInfoLog(c)),console.error(e),null;return c}function N(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return j.NEAREST;default:return j.LINEAR}}
-function J(b){switch(b){case THREE.RepeatWrapping:return j.REPEAT;case THREE.ClampToEdgeWrapping:return j.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return j.MIRRORED_REPEAT;case THREE.NearestFilter:return j.NEAREST;case THREE.NearestMipMapNearestFilter:return j.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return j.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return j.LINEAR;case THREE.LinearMipMapNearestFilter:return j.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return j.LINEAR_MIPMAP_LINEAR;
-case THREE.ByteType:return j.BYTE;case THREE.UnsignedByteType:return j.UNSIGNED_BYTE;case THREE.ShortType:return j.SHORT;case THREE.UnsignedShortType:return j.UNSIGNED_SHORT;case THREE.IntType:return j.INT;case THREE.UnsignedShortType:return j.UNSIGNED_INT;case THREE.FloatType:return j.FLOAT;case THREE.AlphaFormat:return j.ALPHA;case THREE.RGBFormat:return j.RGB;case THREE.RGBAFormat:return j.RGBA;case THREE.LuminanceFormat:return j.LUMINANCE;case THREE.LuminanceAlphaFormat:return j.LUMINANCE_ALPHA}return 0}
-var V=this,j,X=[],O=null,$=null,M=!0,ca=null,U=null,S=null,ja=null,W=0,fa=0,Y=0,ga=0,ea=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Q=new THREE.Matrix4,T=new Float32Array(16),Z=new Float32Array(16),ka=new THREE.Vector4,na={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},aa=b.canvas!==void 0?b.canvas:document.createElement("canvas"),ma=b.stencil!==void 0?b.stencil:
-!0,ia=b.antialias!==void 0?b.antialias:!1,pa=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),la=b.clearAlpha!==void 0?b.clearAlpha:0;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=aa;this.sortObjects=this.autoClear=!0;try{if(!(j=aa.getContext("experimental-webgl",{antialias:ia,stencil:ma})))throw"Error creating WebGL context.";}catch(Ba){console.error(Ba)}console.log(navigator.userAgent+" | "+j.getParameter(j.VERSION)+" | "+j.getParameter(j.VENDOR)+
-" | "+j.getParameter(j.RENDERER)+" | "+j.getParameter(j.SHADING_LANGUAGE_VERSION));j.clearColor(0,0,0,1);j.clearDepth(1);j.enable(j.DEPTH_TEST);j.depthFunc(j.LEQUAL);j.frontFace(j.CCW);j.cullFace(j.BACK);j.enable(j.CULL_FACE);j.enable(j.BLEND);j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA);j.clearColor(pa.r,pa.g,pa.b,la);this.context=j;var ya=j.getParameter(j.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;if(ma){var da={};da.vertices=new Float32Array(12);da.faces=new Uint16Array(6);
-da.darkness=0.5;da.vertices[0]=-20;da.vertices[1]=-20;da.vertices[2]=-1;da.vertices[3]=20;da.vertices[4]=-20;da.vertices[5]=-1;da.vertices[6]=20;da.vertices[7]=20;da.vertices[8]=-1;da.vertices[9]=-20;da.vertices[10]=20;da.vertices[11]=-1;da.faces[0]=0;da.faces[1]=1;da.faces[2]=2;da.faces[3]=0;da.faces[4]=2;da.faces[5]=3;da.vertexBuffer=j.createBuffer();da.elementBuffer=j.createBuffer();j.bindBuffer(j.ARRAY_BUFFER,da.vertexBuffer);j.bufferData(j.ARRAY_BUFFER,da.vertices,j.STATIC_DRAW);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,
-da.elementBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,da.faces,j.STATIC_DRAW);da.program=j.createProgram();j.attachShader(da.program,D("fragment",THREE.ShaderLib.shadowPost.fragmentShader));j.attachShader(da.program,D("vertex",THREE.ShaderLib.shadowPost.vertexShader));j.linkProgram(da.program);da.vertexLocation=j.getAttribLocation(da.program,"position");da.projectionLocation=j.getUniformLocation(da.program,"projectionMatrix");da.darknessLocation=j.getUniformLocation(da.program,"darkness")}var P={};
-P.vertices=new Float32Array(16);P.faces=new Uint16Array(6);b=0;P.vertices[b++]=-1;P.vertices[b++]=-1;P.vertices[b++]=0;P.vertices[b++]=0;P.vertices[b++]=1;P.vertices[b++]=-1;P.vertices[b++]=1;P.vertices[b++]=0;P.vertices[b++]=1;P.vertices[b++]=1;P.vertices[b++]=1;P.vertices[b++]=1;P.vertices[b++]=-1;P.vertices[b++]=1;P.vertices[b++]=0;P.vertices[b++]=1;b=0;P.faces[b++]=0;P.faces[b++]=1;P.faces[b++]=2;P.faces[b++]=0;P.faces[b++]=2;P.faces[b++]=3;P.vertexBuffer=j.createBuffer();P.elementBuffer=j.createBuffer();
-P.tempTexture=j.createTexture();P.occlusionTexture=j.createTexture();j.bindBuffer(j.ARRAY_BUFFER,P.vertexBuffer);j.bufferData(j.ARRAY_BUFFER,P.vertices,j.STATIC_DRAW);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,P.elementBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,P.faces,j.STATIC_DRAW);j.bindTexture(j.TEXTURE_2D,P.tempTexture);j.texImage2D(j.TEXTURE_2D,0,j.RGB,16,16,0,j.RGB,j.UNSIGNED_BYTE,null);j.texParameteri(j.TEXTURE_2D,j.TEXTURE_WRAP_S,j.CLAMP_TO_EDGE);j.texParameteri(j.TEXTURE_2D,j.TEXTURE_WRAP_T,j.CLAMP_TO_EDGE);
-j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MAG_FILTER,j.NEAREST);j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MIN_FILTER,j.NEAREST);j.bindTexture(j.TEXTURE_2D,P.occlusionTexture);j.texImage2D(j.TEXTURE_2D,0,j.RGBA,16,16,0,j.RGBA,j.UNSIGNED_BYTE,null);j.texParameteri(j.TEXTURE_2D,j.TEXTURE_WRAP_S,j.CLAMP_TO_EDGE);j.texParameteri(j.TEXTURE_2D,j.TEXTURE_WRAP_T,j.CLAMP_TO_EDGE);j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MAG_FILTER,j.NEAREST);j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MIN_FILTER,j.NEAREST);j.getParameter(j.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=
-0?(P.hasVertexTexture=!1,P.program=j.createProgram(),j.attachShader(P.program,D("fragment",THREE.ShaderLib.lensFlare.fragmentShader)),j.attachShader(P.program,D("vertex",THREE.ShaderLib.lensFlare.vertexShader))):(P.hasVertexTexture=!0,P.program=j.createProgram(),j.attachShader(P.program,D("fragment",THREE.ShaderLib.lensFlareVertexTexture.fragmentShader)),j.attachShader(P.program,D("vertex",THREE.ShaderLib.lensFlareVertexTexture.vertexShader)));j.linkProgram(P.program);P.attributes={};P.uniforms={};
-P.attributes.vertex=j.getAttribLocation(P.program,"position");P.attributes.uv=j.getAttribLocation(P.program,"UV");P.uniforms.renderType=j.getUniformLocation(P.program,"renderType");P.uniforms.map=j.getUniformLocation(P.program,"map");P.uniforms.occlusionMap=j.getUniformLocation(P.program,"occlusionMap");P.uniforms.opacity=j.getUniformLocation(P.program,"opacity");P.uniforms.scale=j.getUniformLocation(P.program,"scale");P.uniforms.rotation=j.getUniformLocation(P.program,"rotation");P.uniforms.screenPosition=
-j.getUniformLocation(P.program,"screenPosition");var za=!1;_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=j.createBuffer();_sprite.elementBuffer=j.createBuffer();j.bindBuffer(j.ARRAY_BUFFER,_sprite.vertexBuffer);j.bufferData(j.ARRAY_BUFFER,_sprite.vertices,j.STATIC_DRAW);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,_sprite.elementBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,_sprite.faces,j.STATIC_DRAW);_sprite.program=j.createProgram();
-j.attachShader(_sprite.program,D("fragment",THREE.ShaderLib.sprite.fragmentShader));j.attachShader(_sprite.program,D("vertex",THREE.ShaderLib.sprite.vertexShader));j.linkProgram(_sprite.program);_sprite.attributes={};_sprite.uniforms={};_sprite.attributes.position=j.getAttribLocation(_sprite.program,"position");_sprite.attributes.uv=j.getAttribLocation(_sprite.program,"uv");_sprite.uniforms.uvOffset=j.getUniformLocation(_sprite.program,"uvOffset");_sprite.uniforms.uvScale=j.getUniformLocation(_sprite.program,
-"uvScale");_sprite.uniforms.rotation=j.getUniformLocation(_sprite.program,"rotation");_sprite.uniforms.scale=j.getUniformLocation(_sprite.program,"scale");_sprite.uniforms.alignment=j.getUniformLocation(_sprite.program,"alignment");_sprite.uniforms.map=j.getUniformLocation(_sprite.program,"map");_sprite.uniforms.opacity=j.getUniformLocation(_sprite.program,"opacity");_sprite.uniforms.useScreenCoordinates=j.getUniformLocation(_sprite.program,"useScreenCoordinates");_sprite.uniforms.affectedByDistance=
-j.getUniformLocation(_sprite.program,"affectedByDistance");_sprite.uniforms.screenPosition=j.getUniformLocation(_sprite.program,"screenPosition");_sprite.uniforms.modelViewMatrix=j.getUniformLocation(_sprite.program,"modelViewMatrix");_sprite.uniforms.projectionMatrix=j.getUniformLocation(_sprite.program,"projectionMatrix");var ta=!1;this.setSize=function(b,e){aa.width=b;aa.height=e;this.setViewport(0,0,aa.width,aa.height)};this.setViewport=function(b,e,c,f){W=b;fa=e;Y=c;ga=f;j.viewport(W,fa,Y,ga)};
-this.setScissor=function(b,e,c,f){j.scissor(b,e,c,f)};this.enableScissorTest=function(b){b?j.enable(j.SCISSOR_TEST):j.disable(j.SCISSOR_TEST)};this.enableDepthBufferWrite=function(b){M=b;j.depthMask(b)};this.setClearColorHex=function(b,e){pa.setHex(b);la=e;j.clearColor(pa.r,pa.g,pa.b,la)};this.setClearColor=function(b,e){pa.copy(b);la=e;j.clearColor(pa.r,pa.g,pa.b,la)};this.clear=function(){j.clear(j.COLOR_BUFFER_BIT|j.DEPTH_BUFFER_BIT|j.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(b){da.darkness=
-b};this.getContext=function(){return j};this.initMaterial=function(b,e,c,f){var h,g,k;b instanceof THREE.MeshDepthMaterial?k="depth":b instanceof THREE.ShadowVolumeDynamicMaterial?k="shadowVolumeDynamic":b instanceof THREE.MeshNormalMaterial?k="normal":b instanceof THREE.MeshBasicMaterial?k="basic":b instanceof THREE.MeshLambertMaterial?k="lambert":b instanceof THREE.MeshPhongMaterial?k="phong":b instanceof THREE.LineBasicMaterial?k="basic":b instanceof THREE.ParticleBasicMaterial&&(k="particle_basic");
-if(k){var m=THREE.ShaderLib[k];b.uniforms=THREE.UniformsUtils.clone(m.uniforms);b.vertexShader=m.vertexShader;b.fragmentShader=m.fragmentShader}var n,t,o;n=o=m=0;for(t=e.length;n<t;n++)g=e[n],g instanceof THREE.DirectionalLight&&o++,g instanceof THREE.PointLight&&m++;m+o<=4?e=o:(e=Math.ceil(4*o/(m+o)),m=4-e);g={directional:e,point:m};o=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)o=f.bones.length;var p;a:{n=b.fragmentShader;t=b.vertexShader;var m=b.uniforms,e=b.attributes,c={map:!!b.map,envMap:!!b.envMap,
-lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:c,sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:g.directional,maxPointLights:g.point,maxBones:o},u;g=[];k?g.push(k):(g.push(n),g.push(t));for(u in c)g.push(u),g.push(c[u]);k=g.join();u=0;for(g=X.length;u<g;u++)if(X[u].code==k){p=X[u].program;break a}u=j.createProgram();prefix_fragment=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+c.maxDirLights,
-"#define MAX_POINT_LIGHTS "+c.maxPointLights,c.fog?"#define USE_FOG":"",c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");prefix_vertex=[ya?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_BONES "+c.maxBones,c.map?
-"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
-j.attachShader(u,D("fragment",prefix_fragment+n));j.attachShader(u,D("vertex",prefix_vertex+t));j.linkProgram(u);j.getProgramParameter(u,j.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+j.getProgramParameter(u,j.VALIDATE_STATUS)+", gl error ["+j.getError()+"]");u.uniforms={};u.attributes={};var v;n=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(v in m)n.push(v);
-v=n;m=0;for(n=v.length;m<n;m++)t=v[m],u.uniforms[t]=j.getUniformLocation(u,t);n=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(v=0;v<c.maxMorphTargets;v++)n.push("morphTarget"+v);for(p in e)n.push(p);p=n;v=0;for(e=p.length;v<e;v++)c=p[v],u.attributes[c]=j.getAttribLocation(u,c);X.push({program:u,code:k});p=u}b.program=p;p=b.program.attributes;p.position>=0&&j.enableVertexAttribArray(p.position);p.color>=0&&j.enableVertexAttribArray(p.color);
-p.normal>=0&&j.enableVertexAttribArray(p.normal);p.tangent>=0&&j.enableVertexAttribArray(p.tangent);b.skinning&&p.skinVertexA>=0&&p.skinVertexB>=0&&p.skinIndex>=0&&p.skinWeight>=0&&(j.enableVertexAttribArray(p.skinVertexA),j.enableVertexAttribArray(p.skinVertexB),j.enableVertexAttribArray(p.skinIndex),j.enableVertexAttribArray(p.skinWeight));if(b.attributes)for(h in b.attributes)p[h]!==void 0&&p[h]>=0&&j.enableVertexAttribArray(p[h]);if(b.morphTargets){b.numSupportedMorphTargets=0;p.morphTarget0>=
-0&&(j.enableVertexAttribArray(p.morphTarget0),b.numSupportedMorphTargets++);p.morphTarget1>=0&&(j.enableVertexAttribArray(p.morphTarget1),b.numSupportedMorphTargets++);p.morphTarget2>=0&&(j.enableVertexAttribArray(p.morphTarget2),b.numSupportedMorphTargets++);p.morphTarget3>=0&&(j.enableVertexAttribArray(p.morphTarget3),b.numSupportedMorphTargets++);p.morphTarget4>=0&&(j.enableVertexAttribArray(p.morphTarget4),b.numSupportedMorphTargets++);p.morphTarget5>=0&&(j.enableVertexAttribArray(p.morphTarget5),
-b.numSupportedMorphTargets++);p.morphTarget6>=0&&(j.enableVertexAttribArray(p.morphTarget6),b.numSupportedMorphTargets++);p.morphTarget7>=0&&(j.enableVertexAttribArray(p.morphTarget7),b.numSupportedMorphTargets++);f.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);b=0;for(h=this.maxMorphTargets;b<h;b++)f.__webglMorphTargetInfluences[b]=0}};this.render=function(b,c,o,B){var A,D,C,G,J,K,aa,M,ia=b.lights,N=b.fog;V.data.vertices=0;V.data.faces=0;V.data.drawCalls=0;c.matrixAutoUpdate&&
-c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(Z);c.projectionMatrix.flattenToArray(T);Q.multiply(c.projectionMatrix,c.matrixWorldInverse);m(Q);this.initWebGLObjects(b);R(o);(this.autoClear||B)&&this.clear();J=b.__webglObjects.length;for(B=0;B<J;B++)if(A=b.__webglObjects[B],aa=A.object,aa.visible)if(!(aa instanceof THREE.Mesh)||n(aa)){if(aa.matrixWorld.flattenToArray(aa._objectMatrixArray),H(aa,c),t(A),A.render=!0,this.sortObjects)ka.copy(aa.position),Q.multiplyVector3(ka),
-A.z=ka.z}else A.render=!1;else A.render=!1;this.sortObjects&&b.__webglObjects.sort(v);K=b.__webglObjectsImmediate.length;for(B=0;B<K;B++)A=b.__webglObjectsImmediate[B],aa=A.object,aa.visible&&(aa.matrixAutoUpdate&&aa.matrixWorld.flattenToArray(aa._objectMatrixArray),H(aa,c),p(A));I(THREE.NormalBlending);for(B=0;B<J;B++)if(A=b.__webglObjects[B],A.render){aa=A.object;M=A.buffer;C=A.opaque;h(aa);for(A=0;A<C.count;A++)G=C.list[A],k(G.depthTest),f(c,ia,N,G,M,aa)}for(B=0;B<K;B++)if(A=b.__webglObjectsImmediate[B],
-aa=A.object,aa.visible){C=A.opaque;h(aa);for(A=0;A<C.count;A++)G=C.list[A],k(G.depthTest),D=e(c,ia,N,G,aa),aa.render(function(b){g(b,D,G.shading)})}for(B=0;B<J;B++)if(A=b.__webglObjects[B],A.render){aa=A.object;M=A.buffer;C=A.transparent;h(aa);for(A=0;A<C.count;A++)G=C.list[A],I(G.blending),k(G.depthTest),f(c,ia,N,G,M,aa)}for(B=0;B<K;B++)if(A=b.__webglObjectsImmediate[B],aa=A.object,aa.visible){C=A.transparent;h(aa);for(A=0;A<C.count;A++)G=C.list[A],I(G.blending),k(G.depthTest),D=e(c,ia,N,G,aa),aa.render(function(b){g(b,
-D,G.shading)})}b.__webglSprites.length&&w(b,c);ma&&b.__webglShadowVolumes.length&&b.lights.length&&u(b);b.__webglLensFlares.length&&E(b,c);o&&o.minFilter!==THREE.NearestFilter&&o.minFilter!==THREE.LinearFilter&&(j.bindTexture(j.TEXTURE_2D,o.__webglTexture),j.generateMipmap(j.TEXTURE_2D),j.bindTexture(j.TEXTURE_2D,null))};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=[],b.__webglShadowVolumes=[],b.__webglLensFlares=[],b.__webglSprites=[];for(;b.__objectsAdded.length;){var c=
-b.__objectsAdded[0],e=b,f=void 0,h=void 0,g=void 0;if(c._modelViewMatrix==void 0)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)for(f in h=c.geometry,h.geometryGroups==void 0&&K(h),h.geometryGroups){g=h.geometryGroups[f];if(!g.__webglVertexBuffer){var k=g;k.__webglVertexBuffer=j.createBuffer();k.__webglNormalBuffer=
-j.createBuffer();k.__webglTangentBuffer=j.createBuffer();k.__webglColorBuffer=j.createBuffer();k.__webglUVBuffer=j.createBuffer();k.__webglUV2Buffer=j.createBuffer();k.__webglSkinVertexABuffer=j.createBuffer();k.__webglSkinVertexBBuffer=j.createBuffer();k.__webglSkinIndicesBuffer=j.createBuffer();k.__webglSkinWeightsBuffer=j.createBuffer();k.__webglFaceBuffer=j.createBuffer();k.__webglLineBuffer=j.createBuffer();if(k.numMorphTargets){var m=void 0,n=void 0;k.__webglMorphTargetsBuffers=[];m=0;for(n=
-k.numMorphTargets;m<n;m++)k.__webglMorphTargetsBuffers.push(j.createBuffer())}for(var k=g,m=c,t=void 0,p=void 0,o=void 0,u=o=void 0,v=void 0,w=void 0,G=w=n=0,C=o=p=void 0,p=t=void 0,u=m.geometry,C=u.faces,v=k.faces,t=0,p=v.length;t<p;t++)o=v[t],o=C[o],o instanceof THREE.Face3?(n+=3,w+=1,G+=3):o instanceof THREE.Face4&&(n+=4,w+=2,G+=4);for(var t=k,p=m,D=v=C=void 0,E=void 0,D=void 0,o=[],C=0,v=p.materials.length;C<v;C++)if(D=p.materials[C],D instanceof THREE.MeshFaceMaterial){D=0;for(l=t.materials.length;D<
-l;D++)(E=t.materials[D])&&o.push(E)}else(E=D)&&o.push(E);t=o;a:{C=p=void 0;v=t.length;for(p=0;p<v;p++)if(C=t[p],C.map||C.lightMap||C instanceof THREE.MeshShaderMaterial){p=!0;break a}p=!1}a:{C=t;o=v=void 0;D=C.length;for(v=0;v<D;v++)if(o=C[v],!(o instanceof THREE.MeshBasicMaterial&&!o.envMap||o instanceof THREE.MeshDepthMaterial)){C=o&&o.shading!=void 0&&o.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}C=!1}a:{o=v=void 0;D=t.length;for(v=0;v<D;v++)if(o=t[v],o.vertexColors){o=
-o.vertexColors;break a}o=!1}k.__vertexArray=new Float32Array(n*3);if(C)k.__normalArray=new Float32Array(n*3);if(u.hasTangents)k.__tangentArray=new Float32Array(n*4);if(o)k.__colorArray=new Float32Array(n*3);if(p){if(u.faceUvs.length>0||u.faceVertexUvs.length>0)k.__uvArray=new Float32Array(n*2);if(u.faceUvs.length>1||u.faceVertexUvs.length>1)k.__uv2Array=new Float32Array(n*2)}if(m.geometry.skinWeights.length&&m.geometry.skinIndices.length)k.__skinVertexAArray=new Float32Array(n*4),k.__skinVertexBArray=
-new Float32Array(n*4),k.__skinIndexArray=new Float32Array(n*4),k.__skinWeightArray=new Float32Array(n*4);k.__faceArray=new Uint16Array(w*3+(m.geometry.edgeFaces?m.geometry.edgeFaces.length*6:0));k.__lineArray=new Uint16Array(G*2);if(k.numMorphTargets){k.__morphTargetsArrays=[];u=0;for(v=k.numMorphTargets;u<v;u++)k.__morphTargetsArrays.push(new Float32Array(n*3))}k.__needsSmoothNormals=C==THREE.SmoothShading;k.__uvType=p;k.__vertexColorType=o;k.__normalType=C;k.__webglFaceCount=w*3+(m.geometry.edgeFaces?
-m.geometry.edgeFaces.length*6:0);k.__webglLineCount=G*2;u=0;for(v=t.length;u<v;u++)if(t[u].attributes)for(a in k.__webglCustomAttributes={},t[u].attributes){p={};for(prop in t[u].attributes[a])p[prop]=t[u].attributes[a][prop];if(!p.__webglInitialized||p.createUniqueBuffers)p.__webglInitialized=!0,w=1,p.type==="v2"?w=2:p.type==="v3"?w=3:p.type==="v4"?w=4:p.type==="c"&&(w=3),p.size=w,p.needsUpdate=!0,p.array=new Float32Array(n*w),p.buffer=j.createBuffer(),p.buffer.belongsToAttribute=a;k.__webglCustomAttributes[a]=
-p}k.__inittedArrays=!0;h.__dirtyVertices=!0;h.__dirtyMorphTargets=!0;h.__dirtyElements=!0;h.__dirtyUvs=!0;h.__dirtyNormals=!0;h.__dirtyTangents=!0;h.__dirtyColors=!0}c instanceof THREE.ShadowVolume?A(e.__webglShadowVolumes,g,c):A(e.__webglObjects,g,c)}else if(c instanceof THREE.LensFlare)A(e.__webglLensFlares,void 0,c);else if(c instanceof THREE.Ribbon){h=c.geometry;if(!h.__webglVertexBuffer)f=h,f.__webglVertexBuffer=j.createBuffer(),f.__webglColorBuffer=j.createBuffer(),f=h,g=f.vertices.length,f.__vertexArray=
-new Float32Array(g*3),f.__colorArray=new Float32Array(g*3),f.__webglVertexCount=g,h.__dirtyVertices=!0,h.__dirtyColors=!0;A(e.__webglObjects,h,c)}else if(c instanceof THREE.Line){h=c.geometry;if(!h.__webglVertexBuffer)f=h,f.__webglVertexBuffer=j.createBuffer(),f.__webglColorBuffer=j.createBuffer(),f=h,g=f.vertices.length,f.__vertexArray=new Float32Array(g*3),f.__colorArray=new Float32Array(g*3),f.__webglLineCount=g,h.__dirtyVertices=!0,h.__dirtyColors=!0;A(e.__webglObjects,h,c)}else if(c instanceof
-THREE.ParticleSystem){h=c.geometry;if(!h.__webglVertexBuffer)f=h,f.__webglVertexBuffer=j.createBuffer(),f.__webglColorBuffer=j.createBuffer(),f=h,g=f.vertices.length,f.__vertexArray=new Float32Array(g*3),f.__colorArray=new Float32Array(g*3),f.__sortArray=[],f.__webglParticleCount=g,h.__dirtyVertices=!0,h.__dirtyColors=!0;A(e.__webglObjects,h,c)}else THREE.MarchingCubes!==void 0&&c instanceof THREE.MarchingCubes?e.__webglObjectsImmediate.push({object:c,opaque:{list:[],count:0},transparent:{list:[],
-count:0}}):c instanceof THREE.Sprite&&e.__webglSprites.push(c);b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;){c=b.__objectsRemoved[0];e=b;f=h=void 0;if(c instanceof THREE.Mesh)for(h=e.__webglObjects.length-1;h>=0;h--){if(f=e.__webglObjects[h].object,c==f){e.__webglObjects.splice(h,1);break}}else if(c instanceof THREE.Sprite)for(h=e.__webglSprites.length-1;h>=0;h--)if(f=e.__webglSprites[h],c==f){e.__webglSprites.splice(h,1);break}b.__objectsRemoved.splice(0,1)}c=0;for(e=b.__webglObjects.length;c<
-e;c++)B(b.__webglObjects[c].object,b);c=0;for(e=b.__webglShadowVolumes.length;c<e;c++)B(b.__webglShadowVolumes[c].object,b);c=0;for(e=b.__webglLensFlares.length;c<e;c++)B(b.__webglLensFlares[c].object,b)};this.setFaceCulling=function(b,c){b?(!c||c=="ccw"?j.frontFace(j.CCW):j.frontFace(j.CW),b=="back"?j.cullFace(j.BACK):b=="front"?j.cullFace(j.FRONT):j.cullFace(j.FRONT_AND_BACK),j.enable(j.CULL_FACE)):j.disable(j.CULL_FACE)};this.supportsVertexTextures=function(){return ya}};
+c,f=b.object,h=b.opaque,g=b.transparent;g.count=0;b=h.count=0;for(e=f.materials.length;b<e;b++)c=f.materials[b],c.transparent?o(g,c):o(h,c)}function t(b){var e,c,f,h,g=b.object,j=b.buffer,k=b.opaque,m=b.transparent;m.count=0;b=k.count=0;for(f=g.materials.length;b<f;b++)if(e=g.materials[b],e instanceof THREE.MeshFaceMaterial){e=0;for(c=j.materials.length;e<c;e++)(h=j.materials[e])&&(h.transparent?o(m,h):o(k,h))}else(h=e)&&(h.transparent?o(m,h):o(k,h))}function u(b,e){return e.z-b.z}function v(b){h.enable(h.POLYGON_OFFSET_FILL);
+h.polygonOffset(0.1,1);h.enable(h.STENCIL_TEST);h.enable(h.DEPTH_TEST);h.depthMask(!1);h.colorMask(!1,!1,!1,!1);h.stencilFunc(h.ALWAYS,1,255);h.stencilOpSeparate(h.BACK,h.KEEP,h.INCR,h.KEEP);h.stencilOpSeparate(h.FRONT,h.KEEP,h.DECR,h.KEEP);var e,c=b.lights.length,f,g=b.lights,j=[],k,m,n,o,t,p=b.__webglShadowVolumes.length;for(e=0;e<c;e++)if(f=b.lights[e],f instanceof THREE.DirectionalLight&&f.castShadow){j[0]=-f.position.x;j[1]=-f.position.y;j[2]=-f.position.z;for(t=0;t<p;t++)f=b.__webglShadowVolumes[t].object,
+k=b.__webglShadowVolumes[t].buffer,m=f.materials[0],m.program||V.initMaterial(m,g,void 0,f),m=m.program,n=m.uniforms,o=m.attributes,O!==m&&(h.useProgram(m),O=m,h.uniformMatrix4fv(n.projectionMatrix,!1,T),h.uniformMatrix4fv(n.viewMatrix,!1,Z),h.uniform3fv(n.directionalLightDirection,j)),f.matrixWorld.flattenToArray(f._objectMatrixArray),h.uniformMatrix4fv(n.objectMatrix,!1,f._objectMatrixArray),h.bindBuffer(h.ARRAY_BUFFER,k.__webglVertexBuffer),h.vertexAttribPointer(o.position,3,h.FLOAT,!1,0,0),h.bindBuffer(h.ARRAY_BUFFER,
+k.__webglNormalBuffer),h.vertexAttribPointer(o.normal,3,h.FLOAT,!1,0,0),h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,k.__webglFaceBuffer),h.cullFace(h.FRONT),h.drawElements(h.TRIANGLES,k.__webglFaceCount,h.UNSIGNED_SHORT,0),h.cullFace(h.BACK),h.drawElements(h.TRIANGLES,k.__webglFaceCount,h.UNSIGNED_SHORT,0)}h.disable(h.POLYGON_OFFSET_FILL);h.colorMask(!0,!0,!0,!0);h.stencilFunc(h.NOTEQUAL,0,255);h.stencilOp(h.KEEP,h.KEEP,h.KEEP);h.disable(h.DEPTH_TEST);S=-1;O=da.program;h.useProgram(da.program);h.uniformMatrix4fv(da.projectionLocation,
+!1,T);h.uniform1f(da.darknessLocation,da.darkness);h.bindBuffer(h.ARRAY_BUFFER,da.vertexBuffer);h.vertexAttribPointer(da.vertexLocation,3,h.FLOAT,!1,0,0);h.enableVertexAttribArray(da.vertexLocation);h.blendFunc(h.ONE,h.ONE_MINUS_SRC_ALPHA);h.blendEquation(h.FUNC_ADD);h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,da.elementBuffer);h.drawElements(h.TRIANGLES,6,h.UNSIGNED_SHORT,0);h.disable(h.STENCIL_TEST);h.enable(h.DEPTH_TEST);h.depthMask(M)}function w(b,e){var c,f,g;c=_sprite.attributes;var j=_sprite.uniforms,
+k=ha/Y,m,n=[],o=Y*0.5,t=ha*0.5,p=!0;h.useProgram(_sprite.program);O=_sprite.program;S=-1;ta||(h.enableVertexAttribArray(_sprite.attributes.position),h.enableVertexAttribArray(_sprite.attributes.uv),ta=!0);h.disable(h.CULL_FACE);h.enable(h.BLEND);h.depthMask(!0);h.bindBuffer(h.ARRAY_BUFFER,_sprite.vertexBuffer);h.vertexAttribPointer(c.position,2,h.FLOAT,!1,16,0);h.vertexAttribPointer(c.uv,2,h.FLOAT,!1,16,8);h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,_sprite.elementBuffer);h.uniformMatrix4fv(j.projectionMatrix,
+!1,T);h.activeTexture(h.TEXTURE0);h.uniform1i(j.map,0);c=0;for(f=b.__webglSprites.length;c<f;c++)g=b.__webglSprites[c],g.useScreenCoordinates?g.z=-g.position.z:(g._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,g.matrixWorld,g._modelViewMatrixArray),g.z=-g._modelViewMatrix.n34);b.__webglSprites.sort(u);c=0;for(f=b.__webglSprites.length;c<f;c++)g=b.__webglSprites[c],g.material===void 0&&g.map&&g.map.image&&g.map.image.width&&(g.useScreenCoordinates?(h.uniform1i(j.useScreenCoordinates,1),h.uniform3f(j.screenPosition,
+(g.position.x-o)/o,(t-g.position.y)/t,Math.max(0,Math.min(1,g.position.z)))):(h.uniform1i(j.useScreenCoordinates,0),h.uniform1i(j.affectedByDistance,g.affectedByDistance?1:0),h.uniformMatrix4fv(j.modelViewMatrix,!1,g._modelViewMatrixArray)),m=g.map.image.width/(g.affectedByDistance?1:ha),n[0]=m*k*g.scale.x,n[1]=m*g.scale.y,h.uniform2f(j.uvScale,g.uvScale.x,g.uvScale.y),h.uniform2f(j.uvOffset,g.uvOffset.x,g.uvOffset.y),h.uniform2f(j.alignment,g.alignment.x,g.alignment.y),h.uniform1f(j.opacity,g.opacity),
+h.uniform1f(j.rotation,g.rotation),h.uniform2fv(j.scale,n),g.mergeWith3D&&!p?(h.enable(h.DEPTH_TEST),p=!0):!g.mergeWith3D&&p&&(h.disable(h.DEPTH_TEST),p=!1),K(g.blending),C(g.map,0),h.drawElements(h.TRIANGLES,6,h.UNSIGNED_SHORT,0));h.enable(h.CULL_FACE);h.enable(h.DEPTH_TEST);h.depthMask(M)}function E(b,e){var c,f,g=b.__webglLensFlares.length,j,k,m,n=new THREE.Vector3,o=ha/Y,t=Y*0.5,p=ha*0.5,u=16/ha,v=[u*o,u],w=[1,1,0],B=[1,1],A=P.uniforms;c=P.attributes;h.useProgram(P.program);O=P.program;S=-1;Aa||
+(h.enableVertexAttribArray(P.attributes.vertex),h.enableVertexAttribArray(P.attributes.uv),Aa=!0);h.uniform1i(A.occlusionMap,0);h.uniform1i(A.map,1);h.bindBuffer(h.ARRAY_BUFFER,P.vertexBuffer);h.vertexAttribPointer(c.vertex,2,h.FLOAT,!1,16,0);h.vertexAttribPointer(c.uv,2,h.FLOAT,!1,16,8);h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,P.elementBuffer);h.disable(h.CULL_FACE);h.depthMask(!1);h.activeTexture(h.TEXTURE0);h.bindTexture(h.TEXTURE_2D,P.occlusionTexture);h.activeTexture(h.TEXTURE1);for(f=0;f<g;f++)if(c=
+b.__webglLensFlares[f].object,n.set(c.matrixWorld.n14,c.matrixWorld.n24,c.matrixWorld.n34),e.matrixWorldInverse.multiplyVector3(n),e.projectionMatrix.multiplyVector3(n),w[0]=n.x,w[1]=n.y,w[2]=n.z,B[0]=w[0]*t+t,B[1]=w[1]*p+p,P.hasVertexTexture||B[0]>0&&B[0]<Y&&B[1]>0&&B[1]<ha){h.bindTexture(h.TEXTURE_2D,P.tempTexture);h.copyTexImage2D(h.TEXTURE_2D,0,h.RGB,B[0]-8,B[1]-8,16,16,0);h.uniform1i(A.renderType,0);h.uniform2fv(A.scale,v);h.uniform3fv(A.screenPosition,w);h.disable(h.BLEND);h.enable(h.DEPTH_TEST);
+h.drawElements(h.TRIANGLES,6,h.UNSIGNED_SHORT,0);h.bindTexture(h.TEXTURE_2D,P.occlusionTexture);h.copyTexImage2D(h.TEXTURE_2D,0,h.RGBA,B[0]-8,B[1]-8,16,16,0);h.uniform1i(A.renderType,1);h.disable(h.DEPTH_TEST);h.bindTexture(h.TEXTURE_2D,P.tempTexture);h.drawElements(h.TRIANGLES,6,h.UNSIGNED_SHORT,0);c.positionScreen.x=w[0];c.positionScreen.y=w[1];c.positionScreen.z=w[2];c.customUpdateCallback?c.customUpdateCallback(c):c.updateLensFlares();h.uniform1i(A.renderType,2);h.enable(h.BLEND);j=0;for(k=c.lensFlares.length;j<
+k;j++)if(m=c.lensFlares[j],m.opacity>0.0010&&m.scale>0.0010)w[0]=m.x,w[1]=m.y,w[2]=m.z,u=m.size*m.scale/ha,v[0]=u*o,v[1]=u,h.uniform3fv(A.screenPosition,w),h.uniform2fv(A.scale,v),h.uniform1f(A.rotation,m.rotation),h.uniform1f(A.opacity,m.opacity),K(m.blending),C(m.texture,1),h.drawElements(h.TRIANGLES,6,h.UNSIGNED_SHORT,0)}h.enable(h.CULL_FACE);h.enable(h.DEPTH_TEST);h.depthMask(M)}function I(b,e){b._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}
+function B(b){var e,f,g,j,k;if(b instanceof THREE.Mesh){f=b.geometry;for(e in f.geometryGroups){g=f.geometryGroups[e];k=!1;for(j in g.__webglCustomAttributes)if(g.__webglCustomAttributes[j].needsUpdate){k=!0;break}if(f.__dirtyVertices||f.__dirtyMorphTargets||f.__dirtyElements||f.__dirtyUvs||f.__dirtyNormals||f.__dirtyColors||f.__dirtyTangents||k){k=b;var m=h.DYNAMIC_DRAW;if(g.__inittedArrays){var n=void 0,o=void 0,t=void 0,p=void 0,u=t=void 0,v=void 0,w=void 0,B=void 0,A=void 0,E=void 0,I=void 0,
+J=void 0,aa=void 0,C=void 0,G=void 0,H=void 0,K=void 0,F=p=B=p=w=v=void 0,D=void 0,z=D=F=v=void 0,ma=void 0,N=z=D=F=t=t=u=B=p=z=D=F=ma=z=D=F=ma=z=D=F=void 0,M=0,ia=0,P=0,pa=0,R=0,V=0,O=0,T=0,Q=0,L=0,S=0,D=F=0,W=g.__vertexArray,da=g.__uvArray,ca=g.__uv2Array,ja=g.__normalArray,U=g.__tangentArray,$=g.__colorArray,la=g.__skinVertexAArray,X=g.__skinVertexBArray,Y=g.__skinIndexArray,Z=g.__skinWeightArray,ka=g.__morphTargetsArrays,ha=g.__webglCustomAttributes,z=void 0,ea=g.__faceArray,fa=g.__lineArray,
+na=g.__needsSmoothNormals,E=g.__vertexColorType,A=g.__uvType,I=g.__normalType,ra=k.geometry,Ca=ra.__dirtyVertices,za=ra.__dirtyElements,ta=ra.__dirtyUvs,Aa=ra.__dirtyNormals,Ya=ra.__dirtyTangents,Za=ra.__dirtyColors,$a=ra.__dirtyMorphTargets,Ha=ra.vertices,bb=g.faces,eb=ra.faces,cb=ra.faceVertexUvs[0],db=ra.faceVertexUvs[1],Ia=ra.skinVerticesA,Ja=ra.skinVerticesB,Ka=ra.skinIndices,Ba=ra.skinWeights,Fa=k instanceof THREE.ShadowVolume?ra.edgeFaces:void 0,ya=ra.morphTargets;if(ha)for(N in ha)ha[N].offset=
+0,ha[N].offsetSrc=0;n=0;for(o=bb.length;n<o;n++)if(t=bb[n],p=eb[t],cb&&(J=cb[t]),db&&(aa=db[t]),t=p.vertexNormals,u=p.normal,v=p.vertexColors,w=p.color,B=p.vertexTangents,p instanceof THREE.Face3){if(Ca)C=Ha[p.a].position,G=Ha[p.b].position,H=Ha[p.c].position,W[ia]=C.x,W[ia+1]=C.y,W[ia+2]=C.z,W[ia+3]=G.x,W[ia+4]=G.y,W[ia+5]=G.z,W[ia+6]=H.x,W[ia+7]=H.y,W[ia+8]=H.z,ia+=9;if(ha)for(N in ha)if(z=ha[N],z.needsUpdate)F=z.offset,D=z.offsetSrc,z.size===1?(z.boundTo===void 0||z.boundTo==="vertices"?(z.array[F+
+0]=z.value[p.a],z.array[F+1]=z.value[p.b],z.array[F+2]=z.value[p.c]):z.boundTo==="faces"?(z.array[F+0]=z.value[D],z.array[F+1]=z.value[D],z.array[F+2]=z.value[D],z.offsetSrc++):z.boundTo==="faceVertices"&&(z.array[F+0]=z.value[D+0],z.array[F+1]=z.value[D+1],z.array[F+2]=z.value[D+2],z.offsetSrc+=3),z.offset+=3):(z.boundTo===void 0||z.boundTo==="vertices"?(C=z.value[p.a],G=z.value[p.b],H=z.value[p.c]):z.boundTo==="faces"?(C=z.value[D],G=z.value[D],H=z.value[D],z.offsetSrc++):z.boundTo==="faceVertices"&&
+(C=z.value[D+0],G=z.value[D+1],H=z.value[D+2],z.offsetSrc+=3),z.size===2?(z.array[F+0]=C.x,z.array[F+1]=C.y,z.array[F+2]=G.x,z.array[F+3]=G.y,z.array[F+4]=H.x,z.array[F+5]=H.y,z.offset+=6):z.size===3?(z.type==="c"?(z.array[F+0]=C.r,z.array[F+1]=C.g,z.array[F+2]=C.b,z.array[F+3]=G.r,z.array[F+4]=G.g,z.array[F+5]=G.b,z.array[F+6]=H.r,z.array[F+7]=H.g,z.array[F+8]=H.b):(z.array[F+0]=C.x,z.array[F+1]=C.y,z.array[F+2]=C.z,z.array[F+3]=G.x,z.array[F+4]=G.y,z.array[F+5]=G.z,z.array[F+6]=H.x,z.array[F+7]=
+H.y,z.array[F+8]=H.z),z.offset+=9):(z.array[F+0]=C.x,z.array[F+1]=C.y,z.array[F+2]=C.z,z.array[F+3]=C.w,z.array[F+4]=G.x,z.array[F+5]=G.y,z.array[F+6]=G.z,z.array[F+7]=G.w,z.array[F+8]=H.x,z.array[F+9]=H.y,z.array[F+10]=H.z,z.array[F+11]=H.w,z.offset+=12));if($a){F=0;for(D=ya.length;F<D;F++)C=ya[F].vertices[p.a].position,G=ya[F].vertices[p.b].position,H=ya[F].vertices[p.c].position,z=ka[F],z[S+0]=C.x,z[S+1]=C.y,z[S+2]=C.z,z[S+3]=G.x,z[S+4]=G.y,z[S+5]=G.z,z[S+6]=H.x,z[S+7]=H.y,z[S+8]=H.z;S+=9}if(Ba.length)F=
+Ba[p.a],D=Ba[p.b],z=Ba[p.c],Z[L]=F.x,Z[L+1]=F.y,Z[L+2]=F.z,Z[L+3]=F.w,Z[L+4]=D.x,Z[L+5]=D.y,Z[L+6]=D.z,Z[L+7]=D.w,Z[L+8]=z.x,Z[L+9]=z.y,Z[L+10]=z.z,Z[L+11]=z.w,F=Ka[p.a],D=Ka[p.b],z=Ka[p.c],Y[L]=F.x,Y[L+1]=F.y,Y[L+2]=F.z,Y[L+3]=F.w,Y[L+4]=D.x,Y[L+5]=D.y,Y[L+6]=D.z,Y[L+7]=D.w,Y[L+8]=z.x,Y[L+9]=z.y,Y[L+10]=z.z,Y[L+11]=z.w,F=Ia[p.a],D=Ia[p.b],z=Ia[p.c],la[L]=F.x,la[L+1]=F.y,la[L+2]=F.z,la[L+3]=1,la[L+4]=D.x,la[L+5]=D.y,la[L+6]=D.z,la[L+7]=1,la[L+8]=z.x,la[L+9]=z.y,la[L+10]=z.z,la[L+11]=1,F=Ja[p.a],D=
+Ja[p.b],z=Ja[p.c],X[L]=F.x,X[L+1]=F.y,X[L+2]=F.z,X[L+3]=1,X[L+4]=D.x,X[L+5]=D.y,X[L+6]=D.z,X[L+7]=1,X[L+8]=z.x,X[L+9]=z.y,X[L+10]=z.z,X[L+11]=1,L+=12;if(Za&&E)v.length==3&&E==THREE.VertexColors?(p=v[0],F=v[1],D=v[2]):D=F=p=w,$[Q]=p.r,$[Q+1]=p.g,$[Q+2]=p.b,$[Q+3]=F.r,$[Q+4]=F.g,$[Q+5]=F.b,$[Q+6]=D.r,$[Q+7]=D.g,$[Q+8]=D.b,Q+=9;if(Ya&&ra.hasTangents)v=B[0],w=B[1],p=B[2],U[O]=v.x,U[O+1]=v.y,U[O+2]=v.z,U[O+3]=v.w,U[O+4]=w.x,U[O+5]=w.y,U[O+6]=w.z,U[O+7]=w.w,U[O+8]=p.x,U[O+9]=p.y,U[O+10]=p.z,U[O+11]=p.w,
+O+=12;if(Aa&&I)if(t.length==3&&na)for(B=0;B<3;B++)u=t[B],ja[V]=u.x,ja[V+1]=u.y,ja[V+2]=u.z,V+=3;else for(B=0;B<3;B++)ja[V]=u.x,ja[V+1]=u.y,ja[V+2]=u.z,V+=3;if(ta&&J!==void 0&&A)for(B=0;B<3;B++)t=J[B],da[P]=t.u,da[P+1]=t.v,P+=2;if(ta&&aa!==void 0&&A)for(B=0;B<3;B++)t=aa[B],ca[pa]=t.u,ca[pa+1]=t.v,pa+=2;za&&(ea[R]=M,ea[R+1]=M+1,ea[R+2]=M+2,R+=3,fa[T]=M,fa[T+1]=M+1,fa[T+2]=M,fa[T+3]=M+2,fa[T+4]=M+1,fa[T+5]=M+2,T+=6,M+=3)}else if(p instanceof THREE.Face4){if(Ca)C=Ha[p.a].position,G=Ha[p.b].position,H=
+Ha[p.c].position,K=Ha[p.d].position,W[ia]=C.x,W[ia+1]=C.y,W[ia+2]=C.z,W[ia+3]=G.x,W[ia+4]=G.y,W[ia+5]=G.z,W[ia+6]=H.x,W[ia+7]=H.y,W[ia+8]=H.z,W[ia+9]=K.x,W[ia+10]=K.y,W[ia+11]=K.z,ia+=12;if(ha)for(N in ha)if(z=ha[N],z.needsUpdate)F=z.offset,D=z.offsetSrc,z.size===1?(z.boundTo===void 0||z.boundTo==="vertices"?(z.array[F+0]=z.value[p.a],z.array[F+1]=z.value[p.b],z.array[F+2]=z.value[p.c],z.array[F+3]=z.value[p.d]):z.boundTo==="faces"?(z.array[F+0]=z.value[D],z.array[F+1]=z.value[D],z.array[F+2]=z.value[D],
+z.array[F+3]=z.value[D],z.offsetSrc++):z.boundTo==="faceVertices"&&(z.array[F+0]=z.value[D+0],z.array[F+1]=z.value[D+1],z.array[F+2]=z.value[D+2],z.array[F+3]=z.value[D+3],z.offsetSrc+=4),z.offset+=4):(z.boundTo===void 0||z.boundTo==="vertices"?(C=z.value[p.a],G=z.value[p.b],H=z.value[p.c],K=z.value[p.d]):z.boundTo==="faces"?(C=z.value[D],G=z.value[D],H=z.value[D],K=z.value[D],z.offsetSrc++):z.boundTo==="faceVertices"&&(C=z.value[D+0],G=z.value[D+1],H=z.value[D+2],K=z.value[D+3],z.offsetSrc+=4),z.size===
+2?(z.array[F+0]=C.x,z.array[F+1]=C.y,z.array[F+2]=G.x,z.array[F+3]=G.y,z.array[F+4]=H.x,z.array[F+5]=H.y,z.array[F+6]=K.x,z.array[F+7]=K.y,z.offset+=8):z.size===3?(z.type==="c"?(z.array[F+0]=C.r,z.array[F+1]=C.g,z.array[F+2]=C.b,z.array[F+3]=G.r,z.array[F+4]=G.g,z.array[F+5]=G.b,z.array[F+6]=H.r,z.array[F+7]=H.g,z.array[F+8]=H.b,z.array[F+9]=K.r,z.array[F+10]=K.g,z.array[F+11]=K.b):(z.array[F+0]=C.x,z.array[F+1]=C.y,z.array[F+2]=C.z,z.array[F+3]=G.x,z.array[F+4]=G.y,z.array[F+5]=G.z,z.array[F+6]=
+H.x,z.array[F+7]=H.y,z.array[F+8]=H.z,z.array[F+9]=K.x,z.array[F+10]=K.y,z.array[F+11]=K.z),z.offset+=12):(z.array[F+0]=C.x,z.array[F+1]=C.y,z.array[F+2]=C.z,z.array[F+3]=C.w,z.array[F+4]=G.x,z.array[F+5]=G.y,z.array[F+6]=G.z,z.array[F+7]=G.w,z.array[F+8]=H.x,z.array[F+9]=H.y,z.array[F+10]=H.z,z.array[F+11]=H.w,z.array[F+12]=K.x,z.array[F+13]=K.y,z.array[F+14]=K.z,z.array[F+15]=K.w,z.offset+=16));if($a){F=0;for(D=ya.length;F<D;F++)C=ya[F].vertices[p.a].position,G=ya[F].vertices[p.b].position,H=ya[F].vertices[p.c].position,
+K=ya[F].vertices[p.d].position,z=ka[F],z[S+0]=C.x,z[S+1]=C.y,z[S+2]=C.z,z[S+3]=G.x,z[S+4]=G.y,z[S+5]=G.z,z[S+6]=H.x,z[S+7]=H.y,z[S+8]=H.z,z[S+9]=K.x,z[S+10]=K.y,z[S+11]=K.z;S+=12}if(Ba.length)F=Ba[p.a],D=Ba[p.b],z=Ba[p.c],ma=Ba[p.d],Z[L]=F.x,Z[L+1]=F.y,Z[L+2]=F.z,Z[L+3]=F.w,Z[L+4]=D.x,Z[L+5]=D.y,Z[L+6]=D.z,Z[L+7]=D.w,Z[L+8]=z.x,Z[L+9]=z.y,Z[L+10]=z.z,Z[L+11]=z.w,Z[L+12]=ma.x,Z[L+13]=ma.y,Z[L+14]=ma.z,Z[L+15]=ma.w,F=Ka[p.a],D=Ka[p.b],z=Ka[p.c],ma=Ka[p.d],Y[L]=F.x,Y[L+1]=F.y,Y[L+2]=F.z,Y[L+3]=F.w,Y[L+
+4]=D.x,Y[L+5]=D.y,Y[L+6]=D.z,Y[L+7]=D.w,Y[L+8]=z.x,Y[L+9]=z.y,Y[L+10]=z.z,Y[L+11]=z.w,Y[L+12]=ma.x,Y[L+13]=ma.y,Y[L+14]=ma.z,Y[L+15]=ma.w,F=Ia[p.a],D=Ia[p.b],z=Ia[p.c],ma=Ia[p.d],la[L]=F.x,la[L+1]=F.y,la[L+2]=F.z,la[L+3]=1,la[L+4]=D.x,la[L+5]=D.y,la[L+6]=D.z,la[L+7]=1,la[L+8]=z.x,la[L+9]=z.y,la[L+10]=z.z,la[L+11]=1,la[L+12]=ma.x,la[L+13]=ma.y,la[L+14]=ma.z,la[L+15]=1,F=Ja[p.a],D=Ja[p.b],z=Ja[p.c],p=Ja[p.d],X[L]=F.x,X[L+1]=F.y,X[L+2]=F.z,X[L+3]=1,X[L+4]=D.x,X[L+5]=D.y,X[L+6]=D.z,X[L+7]=1,X[L+8]=z.x,
+X[L+9]=z.y,X[L+10]=z.z,X[L+11]=1,X[L+12]=p.x,X[L+13]=p.y,X[L+14]=p.z,X[L+15]=1,L+=16;if(Za&&E)v.length==4&&E==THREE.VertexColors?(p=v[0],F=v[1],D=v[2],v=v[3]):v=D=F=p=w,$[Q]=p.r,$[Q+1]=p.g,$[Q+2]=p.b,$[Q+3]=F.r,$[Q+4]=F.g,$[Q+5]=F.b,$[Q+6]=D.r,$[Q+7]=D.g,$[Q+8]=D.b,$[Q+9]=v.r,$[Q+10]=v.g,$[Q+11]=v.b,Q+=12;if(Ya&&ra.hasTangents)v=B[0],w=B[1],p=B[2],B=B[3],U[O]=v.x,U[O+1]=v.y,U[O+2]=v.z,U[O+3]=v.w,U[O+4]=w.x,U[O+5]=w.y,U[O+6]=w.z,U[O+7]=w.w,U[O+8]=p.x,U[O+9]=p.y,U[O+10]=p.z,U[O+11]=p.w,U[O+12]=B.x,
+U[O+13]=B.y,U[O+14]=B.z,U[O+15]=B.w,O+=16;if(Aa&&I)if(t.length==4&&na)for(B=0;B<4;B++)u=t[B],ja[V]=u.x,ja[V+1]=u.y,ja[V+2]=u.z,V+=3;else for(B=0;B<4;B++)ja[V]=u.x,ja[V+1]=u.y,ja[V+2]=u.z,V+=3;if(ta&&J!==void 0&&A)for(B=0;B<4;B++)t=J[B],da[P]=t.u,da[P+1]=t.v,P+=2;if(ta&&aa!==void 0&&A)for(B=0;B<4;B++)t=aa[B],ca[pa]=t.u,ca[pa+1]=t.v,pa+=2;za&&(ea[R]=M,ea[R+1]=M+1,ea[R+2]=M+3,ea[R+3]=M+1,ea[R+4]=M+2,ea[R+5]=M+3,R+=6,fa[T]=M,fa[T+1]=M+1,fa[T+2]=M,fa[T+3]=M+3,fa[T+4]=M+1,fa[T+5]=M+2,fa[T+6]=M+2,fa[T+7]=
+M+3,T+=8,M+=4)}if(Fa){n=0;for(o=Fa.length;n<o;n++)ea[R]=Fa[n].a,ea[R+1]=Fa[n].b,ea[R+2]=Fa[n].c,ea[R+3]=Fa[n].a,ea[R+4]=Fa[n].c,ea[R+5]=Fa[n].d,R+=6}Ca&&(h.bindBuffer(h.ARRAY_BUFFER,g.__webglVertexBuffer),h.bufferData(h.ARRAY_BUFFER,W,m));if(ha)for(N in ha)if(z=ha[N],z.needsUpdate)h.bindBuffer(h.ARRAY_BUFFER,z.buffer),h.bufferData(h.ARRAY_BUFFER,z.array,m),z.needsUpdate=!1;if($a){F=0;for(D=ya.length;F<D;F++)h.bindBuffer(h.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[F]),h.bufferData(h.ARRAY_BUFFER,ka[F],
+m)}Za&&Q>0&&(h.bindBuffer(h.ARRAY_BUFFER,g.__webglColorBuffer),h.bufferData(h.ARRAY_BUFFER,$,m));Aa&&(h.bindBuffer(h.ARRAY_BUFFER,g.__webglNormalBuffer),h.bufferData(h.ARRAY_BUFFER,ja,m));Ya&&ra.hasTangents&&(h.bindBuffer(h.ARRAY_BUFFER,g.__webglTangentBuffer),h.bufferData(h.ARRAY_BUFFER,U,m));ta&&P>0&&(h.bindBuffer(h.ARRAY_BUFFER,g.__webglUVBuffer),h.bufferData(h.ARRAY_BUFFER,da,m));ta&&pa>0&&(h.bindBuffer(h.ARRAY_BUFFER,g.__webglUV2Buffer),h.bufferData(h.ARRAY_BUFFER,ca,m));za&&(h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,
+g.__webglFaceBuffer),h.bufferData(h.ELEMENT_ARRAY_BUFFER,ea,m),h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,g.__webglLineBuffer),h.bufferData(h.ELEMENT_ARRAY_BUFFER,fa,m));L>0&&(h.bindBuffer(h.ARRAY_BUFFER,g.__webglSkinVertexABuffer),h.bufferData(h.ARRAY_BUFFER,la,m),h.bindBuffer(h.ARRAY_BUFFER,g.__webglSkinVertexBBuffer),h.bufferData(h.ARRAY_BUFFER,X,m),h.bindBuffer(h.ARRAY_BUFFER,g.__webglSkinIndicesBuffer),h.bufferData(h.ARRAY_BUFFER,Y,m),h.bindBuffer(h.ARRAY_BUFFER,g.__webglSkinWeightsBuffer),h.bufferData(h.ARRAY_BUFFER,
+Z,m));k.dynamic||(delete g.__inittedArrays,delete g.__colorArray,delete g.__normalArray,delete g.__tangentArray,delete g.__uvArray,delete g.__uv2Array,delete g.__faceArray,delete g.__vertexArray,delete g.__lineArray,delete g.__skinVertexAArray,delete g.__skinVertexBArray,delete g.__skinIndexArray,delete g.__skinWeightArray)}}}f.__dirtyVertices=!1;f.__dirtyMorphTargets=!1;f.__dirtyElements=!1;f.__dirtyUvs=!1;f.__dirtyNormals=!1;f.__dirtyTangents=!1;f.__dirtyColors=!1}else if(b instanceof THREE.Ribbon){f=
+b.geometry;if(f.__dirtyVertices||f.__dirtyColors){b=f;e=h.DYNAMIC_DRAW;A=b.vertices;g=b.colors;E=A.length;k=g.length;I=b.__vertexArray;m=b.__colorArray;J=b.__dirtyColors;if(b.__dirtyVertices){for(n=0;n<E;n++)o=A[n].position,j=n*3,I[j]=o.x,I[j+1]=o.y,I[j+2]=o.z;h.bindBuffer(h.ARRAY_BUFFER,b.__webglVertexBuffer);h.bufferData(h.ARRAY_BUFFER,I,e)}if(J){for(n=0;n<k;n++)color=g[n],j=n*3,m[j]=color.r,m[j+1]=color.g,m[j+2]=color.b;h.bindBuffer(h.ARRAY_BUFFER,b.__webglColorBuffer);h.bufferData(h.ARRAY_BUFFER,
+m,e)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(b instanceof THREE.Line){f=b.geometry;if(f.__dirtyVertices||f.__dirtyColors){b=f;e=h.DYNAMIC_DRAW;A=b.vertices;g=b.colors;E=A.length;k=g.length;I=b.__vertexArray;m=b.__colorArray;J=b.__dirtyColors;if(b.__dirtyVertices){for(n=0;n<E;n++)o=A[n].position,j=n*3,I[j]=o.x,I[j+1]=o.y,I[j+2]=o.z;h.bindBuffer(h.ARRAY_BUFFER,b.__webglVertexBuffer);h.bufferData(h.ARRAY_BUFFER,I,e)}if(J){for(n=0;n<k;n++)color=g[n],j=n*3,m[j]=color.r,m[j+1]=color.g,m[j+2]=color.b;
+h.bindBuffer(h.ARRAY_BUFFER,b.__webglColorBuffer);h.bufferData(h.ARRAY_BUFFER,m,e)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(b instanceof THREE.ParticleSystem)f=b.geometry,(f.__dirtyVertices||f.__dirtyColors||b.sortParticles)&&c(f,h.DYNAMIC_DRAW,b),f.__dirtyVertices=!1,f.__dirtyColors=!1}function H(b){function e(b){var g=[];c=0;for(f=b.length;c<f;c++)b[c]==void 0?g.push("undefined"):g.push(b[c].id);return g.join("_")}var c,f,g,j,h,k,m,n,p={},o=b.morphTargets!==void 0?b.morphTargets.length:
+0;b.geometryGroups={};g=0;for(j=b.faces.length;g<j;g++)h=b.faces[g],k=h.materials,m=e(k),p[m]==void 0&&(p[m]={hash:m,counter:0}),n=p[m].hash+"_"+p[m].counter,b.geometryGroups[n]==void 0&&(b.geometryGroups[n]={faces:[],materials:k,vertices:0,numMorphTargets:o}),h=h instanceof THREE.Face3?3:4,b.geometryGroups[n].vertices+h>65535&&(p[m].counter+=1,n=p[m].hash+"_"+p[m].counter,b.geometryGroups[n]==void 0&&(b.geometryGroups[n]={faces:[],materials:k,vertices:0,numMorphTargets:o})),b.geometryGroups[n].faces.push(g),
+b.geometryGroups[n].vertices+=h}function A(b,e,c){b.push({buffer:e,object:c,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function K(b){if(b!=S){switch(b){case THREE.AdditiveBlending:h.blendEquation(h.FUNC_ADD);h.blendFunc(h.SRC_ALPHA,h.ONE);break;case THREE.SubtractiveBlending:h.blendEquation(h.FUNC_ADD);h.blendFunc(h.ZERO,h.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:h.blendEquation(h.FUNC_ADD);h.blendFunc(h.ZERO,h.SRC_COLOR);break;default:h.blendEquationSeparate(h.FUNC_ADD,
+h.FUNC_ADD),h.blendFuncSeparate(h.SRC_ALPHA,h.ONE_MINUS_SRC_ALPHA,h.ONE,h.ONE_MINUS_SRC_ALPHA)}S=b}}function G(b,e,c){(c.width&c.width-1)==0&&(c.height&c.height-1)==0?(h.texParameteri(b,h.TEXTURE_WRAP_S,J(e.wrapS)),h.texParameteri(b,h.TEXTURE_WRAP_T,J(e.wrapT)),h.texParameteri(b,h.TEXTURE_MAG_FILTER,J(e.magFilter)),h.texParameteri(b,h.TEXTURE_MIN_FILTER,J(e.minFilter)),h.generateMipmap(b)):(h.texParameteri(b,h.TEXTURE_WRAP_S,h.CLAMP_TO_EDGE),h.texParameteri(b,h.TEXTURE_WRAP_T,h.CLAMP_TO_EDGE),h.texParameteri(b,
+h.TEXTURE_MAG_FILTER,N(e.magFilter)),h.texParameteri(b,h.TEXTURE_MIN_FILTER,N(e.minFilter)))}function C(b,e){if(b.needsUpdate){if(b.__webglTexture)b.__webglTexture=h.deleteTexture(b.__webglTexture);b.__webglTexture=h.createTexture();h.bindTexture(h.TEXTURE_2D,b.__webglTexture);h.texImage2D(h.TEXTURE_2D,0,h.RGBA,h.RGBA,h.UNSIGNED_BYTE,b.image);G(h.TEXTURE_2D,b,b.image);h.bindTexture(h.TEXTURE_2D,null);b.needsUpdate=!1}h.activeTexture(h.TEXTURE0+e);h.bindTexture(h.TEXTURE_2D,b.__webglTexture)}function R(b){if(b&&
+!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglFramebuffer=h.createFramebuffer();b.__webglRenderbuffer=h.createRenderbuffer();b.__webglTexture=h.createTexture();h.bindTexture(h.TEXTURE_2D,b.__webglTexture);h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_S,J(b.wrapS));h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_T,J(b.wrapT));h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MAG_FILTER,J(b.magFilter));h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MIN_FILTER,
+J(b.minFilter));h.texImage2D(h.TEXTURE_2D,0,J(b.format),b.width,b.height,0,J(b.format),J(b.type),null);h.bindRenderbuffer(h.RENDERBUFFER,b.__webglRenderbuffer);h.bindFramebuffer(h.FRAMEBUFFER,b.__webglFramebuffer);h.framebufferTexture2D(h.FRAMEBUFFER,h.COLOR_ATTACHMENT0,h.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(h.renderbufferStorage(h.RENDERBUFFER,h.DEPTH_COMPONENT16,b.width,b.height),h.framebufferRenderbuffer(h.FRAMEBUFFER,h.DEPTH_ATTACHMENT,h.RENDERBUFFER,b.__webglRenderbuffer)):
+b.depthBuffer&&b.stencilBuffer?(h.renderbufferStorage(h.RENDERBUFFER,h.DEPTH_STENCIL,b.width,b.height),h.framebufferRenderbuffer(h.FRAMEBUFFER,h.DEPTH_STENCIL_ATTACHMENT,h.RENDERBUFFER,b.__webglRenderbuffer)):h.renderbufferStorage(h.RENDERBUFFER,h.RGBA4,b.width,b.height);h.bindTexture(h.TEXTURE_2D,null);h.bindRenderbuffer(h.RENDERBUFFER,null);h.bindFramebuffer(h.FRAMEBUFFER,null)}var e,c;b?(e=b.__webglFramebuffer,c=b.width,b=b.height):(e=null,c=Y,b=ha);e!=$&&(h.bindFramebuffer(h.FRAMEBUFFER,e),h.viewport(W,
+fa,c,b),$=e)}function D(b,e){var c;b=="fragment"?c=h.createShader(h.FRAGMENT_SHADER):b=="vertex"&&(c=h.createShader(h.VERTEX_SHADER));h.shaderSource(c,e);h.compileShader(c);if(!h.getShaderParameter(c,h.COMPILE_STATUS))return console.error(h.getShaderInfoLog(c)),console.error(e),null;return c}function N(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return h.NEAREST;default:return h.LINEAR}}function J(b){switch(b){case THREE.RepeatWrapping:return h.REPEAT;
+case THREE.ClampToEdgeWrapping:return h.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return h.MIRRORED_REPEAT;case THREE.NearestFilter:return h.NEAREST;case THREE.NearestMipMapNearestFilter:return h.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return h.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return h.LINEAR;case THREE.LinearMipMapNearestFilter:return h.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return h.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return h.BYTE;
+case THREE.UnsignedByteType:return h.UNSIGNED_BYTE;case THREE.ShortType:return h.SHORT;case THREE.UnsignedShortType:return h.UNSIGNED_SHORT;case THREE.IntType:return h.INT;case THREE.UnsignedShortType:return h.UNSIGNED_INT;case THREE.FloatType:return h.FLOAT;case THREE.AlphaFormat:return h.ALPHA;case THREE.RGBFormat:return h.RGB;case THREE.RGBAFormat:return h.RGBA;case THREE.LuminanceFormat:return h.LUMINANCE;case THREE.LuminanceAlphaFormat:return h.LUMINANCE_ALPHA}return 0}var V=this,h,X=[],O=null,
+$=null,M=!0,ca=null,U=null,S=null,ja=null,W=0,fa=0,Y=0,ha=0,ea=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Q=new THREE.Matrix4,T=new Float32Array(16),Z=new Float32Array(16),ka=new THREE.Vector4,na={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},aa=b.canvas!==void 0?b.canvas:document.createElement("canvas"),ma=b.stencil!==void 0?b.stencil:!0,ia=b.antialias!==
+void 0?b.antialias:!1,pa=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),la=b.clearAlpha!==void 0?b.clearAlpha:0;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=aa;this.sortObjects=this.autoClear=!0;try{if(!(h=aa.getContext("experimental-webgl",{antialias:ia,stencil:ma})))throw"Error creating WebGL context.";}catch(Ca){console.error(Ca)}console.log(navigator.userAgent+" | "+h.getParameter(h.VERSION)+" | "+h.getParameter(h.VENDOR)+" | "+h.getParameter(h.RENDERER)+
+" | "+h.getParameter(h.SHADING_LANGUAGE_VERSION));h.clearColor(0,0,0,1);h.clearDepth(1);h.enable(h.DEPTH_TEST);h.depthFunc(h.LEQUAL);h.frontFace(h.CCW);h.cullFace(h.BACK);h.enable(h.CULL_FACE);h.enable(h.BLEND);h.blendEquation(h.FUNC_ADD);h.blendFunc(h.SRC_ALPHA,h.ONE_MINUS_SRC_ALPHA);h.clearColor(pa.r,pa.g,pa.b,la);this.context=h;var za=h.getParameter(h.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;if(ma){var da={};da.vertices=new Float32Array(12);da.faces=new Uint16Array(6);da.darkness=0.5;da.vertices[0]=-20;
+da.vertices[1]=-20;da.vertices[2]=-1;da.vertices[3]=20;da.vertices[4]=-20;da.vertices[5]=-1;da.vertices[6]=20;da.vertices[7]=20;da.vertices[8]=-1;da.vertices[9]=-20;da.vertices[10]=20;da.vertices[11]=-1;da.faces[0]=0;da.faces[1]=1;da.faces[2]=2;da.faces[3]=0;da.faces[4]=2;da.faces[5]=3;da.vertexBuffer=h.createBuffer();da.elementBuffer=h.createBuffer();h.bindBuffer(h.ARRAY_BUFFER,da.vertexBuffer);h.bufferData(h.ARRAY_BUFFER,da.vertices,h.STATIC_DRAW);h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,da.elementBuffer);
+h.bufferData(h.ELEMENT_ARRAY_BUFFER,da.faces,h.STATIC_DRAW);da.program=h.createProgram();h.attachShader(da.program,D("fragment",THREE.ShaderLib.shadowPost.fragmentShader));h.attachShader(da.program,D("vertex",THREE.ShaderLib.shadowPost.vertexShader));h.linkProgram(da.program);da.vertexLocation=h.getAttribLocation(da.program,"position");da.projectionLocation=h.getUniformLocation(da.program,"projectionMatrix");da.darknessLocation=h.getUniformLocation(da.program,"darkness")}var P={};P.vertices=new Float32Array(16);
+P.faces=new Uint16Array(6);b=0;P.vertices[b++]=-1;P.vertices[b++]=-1;P.vertices[b++]=0;P.vertices[b++]=0;P.vertices[b++]=1;P.vertices[b++]=-1;P.vertices[b++]=1;P.vertices[b++]=0;P.vertices[b++]=1;P.vertices[b++]=1;P.vertices[b++]=1;P.vertices[b++]=1;P.vertices[b++]=-1;P.vertices[b++]=1;P.vertices[b++]=0;P.vertices[b++]=1;b=0;P.faces[b++]=0;P.faces[b++]=1;P.faces[b++]=2;P.faces[b++]=0;P.faces[b++]=2;P.faces[b++]=3;P.vertexBuffer=h.createBuffer();P.elementBuffer=h.createBuffer();P.tempTexture=h.createTexture();
+P.occlusionTexture=h.createTexture();h.bindBuffer(h.ARRAY_BUFFER,P.vertexBuffer);h.bufferData(h.ARRAY_BUFFER,P.vertices,h.STATIC_DRAW);h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,P.elementBuffer);h.bufferData(h.ELEMENT_ARRAY_BUFFER,P.faces,h.STATIC_DRAW);h.bindTexture(h.TEXTURE_2D,P.tempTexture);h.texImage2D(h.TEXTURE_2D,0,h.RGB,16,16,0,h.RGB,h.UNSIGNED_BYTE,null);h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_S,h.CLAMP_TO_EDGE);h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_T,h.CLAMP_TO_EDGE);h.texParameteri(h.TEXTURE_2D,
+h.TEXTURE_MAG_FILTER,h.NEAREST);h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MIN_FILTER,h.NEAREST);h.bindTexture(h.TEXTURE_2D,P.occlusionTexture);h.texImage2D(h.TEXTURE_2D,0,h.RGBA,16,16,0,h.RGBA,h.UNSIGNED_BYTE,null);h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_S,h.CLAMP_TO_EDGE);h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_T,h.CLAMP_TO_EDGE);h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MAG_FILTER,h.NEAREST);h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MIN_FILTER,h.NEAREST);h.getParameter(h.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=
+0?(P.hasVertexTexture=!1,P.program=h.createProgram(),h.attachShader(P.program,D("fragment",THREE.ShaderLib.lensFlare.fragmentShader)),h.attachShader(P.program,D("vertex",THREE.ShaderLib.lensFlare.vertexShader))):(P.hasVertexTexture=!0,P.program=h.createProgram(),h.attachShader(P.program,D("fragment",THREE.ShaderLib.lensFlareVertexTexture.fragmentShader)),h.attachShader(P.program,D("vertex",THREE.ShaderLib.lensFlareVertexTexture.vertexShader)));h.linkProgram(P.program);P.attributes={};P.uniforms={};
+P.attributes.vertex=h.getAttribLocation(P.program,"position");P.attributes.uv=h.getAttribLocation(P.program,"UV");P.uniforms.renderType=h.getUniformLocation(P.program,"renderType");P.uniforms.map=h.getUniformLocation(P.program,"map");P.uniforms.occlusionMap=h.getUniformLocation(P.program,"occlusionMap");P.uniforms.opacity=h.getUniformLocation(P.program,"opacity");P.uniforms.scale=h.getUniformLocation(P.program,"scale");P.uniforms.rotation=h.getUniformLocation(P.program,"rotation");P.uniforms.screenPosition=
+h.getUniformLocation(P.program,"screenPosition");var Aa=!1;_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=h.createBuffer();_sprite.elementBuffer=h.createBuffer();h.bindBuffer(h.ARRAY_BUFFER,_sprite.vertexBuffer);h.bufferData(h.ARRAY_BUFFER,_sprite.vertices,h.STATIC_DRAW);h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,_sprite.elementBuffer);h.bufferData(h.ELEMENT_ARRAY_BUFFER,_sprite.faces,h.STATIC_DRAW);_sprite.program=h.createProgram();
+h.attachShader(_sprite.program,D("fragment",THREE.ShaderLib.sprite.fragmentShader));h.attachShader(_sprite.program,D("vertex",THREE.ShaderLib.sprite.vertexShader));h.linkProgram(_sprite.program);_sprite.attributes={};_sprite.uniforms={};_sprite.attributes.position=h.getAttribLocation(_sprite.program,"position");_sprite.attributes.uv=h.getAttribLocation(_sprite.program,"uv");_sprite.uniforms.uvOffset=h.getUniformLocation(_sprite.program,"uvOffset");_sprite.uniforms.uvScale=h.getUniformLocation(_sprite.program,
+"uvScale");_sprite.uniforms.rotation=h.getUniformLocation(_sprite.program,"rotation");_sprite.uniforms.scale=h.getUniformLocation(_sprite.program,"scale");_sprite.uniforms.alignment=h.getUniformLocation(_sprite.program,"alignment");_sprite.uniforms.map=h.getUniformLocation(_sprite.program,"map");_sprite.uniforms.opacity=h.getUniformLocation(_sprite.program,"opacity");_sprite.uniforms.useScreenCoordinates=h.getUniformLocation(_sprite.program,"useScreenCoordinates");_sprite.uniforms.affectedByDistance=
+h.getUniformLocation(_sprite.program,"affectedByDistance");_sprite.uniforms.screenPosition=h.getUniformLocation(_sprite.program,"screenPosition");_sprite.uniforms.modelViewMatrix=h.getUniformLocation(_sprite.program,"modelViewMatrix");_sprite.uniforms.projectionMatrix=h.getUniformLocation(_sprite.program,"projectionMatrix");var ta=!1;this.setSize=function(b,e){aa.width=b;aa.height=e;this.setViewport(0,0,aa.width,aa.height)};this.setViewport=function(b,e,c,f){W=b;fa=e;Y=c;ha=f;h.viewport(W,fa,Y,ha)};
+this.setScissor=function(b,e,c,f){h.scissor(b,e,c,f)};this.enableScissorTest=function(b){b?h.enable(h.SCISSOR_TEST):h.disable(h.SCISSOR_TEST)};this.enableDepthBufferWrite=function(b){M=b;h.depthMask(b)};this.setClearColorHex=function(b,e){pa.setHex(b);la=e;h.clearColor(pa.r,pa.g,pa.b,la)};this.setClearColor=function(b,e){pa.copy(b);la=e;h.clearColor(pa.r,pa.g,pa.b,la)};this.clear=function(){h.clear(h.COLOR_BUFFER_BIT|h.DEPTH_BUFFER_BIT|h.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(b){da.darkness=
+b};this.getContext=function(){return h};this.initMaterial=function(b,e,c,f){var g,j,k;b instanceof THREE.MeshDepthMaterial?k="depth":b instanceof THREE.ShadowVolumeDynamicMaterial?k="shadowVolumeDynamic":b instanceof THREE.MeshNormalMaterial?k="normal":b instanceof THREE.MeshBasicMaterial?k="basic":b instanceof THREE.MeshLambertMaterial?k="lambert":b instanceof THREE.MeshPhongMaterial?k="phong":b instanceof THREE.LineBasicMaterial?k="basic":b instanceof THREE.ParticleBasicMaterial&&(k="particle_basic");
+if(k){var m=THREE.ShaderLib[k];b.uniforms=THREE.UniformsUtils.clone(m.uniforms);b.vertexShader=m.vertexShader;b.fragmentShader=m.fragmentShader}var n,p,o;n=o=m=0;for(p=e.length;n<p;n++)j=e[n],j instanceof THREE.DirectionalLight&&o++,j instanceof THREE.PointLight&&m++;m+o<=4?e=o:(e=Math.ceil(4*o/(m+o)),m=4-e);j={directional:e,point:m};o=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)o=f.bones.length;var t;a:{n=b.fragmentShader;p=b.vertexShader;var m=b.uniforms,e=b.attributes,c={map:!!b.map,envMap:!!b.envMap,
+lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:c,sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:j.directional,maxPointLights:j.point,maxBones:o},u;j=[];k?j.push(k):(j.push(n),j.push(p));for(u in c)j.push(u),j.push(c[u]);k=j.join();u=0;for(j=X.length;u<j;u++)if(X[u].code==k){t=X[u].program;break a}u=h.createProgram();j=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+c.maxDirLights,
+"#define MAX_POINT_LIGHTS "+c.maxPointLights,c.fog?"#define USE_FOG":"",c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");o=[za?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":
+"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
+h.attachShader(u,D("fragment",j+n));h.attachShader(u,D("vertex",o+p));h.linkProgram(u);h.getProgramParameter(u,h.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+h.getProgramParameter(u,h.VALIDATE_STATUS)+", gl error ["+h.getError()+"]");u.uniforms={};u.attributes={};var v;n=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(v in m)n.push(v);v=n;m=0;for(n=
+v.length;m<n;m++)p=v[m],u.uniforms[p]=h.getUniformLocation(u,p);n=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(v=0;v<c.maxMorphTargets;v++)n.push("morphTarget"+v);for(t in e)n.push(t);t=n;v=0;for(e=t.length;v<e;v++)c=t[v],u.attributes[c]=h.getAttribLocation(u,c);X.push({program:u,code:k});t=u}b.program=t;t=b.program.attributes;t.position>=0&&h.enableVertexAttribArray(t.position);t.color>=0&&h.enableVertexAttribArray(t.color);t.normal>=
+0&&h.enableVertexAttribArray(t.normal);t.tangent>=0&&h.enableVertexAttribArray(t.tangent);b.skinning&&t.skinVertexA>=0&&t.skinVertexB>=0&&t.skinIndex>=0&&t.skinWeight>=0&&(h.enableVertexAttribArray(t.skinVertexA),h.enableVertexAttribArray(t.skinVertexB),h.enableVertexAttribArray(t.skinIndex),h.enableVertexAttribArray(t.skinWeight));if(b.attributes)for(g in b.attributes)t[g]!==void 0&&t[g]>=0&&h.enableVertexAttribArray(t[g]);if(b.morphTargets){b.numSupportedMorphTargets=0;t.morphTarget0>=0&&(h.enableVertexAttribArray(t.morphTarget0),
+b.numSupportedMorphTargets++);t.morphTarget1>=0&&(h.enableVertexAttribArray(t.morphTarget1),b.numSupportedMorphTargets++);t.morphTarget2>=0&&(h.enableVertexAttribArray(t.morphTarget2),b.numSupportedMorphTargets++);t.morphTarget3>=0&&(h.enableVertexAttribArray(t.morphTarget3),b.numSupportedMorphTargets++);t.morphTarget4>=0&&(h.enableVertexAttribArray(t.morphTarget4),b.numSupportedMorphTargets++);t.morphTarget5>=0&&(h.enableVertexAttribArray(t.morphTarget5),b.numSupportedMorphTargets++);t.morphTarget6>=
+0&&(h.enableVertexAttribArray(t.morphTarget6),b.numSupportedMorphTargets++);t.morphTarget7>=0&&(h.enableVertexAttribArray(t.morphTarget7),b.numSupportedMorphTargets++);f.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);b=0;for(g=this.maxMorphTargets;b<g;b++)f.__webglMorphTargetInfluences[b]=0}};this.render=function(b,c,o,B){var A,D,C,G,H,J,aa,M,ia=b.lights,N=b.fog;V.data.vertices=0;V.data.faces=0;V.data.drawCalls=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(Z);
+c.projectionMatrix.flattenToArray(T);Q.multiply(c.projectionMatrix,c.matrixWorldInverse);m(Q);this.initWebGLObjects(b);R(o);(this.autoClear||B)&&this.clear();H=b.__webglObjects.length;for(B=0;B<H;B++)if(A=b.__webglObjects[B],aa=A.object,aa.visible)if(!(aa instanceof THREE.Mesh)||n(aa)){if(aa.matrixWorld.flattenToArray(aa._objectMatrixArray),I(aa,c),t(A),A.render=!0,this.sortObjects)ka.copy(aa.position),Q.multiplyVector3(ka),A.z=ka.z}else A.render=!1;else A.render=!1;this.sortObjects&&b.__webglObjects.sort(u);
+J=b.__webglObjectsImmediate.length;for(B=0;B<J;B++)A=b.__webglObjectsImmediate[B],aa=A.object,aa.visible&&(aa.matrixAutoUpdate&&aa.matrixWorld.flattenToArray(aa._objectMatrixArray),I(aa,c),p(A));K(THREE.NormalBlending);for(B=0;B<H;B++)if(A=b.__webglObjects[B],A.render){aa=A.object;M=A.buffer;C=A.opaque;j(aa);for(A=0;A<C.count;A++)G=C.list[A],k(G.depthTest),f(c,ia,N,G,M,aa)}for(B=0;B<J;B++)if(A=b.__webglObjectsImmediate[B],aa=A.object,aa.visible){C=A.opaque;j(aa);for(A=0;A<C.count;A++)G=C.list[A],
+k(G.depthTest),D=e(c,ia,N,G,aa),aa.render(function(b){g(b,D,G.shading)})}for(B=0;B<H;B++)if(A=b.__webglObjects[B],A.render){aa=A.object;M=A.buffer;C=A.transparent;j(aa);for(A=0;A<C.count;A++)G=C.list[A],K(G.blending),k(G.depthTest),f(c,ia,N,G,M,aa)}for(B=0;B<J;B++)if(A=b.__webglObjectsImmediate[B],aa=A.object,aa.visible){C=A.transparent;j(aa);for(A=0;A<C.count;A++)G=C.list[A],K(G.blending),k(G.depthTest),D=e(c,ia,N,G,aa),aa.render(function(b){g(b,D,G.shading)})}b.__webglSprites.length&&w(b,c);ma&&
+b.__webglShadowVolumes.length&&b.lights.length&&v(b);b.__webglLensFlares.length&&E(b,c);o&&o.minFilter!==THREE.NearestFilter&&o.minFilter!==THREE.LinearFilter&&(h.bindTexture(h.TEXTURE_2D,o.__webglTexture),h.generateMipmap(h.TEXTURE_2D),h.bindTexture(h.TEXTURE_2D,null))};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=[],b.__webglShadowVolumes=[],b.__webglLensFlares=[],b.__webglSprites=[];for(;b.__objectsAdded.length;){var c=b.__objectsAdded[0],
+e=b,f=void 0,g=void 0,j=void 0;if(c._modelViewMatrix==void 0)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)for(f in g=c.geometry,g.geometryGroups==void 0&&H(g),g.geometryGroups){j=g.geometryGroups[f];if(!j.__webglVertexBuffer){var k=j;k.__webglVertexBuffer=h.createBuffer();k.__webglNormalBuffer=h.createBuffer();
+k.__webglTangentBuffer=h.createBuffer();k.__webglColorBuffer=h.createBuffer();k.__webglUVBuffer=h.createBuffer();k.__webglUV2Buffer=h.createBuffer();k.__webglSkinVertexABuffer=h.createBuffer();k.__webglSkinVertexBBuffer=h.createBuffer();k.__webglSkinIndicesBuffer=h.createBuffer();k.__webglSkinWeightsBuffer=h.createBuffer();k.__webglFaceBuffer=h.createBuffer();k.__webglLineBuffer=h.createBuffer();if(k.numMorphTargets){var m=void 0,n=void 0;k.__webglMorphTargetsBuffers=[];m=0;for(n=k.numMorphTargets;m<
+n;m++)k.__webglMorphTargetsBuffers.push(h.createBuffer())}for(var k=j,m=c,t=void 0,o=void 0,p=void 0,u=p=void 0,v=void 0,w=void 0,G=w=n=0,C=p=o=void 0,o=t=void 0,u=m.geometry,C=u.faces,v=k.faces,t=0,o=v.length;t<o;t++)p=v[t],p=C[p],p instanceof THREE.Face3?(n+=3,w+=1,G+=3):p instanceof THREE.Face4&&(n+=4,w+=2,G+=4);for(var t=k,o=m,D=v=C=void 0,E=void 0,D=void 0,p=[],C=0,v=o.materials.length;C<v;C++)if(D=o.materials[C],D instanceof THREE.MeshFaceMaterial){D=0;for(l=t.materials.length;D<l;D++)(E=t.materials[D])&&
+p.push(E)}else(E=D)&&p.push(E);t=p;a:{C=o=void 0;v=t.length;for(o=0;o<v;o++)if(C=t[o],C.map||C.lightMap||C instanceof THREE.MeshShaderMaterial){o=!0;break a}o=!1}a:{C=t;p=v=void 0;D=C.length;for(v=0;v<D;v++)if(p=C[v],!(p instanceof THREE.MeshBasicMaterial&&!p.envMap||p instanceof THREE.MeshDepthMaterial)){C=p&&p.shading!=void 0&&p.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}C=!1}a:{p=v=void 0;D=t.length;for(v=0;v<D;v++)if(p=t[v],p.vertexColors){p=p.vertexColors;break a}p=
+!1}k.__vertexArray=new Float32Array(n*3);if(C)k.__normalArray=new Float32Array(n*3);if(u.hasTangents)k.__tangentArray=new Float32Array(n*4);if(p)k.__colorArray=new Float32Array(n*3);if(o){if(u.faceUvs.length>0||u.faceVertexUvs.length>0)k.__uvArray=new Float32Array(n*2);if(u.faceUvs.length>1||u.faceVertexUvs.length>1)k.__uv2Array=new Float32Array(n*2)}if(m.geometry.skinWeights.length&&m.geometry.skinIndices.length)k.__skinVertexAArray=new Float32Array(n*4),k.__skinVertexBArray=new Float32Array(n*4),
+k.__skinIndexArray=new Float32Array(n*4),k.__skinWeightArray=new Float32Array(n*4);k.__faceArray=new Uint16Array(w*3+(m.geometry.edgeFaces?m.geometry.edgeFaces.length*6:0));k.__lineArray=new Uint16Array(G*2);if(k.numMorphTargets){k.__morphTargetsArrays=[];u=0;for(v=k.numMorphTargets;u<v;u++)k.__morphTargetsArrays.push(new Float32Array(n*3))}k.__needsSmoothNormals=C==THREE.SmoothShading;k.__uvType=o;k.__vertexColorType=p;k.__normalType=C;k.__webglFaceCount=w*3+(m.geometry.edgeFaces?m.geometry.edgeFaces.length*
+6:0);k.__webglLineCount=G*2;u=0;for(v=t.length;u<v;u++)if(t[u].attributes)for(a in k.__webglCustomAttributes={},t[u].attributes){o={};for(prop in t[u].attributes[a])o[prop]=t[u].attributes[a][prop];if(!o.__webglInitialized||o.createUniqueBuffers)o.__webglInitialized=!0,w=1,o.type==="v2"?w=2:o.type==="v3"?w=3:o.type==="v4"?w=4:o.type==="c"&&(w=3),o.size=w,o.needsUpdate=!0,o.array=new Float32Array(n*w),o.buffer=h.createBuffer(),o.buffer.belongsToAttribute=a;k.__webglCustomAttributes[a]=o}k.__inittedArrays=
+!0;g.__dirtyVertices=!0;g.__dirtyMorphTargets=!0;g.__dirtyElements=!0;g.__dirtyUvs=!0;g.__dirtyNormals=!0;g.__dirtyTangents=!0;g.__dirtyColors=!0}c instanceof THREE.ShadowVolume?A(e.__webglShadowVolumes,j,c):A(e.__webglObjects,j,c)}else if(c instanceof THREE.LensFlare)A(e.__webglLensFlares,void 0,c);else if(c instanceof THREE.Ribbon){g=c.geometry;if(!g.__webglVertexBuffer)f=g,f.__webglVertexBuffer=h.createBuffer(),f.__webglColorBuffer=h.createBuffer(),f=g,j=f.vertices.length,f.__vertexArray=new Float32Array(j*
+3),f.__colorArray=new Float32Array(j*3),f.__webglVertexCount=j,g.__dirtyVertices=!0,g.__dirtyColors=!0;A(e.__webglObjects,g,c)}else if(c instanceof THREE.Line){g=c.geometry;if(!g.__webglVertexBuffer)f=g,f.__webglVertexBuffer=h.createBuffer(),f.__webglColorBuffer=h.createBuffer(),f=g,j=f.vertices.length,f.__vertexArray=new Float32Array(j*3),f.__colorArray=new Float32Array(j*3),f.__webglLineCount=j,g.__dirtyVertices=!0,g.__dirtyColors=!0;A(e.__webglObjects,g,c)}else if(c instanceof THREE.ParticleSystem){g=
+c.geometry;if(!g.__webglVertexBuffer)f=g,f.__webglVertexBuffer=h.createBuffer(),f.__webglColorBuffer=h.createBuffer(),f=g,j=f.vertices.length,f.__vertexArray=new Float32Array(j*3),f.__colorArray=new Float32Array(j*3),f.__sortArray=[],f.__webglParticleCount=j,g.__dirtyVertices=!0,g.__dirtyColors=!0;A(e.__webglObjects,g,c)}else THREE.MarchingCubes!==void 0&&c instanceof THREE.MarchingCubes?e.__webglObjectsImmediate.push({object:c,opaque:{list:[],count:0},transparent:{list:[],count:0}}):c instanceof
+THREE.Sprite&&e.__webglSprites.push(c);b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;){c=b.__objectsRemoved[0];e=b;f=g=void 0;if(c instanceof THREE.Mesh)for(g=e.__webglObjects.length-1;g>=0;g--){if(f=e.__webglObjects[g].object,c==f){e.__webglObjects.splice(g,1);break}}else if(c instanceof THREE.Sprite)for(g=e.__webglSprites.length-1;g>=0;g--)if(f=e.__webglSprites[g],c==f){e.__webglSprites.splice(g,1);break}b.__objectsRemoved.splice(0,1)}c=0;for(e=b.__webglObjects.length;c<e;c++)B(b.__webglObjects[c].object,
+b);c=0;for(e=b.__webglShadowVolumes.length;c<e;c++)B(b.__webglShadowVolumes[c].object,b);c=0;for(e=b.__webglLensFlares.length;c<e;c++)B(b.__webglLensFlares[c].object,b)};this.setFaceCulling=function(b,c){b?(!c||c=="ccw"?h.frontFace(h.CCW):h.frontFace(h.CW),b=="back"?h.cullFace(h.BACK):b=="front"?h.cullFace(h.FRONT):h.cullFace(h.FRONT_AND_BACK),h.enable(h.CULL_FACE)):h.disable(h.CULL_FACE)};this.supportsVertexTextures=function(){return za}};
 THREE.WebGLRenderTarget=function(b,c,e){this.width=b;this.height=c;e=e||{};this.wrapS=e.wrapS!==void 0?e.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=e.wrapT!==void 0?e.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=e.magFilter!==void 0?e.magFilter:THREE.LinearFilter;this.minFilter=e.minFilter!==void 0?e.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=e.format!==void 0?e.format:THREE.RGBAFormat;this.type=e.type!==void 0?e.type:
 THREE.UnsignedByteType;this.depthBuffer=e.depthBuffer!==void 0?e.depthBuffer:!0;this.stencilBuffer=e.stencilBuffer!==void 0?e.stencilBuffer:!0};
 THREE.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,e){e&&b.update(void 0,!1,c);var e=b.sounds,f,g=e.length;for(f=0;f<g;f++)b=e[f],this.soundPosition.set(b.matrixWorld.n14,b.matrixWorld.n24,b.matrixWorld.n34),this.soundPosition.subSelf(c.position),b.isPlaying&&b.isLoaded&&(b.isAddedToDOM||b.addToDOM(this.domElement),b.calculateVolumeAndPan(this.soundPosition))}};
@@ -339,15 +341,15 @@ THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.posi
 THREE.RenderableFace3=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[[]];this.z=null};
 THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.v4=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[[]];this.z=null};
 THREE.RenderableObject=function(){this.z=this.object=null};THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.materials=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.materials=null};
-THREE.ColorUtils={adjustHSV:function(b,c,e,f){var g=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(b,g);g.h=THREE.ColorUtils.clamp(g.h+c,0,1);g.s=THREE.ColorUtils.clamp(g.s+e,0,1);g.v=THREE.ColorUtils.clamp(g.v+f,0,1);b.setHSV(g.h,g.s,g.v)},rgbToHsv:function(b,c){var e=b.r,f=b.g,g=b.b,h=Math.max(Math.max(e,f),g),k=Math.min(Math.min(e,f),g);if(k==h)k=e=0;else{var m=h-k,k=m/h,e=e==h?(f-g)/m:f==h?2+(g-e)/m:4+(e-f)/m;e/=6;e<0&&(e+=1);e>1&&(e-=1)}c===void 0&&(c={h:0,s:0,v:0});c.h=e;c.s=k;c.v=h;return c},
+THREE.ColorUtils={adjustHSV:function(b,c,e,f){var g=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(b,g);g.h=THREE.ColorUtils.clamp(g.h+c,0,1);g.s=THREE.ColorUtils.clamp(g.s+e,0,1);g.v=THREE.ColorUtils.clamp(g.v+f,0,1);b.setHSV(g.h,g.s,g.v)},rgbToHsv:function(b,c){var e=b.r,f=b.g,g=b.b,j=Math.max(Math.max(e,f),g),k=Math.min(Math.min(e,f),g);if(k==j)k=e=0;else{var m=j-k,k=m/j,e=e==j?(f-g)/m:f==j?2+(g-e)/m:4+(e-f)/m;e/=6;e<0&&(e+=1);e>1&&(e-=1)}c===void 0&&(c={h:0,s:0,v:0});c.h=e;c.s=k;c.v=j;return c},
 clamp:function(b,c,e){return b<c?c:b>e?e:b}};THREE.ColorUtils.__hsv={h:0,s:0,v:0};
-var GeometryUtils={merge:function(b,c){var e=c instanceof THREE.Mesh,f=b.vertices.length,g=e?c.geometry:c,h=b.vertices,k=g.vertices,m=b.faces,n=g.faces,o=b.faceVertexUvs[0],g=g.faceVertexUvs[0];e&&c.matrixAutoUpdate&&c.updateMatrix();for(var p=0,t=k.length;p<t;p++){var v=new THREE.Vertex(k[p].position.clone());e&&c.matrix.multiplyVector3(v.position);h.push(v)}p=0;for(t=n.length;p<t;p++){var k=n[p],u,w,E=k.vertexNormals,v=k.vertexColors;k instanceof THREE.Face3?u=new THREE.Face3(k.a+f,k.b+f,k.c+f):
-k instanceof THREE.Face4&&(u=new THREE.Face4(k.a+f,k.b+f,k.c+f,k.d+f));u.normal.copy(k.normal);e=0;for(h=E.length;e<h;e++)w=E[e],u.vertexNormals.push(w.clone());u.color.copy(k.color);e=0;for(h=v.length;e<h;e++)w=v[e],u.vertexColors.push(w.clone());u.materials=k.materials.slice();u.centroid.copy(k.centroid);m.push(u)}p=0;for(t=g.length;p<t;p++){f=g[p];m=[];e=0;for(h=f.length;e<h;e++)m.push(new THREE.UV(f[e].u,f[e].v));o.push(m)}}};
-THREE.ImageUtils={loadTexture:function(b,c,e){var f=new Image,g=new THREE.Texture(f,c);f.onload=function(){g.needsUpdate=!0;e&&e(this)};f.src=b;return g},loadTextureCube:function(b,c,e){var f,g=[],h=new THREE.Texture(g,c),c=g.loadCount=0;for(f=b.length;c<f;++c)g[c]=new Image,g[c].onload=function(){g.loadCount+=1;if(g.loadCount==6)h.needsUpdate=!0;e&&e(this)},g[c].src=b[c];return h}};
-THREE.SceneUtils={addMesh:function(b,c,e,f,g,h,k,m,n,o){c=new THREE.Mesh(c,o);c.scale.x=c.scale.y=c.scale.z=e;c.position.x=f;c.position.y=g;c.position.z=h;c.rotation.x=k;c.rotation.y=m;c.rotation.z=n;b.addObject(c);return c},addPanoramaCubeWebGL:function(b,c,e){var f=THREE.ShaderUtils.lib.cube;f.uniforms.tCube.texture=e;e=new THREE.MeshShaderMaterial({fragmentShader:f.fragmentShader,vertexShader:f.vertexShader,uniforms:f.uniforms});c=new THREE.Mesh(new THREE.Cube(c,c,c,1,1,1,null,!0),e);b.addObject(c);
+var GeometryUtils={merge:function(b,c){var e=c instanceof THREE.Mesh,f=b.vertices.length,g=e?c.geometry:c,j=b.vertices,k=g.vertices,m=b.faces,n=g.faces,o=b.faceVertexUvs[0],g=g.faceVertexUvs[0];e&&c.matrixAutoUpdate&&c.updateMatrix();for(var p=0,t=k.length;p<t;p++){var u=new THREE.Vertex(k[p].position.clone());e&&c.matrix.multiplyVector3(u.position);j.push(u)}p=0;for(t=n.length;p<t;p++){var k=n[p],v,w,E=k.vertexNormals,u=k.vertexColors;k instanceof THREE.Face3?v=new THREE.Face3(k.a+f,k.b+f,k.c+f):
+k instanceof THREE.Face4&&(v=new THREE.Face4(k.a+f,k.b+f,k.c+f,k.d+f));v.normal.copy(k.normal);e=0;for(j=E.length;e<j;e++)w=E[e],v.vertexNormals.push(w.clone());v.color.copy(k.color);e=0;for(j=u.length;e<j;e++)w=u[e],v.vertexColors.push(w.clone());v.materials=k.materials.slice();v.centroid.copy(k.centroid);m.push(v)}p=0;for(t=g.length;p<t;p++){f=g[p];m=[];e=0;for(j=f.length;e<j;e++)m.push(new THREE.UV(f[e].u,f[e].v));o.push(m)}}};
+THREE.ImageUtils={loadTexture:function(b,c,e){var f=new Image,g=new THREE.Texture(f,c);f.onload=function(){g.needsUpdate=!0;e&&e(this)};f.src=b;return g},loadTextureCube:function(b,c,e){var f,g=[],j=new THREE.Texture(g,c),c=g.loadCount=0;for(f=b.length;c<f;++c)g[c]=new Image,g[c].onload=function(){g.loadCount+=1;if(g.loadCount==6)j.needsUpdate=!0;e&&e(this)},g[c].src=b[c];return j}};
+THREE.SceneUtils={addMesh:function(b,c,e,f,g,j,k,m,n,o){c=new THREE.Mesh(c,o);c.scale.x=c.scale.y=c.scale.z=e;c.position.x=f;c.position.y=g;c.position.z=j;c.rotation.x=k;c.rotation.y=m;c.rotation.z=n;b.addObject(c);return c},addPanoramaCubeWebGL:function(b,c,e){var f=THREE.ShaderUtils.lib.cube;f.uniforms.tCube.texture=e;e=new THREE.MeshShaderMaterial({fragmentShader:f.fragmentShader,vertexShader:f.vertexShader,uniforms:f.uniforms});c=new THREE.Mesh(new THREE.Cube(c,c,c,1,1,1,null,!0),e);b.addObject(c);
 return c},addPanoramaCube:function(b,c,e){var f=[];f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(e[0])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(e[1])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(e[2])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(e[3])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(e[4])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(e[5])}));c=new THREE.Mesh(new THREE.Cube(c,c,c,1,1,f,!0),
-new THREE.MeshFaceMaterial);b.addObject(c);return c},addPanoramaCubePlanes:function(b,c,e){var f=c/2,c=new THREE.Plane(c,c),g=Math.PI,h=Math.PI/2;THREE.SceneUtils.addMesh(b,c,1,0,0,-f,0,0,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(e[5])}));THREE.SceneUtils.addMesh(b,c,1,-f,0,0,0,h,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(e[0])}));THREE.SceneUtils.addMesh(b,c,1,f,0,0,0,-h,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(e[1])}));THREE.SceneUtils.addMesh(b,c,1,0,f,0,h,0,g,
-new THREE.MeshBasicMaterial({map:new THREE.Texture(e[2])}));THREE.SceneUtils.addMesh(b,c,1,0,-f,0,-h,0,g,new THREE.MeshBasicMaterial({map:new THREE.Texture(e[3])}))},showHierarchy:function(b,c){THREE.SceneUtils.traverseHierarchy(b,function(b){b.visible=c})},traverseHierarchy:function(b,c){var e,f,g=b.children.length;for(f=0;f<g;f++)e=b.children[f],c(e),THREE.SceneUtils.traverseHierarchy(e,c)}};
+new THREE.MeshFaceMaterial);b.addObject(c);return c},addPanoramaCubePlanes:function(b,c,e){var f=c/2,c=new THREE.Plane(c,c),g=Math.PI,j=Math.PI/2;THREE.SceneUtils.addMesh(b,c,1,0,0,-f,0,0,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(e[5])}));THREE.SceneUtils.addMesh(b,c,1,-f,0,0,0,j,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(e[0])}));THREE.SceneUtils.addMesh(b,c,1,f,0,0,0,-j,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(e[1])}));THREE.SceneUtils.addMesh(b,c,1,0,f,0,j,0,g,
+new THREE.MeshBasicMaterial({map:new THREE.Texture(e[2])}));THREE.SceneUtils.addMesh(b,c,1,0,-f,0,-j,0,g,new THREE.MeshBasicMaterial({map:new THREE.Texture(e[3])}))},showHierarchy:function(b,c){THREE.SceneUtils.traverseHierarchy(b,function(b){b.visible=c})},traverseHierarchy:function(b,c){var e,f,g=b.children.length;for(f=0;f<g;f++)e=b.children[f],c(e),THREE.SceneUtils.traverseHierarchy(e,c)}};
 THREE.ShaderUtils={lib:{fresnel:{uniforms:{mRefractionRatio:{type:"f",value:1.02},mFresnelBias:{type:"f",value:0.1},mFresnelPower:{type:"f",value:2},mFresnelScale:{type:"f",value:1},tCube:{type:"t",value:1,texture:null}},fragmentShader:"uniform samplerCube tCube;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\nvec4 refractedColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nrefractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;\nrefractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;\nrefractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;\nrefractedColor.a = 1.0;\ngl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );\n}",
 vertexShader:"uniform float mRefractionRatio;\nuniform float mFresnelBias;\nuniform float mFresnelScale;\nuniform float mFresnelPower;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = normalize ( mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal );\nvec3 I = mPosition.xyz - cameraPosition;\nvReflect = reflect( I, nWorld );\nvRefract[0] = refract( normalize( I ), nWorld, mRefractionRatio );\nvRefract[1] = refract( normalize( I ), nWorld, mRefractionRatio * 0.99 );\nvRefract[2] = refract( normalize( I ), nWorld, mRefractionRatio * 0.98 );\nvReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), nWorld ), mFresnelPower );\ngl_Position = projectionMatrix * mvPosition;\n}"},
 normal:{uniforms:{enableAO:{type:"i",value:0},enableDiffuse:{type:"i",value:0},enableSpecular:{type:"i",value:0},tDiffuse:{type:"t",value:0,texture:null},tNormal:{type:"t",value:2,texture:null},tSpecular:{type:"t",value:3,texture:null},tAO:{type:"t",value:4,texture:null},uNormalScale:{type:"f",value:1},tDisplacement:{type:"t",value:5,texture:null},uDisplacementBias:{type:"f",value:-0.5},uDisplacementScale:{type:"f",value:2.5},uPointLightPos:{type:"v3",value:new THREE.Vector3},uPointLightColor:{type:"c",
@@ -357,23 +359,23 @@ cube:{uniforms:{tCube:{type:"t",value:1,texture:null}},vertexShader:"varying vec
 value:0,texture:null},uImageIncrement:{type:"v2",value:new THREE.Vector2(0.001953125,0)},cKernel:{type:"fv1",value:[]}},vertexShader:"varying vec2 vUv;\nuniform vec2 uImageIncrement;\nvoid main(void) {\nvUv = uv - ((KERNEL_SIZE - 1.0) / 2.0) * uImageIncrement;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform vec2 uImageIncrement;\nuniform float cKernel[KERNEL_SIZE];\nvoid main(void) {\nvec2 imageCoord = vUv;\nvec4 sum = vec4( 0.0, 0.0, 0.0, 0.0 );\nfor( int i=0; i<KERNEL_SIZE; ++i ) {\nsum += texture2D( tDiffuse, imageCoord ) * cKernel[i];\nimageCoord += uImageIncrement;\n}\ngl_FragColor = sum;\n}"},
 film:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},time:{type:"f",value:0},nIntensity:{type:"f",value:0.5},sIntensity:{type:"f",value:0.05},sCount:{type:"f",value:4096},grayscale:{type:"i",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float time;\nuniform bool grayscale;\nuniform float nIntensity;\nuniform float sIntensity;\nuniform float sCount;\nvoid main() {\nvec4 cTextureScreen = texture2D( tDiffuse, vUv );\nfloat x = vUv.x * vUv.y * time *  1000.0;\nx = mod( x, 13.0 ) * mod( x, 123.0 );\nfloat dx = mod( x, 0.01 );\nvec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx * 100.0, 0.0, 1.0 );\nvec2 sc = vec2( sin( vUv.y * sCount ), cos( vUv.y * sCount ) );\ncResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * sIntensity;\ncResult = cTextureScreen.rgb + clamp( nIntensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );\nif( grayscale ) {\ncResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );\n}\ngl_FragColor =  vec4( cResult, cTextureScreen.a );\n}"},
 screen:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},opacity:{type:"f",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float opacity;\nvoid main() {\nvec4 texel = texture2D( tDiffuse, vUv );\ngl_FragColor = opacity * texel;\n}"},basic:{uniforms:{},vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",
-fragmentShader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(b){var c,e,f,g,h=2*Math.ceil(b*3)+1;h>25&&(h=25);g=(h-1)*0.5;e=Array(h);for(c=f=0;c<h;++c)e[c]=Math.exp(-((c-g)*(c-g))/(2*b*b)),f+=e[c];for(c=0;c<h;++c)e[c]/=f;return e}};
+fragmentShader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(b){var c,e,f,g,j=2*Math.ceil(b*3)+1;j>25&&(j=25);g=(j-1)*0.5;e=Array(j);for(c=f=0;c<j;++c)e[c]=Math.exp(-((c-g)*(c-g))/(2*b*b)),f+=e[c];for(c=0;c<j;++c)e[c]/=f;return e}};
 THREE.AnimationHandler=function(){var b=[],c={},e={update:function(c){for(var e=0;e<b.length;e++)b[e].update(c)},addToUpdate:function(c){b.indexOf(c)===-1&&b.push(c)},removeFromUpdate:function(c){c=b.indexOf(c);c!==-1&&b.splice(c,1)},add:function(b){c[b.name]!==void 0&&console.log("THREE.AnimationHandler.add: Warning! "+b.name+" already exists in library. Overwriting.");c[b.name]=b;if(b.initialized!==!0){for(var e=0;e<b.hierarchy.length;e++){for(var f=0;f<b.hierarchy[e].keys.length;f++){if(b.hierarchy[e].keys[f].time<
 0)b.hierarchy[e].keys[f].time=0;if(b.hierarchy[e].keys[f].rot!==void 0&&!(b.hierarchy[e].keys[f].rot instanceof THREE.Quaternion)){var m=b.hierarchy[e].keys[f].rot;b.hierarchy[e].keys[f].rot=new THREE.Quaternion(m[0],m[1],m[2],m[3])}}if(b.hierarchy[e].keys[0].morphTargets!==void 0){m={};for(f=0;f<b.hierarchy[e].keys.length;f++)for(var n=0;n<b.hierarchy[e].keys[f].morphTargets.length;n++){var o=b.hierarchy[e].keys[f].morphTargets[n];m[o]=-1}b.hierarchy[e].usedMorphTargets=m;for(f=0;f<b.hierarchy[e].keys.length;f++){var p=
 {};for(o in m){for(n=0;n<b.hierarchy[e].keys[f].morphTargets.length;n++)if(b.hierarchy[e].keys[f].morphTargets[n]===o){p[o]=b.hierarchy[e].keys[f].morphTargetsInfluences[n];break}n===b.hierarchy[e].keys[f].morphTargets.length&&(p[o]=0)}b.hierarchy[e].keys[f].morphTargetsInfluences=p}}for(f=1;f<b.hierarchy[e].keys.length;f++)b.hierarchy[e].keys[f].time===b.hierarchy[e].keys[f-1].time&&(b.hierarchy[e].keys.splice(f,1),f--);for(f=1;f<b.hierarchy[e].keys.length;f++)b.hierarchy[e].keys[f].index=f}f=parseInt(b.length*
 b.fps,10);b.JIT={};b.JIT.hierarchy=[];for(e=0;e<b.hierarchy.length;e++)b.JIT.hierarchy.push(Array(f));b.initialized=!0}},get:function(b){if(typeof b==="string")return c[b]?c[b]:(console.log("THREE.AnimationHandler.get: Couldn't find animation "+b),null)},parse:function(b){var c=[];if(b instanceof THREE.SkinnedMesh)for(var e=0;e<b.bones.length;e++)c.push(b.bones[e]);else f(b,c);return c}},f=function(b,c){c.push(b);for(var e=0;e<b.children.length;e++)f(b.children[e],c)};e.LINEAR=0;e.CATMULLROM=1;e.CATMULLROM_FORWARD=
 2;return e}();THREE.Animation=function(b,c,e,f){this.root=b;this.data=THREE.AnimationHandler.get(c);this.hierarchy=THREE.AnimationHandler.parse(b);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.loop=this.isPaused=!0;this.interpolationType=e!==void 0?e:THREE.AnimationHandler.LINEAR;this.JITCompile=f!==void 0?f:!0;this.points=[];this.target=new THREE.Vector3};
 THREE.Animation.prototype.play=function(b,c){if(!this.isPlaying){this.isPlaying=!0;this.loop=b!==void 0?b:!0;this.currentTime=c!==void 0?c:0;var e,f=this.hierarchy.length,g;for(e=0;e<f;e++){g=this.hierarchy[e];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)g.useQuaternion=!0;g.matrixAutoUpdate=!0;if(g.animationCache===void 0)g.animationCache={},g.animationCache.prevKey={pos:0,rot:0,scl:0},g.animationCache.nextKey={pos:0,rot:0,scl:0},g.animationCache.originalMatrix=g instanceof
-THREE.Bone?g.skinMatrix:g.matrix;var h=g.animationCache.prevKey;g=g.animationCache.nextKey;h.pos=this.data.hierarchy[e].keys[0];h.rot=this.data.hierarchy[e].keys[0];h.scl=this.data.hierarchy[e].keys[0];g.pos=this.getNextKeyWith("pos",e,1);g.rot=this.getNextKeyWith("rot",e,1);g.scl=this.getNextKeyWith("scl",e,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
+THREE.Bone?g.skinMatrix:g.matrix;var j=g.animationCache.prevKey;g=g.animationCache.nextKey;j.pos=this.data.hierarchy[e].keys[0];j.rot=this.data.hierarchy[e].keys[0];j.scl=this.data.hierarchy[e].keys[0];g.pos=this.getNextKeyWith("pos",e,1);g.rot=this.getNextKeyWith("rot",e,1);g.scl=this.getNextKeyWith("scl",e,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
 THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
 THREE.Animation.prototype.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var b=0;b<this.hierarchy.length;b++)if(this.hierarchy[b].animationCache!==void 0)this.hierarchy[b]instanceof THREE.Bone?this.hierarchy[b].skinMatrix=this.hierarchy[b].animationCache.originalMatrix:this.hierarchy[b].matrix=this.hierarchy[b].animationCache.originalMatrix,delete this.hierarchy[b].animationCache};
-THREE.Animation.prototype.update=function(b){if(this.isPlaying){var c=["pos","rot","scl"],e,f,g,h,k,m,n,o,p=this.data.JIT.hierarchy,t,v;this.currentTime+=b*this.timeScale;v=this.currentTime;t=this.currentTime%=this.data.length;o=parseInt(Math.min(t*this.data.fps,this.data.length*this.data.fps),10);for(var u=0,w=this.hierarchy.length;u<w;u++)if(b=this.hierarchy[u],n=b.animationCache,this.JITCompile&&p[u][o]!==void 0)b instanceof THREE.Bone?(b.skinMatrix=p[u][o],b.matrixAutoUpdate=!1,b.matrixWorldNeedsUpdate=
-!1):(b.matrix=p[u][o],b.matrixAutoUpdate=!1,b.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)b instanceof THREE.Bone?b.skinMatrix=b.animationCache.originalMatrix:b.matrix=b.animationCache.originalMatrix;for(var E=0;E<3;E++){e=c[E];k=n.prevKey[e];m=n.nextKey[e];if(m.time<=v){if(t<v)if(this.loop){k=this.data.hierarchy[u].keys[0];for(m=this.getNextKeyWith(e,u,1);m.time<t;)k=m,m=this.getNextKeyWith(e,u,m.index+1)}else{this.stop();return}else{do k=m,m=this.getNextKeyWith(e,u,m.index+1);while(m.time<
-t)}n.prevKey[e]=k;n.nextKey[e]=m}b.matrixAutoUpdate=!0;b.matrixWorldNeedsUpdate=!0;f=(t-k.time)/(m.time-k.time);g=k[e];h=m[e];if(f<0||f>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+f+" on bone "+u),f=f<0?0:1;if(e==="pos")if(e=b.position,this.interpolationType===THREE.AnimationHandler.LINEAR)e.x=g[0]+(h[0]-g[0])*f,e.y=g[1]+(h[1]-g[1])*f,e.z=g[2]+(h[2]-g[2])*f;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
-this.getPrevKeyWith("pos",u,k.index-1).pos,this.points[1]=g,this.points[2]=h,this.points[3]=this.getNextKeyWith("pos",u,m.index+1).pos,f=f*0.33+0.33,g=this.interpolateCatmullRom(this.points,f),e.x=g[0],e.y=g[1],e.z=g[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)f=this.interpolateCatmullRom(this.points,f*1.01),this.target.set(f[0],f[1],f[2]),this.target.subSelf(e),this.target.y=0,this.target.normalize(),f=Math.atan2(this.target.x,this.target.z),b.rotation.set(0,f,0)}else if(e===
-"rot")THREE.Quaternion.slerp(g,h,b.quaternion,f);else if(e==="scl")e=b.scale,e.x=g[0]+(h[0]-g[0])*f,e.y=g[1]+(h[1]-g[1])*f,e.z=g[2]+(h[2]-g[2])*f}}if(this.JITCompile&&p[0][o]===void 0){this.hierarchy[0].update(void 0,!0);for(u=0;u<this.hierarchy.length;u++)p[u][o]=this.hierarchy[u]instanceof THREE.Bone?this.hierarchy[u].skinMatrix.clone():this.hierarchy[u].matrix.clone()}}};
-THREE.Animation.prototype.interpolateCatmullRom=function(b,c){var e=[],f=[],g,h,k,m,n,o;g=(b.length-1)*c;h=Math.floor(g);g-=h;e[0]=h==0?h:h-1;e[1]=h;e[2]=h>b.length-2?h:h+1;e[3]=h>b.length-3?h:h+2;h=b[e[0]];m=b[e[1]];n=b[e[2]];o=b[e[3]];e=g*g;k=g*e;f[0]=this.interpolate(h[0],m[0],n[0],o[0],g,e,k);f[1]=this.interpolate(h[1],m[1],n[1],o[1],g,e,k);f[2]=this.interpolate(h[2],m[2],n[2],o[2],g,e,k);return f};
-THREE.Animation.prototype.interpolate=function(b,c,e,f,g,h,k){b=(e-b)*0.5;f=(f-c)*0.5;return(2*(c-e)+b+f)*k+(-3*(c-e)-2*b-f)*h+b*g+c};THREE.Animation.prototype.getNextKeyWith=function(b,c,e){var f=this.data.hierarchy[c].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?e=e<f.length-1?e:f.length-1:e%=f.length;e<f.length;e++)if(f[e][b]!==void 0)return f[e];return this.data.hierarchy[c].keys[0]};
+THREE.Animation.prototype.update=function(b){if(this.isPlaying){var c=["pos","rot","scl"],e,f,g,j,k,m,n,o,p=this.data.JIT.hierarchy,t,u;this.currentTime+=b*this.timeScale;u=this.currentTime;t=this.currentTime%=this.data.length;o=parseInt(Math.min(t*this.data.fps,this.data.length*this.data.fps),10);for(var v=0,w=this.hierarchy.length;v<w;v++)if(b=this.hierarchy[v],n=b.animationCache,this.JITCompile&&p[v][o]!==void 0)b instanceof THREE.Bone?(b.skinMatrix=p[v][o],b.matrixAutoUpdate=!1,b.matrixWorldNeedsUpdate=
+!1):(b.matrix=p[v][o],b.matrixAutoUpdate=!1,b.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)b instanceof THREE.Bone?b.skinMatrix=b.animationCache.originalMatrix:b.matrix=b.animationCache.originalMatrix;for(var E=0;E<3;E++){e=c[E];k=n.prevKey[e];m=n.nextKey[e];if(m.time<=u){if(t<u)if(this.loop){k=this.data.hierarchy[v].keys[0];for(m=this.getNextKeyWith(e,v,1);m.time<t;)k=m,m=this.getNextKeyWith(e,v,m.index+1)}else{this.stop();return}else{do k=m,m=this.getNextKeyWith(e,v,m.index+1);while(m.time<
+t)}n.prevKey[e]=k;n.nextKey[e]=m}b.matrixAutoUpdate=!0;b.matrixWorldNeedsUpdate=!0;f=(t-k.time)/(m.time-k.time);g=k[e];j=m[e];if(f<0||f>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+f+" on bone "+v),f=f<0?0:1;if(e==="pos")if(e=b.position,this.interpolationType===THREE.AnimationHandler.LINEAR)e.x=g[0]+(j[0]-g[0])*f,e.y=g[1]+(j[1]-g[1])*f,e.z=g[2]+(j[2]-g[2])*f;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
+this.getPrevKeyWith("pos",v,k.index-1).pos,this.points[1]=g,this.points[2]=j,this.points[3]=this.getNextKeyWith("pos",v,m.index+1).pos,f=f*0.33+0.33,g=this.interpolateCatmullRom(this.points,f),e.x=g[0],e.y=g[1],e.z=g[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)f=this.interpolateCatmullRom(this.points,f*1.01),this.target.set(f[0],f[1],f[2]),this.target.subSelf(e),this.target.y=0,this.target.normalize(),f=Math.atan2(this.target.x,this.target.z),b.rotation.set(0,f,0)}else if(e===
+"rot")THREE.Quaternion.slerp(g,j,b.quaternion,f);else if(e==="scl")e=b.scale,e.x=g[0]+(j[0]-g[0])*f,e.y=g[1]+(j[1]-g[1])*f,e.z=g[2]+(j[2]-g[2])*f}}if(this.JITCompile&&p[0][o]===void 0){this.hierarchy[0].update(void 0,!0);for(v=0;v<this.hierarchy.length;v++)p[v][o]=this.hierarchy[v]instanceof THREE.Bone?this.hierarchy[v].skinMatrix.clone():this.hierarchy[v].matrix.clone()}}};
+THREE.Animation.prototype.interpolateCatmullRom=function(b,c){var e=[],f=[],g,j,k,m,n,o;g=(b.length-1)*c;j=Math.floor(g);g-=j;e[0]=j==0?j:j-1;e[1]=j;e[2]=j>b.length-2?j:j+1;e[3]=j>b.length-3?j:j+2;j=b[e[0]];m=b[e[1]];n=b[e[2]];o=b[e[3]];e=g*g;k=g*e;f[0]=this.interpolate(j[0],m[0],n[0],o[0],g,e,k);f[1]=this.interpolate(j[1],m[1],n[1],o[1],g,e,k);f[2]=this.interpolate(j[2],m[2],n[2],o[2],g,e,k);return f};
+THREE.Animation.prototype.interpolate=function(b,c,e,f,g,j,k){b=(e-b)*0.5;f=(f-c)*0.5;return(2*(c-e)+b+f)*k+(-3*(c-e)-2*b-f)*j+b*g+c};THREE.Animation.prototype.getNextKeyWith=function(b,c,e){var f=this.data.hierarchy[c].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?e=e<f.length-1?e:f.length-1:e%=f.length;e<f.length;e++)if(f[e][b]!==void 0)return f[e];return this.data.hierarchy[c].keys[0]};
 THREE.Animation.prototype.getPrevKeyWith=function(b,c,e){for(var f=this.data.hierarchy[c].keys,e=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?e>0?e:0:e>=0?e:e+f.length;e>=0;e--)if(f[e][b]!==void 0)return f[e];return this.data.hierarchy[c].keys[f.length-1]};
 THREE.QuakeCamera=function(b){function c(b,c){return function(){c.apply(b,arguments)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=3.14;this.domElement=document;this.lastUpdate=(new Date).getTime();this.tdiff=0;if(b){if(b.movementSpeed!==void 0)this.movementSpeed=
 b.movementSpeed;if(b.lookSpeed!==void 0)this.lookSpeed=b.lookSpeed;if(b.noFly!==void 0)this.noFly=b.noFly;if(b.lookVertical!==void 0)this.lookVertical=b.lookVertical;if(b.autoForward!==void 0)this.autoForward=b.autoForward;if(b.activeLook!==void 0)this.activeLook=b.activeLook;if(b.heightSpeed!==void 0)this.heightSpeed=b.heightSpeed;if(b.heightCoef!==void 0)this.heightCoef=b.heightCoef;if(b.heightMin!==void 0)this.heightMin=b.heightMin;if(b.heightMax!==void 0)this.heightMax=b.heightMax;if(b.constrainVertical!==
@@ -385,12 +387,12 @@ this.heightSpeed?this.tdiff*((this.position.y<this.heightMin?this.heightMin:this
 (this.phi-0)*(this.verticalMax-this.verticalMin)/3.14+this.verticalMin;b=this.target.position;g=this.position;b.x=g.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=g.y+100*Math.cos(this.phi);b.z=g.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",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(b,c,e,f){var h={name:e,fps:0.6,length:f,hierarchy:[]},g,k=c.getControlPointsArray(),m=c.getLength(),n=k.length,K=0;g=n-1;c={parent:-1,keys:[]};c.keys[0]={time:0,pos:k[0],rot:[0,0,0,1],scl:[1,1,1]};c.keys[g]={time:f,pos:k[g],rot:[0,0,0,1],scl:[1,1,1]};for(g=1;g<n-1;g++)K=f*m.chunks[g]/m.total,c.keys[g]={time:K,pos:k[g]};h.hierarchy[0]=c;THREE.AnimationHandler.add(h);return new THREE.Animation(b,e,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function e(b,c){var e,
-f,h=new THREE.Geometry;for(e=0;e<b.points.length*c;e++)f=e/(b.points.length*c),f=b.getPoint(f),h.vertices[e]=new THREE.Vertex(new THREE.Vector3(f.x,f.y,f.z));return h}function f(b,c){var f=e(c,10),h=e(c,10),g=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(f,g);particleObj=new THREE.ParticleSystem(h,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);b.addChild(lineObj);particleObj.scale.set(1,1,1);b.addChild(particleObj);h=new THREE.Sphere(1,
-16,8);g=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<c.points.length;i++)f=new THREE.Mesh(h,g),f.position.copy(c.points[i]),f.updateMatrix(),b.addChild(f)}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.lookHorizontal=
+THREE.PathCamera=function(b){function c(b,c,e,f){var g={name:e,fps:0.6,length:f,hierarchy:[]},j,k=c.getControlPointsArray(),m=c.getLength(),n=k.length,H=0;j=n-1;c={parent:-1,keys:[]};c.keys[0]={time:0,pos:k[0],rot:[0,0,0,1],scl:[1,1,1]};c.keys[j]={time:f,pos:k[j],rot:[0,0,0,1],scl:[1,1,1]};for(j=1;j<n-1;j++)H=f*m.chunks[j]/m.total,c.keys[j]={time:H,pos:k[j]};g.hierarchy[0]=c;THREE.AnimationHandler.add(g);return new THREE.Animation(b,e,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function e(b,c){var e,
+f,g=new THREE.Geometry;for(e=0;e<b.points.length*c;e++)f=e/(b.points.length*c),f=b.getPoint(f),g.vertices[e]=new THREE.Vertex(new THREE.Vector3(f.x,f.y,f.z));return g}function f(b,c){var f=e(c,10),g=e(c,10),j=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(f,j);particleObj=new THREE.ParticleSystem(g,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);b.addChild(lineObj);particleObj.scale.set(1,1,1);b.addChild(particleObj);g=new THREE.Sphere(1,
+16,8);j=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<c.points.length;i++)f=new THREE.Mesh(g,j),f.position.copy(c.points[i]),f.updateMatrix(),b.addChild(f)}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.lookHorizontal=
 this.lookVertical=!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!==void 0)this.duration=b.duration*1E3;if(b.waypoints!==void 0)this.waypoints=b.waypoints;if(b.useConstantSpeed!==void 0)this.useConstantSpeed=b.useConstantSpeed;if(b.resamplingCoef!==void 0)this.resamplingCoef=b.resamplingCoef;if(b.createDebugPath!==void 0)this.createDebugPath=b.createDebugPath;if(b.createDebugDummy!==
 void 0)this.createDebugDummy=b.createDebugDummy;if(b.lookSpeed!==void 0)this.lookSpeed=b.lookSpeed;if(b.lookVertical!==void 0)this.lookVertical=b.lookVertical;if(b.lookHorizontal!==void 0)this.lookHorizontal=b.lookHorizontal;if(b.verticalAngleMap!==void 0)this.verticalAngleMap=b.verticalAngleMap;if(b.horizontalAngleMap!==void 0)this.horizontalAngleMap=b.horizontalAngleMap;if(b.domElement!==void 0)this.domElement=b.domElement}this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.windowHalfX=
-window.innerWidth/2;this.windowHalfY=window.innerHeight/2;var g=Math.PI*2,h=Math.PI/180;this.update=function(b,c,e){var f,k;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*h;this.theta=this.lon*h;f=this.phi%g;this.phi=f>=0?f:f+g;f=this.verticalAngleMap.srcRange;k=this.verticalAngleMap.dstRange;var m=k[1]-k[0];this.phi=
+window.innerWidth/2;this.windowHalfY=window.innerHeight/2;var g=Math.PI*2,j=Math.PI/180;this.update=function(b,c,e){var f,k;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*j;this.theta=this.lon*j;f=this.phi%g;this.phi=f>=0?f:f+g;f=this.verticalAngleMap.srcRange;k=this.verticalAngleMap.dstRange;var m=k[1]-k[0];this.phi=
 TWEEN.Easing.Quadratic.EaseInOut(((this.phi-f[0])*(k[1]-k[0])/(f[1]-f[0])+k[0]-k[0])/m)*m+k[0];f=this.horizontalAngleMap.srcRange;k=this.horizontalAngleMap.dstRange;m=k[1]-k[0];this.theta=TWEEN.Easing.Quadratic.EaseInOut(((this.theta-f[0])*(k[1]-k[0])/(f[1]-f[0])+k[0]-k[0])/m)*m+k[0];f=this.target.position;f.x=100*Math.sin(this.phi)*Math.cos(this.theta);f.y=100*Math.cos(this.phi);f.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,b,c,e)};this.onMouseMove=function(b){this.mouseX=
 b.clientX-this.windowHalfX;this.mouseY=b.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var b=new THREE.MeshLambertMaterial({color:30719}),k=new THREE.MeshLambertMaterial({color:65280}),m=new THREE.Cube(10,10,20),n=new THREE.Cube(2,2,10);this.animationParent=new THREE.Mesh(m,b);b=new THREE.Mesh(n,k);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(b,c){return function(){c.apply(b,arguments)}}(this,this.onMouseMove),!1)};
@@ -399,119 +401,120 @@ THREE.FlyCamera=function(b){function c(b,c){return function(){c.apply(b,argument
 b.autoForward;if(b.domElement!==void 0)this.domElement=b.domElement}this.useTarget=!1;this.useQuaternion=!0;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0,0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.lastUpdate=-1;this.tdiff=0;this.handleEvent=function(b){if(typeof this[b.type]=="function")this[b.type](b)};this.keydown=function(b){if(!b.altKey){switch(b.keyCode){case 16:this.movementSpeedMultiplier=
 0.1;break;case 87:this.moveState.forward=1;break;case 83:this.moveState.back=1;break;case 65:this.moveState.left=1;break;case 68:this.moveState.right=1;break;case 82:this.moveState.up=1;break;case 70:this.moveState.down=1;break;case 38:this.moveState.pitchUp=1;break;case 40:this.moveState.pitchDown=1;break;case 37:this.moveState.yawLeft=1;break;case 39:this.moveState.yawRight=1;break;case 81:this.moveState.rollLeft=1;break;case 69:this.moveState.rollRight=1}this.updateMovementVector();this.updateRotationVector()}};
 this.keyup=function(b){switch(b.keyCode){case 16:this.movementSpeedMultiplier=1;break;case 87:this.moveState.forward=0;break;case 83:this.moveState.back=0;break;case 65:this.moveState.left=0;break;case 68:this.moveState.right=0;break;case 82:this.moveState.up=0;break;case 70:this.moveState.down=0;break;case 38:this.moveState.pitchUp=0;break;case 40:this.moveState.pitchDown=0;break;case 37:this.moveState.yawLeft=0;break;case 39:this.moveState.yawRight=0;break;case 81:this.moveState.rollLeft=0;break;
-case 69:this.moveState.rollRight=0}this.updateMovementVector();this.updateRotationVector()};this.mousedown=function(b){b.preventDefault();b.stopPropagation();if(this.dragToLook)this.mouseStatus++;else switch(b.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}};this.mousemove=function(b){if(!this.dragToLook||this.mouseStatus>0){var c=this.getContainerDimensions(),g=c.size[0]/2,h=c.size[1]/2;this.moveState.yawLeft=-(b.clientX-c.offset[0]-g)/g;this.moveState.pitchDown=(b.clientY-
-c.offset[1]-h)/h;this.updateRotationVector()}};this.mouseup=function(b){b.preventDefault();b.stopPropagation();if(this.dragToLook)this.mouseStatus--,this.moveState.yawLeft=this.moveState.pitchDown=0;else switch(b.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.updateRotationVector()};this.update=function(){var b=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=b;this.tdiff=(b-this.lastUpdate)/1E3;this.lastUpdate=b;var b=this.tdiff*this.movementSpeed,c=this.tdiff*
+case 69:this.moveState.rollRight=0}this.updateMovementVector();this.updateRotationVector()};this.mousedown=function(b){b.preventDefault();b.stopPropagation();if(this.dragToLook)this.mouseStatus++;else switch(b.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}};this.mousemove=function(b){if(!this.dragToLook||this.mouseStatus>0){var c=this.getContainerDimensions(),g=c.size[0]/2,j=c.size[1]/2;this.moveState.yawLeft=-(b.clientX-c.offset[0]-g)/g;this.moveState.pitchDown=(b.clientY-
+c.offset[1]-j)/j;this.updateRotationVector()}};this.mouseup=function(b){b.preventDefault();b.stopPropagation();if(this.dragToLook)this.mouseStatus--,this.moveState.yawLeft=this.moveState.pitchDown=0;else switch(b.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.updateRotationVector()};this.update=function(){var b=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=b;this.tdiff=(b-this.lastUpdate)/1E3;this.lastUpdate=b;var b=this.tdiff*this.movementSpeed,c=this.tdiff*
 this.rollSpeed;this.translateX(this.moveVector.x*b);this.translateY(this.moveVector.y*b);this.translateZ(this.moveVector.z*b);this.tmpQuaternion.set(this.rotationVector.x*c,this.rotationVector.y*c,this.rotationVector.z*c,1).normalize();this.quaternion.multiplySelf(this.tmpQuaternion);this.matrix.setPosition(this.position);this.matrix.setRotationFromQuaternion(this.quaternion);this.matrixWorldNeedsUpdate=!0;this.supr.update.call(this)};this.updateMovementVector=function(){var b=this.moveState.forward||
 this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right;this.moveVector.y=-this.moveState.down+this.moveState.up;this.moveVector.z=-b+this.moveState.back};this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp;this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft;this.rotationVector.z=-this.moveState.rollRight+this.moveState.rollLeft};this.getContainerDimensions=function(){return this.domElement!=
 document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}};this.domElement.addEventListener("mousemove",c(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",c(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",c(this,this.mouseup),!1);window.addEventListener("keydown",c(this,this.keydown),!1);window.addEventListener("keyup",c(this,
 this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};THREE.FlyCamera.prototype=new THREE.Camera;THREE.FlyCamera.prototype.constructor=THREE.FlyCamera;THREE.FlyCamera.prototype.supr=THREE.Camera.prototype;
-THREE.RollCamera=function(b,c,e,f){THREE.Camera.call(this,b,c,e,f);this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.domElement=document;this.matrixAutoUpdate=this.useTarget=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;this.lastUpdate=-1;this.delta=0;var g=new THREE.Vector3,h=new THREE.Vector3,k=new THREE.Vector3,m=new THREE.Matrix4,n=!1,o=1,p=0,t=0,v=0,u=0,w=0,E=window.innerWidth/2,H=window.innerHeight/2;this.update=
-function(){var b=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=b;this.delta=(b-this.lastUpdate)/1E3;this.lastUpdate=b;this.mouseLook&&(b=this.delta*this.lookSpeed,this.rotateHorizontally(b*u),this.rotateVertically(b*w));b=this.delta*this.movementSpeed;this.translateZ(b*(p>0||this.autoForward&&!(p<0)?1:p));this.translateX(b*t);this.translateY(b*v);n&&(this.roll+=this.rollSpeed*this.delta*o);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();
-else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();k.copy(this.forward);h.set(0,1,0);g.cross(h,k).normalize();h.cross(k,g).normalize();this.matrix.n11=g.x;this.matrix.n12=h.x;this.matrix.n13=k.x;this.matrix.n21=g.y;this.matrix.n22=h.y;this.matrix.n23=k.y;this.matrix.n31=g.z;this.matrix.n32=h.z;this.matrix.n33=k.z;m.identity();m.n11=Math.cos(this.roll);m.n12=-Math.sin(this.roll);m.n21=Math.sin(this.roll);m.n22=Math.cos(this.roll);this.matrix.multiplySelf(m);
+THREE.RollCamera=function(b,c,e,f){THREE.Camera.call(this,b,c,e,f);this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.domElement=document;this.matrixAutoUpdate=this.useTarget=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;this.lastUpdate=-1;this.delta=0;var g=new THREE.Vector3,j=new THREE.Vector3,k=new THREE.Vector3,m=new THREE.Matrix4,n=!1,o=1,p=0,t=0,u=0,v=0,w=0,E=window.innerWidth/2,I=window.innerHeight/2;this.update=
+function(){var b=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=b;this.delta=(b-this.lastUpdate)/1E3;this.lastUpdate=b;this.mouseLook&&(b=this.delta*this.lookSpeed,this.rotateHorizontally(b*v),this.rotateVertically(b*w));b=this.delta*this.movementSpeed;this.translateZ(b*(p>0||this.autoForward&&!(p<0)?1:p));this.translateX(b*t);this.translateY(b*u);n&&(this.roll+=this.rollSpeed*this.delta*o);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();
+else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();k.copy(this.forward);j.set(0,1,0);g.cross(j,k).normalize();j.cross(k,g).normalize();this.matrix.n11=g.x;this.matrix.n12=j.x;this.matrix.n13=k.x;this.matrix.n21=g.y;this.matrix.n22=j.y;this.matrix.n23=k.y;this.matrix.n31=g.z;this.matrix.n32=j.z;this.matrix.n33=k.z;m.identity();m.n11=Math.cos(this.roll);m.n12=-Math.sin(this.roll);m.n21=Math.sin(this.roll);m.n22=Math.cos(this.roll);this.matrix.multiplySelf(m);
 this.matrixWorldNeedsUpdate=!0;this.matrix.n14=this.position.x;this.matrix.n24=this.position.y;this.matrix.n34=this.position.z;this.supr.update.call(this)};this.translateX=function(b){this.position.x+=this.matrix.n11*b;this.position.y+=this.matrix.n21*b;this.position.z+=this.matrix.n31*b};this.translateY=function(b){this.position.x+=this.matrix.n12*b;this.position.y+=this.matrix.n22*b;this.position.z+=this.matrix.n32*b};this.translateZ=function(b){this.position.x-=this.matrix.n13*b;this.position.y-=
-this.matrix.n23*b;this.position.z-=this.matrix.n33*b};this.rotateHorizontally=function(b){g.set(this.matrix.n11,this.matrix.n21,this.matrix.n31);g.multiplyScalar(b);this.forward.subSelf(g);this.forward.normalize()};this.rotateVertically=function(b){h.set(this.matrix.n12,this.matrix.n22,this.matrix.n32);h.multiplyScalar(b);this.forward.addSelf(h);this.forward.normalize()};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",
-function(b){u=(b.clientX-E)/window.innerWidth;w=(b.clientY-H)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:p=1;break;case 2:p=-1}},!1);this.domElement.addEventListener("mouseup",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:p=0;break;case 2:p=0}},!1);this.domElement.addEventListener("keydown",function(b){switch(b.keyCode){case 38:case 87:p=1;break;case 37:case 65:t=-1;break;
-case 40:case 83:p=-1;break;case 39:case 68:t=1;break;case 81:n=!0;o=1;break;case 69:n=!0;o=-1;break;case 82:v=1;break;case 70:v=-1}},!1);this.domElement.addEventListener("keyup",function(b){switch(b.keyCode){case 38:case 87:p=0;break;case 37:case 65:t=0;break;case 40:case 83:p=0;break;case 39:case 68:t=0;break;case 81:n=!1;break;case 69:n=!1;break;case 82:v=0;break;case 70:v=0}},!1)};THREE.RollCamera.prototype=new THREE.Camera;THREE.RollCamera.prototype.constructor=THREE.RollCamera;
+this.matrix.n23*b;this.position.z-=this.matrix.n33*b};this.rotateHorizontally=function(b){g.set(this.matrix.n11,this.matrix.n21,this.matrix.n31);g.multiplyScalar(b);this.forward.subSelf(g);this.forward.normalize()};this.rotateVertically=function(b){j.set(this.matrix.n12,this.matrix.n22,this.matrix.n32);j.multiplyScalar(b);this.forward.addSelf(j);this.forward.normalize()};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",
+function(b){v=(b.clientX-E)/window.innerWidth;w=(b.clientY-I)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:p=1;break;case 2:p=-1}},!1);this.domElement.addEventListener("mouseup",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:p=0;break;case 2:p=0}},!1);this.domElement.addEventListener("keydown",function(b){switch(b.keyCode){case 38:case 87:p=1;break;case 37:case 65:t=-1;break;
+case 40:case 83:p=-1;break;case 39:case 68:t=1;break;case 81:n=!0;o=1;break;case 69:n=!0;o=-1;break;case 82:u=1;break;case 70:u=-1}},!1);this.domElement.addEventListener("keyup",function(b){switch(b.keyCode){case 38:case 87:p=0;break;case 37:case 65:t=0;break;case 40:case 83:p=0;break;case 39:case 68:t=0;break;case 81:n=!1;break;case 69:n=!1;break;case 82:u=0;break;case 70:u=0}},!1)};THREE.RollCamera.prototype=new THREE.Camera;THREE.RollCamera.prototype.constructor=THREE.RollCamera;
 THREE.RollCamera.prototype.supr=THREE.Camera.prototype;
 THREE.TrackballCamera=function(b){function c(b,c){return function(){c.apply(b,arguments)}}b=b||{};THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.domElement=b.domElement||document;this.screen=b.screen||{width:window.innerWidth,height:window.innerHeight,offsetLeft:0,offsetTop:0};this.radius=b.radius||(this.screen.width+this.screen.height)/4;this.rotateSpeed=b.rotateSpeed||1;this.zoomSpeed=b.zoomSpeed||1.2;this.panSpeed=b.panSpeed||0.3;this.noZoom=b.noZoom||!1;this.noPan=b.noPan||
-!1;this.staticMoving=b.staticMoving||!1;this.dynamicDampingFactor=b.dynamicDampingFactor||0.2;this.minDistance=b.minDistance||0;this.maxDistance=b.maxDistance||Infinity;this.keys=b.keys||[65,83,68];this.useTarget=!0;var e=!1,f=this.STATE.NONE,g=new THREE.Vector3,h=new THREE.Vector3,k=new THREE.Vector3,m=new THREE.Vector2,n=new THREE.Vector2,o=new THREE.Vector2,p=new THREE.Vector2;this.handleEvent=function(b){if(typeof this[b.type]=="function")this[b.type](b)};this.getMouseOnScreen=function(b,c){return new THREE.Vector2((b-
+!1;this.staticMoving=b.staticMoving||!1;this.dynamicDampingFactor=b.dynamicDampingFactor||0.2;this.minDistance=b.minDistance||0;this.maxDistance=b.maxDistance||Infinity;this.keys=b.keys||[65,83,68];this.useTarget=!0;var e=!1,f=this.STATE.NONE,g=new THREE.Vector3,j=new THREE.Vector3,k=new THREE.Vector3,m=new THREE.Vector2,n=new THREE.Vector2,o=new THREE.Vector2,p=new THREE.Vector2;this.handleEvent=function(b){if(typeof this[b.type]=="function")this[b.type](b)};this.getMouseOnScreen=function(b,c){return new THREE.Vector2((b-
 this.screen.offsetLeft)/this.radius*0.5,(c-this.screen.offsetTop)/this.radius*0.5)};this.getMouseProjectionOnBall=function(b,c){var e=new THREE.Vector3((b-this.screen.width*0.5-this.screen.offsetLeft)/this.radius,(this.screen.height*0.5+this.screen.offsetTop-c)/this.radius,0),f=e.length();f>1?e.normalize():e.z=Math.sqrt(1-f*f);g=this.position.clone().subSelf(this.target.position);f=this.up.clone().setLength(e.y);f.addSelf(this.up.clone().crossSelf(g).setLength(e.x));f.addSelf(g.setLength(e.z));return f};
-this.rotateCamera=function(){var b=Math.acos(h.dot(k)/h.length()/k.length());if(b){var c=(new THREE.Vector3).cross(h,k).normalize(),e=new THREE.Quaternion;b*=this.rotateSpeed;e.setFromAxisAngle(c,-b);e.multiplyVector3(g);e.multiplyVector3(this.up);e.multiplyVector3(k);this.staticMoving?h=k:(e.setFromAxisAngle(c,b*(this.dynamicDampingFactor-1)),e.multiplyVector3(h))}};this.zoomCamera=function(){var b=1+(n.y-m.y)*this.zoomSpeed;b!==1&&b>0&&(g.multiplyScalar(b),this.staticMoving?m=n:m.y+=(n.y-m.y)*this.dynamicDampingFactor)};
+this.rotateCamera=function(){var b=Math.acos(j.dot(k)/j.length()/k.length());if(b){var c=(new THREE.Vector3).cross(j,k).normalize(),e=new THREE.Quaternion;b*=this.rotateSpeed;e.setFromAxisAngle(c,-b);e.multiplyVector3(g);e.multiplyVector3(this.up);e.multiplyVector3(k);this.staticMoving?j=k:(e.setFromAxisAngle(c,b*(this.dynamicDampingFactor-1)),e.multiplyVector3(j))}};this.zoomCamera=function(){var b=1+(n.y-m.y)*this.zoomSpeed;b!==1&&b>0&&(g.multiplyScalar(b),this.staticMoving?m=n:m.y+=(n.y-m.y)*this.dynamicDampingFactor)};
 this.panCamera=function(){var b=p.clone().subSelf(o);if(b.lengthSq()){b.multiplyScalar(g.length()*this.panSpeed);var c=g.clone().crossSelf(this.up).setLength(b.x);c.addSelf(this.up.clone().setLength(b.y));this.position.addSelf(c);this.target.position.addSelf(c);this.staticMoving?o=p:o.addSelf(b.sub(p,o).multiplyScalar(this.dynamicDampingFactor))}};this.checkDistances=function(){if(!this.noZoom||!this.noPan)this.position.lengthSq()>this.maxDistance*this.maxDistance&&this.position.setLength(this.maxDistance),
 g.lengthSq()<this.minDistance*this.minDistance&&this.position.add(this.target.position,g.setLength(this.minDistance))};this.update=function(b,c,e){g=this.position.clone().subSelf(this.target.position);this.rotateCamera();this.noZoom||this.zoomCamera();this.noPan||this.panCamera();this.position.add(this.target.position,g);this.checkDistances();this.supr.update.call(this,b,c,e)};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",
-c(this,function(b){e&&(h=k=this.getMouseProjectionOnBall(b.clientX,b.clientY),m=n=this.getMouseOnScreen(b.clientX,b.clientY),o=p=this.getMouseOnScreen(b.clientX,b.clientY),e=!1);f!==this.STATE.NONE&&(f===this.STATE.ROTATE?k=this.getMouseProjectionOnBall(b.clientX,b.clientY):f===this.STATE.ZOOM&&!this.noZoom?n=this.getMouseOnScreen(b.clientX,b.clientY):f===this.STATE.PAN&&!this.noPan&&(p=this.getMouseOnScreen(b.clientX,b.clientY)))}),!1);this.domElement.addEventListener("mousedown",c(this,function(b){b.preventDefault();
-b.stopPropagation();if(f===this.STATE.NONE)f=b.button,f===this.STATE.ROTATE?h=k=this.getMouseProjectionOnBall(b.clientX,b.clientY):f===this.STATE.ZOOM&&!this.noZoom?m=n=this.getMouseOnScreen(b.clientX,b.clientY):this.noPan||(o=p=this.getMouseOnScreen(b.clientX,b.clientY))}),!1);this.domElement.addEventListener("mouseup",c(this,function(b){b.preventDefault();b.stopPropagation();f=this.STATE.NONE}),!1);window.addEventListener("keydown",c(this,function(b){if(f===this.STATE.NONE){if(b.keyCode===this.keys[this.STATE.ROTATE])f=
+c(this,function(b){e&&(j=k=this.getMouseProjectionOnBall(b.clientX,b.clientY),m=n=this.getMouseOnScreen(b.clientX,b.clientY),o=p=this.getMouseOnScreen(b.clientX,b.clientY),e=!1);f!==this.STATE.NONE&&(f===this.STATE.ROTATE?k=this.getMouseProjectionOnBall(b.clientX,b.clientY):f===this.STATE.ZOOM&&!this.noZoom?n=this.getMouseOnScreen(b.clientX,b.clientY):f===this.STATE.PAN&&!this.noPan&&(p=this.getMouseOnScreen(b.clientX,b.clientY)))}),!1);this.domElement.addEventListener("mousedown",c(this,function(b){b.preventDefault();
+b.stopPropagation();if(f===this.STATE.NONE)f=b.button,f===this.STATE.ROTATE?j=k=this.getMouseProjectionOnBall(b.clientX,b.clientY):f===this.STATE.ZOOM&&!this.noZoom?m=n=this.getMouseOnScreen(b.clientX,b.clientY):this.noPan||(o=p=this.getMouseOnScreen(b.clientX,b.clientY))}),!1);this.domElement.addEventListener("mouseup",c(this,function(b){b.preventDefault();b.stopPropagation();f=this.STATE.NONE}),!1);window.addEventListener("keydown",c(this,function(b){if(f===this.STATE.NONE){if(b.keyCode===this.keys[this.STATE.ROTATE])f=
 this.STATE.ROTATE;else if(b.keyCode===this.keys[this.STATE.ZOOM]&&!this.noZoom)f=this.STATE.ZOOM;else if(b.keyCode===this.keys[this.STATE.PAN]&&!this.noPan)f=this.STATE.PAN;f!==this.STATE.NONE&&(e=!0)}}),!1);window.addEventListener("keyup",c(this,function(){if(f!==this.STATE.NONE)f=this.STATE.NONE}),!1)};THREE.TrackballCamera.prototype=new THREE.Camera;THREE.TrackballCamera.prototype.constructor=THREE.TrackballCamera;THREE.TrackballCamera.prototype.supr=THREE.Camera.prototype;
 THREE.TrackballCamera.prototype.STATE={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};
-THREE.Cube=function(b,c,e,f,g,h,k,m,n){function o(b,c,e,k,m,n,o,t){var u,v,w=f||1,E=g||1,j=m/2,X=n/2,O=p.vertices.length;if(b=="x"&&c=="y"||b=="y"&&c=="x")u="z";else if(b=="x"&&c=="z"||b=="z"&&c=="x")u="y",E=h||1;else if(b=="z"&&c=="y"||b=="y"&&c=="z")u="x",w=h||1;var $=w+1,M=E+1;m/=w;var ca=n/E;for(v=0;v<M;v++)for(n=0;n<$;n++){var U=new THREE.Vector3;U[b]=(n*m-j)*e;U[c]=(v*ca-X)*k;U[u]=o;p.vertices.push(new THREE.Vertex(U))}for(v=0;v<E;v++)for(n=0;n<w;n++)p.faces.push(new THREE.Face4(n+$*v+O,n+$*
-(v+1)+O,n+1+$*(v+1)+O,n+1+$*v+O,null,null,t)),p.faceVertexUvs[0].push([new THREE.UV(n/w,v/E),new THREE.UV(n/w,(v+1)/E),new THREE.UV((n+1)/w,(v+1)/E),new THREE.UV((n+1)/w,v/E)])}THREE.Geometry.call(this);var p=this,t=b/2,v=c/2,u=e/2,m=m?-1:1;if(k!==void 0)if(k instanceof Array)this.materials=k;else{this.materials=[];for(var w=0;w<6;w++)this.materials.push([k])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(n!=void 0)for(var E in n)this.sides[E]!=void 0&&(this.sides[E]=n[E]);
-this.sides.px&&o("z","y",1*m,-1,e,c,-t,this.materials[0]);this.sides.nx&&o("z","y",-1*m,-1,e,c,t,this.materials[1]);this.sides.py&&o("x","z",1*m,1,b,e,v,this.materials[2]);this.sides.ny&&o("x","z",1*m,-1,b,e,-v,this.materials[3]);this.sides.pz&&o("x","y",1*m,-1,b,c,u,this.materials[4]);this.sides.nz&&o("x","y",-1*m,-1,b,c,-u,this.materials[5]);(function(){for(var b=[],c=[],e=0,f=p.vertices.length;e<f;e++){for(var h=p.vertices[e],g=!1,k=0,m=b.length;k<m;k++){var n=b[k];if(h.position.x==n.position.x&&
-h.position.y==n.position.y&&h.position.z==n.position.z){c[e]=k;g=!0;break}}if(!g)c[e]=b.length,b.push(new THREE.Vertex(h.position.clone()))}e=0;for(f=p.faces.length;e<f;e++)h=p.faces[e],h.a=c[h.a],h.b=c[h.b],h.c=c[h.c],h.d=c[h.d];p.vertices=b})();this.computeCentroids();this.computeFaceNormals()};THREE.Cube.prototype=new THREE.Geometry;THREE.Cube.prototype.constructor=THREE.Cube;
-THREE.Cylinder=function(b,c,e,f,g,h){function k(b,c,e){m.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,e)))}THREE.Geometry.call(this);var m=this,n,o=Math.PI*2,p=f/2;for(n=0;n<b;n++)k(Math.sin(o*n/b)*c,Math.cos(o*n/b)*c,-p);for(n=0;n<b;n++)k(Math.sin(o*n/b)*e,Math.cos(o*n/b)*e,p);for(n=0;n<b;n++)m.faces.push(new THREE.Face4(n,n+b,b+(n+1)%b,(n+1)%b));if(e>0){k(0,0,-p-(h||0));for(n=b;n<b+b/2;n++)m.faces.push(new THREE.Face4(2*b,(2*n-2*b)%b,(2*n-2*b+1)%b,(2*n-2*b+2)%b))}if(c>0){k(0,0,p+(g||0));
-for(n=b+b/2;n<2*b;n++)m.faces.push(new THREE.Face4(2*b+1,(2*n-2*b+2)%b+b,(2*n-2*b+1)%b+b,(2*n-2*b)%b+b))}n=0;for(b=this.faces.length;n<b;n++){var c=[],e=this.faces[n],g=this.vertices[e.a],h=this.vertices[e.b],p=this.vertices[e.c],t=this.vertices[e.d];c.push(new THREE.UV(0.5+Math.atan2(g.position.x,g.position.y)/o,0.5+g.position.z/f));c.push(new THREE.UV(0.5+Math.atan2(h.position.x,h.position.y)/o,0.5+h.position.z/f));c.push(new THREE.UV(0.5+Math.atan2(p.position.x,p.position.y)/o,0.5+p.position.z/
+THREE.Cube=function(b,c,e,f,g,j,k,m,n){function o(b,c,e,k,m,n,o,t){var u,v,w=f||1,E=g||1,h=m/2,X=n/2,O=p.vertices.length;if(b=="x"&&c=="y"||b=="y"&&c=="x")u="z";else if(b=="x"&&c=="z"||b=="z"&&c=="x")u="y",E=j||1;else if(b=="z"&&c=="y"||b=="y"&&c=="z")u="x",w=j||1;var $=w+1,M=E+1;m/=w;var ca=n/E;for(v=0;v<M;v++)for(n=0;n<$;n++){var U=new THREE.Vector3;U[b]=(n*m-h)*e;U[c]=(v*ca-X)*k;U[u]=o;p.vertices.push(new THREE.Vertex(U))}for(v=0;v<E;v++)for(n=0;n<w;n++)p.faces.push(new THREE.Face4(n+$*v+O,n+$*
+(v+1)+O,n+1+$*(v+1)+O,n+1+$*v+O,null,null,t)),p.faceVertexUvs[0].push([new THREE.UV(n/w,v/E),new THREE.UV(n/w,(v+1)/E),new THREE.UV((n+1)/w,(v+1)/E),new THREE.UV((n+1)/w,v/E)])}THREE.Geometry.call(this);var p=this,t=b/2,u=c/2,v=e/2,m=m?-1:1;if(k!==void 0)if(k instanceof Array)this.materials=k;else{this.materials=[];for(var w=0;w<6;w++)this.materials.push([k])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(n!=void 0)for(var E in n)this.sides[E]!=void 0&&(this.sides[E]=n[E]);
+this.sides.px&&o("z","y",1*m,-1,e,c,-t,this.materials[0]);this.sides.nx&&o("z","y",-1*m,-1,e,c,t,this.materials[1]);this.sides.py&&o("x","z",1*m,1,b,e,u,this.materials[2]);this.sides.ny&&o("x","z",1*m,-1,b,e,-u,this.materials[3]);this.sides.pz&&o("x","y",1*m,-1,b,c,v,this.materials[4]);this.sides.nz&&o("x","y",-1*m,-1,b,c,-v,this.materials[5]);(function(){for(var b=[],c=[],e=0,f=p.vertices.length;e<f;e++){for(var g=p.vertices[e],j=!1,k=0,m=b.length;k<m;k++){var n=b[k];if(g.position.x==n.position.x&&
+g.position.y==n.position.y&&g.position.z==n.position.z){c[e]=k;j=!0;break}}if(!j)c[e]=b.length,b.push(new THREE.Vertex(g.position.clone()))}e=0;for(f=p.faces.length;e<f;e++)g=p.faces[e],g.a=c[g.a],g.b=c[g.b],g.c=c[g.c],g.d=c[g.d];p.vertices=b})();this.computeCentroids();this.computeFaceNormals()};THREE.Cube.prototype=new THREE.Geometry;THREE.Cube.prototype.constructor=THREE.Cube;
+THREE.Cylinder=function(b,c,e,f,g,j){function k(b,c,e){m.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,e)))}THREE.Geometry.call(this);var m=this,n,o=Math.PI*2,p=f/2;for(n=0;n<b;n++)k(Math.sin(o*n/b)*c,Math.cos(o*n/b)*c,-p);for(n=0;n<b;n++)k(Math.sin(o*n/b)*e,Math.cos(o*n/b)*e,p);for(n=0;n<b;n++)m.faces.push(new THREE.Face4(n,n+b,b+(n+1)%b,(n+1)%b));if(e>0){k(0,0,-p-(j||0));for(n=b;n<b+b/2;n++)m.faces.push(new THREE.Face4(2*b,(2*n-2*b)%b,(2*n-2*b+1)%b,(2*n-2*b+2)%b))}if(c>0){k(0,0,p+(g||0));
+for(n=b+b/2;n<2*b;n++)m.faces.push(new THREE.Face4(2*b+1,(2*n-2*b+2)%b+b,(2*n-2*b+1)%b+b,(2*n-2*b)%b+b))}n=0;for(b=this.faces.length;n<b;n++){var c=[],e=this.faces[n],g=this.vertices[e.a],j=this.vertices[e.b],p=this.vertices[e.c],t=this.vertices[e.d];c.push(new THREE.UV(0.5+Math.atan2(g.position.x,g.position.y)/o,0.5+g.position.z/f));c.push(new THREE.UV(0.5+Math.atan2(j.position.x,j.position.y)/o,0.5+j.position.z/f));c.push(new THREE.UV(0.5+Math.atan2(p.position.x,p.position.y)/o,0.5+p.position.z/
 f));e instanceof THREE.Face4&&c.push(new THREE.UV(0.5+Math.atan2(t.position.x,t.position.y)/o,0.5+t.position.z/f));this.faceVertexUvs[0].push(c)}this.computeCentroids();this.computeFaceNormals()};THREE.Cylinder.prototype=new THREE.Geometry;THREE.Cylinder.prototype.constructor=THREE.Cylinder;
-THREE.Icosahedron=function(b){function c(b,c,e){var f=Math.sqrt(b*b+c*c+e*e);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(b/f,c/f,e/f)))-1}function e(b,c,e,f){f.faces.push(new THREE.Face3(b,c,e))}function f(b,e){var f=g.vertices[b].position,h=g.vertices[e].position;return c((f.x+h.x)/2,(f.y+h.y)/2,(f.z+h.z)/2)}var g=this,h=new THREE.Geometry,k;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,
-1,-b);c(b,0,-1);c(b,0,1);c(-b,0,-1);c(-b,0,1);e(0,11,5,h);e(0,5,1,h);e(0,1,7,h);e(0,7,10,h);e(0,10,11,h);e(1,5,9,h);e(5,11,4,h);e(11,10,2,h);e(10,7,6,h);e(7,1,8,h);e(3,9,4,h);e(3,4,2,h);e(3,2,6,h);e(3,6,8,h);e(3,8,9,h);e(4,9,5,h);e(2,4,11,h);e(6,2,10,h);e(8,6,7,h);e(9,8,1,h);for(b=0;b<this.subdivisions;b++){k=new THREE.Geometry;for(var m in h.faces){var n=f(h.faces[m].a,h.faces[m].b),o=f(h.faces[m].b,h.faces[m].c),p=f(h.faces[m].c,h.faces[m].a);e(h.faces[m].a,n,p,k);e(h.faces[m].b,o,n,k);e(h.faces[m].c,
-p,o,k);e(n,o,p,k)}h.faces=k.faces}g.faces=h.faces;delete h;delete k;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.Icosahedron.prototype=new THREE.Geometry;THREE.Icosahedron.prototype.constructor=THREE.Icosahedron;
-THREE.Lathe=function(b,c,e){THREE.Geometry.call(this);this.steps=c||12;this.angle=e||2*Math.PI;for(var c=this.angle/this.steps,e=[],f=[],g=[],h=[],k=(new THREE.Matrix4).setRotationZ(c),m=0;m<b.length;m++)this.vertices.push(new THREE.Vertex(b[m])),e[m]=b[m].clone(),f[m]=this.vertices.length-1;for(var n=0;n<=this.angle+0.0010;n+=c){for(m=0;m<e.length;m++)n<this.angle?(e[m]=k.multiplyVector3(e[m].clone()),this.vertices.push(new THREE.Vertex(e[m])),g[m]=this.vertices.length-1):g=h;n==0&&(h=f);for(m=0;m<
+THREE.Icosahedron=function(b){function c(b,c,e){var f=Math.sqrt(b*b+c*c+e*e);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(b/f,c/f,e/f)))-1}function e(b,c,e,f){f.faces.push(new THREE.Face3(b,c,e))}function f(b,e){var f=g.vertices[b].position,j=g.vertices[e].position;return c((f.x+j.x)/2,(f.y+j.y)/2,(f.z+j.z)/2)}var g=this,j=new THREE.Geometry,k;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,
+1,-b);c(b,0,-1);c(b,0,1);c(-b,0,-1);c(-b,0,1);e(0,11,5,j);e(0,5,1,j);e(0,1,7,j);e(0,7,10,j);e(0,10,11,j);e(1,5,9,j);e(5,11,4,j);e(11,10,2,j);e(10,7,6,j);e(7,1,8,j);e(3,9,4,j);e(3,4,2,j);e(3,2,6,j);e(3,6,8,j);e(3,8,9,j);e(4,9,5,j);e(2,4,11,j);e(6,2,10,j);e(8,6,7,j);e(9,8,1,j);for(b=0;b<this.subdivisions;b++){k=new THREE.Geometry;for(var m in j.faces){var n=f(j.faces[m].a,j.faces[m].b),o=f(j.faces[m].b,j.faces[m].c),p=f(j.faces[m].c,j.faces[m].a);e(j.faces[m].a,n,p,k);e(j.faces[m].b,o,n,k);e(j.faces[m].c,
+p,o,k);e(n,o,p,k)}j.faces=k.faces}g.faces=j.faces;delete j;delete k;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.Icosahedron.prototype=new THREE.Geometry;THREE.Icosahedron.prototype.constructor=THREE.Icosahedron;
+THREE.Lathe=function(b,c,e){THREE.Geometry.call(this);this.steps=c||12;this.angle=e||2*Math.PI;for(var c=this.angle/this.steps,e=[],f=[],g=[],j=[],k=(new THREE.Matrix4).setRotationZ(c),m=0;m<b.length;m++)this.vertices.push(new THREE.Vertex(b[m])),e[m]=b[m].clone(),f[m]=this.vertices.length-1;for(var n=0;n<=this.angle+0.0010;n+=c){for(m=0;m<e.length;m++)n<this.angle?(e[m]=k.multiplyVector3(e[m].clone()),this.vertices.push(new THREE.Vertex(e[m])),g[m]=this.vertices.length-1):g=j;n==0&&(j=f);for(m=0;m<
 f.length-1;m++)this.faces.push(new THREE.Face4(g[m],g[m+1],f[m+1],f[m])),this.faceVertexUvs[0].push([new THREE.UV(1-n/this.angle,m/b.length),new THREE.UV(1-n/this.angle,(m+1)/b.length),new THREE.UV(1-(n-c)/this.angle,(m+1)/b.length),new THREE.UV(1-(n-c)/this.angle,m/b.length)]);f=g;g=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.Lathe.prototype=new THREE.Geometry;THREE.Lathe.prototype.constructor=THREE.Lathe;
-THREE.Plane=function(b,c,e,f){THREE.Geometry.call(this);var g,h=b/2,k=c/2,e=e||1,f=f||1,m=e+1,n=f+1;b/=e;var o=c/f;for(g=0;g<n;g++)for(c=0;c<m;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*b-h,-(g*o-k),0)));for(g=0;g<f;g++)for(c=0;c<e;c++)this.faces.push(new THREE.Face4(c+m*g,c+m*(g+1),c+1+m*(g+1),c+1+m*g)),this.faceVertexUvs[0].push([new THREE.UV(c/e,g/f),new THREE.UV(c/e,(g+1)/f),new THREE.UV((c+1)/e,(g+1)/f),new THREE.UV((c+1)/e,g/f)]);this.computeCentroids();this.computeFaceNormals()};
+THREE.Plane=function(b,c,e,f){THREE.Geometry.call(this);var g,j=b/2,k=c/2,e=e||1,f=f||1,m=e+1,n=f+1;b/=e;var o=c/f;for(g=0;g<n;g++)for(c=0;c<m;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*b-j,-(g*o-k),0)));for(g=0;g<f;g++)for(c=0;c<e;c++)this.faces.push(new THREE.Face4(c+m*g,c+m*(g+1),c+1+m*(g+1),c+1+m*g)),this.faceVertexUvs[0].push([new THREE.UV(c/e,g/f),new THREE.UV(c/e,(g+1)/f),new THREE.UV((c+1)/e,(g+1)/f),new THREE.UV((c+1)/e,g/f)]);this.computeCentroids();this.computeFaceNormals()};
 THREE.Plane.prototype=new THREE.Geometry;THREE.Plane.prototype.constructor=THREE.Plane;
-THREE.Sphere=function(b,c,e){THREE.Geometry.call(this);for(var f,g=Math.PI,h=Math.max(3,c||8),k=Math.max(2,e||6),c=[],e=0;e<k+1;e++){f=e/k;var m=b*Math.cos(f*g),n=b*Math.sin(f*g),o=[],p=0;for(f=0;f<h;f++){var t=2*f/h,v=n*Math.sin(t*g),t=n*Math.cos(t*g);(e==0||e==k)&&f>0||(p=this.vertices.push(new THREE.Vertex(new THREE.Vector3(t,m,v)))-1);o.push(p)}c.push(o)}for(var u,w,E,g=c.length,e=0;e<g;e++)if(h=c[e].length,e>0)for(f=0;f<h;f++){o=f==h-1;k=c[e][o?0:f+1];m=c[e][o?h-1:f];n=c[e-1][o?h-1:f];o=c[e-
-1][o?0:f+1];v=e/(g-1);u=(e-1)/(g-1);w=(f+1)/h;var t=f/h,p=new THREE.UV(1-w,v),v=new THREE.UV(1-t,v),t=new THREE.UV(1-t,u),H=new THREE.UV(1-w,u);e<c.length-1&&(u=this.vertices[k].position.clone(),w=this.vertices[m].position.clone(),E=this.vertices[n].position.clone(),u.normalize(),w.normalize(),E.normalize(),this.faces.push(new THREE.Face3(k,m,n,[new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(E.x,E.y,E.z)])),this.faceVertexUvs[0].push([p,v,t]));e>1&&(u=this.vertices[k].position.clone(),
-w=this.vertices[n].position.clone(),E=this.vertices[o].position.clone(),u.normalize(),w.normalize(),E.normalize(),this.faces.push(new THREE.Face3(k,n,o,[new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(E.x,E.y,E.z)])),this.faceVertexUvs[0].push([p,t,H]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:b}};THREE.Sphere.prototype=new THREE.Geometry;THREE.Sphere.prototype.constructor=THREE.Sphere;
+THREE.Sphere=function(b,c,e){THREE.Geometry.call(this);for(var f,g=Math.PI,j=Math.max(3,c||8),k=Math.max(2,e||6),c=[],e=0;e<k+1;e++){f=e/k;var m=b*Math.cos(f*g),n=b*Math.sin(f*g),o=[],p=0;for(f=0;f<j;f++){var t=2*f/j,u=n*Math.sin(t*g),t=n*Math.cos(t*g);(e==0||e==k)&&f>0||(p=this.vertices.push(new THREE.Vertex(new THREE.Vector3(t,m,u)))-1);o.push(p)}c.push(o)}for(var v,w,E,g=c.length,e=0;e<g;e++)if(j=c[e].length,e>0)for(f=0;f<j;f++){o=f==j-1;k=c[e][o?0:f+1];m=c[e][o?j-1:f];n=c[e-1][o?j-1:f];o=c[e-
+1][o?0:f+1];u=e/(g-1);v=(e-1)/(g-1);w=(f+1)/j;var t=f/j,p=new THREE.UV(1-w,u),u=new THREE.UV(1-t,u),t=new THREE.UV(1-t,v),I=new THREE.UV(1-w,v);e<c.length-1&&(v=this.vertices[k].position.clone(),w=this.vertices[m].position.clone(),E=this.vertices[n].position.clone(),v.normalize(),w.normalize(),E.normalize(),this.faces.push(new THREE.Face3(k,m,n,[new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(E.x,E.y,E.z)])),this.faceVertexUvs[0].push([p,u,t]));e>1&&(v=this.vertices[k].position.clone(),
+w=this.vertices[n].position.clone(),E=this.vertices[o].position.clone(),v.normalize(),w.normalize(),E.normalize(),this.faces.push(new THREE.Face3(k,n,o,[new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(E.x,E.y,E.z)])),this.faceVertexUvs[0].push([p,t,I]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:b}};THREE.Sphere.prototype=new THREE.Geometry;THREE.Sphere.prototype.constructor=THREE.Sphere;
 THREE.Torus=function(b,c,e,f){THREE.Geometry.call(this);this.radius=b||100;this.tube=c||40;this.segmentsR=e||8;this.segmentsT=f||6;b=[];for(c=0;c<=this.segmentsR;++c)for(e=0;e<=this.segmentsT;++e){var f=e/this.segmentsT*2*Math.PI,g=c/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(g))*Math.cos(f),(this.radius+this.tube*Math.cos(g))*Math.sin(f),this.tube*Math.sin(g))));b.push([e/this.segmentsT,1-c/this.segmentsR])}for(c=1;c<=this.segmentsR;++c)for(e=
-1;e<=this.segmentsT;++e){var f=(this.segmentsT+1)*c+e,g=(this.segmentsT+1)*c+e-1,h=(this.segmentsT+1)*(c-1)+e-1,k=(this.segmentsT+1)*(c-1)+e;this.faces.push(new THREE.Face4(f,g,h,k));this.faceVertexUvs[0].push([new THREE.UV(b[f][0],b[f][1]),new THREE.UV(b[g][0],b[g][1]),new THREE.UV(b[h][0],b[h][1]),new THREE.UV(b[k][0],b[k][1])])}delete b;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.Torus.prototype=new THREE.Geometry;THREE.Torus.prototype.constructor=THREE.Torus;
-THREE.TorusKnot=function(b,c,e,f,g,h,k){function m(b,c,e,f,h,g){c=e/f*b;e=Math.cos(c);return new THREE.Vector3(h*(2+e)*0.5*Math.cos(b),h*(2+e)*Math.sin(b)*0.5,g*h*Math.sin(c)*0.5)}THREE.Geometry.call(this);this.radius=b||200;this.tube=c||40;this.segmentsR=e||64;this.segmentsT=f||8;this.p=g||2;this.q=h||3;this.heightScale=k||1;this.grid=Array(this.segmentsR);e=new THREE.Vector3;f=new THREE.Vector3;h=new THREE.Vector3;for(b=0;b<this.segmentsR;++b){this.grid[b]=Array(this.segmentsT);for(c=0;c<this.segmentsT;++c){var n=
-b/this.segmentsR*2*this.p*Math.PI,k=c/this.segmentsT*2*Math.PI,g=m(n,k,this.q,this.p,this.radius,this.heightScale),n=m(n+0.01,k,this.q,this.p,this.radius,this.heightScale);e.x=n.x-g.x;e.y=n.y-g.y;e.z=n.z-g.z;f.x=n.x+g.x;f.y=n.y+g.y;f.z=n.z+g.z;h.cross(e,f);f.cross(h,e);h.normalize();f.normalize();n=-this.tube*Math.cos(k);k=this.tube*Math.sin(k);g.x+=n*f.x+k*h.x;g.y+=n*f.y+k*h.y;g.z+=n*f.z+k*h.z;this.grid[b][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(g.x,g.y,g.z)))-1}}for(b=0;b<this.segmentsR;++b)for(c=
-0;c<this.segmentsT;++c){var f=(b+1)%this.segmentsR,h=(c+1)%this.segmentsT,g=this.grid[b][c],e=this.grid[f][c],f=this.grid[f][h],h=this.grid[b][h],k=new THREE.UV(b/this.segmentsR,c/this.segmentsT),n=new THREE.UV((b+1)/this.segmentsR,c/this.segmentsT),o=new THREE.UV((b+1)/this.segmentsR,(c+1)/this.segmentsT),p=new THREE.UV(b/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(g,e,f,h));this.faceVertexUvs[0].push([k,n,o,p])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};
+1;e<=this.segmentsT;++e){var f=(this.segmentsT+1)*c+e,g=(this.segmentsT+1)*c+e-1,j=(this.segmentsT+1)*(c-1)+e-1,k=(this.segmentsT+1)*(c-1)+e;this.faces.push(new THREE.Face4(f,g,j,k));this.faceVertexUvs[0].push([new THREE.UV(b[f][0],b[f][1]),new THREE.UV(b[g][0],b[g][1]),new THREE.UV(b[j][0],b[j][1]),new THREE.UV(b[k][0],b[k][1])])}delete b;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.Torus.prototype=new THREE.Geometry;THREE.Torus.prototype.constructor=THREE.Torus;
+THREE.TorusKnot=function(b,c,e,f,g,j,k){function m(b,c,e,f,g,j){c=e/f*b;e=Math.cos(c);return new THREE.Vector3(g*(2+e)*0.5*Math.cos(b),g*(2+e)*Math.sin(b)*0.5,j*g*Math.sin(c)*0.5)}THREE.Geometry.call(this);this.radius=b||200;this.tube=c||40;this.segmentsR=e||64;this.segmentsT=f||8;this.p=g||2;this.q=j||3;this.heightScale=k||1;this.grid=Array(this.segmentsR);e=new THREE.Vector3;f=new THREE.Vector3;j=new THREE.Vector3;for(b=0;b<this.segmentsR;++b){this.grid[b]=Array(this.segmentsT);for(c=0;c<this.segmentsT;++c){var n=
+b/this.segmentsR*2*this.p*Math.PI,k=c/this.segmentsT*2*Math.PI,g=m(n,k,this.q,this.p,this.radius,this.heightScale),n=m(n+0.01,k,this.q,this.p,this.radius,this.heightScale);e.x=n.x-g.x;e.y=n.y-g.y;e.z=n.z-g.z;f.x=n.x+g.x;f.y=n.y+g.y;f.z=n.z+g.z;j.cross(e,f);f.cross(j,e);j.normalize();f.normalize();n=-this.tube*Math.cos(k);k=this.tube*Math.sin(k);g.x+=n*f.x+k*j.x;g.y+=n*f.y+k*j.y;g.z+=n*f.z+k*j.z;this.grid[b][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(g.x,g.y,g.z)))-1}}for(b=0;b<this.segmentsR;++b)for(c=
+0;c<this.segmentsT;++c){var f=(b+1)%this.segmentsR,j=(c+1)%this.segmentsT,g=this.grid[b][c],e=this.grid[f][c],f=this.grid[f][j],j=this.grid[b][j],k=new THREE.UV(b/this.segmentsR,c/this.segmentsT),n=new THREE.UV((b+1)/this.segmentsR,c/this.segmentsT),o=new THREE.UV((b+1)/this.segmentsR,(c+1)/this.segmentsT),p=new THREE.UV(b/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(g,e,f,j));this.faceVertexUvs[0].push([k,n,o,p])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};
 THREE.TorusKnot.prototype=new THREE.Geometry;THREE.TorusKnot.prototype.constructor=THREE.TorusKnot;THREE.Text=function(b,c){THREE.Geometry.call(this);this.parameters=c||{};this.set(b)};THREE.Text.prototype=new THREE.Geometry;THREE.Text.prototype.constructor=THREE.Text;
-THREE.Text.prototype.set=function(b,c){this.text=b;var c=c||this.parameters,e=c.height!==void 0?c.height:50,f=c.curveSegments!==void 0?c.curveSegments:4,g=c.font!==void 0?c.font:"helvetiker";THREE.FontUtils.size=c.size!==void 0?c.size:100;THREE.FontUtils.divisions=f;THREE.FontUtils.face=g;f=THREE.FontUtils.drawText(b);vertices=f.points;faces=f.faces;contour=f.contour;this.vertices=[];this.faces=[];var f=0,h;for(h in vertices)g=vertices[h],this.vertices.push(new THREE.Vertex(new THREE.Vector3(g.x,
-g.y,0))),f++;for(h in vertices)g=vertices[h],this.vertices.push(new THREE.Vertex(new THREE.Vector3(g.x,g.y,e)));for(h in faces)e=faces[h],this.faces.push(new THREE.Face3(e[2],e[1],e[0]));for(h in faces)e=faces[h],this.faces.push(new THREE.Face3(e[0]+f,e[1]+f,e[2]+f));h=contour.length;for(var k;--h>0;){if(k){if(k.equals(contour[h])){k=null;continue}}else k=contour[h];for(e=0;e<vertices.length;e++)if(vertices[e].equals(contour[h]))break;for(g=0;g<vertices.length;g++)if(vertices[g].equals(contour[h-
+THREE.Text.prototype.set=function(b,c){this.text=b;var c=c||this.parameters,e=c.height!==void 0?c.height:50,f=c.curveSegments!==void 0?c.curveSegments:4,g=c.font!==void 0?c.font:"helvetiker";THREE.FontUtils.size=c.size!==void 0?c.size:100;THREE.FontUtils.divisions=f;THREE.FontUtils.face=g;f=THREE.FontUtils.drawText(b);vertices=f.points;faces=f.faces;contour=f.contour;this.vertices=[];this.faces=[];var f=0,j;for(j in vertices)g=vertices[j],this.vertices.push(new THREE.Vertex(new THREE.Vector3(g.x,
+g.y,0))),f++;for(j in vertices)g=vertices[j],this.vertices.push(new THREE.Vertex(new THREE.Vector3(g.x,g.y,e)));for(j in faces)e=faces[j],this.faces.push(new THREE.Face3(e[2],e[1],e[0]));for(j in faces)e=faces[j],this.faces.push(new THREE.Face3(e[0]+f,e[1]+f,e[2]+f));j=contour.length;for(var k;--j>0;){if(k){if(k.equals(contour[j])){k=null;continue}}else k=contour[j];for(e=0;e<vertices.length;e++)if(vertices[e].equals(contour[j]))break;for(g=0;g<vertices.length;g++)if(vertices[g].equals(contour[j-
 1]))break;this.faces.push(new THREE.Face4(e,g,g+f,e+f))}this.computeCentroids();this.computeFaceNormals()};
-THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},loadFace:function(b){var c=b.familyName.toLowerCase();this.faces[c]=this.faces[c]||{};this.faces[c][b.cssFontWeight]=this.faces[c][b.cssFontWeight]||{};this.faces[c][b.cssFontWeight][b.cssFontStyle]=b;return this.faces[c][b.cssFontWeight][b.cssFontStyle]=b},extractPoints:function(b){if(b.length<3)throw"not valid polygon";var c=[],
-e,f,g=[],h;for(h in b)e=b[h],c.push(e.x+","+e.y);e=c[0];e=c.slice(1).indexOf(e);e<c.length&&(e++,f=b.slice(0,e));for(holes=[];e<c.length;){firstIndex=e+1;e=c[firstIndex];e=c.slice(firstIndex+1).indexOf(e)+firstIndex;if(e<=firstIndex)break;var k=b.slice(firstIndex,e+1);this.Triangulate.area(k)<0?(g.push({shape:f,holes:holes}),f=k,holes=[]):holes.push(k);e++}g.push({shape:f,holes:holes});var c=[],m;for(m in g){e=g[m];f=e.shape;holes=e.holes;for(var n in holes){var b=holes[n],k=Number.POSITIVE_INFINITY,
-o,p,t;for(t in b){var v=b[t];for(h in f)d=v.distanceTo(f[h]),d<k&&(k=d,o=t,p=h)}prevShapeVert=p-1>=0?p-1:f.length-1;nextShapeVert=p+1<f.length?p+1:0;prevHoleVert=o-1>=0?o-1:b.length-1;nextHoleVert=o+1<b.length?o+1:0;var k=f.slice(0,p),v=f.slice(p),u=b.slice(o),w=b.slice(0,o);c.push(b[o]);c.push(f[p]);c.push(f[prevShapeVert]);c.push(b[o]);c.push(b[prevHoleVert]);c.push(f[p]);f=k.concat(u).concat(w).concat(v)}e.shape=f}b=[];h=[];o=0;for(m in g){e=g[m];f=e.shape;b=b.concat(f);p=THREE.FontUtils.Triangulate(f,
-!0);for(var E in p)n=p[E],n[0]+=o,n[1]+=o,n[2]+=o;h=h.concat(p);o+=f.length}for(E=0;E<c.length/3;E++){n=[];for(g=0;g<3;g++){m=!1;for(f=0;f<b.length&&!m;f++){var H=E*3+g;b[f].equals(c[H])&&(n.push(f),m=!0)}m||(b.push(c[H]),n.push(b.length-1))}h.push(n)}return{points:b,faces:h}},drawText:function(b){pts=[];for(var c=this.getFace(),e=this.size/c.resolution,f=0,g=String(b).split(""),h=g.length,b=0;b<h;b++)f+=this.extractGlyphPoints(g[b],c,e,f);width=f/2;for(var k in pts)pts[k].x-=width;c=this.extractPoints(pts);
-c.contour=pts;return c},b2p0:function(b,c){return(1-b)*(1-b)*c},b2p1:function(b,c){return 2*(1-b)*b*c},b2p2:function(b,c){return b*b*c},b2:function(b,c,e,f){return this.b2p0(b,c)+this.b2p1(b,e)+this.b2p2(b,f)},b3p0:function(b,c){var e=1-b;return e*e*e*c},b3p1:function(b,c){var e=1-b;return 3*e*e*b*c},b3p2:function(b,c){return 3*(1-b)*b*b*c},b3p3:function(b,c){return b*b*b*c},b3:function(b,c,e,f,g){return this.b3p0(b,c)+this.b3p1(b,e)+this.b3p2(b,f)+this.b3p3(b,g)},extractGlyphPoints:function(b,c,
-e,f){var g,h,k,m=c.glyphs[b]||c.glyphs[ctxt.options.fallbackCharacter];if(m){if(m.o){c=m._cachedOutline||(m._cachedOutline=m.o.split(" "));k=c.length;for(b=0;b<k;)switch(g=c[b++],g){case "m":x=c[b++]*e+f;y=c[b++]*e;pts.push(new THREE.Vector2(x,y));break;case "l":x=c[b++]*e+f;y=c[b++]*e;pts.push(new THREE.Vector2(x,y));break;case "q":g=c[b++]*e+f;h=c[b++]*e;cpx1=c[b++]*e+f;cpy1=c[b++]*e;var n=pts[pts.length-1];if(n){cpx0=n.x;cpy0=n.y;for(var n=1,o=this.divisions;n<=o;n++){var p=n/o,t=THREE.FontUtils.b2(p,
-cpx0,cpx1,g),p=THREE.FontUtils.b2(p,cpy0,cpy1,h);pts.push(new THREE.Vector2(t,p))}}break;case "b":if(g=c[b++]*e+f,h=c[b++]*e,cpx1=c[b++]*e+f,cpy1=c[b++]*-e,cpx2=c[b++]*e+f,cpy2=c[b++]*-e,n=pts[pts.length-1]){cpx0=n.x;cpy0=n.y;n=1;for(o=this.divisions;n<=o;n++)p=n/o,t=THREE.FontUtils.b3(p,cpx0,cpx1,cpx2,g),p=THREE.FontUtils.b3(p,cpy0,cpy1,cpy2,h),pts.push(new THREE.Vector2(t,p))}}}return m.ha*e}}};
-(function(b){var c=function(b){for(var c=b.length,g=0,h=c-1,k=0;k<c;h=k++)g+=b[h].x*b[k].y-b[k].x*b[h].y;return g*0.5};b.Triangulate=function(b,f){var g=[],h=b.length;if(h<3)return null;var k=[],m=[],n;if(0<c(b))for(n=0;n<h;n++)k[n]=n;else for(n=0;n<h;n++)k[n]=h-1-n;var o=2*h,p;p=0;for(n=h-1;h>2;){if(0>=o--)throw"Warning, unable to triangulate polygon!";var t=n;h<=t&&(t=0);n=t+1;h<=n&&(n=0);var v=n+1;h<=v&&(v=0);var u;a:{u=b;var w=t,E=n,H=v,B=h,K=k,A=void 0,I=void 0,G=void 0,C=void 0,R=void 0,D=void 0,
-N=void 0,J=void 0,V=void 0,I=u[K[w]].x,G=u[K[w]].y,C=u[K[E]].x,R=u[K[E]].y,D=u[K[H]].x,N=u[K[H]].y;if(1.0E-10>(C-I)*(N-G)-(R-G)*(D-I))u=!1;else{for(A=0;A<B;A++)if(!(A==w||A==E||A==H)){var J=u[K[A]].x,V=u[K[A]].y,j=void 0,X=void 0,O=void 0,$=void 0,M=void 0,ca=void 0,U=void 0,S=void 0,ja=void 0,W=void 0,fa=void 0,Y=void 0,j=O=M=void 0,j=D-C,X=N-R,O=I-D,$=G-N,M=C-I,ca=R-G,U=J-I,S=V-G,ja=J-C,W=V-R,fa=J-D,Y=V-N,j=j*W-X*ja,M=M*S-ca*U,O=O*Y-$*fa;if(j>=0&&O>=0&&M>=0){u=!1;break a}}u=!0}}if(u){o=k[t];u=k[n];
-w=k[v];g.push(b[o]);g.push(b[u]);g.push(b[w]);m.push([k[t],k[n],k[v]]);p++;t=n;for(v=n+1;v<h;t++,v++)k[t]=k[v];h--;o=2*h}}if(f)return m;return g};b.Triangulate.area=c;return b})(THREE.FontUtils);window._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};THREE.Loader=function(b){this.statusDomElement=(this.showStatus=b)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
+THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},loadFace:function(b){var c=b.familyName.toLowerCase();this.faces[c]=this.faces[c]||{};this.faces[c][b.cssFontWeight]=this.faces[c][b.cssFontWeight]||{};this.faces[c][b.cssFontWeight][b.cssFontStyle]=b;return this.faces[c][b.cssFontWeight][b.cssFontStyle]=b},extractPoints:function(b,c){if(b.length<3)throw"not valid polygon";var e,
+f,g,j=[],k;for(k in c){b=c[k];e=[];for(var m in b)f=b[m],e.push(f.x+","+f.y);var n;n=e.slice(1).indexOf(e[0]);var o=this.Triangulate.area(b.slice(0,n+1))<0;f=[];for(n=-1;n<e.length;){firstIndex=n+1;n=e[firstIndex];n=e.slice(firstIndex+1).indexOf(n)+firstIndex;if(n<=firstIndex)break;var p=b.slice(firstIndex,n+1);o?this.Triangulate.area(p)<0?(firstIndex>0&&j.push({shape:g,holes:f}),g=p,f=[]):f.push(p):this.Triangulate.area(p)<0?(j.push({shape:p,holes:f}),f=[]):f.push(p);n++}o&&j.push({shape:g,holes:f})}e=
+[];for(var t in j){k=j[t];g=k.shape;f=k.holes;for(var u in f){o=f[u];n=Number.POSITIVE_INFINITY;var v,w,E;for(E in o)for(m in p=o[E],g)d=p.distanceTo(g[m]),d<n&&(n=d,v=E,w=m);prevShapeVert=w-1>=0?w-1:g.length-1;nextShapeVert=w+1<g.length?w+1:0;prevHoleVert=v-1>=0?v-1:o.length-1;nextHoleVert=v+1<o.length?v+1:0;n=g.slice(0,w);var p=g.slice(w),I=o.slice(v),B=o.slice(0,v);e.push(o[v]);e.push(g[w]);e.push(g[prevShapeVert]);e.push(o[v]);e.push(o[prevHoleVert]);e.push(g[w]);g=n.concat(I).concat(B).concat(p)}k.shape=
+g}b=[];m=[];v=0;for(t in j){k=j[t];g=k.shape;b=b.concat(g);w=THREE.FontUtils.Triangulate(g,!0);for(var H in w)u=w[H],u[0]+=v,u[1]+=v,u[2]+=v;m=m.concat(w);v+=g.length}for(H=0;H<e.length/3;H++){u=[];for(j=0;j<3;j++){t=!1;for(g=0;g<b.length&&!t;g++){var A=H*3+j;b[g].equals(e[A])&&(u.push(g),t=!0)}t||(b.push(e[A]),u.push(b.length-1))}m.push(u)}return{points:b,faces:m}},drawText:function(b){for(var c=[],e=[],f=this.getFace(),g=this.size/f.resolution,j=0,k=String(b).split(""),m=k.length,b=0;b<m;b++)ret=
+this.extractGlyphPoints(k[b],f,g,j),j+=ret.offset,c.push(ret.points),e=e.concat(ret.points);width=j/2;for(var n in e)e[n].x-=width;c=this.extractPoints(e,c);c.contour=e;return c},b2p0:function(b,c){return(1-b)*(1-b)*c},b2p1:function(b,c){return 2*(1-b)*b*c},b2p2:function(b,c){return b*b*c},b2:function(b,c,e,f){return this.b2p0(b,c)+this.b2p1(b,e)+this.b2p2(b,f)},b3p0:function(b,c){var e=1-b;return e*e*e*c},b3p1:function(b,c){var e=1-b;return 3*e*e*b*c},b3p2:function(b,c){return 3*(1-b)*b*b*c},b3p3:function(b,
+c){return b*b*b*c},b3:function(b,c,e,f,g){return this.b3p0(b,c)+this.b3p1(b,e)+this.b3p2(b,f)+this.b3p3(b,g)},extractGlyphPoints:function(b,c,e,f){var g,j,k,m=c.glyphs[b]||c.glyphs[ctxt.options.fallbackCharacter],n=[];if(m){if(m.o){c=m._cachedOutline||(m._cachedOutline=m.o.split(" "));k=c.length;for(b=0;b<k;)switch(g=c[b++],g){case "m":x=c[b++]*e+f;y=c[b++]*e;n.push(new THREE.Vector2(x,y));break;case "l":x=c[b++]*e+f;y=c[b++]*e;n.push(new THREE.Vector2(x,y));break;case "q":g=c[b++]*e+f;j=c[b++]*e;
+cpx1=c[b++]*e+f;cpy1=c[b++]*e;var o=n[n.length-1];if(o){cpx0=o.x;cpy0=o.y;for(var o=1,p=this.divisions;o<=p;o++){var t=o/p,u=THREE.FontUtils.b2(t,cpx0,cpx1,g),t=THREE.FontUtils.b2(t,cpy0,cpy1,j);n.push(new THREE.Vector2(u,t))}}break;case "b":if(g=c[b++]*e+f,j=c[b++]*e,cpx1=c[b++]*e+f,cpy1=c[b++]*-e,cpx2=c[b++]*e+f,cpy2=c[b++]*-e,o=n[n.length-1]){cpx0=o.x;cpy0=o.y;o=1;for(p=this.divisions;o<=p;o++)t=o/p,u=THREE.FontUtils.b3(t,cpx0,cpx1,cpx2,g),t=THREE.FontUtils.b3(t,cpy0,cpy1,cpy2,j),n.push(new THREE.Vector2(u,
+t))}}}return{offset:m.ha*e,points:n}}}};
+(function(b){var c=function(b){for(var c=b.length,g=0,j=c-1,k=0;k<c;j=k++)g+=b[j].x*b[k].y-b[k].x*b[j].y;return g*0.5};b.Triangulate=function(b,f){var g=[],j=b.length;if(j<3)return null;var k=[],m=[],n;if(0<c(b))for(n=0;n<j;n++)k[n]=n;else for(n=0;n<j;n++)k[n]=j-1-n;var o=2*j,p;p=0;for(n=j-1;j>2;){if(0>=o--)throw"Warning, unable to triangulate polygon!";var t=n;j<=t&&(t=0);n=t+1;j<=n&&(n=0);var u=n+1;j<=u&&(u=0);var v;a:{v=b;var w=t,E=n,I=u,B=j,H=k,A=void 0,K=void 0,G=void 0,C=void 0,R=void 0,D=void 0,
+N=void 0,J=void 0,V=void 0,K=v[H[w]].x,G=v[H[w]].y,C=v[H[E]].x,R=v[H[E]].y,D=v[H[I]].x,N=v[H[I]].y;if(1.0E-10>(C-K)*(N-G)-(R-G)*(D-K))v=!1;else{for(A=0;A<B;A++)if(!(A==w||A==E||A==I)){var J=v[H[A]].x,V=v[H[A]].y,h=void 0,X=void 0,O=void 0,$=void 0,M=void 0,ca=void 0,U=void 0,S=void 0,ja=void 0,W=void 0,fa=void 0,Y=void 0,h=O=M=void 0,h=D-C,X=N-R,O=K-D,$=G-N,M=C-K,ca=R-G,U=J-K,S=V-G,ja=J-C,W=V-R,fa=J-D,Y=V-N,h=h*W-X*ja,M=M*S-ca*U,O=O*Y-$*fa;if(h>=0&&O>=0&&M>=0){v=!1;break a}}v=!0}}if(v){o=k[t];v=k[n];
+w=k[u];g.push(b[o]);g.push(b[v]);g.push(b[w]);m.push([k[t],k[n],k[u]]);p++;t=n;for(u=n+1;u<j;t++,u++)k[t]=k[u];j--;o=2*j}}if(f)return m;return g};b.Triangulate.area=c;return b})(THREE.FontUtils);window._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};THREE.Loader=function(b){this.statusDomElement=(this.showStatus=b)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
 THREE.Loader.prototype={addStatusElement:function(){var b=document.createElement("div");b.style.position="absolute";b.style.right="0px";b.style.top="0px";b.style.fontSize="0.8em";b.style.textAlign="left";b.style.background="rgba(0,0,0,0.25)";b.style.color="#fff";b.style.width="120px";b.style.padding="0.5em 0.5em 0.5em 0.5em";b.style.zIndex=1E3;b.innerHTML="Loading ...";return b},updateProgress:function(b){var c="Loaded ";c+=b.total?(100*b.loaded/b.total).toFixed(0)+"%":(b.loaded/1E3).toFixed(2)+" KB";
 this.statusDomElement.innerHTML=c},extractUrlbase:function(b){b=b.split("/");b.pop();return b.join("/")},init_materials:function(b,c,e){b.materials=[];for(var f=0;f<c.length;++f)b.materials[f]=[THREE.Loader.prototype.createMaterial(c[f],e)]},createMaterial:function(b,c){function e(b){b=Math.log(b)/Math.LN2;return Math.floor(b)==b}function f(b,c){var f=new Image;f.onload=function(){if(!e(this.width)||!e(this.height)){var c=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),f=Math.pow(2,Math.round(Math.log(this.height)/
-Math.LN2));b.image.width=c;b.image.height=f;b.image.getContext("2d").drawImage(this,0,0,c,f)}else b.image=this;b.needsUpdate=!0};f.src=c}var g,h,k;g="MeshLambertMaterial";h={color:15658734,opacity:1,map:null,lightMap:null,wireframe:b.wireframe};b.shading&&(b.shading=="Phong"?g="MeshPhongMaterial":b.shading=="Basic"&&(g="MeshBasicMaterial"));if(b.blending)if(b.blending=="Additive")h.blending=THREE.AdditiveBlending;else if(b.blending=="Subtractive")h.blending=THREE.SubtractiveBlending;else if(b.blending==
-"Multiply")h.blending=THREE.MultiplyBlending;if(b.transparent!==void 0||b.opacity<1)h.transparent=b.transparent;if(b.depthTest!==void 0)h.depthTest=b.depthTest;if(b.vertexColors!==void 0)if(b.vertexColors=="face")h.vertexColors=THREE.FaceColors;else if(b.vertexColors)h.vertexColors=THREE.VertexColors;if(b.mapDiffuse&&c)k=document.createElement("canvas"),h.map=new THREE.Texture(k),h.map.sourceFile=b.mapDiffuse,f(h.map,c+"/"+b.mapDiffuse);else if(b.colorDiffuse)k=(b.colorDiffuse[0]*255<<16)+(b.colorDiffuse[1]*
-255<<8)+b.colorDiffuse[2]*255,h.color=k,h.opacity=b.transparency;else if(b.DbgColor)h.color=b.DbgColor;if(b.mapLightmap&&c)k=document.createElement("canvas"),h.lightMap=new THREE.Texture(k),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;
+Math.LN2));b.image.width=c;b.image.height=f;b.image.getContext("2d").drawImage(this,0,0,c,f)}else b.image=this;b.needsUpdate=!0};f.src=c}var g,j,k;g="MeshLambertMaterial";j={color:15658734,opacity:1,map:null,lightMap:null,wireframe:b.wireframe};b.shading&&(b.shading=="Phong"?g="MeshPhongMaterial":b.shading=="Basic"&&(g="MeshBasicMaterial"));if(b.blending)if(b.blending=="Additive")j.blending=THREE.AdditiveBlending;else if(b.blending=="Subtractive")j.blending=THREE.SubtractiveBlending;else if(b.blending==
+"Multiply")j.blending=THREE.MultiplyBlending;if(b.transparent!==void 0||b.opacity<1)j.transparent=b.transparent;if(b.depthTest!==void 0)j.depthTest=b.depthTest;if(b.vertexColors!==void 0)if(b.vertexColors=="face")j.vertexColors=THREE.FaceColors;else if(b.vertexColors)j.vertexColors=THREE.VertexColors;if(b.mapDiffuse&&c)k=document.createElement("canvas"),j.map=new THREE.Texture(k),j.map.sourceFile=b.mapDiffuse,f(j.map,c+"/"+b.mapDiffuse);else if(b.colorDiffuse)k=(b.colorDiffuse[0]*255<<16)+(b.colorDiffuse[1]*
+255<<8)+b.colorDiffuse[2]*255,j.color=k,j.opacity=b.transparency;else if(b.DbgColor)j.color=b.DbgColor;if(b.mapLightmap&&c)k=document.createElement("canvas"),j.lightMap=new THREE.Texture(k),j.lightMap.sourceFile=b.mapLightmap,f(j.lightMap,c+"/"+b.mapLightmap);return new THREE[g](j)}};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,e=b.model,f=b.callback,g=b.texture_path?b.texture_path:this.extractUrlbase(e),b=new Worker(e);b.onmessage=function(b){c.createModel(b.data,f,g);c.onLoadComplete()};this.onLoadStart();b.postMessage((new Date).getTime())};
-THREE.JSONLoader.prototype.createModel=function(b,c,e){var f=new THREE.Geometry,g=b.scale!==void 0?1/b.scale:1;this.init_materials(f,b.materials,e);(function(c){if(b.version===void 0||b.version!=2)console.error("Deprecated file format.");else{var e,g,n,o,p,t,v,u,w,E,H,B,K,A,I=b.faces;t=b.vertices;var G=b.normals,C=b.colors,R=0;for(e=0;e<b.uvs.length;e++)b.uvs[e].length&&R++;for(e=0;e<R;e++)f.faceUvs[e]=[],f.faceVertexUvs[e]=[];o=0;for(p=t.length;o<p;)v=new THREE.Vertex,v.position.x=t[o++]*c,v.position.y=
-t[o++]*c,v.position.z=t[o++]*c,f.vertices.push(v);o=0;for(p=I.length;o<p;){c=I[o++];t=c&1;n=c&2;e=c&4;g=c&8;u=c&16;v=c&32;E=c&64;c&=128;t?(H=new THREE.Face4,H.a=I[o++],H.b=I[o++],H.c=I[o++],H.d=I[o++],t=4):(H=new THREE.Face3,H.a=I[o++],H.b=I[o++],H.c=I[o++],t=3);if(n)n=I[o++],H.materials=f.materials[n];n=f.faces.length;if(e)for(e=0;e<R;e++)B=b.uvs[e],w=I[o++],A=B[w*2],w=B[w*2+1],f.faceUvs[e][n]=new THREE.UV(A,w);if(g)for(e=0;e<R;e++){B=b.uvs[e];K=[];for(g=0;g<t;g++)w=I[o++],A=B[w*2],w=B[w*2+1],K[g]=
-new THREE.UV(A,w);f.faceVertexUvs[e][n]=K}if(u)u=I[o++]*3,g=new THREE.Vector3,g.x=G[u++],g.y=G[u++],g.z=G[u],H.normal=g;if(v)for(e=0;e<t;e++)u=I[o++]*3,g=new THREE.Vector3,g.x=G[u++],g.y=G[u++],g.z=G[u],H.vertexNormals.push(g);if(E)v=I[o++],v=new THREE.Color(C[v]),H.color=v;if(c)for(e=0;e<t;e++)v=I[o++],v=new THREE.Color(C[v]),H.vertexColors.push(v);f.faces.push(H)}}})(g);(function(){var c,e,g,n;if(b.skinWeights){c=0;for(e=b.skinWeights.length;c<e;c+=2)g=b.skinWeights[c],n=b.skinWeights[c+1],f.skinWeights.push(new THREE.Vector4(g,
-n,0,0))}if(b.skinIndices){c=0;for(e=b.skinIndices.length;c<e;c+=2)g=b.skinIndices[c],n=b.skinIndices[c+1],f.skinIndices.push(new THREE.Vector4(g,n,0,0))}f.bones=b.bones;f.animation=b.animation})();(function(c){if(b.morphTargets!==void 0){var e,g,n,o,p,t,v,u,w;e=0;for(g=b.morphTargets.length;e<g;e++){f.morphTargets[e]={};f.morphTargets[e].name=b.morphTargets[e].name;f.morphTargets[e].vertices=[];u=f.morphTargets[e].vertices;w=b.morphTargets[e].vertices;n=0;for(o=w.length;n<o;n+=3)p=w[n]*c,t=w[n+1]*
-c,v=w[n+2]*c,u.push(new THREE.Vertex(new THREE.Vector3(p,t,v)))}}if(b.morphColors!==void 0){e=0;for(g=b.morphColors.length;e<g;e++){f.morphColors[e]={};f.morphColors[e].name=b.morphColors[e].name;f.morphColors[e].colors=[];o=f.morphColors[e].colors;p=b.morphColors[e].colors;c=0;for(n=p.length;c<n;c+=3)t=new THREE.Color(16755200),t.setRGB(p[c],p[c+1],p[c+2]),o.push(t)}}})(g);(function(){if(b.edges!==void 0){var c,e,g;for(c=0;c<b.edges.length;c+=2)e=b.edges[c],g=b.edges[c+1],f.edges.push(new THREE.Edge(f.vertices[e],
+THREE.JSONLoader.prototype.createModel=function(b,c,e){var f=new THREE.Geometry,g=b.scale!==void 0?1/b.scale:1;this.init_materials(f,b.materials,e);(function(c){if(b.version===void 0||b.version!=2)console.error("Deprecated file format.");else{var e,g,n,o,p,t,u,v,w,E,I,B,H,A,K=b.faces;t=b.vertices;var G=b.normals,C=b.colors,R=0;for(e=0;e<b.uvs.length;e++)b.uvs[e].length&&R++;for(e=0;e<R;e++)f.faceUvs[e]=[],f.faceVertexUvs[e]=[];o=0;for(p=t.length;o<p;)u=new THREE.Vertex,u.position.x=t[o++]*c,u.position.y=
+t[o++]*c,u.position.z=t[o++]*c,f.vertices.push(u);o=0;for(p=K.length;o<p;){c=K[o++];t=c&1;n=c&2;e=c&4;g=c&8;v=c&16;u=c&32;E=c&64;c&=128;t?(I=new THREE.Face4,I.a=K[o++],I.b=K[o++],I.c=K[o++],I.d=K[o++],t=4):(I=new THREE.Face3,I.a=K[o++],I.b=K[o++],I.c=K[o++],t=3);if(n)n=K[o++],I.materials=f.materials[n];n=f.faces.length;if(e)for(e=0;e<R;e++)B=b.uvs[e],w=K[o++],A=B[w*2],w=B[w*2+1],f.faceUvs[e][n]=new THREE.UV(A,w);if(g)for(e=0;e<R;e++){B=b.uvs[e];H=[];for(g=0;g<t;g++)w=K[o++],A=B[w*2],w=B[w*2+1],H[g]=
+new THREE.UV(A,w);f.faceVertexUvs[e][n]=H}if(v)v=K[o++]*3,g=new THREE.Vector3,g.x=G[v++],g.y=G[v++],g.z=G[v],I.normal=g;if(u)for(e=0;e<t;e++)v=K[o++]*3,g=new THREE.Vector3,g.x=G[v++],g.y=G[v++],g.z=G[v],I.vertexNormals.push(g);if(E)u=K[o++],u=new THREE.Color(C[u]),I.color=u;if(c)for(e=0;e<t;e++)u=K[o++],u=new THREE.Color(C[u]),I.vertexColors.push(u);f.faces.push(I)}}})(g);(function(){var c,e,g,n;if(b.skinWeights){c=0;for(e=b.skinWeights.length;c<e;c+=2)g=b.skinWeights[c],n=b.skinWeights[c+1],f.skinWeights.push(new THREE.Vector4(g,
+n,0,0))}if(b.skinIndices){c=0;for(e=b.skinIndices.length;c<e;c+=2)g=b.skinIndices[c],n=b.skinIndices[c+1],f.skinIndices.push(new THREE.Vector4(g,n,0,0))}f.bones=b.bones;f.animation=b.animation})();(function(c){if(b.morphTargets!==void 0){var e,g,n,o,p,t,u,v,w;e=0;for(g=b.morphTargets.length;e<g;e++){f.morphTargets[e]={};f.morphTargets[e].name=b.morphTargets[e].name;f.morphTargets[e].vertices=[];v=f.morphTargets[e].vertices;w=b.morphTargets[e].vertices;n=0;for(o=w.length;n<o;n+=3)p=w[n]*c,t=w[n+1]*
+c,u=w[n+2]*c,v.push(new THREE.Vertex(new THREE.Vector3(p,t,u)))}}if(b.morphColors!==void 0){e=0;for(g=b.morphColors.length;e<g;e++){f.morphColors[e]={};f.morphColors[e].name=b.morphColors[e].name;f.morphColors[e].colors=[];o=f.morphColors[e].colors;p=b.morphColors[e].colors;c=0;for(n=p.length;c<n;c+=3)t=new THREE.Color(16755200),t.setRGB(p[c],p[c+1],p[c+2]),o.push(t)}}})(g);(function(){if(b.edges!==void 0){var c,e,g;for(c=0;c<b.edges.length;c+=2)e=b.edges[c],g=b.edges[c+1],f.edges.push(new THREE.Edge(f.vertices[e],
 f.vertices[g],e,g))}})();f.computeCentroids();f.computeFaceNormals();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,e=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),h=this.showProgress?THREE.Loader.prototype.updateProgress:null;c.onmessage=function(b){THREE.BinaryLoader.prototype.loadAjaxBuffers(b.data.buffers,b.data.materials,e,g,f,h)};c.onerror=function(b){alert("worker.onerror: "+b.message+"\n"+b.data);b.preventDefault()};
-c.postMessage(b)},loadAjaxBuffers:function(b,c,e,f,g,h){var k=new XMLHttpRequest,m=f+"/"+b,n=0;k.onreadystatechange=function(){k.readyState==4?k.status==200||k.status==0?THREE.BinaryLoader.prototype.createBinModel(k.responseText,e,g,c):alert("Couldn't load ["+m+"] ["+k.status+"]"):k.readyState==3?h&&(n==0&&(n=k.getResponseHeader("Content-Length")),h({total:n,loaded:k.responseText.length})):k.readyState==2&&(n=k.getResponseHeader("Content-Length"))};k.open("GET",m,!0);k.overrideMimeType("text/plain; charset=x-user-defined");
+THREE.BinaryLoader.prototype={load:function(b){var c=b.model,e=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),j=this.showProgress?THREE.Loader.prototype.updateProgress:null;c.onmessage=function(b){THREE.BinaryLoader.prototype.loadAjaxBuffers(b.data.buffers,b.data.materials,e,g,f,j)};c.onerror=function(b){alert("worker.onerror: "+b.message+"\n"+b.data);b.preventDefault()};
+c.postMessage(b)},loadAjaxBuffers:function(b,c,e,f,g,j){var k=new XMLHttpRequest,m=f+"/"+b,n=0;k.onreadystatechange=function(){k.readyState==4?k.status==200||k.status==0?THREE.BinaryLoader.prototype.createBinModel(k.responseText,e,g,c):alert("Couldn't load ["+m+"] ["+k.status+"]"):k.readyState==3?j&&(n==0&&(n=k.getResponseHeader("Content-Length")),j({total:n,loaded:k.responseText.length})):k.readyState==2&&(n=k.getResponseHeader("Content-Length"))};k.open("GET",m,!0);k.overrideMimeType("text/plain; charset=x-user-defined");
 k.setRequestHeader("Content-Type","text/plain");k.send(null)},createBinModel:function(b,c,e,f){var g=function(c){function e(b,c){var f=p(b,c),g=p(b,c+1),h=p(b,c+2),j=p(b,c+3),k=(j<<1&255|h>>7)-127;f|=(h&127)<<16|g<<8;if(f==0&&k==-127)return 0;return(1-2*(j>>7))*(1+f*Math.pow(2,-23))*Math.pow(2,k)}function g(b,c){var e=p(b,c),f=p(b,c+1),h=p(b,c+2);return(p(b,c+3)<<24)+(h<<16)+(f<<8)+e}function n(b,c){var e=p(b,c);return(p(b,c+1)<<8)+e}function o(b,c){var e=p(b,c);return e>127?e-256:e}function p(b,
-c){return b.charCodeAt(c)&255}function t(c){var e,f,h;e=g(b,c);f=g(b,c+C);h=g(b,c+R);c=n(b,c+D);THREE.BinaryLoader.prototype.f3(B,e,f,h,c)}function v(c){var e,f,h,j,k,p;e=g(b,c);f=g(b,c+C);h=g(b,c+R);j=n(b,c+D);k=g(b,c+N);p=g(b,c+J);c=g(b,c+V);THREE.BinaryLoader.prototype.f3n(B,I,e,f,h,j,k,p,c)}function u(c){var e,f,h,k;e=g(b,c);f=g(b,c+j);h=g(b,c+X);k=g(b,c+O);c=n(b,c+$);THREE.BinaryLoader.prototype.f4(B,e,f,h,k,c)}function w(c){var e,f,h,k,p,o,t,u;e=g(b,c);f=g(b,c+j);h=g(b,c+X);k=g(b,c+O);p=n(b,
-c+$);o=g(b,c+M);t=g(b,c+ca);u=g(b,c+U);c=g(b,c+S);THREE.BinaryLoader.prototype.f4n(B,I,e,f,h,k,p,o,t,u,c)}function E(c){var e,f;e=g(b,c);f=g(b,c+ja);c=g(b,c+W);THREE.BinaryLoader.prototype.uv3(B.faceVertexUvs[0],G[e*2],G[e*2+1],G[f*2],G[f*2+1],G[c*2],G[c*2+1])}function H(c){var e,f,h;e=g(b,c);f=g(b,c+fa);h=g(b,c+Y);c=g(b,c+ga);THREE.BinaryLoader.prototype.uv4(B.faceVertexUvs[0],G[e*2],G[e*2+1],G[f*2],G[f*2+1],G[h*2],G[h*2+1],G[c*2],G[c*2+1])}var B=this,K=0,A,I=[],G=[],C,R,D,N,J,V,j,X,O,$,M,ca,U,S,
-ja,W,fa,Y,ga,ea,Q,T,Z,ka,na;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(B,f,c);A={signature:b.substr(K,8),header_bytes:p(b,K+8),vertex_coordinate_bytes:p(b,K+9),normal_coordinate_bytes:p(b,K+10),uv_coordinate_bytes:p(b,K+11),vertex_index_bytes:p(b,K+12),normal_index_bytes:p(b,K+13),uv_index_bytes:p(b,K+14),material_index_bytes:p(b,K+15),nvertices:g(b,K+16),nnormals:g(b,K+16+4),nuvs:g(b,K+16+8),ntri_flat:g(b,K+16+12),ntri_smooth:g(b,K+16+16),ntri_flat_uv:g(b,K+16+20),ntri_smooth_uv:g(b,
-K+16+24),nquad_flat:g(b,K+16+28),nquad_smooth:g(b,K+16+32),nquad_flat_uv:g(b,K+16+36),nquad_smooth_uv:g(b,K+16+40)};K+=A.header_bytes;C=A.vertex_index_bytes;R=A.vertex_index_bytes*2;D=A.vertex_index_bytes*3;N=A.vertex_index_bytes*3+A.material_index_bytes;J=A.vertex_index_bytes*3+A.material_index_bytes+A.normal_index_bytes;V=A.vertex_index_bytes*3+A.material_index_bytes+A.normal_index_bytes*2;j=A.vertex_index_bytes;X=A.vertex_index_bytes*2;O=A.vertex_index_bytes*3;$=A.vertex_index_bytes*4;M=A.vertex_index_bytes*
-4+A.material_index_bytes;ca=A.vertex_index_bytes*4+A.material_index_bytes+A.normal_index_bytes;U=A.vertex_index_bytes*4+A.material_index_bytes+A.normal_index_bytes*2;S=A.vertex_index_bytes*4+A.material_index_bytes+A.normal_index_bytes*3;ja=A.uv_index_bytes;W=A.uv_index_bytes*2;fa=A.uv_index_bytes;Y=A.uv_index_bytes*2;ga=A.uv_index_bytes*3;c=A.vertex_index_bytes*3+A.material_index_bytes;na=A.vertex_index_bytes*4+A.material_index_bytes;ea=A.ntri_flat*c;Q=A.ntri_smooth*(c+A.normal_index_bytes*3);T=A.ntri_flat_uv*
-(c+A.uv_index_bytes*3);Z=A.ntri_smooth_uv*(c+A.normal_index_bytes*3+A.uv_index_bytes*3);ka=A.nquad_flat*na;c=A.nquad_smooth*(na+A.normal_index_bytes*4);na=A.nquad_flat_uv*(na+A.uv_index_bytes*4);K+=function(c){for(var f,h,g,j=A.vertex_coordinate_bytes*3,m=c+A.nvertices*j;c<m;c+=j)f=e(b,c),h=e(b,c+A.vertex_coordinate_bytes),g=e(b,c+A.vertex_coordinate_bytes*2),THREE.BinaryLoader.prototype.v(B,f,h,g);return A.nvertices*j}(K);K+=function(c){for(var e,f,h,g=A.normal_coordinate_bytes*3,j=c+A.nnormals*
-g;c<j;c+=g)e=o(b,c),f=o(b,c+A.normal_coordinate_bytes),h=o(b,c+A.normal_coordinate_bytes*2),I.push(e/127,f/127,h/127);return A.nnormals*g}(K);K+=function(c){for(var f,h,g=A.uv_coordinate_bytes*2,j=c+A.nuvs*g;c<j;c+=g)f=e(b,c),h=e(b,c+A.uv_coordinate_bytes),G.push(f,h);return A.nuvs*g}(K);ea=K+ea;Q=ea+Q;T=Q+T;Z=T+Z;ka=Z+ka;c=ka+c;na=c+na;(function(b){var c,e=A.vertex_index_bytes*3+A.material_index_bytes,f=e+A.uv_index_bytes*3,h=b+A.ntri_flat_uv*f;for(c=b;c<h;c+=f)t(c),E(c+e);return h-b})(Q);(function(b){var c,
-e=A.vertex_index_bytes*3+A.material_index_bytes+A.normal_index_bytes*3,f=e+A.uv_index_bytes*3,h=b+A.ntri_smooth_uv*f;for(c=b;c<h;c+=f)v(c),E(c+e);return h-b})(T);(function(b){var c,e=A.vertex_index_bytes*4+A.material_index_bytes,f=e+A.uv_index_bytes*4,h=b+A.nquad_flat_uv*f;for(c=b;c<h;c+=f)u(c),H(c+e);return h-b})(c);(function(b){var c,e=A.vertex_index_bytes*4+A.material_index_bytes+A.normal_index_bytes*4,f=e+A.uv_index_bytes*4,h=b+A.nquad_smooth_uv*f;for(c=b;c<h;c+=f)w(c),H(c+e);return h-b})(na);
-(function(b){var c,e=A.vertex_index_bytes*3+A.material_index_bytes,f=b+A.ntri_flat*e;for(c=b;c<f;c+=e)t(c);return f-b})(K);(function(b){var c,e=A.vertex_index_bytes*3+A.material_index_bytes+A.normal_index_bytes*3,f=b+A.ntri_smooth*e;for(c=b;c<f;c+=e)v(c);return f-b})(ea);(function(b){var c,e=A.vertex_index_bytes*4+A.material_index_bytes,f=b+A.nquad_flat*e;for(c=b;c<f;c+=e)u(c);return f-b})(Z);(function(b){var c,e=A.vertex_index_bytes*4+A.material_index_bytes+A.normal_index_bytes*4,f=b+A.nquad_smooth*
-e;for(c=b;c<f;c+=e)w(c);return f-b})(ka);this.computeCentroids();this.computeFaceNormals()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;c(new g(e))},v:function(b,c,e,f){b.vertices.push(new THREE.Vertex(new THREE.Vector3(c,e,f)))},f3:function(b,c,e,f,g){b.faces.push(new THREE.Face3(c,e,f,null,null,b.materials[g]))},f4:function(b,c,e,f,g,h){b.faces.push(new THREE.Face4(c,e,f,g,null,null,b.materials[h]))},f3n:function(b,c,e,f,g,h,k,m,n){var h=b.materials[h],o=c[m*3],p=c[m*3+1],m=c[m*3+2],
-t=c[n*3],v=c[n*3+1],n=c[n*3+2];b.faces.push(new THREE.Face3(e,f,g,[new THREE.Vector3(c[k*3],c[k*3+1],c[k*3+2]),new THREE.Vector3(o,p,m),new THREE.Vector3(t,v,n)],null,h))},f4n:function(b,c,e,f,g,h,k,m,n,o,p){var k=b.materials[k],t=c[n*3],v=c[n*3+1],n=c[n*3+2],u=c[o*3],w=c[o*3+1],o=c[o*3+2],E=c[p*3],H=c[p*3+1],p=c[p*3+2];b.faces.push(new THREE.Face4(e,f,g,h,[new THREE.Vector3(c[m*3],c[m*3+1],c[m*3+2]),new THREE.Vector3(t,v,n),new THREE.Vector3(u,w,o),new THREE.Vector3(E,H,p)],null,k))},uv3:function(b,
-c,e,f,g,h,k){var m=[];m.push(new THREE.UV(c,e));m.push(new THREE.UV(f,g));m.push(new THREE.UV(h,k));b.push(m)},uv4:function(b,c,e,f,g,h,k,m,n){var o=[];o.push(new THREE.UV(c,e));o.push(new THREE.UV(f,g));o.push(new THREE.UV(h,k));o.push(new THREE.UV(m,n));b.push(o)}};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
-THREE.SceneLoader.prototype={load:function(b,c){var e=this,f=new Worker(b);f.postMessage(0);var g=THREE.Loader.prototype.extractUrlbase(b);f.onmessage=function(b){function f(b,c){return c=="relativeToHTML"?b:g+"/"+b}function m(){for(u in J.objects)if(!M.objects[u])if(K=J.objects[u],K.geometry!==void 0){if(C=M.geometries[K.geometry]){N=[];for(S=0;S<K.materials.length;S++)N[S]=M.materials[K.materials[S]];A=K.position;r=K.rotation;q=K.quaternion;s=K.scale;q=0;N.length==0&&(N[0]=new THREE.MeshFaceMaterial);
-N.length>1&&(N=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(C,N);object.name=u;object.position.set(A[0],A[1],A[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=K.visible;M.scene.addObject(object);M.objects[u]=object;if(K.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(object);M.scene.collisions.colliders.push(b)}if(K.castsShadow)b=new THREE.ShadowVolume(C),M.scene.addChild(b),
-b.position=object.position,b.rotation=object.rotation,b.scale=object.scale;K.trigger&&K.trigger.toLowerCase()!="none"&&(b={type:K.trigger,object:K},M.triggers[object.name]=b)}}else A=K.position,r=K.rotation,q=K.quaternion,s=K.scale,q=0,object=new THREE.Object3D,object.name=u,object.position.set(A[0],A[1],A[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],s[1],s[2]),object.visible=K.visible!==void 0?K.visible:!1,M.scene.addObject(object),
-M.objects[u]=object,M.empties[u]=object,K.trigger&&K.trigger.toLowerCase()!="none"&&(b={type:K.trigger,object:K},M.triggers[object.name]=b)}function n(b){return function(c){M.geometries[b]=c;m();j-=1;e.onLoadComplete();p()}}function o(b){return function(c){M.geometries[b]=c}}function p(){e.callbackProgress({totalModels:O,totalTextures:$,loadedModels:O-j,loadedTextures:$-X},M);e.onLoadProgress();j==0&&X==0&&c(M)}var t,v,u,w,E,H,B,K,A,I,G,C,R,D,N,J,V,j,X,O,$,M;J=b.data;b=new THREE.BinaryLoader;V=new THREE.JSONLoader;
-X=j=0;M={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};var ca=!1;for(u in J.objects)if(K=J.objects[u],K.meshCollider){ca=!0;break}if(ca)M.scene.collisions=new THREE.CollisionSystem;if(J.transform){ca=J.transform.position;I=J.transform.rotation;var U=J.transform.scale;ca&&M.scene.position.set(ca[0],ca[1],ca[2]);I&&M.scene.rotation.set(I[0],I[1],I[2]);U&&M.scene.scale.set(U[0],U[1],U[2]);(ca||I||U)&&M.scene.updateMatrix()}ca=
-function(){X-=1;p();e.onLoadComplete()};for(E in J.cameras){I=J.cameras[E];if(I.type=="perspective")R=new THREE.Camera(I.fov,I.aspect,I.near,I.far);else if(I.type=="ortho")R=new THREE.Camera,R.projectionMatrix=THREE.Matrix4.makeOrtho(I.left,I.right,I.top,I.bottom,I.near,I.far);A=I.position;I=I.target;R.position.set(A[0],A[1],A[2]);R.target.position.set(I[0],I[1],I[2]);M.cameras[E]=R}for(w in J.lights){E=J.lights[w];R=E.color!==void 0?E.color:16777215;I=E.intensity!==void 0?E.intensity:1;if(E.type==
-"directional")A=E.direction,light=new THREE.DirectionalLight(R,I),light.position.set(A[0],A[1],A[2]),light.position.normalize();else if(E.type=="point")A=E.position,light=new THREE.PointLight(R,I),light.position.set(A[0],A[1],A[2]);M.scene.addLight(light);M.lights[w]=light}for(H in J.fogs)w=J.fogs[H],w.type=="linear"?D=new THREE.Fog(0,w.near,w.far):w.type=="exp2"&&(D=new THREE.FogExp2(0,w.density)),I=w.color,D.color.setRGB(I[0],I[1],I[2]),M.fogs[H]=D;if(M.cameras&&J.defaults.camera)M.currentCamera=
-M.cameras[J.defaults.camera];if(M.fogs&&J.defaults.fog)M.scene.fog=M.fogs[J.defaults.fog];I=J.defaults.bgcolor;M.bgColor=new THREE.Color;M.bgColor.setRGB(I[0],I[1],I[2]);M.bgColorAlpha=J.defaults.bgalpha;for(t in J.geometries)if(H=J.geometries[t],H.type=="bin_mesh"||H.type=="ascii_mesh")j+=1,e.onLoadStart();O=j;for(t in J.geometries)H=J.geometries[t],H.type=="cube"?(C=new THREE.Cube(H.width,H.height,H.depth,H.segmentsWidth,H.segmentsHeight,H.segmentsDepth,null,H.flipped,H.sides),M.geometries[t]=C):
-H.type=="plane"?(C=new THREE.Plane(H.width,H.height,H.segmentsWidth,H.segmentsHeight),M.geometries[t]=C):H.type=="sphere"?(C=new THREE.Sphere(H.radius,H.segmentsWidth,H.segmentsHeight),M.geometries[t]=C):H.type=="cylinder"?(C=new THREE.Cylinder(H.numSegs,H.topRad,H.botRad,H.height,H.topOffset,H.botOffset),M.geometries[t]=C):H.type=="torus"?(C=new THREE.Torus(H.radius,H.tube,H.segmentsR,H.segmentsT),M.geometries[t]=C):H.type=="icosahedron"?(C=new THREE.Icosahedron(H.subdivisions),M.geometries[t]=C):
-H.type=="bin_mesh"?b.load({model:f(H.url,J.urlBaseType),callback:n(t)}):H.type=="ascii_mesh"?V.load({model:f(H.url,J.urlBaseType),callback:n(t)}):H.type=="embedded_mesh"&&(H=J.embeds[H.id])&&V.createModel(H,o(t),"");for(B in J.textures)if(t=J.textures[B],t.url instanceof Array){X+=t.url.length;for(b=0;b<t.url.length;b++)e.onLoadStart()}else X+=1,e.onLoadStart();$=X;for(B in J.textures){t=J.textures[B];if(t.mapping!=void 0&&THREE[t.mapping]!=void 0)t.mapping=new THREE[t.mapping];if(t.url instanceof
-Array){for(var b=[],S=0;S<t.url.length;S++)b[S]=f(t.url[S],J.urlBaseType);b=THREE.ImageUtils.loadTextureCube(b,t.mapping,ca)}else{b=THREE.ImageUtils.loadTexture(f(t.url,J.urlBaseType),t.mapping,ca);if(THREE[t.minFilter]!=void 0)b.minFilter=THREE[t.minFilter];if(THREE[t.magFilter]!=void 0)b.magFilter=THREE[t.magFilter]}M.textures[B]=b}for(v in J.materials){B=J.materials[v];for(G in B.parameters)if(G=="envMap"||G=="map"||G=="lightMap")B.parameters[G]=M.textures[B.parameters[G]];else if(G=="shading")B.parameters[G]=
+c){return b.charCodeAt(c)&255}function t(c){var e,f,h;e=g(b,c);f=g(b,c+C);h=g(b,c+R);c=n(b,c+D);THREE.BinaryLoader.prototype.f3(B,e,f,h,c)}function u(c){var e,f,h,j,k,o;e=g(b,c);f=g(b,c+C);h=g(b,c+R);j=n(b,c+D);k=g(b,c+N);o=g(b,c+J);c=g(b,c+V);THREE.BinaryLoader.prototype.f3n(B,K,e,f,h,j,k,o,c)}function v(c){var e,f,j,k;e=g(b,c);f=g(b,c+h);j=g(b,c+X);k=g(b,c+O);c=n(b,c+$);THREE.BinaryLoader.prototype.f4(B,e,f,j,k,c)}function w(c){var e,f,j,k,o,p,t,u;e=g(b,c);f=g(b,c+h);j=g(b,c+X);k=g(b,c+O);o=n(b,
+c+$);p=g(b,c+M);t=g(b,c+ca);u=g(b,c+U);c=g(b,c+S);THREE.BinaryLoader.prototype.f4n(B,K,e,f,j,k,o,p,t,u,c)}function E(c){var e,f;e=g(b,c);f=g(b,c+ja);c=g(b,c+W);THREE.BinaryLoader.prototype.uv3(B.faceVertexUvs[0],G[e*2],G[e*2+1],G[f*2],G[f*2+1],G[c*2],G[c*2+1])}function I(c){var e,f,h;e=g(b,c);f=g(b,c+fa);h=g(b,c+Y);c=g(b,c+ha);THREE.BinaryLoader.prototype.uv4(B.faceVertexUvs[0],G[e*2],G[e*2+1],G[f*2],G[f*2+1],G[h*2],G[h*2+1],G[c*2],G[c*2+1])}var B=this,H=0,A,K=[],G=[],C,R,D,N,J,V,h,X,O,$,M,ca,U,S,
+ja,W,fa,Y,ha,ea,Q,T,Z,ka,na;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(B,f,c);A={signature:b.substr(H,8),header_bytes:p(b,H+8),vertex_coordinate_bytes:p(b,H+9),normal_coordinate_bytes:p(b,H+10),uv_coordinate_bytes:p(b,H+11),vertex_index_bytes:p(b,H+12),normal_index_bytes:p(b,H+13),uv_index_bytes:p(b,H+14),material_index_bytes:p(b,H+15),nvertices:g(b,H+16),nnormals:g(b,H+16+4),nuvs:g(b,H+16+8),ntri_flat:g(b,H+16+12),ntri_smooth:g(b,H+16+16),ntri_flat_uv:g(b,H+16+20),ntri_smooth_uv:g(b,
+H+16+24),nquad_flat:g(b,H+16+28),nquad_smooth:g(b,H+16+32),nquad_flat_uv:g(b,H+16+36),nquad_smooth_uv:g(b,H+16+40)};H+=A.header_bytes;C=A.vertex_index_bytes;R=A.vertex_index_bytes*2;D=A.vertex_index_bytes*3;N=A.vertex_index_bytes*3+A.material_index_bytes;J=A.vertex_index_bytes*3+A.material_index_bytes+A.normal_index_bytes;V=A.vertex_index_bytes*3+A.material_index_bytes+A.normal_index_bytes*2;h=A.vertex_index_bytes;X=A.vertex_index_bytes*2;O=A.vertex_index_bytes*3;$=A.vertex_index_bytes*4;M=A.vertex_index_bytes*
+4+A.material_index_bytes;ca=A.vertex_index_bytes*4+A.material_index_bytes+A.normal_index_bytes;U=A.vertex_index_bytes*4+A.material_index_bytes+A.normal_index_bytes*2;S=A.vertex_index_bytes*4+A.material_index_bytes+A.normal_index_bytes*3;ja=A.uv_index_bytes;W=A.uv_index_bytes*2;fa=A.uv_index_bytes;Y=A.uv_index_bytes*2;ha=A.uv_index_bytes*3;c=A.vertex_index_bytes*3+A.material_index_bytes;na=A.vertex_index_bytes*4+A.material_index_bytes;ea=A.ntri_flat*c;Q=A.ntri_smooth*(c+A.normal_index_bytes*3);T=A.ntri_flat_uv*
+(c+A.uv_index_bytes*3);Z=A.ntri_smooth_uv*(c+A.normal_index_bytes*3+A.uv_index_bytes*3);ka=A.nquad_flat*na;c=A.nquad_smooth*(na+A.normal_index_bytes*4);na=A.nquad_flat_uv*(na+A.uv_index_bytes*4);H+=function(c){for(var f,g,h,j=A.vertex_coordinate_bytes*3,m=c+A.nvertices*j;c<m;c+=j)f=e(b,c),g=e(b,c+A.vertex_coordinate_bytes),h=e(b,c+A.vertex_coordinate_bytes*2),THREE.BinaryLoader.prototype.v(B,f,g,h);return A.nvertices*j}(H);H+=function(c){for(var e,f,g,h=A.normal_coordinate_bytes*3,j=c+A.nnormals*
+h;c<j;c+=h)e=o(b,c),f=o(b,c+A.normal_coordinate_bytes),g=o(b,c+A.normal_coordinate_bytes*2),K.push(e/127,f/127,g/127);return A.nnormals*h}(H);H+=function(c){for(var f,g,h=A.uv_coordinate_bytes*2,j=c+A.nuvs*h;c<j;c+=h)f=e(b,c),g=e(b,c+A.uv_coordinate_bytes),G.push(f,g);return A.nuvs*h}(H);ea=H+ea;Q=ea+Q;T=Q+T;Z=T+Z;ka=Z+ka;c=ka+c;na=c+na;(function(b){var c,e=A.vertex_index_bytes*3+A.material_index_bytes,f=e+A.uv_index_bytes*3,g=b+A.ntri_flat_uv*f;for(c=b;c<g;c+=f)t(c),E(c+e);return g-b})(Q);(function(b){var c,
+e=A.vertex_index_bytes*3+A.material_index_bytes+A.normal_index_bytes*3,f=e+A.uv_index_bytes*3,g=b+A.ntri_smooth_uv*f;for(c=b;c<g;c+=f)u(c),E(c+e);return g-b})(T);(function(b){var c,e=A.vertex_index_bytes*4+A.material_index_bytes,f=e+A.uv_index_bytes*4,g=b+A.nquad_flat_uv*f;for(c=b;c<g;c+=f)v(c),I(c+e);return g-b})(c);(function(b){var c,e=A.vertex_index_bytes*4+A.material_index_bytes+A.normal_index_bytes*4,f=e+A.uv_index_bytes*4,g=b+A.nquad_smooth_uv*f;for(c=b;c<g;c+=f)w(c),I(c+e);return g-b})(na);
+(function(b){var c,e=A.vertex_index_bytes*3+A.material_index_bytes,f=b+A.ntri_flat*e;for(c=b;c<f;c+=e)t(c);return f-b})(H);(function(b){var c,e=A.vertex_index_bytes*3+A.material_index_bytes+A.normal_index_bytes*3,f=b+A.ntri_smooth*e;for(c=b;c<f;c+=e)u(c);return f-b})(ea);(function(b){var c,e=A.vertex_index_bytes*4+A.material_index_bytes,f=b+A.nquad_flat*e;for(c=b;c<f;c+=e)v(c);return f-b})(Z);(function(b){var c,e=A.vertex_index_bytes*4+A.material_index_bytes+A.normal_index_bytes*4,f=b+A.nquad_smooth*
+e;for(c=b;c<f;c+=e)w(c);return f-b})(ka);this.computeCentroids();this.computeFaceNormals()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;c(new g(e))},v:function(b,c,e,f){b.vertices.push(new THREE.Vertex(new THREE.Vector3(c,e,f)))},f3:function(b,c,e,f,g){b.faces.push(new THREE.Face3(c,e,f,null,null,b.materials[g]))},f4:function(b,c,e,f,g,j){b.faces.push(new THREE.Face4(c,e,f,g,null,null,b.materials[j]))},f3n:function(b,c,e,f,g,j,k,m,n){var j=b.materials[j],o=c[m*3],p=c[m*3+1],m=c[m*3+2],
+t=c[n*3],u=c[n*3+1],n=c[n*3+2];b.faces.push(new THREE.Face3(e,f,g,[new THREE.Vector3(c[k*3],c[k*3+1],c[k*3+2]),new THREE.Vector3(o,p,m),new THREE.Vector3(t,u,n)],null,j))},f4n:function(b,c,e,f,g,j,k,m,n,o,p){var k=b.materials[k],t=c[n*3],u=c[n*3+1],n=c[n*3+2],v=c[o*3],w=c[o*3+1],o=c[o*3+2],E=c[p*3],I=c[p*3+1],p=c[p*3+2];b.faces.push(new THREE.Face4(e,f,g,j,[new THREE.Vector3(c[m*3],c[m*3+1],c[m*3+2]),new THREE.Vector3(t,u,n),new THREE.Vector3(v,w,o),new THREE.Vector3(E,I,p)],null,k))},uv3:function(b,
+c,e,f,g,j,k){var m=[];m.push(new THREE.UV(c,e));m.push(new THREE.UV(f,g));m.push(new THREE.UV(j,k));b.push(m)},uv4:function(b,c,e,f,g,j,k,m,n){var o=[];o.push(new THREE.UV(c,e));o.push(new THREE.UV(f,g));o.push(new THREE.UV(j,k));o.push(new THREE.UV(m,n));b.push(o)}};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
+THREE.SceneLoader.prototype={load:function(b,c){var e=this,f=new Worker(b);f.postMessage(0);var g=THREE.Loader.prototype.extractUrlbase(b);f.onmessage=function(b){function f(b,c){return c=="relativeToHTML"?b:g+"/"+b}function m(){for(v in J.objects)if(!M.objects[v])if(H=J.objects[v],H.geometry!==void 0){if(C=M.geometries[H.geometry]){N=[];for(S=0;S<H.materials.length;S++)N[S]=M.materials[H.materials[S]];A=H.position;r=H.rotation;q=H.quaternion;s=H.scale;q=0;N.length==0&&(N[0]=new THREE.MeshFaceMaterial);
+N.length>1&&(N=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(C,N);object.name=v;object.position.set(A[0],A[1],A[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=H.visible;M.scene.addObject(object);M.objects[v]=object;if(H.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(object);M.scene.collisions.colliders.push(b)}if(H.castsShadow)b=new THREE.ShadowVolume(C),M.scene.addChild(b),
+b.position=object.position,b.rotation=object.rotation,b.scale=object.scale;H.trigger&&H.trigger.toLowerCase()!="none"&&(b={type:H.trigger,object:H},M.triggers[object.name]=b)}}else A=H.position,r=H.rotation,q=H.quaternion,s=H.scale,q=0,object=new THREE.Object3D,object.name=v,object.position.set(A[0],A[1],A[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],s[1],s[2]),object.visible=H.visible!==void 0?H.visible:!1,M.scene.addObject(object),
+M.objects[v]=object,M.empties[v]=object,H.trigger&&H.trigger.toLowerCase()!="none"&&(b={type:H.trigger,object:H},M.triggers[object.name]=b)}function n(b){return function(c){M.geometries[b]=c;m();h-=1;e.onLoadComplete();p()}}function o(b){return function(c){M.geometries[b]=c}}function p(){e.callbackProgress({totalModels:O,totalTextures:$,loadedModels:O-h,loadedTextures:$-X},M);e.onLoadProgress();h==0&&X==0&&c(M)}var t,u,v,w,E,I,B,H,A,K,G,C,R,D,N,J,V,h,X,O,$,M;J=b.data;b=new THREE.BinaryLoader;V=new THREE.JSONLoader;
+X=h=0;M={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};var ca=!1;for(v in J.objects)if(H=J.objects[v],H.meshCollider){ca=!0;break}if(ca)M.scene.collisions=new THREE.CollisionSystem;if(J.transform){ca=J.transform.position;K=J.transform.rotation;var U=J.transform.scale;ca&&M.scene.position.set(ca[0],ca[1],ca[2]);K&&M.scene.rotation.set(K[0],K[1],K[2]);U&&M.scene.scale.set(U[0],U[1],U[2]);(ca||K||U)&&M.scene.updateMatrix()}ca=
+function(){X-=1;p();e.onLoadComplete()};for(E in J.cameras){K=J.cameras[E];if(K.type=="perspective")R=new THREE.Camera(K.fov,K.aspect,K.near,K.far);else if(K.type=="ortho")R=new THREE.Camera,R.projectionMatrix=THREE.Matrix4.makeOrtho(K.left,K.right,K.top,K.bottom,K.near,K.far);A=K.position;K=K.target;R.position.set(A[0],A[1],A[2]);R.target.position.set(K[0],K[1],K[2]);M.cameras[E]=R}for(w in J.lights){E=J.lights[w];R=E.color!==void 0?E.color:16777215;K=E.intensity!==void 0?E.intensity:1;if(E.type==
+"directional")A=E.direction,light=new THREE.DirectionalLight(R,K),light.position.set(A[0],A[1],A[2]),light.position.normalize();else if(E.type=="point")A=E.position,light=new THREE.PointLight(R,K),light.position.set(A[0],A[1],A[2]);M.scene.addLight(light);M.lights[w]=light}for(I in J.fogs)w=J.fogs[I],w.type=="linear"?D=new THREE.Fog(0,w.near,w.far):w.type=="exp2"&&(D=new THREE.FogExp2(0,w.density)),K=w.color,D.color.setRGB(K[0],K[1],K[2]),M.fogs[I]=D;if(M.cameras&&J.defaults.camera)M.currentCamera=
+M.cameras[J.defaults.camera];if(M.fogs&&J.defaults.fog)M.scene.fog=M.fogs[J.defaults.fog];K=J.defaults.bgcolor;M.bgColor=new THREE.Color;M.bgColor.setRGB(K[0],K[1],K[2]);M.bgColorAlpha=J.defaults.bgalpha;for(t in J.geometries)if(I=J.geometries[t],I.type=="bin_mesh"||I.type=="ascii_mesh")h+=1,e.onLoadStart();O=h;for(t in J.geometries)I=J.geometries[t],I.type=="cube"?(C=new THREE.Cube(I.width,I.height,I.depth,I.segmentsWidth,I.segmentsHeight,I.segmentsDepth,null,I.flipped,I.sides),M.geometries[t]=C):
+I.type=="plane"?(C=new THREE.Plane(I.width,I.height,I.segmentsWidth,I.segmentsHeight),M.geometries[t]=C):I.type=="sphere"?(C=new THREE.Sphere(I.radius,I.segmentsWidth,I.segmentsHeight),M.geometries[t]=C):I.type=="cylinder"?(C=new THREE.Cylinder(I.numSegs,I.topRad,I.botRad,I.height,I.topOffset,I.botOffset),M.geometries[t]=C):I.type=="torus"?(C=new THREE.Torus(I.radius,I.tube,I.segmentsR,I.segmentsT),M.geometries[t]=C):I.type=="icosahedron"?(C=new THREE.Icosahedron(I.subdivisions),M.geometries[t]=C):
+I.type=="bin_mesh"?b.load({model:f(I.url,J.urlBaseType),callback:n(t)}):I.type=="ascii_mesh"?V.load({model:f(I.url,J.urlBaseType),callback:n(t)}):I.type=="embedded_mesh"&&(I=J.embeds[I.id])&&V.createModel(I,o(t),"");for(B in J.textures)if(t=J.textures[B],t.url instanceof Array){X+=t.url.length;for(b=0;b<t.url.length;b++)e.onLoadStart()}else X+=1,e.onLoadStart();$=X;for(B in J.textures){t=J.textures[B];if(t.mapping!=void 0&&THREE[t.mapping]!=void 0)t.mapping=new THREE[t.mapping];if(t.url instanceof
+Array){for(var b=[],S=0;S<t.url.length;S++)b[S]=f(t.url[S],J.urlBaseType);b=THREE.ImageUtils.loadTextureCube(b,t.mapping,ca)}else{b=THREE.ImageUtils.loadTexture(f(t.url,J.urlBaseType),t.mapping,ca);if(THREE[t.minFilter]!=void 0)b.minFilter=THREE[t.minFilter];if(THREE[t.magFilter]!=void 0)b.magFilter=THREE[t.magFilter]}M.textures[B]=b}for(u in J.materials){B=J.materials[u];for(G in B.parameters)if(G=="envMap"||G=="map"||G=="lightMap")B.parameters[G]=M.textures[B.parameters[G]];else if(G=="shading")B.parameters[G]=
 B.parameters[G]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(G=="blending")B.parameters[G]=THREE[B.parameters[G]]?THREE[B.parameters[G]]:THREE.NormalBlending;else if(G=="combine")B.parameters[G]=B.parameters[G]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(G=="vertexColors")if(B.parameters[G]=="face")B.parameters[G]=THREE.FaceColors;else if(B.parameters[G])B.parameters[G]=THREE.VertexColors;if(B.parameters.opacity!==void 0&&B.parameters.opacity<1)B.parameters.transparent=
-!0;B=new THREE[B.type](B.parameters);M.materials[v]=B}m();e.callbackSync(M)}}};
+!0;B=new THREE[B.type](B.parameters);M.materials[u]=B}m();e.callbackSync(M)}}};
 THREE.MarchingCubes=function(b,c){THREE.Object3D.call(this);this.materials=c instanceof Array?c:[c];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.hasNormal=this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(b,c,g){return b+(c-b)*g};this.VIntX=function(b,c,g,h,k,m,n,o,p,t){k=(k-p)/(t-p);p=this.normal_cache;c[h]=m+k*this.delta;c[h+1]=n;c[h+2]=o;g[h]=this.lerp(p[b],p[b+3],k);g[h+1]=this.lerp(p[b+1],p[b+4],k);g[h+2]=this.lerp(p[b+2],p[b+5],k)};this.VIntY=function(b,c,g,h,k,m,n,o,p,t){k=(k-p)/(t-p);p=this.normal_cache;c[h]=m;c[h+1]=n+k*this.delta;c[h+
-2]=o;c=b+this.yd*3;g[h]=this.lerp(p[b],p[c],k);g[h+1]=this.lerp(p[b+1],p[c+1],k);g[h+2]=this.lerp(p[b+2],p[c+2],k)};this.VIntZ=function(b,c,g,h,k,m,n,o,p,t){k=(k-p)/(t-p);p=this.normal_cache;c[h]=m;c[h+1]=n;c[h+2]=o+k*this.delta;c=b+this.zd*3;g[h]=this.lerp(p[b],p[c],k);g[h+1]=this.lerp(p[b+1],p[c+1],k);g[h+2]=this.lerp(p[b+2],p[c+2],k)};this.compNorm=function(b){var c=b*3;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,g,h,k,m){var n=h+1,o=h+this.yd,p=h+this.zd,t=n+this.yd,v=n+this.zd,u=h+this.yd+this.zd,w=n+this.yd+this.zd,E=0,H=this.field[h],B=this.field[n],K=this.field[o],A=this.field[t],I=this.field[p],G=this.field[v],C=this.field[u],R=this.field[w];H<k&&(E|=1);B<k&&(E|=2);K<k&&(E|=8);A<k&&(E|=4);I<k&&(E|=16);G<k&&(E|=32);C<k&&(E|=128);R<k&&(E|=64);var D=THREE.edgeTable[E];if(D==0)return 0;var N=this.delta,
-J=b+N,V=c+N,N=g+N;D&1&&(this.compNorm(h),this.compNorm(n),this.VIntX(h*3,this.vlist,this.nlist,0,k,b,c,g,H,B));D&2&&(this.compNorm(n),this.compNorm(t),this.VIntY(n*3,this.vlist,this.nlist,3,k,J,c,g,B,A));D&4&&(this.compNorm(o),this.compNorm(t),this.VIntX(o*3,this.vlist,this.nlist,6,k,b,V,g,K,A));D&8&&(this.compNorm(h),this.compNorm(o),this.VIntY(h*3,this.vlist,this.nlist,9,k,b,c,g,H,K));D&16&&(this.compNorm(p),this.compNorm(v),this.VIntX(p*3,this.vlist,this.nlist,12,k,b,c,N,I,G));D&32&&(this.compNorm(v),
-this.compNorm(w),this.VIntY(v*3,this.vlist,this.nlist,15,k,J,c,N,G,R));D&64&&(this.compNorm(u),this.compNorm(w),this.VIntX(u*3,this.vlist,this.nlist,18,k,b,V,N,C,R));D&128&&(this.compNorm(p),this.compNorm(u),this.VIntY(p*3,this.vlist,this.nlist,21,k,b,c,N,I,C));D&256&&(this.compNorm(h),this.compNorm(p),this.VIntZ(h*3,this.vlist,this.nlist,24,k,b,c,g,H,I));D&512&&(this.compNorm(n),this.compNorm(v),this.VIntZ(n*3,this.vlist,this.nlist,27,k,J,c,g,B,G));D&1024&&(this.compNorm(t),this.compNorm(w),this.VIntZ(t*
-3,this.vlist,this.nlist,30,k,J,V,g,A,R));D&2048&&(this.compNorm(o),this.compNorm(u),this.VIntZ(o*3,this.vlist,this.nlist,33,k,b,V,g,K,C));E<<=4;for(k=h=0;THREE.triTable[E+k]!=-1;)b=E+k,c=b+1,g=b+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[c],3*THREE.triTable[g],m),k+=3,h++;return h};this.posnormtriv=function(b,c,g,h,k,m){var n=this.count*3;this.positionArray[n]=b[g];this.positionArray[n+1]=b[g+1];this.positionArray[n+2]=b[g+2];this.positionArray[n+3]=b[h];this.positionArray[n+
-4]=b[h+1];this.positionArray[n+5]=b[h+2];this.positionArray[n+6]=b[k];this.positionArray[n+7]=b[k+1];this.positionArray[n+8]=b[k+2];this.normalArray[n]=c[g];this.normalArray[n+1]=c[g+1];this.normalArray[n+2]=c[g+2];this.normalArray[n+3]=c[h];this.normalArray[n+4]=c[h+1];this.normalArray[n+5]=c[h+2];this.normalArray[n+6]=c[k];this.normalArray[n+7]=c[k+1];this.normalArray[n+8]=c[k+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&m(this)};this.begin=function(){this.count=0;
-this.hasNormal=this.hasPos=!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,g,h,k){var m=this.size*Math.sqrt(h/k),n=g*this.size,o=c*this.size,p=b*this.size,t=Math.floor(n-m);t<1&&(t=1);n=Math.floor(n+m);n>this.size-1&&(n=this.size-1);var v=Math.floor(o-m);v<1&&(v=1);o=Math.floor(o+m);o>this.size-1&&(o=this.size-1);var u=Math.floor(p-m);u<1&&(u=1);m=Math.floor(p+m);m>this.size-1&&(m=this.size-
-1);for(var w,E,H,B,K,A;t<n;t++){p=this.size2*t;E=t/this.size-g;K=E*E;for(E=v;E<o;E++){H=p+this.size*E;w=E/this.size-c;A=w*w;for(w=u;w<m;w++)B=w/this.size-b,B=h/(1.0E-6+B*B+A+K)-k,B>0&&(this.field[H+w]+=B)}}};this.addPlaneX=function(b,c){var g,h,k,m,n,o=this.size,p=this.yd,t=this.zd,v=this.field,u=o*Math.sqrt(b/c);u>o&&(u=o);for(g=0;g<u;g++)if(h=g/o,h*=h,m=b/(1.0E-4+h)-c,m>0)for(h=0;h<o;h++){n=g+h*p;for(k=0;k<o;k++)v[t*k+n]+=m}};this.addPlaneY=function(b,c){var g,h,k,m,n,o,p=this.size,t=this.yd,v=
-this.zd,u=this.field,w=p*Math.sqrt(b/c);w>p&&(w=p);for(h=0;h<w;h++)if(g=h/p,g*=g,m=b/(1.0E-4+g)-c,m>0){n=h*t;for(g=0;g<p;g++){o=n+g;for(k=0;k<p;k++)u[v*k+o]+=m}}};this.addPlaneZ=function(b,c){var g,h,k,m,n,o;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(b/c);dist>size&&(dist=size);for(k=0;k<dist;k++)if(g=k/size,g*=g,m=b/(1.0E-4+g)-c,m>0){n=zd*k;for(h=0;h<size;h++){o=n+h*yd;for(g=0;g<size;g++)field[o+g]+=m}}};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,g,h,k,m,n,o,p,t,v=this.size-2;for(k=1;k<v;k++){t=this.size2*k;o=(k-this.halfsize)/this.halfsize;for(h=1;h<v;h++){p=t+this.size*h;n=(h-this.halfsize)/this.halfsize;for(g=1;g<v;g++)m=(g-this.halfsize)/this.halfsize,c=p+g,this.polygonize(m,n,o,c,this.isolation,b)}}this.end(b)};this.generateGeometry=function(){var b=0,c=new THREE.Geometry,g=[];this.render(function(h){var k,m,n,o,p,t,v,u;for(k=0;k<h.count;k++)v=k*3,p=v+1,u=v+2,m=h.positionArray[v],
-n=h.positionArray[p],o=h.positionArray[u],t=new THREE.Vector3(m,n,o),m=h.normalArray[v],n=h.normalArray[p],o=h.normalArray[u],v=new THREE.Vector3(m,n,o),v.normalize(),p=new THREE.Vertex(t),c.vertices.push(p),g.push(v);nfaces=h.count/3;for(k=0;k<nfaces;k++)v=(b+k)*3,p=v+1,u=v+2,t=g[v],m=g[p],n=g[u],v=new THREE.Face3(v,p,u,[t,m,n]),c.faces.push(v);b+=nfaces;h.count=0});return c};this.init(b)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
+0;this.hasNormal=this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(b,c,g){return b+(c-b)*g};this.VIntX=function(b,c,g,j,k,m,n,o,p,t){k=(k-p)/(t-p);p=this.normal_cache;c[j]=m+k*this.delta;c[j+1]=n;c[j+2]=o;g[j]=this.lerp(p[b],p[b+3],k);g[j+1]=this.lerp(p[b+1],p[b+4],k);g[j+2]=this.lerp(p[b+2],p[b+5],k)};this.VIntY=function(b,c,g,j,k,m,n,o,p,t){k=(k-p)/(t-p);p=this.normal_cache;c[j]=m;c[j+1]=n+k*this.delta;c[j+
+2]=o;c=b+this.yd*3;g[j]=this.lerp(p[b],p[c],k);g[j+1]=this.lerp(p[b+1],p[c+1],k);g[j+2]=this.lerp(p[b+2],p[c+2],k)};this.VIntZ=function(b,c,g,j,k,m,n,o,p,t){k=(k-p)/(t-p);p=this.normal_cache;c[j]=m;c[j+1]=n;c[j+2]=o+k*this.delta;c=b+this.zd*3;g[j]=this.lerp(p[b],p[c],k);g[j+1]=this.lerp(p[b+1],p[c+1],k);g[j+2]=this.lerp(p[b+2],p[c+2],k)};this.compNorm=function(b){var c=b*3;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,g,j,k,m){var n=j+1,o=j+this.yd,p=j+this.zd,t=n+this.yd,u=n+this.zd,v=j+this.yd+this.zd,w=n+this.yd+this.zd,E=0,I=this.field[j],B=this.field[n],H=this.field[o],A=this.field[t],K=this.field[p],G=this.field[u],C=this.field[v],R=this.field[w];I<k&&(E|=1);B<k&&(E|=2);H<k&&(E|=8);A<k&&(E|=4);K<k&&(E|=16);G<k&&(E|=32);C<k&&(E|=128);R<k&&(E|=64);var D=THREE.edgeTable[E];if(D==0)return 0;var N=this.delta,
+J=b+N,V=c+N,N=g+N;D&1&&(this.compNorm(j),this.compNorm(n),this.VIntX(j*3,this.vlist,this.nlist,0,k,b,c,g,I,B));D&2&&(this.compNorm(n),this.compNorm(t),this.VIntY(n*3,this.vlist,this.nlist,3,k,J,c,g,B,A));D&4&&(this.compNorm(o),this.compNorm(t),this.VIntX(o*3,this.vlist,this.nlist,6,k,b,V,g,H,A));D&8&&(this.compNorm(j),this.compNorm(o),this.VIntY(j*3,this.vlist,this.nlist,9,k,b,c,g,I,H));D&16&&(this.compNorm(p),this.compNorm(u),this.VIntX(p*3,this.vlist,this.nlist,12,k,b,c,N,K,G));D&32&&(this.compNorm(u),
+this.compNorm(w),this.VIntY(u*3,this.vlist,this.nlist,15,k,J,c,N,G,R));D&64&&(this.compNorm(v),this.compNorm(w),this.VIntX(v*3,this.vlist,this.nlist,18,k,b,V,N,C,R));D&128&&(this.compNorm(p),this.compNorm(v),this.VIntY(p*3,this.vlist,this.nlist,21,k,b,c,N,K,C));D&256&&(this.compNorm(j),this.compNorm(p),this.VIntZ(j*3,this.vlist,this.nlist,24,k,b,c,g,I,K));D&512&&(this.compNorm(n),this.compNorm(u),this.VIntZ(n*3,this.vlist,this.nlist,27,k,J,c,g,B,G));D&1024&&(this.compNorm(t),this.compNorm(w),this.VIntZ(t*
+3,this.vlist,this.nlist,30,k,J,V,g,A,R));D&2048&&(this.compNorm(o),this.compNorm(v),this.VIntZ(o*3,this.vlist,this.nlist,33,k,b,V,g,H,C));E<<=4;for(k=j=0;THREE.triTable[E+k]!=-1;)b=E+k,c=b+1,g=b+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[c],3*THREE.triTable[g],m),k+=3,j++;return j};this.posnormtriv=function(b,c,g,j,k,m){var n=this.count*3;this.positionArray[n]=b[g];this.positionArray[n+1]=b[g+1];this.positionArray[n+2]=b[g+2];this.positionArray[n+3]=b[j];this.positionArray[n+
+4]=b[j+1];this.positionArray[n+5]=b[j+2];this.positionArray[n+6]=b[k];this.positionArray[n+7]=b[k+1];this.positionArray[n+8]=b[k+2];this.normalArray[n]=c[g];this.normalArray[n+1]=c[g+1];this.normalArray[n+2]=c[g+2];this.normalArray[n+3]=c[j];this.normalArray[n+4]=c[j+1];this.normalArray[n+5]=c[j+2];this.normalArray[n+6]=c[k];this.normalArray[n+7]=c[k+1];this.normalArray[n+8]=c[k+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&m(this)};this.begin=function(){this.count=0;
+this.hasNormal=this.hasPos=!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,g,j,k){var m=this.size*Math.sqrt(j/k),n=g*this.size,o=c*this.size,p=b*this.size,t=Math.floor(n-m);t<1&&(t=1);n=Math.floor(n+m);n>this.size-1&&(n=this.size-1);var u=Math.floor(o-m);u<1&&(u=1);o=Math.floor(o+m);o>this.size-1&&(o=this.size-1);var v=Math.floor(p-m);v<1&&(v=1);m=Math.floor(p+m);m>this.size-1&&(m=this.size-
+1);for(var w,E,I,B,H,A;t<n;t++){p=this.size2*t;E=t/this.size-g;H=E*E;for(E=u;E<o;E++){I=p+this.size*E;w=E/this.size-c;A=w*w;for(w=v;w<m;w++)B=w/this.size-b,B=j/(1.0E-6+B*B+A+H)-k,B>0&&(this.field[I+w]+=B)}}};this.addPlaneX=function(b,c){var g,j,k,m,n,o=this.size,p=this.yd,t=this.zd,u=this.field,v=o*Math.sqrt(b/c);v>o&&(v=o);for(g=0;g<v;g++)if(j=g/o,j*=j,m=b/(1.0E-4+j)-c,m>0)for(j=0;j<o;j++){n=g+j*p;for(k=0;k<o;k++)u[t*k+n]+=m}};this.addPlaneY=function(b,c){var g,j,k,m,n,o,p=this.size,t=this.yd,u=
+this.zd,v=this.field,w=p*Math.sqrt(b/c);w>p&&(w=p);for(j=0;j<w;j++)if(g=j/p,g*=g,m=b/(1.0E-4+g)-c,m>0){n=j*t;for(g=0;g<p;g++){o=n+g;for(k=0;k<p;k++)v[u*k+o]+=m}}};this.addPlaneZ=function(b,c){var g,j,k,m,n,o;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(b/c);dist>size&&(dist=size);for(k=0;k<dist;k++)if(g=k/size,g*=g,m=b/(1.0E-4+g)-c,m>0){n=zd*k;for(j=0;j<size;j++){o=n+j*yd;for(g=0;g<size;g++)field[o+g]+=m}}};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,g,j,k,m,n,o,p,t,u=this.size-2;for(k=1;k<u;k++){t=this.size2*k;o=(k-this.halfsize)/this.halfsize;for(j=1;j<u;j++){p=t+this.size*j;n=(j-this.halfsize)/this.halfsize;for(g=1;g<u;g++)m=(g-this.halfsize)/this.halfsize,c=p+g,this.polygonize(m,n,o,c,this.isolation,b)}}this.end(b)};this.generateGeometry=function(){var b=0,c=new THREE.Geometry,g=[];this.render(function(j){var k,m,n,o,p,t,u,v;for(k=0;k<j.count;k++)u=k*3,p=u+1,v=u+2,m=j.positionArray[u],
+n=j.positionArray[p],o=j.positionArray[v],t=new THREE.Vector3(m,n,o),m=j.normalArray[u],n=j.normalArray[p],o=j.normalArray[v],u=new THREE.Vector3(m,n,o),u.normalize(),p=new THREE.Vertex(t),c.vertices.push(p),g.push(u);nfaces=j.count/3;for(k=0;k<nfaces;k++)u=(b+k)*3,p=u+1,v=u+2,t=g[u],m=g[p],n=g[v],u=new THREE.Face3(u,p,v,[t,m,n]),c.faces.push(u);b+=nfaces;j.count=0});return c};this.init(b)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
 THREE.edgeTable=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,
 1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,
 419,681,928,3376,3129,3891,3642,2358,2111,2869,2620,1340,1077,1855,1590,314,51,825,560,3728,3993,3219,3482,2710,2975,2197,2460,1692,1941,1183,1430,666,915,153,400,3840,3593,3331,3082,2822,2575,2309,2060,1804,1541,1295,1030,778,515,265,0]);
@@ -540,20 +543,22 @@ THREE.Trident=function(b){function c(c){return new THREE.Mesh(new THREE.Cylinder
 this.scale=new THREE.Vector3(b.scale,b.scale,b.scale);this.addChild(e(new THREE.Vector3(b.length,0,0),b.xAxisColor));this.addChild(e(new THREE.Vector3(0,b.length,0),b.yAxisColor));this.addChild(e(new THREE.Vector3(0,0,b.length),b.zAxisColor));if(b.showArrows)g=c(b.xAxisColor),g.rotation.y=-f,g.position.x=b.length,this.addChild(g),g=c(b.yAxisColor),g.rotation.x=f,g.position.y=b.length,this.addChild(g),g=c(b.zAxisColor),g.rotation.y=Math.PI,g.position.z=b.length,this.addChild(g)};
 THREE.Trident.prototype=new THREE.Object3D;THREE.Trident.prototype.constructor=THREE.Trident;THREE.Trident.defaultParams={xAxisColor:16711680,yAxisColor:65280,zAxisColor:255,showArrows:!0,length:100,scale:1};THREE.PlaneCollider=function(b,c){this.point=b;this.normal=c};THREE.SphereCollider=function(b,c){this.center=b;this.radius=c;this.radiusSq=c*c};THREE.BoxCollider=function(b,c){this.min=b;this.max=c;this.dynamic=!0;this.normal=new THREE.Vector3};
 THREE.MeshCollider=function(b,c){this.mesh=b;this.box=c;this.numFaces=this.mesh.geometry.faces.length;this.normal=new THREE.Vector3};THREE.CollisionSystem=function(){this.collisionNormal=new THREE.Vector3;this.colliders=[];this.hits=[]};THREE.Collisions=new THREE.CollisionSystem;THREE.CollisionSystem.prototype.merge=function(b){this.colliders=this.colliders.concat(b.colliders);this.hits=this.hits.concat(b.hits)};
-THREE.CollisionSystem.prototype.rayCastAll=function(b){b.direction.normalize();this.hits.length=0;var c,e,f,g,h=0;c=0;for(e=this.colliders.length;c<e;c++)if(g=this.colliders[c],f=this.rayCast(b,g),f<Number.MAX_VALUE)g.distance=f,f>h?this.hits.push(g):this.hits.unshift(g),h=f;return this.hits};
+THREE.CollisionSystem.prototype.rayCastAll=function(b){b.direction.normalize();this.hits.length=0;var c,e,f,g,j=0;c=0;for(e=this.colliders.length;c<e;c++)if(g=this.colliders[c],f=this.rayCast(b,g),f<Number.MAX_VALUE)g.distance=f,f>j?this.hits.push(g):this.hits.unshift(g),j=f;return this.hits};
 THREE.CollisionSystem.prototype.rayCastNearest=function(b){var c=this.rayCastAll(b);if(c.length==0)return null;for(var e=0;c[e]instanceof THREE.MeshCollider;){var f=this.rayMesh(b,c[e]);if(f.dist<Number.MAX_VALUE){c[e].distance=f.dist;c[e].faceIndex=f.faceIndex;break}e++}if(e>c.length)return null;return c[e]};
 THREE.CollisionSystem.prototype.rayCast=function(b,c){if(c instanceof THREE.PlaneCollider)return this.rayPlane(b,c);else if(c instanceof THREE.SphereCollider)return this.raySphere(b,c);else if(c instanceof THREE.BoxCollider)return this.rayBox(b,c);else if(c instanceof THREE.MeshCollider&&c.box)return this.rayBox(b,c.box)};
-THREE.CollisionSystem.prototype.rayMesh=function(b,c){for(var e=this.makeRayLocal(b,c.mesh),f=Number.MAX_VALUE,g,h=0;h<c.numFaces;h++){var k=c.mesh.geometry.faces[h],m=c.mesh.geometry.vertices[k.a].position,n=c.mesh.geometry.vertices[k.b].position,o=c.mesh.geometry.vertices[k.c].position,p=k instanceof THREE.Face4?c.mesh.geometry.vertices[k.d].position:null;k instanceof THREE.Face3?(k=this.rayTriangle(e,m,n,o,f,this.collisionNormal),k<f&&(f=k,g=h,c.normal.copy(this.collisionNormal),c.normal.normalize())):
-k instanceof THREE.Face4&&(k=this.rayTriangle(e,m,n,p,f,this.collisionNormal),k<f&&(f=k,g=h,c.normal.copy(this.collisionNormal),c.normal.normalize()),k=this.rayTriangle(e,n,o,p,f,this.collisionNormal),k<f&&(f=k,g=h,c.normal.copy(this.collisionNormal),c.normal.normalize()))}return{dist:f,faceIndex:g}};
-THREE.CollisionSystem.prototype.rayTriangle=function(b,c,e,f,g,h){var k=THREE.CollisionSystem.__v1,m=THREE.CollisionSystem.__v2;h.set(0,0,0);k.sub(e,c);m.sub(f,e);h.cross(k,m);m=h.dot(b.direction);if(!(m<0))return Number.MAX_VALUE;k=h.dot(c)-h.dot(b.origin);if(!(k<=0))return Number.MAX_VALUE;if(!(k>=m*g))return Number.MAX_VALUE;k/=m;m=THREE.CollisionSystem.__v3;m.copy(b.direction);m.multiplyScalar(k);m.addSelf(b.origin);Math.abs(h.x)>Math.abs(h.y)?Math.abs(h.x)>Math.abs(h.z)?(b=m.y-c.y,h=e.y-c.y,
-g=f.y-c.y,m=m.z-c.z,e=e.z-c.z,f=f.z-c.z):(b=m.x-c.x,h=e.x-c.x,g=f.x-c.x,m=m.y-c.y,e=e.y-c.y,f=f.y-c.y):Math.abs(h.y)>Math.abs(h.z)?(b=m.x-c.x,h=e.x-c.x,g=f.x-c.x,m=m.z-c.z,e=e.z-c.z,f=f.z-c.z):(b=m.x-c.x,h=e.x-c.x,g=f.x-c.x,m=m.y-c.y,e=e.y-c.y,f=f.y-c.y);c=h*f-e*g;if(c==0)return Number.MAX_VALUE;c=1/c;f=(b*f-m*g)*c;if(!(f>=0))return Number.MAX_VALUE;c*=h*m-e*b;if(!(c>=0))return Number.MAX_VALUE;if(!(1-f-c>=0))return Number.MAX_VALUE;return k};
+THREE.CollisionSystem.prototype.rayMesh=function(b,c){for(var e=this.makeRayLocal(b,c.mesh),f=Number.MAX_VALUE,g,j=0;j<c.numFaces;j++){var k=c.mesh.geometry.faces[j],m=c.mesh.geometry.vertices[k.a].position,n=c.mesh.geometry.vertices[k.b].position,o=c.mesh.geometry.vertices[k.c].position,p=k instanceof THREE.Face4?c.mesh.geometry.vertices[k.d].position:null;k instanceof THREE.Face3?(k=this.rayTriangle(e,m,n,o,f,this.collisionNormal),k<f&&(f=k,g=j,c.normal.copy(this.collisionNormal),c.normal.normalize())):
+k instanceof THREE.Face4&&(k=this.rayTriangle(e,m,n,p,f,this.collisionNormal),k<f&&(f=k,g=j,c.normal.copy(this.collisionNormal),c.normal.normalize()),k=this.rayTriangle(e,n,o,p,f,this.collisionNormal),k<f&&(f=k,g=j,c.normal.copy(this.collisionNormal),c.normal.normalize()))}return{dist:f,faceIndex:g}};
+THREE.CollisionSystem.prototype.rayTriangle=function(b,c,e,f,g,j){var k=THREE.CollisionSystem.__v1,m=THREE.CollisionSystem.__v2;j.set(0,0,0);k.sub(e,c);m.sub(f,e);j.cross(k,m);m=j.dot(b.direction);if(!(m<0))return Number.MAX_VALUE;k=j.dot(c)-j.dot(b.origin);if(!(k<=0))return Number.MAX_VALUE;if(!(k>=m*g))return Number.MAX_VALUE;k/=m;m=THREE.CollisionSystem.__v3;m.copy(b.direction);m.multiplyScalar(k);m.addSelf(b.origin);Math.abs(j.x)>Math.abs(j.y)?Math.abs(j.x)>Math.abs(j.z)?(b=m.y-c.y,j=e.y-c.y,
+g=f.y-c.y,m=m.z-c.z,e=e.z-c.z,f=f.z-c.z):(b=m.x-c.x,j=e.x-c.x,g=f.x-c.x,m=m.y-c.y,e=e.y-c.y,f=f.y-c.y):Math.abs(j.y)>Math.abs(j.z)?(b=m.x-c.x,j=e.x-c.x,g=f.x-c.x,m=m.z-c.z,e=e.z-c.z,f=f.z-c.z):(b=m.x-c.x,j=e.x-c.x,g=f.x-c.x,m=m.y-c.y,e=e.y-c.y,f=f.y-c.y);c=j*f-e*g;if(c==0)return Number.MAX_VALUE;c=1/c;f=(b*f-m*g)*c;if(!(f>=0))return Number.MAX_VALUE;c*=j*m-e*b;if(!(c>=0))return Number.MAX_VALUE;if(!(1-f-c>=0))return Number.MAX_VALUE;return k};
 THREE.CollisionSystem.prototype.makeRayLocal=function(b,c){var e=THREE.CollisionSystem.__m;THREE.Matrix4.makeInvert(c.matrixWorld,e);var f=THREE.CollisionSystem.__r;f.origin.copy(b.origin);f.direction.copy(b.direction);e.multiplyVector3(f.origin);e.rotateAxis(f.direction);f.direction.normalize();return f};
-THREE.CollisionSystem.prototype.rayBox=function(b,c){var e;c.dynamic&&c.mesh&&c.mesh.matrixWorld?e=this.makeRayLocal(b,c.mesh):(e=THREE.CollisionSystem.__r,e.origin.copy(b.origin),e.direction.copy(b.direction));var f=0,g=0,h=0,k=0,m=0,n=0,o=!0;e.origin.x<c.min.x?(f=c.min.x-e.origin.x,f/=e.direction.x,o=!1,k=-1):e.origin.x>c.max.x&&(f=c.max.x-e.origin.x,f/=e.direction.x,o=!1,k=1);e.origin.y<c.min.y?(g=c.min.y-e.origin.y,g/=e.direction.y,o=!1,m=-1):e.origin.y>c.max.y&&(g=c.max.y-e.origin.y,g/=e.direction.y,
-o=!1,m=1);e.origin.z<c.min.z?(h=c.min.z-e.origin.z,h/=e.direction.z,o=!1,n=-1):e.origin.z>c.max.z&&(h=c.max.z-e.origin.z,h/=e.direction.z,o=!1,n=1);if(o)return-1;o=0;g>f&&(o=1,f=g);h>f&&(o=2,f=h);switch(o){case 0:m=e.origin.y+e.direction.y*f;if(m<c.min.y||m>c.max.y)return Number.MAX_VALUE;e=e.origin.z+e.direction.z*f;if(e<c.min.z||e>c.max.z)return Number.MAX_VALUE;c.normal.set(k,0,0);break;case 1:k=e.origin.x+e.direction.x*f;if(k<c.min.x||k>c.max.x)return Number.MAX_VALUE;e=e.origin.z+e.direction.z*
+THREE.CollisionSystem.prototype.rayBox=function(b,c){var e;c.dynamic&&c.mesh&&c.mesh.matrixWorld?e=this.makeRayLocal(b,c.mesh):(e=THREE.CollisionSystem.__r,e.origin.copy(b.origin),e.direction.copy(b.direction));var f=0,g=0,j=0,k=0,m=0,n=0,o=!0;e.origin.x<c.min.x?(f=c.min.x-e.origin.x,f/=e.direction.x,o=!1,k=-1):e.origin.x>c.max.x&&(f=c.max.x-e.origin.x,f/=e.direction.x,o=!1,k=1);e.origin.y<c.min.y?(g=c.min.y-e.origin.y,g/=e.direction.y,o=!1,m=-1):e.origin.y>c.max.y&&(g=c.max.y-e.origin.y,g/=e.direction.y,
+o=!1,m=1);e.origin.z<c.min.z?(j=c.min.z-e.origin.z,j/=e.direction.z,o=!1,n=-1):e.origin.z>c.max.z&&(j=c.max.z-e.origin.z,j/=e.direction.z,o=!1,n=1);if(o)return-1;o=0;g>f&&(o=1,f=g);j>f&&(o=2,f=j);switch(o){case 0:m=e.origin.y+e.direction.y*f;if(m<c.min.y||m>c.max.y)return Number.MAX_VALUE;e=e.origin.z+e.direction.z*f;if(e<c.min.z||e>c.max.z)return Number.MAX_VALUE;c.normal.set(k,0,0);break;case 1:k=e.origin.x+e.direction.x*f;if(k<c.min.x||k>c.max.x)return Number.MAX_VALUE;e=e.origin.z+e.direction.z*
 f;if(e<c.min.z||e>c.max.z)return Number.MAX_VALUE;c.normal.set(0,m,0);break;case 2:k=e.origin.x+e.direction.x*f;if(k<c.min.x||k>c.max.x)return Number.MAX_VALUE;m=e.origin.y+e.direction.y*f;if(m<c.min.y||m>c.max.y)return Number.MAX_VALUE;c.normal.set(0,0,n)}return f};THREE.CollisionSystem.prototype.rayPlane=function(b,c){var e=b.direction.dot(c.normal),f=c.point.dot(c.normal);if(e<0)e=(f-b.origin.dot(c.normal))/e;else return Number.MAX_VALUE;return e>0?e:Number.MAX_VALUE};
 THREE.CollisionSystem.prototype.raySphere=function(b,c){var e=c.center.clone().subSelf(b.origin);if(e.lengthSq<c.radiusSq)return-1;var f=e.dot(b.direction.clone());if(f<=0)return Number.MAX_VALUE;e=c.radiusSq-(e.lengthSq()-f*f);if(e>=0)return Math.abs(f)-Math.sqrt(e);return Number.MAX_VALUE};THREE.CollisionSystem.__v1=new THREE.Vector3;THREE.CollisionSystem.__v2=new THREE.Vector3;THREE.CollisionSystem.__v3=new THREE.Vector3;THREE.CollisionSystem.__nr=new THREE.Vector3;THREE.CollisionSystem.__m=new THREE.Matrix4;
 THREE.CollisionSystem.__r=new THREE.Ray;THREE.CollisionUtils={};THREE.CollisionUtils.MeshOBB=function(b){b.geometry.computeBoundingBox();var c=b.geometry.boundingBox,e=new THREE.Vector3(c.x[0],c.y[0],c.z[0]),c=new THREE.Vector3(c.x[1],c.y[1],c.z[1]),e=new THREE.BoxCollider(e,c);e.mesh=b;return e};THREE.CollisionUtils.MeshAABB=function(b){var c=THREE.CollisionUtils.MeshOBB(b);c.min.addSelf(b.position);c.max.addSelf(b.position);c.dynamic=!1;return c};
 THREE.CollisionUtils.MeshColliderWBox=function(b){return new THREE.MeshCollider(b,THREE.CollisionUtils.MeshOBB(b))};
-THREE.AnaglyphWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);var c=this,e=this.setSize,f=this.render,g=new THREE.Camera,h=new THREE.Camera,b={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},k=new THREE.WebGLRenderTarget(512,512,b),m=new THREE.WebGLRenderTarget(512,512,b),n=new THREE.Camera(53,1,1,1E4);n.position.z=2;_material=new THREE.MeshShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:k},mapRight:{type:"t",value:1,texture:m}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",
+THREE.AnaglyphWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);var c=this,e=this.setSize,f=this.render,g=new THREE.Camera,j=new THREE.Camera,b={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},k=new THREE.WebGLRenderTarget(512,512,b),m=new THREE.WebGLRenderTarget(512,512,b),n=new THREE.Camera(53,1,1,1E4);n.position.z=2;_material=new THREE.MeshShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:k},mapRight:{type:"t",value:1,texture:m}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",
 fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"});var o=new THREE.Scene;o.addObject(new THREE.Mesh(new THREE.Plane(2,2),_material));this.setSize=function(b,f){e.call(c,b,f);k.width=b;k.height=f;m.width=b;m.height=f};this.render=
-function(b,e){g.projectionMatrix=e.projectionMatrix;g.position.copy(e.position);g.target.position.copy(e.target.position);g.translateX(-10);h.projectionMatrix=e.projectionMatrix;h.position.copy(e.position);h.target.position.copy(e.target.position);h.translateX(10);f.call(c,b,g,k,!0);f.call(c,b,h,m,!0);f.call(c,o,n)}};THREE.AnaglyphWebGLRenderer.prototype=new THREE.WebGLRenderer;THREE.AnaglyphWebGLRenderer.prototype.constructor=THREE.AnaglyphWebGLRenderer;
+function(b,e){g.projectionMatrix=e.projectionMatrix;g.position.copy(e.position);g.target.position.copy(e.target.position);g.translateX(-10);j.projectionMatrix=e.projectionMatrix;j.position.copy(e.position);j.target.position.copy(e.target.position);j.translateX(10);f.call(c,b,g,k,!0);f.call(c,b,j,m,!0);f.call(c,o,n)}};THREE.AnaglyphWebGLRenderer.prototype=new THREE.WebGLRenderer;THREE.AnaglyphWebGLRenderer.prototype.constructor=THREE.AnaglyphWebGLRenderer;
+THREE.CrosseyedWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);this.autoClear=!1;var c=this,e=this.setSize,f=this.render,g,j,k=new THREE.Camera,m=new THREE.Camera;c.separation=10;if(b&&b.separation!==void 0)c.separation=b.separation;(new THREE.Camera(53,window.innerWidth/2/window.innerHeight,1,1E4)).position.z=-10;this.setSize=function(b,f){e.call(c,b,f);g=b/2;j=f};this.render=function(b,e){this.clear();k.fov=e.fov;k.aspect=0.5*e.aspect;k.near=e.near;k.far=e.far;k.updateProjectionMatrix();
+k.position.copy(e.position);k.target.position.copy(e.target.position);k.translateX(c.separation);m.projectionMatrix=k.projectionMatrix;m.position.copy(e.position);m.target.position.copy(e.target.position);m.translateX(-c.separation);this.setViewport(0,0,g,j);f.call(c,b,k);this.setViewport(g,0,g,j);f.call(c,b,m,!1)}};THREE.CrosseyedWebGLRenderer.prototype=new THREE.WebGLRenderer;THREE.CrosseyedWebGLRenderer.prototype.constructor=THREE.CrosseyedWebGLRenderer;

+ 10 - 8
build/custom/ThreeCanvas.js

@@ -41,8 +41,8 @@ e*k*m-g*j*m+g*f*l-c*k*l-e*f*n+c*j*n;b.n31=h*n*i-k*p*i+k*m*q-f*n*q-h*m*t+f*p*t;b.
 THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,e=-a.n33*a.n21+a.n31*a.n23,g=a.n32*a.n21-a.n31*a.n22,f=-a.n33*a.n12+a.n32*a.n13,h=a.n33*a.n11-a.n31*a.n13,j=-a.n32*a.n11+a.n31*a.n12,k=a.n23*a.n12-a.n22*a.n13,m=-a.n23*a.n11+a.n21*a.n13,p=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*f+a.n31*k;a==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;c[0]=a*d;c[1]=a*e;c[2]=a*g;c[3]=a*f;c[4]=a*h;c[5]=a*j;c[6]=a*k;c[7]=a*m;c[8]=a*p;return b};
 THREE.Matrix4.makeFrustum=function(a,b,c,d,e,g){var f;f=new THREE.Matrix4;f.n11=2*e/(b-a);f.n12=0;f.n13=(b+a)/(b-a);f.n14=0;f.n21=0;f.n22=2*e/(d-c);f.n23=(d+c)/(d-c);f.n24=0;f.n31=0;f.n32=0;f.n33=-(g+e)/(g-e);f.n34=-2*g*e/(g-e);f.n41=0;f.n42=0;f.n43=-1;f.n44=0;return f};THREE.Matrix4.makePerspective=function(a,b,c,d){var e,a=c*Math.tan(a*Math.PI/360);e=-a;return THREE.Matrix4.makeFrustum(e*b,a*b,e,a,c,d)};
 THREE.Matrix4.makeOrtho=function(a,b,c,d,e,g){var f,h,j,k;f=new THREE.Matrix4;h=b-a;j=c-d;k=g-e;f.n11=2/h;f.n12=0;f.n13=0;f.n14=-((b+a)/h);f.n21=0;f.n22=2/j;f.n23=0;f.n24=-((c+d)/j);f.n31=0;f.n32=0;f.n33=-2/k;f.n34=-((g+e)/k);f.n41=0;f.n42=0;f.n43=0;f.n44=1;return f};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
-THREE.Object3D=function(){this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.dynamic=!1;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;
-this.visible=!0;this._vector=new THREE.Vector3;this.name=""};
+THREE.Object3D=function(){this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=
+0;this.boundRadiusScale=1;this.visible=!0;this._vector=new THREE.Vector3;this.name=""};
 THREE.Object3D.prototype={translate:function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(a,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(a){if(this.children.indexOf(a)===
 -1){a.parent!==void 0&&a.parent.removeChild(a);a.parent=this;this.children.push(a);for(var b=this;b.parent!==void 0;)b=b.parent;b!==void 0&&b instanceof THREE.Scene&&b.addChildRecurse(a)}},removeChild:function(a){var b=this.children.indexOf(a);if(b!==-1)a.parent=void 0,this.children.splice(b,1)},getChildByName:function(a,b){var c,d,e;c=0;for(d=this.children.length;c<d;c++){e=this.children[c];if(e.name===a)return e;if(b&&(e=e.getChildByName(a,b),e!==void 0))return e}},updateMatrix:function(){this.matrix.setPosition(this.position);
 this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},update:function(a,b,c){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||b)a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixRotationWorld.extractRotation(this.matrixWorld,
@@ -66,7 +66,9 @@ if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this
 else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=0,b=0,c=this.vertices.length;b<c;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}},computeEdgeFaces:function(){function a(a,b){return Math.min(a,b)+"_"+Math.max(a,b)}function b(a,b,c){a[b]===
 void 0?(a[b]={set:{},array:[]},a[b].set[c]=1,a[b].array.push(c)):a[b].set[c]===void 0&&(a[b].set[c]=1,a[b].array.push(c))}var c,d,e,g,f,h={};c=0;for(d=this.faces.length;c<d;c++)f=this.faces[c],f instanceof THREE.Face3?(e=a(f.a,f.b),b(h,e,c),e=a(f.b,f.c),b(h,e,c),e=a(f.a,f.c),b(h,e,c)):f instanceof THREE.Face4&&(e=a(f.b,f.d),b(h,e,c),e=a(f.a,f.b),b(h,e,c),e=a(f.a,f.d),b(h,e,c),e=a(f.b,f.c),b(h,e,c),e=a(f.c,f.d),b(h,e,c));c=0;for(d=this.edges.length;c<d;c++){f=this.edges[c];e=f.vertexIndices[0];g=f.vertexIndices[1];
 f.faceIndices=h[a(e,g)].array;for(e=0;e<f.faceIndices.length;e++)g=f.faceIndices[e],f.faces.push(this.faces[g])}}};THREE.GeometryIdCounter=0;THREE.Camera=function(a,b,c,d,e){THREE.Object3D.call(this);this.fov=a||50;this.aspect=b||1;this.near=c||0.1;this.far=d||2E3;this.target=e||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;
-THREE.Camera.prototype.supr=THREE.Object3D.prototype;THREE.Camera.prototype.translate=function(a,b){this.matrix.rotateAxis(b);b.multiplyScalar(a);this.position.addSelf(b);this.target.position.addSelf(b)};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};
+THREE.Camera.prototype.supr=THREE.Object3D.prototype;THREE.Camera.prototype.translate=function(a,b){this.matrix.rotateAxis(b);b.multiplyScalar(a);this.position.addSelf(b);this.target.position.addSelf(b)};
+THREE.Camera.prototype.updateProjectionMatrix=function(){if(this.fullWidth){var a=this.fullWidth/this.fullHeight,b=Math.tan(this.fov*Math.PI/360)*this.near,c=-b,d=a*c,a=Math.abs(a*b-d),c=Math.abs(b-c);this.projectionMatrix=THREE.Matrix4.makeFrustum(d+this.x*a/this.fullWidth,d+(this.x+this.width)*a/this.fullWidth,b-(this.y+this.height)*c/this.fullHeight,b-this.y*c/this.fullHeight,this.near,this.far)}else this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};
+THREE.Camera.prototype.setViewOffset=function(a,b,c,d,e,g){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=d;this.width=e;this.height=g;this.updateProjectionMatrix()};
 THREE.Camera.prototype.update=function(a,b,c){if(this.useTarget)this.matrix.lookAt(this.position,this.target.position,this.up),this.matrix.setPosition(this.position),a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix),THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse),b=!0;else if(this.matrixAutoUpdate&&this.updateMatrix(),b||this.matrixWorldNeedsUpdate)a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=
 !1,b=!0,THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,b,c)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;
 THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(a,b,c,d){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=b||1;this.distance=c||0;this.castShadow=d!==void 0?d:!1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=b||1;this.distance=c||0};
@@ -90,8 +92,8 @@ THREE.Texture=function(a,b,c,d,e,g){this.image=a;this.mapping=b!==void 0?b:new T
 THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter)}};THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;
 THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a]};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;
 THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.type=c!=void 0?c:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;
-THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b&&b.length?b:[b];this.overdraw=this.doubleSided=this.flipSided=!1;if(this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere(),this.boundRadius=a.boundingSphere.radius,this.geometry.morphTargets.length)){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var c=0;c<this.geometry.morphTargets.length;c++)this.morphTargetInfluences.push(0),
-this.morphTargetDictionary[this.geometry.morphTargets[c].name]=c}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;THREE.Mesh.prototype.getMorphTargetIndexByName=function(a){if(this.morphTargetDictionary[a]!==void 0)return this.morphTargetDictionary[a];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+a+" does not exist. Returning 0.");return 0};
+THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b&&b.length?b:[b];this.overdraw=!1;if(this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere(),this.boundRadius=a.boundingSphere.radius,this.geometry.morphTargets.length)){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var c=0;c<this.geometry.morphTargets.length;c++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[this.geometry.morphTargets[c].name]=
+c}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;THREE.Mesh.prototype.getMorphTargetIndexByName=function(a){if(this.morphTargetDictionary[a]!==void 0)return this.morphTargetDictionary[a];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+a+" does not exist. Returning 0.");return 0};
 THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
 THREE.Bone.prototype.update=function(a,b,c){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate)a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,b=!0;var d,e=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(d=0;d<e;d++)a=this.children[d],a instanceof THREE.Bone?a.update(this.skinMatrix,b,c):a.update(this.matrixWorld,!0,c)}else for(d=0;d<e;d++)this.children[d].update(this.skinMatrix,
 b,c)};THREE.Bone.prototype.addChild=function(a){if(this.children.indexOf(a)===-1&&(a.parent!==void 0&&a.parent.removeChild(a),a.parent=this,this.children.push(a),!(a instanceof THREE.Bone)))this.hasNoneBoneChildren=!0};
@@ -104,7 +106,7 @@ THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.c
 THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(a instanceof THREE.Sound)this.sounds.indexOf(a)===-1&&this.sounds.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1)this.objects.push(a),this.__objectsAdded.push(a);for(var b=0;b<a.children.length;b++)this.addChildRecurse(a.children[b])};
 THREE.Scene.prototype.removeChild=function(a){this.supr.removeChild.call(this,a);this.removeChildRecurse(a)};THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else a instanceof THREE.Sound?(b=this.sounds.indexOf(a),b!==-1&&this.sounds.splice(b,1)):a instanceof THREE.Camera||(b=this.objects.indexOf(a),b!==-1&&(this.objects.splice(b,1),this.__objectsRemoved.push(a)));for(b=0;b<a.children.length;b++)this.removeChildRecurse(a.children[b])};
 THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;
-THREE.Projector=function(){function a(){var a=j[h]=j[h]||new THREE.RenderableVertex;h++;return a}function b(a,b){return b.z-a.z}function c(a,b){var c=0,d=1,f=a.z+a.w,e=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;return f>=0&&e>=0&&g>=0&&h>=0?!0:f<0&&e<0||g<0&&h<0?!1:(f<0?c=Math.max(c,f/(f-e)):e<0&&(d=Math.min(d,f/(f-e))),g<0?c=Math.max(c,g/(g-h)):h<0&&(d=Math.min(d,g/(g-h))),d<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-d),!0))}var d,e,g=[],f,h,j=[],k,m,p=[],l,n=[],i,q,v=[],t,G,K=[],x=new THREE.Vector4,B=new THREE.Vector4,
+THREE.Projector=function(){function a(){var a=j[h]=j[h]||new THREE.RenderableVertex;h++;return a}function b(a,b){return b.z-a.z}function c(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;return e>=0&&f>=0&&g>=0&&h>=0?!0:e<0&&f<0||g<0&&h<0?!1:(e<0?c=Math.max(c,e/(e-f)):f<0&&(d=Math.min(d,e/(e-f))),g<0?c=Math.max(c,g/(g-h)):h<0&&(d=Math.min(d,g/(g-h))),d<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-d),!0))}var d,e,g=[],f,h,j=[],k,m,p=[],l,n=[],i,q,v=[],t,G,K=[],x=new THREE.Vector4,B=new THREE.Vector4,
 o=new THREE.Matrix4,M=new THREE.Matrix4,r=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],u=new THREE.Vector4,y=new THREE.Vector4;this.projectVector=function(a,b){o.multiply(b.projectionMatrix,b.matrixWorldInverse);o.multiplyVector3(a);return a};this.unprojectVector=function(a,b){o.multiply(b.matrixWorld,THREE.Matrix4.makeInvert(b.projectionMatrix));o.multiplyVector3(a);return a};this.projectObjects=function(a,c,f){var c=[],h,i,l;e=0;i=
 a.objects;a=0;for(h=i.length;a<h;a++){l=i[a];var k;if(!(k=!l.visible))if(k=l instanceof THREE.Mesh){a:{k=void 0;for(var j=l.matrixWorld,n=-l.geometry.boundingSphere.radius*Math.max(l.scale.x,Math.max(l.scale.y,l.scale.z)),m=0;m<6;m++)if(k=r[m].x*j.n14+r[m].y*j.n24+r[m].z*j.n34+r[m].w,k<=n){k=!1;break a}k=!0}k=!k}if(!k)k=g[e]=g[e]||new THREE.RenderableObject,e++,d=k,x.copy(l.position),o.multiplyVector3(x),d.object=l,d.z=x.z,c.push(d)}f&&c.sort(b);return c};this.projectScene=function(d,e,g){var I=[],
 O=e.near,R=e.far,L,D,z,N,w,J,H,S,x,s,E,C,F,T,W,ca,X;G=q=l=m=0;e.matrixAutoUpdate&&e.update(void 0,!0);d.update(void 0,!1,e);o.multiply(e.projectionMatrix,e.matrixWorldInverse);r[0].set(o.n41-o.n11,o.n42-o.n12,o.n43-o.n13,o.n44-o.n14);r[1].set(o.n41+o.n11,o.n42+o.n12,o.n43+o.n13,o.n44+o.n14);r[2].set(o.n41+o.n21,o.n42+o.n22,o.n43+o.n23,o.n44+o.n24);r[3].set(o.n41-o.n21,o.n42-o.n22,o.n43-o.n23,o.n44-o.n24);r[4].set(o.n41-o.n31,o.n42-o.n32,o.n43-o.n33,o.n44-o.n34);r[5].set(o.n41+o.n31,o.n42+o.n32,o.n43+
@@ -121,8 +123,8 @@ var f=this,h=null,j=new THREE.Projector,a=a||{},k=a.canvas!==void 0?a.canvas:doc
 faces:0};this.setSize=function(a,b){m=a;p=b;l=m/2;n=p/2;k.width=m;k.height=p;ka.set(-l,-n,l,n);t=1;G=0;M=o=B=x=K=null};this.setClearColor=function(a,b){q=a;v=b};this.setClearColorHex=function(a,b){q.setHex(a);v=b};this.clear=function(){i.setTransform(1,0,0,-1,l,n);if(!da.isEmpty())da.inflate(1),da.minSelf(ka),q.hex==0&&v==0?i.clearRect(da.getX(),da.getY(),da.getWidth(),da.getHeight()):(c(THREE.NormalBlending),b(1),i.fillStyle="rgba("+Math.floor(q.r*255)+","+Math.floor(q.g*255)+","+Math.floor(q.b*
 255)+","+v+")",i.fillRect(da.getX(),da.getY(),da.getWidth(),da.getHeight())),da.empty()};this.render=function(a,g){function k(a){var b,c,d,e=a.lights;Y.setRGB(0,0,0);sa.setRGB(0,0,0);ta.setRGB(0,0,0);a=0;for(b=e.length;a<b;a++)c=e[a],d=c.color,c instanceof THREE.AmbientLight?(Y.r+=d.r,Y.g+=d.g,Y.b+=d.b):c instanceof THREE.DirectionalLight?(sa.r+=d.r,sa.g+=d.g,sa.b+=d.b):c instanceof THREE.PointLight&&(ta.r+=d.r,ta.g+=d.g,ta.b+=d.b)}function m(a,b,c,d){var e,f,g,h,i=a.lights,a=0;for(e=i.length;a<e;a++)f=
 i[a],g=f.color,f instanceof THREE.DirectionalLight?(h=c.dot(f.position),h<=0||(h*=f.intensity,d.r+=g.r*h,d.g+=g.g*h,d.b+=g.b*h)):f instanceof THREE.PointLight&&(h=c.dot(P.sub(f.position,b).normalize()),h<=0||(h*=f.distance==0?1:1-Math.min(b.distanceTo(f.position)/f.distance,1),h!=0&&(h*=f.intensity,d.r+=g.r*h,d.g+=g.g*h,d.b+=g.b*h)))}function p(a,f,g){b(g.opacity);c(g.blending);var h,k,m,j,Aa,o;if(g instanceof THREE.ParticleBasicMaterial){if(g.map)j=g.map.image,Aa=j.width>>1,o=j.height>>1,g=f.scale.x*
-l,m=f.scale.y*n,h=g*Aa,k=m*o,V.set(a.x-h,a.y-k,a.x+h,a.y+k),ka.instersects(V)&&(i.save(),i.translate(a.x,a.y),i.rotate(-f.rotation),i.scale(g,-m),i.translate(-Aa,-o),i.drawImage(j,0,0),i.restore())}else g instanceof THREE.ParticleCanvasMaterial&&(h=f.scale.x*l,k=f.scale.y*n,V.set(a.x-h,a.y-k,a.x+h,a.y+k),ka.instersects(V)&&(d(g.color),e(g.color),i.save(),i.translate(a.x,a.y),i.rotate(-f.rotation),i.scale(h,k),g.program(i),i.restore()))}function q(a,f,e,g){b(g.opacity);c(g.blending);i.beginPath();
-i.moveTo(a.positionScreen.x,a.positionScreen.y);i.lineTo(f.positionScreen.x,f.positionScreen.y);i.closePath();if(g instanceof THREE.LineBasicMaterial){a=g.linewidth;if(B!=a)i.lineWidth=B=a;a=g.linecap;if(o!=a)i.lineCap=o=a;a=g.linejoin;if(M!=a)i.lineJoin=M=a;d(g.color);i.stroke();V.inflate(g.linewidth*2)}}function t(a,d,e,h,k,i,l,j,n){f.data.vertices+=3;f.data.faces++;b(j.opacity);c(j.blending);I=a.positionScreen.x;O=a.positionScreen.y;R=d.positionScreen.x;L=d.positionScreen.y;D=e.positionScreen.x;
+l,m=f.scale.y*n,h=g*Aa,k=m*o,V.set(a.x-h,a.y-k,a.x+h,a.y+k),ka.instersects(V)&&(i.save(),i.translate(a.x,a.y),i.rotate(-f.rotation),i.scale(g,-m),i.translate(-Aa,-o),i.drawImage(j,0,0),i.restore())}else g instanceof THREE.ParticleCanvasMaterial&&(h=f.scale.x*l,k=f.scale.y*n,V.set(a.x-h,a.y-k,a.x+h,a.y+k),ka.instersects(V)&&(d(g.color),e(g.color),i.save(),i.translate(a.x,a.y),i.rotate(-f.rotation),i.scale(h,k),g.program(i),i.restore()))}function q(a,e,f,g){b(g.opacity);c(g.blending);i.beginPath();
+i.moveTo(a.positionScreen.x,a.positionScreen.y);i.lineTo(e.positionScreen.x,e.positionScreen.y);i.closePath();if(g instanceof THREE.LineBasicMaterial){a=g.linewidth;if(B!=a)i.lineWidth=B=a;a=g.linecap;if(o!=a)i.lineCap=o=a;a=g.linejoin;if(M!=a)i.lineJoin=M=a;d(g.color);i.stroke();V.inflate(g.linewidth*2)}}function t(a,d,e,h,k,i,l,j,n){f.data.vertices+=3;f.data.faces++;b(j.opacity);c(j.blending);I=a.positionScreen.x;O=a.positionScreen.y;R=d.positionScreen.x;L=d.positionScreen.y;D=e.positionScreen.x;
 z=e.positionScreen.y;x(I,O,R,L,D,z);if(j instanceof THREE.MeshBasicMaterial)if(j.map)j.map.mapping instanceof THREE.UVMapping&&(aa=l.uvs[0],ga(I,O,R,L,D,z,j.map.image,aa[h].u,aa[h].v,aa[k].u,aa[k].v,aa[i].u,aa[i].v));else if(j.envMap){if(j.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=g.matrixWorldInverse,P.copy(l.vertexNormalsWorld[0]),Ba=(P.x*a.n11+P.y*a.n12+P.z*a.n13)*0.5+0.5,Ca=-(P.x*a.n21+P.y*a.n22+P.z*a.n23)*0.5+0.5,P.copy(l.vertexNormalsWorld[1]),Da=(P.x*a.n11+P.y*a.n12+P.z*
 a.n13)*0.5+0.5,Ea=-(P.x*a.n21+P.y*a.n22+P.z*a.n23)*0.5+0.5,P.copy(l.vertexNormalsWorld[2]),Fa=(P.x*a.n11+P.y*a.n12+P.z*a.n13)*0.5+0.5,Ga=-(P.x*a.n21+P.y*a.n22+P.z*a.n23)*0.5+0.5,ga(I,O,R,L,D,z,j.envMap.image,Ba,Ca,Da,Ea,Fa,Ga)}else j.wireframe?G(j.color,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):ha(j.color);else if(j instanceof THREE.MeshLambertMaterial)j.map&&!j.wireframe&&(j.map.mapping instanceof THREE.UVMapping&&(aa=l.uvs[0],ga(I,O,R,L,D,z,j.map.image,aa[h].u,aa[h].v,aa[k].u,
 aa[k].v,aa[i].u,aa[i].v)),c(THREE.SubtractiveBlending)),ya?!j.wireframe&&j.shading==THREE.SmoothShading&&l.vertexNormalsWorld.length==3?(E.r=C.r=F.r=Y.r,E.g=C.g=F.g=Y.g,E.b=C.b=F.b=Y.b,m(n,l.v1.positionWorld,l.vertexNormalsWorld[0],E),m(n,l.v2.positionWorld,l.vertexNormalsWorld[1],C),m(n,l.v3.positionWorld,l.vertexNormalsWorld[2],F),T.r=(C.r+F.r)*0.5,T.g=(C.g+F.g)*0.5,T.b=(C.b+F.b)*0.5,X=va(E,C,F,T),ga(I,O,R,L,D,z,X,0,0,1,0,0,1)):(ba.r=Y.r,ba.g=Y.g,ba.b=Y.b,m(n,l.centroidWorld,l.normalWorld,ba),s.r=

+ 6 - 4
build/custom/ThreeDOM.js

@@ -41,8 +41,8 @@ e*k*l-g*i*l+g*f*j-c*k*j-e*f*m+c*i*m;b.n31=h*m*p-k*n*p+k*l*q-f*m*q-h*l*r+f*n*r;b.
 THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,e=-a.n33*a.n21+a.n31*a.n23,g=a.n32*a.n21-a.n31*a.n22,f=-a.n33*a.n12+a.n32*a.n13,h=a.n33*a.n11-a.n31*a.n13,i=-a.n32*a.n11+a.n31*a.n12,k=a.n23*a.n12-a.n22*a.n13,l=-a.n23*a.n11+a.n21*a.n13,n=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*f+a.n31*k;a==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;c[0]=a*d;c[1]=a*e;c[2]=a*g;c[3]=a*f;c[4]=a*h;c[5]=a*i;c[6]=a*k;c[7]=a*l;c[8]=a*n;return b};
 THREE.Matrix4.makeFrustum=function(a,b,c,d,e,g){var f;f=new THREE.Matrix4;f.n11=2*e/(b-a);f.n12=0;f.n13=(b+a)/(b-a);f.n14=0;f.n21=0;f.n22=2*e/(d-c);f.n23=(d+c)/(d-c);f.n24=0;f.n31=0;f.n32=0;f.n33=-(g+e)/(g-e);f.n34=-2*g*e/(g-e);f.n41=0;f.n42=0;f.n43=-1;f.n44=0;return f};THREE.Matrix4.makePerspective=function(a,b,c,d){var e,a=c*Math.tan(a*Math.PI/360);e=-a;return THREE.Matrix4.makeFrustum(e*b,a*b,e,a,c,d)};
 THREE.Matrix4.makeOrtho=function(a,b,c,d,e,g){var f,h,i,k;f=new THREE.Matrix4;h=b-a;i=c-d;k=g-e;f.n11=2/h;f.n12=0;f.n13=0;f.n14=-((b+a)/h);f.n21=0;f.n22=2/i;f.n23=0;f.n24=-((c+d)/i);f.n31=0;f.n32=0;f.n33=-2/k;f.n34=-((g+e)/k);f.n41=0;f.n42=0;f.n43=0;f.n44=1;return f};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
-THREE.Object3D=function(){this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.dynamic=!1;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;
-this.visible=!0;this._vector=new THREE.Vector3;this.name=""};
+THREE.Object3D=function(){this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=
+0;this.boundRadiusScale=1;this.visible=!0;this._vector=new THREE.Vector3;this.name=""};
 THREE.Object3D.prototype={translate:function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(a,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(a){if(this.children.indexOf(a)===
 -1){a.parent!==void 0&&a.parent.removeChild(a);a.parent=this;this.children.push(a);for(var b=this;b.parent!==void 0;)b=b.parent;b!==void 0&&b instanceof THREE.Scene&&b.addChildRecurse(a)}},removeChild:function(a){var b=this.children.indexOf(a);if(b!==-1)a.parent=void 0,this.children.splice(b,1)},getChildByName:function(a,b){var c,d,e;c=0;for(d=this.children.length;c<d;c++){e=this.children[c];if(e.name===a)return e;if(b&&(e=e.getChildByName(a,b),e!==void 0))return e}},updateMatrix:function(){this.matrix.setPosition(this.position);
 this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},update:function(a,b,c){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||b)a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixRotationWorld.extractRotation(this.matrixWorld,
@@ -55,7 +55,9 @@ THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;i
 THREE.Face3=function(a,b,c,d,e,g){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};
 THREE.Face4=function(a,b,c,d,e,g,f){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=f instanceof Array?f:[f];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.set(a||0,b||0)};
 THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Camera=function(a,b,c,d,e){THREE.Object3D.call(this);this.fov=a||50;this.aspect=b||1;this.near=c||0.1;this.far=d||2E3;this.target=e||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;
-THREE.Camera.prototype.supr=THREE.Object3D.prototype;THREE.Camera.prototype.translate=function(a,b){this.matrix.rotateAxis(b);b.multiplyScalar(a);this.position.addSelf(b);this.target.position.addSelf(b)};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};
+THREE.Camera.prototype.supr=THREE.Object3D.prototype;THREE.Camera.prototype.translate=function(a,b){this.matrix.rotateAxis(b);b.multiplyScalar(a);this.position.addSelf(b);this.target.position.addSelf(b)};
+THREE.Camera.prototype.updateProjectionMatrix=function(){if(this.fullWidth){var a=this.fullWidth/this.fullHeight,b=Math.tan(this.fov*Math.PI/360)*this.near,c=-b,d=a*c,a=Math.abs(a*b-d),c=Math.abs(b-c);this.projectionMatrix=THREE.Matrix4.makeFrustum(d+this.x*a/this.fullWidth,d+(this.x+this.width)*a/this.fullWidth,b-(this.y+this.height)*c/this.fullHeight,b-this.y*c/this.fullHeight,this.near,this.far)}else this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};
+THREE.Camera.prototype.setViewOffset=function(a,b,c,d,e,g){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=d;this.width=e;this.height=g;this.updateProjectionMatrix()};
 THREE.Camera.prototype.update=function(a,b,c){if(this.useTarget)this.matrix.lookAt(this.position,this.target.position,this.up),this.matrix.setPosition(this.position),a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix),THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse),b=!0;else if(this.matrixAutoUpdate&&this.updateMatrix(),b||this.matrixWorldNeedsUpdate)a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=
 !1,b=!0,THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,b,c)};THREE.ParticleDOMMaterial=function(a){THREE.Material.call(this);this.domElement=a};THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a]};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;
 THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
@@ -70,7 +72,7 @@ THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.c
 THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(a instanceof THREE.Sound)this.sounds.indexOf(a)===-1&&this.sounds.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1)this.objects.push(a),this.__objectsAdded.push(a);for(var b=0;b<a.children.length;b++)this.addChildRecurse(a.children[b])};
 THREE.Scene.prototype.removeChild=function(a){this.supr.removeChild.call(this,a);this.removeChildRecurse(a)};THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else a instanceof THREE.Sound?(b=this.sounds.indexOf(a),b!==-1&&this.sounds.splice(b,1)):a instanceof THREE.Camera||(b=this.objects.indexOf(a),b!==-1&&(this.objects.splice(b,1),this.__objectsRemoved.push(a)));for(b=0;b<a.children.length;b++)this.removeChildRecurse(a.children[b])};
 THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;
-THREE.Projector=function(){function a(){var a=i[h]=i[h]||new THREE.RenderableVertex;h++;return a}function b(a,b){return b.z-a.z}function c(a,b){var c=0,d=1,f=a.z+a.w,e=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;return f>=0&&e>=0&&g>=0&&h>=0?!0:f<0&&e<0||g<0&&h<0?!1:(f<0?c=Math.max(c,f/(f-e)):e<0&&(d=Math.min(d,f/(f-e))),g<0?c=Math.max(c,g/(g-h)):h<0&&(d=Math.min(d,g/(g-h))),d<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-d),!0))}var d,e,g=[],f,h,i=[],k,l,n=[],j,m=[],p,q,t=[],r,H,K=[],A=new THREE.Vector4,v=new THREE.Vector4,
+THREE.Projector=function(){function a(){var a=i[h]=i[h]||new THREE.RenderableVertex;h++;return a}function b(a,b){return b.z-a.z}function c(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;return e>=0&&f>=0&&g>=0&&h>=0?!0:e<0&&f<0||g<0&&h<0?!1:(e<0?c=Math.max(c,e/(e-f)):f<0&&(d=Math.min(d,e/(e-f))),g<0?c=Math.max(c,g/(g-h)):h<0&&(d=Math.min(d,g/(g-h))),d<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-d),!0))}var d,e,g=[],f,h,i=[],k,l,n=[],j,m=[],p,q,t=[],r,H,K=[],A=new THREE.Vector4,v=new THREE.Vector4,
 o=new THREE.Matrix4,I=new THREE.Matrix4,z=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],D=new THREE.Vector4,E=new THREE.Vector4;this.projectVector=function(a,b){o.multiply(b.projectionMatrix,b.matrixWorldInverse);o.multiplyVector3(a);return a};this.unprojectVector=function(a,b){o.multiply(b.matrixWorld,THREE.Matrix4.makeInvert(b.projectionMatrix));o.multiplyVector3(a);return a};this.projectObjects=function(a,c,f){var c=[],h,k,i;e=0;k=
 a.objects;a=0;for(h=k.length;a<h;a++){i=k[a];var j;if(!(j=!i.visible))if(j=i instanceof THREE.Mesh){a:{j=void 0;for(var l=i.matrixWorld,n=-i.geometry.boundingSphere.radius*Math.max(i.scale.x,Math.max(i.scale.y,i.scale.z)),m=0;m<6;m++)if(j=z[m].x*l.n14+z[m].y*l.n24+z[m].z*l.n34+z[m].w,j<=n){j=!1;break a}j=!0}j=!j}if(!j)j=g[e]=g[e]||new THREE.RenderableObject,e++,d=j,A.copy(i.position),o.multiplyVector3(A),d.object=i,d.z=A.z,c.push(d)}f&&c.sort(b);return c};this.projectScene=function(d,e,g){var A=[],
 V=e.near,W=e.far,M,G,x,C,s,y,w,B,F,u,J,R,T,U,L,S,N;H=q=j=l=0;e.matrixAutoUpdate&&e.update(void 0,!0);d.update(void 0,!1,e);o.multiply(e.projectionMatrix,e.matrixWorldInverse);z[0].set(o.n41-o.n11,o.n42-o.n12,o.n43-o.n13,o.n44-o.n14);z[1].set(o.n41+o.n11,o.n42+o.n12,o.n43+o.n13,o.n44+o.n14);z[2].set(o.n41+o.n21,o.n42+o.n22,o.n43+o.n23,o.n44+o.n24);z[3].set(o.n41-o.n21,o.n42-o.n22,o.n43-o.n23,o.n44-o.n24);z[4].set(o.n41-o.n31,o.n42-o.n32,o.n43-o.n33,o.n44-o.n34);z[5].set(o.n41+o.n31,o.n42+o.n32,o.n43+

+ 88 - 85
build/custom/ThreeExtras.js

@@ -1,10 +1,10 @@
 // ThreeExtras.js r41/ROME - http://github.com/mrdoob/three.js
 THREE.ColorUtils={adjustHSV:function(a,b,c,e){var f=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,f);f.h=THREE.ColorUtils.clamp(f.h+b,0,1);f.s=THREE.ColorUtils.clamp(f.s+c,0,1);f.v=THREE.ColorUtils.clamp(f.v+e,0,1);a.setHSV(f.h,f.s,f.v)},rgbToHsv:function(a,b){var c=a.r,e=a.g,f=a.b,g=Math.max(Math.max(c,e),f),h=Math.min(Math.min(c,e),f);if(h==g)h=c=0;else{var k=g-h,h=k/g,c=c==g?(e-f)/k:e==g?2+(f-c)/k:4+(c-e)/k;c/=6;c<0&&(c+=1);c>1&&(c-=1)}b===void 0&&(b={h:0,s:0,v:0});b.h=c;b.s=h;b.v=g;return b},
 clamp:function(a,b,c){return a<b?b:a>c?c:a}};THREE.ColorUtils.__hsv={h:0,s:0,v:0};
-var GeometryUtils={merge:function(a,b){var c=b instanceof THREE.Mesh,e=a.vertices.length,f=c?b.geometry:b,g=a.vertices,h=f.vertices,k=a.faces,j=f.faces,m=a.faceVertexUvs[0],f=f.faceVertexUvs[0];c&&b.matrixAutoUpdate&&b.updateMatrix();for(var l=0,n=h.length;l<n;l++){var t=new THREE.Vertex(h[l].position.clone());c&&b.matrix.multiplyVector3(t.position);g.push(t)}l=0;for(n=j.length;l<n;l++){var h=j[l],p,u,w=h.vertexNormals,t=h.vertexColors;h instanceof THREE.Face3?p=new THREE.Face3(h.a+e,h.b+e,h.c+e):
-h instanceof THREE.Face4&&(p=new THREE.Face4(h.a+e,h.b+e,h.c+e,h.d+e));p.normal.copy(h.normal);c=0;for(g=w.length;c<g;c++)u=w[c],p.vertexNormals.push(u.clone());p.color.copy(h.color);c=0;for(g=t.length;c<g;c++)u=t[c],p.vertexColors.push(u.clone());p.materials=h.materials.slice();p.centroid.copy(h.centroid);k.push(p)}l=0;for(n=f.length;l<n;l++){e=f[l];k=[];c=0;for(g=e.length;c<g;c++)k.push(new THREE.UV(e[c].u,e[c].v));m.push(k)}}};
+var GeometryUtils={merge:function(a,b){var c=b instanceof THREE.Mesh,e=a.vertices.length,f=c?b.geometry:b,g=a.vertices,h=f.vertices,k=a.faces,j=f.faces,l=a.faceVertexUvs[0],f=f.faceVertexUvs[0];c&&b.matrixAutoUpdate&&b.updateMatrix();for(var m=0,n=h.length;m<n;m++){var t=new THREE.Vertex(h[m].position.clone());c&&b.matrix.multiplyVector3(t.position);g.push(t)}m=0;for(n=j.length;m<n;m++){var h=j[m],p,u,z=h.vertexNormals,t=h.vertexColors;h instanceof THREE.Face3?p=new THREE.Face3(h.a+e,h.b+e,h.c+e):
+h instanceof THREE.Face4&&(p=new THREE.Face4(h.a+e,h.b+e,h.c+e,h.d+e));p.normal.copy(h.normal);c=0;for(g=z.length;c<g;c++)u=z[c],p.vertexNormals.push(u.clone());p.color.copy(h.color);c=0;for(g=t.length;c<g;c++)u=t[c],p.vertexColors.push(u.clone());p.materials=h.materials.slice();p.centroid.copy(h.centroid);k.push(p)}m=0;for(n=f.length;m<n;m++){e=f[m];k=[];c=0;for(g=e.length;c<g;c++)k.push(new THREE.UV(e[c].u,e[c].v));l.push(k)}}};
 THREE.ImageUtils={loadTexture:function(a,b,c){var e=new Image,f=new THREE.Texture(e,b);e.onload=function(){f.needsUpdate=!0;c&&c(this)};e.src=a;return f},loadTextureCube:function(a,b,c){var e,f=[],g=new THREE.Texture(f,b),b=f.loadCount=0;for(e=a.length;b<e;++b)f[b]=new Image,f[b].onload=function(){f.loadCount+=1;if(f.loadCount==6)g.needsUpdate=!0;c&&c(this)},f[b].src=a[b];return g}};
-THREE.SceneUtils={addMesh:function(a,b,c,e,f,g,h,k,j,m){b=new THREE.Mesh(b,m);b.scale.x=b.scale.y=b.scale.z=c;b.position.x=e;b.position.y=f;b.position.z=g;b.rotation.x=h;b.rotation.y=k;b.rotation.z=j;a.addObject(b);return b},addPanoramaCubeWebGL:function(a,b,c){var e=THREE.ShaderUtils.lib.cube;e.uniforms.tCube.texture=c;c=new THREE.MeshShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:e.uniforms});b=new THREE.Mesh(new THREE.Cube(b,b,b,1,1,1,null,!0),c);a.addObject(b);
+THREE.SceneUtils={addMesh:function(a,b,c,e,f,g,h,k,j,l){b=new THREE.Mesh(b,l);b.scale.x=b.scale.y=b.scale.z=c;b.position.x=e;b.position.y=f;b.position.z=g;b.rotation.x=h;b.rotation.y=k;b.rotation.z=j;a.addObject(b);return b},addPanoramaCubeWebGL:function(a,b,c){var e=THREE.ShaderUtils.lib.cube;e.uniforms.tCube.texture=c;c=new THREE.MeshShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:e.uniforms});b=new THREE.Mesh(new THREE.Cube(b,b,b,1,1,1,null,!0),c);a.addObject(b);
 return b},addPanoramaCube:function(a,b,c){var e=[];e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[0])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[1])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[2])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[3])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[4])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[5])}));b=new THREE.Mesh(new THREE.Cube(b,b,b,1,1,e,!0),
 new THREE.MeshFaceMaterial);a.addObject(b);return b},addPanoramaCubePlanes:function(a,b,c){var e=b/2,b=new THREE.Plane(b,b),f=Math.PI,g=Math.PI/2;THREE.SceneUtils.addMesh(a,b,1,0,0,-e,0,0,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[5])}));THREE.SceneUtils.addMesh(a,b,1,-e,0,0,0,g,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[0])}));THREE.SceneUtils.addMesh(a,b,1,e,0,0,0,-g,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[1])}));THREE.SceneUtils.addMesh(a,b,1,0,e,0,g,0,f,
 new THREE.MeshBasicMaterial({map:new THREE.Texture(c[2])}));THREE.SceneUtils.addMesh(a,b,1,0,-e,0,-g,0,f,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[3])}))},showHierarchy:function(a,b){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=b})},traverseHierarchy:function(a,b){var c,e,f=a.children.length;for(e=0;e<f;e++)c=a.children[e],b(c),THREE.SceneUtils.traverseHierarchy(c,b)}};
@@ -19,20 +19,20 @@ film:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},time:{type:"f",value:0}
 screen:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},opacity:{type:"f",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float opacity;\nvoid main() {\nvec4 texel = texture2D( tDiffuse, vUv );\ngl_FragColor = opacity * texel;\n}"},basic:{uniforms:{},vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",
 fragmentShader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(a){var b,c,e,f,g=2*Math.ceil(a*3)+1;g>25&&(g=25);f=(g-1)*0.5;c=Array(g);for(b=e=0;b<g;++b)c[b]=Math.exp(-((b-f)*(b-f))/(2*a*a)),e+=c[b];for(b=0;b<g;++b)c[b]/=e;return c}};
 THREE.AnimationHandler=function(){var a=[],b={},c={update:function(c){for(var b=0;b<a.length;b++)a[b].update(c)},addToUpdate:function(c){a.indexOf(c)===-1&&a.push(c)},removeFromUpdate:function(c){c=a.indexOf(c);c!==-1&&a.splice(c,1)},add:function(a){b[a.name]!==void 0&&console.log("THREE.AnimationHandler.add: Warning! "+a.name+" already exists in library. Overwriting.");b[a.name]=a;if(a.initialized!==!0){for(var c=0;c<a.hierarchy.length;c++){for(var e=0;e<a.hierarchy[c].keys.length;e++){if(a.hierarchy[c].keys[e].time<
-0)a.hierarchy[c].keys[e].time=0;if(a.hierarchy[c].keys[e].rot!==void 0&&!(a.hierarchy[c].keys[e].rot instanceof THREE.Quaternion)){var k=a.hierarchy[c].keys[e].rot;a.hierarchy[c].keys[e].rot=new THREE.Quaternion(k[0],k[1],k[2],k[3])}}if(a.hierarchy[c].keys[0].morphTargets!==void 0){k={};for(e=0;e<a.hierarchy[c].keys.length;e++)for(var j=0;j<a.hierarchy[c].keys[e].morphTargets.length;j++){var m=a.hierarchy[c].keys[e].morphTargets[j];k[m]=-1}a.hierarchy[c].usedMorphTargets=k;for(e=0;e<a.hierarchy[c].keys.length;e++){var l=
-{};for(m in k){for(j=0;j<a.hierarchy[c].keys[e].morphTargets.length;j++)if(a.hierarchy[c].keys[e].morphTargets[j]===m){l[m]=a.hierarchy[c].keys[e].morphTargetsInfluences[j];break}j===a.hierarchy[c].keys[e].morphTargets.length&&(l[m]=0)}a.hierarchy[c].keys[e].morphTargetsInfluences=l}}for(e=1;e<a.hierarchy[c].keys.length;e++)a.hierarchy[c].keys[e].time===a.hierarchy[c].keys[e-1].time&&(a.hierarchy[c].keys.splice(e,1),e--);for(e=1;e<a.hierarchy[c].keys.length;e++)a.hierarchy[c].keys[e].index=e}e=parseInt(a.length*
+0)a.hierarchy[c].keys[e].time=0;if(a.hierarchy[c].keys[e].rot!==void 0&&!(a.hierarchy[c].keys[e].rot instanceof THREE.Quaternion)){var k=a.hierarchy[c].keys[e].rot;a.hierarchy[c].keys[e].rot=new THREE.Quaternion(k[0],k[1],k[2],k[3])}}if(a.hierarchy[c].keys[0].morphTargets!==void 0){k={};for(e=0;e<a.hierarchy[c].keys.length;e++)for(var j=0;j<a.hierarchy[c].keys[e].morphTargets.length;j++){var l=a.hierarchy[c].keys[e].morphTargets[j];k[l]=-1}a.hierarchy[c].usedMorphTargets=k;for(e=0;e<a.hierarchy[c].keys.length;e++){var m=
+{};for(l in k){for(j=0;j<a.hierarchy[c].keys[e].morphTargets.length;j++)if(a.hierarchy[c].keys[e].morphTargets[j]===l){m[l]=a.hierarchy[c].keys[e].morphTargetsInfluences[j];break}j===a.hierarchy[c].keys[e].morphTargets.length&&(m[l]=0)}a.hierarchy[c].keys[e].morphTargetsInfluences=m}}for(e=1;e<a.hierarchy[c].keys.length;e++)a.hierarchy[c].keys[e].time===a.hierarchy[c].keys[e-1].time&&(a.hierarchy[c].keys.splice(e,1),e--);for(e=1;e<a.hierarchy[c].keys.length;e++)a.hierarchy[c].keys[e].index=e}e=parseInt(a.length*
 a.fps,10);a.JIT={};a.JIT.hierarchy=[];for(c=0;c<a.hierarchy.length;c++)a.JIT.hierarchy.push(Array(e));a.initialized=!0}},get:function(a){if(typeof a==="string")return b[a]?b[a]:(console.log("THREE.AnimationHandler.get: Couldn't find animation "+a),null)},parse:function(a){var c=[];if(a instanceof THREE.SkinnedMesh)for(var b=0;b<a.bones.length;b++)c.push(a.bones[b]);else e(a,c);return c}},e=function(a,c){c.push(a);for(var b=0;b<a.children.length;b++)e(a.children[b],c)};c.LINEAR=0;c.CATMULLROM=1;c.CATMULLROM_FORWARD=
 2;return c}();THREE.Animation=function(a,b,c,e){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.loop=this.isPaused=!0;this.interpolationType=c!==void 0?c:THREE.AnimationHandler.LINEAR;this.JITCompile=e!==void 0?e:!0;this.points=[];this.target=new THREE.Vector3};
 THREE.Animation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==void 0?a:!0;this.currentTime=b!==void 0?b:0;var c,e=this.hierarchy.length,f;for(c=0;c<e;c++){f=this.hierarchy[c];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)f.useQuaternion=!0;f.matrixAutoUpdate=!0;if(f.animationCache===void 0)f.animationCache={},f.animationCache.prevKey={pos:0,rot:0,scl:0},f.animationCache.nextKey={pos:0,rot:0,scl:0},f.animationCache.originalMatrix=f instanceof
 THREE.Bone?f.skinMatrix:f.matrix;var g=f.animationCache.prevKey;f=f.animationCache.nextKey;g.pos=this.data.hierarchy[c].keys[0];g.rot=this.data.hierarchy[c].keys[0];g.scl=this.data.hierarchy[c].keys[0];f.pos=this.getNextKeyWith("pos",c,1);f.rot=this.getNextKeyWith("rot",c,1);f.scl=this.getNextKeyWith("scl",c,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
 THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
 THREE.Animation.prototype.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==void 0)this.hierarchy[a]instanceof THREE.Bone?this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix:this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix,delete this.hierarchy[a].animationCache};
-THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,e,f,g,h,k,j,m,l=this.data.JIT.hierarchy,n,t;this.currentTime+=a*this.timeScale;t=this.currentTime;n=this.currentTime%=this.data.length;m=parseInt(Math.min(n*this.data.fps,this.data.length*this.data.fps),10);for(var p=0,u=this.hierarchy.length;p<u;p++)if(a=this.hierarchy[p],j=a.animationCache,this.JITCompile&&l[p][m]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=l[p][m],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
-!1):(a.matrix=l[p][m],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)a instanceof THREE.Bone?a.skinMatrix=a.animationCache.originalMatrix:a.matrix=a.animationCache.originalMatrix;for(var w=0;w<3;w++){c=b[w];h=j.prevKey[c];k=j.nextKey[c];if(k.time<=t){if(n<t)if(this.loop){h=this.data.hierarchy[p].keys[0];for(k=this.getNextKeyWith(c,p,1);k.time<n;)h=k,k=this.getNextKeyWith(c,p,k.index+1)}else{this.stop();return}else{do h=k,k=this.getNextKeyWith(c,p,k.index+1);while(k.time<
+THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,e,f,g,h,k,j,l,m=this.data.JIT.hierarchy,n,t;this.currentTime+=a*this.timeScale;t=this.currentTime;n=this.currentTime%=this.data.length;l=parseInt(Math.min(n*this.data.fps,this.data.length*this.data.fps),10);for(var p=0,u=this.hierarchy.length;p<u;p++)if(a=this.hierarchy[p],j=a.animationCache,this.JITCompile&&m[p][l]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=m[p][l],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
+!1):(a.matrix=m[p][l],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)a instanceof THREE.Bone?a.skinMatrix=a.animationCache.originalMatrix:a.matrix=a.animationCache.originalMatrix;for(var z=0;z<3;z++){c=b[z];h=j.prevKey[c];k=j.nextKey[c];if(k.time<=t){if(n<t)if(this.loop){h=this.data.hierarchy[p].keys[0];for(k=this.getNextKeyWith(c,p,1);k.time<n;)h=k,k=this.getNextKeyWith(c,p,k.index+1)}else{this.stop();return}else{do h=k,k=this.getNextKeyWith(c,p,k.index+1);while(k.time<
 n)}j.prevKey[c]=h;j.nextKey[c]=k}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;e=(n-h.time)/(k.time-h.time);f=h[c];g=k[c];if(e<0||e>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+e+" on bone "+p),e=e<0?0:1;if(c==="pos")if(c=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)c.x=f[0]+(g[0]-f[0])*e,c.y=f[1]+(g[1]-f[1])*e,c.z=f[2]+(g[2]-f[2])*e;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
 this.getPrevKeyWith("pos",p,h.index-1).pos,this.points[1]=f,this.points[2]=g,this.points[3]=this.getNextKeyWith("pos",p,k.index+1).pos,e=e*0.33+0.33,f=this.interpolateCatmullRom(this.points,e),c.x=f[0],c.y=f[1],c.z=f[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)e=this.interpolateCatmullRom(this.points,e*1.01),this.target.set(e[0],e[1],e[2]),this.target.subSelf(c),this.target.y=0,this.target.normalize(),e=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,e,0)}else if(c===
-"rot")THREE.Quaternion.slerp(f,g,a.quaternion,e);else if(c==="scl")c=a.scale,c.x=f[0]+(g[0]-f[0])*e,c.y=f[1]+(g[1]-f[1])*e,c.z=f[2]+(g[2]-f[2])*e}}if(this.JITCompile&&l[0][m]===void 0){this.hierarchy[0].update(void 0,!0);for(p=0;p<this.hierarchy.length;p++)l[p][m]=this.hierarchy[p]instanceof THREE.Bone?this.hierarchy[p].skinMatrix.clone():this.hierarchy[p].matrix.clone()}}};
-THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],e=[],f,g,h,k,j,m;f=(a.length-1)*b;g=Math.floor(f);f-=g;c[0]=g==0?g:g-1;c[1]=g;c[2]=g>a.length-2?g:g+1;c[3]=g>a.length-3?g:g+2;g=a[c[0]];k=a[c[1]];j=a[c[2]];m=a[c[3]];c=f*f;h=f*c;e[0]=this.interpolate(g[0],k[0],j[0],m[0],f,c,h);e[1]=this.interpolate(g[1],k[1],j[1],m[1],f,c,h);e[2]=this.interpolate(g[2],k[2],j[2],m[2],f,c,h);return e};
+"rot")THREE.Quaternion.slerp(f,g,a.quaternion,e);else if(c==="scl")c=a.scale,c.x=f[0]+(g[0]-f[0])*e,c.y=f[1]+(g[1]-f[1])*e,c.z=f[2]+(g[2]-f[2])*e}}if(this.JITCompile&&m[0][l]===void 0){this.hierarchy[0].update(void 0,!0);for(p=0;p<this.hierarchy.length;p++)m[p][l]=this.hierarchy[p]instanceof THREE.Bone?this.hierarchy[p].skinMatrix.clone():this.hierarchy[p].matrix.clone()}}};
+THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],e=[],f,g,h,k,j,l;f=(a.length-1)*b;g=Math.floor(f);f-=g;c[0]=g==0?g:g-1;c[1]=g;c[2]=g>a.length-2?g:g+1;c[3]=g>a.length-3?g:g+2;g=a[c[0]];k=a[c[1]];j=a[c[2]];l=a[c[3]];c=f*f;h=f*c;e[0]=this.interpolate(g[0],k[0],j[0],l[0],f,c,h);e[1]=this.interpolate(g[1],k[1],j[1],l[1],f,c,h);e[2]=this.interpolate(g[2],k[2],j[2],l[2],f,c,h);return e};
 THREE.Animation.prototype.interpolate=function(a,b,c,e,f,g,h){a=(c-a)*0.5;e=(e-b)*0.5;return(2*(b-c)+a+e)*h+(-3*(b-c)-2*a-e)*g+a*f+b};THREE.Animation.prototype.getNextKeyWith=function(a,b,c){var e=this.data.hierarchy[b].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c=c<e.length-1?c:e.length-1:c%=e.length;c<e.length;c++)if(e[c][a]!==void 0)return e[c];return this.data.hierarchy[b].keys[0]};
 THREE.Animation.prototype.getPrevKeyWith=function(a,b,c){for(var e=this.data.hierarchy[b].keys,c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c>0?c:0:c>=0?c:c+e.length;c>=0;c--)if(e[c][a]!==void 0)return e[c];return this.data.hierarchy[b].keys[e.length-1]};
 THREE.QuakeCamera=function(a){function b(a,b){return function(){b.apply(a,arguments)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=3.14;this.domElement=document;this.lastUpdate=(new Date).getTime();this.tdiff=0;if(a){if(a.movementSpeed!==void 0)this.movementSpeed=
@@ -45,7 +45,7 @@ this.heightSpeed?this.tdiff*((this.position.y<this.heightMin?this.heightMin:this
 (this.phi-0)*(this.verticalMax-this.verticalMin)/3.14+this.verticalMin;a=this.target.position;f=this.position;a.x=f.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=f.y+100*Math.cos(this.phi);a.z=f.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",b(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",b(this,this.onMouseDown),
 !1);this.domElement.addEventListener("mouseup",b(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",b(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",b(this,this.onKeyUp),!1)};THREE.QuakeCamera.prototype=new THREE.Camera;THREE.QuakeCamera.prototype.constructor=THREE.QuakeCamera;THREE.QuakeCamera.prototype.supr=THREE.Camera.prototype;
 THREE.QuakeCamera.prototype.translate=function(a,b){this.matrix.rotateAxis(b);if(this.noFly)b.y=0;this.position.addSelf(b.multiplyScalar(a));this.target.position.addSelf(b.multiplyScalar(a))};
-THREE.PathCamera=function(a){function b(a,c,b,e){var g={name:b,fps:0.6,length:e,hierarchy:[]},f,h=c.getControlPointsArray(),k=c.getLength(),j=h.length,z=0;f=j-1;c={parent:-1,keys:[]};c.keys[0]={time:0,pos:h[0],rot:[0,0,0,1],scl:[1,1,1]};c.keys[f]={time:e,pos:h[f],rot:[0,0,0,1],scl:[1,1,1]};for(f=1;f<j-1;f++)z=e*k.chunks[f]/k.total,c.keys[f]={time:z,pos:h[f]};g.hierarchy[0]=c;THREE.AnimationHandler.add(g);return new THREE.Animation(a,b,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function c(a,c){var b,
+THREE.PathCamera=function(a){function b(a,c,b,e){var g={name:b,fps:0.6,length:e,hierarchy:[]},f,h=c.getControlPointsArray(),k=c.getLength(),j=h.length,v=0;f=j-1;c={parent:-1,keys:[]};c.keys[0]={time:0,pos:h[0],rot:[0,0,0,1],scl:[1,1,1]};c.keys[f]={time:e,pos:h[f],rot:[0,0,0,1],scl:[1,1,1]};for(f=1;f<j-1;f++)v=e*k.chunks[f]/k.total,c.keys[f]={time:v,pos:h[f]};g.hierarchy[0]=c;THREE.AnimationHandler.add(g);return new THREE.Animation(a,b,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function c(a,c){var b,
 e,g=new THREE.Geometry;for(b=0;b<a.points.length*c;b++)e=b/(a.points.length*c),e=a.getPoint(e),g.vertices[b]=new THREE.Vertex(new THREE.Vector3(e.x,e.y,e.z));return g}function e(a,b){var e=c(b,10),g=c(b,10),f=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(e,f);particleObj=new THREE.ParticleSystem(g,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);a.addChild(lineObj);particleObj.scale.set(1,1,1);a.addChild(particleObj);g=new THREE.Sphere(1,
 16,8);f=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<b.points.length;i++)e=new THREE.Mesh(g,f),e.position.copy(b.points[i]),e.updateMatrix(),a.addChild(e)}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.lookHorizontal=
 this.lookVertical=!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!==void 0)this.duration=a.duration*1E3;if(a.waypoints!==void 0)this.waypoints=a.waypoints;if(a.useConstantSpeed!==void 0)this.useConstantSpeed=a.useConstantSpeed;if(a.resamplingCoef!==void 0)this.resamplingCoef=a.resamplingCoef;if(a.createDebugPath!==void 0)this.createDebugPath=a.createDebugPath;if(a.createDebugDummy!==
@@ -65,113 +65,114 @@ this.rollSpeed;this.translateX(this.moveVector.x*a);this.translateY(this.moveVec
 this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right;this.moveVector.y=-this.moveState.down+this.moveState.up;this.moveVector.z=-a+this.moveState.back};this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp;this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft;this.rotationVector.z=-this.moveState.rollRight+this.moveState.rollLeft};this.getContainerDimensions=function(){return this.domElement!=
 document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}};this.domElement.addEventListener("mousemove",b(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",b(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",b(this,this.mouseup),!1);window.addEventListener("keydown",b(this,this.keydown),!1);window.addEventListener("keyup",b(this,
 this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};THREE.FlyCamera.prototype=new THREE.Camera;THREE.FlyCamera.prototype.constructor=THREE.FlyCamera;THREE.FlyCamera.prototype.supr=THREE.Camera.prototype;
-THREE.RollCamera=function(a,b,c,e){THREE.Camera.call(this,a,b,c,e);this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.domElement=document;this.matrixAutoUpdate=this.useTarget=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;this.lastUpdate=-1;this.delta=0;var f=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Vector3,k=new THREE.Matrix4,j=!1,m=1,l=0,n=0,t=0,p=0,u=0,w=window.innerWidth/2,v=window.innerHeight/2;this.update=
-function(){var a=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=a;this.delta=(a-this.lastUpdate)/1E3;this.lastUpdate=a;this.mouseLook&&(a=this.delta*this.lookSpeed,this.rotateHorizontally(a*p),this.rotateVertically(a*u));a=this.delta*this.movementSpeed;this.translateZ(a*(l>0||this.autoForward&&!(l<0)?1:l));this.translateX(a*n);this.translateY(a*t);j&&(this.roll+=this.rollSpeed*this.delta*m);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();
+THREE.RollCamera=function(a,b,c,e){THREE.Camera.call(this,a,b,c,e);this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.domElement=document;this.matrixAutoUpdate=this.useTarget=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;this.lastUpdate=-1;this.delta=0;var f=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Vector3,k=new THREE.Matrix4,j=!1,l=1,m=0,n=0,t=0,p=0,u=0,z=window.innerWidth/2,w=window.innerHeight/2;this.update=
+function(){var a=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=a;this.delta=(a-this.lastUpdate)/1E3;this.lastUpdate=a;this.mouseLook&&(a=this.delta*this.lookSpeed,this.rotateHorizontally(a*p),this.rotateVertically(a*u));a=this.delta*this.movementSpeed;this.translateZ(a*(m>0||this.autoForward&&!(m<0)?1:m));this.translateX(a*n);this.translateY(a*t);j&&(this.roll+=this.rollSpeed*this.delta*l);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();
 else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();h.copy(this.forward);g.set(0,1,0);f.cross(g,h).normalize();g.cross(h,f).normalize();this.matrix.n11=f.x;this.matrix.n12=g.x;this.matrix.n13=h.x;this.matrix.n21=f.y;this.matrix.n22=g.y;this.matrix.n23=h.y;this.matrix.n31=f.z;this.matrix.n32=g.z;this.matrix.n33=h.z;k.identity();k.n11=Math.cos(this.roll);k.n12=-Math.sin(this.roll);k.n21=Math.sin(this.roll);k.n22=Math.cos(this.roll);this.matrix.multiplySelf(k);
 this.matrixWorldNeedsUpdate=!0;this.matrix.n14=this.position.x;this.matrix.n24=this.position.y;this.matrix.n34=this.position.z;this.supr.update.call(this)};this.translateX=function(a){this.position.x+=this.matrix.n11*a;this.position.y+=this.matrix.n21*a;this.position.z+=this.matrix.n31*a};this.translateY=function(a){this.position.x+=this.matrix.n12*a;this.position.y+=this.matrix.n22*a;this.position.z+=this.matrix.n32*a};this.translateZ=function(a){this.position.x-=this.matrix.n13*a;this.position.y-=
 this.matrix.n23*a;this.position.z-=this.matrix.n33*a};this.rotateHorizontally=function(a){f.set(this.matrix.n11,this.matrix.n21,this.matrix.n31);f.multiplyScalar(a);this.forward.subSelf(f);this.forward.normalize()};this.rotateVertically=function(a){g.set(this.matrix.n12,this.matrix.n22,this.matrix.n32);g.multiplyScalar(a);this.forward.addSelf(g);this.forward.normalize()};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",
-function(a){p=(a.clientX-w)/window.innerWidth;u=(a.clientY-v)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:l=1;break;case 2:l=-1}},!1);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:l=0;break;case 2:l=0}},!1);this.domElement.addEventListener("keydown",function(a){switch(a.keyCode){case 38:case 87:l=1;break;case 37:case 65:n=-1;break;
-case 40:case 83:l=-1;break;case 39:case 68:n=1;break;case 81:j=!0;m=1;break;case 69:j=!0;m=-1;break;case 82:t=1;break;case 70:t=-1}},!1);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:l=0;break;case 37:case 65:n=0;break;case 40:case 83:l=0;break;case 39:case 68:n=0;break;case 81:j=!1;break;case 69:j=!1;break;case 82:t=0;break;case 70:t=0}},!1)};THREE.RollCamera.prototype=new THREE.Camera;THREE.RollCamera.prototype.constructor=THREE.RollCamera;
+function(a){p=(a.clientX-z)/window.innerWidth;u=(a.clientY-w)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:m=1;break;case 2:m=-1}},!1);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:m=0;break;case 2:m=0}},!1);this.domElement.addEventListener("keydown",function(a){switch(a.keyCode){case 38:case 87:m=1;break;case 37:case 65:n=-1;break;
+case 40:case 83:m=-1;break;case 39:case 68:n=1;break;case 81:j=!0;l=1;break;case 69:j=!0;l=-1;break;case 82:t=1;break;case 70:t=-1}},!1);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:m=0;break;case 37:case 65:n=0;break;case 40:case 83:m=0;break;case 39:case 68:n=0;break;case 81:j=!1;break;case 69:j=!1;break;case 82:t=0;break;case 70:t=0}},!1)};THREE.RollCamera.prototype=new THREE.Camera;THREE.RollCamera.prototype.constructor=THREE.RollCamera;
 THREE.RollCamera.prototype.supr=THREE.Camera.prototype;
 THREE.TrackballCamera=function(a){function b(a,c){return function(){c.apply(a,arguments)}}a=a||{};THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.domElement=a.domElement||document;this.screen=a.screen||{width:window.innerWidth,height:window.innerHeight,offsetLeft:0,offsetTop:0};this.radius=a.radius||(this.screen.width+this.screen.height)/4;this.rotateSpeed=a.rotateSpeed||1;this.zoomSpeed=a.zoomSpeed||1.2;this.panSpeed=a.panSpeed||0.3;this.noZoom=a.noZoom||!1;this.noPan=a.noPan||
-!1;this.staticMoving=a.staticMoving||!1;this.dynamicDampingFactor=a.dynamicDampingFactor||0.2;this.minDistance=a.minDistance||0;this.maxDistance=a.maxDistance||Infinity;this.keys=a.keys||[65,83,68];this.useTarget=!0;var c=!1,e=this.STATE.NONE,f=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Vector3,k=new THREE.Vector2,j=new THREE.Vector2,m=new THREE.Vector2,l=new THREE.Vector2;this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.getMouseOnScreen=function(a,c){return new THREE.Vector2((a-
+!1;this.staticMoving=a.staticMoving||!1;this.dynamicDampingFactor=a.dynamicDampingFactor||0.2;this.minDistance=a.minDistance||0;this.maxDistance=a.maxDistance||Infinity;this.keys=a.keys||[65,83,68];this.useTarget=!0;var c=!1,e=this.STATE.NONE,f=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Vector3,k=new THREE.Vector2,j=new THREE.Vector2,l=new THREE.Vector2,m=new THREE.Vector2;this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.getMouseOnScreen=function(a,c){return new THREE.Vector2((a-
 this.screen.offsetLeft)/this.radius*0.5,(c-this.screen.offsetTop)/this.radius*0.5)};this.getMouseProjectionOnBall=function(a,c){var b=new THREE.Vector3((a-this.screen.width*0.5-this.screen.offsetLeft)/this.radius,(this.screen.height*0.5+this.screen.offsetTop-c)/this.radius,0),e=b.length();e>1?b.normalize():b.z=Math.sqrt(1-e*e);f=this.position.clone().subSelf(this.target.position);e=this.up.clone().setLength(b.y);e.addSelf(this.up.clone().crossSelf(f).setLength(b.x));e.addSelf(f.setLength(b.z));return e};
 this.rotateCamera=function(){var a=Math.acos(g.dot(h)/g.length()/h.length());if(a){var c=(new THREE.Vector3).cross(g,h).normalize(),b=new THREE.Quaternion;a*=this.rotateSpeed;b.setFromAxisAngle(c,-a);b.multiplyVector3(f);b.multiplyVector3(this.up);b.multiplyVector3(h);this.staticMoving?g=h:(b.setFromAxisAngle(c,a*(this.dynamicDampingFactor-1)),b.multiplyVector3(g))}};this.zoomCamera=function(){var a=1+(j.y-k.y)*this.zoomSpeed;a!==1&&a>0&&(f.multiplyScalar(a),this.staticMoving?k=j:k.y+=(j.y-k.y)*this.dynamicDampingFactor)};
-this.panCamera=function(){var a=l.clone().subSelf(m);if(a.lengthSq()){a.multiplyScalar(f.length()*this.panSpeed);var c=f.clone().crossSelf(this.up).setLength(a.x);c.addSelf(this.up.clone().setLength(a.y));this.position.addSelf(c);this.target.position.addSelf(c);this.staticMoving?m=l:m.addSelf(a.sub(l,m).multiplyScalar(this.dynamicDampingFactor))}};this.checkDistances=function(){if(!this.noZoom||!this.noPan)this.position.lengthSq()>this.maxDistance*this.maxDistance&&this.position.setLength(this.maxDistance),
+this.panCamera=function(){var a=m.clone().subSelf(l);if(a.lengthSq()){a.multiplyScalar(f.length()*this.panSpeed);var c=f.clone().crossSelf(this.up).setLength(a.x);c.addSelf(this.up.clone().setLength(a.y));this.position.addSelf(c);this.target.position.addSelf(c);this.staticMoving?l=m:l.addSelf(a.sub(m,l).multiplyScalar(this.dynamicDampingFactor))}};this.checkDistances=function(){if(!this.noZoom||!this.noPan)this.position.lengthSq()>this.maxDistance*this.maxDistance&&this.position.setLength(this.maxDistance),
 f.lengthSq()<this.minDistance*this.minDistance&&this.position.add(this.target.position,f.setLength(this.minDistance))};this.update=function(a,c,b){f=this.position.clone().subSelf(this.target.position);this.rotateCamera();this.noZoom||this.zoomCamera();this.noPan||this.panCamera();this.position.add(this.target.position,f);this.checkDistances();this.supr.update.call(this,a,c,b)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",
-b(this,function(a){c&&(g=h=this.getMouseProjectionOnBall(a.clientX,a.clientY),k=j=this.getMouseOnScreen(a.clientX,a.clientY),m=l=this.getMouseOnScreen(a.clientX,a.clientY),c=!1);e!==this.STATE.NONE&&(e===this.STATE.ROTATE?h=this.getMouseProjectionOnBall(a.clientX,a.clientY):e===this.STATE.ZOOM&&!this.noZoom?j=this.getMouseOnScreen(a.clientX,a.clientY):e===this.STATE.PAN&&!this.noPan&&(l=this.getMouseOnScreen(a.clientX,a.clientY)))}),!1);this.domElement.addEventListener("mousedown",b(this,function(a){a.preventDefault();
-a.stopPropagation();if(e===this.STATE.NONE)e=a.button,e===this.STATE.ROTATE?g=h=this.getMouseProjectionOnBall(a.clientX,a.clientY):e===this.STATE.ZOOM&&!this.noZoom?k=j=this.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(m=l=this.getMouseOnScreen(a.clientX,a.clientY))}),!1);this.domElement.addEventListener("mouseup",b(this,function(a){a.preventDefault();a.stopPropagation();e=this.STATE.NONE}),!1);window.addEventListener("keydown",b(this,function(a){if(e===this.STATE.NONE){if(a.keyCode===this.keys[this.STATE.ROTATE])e=
+b(this,function(a){c&&(g=h=this.getMouseProjectionOnBall(a.clientX,a.clientY),k=j=this.getMouseOnScreen(a.clientX,a.clientY),l=m=this.getMouseOnScreen(a.clientX,a.clientY),c=!1);e!==this.STATE.NONE&&(e===this.STATE.ROTATE?h=this.getMouseProjectionOnBall(a.clientX,a.clientY):e===this.STATE.ZOOM&&!this.noZoom?j=this.getMouseOnScreen(a.clientX,a.clientY):e===this.STATE.PAN&&!this.noPan&&(m=this.getMouseOnScreen(a.clientX,a.clientY)))}),!1);this.domElement.addEventListener("mousedown",b(this,function(a){a.preventDefault();
+a.stopPropagation();if(e===this.STATE.NONE)e=a.button,e===this.STATE.ROTATE?g=h=this.getMouseProjectionOnBall(a.clientX,a.clientY):e===this.STATE.ZOOM&&!this.noZoom?k=j=this.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(l=m=this.getMouseOnScreen(a.clientX,a.clientY))}),!1);this.domElement.addEventListener("mouseup",b(this,function(a){a.preventDefault();a.stopPropagation();e=this.STATE.NONE}),!1);window.addEventListener("keydown",b(this,function(a){if(e===this.STATE.NONE){if(a.keyCode===this.keys[this.STATE.ROTATE])e=
 this.STATE.ROTATE;else if(a.keyCode===this.keys[this.STATE.ZOOM]&&!this.noZoom)e=this.STATE.ZOOM;else if(a.keyCode===this.keys[this.STATE.PAN]&&!this.noPan)e=this.STATE.PAN;e!==this.STATE.NONE&&(c=!0)}}),!1);window.addEventListener("keyup",b(this,function(){if(e!==this.STATE.NONE)e=this.STATE.NONE}),!1)};THREE.TrackballCamera.prototype=new THREE.Camera;THREE.TrackballCamera.prototype.constructor=THREE.TrackballCamera;THREE.TrackballCamera.prototype.supr=THREE.Camera.prototype;
 THREE.TrackballCamera.prototype.STATE={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};
-THREE.Cube=function(a,b,c,e,f,g,h,k,j){function m(a,c,b,h,k,j,m,n){var p,t,u=e||1,w=f||1,K=k/2,N=j/2,L=l.vertices.length;if(a=="x"&&c=="y"||a=="y"&&c=="x")p="z";else if(a=="x"&&c=="z"||a=="z"&&c=="x")p="y",w=g||1;else if(a=="z"&&c=="y"||a=="y"&&c=="z")p="x",u=g||1;var O=u+1,D=w+1;k/=u;var J=j/w;for(t=0;t<D;t++)for(j=0;j<O;j++){var P=new THREE.Vector3;P[a]=(j*k-K)*b;P[c]=(t*J-N)*h;P[p]=m;l.vertices.push(new THREE.Vertex(P))}for(t=0;t<w;t++)for(j=0;j<u;j++)l.faces.push(new THREE.Face4(j+O*t+L,j+O*(t+
-1)+L,j+1+O*(t+1)+L,j+1+O*t+L,null,null,n)),l.faceVertexUvs[0].push([new THREE.UV(j/u,t/w),new THREE.UV(j/u,(t+1)/w),new THREE.UV((j+1)/u,(t+1)/w),new THREE.UV((j+1)/u,t/w)])}THREE.Geometry.call(this);var l=this,n=a/2,t=b/2,p=c/2,k=k?-1:1;if(h!==void 0)if(h instanceof Array)this.materials=h;else{this.materials=[];for(var u=0;u<6;u++)this.materials.push([h])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(j!=void 0)for(var w in j)this.sides[w]!=void 0&&(this.sides[w]=j[w]);
-this.sides.px&&m("z","y",1*k,-1,c,b,-n,this.materials[0]);this.sides.nx&&m("z","y",-1*k,-1,c,b,n,this.materials[1]);this.sides.py&&m("x","z",1*k,1,a,c,t,this.materials[2]);this.sides.ny&&m("x","z",1*k,-1,a,c,-t,this.materials[3]);this.sides.pz&&m("x","y",1*k,-1,a,b,p,this.materials[4]);this.sides.nz&&m("x","y",-1*k,-1,a,b,-p,this.materials[5]);(function(){for(var a=[],c=[],b=0,e=l.vertices.length;b<e;b++){for(var g=l.vertices[b],f=!1,h=0,k=a.length;h<k;h++){var j=a[h];if(g.position.x==j.position.x&&
-g.position.y==j.position.y&&g.position.z==j.position.z){c[b]=h;f=!0;break}}if(!f)c[b]=a.length,a.push(new THREE.Vertex(g.position.clone()))}b=0;for(e=l.faces.length;b<e;b++)g=l.faces[b],g.a=c[g.a],g.b=c[g.b],g.c=c[g.c],g.d=c[g.d];l.vertices=a})();this.computeCentroids();this.computeFaceNormals()};THREE.Cube.prototype=new THREE.Geometry;THREE.Cube.prototype.constructor=THREE.Cube;
-THREE.Cylinder=function(a,b,c,e,f,g){function h(a,c,b){k.vertices.push(new THREE.Vertex(new THREE.Vector3(a,c,b)))}THREE.Geometry.call(this);var k=this,j,m=Math.PI*2,l=e/2;for(j=0;j<a;j++)h(Math.sin(m*j/a)*b,Math.cos(m*j/a)*b,-l);for(j=0;j<a;j++)h(Math.sin(m*j/a)*c,Math.cos(m*j/a)*c,l);for(j=0;j<a;j++)k.faces.push(new THREE.Face4(j,j+a,a+(j+1)%a,(j+1)%a));if(c>0){h(0,0,-l-(g||0));for(j=a;j<a+a/2;j++)k.faces.push(new THREE.Face4(2*a,(2*j-2*a)%a,(2*j-2*a+1)%a,(2*j-2*a+2)%a))}if(b>0){h(0,0,l+(f||0));
-for(j=a+a/2;j<2*a;j++)k.faces.push(new THREE.Face4(2*a+1,(2*j-2*a+2)%a+a,(2*j-2*a+1)%a+a,(2*j-2*a)%a+a))}j=0;for(a=this.faces.length;j<a;j++){var b=[],c=this.faces[j],f=this.vertices[c.a],g=this.vertices[c.b],l=this.vertices[c.c],n=this.vertices[c.d];b.push(new THREE.UV(0.5+Math.atan2(f.position.x,f.position.y)/m,0.5+f.position.z/e));b.push(new THREE.UV(0.5+Math.atan2(g.position.x,g.position.y)/m,0.5+g.position.z/e));b.push(new THREE.UV(0.5+Math.atan2(l.position.x,l.position.y)/m,0.5+l.position.z/
-e));c instanceof THREE.Face4&&b.push(new THREE.UV(0.5+Math.atan2(n.position.x,n.position.y)/m,0.5+n.position.z/e));this.faceVertexUvs[0].push(b)}this.computeCentroids();this.computeFaceNormals()};THREE.Cylinder.prototype=new THREE.Geometry;THREE.Cylinder.prototype.constructor=THREE.Cylinder;
+THREE.Cube=function(a,b,c,e,f,g,h,k,j){function l(a,c,b,h,k,j,l,n){var p,t,u=e||1,z=f||1,K=k/2,N=j/2,L=m.vertices.length;if(a=="x"&&c=="y"||a=="y"&&c=="x")p="z";else if(a=="x"&&c=="z"||a=="z"&&c=="x")p="y",z=g||1;else if(a=="z"&&c=="y"||a=="y"&&c=="z")p="x",u=g||1;var O=u+1,D=z+1;k/=u;var J=j/z;for(t=0;t<D;t++)for(j=0;j<O;j++){var P=new THREE.Vector3;P[a]=(j*k-K)*b;P[c]=(t*J-N)*h;P[p]=l;m.vertices.push(new THREE.Vertex(P))}for(t=0;t<z;t++)for(j=0;j<u;j++)m.faces.push(new THREE.Face4(j+O*t+L,j+O*(t+
+1)+L,j+1+O*(t+1)+L,j+1+O*t+L,null,null,n)),m.faceVertexUvs[0].push([new THREE.UV(j/u,t/z),new THREE.UV(j/u,(t+1)/z),new THREE.UV((j+1)/u,(t+1)/z),new THREE.UV((j+1)/u,t/z)])}THREE.Geometry.call(this);var m=this,n=a/2,t=b/2,p=c/2,k=k?-1:1;if(h!==void 0)if(h instanceof Array)this.materials=h;else{this.materials=[];for(var u=0;u<6;u++)this.materials.push([h])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(j!=void 0)for(var z in j)this.sides[z]!=void 0&&(this.sides[z]=j[z]);
+this.sides.px&&l("z","y",1*k,-1,c,b,-n,this.materials[0]);this.sides.nx&&l("z","y",-1*k,-1,c,b,n,this.materials[1]);this.sides.py&&l("x","z",1*k,1,a,c,t,this.materials[2]);this.sides.ny&&l("x","z",1*k,-1,a,c,-t,this.materials[3]);this.sides.pz&&l("x","y",1*k,-1,a,b,p,this.materials[4]);this.sides.nz&&l("x","y",-1*k,-1,a,b,-p,this.materials[5]);(function(){for(var a=[],c=[],b=0,e=m.vertices.length;b<e;b++){for(var g=m.vertices[b],f=!1,h=0,k=a.length;h<k;h++){var j=a[h];if(g.position.x==j.position.x&&
+g.position.y==j.position.y&&g.position.z==j.position.z){c[b]=h;f=!0;break}}if(!f)c[b]=a.length,a.push(new THREE.Vertex(g.position.clone()))}b=0;for(e=m.faces.length;b<e;b++)g=m.faces[b],g.a=c[g.a],g.b=c[g.b],g.c=c[g.c],g.d=c[g.d];m.vertices=a})();this.computeCentroids();this.computeFaceNormals()};THREE.Cube.prototype=new THREE.Geometry;THREE.Cube.prototype.constructor=THREE.Cube;
+THREE.Cylinder=function(a,b,c,e,f,g){function h(a,c,b){k.vertices.push(new THREE.Vertex(new THREE.Vector3(a,c,b)))}THREE.Geometry.call(this);var k=this,j,l=Math.PI*2,m=e/2;for(j=0;j<a;j++)h(Math.sin(l*j/a)*b,Math.cos(l*j/a)*b,-m);for(j=0;j<a;j++)h(Math.sin(l*j/a)*c,Math.cos(l*j/a)*c,m);for(j=0;j<a;j++)k.faces.push(new THREE.Face4(j,j+a,a+(j+1)%a,(j+1)%a));if(c>0){h(0,0,-m-(g||0));for(j=a;j<a+a/2;j++)k.faces.push(new THREE.Face4(2*a,(2*j-2*a)%a,(2*j-2*a+1)%a,(2*j-2*a+2)%a))}if(b>0){h(0,0,m+(f||0));
+for(j=a+a/2;j<2*a;j++)k.faces.push(new THREE.Face4(2*a+1,(2*j-2*a+2)%a+a,(2*j-2*a+1)%a+a,(2*j-2*a)%a+a))}j=0;for(a=this.faces.length;j<a;j++){var b=[],c=this.faces[j],f=this.vertices[c.a],g=this.vertices[c.b],m=this.vertices[c.c],n=this.vertices[c.d];b.push(new THREE.UV(0.5+Math.atan2(f.position.x,f.position.y)/l,0.5+f.position.z/e));b.push(new THREE.UV(0.5+Math.atan2(g.position.x,g.position.y)/l,0.5+g.position.z/e));b.push(new THREE.UV(0.5+Math.atan2(m.position.x,m.position.y)/l,0.5+m.position.z/
+e));c instanceof THREE.Face4&&b.push(new THREE.UV(0.5+Math.atan2(n.position.x,n.position.y)/l,0.5+n.position.z/e));this.faceVertexUvs[0].push(b)}this.computeCentroids();this.computeFaceNormals()};THREE.Cylinder.prototype=new THREE.Geometry;THREE.Cylinder.prototype.constructor=THREE.Cylinder;
 THREE.Icosahedron=function(a){function b(a,c,b){var e=Math.sqrt(a*a+c*c+b*b);return f.vertices.push(new THREE.Vertex(new THREE.Vector3(a/e,c/e,b/e)))-1}function c(a,c,b,e){e.faces.push(new THREE.Face3(a,c,b))}function e(a,c){var e=f.vertices[a].position,g=f.vertices[c].position;return b((e.x+g.x)/2,(e.y+g.y)/2,(e.z+g.z)/2)}var f=this,g=new THREE.Geometry,h;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;b(-1,a,0);b(1,a,0);b(-1,-a,0);b(1,-a,0);b(0,-1,a);b(0,1,a);b(0,-1,-a);b(0,
-1,-a);b(a,0,-1);b(a,0,1);b(-a,0,-1);b(-a,0,1);c(0,11,5,g);c(0,5,1,g);c(0,1,7,g);c(0,7,10,g);c(0,10,11,g);c(1,5,9,g);c(5,11,4,g);c(11,10,2,g);c(10,7,6,g);c(7,1,8,g);c(3,9,4,g);c(3,4,2,g);c(3,2,6,g);c(3,6,8,g);c(3,8,9,g);c(4,9,5,g);c(2,4,11,g);c(6,2,10,g);c(8,6,7,g);c(9,8,1,g);for(a=0;a<this.subdivisions;a++){h=new THREE.Geometry;for(var k in g.faces){var j=e(g.faces[k].a,g.faces[k].b),m=e(g.faces[k].b,g.faces[k].c),l=e(g.faces[k].c,g.faces[k].a);c(g.faces[k].a,j,l,h);c(g.faces[k].b,m,j,h);c(g.faces[k].c,
-l,m,h);c(j,m,l,h)}g.faces=h.faces}f.faces=g.faces;delete g;delete h;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.Icosahedron.prototype=new THREE.Geometry;THREE.Icosahedron.prototype.constructor=THREE.Icosahedron;
+1,-a);b(a,0,-1);b(a,0,1);b(-a,0,-1);b(-a,0,1);c(0,11,5,g);c(0,5,1,g);c(0,1,7,g);c(0,7,10,g);c(0,10,11,g);c(1,5,9,g);c(5,11,4,g);c(11,10,2,g);c(10,7,6,g);c(7,1,8,g);c(3,9,4,g);c(3,4,2,g);c(3,2,6,g);c(3,6,8,g);c(3,8,9,g);c(4,9,5,g);c(2,4,11,g);c(6,2,10,g);c(8,6,7,g);c(9,8,1,g);for(a=0;a<this.subdivisions;a++){h=new THREE.Geometry;for(var k in g.faces){var j=e(g.faces[k].a,g.faces[k].b),l=e(g.faces[k].b,g.faces[k].c),m=e(g.faces[k].c,g.faces[k].a);c(g.faces[k].a,j,m,h);c(g.faces[k].b,l,j,h);c(g.faces[k].c,
+m,l,h);c(j,l,m,h)}g.faces=h.faces}f.faces=g.faces;delete g;delete h;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.Icosahedron.prototype=new THREE.Geometry;THREE.Icosahedron.prototype.constructor=THREE.Icosahedron;
 THREE.Lathe=function(a,b,c){THREE.Geometry.call(this);this.steps=b||12;this.angle=c||2*Math.PI;for(var b=this.angle/this.steps,c=[],e=[],f=[],g=[],h=(new THREE.Matrix4).setRotationZ(b),k=0;k<a.length;k++)this.vertices.push(new THREE.Vertex(a[k])),c[k]=a[k].clone(),e[k]=this.vertices.length-1;for(var j=0;j<=this.angle+0.0010;j+=b){for(k=0;k<c.length;k++)j<this.angle?(c[k]=h.multiplyVector3(c[k].clone()),this.vertices.push(new THREE.Vertex(c[k])),f[k]=this.vertices.length-1):f=g;j==0&&(g=e);for(k=0;k<
 e.length-1;k++)this.faces.push(new THREE.Face4(f[k],f[k+1],e[k+1],e[k])),this.faceVertexUvs[0].push([new THREE.UV(1-j/this.angle,k/a.length),new THREE.UV(1-j/this.angle,(k+1)/a.length),new THREE.UV(1-(j-b)/this.angle,(k+1)/a.length),new THREE.UV(1-(j-b)/this.angle,k/a.length)]);e=f;f=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.Lathe.prototype=new THREE.Geometry;THREE.Lathe.prototype.constructor=THREE.Lathe;
-THREE.Plane=function(a,b,c,e){THREE.Geometry.call(this);var f,g=a/2,h=b/2,c=c||1,e=e||1,k=c+1,j=e+1;a/=c;var m=b/e;for(f=0;f<j;f++)for(b=0;b<k;b++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(b*a-g,-(f*m-h),0)));for(f=0;f<e;f++)for(b=0;b<c;b++)this.faces.push(new THREE.Face4(b+k*f,b+k*(f+1),b+1+k*(f+1),b+1+k*f)),this.faceVertexUvs[0].push([new THREE.UV(b/c,f/e),new THREE.UV(b/c,(f+1)/e),new THREE.UV((b+1)/c,(f+1)/e),new THREE.UV((b+1)/c,f/e)]);this.computeCentroids();this.computeFaceNormals()};
+THREE.Plane=function(a,b,c,e){THREE.Geometry.call(this);var f,g=a/2,h=b/2,c=c||1,e=e||1,k=c+1,j=e+1;a/=c;var l=b/e;for(f=0;f<j;f++)for(b=0;b<k;b++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(b*a-g,-(f*l-h),0)));for(f=0;f<e;f++)for(b=0;b<c;b++)this.faces.push(new THREE.Face4(b+k*f,b+k*(f+1),b+1+k*(f+1),b+1+k*f)),this.faceVertexUvs[0].push([new THREE.UV(b/c,f/e),new THREE.UV(b/c,(f+1)/e),new THREE.UV((b+1)/c,(f+1)/e),new THREE.UV((b+1)/c,f/e)]);this.computeCentroids();this.computeFaceNormals()};
 THREE.Plane.prototype=new THREE.Geometry;THREE.Plane.prototype.constructor=THREE.Plane;
-THREE.Sphere=function(a,b,c){THREE.Geometry.call(this);for(var e,f=Math.PI,g=Math.max(3,b||8),h=Math.max(2,c||6),b=[],c=0;c<h+1;c++){e=c/h;var k=a*Math.cos(e*f),j=a*Math.sin(e*f),m=[],l=0;for(e=0;e<g;e++){var n=2*e/g,t=j*Math.sin(n*f),n=j*Math.cos(n*f);(c==0||c==h)&&e>0||(l=this.vertices.push(new THREE.Vertex(new THREE.Vector3(n,k,t)))-1);m.push(l)}b.push(m)}for(var p,u,w,f=b.length,c=0;c<f;c++)if(g=b[c].length,c>0)for(e=0;e<g;e++){m=e==g-1;h=b[c][m?0:e+1];k=b[c][m?g-1:e];j=b[c-1][m?g-1:e];m=b[c-
-1][m?0:e+1];t=c/(f-1);p=(c-1)/(f-1);u=(e+1)/g;var n=e/g,l=new THREE.UV(1-u,t),t=new THREE.UV(1-n,t),n=new THREE.UV(1-n,p),v=new THREE.UV(1-u,p);c<b.length-1&&(p=this.vertices[h].position.clone(),u=this.vertices[k].position.clone(),w=this.vertices[j].position.clone(),p.normalize(),u.normalize(),w.normalize(),this.faces.push(new THREE.Face3(h,k,j,[new THREE.Vector3(p.x,p.y,p.z),new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(w.x,w.y,w.z)])),this.faceVertexUvs[0].push([l,t,n]));c>1&&(p=this.vertices[h].position.clone(),
-u=this.vertices[j].position.clone(),w=this.vertices[m].position.clone(),p.normalize(),u.normalize(),w.normalize(),this.faces.push(new THREE.Face3(h,j,m,[new THREE.Vector3(p.x,p.y,p.z),new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(w.x,w.y,w.z)])),this.faceVertexUvs[0].push([l,n,v]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};THREE.Sphere.prototype=new THREE.Geometry;THREE.Sphere.prototype.constructor=THREE.Sphere;
+THREE.Sphere=function(a,b,c){THREE.Geometry.call(this);for(var e,f=Math.PI,g=Math.max(3,b||8),h=Math.max(2,c||6),b=[],c=0;c<h+1;c++){e=c/h;var k=a*Math.cos(e*f),j=a*Math.sin(e*f),l=[],m=0;for(e=0;e<g;e++){var n=2*e/g,t=j*Math.sin(n*f),n=j*Math.cos(n*f);(c==0||c==h)&&e>0||(m=this.vertices.push(new THREE.Vertex(new THREE.Vector3(n,k,t)))-1);l.push(m)}b.push(l)}for(var p,u,z,f=b.length,c=0;c<f;c++)if(g=b[c].length,c>0)for(e=0;e<g;e++){l=e==g-1;h=b[c][l?0:e+1];k=b[c][l?g-1:e];j=b[c-1][l?g-1:e];l=b[c-
+1][l?0:e+1];t=c/(f-1);p=(c-1)/(f-1);u=(e+1)/g;var n=e/g,m=new THREE.UV(1-u,t),t=new THREE.UV(1-n,t),n=new THREE.UV(1-n,p),w=new THREE.UV(1-u,p);c<b.length-1&&(p=this.vertices[h].position.clone(),u=this.vertices[k].position.clone(),z=this.vertices[j].position.clone(),p.normalize(),u.normalize(),z.normalize(),this.faces.push(new THREE.Face3(h,k,j,[new THREE.Vector3(p.x,p.y,p.z),new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(z.x,z.y,z.z)])),this.faceVertexUvs[0].push([m,t,n]));c>1&&(p=this.vertices[h].position.clone(),
+u=this.vertices[j].position.clone(),z=this.vertices[l].position.clone(),p.normalize(),u.normalize(),z.normalize(),this.faces.push(new THREE.Face3(h,j,l,[new THREE.Vector3(p.x,p.y,p.z),new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(z.x,z.y,z.z)])),this.faceVertexUvs[0].push([m,n,w]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};THREE.Sphere.prototype=new THREE.Geometry;THREE.Sphere.prototype.constructor=THREE.Sphere;
 THREE.Torus=function(a,b,c,e){THREE.Geometry.call(this);this.radius=a||100;this.tube=b||40;this.segmentsR=c||8;this.segmentsT=e||6;a=[];for(b=0;b<=this.segmentsR;++b)for(c=0;c<=this.segmentsT;++c){var e=c/this.segmentsT*2*Math.PI,f=b/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(f))*Math.cos(e),(this.radius+this.tube*Math.cos(f))*Math.sin(e),this.tube*Math.sin(f))));a.push([c/this.segmentsT,1-b/this.segmentsR])}for(b=1;b<=this.segmentsR;++b)for(c=
 1;c<=this.segmentsT;++c){var e=(this.segmentsT+1)*b+c,f=(this.segmentsT+1)*b+c-1,g=(this.segmentsT+1)*(b-1)+c-1,h=(this.segmentsT+1)*(b-1)+c;this.faces.push(new THREE.Face4(e,f,g,h));this.faceVertexUvs[0].push([new THREE.UV(a[e][0],a[e][1]),new THREE.UV(a[f][0],a[f][1]),new THREE.UV(a[g][0],a[g][1]),new THREE.UV(a[h][0],a[h][1])])}delete a;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.Torus.prototype=new THREE.Geometry;THREE.Torus.prototype.constructor=THREE.Torus;
 THREE.TorusKnot=function(a,b,c,e,f,g,h){function k(a,c,b,e,g,f){c=b/e*a;b=Math.cos(c);return new THREE.Vector3(g*(2+b)*0.5*Math.cos(a),g*(2+b)*Math.sin(a)*0.5,f*g*Math.sin(c)*0.5)}THREE.Geometry.call(this);this.radius=a||200;this.tube=b||40;this.segmentsR=c||64;this.segmentsT=e||8;this.p=f||2;this.q=g||3;this.heightScale=h||1;this.grid=Array(this.segmentsR);c=new THREE.Vector3;e=new THREE.Vector3;g=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=Array(this.segmentsT);for(b=0;b<this.segmentsT;++b){var j=
 a/this.segmentsR*2*this.p*Math.PI,h=b/this.segmentsT*2*Math.PI,f=k(j,h,this.q,this.p,this.radius,this.heightScale),j=k(j+0.01,h,this.q,this.p,this.radius,this.heightScale);c.x=j.x-f.x;c.y=j.y-f.y;c.z=j.z-f.z;e.x=j.x+f.x;e.y=j.y+f.y;e.z=j.z+f.z;g.cross(c,e);e.cross(g,c);g.normalize();e.normalize();j=-this.tube*Math.cos(h);h=this.tube*Math.sin(h);f.x+=j*e.x+h*g.x;f.y+=j*e.y+h*g.y;f.z+=j*e.z+h*g.z;this.grid[a][b]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(f.x,f.y,f.z)))-1}}for(a=0;a<this.segmentsR;++a)for(b=
-0;b<this.segmentsT;++b){var e=(a+1)%this.segmentsR,g=(b+1)%this.segmentsT,f=this.grid[a][b],c=this.grid[e][b],e=this.grid[e][g],g=this.grid[a][g],h=new THREE.UV(a/this.segmentsR,b/this.segmentsT),j=new THREE.UV((a+1)/this.segmentsR,b/this.segmentsT),m=new THREE.UV((a+1)/this.segmentsR,(b+1)/this.segmentsT),l=new THREE.UV(a/this.segmentsR,(b+1)/this.segmentsT);this.faces.push(new THREE.Face4(f,c,e,g));this.faceVertexUvs[0].push([h,j,m,l])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};
+0;b<this.segmentsT;++b){var e=(a+1)%this.segmentsR,g=(b+1)%this.segmentsT,f=this.grid[a][b],c=this.grid[e][b],e=this.grid[e][g],g=this.grid[a][g],h=new THREE.UV(a/this.segmentsR,b/this.segmentsT),j=new THREE.UV((a+1)/this.segmentsR,b/this.segmentsT),l=new THREE.UV((a+1)/this.segmentsR,(b+1)/this.segmentsT),m=new THREE.UV(a/this.segmentsR,(b+1)/this.segmentsT);this.faces.push(new THREE.Face4(f,c,e,g));this.faceVertexUvs[0].push([h,j,l,m])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};
 THREE.TorusKnot.prototype=new THREE.Geometry;THREE.TorusKnot.prototype.constructor=THREE.TorusKnot;THREE.Text=function(a,b){THREE.Geometry.call(this);this.parameters=b||{};this.set(a)};THREE.Text.prototype=new THREE.Geometry;THREE.Text.prototype.constructor=THREE.Text;
 THREE.Text.prototype.set=function(a,b){this.text=a;var b=b||this.parameters,c=b.height!==void 0?b.height:50,e=b.curveSegments!==void 0?b.curveSegments:4,f=b.font!==void 0?b.font:"helvetiker";THREE.FontUtils.size=b.size!==void 0?b.size:100;THREE.FontUtils.divisions=e;THREE.FontUtils.face=f;e=THREE.FontUtils.drawText(a);vertices=e.points;faces=e.faces;contour=e.contour;this.vertices=[];this.faces=[];var e=0,g;for(g in vertices)f=vertices[g],this.vertices.push(new THREE.Vertex(new THREE.Vector3(f.x,
 f.y,0))),e++;for(g in vertices)f=vertices[g],this.vertices.push(new THREE.Vertex(new THREE.Vector3(f.x,f.y,c)));for(g in faces)c=faces[g],this.faces.push(new THREE.Face3(c[2],c[1],c[0]));for(g in faces)c=faces[g],this.faces.push(new THREE.Face3(c[0]+e,c[1]+e,c[2]+e));g=contour.length;for(var h;--g>0;){if(h){if(h.equals(contour[g])){h=null;continue}}else h=contour[g];for(c=0;c<vertices.length;c++)if(vertices[c].equals(contour[g]))break;for(f=0;f<vertices.length;f++)if(vertices[f].equals(contour[g-
 1]))break;this.faces.push(new THREE.Face4(c,f,f+e,c+e))}this.computeCentroids();this.computeFaceNormals()};
-THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},loadFace:function(a){var b=a.familyName.toLowerCase();this.faces[b]=this.faces[b]||{};this.faces[b][a.cssFontWeight]=this.faces[b][a.cssFontWeight]||{};this.faces[b][a.cssFontWeight][a.cssFontStyle]=a;return this.faces[b][a.cssFontWeight][a.cssFontStyle]=a},extractPoints:function(a){if(a.length<3)throw"not valid polygon";var b=[],
-c,e,f=[],g;for(g in a)c=a[g],b.push(c.x+","+c.y);c=b[0];c=b.slice(1).indexOf(c);c<b.length&&(c++,e=a.slice(0,c));for(holes=[];c<b.length;){firstIndex=c+1;c=b[firstIndex];c=b.slice(firstIndex+1).indexOf(c)+firstIndex;if(c<=firstIndex)break;var h=a.slice(firstIndex,c+1);this.Triangulate.area(h)<0?(f.push({shape:e,holes:holes}),e=h,holes=[]):holes.push(h);c++}f.push({shape:e,holes:holes});var b=[],k;for(k in f){c=f[k];e=c.shape;holes=c.holes;for(var j in holes){var a=holes[j],h=Number.POSITIVE_INFINITY,
-m,l,n;for(n in a){var t=a[n];for(g in e)d=t.distanceTo(e[g]),d<h&&(h=d,m=n,l=g)}prevShapeVert=l-1>=0?l-1:e.length-1;nextShapeVert=l+1<e.length?l+1:0;prevHoleVert=m-1>=0?m-1:a.length-1;nextHoleVert=m+1<a.length?m+1:0;var h=e.slice(0,l),t=e.slice(l),p=a.slice(m),u=a.slice(0,m);b.push(a[m]);b.push(e[l]);b.push(e[prevShapeVert]);b.push(a[m]);b.push(a[prevHoleVert]);b.push(e[l]);e=h.concat(p).concat(u).concat(t)}c.shape=e}a=[];g=[];m=0;for(k in f){c=f[k];e=c.shape;a=a.concat(e);l=THREE.FontUtils.Triangulate(e,
-!0);for(var w in l)j=l[w],j[0]+=m,j[1]+=m,j[2]+=m;g=g.concat(l);m+=e.length}for(w=0;w<b.length/3;w++){j=[];for(f=0;f<3;f++){k=!1;for(e=0;e<a.length&&!k;e++){var v=w*3+f;a[e].equals(b[v])&&(j.push(e),k=!0)}k||(a.push(b[v]),j.push(a.length-1))}g.push(j)}return{points:a,faces:g}},drawText:function(a){pts=[];for(var b=this.getFace(),c=this.size/b.resolution,e=0,f=String(a).split(""),g=f.length,a=0;a<g;a++)e+=this.extractGlyphPoints(f[a],b,c,e);width=e/2;for(var h in pts)pts[h].x-=width;b=this.extractPoints(pts);
-b.contour=pts;return b},b2p0:function(a,b){return(1-a)*(1-a)*b},b2p1:function(a,b){return 2*(1-a)*a*b},b2p2:function(a,b){return a*a*b},b2:function(a,b,c,e){return this.b2p0(a,b)+this.b2p1(a,c)+this.b2p2(a,e)},b3p0:function(a,b){var c=1-a;return c*c*c*b},b3p1:function(a,b){var c=1-a;return 3*c*c*a*b},b3p2:function(a,b){return 3*(1-a)*a*a*b},b3p3:function(a,b){return a*a*a*b},b3:function(a,b,c,e,f){return this.b3p0(a,b)+this.b3p1(a,c)+this.b3p2(a,e)+this.b3p3(a,f)},extractGlyphPoints:function(a,b,
-c,e){var f,g,h,k=b.glyphs[a]||b.glyphs[ctxt.options.fallbackCharacter];if(k){if(k.o){b=k._cachedOutline||(k._cachedOutline=k.o.split(" "));h=b.length;for(a=0;a<h;)switch(f=b[a++],f){case "m":x=b[a++]*c+e;y=b[a++]*c;pts.push(new THREE.Vector2(x,y));break;case "l":x=b[a++]*c+e;y=b[a++]*c;pts.push(new THREE.Vector2(x,y));break;case "q":f=b[a++]*c+e;g=b[a++]*c;cpx1=b[a++]*c+e;cpy1=b[a++]*c;var j=pts[pts.length-1];if(j){cpx0=j.x;cpy0=j.y;for(var j=1,m=this.divisions;j<=m;j++){var l=j/m,n=THREE.FontUtils.b2(l,
-cpx0,cpx1,f),l=THREE.FontUtils.b2(l,cpy0,cpy1,g);pts.push(new THREE.Vector2(n,l))}}break;case "b":if(f=b[a++]*c+e,g=b[a++]*c,cpx1=b[a++]*c+e,cpy1=b[a++]*-c,cpx2=b[a++]*c+e,cpy2=b[a++]*-c,j=pts[pts.length-1]){cpx0=j.x;cpy0=j.y;j=1;for(m=this.divisions;j<=m;j++)l=j/m,n=THREE.FontUtils.b3(l,cpx0,cpx1,cpx2,f),l=THREE.FontUtils.b3(l,cpy0,cpy1,cpy2,g),pts.push(new THREE.Vector2(n,l))}}}return k.ha*c}}};
-(function(a){var b=function(a){for(var b=a.length,f=0,g=b-1,h=0;h<b;g=h++)f+=a[g].x*a[h].y-a[h].x*a[g].y;return f*0.5};a.Triangulate=function(a,e){var f=[],g=a.length;if(g<3)return null;var h=[],k=[],j;if(0<b(a))for(j=0;j<g;j++)h[j]=j;else for(j=0;j<g;j++)h[j]=g-1-j;var m=2*g,l;l=0;for(j=g-1;g>2;){if(0>=m--)throw"Warning, unable to triangulate polygon!";var n=j;g<=n&&(n=0);j=n+1;g<=j&&(j=0);var t=j+1;g<=t&&(t=0);var p;a:{p=a;var u=n,w=j,v=t,B=g,z=h,o=void 0,A=void 0,C=void 0,F=void 0,G=void 0,H=void 0,
-I=void 0,E=void 0,M=void 0,A=p[z[u]].x,C=p[z[u]].y,F=p[z[w]].x,G=p[z[w]].y,H=p[z[v]].x,I=p[z[v]].y;if(1.0E-10>(F-A)*(I-C)-(G-C)*(H-A))p=!1;else{for(o=0;o<B;o++)if(!(o==u||o==w||o==v)){var E=p[z[o]].x,M=p[z[o]].y,K=void 0,N=void 0,L=void 0,O=void 0,D=void 0,J=void 0,P=void 0,Q=void 0,S=void 0,T=void 0,U=void 0,V=void 0,K=L=D=void 0,K=H-F,N=I-G,L=A-H,O=C-I,D=F-A,J=G-C,P=E-A,Q=M-C,S=E-F,T=M-G,U=E-H,V=M-I,K=K*T-N*S,D=D*Q-J*P,L=L*V-O*U;if(K>=0&&L>=0&&D>=0){p=!1;break a}}p=!0}}if(p){m=h[n];p=h[j];u=h[t];
-f.push(a[m]);f.push(a[p]);f.push(a[u]);k.push([h[n],h[j],h[t]]);l++;n=j;for(t=j+1;t<g;n++,t++)h[n]=h[t];g--;m=2*g}}if(e)return k;return f};a.Triangulate.area=b;return a})(THREE.FontUtils);window._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
+THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},loadFace:function(a){var b=a.familyName.toLowerCase();this.faces[b]=this.faces[b]||{};this.faces[b][a.cssFontWeight]=this.faces[b][a.cssFontWeight]||{};this.faces[b][a.cssFontWeight][a.cssFontStyle]=a;return this.faces[b][a.cssFontWeight][a.cssFontStyle]=a},extractPoints:function(a,b){if(a.length<3)throw"not valid polygon";var c,
+e,f,g=[],h;for(h in b){a=b[h];c=[];for(var k in a)e=a[k],c.push(e.x+","+e.y);var j;j=c.slice(1).indexOf(c[0]);var l=this.Triangulate.area(a.slice(0,j+1))<0;e=[];for(j=-1;j<c.length;){firstIndex=j+1;j=c[firstIndex];j=c.slice(firstIndex+1).indexOf(j)+firstIndex;if(j<=firstIndex)break;var m=a.slice(firstIndex,j+1);l?this.Triangulate.area(m)<0?(firstIndex>0&&g.push({shape:f,holes:e}),f=m,e=[]):e.push(m):this.Triangulate.area(m)<0?(g.push({shape:m,holes:e}),e=[]):e.push(m);j++}l&&g.push({shape:f,holes:e})}c=
+[];for(var n in g){h=g[n];f=h.shape;e=h.holes;for(var t in e){l=e[t];j=Number.POSITIVE_INFINITY;var p,u,z;for(z in l)for(k in m=l[z],f)d=m.distanceTo(f[k]),d<j&&(j=d,p=z,u=k);prevShapeVert=u-1>=0?u-1:f.length-1;nextShapeVert=u+1<f.length?u+1:0;prevHoleVert=p-1>=0?p-1:l.length-1;nextHoleVert=p+1<l.length?p+1:0;j=f.slice(0,u);var m=f.slice(u),w=l.slice(p),B=l.slice(0,p);c.push(l[p]);c.push(f[u]);c.push(f[prevShapeVert]);c.push(l[p]);c.push(l[prevHoleVert]);c.push(f[u]);f=j.concat(w).concat(B).concat(m)}h.shape=
+f}a=[];k=[];p=0;for(n in g){h=g[n];f=h.shape;a=a.concat(f);u=THREE.FontUtils.Triangulate(f,!0);for(var v in u)t=u[v],t[0]+=p,t[1]+=p,t[2]+=p;k=k.concat(u);p+=f.length}for(v=0;v<c.length/3;v++){t=[];for(g=0;g<3;g++){n=!1;for(f=0;f<a.length&&!n;f++){var o=v*3+g;a[f].equals(c[o])&&(t.push(f),n=!0)}n||(a.push(c[o]),t.push(a.length-1))}k.push(t)}return{points:a,faces:k}},drawText:function(a){for(var b=[],c=[],e=this.getFace(),f=this.size/e.resolution,g=0,h=String(a).split(""),k=h.length,a=0;a<k;a++)ret=
+this.extractGlyphPoints(h[a],e,f,g),g+=ret.offset,b.push(ret.points),c=c.concat(ret.points);width=g/2;for(var j in c)c[j].x-=width;b=this.extractPoints(c,b);b.contour=c;return b},b2p0:function(a,b){return(1-a)*(1-a)*b},b2p1:function(a,b){return 2*(1-a)*a*b},b2p2:function(a,b){return a*a*b},b2:function(a,b,c,e){return this.b2p0(a,b)+this.b2p1(a,c)+this.b2p2(a,e)},b3p0:function(a,b){var c=1-a;return c*c*c*b},b3p1:function(a,b){var c=1-a;return 3*c*c*a*b},b3p2:function(a,b){return 3*(1-a)*a*a*b},b3p3:function(a,
+b){return a*a*a*b},b3:function(a,b,c,e,f){return this.b3p0(a,b)+this.b3p1(a,c)+this.b3p2(a,e)+this.b3p3(a,f)},extractGlyphPoints:function(a,b,c,e){var f,g,h,k=b.glyphs[a]||b.glyphs[ctxt.options.fallbackCharacter],j=[];if(k){if(k.o){b=k._cachedOutline||(k._cachedOutline=k.o.split(" "));h=b.length;for(a=0;a<h;)switch(f=b[a++],f){case "m":x=b[a++]*c+e;y=b[a++]*c;j.push(new THREE.Vector2(x,y));break;case "l":x=b[a++]*c+e;y=b[a++]*c;j.push(new THREE.Vector2(x,y));break;case "q":f=b[a++]*c+e;g=b[a++]*c;
+cpx1=b[a++]*c+e;cpy1=b[a++]*c;var l=j[j.length-1];if(l){cpx0=l.x;cpy0=l.y;for(var l=1,m=this.divisions;l<=m;l++){var n=l/m,t=THREE.FontUtils.b2(n,cpx0,cpx1,f),n=THREE.FontUtils.b2(n,cpy0,cpy1,g);j.push(new THREE.Vector2(t,n))}}break;case "b":if(f=b[a++]*c+e,g=b[a++]*c,cpx1=b[a++]*c+e,cpy1=b[a++]*-c,cpx2=b[a++]*c+e,cpy2=b[a++]*-c,l=j[j.length-1]){cpx0=l.x;cpy0=l.y;l=1;for(m=this.divisions;l<=m;l++)n=l/m,t=THREE.FontUtils.b3(n,cpx0,cpx1,cpx2,f),n=THREE.FontUtils.b3(n,cpy0,cpy1,cpy2,g),j.push(new THREE.Vector2(t,
+n))}}}return{offset:k.ha*c,points:j}}}};
+(function(a){var b=function(a){for(var b=a.length,f=0,g=b-1,h=0;h<b;g=h++)f+=a[g].x*a[h].y-a[h].x*a[g].y;return f*0.5};a.Triangulate=function(a,e){var f=[],g=a.length;if(g<3)return null;var h=[],k=[],j;if(0<b(a))for(j=0;j<g;j++)h[j]=j;else for(j=0;j<g;j++)h[j]=g-1-j;var l=2*g,m;m=0;for(j=g-1;g>2;){if(0>=l--)throw"Warning, unable to triangulate polygon!";var n=j;g<=n&&(n=0);j=n+1;g<=j&&(j=0);var t=j+1;g<=t&&(t=0);var p;a:{p=a;var u=n,z=j,w=t,B=g,v=h,o=void 0,A=void 0,C=void 0,F=void 0,G=void 0,H=void 0,
+I=void 0,E=void 0,M=void 0,A=p[v[u]].x,C=p[v[u]].y,F=p[v[z]].x,G=p[v[z]].y,H=p[v[w]].x,I=p[v[w]].y;if(1.0E-10>(F-A)*(I-C)-(G-C)*(H-A))p=!1;else{for(o=0;o<B;o++)if(!(o==u||o==z||o==w)){var E=p[v[o]].x,M=p[v[o]].y,K=void 0,N=void 0,L=void 0,O=void 0,D=void 0,J=void 0,P=void 0,Q=void 0,S=void 0,T=void 0,U=void 0,V=void 0,K=L=D=void 0,K=H-F,N=I-G,L=A-H,O=C-I,D=F-A,J=G-C,P=E-A,Q=M-C,S=E-F,T=M-G,U=E-H,V=M-I,K=K*T-N*S,D=D*Q-J*P,L=L*V-O*U;if(K>=0&&L>=0&&D>=0){p=!1;break a}}p=!0}}if(p){l=h[n];p=h[j];u=h[t];
+f.push(a[l]);f.push(a[p]);f.push(a[u]);k.push([h[n],h[j],h[t]]);m++;n=j;for(t=j+1;t<g;n++,t++)h[n]=h[t];g--;l=2*g}}if(e)return k;return f};a.Triangulate.area=b;return a})(THREE.FontUtils);window._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
 THREE.Loader.prototype={addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var b="Loaded ";b+=a.total?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/1E3).toFixed(2)+" KB";
 this.statusDomElement.innerHTML=b},extractUrlbase:function(a){a=a.split("/");a.pop();return a.join("/")},init_materials:function(a,b,c){a.materials=[];for(var e=0;e<b.length;++e)a.materials[e]=[THREE.Loader.prototype.createMaterial(b[e],c)]},createMaterial:function(a,b){function c(a){a=Math.log(a)/Math.LN2;return Math.floor(a)==a}function e(a,b){var e=new Image;e.onload=function(){if(!c(this.width)||!c(this.height)){var b=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),e=Math.pow(2,Math.round(Math.log(this.height)/
 Math.LN2));a.image.width=b;a.image.height=e;a.image.getContext("2d").drawImage(this,0,0,b,e)}else a.image=this;a.needsUpdate=!0};e.src=b}var f,g,h;f="MeshLambertMaterial";g={color:15658734,opacity:1,map:null,lightMap:null,wireframe:a.wireframe};a.shading&&(a.shading=="Phong"?f="MeshPhongMaterial":a.shading=="Basic"&&(f="MeshBasicMaterial"));if(a.blending)if(a.blending=="Additive")g.blending=THREE.AdditiveBlending;else if(a.blending=="Subtractive")g.blending=THREE.SubtractiveBlending;else if(a.blending==
 "Multiply")g.blending=THREE.MultiplyBlending;if(a.transparent!==void 0||a.opacity<1)g.transparent=a.transparent;if(a.depthTest!==void 0)g.depthTest=a.depthTest;if(a.vertexColors!==void 0)if(a.vertexColors=="face")g.vertexColors=THREE.FaceColors;else if(a.vertexColors)g.vertexColors=THREE.VertexColors;if(a.mapDiffuse&&b)h=document.createElement("canvas"),g.map=new THREE.Texture(h),g.map.sourceFile=a.mapDiffuse,e(g.map,b+"/"+a.mapDiffuse);else if(a.colorDiffuse)h=(a.colorDiffuse[0]*255<<16)+(a.colorDiffuse[1]*
 255<<8)+a.colorDiffuse[2]*255,g.color=h,g.opacity=a.transparency;else if(a.DbgColor)g.color=a.DbgColor;if(a.mapLightmap&&b)h=document.createElement("canvas"),g.lightMap=new THREE.Texture(h),g.lightMap.sourceFile=a.mapLightmap,e(g.lightMap,b+"/"+a.mapLightmap);return new THREE[f](g)}};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 b=this,c=a.model,e=a.callback,f=a.texture_path?a.texture_path:this.extractUrlbase(c),a=new Worker(c);a.onmessage=function(a){b.createModel(a.data,e,f);b.onLoadComplete()};this.onLoadStart();a.postMessage((new Date).getTime())};
-THREE.JSONLoader.prototype.createModel=function(a,b,c){var e=new THREE.Geometry,f=a.scale!==void 0?1/a.scale:1;this.init_materials(e,a.materials,c);(function(c){if(a.version===void 0||a.version!=2)console.error("Deprecated file format.");else{var b,f,j,m,l,n,t,p,u,w,v,B,z,o,A=a.faces;n=a.vertices;var C=a.normals,F=a.colors,G=0;for(b=0;b<a.uvs.length;b++)a.uvs[b].length&&G++;for(b=0;b<G;b++)e.faceUvs[b]=[],e.faceVertexUvs[b]=[];m=0;for(l=n.length;m<l;)t=new THREE.Vertex,t.position.x=n[m++]*c,t.position.y=
-n[m++]*c,t.position.z=n[m++]*c,e.vertices.push(t);m=0;for(l=A.length;m<l;){c=A[m++];n=c&1;j=c&2;b=c&4;f=c&8;p=c&16;t=c&32;w=c&64;c&=128;n?(v=new THREE.Face4,v.a=A[m++],v.b=A[m++],v.c=A[m++],v.d=A[m++],n=4):(v=new THREE.Face3,v.a=A[m++],v.b=A[m++],v.c=A[m++],n=3);if(j)j=A[m++],v.materials=e.materials[j];j=e.faces.length;if(b)for(b=0;b<G;b++)B=a.uvs[b],u=A[m++],o=B[u*2],u=B[u*2+1],e.faceUvs[b][j]=new THREE.UV(o,u);if(f)for(b=0;b<G;b++){B=a.uvs[b];z=[];for(f=0;f<n;f++)u=A[m++],o=B[u*2],u=B[u*2+1],z[f]=
-new THREE.UV(o,u);e.faceVertexUvs[b][j]=z}if(p)p=A[m++]*3,f=new THREE.Vector3,f.x=C[p++],f.y=C[p++],f.z=C[p],v.normal=f;if(t)for(b=0;b<n;b++)p=A[m++]*3,f=new THREE.Vector3,f.x=C[p++],f.y=C[p++],f.z=C[p],v.vertexNormals.push(f);if(w)t=A[m++],t=new THREE.Color(F[t]),v.color=t;if(c)for(b=0;b<n;b++)t=A[m++],t=new THREE.Color(F[t]),v.vertexColors.push(t);e.faces.push(v)}}})(f);(function(){var c,b,f,j;if(a.skinWeights){c=0;for(b=a.skinWeights.length;c<b;c+=2)f=a.skinWeights[c],j=a.skinWeights[c+1],e.skinWeights.push(new THREE.Vector4(f,
-j,0,0))}if(a.skinIndices){c=0;for(b=a.skinIndices.length;c<b;c+=2)f=a.skinIndices[c],j=a.skinIndices[c+1],e.skinIndices.push(new THREE.Vector4(f,j,0,0))}e.bones=a.bones;e.animation=a.animation})();(function(c){if(a.morphTargets!==void 0){var b,f,j,m,l,n,t,p,u;b=0;for(f=a.morphTargets.length;b<f;b++){e.morphTargets[b]={};e.morphTargets[b].name=a.morphTargets[b].name;e.morphTargets[b].vertices=[];p=e.morphTargets[b].vertices;u=a.morphTargets[b].vertices;j=0;for(m=u.length;j<m;j+=3)l=u[j]*c,n=u[j+1]*
-c,t=u[j+2]*c,p.push(new THREE.Vertex(new THREE.Vector3(l,n,t)))}}if(a.morphColors!==void 0){b=0;for(f=a.morphColors.length;b<f;b++){e.morphColors[b]={};e.morphColors[b].name=a.morphColors[b].name;e.morphColors[b].colors=[];m=e.morphColors[b].colors;l=a.morphColors[b].colors;c=0;for(j=l.length;c<j;c+=3)n=new THREE.Color(16755200),n.setRGB(l[c],l[c+1],l[c+2]),m.push(n)}}})(f);(function(){if(a.edges!==void 0){var c,b,f;for(c=0;c<a.edges.length;c+=2)b=a.edges[c],f=a.edges[c+1],e.edges.push(new THREE.Edge(e.vertices[b],
+THREE.JSONLoader.prototype.createModel=function(a,b,c){var e=new THREE.Geometry,f=a.scale!==void 0?1/a.scale:1;this.init_materials(e,a.materials,c);(function(c){if(a.version===void 0||a.version!=2)console.error("Deprecated file format.");else{var b,f,j,l,m,n,t,p,u,z,w,B,v,o,A=a.faces;n=a.vertices;var C=a.normals,F=a.colors,G=0;for(b=0;b<a.uvs.length;b++)a.uvs[b].length&&G++;for(b=0;b<G;b++)e.faceUvs[b]=[],e.faceVertexUvs[b]=[];l=0;for(m=n.length;l<m;)t=new THREE.Vertex,t.position.x=n[l++]*c,t.position.y=
+n[l++]*c,t.position.z=n[l++]*c,e.vertices.push(t);l=0;for(m=A.length;l<m;){c=A[l++];n=c&1;j=c&2;b=c&4;f=c&8;p=c&16;t=c&32;z=c&64;c&=128;n?(w=new THREE.Face4,w.a=A[l++],w.b=A[l++],w.c=A[l++],w.d=A[l++],n=4):(w=new THREE.Face3,w.a=A[l++],w.b=A[l++],w.c=A[l++],n=3);if(j)j=A[l++],w.materials=e.materials[j];j=e.faces.length;if(b)for(b=0;b<G;b++)B=a.uvs[b],u=A[l++],o=B[u*2],u=B[u*2+1],e.faceUvs[b][j]=new THREE.UV(o,u);if(f)for(b=0;b<G;b++){B=a.uvs[b];v=[];for(f=0;f<n;f++)u=A[l++],o=B[u*2],u=B[u*2+1],v[f]=
+new THREE.UV(o,u);e.faceVertexUvs[b][j]=v}if(p)p=A[l++]*3,f=new THREE.Vector3,f.x=C[p++],f.y=C[p++],f.z=C[p],w.normal=f;if(t)for(b=0;b<n;b++)p=A[l++]*3,f=new THREE.Vector3,f.x=C[p++],f.y=C[p++],f.z=C[p],w.vertexNormals.push(f);if(z)t=A[l++],t=new THREE.Color(F[t]),w.color=t;if(c)for(b=0;b<n;b++)t=A[l++],t=new THREE.Color(F[t]),w.vertexColors.push(t);e.faces.push(w)}}})(f);(function(){var c,b,f,j;if(a.skinWeights){c=0;for(b=a.skinWeights.length;c<b;c+=2)f=a.skinWeights[c],j=a.skinWeights[c+1],e.skinWeights.push(new THREE.Vector4(f,
+j,0,0))}if(a.skinIndices){c=0;for(b=a.skinIndices.length;c<b;c+=2)f=a.skinIndices[c],j=a.skinIndices[c+1],e.skinIndices.push(new THREE.Vector4(f,j,0,0))}e.bones=a.bones;e.animation=a.animation})();(function(c){if(a.morphTargets!==void 0){var b,f,j,l,m,n,t,p,u;b=0;for(f=a.morphTargets.length;b<f;b++){e.morphTargets[b]={};e.morphTargets[b].name=a.morphTargets[b].name;e.morphTargets[b].vertices=[];p=e.morphTargets[b].vertices;u=a.morphTargets[b].vertices;j=0;for(l=u.length;j<l;j+=3)m=u[j]*c,n=u[j+1]*
+c,t=u[j+2]*c,p.push(new THREE.Vertex(new THREE.Vector3(m,n,t)))}}if(a.morphColors!==void 0){b=0;for(f=a.morphColors.length;b<f;b++){e.morphColors[b]={};e.morphColors[b].name=a.morphColors[b].name;e.morphColors[b].colors=[];l=e.morphColors[b].colors;m=a.morphColors[b].colors;c=0;for(j=m.length;c<j;c+=3)n=new THREE.Color(16755200),n.setRGB(m[c],m[c+1],m[c+2]),l.push(n)}}})(f);(function(){if(a.edges!==void 0){var c,b,f;for(c=0;c<a.edges.length;c+=2)b=a.edges[c],f=a.edges[c+1],e.edges.push(new THREE.Edge(e.vertices[b],
 e.vertices[f],b,f))}})();e.computeCentroids();e.computeFaceNormals();b(e)};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 b=a.model,c=a.callback,e=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(b),f=a.bin_path?a.bin_path:THREE.Loader.prototype.extractUrlbase(b),a=(new Date).getTime(),b=new Worker(b),g=this.showProgress?THREE.Loader.prototype.updateProgress:null;b.onmessage=function(a){THREE.BinaryLoader.prototype.loadAjaxBuffers(a.data.buffers,a.data.materials,c,f,e,g)};b.onerror=function(a){alert("worker.onerror: "+a.message+"\n"+a.data);a.preventDefault()};
 b.postMessage(a)},loadAjaxBuffers:function(a,b,c,e,f,g){var h=new XMLHttpRequest,k=e+"/"+a,j=0;h.onreadystatechange=function(){h.readyState==4?h.status==200||h.status==0?THREE.BinaryLoader.prototype.createBinModel(h.responseText,c,f,b):alert("Couldn't load ["+k+"] ["+h.status+"]"):h.readyState==3?g&&(j==0&&(j=h.getResponseHeader("Content-Length")),g({total:j,loaded:h.responseText.length})):h.readyState==2&&(j=h.getResponseHeader("Content-Length"))};h.open("GET",k,!0);h.overrideMimeType("text/plain; charset=x-user-defined");
-h.setRequestHeader("Content-Type","text/plain");h.send(null)},createBinModel:function(a,b,c,e){var f=function(c){function b(a,c){var e=l(a,c),f=l(a,c+1),g=l(a,c+2),h=l(a,c+3),j=(h<<1&255|g>>7)-127;e|=(g&127)<<16|f<<8;if(e==0&&j==-127)return 0;return(1-2*(h>>7))*(1+e*Math.pow(2,-23))*Math.pow(2,j)}function f(a,c){var b=l(a,c),e=l(a,c+1),g=l(a,c+2);return(l(a,c+3)<<24)+(g<<16)+(e<<8)+b}function j(a,c){var b=l(a,c);return(l(a,c+1)<<8)+b}function m(a,c){var b=l(a,c);return b>127?b-256:b}function l(a,
+h.setRequestHeader("Content-Type","text/plain");h.send(null)},createBinModel:function(a,b,c,e){var f=function(c){function b(a,c){var e=m(a,c),f=m(a,c+1),g=m(a,c+2),h=m(a,c+3),j=(h<<1&255|g>>7)-127;e|=(g&127)<<16|f<<8;if(e==0&&j==-127)return 0;return(1-2*(h>>7))*(1+e*Math.pow(2,-23))*Math.pow(2,j)}function f(a,c){var b=m(a,c),e=m(a,c+1),g=m(a,c+2);return(m(a,c+3)<<24)+(g<<16)+(e<<8)+b}function j(a,c){var b=m(a,c);return(m(a,c+1)<<8)+b}function l(a,c){var b=m(a,c);return b>127?b-256:b}function m(a,
 c){return a.charCodeAt(c)&255}function n(c){var b,e,g;b=f(a,c);e=f(a,c+F);g=f(a,c+G);c=j(a,c+H);THREE.BinaryLoader.prototype.f3(B,b,e,g,c)}function t(c){var b,e,g,h,l,m;b=f(a,c);e=f(a,c+F);g=f(a,c+G);h=j(a,c+H);l=f(a,c+I);m=f(a,c+E);c=f(a,c+M);THREE.BinaryLoader.prototype.f3n(B,A,b,e,g,h,l,m,c)}function p(c){var b,e,g,h;b=f(a,c);e=f(a,c+K);g=f(a,c+N);h=f(a,c+L);c=j(a,c+O);THREE.BinaryLoader.prototype.f4(B,b,e,g,h,c)}function u(c){var b,e,g,h,l,m,n,o;b=f(a,c);e=f(a,c+K);g=f(a,c+N);h=f(a,c+L);l=j(a,
-c+O);m=f(a,c+D);n=f(a,c+J);o=f(a,c+P);c=f(a,c+Q);THREE.BinaryLoader.prototype.f4n(B,A,b,e,g,h,l,m,n,o,c)}function w(c){var b,e;b=f(a,c);e=f(a,c+S);c=f(a,c+T);THREE.BinaryLoader.prototype.uv3(B.faceVertexUvs[0],C[b*2],C[b*2+1],C[e*2],C[e*2+1],C[c*2],C[c*2+1])}function v(c){var b,e,g;b=f(a,c);e=f(a,c+U);g=f(a,c+V);c=f(a,c+aa);THREE.BinaryLoader.prototype.uv4(B.faceVertexUvs[0],C[b*2],C[b*2+1],C[e*2],C[e*2+1],C[g*2],C[g*2+1],C[c*2],C[c*2+1])}var B=this,z=0,o,A=[],C=[],F,G,H,I,E,M,K,N,L,O,D,J,P,Q,S,T,
-U,V,aa,W,X,Y,Z,$,R;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(B,e,c);o={signature:a.substr(z,8),header_bytes:l(a,z+8),vertex_coordinate_bytes:l(a,z+9),normal_coordinate_bytes:l(a,z+10),uv_coordinate_bytes:l(a,z+11),vertex_index_bytes:l(a,z+12),normal_index_bytes:l(a,z+13),uv_index_bytes:l(a,z+14),material_index_bytes:l(a,z+15),nvertices:f(a,z+16),nnormals:f(a,z+16+4),nuvs:f(a,z+16+8),ntri_flat:f(a,z+16+12),ntri_smooth:f(a,z+16+16),ntri_flat_uv:f(a,z+16+20),ntri_smooth_uv:f(a,
-z+16+24),nquad_flat:f(a,z+16+28),nquad_smooth:f(a,z+16+32),nquad_flat_uv:f(a,z+16+36),nquad_smooth_uv:f(a,z+16+40)};z+=o.header_bytes;F=o.vertex_index_bytes;G=o.vertex_index_bytes*2;H=o.vertex_index_bytes*3;I=o.vertex_index_bytes*3+o.material_index_bytes;E=o.vertex_index_bytes*3+o.material_index_bytes+o.normal_index_bytes;M=o.vertex_index_bytes*3+o.material_index_bytes+o.normal_index_bytes*2;K=o.vertex_index_bytes;N=o.vertex_index_bytes*2;L=o.vertex_index_bytes*3;O=o.vertex_index_bytes*4;D=o.vertex_index_bytes*
+c+O);m=f(a,c+D);n=f(a,c+J);o=f(a,c+P);c=f(a,c+Q);THREE.BinaryLoader.prototype.f4n(B,A,b,e,g,h,l,m,n,o,c)}function z(c){var b,e;b=f(a,c);e=f(a,c+S);c=f(a,c+T);THREE.BinaryLoader.prototype.uv3(B.faceVertexUvs[0],C[b*2],C[b*2+1],C[e*2],C[e*2+1],C[c*2],C[c*2+1])}function w(c){var b,e,g;b=f(a,c);e=f(a,c+U);g=f(a,c+V);c=f(a,c+aa);THREE.BinaryLoader.prototype.uv4(B.faceVertexUvs[0],C[b*2],C[b*2+1],C[e*2],C[e*2+1],C[g*2],C[g*2+1],C[c*2],C[c*2+1])}var B=this,v=0,o,A=[],C=[],F,G,H,I,E,M,K,N,L,O,D,J,P,Q,S,T,
+U,V,aa,W,X,Y,Z,$,R;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(B,e,c);o={signature:a.substr(v,8),header_bytes:m(a,v+8),vertex_coordinate_bytes:m(a,v+9),normal_coordinate_bytes:m(a,v+10),uv_coordinate_bytes:m(a,v+11),vertex_index_bytes:m(a,v+12),normal_index_bytes:m(a,v+13),uv_index_bytes:m(a,v+14),material_index_bytes:m(a,v+15),nvertices:f(a,v+16),nnormals:f(a,v+16+4),nuvs:f(a,v+16+8),ntri_flat:f(a,v+16+12),ntri_smooth:f(a,v+16+16),ntri_flat_uv:f(a,v+16+20),ntri_smooth_uv:f(a,
+v+16+24),nquad_flat:f(a,v+16+28),nquad_smooth:f(a,v+16+32),nquad_flat_uv:f(a,v+16+36),nquad_smooth_uv:f(a,v+16+40)};v+=o.header_bytes;F=o.vertex_index_bytes;G=o.vertex_index_bytes*2;H=o.vertex_index_bytes*3;I=o.vertex_index_bytes*3+o.material_index_bytes;E=o.vertex_index_bytes*3+o.material_index_bytes+o.normal_index_bytes;M=o.vertex_index_bytes*3+o.material_index_bytes+o.normal_index_bytes*2;K=o.vertex_index_bytes;N=o.vertex_index_bytes*2;L=o.vertex_index_bytes*3;O=o.vertex_index_bytes*4;D=o.vertex_index_bytes*
 4+o.material_index_bytes;J=o.vertex_index_bytes*4+o.material_index_bytes+o.normal_index_bytes;P=o.vertex_index_bytes*4+o.material_index_bytes+o.normal_index_bytes*2;Q=o.vertex_index_bytes*4+o.material_index_bytes+o.normal_index_bytes*3;S=o.uv_index_bytes;T=o.uv_index_bytes*2;U=o.uv_index_bytes;V=o.uv_index_bytes*2;aa=o.uv_index_bytes*3;c=o.vertex_index_bytes*3+o.material_index_bytes;R=o.vertex_index_bytes*4+o.material_index_bytes;W=o.ntri_flat*c;X=o.ntri_smooth*(c+o.normal_index_bytes*3);Y=o.ntri_flat_uv*
-(c+o.uv_index_bytes*3);Z=o.ntri_smooth_uv*(c+o.normal_index_bytes*3+o.uv_index_bytes*3);$=o.nquad_flat*R;c=o.nquad_smooth*(R+o.normal_index_bytes*4);R=o.nquad_flat_uv*(R+o.uv_index_bytes*4);z+=function(c){for(var e,f,g,j=o.vertex_coordinate_bytes*3,k=c+o.nvertices*j;c<k;c+=j)e=b(a,c),f=b(a,c+o.vertex_coordinate_bytes),g=b(a,c+o.vertex_coordinate_bytes*2),THREE.BinaryLoader.prototype.v(B,e,f,g);return o.nvertices*j}(z);z+=function(c){for(var b,e,f,g=o.normal_coordinate_bytes*3,h=c+o.nnormals*g;c<h;c+=
-g)b=m(a,c),e=m(a,c+o.normal_coordinate_bytes),f=m(a,c+o.normal_coordinate_bytes*2),A.push(b/127,e/127,f/127);return o.nnormals*g}(z);z+=function(c){for(var e,f,g=o.uv_coordinate_bytes*2,j=c+o.nuvs*g;c<j;c+=g)e=b(a,c),f=b(a,c+o.uv_coordinate_bytes),C.push(e,f);return o.nuvs*g}(z);W=z+W;X=W+X;Y=X+Y;Z=Y+Z;$=Z+$;c=$+c;R=c+R;(function(a){var c,b=o.vertex_index_bytes*3+o.material_index_bytes,e=b+o.uv_index_bytes*3,f=a+o.ntri_flat_uv*e;for(c=a;c<f;c+=e)n(c),w(c+b);return f-a})(X);(function(a){var c,b=o.vertex_index_bytes*
-3+o.material_index_bytes+o.normal_index_bytes*3,e=b+o.uv_index_bytes*3,f=a+o.ntri_smooth_uv*e;for(c=a;c<f;c+=e)t(c),w(c+b);return f-a})(Y);(function(a){var c,b=o.vertex_index_bytes*4+o.material_index_bytes,e=b+o.uv_index_bytes*4,f=a+o.nquad_flat_uv*e;for(c=a;c<f;c+=e)p(c),v(c+b);return f-a})(c);(function(a){var c,b=o.vertex_index_bytes*4+o.material_index_bytes+o.normal_index_bytes*4,e=b+o.uv_index_bytes*4,f=a+o.nquad_smooth_uv*e;for(c=a;c<f;c+=e)u(c),v(c+b);return f-a})(R);(function(a){var c,b=o.vertex_index_bytes*
-3+o.material_index_bytes,e=a+o.ntri_flat*b;for(c=a;c<e;c+=b)n(c);return e-a})(z);(function(a){var c,b=o.vertex_index_bytes*3+o.material_index_bytes+o.normal_index_bytes*3,e=a+o.ntri_smooth*b;for(c=a;c<e;c+=b)t(c);return e-a})(W);(function(a){var c,b=o.vertex_index_bytes*4+o.material_index_bytes,e=a+o.nquad_flat*b;for(c=a;c<e;c+=b)p(c);return e-a})(Z);(function(a){var c,b=o.vertex_index_bytes*4+o.material_index_bytes+o.normal_index_bytes*4,e=a+o.nquad_smooth*b;for(c=a;c<e;c+=b)u(c);return e-a})($);
-this.computeCentroids();this.computeFaceNormals()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;b(new f(c))},v:function(a,b,c,e){a.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,e)))},f3:function(a,b,c,e,f){a.faces.push(new THREE.Face3(b,c,e,null,null,a.materials[f]))},f4:function(a,b,c,e,f,g){a.faces.push(new THREE.Face4(b,c,e,f,null,null,a.materials[g]))},f3n:function(a,b,c,e,f,g,h,k,j){var g=a.materials[g],m=b[k*3],l=b[k*3+1],k=b[k*3+2],n=b[j*3],t=b[j*3+1],j=b[j*3+2];a.faces.push(new THREE.Face3(c,
-e,f,[new THREE.Vector3(b[h*3],b[h*3+1],b[h*3+2]),new THREE.Vector3(m,l,k),new THREE.Vector3(n,t,j)],null,g))},f4n:function(a,b,c,e,f,g,h,k,j,m,l){var h=a.materials[h],n=b[j*3],t=b[j*3+1],j=b[j*3+2],p=b[m*3],u=b[m*3+1],m=b[m*3+2],w=b[l*3],v=b[l*3+1],l=b[l*3+2];a.faces.push(new THREE.Face4(c,e,f,g,[new THREE.Vector3(b[k*3],b[k*3+1],b[k*3+2]),new THREE.Vector3(n,t,j),new THREE.Vector3(p,u,m),new THREE.Vector3(w,v,l)],null,h))},uv3:function(a,b,c,e,f,g,h){var k=[];k.push(new THREE.UV(b,c));k.push(new THREE.UV(e,
-f));k.push(new THREE.UV(g,h));a.push(k)},uv4:function(a,b,c,e,f,g,h,k,j){var m=[];m.push(new THREE.UV(b,c));m.push(new THREE.UV(e,f));m.push(new THREE.UV(g,h));m.push(new THREE.UV(k,j));a.push(m)}};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
-THREE.SceneLoader.prototype={load:function(a,b){var c=this,e=new Worker(a);e.postMessage(0);var f=THREE.Loader.prototype.extractUrlbase(a);e.onmessage=function(a){function e(a,c){return c=="relativeToHTML"?a:f+"/"+a}function k(){for(p in E.objects)if(!D.objects[p])if(z=E.objects[p],z.geometry!==void 0){if(F=D.geometries[z.geometry]){I=[];for(Q=0;Q<z.materials.length;Q++)I[Q]=D.materials[z.materials[Q]];o=z.position;r=z.rotation;q=z.quaternion;s=z.scale;q=0;I.length==0&&(I[0]=new THREE.MeshFaceMaterial);
-I.length>1&&(I=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(F,I);object.name=p;object.position.set(o[0],o[1],o[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=z.visible;D.scene.addObject(object);D.objects[p]=object;if(z.meshCollider){var a=THREE.CollisionUtils.MeshColliderWBox(object);D.scene.collisions.colliders.push(a)}if(z.castsShadow)a=new THREE.ShadowVolume(F),D.scene.addChild(a),
-a.position=object.position,a.rotation=object.rotation,a.scale=object.scale;z.trigger&&z.trigger.toLowerCase()!="none"&&(a={type:z.trigger,object:z},D.triggers[object.name]=a)}}else o=z.position,r=z.rotation,q=z.quaternion,s=z.scale,q=0,object=new THREE.Object3D,object.name=p,object.position.set(o[0],o[1],o[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],s[1],s[2]),object.visible=z.visible!==void 0?z.visible:!1,D.scene.addObject(object),
-D.objects[p]=object,D.empties[p]=object,z.trigger&&z.trigger.toLowerCase()!="none"&&(a={type:z.trigger,object:z},D.triggers[object.name]=a)}function j(a){return function(b){D.geometries[a]=b;k();K-=1;c.onLoadComplete();l()}}function m(a){return function(c){D.geometries[a]=c}}function l(){c.callbackProgress({totalModels:L,totalTextures:O,loadedModels:L-K,loadedTextures:O-N},D);c.onLoadProgress();K==0&&N==0&&b(D)}var n,t,p,u,w,v,B,z,o,A,C,F,G,H,I,E,M,K,N,L,O,D;E=a.data;a=new THREE.BinaryLoader;M=new THREE.JSONLoader;
-N=K=0;D={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};var J=!1;for(p in E.objects)if(z=E.objects[p],z.meshCollider){J=!0;break}if(J)D.scene.collisions=new THREE.CollisionSystem;if(E.transform){J=E.transform.position;A=E.transform.rotation;var P=E.transform.scale;J&&D.scene.position.set(J[0],J[1],J[2]);A&&D.scene.rotation.set(A[0],A[1],A[2]);P&&D.scene.scale.set(P[0],P[1],P[2]);(J||A||P)&&D.scene.updateMatrix()}J=function(){N-=
-1;l();c.onLoadComplete()};for(w in E.cameras){A=E.cameras[w];if(A.type=="perspective")G=new THREE.Camera(A.fov,A.aspect,A.near,A.far);else if(A.type=="ortho")G=new THREE.Camera,G.projectionMatrix=THREE.Matrix4.makeOrtho(A.left,A.right,A.top,A.bottom,A.near,A.far);o=A.position;A=A.target;G.position.set(o[0],o[1],o[2]);G.target.position.set(A[0],A[1],A[2]);D.cameras[w]=G}for(u in E.lights){w=E.lights[u];G=w.color!==void 0?w.color:16777215;A=w.intensity!==void 0?w.intensity:1;if(w.type=="directional")o=
-w.direction,light=new THREE.DirectionalLight(G,A),light.position.set(o[0],o[1],o[2]),light.position.normalize();else if(w.type=="point")o=w.position,light=new THREE.PointLight(G,A),light.position.set(o[0],o[1],o[2]);D.scene.addLight(light);D.lights[u]=light}for(v in E.fogs)u=E.fogs[v],u.type=="linear"?H=new THREE.Fog(0,u.near,u.far):u.type=="exp2"&&(H=new THREE.FogExp2(0,u.density)),A=u.color,H.color.setRGB(A[0],A[1],A[2]),D.fogs[v]=H;if(D.cameras&&E.defaults.camera)D.currentCamera=D.cameras[E.defaults.camera];
-if(D.fogs&&E.defaults.fog)D.scene.fog=D.fogs[E.defaults.fog];A=E.defaults.bgcolor;D.bgColor=new THREE.Color;D.bgColor.setRGB(A[0],A[1],A[2]);D.bgColorAlpha=E.defaults.bgalpha;for(n in E.geometries)if(v=E.geometries[n],v.type=="bin_mesh"||v.type=="ascii_mesh")K+=1,c.onLoadStart();L=K;for(n in E.geometries)v=E.geometries[n],v.type=="cube"?(F=new THREE.Cube(v.width,v.height,v.depth,v.segmentsWidth,v.segmentsHeight,v.segmentsDepth,null,v.flipped,v.sides),D.geometries[n]=F):v.type=="plane"?(F=new THREE.Plane(v.width,
-v.height,v.segmentsWidth,v.segmentsHeight),D.geometries[n]=F):v.type=="sphere"?(F=new THREE.Sphere(v.radius,v.segmentsWidth,v.segmentsHeight),D.geometries[n]=F):v.type=="cylinder"?(F=new THREE.Cylinder(v.numSegs,v.topRad,v.botRad,v.height,v.topOffset,v.botOffset),D.geometries[n]=F):v.type=="torus"?(F=new THREE.Torus(v.radius,v.tube,v.segmentsR,v.segmentsT),D.geometries[n]=F):v.type=="icosahedron"?(F=new THREE.Icosahedron(v.subdivisions),D.geometries[n]=F):v.type=="bin_mesh"?a.load({model:e(v.url,
-E.urlBaseType),callback:j(n)}):v.type=="ascii_mesh"?M.load({model:e(v.url,E.urlBaseType),callback:j(n)}):v.type=="embedded_mesh"&&(v=E.embeds[v.id])&&M.createModel(v,m(n),"");for(B in E.textures)if(n=E.textures[B],n.url instanceof Array){N+=n.url.length;for(a=0;a<n.url.length;a++)c.onLoadStart()}else N+=1,c.onLoadStart();O=N;for(B in E.textures){n=E.textures[B];if(n.mapping!=void 0&&THREE[n.mapping]!=void 0)n.mapping=new THREE[n.mapping];if(n.url instanceof Array){for(var a=[],Q=0;Q<n.url.length;Q++)a[Q]=
+(c+o.uv_index_bytes*3);Z=o.ntri_smooth_uv*(c+o.normal_index_bytes*3+o.uv_index_bytes*3);$=o.nquad_flat*R;c=o.nquad_smooth*(R+o.normal_index_bytes*4);R=o.nquad_flat_uv*(R+o.uv_index_bytes*4);v+=function(c){for(var e,f,g,j=o.vertex_coordinate_bytes*3,k=c+o.nvertices*j;c<k;c+=j)e=b(a,c),f=b(a,c+o.vertex_coordinate_bytes),g=b(a,c+o.vertex_coordinate_bytes*2),THREE.BinaryLoader.prototype.v(B,e,f,g);return o.nvertices*j}(v);v+=function(c){for(var b,e,f,g=o.normal_coordinate_bytes*3,h=c+o.nnormals*g;c<h;c+=
+g)b=l(a,c),e=l(a,c+o.normal_coordinate_bytes),f=l(a,c+o.normal_coordinate_bytes*2),A.push(b/127,e/127,f/127);return o.nnormals*g}(v);v+=function(c){for(var e,f,g=o.uv_coordinate_bytes*2,j=c+o.nuvs*g;c<j;c+=g)e=b(a,c),f=b(a,c+o.uv_coordinate_bytes),C.push(e,f);return o.nuvs*g}(v);W=v+W;X=W+X;Y=X+Y;Z=Y+Z;$=Z+$;c=$+c;R=c+R;(function(a){var c,b=o.vertex_index_bytes*3+o.material_index_bytes,e=b+o.uv_index_bytes*3,f=a+o.ntri_flat_uv*e;for(c=a;c<f;c+=e)n(c),z(c+b);return f-a})(X);(function(a){var c,b=o.vertex_index_bytes*
+3+o.material_index_bytes+o.normal_index_bytes*3,e=b+o.uv_index_bytes*3,f=a+o.ntri_smooth_uv*e;for(c=a;c<f;c+=e)t(c),z(c+b);return f-a})(Y);(function(a){var c,b=o.vertex_index_bytes*4+o.material_index_bytes,e=b+o.uv_index_bytes*4,f=a+o.nquad_flat_uv*e;for(c=a;c<f;c+=e)p(c),w(c+b);return f-a})(c);(function(a){var c,b=o.vertex_index_bytes*4+o.material_index_bytes+o.normal_index_bytes*4,e=b+o.uv_index_bytes*4,f=a+o.nquad_smooth_uv*e;for(c=a;c<f;c+=e)u(c),w(c+b);return f-a})(R);(function(a){var c,b=o.vertex_index_bytes*
+3+o.material_index_bytes,e=a+o.ntri_flat*b;for(c=a;c<e;c+=b)n(c);return e-a})(v);(function(a){var c,b=o.vertex_index_bytes*3+o.material_index_bytes+o.normal_index_bytes*3,e=a+o.ntri_smooth*b;for(c=a;c<e;c+=b)t(c);return e-a})(W);(function(a){var c,b=o.vertex_index_bytes*4+o.material_index_bytes,e=a+o.nquad_flat*b;for(c=a;c<e;c+=b)p(c);return e-a})(Z);(function(a){var c,b=o.vertex_index_bytes*4+o.material_index_bytes+o.normal_index_bytes*4,e=a+o.nquad_smooth*b;for(c=a;c<e;c+=b)u(c);return e-a})($);
+this.computeCentroids();this.computeFaceNormals()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;b(new f(c))},v:function(a,b,c,e){a.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,e)))},f3:function(a,b,c,e,f){a.faces.push(new THREE.Face3(b,c,e,null,null,a.materials[f]))},f4:function(a,b,c,e,f,g){a.faces.push(new THREE.Face4(b,c,e,f,null,null,a.materials[g]))},f3n:function(a,b,c,e,f,g,h,k,j){var g=a.materials[g],l=b[k*3],m=b[k*3+1],k=b[k*3+2],n=b[j*3],t=b[j*3+1],j=b[j*3+2];a.faces.push(new THREE.Face3(c,
+e,f,[new THREE.Vector3(b[h*3],b[h*3+1],b[h*3+2]),new THREE.Vector3(l,m,k),new THREE.Vector3(n,t,j)],null,g))},f4n:function(a,b,c,e,f,g,h,k,j,l,m){var h=a.materials[h],n=b[j*3],t=b[j*3+1],j=b[j*3+2],p=b[l*3],u=b[l*3+1],l=b[l*3+2],z=b[m*3],w=b[m*3+1],m=b[m*3+2];a.faces.push(new THREE.Face4(c,e,f,g,[new THREE.Vector3(b[k*3],b[k*3+1],b[k*3+2]),new THREE.Vector3(n,t,j),new THREE.Vector3(p,u,l),new THREE.Vector3(z,w,m)],null,h))},uv3:function(a,b,c,e,f,g,h){var k=[];k.push(new THREE.UV(b,c));k.push(new THREE.UV(e,
+f));k.push(new THREE.UV(g,h));a.push(k)},uv4:function(a,b,c,e,f,g,h,k,j){var l=[];l.push(new THREE.UV(b,c));l.push(new THREE.UV(e,f));l.push(new THREE.UV(g,h));l.push(new THREE.UV(k,j));a.push(l)}};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
+THREE.SceneLoader.prototype={load:function(a,b){var c=this,e=new Worker(a);e.postMessage(0);var f=THREE.Loader.prototype.extractUrlbase(a);e.onmessage=function(a){function e(a,c){return c=="relativeToHTML"?a:f+"/"+a}function k(){for(p in E.objects)if(!D.objects[p])if(v=E.objects[p],v.geometry!==void 0){if(F=D.geometries[v.geometry]){I=[];for(Q=0;Q<v.materials.length;Q++)I[Q]=D.materials[v.materials[Q]];o=v.position;r=v.rotation;q=v.quaternion;s=v.scale;q=0;I.length==0&&(I[0]=new THREE.MeshFaceMaterial);
+I.length>1&&(I=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(F,I);object.name=p;object.position.set(o[0],o[1],o[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=v.visible;D.scene.addObject(object);D.objects[p]=object;if(v.meshCollider){var a=THREE.CollisionUtils.MeshColliderWBox(object);D.scene.collisions.colliders.push(a)}if(v.castsShadow)a=new THREE.ShadowVolume(F),D.scene.addChild(a),
+a.position=object.position,a.rotation=object.rotation,a.scale=object.scale;v.trigger&&v.trigger.toLowerCase()!="none"&&(a={type:v.trigger,object:v},D.triggers[object.name]=a)}}else o=v.position,r=v.rotation,q=v.quaternion,s=v.scale,q=0,object=new THREE.Object3D,object.name=p,object.position.set(o[0],o[1],o[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],s[1],s[2]),object.visible=v.visible!==void 0?v.visible:!1,D.scene.addObject(object),
+D.objects[p]=object,D.empties[p]=object,v.trigger&&v.trigger.toLowerCase()!="none"&&(a={type:v.trigger,object:v},D.triggers[object.name]=a)}function j(a){return function(b){D.geometries[a]=b;k();K-=1;c.onLoadComplete();m()}}function l(a){return function(c){D.geometries[a]=c}}function m(){c.callbackProgress({totalModels:L,totalTextures:O,loadedModels:L-K,loadedTextures:O-N},D);c.onLoadProgress();K==0&&N==0&&b(D)}var n,t,p,u,z,w,B,v,o,A,C,F,G,H,I,E,M,K,N,L,O,D;E=a.data;a=new THREE.BinaryLoader;M=new THREE.JSONLoader;
+N=K=0;D={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};var J=!1;for(p in E.objects)if(v=E.objects[p],v.meshCollider){J=!0;break}if(J)D.scene.collisions=new THREE.CollisionSystem;if(E.transform){J=E.transform.position;A=E.transform.rotation;var P=E.transform.scale;J&&D.scene.position.set(J[0],J[1],J[2]);A&&D.scene.rotation.set(A[0],A[1],A[2]);P&&D.scene.scale.set(P[0],P[1],P[2]);(J||A||P)&&D.scene.updateMatrix()}J=function(){N-=
+1;m();c.onLoadComplete()};for(z in E.cameras){A=E.cameras[z];if(A.type=="perspective")G=new THREE.Camera(A.fov,A.aspect,A.near,A.far);else if(A.type=="ortho")G=new THREE.Camera,G.projectionMatrix=THREE.Matrix4.makeOrtho(A.left,A.right,A.top,A.bottom,A.near,A.far);o=A.position;A=A.target;G.position.set(o[0],o[1],o[2]);G.target.position.set(A[0],A[1],A[2]);D.cameras[z]=G}for(u in E.lights){z=E.lights[u];G=z.color!==void 0?z.color:16777215;A=z.intensity!==void 0?z.intensity:1;if(z.type=="directional")o=
+z.direction,light=new THREE.DirectionalLight(G,A),light.position.set(o[0],o[1],o[2]),light.position.normalize();else if(z.type=="point")o=z.position,light=new THREE.PointLight(G,A),light.position.set(o[0],o[1],o[2]);D.scene.addLight(light);D.lights[u]=light}for(w in E.fogs)u=E.fogs[w],u.type=="linear"?H=new THREE.Fog(0,u.near,u.far):u.type=="exp2"&&(H=new THREE.FogExp2(0,u.density)),A=u.color,H.color.setRGB(A[0],A[1],A[2]),D.fogs[w]=H;if(D.cameras&&E.defaults.camera)D.currentCamera=D.cameras[E.defaults.camera];
+if(D.fogs&&E.defaults.fog)D.scene.fog=D.fogs[E.defaults.fog];A=E.defaults.bgcolor;D.bgColor=new THREE.Color;D.bgColor.setRGB(A[0],A[1],A[2]);D.bgColorAlpha=E.defaults.bgalpha;for(n in E.geometries)if(w=E.geometries[n],w.type=="bin_mesh"||w.type=="ascii_mesh")K+=1,c.onLoadStart();L=K;for(n in E.geometries)w=E.geometries[n],w.type=="cube"?(F=new THREE.Cube(w.width,w.height,w.depth,w.segmentsWidth,w.segmentsHeight,w.segmentsDepth,null,w.flipped,w.sides),D.geometries[n]=F):w.type=="plane"?(F=new THREE.Plane(w.width,
+w.height,w.segmentsWidth,w.segmentsHeight),D.geometries[n]=F):w.type=="sphere"?(F=new THREE.Sphere(w.radius,w.segmentsWidth,w.segmentsHeight),D.geometries[n]=F):w.type=="cylinder"?(F=new THREE.Cylinder(w.numSegs,w.topRad,w.botRad,w.height,w.topOffset,w.botOffset),D.geometries[n]=F):w.type=="torus"?(F=new THREE.Torus(w.radius,w.tube,w.segmentsR,w.segmentsT),D.geometries[n]=F):w.type=="icosahedron"?(F=new THREE.Icosahedron(w.subdivisions),D.geometries[n]=F):w.type=="bin_mesh"?a.load({model:e(w.url,
+E.urlBaseType),callback:j(n)}):w.type=="ascii_mesh"?M.load({model:e(w.url,E.urlBaseType),callback:j(n)}):w.type=="embedded_mesh"&&(w=E.embeds[w.id])&&M.createModel(w,l(n),"");for(B in E.textures)if(n=E.textures[B],n.url instanceof Array){N+=n.url.length;for(a=0;a<n.url.length;a++)c.onLoadStart()}else N+=1,c.onLoadStart();O=N;for(B in E.textures){n=E.textures[B];if(n.mapping!=void 0&&THREE[n.mapping]!=void 0)n.mapping=new THREE[n.mapping];if(n.url instanceof Array){for(var a=[],Q=0;Q<n.url.length;Q++)a[Q]=
 e(n.url[Q],E.urlBaseType);a=THREE.ImageUtils.loadTextureCube(a,n.mapping,J)}else{a=THREE.ImageUtils.loadTexture(e(n.url,E.urlBaseType),n.mapping,J);if(THREE[n.minFilter]!=void 0)a.minFilter=THREE[n.minFilter];if(THREE[n.magFilter]!=void 0)a.magFilter=THREE[n.magFilter]}D.textures[B]=a}for(t in E.materials){B=E.materials[t];for(C in B.parameters)if(C=="envMap"||C=="map"||C=="lightMap")B.parameters[C]=D.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 if(C=="combine")B.parameters[C]=B.parameters[C]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(C=="vertexColors")if(B.parameters[C]=="face")B.parameters[C]=THREE.FaceColors;else if(B.parameters[C])B.parameters[C]=THREE.VertexColors;if(B.parameters.opacity!==void 0&&B.parameters.opacity<1)B.parameters.transparent=!0;B=new THREE[B.type](B.parameters);
 D.materials[t]=B}k();c.callbackSync(D)}}};
 THREE.MarchingCubes=function(a,b){THREE.Object3D.call(this);this.materials=b instanceof Array?b:[b];this.init=function(a){this.isolation=80;this.size=a;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.hasNormal=this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(a,b,f){return a+(b-a)*f};this.VIntX=function(a,b,f,g,h,k,j,m,l,n){h=(h-l)/(n-l);l=this.normal_cache;b[g]=k+h*this.delta;b[g+1]=j;b[g+2]=m;f[g]=this.lerp(l[a],l[a+3],h);f[g+1]=this.lerp(l[a+1],l[a+4],h);f[g+2]=this.lerp(l[a+2],l[a+5],h)};this.VIntY=function(a,b,f,g,h,k,j,m,l,n){h=(h-l)/(n-l);l=this.normal_cache;b[g]=k;b[g+1]=j+h*this.delta;b[g+
-2]=m;b=a+this.yd*3;f[g]=this.lerp(l[a],l[b],h);f[g+1]=this.lerp(l[a+1],l[b+1],h);f[g+2]=this.lerp(l[a+2],l[b+2],h)};this.VIntZ=function(a,b,f,g,h,k,j,m,l,n){h=(h-l)/(n-l);l=this.normal_cache;b[g]=k;b[g+1]=j;b[g+2]=m+h*this.delta;b=a+this.zd*3;f[g]=this.lerp(l[a],l[b],h);f[g+1]=this.lerp(l[a+1],l[b+1],h);f[g+2]=this.lerp(l[a+2],l[b+2],h)};this.compNorm=function(a){var b=a*3;this.normal_cache[b]==0&&(this.normal_cache[b]=this.field[a-1]-this.field[a+1],this.normal_cache[b+1]=this.field[a-this.yd]-this.field[a+
-this.yd],this.normal_cache[b+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,b,f,g,h,k){var j=g+1,m=g+this.yd,l=g+this.zd,n=j+this.yd,t=j+this.zd,p=g+this.yd+this.zd,u=j+this.yd+this.zd,w=0,v=this.field[g],B=this.field[j],z=this.field[m],o=this.field[n],A=this.field[l],C=this.field[t],F=this.field[p],G=this.field[u];v<h&&(w|=1);B<h&&(w|=2);z<h&&(w|=8);o<h&&(w|=4);A<h&&(w|=16);C<h&&(w|=32);F<h&&(w|=128);G<h&&(w|=64);var H=THREE.edgeTable[w];if(H==0)return 0;var I=this.delta,
-E=a+I,M=b+I,I=f+I;H&1&&(this.compNorm(g),this.compNorm(j),this.VIntX(g*3,this.vlist,this.nlist,0,h,a,b,f,v,B));H&2&&(this.compNorm(j),this.compNorm(n),this.VIntY(j*3,this.vlist,this.nlist,3,h,E,b,f,B,o));H&4&&(this.compNorm(m),this.compNorm(n),this.VIntX(m*3,this.vlist,this.nlist,6,h,a,M,f,z,o));H&8&&(this.compNorm(g),this.compNorm(m),this.VIntY(g*3,this.vlist,this.nlist,9,h,a,b,f,v,z));H&16&&(this.compNorm(l),this.compNorm(t),this.VIntX(l*3,this.vlist,this.nlist,12,h,a,b,I,A,C));H&32&&(this.compNorm(t),
-this.compNorm(u),this.VIntY(t*3,this.vlist,this.nlist,15,h,E,b,I,C,G));H&64&&(this.compNorm(p),this.compNorm(u),this.VIntX(p*3,this.vlist,this.nlist,18,h,a,M,I,F,G));H&128&&(this.compNorm(l),this.compNorm(p),this.VIntY(l*3,this.vlist,this.nlist,21,h,a,b,I,A,F));H&256&&(this.compNorm(g),this.compNorm(l),this.VIntZ(g*3,this.vlist,this.nlist,24,h,a,b,f,v,A));H&512&&(this.compNorm(j),this.compNorm(t),this.VIntZ(j*3,this.vlist,this.nlist,27,h,E,b,f,B,C));H&1024&&(this.compNorm(n),this.compNorm(u),this.VIntZ(n*
-3,this.vlist,this.nlist,30,h,E,M,f,o,G));H&2048&&(this.compNorm(m),this.compNorm(p),this.VIntZ(m*3,this.vlist,this.nlist,33,h,a,M,f,z,F));w<<=4;for(h=g=0;THREE.triTable[w+h]!=-1;)a=w+h,b=a+1,f=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[b],3*THREE.triTable[f],k),h+=3,g++;return g};this.posnormtriv=function(a,b,f,g,h,k){var j=this.count*3;this.positionArray[j]=a[f];this.positionArray[j+1]=a[f+1];this.positionArray[j+2]=a[f+2];this.positionArray[j+3]=a[g];this.positionArray[j+
+0;this.hasNormal=this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(a,b,f){return a+(b-a)*f};this.VIntX=function(a,b,f,g,h,k,j,l,m,n){h=(h-m)/(n-m);m=this.normal_cache;b[g]=k+h*this.delta;b[g+1]=j;b[g+2]=l;f[g]=this.lerp(m[a],m[a+3],h);f[g+1]=this.lerp(m[a+1],m[a+4],h);f[g+2]=this.lerp(m[a+2],m[a+5],h)};this.VIntY=function(a,b,f,g,h,k,j,l,m,n){h=(h-m)/(n-m);m=this.normal_cache;b[g]=k;b[g+1]=j+h*this.delta;b[g+
+2]=l;b=a+this.yd*3;f[g]=this.lerp(m[a],m[b],h);f[g+1]=this.lerp(m[a+1],m[b+1],h);f[g+2]=this.lerp(m[a+2],m[b+2],h)};this.VIntZ=function(a,b,f,g,h,k,j,l,m,n){h=(h-m)/(n-m);m=this.normal_cache;b[g]=k;b[g+1]=j;b[g+2]=l+h*this.delta;b=a+this.zd*3;f[g]=this.lerp(m[a],m[b],h);f[g+1]=this.lerp(m[a+1],m[b+1],h);f[g+2]=this.lerp(m[a+2],m[b+2],h)};this.compNorm=function(a){var b=a*3;this.normal_cache[b]==0&&(this.normal_cache[b]=this.field[a-1]-this.field[a+1],this.normal_cache[b+1]=this.field[a-this.yd]-this.field[a+
+this.yd],this.normal_cache[b+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,b,f,g,h,k){var j=g+1,l=g+this.yd,m=g+this.zd,n=j+this.yd,t=j+this.zd,p=g+this.yd+this.zd,u=j+this.yd+this.zd,z=0,w=this.field[g],B=this.field[j],v=this.field[l],o=this.field[n],A=this.field[m],C=this.field[t],F=this.field[p],G=this.field[u];w<h&&(z|=1);B<h&&(z|=2);v<h&&(z|=8);o<h&&(z|=4);A<h&&(z|=16);C<h&&(z|=32);F<h&&(z|=128);G<h&&(z|=64);var H=THREE.edgeTable[z];if(H==0)return 0;var I=this.delta,
+E=a+I,M=b+I,I=f+I;H&1&&(this.compNorm(g),this.compNorm(j),this.VIntX(g*3,this.vlist,this.nlist,0,h,a,b,f,w,B));H&2&&(this.compNorm(j),this.compNorm(n),this.VIntY(j*3,this.vlist,this.nlist,3,h,E,b,f,B,o));H&4&&(this.compNorm(l),this.compNorm(n),this.VIntX(l*3,this.vlist,this.nlist,6,h,a,M,f,v,o));H&8&&(this.compNorm(g),this.compNorm(l),this.VIntY(g*3,this.vlist,this.nlist,9,h,a,b,f,w,v));H&16&&(this.compNorm(m),this.compNorm(t),this.VIntX(m*3,this.vlist,this.nlist,12,h,a,b,I,A,C));H&32&&(this.compNorm(t),
+this.compNorm(u),this.VIntY(t*3,this.vlist,this.nlist,15,h,E,b,I,C,G));H&64&&(this.compNorm(p),this.compNorm(u),this.VIntX(p*3,this.vlist,this.nlist,18,h,a,M,I,F,G));H&128&&(this.compNorm(m),this.compNorm(p),this.VIntY(m*3,this.vlist,this.nlist,21,h,a,b,I,A,F));H&256&&(this.compNorm(g),this.compNorm(m),this.VIntZ(g*3,this.vlist,this.nlist,24,h,a,b,f,w,A));H&512&&(this.compNorm(j),this.compNorm(t),this.VIntZ(j*3,this.vlist,this.nlist,27,h,E,b,f,B,C));H&1024&&(this.compNorm(n),this.compNorm(u),this.VIntZ(n*
+3,this.vlist,this.nlist,30,h,E,M,f,o,G));H&2048&&(this.compNorm(l),this.compNorm(p),this.VIntZ(l*3,this.vlist,this.nlist,33,h,a,M,f,v,F));z<<=4;for(h=g=0;THREE.triTable[z+h]!=-1;)a=z+h,b=a+1,f=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[b],3*THREE.triTable[f],k),h+=3,g++;return g};this.posnormtriv=function(a,b,f,g,h,k){var j=this.count*3;this.positionArray[j]=a[f];this.positionArray[j+1]=a[f+1];this.positionArray[j+2]=a[f+2];this.positionArray[j+3]=a[g];this.positionArray[j+
 4]=a[g+1];this.positionArray[j+5]=a[g+2];this.positionArray[j+6]=a[h];this.positionArray[j+7]=a[h+1];this.positionArray[j+8]=a[h+2];this.normalArray[j]=b[f];this.normalArray[j+1]=b[f+1];this.normalArray[j+2]=b[f+2];this.normalArray[j+3]=b[g];this.normalArray[j+4]=b[g+1];this.normalArray[j+5]=b[g+2];this.normalArray[j+6]=b[h];this.normalArray[j+7]=b[h+1];this.normalArray[j+8]=b[h+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&k(this)};this.begin=function(){this.count=0;
-this.hasNormal=this.hasPos=!1};this.end=function(a){if(this.count!=0){for(var b=this.count*3;b<this.positionArray.length;b++)this.positionArray[b]=0;a(this)}};this.addBall=function(a,b,f,g,h){var k=this.size*Math.sqrt(g/h),j=f*this.size,m=b*this.size,l=a*this.size,n=Math.floor(j-k);n<1&&(n=1);j=Math.floor(j+k);j>this.size-1&&(j=this.size-1);var t=Math.floor(m-k);t<1&&(t=1);m=Math.floor(m+k);m>this.size-1&&(m=this.size-1);var p=Math.floor(l-k);p<1&&(p=1);k=Math.floor(l+k);k>this.size-1&&(k=this.size-
-1);for(var u,w,v,B,z,o;n<j;n++){l=this.size2*n;w=n/this.size-f;z=w*w;for(w=t;w<m;w++){v=l+this.size*w;u=w/this.size-b;o=u*u;for(u=p;u<k;u++)B=u/this.size-a,B=g/(1.0E-6+B*B+o+z)-h,B>0&&(this.field[v+u]+=B)}}};this.addPlaneX=function(a,b){var f,g,h,k,j,m=this.size,l=this.yd,n=this.zd,t=this.field,p=m*Math.sqrt(a/b);p>m&&(p=m);for(f=0;f<p;f++)if(g=f/m,g*=g,k=a/(1.0E-4+g)-b,k>0)for(g=0;g<m;g++){j=f+g*l;for(h=0;h<m;h++)t[n*h+j]+=k}};this.addPlaneY=function(a,b){var f,g,h,k,j,m,l=this.size,n=this.yd,t=
-this.zd,p=this.field,u=l*Math.sqrt(a/b);u>l&&(u=l);for(g=0;g<u;g++)if(f=g/l,f*=f,k=a/(1.0E-4+f)-b,k>0){j=g*n;for(f=0;f<l;f++){m=j+f;for(h=0;h<l;h++)p[t*h+m]+=k}}};this.addPlaneZ=function(a,b){var f,g,h,k,j,m;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(a/b);dist>size&&(dist=size);for(h=0;h<dist;h++)if(f=h/size,f*=f,k=a/(1.0E-4+f)-b,k>0){j=zd*h;for(g=0;g<size;g++){m=j+g*yd;for(f=0;f<size;f++)field[m+f]+=k}}};this.reset=function(){var a;for(a=0;a<this.size3;a++)this.normal_cache[a*
-3]=0,this.field[a]=0};this.render=function(a){this.begin();var b,f,g,h,k,j,m,l,n,t=this.size-2;for(h=1;h<t;h++){n=this.size2*h;m=(h-this.halfsize)/this.halfsize;for(g=1;g<t;g++){l=n+this.size*g;j=(g-this.halfsize)/this.halfsize;for(f=1;f<t;f++)k=(f-this.halfsize)/this.halfsize,b=l+f,this.polygonize(k,j,m,b,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,b=new THREE.Geometry,f=[];this.render(function(g){var h,k,j,m,l,n,t,p;for(h=0;h<g.count;h++)t=h*3,l=t+1,p=t+2,k=g.positionArray[t],
-j=g.positionArray[l],m=g.positionArray[p],n=new THREE.Vector3(k,j,m),k=g.normalArray[t],j=g.normalArray[l],m=g.normalArray[p],t=new THREE.Vector3(k,j,m),t.normalize(),l=new THREE.Vertex(n),b.vertices.push(l),f.push(t);nfaces=g.count/3;for(h=0;h<nfaces;h++)t=(a+h)*3,l=t+1,p=t+2,n=f[t],k=f[l],j=f[p],t=new THREE.Face3(t,l,p,[n,k,j]),b.faces.push(t);a+=nfaces;g.count=0});return b};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
+this.hasNormal=this.hasPos=!1};this.end=function(a){if(this.count!=0){for(var b=this.count*3;b<this.positionArray.length;b++)this.positionArray[b]=0;a(this)}};this.addBall=function(a,b,f,g,h){var k=this.size*Math.sqrt(g/h),j=f*this.size,l=b*this.size,m=a*this.size,n=Math.floor(j-k);n<1&&(n=1);j=Math.floor(j+k);j>this.size-1&&(j=this.size-1);var t=Math.floor(l-k);t<1&&(t=1);l=Math.floor(l+k);l>this.size-1&&(l=this.size-1);var p=Math.floor(m-k);p<1&&(p=1);k=Math.floor(m+k);k>this.size-1&&(k=this.size-
+1);for(var u,z,w,B,v,o;n<j;n++){m=this.size2*n;z=n/this.size-f;v=z*z;for(z=t;z<l;z++){w=m+this.size*z;u=z/this.size-b;o=u*u;for(u=p;u<k;u++)B=u/this.size-a,B=g/(1.0E-6+B*B+o+v)-h,B>0&&(this.field[w+u]+=B)}}};this.addPlaneX=function(a,b){var f,g,h,k,j,l=this.size,m=this.yd,n=this.zd,t=this.field,p=l*Math.sqrt(a/b);p>l&&(p=l);for(f=0;f<p;f++)if(g=f/l,g*=g,k=a/(1.0E-4+g)-b,k>0)for(g=0;g<l;g++){j=f+g*m;for(h=0;h<l;h++)t[n*h+j]+=k}};this.addPlaneY=function(a,b){var f,g,h,k,j,l,m=this.size,n=this.yd,t=
+this.zd,p=this.field,u=m*Math.sqrt(a/b);u>m&&(u=m);for(g=0;g<u;g++)if(f=g/m,f*=f,k=a/(1.0E-4+f)-b,k>0){j=g*n;for(f=0;f<m;f++){l=j+f;for(h=0;h<m;h++)p[t*h+l]+=k}}};this.addPlaneZ=function(a,b){var f,g,h,k,j,l;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(a/b);dist>size&&(dist=size);for(h=0;h<dist;h++)if(f=h/size,f*=f,k=a/(1.0E-4+f)-b,k>0){j=zd*h;for(g=0;g<size;g++){l=j+g*yd;for(f=0;f<size;f++)field[l+f]+=k}}};this.reset=function(){var a;for(a=0;a<this.size3;a++)this.normal_cache[a*
+3]=0,this.field[a]=0};this.render=function(a){this.begin();var b,f,g,h,k,j,l,m,n,t=this.size-2;for(h=1;h<t;h++){n=this.size2*h;l=(h-this.halfsize)/this.halfsize;for(g=1;g<t;g++){m=n+this.size*g;j=(g-this.halfsize)/this.halfsize;for(f=1;f<t;f++)k=(f-this.halfsize)/this.halfsize,b=m+f,this.polygonize(k,j,l,b,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,b=new THREE.Geometry,f=[];this.render(function(g){var h,k,j,l,m,n,t,p;for(h=0;h<g.count;h++)t=h*3,m=t+1,p=t+2,k=g.positionArray[t],
+j=g.positionArray[m],l=g.positionArray[p],n=new THREE.Vector3(k,j,l),k=g.normalArray[t],j=g.normalArray[m],l=g.normalArray[p],t=new THREE.Vector3(k,j,l),t.normalize(),m=new THREE.Vertex(n),b.vertices.push(m),f.push(t);nfaces=g.count/3;for(h=0;h<nfaces;h++)t=(a+h)*3,m=t+1,p=t+2,n=f[t],k=f[m],j=f[p],t=new THREE.Face3(t,m,p,[n,k,j]),b.faces.push(t);a+=nfaces;g.count=0});return b};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
 THREE.edgeTable=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,
 1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,
 419,681,928,3376,3129,3891,3642,2358,2111,2869,2620,1340,1077,1855,1590,314,51,825,560,3728,3993,3219,3482,2710,2975,2197,2460,1692,1941,1183,1430,666,915,153,400,3840,3593,3331,3082,2822,2575,2309,2060,1804,1541,1295,1030,778,515,265,0]);
@@ -203,17 +204,19 @@ THREE.MeshCollider=function(a,b){this.mesh=a;this.box=b;this.numFaces=this.mesh.
 THREE.CollisionSystem.prototype.rayCastAll=function(a){a.direction.normalize();this.hits.length=0;var b,c,e,f,g=0;b=0;for(c=this.colliders.length;b<c;b++)if(f=this.colliders[b],e=this.rayCast(a,f),e<Number.MAX_VALUE)f.distance=e,e>g?this.hits.push(f):this.hits.unshift(f),g=e;return this.hits};
 THREE.CollisionSystem.prototype.rayCastNearest=function(a){var b=this.rayCastAll(a);if(b.length==0)return null;for(var c=0;b[c]instanceof THREE.MeshCollider;){var e=this.rayMesh(a,b[c]);if(e.dist<Number.MAX_VALUE){b[c].distance=e.dist;b[c].faceIndex=e.faceIndex;break}c++}if(c>b.length)return null;return b[c]};
 THREE.CollisionSystem.prototype.rayCast=function(a,b){if(b instanceof THREE.PlaneCollider)return this.rayPlane(a,b);else if(b instanceof THREE.SphereCollider)return this.raySphere(a,b);else if(b instanceof THREE.BoxCollider)return this.rayBox(a,b);else if(b instanceof THREE.MeshCollider&&b.box)return this.rayBox(a,b.box)};
-THREE.CollisionSystem.prototype.rayMesh=function(a,b){for(var c=this.makeRayLocal(a,b.mesh),e=Number.MAX_VALUE,f,g=0;g<b.numFaces;g++){var h=b.mesh.geometry.faces[g],k=b.mesh.geometry.vertices[h.a].position,j=b.mesh.geometry.vertices[h.b].position,m=b.mesh.geometry.vertices[h.c].position,l=h instanceof THREE.Face4?b.mesh.geometry.vertices[h.d].position:null;h instanceof THREE.Face3?(h=this.rayTriangle(c,k,j,m,e,this.collisionNormal),h<e&&(e=h,f=g,b.normal.copy(this.collisionNormal),b.normal.normalize())):
-h instanceof THREE.Face4&&(h=this.rayTriangle(c,k,j,l,e,this.collisionNormal),h<e&&(e=h,f=g,b.normal.copy(this.collisionNormal),b.normal.normalize()),h=this.rayTriangle(c,j,m,l,e,this.collisionNormal),h<e&&(e=h,f=g,b.normal.copy(this.collisionNormal),b.normal.normalize()))}return{dist:e,faceIndex:f}};
+THREE.CollisionSystem.prototype.rayMesh=function(a,b){for(var c=this.makeRayLocal(a,b.mesh),e=Number.MAX_VALUE,f,g=0;g<b.numFaces;g++){var h=b.mesh.geometry.faces[g],k=b.mesh.geometry.vertices[h.a].position,j=b.mesh.geometry.vertices[h.b].position,l=b.mesh.geometry.vertices[h.c].position,m=h instanceof THREE.Face4?b.mesh.geometry.vertices[h.d].position:null;h instanceof THREE.Face3?(h=this.rayTriangle(c,k,j,l,e,this.collisionNormal),h<e&&(e=h,f=g,b.normal.copy(this.collisionNormal),b.normal.normalize())):
+h instanceof THREE.Face4&&(h=this.rayTriangle(c,k,j,m,e,this.collisionNormal),h<e&&(e=h,f=g,b.normal.copy(this.collisionNormal),b.normal.normalize()),h=this.rayTriangle(c,j,l,m,e,this.collisionNormal),h<e&&(e=h,f=g,b.normal.copy(this.collisionNormal),b.normal.normalize()))}return{dist:e,faceIndex:f}};
 THREE.CollisionSystem.prototype.rayTriangle=function(a,b,c,e,f,g){var h=THREE.CollisionSystem.__v1,k=THREE.CollisionSystem.__v2;g.set(0,0,0);h.sub(c,b);k.sub(e,c);g.cross(h,k);k=g.dot(a.direction);if(!(k<0))return Number.MAX_VALUE;h=g.dot(b)-g.dot(a.origin);if(!(h<=0))return Number.MAX_VALUE;if(!(h>=k*f))return Number.MAX_VALUE;h/=k;k=THREE.CollisionSystem.__v3;k.copy(a.direction);k.multiplyScalar(h);k.addSelf(a.origin);Math.abs(g.x)>Math.abs(g.y)?Math.abs(g.x)>Math.abs(g.z)?(a=k.y-b.y,g=c.y-b.y,
 f=e.y-b.y,k=k.z-b.z,c=c.z-b.z,e=e.z-b.z):(a=k.x-b.x,g=c.x-b.x,f=e.x-b.x,k=k.y-b.y,c=c.y-b.y,e=e.y-b.y):Math.abs(g.y)>Math.abs(g.z)?(a=k.x-b.x,g=c.x-b.x,f=e.x-b.x,k=k.z-b.z,c=c.z-b.z,e=e.z-b.z):(a=k.x-b.x,g=c.x-b.x,f=e.x-b.x,k=k.y-b.y,c=c.y-b.y,e=e.y-b.y);b=g*e-c*f;if(b==0)return Number.MAX_VALUE;b=1/b;e=(a*e-k*f)*b;if(!(e>=0))return Number.MAX_VALUE;b*=g*k-c*a;if(!(b>=0))return Number.MAX_VALUE;if(!(1-e-b>=0))return Number.MAX_VALUE;return h};
 THREE.CollisionSystem.prototype.makeRayLocal=function(a,b){var c=THREE.CollisionSystem.__m;THREE.Matrix4.makeInvert(b.matrixWorld,c);var e=THREE.CollisionSystem.__r;e.origin.copy(a.origin);e.direction.copy(a.direction);c.multiplyVector3(e.origin);c.rotateAxis(e.direction);e.direction.normalize();return e};
-THREE.CollisionSystem.prototype.rayBox=function(a,b){var c;b.dynamic&&b.mesh&&b.mesh.matrixWorld?c=this.makeRayLocal(a,b.mesh):(c=THREE.CollisionSystem.__r,c.origin.copy(a.origin),c.direction.copy(a.direction));var e=0,f=0,g=0,h=0,k=0,j=0,m=!0;c.origin.x<b.min.x?(e=b.min.x-c.origin.x,e/=c.direction.x,m=!1,h=-1):c.origin.x>b.max.x&&(e=b.max.x-c.origin.x,e/=c.direction.x,m=!1,h=1);c.origin.y<b.min.y?(f=b.min.y-c.origin.y,f/=c.direction.y,m=!1,k=-1):c.origin.y>b.max.y&&(f=b.max.y-c.origin.y,f/=c.direction.y,
-m=!1,k=1);c.origin.z<b.min.z?(g=b.min.z-c.origin.z,g/=c.direction.z,m=!1,j=-1):c.origin.z>b.max.z&&(g=b.max.z-c.origin.z,g/=c.direction.z,m=!1,j=1);if(m)return-1;m=0;f>e&&(m=1,e=f);g>e&&(m=2,e=g);switch(m){case 0:k=c.origin.y+c.direction.y*e;if(k<b.min.y||k>b.max.y)return Number.MAX_VALUE;c=c.origin.z+c.direction.z*e;if(c<b.min.z||c>b.max.z)return Number.MAX_VALUE;b.normal.set(h,0,0);break;case 1:h=c.origin.x+c.direction.x*e;if(h<b.min.x||h>b.max.x)return Number.MAX_VALUE;c=c.origin.z+c.direction.z*
+THREE.CollisionSystem.prototype.rayBox=function(a,b){var c;b.dynamic&&b.mesh&&b.mesh.matrixWorld?c=this.makeRayLocal(a,b.mesh):(c=THREE.CollisionSystem.__r,c.origin.copy(a.origin),c.direction.copy(a.direction));var e=0,f=0,g=0,h=0,k=0,j=0,l=!0;c.origin.x<b.min.x?(e=b.min.x-c.origin.x,e/=c.direction.x,l=!1,h=-1):c.origin.x>b.max.x&&(e=b.max.x-c.origin.x,e/=c.direction.x,l=!1,h=1);c.origin.y<b.min.y?(f=b.min.y-c.origin.y,f/=c.direction.y,l=!1,k=-1):c.origin.y>b.max.y&&(f=b.max.y-c.origin.y,f/=c.direction.y,
+l=!1,k=1);c.origin.z<b.min.z?(g=b.min.z-c.origin.z,g/=c.direction.z,l=!1,j=-1):c.origin.z>b.max.z&&(g=b.max.z-c.origin.z,g/=c.direction.z,l=!1,j=1);if(l)return-1;l=0;f>e&&(l=1,e=f);g>e&&(l=2,e=g);switch(l){case 0:k=c.origin.y+c.direction.y*e;if(k<b.min.y||k>b.max.y)return Number.MAX_VALUE;c=c.origin.z+c.direction.z*e;if(c<b.min.z||c>b.max.z)return Number.MAX_VALUE;b.normal.set(h,0,0);break;case 1:h=c.origin.x+c.direction.x*e;if(h<b.min.x||h>b.max.x)return Number.MAX_VALUE;c=c.origin.z+c.direction.z*
 e;if(c<b.min.z||c>b.max.z)return Number.MAX_VALUE;b.normal.set(0,k,0);break;case 2:h=c.origin.x+c.direction.x*e;if(h<b.min.x||h>b.max.x)return Number.MAX_VALUE;k=c.origin.y+c.direction.y*e;if(k<b.min.y||k>b.max.y)return Number.MAX_VALUE;b.normal.set(0,0,j)}return e};THREE.CollisionSystem.prototype.rayPlane=function(a,b){var c=a.direction.dot(b.normal),e=b.point.dot(b.normal);if(c<0)c=(e-a.origin.dot(b.normal))/c;else return Number.MAX_VALUE;return c>0?c:Number.MAX_VALUE};
 THREE.CollisionSystem.prototype.raySphere=function(a,b){var c=b.center.clone().subSelf(a.origin);if(c.lengthSq<b.radiusSq)return-1;var e=c.dot(a.direction.clone());if(e<=0)return Number.MAX_VALUE;c=b.radiusSq-(c.lengthSq()-e*e);if(c>=0)return Math.abs(e)-Math.sqrt(c);return Number.MAX_VALUE};THREE.CollisionSystem.__v1=new THREE.Vector3;THREE.CollisionSystem.__v2=new THREE.Vector3;THREE.CollisionSystem.__v3=new THREE.Vector3;THREE.CollisionSystem.__nr=new THREE.Vector3;THREE.CollisionSystem.__m=new THREE.Matrix4;
 THREE.CollisionSystem.__r=new THREE.Ray;THREE.CollisionUtils={};THREE.CollisionUtils.MeshOBB=function(a){a.geometry.computeBoundingBox();var b=a.geometry.boundingBox,c=new THREE.Vector3(b.x[0],b.y[0],b.z[0]),b=new THREE.Vector3(b.x[1],b.y[1],b.z[1]),c=new THREE.BoxCollider(c,b);c.mesh=a;return c};THREE.CollisionUtils.MeshAABB=function(a){var b=THREE.CollisionUtils.MeshOBB(a);b.min.addSelf(a.position);b.max.addSelf(a.position);b.dynamic=!1;return b};
 THREE.CollisionUtils.MeshColliderWBox=function(a){return new THREE.MeshCollider(a,THREE.CollisionUtils.MeshOBB(a))};
 THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);var b=this,c=this.setSize,e=this.render,f=new THREE.Camera,g=new THREE.Camera,a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},h=new THREE.WebGLRenderTarget(512,512,a),k=new THREE.WebGLRenderTarget(512,512,a),j=new THREE.Camera(53,1,1,1E4);j.position.z=2;_material=new THREE.MeshShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:h},mapRight:{type:"t",value:1,texture:k}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",
-fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"});var m=new THREE.Scene;m.addObject(new THREE.Mesh(new THREE.Plane(2,2),_material));this.setSize=function(a,e){c.call(b,a,e);h.width=a;h.height=e;k.width=a;k.height=e};this.render=
-function(a,c){f.projectionMatrix=c.projectionMatrix;f.position.copy(c.position);f.target.position.copy(c.target.position);f.translateX(-10);g.projectionMatrix=c.projectionMatrix;g.position.copy(c.position);g.target.position.copy(c.target.position);g.translateX(10);e.call(b,a,f,h,!0);e.call(b,a,g,k,!0);e.call(b,m,j)}};THREE.AnaglyphWebGLRenderer.prototype=new THREE.WebGLRenderer;THREE.AnaglyphWebGLRenderer.prototype.constructor=THREE.AnaglyphWebGLRenderer;
+fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"});var l=new THREE.Scene;l.addObject(new THREE.Mesh(new THREE.Plane(2,2),_material));this.setSize=function(a,e){c.call(b,a,e);h.width=a;h.height=e;k.width=a;k.height=e};this.render=
+function(a,c){f.projectionMatrix=c.projectionMatrix;f.position.copy(c.position);f.target.position.copy(c.target.position);f.translateX(-10);g.projectionMatrix=c.projectionMatrix;g.position.copy(c.position);g.target.position.copy(c.target.position);g.translateX(10);e.call(b,a,f,h,!0);e.call(b,a,g,k,!0);e.call(b,l,j)}};THREE.AnaglyphWebGLRenderer.prototype=new THREE.WebGLRenderer;THREE.AnaglyphWebGLRenderer.prototype.constructor=THREE.AnaglyphWebGLRenderer;
+THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=!1;var b=this,c=this.setSize,e=this.render,f,g,h=new THREE.Camera,k=new THREE.Camera;b.separation=10;if(a&&a.separation!==void 0)b.separation=a.separation;(new THREE.Camera(53,window.innerWidth/2/window.innerHeight,1,1E4)).position.z=-10;this.setSize=function(a,e){c.call(b,a,e);f=a/2;g=e};this.render=function(a,c){this.clear();h.fov=c.fov;h.aspect=0.5*c.aspect;h.near=c.near;h.far=c.far;h.updateProjectionMatrix();
+h.position.copy(c.position);h.target.position.copy(c.target.position);h.translateX(b.separation);k.projectionMatrix=h.projectionMatrix;k.position.copy(c.position);k.target.position.copy(c.target.position);k.translateX(-b.separation);this.setViewport(0,0,f,g);e.call(b,a,h);this.setViewport(f,0,f,g);e.call(b,a,k,!1)}};THREE.CrosseyedWebGLRenderer.prototype=new THREE.WebGLRenderer;THREE.CrosseyedWebGLRenderer.prototype.constructor=THREE.CrosseyedWebGLRenderer;

+ 8 - 6
build/custom/ThreeSVG.js

@@ -41,8 +41,8 @@ e*l*k-g*i*k+g*f*j-c*l*j-e*f*o+c*i*o;b.n31=h*o*p-l*n*p+l*k*q-f*o*q-h*k*u+f*n*u;b.
 THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,e=-a.n33*a.n21+a.n31*a.n23,g=a.n32*a.n21-a.n31*a.n22,f=-a.n33*a.n12+a.n32*a.n13,h=a.n33*a.n11-a.n31*a.n13,i=-a.n32*a.n11+a.n31*a.n12,l=a.n23*a.n12-a.n22*a.n13,k=-a.n23*a.n11+a.n21*a.n13,n=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*f+a.n31*l;a==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;c[0]=a*d;c[1]=a*e;c[2]=a*g;c[3]=a*f;c[4]=a*h;c[5]=a*i;c[6]=a*l;c[7]=a*k;c[8]=a*n;return b};
 THREE.Matrix4.makeFrustum=function(a,b,c,d,e,g){var f;f=new THREE.Matrix4;f.n11=2*e/(b-a);f.n12=0;f.n13=(b+a)/(b-a);f.n14=0;f.n21=0;f.n22=2*e/(d-c);f.n23=(d+c)/(d-c);f.n24=0;f.n31=0;f.n32=0;f.n33=-(g+e)/(g-e);f.n34=-2*g*e/(g-e);f.n41=0;f.n42=0;f.n43=-1;f.n44=0;return f};THREE.Matrix4.makePerspective=function(a,b,c,d){var e,a=c*Math.tan(a*Math.PI/360);e=-a;return THREE.Matrix4.makeFrustum(e*b,a*b,e,a,c,d)};
 THREE.Matrix4.makeOrtho=function(a,b,c,d,e,g){var f,h,i,l;f=new THREE.Matrix4;h=b-a;i=c-d;l=g-e;f.n11=2/h;f.n12=0;f.n13=0;f.n14=-((b+a)/h);f.n21=0;f.n22=2/i;f.n23=0;f.n24=-((c+d)/i);f.n31=0;f.n32=0;f.n33=-2/l;f.n34=-((g+e)/l);f.n41=0;f.n42=0;f.n43=0;f.n44=1;return f};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
-THREE.Object3D=function(){this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.dynamic=!1;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;
-this.visible=!0;this._vector=new THREE.Vector3;this.name=""};
+THREE.Object3D=function(){this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=
+0;this.boundRadiusScale=1;this.visible=!0;this._vector=new THREE.Vector3;this.name=""};
 THREE.Object3D.prototype={translate:function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(a,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(a){if(this.children.indexOf(a)===
 -1){a.parent!==void 0&&a.parent.removeChild(a);a.parent=this;this.children.push(a);for(var b=this;b.parent!==void 0;)b=b.parent;b!==void 0&&b instanceof THREE.Scene&&b.addChildRecurse(a)}},removeChild:function(a){var b=this.children.indexOf(a);if(b!==-1)a.parent=void 0,this.children.splice(b,1)},getChildByName:function(a,b){var c,d,e;c=0;for(d=this.children.length;c<d;c++){e=this.children[c];if(e.name===a)return e;if(b&&(e=e.getChildByName(a,b),e!==void 0))return e}},updateMatrix:function(){this.matrix.setPosition(this.position);
 this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},update:function(a,b,c){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||b)a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixRotationWorld.extractRotation(this.matrixWorld,
@@ -66,7 +66,9 @@ if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this
 else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=0,b=0,c=this.vertices.length;b<c;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}},computeEdgeFaces:function(){function a(a,b){return Math.min(a,b)+"_"+Math.max(a,b)}function b(a,b,c){a[b]===
 void 0?(a[b]={set:{},array:[]},a[b].set[c]=1,a[b].array.push(c)):a[b].set[c]===void 0&&(a[b].set[c]=1,a[b].array.push(c))}var c,d,e,g,f,h={};c=0;for(d=this.faces.length;c<d;c++)f=this.faces[c],f instanceof THREE.Face3?(e=a(f.a,f.b),b(h,e,c),e=a(f.b,f.c),b(h,e,c),e=a(f.a,f.c),b(h,e,c)):f instanceof THREE.Face4&&(e=a(f.b,f.d),b(h,e,c),e=a(f.a,f.b),b(h,e,c),e=a(f.a,f.d),b(h,e,c),e=a(f.b,f.c),b(h,e,c),e=a(f.c,f.d),b(h,e,c));c=0;for(d=this.edges.length;c<d;c++){f=this.edges[c];e=f.vertexIndices[0];g=f.vertexIndices[1];
 f.faceIndices=h[a(e,g)].array;for(e=0;e<f.faceIndices.length;e++)g=f.faceIndices[e],f.faces.push(this.faces[g])}}};THREE.GeometryIdCounter=0;THREE.Camera=function(a,b,c,d,e){THREE.Object3D.call(this);this.fov=a||50;this.aspect=b||1;this.near=c||0.1;this.far=d||2E3;this.target=e||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;
-THREE.Camera.prototype.supr=THREE.Object3D.prototype;THREE.Camera.prototype.translate=function(a,b){this.matrix.rotateAxis(b);b.multiplyScalar(a);this.position.addSelf(b);this.target.position.addSelf(b)};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};
+THREE.Camera.prototype.supr=THREE.Object3D.prototype;THREE.Camera.prototype.translate=function(a,b){this.matrix.rotateAxis(b);b.multiplyScalar(a);this.position.addSelf(b);this.target.position.addSelf(b)};
+THREE.Camera.prototype.updateProjectionMatrix=function(){if(this.fullWidth){var a=this.fullWidth/this.fullHeight,b=Math.tan(this.fov*Math.PI/360)*this.near,c=-b,d=a*c,a=Math.abs(a*b-d),c=Math.abs(b-c);this.projectionMatrix=THREE.Matrix4.makeFrustum(d+this.x*a/this.fullWidth,d+(this.x+this.width)*a/this.fullWidth,b-(this.y+this.height)*c/this.fullHeight,b-this.y*c/this.fullHeight,this.near,this.far)}else this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};
+THREE.Camera.prototype.setViewOffset=function(a,b,c,d,e,g){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=d;this.width=e;this.height=g;this.updateProjectionMatrix()};
 THREE.Camera.prototype.update=function(a,b,c){if(this.useTarget)this.matrix.lookAt(this.position,this.target.position,this.up),this.matrix.setPosition(this.position),a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix),THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse),b=!0;else if(this.matrixAutoUpdate&&this.updateMatrix(),b||this.matrixWorldNeedsUpdate)a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=
 !1,b=!0,THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,b,c)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;
 THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(a,b,c,d){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=b||1;this.distance=c||0;this.castShadow=d!==void 0?d:!1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=b||1;this.distance=c||0};
@@ -86,8 +88,8 @@ THREE.MeshDepthMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.sha
 THREE.MeshNormalMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.shading=a.shading?a.shading:THREE.FlatShading;this.wireframe=a.wireframe?a.wireframe:!1;this.wireframeLinewidth=a.wireframeLinewidth?a.wireframeLinewidth:1};THREE.MeshNormalMaterial.prototype=new THREE.Material;THREE.MeshNormalMaterial.prototype.constructor=THREE.MeshNormalMaterial;THREE.MeshFaceMaterial=function(){};
 THREE.ParticleBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.map=a.map!==void 0?a.map:null;this.size=a.size!==void 0?a.size:1;this.sizeAttenuation=a.sizeAttenuation!==void 0?a.sizeAttenuation:!0;this.vertexColors=a.vertexColors!==void 0?a.vertexColors:!1};THREE.ParticleBasicMaterial.prototype=new THREE.Material;THREE.ParticleBasicMaterial.prototype.constructor=THREE.ParticleBasicMaterial;
 THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a]};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.type=c!=void 0?c:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;
-THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b&&b.length?b:[b];this.overdraw=this.doubleSided=this.flipSided=!1;if(this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere(),this.boundRadius=a.boundingSphere.radius,this.geometry.morphTargets.length)){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var c=0;c<this.geometry.morphTargets.length;c++)this.morphTargetInfluences.push(0),
-this.morphTargetDictionary[this.geometry.morphTargets[c].name]=c}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;THREE.Mesh.prototype.getMorphTargetIndexByName=function(a){if(this.morphTargetDictionary[a]!==void 0)return this.morphTargetDictionary[a];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+a+" does not exist. Returning 0.");return 0};
+THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b&&b.length?b:[b];this.overdraw=!1;if(this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere(),this.boundRadius=a.boundingSphere.radius,this.geometry.morphTargets.length)){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var c=0;c<this.geometry.morphTargets.length;c++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[this.geometry.morphTargets[c].name]=
+c}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;THREE.Mesh.prototype.getMorphTargetIndexByName=function(a){if(this.morphTargetDictionary[a]!==void 0)return this.morphTargetDictionary[a];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+a+" does not exist. Returning 0.");return 0};
 THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
 THREE.Bone.prototype.update=function(a,b,c){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate)a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,b=!0;var d,e=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(d=0;d<e;d++)a=this.children[d],a instanceof THREE.Bone?a.update(this.skinMatrix,b,c):a.update(this.matrixWorld,!0,c)}else for(d=0;d<e;d++)this.children[d].update(this.skinMatrix,
 b,c)};THREE.Bone.prototype.addChild=function(a){if(this.children.indexOf(a)===-1&&(a.parent!==void 0&&a.parent.removeChild(a),a.parent=this,this.children.push(a),!(a instanceof THREE.Bone)))this.hasNoneBoneChildren=!0};
@@ -100,7 +102,7 @@ THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.c
 THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(a instanceof THREE.Sound)this.sounds.indexOf(a)===-1&&this.sounds.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1)this.objects.push(a),this.__objectsAdded.push(a);for(var b=0;b<a.children.length;b++)this.addChildRecurse(a.children[b])};
 THREE.Scene.prototype.removeChild=function(a){this.supr.removeChild.call(this,a);this.removeChildRecurse(a)};THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else a instanceof THREE.Sound?(b=this.sounds.indexOf(a),b!==-1&&this.sounds.splice(b,1)):a instanceof THREE.Camera||(b=this.objects.indexOf(a),b!==-1&&(this.objects.splice(b,1),this.__objectsRemoved.push(a)));for(b=0;b<a.children.length;b++)this.removeChildRecurse(a.children[b])};
 THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;
-THREE.Projector=function(){function a(){var a=i[h]=i[h]||new THREE.RenderableVertex;h++;return a}function b(a,b){return b.z-a.z}function c(a,b){var c=0,d=1,f=a.z+a.w,e=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;return f>=0&&e>=0&&g>=0&&h>=0?!0:f<0&&e<0||g<0&&h<0?!1:(f<0?c=Math.max(c,f/(f-e)):e<0&&(d=Math.min(d,f/(f-e))),g<0?c=Math.max(c,g/(g-h)):h<0&&(d=Math.min(d,g/(g-h))),d<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-d),!0))}var d,e,g=[],f,h,i=[],l,k,n=[],j,o=[],p,q,t=[],u,G,y=[],E=new THREE.Vector4,r=new THREE.Vector4,
+THREE.Projector=function(){function a(){var a=i[h]=i[h]||new THREE.RenderableVertex;h++;return a}function b(a,b){return b.z-a.z}function c(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;return e>=0&&f>=0&&g>=0&&h>=0?!0:e<0&&f<0||g<0&&h<0?!1:(e<0?c=Math.max(c,e/(e-f)):f<0&&(d=Math.min(d,e/(e-f))),g<0?c=Math.max(c,g/(g-h)):h<0&&(d=Math.min(d,g/(g-h))),d<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-d),!0))}var d,e,g=[],f,h,i=[],l,k,n=[],j,o=[],p,q,t=[],u,G,y=[],E=new THREE.Vector4,r=new THREE.Vector4,
 m=new THREE.Matrix4,z=new THREE.Matrix4,A=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],C=new THREE.Vector4,v=new THREE.Vector4;this.projectVector=function(a,b){m.multiply(b.projectionMatrix,b.matrixWorldInverse);m.multiplyVector3(a);return a};this.unprojectVector=function(a,b){m.multiply(b.matrixWorld,THREE.Matrix4.makeInvert(b.projectionMatrix));m.multiplyVector3(a);return a};this.projectObjects=function(a,c,f){var c=[],h,l,j;e=0;l=
 a.objects;a=0;for(h=l.length;a<h;a++){j=l[a];var i;if(!(i=!j.visible))if(i=j instanceof THREE.Mesh){a:{i=void 0;for(var k=j.matrixWorld,o=-j.geometry.boundingSphere.radius*Math.max(j.scale.x,Math.max(j.scale.y,j.scale.z)),n=0;n<6;n++)if(i=A[n].x*k.n14+A[n].y*k.n24+A[n].z*k.n34+A[n].w,i<=o){i=!1;break a}i=!0}i=!i}if(!i)i=g[e]=g[e]||new THREE.RenderableObject,e++,d=i,E.copy(j.position),m.multiplyVector3(E),d.object=j,d.z=E.z,c.push(d)}f&&c.sort(b);return c};this.projectScene=function(d,e,g){var B=[],
 E=e.near,S=e.far,N,P,H,M,x,I,D,K,O,s,w,U,W,X,R,V,T;G=q=j=k=0;e.matrixAutoUpdate&&e.update(void 0,!0);d.update(void 0,!1,e);m.multiply(e.projectionMatrix,e.matrixWorldInverse);A[0].set(m.n41-m.n11,m.n42-m.n12,m.n43-m.n13,m.n44-m.n14);A[1].set(m.n41+m.n11,m.n42+m.n12,m.n43+m.n13,m.n44+m.n14);A[2].set(m.n41+m.n21,m.n42+m.n22,m.n43+m.n23,m.n44+m.n24);A[3].set(m.n41-m.n21,m.n42-m.n22,m.n43-m.n23,m.n44-m.n24);A[4].set(m.n41-m.n31,m.n42-m.n32,m.n43-m.n33,m.n44-m.n34);A[5].set(m.n41+m.n31,m.n42+m.n32,m.n43+

+ 95 - 93
build/custom/ThreeWebGL.js

@@ -41,8 +41,8 @@ h*k*n-i*p*n+i*g*r-e*k*r-h*g*q+e*p*q;d.n31=j*q*z-k*v*z+k*n*C-g*q*C-j*n*y+g*v*y;d.
 THREE.Matrix4.makeInvert3x3=function(b){var d=b.m33,e=d.m,f=b.n33*b.n22-b.n32*b.n23,h=-b.n33*b.n21+b.n31*b.n23,i=b.n32*b.n21-b.n31*b.n22,g=-b.n33*b.n12+b.n32*b.n13,j=b.n33*b.n11-b.n31*b.n13,p=-b.n32*b.n11+b.n31*b.n12,k=b.n23*b.n12-b.n22*b.n13,n=-b.n23*b.n11+b.n21*b.n13,v=b.n22*b.n11-b.n21*b.n12,b=b.n11*f+b.n21*g+b.n31*k;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;e[0]=b*f;e[1]=b*h;e[2]=b*i;e[3]=b*g;e[4]=b*j;e[5]=b*p;e[6]=b*k;e[7]=b*n;e[8]=b*v;return d};
 THREE.Matrix4.makeFrustum=function(b,d,e,f,h,i){var g;g=new THREE.Matrix4;g.n11=2*h/(d-b);g.n12=0;g.n13=(d+b)/(d-b);g.n14=0;g.n21=0;g.n22=2*h/(f-e);g.n23=(f+e)/(f-e);g.n24=0;g.n31=0;g.n32=0;g.n33=-(i+h)/(i-h);g.n34=-2*i*h/(i-h);g.n41=0;g.n42=0;g.n43=-1;g.n44=0;return g};THREE.Matrix4.makePerspective=function(b,d,e,f){var h,b=e*Math.tan(b*Math.PI/360);h=-b;return THREE.Matrix4.makeFrustum(h*d,b*d,h,b,e,f)};
 THREE.Matrix4.makeOrtho=function(b,d,e,f,h,i){var g,j,p,k;g=new THREE.Matrix4;j=d-b;p=e-f;k=i-h;g.n11=2/j;g.n12=0;g.n13=0;g.n14=-((d+b)/j);g.n21=0;g.n22=2/p;g.n23=0;g.n24=-((e+f)/p);g.n31=0;g.n32=0;g.n33=-2/k;g.n34=-((i+h)/k);g.n41=0;g.n42=0;g.n43=0;g.n44=1;return g};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
-THREE.Object3D=function(){this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.dynamic=!1;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;
-this.visible=!0;this._vector=new THREE.Vector3;this.name=""};
+THREE.Object3D=function(){this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=
+0;this.boundRadiusScale=1;this.visible=!0;this._vector=new THREE.Vector3;this.name=""};
 THREE.Object3D.prototype={translate:function(b,d){this.matrix.rotateAxis(d);this.position.addSelf(d.multiplyScalar(b))},translateX:function(b){this.translate(b,this._vector.set(1,0,0))},translateY:function(b){this.translate(b,this._vector.set(0,1,0))},translateZ:function(b){this.translate(b,this._vector.set(0,0,1))},lookAt:function(b){this.matrix.lookAt(b,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(b){if(this.children.indexOf(b)===
 -1){b.parent!==void 0&&b.parent.removeChild(b);b.parent=this;this.children.push(b);for(var d=this;d.parent!==void 0;)d=d.parent;d!==void 0&&d instanceof THREE.Scene&&d.addChildRecurse(b)}},removeChild:function(b){var d=this.children.indexOf(b);if(d!==-1)b.parent=void 0,this.children.splice(d,1)},getChildByName:function(b,d){var e,f,h;e=0;for(f=this.children.length;e<f;e++){h=this.children[e];if(h.name===b)return h;if(d&&(h=h.getChildByName(b,d),h!==void 0))return h}},updateMatrix:function(){this.matrix.setPosition(this.position);
 this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},update:function(b,d,e){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||d)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixRotationWorld.extractRotation(this.matrixWorld,
@@ -60,8 +60,8 @@ e.centroid.addSelf(this.vertices[e.d].position),e.centroid.divideScalar(4))},com
 j.normalize();i.normal.copy(j)}},computeVertexNormals:function(){var b,d,e,f;if(this.__tmpVertices==void 0){f=this.__tmpVertices=Array(this.vertices.length);b=0;for(d=this.vertices.length;b<d;b++)f[b]=new THREE.Vector3;b=0;for(d=this.faces.length;b<d;b++)if(e=this.faces[b],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{f=
 this.__tmpVertices;b=0;for(d=this.vertices.length;b<d;b++)f[b].set(0,0,0)}b=0;for(d=this.faces.length;b<d;b++)e=this.faces[b],e instanceof THREE.Face3?(f[e.a].addSelf(e.normal),f[e.b].addSelf(e.normal),f[e.c].addSelf(e.normal)):e instanceof THREE.Face4&&(f[e.a].addSelf(e.normal),f[e.b].addSelf(e.normal),f[e.c].addSelf(e.normal),f[e.d].addSelf(e.normal));b=0;for(d=this.vertices.length;b<d;b++)f[b].normalize();b=0;for(d=this.faces.length;b<d;b++)e=this.faces[b],e instanceof THREE.Face3?(e.vertexNormals[0].copy(f[e.a]),
 e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c])):e instanceof THREE.Face4&&(e.vertexNormals[0].copy(f[e.a]),e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c]),e.vertexNormals[3].copy(f[e.d]))},computeTangents:function(){function b(b,d,e,f,h,i,J){j=b.vertices[d].position;p=b.vertices[e].position;k=b.vertices[f].position;n=g[h];v=g[i];r=g[J];q=p.x-j.x;z=k.x-j.x;C=p.y-j.y;D=k.y-j.y;y=p.z-j.z;S=k.z-j.z;Q=v.u-n.u;L=r.u-n.u;B=v.v-n.v;x=r.v-n.v;R=1/(Q*x-L*B);$.set((x*q-B*z)*
-R,(x*C-B*D)*R,(x*y-B*S)*R);c.set((Q*z-L*q)*R,(Q*D-L*C)*R,(Q*S-L*y)*R);aa[d].addSelf($);aa[e].addSelf($);aa[f].addSelf($);E[d].addSelf(c);E[e].addSelf(c);E[f].addSelf(c)}var d,e,f,h,i,g,j,p,k,n,v,r,q,z,C,D,y,S,Q,L,B,x,R,J,aa=[],E=[],$=new THREE.Vector3,c=new THREE.Vector3,ja=new THREE.Vector3,oa=new THREE.Vector3,Aa=new THREE.Vector3;d=0;for(e=this.vertices.length;d<e;d++)aa[d]=new THREE.Vector3,E[d]=new THREE.Vector3;d=0;for(e=this.faces.length;d<e;d++)i=this.faces[d],g=this.faceVertexUvs[0][d],i instanceof
-THREE.Face3?b(this,i.a,i.b,i.c,0,1,2):i instanceof THREE.Face4&&(b(this,i.a,i.b,i.c,0,1,2),b(this,i.a,i.b,i.d,0,1,3));var ra=["a","b","c","d"];d=0;for(e=this.faces.length;d<e;d++){i=this.faces[d];for(f=0;f<i.vertexNormals.length;f++)Aa.copy(i.vertexNormals[f]),h=i[ra[f]],J=aa[h],ja.copy(J),ja.subSelf(Aa.multiplyScalar(Aa.dot(J))).normalize(),oa.cross(i.vertexNormals[f],J),h=oa.dot(E[h]),h=h<0?-1:1,i.vertexTangents[f]=new THREE.Vector4(ja.x,ja.y,ja.z,h)}this.hasTangents=!0},computeBoundingBox:function(){var b;
+R,(x*C-B*D)*R,(x*y-B*S)*R);c.set((Q*z-L*q)*R,(Q*D-L*C)*R,(Q*S-L*y)*R);aa[d].addSelf($);aa[e].addSelf($);aa[f].addSelf($);E[d].addSelf(c);E[e].addSelf(c);E[f].addSelf(c)}var d,e,f,h,i,g,j,p,k,n,v,r,q,z,C,D,y,S,Q,L,B,x,R,J,aa=[],E=[],$=new THREE.Vector3,c=new THREE.Vector3,ja=new THREE.Vector3,oa=new THREE.Vector3,Ba=new THREE.Vector3;d=0;for(e=this.vertices.length;d<e;d++)aa[d]=new THREE.Vector3,E[d]=new THREE.Vector3;d=0;for(e=this.faces.length;d<e;d++)i=this.faces[d],g=this.faceVertexUvs[0][d],i instanceof
+THREE.Face3?b(this,i.a,i.b,i.c,0,1,2):i instanceof THREE.Face4&&(b(this,i.a,i.b,i.c,0,1,2),b(this,i.a,i.b,i.d,0,1,3));var ra=["a","b","c","d"];d=0;for(e=this.faces.length;d<e;d++){i=this.faces[d];for(f=0;f<i.vertexNormals.length;f++)Ba.copy(i.vertexNormals[f]),h=i[ra[f]],J=aa[h],ja.copy(J),ja.subSelf(Ba.multiplyScalar(Ba.dot(J))).normalize(),oa.cross(i.vertexNormals[f],J),h=oa.dot(E[h]),h=h<0?-1:1,i.vertexTangents[f]=new THREE.Vector4(ja.x,ja.y,ja.z,h)}this.hasTangents=!0},computeBoundingBox:function(){var b;
 if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var d=1,e=this.vertices.length;d<e;d++){b=this.vertices[d];if(b.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=b.position.x;else if(b.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=b.position.x;if(b.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=b.position.y;
 else if(b.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=b.position.y;if(b.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=b.position.z;else if(b.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=0,d=0,e=this.vertices.length;d<e;d++)b=Math.max(b,this.vertices[d].position.length());this.boundingSphere={radius:b}},computeEdgeFaces:function(){function b(b,d){return Math.min(b,d)+"_"+Math.max(b,d)}function d(b,d,e){b[d]===
 void 0?(b[d]={set:{},array:[]},b[d].set[e]=1,b[d].array.push(e)):b[d].set[e]===void 0&&(b[d].set[e]=1,b[d].array.push(e))}var e,f,h,i,g,j={};e=0;for(f=this.faces.length;e<f;e++)g=this.faces[e],g instanceof THREE.Face3?(h=b(g.a,g.b),d(j,h,e),h=b(g.b,g.c),d(j,h,e),h=b(g.a,g.c),d(j,h,e)):g instanceof THREE.Face4&&(h=b(g.b,g.d),d(j,h,e),h=b(g.a,g.b),d(j,h,e),h=b(g.a,g.d),d(j,h,e),h=b(g.b,g.c),d(j,h,e),h=b(g.c,g.d),d(j,h,e));e=0;for(f=this.edges.length;e<f;e++){g=this.edges[e];h=g.vertexIndices[0];i=g.vertexIndices[1];
@@ -70,7 +70,9 @@ THREE.Spline=function(b){function d(b,d,e,f,h,g,i){b=(e-b)*0.5;f=(f-d)*0.5;retur
 v=this.points[e[2]];r=this.points[e[3]];j=g*g;p=g*j;f.x=d(k.x,n.x,v.x,r.x,g,j,p);f.y=d(k.y,n.y,v.y,r.y,g,j,p);f.z=d(k.z,n.z,v.z,r.z,g,j,p);return f};this.getControlPointsArray=function(){var b,d,e=this.points.length,f=[];for(b=0;b<e;b++)d=this.points[b],f[b]=[d.x,d.y,d.z];return f};this.getLength=function(b){var d,e,f=d=d=0,h=new THREE.Vector3,g=new THREE.Vector3,i=[],j=0;i[0]=0;b||(b=100);e=this.points.length*b;h.copy(this.points[0]);for(b=1;b<e;b++)d=b/e,position=this.getPoint(d),g.copy(position),
 j+=g.distanceTo(h),h.copy(position),d*=this.points.length-1,d=Math.floor(d),d!=f&&(i[d]=j,f=d);i[i.length]=j;return{chunks:i,total:j}};this.reparametrizeByArcLength=function(b){var d,e,f,h,g,i,j=[],k=new THREE.Vector3,p=this.getLength();j.push(k.copy(this.points[0]).clone());for(d=1;d<this.points.length;d++){e=p.chunks[d]-p.chunks[d-1];i=Math.ceil(b*e/p.total);h=(d-1)/(this.points.length-1);g=d/(this.points.length-1);for(e=1;e<i-1;e++)f=h+e*(1/i)*(g-h),position=this.getPoint(f),j.push(k.copy(position).clone());
 j.push(k.copy(this.points[d]).clone())}this.points=j}};THREE.Edge=function(b,d,e,f){this.vertices=[b,d];this.vertexIndices=[e,f];this.faces=[];this.faceIndices=[]};THREE.Camera=function(b,d,e,f,h){THREE.Object3D.call(this);this.fov=b||50;this.aspect=d||1;this.near=e||0.1;this.far=f||2E3;this.target=h||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;
-THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;THREE.Camera.prototype.translate=function(b,d){this.matrix.rotateAxis(d);d.multiplyScalar(b);this.position.addSelf(d);this.target.position.addSelf(d)};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};
+THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;THREE.Camera.prototype.translate=function(b,d){this.matrix.rotateAxis(d);d.multiplyScalar(b);this.position.addSelf(d);this.target.position.addSelf(d)};
+THREE.Camera.prototype.updateProjectionMatrix=function(){if(this.fullWidth){var b=this.fullWidth/this.fullHeight,d=Math.tan(this.fov*Math.PI/360)*this.near,e=-d,f=b*e,b=Math.abs(b*d-f),e=Math.abs(d-e);this.projectionMatrix=THREE.Matrix4.makeFrustum(f+this.x*b/this.fullWidth,f+(this.x+this.width)*b/this.fullWidth,d-(this.y+this.height)*e/this.fullHeight,d-this.y*e/this.fullHeight,this.near,this.far)}else this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};
+THREE.Camera.prototype.setViewOffset=function(b,d,e,f,h,i){this.fullWidth=b;this.fullHeight=d;this.x=e;this.y=f;this.width=h;this.height=i;this.updateProjectionMatrix()};
 THREE.Camera.prototype.update=function(b,d,e){if(this.useTarget)this.matrix.lookAt(this.position,this.target.position,this.up),this.matrix.setPosition(this.position),b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse),d=!0;else if(this.matrixAutoUpdate&&this.updateMatrix(),d||this.matrixWorldNeedsUpdate)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=
 !1,d=!0,THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);for(b=0;b<this.children.length;b++)this.children[b].update(this.matrixWorld,d,e)};THREE.Light=function(b){THREE.Object3D.call(this);this.color=new THREE.Color(b)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(b){THREE.Light.call(this,b)};THREE.AmbientLight.prototype=new THREE.Light;
 THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(b,d,e,f){THREE.Light.call(this,b);this.position=new THREE.Vector3(0,1,0);this.intensity=d||1;this.distance=e||0;this.castShadow=f!==void 0?f:!1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(b,d,e){THREE.Light.call(this,b);this.position=new THREE.Vector3;this.intensity=d||1;this.distance=e||0};
@@ -102,7 +104,7 @@ THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,th
 THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;THREE.Particle=function(b){THREE.Object3D.call(this);this.materials=b instanceof Array?b:[b]};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;
 THREE.ParticleSystem=function(b,d){THREE.Object3D.call(this);this.geometry=b;this.materials=d instanceof Array?d:[d];this.sortParticles=!1};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;THREE.Line=function(b,d,e){THREE.Object3D.call(this);this.geometry=b;this.materials=d instanceof Array?d:[d];this.type=e!=void 0?e:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;
 THREE.Line.prototype.constructor=THREE.Line;
-THREE.Mesh=function(b,d){THREE.Object3D.call(this);this.geometry=b;this.materials=d&&d.length?d:[d];this.overdraw=this.doubleSided=this.flipSided=!1;if(this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere(),this.boundRadius=b.boundingSphere.radius,this.geometry.morphTargets.length)){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var e=0;e<this.geometry.morphTargets.length;e++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[this.geometry.morphTargets[e].name]=
+THREE.Mesh=function(b,d){THREE.Object3D.call(this);this.geometry=b;this.materials=d&&d.length?d:[d];this.overdraw=!1;if(this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere(),this.boundRadius=b.boundingSphere.radius,this.geometry.morphTargets.length)){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var e=0;e<this.geometry.morphTargets.length;e++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[this.geometry.morphTargets[e].name]=
 e}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;THREE.Mesh.prototype.getMorphTargetIndexByName=function(b){if(this.morphTargetDictionary[b]!==void 0)return this.morphTargetDictionary[b];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+b+" does not exist. Returning 0.");return 0};
 THREE.Bone=function(b){THREE.Object3D.call(this);this.skin=b;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
 THREE.Bone.prototype.update=function(b,d,e){this.matrixAutoUpdate&&(d|=this.updateMatrix());if(d||this.matrixWorldNeedsUpdate)b?this.skinMatrix.multiply(b,this.matrix):this.skinMatrix.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,d=!0;var f,h=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(f=0;f<h;f++)b=this.children[f],b instanceof THREE.Bone?b.update(this.skinMatrix,d,e):b.update(this.matrixWorld,!0,e)}else for(f=0;f<h;f++)this.children[f].update(this.skinMatrix,
@@ -112,8 +114,8 @@ f=this.bones[e],h.parent===-1?this.addChild(f):this.bones[h.parent].addChild(f);
 THREE.SkinnedMesh.prototype.update=function(b,d,e){if(this.visible){this.matrixAutoUpdate&&(d|=this.updateMatrix());if(d||this.matrixWorldNeedsUpdate)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,d=!0;var f,h=this.children.length;for(f=0;f<h;f++)b=this.children[f],b instanceof THREE.Bone?b.update(this.identityMatrix,!1,e):b.update(this.matrixWorld,d,e);e=this.bones.length;ba=this.bones;bm=this.boneMatrices;for(d=0;d<e;d++)ba[d].skinMatrix.flattenToArrayOffset(bm,
 d*16)}};THREE.SkinnedMesh.prototype.addBone=function(b){b===void 0&&(b=new THREE.Bone(this));this.bones.push(b);return b};
 THREE.SkinnedMesh.prototype.pose=function(){this.update(void 0,!0);for(var b,d=[],e=0;e<this.bones.length;e++)b=this.bones[e],d.push(THREE.Matrix4.makeInvert(b.skinMatrix)),b.skinMatrix.flattenToArrayOffset(this.boneMatrices,e*16);if(this.geometry.skinVerticesA===void 0){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];var f;for(b=0;b<this.geometry.skinIndices.length;b++){var e=this.geometry.vertices[b].position,h=this.geometry.skinIndices[b].x,i=this.geometry.skinIndices[b].y;f=new THREE.Vector3(e.x,
-e.y,e.z);this.geometry.skinVerticesA.push(d[h].multiplyVector3(f));f=new THREE.Vector3(e.x,e.y,e.z);this.geometry.skinVerticesB.push(d[i].multiplyVector3(f));this.geometry.skinWeights[b].x+this.geometry.skinWeights[b].y!==1&&(e=(1-(this.geometry.skinWeights[b].x+this.geometry.skinWeights[b].y))*0.5,this.geometry.skinWeights[b].x+=e,this.geometry.skinWeights[b].y+=e)}}};
-THREE.Ribbon=function(b,d){THREE.Object3D.call(this);this.geometry=b;this.materials=d instanceof Array?d:[d];this.doubleSided=this.flipSided=!1};THREE.Ribbon.prototype=new THREE.Object3D;THREE.Ribbon.prototype.constructor=THREE.Ribbon;
+e.y,e.z);this.geometry.skinVerticesA.push(d[h].multiplyVector3(f));f=new THREE.Vector3(e.x,e.y,e.z);this.geometry.skinVerticesB.push(d[i].multiplyVector3(f));this.geometry.skinWeights[b].x+this.geometry.skinWeights[b].y!==1&&(e=(1-(this.geometry.skinWeights[b].x+this.geometry.skinWeights[b].y))*0.5,this.geometry.skinWeights[b].x+=e,this.geometry.skinWeights[b].y+=e)}}};THREE.Ribbon=function(b,d){THREE.Object3D.call(this);this.geometry=b;this.materials=d instanceof Array?d:[d]};
+THREE.Ribbon.prototype=new THREE.Object3D;THREE.Ribbon.prototype.constructor=THREE.Ribbon;
 THREE.Sound=function(b,d,e,f){THREE.Object3D.call(this);this.isPlaying=this.isAddedToDOM=this.isLoaded=!1;this.duration=-1;this.radius=d!==void 0?Math.abs(d):100;this.volume=Math.min(1,Math.max(0,e!==void 0?e:1));this.domElement=document.createElement("audio");this.domElement.volume=0;this.domElement.pan=0;this.domElement.loop=f!==void 0?f:!0;this.sources=b instanceof Array?b:[b];for(var h,e=this.sources.length,b=0;b<e;b++)if(d=this.sources[b],d.toLowerCase(),d.indexOf(".mp3")!==-1?h="audio/mpeg":
 d.indexOf(".ogg")!==-1?h="audio/ogg":d.indexOf(".wav")!==-1&&(h="audio/wav"),this.domElement.canPlayType(h)){h=document.createElement("source");h.src=this.sources[b];this.domElement.THREESound=this;this.domElement.appendChild(h);this.domElement.addEventListener("canplay",this.onLoad,!0);this.domElement.load();break}};THREE.Sound.prototype=new THREE.Object3D;THREE.Sound.prototype.constructor=THREE.Sound;THREE.Sound.prototype.supr=THREE.Object3D.prototype;
 THREE.Sound.prototype.onLoad=function(){var b=this.THREESound;if(!b.isLoaded)this.removeEventListener("canplay",this.onLoad,!0),b.isLoaded=!0,b.duration=this.duration,b.isPlaying&&b.play()};THREE.Sound.prototype.addToDOM=function(b){this.isAddedToDOM=!0;b.appendChild(this.domElement)};THREE.Sound.prototype.play=function(b){this.isPlaying=!0;if(this.isLoaded&&(this.domElement.play(),b))this.domElement.currentTime=b%this.duration};THREE.Sound.prototype.pause=function(){this.isPlaying=!1;this.domElement.pause()};
@@ -141,12 +143,12 @@ THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.proto
 THREE.Projector=function(){function b(){var b=p[j]=p[j]||new THREE.RenderableVertex;j++;return b}function d(b,c){return c.z-b.z}function e(b,c){var d=0,e=1,f=b.z+b.w,h=c.z+c.w,g=-b.z+b.w,i=-c.z+c.w;return f>=0&&h>=0&&g>=0&&i>=0?!0:f<0&&h<0||g<0&&i<0?!1:(f<0?d=Math.max(d,f/(f-h)):h<0&&(e=Math.min(e,f/(f-h))),g<0?d=Math.max(d,g/(g-i)):i<0&&(e=Math.min(e,g/(g-i))),e<d?!1:(b.lerpSelf(c,d),c.lerpSelf(b,1-e),!0))}var f,h,i=[],g,j,p=[],k,n,v=[],r,q=[],z,C,D=[],y,S,Q=[],L=new THREE.Vector4,B=new THREE.Vector4,
 x=new THREE.Matrix4,R=new THREE.Matrix4,J=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],aa=new THREE.Vector4,E=new THREE.Vector4;this.projectVector=function(b,c){x.multiply(c.projectionMatrix,c.matrixWorldInverse);x.multiplyVector3(b);return b};this.unprojectVector=function(b,c){x.multiply(c.matrixWorld,THREE.Matrix4.makeInvert(c.projectionMatrix));x.multiplyVector3(b);return b};this.projectObjects=function(b,c,e){var c=[],g,j,k;h=0;
 j=b.objects;b=0;for(g=j.length;b<g;b++){k=j[b];var p;if(!(p=!k.visible))if(p=k instanceof THREE.Mesh){a:{p=void 0;for(var n=k.matrixWorld,r=-k.geometry.boundingSphere.radius*Math.max(k.scale.x,Math.max(k.scale.y,k.scale.z)),v=0;v<6;v++)if(p=J[v].x*n.n14+J[v].y*n.n24+J[v].z*n.n34+J[v].w,p<=r){p=!1;break a}p=!0}p=!p}if(!p)p=i[h]=i[h]||new THREE.RenderableObject,h++,f=p,L.copy(k.position),x.multiplyVector3(L),f.object=k,f.z=L.z,c.push(f)}e&&c.sort(d);return c};this.projectScene=function(f,c,h){var i=
-[],L=c.near,ra=c.far,pa,ka,M,ha,F,Z,O,H,N,P,fa,la,qa,Ba,ia,sa,ta;S=C=r=n=0;c.matrixAutoUpdate&&c.update(void 0,!0);f.update(void 0,!1,c);x.multiply(c.projectionMatrix,c.matrixWorldInverse);J[0].set(x.n41-x.n11,x.n42-x.n12,x.n43-x.n13,x.n44-x.n14);J[1].set(x.n41+x.n11,x.n42+x.n12,x.n43+x.n13,x.n44+x.n14);J[2].set(x.n41+x.n21,x.n42+x.n22,x.n43+x.n23,x.n44+x.n24);J[3].set(x.n41-x.n21,x.n42-x.n22,x.n43-x.n23,x.n44-x.n24);J[4].set(x.n41-x.n31,x.n42-x.n32,x.n43-x.n33,x.n44-x.n34);J[5].set(x.n41+x.n31,x.n42+
-x.n32,x.n43+x.n33,x.n44+x.n34);for(pa=0;pa<6;pa++)N=J[pa],N.divideScalar(Math.sqrt(N.x*N.x+N.y*N.y+N.z*N.z));N=this.projectObjects(f,c,!0);f=0;for(pa=N.length;f<pa;f++)if(P=N[f].object,P.visible)if(fa=P.matrixWorld,la=P.matrixRotationWorld,qa=P.materials,Ba=P.overdraw,j=0,P instanceof THREE.Mesh){ia=P.geometry;ha=ia.vertices;sa=ia.faces;ia=ia.faceVertexUvs;ka=0;for(M=ha.length;ka<M;ka++)g=b(),g.positionWorld.copy(ha[ka].position),fa.multiplyVector3(g.positionWorld),g.positionScreen.copy(g.positionWorld),
+[],L=c.near,ra=c.far,pa,ka,M,ha,F,Z,O,H,N,P,fa,la,qa,Ca,ia,sa,ta;S=C=r=n=0;c.matrixAutoUpdate&&c.update(void 0,!0);f.update(void 0,!1,c);x.multiply(c.projectionMatrix,c.matrixWorldInverse);J[0].set(x.n41-x.n11,x.n42-x.n12,x.n43-x.n13,x.n44-x.n14);J[1].set(x.n41+x.n11,x.n42+x.n12,x.n43+x.n13,x.n44+x.n14);J[2].set(x.n41+x.n21,x.n42+x.n22,x.n43+x.n23,x.n44+x.n24);J[3].set(x.n41-x.n21,x.n42-x.n22,x.n43-x.n23,x.n44-x.n24);J[4].set(x.n41-x.n31,x.n42-x.n32,x.n43-x.n33,x.n44-x.n34);J[5].set(x.n41+x.n31,x.n42+
+x.n32,x.n43+x.n33,x.n44+x.n34);for(pa=0;pa<6;pa++)N=J[pa],N.divideScalar(Math.sqrt(N.x*N.x+N.y*N.y+N.z*N.z));N=this.projectObjects(f,c,!0);f=0;for(pa=N.length;f<pa;f++)if(P=N[f].object,P.visible)if(fa=P.matrixWorld,la=P.matrixRotationWorld,qa=P.materials,Ca=P.overdraw,j=0,P instanceof THREE.Mesh){ia=P.geometry;ha=ia.vertices;sa=ia.faces;ia=ia.faceVertexUvs;ka=0;for(M=ha.length;ka<M;ka++)g=b(),g.positionWorld.copy(ha[ka].position),fa.multiplyVector3(g.positionWorld),g.positionScreen.copy(g.positionWorld),
 x.multiplyVector4(g.positionScreen),g.positionScreen.x/=g.positionScreen.w,g.positionScreen.y/=g.positionScreen.w,g.visible=g.positionScreen.z>L&&g.positionScreen.z<ra;ha=0;for(ka=sa.length;ha<ka;ha++){M=sa[ha];if(M instanceof THREE.Face3)if(F=p[M.a],Z=p[M.b],O=p[M.c],F.visible&&Z.visible&&O.visible&&(P.doubleSided||P.flipSided!=(O.positionScreen.x-F.positionScreen.x)*(Z.positionScreen.y-F.positionScreen.y)-(O.positionScreen.y-F.positionScreen.y)*(Z.positionScreen.x-F.positionScreen.x)<0))H=v[n]=
 v[n]||new THREE.RenderableFace3,n++,k=H,k.v1.copy(F),k.v2.copy(Z),k.v3.copy(O);else continue;else if(M instanceof THREE.Face4)if(F=p[M.a],Z=p[M.b],O=p[M.c],H=p[M.d],F.visible&&Z.visible&&O.visible&&H.visible&&(P.doubleSided||P.flipSided!=((H.positionScreen.x-F.positionScreen.x)*(Z.positionScreen.y-F.positionScreen.y)-(H.positionScreen.y-F.positionScreen.y)*(Z.positionScreen.x-F.positionScreen.x)<0||(Z.positionScreen.x-O.positionScreen.x)*(H.positionScreen.y-O.positionScreen.y)-(Z.positionScreen.y-
 O.positionScreen.y)*(H.positionScreen.x-O.positionScreen.x)<0)))ta=q[r]=q[r]||new THREE.RenderableFace4,r++,k=ta,k.v1.copy(F),k.v2.copy(Z),k.v3.copy(O),k.v4.copy(H);else continue;k.normalWorld.copy(M.normal);la.multiplyVector3(k.normalWorld);k.centroidWorld.copy(M.centroid);fa.multiplyVector3(k.centroidWorld);k.centroidScreen.copy(k.centroidWorld);x.multiplyVector3(k.centroidScreen);O=M.vertexNormals;F=0;for(Z=O.length;F<Z;F++)H=k.vertexNormalsWorld[F],H.copy(O[F]),la.multiplyVector3(H);F=0;for(Z=
-ia.length;F<Z;F++)if(ta=ia[F][ha]){O=0;for(H=ta.length;O<H;O++)k.uvs[F][O]=ta[O]}k.meshMaterials=qa;k.faceMaterials=M.materials;k.overdraw=Ba;k.z=k.centroidScreen.z;i.push(k)}}else if(P instanceof THREE.Line){R.multiply(x,fa);ha=P.geometry.vertices;F=b();F.positionScreen.copy(ha[0].position);R.multiplyVector4(F.positionScreen);ka=1;for(M=ha.length;ka<M;ka++)if(F=b(),F.positionScreen.copy(ha[ka].position),R.multiplyVector4(F.positionScreen),Z=p[j-2],aa.copy(F.positionScreen),E.copy(Z.positionScreen),
+ia.length;F<Z;F++)if(ta=ia[F][ha]){O=0;for(H=ta.length;O<H;O++)k.uvs[F][O]=ta[O]}k.meshMaterials=qa;k.faceMaterials=M.materials;k.overdraw=Ca;k.z=k.centroidScreen.z;i.push(k)}}else if(P instanceof THREE.Line){R.multiply(x,fa);ha=P.geometry.vertices;F=b();F.positionScreen.copy(ha[0].position);R.multiplyVector4(F.positionScreen);ka=1;for(M=ha.length;ka<M;ka++)if(F=b(),F.positionScreen.copy(ha[ka].position),R.multiplyVector4(F.positionScreen),Z=p[j-2],aa.copy(F.positionScreen),E.copy(Z.positionScreen),
 e(aa,E))aa.multiplyScalar(1/aa.w),E.multiplyScalar(1/E.w),fa=D[C]=D[C]||new THREE.RenderableLine,C++,z=fa,z.v1.positionScreen.copy(aa),z.v2.positionScreen.copy(E),z.z=Math.max(aa.z,E.z),z.materials=P.materials,i.push(z)}else if(P instanceof THREE.Particle&&(B.set(P.matrixWorld.n14,P.matrixWorld.n24,P.matrixWorld.n34,1),x.multiplyVector4(B),B.z/=B.w,B.z>0&&B.z<1))fa=Q[S]=Q[S]||new THREE.RenderableParticle,S++,y=fa,y.x=B.x/B.w,y.y=B.y/B.w,y.z=B.z,y.rotation=P.rotation.z,y.scale.x=P.scale.x*Math.abs(y.x-
 (B.x+c.projectionMatrix.n11)/(B.w+c.projectionMatrix.n14)),y.scale.y=P.scale.y*Math.abs(y.y-(B.y+c.projectionMatrix.n22)/(B.w+c.projectionMatrix.n24)),y.materials=P.materials,i.push(y);h&&i.sort(d);return i}};
 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(void 0,!1,d);var e=b.sounds,f,h=e.length;for(f=0;f<h;f++)b=e[f],this.soundPosition.set(b.matrixWorld.n14,b.matrixWorld.n24,b.matrixWorld.n34),this.soundPosition.subSelf(d.position),b.isPlaying&&b.isLoaded&&(b.isAddedToDOM||b.addToDOM(this.domElement),b.calculateVolumeAndPan(this.soundPosition))}};
@@ -181,11 +183,11 @@ THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.Shade
 "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 d(b,d,e){var f,h,g,i=b.vertices,j=i.length,k=b.colors,p=k.length,o=b.__vertexArray,G=b.__colorArray,ua=b.__sortArray,n=b.__dirtyVertices,r=b.__dirtyColors;if(e.sortParticles){P.multiplySelf(e.matrixWorld);for(f=0;f<j;f++)h=i[f].position,qa.copy(h),P.multiplyVector3(qa),ua[f]=[qa.z,f];ua.sort(function(b,c){return c[0]-b[0]});for(f=0;f<j;f++)h=i[ua[f][1]].position,g=f*3,o[g]=h.x,o[g+1]=h.y,o[g+2]=h.z;for(f=0;f<p;f++)g=f*3,color=k[ua[f][1]],G[g]=color.r,G[g+1]=
+THREE.WebGLRenderer=function(b){function d(b,d,e){var f,h,g,i=b.vertices,j=i.length,k=b.colors,p=k.length,o=b.__vertexArray,G=b.__colorArray,va=b.__sortArray,n=b.__dirtyVertices,r=b.__dirtyColors;if(e.sortParticles){P.multiplySelf(e.matrixWorld);for(f=0;f<j;f++)h=i[f].position,qa.copy(h),P.multiplyVector3(qa),va[f]=[qa.z,f];va.sort(function(b,c){return c[0]-b[0]});for(f=0;f<j;f++)h=i[va[f][1]].position,g=f*3,o[g]=h.x,o[g+1]=h.y,o[g+2]=h.z;for(f=0;f<p;f++)g=f*3,color=k[va[f][1]],G[g]=color.r,G[g+1]=
 color.g,G[g+2]=color.b}else{if(n)for(f=0;f<j;f++)h=i[f].position,g=f*3,o[g]=h.x,o[g+1]=h.y,o[g+2]=h.z;if(r)for(f=0;f<p;f++)color=k[f],g=f*3,G[g]=color.r,G[g+1]=color.g,G[g+2]=color.b}if(n||e.sortParticles)c.bindBuffer(c.ARRAY_BUFFER,b.__webglVertexBuffer),c.bufferData(c.ARRAY_BUFFER,o,d);if(r||e.sortParticles)c.bindBuffer(c.ARRAY_BUFFER,b.__webglColorBuffer),c.bufferData(c.ARRAY_BUFFER,G,d)}function e(b,d,e,f,h){f.program||$.initMaterial(f,d,e,h);var g=f.program,i=g.uniforms,j=f.uniforms;g!=oa&&(c.useProgram(g),
 oa=g);c.uniformMatrix4fv(i.projectionMatrix,!1,fa);if(e&&(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial||f instanceof THREE.LineBasicMaterial||f instanceof THREE.ParticleBasicMaterial||f.fog))if(j.fogColor.value=e.color,e instanceof THREE.Fog)j.fogNear.value=e.near,j.fogFar.value=e.far;else if(e instanceof THREE.FogExp2)j.fogDensity.value=e.density;if(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||
-f.lights){var k,p,o=0,G=0,ua=0,n,r,v,q,t=Ba,z=t.directional.colors,y=t.directional.positions,C=t.point.colors,I=t.point.positions,K=t.point.distances,u=0,s=0,e=p=q=0;for(k=d.length;e<k;e++)if(p=d[e],n=p.color,r=p.position,v=p.intensity,q=p.distance,p instanceof THREE.AmbientLight)o+=n.r,G+=n.g,ua+=n.b;else if(p instanceof THREE.DirectionalLight)q=u*3,z[q]=n.r*v,z[q+1]=n.g*v,z[q+2]=n.b*v,y[q]=r.x,y[q+1]=r.y,y[q+2]=r.z,u+=1;else if(p instanceof THREE.PointLight)p=s*3,C[p]=n.r*v,C[p+1]=n.g*v,C[p+2]=
-n.b*v,I[p]=r.x,I[p+1]=r.y,I[p+2]=r.z,K[s]=q,s+=1;for(e=u*3;e<z.length;e++)z[e]=0;for(e=s*3;e<C.length;e++)C[e]=0;t.point.length=s;t.directional.length=u;t.ambient[0]=o;t.ambient[1]=G;t.ambient[2]=ua;e=Ba;j.enableLighting.value=e.directional.length+e.point.length;j.ambientLightColor.value=e.ambient;j.directionalLightColor.value=e.directional.colors;j.directionalLightDirection.value=e.directional.positions;j.pointLightColor.value=e.point.colors;j.pointLightPosition.value=e.point.positions;j.pointLightDistance.value=
+f.lights){var k,p,o=0,G=0,va=0,n,r,v,q,t=Ca,z=t.directional.colors,y=t.directional.positions,C=t.point.colors,I=t.point.positions,K=t.point.distances,u=0,s=0,e=p=q=0;for(k=d.length;e<k;e++)if(p=d[e],n=p.color,r=p.position,v=p.intensity,q=p.distance,p instanceof THREE.AmbientLight)o+=n.r,G+=n.g,va+=n.b;else if(p instanceof THREE.DirectionalLight)q=u*3,z[q]=n.r*v,z[q+1]=n.g*v,z[q+2]=n.b*v,y[q]=r.x,y[q+1]=r.y,y[q+2]=r.z,u+=1;else if(p instanceof THREE.PointLight)p=s*3,C[p]=n.r*v,C[p+1]=n.g*v,C[p+2]=
+n.b*v,I[p]=r.x,I[p+1]=r.y,I[p+2]=r.z,K[s]=q,s+=1;for(e=u*3;e<z.length;e++)z[e]=0;for(e=s*3;e<C.length;e++)C[e]=0;t.point.length=s;t.directional.length=u;t.ambient[0]=o;t.ambient[1]=G;t.ambient[2]=va;e=Ca;j.enableLighting.value=e.directional.length+e.point.length;j.ambientLightColor.value=e.ambient;j.directionalLightColor.value=e.directional.colors;j.directionalLightDirection.value=e.directional.positions;j.pointLightColor.value=e.point.colors;j.pointLightPosition.value=e.point.positions;j.pointLightDistance.value=
 e.point.distances}if(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial)j.diffuse.value=f.color,j.opacity.value=f.opacity,(j.map.texture=f.map)&&j.offsetRepeat.value.set(f.map.offset.x,f.map.offset.y,f.map.repeat.x,f.map.repeat.y),j.lightMap.texture=f.lightMap,j.envMap.texture=f.envMap,j.reflectivity.value=f.reflectivity,j.refractionRatio.value=f.refractionRatio,j.combine.value=f.combine,j.useRefract.value=f.envMap&&f.envMap.mapping instanceof
 THREE.CubeRefractionMapping;if(f instanceof THREE.LineBasicMaterial)j.diffuse.value=f.color,j.opacity.value=f.opacity;else if(f instanceof THREE.ParticleBasicMaterial)j.psColor.value=f.color,j.opacity.value=f.opacity,j.size.value=f.size,j.scale.value=ia.height/2,j.map.texture=f.map;else if(f instanceof THREE.MeshPhongMaterial)j.ambient.value=f.ambient,j.specular.value=f.specular,j.shininess.value=f.shininess;else if(f instanceof THREE.MeshDepthMaterial)j.mNear.value=b.near,j.mFar.value=b.far,j.opacity.value=
 f.opacity;else if(f instanceof THREE.MeshNormalMaterial)j.opacity.value=f.opacity;for(var A in j)if(G=g.uniforms[A])if(k=j[A],o=k.type,e=k.value,o=="i")c.uniform1i(G,e);else if(o=="f")c.uniform1f(G,e);else if(o=="fv1")c.uniform1fv(G,e);else if(o=="fv")c.uniform3fv(G,e);else if(o=="v2")c.uniform2f(G,e.x,e.y);else if(o=="v3")c.uniform3f(G,e.x,e.y,e.z);else if(o=="v4")c.uniform4f(G,e.x,e.y,e.z,e.w);else if(o=="c")c.uniform3f(G,e.r,e.g,e.b);else if(o=="t"&&(c.uniform1i(G,e),k=k.texture))if(k.image instanceof
@@ -194,7 +196,7 @@ k,k.image[0]);c.bindTexture(c.TEXTURE_CUBE_MAP,null);k.needsUpdate=!1}c.activeTe
 f.envMap||f.skinning)&&i.objectMatrix!==null&&c.uniformMatrix4fv(i.objectMatrix,!1,h._objectMatrixArray);(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshShaderMaterial||f.skinning)&&i.viewMatrix!==null&&c.uniformMatrix4fv(i.viewMatrix,!1,la);if(f instanceof THREE.ShadowVolumeDynamicMaterial)b=j.directionalLightDirection.value,b[0]=-d[1].position.x,b[1]=-d[1].position.y,b[2]=-d[1].position.z,c.uniform3fv(i.directionalLightDirection,b),c.uniformMatrix4fv(i.objectMatrix,
 !1,h._objectMatrixArray),c.uniformMatrix4fv(i.viewMatrix,!1,la);f.skinning&&(c.uniformMatrix4fv(i.cameraInverseMatrix,!1,la),c.uniformMatrix4fv(i.boneGlobalMatrices,!1,h.boneMatrices));return g}function f(b,d,f,h,g,i){if(h.opacity!=0){var j,b=e(b,d,f,h,i).attributes;if(!h.morphTargets&&b.position>=0)c.bindBuffer(c.ARRAY_BUFFER,g.__webglVertexBuffer),c.vertexAttribPointer(b.position,3,c.FLOAT,!1,0,0);else{d=h.program.attributes;i.morphTargetBase!==-1?(c.bindBuffer(c.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[i.morphTargetBase]),
 c.vertexAttribPointer(d.position,3,c.FLOAT,!1,0,0)):d.position>=0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglVertexBuffer),c.vertexAttribPointer(d.position,3,c.FLOAT,!1,0,0));if(i.morphTargetForcedOrder.length)for(var f=0,k=i.morphTargetForcedOrder,p=i.morphTargetInfluences;f<h.numSupportedMorphTargets&&f<k.length;)c.bindBuffer(c.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[k[f]]),c.vertexAttribPointer(d["morphTarget"+f],3,c.FLOAT,!1,0,0),i.__webglMorphTargetInfluences[f]=p[k[f]],f++;else{var k=[],n=-1,
-o=0,p=i.morphTargetInfluences,G,ua=p.length,f=0;for(i.morphTargetBase!==-1&&(k[i.morphTargetBase]=!0);f<h.numSupportedMorphTargets;){for(G=0;G<ua;G++)!k[G]&&p[G]>n&&(o=G,n=p[o]);c.bindBuffer(c.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[o]);c.vertexAttribPointer(d["morphTarget"+f],3,c.FLOAT,!1,0,0);i.__webglMorphTargetInfluences[f]=n;k[o]=1;n=-1;f++}}h.program.uniforms.morphTargetInfluences!==null&&c.uniform1fv(h.program.uniforms.morphTargetInfluences,i.__webglMorphTargetInfluences)}if(g.__webglCustomAttributes)for(j in g.__webglCustomAttributes)b[j]>=
+o=0,p=i.morphTargetInfluences,G,va=p.length,f=0;for(i.morphTargetBase!==-1&&(k[i.morphTargetBase]=!0);f<h.numSupportedMorphTargets;){for(G=0;G<va;G++)!k[G]&&p[G]>n&&(o=G,n=p[o]);c.bindBuffer(c.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[o]);c.vertexAttribPointer(d["morphTarget"+f],3,c.FLOAT,!1,0,0);i.__webglMorphTargetInfluences[f]=n;k[o]=1;n=-1;f++}}h.program.uniforms.morphTargetInfluences!==null&&c.uniform1fv(h.program.uniforms.morphTargetInfluences,i.__webglMorphTargetInfluences)}if(g.__webglCustomAttributes)for(j in g.__webglCustomAttributes)b[j]>=
 0&&(d=g.__webglCustomAttributes[j],c.bindBuffer(c.ARRAY_BUFFER,d.buffer),c.vertexAttribPointer(b[j],d.size,c.FLOAT,!1,0,0));b.color>=0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglColorBuffer),c.vertexAttribPointer(b.color,3,c.FLOAT,!1,0,0));b.normal>=0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglNormalBuffer),c.vertexAttribPointer(b.normal,3,c.FLOAT,!1,0,0));b.tangent>=0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglTangentBuffer),c.vertexAttribPointer(b.tangent,4,c.FLOAT,!1,0,0));b.uv>=0&&(g.__webglUVBuffer?(c.bindBuffer(c.ARRAY_BUFFER,
 g.__webglUVBuffer),c.vertexAttribPointer(b.uv,2,c.FLOAT,!1,0,0),c.enableVertexAttribArray(b.uv)):c.disableVertexAttribArray(b.uv));b.uv2>=0&&(g.__webglUV2Buffer?(c.bindBuffer(c.ARRAY_BUFFER,g.__webglUV2Buffer),c.vertexAttribPointer(b.uv2,2,c.FLOAT,!1,0,0),c.enableVertexAttribArray(b.uv2)):c.disableVertexAttribArray(b.uv2));h.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglSkinVertexABuffer),c.vertexAttribPointer(b.skinVertexA,4,
 c.FLOAT,!1,0,0),c.bindBuffer(c.ARRAY_BUFFER,g.__webglSkinVertexBBuffer),c.vertexAttribPointer(b.skinVertexB,4,c.FLOAT,!1,0,0),c.bindBuffer(c.ARRAY_BUFFER,g.__webglSkinIndicesBuffer),c.vertexAttribPointer(b.skinIndex,4,c.FLOAT,!1,0,0),c.bindBuffer(c.ARRAY_BUFFER,g.__webglSkinWeightsBuffer),c.vertexAttribPointer(b.skinWeight,4,c.FLOAT,!1,0,0));i instanceof THREE.Mesh?(h.wireframe?(c.lineWidth(h.wireframeLinewidth),c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,g.__webglLineBuffer),c.drawElements(c.LINES,g.__webglLineCount,
@@ -208,90 +210,90 @@ c.polygonOffset(0.1,1);c.enable(c.STENCIL_TEST);c.enable(c.DEPTH_TEST);c.depthMa
 i=b.__webglShadowVolumes[o].buffer,j=f.materials[0],j.program||$.initMaterial(j,g,void 0,f),j=j.program,k=j.uniforms,p=j.attributes,oa!==j&&(c.useProgram(j),oa=j,c.uniformMatrix4fv(k.projectionMatrix,!1,fa),c.uniformMatrix4fv(k.viewMatrix,!1,la),c.uniform3fv(k.directionalLightDirection,h)),f.matrixWorld.flattenToArray(f._objectMatrixArray),c.uniformMatrix4fv(k.objectMatrix,!1,f._objectMatrixArray),c.bindBuffer(c.ARRAY_BUFFER,i.__webglVertexBuffer),c.vertexAttribPointer(p.position,3,c.FLOAT,!1,0,0),
 c.bindBuffer(c.ARRAY_BUFFER,i.__webglNormalBuffer),c.vertexAttribPointer(p.normal,3,c.FLOAT,!1,0,0),c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,i.__webglFaceBuffer),c.cullFace(c.FRONT),c.drawElements(c.TRIANGLES,i.__webglFaceCount,c.UNSIGNED_SHORT,0),c.cullFace(c.BACK),c.drawElements(c.TRIANGLES,i.__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);M=-1;oa=u.program;c.useProgram(u.program);
 c.uniformMatrix4fv(u.projectionLocation,!1,fa);c.uniform1f(u.darknessLocation,u.darkness);c.bindBuffer(c.ARRAY_BUFFER,u.vertexBuffer);c.vertexAttribPointer(u.vertexLocation,3,c.FLOAT,!1,0,0);c.enableVertexAttribArray(u.vertexLocation);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA);c.blendEquation(c.FUNC_ADD);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,u.elementBuffer);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0);c.disable(c.STENCIL_TEST);c.enable(c.DEPTH_TEST);c.depthMask(ra)}function z(b,d){var e,f,g;e=_sprite.attributes;
-var h=_sprite.uniforms,i=H/O,j,k=[],p=O*0.5,o=H*0.5,n=!0;c.useProgram(_sprite.program);oa=_sprite.program;M=-1;Da||(c.enableVertexAttribArray(_sprite.attributes.position),c.enableVertexAttribArray(_sprite.attributes.uv),Da=!0);c.disable(c.CULL_FACE);c.enable(c.BLEND);c.depthMask(!0);c.bindBuffer(c.ARRAY_BUFFER,_sprite.vertexBuffer);c.vertexAttribPointer(e.position,2,c.FLOAT,!1,16,0);c.vertexAttribPointer(e.uv,2,c.FLOAT,!1,16,8);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,_sprite.elementBuffer);c.uniformMatrix4fv(h.projectionMatrix,
+var h=_sprite.uniforms,i=H/O,j,k=[],p=O*0.5,o=H*0.5,n=!0;c.useProgram(_sprite.program);oa=_sprite.program;M=-1;Ea||(c.enableVertexAttribArray(_sprite.attributes.position),c.enableVertexAttribArray(_sprite.attributes.uv),Ea=!0);c.disable(c.CULL_FACE);c.enable(c.BLEND);c.depthMask(!0);c.bindBuffer(c.ARRAY_BUFFER,_sprite.vertexBuffer);c.vertexAttribPointer(e.position,2,c.FLOAT,!1,16,0);c.vertexAttribPointer(e.uv,2,c.FLOAT,!1,16,8);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,_sprite.elementBuffer);c.uniformMatrix4fv(h.projectionMatrix,
 !1,fa);c.activeTexture(c.TEXTURE0);c.uniform1i(h.map,0);e=0;for(f=b.__webglSprites.length;e<f;e++)g=b.__webglSprites[e],g.useScreenCoordinates?g.z=-g.position.z:(g._modelViewMatrix.multiplyToArray(d.matrixWorldInverse,g.matrixWorld,g._modelViewMatrixArray),g.z=-g._modelViewMatrix.n34);b.__webglSprites.sort(r);e=0;for(f=b.__webglSprites.length;e<f;e++)g=b.__webglSprites[e],g.material===void 0&&g.map&&g.map.image&&g.map.image.width&&(g.useScreenCoordinates?(c.uniform1i(h.useScreenCoordinates,1),c.uniform3f(h.screenPosition,
 (g.position.x-p)/p,(o-g.position.y)/o,Math.max(0,Math.min(1,g.position.z)))):(c.uniform1i(h.useScreenCoordinates,0),c.uniform1i(h.affectedByDistance,g.affectedByDistance?1:0),c.uniformMatrix4fv(h.modelViewMatrix,!1,g._modelViewMatrixArray)),j=g.map.image.width/(g.affectedByDistance?1:H),k[0]=j*i*g.scale.x,k[1]=j*g.scale.y,c.uniform2f(h.uvScale,g.uvScale.x,g.uvScale.y),c.uniform2f(h.uvOffset,g.uvOffset.x,g.uvOffset.y),c.uniform2f(h.alignment,g.alignment.x,g.alignment.y),c.uniform1f(h.opacity,g.opacity),
-c.uniform1f(h.rotation,g.rotation),c.uniform2fv(h.scale,k),g.mergeWith3D&&!n?(c.enable(c.DEPTH_TEST),n=!0):!g.mergeWith3D&&n&&(c.disable(c.DEPTH_TEST),n=!1),L(g.blending),x(g.map,0),c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0));c.enable(c.CULL_FACE);c.enable(c.DEPTH_TEST);c.depthMask(ra)}function C(b,d){var e,f,g=b.__webglLensFlares.length,h,i,j,k=new THREE.Vector3,p=H/O,o=O*0.5,n=H*0.5,r=16/H,v=[r*p,r],q=[1,1,0],z=[1,1],y=t.uniforms;e=t.attributes;c.useProgram(t.program);oa=t.program;M=-1;Ea||
-(c.enableVertexAttribArray(t.attributes.vertex),c.enableVertexAttribArray(t.attributes.uv),Ea=!0);c.uniform1i(y.occlusionMap,0);c.uniform1i(y.map,1);c.bindBuffer(c.ARRAY_BUFFER,t.vertexBuffer);c.vertexAttribPointer(e.vertex,2,c.FLOAT,!1,16,0);c.vertexAttribPointer(e.uv,2,c.FLOAT,!1,16,8);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,t.elementBuffer);c.disable(c.CULL_FACE);c.depthMask(!1);c.activeTexture(c.TEXTURE0);c.bindTexture(c.TEXTURE_2D,t.occlusionTexture);c.activeTexture(c.TEXTURE1);for(f=0;f<g;f++)if(e=
+c.uniform1f(h.rotation,g.rotation),c.uniform2fv(h.scale,k),g.mergeWith3D&&!n?(c.enable(c.DEPTH_TEST),n=!0):!g.mergeWith3D&&n&&(c.disable(c.DEPTH_TEST),n=!1),L(g.blending),x(g.map,0),c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0));c.enable(c.CULL_FACE);c.enable(c.DEPTH_TEST);c.depthMask(ra)}function C(b,d){var e,f,g=b.__webglLensFlares.length,h,i,j,k=new THREE.Vector3,p=H/O,o=O*0.5,n=H*0.5,r=16/H,v=[r*p,r],q=[1,1,0],z=[1,1],y=t.uniforms;e=t.attributes;c.useProgram(t.program);oa=t.program;M=-1;Fa||
+(c.enableVertexAttribArray(t.attributes.vertex),c.enableVertexAttribArray(t.attributes.uv),Fa=!0);c.uniform1i(y.occlusionMap,0);c.uniform1i(y.map,1);c.bindBuffer(c.ARRAY_BUFFER,t.vertexBuffer);c.vertexAttribPointer(e.vertex,2,c.FLOAT,!1,16,0);c.vertexAttribPointer(e.uv,2,c.FLOAT,!1,16,8);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,t.elementBuffer);c.disable(c.CULL_FACE);c.depthMask(!1);c.activeTexture(c.TEXTURE0);c.bindTexture(c.TEXTURE_2D,t.occlusionTexture);c.activeTexture(c.TEXTURE1);for(f=0;f<g;f++)if(e=
 b.__webglLensFlares[f].object,k.set(e.matrixWorld.n14,e.matrixWorld.n24,e.matrixWorld.n34),d.matrixWorldInverse.multiplyVector3(k),d.projectionMatrix.multiplyVector3(k),q[0]=k.x,q[1]=k.y,q[2]=k.z,z[0]=q[0]*o+o,z[1]=q[1]*n+n,t.hasVertexTexture||z[0]>0&&z[0]<O&&z[1]>0&&z[1]<H){c.bindTexture(c.TEXTURE_2D,t.tempTexture);c.copyTexImage2D(c.TEXTURE_2D,0,c.RGB,z[0]-8,z[1]-8,16,16,0);c.uniform1i(y.renderType,0);c.uniform2fv(y.scale,v);c.uniform3fv(y.screenPosition,q);c.disable(c.BLEND);c.enable(c.DEPTH_TEST);
 c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0);c.bindTexture(c.TEXTURE_2D,t.occlusionTexture);c.copyTexImage2D(c.TEXTURE_2D,0,c.RGBA,z[0]-8,z[1]-8,16,16,0);c.uniform1i(y.renderType,1);c.disable(c.DEPTH_TEST);c.bindTexture(c.TEXTURE_2D,t.tempTexture);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0);e.positionScreen.x=q[0];e.positionScreen.y=q[1];e.positionScreen.z=q[2];e.customUpdateCallback?e.customUpdateCallback(e):e.updateLensFlares();c.uniform1i(y.renderType,2);c.enable(c.BLEND);h=0;for(i=e.lensFlares.length;h<
 i;h++)if(j=e.lensFlares[h],j.opacity>0.0010&&j.scale>0.0010)q[0]=j.x,q[1]=j.y,q[2]=j.z,r=j.size*j.scale/H,v[0]=r*p,v[1]=r,c.uniform3fv(y.screenPosition,q),c.uniform2fv(y.scale,v),c.uniform1f(y.rotation,j.rotation),c.uniform1f(y.opacity,j.opacity),L(j.blending),x(j.texture,1),c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0)}c.enable(c.CULL_FACE);c.enable(c.DEPTH_TEST);c.depthMask(ra)}function D(b,c){b._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}
 function y(b){var e,f,g,h,i;if(b instanceof THREE.Mesh){f=b.geometry;for(e in f.geometryGroups){g=f.geometryGroups[e];i=!1;for(h in g.__webglCustomAttributes)if(g.__webglCustomAttributes[h].needsUpdate){i=!0;break}if(f.__dirtyVertices||f.__dirtyMorphTargets||f.__dirtyElements||f.__dirtyUvs||f.__dirtyNormals||f.__dirtyColors||f.__dirtyTangents||i){i=b;var j=c.DYNAMIC_DRAW;if(g.__inittedArrays){var k=void 0,p=void 0,n=void 0,o=void 0,G=n=void 0,r=void 0,v=void 0,q=void 0,t=void 0,z=void 0,y=void 0,
 x=void 0,C=void 0,u=void 0,I=void 0,K=void 0,D=void 0,s=o=q=o=v=r=void 0,A=void 0,m=A=s=r=void 0,F=void 0,J=m=A=s=n=n=G=q=o=m=A=s=F=m=A=s=F=m=A=s=void 0,B=0,E=0,O=0,P=0,H=0,M=0,T=0,N=0,ca=0,w=0,da=0,A=s=0,L=g.__vertexArray,Z=g.__uvArray,$=g.__uv2Array,Q=g.__normalArray,U=g.__tangentArray,ea=g.__colorArray,V=g.__skinVertexAArray,W=g.__skinVertexBArray,X=g.__skinIndexArray,Y=g.__skinWeightArray,aa=g.__morphTargetsArrays,R=g.__webglCustomAttributes,m=void 0,ma=g.__faceArray,S=g.__lineArray,ja=g.__needsSmoothNormals,
-z=g.__vertexColorType,t=g.__uvType,y=g.__normalType,ga=i.geometry,ha=ga.__dirtyVertices,ia=ga.__dirtyElements,fa=ga.__dirtyUvs,ka=ga.__dirtyNormals,na=ga.__dirtyTangents,oa=ga.__dirtyColors,pa=ga.__dirtyMorphTargets,la=ga.vertices,qa=g.faces,ra=ga.faces,sa=ga.faceVertexUvs[0],ta=ga.faceVertexUvs[1],xa=ga.skinVerticesA,ya=ga.skinVerticesB,za=ga.skinIndices,va=ga.skinWeights,wa=i instanceof THREE.ShadowVolume?ga.edgeFaces:void 0;morphTargets=ga.morphTargets;if(R)for(J in R)R[J].offset=0,R[J].offsetSrc=
-0;k=0;for(p=qa.length;k<p;k++)if(n=qa[k],o=ra[n],sa&&(x=sa[n]),ta&&(C=ta[n]),n=o.vertexNormals,G=o.normal,r=o.vertexColors,v=o.color,q=o.vertexTangents,o instanceof THREE.Face3){if(ha)u=la[o.a].position,I=la[o.b].position,K=la[o.c].position,L[E]=u.x,L[E+1]=u.y,L[E+2]=u.z,L[E+3]=I.x,L[E+4]=I.y,L[E+5]=I.z,L[E+6]=K.x,L[E+7]=K.y,L[E+8]=K.z,E+=9;if(R)for(J in R)if(m=R[J],m.needsUpdate)s=m.offset,A=m.offsetSrc,m.size===1?(m.boundTo===void 0||m.boundTo==="vertices"?(m.array[s+0]=m.value[o.a],m.array[s+1]=
-m.value[o.b],m.array[s+2]=m.value[o.c]):m.boundTo==="faces"?(m.array[s+0]=m.value[A],m.array[s+1]=m.value[A],m.array[s+2]=m.value[A],m.offsetSrc++):m.boundTo==="faceVertices"&&(m.array[s+0]=m.value[A+0],m.array[s+1]=m.value[A+1],m.array[s+2]=m.value[A+2],m.offsetSrc+=3),m.offset+=3):(m.boundTo===void 0||m.boundTo==="vertices"?(u=m.value[o.a],I=m.value[o.b],K=m.value[o.c]):m.boundTo==="faces"?(u=m.value[A],I=m.value[A],K=m.value[A],m.offsetSrc++):m.boundTo==="faceVertices"&&(u=m.value[A+0],I=m.value[A+
-1],K=m.value[A+2],m.offsetSrc+=3),m.size===2?(m.array[s+0]=u.x,m.array[s+1]=u.y,m.array[s+2]=I.x,m.array[s+3]=I.y,m.array[s+4]=K.x,m.array[s+5]=K.y,m.offset+=6):m.size===3?(m.type==="c"?(m.array[s+0]=u.r,m.array[s+1]=u.g,m.array[s+2]=u.b,m.array[s+3]=I.r,m.array[s+4]=I.g,m.array[s+5]=I.b,m.array[s+6]=K.r,m.array[s+7]=K.g,m.array[s+8]=K.b):(m.array[s+0]=u.x,m.array[s+1]=u.y,m.array[s+2]=u.z,m.array[s+3]=I.x,m.array[s+4]=I.y,m.array[s+5]=I.z,m.array[s+6]=K.x,m.array[s+7]=K.y,m.array[s+8]=K.z),m.offset+=
-9):(m.array[s+0]=u.x,m.array[s+1]=u.y,m.array[s+2]=u.z,m.array[s+3]=u.w,m.array[s+4]=I.x,m.array[s+5]=I.y,m.array[s+6]=I.z,m.array[s+7]=I.w,m.array[s+8]=K.x,m.array[s+9]=K.y,m.array[s+10]=K.z,m.array[s+11]=K.w,m.offset+=12));if(pa){s=0;for(A=morphTargets.length;s<A;s++)u=morphTargets[s].vertices[o.a].position,I=morphTargets[s].vertices[o.b].position,K=morphTargets[s].vertices[o.c].position,m=aa[s],m[da+0]=u.x,m[da+1]=u.y,m[da+2]=u.z,m[da+3]=I.x,m[da+4]=I.y,m[da+5]=I.z,m[da+6]=K.x,m[da+7]=K.y,m[da+
-8]=K.z;da+=9}if(va.length)s=va[o.a],A=va[o.b],m=va[o.c],Y[w]=s.x,Y[w+1]=s.y,Y[w+2]=s.z,Y[w+3]=s.w,Y[w+4]=A.x,Y[w+5]=A.y,Y[w+6]=A.z,Y[w+7]=A.w,Y[w+8]=m.x,Y[w+9]=m.y,Y[w+10]=m.z,Y[w+11]=m.w,s=za[o.a],A=za[o.b],m=za[o.c],X[w]=s.x,X[w+1]=s.y,X[w+2]=s.z,X[w+3]=s.w,X[w+4]=A.x,X[w+5]=A.y,X[w+6]=A.z,X[w+7]=A.w,X[w+8]=m.x,X[w+9]=m.y,X[w+10]=m.z,X[w+11]=m.w,s=xa[o.a],A=xa[o.b],m=xa[o.c],V[w]=s.x,V[w+1]=s.y,V[w+2]=s.z,V[w+3]=1,V[w+4]=A.x,V[w+5]=A.y,V[w+6]=A.z,V[w+7]=1,V[w+8]=m.x,V[w+9]=m.y,V[w+10]=m.z,V[w+11]=
-1,s=ya[o.a],A=ya[o.b],m=ya[o.c],W[w]=s.x,W[w+1]=s.y,W[w+2]=s.z,W[w+3]=1,W[w+4]=A.x,W[w+5]=A.y,W[w+6]=A.z,W[w+7]=1,W[w+8]=m.x,W[w+9]=m.y,W[w+10]=m.z,W[w+11]=1,w+=12;if(oa&&z)r.length==3&&z==THREE.VertexColors?(o=r[0],s=r[1],A=r[2]):A=s=o=v,ea[ca]=o.r,ea[ca+1]=o.g,ea[ca+2]=o.b,ea[ca+3]=s.r,ea[ca+4]=s.g,ea[ca+5]=s.b,ea[ca+6]=A.r,ea[ca+7]=A.g,ea[ca+8]=A.b,ca+=9;if(na&&ga.hasTangents)r=q[0],v=q[1],o=q[2],U[T]=r.x,U[T+1]=r.y,U[T+2]=r.z,U[T+3]=r.w,U[T+4]=v.x,U[T+5]=v.y,U[T+6]=v.z,U[T+7]=v.w,U[T+8]=o.x,U[T+
-9]=o.y,U[T+10]=o.z,U[T+11]=o.w,T+=12;if(ka&&y)if(n.length==3&&ja)for(q=0;q<3;q++)G=n[q],Q[M]=G.x,Q[M+1]=G.y,Q[M+2]=G.z,M+=3;else for(q=0;q<3;q++)Q[M]=G.x,Q[M+1]=G.y,Q[M+2]=G.z,M+=3;if(fa&&x!==void 0&&t)for(q=0;q<3;q++)n=x[q],Z[O]=n.u,Z[O+1]=n.v,O+=2;if(fa&&C!==void 0&&t)for(q=0;q<3;q++)n=C[q],$[P]=n.u,$[P+1]=n.v,P+=2;ia&&(ma[H]=B,ma[H+1]=B+1,ma[H+2]=B+2,H+=3,S[N]=B,S[N+1]=B+1,S[N+2]=B,S[N+3]=B+2,S[N+4]=B+1,S[N+5]=B+2,N+=6,B+=3)}else if(o instanceof THREE.Face4){if(ha)u=la[o.a].position,I=la[o.b].position,
-K=la[o.c].position,D=la[o.d].position,L[E]=u.x,L[E+1]=u.y,L[E+2]=u.z,L[E+3]=I.x,L[E+4]=I.y,L[E+5]=I.z,L[E+6]=K.x,L[E+7]=K.y,L[E+8]=K.z,L[E+9]=D.x,L[E+10]=D.y,L[E+11]=D.z,E+=12;if(R)for(J in R)if(m=R[J],m.needsUpdate)s=m.offset,A=m.offsetSrc,m.size===1?(m.boundTo===void 0||m.boundTo==="vertices"?(m.array[s+0]=m.value[o.a],m.array[s+1]=m.value[o.b],m.array[s+2]=m.value[o.c],m.array[s+3]=m.value[o.d]):m.boundTo==="faces"?(m.array[s+0]=m.value[A],m.array[s+1]=m.value[A],m.array[s+2]=m.value[A],m.array[s+
-3]=m.value[A],m.offsetSrc++):m.boundTo==="faceVertices"&&(m.array[s+0]=m.value[A+0],m.array[s+1]=m.value[A+1],m.array[s+2]=m.value[A+2],m.array[s+3]=m.value[A+3],m.offsetSrc+=4),m.offset+=4):(m.boundTo===void 0||m.boundTo==="vertices"?(u=m.value[o.a],I=m.value[o.b],K=m.value[o.c],D=m.value[o.d]):m.boundTo==="faces"?(u=m.value[A],I=m.value[A],K=m.value[A],D=m.value[A],m.offsetSrc++):m.boundTo==="faceVertices"&&(u=m.value[A+0],I=m.value[A+1],K=m.value[A+2],D=m.value[A+3],m.offsetSrc+=4),m.size===2?
-(m.array[s+0]=u.x,m.array[s+1]=u.y,m.array[s+2]=I.x,m.array[s+3]=I.y,m.array[s+4]=K.x,m.array[s+5]=K.y,m.array[s+6]=D.x,m.array[s+7]=D.y,m.offset+=8):m.size===3?(m.type==="c"?(m.array[s+0]=u.r,m.array[s+1]=u.g,m.array[s+2]=u.b,m.array[s+3]=I.r,m.array[s+4]=I.g,m.array[s+5]=I.b,m.array[s+6]=K.r,m.array[s+7]=K.g,m.array[s+8]=K.b,m.array[s+9]=D.r,m.array[s+10]=D.g,m.array[s+11]=D.b):(m.array[s+0]=u.x,m.array[s+1]=u.y,m.array[s+2]=u.z,m.array[s+3]=I.x,m.array[s+4]=I.y,m.array[s+5]=I.z,m.array[s+6]=K.x,
-m.array[s+7]=K.y,m.array[s+8]=K.z,m.array[s+9]=D.x,m.array[s+10]=D.y,m.array[s+11]=D.z),m.offset+=12):(m.array[s+0]=u.x,m.array[s+1]=u.y,m.array[s+2]=u.z,m.array[s+3]=u.w,m.array[s+4]=I.x,m.array[s+5]=I.y,m.array[s+6]=I.z,m.array[s+7]=I.w,m.array[s+8]=K.x,m.array[s+9]=K.y,m.array[s+10]=K.z,m.array[s+11]=K.w,m.array[s+12]=D.x,m.array[s+13]=D.y,m.array[s+14]=D.z,m.array[s+15]=D.w,m.offset+=16));if(pa){s=0;for(A=morphTargets.length;s<A;s++)u=morphTargets[s].vertices[o.a].position,I=morphTargets[s].vertices[o.b].position,
-K=morphTargets[s].vertices[o.c].position,D=morphTargets[s].vertices[o.d].position,m=aa[s],m[da+0]=u.x,m[da+1]=u.y,m[da+2]=u.z,m[da+3]=I.x,m[da+4]=I.y,m[da+5]=I.z,m[da+6]=K.x,m[da+7]=K.y,m[da+8]=K.z,m[da+9]=D.x,m[da+10]=D.y,m[da+11]=D.z;da+=12}if(va.length)s=va[o.a],A=va[o.b],m=va[o.c],F=va[o.d],Y[w]=s.x,Y[w+1]=s.y,Y[w+2]=s.z,Y[w+3]=s.w,Y[w+4]=A.x,Y[w+5]=A.y,Y[w+6]=A.z,Y[w+7]=A.w,Y[w+8]=m.x,Y[w+9]=m.y,Y[w+10]=m.z,Y[w+11]=m.w,Y[w+12]=F.x,Y[w+13]=F.y,Y[w+14]=F.z,Y[w+15]=F.w,s=za[o.a],A=za[o.b],m=za[o.c],
-F=za[o.d],X[w]=s.x,X[w+1]=s.y,X[w+2]=s.z,X[w+3]=s.w,X[w+4]=A.x,X[w+5]=A.y,X[w+6]=A.z,X[w+7]=A.w,X[w+8]=m.x,X[w+9]=m.y,X[w+10]=m.z,X[w+11]=m.w,X[w+12]=F.x,X[w+13]=F.y,X[w+14]=F.z,X[w+15]=F.w,s=xa[o.a],A=xa[o.b],m=xa[o.c],F=xa[o.d],V[w]=s.x,V[w+1]=s.y,V[w+2]=s.z,V[w+3]=1,V[w+4]=A.x,V[w+5]=A.y,V[w+6]=A.z,V[w+7]=1,V[w+8]=m.x,V[w+9]=m.y,V[w+10]=m.z,V[w+11]=1,V[w+12]=F.x,V[w+13]=F.y,V[w+14]=F.z,V[w+15]=1,s=ya[o.a],A=ya[o.b],m=ya[o.c],o=ya[o.d],W[w]=s.x,W[w+1]=s.y,W[w+2]=s.z,W[w+3]=1,W[w+4]=A.x,W[w+5]=A.y,
-W[w+6]=A.z,W[w+7]=1,W[w+8]=m.x,W[w+9]=m.y,W[w+10]=m.z,W[w+11]=1,W[w+12]=o.x,W[w+13]=o.y,W[w+14]=o.z,W[w+15]=1,w+=16;if(oa&&z)r.length==4&&z==THREE.VertexColors?(o=r[0],s=r[1],A=r[2],r=r[3]):r=A=s=o=v,ea[ca]=o.r,ea[ca+1]=o.g,ea[ca+2]=o.b,ea[ca+3]=s.r,ea[ca+4]=s.g,ea[ca+5]=s.b,ea[ca+6]=A.r,ea[ca+7]=A.g,ea[ca+8]=A.b,ea[ca+9]=r.r,ea[ca+10]=r.g,ea[ca+11]=r.b,ca+=12;if(na&&ga.hasTangents)r=q[0],v=q[1],o=q[2],q=q[3],U[T]=r.x,U[T+1]=r.y,U[T+2]=r.z,U[T+3]=r.w,U[T+4]=v.x,U[T+5]=v.y,U[T+6]=v.z,U[T+7]=v.w,U[T+
-8]=o.x,U[T+9]=o.y,U[T+10]=o.z,U[T+11]=o.w,U[T+12]=q.x,U[T+13]=q.y,U[T+14]=q.z,U[T+15]=q.w,T+=16;if(ka&&y)if(n.length==4&&ja)for(q=0;q<4;q++)G=n[q],Q[M]=G.x,Q[M+1]=G.y,Q[M+2]=G.z,M+=3;else for(q=0;q<4;q++)Q[M]=G.x,Q[M+1]=G.y,Q[M+2]=G.z,M+=3;if(fa&&x!==void 0&&t)for(q=0;q<4;q++)n=x[q],Z[O]=n.u,Z[O+1]=n.v,O+=2;if(fa&&C!==void 0&&t)for(q=0;q<4;q++)n=C[q],$[P]=n.u,$[P+1]=n.v,P+=2;ia&&(ma[H]=B,ma[H+1]=B+1,ma[H+2]=B+3,ma[H+3]=B+1,ma[H+4]=B+2,ma[H+5]=B+3,H+=6,S[N]=B,S[N+1]=B+1,S[N+2]=B,S[N+3]=B+3,S[N+4]=
-B+1,S[N+5]=B+2,S[N+6]=B+2,S[N+7]=B+3,N+=8,B+=4)}if(wa){k=0;for(p=wa.length;k<p;k++)ma[H]=wa[k].a,ma[H+1]=wa[k].b,ma[H+2]=wa[k].c,ma[H+3]=wa[k].a,ma[H+4]=wa[k].c,ma[H+5]=wa[k].d,H+=6}ha&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglVertexBuffer),c.bufferData(c.ARRAY_BUFFER,L,j));if(R)for(J in R)if(m=R[J],m.needsUpdate)c.bindBuffer(c.ARRAY_BUFFER,m.buffer),c.bufferData(c.ARRAY_BUFFER,m.array,j),m.needsUpdate=!1;if(pa){s=0;for(A=morphTargets.length;s<A;s++)c.bindBuffer(c.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[s]),
-c.bufferData(c.ARRAY_BUFFER,aa[s],j)}oa&&ca>0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglColorBuffer),c.bufferData(c.ARRAY_BUFFER,ea,j));ka&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglNormalBuffer),c.bufferData(c.ARRAY_BUFFER,Q,j));na&&ga.hasTangents&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglTangentBuffer),c.bufferData(c.ARRAY_BUFFER,U,j));fa&&O>0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglUVBuffer),c.bufferData(c.ARRAY_BUFFER,Z,j));fa&&P>0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglUV2Buffer),c.bufferData(c.ARRAY_BUFFER,
-$,j));ia&&(c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,g.__webglFaceBuffer),c.bufferData(c.ELEMENT_ARRAY_BUFFER,ma,j),c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,g.__webglLineBuffer),c.bufferData(c.ELEMENT_ARRAY_BUFFER,S,j));w>0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglSkinVertexABuffer),c.bufferData(c.ARRAY_BUFFER,V,j),c.bindBuffer(c.ARRAY_BUFFER,g.__webglSkinVertexBBuffer),c.bufferData(c.ARRAY_BUFFER,W,j),c.bindBuffer(c.ARRAY_BUFFER,g.__webglSkinIndicesBuffer),c.bufferData(c.ARRAY_BUFFER,X,j),c.bindBuffer(c.ARRAY_BUFFER,
-g.__webglSkinWeightsBuffer),c.bufferData(c.ARRAY_BUFFER,Y,j));i.dynamic||(delete g.__inittedArrays,delete g.__colorArray,delete g.__normalArray,delete g.__tangentArray,delete g.__uvArray,delete g.__uv2Array,delete g.__faceArray,delete g.__vertexArray,delete g.__lineArray,delete g.__skinVertexAArray,delete g.__skinVertexBArray,delete g.__skinIndexArray,delete g.__skinWeightArray)}}}f.__dirtyVertices=!1;f.__dirtyMorphTargets=!1;f.__dirtyElements=!1;f.__dirtyUvs=!1;f.__dirtyNormals=!1;f.__dirtyTangents=
-!1;f.__dirtyColors=!1}else if(b instanceof THREE.Ribbon){f=b.geometry;if(f.__dirtyVertices||f.__dirtyColors){b=f;e=c.DYNAMIC_DRAW;t=b.vertices;g=b.colors;z=t.length;i=g.length;y=b.__vertexArray;j=b.__colorArray;x=b.__dirtyColors;if(b.__dirtyVertices){for(k=0;k<z;k++)p=t[k].position,h=k*3,y[h]=p.x,y[h+1]=p.y,y[h+2]=p.z;c.bindBuffer(c.ARRAY_BUFFER,b.__webglVertexBuffer);c.bufferData(c.ARRAY_BUFFER,y,e)}if(x){for(k=0;k<i;k++)color=g[k],h=k*3,j[h]=color.r,j[h+1]=color.g,j[h+2]=color.b;c.bindBuffer(c.ARRAY_BUFFER,
-b.__webglColorBuffer);c.bufferData(c.ARRAY_BUFFER,j,e)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(b instanceof THREE.Line){f=b.geometry;if(f.__dirtyVertices||f.__dirtyColors){b=f;e=c.DYNAMIC_DRAW;t=b.vertices;g=b.colors;z=t.length;i=g.length;y=b.__vertexArray;j=b.__colorArray;x=b.__dirtyColors;if(b.__dirtyVertices){for(k=0;k<z;k++)p=t[k].position,h=k*3,y[h]=p.x,y[h+1]=p.y,y[h+2]=p.z;c.bindBuffer(c.ARRAY_BUFFER,b.__webglVertexBuffer);c.bufferData(c.ARRAY_BUFFER,y,e)}if(x){for(k=0;k<i;k++)color=
-g[k],h=k*3,j[h]=color.r,j[h+1]=color.g,j[h+2]=color.b;c.bindBuffer(c.ARRAY_BUFFER,b.__webglColorBuffer);c.bufferData(c.ARRAY_BUFFER,j,e)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(b instanceof THREE.ParticleSystem)f=b.geometry,(f.__dirtyVertices||f.__dirtyColors||b.sortParticles)&&d(f,c.DYNAMIC_DRAW,b),f.__dirtyVertices=!1,f.__dirtyColors=!1}function S(b){function c(b){var f=[];d=0;for(e=b.length;d<e;d++)b[d]==void 0?f.push("undefined"):f.push(b[d].id);return f.join("_")}var d,e,f,g,h,i,j,k,
-o={},p=b.morphTargets!==void 0?b.morphTargets.length:0;b.geometryGroups={};f=0;for(g=b.faces.length;f<g;f++)h=b.faces[f],i=h.materials,j=c(i),o[j]==void 0&&(o[j]={hash:j,counter:0}),k=o[j].hash+"_"+o[j].counter,b.geometryGroups[k]==void 0&&(b.geometryGroups[k]={faces:[],materials:i,vertices:0,numMorphTargets:p}),h=h instanceof THREE.Face3?3:4,b.geometryGroups[k].vertices+h>65535&&(o[j].counter+=1,k=o[j].hash+"_"+o[j].counter,b.geometryGroups[k]==void 0&&(b.geometryGroups[k]={faces:[],materials:i,
-vertices:0,numMorphTargets:p})),b.geometryGroups[k].faces.push(f),b.geometryGroups[k].vertices+=h}function Q(b,c,d){b.push({buffer:c,object:d,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function L(b){if(b!=M){switch(b){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)}M=b}}function B(b,d,e){(e.width&e.width-1)==0&&(e.height&e.height-1)==0?(c.texParameteri(b,c.TEXTURE_WRAP_S,E(d.wrapS)),c.texParameteri(b,c.TEXTURE_WRAP_T,E(d.wrapT)),c.texParameteri(b,c.TEXTURE_MAG_FILTER,E(d.magFilter)),c.texParameteri(b,c.TEXTURE_MIN_FILTER,E(d.minFilter)),c.generateMipmap(b)):(c.texParameteri(b,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE),
-c.texParameteri(b,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE),c.texParameteri(b,c.TEXTURE_MAG_FILTER,aa(d.magFilter)),c.texParameteri(b,c.TEXTURE_MIN_FILTER,aa(d.minFilter)))}function x(b,d){if(b.needsUpdate){if(b.__webglTexture)b.__webglTexture=c.deleteTexture(b.__webglTexture);b.__webglTexture=c.createTexture();c.bindTexture(c.TEXTURE_2D,b.__webglTexture);c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,b.image);B(c.TEXTURE_2D,b,b.image);c.bindTexture(c.TEXTURE_2D,null);b.needsUpdate=!1}c.activeTexture(c.TEXTURE0+
-d);c.bindTexture(c.TEXTURE_2D,b.__webglTexture)}function R(b){if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglFramebuffer=c.createFramebuffer();b.__webglRenderbuffer=c.createRenderbuffer();b.__webglTexture=c.createTexture();c.bindTexture(c.TEXTURE_2D,b.__webglTexture);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,E(b.wrapS));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,E(b.wrapT));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,
-E(b.magFilter));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,E(b.minFilter));c.texImage2D(c.TEXTURE_2D,0,E(b.format),b.width,b.height,0,E(b.format),E(b.type),null);c.bindRenderbuffer(c.RENDERBUFFER,b.__webglRenderbuffer);c.bindFramebuffer(c.FRAMEBUFFER,b.__webglFramebuffer);c.framebufferTexture2D(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,c.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(c.renderbufferStorage(c.RENDERBUFFER,c.DEPTH_COMPONENT16,b.width,b.height),c.framebufferRenderbuffer(c.FRAMEBUFFER,
-c.DEPTH_ATTACHMENT,c.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&b.stencilBuffer?(c.renderbufferStorage(c.RENDERBUFFER,c.DEPTH_STENCIL,b.width,b.height),c.framebufferRenderbuffer(c.FRAMEBUFFER,c.DEPTH_STENCIL_ATTACHMENT,c.RENDERBUFFER,b.__webglRenderbuffer)):c.renderbufferStorage(c.RENDERBUFFER,c.RGBA4,b.width,b.height);c.bindTexture(c.TEXTURE_2D,null);c.bindRenderbuffer(c.RENDERBUFFER,null);c.bindFramebuffer(c.FRAMEBUFFER,null)}var d,e;b?(d=b.__webglFramebuffer,e=b.width,b=b.height):(d=null,
-e=O,b=H);d!=Aa&&(c.bindFramebuffer(c.FRAMEBUFFER,d),c.viewport(F,Z,e,b),Aa=d)}function J(b,d){var e;b=="fragment"?e=c.createShader(c.FRAGMENT_SHADER):b=="vertex"&&(e=c.createShader(c.VERTEX_SHADER));c.shaderSource(e,d);c.compileShader(e);if(!c.getShaderParameter(e,c.COMPILE_STATUS))return console.error(c.getShaderInfoLog(e)),console.error(d),null;return e}function aa(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return c.NEAREST;default:return c.LINEAR}}
-function E(b){switch(b){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 $=this,c,ja=[],oa=null,Aa=null,ra=!0,pa=null,ka=null,M=null,ha=null,F=0,Z=0,O=0,H=0,N=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],P=new THREE.Matrix4,fa=new Float32Array(16),la=new Float32Array(16),qa=new THREE.Vector4,Ba={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},ia=b.canvas!==void 0?b.canvas:document.createElement("canvas"),sa=b.stencil!==void 0?
-b.stencil:!0,ta=b.antialias!==void 0?b.antialias:!1,na=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),Ca=b.clearAlpha!==void 0?b.clearAlpha:0;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=ia;this.sortObjects=this.autoClear=!0;try{if(!(c=ia.getContext("experimental-webgl",{antialias:ta,stencil:sa})))throw"Error creating WebGL context.";}catch(Ga){console.error(Ga)}console.log(navigator.userAgent+" | "+c.getParameter(c.VERSION)+" | "+c.getParameter(c.VENDOR)+
-" | "+c.getParameter(c.RENDERER)+" | "+c.getParameter(c.SHADING_LANGUAGE_VERSION));c.clearColor(0,0,0,1);c.clearDepth(1);c.enable(c.DEPTH_TEST);c.depthFunc(c.LEQUAL);c.frontFace(c.CCW);c.cullFace(c.BACK);c.enable(c.CULL_FACE);c.enable(c.BLEND);c.blendEquation(c.FUNC_ADD);c.blendFunc(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA);c.clearColor(na.r,na.g,na.b,Ca);this.context=c;var Fa=c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;if(sa){var u={};u.vertices=new Float32Array(12);u.faces=new Uint16Array(6);u.darkness=
-0.5;u.vertices[0]=-20;u.vertices[1]=-20;u.vertices[2]=-1;u.vertices[3]=20;u.vertices[4]=-20;u.vertices[5]=-1;u.vertices[6]=20;u.vertices[7]=20;u.vertices[8]=-1;u.vertices[9]=-20;u.vertices[10]=20;u.vertices[11]=-1;u.faces[0]=0;u.faces[1]=1;u.faces[2]=2;u.faces[3]=0;u.faces[4]=2;u.faces[5]=3;u.vertexBuffer=c.createBuffer();u.elementBuffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,u.vertexBuffer);c.bufferData(c.ARRAY_BUFFER,u.vertices,c.STATIC_DRAW);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,u.elementBuffer);
-c.bufferData(c.ELEMENT_ARRAY_BUFFER,u.faces,c.STATIC_DRAW);u.program=c.createProgram();c.attachShader(u.program,J("fragment",THREE.ShaderLib.shadowPost.fragmentShader));c.attachShader(u.program,J("vertex",THREE.ShaderLib.shadowPost.vertexShader));c.linkProgram(u.program);u.vertexLocation=c.getAttribLocation(u.program,"position");u.projectionLocation=c.getUniformLocation(u.program,"projectionMatrix");u.darknessLocation=c.getUniformLocation(u.program,"darkness")}var t={};t.vertices=new Float32Array(16);
-t.faces=new Uint16Array(6);b=0;t.vertices[b++]=-1;t.vertices[b++]=-1;t.vertices[b++]=0;t.vertices[b++]=0;t.vertices[b++]=1;t.vertices[b++]=-1;t.vertices[b++]=1;t.vertices[b++]=0;t.vertices[b++]=1;t.vertices[b++]=1;t.vertices[b++]=1;t.vertices[b++]=1;t.vertices[b++]=-1;t.vertices[b++]=1;t.vertices[b++]=0;t.vertices[b++]=1;b=0;t.faces[b++]=0;t.faces[b++]=1;t.faces[b++]=2;t.faces[b++]=0;t.faces[b++]=2;t.faces[b++]=3;t.vertexBuffer=c.createBuffer();t.elementBuffer=c.createBuffer();t.tempTexture=c.createTexture();
-t.occlusionTexture=c.createTexture();c.bindBuffer(c.ARRAY_BUFFER,t.vertexBuffer);c.bufferData(c.ARRAY_BUFFER,t.vertices,c.STATIC_DRAW);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,t.elementBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,t.faces,c.STATIC_DRAW);c.bindTexture(c.TEXTURE_2D,t.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,t.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);c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=
-0?(t.hasVertexTexture=!1,t.program=c.createProgram(),c.attachShader(t.program,J("fragment",THREE.ShaderLib.lensFlare.fragmentShader)),c.attachShader(t.program,J("vertex",THREE.ShaderLib.lensFlare.vertexShader))):(t.hasVertexTexture=!0,t.program=c.createProgram(),c.attachShader(t.program,J("fragment",THREE.ShaderLib.lensFlareVertexTexture.fragmentShader)),c.attachShader(t.program,J("vertex",THREE.ShaderLib.lensFlareVertexTexture.vertexShader)));c.linkProgram(t.program);t.attributes={};t.uniforms={};
-t.attributes.vertex=c.getAttribLocation(t.program,"position");t.attributes.uv=c.getAttribLocation(t.program,"UV");t.uniforms.renderType=c.getUniformLocation(t.program,"renderType");t.uniforms.map=c.getUniformLocation(t.program,"map");t.uniforms.occlusionMap=c.getUniformLocation(t.program,"occlusionMap");t.uniforms.opacity=c.getUniformLocation(t.program,"opacity");t.uniforms.scale=c.getUniformLocation(t.program,"scale");t.uniforms.rotation=c.getUniformLocation(t.program,"rotation");t.uniforms.screenPosition=
-c.getUniformLocation(t.program,"screenPosition");var Ea=!1;_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,J("fragment",THREE.ShaderLib.sprite.fragmentShader));c.attachShader(_sprite.program,J("vertex",THREE.ShaderLib.sprite.vertexShader));c.linkProgram(_sprite.program);_sprite.attributes={};_sprite.uniforms={};_sprite.attributes.position=c.getAttribLocation(_sprite.program,"position");_sprite.attributes.uv=c.getAttribLocation(_sprite.program,"uv");_sprite.uniforms.uvOffset=c.getUniformLocation(_sprite.program,"uvOffset");_sprite.uniforms.uvScale=c.getUniformLocation(_sprite.program,
-"uvScale");_sprite.uniforms.rotation=c.getUniformLocation(_sprite.program,"rotation");_sprite.uniforms.scale=c.getUniformLocation(_sprite.program,"scale");_sprite.uniforms.alignment=c.getUniformLocation(_sprite.program,"alignment");_sprite.uniforms.map=c.getUniformLocation(_sprite.program,"map");_sprite.uniforms.opacity=c.getUniformLocation(_sprite.program,"opacity");_sprite.uniforms.useScreenCoordinates=c.getUniformLocation(_sprite.program,"useScreenCoordinates");_sprite.uniforms.affectedByDistance=
-c.getUniformLocation(_sprite.program,"affectedByDistance");_sprite.uniforms.screenPosition=c.getUniformLocation(_sprite.program,"screenPosition");_sprite.uniforms.modelViewMatrix=c.getUniformLocation(_sprite.program,"modelViewMatrix");_sprite.uniforms.projectionMatrix=c.getUniformLocation(_sprite.program,"projectionMatrix");var Da=!1;this.setSize=function(b,c){ia.width=b;ia.height=c;this.setViewport(0,0,ia.width,ia.height)};this.setViewport=function(b,d,e,f){F=b;Z=d;O=e;H=f;c.viewport(F,Z,O,H)};this.setScissor=
-function(b,d,e,f){c.scissor(b,d,e,f)};this.enableScissorTest=function(b){b?c.enable(c.SCISSOR_TEST):c.disable(c.SCISSOR_TEST)};this.enableDepthBufferWrite=function(b){ra=b;c.depthMask(b)};this.setClearColorHex=function(b,d){na.setHex(b);Ca=d;c.clearColor(na.r,na.g,na.b,Ca)};this.setClearColor=function(b,d){na.copy(b);Ca=d;c.clearColor(na.r,na.g,na.b,Ca)};this.clear=function(){c.clear(c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT|c.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(b){u.darkness=
-b};this.getContext=function(){return c};this.initMaterial=function(b,d,e,f){var g,h,i;b instanceof THREE.MeshDepthMaterial?i="depth":b instanceof THREE.ShadowVolumeDynamicMaterial?i="shadowVolumeDynamic":b instanceof THREE.MeshNormalMaterial?i="normal":b instanceof THREE.MeshBasicMaterial?i="basic":b instanceof THREE.MeshLambertMaterial?i="lambert":b instanceof THREE.MeshPhongMaterial?i="phong":b instanceof THREE.LineBasicMaterial?i="basic":b instanceof THREE.ParticleBasicMaterial&&(i="particle_basic");
-if(i){var j=THREE.ShaderLib[i];b.uniforms=THREE.UniformsUtils.clone(j.uniforms);b.vertexShader=j.vertexShader;b.fragmentShader=j.fragmentShader}var k,p,o;k=o=j=0;for(p=d.length;k<p;k++)h=d[k],h instanceof THREE.DirectionalLight&&o++,h instanceof THREE.PointLight&&j++;j+o<=4?d=o:(d=Math.ceil(4*o/(j+o)),j=4-d);h={directional:d,point:j};o=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)o=f.bones.length;var n;a:{k=b.fragmentShader;p=b.vertexShader;var j=b.uniforms,d=b.attributes,e={map:!!b.map,envMap:!!b.envMap,
-lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:e,sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:h.directional,maxPointLights:h.point,maxBones:o},q;h=[];i?h.push(i):(h.push(k),h.push(p));for(q in e)h.push(q),h.push(e[q]);i=h.join();q=0;for(h=ja.length;q<h;q++)if(ja[q].code==i){n=ja[q].program;break a}q=c.createProgram();prefix_fragment=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+
-e.maxDirLights,"#define MAX_POINT_LIGHTS "+e.maxPointLights,e.fog?"#define USE_FOG":"",e.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",e.map?"#define USE_MAP":"",e.envMap?"#define USE_ENVMAP":"",e.lightMap?"#define USE_LIGHTMAP":"",e.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");prefix_vertex=[Fa?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+e.maxDirLights,"#define MAX_POINT_LIGHTS "+e.maxPointLights,"#define MAX_BONES "+e.maxBones,
-e.map?"#define USE_MAP":"",e.envMap?"#define USE_ENVMAP":"",e.lightMap?"#define USE_LIGHTMAP":"",e.vertexColors?"#define USE_COLOR":"",e.skinning?"#define USE_SKINNING":"",e.morphTargets?"#define USE_MORPHTARGETS":"",e.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(q,J("fragment",prefix_fragment+k));c.attachShader(q,J("vertex",prefix_vertex+p));c.linkProgram(q);c.getProgramParameter(q,c.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+c.getProgramParameter(q,c.VALIDATE_STATUS)+", gl error ["+c.getError()+"]");q.uniforms={};q.attributes={};var r;k=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(r in j)k.push(r);
-r=k;j=0;for(k=r.length;j<k;j++)p=r[j],q.uniforms[p]=c.getUniformLocation(q,p);k=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(r=0;r<e.maxMorphTargets;r++)k.push("morphTarget"+r);for(n in d)k.push(n);n=k;r=0;for(d=n.length;r<d;r++)e=n[r],q.attributes[e]=c.getAttribLocation(q,e);ja.push({program:q,code:i});n=q}b.program=n;n=b.program.attributes;n.position>=0&&c.enableVertexAttribArray(n.position);n.color>=0&&c.enableVertexAttribArray(n.color);
-n.normal>=0&&c.enableVertexAttribArray(n.normal);n.tangent>=0&&c.enableVertexAttribArray(n.tangent);b.skinning&&n.skinVertexA>=0&&n.skinVertexB>=0&&n.skinIndex>=0&&n.skinWeight>=0&&(c.enableVertexAttribArray(n.skinVertexA),c.enableVertexAttribArray(n.skinVertexB),c.enableVertexAttribArray(n.skinIndex),c.enableVertexAttribArray(n.skinWeight));if(b.attributes)for(g in b.attributes)n[g]!==void 0&&n[g]>=0&&c.enableVertexAttribArray(n[g]);if(b.morphTargets){b.numSupportedMorphTargets=0;n.morphTarget0>=
-0&&(c.enableVertexAttribArray(n.morphTarget0),b.numSupportedMorphTargets++);n.morphTarget1>=0&&(c.enableVertexAttribArray(n.morphTarget1),b.numSupportedMorphTargets++);n.morphTarget2>=0&&(c.enableVertexAttribArray(n.morphTarget2),b.numSupportedMorphTargets++);n.morphTarget3>=0&&(c.enableVertexAttribArray(n.morphTarget3),b.numSupportedMorphTargets++);n.morphTarget4>=0&&(c.enableVertexAttribArray(n.morphTarget4),b.numSupportedMorphTargets++);n.morphTarget5>=0&&(c.enableVertexAttribArray(n.morphTarget5),
-b.numSupportedMorphTargets++);n.morphTarget6>=0&&(c.enableVertexAttribArray(n.morphTarget6),b.numSupportedMorphTargets++);n.morphTarget7>=0&&(c.enableVertexAttribArray(n.morphTarget7),b.numSupportedMorphTargets++);f.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);b=0;for(g=this.maxMorphTargets;b<g;b++)f.__webglMorphTargetInfluences[b]=0}};this.render=function(b,d,k,u){var t,y,x,B,E,F,o,G,H=b.lights,J=b.fog;$.data.vertices=0;$.data.faces=0;$.data.drawCalls=0;d.matrixAutoUpdate&&
-d.update(void 0,!0);b.update(void 0,!1,d);d.matrixWorldInverse.flattenToArray(la);d.projectionMatrix.flattenToArray(fa);P.multiply(d.projectionMatrix,d.matrixWorldInverse);j(P);this.initWebGLObjects(b);R(k);(this.autoClear||u)&&this.clear();E=b.__webglObjects.length;for(u=0;u<E;u++)if(t=b.__webglObjects[u],o=t.object,o.visible)if(!(o instanceof THREE.Mesh)||p(o)){if(o.matrixWorld.flattenToArray(o._objectMatrixArray),D(o,d),v(t),t.render=!0,this.sortObjects)qa.copy(o.position),P.multiplyVector3(qa),
-t.z=qa.z}else t.render=!1;else t.render=!1;this.sortObjects&&b.__webglObjects.sort(r);F=b.__webglObjectsImmediate.length;for(u=0;u<F;u++)t=b.__webglObjectsImmediate[u],o=t.object,o.visible&&(o.matrixAutoUpdate&&o.matrixWorld.flattenToArray(o._objectMatrixArray),D(o,d),n(t));L(THREE.NormalBlending);for(u=0;u<E;u++)if(t=b.__webglObjects[u],t.render){o=t.object;G=t.buffer;x=t.opaque;i(o);for(t=0;t<x.count;t++)B=x.list[t],g(B.depthTest),f(d,H,J,B,G,o)}for(u=0;u<F;u++)if(t=b.__webglObjectsImmediate[u],
-o=t.object,o.visible){x=t.opaque;i(o);for(t=0;t<x.count;t++)B=x.list[t],g(B.depthTest),y=e(d,H,J,B,o),o.render(function(b){h(b,y,B.shading)})}for(u=0;u<E;u++)if(t=b.__webglObjects[u],t.render){o=t.object;G=t.buffer;x=t.transparent;i(o);for(t=0;t<x.count;t++)B=x.list[t],L(B.blending),g(B.depthTest),f(d,H,J,B,G,o)}for(u=0;u<F;u++)if(t=b.__webglObjectsImmediate[u],o=t.object,o.visible){x=t.transparent;i(o);for(t=0;t<x.count;t++)B=x.list[t],L(B.blending),g(B.depthTest),y=e(d,H,J,B,o),o.render(function(b){h(b,
-y,B.shading)})}b.__webglSprites.length&&z(b,d);sa&&b.__webglShadowVolumes.length&&b.lights.length&&q(b);b.__webglLensFlares.length&&C(b,d);k&&k.minFilter!==THREE.NearestFilter&&k.minFilter!==THREE.LinearFilter&&(c.bindTexture(c.TEXTURE_2D,k.__webglTexture),c.generateMipmap(c.TEXTURE_2D),c.bindTexture(c.TEXTURE_2D,null))};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=[],b.__webglShadowVolumes=[],b.__webglLensFlares=[],b.__webglSprites=[];for(;b.__objectsAdded.length;){var d=
-b.__objectsAdded[0],e=b,f=void 0,g=void 0,h=void 0;if(d._modelViewMatrix==void 0)d._modelViewMatrix=new THREE.Matrix4,d._normalMatrixArray=new Float32Array(9),d._modelViewMatrixArray=new Float32Array(16),d._objectMatrixArray=new Float32Array(16),d.matrixWorld.flattenToArray(d._objectMatrixArray);if(d instanceof THREE.Mesh)for(f in g=d.geometry,g.geometryGroups==void 0&&S(g),g.geometryGroups){h=g.geometryGroups[f];if(!h.__webglVertexBuffer){var i=h;i.__webglVertexBuffer=c.createBuffer();i.__webglNormalBuffer=
-c.createBuffer();i.__webglTangentBuffer=c.createBuffer();i.__webglColorBuffer=c.createBuffer();i.__webglUVBuffer=c.createBuffer();i.__webglUV2Buffer=c.createBuffer();i.__webglSkinVertexABuffer=c.createBuffer();i.__webglSkinVertexBBuffer=c.createBuffer();i.__webglSkinIndicesBuffer=c.createBuffer();i.__webglSkinWeightsBuffer=c.createBuffer();i.__webglFaceBuffer=c.createBuffer();i.__webglLineBuffer=c.createBuffer();if(i.numMorphTargets){var j=void 0,k=void 0;i.__webglMorphTargetsBuffers=[];j=0;for(k=
-i.numMorphTargets;j<k;j++)i.__webglMorphTargetsBuffers.push(c.createBuffer())}for(var i=h,j=d,n=void 0,o=void 0,p=void 0,q=p=void 0,r=void 0,t=void 0,v=t=k=0,u=p=o=void 0,o=n=void 0,q=j.geometry,u=q.faces,r=i.faces,n=0,o=r.length;n<o;n++)p=r[n],p=u[p],p instanceof THREE.Face3?(k+=3,t+=1,v+=3):p instanceof THREE.Face4&&(k+=4,t+=2,v+=4);for(var n=i,o=j,x=r=u=void 0,z=void 0,x=void 0,p=[],u=0,r=o.materials.length;u<r;u++)if(x=o.materials[u],x instanceof THREE.MeshFaceMaterial){x=0;for(l=n.materials.length;x<
-l;x++)(z=n.materials[x])&&p.push(z)}else(z=x)&&p.push(z);n=p;a:{u=o=void 0;r=n.length;for(o=0;o<r;o++)if(u=n[o],u.map||u.lightMap||u instanceof THREE.MeshShaderMaterial){o=!0;break a}o=!1}a:{r=u=void 0;p=n.length;for(u=0;u<p;u++)if(r=n[u],!(r instanceof THREE.MeshBasicMaterial&&!r.envMap||r instanceof THREE.MeshDepthMaterial)){u=r&&r.shading!=void 0&&r.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}u=!1}a:{p=r=void 0;x=n.length;for(r=0;r<x;r++)if(p=n[r],p.vertexColors){p=
-p.vertexColors;break a}p=!1}i.__vertexArray=new Float32Array(k*3);if(u)i.__normalArray=new Float32Array(k*3);if(q.hasTangents)i.__tangentArray=new Float32Array(k*4);if(p)i.__colorArray=new Float32Array(k*3);if(o){if(q.faceUvs.length>0||q.faceVertexUvs.length>0)i.__uvArray=new Float32Array(k*2);if(q.faceUvs.length>1||q.faceVertexUvs.length>1)i.__uv2Array=new Float32Array(k*2)}if(j.geometry.skinWeights.length&&j.geometry.skinIndices.length)i.__skinVertexAArray=new Float32Array(k*4),i.__skinVertexBArray=
-new Float32Array(k*4),i.__skinIndexArray=new Float32Array(k*4),i.__skinWeightArray=new Float32Array(k*4);i.__faceArray=new Uint16Array(t*3+(j.geometry.edgeFaces?j.geometry.edgeFaces.length*6:0));i.__lineArray=new Uint16Array(v*2);if(i.numMorphTargets){i.__morphTargetsArrays=[];q=0;for(r=i.numMorphTargets;q<r;q++)i.__morphTargetsArrays.push(new Float32Array(k*3))}i.__needsSmoothNormals=u==THREE.SmoothShading;i.__uvType=o;i.__vertexColorType=p;i.__normalType=u;i.__webglFaceCount=t*3+(j.geometry.edgeFaces?
-j.geometry.edgeFaces.length*6:0);i.__webglLineCount=v*2;q=0;for(r=n.length;q<r;q++)if(n[q].attributes)for(a in i.__webglCustomAttributes={},n[q].attributes){o={};for(prop in n[q].attributes[a])o[prop]=n[q].attributes[a][prop];if(!o.__webglInitialized||o.createUniqueBuffers)o.__webglInitialized=!0,t=1,o.type==="v2"?t=2:o.type==="v3"?t=3:o.type==="v4"?t=4:o.type==="c"&&(t=3),o.size=t,o.needsUpdate=!0,o.array=new Float32Array(k*t),o.buffer=c.createBuffer(),o.buffer.belongsToAttribute=a;i.__webglCustomAttributes[a]=
-o}i.__inittedArrays=!0;g.__dirtyVertices=!0;g.__dirtyMorphTargets=!0;g.__dirtyElements=!0;g.__dirtyUvs=!0;g.__dirtyNormals=!0;g.__dirtyTangents=!0;g.__dirtyColors=!0}d instanceof THREE.ShadowVolume?Q(e.__webglShadowVolumes,h,d):Q(e.__webglObjects,h,d)}else if(d instanceof THREE.LensFlare)Q(e.__webglLensFlares,void 0,d);else if(d instanceof THREE.Ribbon){g=d.geometry;if(!g.__webglVertexBuffer)f=g,f.__webglVertexBuffer=c.createBuffer(),f.__webglColorBuffer=c.createBuffer(),f=g,h=f.vertices.length,f.__vertexArray=
-new Float32Array(h*3),f.__colorArray=new Float32Array(h*3),f.__webglVertexCount=h,g.__dirtyVertices=!0,g.__dirtyColors=!0;Q(e.__webglObjects,g,d)}else if(d instanceof THREE.Line){g=d.geometry;if(!g.__webglVertexBuffer)f=g,f.__webglVertexBuffer=c.createBuffer(),f.__webglColorBuffer=c.createBuffer(),f=g,h=f.vertices.length,f.__vertexArray=new Float32Array(h*3),f.__colorArray=new Float32Array(h*3),f.__webglLineCount=h,g.__dirtyVertices=!0,g.__dirtyColors=!0;Q(e.__webglObjects,g,d)}else if(d instanceof
-THREE.ParticleSystem){g=d.geometry;if(!g.__webglVertexBuffer)f=g,f.__webglVertexBuffer=c.createBuffer(),f.__webglColorBuffer=c.createBuffer(),f=g,h=f.vertices.length,f.__vertexArray=new Float32Array(h*3),f.__colorArray=new Float32Array(h*3),f.__sortArray=[],f.__webglParticleCount=h,g.__dirtyVertices=!0,g.__dirtyColors=!0;Q(e.__webglObjects,g,d)}else THREE.MarchingCubes!==void 0&&d instanceof THREE.MarchingCubes?e.__webglObjectsImmediate.push({object:d,opaque:{list:[],count:0},transparent:{list:[],
-count:0}}):d instanceof THREE.Sprite&&e.__webglSprites.push(d);b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;){d=b.__objectsRemoved[0];e=b;f=g=void 0;if(d instanceof THREE.Mesh)for(g=e.__webglObjects.length-1;g>=0;g--){if(f=e.__webglObjects[g].object,d==f){e.__webglObjects.splice(g,1);break}}else if(d instanceof THREE.Sprite)for(g=e.__webglSprites.length-1;g>=0;g--)if(f=e.__webglSprites[g],d==f){e.__webglSprites.splice(g,1);break}b.__objectsRemoved.splice(0,1)}d=0;for(e=b.__webglObjects.length;d<
-e;d++)y(b.__webglObjects[d].object,b);d=0;for(e=b.__webglShadowVolumes.length;d<e;d++)y(b.__webglShadowVolumes[d].object,b);d=0;for(e=b.__webglLensFlares.length;d<e;d++)y(b.__webglLensFlares[d].object,b)};this.setFaceCulling=function(b,d){b?(!d||d=="ccw"?c.frontFace(c.CCW):c.frontFace(c.CW),b=="back"?c.cullFace(c.BACK):b=="front"?c.cullFace(c.FRONT):c.cullFace(c.FRONT_AND_BACK),c.enable(c.CULL_FACE)):c.disable(c.CULL_FACE)};this.supportsVertexTextures=function(){return Fa}};
+z=g.__vertexColorType,t=g.__uvType,y=g.__normalType,ga=i.geometry,ha=ga.__dirtyVertices,ia=ga.__dirtyElements,fa=ga.__dirtyUvs,ka=ga.__dirtyNormals,na=ga.__dirtyTangents,oa=ga.__dirtyColors,pa=ga.__dirtyMorphTargets,la=ga.vertices,qa=g.faces,ra=ga.faces,sa=ga.faceVertexUvs[0],ta=ga.faceVertexUvs[1],ya=ga.skinVerticesA,za=ga.skinVerticesB,Aa=ga.skinIndices,wa=ga.skinWeights,xa=i instanceof THREE.ShadowVolume?ga.edgeFaces:void 0,ua=ga.morphTargets;if(R)for(J in R)R[J].offset=0,R[J].offsetSrc=0;k=0;
+for(p=qa.length;k<p;k++)if(n=qa[k],o=ra[n],sa&&(x=sa[n]),ta&&(C=ta[n]),n=o.vertexNormals,G=o.normal,r=o.vertexColors,v=o.color,q=o.vertexTangents,o instanceof THREE.Face3){if(ha)u=la[o.a].position,I=la[o.b].position,K=la[o.c].position,L[E]=u.x,L[E+1]=u.y,L[E+2]=u.z,L[E+3]=I.x,L[E+4]=I.y,L[E+5]=I.z,L[E+6]=K.x,L[E+7]=K.y,L[E+8]=K.z,E+=9;if(R)for(J in R)if(m=R[J],m.needsUpdate)s=m.offset,A=m.offsetSrc,m.size===1?(m.boundTo===void 0||m.boundTo==="vertices"?(m.array[s+0]=m.value[o.a],m.array[s+1]=m.value[o.b],
+m.array[s+2]=m.value[o.c]):m.boundTo==="faces"?(m.array[s+0]=m.value[A],m.array[s+1]=m.value[A],m.array[s+2]=m.value[A],m.offsetSrc++):m.boundTo==="faceVertices"&&(m.array[s+0]=m.value[A+0],m.array[s+1]=m.value[A+1],m.array[s+2]=m.value[A+2],m.offsetSrc+=3),m.offset+=3):(m.boundTo===void 0||m.boundTo==="vertices"?(u=m.value[o.a],I=m.value[o.b],K=m.value[o.c]):m.boundTo==="faces"?(u=m.value[A],I=m.value[A],K=m.value[A],m.offsetSrc++):m.boundTo==="faceVertices"&&(u=m.value[A+0],I=m.value[A+1],K=m.value[A+
+2],m.offsetSrc+=3),m.size===2?(m.array[s+0]=u.x,m.array[s+1]=u.y,m.array[s+2]=I.x,m.array[s+3]=I.y,m.array[s+4]=K.x,m.array[s+5]=K.y,m.offset+=6):m.size===3?(m.type==="c"?(m.array[s+0]=u.r,m.array[s+1]=u.g,m.array[s+2]=u.b,m.array[s+3]=I.r,m.array[s+4]=I.g,m.array[s+5]=I.b,m.array[s+6]=K.r,m.array[s+7]=K.g,m.array[s+8]=K.b):(m.array[s+0]=u.x,m.array[s+1]=u.y,m.array[s+2]=u.z,m.array[s+3]=I.x,m.array[s+4]=I.y,m.array[s+5]=I.z,m.array[s+6]=K.x,m.array[s+7]=K.y,m.array[s+8]=K.z),m.offset+=9):(m.array[s+
+0]=u.x,m.array[s+1]=u.y,m.array[s+2]=u.z,m.array[s+3]=u.w,m.array[s+4]=I.x,m.array[s+5]=I.y,m.array[s+6]=I.z,m.array[s+7]=I.w,m.array[s+8]=K.x,m.array[s+9]=K.y,m.array[s+10]=K.z,m.array[s+11]=K.w,m.offset+=12));if(pa){s=0;for(A=ua.length;s<A;s++)u=ua[s].vertices[o.a].position,I=ua[s].vertices[o.b].position,K=ua[s].vertices[o.c].position,m=aa[s],m[da+0]=u.x,m[da+1]=u.y,m[da+2]=u.z,m[da+3]=I.x,m[da+4]=I.y,m[da+5]=I.z,m[da+6]=K.x,m[da+7]=K.y,m[da+8]=K.z;da+=9}if(wa.length)s=wa[o.a],A=wa[o.b],m=wa[o.c],
+Y[w]=s.x,Y[w+1]=s.y,Y[w+2]=s.z,Y[w+3]=s.w,Y[w+4]=A.x,Y[w+5]=A.y,Y[w+6]=A.z,Y[w+7]=A.w,Y[w+8]=m.x,Y[w+9]=m.y,Y[w+10]=m.z,Y[w+11]=m.w,s=Aa[o.a],A=Aa[o.b],m=Aa[o.c],X[w]=s.x,X[w+1]=s.y,X[w+2]=s.z,X[w+3]=s.w,X[w+4]=A.x,X[w+5]=A.y,X[w+6]=A.z,X[w+7]=A.w,X[w+8]=m.x,X[w+9]=m.y,X[w+10]=m.z,X[w+11]=m.w,s=ya[o.a],A=ya[o.b],m=ya[o.c],V[w]=s.x,V[w+1]=s.y,V[w+2]=s.z,V[w+3]=1,V[w+4]=A.x,V[w+5]=A.y,V[w+6]=A.z,V[w+7]=1,V[w+8]=m.x,V[w+9]=m.y,V[w+10]=m.z,V[w+11]=1,s=za[o.a],A=za[o.b],m=za[o.c],W[w]=s.x,W[w+1]=s.y,W[w+
+2]=s.z,W[w+3]=1,W[w+4]=A.x,W[w+5]=A.y,W[w+6]=A.z,W[w+7]=1,W[w+8]=m.x,W[w+9]=m.y,W[w+10]=m.z,W[w+11]=1,w+=12;if(oa&&z)r.length==3&&z==THREE.VertexColors?(o=r[0],s=r[1],A=r[2]):A=s=o=v,ea[ca]=o.r,ea[ca+1]=o.g,ea[ca+2]=o.b,ea[ca+3]=s.r,ea[ca+4]=s.g,ea[ca+5]=s.b,ea[ca+6]=A.r,ea[ca+7]=A.g,ea[ca+8]=A.b,ca+=9;if(na&&ga.hasTangents)r=q[0],v=q[1],o=q[2],U[T]=r.x,U[T+1]=r.y,U[T+2]=r.z,U[T+3]=r.w,U[T+4]=v.x,U[T+5]=v.y,U[T+6]=v.z,U[T+7]=v.w,U[T+8]=o.x,U[T+9]=o.y,U[T+10]=o.z,U[T+11]=o.w,T+=12;if(ka&&y)if(n.length==
+3&&ja)for(q=0;q<3;q++)G=n[q],Q[M]=G.x,Q[M+1]=G.y,Q[M+2]=G.z,M+=3;else for(q=0;q<3;q++)Q[M]=G.x,Q[M+1]=G.y,Q[M+2]=G.z,M+=3;if(fa&&x!==void 0&&t)for(q=0;q<3;q++)n=x[q],Z[O]=n.u,Z[O+1]=n.v,O+=2;if(fa&&C!==void 0&&t)for(q=0;q<3;q++)n=C[q],$[P]=n.u,$[P+1]=n.v,P+=2;ia&&(ma[H]=B,ma[H+1]=B+1,ma[H+2]=B+2,H+=3,S[N]=B,S[N+1]=B+1,S[N+2]=B,S[N+3]=B+2,S[N+4]=B+1,S[N+5]=B+2,N+=6,B+=3)}else if(o instanceof THREE.Face4){if(ha)u=la[o.a].position,I=la[o.b].position,K=la[o.c].position,D=la[o.d].position,L[E]=u.x,L[E+
+1]=u.y,L[E+2]=u.z,L[E+3]=I.x,L[E+4]=I.y,L[E+5]=I.z,L[E+6]=K.x,L[E+7]=K.y,L[E+8]=K.z,L[E+9]=D.x,L[E+10]=D.y,L[E+11]=D.z,E+=12;if(R)for(J in R)if(m=R[J],m.needsUpdate)s=m.offset,A=m.offsetSrc,m.size===1?(m.boundTo===void 0||m.boundTo==="vertices"?(m.array[s+0]=m.value[o.a],m.array[s+1]=m.value[o.b],m.array[s+2]=m.value[o.c],m.array[s+3]=m.value[o.d]):m.boundTo==="faces"?(m.array[s+0]=m.value[A],m.array[s+1]=m.value[A],m.array[s+2]=m.value[A],m.array[s+3]=m.value[A],m.offsetSrc++):m.boundTo==="faceVertices"&&
+(m.array[s+0]=m.value[A+0],m.array[s+1]=m.value[A+1],m.array[s+2]=m.value[A+2],m.array[s+3]=m.value[A+3],m.offsetSrc+=4),m.offset+=4):(m.boundTo===void 0||m.boundTo==="vertices"?(u=m.value[o.a],I=m.value[o.b],K=m.value[o.c],D=m.value[o.d]):m.boundTo==="faces"?(u=m.value[A],I=m.value[A],K=m.value[A],D=m.value[A],m.offsetSrc++):m.boundTo==="faceVertices"&&(u=m.value[A+0],I=m.value[A+1],K=m.value[A+2],D=m.value[A+3],m.offsetSrc+=4),m.size===2?(m.array[s+0]=u.x,m.array[s+1]=u.y,m.array[s+2]=I.x,m.array[s+
+3]=I.y,m.array[s+4]=K.x,m.array[s+5]=K.y,m.array[s+6]=D.x,m.array[s+7]=D.y,m.offset+=8):m.size===3?(m.type==="c"?(m.array[s+0]=u.r,m.array[s+1]=u.g,m.array[s+2]=u.b,m.array[s+3]=I.r,m.array[s+4]=I.g,m.array[s+5]=I.b,m.array[s+6]=K.r,m.array[s+7]=K.g,m.array[s+8]=K.b,m.array[s+9]=D.r,m.array[s+10]=D.g,m.array[s+11]=D.b):(m.array[s+0]=u.x,m.array[s+1]=u.y,m.array[s+2]=u.z,m.array[s+3]=I.x,m.array[s+4]=I.y,m.array[s+5]=I.z,m.array[s+6]=K.x,m.array[s+7]=K.y,m.array[s+8]=K.z,m.array[s+9]=D.x,m.array[s+
+10]=D.y,m.array[s+11]=D.z),m.offset+=12):(m.array[s+0]=u.x,m.array[s+1]=u.y,m.array[s+2]=u.z,m.array[s+3]=u.w,m.array[s+4]=I.x,m.array[s+5]=I.y,m.array[s+6]=I.z,m.array[s+7]=I.w,m.array[s+8]=K.x,m.array[s+9]=K.y,m.array[s+10]=K.z,m.array[s+11]=K.w,m.array[s+12]=D.x,m.array[s+13]=D.y,m.array[s+14]=D.z,m.array[s+15]=D.w,m.offset+=16));if(pa){s=0;for(A=ua.length;s<A;s++)u=ua[s].vertices[o.a].position,I=ua[s].vertices[o.b].position,K=ua[s].vertices[o.c].position,D=ua[s].vertices[o.d].position,m=aa[s],
+m[da+0]=u.x,m[da+1]=u.y,m[da+2]=u.z,m[da+3]=I.x,m[da+4]=I.y,m[da+5]=I.z,m[da+6]=K.x,m[da+7]=K.y,m[da+8]=K.z,m[da+9]=D.x,m[da+10]=D.y,m[da+11]=D.z;da+=12}if(wa.length)s=wa[o.a],A=wa[o.b],m=wa[o.c],F=wa[o.d],Y[w]=s.x,Y[w+1]=s.y,Y[w+2]=s.z,Y[w+3]=s.w,Y[w+4]=A.x,Y[w+5]=A.y,Y[w+6]=A.z,Y[w+7]=A.w,Y[w+8]=m.x,Y[w+9]=m.y,Y[w+10]=m.z,Y[w+11]=m.w,Y[w+12]=F.x,Y[w+13]=F.y,Y[w+14]=F.z,Y[w+15]=F.w,s=Aa[o.a],A=Aa[o.b],m=Aa[o.c],F=Aa[o.d],X[w]=s.x,X[w+1]=s.y,X[w+2]=s.z,X[w+3]=s.w,X[w+4]=A.x,X[w+5]=A.y,X[w+6]=A.z,
+X[w+7]=A.w,X[w+8]=m.x,X[w+9]=m.y,X[w+10]=m.z,X[w+11]=m.w,X[w+12]=F.x,X[w+13]=F.y,X[w+14]=F.z,X[w+15]=F.w,s=ya[o.a],A=ya[o.b],m=ya[o.c],F=ya[o.d],V[w]=s.x,V[w+1]=s.y,V[w+2]=s.z,V[w+3]=1,V[w+4]=A.x,V[w+5]=A.y,V[w+6]=A.z,V[w+7]=1,V[w+8]=m.x,V[w+9]=m.y,V[w+10]=m.z,V[w+11]=1,V[w+12]=F.x,V[w+13]=F.y,V[w+14]=F.z,V[w+15]=1,s=za[o.a],A=za[o.b],m=za[o.c],o=za[o.d],W[w]=s.x,W[w+1]=s.y,W[w+2]=s.z,W[w+3]=1,W[w+4]=A.x,W[w+5]=A.y,W[w+6]=A.z,W[w+7]=1,W[w+8]=m.x,W[w+9]=m.y,W[w+10]=m.z,W[w+11]=1,W[w+12]=o.x,W[w+13]=
+o.y,W[w+14]=o.z,W[w+15]=1,w+=16;if(oa&&z)r.length==4&&z==THREE.VertexColors?(o=r[0],s=r[1],A=r[2],r=r[3]):r=A=s=o=v,ea[ca]=o.r,ea[ca+1]=o.g,ea[ca+2]=o.b,ea[ca+3]=s.r,ea[ca+4]=s.g,ea[ca+5]=s.b,ea[ca+6]=A.r,ea[ca+7]=A.g,ea[ca+8]=A.b,ea[ca+9]=r.r,ea[ca+10]=r.g,ea[ca+11]=r.b,ca+=12;if(na&&ga.hasTangents)r=q[0],v=q[1],o=q[2],q=q[3],U[T]=r.x,U[T+1]=r.y,U[T+2]=r.z,U[T+3]=r.w,U[T+4]=v.x,U[T+5]=v.y,U[T+6]=v.z,U[T+7]=v.w,U[T+8]=o.x,U[T+9]=o.y,U[T+10]=o.z,U[T+11]=o.w,U[T+12]=q.x,U[T+13]=q.y,U[T+14]=q.z,U[T+
+15]=q.w,T+=16;if(ka&&y)if(n.length==4&&ja)for(q=0;q<4;q++)G=n[q],Q[M]=G.x,Q[M+1]=G.y,Q[M+2]=G.z,M+=3;else for(q=0;q<4;q++)Q[M]=G.x,Q[M+1]=G.y,Q[M+2]=G.z,M+=3;if(fa&&x!==void 0&&t)for(q=0;q<4;q++)n=x[q],Z[O]=n.u,Z[O+1]=n.v,O+=2;if(fa&&C!==void 0&&t)for(q=0;q<4;q++)n=C[q],$[P]=n.u,$[P+1]=n.v,P+=2;ia&&(ma[H]=B,ma[H+1]=B+1,ma[H+2]=B+3,ma[H+3]=B+1,ma[H+4]=B+2,ma[H+5]=B+3,H+=6,S[N]=B,S[N+1]=B+1,S[N+2]=B,S[N+3]=B+3,S[N+4]=B+1,S[N+5]=B+2,S[N+6]=B+2,S[N+7]=B+3,N+=8,B+=4)}if(xa){k=0;for(p=xa.length;k<p;k++)ma[H]=
+xa[k].a,ma[H+1]=xa[k].b,ma[H+2]=xa[k].c,ma[H+3]=xa[k].a,ma[H+4]=xa[k].c,ma[H+5]=xa[k].d,H+=6}ha&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglVertexBuffer),c.bufferData(c.ARRAY_BUFFER,L,j));if(R)for(J in R)if(m=R[J],m.needsUpdate)c.bindBuffer(c.ARRAY_BUFFER,m.buffer),c.bufferData(c.ARRAY_BUFFER,m.array,j),m.needsUpdate=!1;if(pa){s=0;for(A=ua.length;s<A;s++)c.bindBuffer(c.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[s]),c.bufferData(c.ARRAY_BUFFER,aa[s],j)}oa&&ca>0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglColorBuffer),
+c.bufferData(c.ARRAY_BUFFER,ea,j));ka&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglNormalBuffer),c.bufferData(c.ARRAY_BUFFER,Q,j));na&&ga.hasTangents&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglTangentBuffer),c.bufferData(c.ARRAY_BUFFER,U,j));fa&&O>0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglUVBuffer),c.bufferData(c.ARRAY_BUFFER,Z,j));fa&&P>0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglUV2Buffer),c.bufferData(c.ARRAY_BUFFER,$,j));ia&&(c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,g.__webglFaceBuffer),c.bufferData(c.ELEMENT_ARRAY_BUFFER,
+ma,j),c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,g.__webglLineBuffer),c.bufferData(c.ELEMENT_ARRAY_BUFFER,S,j));w>0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglSkinVertexABuffer),c.bufferData(c.ARRAY_BUFFER,V,j),c.bindBuffer(c.ARRAY_BUFFER,g.__webglSkinVertexBBuffer),c.bufferData(c.ARRAY_BUFFER,W,j),c.bindBuffer(c.ARRAY_BUFFER,g.__webglSkinIndicesBuffer),c.bufferData(c.ARRAY_BUFFER,X,j),c.bindBuffer(c.ARRAY_BUFFER,g.__webglSkinWeightsBuffer),c.bufferData(c.ARRAY_BUFFER,Y,j));i.dynamic||(delete g.__inittedArrays,
+delete g.__colorArray,delete g.__normalArray,delete g.__tangentArray,delete g.__uvArray,delete g.__uv2Array,delete g.__faceArray,delete g.__vertexArray,delete g.__lineArray,delete g.__skinVertexAArray,delete g.__skinVertexBArray,delete g.__skinIndexArray,delete g.__skinWeightArray)}}}f.__dirtyVertices=!1;f.__dirtyMorphTargets=!1;f.__dirtyElements=!1;f.__dirtyUvs=!1;f.__dirtyNormals=!1;f.__dirtyTangents=!1;f.__dirtyColors=!1}else if(b instanceof THREE.Ribbon){f=b.geometry;if(f.__dirtyVertices||f.__dirtyColors){b=
+f;e=c.DYNAMIC_DRAW;t=b.vertices;g=b.colors;z=t.length;i=g.length;y=b.__vertexArray;j=b.__colorArray;x=b.__dirtyColors;if(b.__dirtyVertices){for(k=0;k<z;k++)p=t[k].position,h=k*3,y[h]=p.x,y[h+1]=p.y,y[h+2]=p.z;c.bindBuffer(c.ARRAY_BUFFER,b.__webglVertexBuffer);c.bufferData(c.ARRAY_BUFFER,y,e)}if(x){for(k=0;k<i;k++)color=g[k],h=k*3,j[h]=color.r,j[h+1]=color.g,j[h+2]=color.b;c.bindBuffer(c.ARRAY_BUFFER,b.__webglColorBuffer);c.bufferData(c.ARRAY_BUFFER,j,e)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(b instanceof
+THREE.Line){f=b.geometry;if(f.__dirtyVertices||f.__dirtyColors){b=f;e=c.DYNAMIC_DRAW;t=b.vertices;g=b.colors;z=t.length;i=g.length;y=b.__vertexArray;j=b.__colorArray;x=b.__dirtyColors;if(b.__dirtyVertices){for(k=0;k<z;k++)p=t[k].position,h=k*3,y[h]=p.x,y[h+1]=p.y,y[h+2]=p.z;c.bindBuffer(c.ARRAY_BUFFER,b.__webglVertexBuffer);c.bufferData(c.ARRAY_BUFFER,y,e)}if(x){for(k=0;k<i;k++)color=g[k],h=k*3,j[h]=color.r,j[h+1]=color.g,j[h+2]=color.b;c.bindBuffer(c.ARRAY_BUFFER,b.__webglColorBuffer);c.bufferData(c.ARRAY_BUFFER,
+j,e)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(b instanceof THREE.ParticleSystem)f=b.geometry,(f.__dirtyVertices||f.__dirtyColors||b.sortParticles)&&d(f,c.DYNAMIC_DRAW,b),f.__dirtyVertices=!1,f.__dirtyColors=!1}function S(b){function c(b){var f=[];d=0;for(e=b.length;d<e;d++)b[d]==void 0?f.push("undefined"):f.push(b[d].id);return f.join("_")}var d,e,f,g,h,i,j,k,o={},p=b.morphTargets!==void 0?b.morphTargets.length:0;b.geometryGroups={};f=0;for(g=b.faces.length;f<g;f++)h=b.faces[f],i=h.materials,
+j=c(i),o[j]==void 0&&(o[j]={hash:j,counter:0}),k=o[j].hash+"_"+o[j].counter,b.geometryGroups[k]==void 0&&(b.geometryGroups[k]={faces:[],materials:i,vertices:0,numMorphTargets:p}),h=h instanceof THREE.Face3?3:4,b.geometryGroups[k].vertices+h>65535&&(o[j].counter+=1,k=o[j].hash+"_"+o[j].counter,b.geometryGroups[k]==void 0&&(b.geometryGroups[k]={faces:[],materials:i,vertices:0,numMorphTargets:p})),b.geometryGroups[k].faces.push(f),b.geometryGroups[k].vertices+=h}function Q(b,c,d){b.push({buffer:c,object:d,
+opaque:{list:[],count:0},transparent:{list:[],count:0}})}function L(b){if(b!=M){switch(b){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)}M=
+b}}function B(b,d,e){(e.width&e.width-1)==0&&(e.height&e.height-1)==0?(c.texParameteri(b,c.TEXTURE_WRAP_S,E(d.wrapS)),c.texParameteri(b,c.TEXTURE_WRAP_T,E(d.wrapT)),c.texParameteri(b,c.TEXTURE_MAG_FILTER,E(d.magFilter)),c.texParameteri(b,c.TEXTURE_MIN_FILTER,E(d.minFilter)),c.generateMipmap(b)):(c.texParameteri(b,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE),c.texParameteri(b,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE),c.texParameteri(b,c.TEXTURE_MAG_FILTER,aa(d.magFilter)),c.texParameteri(b,c.TEXTURE_MIN_FILTER,aa(d.minFilter)))}
+function x(b,d){if(b.needsUpdate){if(b.__webglTexture)b.__webglTexture=c.deleteTexture(b.__webglTexture);b.__webglTexture=c.createTexture();c.bindTexture(c.TEXTURE_2D,b.__webglTexture);c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,b.image);B(c.TEXTURE_2D,b,b.image);c.bindTexture(c.TEXTURE_2D,null);b.needsUpdate=!1}c.activeTexture(c.TEXTURE0+d);c.bindTexture(c.TEXTURE_2D,b.__webglTexture)}function R(b){if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===
+void 0)b.stencilBuffer=!0;b.__webglFramebuffer=c.createFramebuffer();b.__webglRenderbuffer=c.createRenderbuffer();b.__webglTexture=c.createTexture();c.bindTexture(c.TEXTURE_2D,b.__webglTexture);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,E(b.wrapS));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,E(b.wrapT));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,E(b.magFilter));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,E(b.minFilter));c.texImage2D(c.TEXTURE_2D,0,E(b.format),b.width,b.height,0,
+E(b.format),E(b.type),null);c.bindRenderbuffer(c.RENDERBUFFER,b.__webglRenderbuffer);c.bindFramebuffer(c.FRAMEBUFFER,b.__webglFramebuffer);c.framebufferTexture2D(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,c.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(c.renderbufferStorage(c.RENDERBUFFER,c.DEPTH_COMPONENT16,b.width,b.height),c.framebufferRenderbuffer(c.FRAMEBUFFER,c.DEPTH_ATTACHMENT,c.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&b.stencilBuffer?(c.renderbufferStorage(c.RENDERBUFFER,
+c.DEPTH_STENCIL,b.width,b.height),c.framebufferRenderbuffer(c.FRAMEBUFFER,c.DEPTH_STENCIL_ATTACHMENT,c.RENDERBUFFER,b.__webglRenderbuffer)):c.renderbufferStorage(c.RENDERBUFFER,c.RGBA4,b.width,b.height);c.bindTexture(c.TEXTURE_2D,null);c.bindRenderbuffer(c.RENDERBUFFER,null);c.bindFramebuffer(c.FRAMEBUFFER,null)}var d,e;b?(d=b.__webglFramebuffer,e=b.width,b=b.height):(d=null,e=O,b=H);d!=Ba&&(c.bindFramebuffer(c.FRAMEBUFFER,d),c.viewport(F,Z,e,b),Ba=d)}function J(b,d){var e;b=="fragment"?e=c.createShader(c.FRAGMENT_SHADER):
+b=="vertex"&&(e=c.createShader(c.VERTEX_SHADER));c.shaderSource(e,d);c.compileShader(e);if(!c.getShaderParameter(e,c.COMPILE_STATUS))return console.error(c.getShaderInfoLog(e)),console.error(d),null;return e}function aa(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return c.NEAREST;default:return c.LINEAR}}function E(b){switch(b){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 $=this,c,ja=[],oa=null,Ba=null,ra=!0,pa=null,ka=null,M=null,ha=null,F=0,Z=0,O=0,H=0,N=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,
+new THREE.Vector4,new THREE.Vector4],P=new THREE.Matrix4,fa=new Float32Array(16),la=new Float32Array(16),qa=new THREE.Vector4,Ca={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},ia=b.canvas!==void 0?b.canvas:document.createElement("canvas"),sa=b.stencil!==void 0?b.stencil:!0,ta=b.antialias!==void 0?b.antialias:!1,na=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),Da=b.clearAlpha!==void 0?b.clearAlpha:
+0;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=ia;this.sortObjects=this.autoClear=!0;try{if(!(c=ia.getContext("experimental-webgl",{antialias:ta,stencil:sa})))throw"Error creating WebGL context.";}catch(Ha){console.error(Ha)}console.log(navigator.userAgent+" | "+c.getParameter(c.VERSION)+" | "+c.getParameter(c.VENDOR)+" | "+c.getParameter(c.RENDERER)+" | "+c.getParameter(c.SHADING_LANGUAGE_VERSION));c.clearColor(0,0,0,1);c.clearDepth(1);c.enable(c.DEPTH_TEST);
+c.depthFunc(c.LEQUAL);c.frontFace(c.CCW);c.cullFace(c.BACK);c.enable(c.CULL_FACE);c.enable(c.BLEND);c.blendEquation(c.FUNC_ADD);c.blendFunc(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA);c.clearColor(na.r,na.g,na.b,Da);this.context=c;var Ga=c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;if(sa){var u={};u.vertices=new Float32Array(12);u.faces=new Uint16Array(6);u.darkness=0.5;u.vertices[0]=-20;u.vertices[1]=-20;u.vertices[2]=-1;u.vertices[3]=20;u.vertices[4]=-20;u.vertices[5]=-1;u.vertices[6]=20;u.vertices[7]=
+20;u.vertices[8]=-1;u.vertices[9]=-20;u.vertices[10]=20;u.vertices[11]=-1;u.faces[0]=0;u.faces[1]=1;u.faces[2]=2;u.faces[3]=0;u.faces[4]=2;u.faces[5]=3;u.vertexBuffer=c.createBuffer();u.elementBuffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,u.vertexBuffer);c.bufferData(c.ARRAY_BUFFER,u.vertices,c.STATIC_DRAW);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,u.elementBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,u.faces,c.STATIC_DRAW);u.program=c.createProgram();c.attachShader(u.program,J("fragment",THREE.ShaderLib.shadowPost.fragmentShader));
+c.attachShader(u.program,J("vertex",THREE.ShaderLib.shadowPost.vertexShader));c.linkProgram(u.program);u.vertexLocation=c.getAttribLocation(u.program,"position");u.projectionLocation=c.getUniformLocation(u.program,"projectionMatrix");u.darknessLocation=c.getUniformLocation(u.program,"darkness")}var t={};t.vertices=new Float32Array(16);t.faces=new Uint16Array(6);b=0;t.vertices[b++]=-1;t.vertices[b++]=-1;t.vertices[b++]=0;t.vertices[b++]=0;t.vertices[b++]=1;t.vertices[b++]=-1;t.vertices[b++]=1;t.vertices[b++]=
+0;t.vertices[b++]=1;t.vertices[b++]=1;t.vertices[b++]=1;t.vertices[b++]=1;t.vertices[b++]=-1;t.vertices[b++]=1;t.vertices[b++]=0;t.vertices[b++]=1;b=0;t.faces[b++]=0;t.faces[b++]=1;t.faces[b++]=2;t.faces[b++]=0;t.faces[b++]=2;t.faces[b++]=3;t.vertexBuffer=c.createBuffer();t.elementBuffer=c.createBuffer();t.tempTexture=c.createTexture();t.occlusionTexture=c.createTexture();c.bindBuffer(c.ARRAY_BUFFER,t.vertexBuffer);c.bufferData(c.ARRAY_BUFFER,t.vertices,c.STATIC_DRAW);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,
+t.elementBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,t.faces,c.STATIC_DRAW);c.bindTexture(c.TEXTURE_2D,t.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,t.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);c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0?(t.hasVertexTexture=!1,t.program=c.createProgram(),c.attachShader(t.program,J("fragment",THREE.ShaderLib.lensFlare.fragmentShader)),c.attachShader(t.program,
+J("vertex",THREE.ShaderLib.lensFlare.vertexShader))):(t.hasVertexTexture=!0,t.program=c.createProgram(),c.attachShader(t.program,J("fragment",THREE.ShaderLib.lensFlareVertexTexture.fragmentShader)),c.attachShader(t.program,J("vertex",THREE.ShaderLib.lensFlareVertexTexture.vertexShader)));c.linkProgram(t.program);t.attributes={};t.uniforms={};t.attributes.vertex=c.getAttribLocation(t.program,"position");t.attributes.uv=c.getAttribLocation(t.program,"UV");t.uniforms.renderType=c.getUniformLocation(t.program,
+"renderType");t.uniforms.map=c.getUniformLocation(t.program,"map");t.uniforms.occlusionMap=c.getUniformLocation(t.program,"occlusionMap");t.uniforms.opacity=c.getUniformLocation(t.program,"opacity");t.uniforms.scale=c.getUniformLocation(t.program,"scale");t.uniforms.rotation=c.getUniformLocation(t.program,"rotation");t.uniforms.screenPosition=c.getUniformLocation(t.program,"screenPosition");var Fa=!1;_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,J("fragment",THREE.ShaderLib.sprite.fragmentShader));c.attachShader(_sprite.program,J("vertex",THREE.ShaderLib.sprite.vertexShader));c.linkProgram(_sprite.program);
+_sprite.attributes={};_sprite.uniforms={};_sprite.attributes.position=c.getAttribLocation(_sprite.program,"position");_sprite.attributes.uv=c.getAttribLocation(_sprite.program,"uv");_sprite.uniforms.uvOffset=c.getUniformLocation(_sprite.program,"uvOffset");_sprite.uniforms.uvScale=c.getUniformLocation(_sprite.program,"uvScale");_sprite.uniforms.rotation=c.getUniformLocation(_sprite.program,"rotation");_sprite.uniforms.scale=c.getUniformLocation(_sprite.program,"scale");_sprite.uniforms.alignment=
+c.getUniformLocation(_sprite.program,"alignment");_sprite.uniforms.map=c.getUniformLocation(_sprite.program,"map");_sprite.uniforms.opacity=c.getUniformLocation(_sprite.program,"opacity");_sprite.uniforms.useScreenCoordinates=c.getUniformLocation(_sprite.program,"useScreenCoordinates");_sprite.uniforms.affectedByDistance=c.getUniformLocation(_sprite.program,"affectedByDistance");_sprite.uniforms.screenPosition=c.getUniformLocation(_sprite.program,"screenPosition");_sprite.uniforms.modelViewMatrix=
+c.getUniformLocation(_sprite.program,"modelViewMatrix");_sprite.uniforms.projectionMatrix=c.getUniformLocation(_sprite.program,"projectionMatrix");var Ea=!1;this.setSize=function(b,c){ia.width=b;ia.height=c;this.setViewport(0,0,ia.width,ia.height)};this.setViewport=function(b,d,e,f){F=b;Z=d;O=e;H=f;c.viewport(F,Z,O,H)};this.setScissor=function(b,d,e,f){c.scissor(b,d,e,f)};this.enableScissorTest=function(b){b?c.enable(c.SCISSOR_TEST):c.disable(c.SCISSOR_TEST)};this.enableDepthBufferWrite=function(b){ra=
+b;c.depthMask(b)};this.setClearColorHex=function(b,d){na.setHex(b);Da=d;c.clearColor(na.r,na.g,na.b,Da)};this.setClearColor=function(b,d){na.copy(b);Da=d;c.clearColor(na.r,na.g,na.b,Da)};this.clear=function(){c.clear(c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT|c.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(b){u.darkness=b};this.getContext=function(){return c};this.initMaterial=function(b,d,e,f){var g,h,i;b instanceof THREE.MeshDepthMaterial?i="depth":b instanceof THREE.ShadowVolumeDynamicMaterial?
+i="shadowVolumeDynamic":b instanceof THREE.MeshNormalMaterial?i="normal":b instanceof THREE.MeshBasicMaterial?i="basic":b instanceof THREE.MeshLambertMaterial?i="lambert":b instanceof THREE.MeshPhongMaterial?i="phong":b instanceof THREE.LineBasicMaterial?i="basic":b instanceof THREE.ParticleBasicMaterial&&(i="particle_basic");if(i){var j=THREE.ShaderLib[i];b.uniforms=THREE.UniformsUtils.clone(j.uniforms);b.vertexShader=j.vertexShader;b.fragmentShader=j.fragmentShader}var k,p,o;k=o=j=0;for(p=d.length;k<
+p;k++)h=d[k],h instanceof THREE.DirectionalLight&&o++,h instanceof THREE.PointLight&&j++;j+o<=4?d=o:(d=Math.ceil(4*o/(j+o)),j=4-d);h={directional:d,point:j};o=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)o=f.bones.length;var n;a:{k=b.fragmentShader;p=b.vertexShader;var j=b.uniforms,d=b.attributes,e={map:!!b.map,envMap:!!b.envMap,lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:e,sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,
+maxDirLights:h.directional,maxPointLights:h.point,maxBones:o},q;h=[];i?h.push(i):(h.push(k),h.push(p));for(q in e)h.push(q),h.push(e[q]);i=h.join();q=0;for(h=ja.length;q<h;q++)if(ja[q].code==i){n=ja[q].program;break a}q=c.createProgram();h=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+e.maxDirLights,"#define MAX_POINT_LIGHTS "+e.maxPointLights,e.fog?"#define USE_FOG":"",e.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",e.map?"#define USE_MAP":"",e.envMap?"#define USE_ENVMAP":
+"",e.lightMap?"#define USE_LIGHTMAP":"",e.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");o=[Ga?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+e.maxDirLights,"#define MAX_POINT_LIGHTS "+e.maxPointLights,"#define MAX_BONES "+e.maxBones,e.map?"#define USE_MAP":"",e.envMap?"#define USE_ENVMAP":"",e.lightMap?"#define USE_LIGHTMAP":"",e.vertexColors?"#define USE_COLOR":"",e.skinning?"#define USE_SKINNING":"",e.morphTargets?"#define USE_MORPHTARGETS":
+"",e.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(q,J("fragment",h+k));c.attachShader(q,J("vertex",o+p));c.linkProgram(q);c.getProgramParameter(q,c.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+c.getProgramParameter(q,c.VALIDATE_STATUS)+", gl error ["+c.getError()+"]");q.uniforms={};q.attributes={};var r;k=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(r in j)k.push(r);r=k;j=0;for(k=
+r.length;j<k;j++)p=r[j],q.uniforms[p]=c.getUniformLocation(q,p);k=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(r=0;r<e.maxMorphTargets;r++)k.push("morphTarget"+r);for(n in d)k.push(n);n=k;r=0;for(d=n.length;r<d;r++)e=n[r],q.attributes[e]=c.getAttribLocation(q,e);ja.push({program:q,code:i});n=q}b.program=n;n=b.program.attributes;n.position>=0&&c.enableVertexAttribArray(n.position);n.color>=0&&c.enableVertexAttribArray(n.color);n.normal>=
+0&&c.enableVertexAttribArray(n.normal);n.tangent>=0&&c.enableVertexAttribArray(n.tangent);b.skinning&&n.skinVertexA>=0&&n.skinVertexB>=0&&n.skinIndex>=0&&n.skinWeight>=0&&(c.enableVertexAttribArray(n.skinVertexA),c.enableVertexAttribArray(n.skinVertexB),c.enableVertexAttribArray(n.skinIndex),c.enableVertexAttribArray(n.skinWeight));if(b.attributes)for(g in b.attributes)n[g]!==void 0&&n[g]>=0&&c.enableVertexAttribArray(n[g]);if(b.morphTargets){b.numSupportedMorphTargets=0;n.morphTarget0>=0&&(c.enableVertexAttribArray(n.morphTarget0),
+b.numSupportedMorphTargets++);n.morphTarget1>=0&&(c.enableVertexAttribArray(n.morphTarget1),b.numSupportedMorphTargets++);n.morphTarget2>=0&&(c.enableVertexAttribArray(n.morphTarget2),b.numSupportedMorphTargets++);n.morphTarget3>=0&&(c.enableVertexAttribArray(n.morphTarget3),b.numSupportedMorphTargets++);n.morphTarget4>=0&&(c.enableVertexAttribArray(n.morphTarget4),b.numSupportedMorphTargets++);n.morphTarget5>=0&&(c.enableVertexAttribArray(n.morphTarget5),b.numSupportedMorphTargets++);n.morphTarget6>=
+0&&(c.enableVertexAttribArray(n.morphTarget6),b.numSupportedMorphTargets++);n.morphTarget7>=0&&(c.enableVertexAttribArray(n.morphTarget7),b.numSupportedMorphTargets++);f.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);b=0;for(g=this.maxMorphTargets;b<g;b++)f.__webglMorphTargetInfluences[b]=0}};this.render=function(b,d,k,u){var t,y,x,B,E,F,o,G,H=b.lights,J=b.fog;$.data.vertices=0;$.data.faces=0;$.data.drawCalls=0;d.matrixAutoUpdate&&d.update(void 0,!0);b.update(void 0,!1,d);d.matrixWorldInverse.flattenToArray(la);
+d.projectionMatrix.flattenToArray(fa);P.multiply(d.projectionMatrix,d.matrixWorldInverse);j(P);this.initWebGLObjects(b);R(k);(this.autoClear||u)&&this.clear();E=b.__webglObjects.length;for(u=0;u<E;u++)if(t=b.__webglObjects[u],o=t.object,o.visible)if(!(o instanceof THREE.Mesh)||p(o)){if(o.matrixWorld.flattenToArray(o._objectMatrixArray),D(o,d),v(t),t.render=!0,this.sortObjects)qa.copy(o.position),P.multiplyVector3(qa),t.z=qa.z}else t.render=!1;else t.render=!1;this.sortObjects&&b.__webglObjects.sort(r);
+F=b.__webglObjectsImmediate.length;for(u=0;u<F;u++)t=b.__webglObjectsImmediate[u],o=t.object,o.visible&&(o.matrixAutoUpdate&&o.matrixWorld.flattenToArray(o._objectMatrixArray),D(o,d),n(t));L(THREE.NormalBlending);for(u=0;u<E;u++)if(t=b.__webglObjects[u],t.render){o=t.object;G=t.buffer;x=t.opaque;i(o);for(t=0;t<x.count;t++)B=x.list[t],g(B.depthTest),f(d,H,J,B,G,o)}for(u=0;u<F;u++)if(t=b.__webglObjectsImmediate[u],o=t.object,o.visible){x=t.opaque;i(o);for(t=0;t<x.count;t++)B=x.list[t],g(B.depthTest),
+y=e(d,H,J,B,o),o.render(function(b){h(b,y,B.shading)})}for(u=0;u<E;u++)if(t=b.__webglObjects[u],t.render){o=t.object;G=t.buffer;x=t.transparent;i(o);for(t=0;t<x.count;t++)B=x.list[t],L(B.blending),g(B.depthTest),f(d,H,J,B,G,o)}for(u=0;u<F;u++)if(t=b.__webglObjectsImmediate[u],o=t.object,o.visible){x=t.transparent;i(o);for(t=0;t<x.count;t++)B=x.list[t],L(B.blending),g(B.depthTest),y=e(d,H,J,B,o),o.render(function(b){h(b,y,B.shading)})}b.__webglSprites.length&&z(b,d);sa&&b.__webglShadowVolumes.length&&
+b.lights.length&&q(b);b.__webglLensFlares.length&&C(b,d);k&&k.minFilter!==THREE.NearestFilter&&k.minFilter!==THREE.LinearFilter&&(c.bindTexture(c.TEXTURE_2D,k.__webglTexture),c.generateMipmap(c.TEXTURE_2D),c.bindTexture(c.TEXTURE_2D,null))};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=[],b.__webglShadowVolumes=[],b.__webglLensFlares=[],b.__webglSprites=[];for(;b.__objectsAdded.length;){var d=b.__objectsAdded[0],e=b,f=void 0,g=void 0,h=void 0;
+if(d._modelViewMatrix==void 0)d._modelViewMatrix=new THREE.Matrix4,d._normalMatrixArray=new Float32Array(9),d._modelViewMatrixArray=new Float32Array(16),d._objectMatrixArray=new Float32Array(16),d.matrixWorld.flattenToArray(d._objectMatrixArray);if(d instanceof THREE.Mesh)for(f in g=d.geometry,g.geometryGroups==void 0&&S(g),g.geometryGroups){h=g.geometryGroups[f];if(!h.__webglVertexBuffer){var i=h;i.__webglVertexBuffer=c.createBuffer();i.__webglNormalBuffer=c.createBuffer();i.__webglTangentBuffer=
+c.createBuffer();i.__webglColorBuffer=c.createBuffer();i.__webglUVBuffer=c.createBuffer();i.__webglUV2Buffer=c.createBuffer();i.__webglSkinVertexABuffer=c.createBuffer();i.__webglSkinVertexBBuffer=c.createBuffer();i.__webglSkinIndicesBuffer=c.createBuffer();i.__webglSkinWeightsBuffer=c.createBuffer();i.__webglFaceBuffer=c.createBuffer();i.__webglLineBuffer=c.createBuffer();if(i.numMorphTargets){var j=void 0,k=void 0;i.__webglMorphTargetsBuffers=[];j=0;for(k=i.numMorphTargets;j<k;j++)i.__webglMorphTargetsBuffers.push(c.createBuffer())}for(var i=
+h,j=d,n=void 0,o=void 0,p=void 0,q=p=void 0,r=void 0,t=void 0,v=t=k=0,u=p=o=void 0,o=n=void 0,q=j.geometry,u=q.faces,r=i.faces,n=0,o=r.length;n<o;n++)p=r[n],p=u[p],p instanceof THREE.Face3?(k+=3,t+=1,v+=3):p instanceof THREE.Face4&&(k+=4,t+=2,v+=4);for(var n=i,o=j,x=r=u=void 0,z=void 0,x=void 0,p=[],u=0,r=o.materials.length;u<r;u++)if(x=o.materials[u],x instanceof THREE.MeshFaceMaterial){x=0;for(l=n.materials.length;x<l;x++)(z=n.materials[x])&&p.push(z)}else(z=x)&&p.push(z);n=p;a:{u=o=void 0;r=n.length;
+for(o=0;o<r;o++)if(u=n[o],u.map||u.lightMap||u instanceof THREE.MeshShaderMaterial){o=!0;break a}o=!1}a:{r=u=void 0;p=n.length;for(u=0;u<p;u++)if(r=n[u],!(r instanceof THREE.MeshBasicMaterial&&!r.envMap||r instanceof THREE.MeshDepthMaterial)){u=r&&r.shading!=void 0&&r.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}u=!1}a:{p=r=void 0;x=n.length;for(r=0;r<x;r++)if(p=n[r],p.vertexColors){p=p.vertexColors;break a}p=!1}i.__vertexArray=new Float32Array(k*3);if(u)i.__normalArray=
+new Float32Array(k*3);if(q.hasTangents)i.__tangentArray=new Float32Array(k*4);if(p)i.__colorArray=new Float32Array(k*3);if(o){if(q.faceUvs.length>0||q.faceVertexUvs.length>0)i.__uvArray=new Float32Array(k*2);if(q.faceUvs.length>1||q.faceVertexUvs.length>1)i.__uv2Array=new Float32Array(k*2)}if(j.geometry.skinWeights.length&&j.geometry.skinIndices.length)i.__skinVertexAArray=new Float32Array(k*4),i.__skinVertexBArray=new Float32Array(k*4),i.__skinIndexArray=new Float32Array(k*4),i.__skinWeightArray=
+new Float32Array(k*4);i.__faceArray=new Uint16Array(t*3+(j.geometry.edgeFaces?j.geometry.edgeFaces.length*6:0));i.__lineArray=new Uint16Array(v*2);if(i.numMorphTargets){i.__morphTargetsArrays=[];q=0;for(r=i.numMorphTargets;q<r;q++)i.__morphTargetsArrays.push(new Float32Array(k*3))}i.__needsSmoothNormals=u==THREE.SmoothShading;i.__uvType=o;i.__vertexColorType=p;i.__normalType=u;i.__webglFaceCount=t*3+(j.geometry.edgeFaces?j.geometry.edgeFaces.length*6:0);i.__webglLineCount=v*2;q=0;for(r=n.length;q<
+r;q++)if(n[q].attributes)for(a in i.__webglCustomAttributes={},n[q].attributes){o={};for(prop in n[q].attributes[a])o[prop]=n[q].attributes[a][prop];if(!o.__webglInitialized||o.createUniqueBuffers)o.__webglInitialized=!0,t=1,o.type==="v2"?t=2:o.type==="v3"?t=3:o.type==="v4"?t=4:o.type==="c"&&(t=3),o.size=t,o.needsUpdate=!0,o.array=new Float32Array(k*t),o.buffer=c.createBuffer(),o.buffer.belongsToAttribute=a;i.__webglCustomAttributes[a]=o}i.__inittedArrays=!0;g.__dirtyVertices=!0;g.__dirtyMorphTargets=
+!0;g.__dirtyElements=!0;g.__dirtyUvs=!0;g.__dirtyNormals=!0;g.__dirtyTangents=!0;g.__dirtyColors=!0}d instanceof THREE.ShadowVolume?Q(e.__webglShadowVolumes,h,d):Q(e.__webglObjects,h,d)}else if(d instanceof THREE.LensFlare)Q(e.__webglLensFlares,void 0,d);else if(d instanceof THREE.Ribbon){g=d.geometry;if(!g.__webglVertexBuffer)f=g,f.__webglVertexBuffer=c.createBuffer(),f.__webglColorBuffer=c.createBuffer(),f=g,h=f.vertices.length,f.__vertexArray=new Float32Array(h*3),f.__colorArray=new Float32Array(h*
+3),f.__webglVertexCount=h,g.__dirtyVertices=!0,g.__dirtyColors=!0;Q(e.__webglObjects,g,d)}else if(d instanceof THREE.Line){g=d.geometry;if(!g.__webglVertexBuffer)f=g,f.__webglVertexBuffer=c.createBuffer(),f.__webglColorBuffer=c.createBuffer(),f=g,h=f.vertices.length,f.__vertexArray=new Float32Array(h*3),f.__colorArray=new Float32Array(h*3),f.__webglLineCount=h,g.__dirtyVertices=!0,g.__dirtyColors=!0;Q(e.__webglObjects,g,d)}else if(d instanceof THREE.ParticleSystem){g=d.geometry;if(!g.__webglVertexBuffer)f=
+g,f.__webglVertexBuffer=c.createBuffer(),f.__webglColorBuffer=c.createBuffer(),f=g,h=f.vertices.length,f.__vertexArray=new Float32Array(h*3),f.__colorArray=new Float32Array(h*3),f.__sortArray=[],f.__webglParticleCount=h,g.__dirtyVertices=!0,g.__dirtyColors=!0;Q(e.__webglObjects,g,d)}else THREE.MarchingCubes!==void 0&&d instanceof THREE.MarchingCubes?e.__webglObjectsImmediate.push({object:d,opaque:{list:[],count:0},transparent:{list:[],count:0}}):d instanceof THREE.Sprite&&e.__webglSprites.push(d);
+b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;){d=b.__objectsRemoved[0];e=b;f=g=void 0;if(d instanceof THREE.Mesh)for(g=e.__webglObjects.length-1;g>=0;g--){if(f=e.__webglObjects[g].object,d==f){e.__webglObjects.splice(g,1);break}}else if(d instanceof THREE.Sprite)for(g=e.__webglSprites.length-1;g>=0;g--)if(f=e.__webglSprites[g],d==f){e.__webglSprites.splice(g,1);break}b.__objectsRemoved.splice(0,1)}d=0;for(e=b.__webglObjects.length;d<e;d++)y(b.__webglObjects[d].object,b);d=0;for(e=b.__webglShadowVolumes.length;d<
+e;d++)y(b.__webglShadowVolumes[d].object,b);d=0;for(e=b.__webglLensFlares.length;d<e;d++)y(b.__webglLensFlares[d].object,b)};this.setFaceCulling=function(b,d){b?(!d||d=="ccw"?c.frontFace(c.CCW):c.frontFace(c.CW),b=="back"?c.cullFace(c.BACK):b=="front"?c.cullFace(c.FRONT):c.cullFace(c.FRONT_AND_BACK),c.enable(c.CULL_FACE)):c.disable(c.CULL_FACE)};this.supportsVertexTextures=function(){return Ga}};
 THREE.WebGLRenderTarget=function(b,d,e){this.width=b;this.height=d;e=e||{};this.wrapS=e.wrapS!==void 0?e.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=e.wrapT!==void 0?e.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=e.magFilter!==void 0?e.magFilter:THREE.LinearFilter;this.minFilter=e.minFilter!==void 0?e.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=e.format!==void 0?e.format:THREE.RGBAFormat;this.type=e.type!==void 0?e.type:
 THREE.UnsignedByteType;this.depthBuffer=e.depthBuffer!==void 0?e.depthBuffer:!0;this.stencilBuffer=e.stencilBuffer!==void 0?e.stencilBuffer:!0};

+ 37 - 21
examples/canvas_geometry_text.html

@@ -22,6 +22,7 @@
 		<script type="text/javascript" src="js/Stats.js"></script>
 		      
 		<!-- load the font file from canvas-text -->
+
 		<script type="text/javascript" src="js/helvetiker-normal-normal.js"></script>
         
 
@@ -55,10 +56,10 @@
 				info.style.top = '10px';
 				info.style.width = '100%';
 				info.style.textAlign = 'center';
-				info.innerHTML = 'Drag to spin the text<br/>Simple Dynamic 3D Text Example by <a href="http://www.lab4games.net/zz85/blog">zz85</a>';
+				info.innerHTML = 'Simple Dynamic 3D Text Example by <a href="http://www.lab4games.net/zz85/blog">zz85</a><br/>Drag to spin the text';
 				container.appendChild( info );
 
-				camera = new THREE.Camera( 70, window.innerWidth / window.innerHeight, 1, 1000 );
+				camera = new THREE.Camera( 50, window.innerWidth / window.innerHeight, 1, 1000 );
 				camera.position.y = 150;
 				camera.position.z = 500;
 				camera.target.position.y = 150;
@@ -66,41 +67,49 @@
 				scene = new THREE.Scene();
 
 				// Get text from hash
+
 				var theText = "Hello three.js! :)";
-                 var hash = document.location.hash.substr(1);
-                  if (hash.length === 0) {
-                    
-                  } else {
-                   theText = hash;
-                  }
+				
+				var hash = document.location.hash.substr( 1 );
+				
+				if ( hash.length !== 0 ) {
+                   
+					theText = hash;
+
+				}
                 
-                var text3d = new THREE.Text(theText, {
+                var text3d = new THREE.Text( theText, {
+
 					size: 80, 
-					height:40,
-					curveSegments:2,
+					height: 20,
+					curveSegments: 2,
 					font: "helvetiker"
+
 				});
-             
-                var textMaterial = new THREE.MeshBasicMaterial( { color: Math.random() * 0xffffff, wireframe:false });
-                text = new THREE.Mesh( text3d, textMaterial);
-                
+
+                var textMaterial = new THREE.MeshBasicMaterial( { color: Math.random() * 0xffffff, wireframe:false } );
+                text = new THREE.Mesh( text3d, textMaterial );
+
                 text.doubleSided = false;
+
                 text.position.y = 0;
-                text.position.y = 0;
+                text.position.y = 100;
                 text.position.z = 0;
+
                 text.rotation.x = 0;
                 text.rotation.y = Math.PI*2;
 				text.overdraw = true;
-				
+
                 scene.addObject( text );
-             
+
 				// Plane
-				plane = new THREE.Mesh( new THREE.Plane( 800, 800 ), new THREE.MeshBasicMaterial( { color: 0xe0e0e0, wireframe:true}) );
+
+				plane = new THREE.Mesh( new THREE.Plane( 800, 800 ), new THREE.MeshBasicMaterial( { color: 0xe0e0e0, wireframe:true }) );
 				plane.rotation.x = - 90 * ( Math.PI / 180 );
                 plane.position.x = 0;
 				plane.overdraw = true;
-                
-				scene.addObject( plane );
+
+				//scene.addObject( plane );
 
 				renderer = new THREE.CanvasRenderer();
                 renderer.setSize( window.innerWidth, window.innerHeight );
@@ -115,6 +124,7 @@
 				document.addEventListener( 'mousedown', onDocumentMouseDown, false );
 				document.addEventListener( 'touchstart', onDocumentTouchStart, false );
 				document.addEventListener( 'touchmove', onDocumentTouchMove, false );
+
 			}
 
 			//
@@ -129,6 +139,7 @@
 
 				mouseXOnMouseDown = event.clientX - windowHalfX;
 				targetRotationOnMouseDown = targetRotation;
+
 			}
 
 			function onDocumentMouseMove( event ) {
@@ -136,6 +147,7 @@
 				mouseX = event.clientX - windowHalfX;
 
 				targetRotation = targetRotationOnMouseDown + ( mouseX - mouseXOnMouseDown ) * 0.02;
+
 			}
 
 			function onDocumentMouseUp( event ) {
@@ -143,6 +155,7 @@
 				document.removeEventListener( 'mousemove', onDocumentMouseMove, false );
 				document.removeEventListener( 'mouseup', onDocumentMouseUp, false );
 				document.removeEventListener( 'mouseout', onDocumentMouseOut, false );
+
 			}
 
 			function onDocumentMouseOut( event ) {
@@ -150,6 +163,7 @@
 				document.removeEventListener( 'mousemove', onDocumentMouseMove, false );
 				document.removeEventListener( 'mouseup', onDocumentMouseUp, false );
 				document.removeEventListener( 'mouseout', onDocumentMouseOut, false );
+
 			}
 
 			function onDocumentTouchStart( event ) {
@@ -162,6 +176,7 @@
 					targetRotationOnMouseDown = targetRotation;
 
 				}
+
 			}
 
 			function onDocumentTouchMove( event ) {
@@ -174,6 +189,7 @@
 					targetRotation = targetRotationOnMouseDown + ( mouseX - mouseXOnMouseDown ) * 0.05;
 
 				}
+
 			}
 
 			//

+ 259 - 0
examples/webgl_materials_cars_camaro_crosseyed.html

@@ -0,0 +1,259 @@
+<!DOCTYPE HTML>
+<html lang="en">
+	<head>
+		<title>three.js webgl - materials - cube reflection [camaro]</title>
+		<meta charset="utf-8">
+		<style type="text/css">
+			body {
+				background:#000;
+				color:#fff;
+				padding:0;
+				margin:0;
+				overflow:hidden;
+				font-family:georgia;
+				text-align:center;
+			}
+			h1 { }
+			a { color:skyblue }
+			canvas { pointer-events:none; z-index:10; position:relative; }
+			#log { position:absolute; top:50px; text-align:left; display:block; z-index:100 }
+			#d { text-align:center; margin:1em 0 -2.5em 0; z-index:0; position:relative; display:block }
+			#buttons { margin:0.5em 0 0 0 }
+			button { font-family:georgia; border:0; background:#222; color:#fff; padding:0.2em 0.5em; cursor:pointer; border-radius:3px }
+			button:hover { background:#333 }
+		</style>
+	</head>
+
+	<body>
+		<div id="d">
+			<div id="info">
+				<a href="http://github.com/mrdoob/three.js" target="_blank">three.js</a> - webgl cube reflection demo. chevrolet camaro by <a href="http://www.turbosquid.com/3d-models/blender-camaro/411348" target="_blank">dskfnwn</a>
+					- O, P : change eye separation
+				</div>
+				
+			<div id="buttons"></div>
+		</div>
+
+		<div id="log"></div>
+
+		<script type="text/javascript" src="../build/Three.js"></script>
+		
+		<script type="text/javascript" src="js/Detector.js"></script>
+		<script type="text/javascript" src="js/RequestAnimationFrame.js"></script>
+		<script type="text/javascript" src="js/Stats.js"></script>
+
+		<script type="text/javascript">
+
+			if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
+
+			var SCREEN_WIDTH = window.innerWidth;
+			var SCREEN_HEIGHT = window.innerHeight;
+
+			var container, stats;
+
+			var camera, scene, webglRenderer;
+
+			var lightMesh;
+
+			var directionalLight, pointLight;
+
+			var mouseX = 0, mouseY = 0;
+
+			var windowHalfX = window.innerWidth / 2;
+			var windowHalfY = window.innerHeight / 2;
+
+			init();
+			animate();
+
+			function init() {
+
+				container = document.createElement( 'div' );
+				document.body.appendChild( container );
+
+				camera = new THREE.Camera( 70, SCREEN_WIDTH / SCREEN_HEIGHT, 1, 100000 );
+				camera.position.z = 1000;
+				camera.updateMatrix();
+
+				scene = new THREE.Scene();
+
+				// LIGHTS
+
+				var ambient = new THREE.AmbientLight( 0x555555 );
+				scene.addLight( ambient );
+
+				directionalLight = new THREE.DirectionalLight( 0xffffff );
+				directionalLight.position.x = 1;
+				directionalLight.position.y = 1;
+				directionalLight.position.z = 0.5;
+				directionalLight.position.normalize();
+				scene.addLight( directionalLight );
+
+				pointLight = new THREE.PointLight( 0xffaa00 );
+				pointLight.position.x = 0;
+				pointLight.position.y = 0;
+				pointLight.position.z = 0;
+				scene.addLight( pointLight );
+
+
+				sphere = new THREE.Sphere( 100, 16, 8, 1 );
+				lightMesh = new THREE.Mesh( sphere, new THREE.MeshBasicMaterial( { color: 0xffaa00 } ) );
+				lightMesh.scale.x = lightMesh.scale.y = lightMesh.scale.z = 0.05;
+				lightMesh.position = pointLight.position;
+				lightMesh.overdraw = true;
+				lightMesh.updateMatrix();
+				scene.addObject(lightMesh);
+
+
+				webglRenderer = new THREE.CrosseyedWebGLRenderer( { separation: 20, antialias: true } );
+				webglRenderer.setSize( window.innerWidth, window.innerHeight );
+				container.appendChild( webglRenderer.domElement );
+
+				webglRenderer.setFaceCulling( 0 );
+
+				stats = new Stats();
+				stats.domElement.style.position = 'absolute';
+				stats.domElement.style.top = '0px';
+				stats.domElement.style.zIndex = 100;
+				container.appendChild( stats.domElement );
+
+				document.addEventListener( 'mousemove', onDocumentMouseMove, false );
+				document.addEventListener( 'keydown', onKeyDown, false );
+
+				var r = "textures/cube/SwedishRoyalCastle/";
+				var urls = [ r + "px.jpg", r + "nx.jpg",
+							 r + "py.jpg", r + "ny.jpg",
+							 r + "pz.jpg", r + "nz.jpg" ];
+
+				var textureCube = THREE.ImageUtils.loadTextureCube( urls );
+
+				var camaroMaterials = {
+
+					body: [],
+					chrome: new THREE.MeshLambertMaterial( { color: 0xffffff, envMap: textureCube } ),
+					darkchrome: new THREE.MeshLambertMaterial( { color: 0x444444, envMap: textureCube } ),
+					glass: new THREE.MeshBasicMaterial( { color: 0x223344, envMap: textureCube, opacity: 0.25, combine: THREE.MixOperation, reflectivity: 0.25, transparent: true } ),
+					tire: new THREE.MeshLambertMaterial( { color: 0x050505 } ),
+					interior: new THREE.MeshPhongMaterial( { color: 0x050505, shininess: 20 } ),
+					black: new THREE.MeshLambertMaterial( { color: 0x000000 } )
+
+				}
+
+				camaroMaterials.body.push( [ "Orange", new THREE.MeshLambertMaterial( { color: 0xff6600, envMap: textureCube, combine: THREE.MixOperation, reflectivity: 0.3 } ) ] );
+				camaroMaterials.body.push( [ "Blue", new THREE.MeshLambertMaterial( { color: 0x226699, envMap: textureCube, combine: THREE.MixOperation, reflectivity: 0.3 } ) ] );
+				camaroMaterials.body.push( [ "Red", new THREE.MeshLambertMaterial( { color: 0x660000, envMap: textureCube, combine: THREE.MixOperation, reflectivity: 0.5 } ) ] );
+				camaroMaterials.body.push( [ "Black", new THREE.MeshLambertMaterial( { color: 0x000000, envMap: textureCube, combine: THREE.MixOperation, reflectivity: 0.5 } ) ] );
+				camaroMaterials.body.push( [ "White", new THREE.MeshLambertMaterial( { color: 0xffffff, envMap: textureCube, combine: THREE.MixOperation, reflectivity: 0.5 } ) ] );
+
+				camaroMaterials.body.push( [ "Carmine", new THREE.MeshPhongMaterial( { color: 0x770000, specular:0xffaaaa, envMap: textureCube, combine: THREE.MultiplyOperation } ) ] );
+				camaroMaterials.body.push( [ "Gold", new THREE.MeshPhongMaterial( { color: 0xaa9944, specular:0xbbaa99, shininess:50, envMap: textureCube, combine: THREE.MultiplyOperation } ) ] );
+				camaroMaterials.body.push( [ "Bronze", new THREE.MeshPhongMaterial( { color: 0x150505, specular:0xee6600, shininess:10, envMap: textureCube, combine: THREE.MixOperation, reflectivity: 0.5 } ) ] );
+				camaroMaterials.body.push( [ "Chrome", new THREE.MeshPhongMaterial( { color: 0xffffff, specular:0xffffff, envMap: textureCube, combine: THREE.MultiplyOperation } ) ] );
+
+				var loader = new THREE.BinaryLoader();
+				loader.load( { model: "obj/camaro/CamaroNoUv_bin.js", callback: function( geometry ) { createScene( geometry, camaroMaterials ) } } );
+
+			}
+
+			function $( id ) { return document.getElementById( id ) }
+
+
+			function createButtons( materials, geometry ) {
+
+				var i, src = "", parent = $( "buttons" );
+
+				for( i = 0; i < materials.length; i++ ) {
+
+					src += '<button id="m' + i + '">' + materials[ i ][ 0 ] + '</button>';
+
+				}
+
+				parent.innerHTML = src;
+
+				for( i = 0; i < materials.length; i++ ) {
+
+					$( "m" + i ).counter = i;
+					$( "m" + i ).addEventListener( 'click', function() { geometry.materials[ 0 ][ 0 ] = materials[ this.counter ][ 1 ] }, false );
+
+				}
+
+			}
+
+			function createScene( geometry, materials ) {
+
+				var s = 75, m = new THREE.MeshFaceMaterial();
+
+				geometry.materials[ 0 ][ 0 ] = materials.body[ 0 ][ 1 ]; // car body
+				geometry.materials[ 1 ][ 0 ] = materials.chrome; // wheels chrome
+				geometry.materials[ 2 ][ 0 ] = materials.chrome; // grille chrome
+				geometry.materials[ 3 ][ 0 ] = materials.darkchrome; // door lines
+				geometry.materials[ 4 ][ 0 ] = materials.glass; // windshield
+				geometry.materials[ 5 ][ 0 ] = materials.interior; // interior
+				geometry.materials[ 6 ][ 0 ] = materials.tire; // tire
+				geometry.materials[ 7 ][ 0 ] = materials.black; // tireling
+				geometry.materials[ 8 ][ 0 ] = materials.black; // behind grille
+
+				THREE.SceneUtils.addMesh( scene, geometry, s, 0, 0, 0, 0.0, 1.0, 0.0, m );
+
+				createButtons( materials.body, geometry );
+
+			}
+
+			function onDocumentMouseMove( event ) {
+
+				mouseX = ( event.clientX - windowHalfX );
+				mouseY = ( event.clientY - windowHalfY );
+
+			}
+
+			function onKeyDown ( event ) {
+
+				switch( event.keyCode ) {
+				
+					/* O */
+					case 79: webglRenderer.separation -= 0.5; break;
+					
+					/* P */
+					case 80: webglRenderer.separation += 0.5; break;
+
+				}
+
+				console.log( webglRenderer.separation );
+
+			};
+
+			// 
+
+			function animate() {
+
+				requestAnimationFrame( animate );
+
+				render();
+				stats.update();
+
+			}
+
+			function render() {
+
+				var timer = - new Date().getTime() * 0.0002;
+
+				camera.position.x += ( mouseX - camera.position.x ) * .05;
+				camera.position.y += ( - mouseY - camera.position.y ) * .05;
+
+				lightMesh.position.x = 1500 * Math.cos( timer );
+				lightMesh.position.z = 1500 * Math.sin( timer );
+
+				webglRenderer.render( scene, camera );
+
+			}
+
+			function log(text) {
+
+				var e = document.getElementById("log");
+				e.innerHTML = text + "<br/>" + e.innerHTML;
+
+			}
+
+		</script>
+
+	</body>
+</html>

+ 170 - 0
examples/webgl_materials_cubemap_balls_refraction_crosseyed.html

@@ -0,0 +1,170 @@
+<!DOCTYPE HTML>
+<html lang="en">
+	<head>
+		<title>three.js webgl - materials - cube refraction [balls]</title>
+		<meta charset="utf-8">
+		<style type="text/css">
+			body {
+				background:#777;
+				padding:0;
+				margin:0;
+				font-weight: bold;
+				overflow:hidden;
+			}
+
+			#info {
+				position: absolute;
+				top: 0px; width: 100%;
+				color: #ffffff;
+				padding: 5px;
+				font-family:Monospace;
+				font-size:13px;
+				text-align:center;
+				z-index:1000; 
+			}
+
+			a {
+				color: #ffffff;
+			}
+
+			#oldie a { color:#da0 }
+		</style>
+	</head>
+
+	<body>
+		<div id="info">
+			<a href="http://github.com/mrdoob/three.js" target="_blank">three.js</a> - webgl cube refraction demo. skybox by <a href="http://www.zfight.com/" target="_blank">Jochum Skoglund</a>
+			- O, P : change eye separation
+		</div>
+
+		<script type="text/javascript" src="../build/Three.js"></script>
+
+		<script type="text/javascript" src="js/Detector.js"></script>
+		<script type="text/javascript" src="js/RequestAnimationFrame.js"></script>
+
+		<script type="text/javascript">
+
+			if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
+
+			var container, timer;
+
+			var camera, scene, webglRenderer;
+
+			var mesh, zmesh, lightMesh, geometry;
+			var spheres = [];
+
+			var directionalLight, pointLight;
+
+			var mouseX = 0, mouseY = 0;
+
+			var windowHalfX = window.innerWidth / 2;
+			var windowHalfY = window.innerHeight / 2;
+
+			document.addEventListener( 'mousemove', onDocumentMouseMove, false );
+
+			init();
+			animate();
+
+			function init() {
+
+				container = document.createElement( 'div' );
+				document.body.appendChild( container );
+
+				camera = new THREE.Camera( 60, window.innerWidth / window.innerHeight, 1, 100000 );
+				camera.position.z = 3200;
+
+				scene = new THREE.Scene();
+
+				var geometry = new THREE.Sphere( 100, 32, 16 );
+
+				var path = "textures/cube/skybox/";
+				var format = '.jpg';
+				var urls = [
+					path + 'px' + format, path + 'nx' + format,
+					path + 'py' + format, path + 'ny' + format,
+					path + 'pz' + format, path + 'nz' + format
+				];
+
+				var textureCube = THREE.ImageUtils.loadTextureCube( urls, new THREE.CubeRefractionMapping() );
+				var material = new THREE.MeshBasicMaterial( { color: 0xffffff, envMap: textureCube, refractionRatio: 0.95 } );
+
+				for ( var i = 0; i < 500; i ++ ) {
+
+					var mesh = new THREE.Mesh( geometry, material );
+					mesh.position.x = Math.random() * 10000 - 5000;
+					mesh.position.y = Math.random() * 10000 - 5000;
+					mesh.position.z = Math.random() * 10000 - 5000;
+					mesh.scale.x = mesh.scale.y = mesh.scale.z = Math.random() * 3 + 1;
+					scene.addObject( mesh );
+
+					spheres.push( mesh );
+
+				}
+
+				THREE.SceneUtils.addPanoramaCubeWebGL( scene, 100000, textureCube );
+
+				webglRenderer = new THREE.CrosseyedWebGLRenderer( { separation: 90 } );
+				webglRenderer.setSize( window.innerWidth, window.innerHeight );
+				container.appendChild( webglRenderer.domElement );
+				
+				document.addEventListener( 'keydown', onKeyDown, false );
+
+			}
+
+			function onDocumentMouseMove( event ) {
+
+				mouseX = ( event.clientX - windowHalfX ) * 10;
+				mouseY = ( event.clientY - windowHalfY ) * 10;
+
+			}
+
+			function onKeyDown ( event ) {
+
+				switch( event.keyCode ) {
+				
+					/* O */
+					case 79: webglRenderer.separation -= 0.5; break;
+					
+					/* P */
+					case 80: webglRenderer.separation += 0.5; break;
+
+				}
+
+				console.log( webglRenderer.separation );
+
+			};
+
+			//
+
+			function animate() {
+
+				requestAnimationFrame( animate );
+
+				render();
+
+			}
+
+			function render() {
+
+				timer = new Date().getTime() * 0.0001;
+
+				camera.position.x += ( mouseX - camera.position.x ) * .05;
+				camera.position.y += ( - mouseY - camera.position.y ) * .05;
+
+				for ( var i = 0, il = spheres.length; i < il; i ++ ) {
+
+					var sphere = spheres[ i ];
+
+					sphere.position.x = 5000 * Math.cos( timer + i );
+					sphere.position.y = 5000 * Math.sin( timer + i * 1.1 );
+
+				}
+
+				webglRenderer.render( scene, camera );
+
+			}
+
+		</script>
+
+	</body>
+</html>

+ 264 - 0
examples/webgl_multiple_canvases_complex.html

@@ -0,0 +1,264 @@
+<!DOCTYPE HTML>
+<html lang="en">
+	<head>
+		<title>three.js webgl - multiple-canvaes - complex</title>
+		<meta charset="utf-8">
+		<style type="text/css">
+			body {
+				color: #808080;
+				font-family:Monospace;
+				font-size:13px;
+				text-align:center;
+
+				background-color: #fff;
+				margin: 0px;
+				overflow: hidden;
+			}
+
+			#info {
+				position: absolute;
+				top: 0px; width: 100%;
+				padding: 5px;
+			}
+
+			#container1, #container2, #container3 {
+				position: relative;
+				border: 1px solid red;
+			}
+
+			#container1 {
+				width: 300px;
+				height: 200px;
+			}
+
+			#container2 {
+				width: 400px;
+				height: 100px;
+				left: 150px;
+			}
+
+			#container3 {
+				width: 200px;
+				height: 300px;
+				left: 75px;
+			}
+
+			a {
+
+				color: #0080ff;
+			}
+
+		</style>
+	</head>
+	<body>
+
+		<div id="container">
+			<div id="container1"></div>
+			<div id="container2"></div>
+			<div id="container3"></div>
+		</div>
+		<div id="info"><a href="http://github.com/mrdoob/three.js" target="_blank">three.js</a> - vertex colors - webgl</div>
+
+		<script type="text/javascript" src="../build/Three.js"></script>
+
+		<script type="text/javascript" src="js/Detector.js"></script>
+		<script type="text/javascript" src="js/RequestAnimationFrame.js"></script>
+		<script type="text/javascript" src="js/Stats.js"></script>
+
+		<script type="text/javascript">
+
+			if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
+
+			var apps = [];
+
+			init();
+			animate();
+
+			function init() {
+
+				var container1 = document.getElementById( 'container1' );
+				var container2 = document.getElementById( 'container2' );
+				var container3 = document.getElementById( 'container3' );
+
+				var fullWidth = 550;
+				var fullHeight = 600;
+
+				apps.push( new App( 'container1', fullWidth, fullHeight,   0,   0, container1.clientWidth, container1.clientHeight ) );
+				apps.push( new App( 'container2', fullWidth, fullHeight, 150, 200, container2.clientWidth, container2.clientHeight ) );
+				apps.push( new App( 'container3', fullWidth, fullHeight,  75, 300, container3.clientWidth, container3.clientHeight ) );
+
+			}
+
+			function animate() {
+
+				for ( var i = 0; i < apps.length; ++i ) {
+
+					apps[ i ].animate();
+
+				}
+
+				requestAnimationFrame( animate );
+
+			}
+
+			function App( containerId, fullWidth, fullHeight, viewX, viewY, viewWidth, viewHeight ) {
+
+				var container, stats;
+
+				var camera, scene, renderer;
+
+				var mesh, mesh2, mesh3, light;
+
+				var mouseX = 0, mouseY = 0;
+
+				var windowHalfX = window.innerWidth / 2;
+				var windowHalfY = window.innerHeight / 2;
+
+				init();
+
+				function init() {
+
+					container = document.getElementById( containerId );
+
+					camera = new THREE.Camera( 20, container.clientWidth / container.clientHeight, 1, 10000 );
+					camera.setViewOffset(fullWidth, fullHeight, viewX, viewY, viewWidth, viewHeight);
+					camera.position.z = 1800;
+
+					scene = new THREE.Scene();
+
+					light = new THREE.DirectionalLight( 0xffffff );
+					light.position.set( 0, 0, 1 );
+					light.position.normalize();
+					scene.addLight( light );
+
+					var shadowMaterial = new THREE.MeshBasicMaterial( { map: THREE.ImageUtils.loadTexture( 'textures/shadow.png' ) } );
+					var shadowGeo = new THREE.Plane( 300, 300, 1, 1 );
+
+					mesh = new THREE.Mesh( shadowGeo, shadowMaterial );
+					mesh.position.y = - 250;
+					mesh.rotation.x = - 90 * Math.PI / 180;
+					scene.addObject( mesh );
+
+					mesh = new THREE.Mesh( shadowGeo, shadowMaterial );
+					mesh.position.y = - 250;
+					mesh.position.x = - 400;
+					mesh.rotation.x = - 90 * Math.PI / 180;
+					scene.addObject( mesh );
+
+					mesh = new THREE.Mesh( shadowGeo, shadowMaterial );
+					mesh.position.y = - 250;
+					mesh.position.x = 400;
+					mesh.rotation.x = - 90 * Math.PI / 180;
+					scene.addObject( mesh );
+
+					var faceIndices = [ 'a', 'b', 'c', 'd' ];
+
+					var color, f, f2, f3, p, n, vertexIndex,
+
+						geometry  = new THREE.Icosahedron( 1 ),
+						geometry2 = new THREE.Icosahedron( 1 ),
+						geometry3 = new THREE.Icosahedron( 1 );
+
+					for ( var i = 0; i < geometry.faces.length; i++ ) {
+
+						f  = geometry.faces[ i ];
+						f2 = geometry2.faces[ i ];
+						f3 = geometry3.faces[ i ];
+
+						n = ( f instanceof THREE.Face3 ) ? 3 : 4;
+
+						for( var j = 0; j < n; j++ ) {
+
+							vertexIndex = f[ faceIndices[ j ] ];
+
+							p = geometry.vertices[ vertexIndex ].position;
+
+							color = new THREE.Color( 0xffffff );
+							color.setHSV( ( p.y + 1 ) / 2, 1.0, 1.0 );
+
+							f.vertexColors[ j ] = color;
+
+							color = new THREE.Color( 0xffffff );
+							color.setHSV( 0.0, ( p.y + 1 ) / 2, 1.0 );
+
+							f2.vertexColors[ j ] = color;
+
+							color = new THREE.Color( 0xffffff );
+							color.setHSV( 0.125 * vertexIndex/geometry.vertices.length, 1.0, 1.0 );
+
+							f3.vertexColors[ j ] = color;
+
+						}
+
+					}
+
+
+					var materials = [
+
+						new THREE.MeshLambertMaterial( { color: 0xffffff, shading: THREE.FlatShading, vertexColors: THREE.VertexColors } ),
+						new THREE.MeshBasicMaterial( { color: 0x000000, shading: THREE.FlatShading, wireframe: true } )
+
+					];
+
+					mesh = new THREE.Mesh( geometry, materials  );
+					mesh.position.x = -400;
+					mesh.scale.x = mesh.scale.y = mesh.scale.z = 200;
+					mesh.rotation.x = -1.87;
+					scene.addObject( mesh );
+
+					mesh2 = new THREE.Mesh( geometry2, materials  );
+					mesh2.position.x = 400;
+					mesh2.rotation.x = 0;
+					mesh2.scale = mesh.scale;
+					scene.addObject( mesh2 );
+
+					mesh3 = new THREE.Mesh( geometry3, materials  );
+					mesh3.position.x = 0;
+					mesh3.rotation.x = 0;
+					mesh3.scale = mesh.scale;
+					scene.addObject( mesh3 );
+
+					renderer = new THREE.WebGLRenderer( { antialias: true } );
+					renderer.setSize( container.clientWidth, container.clientHeight );
+
+					container.appendChild( renderer.domElement );
+
+					stats = new Stats();
+					stats.domElement.style.position = 'absolute';
+					stats.domElement.style.top = '0px';
+					container.appendChild( stats.domElement );
+
+					document.addEventListener( 'mousemove', onDocumentMouseMove, false );
+
+				}
+
+				function onDocumentMouseMove( event ) {
+
+					mouseX = ( event.clientX - windowHalfX );
+					mouseY = ( event.clientY - windowHalfY );
+
+				}
+
+				//
+
+				this.animate = function() {
+
+					render();
+					stats.update();
+
+				};
+
+				function render() {
+
+					camera.position.x += ( mouseX - camera.position.x ) * 0.05;
+					camera.position.y += ( - mouseY - camera.position.y ) * 0.05;
+
+					renderer.render( scene, camera );
+
+				}
+			}
+
+		</script>
+
+	</body>
+</html>

+ 280 - 0
examples/webgl_multiple_canvases_grid.html

@@ -0,0 +1,280 @@
+<!DOCTYPE HTML>
+<html lang="en">
+	<head>
+		<title>three.js webgl - multiple canvases - grid</title>
+		<meta charset="utf-8">
+		<style type="text/css">
+			html, body {
+				color: #808080;
+				font-family:Monospace;
+				font-size:13px;
+				text-align:center;
+
+				background-color: #fff;
+				margin: 0px;
+				overflow: hidden;
+				width: 100%;
+				height: 100%;
+			}
+
+			#info {
+				position: absolute;
+				top: 0px; width: 100%;
+				padding: 5px;
+			}
+
+			#centerer {
+				display: table;
+				width: 100%;
+				height: 100%;
+			}
+
+			#centerer-cell {
+				display: table-cell;
+				vertical-align: middle;
+			}
+
+			#container {
+				margin-left: auto;
+				margin-right: auto;
+				width: 604px;  // 300*2 + border;
+			}
+
+			#container div {
+				float: left;
+			}
+			#container1, #container2, #container3, #container4 {
+				width: 300px;
+				height: 200px;
+				position: relative;
+				border: 1px solid red;
+				float:left;
+			}
+
+			a {
+
+				color: #0080ff;
+			}
+
+		</style>
+	</head>
+	<body>
+		<div id="centerer">
+			<div id="centerer-cell">
+				<div id="container">
+					<div class="container-row">
+						<div id="container1"></div>
+						<div id="container2"></div>
+					</div>
+					<div class="container-row">
+						<div id="container3"></div>
+						<div id="container4"></div>
+					</div>
+				</div>
+			</div>
+		</div>
+		<div id="info"><a href="http://github.com/mrdoob/three.js" target="_blank">three.js</a> - vertex colors - webgl</div>
+
+		<script type="text/javascript" src="../build/Three.js"></script>
+
+		<script type="text/javascript" src="js/Detector.js"></script>
+		<script type="text/javascript" src="js/RequestAnimationFrame.js"></script>
+		<script type="text/javascript" src="js/Stats.js"></script>
+
+		<script type="text/javascript">
+
+			if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
+
+			var apps = [];
+
+			init();
+			animate();
+
+			function init() {
+
+				var w = 300;
+				var h = 200;
+
+				var fullWidth = w * 2;
+				var fullHeight = h * 2;
+
+				apps.push( new App( 'container1', fullWidth, fullHeight, w * 0, h * 0, w, h ) );
+				apps.push( new App( 'container2', fullWidth, fullHeight, w * 1, h * 0, w, h ) );
+				apps.push( new App( 'container3', fullWidth, fullHeight, w * 0, h * 1, w, h ) );
+				apps.push( new App( 'container4', fullWidth, fullHeight, w * 1, h * 1, w, h ) );
+
+			}
+
+			function animate() {
+
+				for ( var i = 0; i < apps.length; ++i ) {
+
+					apps[ i ].animate();
+
+				}
+
+				requestAnimationFrame( animate );
+
+			}
+
+			function App( containerId, fullWidth, fullHeight, viewX, viewY, viewWidth, viewHeight ) {
+
+				var container, stats;
+
+				var camera, scene, renderer;
+
+				var mesh, mesh2, mesh3, light;
+
+				var mouseX = 0, mouseY = 0;
+
+				var windowHalfX = window.innerWidth / 2;
+				var windowHalfY = window.innerHeight / 2;
+
+				init();
+
+				function init() {
+
+					container = document.getElementById( containerId );
+
+					camera = new THREE.Camera( 20, container.clientWidth / container.clientHeight, 1, 10000 );
+					camera.setViewOffset( fullWidth, fullHeight, viewX, viewY, viewWidth, viewHeight );
+					camera.position.z = 1800;
+
+					scene = new THREE.Scene();
+
+					light = new THREE.DirectionalLight( 0xffffff );
+					light.position.set( 0, 0, 1 );
+					light.position.normalize();
+					scene.addLight( light );
+
+					var shadowMaterial = new THREE.MeshBasicMaterial( { map: THREE.ImageUtils.loadTexture( 'textures/shadow.png' ) } );
+					var shadowGeo = new THREE.Plane( 300, 300, 1, 1 );
+
+					mesh = new THREE.Mesh( shadowGeo, shadowMaterial );
+					mesh.position.y = - 250;
+					mesh.rotation.x = - 90 * Math.PI / 180;
+					scene.addObject( mesh );
+
+					mesh = new THREE.Mesh( shadowGeo, shadowMaterial );
+					mesh.position.y = - 250;
+					mesh.position.x = - 400;
+					mesh.rotation.x = - 90 * Math.PI / 180;
+					scene.addObject( mesh );
+
+					mesh = new THREE.Mesh( shadowGeo, shadowMaterial );
+					mesh.position.y = - 250;
+					mesh.position.x = 400;
+					mesh.rotation.x = - 90 * Math.PI / 180;
+					scene.addObject( mesh );
+
+					var faceIndices = [ 'a', 'b', 'c', 'd' ];
+
+					var color, f, f2, f3, p, n, vertexIndex,
+
+						geometry  = new THREE.Icosahedron( 1 ),
+						geometry2 = new THREE.Icosahedron( 1 ),
+						geometry3 = new THREE.Icosahedron( 1 );
+
+					for ( var i = 0; i < geometry.faces.length; i++ ) {
+
+						f  = geometry.faces[ i ];
+						f2 = geometry2.faces[ i ];
+						f3 = geometry3.faces[ i ];
+
+						n = ( f instanceof THREE.Face3 ) ? 3 : 4;
+
+						for( var j = 0; j < n; j++ ) {
+
+							vertexIndex = f[ faceIndices[ j ] ];
+
+							p = geometry.vertices[ vertexIndex ].position;
+
+							color = new THREE.Color( 0xffffff );
+							color.setHSV( ( p.y + 1 ) / 2, 1.0, 1.0 );
+
+							f.vertexColors[ j ] = color;
+
+							color = new THREE.Color( 0xffffff );
+							color.setHSV( 0.0, ( p.y + 1 ) / 2, 1.0 );
+
+							f2.vertexColors[ j ] = color;
+
+							color = new THREE.Color( 0xffffff );
+							color.setHSV( 0.125 * vertexIndex/geometry.vertices.length, 1.0, 1.0 );
+
+							f3.vertexColors[ j ] = color;
+
+						}
+
+					}
+
+
+					var materials = [
+
+						new THREE.MeshLambertMaterial( { color: 0xffffff, shading: THREE.FlatShading, vertexColors: THREE.VertexColors } ),
+						new THREE.MeshBasicMaterial( { color: 0x000000, shading: THREE.FlatShading, wireframe: true } )
+
+					];
+
+					mesh = new THREE.Mesh( geometry, materials  );
+					mesh.position.x = -400;
+					mesh.scale.x = mesh.scale.y = mesh.scale.z = 200;
+					mesh.rotation.x = -1.87;
+					scene.addObject( mesh );
+
+					mesh2 = new THREE.Mesh( geometry2, materials  );
+					mesh2.position.x = 400;
+					mesh2.rotation.x = 0;
+					mesh2.scale = mesh.scale;
+					scene.addObject( mesh2 );
+
+					mesh3 = new THREE.Mesh( geometry3, materials  );
+					mesh3.position.x = 0;
+					mesh3.rotation.x = 0;
+					mesh3.scale = mesh.scale;
+					scene.addObject( mesh3 );
+
+					renderer = new THREE.WebGLRenderer( { antialias: true } );
+					renderer.setSize( container.clientWidth, container.clientHeight );
+
+					container.appendChild( renderer.domElement );
+
+					stats = new Stats();
+					stats.domElement.style.position = 'absolute';
+					stats.domElement.style.top = '0px';
+					container.appendChild( stats.domElement );
+
+					document.addEventListener( 'mousemove', onDocumentMouseMove, false );
+
+				}
+
+				function onDocumentMouseMove( event ) {
+
+					mouseX = ( event.clientX - windowHalfX );
+					mouseY = ( event.clientY - windowHalfY );
+
+				}
+
+				//
+
+				this.animate = function() {
+
+					render();
+					stats.update();
+
+				};
+
+				function render() {
+
+					camera.position.x += ( mouseX - camera.position.x ) * 0.05;
+					camera.position.y += ( - mouseY - camera.position.y ) * 0.05;
+
+					renderer.render( scene, camera );
+
+				}
+			}
+
+		</script>
+
+	</body>
+</html>

+ 640 - 0
examples/webgl_particles_dynamic.html

@@ -0,0 +1,640 @@
+<!DOCTYPE HTML>
+<html lang="en">
+    <head>
+        <title>three.js webgl - particles - dynamic - postprocessing</title>
+        <meta charset="utf-8">
+        <style type="text/css">
+            body {
+                color: #fff;
+                font-family:Monospace;
+                font-size:13px;
+                text-align:center;
+                font-weight: bold;
+
+                background-color: #000;
+                margin: 0px;
+                overflow: hidden;
+            }
+
+            #info {
+				color:#fff;
+                position: absolute;
+                top: 0px; width: 100%;
+                padding: 5px;
+				
+            }
+
+            a { color: red; }
+
+        </style>
+    </head>
+    <body>
+
+        <div id="container"></div>
+        <div id="info">
+			<a href="http://github.com/mrdoob/three.js" target="_blank">three.js</a> - webgl dynamic particles + postprocessing
+			- models by <a href="http://sketchup.google.com/3dwarehouse/details?mid=2c6fd128fca34052adc5f5b98d513da1" target="_blank">Reallusion</a>
+			<a href="http://sketchup.google.com/3dwarehouse/details?mid=f526cc4abf7cb68d76cab47c765b7255" target="_blank">iClone</a>,
+			<a href="http://artist-3d.com/free_3d_models/dnm/model_disp.php?uid=1129" target="_blank">Troyano</a>
+
+		</div>
+
+        <script type="text/javascript" src="../build/Three.js"></script>
+		
+        <script type="text/javascript" src="js/Stats.js"></script>
+        <script type="text/javascript" src="js/Detector.js"></script>
+		<script type="text/javascript" src="js/RequestAnimationFrame.js"></script>
+
+        <script type="text/javascript">
+			
+			if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
+
+			var SCREEN_HEIGHT = window.innerHeight;
+			var SCREEN_WIDTH = window.innerWidth;
+
+            var container, stats;
+
+            var camera, scene, renderer, mesh, directionalLight;
+			
+			var parent,
+				meshes = [], clonemeshes = [];			
+			
+			var p;
+			
+			var aloader, bloader;
+			
+			var total = 0, totaln = 0;
+
+			var postprocessing1 = {};
+			var postprocessing2 = {};
+
+            init();
+            animate();
+			
+            function init() {
+
+                container = document.getElementById( 'container' );
+
+				camera = new THREE.Camera( 20, SCREEN_WIDTH / SCREEN_HEIGHT, 1, 50000 );
+				camera.position.z = 7000;
+				camera.position.y = 700;
+
+                scene = new THREE.Scene();
+
+				scene.fog = new THREE.FogExp2( 0x000104, 0.0000675 );
+				
+				directionalLight = new THREE.DirectionalLight( 0xffffff );
+				directionalLight.position.set( 0, 0, 1 );
+				directionalLight.position.normalize();
+				scene.addLight( directionalLight );
+
+				initPostprocessingBloom( postprocessing1 );
+				initPostprocessingFocus( postprocessing2 );
+
+				aloader = new THREE.JSONLoader( );
+				bloader = new THREE.BinaryLoader( true );
+
+				document.body.appendChild( bloader.statusDomElement );
+				
+				aloader.load( { model: "obj/terrain.js", callback: function( geometry ) { 
+						
+					createMesh( geometry, scene, 16.8, -11000, -200,  -5000, 0x00ff44, false );
+					createMesh( geometry, scene, 16.8,  11000, -200, -15000, 0x00ff33, false );
+					createMesh( geometry, scene, 16.8,      0, -200, -15000, 0x00ff33, false );
+					createMesh( geometry, scene, 16.8,      0, -200,  15000, 0x00ff33, false );
+					createMesh( geometry, scene, 16.8,  11000, -200,  15000, 0x00ff22, false );
+					createMesh( geometry, scene, 16.8, -11000, -200,   5000, 0x00ff11, false );
+					createMesh( geometry, scene, 16.8,  13000, -200,   5000, 0x00ff55, false );
+					createMesh( geometry, scene, 16.8,  13000, -200,  -5000, 0x00ff66, false );
+						
+				} } );
+				
+				bloader.load( { model: "obj/veyron/VeyronNoUv_bin.js", callback: function( geometry ) { createMesh( geometry, scene, 6.8, 2200, -200, -100, 0x0055ff, false ) } } );
+				
+				bloader.load( { model: "obj/female02/Female02_bin.js", callback: function( geometry ) { 
+				
+					createMesh( geometry, scene, 4.05, -1000, -350,    0, 0xffdd44, true );
+					createMesh( geometry, scene, 4.05,     0, -350,    0, 0xffffff, true );
+					createMesh( geometry, scene, 4.05,  1000, -350,  400, 0xff4422, true );
+					createMesh( geometry, scene, 4.05,   250, -350, 1500, 0xff9955, true );
+					createMesh( geometry, scene, 4.05,   250, -350, 2500, 0xff77dd, true );
+					
+				} } );
+				
+				bloader.load( { model: "obj/male02/Male02_bin.js", callback: function( geometry ) { 
+				
+					createMesh( geometry, scene, 4.05,  -500, -350,   600, 0xff7744, true );
+					createMesh( geometry, scene, 4.05,   500, -350,     0, 0xff5522, true );
+					createMesh( geometry, scene, 4.05,  -250, -350,  1500, 0xff9922, true );
+					createMesh( geometry, scene, 4.05,  -250, -350, -1500, 0xff99ff, true );
+					
+				} } );
+				
+                renderer = new THREE.WebGLRenderer( { clearColor: 0x000000, clearAlpha: 1, antialias: false } );
+				renderer.setSize( SCREEN_WIDTH, SCREEN_HEIGHT );
+				renderer.autoClear = false;
+				renderer.sortObjects = false;
+                container.appendChild( renderer.domElement );
+				
+				renderer.setClearColor( scene.fog.color, 1 );
+				
+                stats = new Stats();
+                stats.domElement.style.position = 'absolute';
+                stats.domElement.style.top = '0px';
+                //container.appendChild( stats.domElement );
+				
+				parent = new THREE.Object3D();
+				scene.addObject( parent );
+
+				var grid = new THREE.ParticleSystem( new THREE.Plane( 15000, 15000, 64, 64 ), new THREE.ParticleBasicMaterial( { color: 0xff0000, size: 10 } ) );
+				grid.rotation.x = 1.57;
+				grid.position.y = -400;
+				parent.addChild( grid );
+				
+				totaln += 1;
+				total += grid.geometry.vertices.length;
+
+            }
+
+			function createMesh( originalGeometry, scene, scale, x, y, z, color, dynamic ) {
+
+				var i, c;
+
+				var vertices = originalGeometry.vertices;
+				var vl = vertices.length;
+
+				var geometry = new THREE.Geometry();
+				var vertices_tmp = [];
+				
+				for( i = 0; i < vl; i++ ) {
+				
+					p = vertices[ i ].position;
+					
+					geometry.vertices[ i ] = new THREE.Vertex( p.clone() );
+					vertices_tmp[ i ] = [ p.x, p.y, p.z, 0, 0 ];
+
+				}
+
+				var clones = [
+								[  6000, 0, -4000 ], 
+								[  5000, 0, 0 ], 
+								[  1000, 0, 5000 ],
+								[  1000, 0, -5000 ],
+								[  4000, 0, 2000 ], 
+								[ -4000, 0, 1000 ], 
+								[ -5000, 0, -5000 ], 
+
+								[ 0, 0, 0 ]
+
+							  ];
+				
+				if ( dynamic ) {
+					
+					for( i = 0; i < clones.length; i++ ) {
+					
+						c = ( i < clones.length -1 ) ? 0x252525 : color;
+
+						mesh = new THREE.ParticleSystem( geometry, new THREE.ParticleBasicMaterial( { size: 3, color: c } ) );
+						mesh.scale.x = mesh.scale.y = mesh.scale.z = scale;
+						
+						mesh.position.x = x + clones[ i ][ 0 ];
+						mesh.position.y = y + clones[ i ][ 1 ];
+						mesh.position.z = z + clones[ i ][ 2 ];
+						
+						parent.addChild( mesh );
+						
+						clonemeshes.push( { mesh: mesh, speed: 0.5 + Math.random() } );
+						
+					}
+					
+					totaln += clones.length;
+					total += clones.length * vl;
+				
+				} else {
+				
+					mesh = new THREE.ParticleSystem( geometry, new THREE.ParticleBasicMaterial( { size: 3, color: color } ) );
+					mesh.scale.x = mesh.scale.y = mesh.scale.z = scale;
+					
+					mesh.position.x = x;
+					mesh.position.y = y;
+					mesh.position.z = z;
+					
+					parent.addChild( mesh );
+					
+					totaln += 1;
+					total += vl;
+
+				}
+
+				bloader.statusDomElement.style.display = "none";
+				
+				meshes.push( { mesh: mesh, vertices: geometry.vertices, vertices_tmp: vertices_tmp, vl: vl,
+							  down: 0, up: 0, direction: 0, speed: 35, delay: Math.floor( 200 + 200 * Math.random() ),
+							  started: false, start: Math.floor( 100 + 200 * Math.random() ),
+							  dynamic: dynamic,
+							  bb: geometry.boundingBox } );
+
+				console.log( total, totaln );
+
+			}
+
+			function initPostprocessingFocus( effect ) {
+				
+				effect.type = "focus";
+				
+				effect.scene = new THREE.Scene();
+				
+				effect.camera = new THREE.Camera();
+				effect.camera.projectionMatrix = THREE.Matrix4.makeOrtho( SCREEN_WIDTH / - 2, SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2, SCREEN_HEIGHT / - 2, -10000, 10000 );
+				effect.camera.position.z = 100;
+				
+				effect.texture = new THREE.WebGLRenderTarget( SCREEN_WIDTH, SCREEN_HEIGHT, { minFilter: THREE.LinearFilter, magFilter: THREE.NearestFilter, format: THREE.RGBFormat } );
+				
+				var heatUniforms = {
+
+					"map": { type: "t", value:0, texture: effect.texture },
+					"screenWidth": { type: "f", value: SCREEN_WIDTH },
+					"screenHeight": { type: "f", value: SCREEN_HEIGHT },
+					"sampleDistance": { type: "f", value: 0.94 },
+					"waveFactor": { type: "f", value: 0.00125 }
+
+				};
+
+				effect.materialHeat = new THREE.MeshShaderMaterial( {
+
+					uniforms: heatUniforms,
+					vertexShader: [
+
+						"varying vec2 vUv;",
+
+						"void main() {",
+
+							"vUv = vec2( uv.x, 1.0 - uv.y );",
+							"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+
+						"}"
+
+					].join("\n"),
+					
+					fragmentShader: [
+
+							"uniform float screenWidth;",
+							"uniform float screenHeight;",
+							"uniform float sampleDistance;",
+							"uniform float waveFactor;",
+							
+							"uniform sampler2D map;",
+							"varying vec2 vUv;",
+				
+							"void main() {",
+
+								"vec4 color, org, tmp, add;",
+								"float sample_dist, f;",
+								"vec2 vin;",				
+								"vec2 uv = vUv;",
+								
+								"add += color = org = texture2D( map, uv );",
+
+								"vin = ( uv - vec2( 0.5 ) ) * vec2( 1.4 );",
+								"sample_dist = dot( vin, vin ) * 2.0;",
+								
+								"f = ( waveFactor * 100.0 + sample_dist ) * sampleDistance * 4.0;",
+				
+								"vec2 sampleSize = vec2(  1.0 / screenWidth, 1.0 / screenHeight ) * vec2(f);",
+				
+								"add += tmp = texture2D( map, uv + vec2(0.111964, 0.993712) * sampleSize );", 
+								"if( tmp.b < color.b ) color = tmp;",
+				
+								"add += tmp = texture2D( map, uv + vec2(0.846724, 0.532032) * sampleSize );",
+								"if( tmp.b < color.b ) color = tmp;",
+				
+								"add += tmp = texture2D( map, uv + vec2(0.943883, -0.330279) * sampleSize );",
+								"if( tmp.b < color.b ) color = tmp;",
+				
+								"add += tmp = texture2D( map, uv + vec2(0.330279, -0.943883) * sampleSize );",
+								"if( tmp.b < color.b ) color = tmp;",
+				
+								"add += tmp = texture2D( map, uv + vec2(-0.532032, -0.846724) * sampleSize );",
+								"if( tmp.b < color.b ) color = tmp;",
+				
+								"add += tmp = texture2D( map, uv + vec2(-0.993712, -0.111964) * sampleSize );",
+								"if( tmp.b < color.b ) color = tmp;",
+				
+								"add += tmp = texture2D( map, uv + vec2(-0.707107, 0.707107) * sampleSize );",
+								"if( tmp.b < color.b ) color = tmp;",
+
+								"color = color * vec4( 2.0 ) - ( add / vec4( 8.0 ) );",
+								"color = color + ( add / vec4(8.0) - color ) * ( vec4(1.0) - vec4(sample_dist * 0.5) );",
+
+								"gl_FragColor = vec4( color.rgb * color.rgb * vec3( 0.95 ) + color.rgb, 1.0 );",								
+								
+							"}"
+
+
+						].join("\n")
+
+				} );
+				
+				effect.quad = new THREE.Mesh( new THREE.Plane( SCREEN_WIDTH, SCREEN_HEIGHT ), effect.materialHeat );
+				effect.quad.position.z = -500;
+				effect.scene.addObject( effect.quad );
+
+			}
+
+			function initPostprocessingBloom( effect ) {
+
+				effect.type = "bloomnoise";
+				
+				effect.scene = new THREE.Scene();
+
+				effect.camera = new THREE.Camera();
+				effect.camera.projectionMatrix = THREE.Matrix4.makeOrtho( SCREEN_WIDTH / - 2, SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2, SCREEN_HEIGHT / - 2, -10000, 10000 );
+				effect.camera.position.z = 100;
+
+				var pars = { minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter, format: THREE.RGBFormat };
+				
+				effect.rtTexture1 = new THREE.WebGLRenderTarget( SCREEN_WIDTH, SCREEN_HEIGHT, pars );
+				effect.rtTexture2 = new THREE.WebGLRenderTarget( 256, 512, pars );
+				effect.rtTexture3 = new THREE.WebGLRenderTarget( 512, 256, pars );
+				
+				var screen_shader = THREE.ShaderUtils.lib["screen"];
+				var screen_uniforms = THREE.UniformsUtils.clone( screen_shader.uniforms );
+
+				screen_uniforms["tDiffuse"].texture = effect.rtTexture3;
+				screen_uniforms["opacity"].value = 0.75;
+
+				effect.materialScreen = new THREE.MeshShaderMaterial( {
+
+					uniforms: screen_uniforms,
+					vertexShader: screen_shader.vertexShader,
+					fragmentShader: screen_shader.fragmentShader,
+					blending: THREE.AdditiveBlending,
+					transparent: true
+
+				} );
+
+				var convolution_shader = THREE.ShaderUtils.lib["convolution"];
+				var convolution_uniforms = THREE.UniformsUtils.clone( convolution_shader.uniforms );
+
+				effect.blurx = new THREE.Vector2( 0.001953125, 0.0 ),
+				effect.blury = new THREE.Vector2( 0.0, 0.001953125 );
+
+				convolution_uniforms["tDiffuse"].texture = effect.rtTexture1;
+				convolution_uniforms["uImageIncrement"].value = effect.blurx;
+				convolution_uniforms["cKernel"].value = THREE.ShaderUtils.buildKernel( 4.0 );
+
+				effect.materialConvolution = new THREE.MeshShaderMaterial( {
+
+					uniforms: convolution_uniforms,
+					vertexShader:   "#define KERNEL_SIZE 25.0\n" + convolution_shader.vertexShader,
+					fragmentShader: "#define KERNEL_SIZE 25\n"   + convolution_shader.fragmentShader
+
+				} );
+
+				var film_shader = THREE.ShaderUtils.lib["film"];
+				var film_uniforms = THREE.UniformsUtils.clone( film_shader.uniforms );
+				
+				film_uniforms["tDiffuse"].texture = effect.rtTexture1;
+				
+				effect.materialFilm = new THREE.MeshShaderMaterial( { uniforms: film_uniforms, vertexShader: film_shader.vertexShader, fragmentShader: film_shader.fragmentShader } );
+				effect.materialFilm.uniforms.grayscale.value = 0;
+				effect.materialFilm.uniforms.nIntensity.value = 0.5;
+				effect.materialFilm.uniforms.sIntensity.value = 0.5;
+				effect.materialFilm.uniforms.sCount.value = 1448;
+
+				effect.quad = new THREE.Mesh( new THREE.Plane( SCREEN_WIDTH, SCREEN_HEIGHT ), effect.materialConvolution );
+				effect.quad.position.z = -500;
+				effect.scene.addObject( effect.quad );
+
+			}
+
+			var j, jl, cm, data, vertices, vertices_tmp, vl, d, vt,
+				time, oldTime, delta;
+			
+			function animate() {
+
+				requestAnimationFrame( animate );
+
+				render();
+				//stats.update();
+
+			}
+			
+            function render() {
+
+				if ( ! oldTime ) {
+
+					oldTime = new Date().getTime();
+					
+				}
+					
+				time = new Date().getTime();				
+
+				delta = 0.01 * ( time - oldTime );
+				oldTime = time;
+				
+				delta = delta < 2 ? delta : 2;
+				
+				parent.rotation.y += -0.02 * delta;
+				
+				for( j = 0, jl = clonemeshes.length; j < jl; j++ ) {
+				
+					cm = clonemeshes[ j ];
+					cm.mesh.rotation.y += -0.1 * delta * cm.speed;
+					
+				}
+				
+				for( j = 0, jl = meshes.length; j < jl; j++ ) {				
+
+					data = meshes[ j ];
+					mesh = data.mesh;
+					vertices = data.vertices;
+					vertices_tmp = data.vertices_tmp;
+					vl = data.vl;
+
+					if ( ! data.dynamic ) continue;
+					
+					if ( data.start > 0 ) {
+					
+						data.start -= 1;
+
+					} else {
+					
+						if ( !data.started ) {
+
+							data.direction = -1;
+							data.started = true;
+							
+						}
+
+					}
+
+					for ( i = 0; i < vl; i ++ ) {
+
+						p = vertices[ i ].position;
+						vt = vertices_tmp[ i ];
+
+						// falling down
+						
+						if ( data.direction < 0 ) {
+
+							// var d = Math.abs( p.x - vertices_tmp[ i ][ 0 ] ) + Math.abs( p.y - vertices_tmp[ i ][ 1 ] ) + Math.abs( p.z - vertices_tmp[ i ][ 2 ] );
+							// if ( d < 200 ) {
+
+							if ( p.y > 0 ) {
+
+								// p.y += data.direction * data.speed * delta;
+
+								p.x += 1.5 * ( 0.50 - Math.random() ) * data.speed * delta;
+								p.y += 3.0 * ( 0.25 - Math.random() ) * data.speed * delta;
+								p.z += 1.5 * ( 0.50 - Math.random() ) * data.speed * delta;
+
+							} else {
+							
+								if ( ! vt[ 3 ] ) {
+								
+									vt[ 3 ] = 1;
+									data.down += 1;
+									
+								}
+								
+							}
+							
+						}
+						
+						// rising up 
+						
+						if ( data.direction > 0 ) {
+							
+							//if ( p.y < vertices_tmp[ i ][ 1 ] ) {
+							
+							//	p.y += data.direction * data.speed * delta;
+							
+							d = Math.abs( p.x - vt[ 0 ] ) + Math.abs( p.y - vt[ 1 ] ) + Math.abs( p.z - vt[ 2 ] );
+							
+							if ( d > 1 ) {
+							
+								p.x += - ( p.x - vt[ 0 ] ) / d * data.speed * delta * ( 0.85 - Math.random() );
+								p.y += - ( p.y - vt[ 1 ] ) / d * data.speed * delta * ( 1 + Math.random() );
+								p.z += - ( p.z - vt[ 2 ] ) / d * data.speed * delta * ( 0.85 - Math.random() );
+							
+							} else {
+						
+								if ( ! vt[ 4 ] ) {
+								
+									vt[ 4 ] = 1;
+									data.up += 1;
+									
+								}
+								
+							}
+							
+						}						
+						
+
+					}
+					
+					// all down
+					
+					if ( data.down == vl ) {
+						
+						if ( data.delay == 0 ) {
+						
+							data.direction = 1;
+							data.speed = 10;
+							data.down = 0;
+							data.delay = 320;
+							
+							for ( i = 0; i < vl; i ++ ) {
+							
+								vertices_tmp[ i ][ 3 ] = 0;
+								
+							}
+							
+						} else {
+						
+							data.delay -= 1;
+							
+						}
+						
+						
+					}
+					
+					// all up
+					
+					if ( data.up == vl ) {
+						
+						if ( data.delay == 0 ) {
+							
+							data.direction = -1;
+							data.speed = 35;
+							data.up = 0;
+							data.delay = 120;
+
+							for ( i = 0; i < vl; i ++ ) {
+							
+								vertices_tmp[ i ][ 4 ] = 0;
+								
+							}
+
+						} else {
+						
+							data.delay -= 1;
+							
+						}
+
+
+					}
+					
+					mesh.geometry.__dirtyVertices = true;
+
+				}
+
+				renderer.clear();
+
+				// BLOOM
+
+				// Render scene into texture
+
+				renderer.render( scene, camera, postprocessing1.rtTexture1, true );
+
+				// Render quad with blured scene into texture (convolution pass 1)
+
+				postprocessing1.quad.materials[ 0 ] = postprocessing1.materialConvolution;
+
+				postprocessing1.materialConvolution.uniforms.tDiffuse.texture = postprocessing1.rtTexture1;
+				postprocessing1.materialConvolution.uniforms.uImageIncrement.value = postprocessing1.blurx;
+
+				renderer.render( postprocessing1.scene, postprocessing1.camera, postprocessing1.rtTexture2, true );
+
+				// Render quad with blured scene into texture (convolution pass 2)
+
+				postprocessing1.materialConvolution.uniforms.tDiffuse.texture = postprocessing1.rtTexture2;
+				postprocessing1.materialConvolution.uniforms.uImageIncrement.value = postprocessing1.blury;
+
+				renderer.render( postprocessing1.scene, postprocessing1.camera, postprocessing1.rtTexture3, true );
+
+				// Render original scene with superimposed blur to texture
+
+				postprocessing1.quad.materials[ 0 ] = postprocessing1.materialScreen;
+
+				renderer.render( postprocessing1.scene, postprocessing1.camera, postprocessing1.rtTexture1, false );
+
+
+				// NOISE + SCANLINES
+				
+				postprocessing1.materialFilm.uniforms.time.value += 0.01;
+				postprocessing1.quad.materials[ 0 ] = postprocessing1.materialFilm;
+
+				renderer.render( postprocessing1.scene, postprocessing1.camera, postprocessing2.texture, true );
+
+				// FOCUS				
+
+				renderer.render( postprocessing2.scene, postprocessing2.camera );
+
+            }
+
+        </script>
+
+    </body>
+</html>

+ 73 - 1
src/cameras/Camera.js

@@ -1,6 +1,7 @@
 /**
  * @author mr.doob / http://mrdoob.com/
  * @author mikael emtinger / http://gomo.se/
+ * @author greggman / http://games.greggman.com/
  */
 
 THREE.Camera = function ( fov, aspect, near, far, target ) {
@@ -41,7 +42,78 @@ THREE.Camera.prototype.translate = function ( distance, axis ) {
 
 THREE.Camera.prototype.updateProjectionMatrix = function () {
 
-	this.projectionMatrix = THREE.Matrix4.makePerspective( this.fov, this.aspect, this.near, this.far );
+	if ( this.fullWidth ) {
+
+		var aspect = this.fullWidth / this.fullHeight;
+		var top = Math.tan( this.fov * Math.PI / 360 ) * this.near;
+		var bottom = -top;
+		var left = aspect * bottom;
+		var right = aspect * top;
+		var width = Math.abs( right - left );
+		var height = Math.abs( top - bottom );
+
+		this.projectionMatrix = THREE.Matrix4.makeFrustum(
+			left + this.x * width / this.fullWidth,
+			left + ( this.x + this.width ) * width / this.fullWidth,
+			top - ( this.y + this.height ) * height / this.fullHeight,
+			top - this.y * height / this.fullHeight,
+			this.near,
+			this.far );
+
+	} else {
+
+		this.projectionMatrix = THREE.Matrix4.makePerspective( this.fov, this.aspect, this.near, this.far );
+
+	}
+
+};
+
+/**
+ * Sets an offset in a larger frustum. This is useful for multi-window or
+ * multi-monitor/multi-machine setups.
+ *
+ * For example, if you have 3x2 monitors and each monitor is 1920x1080 and
+ * the monitors are in grid like this
+ *
+ *   +---+---+---+
+ *   | A | B | C |
+ *   +---+---+---+
+ *   | D | E | F |
+ *   +---+---+---+
+ *
+ * then for monitor each monitor you would call it like this
+ *
+ *   var w = 1920;
+ *   var h = 1080;
+ *   var fullWidth = w * 3;
+ *   var fullHeight = h * 2;
+ *
+ *   --A--
+ *   camera.setOffset( fullWidth, fullHeight, w * 0, h * 0, w, h );
+ *   --B--
+ *   camera.setOffset( fullWidth, fullHeight, w * 1, h * 0, w, h );
+ *   --C--
+ *   camera.setOffset( fullWidth, fullHeight, w * 2, h * 0, w, h );
+ *   --D--
+ *   camera.setOffset( fullWidth, fullHeight, w * 0, h * 1, w, h );
+ *   --E--
+ *   camera.setOffset( fullWidth, fullHeight, w * 1, h * 1, w, h );
+ *   --F--
+ *   camera.setOffset( fullWidth, fullHeight, w * 2, h * 1, w, h );
+ *
+ *   Note there is no reason monitors have to be the same size or in a grid.
+ */
+
+THREE.Camera.prototype.setViewOffset = function( fullWidth, fullHeight, x, y, width, height ) {
+
+	this.fullWidth = fullWidth;
+	this.fullHeight = fullHeight;
+	this.x = x;
+	this.y = y;
+	this.width = width;
+	this.height = height;
+
+	this.updateProjectionMatrix();
 
 };
 

+ 3 - 0
src/core/Object3D.js

@@ -16,6 +16,9 @@ THREE.Object3D = function() {
 	this.scale = new THREE.Vector3( 1, 1, 1 );
 
 	this.dynamic = false; // when true it retains arrays so they can be updated with __dirty*
+	
+	this.doubleSided = false;
+	this.flipSided = false;
 
 	this.rotationAutoUpdate = true;
 

+ 9 - 5
src/core/Vector2.js

@@ -157,17 +157,21 @@ THREE.Vector2.prototype = {
 	},
 
 	// deprecated: same as normalize
+
 	unit : function () {
 
 		return this.normalize();
 
-		// this.multiplyScalar( 1 / this.length() );
-		// return this;
-
 	},
 	
-	equals : function(v) {
-		return ( (v.x == this.x) && (v.y == this.y) );
+	// danger, works only on numbers which are exactly the same
+	// (which may be not what is expected thanks to floating point precision)
+	// (should be probably using some tiny epsilon instead of equality)
+	
+	equals : function( v ) {
+
+		return ( ( v.x == this.x ) && ( v.y == this.y ) );
+
 	}
 
 };

+ 1 - 3
src/extras/geometries/Text.js

@@ -344,10 +344,8 @@ THREE.FontUtils = {
 	                }
                 
 	            }
-				
+				// you would not wish to reach this point of code, because thing else is then wrong.
 				if (!found) {
-					// you would not wish to reach this point of code, because thing else is then wrong.
-					console.log("warning...");
 					points.push(verts[l]);
 					face.push(points.length-1);
 				}

+ 69 - 0
src/extras/renderers/CrosseyedWebGLRenderer.js

@@ -0,0 +1,69 @@
+/**
+ * @author alteredq / http://alteredqualia.com/
+ */
+
+THREE.CrosseyedWebGLRenderer = function ( parameters ) {
+
+	THREE.WebGLRenderer.call( this, parameters );
+
+	this.autoClear = false;
+
+	var _this = this, _setSize = this.setSize, _render = this.render;
+
+	var _width, _height;
+	
+	var _cameraL = new THREE.Camera(), 
+		_cameraR = new THREE.Camera();
+
+	_this.separation = 10;
+	if ( parameters && parameters.separation !== undefined ) _this.separation = parameters.separation;
+
+	var SCREEN_WIDTH  = window.innerWidth;
+	var SCREEN_HEIGHT = window.innerHeight;
+	var HALF_WIDTH = SCREEN_WIDTH / 2;
+	
+	var _camera = new THREE.Camera( 53, HALF_WIDTH / SCREEN_HEIGHT, 1, 10000 );
+	_camera.position.z = -10;
+	
+
+	this.setSize = function ( width, height ) {
+
+		_setSize.call( _this, width, height );
+
+		_width = width/2;
+		_height = height;
+
+	};
+
+	this.render = function ( scene, camera, renderTarget, forceClear ) {
+		
+		this.clear();
+
+		_cameraL.fov = camera.fov;
+		_cameraL.aspect = 0.5 * camera.aspect;
+		_cameraL.near = camera.near;
+		_cameraL.far = camera.far;
+		_cameraL.updateProjectionMatrix();
+		
+		_cameraL.position.copy( camera.position );
+		_cameraL.target.position.copy( camera.target.position );
+		_cameraL.translateX( _this.separation );
+
+		_cameraR.projectionMatrix = _cameraL.projectionMatrix;
+
+		_cameraR.position.copy( camera.position );
+		_cameraR.target.position.copy( camera.target.position );
+		_cameraR.translateX( - _this.separation );
+
+		this.setViewport( 0, 0, _width, _height );
+		_render.call( _this, scene, _cameraL );
+		
+		this.setViewport( _width, 0, _width, _height );
+		_render.call( _this, scene, _cameraR, false );
+
+	};
+
+};
+
+THREE.CrosseyedWebGLRenderer.prototype = new THREE.WebGLRenderer();
+THREE.CrosseyedWebGLRenderer.prototype.constructor = THREE.CrosseyedWebGLRenderer;

+ 0 - 3
src/objects/Mesh.js

@@ -11,9 +11,6 @@ THREE.Mesh = function ( geometry, materials ) {
 	this.geometry = geometry;
 	this.materials = materials && materials.length ? materials : [ materials ];
 
-	this.flipSided = false;
-	this.doubleSided = false;
-
 	this.overdraw = false; // TODO: Move to material?
 
 

+ 0 - 3
src/objects/Ribbon.js

@@ -9,9 +9,6 @@ THREE.Ribbon = function ( geometry, materials ) {
 	this.geometry = geometry;
 	this.materials = materials instanceof Array ? materials : [ materials ];
 
-	this.flipSided = false;
-	this.doubleSided = false;
-
 };
 
 THREE.Ribbon.prototype = new THREE.Object3D();

+ 5 - 5
src/renderers/WebGLRenderer.js

@@ -826,7 +826,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 		obj_skinVerticesB = geometry.skinVerticesB,
 		obj_skinIndices = geometry.skinIndices,
 		obj_skinWeights = geometry.skinWeights,
-		obj_edgeFaces = object instanceof THREE.ShadowVolume ? geometry.edgeFaces : undefined;
+		obj_edgeFaces = object instanceof THREE.ShadowVolume ? geometry.edgeFaces : undefined,
 
 		morphTargets = geometry.morphTargets;
 
@@ -4343,9 +4343,9 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 		//
 
-		program = _gl.createProgram(),
+		program = _gl.createProgram();
 
-		prefix_fragment = [
+		var prefix_fragment = [
 
 			"#ifdef GL_ES",
 			"precision highp float;",
@@ -4366,9 +4366,9 @@ THREE.WebGLRenderer = function ( parameters ) {
 			"uniform vec3 cameraPosition;",
 			""
 
-		].join("\n"),
+		].join("\n");
 
-		prefix_vertex = [
+		var prefix_vertex = [
 			
 			_supportsVertexTextures ? "#define VERTEX_TEXTURES" : "",
 

+ 2 - 1
utils/build.py

@@ -111,7 +111,8 @@ EXTRAS_FILES = [
 'extras/objects/Trident.js',
 'extras/physics/Collisions.js',
 'extras/physics/CollisionUtils.js',
-'extras/renderers/AnaglyphWebGLRenderer.js'
+'extras/renderers/AnaglyphWebGLRenderer.js',
+'extras/renderers/CrosseyedWebGLRenderer.js'
 ]
 
 CANVAS_FILES = [

+ 1 - 1
utils/build_all.bat

@@ -1 +1 @@
-python build.py --all
+python build.py --all --includes