Browse Source

Merge branch 'master' of git://github.com/mrdoob/three.js

Mikael Emtinger 14 years ago
parent
commit
1f2d4641c9

File diff suppressed because it is too large
+ 89 - 88
build/Three.js


+ 75 - 76
build/custom/ThreeCanvas.js

@@ -1,8 +1,7 @@
 // ThreeCanvas.js r40 - http://github.com/mrdoob/three.js
 // ThreeCanvas.js r40 - http://github.com/mrdoob/three.js
 var THREE=THREE||{};if(!window.Int32Array){window.Int32Array=Array;window.Float32Array=Array}THREE.Color=function(a){this.setHex(a)};
 var THREE=THREE||{};if(!window.Int32Array){window.Int32Array=Array;window.Float32Array=Array}THREE.Color=function(a){this.setHex(a)};
-THREE.Color.prototype={autoUpdate:!0,copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;this.hex=a.hex;this.__styleString=a.__styleString},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,b,c){var d,e,h,f,k,g;if(c==0)d=e=h=0;else{f=Math.floor(a*6);k=a*6-f;a=c*(1-b);g=c*(1-b*k);b=c*(1-b*(1-k));switch(f){case 1:d=g;e=c;h=a;break;case 2:d=a;e=c;h=b;break;case 3:d=a;e=g;h=c;break;case 4:d=b;e=a;h=c;break;case 5:d=c;e=a;
-h=g;break;case 6:case 0:d=c;e=b;h=a}}this.r=d;this.g=e;this.b=h;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGB();this.updateStyleString()}},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},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+","+~~(this.g*
-255)+","+~~(this.b*255)+")"},clone:function(){return new THREE.Color(this.hex)}};THREE.Vector2=function(a,b){this.set(a||0,b||0)};
+THREE.Color.prototype={copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;this.hex=a.hex},setHex:function(a){this.hex=~~a&16777215;this.updateRGB()},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;this.updateHex()},setHSV:function(a,b,c){var d,e,g,f,i,h;if(c==0)d=e=g=0;else{f=Math.floor(a*6);i=a*6-f;a=c*(1-b);h=c*(1-b*i);b=c*(1-b*(1-i));switch(f){case 1:d=h;e=c;g=a;break;case 2:d=a;e=c;g=b;break;case 3:d=a;e=h;g=c;break;case 4:d=b;e=a;g=c;break;case 5:d=c;e=a;g=h;break;case 6:case 0:d=c;e=b;g=a}}this.setRGB(d,
+e,g)},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(a,b){this.set(a||0,b||0)};
 THREE.Vector2.prototype={set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.set(a.x,a.y);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a);return this},negate:function(){this.set(-this.x,-this.y);return this},unit:function(){this.multiplyScalar(1/
 THREE.Vector2.prototype={set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.set(a.x,a.y);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a);return this},negate:function(){this.set(-this.x,-this.y);return this},unit:function(){this.multiplyScalar(1/
 this.length());return this},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y},clone:function(){return new THREE.Vector2(this.x,this.y)}};THREE.Vector3=function(a,b,c){this.set(a||0,b||0,c||0)};
 this.length());return this},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y},clone:function(){return new THREE.Vector2(this.x,this.y)}};THREE.Vector3=function(a,b,c){this.set(a||0,b||0,c||0)};
 THREE.Vector3.prototype={set:function(a,b,c){this.x=a;this.y=b;this.z=c;return this},copy:function(a){this.set(a.x,a.y,a.z);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z);return this},addScalar:function(a){this.set(this.x+a,this.y+a,this.z+a);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z);return this},cross:function(a,
 THREE.Vector3.prototype={set:function(a,b,c){this.x=a;this.y=b;this.z=c;return this},copy:function(a){this.set(a.x,a.y,a.z);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z);return this},addScalar:function(a){this.set(this.x+a,this.y+a,this.z+a);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z);return this},cross:function(a,
@@ -12,59 +11,59 @@ this.length();a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setPosit
 1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,b,c,d){this.set(a||0,b||0,c||0,d||1)};
 1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,b,c,d){this.set(a||0,b||0,c||0,d||1)};
 THREE.Vector4.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z,a.w+b.w);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z,this.w+a.w);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z,a.w-b.w);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z,this.w-a.w);return this},multiplyScalar:function(a){this.set(this.x*
 THREE.Vector4.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z,a.w+b.w);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z,this.w+a.w);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z,a.w-b.w);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z,this.w-a.w);return this},multiplyScalar:function(a){this.set(this.x*
 a,this.y*a,this.z*a,this.w*a);return this},divideScalar:function(a){this.set(this.x/a,this.y/a,this.z/a,this.w/a);return this},lerpSelf:function(a,b){this.set(this.x+(a.x-this.x)*b,this.y+(a.y-this.y)*b,this.z+(a.z-this.z)*b,this.w+(a.w-this.w)*b)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
 a,this.y*a,this.z*a,this.w*a);return this},divideScalar:function(a){this.set(this.x/a,this.y/a,this.z/a,this.w/a);return this},lerpSelf:function(a,b){this.set(this.x+(a.x-this.x)*b,this.y+(a.y-this.y)*b,this.z+(a.z-this.z)*b,this.w+(a.w-this.w)*b)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
-THREE.Ray.prototype={intersectScene:function(a){var b,c,d=a.objects,e=[];a=0;for(b=d.length;a<b;a++){c=d[a];c instanceof THREE.Mesh&&(e=e.concat(this.intersectObject(c)))}e.sort(function(h,f){return h.distance-f.distance});return e},intersectObject:function(a){function b(D,z,T,U){U=U.clone().subSelf(z);T=T.clone().subSelf(z);var X=D.clone().subSelf(z);D=U.dot(U);z=U.dot(T);U=U.dot(X);var s=T.dot(T);T=T.dot(X);X=1/(D*s-z*z);s=(s*U-z*T)*X;D=(D*T-z*U)*X;return s>0&&D>0&&s+D<1}var c,d,e,h,f,k,g,i,n,j,
-p,r=a.geometry,y=r.vertices,A=[];c=0;for(d=r.faces.length;c<d;c++){e=r.faces[c];j=this.origin.clone();p=this.direction.clone();g=a.matrixWorld;h=g.multiplyVector3(y[e.a].position.clone());f=g.multiplyVector3(y[e.b].position.clone());k=g.multiplyVector3(y[e.c].position.clone());g=e instanceof THREE.Face4?g.multiplyVector3(y[e.d].position.clone()):null;i=a.matrixRotationWorld.multiplyVector3(e.normal.clone());n=p.dot(i);if(a.doubleSided||(a.flipSided?n>0:n<0)){i=i.dot((new THREE.Vector3).sub(h,j))/
-n;j=j.addSelf(p.multiplyScalar(i));if(e instanceof THREE.Face3){if(b(j,h,f,k)){e={distance:this.origin.distanceTo(j),point:j,face:e,object:a};A.push(e)}}else if(e instanceof THREE.Face4&&(b(j,h,f,g)||b(j,f,k,g))){e={distance:this.origin.distanceTo(j),point:j,face:e,object:a};A.push(e)}}}return A}};
-THREE.Rectangle=function(){function a(){h=d-b;f=e-c}var b,c,d,e,h,f,k=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return h};this.getHeight=function(){return f};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(g,i,n,j){k=!1;b=g;c=i;d=n;e=j;a()};this.addPoint=function(g,i){if(k){k=!1;b=g;c=i;d=g;e=i}else{b=b<g?b:g;c=c<i?c:i;d=d>g?d:g;e=e>i?e:i}a()};
-this.add3Points=function(g,i,n,j,p,r){if(k){k=!1;b=g<n?g<p?g:p:n<p?n:p;c=i<j?i<r?i:r:j<r?j:r;d=g>n?g>p?g:p:n>p?n:p;e=i>j?i>r?i:r:j>r?j:r}else{b=g<n?g<p?g<b?g:b:p<b?p:b:n<p?n<b?n:b:p<b?p:b;c=i<j?i<r?i<c?i:c:r<c?r:c:j<r?j<c?j:c:r<c?r:c;d=g>n?g>p?g>d?g:d:p>d?p:d:n>p?n>d?n:d:p>d?p:d;e=i>j?i>r?i>e?i:e:r>e?r:e:j>r?j>e?j:e:r>e?r:e}a()};this.addRectangle=function(g){if(k){k=!1;b=g.getLeft();c=g.getTop();d=g.getRight();e=g.getBottom()}else{b=b<g.getLeft()?b:g.getLeft();c=c<g.getTop()?c:g.getTop();d=d>g.getRight()?
-d:g.getRight();e=e>g.getBottom()?e:g.getBottom()}a()};this.inflate=function(g){b-=g;c-=g;d+=g;e+=g;a()};this.minSelf=function(g){b=b>g.getLeft()?b:g.getLeft();c=c>g.getTop()?c:g.getTop();d=d<g.getRight()?d:g.getRight();e=e<g.getBottom()?e:g.getBottom();a()};this.instersects=function(g){return Math.min(d,g.getRight())-Math.max(b,g.getLeft())>=0&&Math.min(e,g.getBottom())-Math.max(c,g.getTop())>=0};this.empty=function(){k=!0;e=d=c=b=0;a()};this.isEmpty=function(){return k}};
+THREE.Ray.prototype={intersectScene:function(a){var b,c,d=a.objects,e=[];a=0;for(b=d.length;a<b;a++){c=d[a];c instanceof THREE.Mesh&&(e=e.concat(this.intersectObject(c)))}e.sort(function(g,f){return g.distance-f.distance});return e},intersectObject:function(a){function b(D,x,W,X){X=X.clone().subSelf(x);W=W.clone().subSelf(x);var aa=D.clone().subSelf(x);D=X.dot(X);x=X.dot(W);X=X.dot(aa);var H=W.dot(W);W=W.dot(aa);aa=1/(D*H-x*x);H=(H*X-x*W)*aa;D=(D*W-x*X)*aa;return H>0&&D>0&&H+D<1}var c,d,e,g,f,i,h,
+j,p,n,o,k=a.geometry,t=k.vertices,w=[];c=0;for(d=k.faces.length;c<d;c++){e=k.faces[c];n=this.origin.clone();o=this.direction.clone();h=a.matrixWorld;g=h.multiplyVector3(t[e.a].position.clone());f=h.multiplyVector3(t[e.b].position.clone());i=h.multiplyVector3(t[e.c].position.clone());h=e instanceof THREE.Face4?h.multiplyVector3(t[e.d].position.clone()):null;j=a.matrixRotationWorld.multiplyVector3(e.normal.clone());p=o.dot(j);if(a.doubleSided||(a.flipSided?p>0:p<0)){j=j.dot((new THREE.Vector3).sub(g,
+n))/p;n=n.addSelf(o.multiplyScalar(j));if(e instanceof THREE.Face3){if(b(n,g,f,i)){e={distance:this.origin.distanceTo(n),point:n,face:e,object:a};w.push(e)}}else if(e instanceof THREE.Face4&&(b(n,g,f,h)||b(n,f,i,h))){e={distance:this.origin.distanceTo(n),point:n,face:e,object:a};w.push(e)}}}return w}};
+THREE.Rectangle=function(){function a(){g=d-b;f=e-c}var b,c,d,e,g,f,i=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return g};this.getHeight=function(){return f};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(h,j,p,n){i=!1;b=h;c=j;d=p;e=n;a()};this.addPoint=function(h,j){if(i){i=!1;b=h;c=j;d=h;e=j}else{b=b<h?b:h;c=c<j?c:j;d=d>h?d:h;e=e>j?e:j}a()};
+this.add3Points=function(h,j,p,n,o,k){if(i){i=!1;b=h<p?h<o?h:o:p<o?p:o;c=j<n?j<k?j:k:n<k?n:k;d=h>p?h>o?h:o:p>o?p:o;e=j>n?j>k?j:k:n>k?n:k}else{b=h<p?h<o?h<b?h:b:o<b?o:b:p<o?p<b?p:b:o<b?o:b;c=j<n?j<k?j<c?j:c:k<c?k:c:n<k?n<c?n:c:k<c?k:c;d=h>p?h>o?h>d?h:d:o>d?o:d:p>o?p>d?p:d:o>d?o:d;e=j>n?j>k?j>e?j:e:k>e?k:e:n>k?n>e?n:e:k>e?k:e}a()};this.addRectangle=function(h){if(i){i=!1;b=h.getLeft();c=h.getTop();d=h.getRight();e=h.getBottom()}else{b=b<h.getLeft()?b:h.getLeft();c=c<h.getTop()?c:h.getTop();d=d>h.getRight()?
+d:h.getRight();e=e>h.getBottom()?e:h.getBottom()}a()};this.inflate=function(h){b-=h;c-=h;d+=h;e+=h;a()};this.minSelf=function(h){b=b>h.getLeft()?b:h.getLeft();c=c>h.getTop()?c:h.getTop();d=d<h.getRight()?d:h.getRight();e=e<h.getBottom()?e:h.getBottom();a()};this.instersects=function(h){return Math.min(d,h.getRight())-Math.max(b,h.getLeft())>=0&&Math.min(e,h.getBottom())-Math.max(c,h.getTop())>=0};this.empty=function(){i=!0;e=d=c=b=0;a()};this.isEmpty=function(){return i}};
 THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};
 THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};
-THREE.Matrix4=function(a,b,c,d,e,h,f,k,g,i,n,j,p,r,y,A){this.set(a||1,b||0,c||0,d||0,e||0,h||1,f||0,k||0,g||0,i||0,n||1,j||0,p||0,r||0,y||0,A||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={set:function(a,b,c,d,e,h,f,k,g,i,n,j,p,r,y,A){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=e;this.n22=h;this.n23=f;this.n24=k;this.n31=g;this.n32=i;this.n33=n;this.n34=j;this.n41=p;this.n42=r;this.n43=y;this.n44=A;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,b,c){var d=THREE.Matrix4.__v1,
-e=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;h.sub(a,b).normalize();if(h.length()===0)h.z=1;d.cross(c,h).normalize();if(d.length()===0){h.x+=1.0E-4;d.cross(c,h).normalize()}e.cross(h,d).normalize();this.n11=d.x;this.n12=e.x;this.n13=h.x;this.n21=d.y;this.n22=e.y;this.n23=h.y;this.n31=d.z;this.n32=e.z;this.n33=h.z;return this},multiplyVector3:function(a){var b=a.x,c=a.y,d=a.z,e=1/(this.n41*b+this.n42*c+this.n43*d+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*d+this.n14)*e;a.y=(this.n21*b+this.n22*c+this.n23*
+THREE.Matrix4=function(a,b,c,d,e,g,f,i,h,j,p,n,o,k,t,w){this.set(a||1,b||0,c||0,d||0,e||0,g||1,f||0,i||0,h||0,j||0,p||1,n||0,o||0,k||0,t||0,w||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={set:function(a,b,c,d,e,g,f,i,h,j,p,n,o,k,t,w){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=e;this.n22=g;this.n23=f;this.n24=i;this.n31=h;this.n32=j;this.n33=p;this.n34=n;this.n41=o;this.n42=k;this.n43=t;this.n44=w;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,b,c){var d=THREE.Matrix4.__v1,
+e=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,b).normalize();if(g.length()===0)g.z=1;d.cross(c,g).normalize();if(d.length()===0){g.x+=1.0E-4;d.cross(c,g).normalize()}e.cross(g,d).normalize();this.n11=d.x;this.n12=e.x;this.n13=g.x;this.n21=d.y;this.n22=e.y;this.n23=g.y;this.n31=d.z;this.n32=e.z;this.n33=g.z;return this},multiplyVector3:function(a){var b=a.x,c=a.y,d=a.z,e=1/(this.n41*b+this.n42*c+this.n43*d+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*d+this.n14)*e;a.y=(this.n21*b+this.n22*c+this.n23*
 d+this.n24)*e;a.z=(this.n31*b+this.n32*c+this.n33*d+this.n34)*e;return a},multiplyVector4:function(a){var b=a.x,c=a.y,d=a.z,e=a.w;a.x=this.n11*b+this.n12*c+this.n13*d+this.n14*e;a.y=this.n21*b+this.n22*c+this.n23*d+this.n24*e;a.z=this.n31*b+this.n32*c+this.n33*d+this.n34*e;a.w=this.n41*b+this.n42*c+this.n43*d+this.n44*e;return a},rotateAxis:function(a){var b=a.x,c=a.y,d=a.z;a.x=b*this.n11+c*this.n12+d*this.n13;a.y=b*this.n21+c*this.n22+d*this.n23;a.z=b*this.n31+c*this.n32+d*this.n33;a.normalize();
 d+this.n24)*e;a.z=(this.n31*b+this.n32*c+this.n33*d+this.n34)*e;return a},multiplyVector4:function(a){var b=a.x,c=a.y,d=a.z,e=a.w;a.x=this.n11*b+this.n12*c+this.n13*d+this.n14*e;a.y=this.n21*b+this.n22*c+this.n23*d+this.n24*e;a.z=this.n31*b+this.n32*c+this.n33*d+this.n34*e;a.w=this.n41*b+this.n42*c+this.n43*d+this.n44*e;return a},rotateAxis:function(a){var b=a.x,c=a.y,d=a.z;a.x=b*this.n11+c*this.n12+d*this.n13;a.y=b*this.n21+c*this.n22+d*this.n23;a.z=b*this.n31+c*this.n32+d*this.n33;a.normalize();
-return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var c=a.n11,d=a.n12,e=a.n13,h=a.n14,f=a.n21,k=a.n22,g=a.n23,i=a.n24,n=a.n31,j=a.n32,p=a.n33,r=a.n34,y=a.n41,A=a.n42,D=a.n43,z=a.n44,T=b.n11,U=b.n12,X=b.n13,s=b.n14,o=b.n21,L=b.n22,
-R=b.n23,aa=b.n24,ba=b.n31,w=b.n32,u=b.n33,H=b.n34;this.n11=c*T+d*o+e*ba;this.n12=c*U+d*L+e*w;this.n13=c*X+d*R+e*u;this.n14=c*s+d*aa+e*H+h;this.n21=f*T+k*o+g*ba;this.n22=f*U+k*L+g*w;this.n23=f*X+k*R+g*u;this.n24=f*s+k*aa+g*H+i;this.n31=n*T+j*o+p*ba;this.n32=n*U+j*L+p*w;this.n33=n*X+j*R+p*u;this.n34=n*s+j*aa+p*H+r;this.n41=y*T+A*o+D*ba;this.n42=y*U+A*L+D*w;this.n43=y*X+A*R+D*u;this.n44=y*s+A*aa+D*H+z;return this},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;
+return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var c=a.n11,d=a.n12,e=a.n13,g=a.n14,f=a.n21,i=a.n22,h=a.n23,j=a.n24,p=a.n31,n=a.n32,o=a.n33,k=a.n34,t=a.n41,w=a.n42,D=a.n43,x=a.n44,W=b.n11,X=b.n12,aa=b.n13,H=b.n14,q=b.n21,B=b.n22,
+z=b.n23,L=b.n24,Y=b.n31,C=b.n32,A=b.n33,I=b.n34;this.n11=c*W+d*q+e*Y;this.n12=c*X+d*B+e*C;this.n13=c*aa+d*z+e*A;this.n14=c*H+d*L+e*I+g;this.n21=f*W+i*q+h*Y;this.n22=f*X+i*B+h*C;this.n23=f*aa+i*z+h*A;this.n24=f*H+i*L+h*I+j;this.n31=p*W+n*q+o*Y;this.n32=p*X+n*B+o*C;this.n33=p*aa+n*z+o*A;this.n34=p*H+n*L+o*I+k;this.n41=t*W+w*q+D*Y;this.n42=t*X+w*B+D*C;this.n43=t*aa+w*z+D*A;this.n44=t*H+w*L+D*I+x;return this},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;
 c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplySelf:function(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=
 c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplySelf:function(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=
-this.n11,b=this.n12,c=this.n13,d=this.n14,e=this.n21,h=this.n22,f=this.n23,k=this.n24,g=this.n31,i=this.n32,n=this.n33,j=this.n34,p=this.n41,r=this.n42,y=this.n43,A=this.n44;return d*f*i*p-c*k*i*p-d*h*n*p+b*k*n*p+c*h*j*p-b*f*j*p-d*f*g*r+c*k*g*r+d*e*n*r-a*k*n*r-c*e*j*r+a*f*j*r+d*h*g*y-b*k*g*y-d*e*i*y+a*k*i*y+b*e*j*y-a*h*j*y-c*h*g*A+b*f*g*A+c*e*i*A-a*f*i*A-b*e*n*A+a*h*n*A},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=
+this.n11,b=this.n12,c=this.n13,d=this.n14,e=this.n21,g=this.n22,f=this.n23,i=this.n24,h=this.n31,j=this.n32,p=this.n33,n=this.n34,o=this.n41,k=this.n42,t=this.n43,w=this.n44;return d*f*j*o-c*i*j*o-d*g*p*o+b*i*p*o+c*g*n*o-b*f*n*o-d*f*h*k+c*i*h*k+d*e*p*k-a*i*p*k-c*e*n*k+a*f*n*k+d*g*h*t-b*i*h*t-d*e*j*t+a*i*j*t+b*e*n*t-a*g*n*t-c*g*h*w+b*f*h*w+c*e*j*w-a*f*j*w-b*e*p*w+a*g*p*w},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=
 this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;
 this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;
 this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=
 this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=
 this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},setScale:function(a,
 this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},setScale:function(a,
-b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotationX:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotationY:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotationZ:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,h=a.x,f=a.y,k=a.z,g=e*h,i=e*f;this.set(g*
-h+c,g*f-d*k,g*k+d*f,0,g*f+d*k,i*f+c,i*k-d*h,0,g*k-d*f,i*k+d*h,e*k*k+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX=new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3;
-this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(a){var b=a.x,c=a.y,d=a.z;a=Math.cos(b);b=Math.sin(b);var e=Math.cos(c);c=Math.sin(c);var h=Math.cos(d);d=Math.sin(d);var f=a*c,k=b*c;this.n11=e*h;this.n12=-e*d;this.n13=c;this.n21=k*h+a*d;this.n22=-k*d+a*h;this.n23=-b*e;this.n31=-f*h+b*d;this.n32=f*d+b*h;this.n33=a*e;return this},
-setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,e=a.w,h=b+b,f=c+c,k=d+d;a=b*h;var g=b*f;b*=k;var i=c*f;c*=k;d*=k;h*=e;f*=e;e*=k;this.n11=1-(i+d);this.n12=g-e;this.n13=b+f;this.n21=g+e;this.n22=1-(a+d);this.n23=c-h;this.n31=b-f;this.n32=c+h;this.n33=1-(a+i);return this},scale:function(a){var b=a.x,c=a.y;a=a.z;this.n11*=b;this.n12*=c;this.n13*=a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},extractPosition:function(a){this.n14=
+b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotationX:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotationY:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotationZ:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,g=a.x,f=a.y,i=a.z,h=e*g,j=e*f;this.set(h*
+g+c,h*f-d*i,h*i+d*f,0,h*f+d*i,j*f+c,j*i-d*g,0,h*i-d*f,j*i+d*g,e*i*i+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX=new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3;
+this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(a){var b=a.x,c=a.y,d=a.z;a=Math.cos(b);b=Math.sin(b);var e=Math.cos(c);c=Math.sin(c);var g=Math.cos(d);d=Math.sin(d);var f=a*c,i=b*c;this.n11=e*g;this.n12=-e*d;this.n13=c;this.n21=i*g+a*d;this.n22=-i*d+a*g;this.n23=-b*e;this.n31=-f*g+b*d;this.n32=f*d+b*g;this.n33=a*e;return this},
+setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,e=a.w,g=b+b,f=c+c,i=d+d;a=b*g;var h=b*f;b*=i;var j=c*f;c*=i;d*=i;g*=e;f*=e;e*=i;this.n11=1-(j+d);this.n12=h-e;this.n13=b+f;this.n21=h+e;this.n22=1-(a+d);this.n23=c-g;this.n31=b-f;this.n32=c+g;this.n33=1-(a+j);return this},scale:function(a){var b=a.x,c=a.y;a=a.z;this.n11*=b;this.n12*=c;this.n13*=a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},extractPosition:function(a){this.n14=
 a.n14;this.n24=a.n24;this.n34=a.n34},extractRotation:function(a,b){var c=1/b.x,d=1/b.y,e=1/b.z;this.n11=a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*d;this.n22=a.n22*d;this.n32=a.n32*d;this.n13=a.n13*e;this.n23=a.n23*e;this.n33=a.n33*e}};
 a.n14;this.n24=a.n24;this.n34=a.n34},extractRotation:function(a,b){var c=1/b.x,d=1/b.y,e=1/b.z;this.n11=a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*d;this.n22=a.n22*d;this.n32=a.n32*d;this.n13=a.n13*e;this.n23=a.n23*e;this.n33=a.n33*e}};
-THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,d=a.n12,e=a.n13,h=a.n14,f=a.n21,k=a.n22,g=a.n23,i=a.n24,n=a.n31,j=a.n32,p=a.n33,r=a.n34,y=a.n41,A=a.n42,D=a.n43,z=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=g*r*A-i*p*A+i*j*D-k*r*D-g*j*z+k*p*z;b.n12=h*p*A-e*r*A-h*j*D+d*r*D+e*j*z-d*p*z;b.n13=e*i*A-h*g*A+h*k*D-d*i*D-e*k*z+d*g*z;b.n14=h*g*j-e*i*j-h*k*p+d*i*p+e*k*r-d*g*r;b.n21=i*p*y-g*r*y-i*n*D+f*r*D+g*n*z-f*p*z;b.n22=e*r*y-h*p*y+h*n*D-c*r*D-e*n*z+c*p*z;b.n23=h*g*y-e*i*y-h*f*D+c*i*D+e*f*z-c*g*z;
-b.n24=e*i*n-h*g*n+h*f*p-c*i*p-e*f*r+c*g*r;b.n31=k*r*y-i*j*y+i*n*A-f*r*A-k*n*z+f*j*z;b.n32=h*j*y-d*r*y-h*n*A+c*r*A+d*n*z-c*j*z;b.n33=e*i*y-h*k*y+h*f*A-c*i*A-d*f*z+c*k*z;b.n34=h*k*n-d*i*n-h*f*j+c*i*j+d*f*r-c*k*r;b.n41=g*j*y-k*p*y-g*n*A+f*p*A+k*n*D-f*j*D;b.n42=d*p*y-e*j*y+e*n*A-c*p*A-d*n*D+c*j*D;b.n43=e*k*y-d*g*y-e*f*A+c*g*A+d*f*D-c*k*D;b.n44=d*g*n-e*k*n+e*f*j-c*g*j-d*f*p+c*k*p;b.multiplyScalar(1/a.determinant());return b};
-THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,e=-a.n33*a.n21+a.n31*a.n23,h=a.n32*a.n21-a.n31*a.n22,f=-a.n33*a.n12+a.n32*a.n13,k=a.n33*a.n11-a.n31*a.n13,g=-a.n32*a.n11+a.n31*a.n12,i=a.n23*a.n12-a.n22*a.n13,n=-a.n23*a.n11+a.n21*a.n13,j=a.n22*a.n11-a.n21*a.n12;a=a.n11*d+a.n21*f+a.n31*i;if(a==0)throw"matrix not invertible";a=1/a;c[0]=a*d;c[1]=a*e;c[2]=a*h;c[3]=a*f;c[4]=a*k;c[5]=a*g;c[6]=a*i;c[7]=a*n;c[8]=a*j;return b};
-THREE.Matrix4.makeFrustum=function(a,b,c,d,e,h){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=-(h+e)/(h-e);f.n34=-2*h*e/(h-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,h){var f,k,g,i;f=new THREE.Matrix4;k=b-a;g=c-d;i=h-e;f.n11=2/k;f.n12=0;f.n13=0;f.n14=-((b+a)/k);f.n21=0;f.n22=2/g;f.n23=0;f.n24=-((c+d)/g);f.n31=0;f.n32=0;f.n33=-2/i;f.n34=-((h+e)/i);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.Matrix4.makeInvert=function(a,b){var c=a.n11,d=a.n12,e=a.n13,g=a.n14,f=a.n21,i=a.n22,h=a.n23,j=a.n24,p=a.n31,n=a.n32,o=a.n33,k=a.n34,t=a.n41,w=a.n42,D=a.n43,x=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=h*k*w-j*o*w+j*n*D-i*k*D-h*n*x+i*o*x;b.n12=g*o*w-e*k*w-g*n*D+d*k*D+e*n*x-d*o*x;b.n13=e*j*w-g*h*w+g*i*D-d*j*D-e*i*x+d*h*x;b.n14=g*h*n-e*j*n-g*i*o+d*j*o+e*i*k-d*h*k;b.n21=j*o*t-h*k*t-j*p*D+f*k*D+h*p*x-f*o*x;b.n22=e*k*t-g*o*t+g*p*D-c*k*D-e*p*x+c*o*x;b.n23=g*h*t-e*j*t-g*f*D+c*j*D+e*f*x-c*h*x;
+b.n24=e*j*p-g*h*p+g*f*o-c*j*o-e*f*k+c*h*k;b.n31=i*k*t-j*n*t+j*p*w-f*k*w-i*p*x+f*n*x;b.n32=g*n*t-d*k*t-g*p*w+c*k*w+d*p*x-c*n*x;b.n33=e*j*t-g*i*t+g*f*w-c*j*w-d*f*x+c*i*x;b.n34=g*i*p-d*j*p-g*f*n+c*j*n+d*f*k-c*i*k;b.n41=h*n*t-i*o*t-h*p*w+f*o*w+i*p*D-f*n*D;b.n42=d*o*t-e*n*t+e*p*w-c*o*w-d*p*D+c*n*D;b.n43=e*i*t-d*h*t-e*f*w+c*h*w+d*f*D-c*i*D;b.n44=d*h*p-e*i*p+e*f*n-c*h*n-d*f*o+c*i*o;b.multiplyScalar(1/a.determinant());return b};
+THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,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,i=a.n33*a.n11-a.n31*a.n13,h=-a.n32*a.n11+a.n31*a.n12,j=a.n23*a.n12-a.n22*a.n13,p=-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*j;if(a==0)throw"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*i;c[5]=a*h;c[6]=a*j;c[7]=a*p;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,i,h,j;f=new THREE.Matrix4;i=b-a;h=c-d;j=g-e;f.n11=2/i;f.n12=0;f.n13=0;f.n14=-((b+a)/i);f.n21=0;f.n22=2/h;f.n23=0;f.n24=-((c+d)/h);f.n31=0;f.n32=0;f.n33=-2/j;f.n34=-((g+e)/j);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=undefined;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.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixAutoUpdate=!0;this.matrixWorldNeedsUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=
 THREE.Object3D=function(){this.parent=undefined;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.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixAutoUpdate=!0;this.matrixWorldNeedsUpdate=!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=""};
 !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)===
 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!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);for(var b=this;b.parent!==undefined;)b=b.parent;b!==undefined&&b instanceof THREE.Scene&&b.addChildRecurse(a)}},removeChild:function(a){var b=this.children.indexOf(a);if(b!==-1){a.parent=undefined;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);if(e!==undefined)return e}}},updateMatrix:function(){this.matrix.setPosition(this.position);
 -1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);for(var b=this;b.parent!==undefined;)b=b.parent;b!==undefined&&b instanceof THREE.Scene&&b.addChildRecurse(a)}},removeChild:function(a){var b=this.children.indexOf(a);if(b!==-1){a.parent=undefined;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);if(e!==undefined)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.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,this.scale);this.matrixWorldNeedsUpdate=!1;b=!0}a=0;for(var d=this.children.length;a<d;a++)this.children[a].update(this.matrixWorld,b,c)}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==undefined?d:1)};
 this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale);this.matrixWorldNeedsUpdate=!1;b=!0}a=0;for(var d=this.children.length;a<d;a++)this.children[a].update(this.matrixWorld,b,c)}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==undefined?d:1)};
-THREE.Quaternion.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b;a=Math.cos(d);d=Math.sin(d);b=Math.cos(-e);e=Math.sin(-e);var h=Math.cos(c);c=Math.sin(c);var f=a*b,k=d*e;this.w=f*h-k*c;this.x=f*c+k*h;this.y=d*b*h+a*e*c;this.z=a*e*h-d*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);this.x=a.x*d;this.y=
+THREE.Quaternion.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b;a=Math.cos(d);d=Math.sin(d);b=Math.cos(-e);e=Math.sin(-e);var g=Math.cos(c);c=Math.sin(c);var f=a*b,i=d*e;this.w=f*g-i*c;this.x=f*c+i*g;this.y=d*b*g+a*e*c;this.z=a*e*g-d*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);this.x=a.x*d;this.y=
 a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},
 a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},
-multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,h=a.x,f=a.y,k=a.z;a=a.w;this.x=b*a+e*h+c*k-d*f;this.y=c*a+e*f+d*h-b*k;this.z=d*a+e*k+b*f-c*h;this.w=e*a-b*h-c*f-d*k;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,h=this.x,f=this.y,k=this.z,g=this.w,i=g*c+f*e-k*d,n=
-g*d+k*c-h*e,j=g*e+h*d-f*c;c=-h*c-f*d-k*e;b.x=i*g+c*-h+n*-k-j*-f;b.y=n*g+c*-f+j*-h-i*-k;b.z=j*g+c*-k+i*-f-n*-h;return b}};
-THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var h=Math.acos(e),f=Math.sqrt(1-e*e);if(Math.abs(f)<0.001){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}e=Math.sin((1-d)*h)/f;d=Math.sin(d*h)/f;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
-THREE.Face3=function(a,b,c,d,e,h){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};
-THREE.Face4=function(a,b,c,d,e,h,f){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=f instanceof Array?f:[f];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.set(a||0,b||0)};
+multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,g=a.x,f=a.y,i=a.z;a=a.w;this.x=b*a+e*g+c*i-d*f;this.y=c*a+e*f+d*g-b*i;this.z=d*a+e*i+b*f-c*g;this.w=e*a-b*g-c*f-d*i;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,g=this.x,f=this.y,i=this.z,h=this.w,j=h*c+f*e-i*d,p=
+h*d+i*c-g*e,n=h*e+g*d-f*c;c=-g*c-f*d-i*e;b.x=j*h+c*-g+p*-i-n*-f;b.y=p*h+c*-f+n*-g-j*-i;b.z=n*h+c*-i+j*-f-p*-g;return b}};
+THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var g=Math.acos(e),f=Math.sqrt(1-e*e);if(Math.abs(f)<0.001){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}e=Math.sin((1-d)*g)/f;d=Math.sin(d*g)/f;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
+THREE.Face3=function(a,b,c,d,e,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.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.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
 THREE.Geometry.prototype={computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];c.centroid.set(0,0,0);if(c instanceof THREE.Face3){c.centroid.addSelf(this.vertices[c.a].position);c.centroid.addSelf(this.vertices[c.b].position);c.centroid.addSelf(this.vertices[c.c].position);c.centroid.divideScalar(3)}else if(c instanceof THREE.Face4){c.centroid.addSelf(this.vertices[c.a].position);c.centroid.addSelf(this.vertices[c.b].position);c.centroid.addSelf(this.vertices[c.c].position);
 THREE.Geometry.prototype={computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];c.centroid.set(0,0,0);if(c instanceof THREE.Face3){c.centroid.addSelf(this.vertices[c.a].position);c.centroid.addSelf(this.vertices[c.b].position);c.centroid.addSelf(this.vertices[c.c].position);c.centroid.divideScalar(3)}else if(c instanceof THREE.Face4){c.centroid.addSelf(this.vertices[c.a].position);c.centroid.addSelf(this.vertices[c.b].position);c.centroid.addSelf(this.vertices[c.c].position);
-c.centroid.addSelf(this.vertices[c.d].position);c.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var b,c,d,e,h,f,k=new THREE.Vector3,g=new THREE.Vector3;d=0;for(e=this.faces.length;d<e;d++){h=this.faces[d];if(a&&h.vertexNormals.length){k.set(0,0,0);b=0;for(c=h.vertexNormals.length;b<c;b++)k.addSelf(h.vertexNormals[b]);k.divideScalar(3)}else{b=this.vertices[h.a];c=this.vertices[h.b];f=this.vertices[h.c];k.sub(f.position,c.position);g.sub(b.position,c.position);k.crossSelf(g)}k.isZero()||
-k.normalize();h.normal.copy(k)}},computeVertexNormals:function(){var a,b,c,d;if(this.__tmpVertices==undefined){d=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{d=
+c.centroid.addSelf(this.vertices[c.d].position);c.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var b,c,d,e,g,f,i=new THREE.Vector3,h=new THREE.Vector3;d=0;for(e=this.faces.length;d<e;d++){g=this.faces[d];if(a&&g.vertexNormals.length){i.set(0,0,0);b=0;for(c=g.vertexNormals.length;b<c;b++)i.addSelf(g.vertexNormals[b]);i.divideScalar(3)}else{b=this.vertices[g.a];c=this.vertices[g.b];f=this.vertices[g.c];i.sub(f.position,c.position);h.sub(b.position,c.position);i.crossSelf(h)}i.isZero()||
+i.normalize();g.normal.copy(i)}},computeVertexNormals:function(){var a,b,c,d;if(this.__tmpVertices==undefined){d=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{d=
 this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal)}else if(c instanceof THREE.Face4){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal);d[c.d].addSelf(c.normal)}}a=0;for(b=this.vertices.length;a<b;a++)d[a].normalize();a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){c.vertexNormals[0].copy(d[c.a]);
 this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal)}else if(c instanceof THREE.Face4){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal);d[c.d].addSelf(c.normal)}}a=0;for(b=this.vertices.length;a<b;a++)d[a].normalize();a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){c.vertexNormals[0].copy(d[c.a]);
-c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c]);c.vertexNormals[3].copy(d[c.d])}}},computeTangents:function(){function a(E,O,S,V,F,Y,B){k=E.vertices[O].position;g=E.vertices[S].position;i=E.vertices[V].position;n=f[F];j=f[Y];p=f[B];r=g.x-k.x;y=i.x-k.x;A=g.y-k.y;D=i.y-k.y;z=g.z-k.z;T=i.z-k.z;U=j.u-n.u;X=p.u-n.u;s=j.v-n.v;o=p.v-n.v;L=1/(U*o-X*s);w.set((o*
-r-s*y)*L,(o*A-s*D)*L,(o*z-s*T)*L);u.set((U*y-X*r)*L,(U*D-X*A)*L,(U*T-X*z)*L);aa[O].addSelf(w);aa[S].addSelf(w);aa[V].addSelf(w);ba[O].addSelf(u);ba[S].addSelf(u);ba[V].addSelf(u)}var b,c,d,e,h,f,k,g,i,n,j,p,r,y,A,D,z,T,U,X,s,o,L,R,aa=[],ba=[],w=new THREE.Vector3,u=new THREE.Vector3,H=new THREE.Vector3,M=new THREE.Vector3,P=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++){aa[b]=new THREE.Vector3;ba[b]=new THREE.Vector3}b=0;for(c=this.faces.length;b<c;b++){h=this.faces[b];f=this.faceVertexUvs[0][b];
-if(h instanceof THREE.Face3)a(this,h.a,h.b,h.c,0,1,2);else if(h instanceof THREE.Face4){a(this,h.a,h.b,h.c,0,1,2);a(this,h.a,h.b,h.d,0,1,3)}}var I=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){h=this.faces[b];for(d=0;d<h.vertexNormals.length;d++){P.copy(h.vertexNormals[d]);e=h[I[d]];R=aa[e];H.copy(R);H.subSelf(P.multiplyScalar(P.dot(R))).normalize();M.cross(h.vertexNormals[d],R);e=M.dot(ba[e]);e=e<0?-1:1;h.vertexTangents[d]=new THREE.Vector4(H.x,H.y,H.z,e)}}this.hasTangents=!0},computeBoundingBox:function(){var a;
+c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c]);c.vertexNormals[3].copy(d[c.d])}}},computeTangents:function(){function a(y,F,Q,S,G,ba,Z){i=y.vertices[F].position;h=y.vertices[Q].position;j=y.vertices[S].position;p=f[G];n=f[ba];o=f[Z];k=h.x-i.x;t=j.x-i.x;w=h.y-i.y;D=j.y-i.y;x=h.z-i.z;W=j.z-i.z;X=n.u-p.u;aa=o.u-p.u;H=n.v-p.v;q=o.v-p.v;B=1/(X*q-aa*H);C.set((q*
+k-H*t)*B,(q*w-H*D)*B,(q*x-H*W)*B);A.set((X*t-aa*k)*B,(X*D-aa*w)*B,(X*W-aa*x)*B);L[F].addSelf(C);L[Q].addSelf(C);L[S].addSelf(C);Y[F].addSelf(A);Y[Q].addSelf(A);Y[S].addSelf(A)}var b,c,d,e,g,f,i,h,j,p,n,o,k,t,w,D,x,W,X,aa,H,q,B,z,L=[],Y=[],C=new THREE.Vector3,A=new THREE.Vector3,I=new THREE.Vector3,O=new THREE.Vector3,R=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++){L[b]=new THREE.Vector3;Y[b]=new THREE.Vector3}b=0;for(c=this.faces.length;b<c;b++){g=this.faces[b];f=this.faceVertexUvs[0][b];
+if(g instanceof THREE.Face3)a(this,g.a,g.b,g.c,0,1,2);else if(g instanceof THREE.Face4){a(this,g.a,g.b,g.c,0,1,2);a(this,g.a,g.b,g.d,0,1,3)}}var J=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){g=this.faces[b];for(d=0;d<g.vertexNormals.length;d++){R.copy(g.vertexNormals[d]);e=g[J[d]];z=L[e];I.copy(z);I.subSelf(R.multiplyScalar(R.dot(z))).normalize();O.cross(g.vertexNormals[d],z);e=O.dot(Y[e]);e=e<0?-1:1;g.vertexTangents[d]=new THREE.Vector4(I.x,I.y,I.z,e)}}this.hasTangents=!0},computeBoundingBox:function(){var a;
 if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,c=this.vertices.length;b<c;b++){a=this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;
 if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,c=this.vertices.length;b<c;b++){a=this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;
-else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,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(g,i){return Math.min(g,
-i)+"_"+Math.max(g,i)}function b(g,i,n){if(g[i]===undefined){g[i]={set:{},array:[]};g[i].set[n]=1;g[i].array.push(n)}else if(g[i].set[n]===undefined){g[i].set[n]=1;g[i].array.push(n)}}var c,d,e,h,f,k={};c=0;for(d=this.faces.length;c<d;c++){f=this.faces[c];if(f instanceof THREE.Face3){e=a(f.a,f.b);b(k,e,c);e=a(f.b,f.c);b(k,e,c);e=a(f.a,f.c);b(k,e,c)}else if(f instanceof THREE.Face4){e=a(f.b,f.d);b(k,e,c);e=a(f.a,f.b);b(k,e,c);e=a(f.a,f.d);b(k,e,c);e=a(f.b,f.c);b(k,e,c);e=a(f.c,f.d);b(k,e,c)}}c=0;for(d=
-this.edges.length;c<d;c++){f=this.edges[c];e=f.vertexIndices[0];h=f.vertexIndices[1];f.faceIndices=k[a(e,h)].array;for(e=0;e<f.faceIndices.length;e++){h=f.faceIndices[e];f.faces.push(this.faces[h])}}}};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()};
+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=this.boundingSphere===null?0:this.boundingSphere.radius,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(h,j){return Math.min(h,
+j)+"_"+Math.max(h,j)}function b(h,j,p){if(h[j]===undefined){h[j]={set:{},array:[]};h[j].set[p]=1;h[j].array.push(p)}else if(h[j].set[p]===undefined){h[j].set[p]=1;h[j].array.push(p)}}var c,d,e,g,f,i={};c=0;for(d=this.faces.length;c<d;c++){f=this.faces[c];if(f instanceof THREE.Face3){e=a(f.a,f.b);b(i,e,c);e=a(f.b,f.c);b(i,e,c);e=a(f.a,f.c);b(i,e,c)}else if(f instanceof THREE.Face4){e=a(f.b,f.d);b(i,e,c);e=a(f.a,f.b);b(i,e,c);e=a(f.a,f.d);b(i,e,c);e=a(f.b,f.c);b(i,e,c);e=a(f.c,f.d);b(i,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=i[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);this.position.addSelf(b.multiplyScalar(a));this.target.position.addSelf(b.multiplyScalar(a))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};
 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);this.position.addSelf(b.multiplyScalar(a));this.target.position.addSelf(b.multiplyScalar(a))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};
 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{this.matrixAutoUpdate&&this.updateMatrix();if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=
 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{this.matrixAutoUpdate&&this.updateMatrix();if(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;
 !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;
@@ -85,7 +84,7 @@ 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.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!==undefined?new THREE.Color(a.color):new THREE.Color(16777215);this.map=a.map!==undefined?a.map:null;this.size=a.size!==undefined?a.size:1;this.sizeAttenuation=a.sizeAttenuation!==undefined?a.sizeAttenuation:!0;this.vertexColors=a.vertexColors!==undefined?a.vertexColors:!1};THREE.ParticleBasicMaterial.prototype=new THREE.Material;THREE.ParticleBasicMaterial.prototype.constructor=THREE.ParticleBasicMaterial;
 THREE.ParticleBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==undefined?new THREE.Color(a.color):new THREE.Color(16777215);this.map=a.map!==undefined?a.map:null;this.size=a.size!==undefined?a.size:1;this.sizeAttenuation=a.sizeAttenuation!==undefined?a.sizeAttenuation:!0;this.vertexColors=a.vertexColors!==undefined?a.vertexColors:!1};THREE.ParticleBasicMaterial.prototype=new THREE.Material;THREE.ParticleBasicMaterial.prototype.constructor=THREE.ParticleBasicMaterial;
 THREE.ParticleCanvasMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==undefined?new THREE.Color(a.color):new THREE.Color(16777215);this.program=a.program!==undefined?a.program:function(){}};THREE.ParticleCanvasMaterial.prototype=new THREE.Material;THREE.ParticleCanvasMaterial.prototype.constructor=THREE.ParticleCanvasMaterial;
 THREE.ParticleCanvasMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==undefined?new THREE.Color(a.color):new THREE.Color(16777215);this.program=a.program!==undefined?a.program:function(){}};THREE.ParticleCanvasMaterial.prototype=new THREE.Material;THREE.ParticleCanvasMaterial.prototype.constructor=THREE.ParticleCanvasMaterial;
-THREE.Texture=function(a,b,c,d,e,h){this.image=a;this.mapping=b!==undefined?b:new THREE.UVMapping;this.wrapS=c!==undefined?c:THREE.ClampToEdgeWrapping;this.wrapT=d!==undefined?d:THREE.ClampToEdgeWrapping;this.magFilter=e!==undefined?e:THREE.LinearFilter;this.minFilter=h!==undefined?h:THREE.LinearMipMapLinearFilter;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.Texture=function(a,b,c,d,e,g){this.image=a;this.mapping=b!==undefined?b:new THREE.UVMapping;this.wrapS=c!==undefined?c:THREE.ClampToEdgeWrapping;this.wrapT=d!==undefined?d:THREE.ClampToEdgeWrapping;this.magFilter=e!==undefined?e:THREE.LinearFilter;this.minFilter=g!==undefined?g:THREE.LinearMipMapLinearFilter;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.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!=undefined?c:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;
 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!=undefined?c:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;
 THREE.Line.prototype.constructor=THREE.Line;
 THREE.Line.prototype.constructor=THREE.Line;
@@ -103,43 +102,43 @@ 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.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 if(a instanceof THREE.Sound){b=this.sounds.indexOf(a);b!==-1&&this.sounds.splice(b,1)}else if(!(a instanceof THREE.Camera)){b=this.objects.indexOf(a);if(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.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 if(a instanceof THREE.Sound){b=this.sounds.indexOf(a);b!==-1&&this.sounds.splice(b,1)}else if(!(a instanceof THREE.Camera)){b=this.objects.indexOf(a);if(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.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 w=g[k]=g[k]||new THREE.RenderableVertex;k++;return w}function b(w,u){return u.z-w.z}function c(w,u){var H=0,M=1,P=w.z+w.w,I=u.z+u.w,E=-w.z+w.w,O=-u.z+u.w;if(P>=0&&I>=0&&E>=0&&O>=0)return!0;else if(P<0&&I<0||E<0&&O<0)return!1;else{if(P<0)H=Math.max(H,P/(P-I));else I<0&&(M=Math.min(M,P/(P-I)));if(E<0)H=Math.max(H,E/(E-O));else O<0&&(M=Math.min(M,E/(E-O)));if(M<H)return!1;else{w.lerpSelf(u,H);u.lerpSelf(w,1-M);return!0}}}var d,e,h=[],f,k,g=[],i,n,j=[],p,r=
-[],y,A,D=[],z,T,U=[],X=new THREE.Vector4,s=new THREE.Vector4,o=new THREE.Matrix4,L=new THREE.Matrix4,R=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],aa=new THREE.Vector4,ba=new THREE.Vector4;this.projectVector=function(w,u){o.multiply(u.projectionMatrix,u.matrixWorldInverse);o.multiplyVector3(w);return w};this.unprojectVector=function(w,u){o.multiply(u.matrixWorld,THREE.Matrix4.makeInvert(u.projectionMatrix));o.multiplyVector3(w);return w};
-this.projectObjects=function(w,u,H){u=[];var M,P,I;e=0;P=w.objects;w=0;for(M=P.length;w<M;w++){I=P[w];var E;if(!(E=!I.visible))if(E=I instanceof THREE.Mesh){a:{E=void 0;for(var O=I.matrixWorld,S=-I.geometry.boundingSphere.radius*Math.max(I.scale.x,Math.max(I.scale.y,I.scale.z)),V=0;V<6;V++){E=R[V].x*O.n14+R[V].y*O.n24+R[V].z*O.n34+R[V].w;if(E<=S){E=!1;break a}}E=!0}E=!E}if(!E){E=h[e]=h[e]||new THREE.RenderableObject;e++;d=E;X.copy(I.position);o.multiplyVector3(X);d.object=I;d.z=X.z;u.push(d)}}H&&
-u.sort(b);return u};this.projectScene=function(w,u,H){var M=[],P=u.near,I=u.far,E,O,S,V,F,Y,B,Q,K,C,Z,ia,ma,ja,ca,Da,wa;T=A=p=n=0;u.matrixAutoUpdate&&u.update(undefined,!0);w.update(undefined,!1,u);o.multiply(u.projectionMatrix,u.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+o.n33,o.n44+o.n34);for(E=0;E<6;E++){K=R[E];K.divideScalar(Math.sqrt(K.x*K.x+K.y*K.y+K.z*K.z))}K=this.projectObjects(w,u,!0);w=0;for(E=K.length;w<E;w++){C=K[w].object;if(C.visible){Z=C.matrixWorld;ia=C.matrixRotationWorld;ma=C.materials;ja=C.overdraw;k=0;if(C instanceof THREE.Mesh){ca=C.geometry;V=ca.vertices;Da=ca.faces;ca=ca.faceVertexUvs;O=0;for(S=V.length;O<S;O++){f=a();f.positionWorld.copy(V[O].position);Z.multiplyVector3(f.positionWorld);
-f.positionScreen.copy(f.positionWorld);o.multiplyVector4(f.positionScreen);f.positionScreen.x/=f.positionScreen.w;f.positionScreen.y/=f.positionScreen.w;f.visible=f.positionScreen.z>P&&f.positionScreen.z<I}V=0;for(O=Da.length;V<O;V++){S=Da[V];if(S instanceof THREE.Face3){F=g[S.a];Y=g[S.b];B=g[S.c];if(F.visible&&Y.visible&&B.visible&&(C.doubleSided||C.flipSided!=(B.positionScreen.x-F.positionScreen.x)*(Y.positionScreen.y-F.positionScreen.y)-(B.positionScreen.y-F.positionScreen.y)*(Y.positionScreen.x-
-F.positionScreen.x)<0)){Q=j[n]=j[n]||new THREE.RenderableFace3;n++;i=Q;i.v1.copy(F);i.v2.copy(Y);i.v3.copy(B)}else continue}else if(S instanceof THREE.Face4){F=g[S.a];Y=g[S.b];B=g[S.c];Q=g[S.d];if(F.visible&&Y.visible&&B.visible&&Q.visible&&(C.doubleSided||C.flipSided!=((Q.positionScreen.x-F.positionScreen.x)*(Y.positionScreen.y-F.positionScreen.y)-(Q.positionScreen.y-F.positionScreen.y)*(Y.positionScreen.x-F.positionScreen.x)<0||(Y.positionScreen.x-B.positionScreen.x)*(Q.positionScreen.y-B.positionScreen.y)-
-(Y.positionScreen.y-B.positionScreen.y)*(Q.positionScreen.x-B.positionScreen.x)<0))){wa=r[p]=r[p]||new THREE.RenderableFace4;p++;i=wa;i.v1.copy(F);i.v2.copy(Y);i.v3.copy(B);i.v4.copy(Q)}else continue}i.normalWorld.copy(S.normal);ia.multiplyVector3(i.normalWorld);i.centroidWorld.copy(S.centroid);Z.multiplyVector3(i.centroidWorld);i.centroidScreen.copy(i.centroidWorld);o.multiplyVector3(i.centroidScreen);B=S.vertexNormals;F=0;for(Y=B.length;F<Y;F++){Q=i.vertexNormalsWorld[F];Q.copy(B[F]);ia.multiplyVector3(Q)}F=
-0;for(Y=ca.length;F<Y;F++)if(wa=ca[F][V]){B=0;for(Q=wa.length;B<Q;B++)i.uvs[F][B]=wa[B]}i.meshMaterials=ma;i.faceMaterials=S.materials;i.overdraw=ja;i.z=i.centroidScreen.z;M.push(i)}}else if(C instanceof THREE.Line){L.multiply(o,Z);V=C.geometry.vertices;F=a();F.positionScreen.copy(V[0].position);L.multiplyVector4(F.positionScreen);O=1;for(S=V.length;O<S;O++){F=a();F.positionScreen.copy(V[O].position);L.multiplyVector4(F.positionScreen);Y=g[k-2];aa.copy(F.positionScreen);ba.copy(Y.positionScreen);
-if(c(aa,ba)){aa.multiplyScalar(1/aa.w);ba.multiplyScalar(1/ba.w);Z=D[A]=D[A]||new THREE.RenderableLine;A++;y=Z;y.v1.positionScreen.copy(aa);y.v2.positionScreen.copy(ba);y.z=Math.max(aa.z,ba.z);y.materials=C.materials;M.push(y)}}}else if(C instanceof THREE.Particle){s.set(C.matrixWorld.n14,C.matrixWorld.n24,C.matrixWorld.n34,1);o.multiplyVector4(s);s.z/=s.w;if(s.z>0&&s.z<1){Z=U[T]=U[T]||new THREE.RenderableParticle;T++;z=Z;z.x=s.x/s.w;z.y=s.y/s.w;z.z=s.z;z.rotation=C.rotation.z;z.scale.x=C.scale.x*
-Math.abs(z.x-(s.x+u.projectionMatrix.n11)/(s.w+u.projectionMatrix.n14));z.scale.y=C.scale.y*Math.abs(z.y-(s.y+u.projectionMatrix.n22)/(s.w+u.projectionMatrix.n24));z.materials=C.materials;M.push(z)}}}}H&&M.sort(b);return M}};
-THREE.CanvasRenderer=function(){function a($){if(y!=$)j.globalAlpha=y=$}function b($){if(A!=$){switch($){case THREE.NormalBlending:j.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:j.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:j.globalCompositeOperation="darker"}A=$}}function c($){if(D!=$)j.strokeStyle=D=$}var d=this,e=null,h=new THREE.Projector,f=document.createElement("canvas"),k,g,i,n,j=f.getContext("2d"),p=new THREE.Color(0),r=0,y=1,A=0,D=null,
-z=null,T=null,U=null,X=null,s,o,L,R,aa=new THREE.RenderableVertex,ba=new THREE.RenderableVertex,w,u,H,M,P,I,E,O,S,V,F,Y,B=new THREE.Color,Q=new THREE.Color,K=new THREE.Color,C=new THREE.Color,Z=new THREE.Color,ia,ma,ja,ca,Da,wa,Wa,Xa,Ya,Za,Ba=new THREE.Rectangle,ka=new THREE.Rectangle,fa=new THREE.Rectangle,Ua=!1,ha=new THREE.Color,ga=new THREE.Color,Ma=new THREE.Color,Na=new THREE.Color,da=new THREE.Vector3,Ha,Ia,Va,la,Ja,Oa,Ea=16;Ha=document.createElement("canvas");Ha.width=Ha.height=2;Ia=Ha.getContext("2d");
-Ia.fillStyle="rgba(0,0,0,1)";Ia.fillRect(0,0,2,2);Va=Ia.getImageData(0,0,2,2);la=Va.data;Ja=document.createElement("canvas");Ja.width=Ja.height=Ea;Oa=Ja.getContext("2d");Oa.translate(-Ea/2,-Ea/2);Oa.scale(Ea,Ea);Ea--;this.domElement=f;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.data={vertices:0,faces:0};this.setSize=function($,na){k=$;g=na;i=k/2;n=g/2;f.width=k;f.height=g;Ba.set(-i,-n,i,n);y=1;A=0;X=U=T=z=D=null};this.setClearColor=function($,na){p=$;r=na};this.setClearColorHex=
-function($,na){p.setHex($);r=na};this.clear=function(){j.setTransform(1,0,0,-1,i,n);if(!ka.isEmpty()){ka.inflate(1);ka.minSelf(Ba);if(p.hex==0&&r==0)j.clearRect(ka.getX(),ka.getY(),ka.getWidth(),ka.getHeight());else{b(THREE.NormalBlending);a(1);j.fillStyle="rgba("+Math.floor(p.r*255)+","+Math.floor(p.g*255)+","+Math.floor(p.b*255)+","+r+")";j.fillRect(ka.getX(),ka.getY(),ka.getWidth(),ka.getHeight())}ka.empty()}};this.render=function($,na){function bb(m){var x,t,q,J=m.lights;ga.setRGB(0,0,0);Ma.setRGB(0,
-0,0);Na.setRGB(0,0,0);m=0;for(x=J.length;m<x;m++){t=J[m];q=t.color;if(t instanceof THREE.AmbientLight){ga.r+=q.r;ga.g+=q.g;ga.b+=q.b}else if(t instanceof THREE.DirectionalLight){Ma.r+=q.r;Ma.g+=q.g;Ma.b+=q.b}else if(t instanceof THREE.PointLight){Na.r+=q.r;Na.g+=q.g;Na.b+=q.b}}}function ra(m,x,t,q){var J,G,v,l,W=m.lights;m=0;for(J=W.length;m<J;m++){G=W[m];v=G.color;if(G instanceof THREE.DirectionalLight){l=t.dot(G.position);if(!(l<=0)){l*=G.intensity;q.r+=v.r*l;q.g+=v.g*l;q.b+=v.b*l}}else if(G instanceof
-THREE.PointLight){l=t.dot(da.sub(G.position,x).normalize());if(!(l<=0)){l*=G.distance==0?1:1-Math.min(x.distanceTo(G.position)/G.distance,1);if(l!=0){l*=G.intensity;q.r+=v.r*l;q.g+=v.g*l;q.b+=v.b*l}}}}}function cb(m,x,t){a(t.opacity);b(t.blending);var q,J,G,v,l,W;if(t instanceof THREE.ParticleBasicMaterial){if(t.map){v=t.map.image;l=v.width>>1;W=v.height>>1;t=x.scale.x*i;G=x.scale.y*n;q=t*l;J=G*W;fa.set(m.x-q,m.y-J,m.x+q,m.y+J);if(Ba.instersects(fa)){j.save();j.translate(m.x,m.y);j.rotate(-x.rotation);
-j.scale(t,-G);j.translate(-l,-W);j.drawImage(v,0,0);j.restore()}}}else if(t instanceof THREE.ParticleCanvasMaterial){q=x.scale.x*i;J=x.scale.y*n;fa.set(m.x-q,m.y-J,m.x+q,m.y+J);if(Ba.instersects(fa)){c(t.color.__styleString);G=t.color.__styleString;if(z!=G)j.fillStyle=z=G;j.save();j.translate(m.x,m.y);j.rotate(-x.rotation);j.scale(q,J);t.program(j);j.restore()}}}function db(m,x,t,q){a(q.opacity);b(q.blending);j.beginPath();j.moveTo(m.positionScreen.x,m.positionScreen.y);j.lineTo(x.positionScreen.x,
-x.positionScreen.y);j.closePath();if(q instanceof THREE.LineBasicMaterial){B.__styleString=q.color.__styleString;m=q.linewidth;if(T!=m)j.lineWidth=T=m;m=q.linecap;if(U!=m)j.lineCap=U=m;m=q.linejoin;if(X!=m)j.lineJoin=X=m;c(B.__styleString);j.stroke();fa.inflate(q.linewidth*2)}}function Pa(m,x,t,q,J,G,v,l,W){d.data.vertices+=3;d.data.faces++;a(l.opacity);b(l.blending);w=m.positionScreen.x;u=m.positionScreen.y;H=x.positionScreen.x;M=x.positionScreen.y;P=t.positionScreen.x;I=t.positionScreen.y;Ka(w,
-u,H,M,P,I);if(l instanceof THREE.MeshBasicMaterial)if(l.map){if(l.map.mapping instanceof THREE.UVMapping){ca=v.uvs[0];sa(w,u,H,M,P,I,l.map.image,ca[q].u,ca[q].v,ca[J].u,ca[J].v,ca[G].u,ca[G].v)}}else if(l.envMap){if(l.envMap.mapping instanceof THREE.SphericalReflectionMapping){m=na.matrixWorldInverse;da.copy(v.vertexNormalsWorld[0]);Da=(da.x*m.n11+da.y*m.n12+da.z*m.n13)*0.5+0.5;wa=-(da.x*m.n21+da.y*m.n22+da.z*m.n23)*0.5+0.5;da.copy(v.vertexNormalsWorld[1]);Wa=(da.x*m.n11+da.y*m.n12+da.z*m.n13)*0.5+
-0.5;Xa=-(da.x*m.n21+da.y*m.n22+da.z*m.n23)*0.5+0.5;da.copy(v.vertexNormalsWorld[2]);Ya=(da.x*m.n11+da.y*m.n12+da.z*m.n13)*0.5+0.5;Za=-(da.x*m.n21+da.y*m.n22+da.z*m.n23)*0.5+0.5;sa(w,u,H,M,P,I,l.envMap.image,Da,wa,Wa,Xa,Ya,Za)}}else l.wireframe?xa(l.color.__styleString,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):ya(l.color.__styleString);else if(l instanceof THREE.MeshLambertMaterial){if(l.map&&!l.wireframe){if(l.map.mapping instanceof THREE.UVMapping){ca=v.uvs[0];sa(w,u,H,M,P,I,l.map.image,
-ca[q].u,ca[q].v,ca[J].u,ca[J].v,ca[G].u,ca[G].v)}b(THREE.SubtractiveBlending)}if(Ua)if(!l.wireframe&&l.shading==THREE.SmoothShading&&v.vertexNormalsWorld.length==3){Q.r=K.r=C.r=ga.r;Q.g=K.g=C.g=ga.g;Q.b=K.b=C.b=ga.b;ra(W,v.v1.positionWorld,v.vertexNormalsWorld[0],Q);ra(W,v.v2.positionWorld,v.vertexNormalsWorld[1],K);ra(W,v.v3.positionWorld,v.vertexNormalsWorld[2],C);Z.r=(K.r+C.r)*0.5;Z.g=(K.g+C.g)*0.5;Z.b=(K.b+C.b)*0.5;ja=Qa(Q,K,C,Z);sa(w,u,H,M,P,I,ja,0,0,1,0,0,1)}else{ha.r=ga.r;ha.g=ga.g;ha.b=ga.b;
-ra(W,v.centroidWorld,v.normalWorld,ha);B.r=l.color.r*ha.r;B.g=l.color.g*ha.g;B.b=l.color.b*ha.b;B.updateStyleString();l.wireframe?xa(B.__styleString,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):ya(B.__styleString)}else l.wireframe?xa(l.color.__styleString,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):ya(l.color.__styleString)}else if(l instanceof THREE.MeshDepthMaterial){ia=na.near;ma=na.far;Q.r=Q.g=Q.b=1-Ca(m.positionScreen.z,ia,ma);K.r=K.g=K.b=1-Ca(x.positionScreen.z,
-ia,ma);C.r=C.g=C.b=1-Ca(t.positionScreen.z,ia,ma);Z.r=(K.r+C.r)*0.5;Z.g=(K.g+C.g)*0.5;Z.b=(K.b+C.b)*0.5;ja=Qa(Q,K,C,Z);sa(w,u,H,M,P,I,ja,0,0,1,0,0,1)}else if(l instanceof THREE.MeshNormalMaterial){B.r=Fa(v.normalWorld.x);B.g=Fa(v.normalWorld.y);B.b=Fa(v.normalWorld.z);B.updateStyleString();l.wireframe?xa(B.__styleString,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):ya(B.__styleString)}}function $a(m,x,t,q,J,G,v,l,W){d.data.vertices+=4;d.data.faces++;a(l.opacity);b(l.blending);if(l.map||
-l.envMap){Pa(m,x,q,0,1,3,v,l,W);Pa(J,t,G,1,2,3,v,l,W)}else{w=m.positionScreen.x;u=m.positionScreen.y;H=x.positionScreen.x;M=x.positionScreen.y;P=t.positionScreen.x;I=t.positionScreen.y;E=q.positionScreen.x;O=q.positionScreen.y;S=J.positionScreen.x;V=J.positionScreen.y;F=G.positionScreen.x;Y=G.positionScreen.y;if(l instanceof THREE.MeshBasicMaterial){Ra(w,u,H,M,P,I,E,O);l.wireframe?xa(l.color.__styleString,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):ya(l.color.__styleString)}else if(l instanceof
-THREE.MeshLambertMaterial)if(Ua)if(!l.wireframe&&l.shading==THREE.SmoothShading&&v.vertexNormalsWorld.length==4){Q.r=K.r=C.r=Z.r=ga.r;Q.g=K.g=C.g=Z.g=ga.g;Q.b=K.b=C.b=Z.b=ga.b;ra(W,v.v1.positionWorld,v.vertexNormalsWorld[0],Q);ra(W,v.v2.positionWorld,v.vertexNormalsWorld[1],K);ra(W,v.v4.positionWorld,v.vertexNormalsWorld[3],C);ra(W,v.v3.positionWorld,v.vertexNormalsWorld[2],Z);ja=Qa(Q,K,C,Z);Ka(w,u,H,M,E,O);sa(w,u,H,M,E,O,ja,0,0,1,0,0,1);Ka(S,V,P,I,F,Y);sa(S,V,P,I,F,Y,ja,1,0,1,1,0,1)}else{ha.r=ga.r;
-ha.g=ga.g;ha.b=ga.b;ra(W,v.centroidWorld,v.normalWorld,ha);B.r=l.color.r*ha.r;B.g=l.color.g*ha.g;B.b=l.color.b*ha.b;B.updateStyleString();Ra(w,u,H,M,P,I,E,O);l.wireframe?xa(B.__styleString,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):ya(B.__styleString)}else{Ra(w,u,H,M,P,I,E,O);l.wireframe?xa(l.color.__styleString,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):ya(l.color.__styleString)}else if(l instanceof THREE.MeshNormalMaterial){B.r=Fa(v.normalWorld.x);B.g=Fa(v.normalWorld.y);
-B.b=Fa(v.normalWorld.z);B.updateStyleString();Ra(w,u,H,M,P,I,E,O);l.wireframe?xa(B.__styleString,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):ya(B.__styleString)}else if(l instanceof THREE.MeshDepthMaterial){ia=na.near;ma=na.far;Q.r=Q.g=Q.b=1-Ca(m.positionScreen.z,ia,ma);K.r=K.g=K.b=1-Ca(x.positionScreen.z,ia,ma);C.r=C.g=C.b=1-Ca(q.positionScreen.z,ia,ma);Z.r=Z.g=Z.b=1-Ca(t.positionScreen.z,ia,ma);ja=Qa(Q,K,C,Z);Ka(w,u,H,M,E,O);sa(w,u,H,M,E,O,ja,0,0,1,0,0,1);Ka(S,V,P,I,F,Y);sa(S,V,
-P,I,F,Y,ja,1,0,1,1,0,1)}}}function Ka(m,x,t,q,J,G){j.beginPath();j.moveTo(m,x);j.lineTo(t,q);j.lineTo(J,G);j.lineTo(m,x);j.closePath()}function Ra(m,x,t,q,J,G,v,l){j.beginPath();j.moveTo(m,x);j.lineTo(t,q);j.lineTo(J,G);j.lineTo(v,l);j.lineTo(m,x);j.closePath()}function xa(m,x,t,q){if(T!=x)j.lineWidth=T=x;if(U!=t)j.lineCap=U=t;if(X!=q)j.lineJoin=X=q;c(m);j.stroke();fa.inflate(x*2)}function ya(m){if(z!=m)j.fillStyle=z=m;j.fill()}function sa(m,x,t,q,J,G,v,l,W,ta,oa,ua,La){var qa,va;qa=v.width-1;va=
-v.height-1;l*=qa;W*=va;ta*=qa;oa*=va;ua*=qa;La*=va;t-=m;q-=x;J-=m;G-=x;ta-=l;oa-=W;ua-=l;La-=W;qa=ta*La-ua*oa;if(qa!=0){va=1/qa;qa=(La*t-oa*J)*va;oa=(La*q-oa*G)*va;t=(ta*J-ua*t)*va;q=(ta*G-ua*q)*va;m=m-qa*l-t*W;x=x-oa*l-q*W;j.save();j.transform(qa,oa,t,q,m,x);j.clip();j.drawImage(v,0,0);j.restore()}}function Qa(m,x,t,q){var J=~~(m.r*255),G=~~(m.g*255);m=~~(m.b*255);var v=~~(x.r*255),l=~~(x.g*255);x=~~(x.b*255);var W=~~(t.r*255),ta=~~(t.g*255);t=~~(t.b*255);var oa=~~(q.r*255),ua=~~(q.g*255);q=~~(q.b*
-255);la[0]=J<0?0:J>255?255:J;la[1]=G<0?0:G>255?255:G;la[2]=m<0?0:m>255?255:m;la[4]=v<0?0:v>255?255:v;la[5]=l<0?0:l>255?255:l;la[6]=x<0?0:x>255?255:x;la[8]=W<0?0:W>255?255:W;la[9]=ta<0?0:ta>255?255:ta;la[10]=t<0?0:t>255?255:t;la[12]=oa<0?0:oa>255?255:oa;la[13]=ua<0?0:ua>255?255:ua;la[14]=q<0?0:q>255?255:q;Ia.putImageData(Va,0,0);Oa.drawImage(Ha,0,0);return Ja}function Ca(m,x,t){m=(m-x)/(t-x);return m*m*(3-2*m)}function Fa(m){m=(m+1)*0.5;return m<0?0:m>1?1:m}function za(m,x){var t=x.x-m.x,q=x.y-m.y,
-J=1/Math.sqrt(t*t+q*q);t*=J;q*=J;x.x+=t;x.y+=q;m.x-=t;m.y-=q}var Sa,ab,N,pa,Aa,Ga,Ta,ea;this.autoClear?this.clear():j.setTransform(1,0,0,-1,i,n);d.data.vertices=0;d.data.faces=0;e=h.projectScene($,na,this.sortElements);(Ua=$.lights.length>0)&&bb($);Sa=0;for(ab=e.length;Sa<ab;Sa++){N=e[Sa];fa.empty();if(N instanceof THREE.RenderableParticle){s=N;s.x*=i;s.y*=n;pa=0;for(Aa=N.materials.length;pa<Aa;){ea=N.materials[pa++];ea.opacity!=0&&cb(s,N,ea,$)}}else if(N instanceof THREE.RenderableLine){s=N.v1;o=
-N.v2;s.positionScreen.x*=i;s.positionScreen.y*=n;o.positionScreen.x*=i;o.positionScreen.y*=n;fa.addPoint(s.positionScreen.x,s.positionScreen.y);fa.addPoint(o.positionScreen.x,o.positionScreen.y);if(Ba.instersects(fa)){pa=0;for(Aa=N.materials.length;pa<Aa;){ea=N.materials[pa++];ea.opacity!=0&&db(s,o,N,ea,$)}}}else if(N instanceof THREE.RenderableFace3){s=N.v1;o=N.v2;L=N.v3;s.positionScreen.x*=i;s.positionScreen.y*=n;o.positionScreen.x*=i;o.positionScreen.y*=n;L.positionScreen.x*=i;L.positionScreen.y*=
-n;if(N.overdraw){za(s.positionScreen,o.positionScreen);za(o.positionScreen,L.positionScreen);za(L.positionScreen,s.positionScreen)}fa.add3Points(s.positionScreen.x,s.positionScreen.y,o.positionScreen.x,o.positionScreen.y,L.positionScreen.x,L.positionScreen.y);if(Ba.instersects(fa)){pa=0;for(Aa=N.meshMaterials.length;pa<Aa;){ea=N.meshMaterials[pa++];if(ea instanceof THREE.MeshFaceMaterial){Ga=0;for(Ta=N.faceMaterials.length;Ga<Ta;)(ea=N.faceMaterials[Ga++])&&ea.opacity!=0&&Pa(s,o,L,0,1,2,N,ea,$)}else ea.opacity!=
-0&&Pa(s,o,L,0,1,2,N,ea,$)}}}else if(N instanceof THREE.RenderableFace4){s=N.v1;o=N.v2;L=N.v3;R=N.v4;s.positionScreen.x*=i;s.positionScreen.y*=n;o.positionScreen.x*=i;o.positionScreen.y*=n;L.positionScreen.x*=i;L.positionScreen.y*=n;R.positionScreen.x*=i;R.positionScreen.y*=n;aa.positionScreen.copy(o.positionScreen);ba.positionScreen.copy(R.positionScreen);if(N.overdraw){za(s.positionScreen,o.positionScreen);za(o.positionScreen,R.positionScreen);za(R.positionScreen,s.positionScreen);za(L.positionScreen,
-aa.positionScreen);za(L.positionScreen,ba.positionScreen)}fa.addPoint(s.positionScreen.x,s.positionScreen.y);fa.addPoint(o.positionScreen.x,o.positionScreen.y);fa.addPoint(L.positionScreen.x,L.positionScreen.y);fa.addPoint(R.positionScreen.x,R.positionScreen.y);if(Ba.instersects(fa)){pa=0;for(Aa=N.meshMaterials.length;pa<Aa;){ea=N.meshMaterials[pa++];if(ea instanceof THREE.MeshFaceMaterial){Ga=0;for(Ta=N.faceMaterials.length;Ga<Ta;)(ea=N.faceMaterials[Ga++])&&ea.opacity!=0&&$a(s,o,L,R,aa,ba,N,ea,
-$)}else ea.opacity!=0&&$a(s,o,L,R,aa,ba,N,ea,$)}}}ka.addRectangle(fa)}j.setTransform(1,0,0,1,0,0)}};
+THREE.Projector=function(){function a(){var C=h[i]=h[i]||new THREE.RenderableVertex;i++;return C}function b(C,A){return A.z-C.z}function c(C,A){var I=0,O=1,R=C.z+C.w,J=A.z+A.w,y=-C.z+C.w,F=-A.z+A.w;if(R>=0&&J>=0&&y>=0&&F>=0)return!0;else if(R<0&&J<0||y<0&&F<0)return!1;else{if(R<0)I=Math.max(I,R/(R-J));else J<0&&(O=Math.min(O,R/(R-J)));if(y<0)I=Math.max(I,y/(y-F));else F<0&&(O=Math.min(O,y/(y-F)));if(O<I)return!1;else{C.lerpSelf(A,I);A.lerpSelf(C,1-O);return!0}}}var d,e,g=[],f,i,h=[],j,p,n=[],o,k=
+[],t,w,D=[],x,W,X=[],aa=new THREE.Vector4,H=new THREE.Vector4,q=new THREE.Matrix4,B=new THREE.Matrix4,z=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],L=new THREE.Vector4,Y=new THREE.Vector4;this.projectVector=function(C,A){q.multiply(A.projectionMatrix,A.matrixWorldInverse);q.multiplyVector3(C);return C};this.unprojectVector=function(C,A){q.multiply(A.matrixWorld,THREE.Matrix4.makeInvert(A.projectionMatrix));q.multiplyVector3(C);return C};
+this.projectObjects=function(C,A,I){A=[];var O,R,J;e=0;R=C.objects;C=0;for(O=R.length;C<O;C++){J=R[C];var y;if(!(y=!J.visible))if(y=J instanceof THREE.Mesh){a:{y=void 0;for(var F=J.matrixWorld,Q=-J.geometry.boundingSphere.radius*Math.max(J.scale.x,Math.max(J.scale.y,J.scale.z)),S=0;S<6;S++){y=z[S].x*F.n14+z[S].y*F.n24+z[S].z*F.n34+z[S].w;if(y<=Q){y=!1;break a}}y=!0}y=!y}if(!y){y=g[e]=g[e]||new THREE.RenderableObject;e++;d=y;aa.copy(J.position);q.multiplyVector3(aa);d.object=J;d.z=aa.z;A.push(d)}}I&&
+A.sort(b);return A};this.projectScene=function(C,A,I){var O=[],R=A.near,J=A.far,y,F,Q,S,G,ba,Z,da,M,E,T,$,ea,oa,ia,ka,fa;W=w=o=p=0;A.matrixAutoUpdate&&A.update(undefined,!0);C.update(undefined,!1,A);q.multiply(A.projectionMatrix,A.matrixWorldInverse);z[0].set(q.n41-q.n11,q.n42-q.n12,q.n43-q.n13,q.n44-q.n14);z[1].set(q.n41+q.n11,q.n42+q.n12,q.n43+q.n13,q.n44+q.n14);z[2].set(q.n41+q.n21,q.n42+q.n22,q.n43+q.n23,q.n44+q.n24);z[3].set(q.n41-q.n21,q.n42-q.n22,q.n43-q.n23,q.n44-q.n24);z[4].set(q.n41-q.n31,
+q.n42-q.n32,q.n43-q.n33,q.n44-q.n34);z[5].set(q.n41+q.n31,q.n42+q.n32,q.n43+q.n33,q.n44+q.n34);for(y=0;y<6;y++){M=z[y];M.divideScalar(Math.sqrt(M.x*M.x+M.y*M.y+M.z*M.z))}M=this.projectObjects(C,A,!0);C=0;for(y=M.length;C<y;C++){E=M[C].object;if(E.visible){T=E.matrixWorld;$=E.matrixRotationWorld;ea=E.materials;oa=E.overdraw;i=0;if(E instanceof THREE.Mesh){ia=E.geometry;S=ia.vertices;ka=ia.faces;ia=ia.faceVertexUvs;F=0;for(Q=S.length;F<Q;F++){f=a();f.positionWorld.copy(S[F].position);T.multiplyVector3(f.positionWorld);
+f.positionScreen.copy(f.positionWorld);q.multiplyVector4(f.positionScreen);f.positionScreen.x/=f.positionScreen.w;f.positionScreen.y/=f.positionScreen.w;f.visible=f.positionScreen.z>R&&f.positionScreen.z<J}S=0;for(F=ka.length;S<F;S++){Q=ka[S];if(Q instanceof THREE.Face3){G=h[Q.a];ba=h[Q.b];Z=h[Q.c];if(G.visible&&ba.visible&&Z.visible&&(E.doubleSided||E.flipSided!=(Z.positionScreen.x-G.positionScreen.x)*(ba.positionScreen.y-G.positionScreen.y)-(Z.positionScreen.y-G.positionScreen.y)*(ba.positionScreen.x-
+G.positionScreen.x)<0)){da=n[p]=n[p]||new THREE.RenderableFace3;p++;j=da;j.v1.copy(G);j.v2.copy(ba);j.v3.copy(Z)}else continue}else if(Q instanceof THREE.Face4){G=h[Q.a];ba=h[Q.b];Z=h[Q.c];da=h[Q.d];if(G.visible&&ba.visible&&Z.visible&&da.visible&&(E.doubleSided||E.flipSided!=((da.positionScreen.x-G.positionScreen.x)*(ba.positionScreen.y-G.positionScreen.y)-(da.positionScreen.y-G.positionScreen.y)*(ba.positionScreen.x-G.positionScreen.x)<0||(ba.positionScreen.x-Z.positionScreen.x)*(da.positionScreen.y-
+Z.positionScreen.y)-(ba.positionScreen.y-Z.positionScreen.y)*(da.positionScreen.x-Z.positionScreen.x)<0))){fa=k[o]=k[o]||new THREE.RenderableFace4;o++;j=fa;j.v1.copy(G);j.v2.copy(ba);j.v3.copy(Z);j.v4.copy(da)}else continue}j.normalWorld.copy(Q.normal);$.multiplyVector3(j.normalWorld);j.centroidWorld.copy(Q.centroid);T.multiplyVector3(j.centroidWorld);j.centroidScreen.copy(j.centroidWorld);q.multiplyVector3(j.centroidScreen);Z=Q.vertexNormals;G=0;for(ba=Z.length;G<ba;G++){da=j.vertexNormalsWorld[G];
+da.copy(Z[G]);$.multiplyVector3(da)}G=0;for(ba=ia.length;G<ba;G++)if(fa=ia[G][S]){Z=0;for(da=fa.length;Z<da;Z++)j.uvs[G][Z]=fa[Z]}j.meshMaterials=ea;j.faceMaterials=Q.materials;j.overdraw=oa;j.z=j.centroidScreen.z;O.push(j)}}else if(E instanceof THREE.Line){B.multiply(q,T);S=E.geometry.vertices;G=a();G.positionScreen.copy(S[0].position);B.multiplyVector4(G.positionScreen);F=1;for(Q=S.length;F<Q;F++){G=a();G.positionScreen.copy(S[F].position);B.multiplyVector4(G.positionScreen);ba=h[i-2];L.copy(G.positionScreen);
+Y.copy(ba.positionScreen);if(c(L,Y)){L.multiplyScalar(1/L.w);Y.multiplyScalar(1/Y.w);T=D[w]=D[w]||new THREE.RenderableLine;w++;t=T;t.v1.positionScreen.copy(L);t.v2.positionScreen.copy(Y);t.z=Math.max(L.z,Y.z);t.materials=E.materials;O.push(t)}}}else if(E instanceof THREE.Particle){H.set(E.matrixWorld.n14,E.matrixWorld.n24,E.matrixWorld.n34,1);q.multiplyVector4(H);H.z/=H.w;if(H.z>0&&H.z<1){T=X[W]=X[W]||new THREE.RenderableParticle;W++;x=T;x.x=H.x/H.w;x.y=H.y/H.w;x.z=H.z;x.rotation=E.rotation.z;x.scale.x=
+E.scale.x*Math.abs(x.x-(H.x+A.projectionMatrix.n11)/(H.w+A.projectionMatrix.n14));x.scale.y=E.scale.y*Math.abs(x.y-(H.y+A.projectionMatrix.n22)/(H.w+A.projectionMatrix.n24));x.materials=E.materials;O.push(x)}}}}I&&O.sort(b);return O}};
+THREE.CanvasRenderer=function(){function a(U){if(D!=U)k.globalAlpha=D=U}function b(U){if(x!=U){switch(U){case THREE.NormalBlending:k.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:k.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:k.globalCompositeOperation="darker"}x=U}}function c(U){if(W!=U.hex){W=U.hex;k.strokeStyle="#"+e(W.toString(16))}}function d(U){if(X!=U.hex){X=U.hex;k.fillStyle="#"+e(X.toString(16))}}function e(U){for(;U.length<6;)U="0"+U;
+return U}var g=this,f=null,i=new THREE.Projector,h=document.createElement("canvas"),j,p,n,o,k=h.getContext("2d"),t=new THREE.Color(0),w=0,D=1,x=0,W=null,X=null,aa=null,H=null,q=null,B,z,L,Y,C=new THREE.RenderableVertex,A=new THREE.RenderableVertex,I,O,R,J,y,F,Q,S,G,ba,Z,da,M=new THREE.Color(0),E=new THREE.Color(0),T=new THREE.Color(0),$=new THREE.Color(0),ea=new THREE.Color(0),oa,ia,ka,fa,Wa,Xa,Ya,Za,$a,ab,Ca=new THREE.Rectangle,ma=new THREE.Rectangle,ha=new THREE.Rectangle,Ua=!1,la=new THREE.Color,
+ja=new THREE.Color,Ma=new THREE.Color,Na=new THREE.Color,ca=new THREE.Vector3,Ha,Ia,Va,na,Ja,Oa,Ea=16;Ha=document.createElement("canvas");Ha.width=Ha.height=2;Ia=Ha.getContext("2d");Ia.fillStyle="rgba(0,0,0,1)";Ia.fillRect(0,0,2,2);Va=Ia.getImageData(0,0,2,2);na=Va.data;Ja=document.createElement("canvas");Ja.width=Ja.height=Ea;Oa=Ja.getContext("2d");Oa.translate(-Ea/2,-Ea/2);Oa.scale(Ea,Ea);Ea--;this.domElement=h;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.data={vertices:0,faces:0};
+this.setSize=function(U,pa){j=U;p=pa;n=j/2;o=p/2;h.width=j;h.height=p;Ca.set(-n,-o,n,o);D=1;x=0;q=H=aa=X=W=null};this.setClearColor=function(U,pa){t=U;w=pa};this.setClearColorHex=function(U,pa){t.setHex(U);w=pa};this.clear=function(){k.setTransform(1,0,0,-1,n,o);if(!ma.isEmpty()){ma.inflate(1);ma.minSelf(Ca);if(t.hex==0&&w==0)k.clearRect(ma.getX(),ma.getY(),ma.getWidth(),ma.getHeight());else{b(THREE.NormalBlending);a(1);k.fillStyle="rgba("+Math.floor(t.r*255)+","+Math.floor(t.g*255)+","+Math.floor(t.b*
+255)+","+w+")";k.fillRect(ma.getX(),ma.getY(),ma.getWidth(),ma.getHeight())}ma.empty()}};this.render=function(U,pa){function db(m){var v,s,r,K=m.lights;ja.setRGB(0,0,0);Ma.setRGB(0,0,0);Na.setRGB(0,0,0);m=0;for(v=K.length;m<v;m++){s=K[m];r=s.color;if(s instanceof THREE.AmbientLight){ja.r+=r.r;ja.g+=r.g;ja.b+=r.b}else if(s instanceof THREE.DirectionalLight){Ma.r+=r.r;Ma.g+=r.g;Ma.b+=r.b}else if(s instanceof THREE.PointLight){Na.r+=r.r;Na.g+=r.g;Na.b+=r.b}}}function ta(m,v,s,r){var K,N,u,l,V=m.lights;
+m=0;for(K=V.length;m<K;m++){N=V[m];u=N.color;if(N instanceof THREE.DirectionalLight){l=s.dot(N.position);if(!(l<=0)){l*=N.intensity;r.r+=u.r*l;r.g+=u.g*l;r.b+=u.b*l}}else if(N instanceof THREE.PointLight){l=s.dot(ca.sub(N.position,v).normalize());if(!(l<=0)){l*=N.distance==0?1:1-Math.min(v.distanceTo(N.position)/N.distance,1);if(l!=0){l*=N.intensity;r.r+=u.r*l;r.g+=u.g*l;r.b+=u.b*l}}}}}function eb(m,v,s){a(s.opacity);b(s.blending);var r,K,N,u,l,V;if(s instanceof THREE.ParticleBasicMaterial){if(s.map){u=
+s.map.image;l=u.width>>1;V=u.height>>1;s=v.scale.x*n;N=v.scale.y*o;r=s*l;K=N*V;ha.set(m.x-r,m.y-K,m.x+r,m.y+K);if(Ca.instersects(ha)){k.save();k.translate(m.x,m.y);k.rotate(-v.rotation);k.scale(s,-N);k.translate(-l,-V);k.drawImage(u,0,0);k.restore()}}}else if(s instanceof THREE.ParticleCanvasMaterial){r=v.scale.x*n;K=v.scale.y*o;ha.set(m.x-r,m.y-K,m.x+r,m.y+K);if(Ca.instersects(ha)){c(s.color);d(s.color);k.save();k.translate(m.x,m.y);k.rotate(-v.rotation);k.scale(r,K);s.program(k);k.restore()}}}function fb(m,
+v,s,r){a(r.opacity);b(r.blending);k.beginPath();k.moveTo(m.positionScreen.x,m.positionScreen.y);k.lineTo(v.positionScreen.x,v.positionScreen.y);k.closePath();if(r instanceof THREE.LineBasicMaterial){m=r.linewidth;if(aa!=m)k.lineWidth=aa=m;m=r.linecap;if(H!=m)k.lineCap=H=m;m=r.linejoin;if(q!=m)k.lineJoin=q=m;c(r.color);k.stroke();ha.inflate(r.linewidth*2)}}function Pa(m,v,s,r,K,N,u,l,V){g.data.vertices+=3;g.data.faces++;a(l.opacity);b(l.blending);I=m.positionScreen.x;O=m.positionScreen.y;R=v.positionScreen.x;
+J=v.positionScreen.y;y=s.positionScreen.x;F=s.positionScreen.y;Ka(I,O,R,J,y,F);if(l instanceof THREE.MeshBasicMaterial)if(l.map){if(l.map.mapping instanceof THREE.UVMapping){fa=u.uvs[0];ua(I,O,R,J,y,F,l.map.image,fa[r].u,fa[r].v,fa[K].u,fa[K].v,fa[N].u,fa[N].v)}}else if(l.envMap){if(l.envMap.mapping instanceof THREE.SphericalReflectionMapping){m=pa.matrixWorldInverse;ca.copy(u.vertexNormalsWorld[0]);Wa=(ca.x*m.n11+ca.y*m.n12+ca.z*m.n13)*0.5+0.5;Xa=-(ca.x*m.n21+ca.y*m.n22+ca.z*m.n23)*0.5+0.5;ca.copy(u.vertexNormalsWorld[1]);
+Ya=(ca.x*m.n11+ca.y*m.n12+ca.z*m.n13)*0.5+0.5;Za=-(ca.x*m.n21+ca.y*m.n22+ca.z*m.n23)*0.5+0.5;ca.copy(u.vertexNormalsWorld[2]);$a=(ca.x*m.n11+ca.y*m.n12+ca.z*m.n13)*0.5+0.5;ab=-(ca.x*m.n21+ca.y*m.n22+ca.z*m.n23)*0.5+0.5;ua(I,O,R,J,y,F,l.envMap.image,Wa,Xa,Ya,Za,$a,ab)}}else l.wireframe?ya(l.color,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):za(l.color);else if(l instanceof THREE.MeshLambertMaterial){if(l.map&&!l.wireframe){if(l.map.mapping instanceof THREE.UVMapping){fa=u.uvs[0];ua(I,
+O,R,J,y,F,l.map.image,fa[r].u,fa[r].v,fa[K].u,fa[K].v,fa[N].u,fa[N].v)}b(THREE.SubtractiveBlending)}if(Ua)if(!l.wireframe&&l.shading==THREE.SmoothShading&&u.vertexNormalsWorld.length==3){E.r=T.r=$.r=ja.r;E.g=T.g=$.g=ja.g;E.b=T.b=$.b=ja.b;ta(V,u.v1.positionWorld,u.vertexNormalsWorld[0],E);ta(V,u.v2.positionWorld,u.vertexNormalsWorld[1],T);ta(V,u.v3.positionWorld,u.vertexNormalsWorld[2],$);ea.r=(T.r+$.r)*0.5;ea.g=(T.g+$.g)*0.5;ea.b=(T.b+$.b)*0.5;ka=Qa(E,T,$,ea);ua(I,O,R,J,y,F,ka,0,0,1,0,0,1)}else{la.r=
+ja.r;la.g=ja.g;la.b=ja.b;ta(V,u.centroidWorld,u.normalWorld,la);M.r=Math.max(0,Math.min(l.color.r*la.r,1));M.g=Math.max(0,Math.min(l.color.g*la.g,1));M.b=Math.max(0,Math.min(l.color.b*la.b,1));M.updateHex();l.wireframe?ya(M,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):za(M)}else l.wireframe?ya(l.color,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):za(l.color)}else if(l instanceof THREE.MeshDepthMaterial){oa=pa.near;ia=pa.far;E.r=E.g=E.b=1-Da(m.positionScreen.z,oa,ia);
+T.r=T.g=T.b=1-Da(v.positionScreen.z,oa,ia);$.r=$.g=$.b=1-Da(s.positionScreen.z,oa,ia);ea.r=(T.r+$.r)*0.5;ea.g=(T.g+$.g)*0.5;ea.b=(T.b+$.b)*0.5;ka=Qa(E,T,$,ea);ua(I,O,R,J,y,F,ka,0,0,1,0,0,1)}else if(l instanceof THREE.MeshNormalMaterial){M.r=Fa(u.normalWorld.x);M.g=Fa(u.normalWorld.y);M.b=Fa(u.normalWorld.z);M.updateHex();l.wireframe?ya(M,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):za(M)}}function bb(m,v,s,r,K,N,u,l,V){g.data.vertices+=4;g.data.faces++;a(l.opacity);b(l.blending);if(l.map||
+l.envMap){Pa(m,v,r,0,1,3,u,l,V);Pa(K,s,N,1,2,3,u,l,V)}else{I=m.positionScreen.x;O=m.positionScreen.y;R=v.positionScreen.x;J=v.positionScreen.y;y=s.positionScreen.x;F=s.positionScreen.y;Q=r.positionScreen.x;S=r.positionScreen.y;G=K.positionScreen.x;ba=K.positionScreen.y;Z=N.positionScreen.x;da=N.positionScreen.y;if(l instanceof THREE.MeshBasicMaterial){Ra(I,O,R,J,y,F,Q,S);l.wireframe?ya(l.color,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):za(l.color)}else if(l instanceof THREE.MeshLambertMaterial)if(Ua)if(!l.wireframe&&
+l.shading==THREE.SmoothShading&&u.vertexNormalsWorld.length==4){E.r=T.r=$.r=ea.r=ja.r;E.g=T.g=$.g=ea.g=ja.g;E.b=T.b=$.b=ea.b=ja.b;ta(V,u.v1.positionWorld,u.vertexNormalsWorld[0],E);ta(V,u.v2.positionWorld,u.vertexNormalsWorld[1],T);ta(V,u.v4.positionWorld,u.vertexNormalsWorld[3],$);ta(V,u.v3.positionWorld,u.vertexNormalsWorld[2],ea);ka=Qa(E,T,$,ea);Ka(I,O,R,J,Q,S);ua(I,O,R,J,Q,S,ka,0,0,1,0,0,1);Ka(G,ba,y,F,Z,da);ua(G,ba,y,F,Z,da,ka,1,0,1,1,0,1)}else{la.r=ja.r;la.g=ja.g;la.b=ja.b;ta(V,u.centroidWorld,
+u.normalWorld,la);M.r=Math.max(0,Math.min(l.color.r*la.r,1));M.g=Math.max(0,Math.min(l.color.g*la.g,1));M.b=Math.max(0,Math.min(l.color.b*la.b,1));M.updateHex();Ra(I,O,R,J,y,F,Q,S);l.wireframe?ya(M,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):za(M)}else{Ra(I,O,R,J,y,F,Q,S);l.wireframe?ya(l.color,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):za(l.color)}else if(l instanceof THREE.MeshNormalMaterial){M.r=Fa(u.normalWorld.x);M.g=Fa(u.normalWorld.y);M.b=Fa(u.normalWorld.z);
+M.updateHex();Ra(I,O,R,J,y,F,Q,S);l.wireframe?ya(M,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):za(M)}else if(l instanceof THREE.MeshDepthMaterial){oa=pa.near;ia=pa.far;E.r=E.g=E.b=1-Da(m.positionScreen.z,oa,ia);T.r=T.g=T.b=1-Da(v.positionScreen.z,oa,ia);$.r=$.g=$.b=1-Da(r.positionScreen.z,oa,ia);ea.r=ea.g=ea.b=1-Da(s.positionScreen.z,oa,ia);ka=Qa(E,T,$,ea);Ka(I,O,R,J,Q,S);ua(I,O,R,J,Q,S,ka,0,0,1,0,0,1);Ka(G,ba,y,F,Z,da);ua(G,ba,y,F,Z,da,ka,1,0,1,1,0,1)}}}function Ka(m,v,s,r,K,N){k.beginPath();
+k.moveTo(m,v);k.lineTo(s,r);k.lineTo(K,N);k.lineTo(m,v);k.closePath()}function Ra(m,v,s,r,K,N,u,l){k.beginPath();k.moveTo(m,v);k.lineTo(s,r);k.lineTo(K,N);k.lineTo(u,l);k.lineTo(m,v);k.closePath()}function ya(m,v,s,r){if(aa!=v)k.lineWidth=aa=v;if(H!=s)k.lineCap=H=s;if(q!=r)k.lineJoin=q=r;c(m);k.stroke();ha.inflate(v*2)}function za(m){d(m);k.fill()}function ua(m,v,s,r,K,N,u,l,V,va,qa,wa,La){var sa,xa;sa=u.width-1;xa=u.height-1;l*=sa;V*=xa;va*=sa;qa*=xa;wa*=sa;La*=xa;s-=m;r-=v;K-=m;N-=v;va-=l;qa-=V;
+wa-=l;La-=V;sa=va*La-wa*qa;if(sa!=0){xa=1/sa;sa=(La*s-qa*K)*xa;qa=(La*r-qa*N)*xa;s=(va*K-wa*s)*xa;r=(va*N-wa*r)*xa;m=m-sa*l-s*V;v=v-qa*l-r*V;k.save();k.transform(sa,qa,s,r,m,v);k.clip();k.drawImage(u,0,0);k.restore()}}function Qa(m,v,s,r){var K=~~(m.r*255),N=~~(m.g*255);m=~~(m.b*255);var u=~~(v.r*255),l=~~(v.g*255);v=~~(v.b*255);var V=~~(s.r*255),va=~~(s.g*255);s=~~(s.b*255);var qa=~~(r.r*255),wa=~~(r.g*255);r=~~(r.b*255);na[0]=K<0?0:K>255?255:K;na[1]=N<0?0:N>255?255:N;na[2]=m<0?0:m>255?255:m;na[4]=
+u<0?0:u>255?255:u;na[5]=l<0?0:l>255?255:l;na[6]=v<0?0:v>255?255:v;na[8]=V<0?0:V>255?255:V;na[9]=va<0?0:va>255?255:va;na[10]=s<0?0:s>255?255:s;na[12]=qa<0?0:qa>255?255:qa;na[13]=wa<0?0:wa>255?255:wa;na[14]=r<0?0:r>255?255:r;Ia.putImageData(Va,0,0);Oa.drawImage(Ha,0,0);return Ja}function Da(m,v,s){m=(m-v)/(s-v);return m*m*(3-2*m)}function Fa(m){m=(m+1)*0.5;return m<0?0:m>1?1:m}function Aa(m,v){var s=v.x-m.x,r=v.y-m.y,K=1/Math.sqrt(s*s+r*r);s*=K;r*=K;v.x+=s;v.y+=r;m.x-=s;m.y-=r}var Sa,cb,P,ra,Ba,Ga,
+Ta,ga;this.autoClear?this.clear():k.setTransform(1,0,0,-1,n,o);g.data.vertices=0;g.data.faces=0;f=i.projectScene(U,pa,this.sortElements);(Ua=U.lights.length>0)&&db(U);Sa=0;for(cb=f.length;Sa<cb;Sa++){P=f[Sa];ha.empty();if(P instanceof THREE.RenderableParticle){B=P;B.x*=n;B.y*=o;ra=0;for(Ba=P.materials.length;ra<Ba;){ga=P.materials[ra++];ga.opacity!=0&&eb(B,P,ga,U)}}else if(P instanceof THREE.RenderableLine){B=P.v1;z=P.v2;B.positionScreen.x*=n;B.positionScreen.y*=o;z.positionScreen.x*=n;z.positionScreen.y*=
+o;ha.addPoint(B.positionScreen.x,B.positionScreen.y);ha.addPoint(z.positionScreen.x,z.positionScreen.y);if(Ca.instersects(ha)){ra=0;for(Ba=P.materials.length;ra<Ba;){ga=P.materials[ra++];ga.opacity!=0&&fb(B,z,P,ga,U)}}}else if(P instanceof THREE.RenderableFace3){B=P.v1;z=P.v2;L=P.v3;B.positionScreen.x*=n;B.positionScreen.y*=o;z.positionScreen.x*=n;z.positionScreen.y*=o;L.positionScreen.x*=n;L.positionScreen.y*=o;if(P.overdraw){Aa(B.positionScreen,z.positionScreen);Aa(z.positionScreen,L.positionScreen);
+Aa(L.positionScreen,B.positionScreen)}ha.add3Points(B.positionScreen.x,B.positionScreen.y,z.positionScreen.x,z.positionScreen.y,L.positionScreen.x,L.positionScreen.y);if(Ca.instersects(ha)){ra=0;for(Ba=P.meshMaterials.length;ra<Ba;){ga=P.meshMaterials[ra++];if(ga instanceof THREE.MeshFaceMaterial){Ga=0;for(Ta=P.faceMaterials.length;Ga<Ta;)(ga=P.faceMaterials[Ga++])&&ga.opacity!=0&&Pa(B,z,L,0,1,2,P,ga,U)}else ga.opacity!=0&&Pa(B,z,L,0,1,2,P,ga,U)}}}else if(P instanceof THREE.RenderableFace4){B=P.v1;
+z=P.v2;L=P.v3;Y=P.v4;B.positionScreen.x*=n;B.positionScreen.y*=o;z.positionScreen.x*=n;z.positionScreen.y*=o;L.positionScreen.x*=n;L.positionScreen.y*=o;Y.positionScreen.x*=n;Y.positionScreen.y*=o;C.positionScreen.copy(z.positionScreen);A.positionScreen.copy(Y.positionScreen);if(P.overdraw){Aa(B.positionScreen,z.positionScreen);Aa(z.positionScreen,Y.positionScreen);Aa(Y.positionScreen,B.positionScreen);Aa(L.positionScreen,C.positionScreen);Aa(L.positionScreen,A.positionScreen)}ha.addPoint(B.positionScreen.x,
+B.positionScreen.y);ha.addPoint(z.positionScreen.x,z.positionScreen.y);ha.addPoint(L.positionScreen.x,L.positionScreen.y);ha.addPoint(Y.positionScreen.x,Y.positionScreen.y);if(Ca.instersects(ha)){ra=0;for(Ba=P.meshMaterials.length;ra<Ba;){ga=P.meshMaterials[ra++];if(ga instanceof THREE.MeshFaceMaterial){Ga=0;for(Ta=P.faceMaterials.length;Ga<Ta;)(ga=P.faceMaterials[Ga++])&&ga.opacity!=0&&bb(B,z,L,Y,C,A,P,ga,U)}else ga.opacity!=0&&bb(B,z,L,Y,C,A,P,ga,U)}}}ma.addRectangle(ha)}k.setTransform(1,0,0,1,
+0,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(a,b,c){c&&a.update(undefined,!1,b);c=a.sounds;var d,e=c.length;for(d=0;d<e;d++){a=c[d];this.soundPosition.set(a.matrixWorld.n14,a.matrixWorld.n24,a.matrixWorld.n34);this.soundPosition.subSelf(b.position);if(a.isPlaying&&a.isLoaded){a.isAddedToDOM||a.addToDOM(this.domElement);a.calculateVolumeAndPan(this.soundPosition)}}}};
 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(a,b,c){c&&a.update(undefined,!1,b);c=a.sounds;var d,e=c.length;for(d=0;d<e;d++){a=c[d];this.soundPosition.set(a.matrixWorld.n14,a.matrixWorld.n24,a.matrixWorld.n34);this.soundPosition.subSelf(b.position);if(a.isPlaying&&a.isLoaded){a.isAddedToDOM||a.addToDOM(this.domElement);a.calculateVolumeAndPan(this.soundPosition)}}}};
 THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};THREE.RenderableVertex.prototype.copy=function(a){this.positionWorld.copy(a.positionWorld);this.positionScreen.copy(a.positionScreen)};
 THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};THREE.RenderableVertex.prototype.copy=function(a){this.positionWorld.copy(a.positionWorld);this.positionScreen.copy(a.positionScreen)};
 THREE.RenderableFace3=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[[]];this.z=null};
 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};

+ 2 - 3
build/custom/ThreeDOM.js

@@ -1,8 +1,7 @@
 // ThreeDOM.js r40 - http://github.com/mrdoob/three.js
 // ThreeDOM.js r40 - http://github.com/mrdoob/three.js
 var THREE=THREE||{};if(!window.Int32Array){window.Int32Array=Array;window.Float32Array=Array}THREE.Color=function(a){this.setHex(a)};
 var THREE=THREE||{};if(!window.Int32Array){window.Int32Array=Array;window.Float32Array=Array}THREE.Color=function(a){this.setHex(a)};
-THREE.Color.prototype={autoUpdate:!0,copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;this.hex=a.hex;this.__styleString=a.__styleString},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,b,c){var d,e,h,f,j,g;if(c==0)d=e=h=0;else{f=Math.floor(a*6);j=a*6-f;a=c*(1-b);g=c*(1-b*j);b=c*(1-b*(1-j));switch(f){case 1:d=g;e=c;h=a;break;case 2:d=a;e=c;h=b;break;case 3:d=a;e=g;h=c;break;case 4:d=b;e=a;h=c;break;case 5:d=c;e=a;
-h=g;break;case 6:case 0:d=c;e=b;h=a}}this.r=d;this.g=e;this.b=h;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGB();this.updateStyleString()}},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},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+","+~~(this.g*
-255)+","+~~(this.b*255)+")"},clone:function(){return new THREE.Color(this.hex)}};THREE.Vector2=function(a,b){this.set(a||0,b||0)};
+THREE.Color.prototype={copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;this.hex=a.hex},setHex:function(a){this.hex=~~a&16777215;this.updateRGB()},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;this.updateHex()},setHSV:function(a,b,c){var d,e,h,f,j,g;if(c==0)d=e=h=0;else{f=Math.floor(a*6);j=a*6-f;a=c*(1-b);g=c*(1-b*j);b=c*(1-b*(1-j));switch(f){case 1:d=g;e=c;h=a;break;case 2:d=a;e=c;h=b;break;case 3:d=a;e=g;h=c;break;case 4:d=b;e=a;h=c;break;case 5:d=c;e=a;h=g;break;case 6:case 0:d=c;e=b;h=a}}this.setRGB(d,
+e,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(a,b){this.set(a||0,b||0)};
 THREE.Vector2.prototype={set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.set(a.x,a.y);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a);return this},negate:function(){this.set(-this.x,-this.y);return this},unit:function(){this.multiplyScalar(1/
 THREE.Vector2.prototype={set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.set(a.x,a.y);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a);return this},negate:function(){this.set(-this.x,-this.y);return this},unit:function(){this.multiplyScalar(1/
 this.length());return this},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y},clone:function(){return new THREE.Vector2(this.x,this.y)}};THREE.Vector3=function(a,b,c){this.set(a||0,b||0,c||0)};
 this.length());return this},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y},clone:function(){return new THREE.Vector2(this.x,this.y)}};THREE.Vector3=function(a,b,c){this.set(a||0,b||0,c||0)};
 THREE.Vector3.prototype={set:function(a,b,c){this.x=a;this.y=b;this.z=c;return this},copy:function(a){this.set(a.x,a.y,a.z);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z);return this},addScalar:function(a){this.set(this.x+a,this.y+a,this.z+a);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z);return this},cross:function(a,
 THREE.Vector3.prototype={set:function(a,b,c){this.x=a;this.y=b;this.z=c;return this},copy:function(a){this.set(a.x,a.y,a.z);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z);return this},addScalar:function(a){this.set(this.x+a,this.y+a,this.z+a);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z);return this},cross:function(a,

+ 21 - 21
build/custom/ThreeExtras.js

@@ -72,7 +72,7 @@ this.matrix.n23*u;this.position.z-=this.matrix.n33*u};this.rotateHorizontally=fu
 function(u){n=(u.clientX-A)/window.innerWidth;v=(u.clientY-w)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(u){u.preventDefault();u.stopPropagation();switch(u.button){case 0:k=1;break;case 2:k=-1}},!1);this.domElement.addEventListener("mouseup",function(u){u.preventDefault();u.stopPropagation();switch(u.button){case 0:k=0;break;case 2:k=0}},!1);this.domElement.addEventListener("keydown",function(u){switch(u.keyCode){case 38:case 87:k=1;break;case 37:case 65:m=-1;break;
 function(u){n=(u.clientX-A)/window.innerWidth;v=(u.clientY-w)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(u){u.preventDefault();u.stopPropagation();switch(u.button){case 0:k=1;break;case 2:k=-1}},!1);this.domElement.addEventListener("mouseup",function(u){u.preventDefault();u.stopPropagation();switch(u.button){case 0:k=0;break;case 2:k=0}},!1);this.domElement.addEventListener("keydown",function(u){switch(u.keyCode){case 38:case 87:k=1;break;case 37:case 65:m=-1;break;
 case 40:case 83:k=-1;break;case 39:case 68:m=1;break;case 81:j=!0;l=1;break;case 69:j=!0;l=-1;break;case 82:p=1;break;case 70:p=-1}},!1);this.domElement.addEventListener("keyup",function(u){switch(u.keyCode){case 38:case 87:k=0;break;case 37:case 65:m=0;break;case 40:case 83:k=0;break;case 39:case 68:m=0;break;case 81:j=!1;break;case 69:j=!1;break;case 82:p=0;break;case 70:p=0}},!1)};THREE.RollCamera.prototype=new THREE.Camera;THREE.RollCamera.prototype.constructor=THREE.RollCamera;
 case 40:case 83:k=-1;break;case 39:case 68:m=1;break;case 81:j=!0;l=1;break;case 69:j=!0;l=-1;break;case 82:p=1;break;case 70:p=-1}},!1);this.domElement.addEventListener("keyup",function(u){switch(u.keyCode){case 38:case 87:k=0;break;case 37:case 65:m=0;break;case 40:case 83:k=0;break;case 39:case 68:m=0;break;case 81:j=!1;break;case 69:j=!1;break;case 82:p=0;break;case 70:p=0}},!1)};THREE.RollCamera.prototype=new THREE.Camera;THREE.RollCamera.prototype.constructor=THREE.RollCamera;
 THREE.RollCamera.prototype.supr=THREE.Camera.prototype;
 THREE.RollCamera.prototype.supr=THREE.Camera.prototype;
-THREE.Cube=function(a,c,b,e,f,d,g,h,j){function l(w,u,y,o,z,B,I,K){var J,G,D=e||1,L=f||1,R=z/2,O=B/2,S=k.vertices.length;if(w=="x"&&u=="y"||w=="y"&&u=="x")J="z";else if(w=="x"&&u=="z"||w=="z"&&u=="x"){J="y";L=d||1}else if(w=="z"&&u=="y"||w=="y"&&u=="z"){J="x";D=d||1}var P=D+1,F=L+1;z/=D;var M=B/L;for(G=0;G<F;G++)for(B=0;B<P;B++){var Q=new THREE.Vector3;Q[w]=(B*z-R)*y;Q[u]=(G*M-O)*o;Q[J]=I;k.vertices.push(new THREE.Vertex(Q))}for(G=0;G<L;G++)for(B=0;B<D;B++){k.faces.push(new THREE.Face4(B+P*G+S,B+
+THREE.Cube=function(a,c,b,e,f,d,g,h,j){function l(w,u,y,o,z,B,I,K){var J,G,D=e||1,L=f||1,R=z/2,O=B/2,S=k.vertices.length;if(w=="x"&&u=="y"||w=="y"&&u=="x")J="z";else if(w=="x"&&u=="z"||w=="z"&&u=="x"){J="y";L=d||1}else if(w=="z"&&u=="y"||w=="y"&&u=="z"){J="x";D=d||1}var P=D+1,F=L+1;z/=D;var N=B/L;for(G=0;G<F;G++)for(B=0;B<P;B++){var Q=new THREE.Vector3;Q[w]=(B*z-R)*y;Q[u]=(G*N-O)*o;Q[J]=I;k.vertices.push(new THREE.Vertex(Q))}for(G=0;G<L;G++)for(B=0;B<D;B++){k.faces.push(new THREE.Face4(B+P*G+S,B+
 P*(G+1)+S,B+1+P*(G+1)+S,B+1+P*G+S,null,null,K));k.faceVertexUvs[0].push([new THREE.UV(B/D,G/L),new THREE.UV(B/D,(G+1)/L),new THREE.UV((B+1)/D,(G+1)/L),new THREE.UV((B+1)/D,G/L)])}}THREE.Geometry.call(this);var k=this,m=a/2,p=c/2,n=b/2;h=h?-1:1;if(g!==undefined)if(g instanceof Array)this.materials=g;else{this.materials=[];for(var v=0;v<6;v++)this.materials.push([g])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(j!=undefined)for(var A in j)this.sides[A]!=undefined&&(this.sides[A]=
 P*(G+1)+S,B+1+P*(G+1)+S,B+1+P*G+S,null,null,K));k.faceVertexUvs[0].push([new THREE.UV(B/D,G/L),new THREE.UV(B/D,(G+1)/L),new THREE.UV((B+1)/D,(G+1)/L),new THREE.UV((B+1)/D,G/L)])}}THREE.Geometry.call(this);var k=this,m=a/2,p=c/2,n=b/2;h=h?-1:1;if(g!==undefined)if(g instanceof Array)this.materials=g;else{this.materials=[];for(var v=0;v<6;v++)this.materials.push([g])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(j!=undefined)for(var A in j)this.sides[A]!=undefined&&(this.sides[A]=
 j[A]);this.sides.px&&l("z","y",1*h,-1,b,c,-m,this.materials[0]);this.sides.nx&&l("z","y",-1*h,-1,b,c,m,this.materials[1]);this.sides.py&&l("x","z",1*h,1,a,b,p,this.materials[2]);this.sides.ny&&l("x","z",1*h,-1,a,b,-p,this.materials[3]);this.sides.pz&&l("x","y",1*h,-1,a,c,n,this.materials[4]);this.sides.nz&&l("x","y",-1*h,-1,a,c,-n,this.materials[5]);(function(){for(var w=[],u=[],y=0,o=k.vertices.length;y<o;y++){for(var z=k.vertices[y],B=!1,I=0,K=w.length;I<K;I++){var J=w[I];if(z.position.x==J.position.x&&
 j[A]);this.sides.px&&l("z","y",1*h,-1,b,c,-m,this.materials[0]);this.sides.nx&&l("z","y",-1*h,-1,b,c,m,this.materials[1]);this.sides.py&&l("x","z",1*h,1,a,b,p,this.materials[2]);this.sides.ny&&l("x","z",1*h,-1,a,b,-p,this.materials[3]);this.sides.pz&&l("x","y",1*h,-1,a,c,n,this.materials[4]);this.sides.nz&&l("x","y",-1*h,-1,a,c,-n,this.materials[5]);(function(){for(var w=[],u=[],y=0,o=k.vertices.length;y<o;y++){for(var z=k.vertices[y],B=!1,I=0,K=w.length;I<K;I++){var J=w[I];if(z.position.x==J.position.x&&
 z.position.y==J.position.y&&z.position.z==J.position.z){u[y]=I;B=!0;break}}if(!B){u[y]=w.length;w.push(new THREE.Vertex(z.position.clone()))}}y=0;for(o=k.faces.length;y<o;y++){z=k.faces[y];z.a=u[z.a];z.b=u[z.b];z.c=u[z.c];z.d=u[z.d]}k.vertices=w})();this.computeCentroids();this.computeFaceNormals()};THREE.Cube.prototype=new THREE.Geometry;THREE.Cube.prototype.constructor=THREE.Cube;
 z.position.y==J.position.y&&z.position.z==J.position.z){u[y]=I;B=!0;break}}if(!B){u[y]=w.length;w.push(new THREE.Vertex(z.position.clone()))}}y=0;for(o=k.faces.length;y<o;y++){z=k.faces[y];z.a=u[z.a];z.b=u[z.b];z.c=u[z.c];z.d=u[z.d]}k.vertices=w})();this.computeCentroids();this.computeFaceNormals()};THREE.Cube.prototype=new THREE.Geometry;THREE.Cube.prototype.constructor=THREE.Cube;
@@ -101,20 +101,20 @@ Math.LN2));h.image.width=k;h.image.height=m;h.image.getContext("2d").drawImage(t
 "Multiply")d.blending=THREE.MultiplyBlending;if(a.transparent!==undefined||a.opacity<1)d.transparent=a.transparent;if(a.depthTest!==undefined)d.depthTest=a.depthTest;if(a.vertexColors!==undefined)if(a.vertexColors=="face")d.vertexColors=THREE.FaceColors;else if(a.vertexColors)d.vertexColors=THREE.VertexColors;if(a.mapDiffuse&&c){g=document.createElement("canvas");d.map=new THREE.Texture(g);d.map.sourceFile=a.mapDiffuse;e(d.map,c+"/"+a.mapDiffuse)}else if(a.colorDiffuse){g=(a.colorDiffuse[0]*255<<
 "Multiply")d.blending=THREE.MultiplyBlending;if(a.transparent!==undefined||a.opacity<1)d.transparent=a.transparent;if(a.depthTest!==undefined)d.depthTest=a.depthTest;if(a.vertexColors!==undefined)if(a.vertexColors=="face")d.vertexColors=THREE.FaceColors;else if(a.vertexColors)d.vertexColors=THREE.VertexColors;if(a.mapDiffuse&&c){g=document.createElement("canvas");d.map=new THREE.Texture(g);d.map.sourceFile=a.mapDiffuse;e(d.map,c+"/"+a.mapDiffuse)}else if(a.colorDiffuse){g=(a.colorDiffuse[0]*255<<
 16)+(a.colorDiffuse[1]*255<<8)+a.colorDiffuse[2]*255;d.color=g;d.opacity=a.transparency}else if(a.DbgColor)d.color=a.DbgColor;if(a.mapLightmap&&c){g=document.createElement("canvas");d.lightMap=new THREE.Texture(g);d.lightMap.sourceFile=a.mapLightmap;e(d.lightMap,c+"/"+a.mapLightmap)}return new THREE[f](d)}};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;
 16)+(a.colorDiffuse[1]*255<<8)+a.colorDiffuse[2]*255;d.color=g;d.opacity=a.transparency}else if(a.DbgColor)d.color=a.DbgColor;if(a.mapLightmap&&c){g=document.createElement("canvas");d.lightMap=new THREE.Texture(g);d.lightMap.sourceFile=a.mapLightmap;e(d.lightMap,c+"/"+a.mapLightmap)}return new THREE[f](d)}};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 c=this,b=a.model,e=a.callback,f=a.texture_path?a.texture_path:this.extractUrlbase(b);a=new Worker(b);a.onmessage=function(d){c.createModel(d.data,e,f);c.onLoadComplete()};this.onLoadStart();a.postMessage((new Date).getTime())};
 THREE.JSONLoader.prototype.load=function(a){var c=this,b=a.model,e=a.callback,f=a.texture_path?a.texture_path:this.extractUrlbase(b);a=new Worker(b);a.onmessage=function(d){c.createModel(d.data,e,f);c.onLoadComplete()};this.onLoadStart();a.postMessage((new Date).getTime())};
-THREE.JSONLoader.prototype.createModel=function(a,c,b){var e=new THREE.Geometry,f=a.scale!==undefined?a.scale:1;this.init_materials(e,a.materials,b);(function(d){if(a.version===undefined||a.version!=2)console.error("Deprecated file format.");else{var g,h,j,l,k,m,p,n,v,A,w,u,y,o,z=a.faces;m=a.vertices;var B=a.normals,I=a.colors,K=0;for(g=0;g<a.uvs.length;g++)a.uvs[g].length&&K++;for(g=0;g<K;g++){e.faceUvs[g]=[];e.faceVertexUvs[g]=[]}l=0;for(k=m.length;l<k;){p=new THREE.Vertex;p.position.x=m[l++]/d;
-p.position.y=m[l++]/d;p.position.z=m[l++]/d;e.vertices.push(p)}l=0;for(k=z.length;l<k;){d=z[l++];m=d&1;j=d&2;g=d&4;h=d&8;n=d&16;p=d&32;A=d&64;d&=128;if(m){w=new THREE.Face4;w.a=z[l++];w.b=z[l++];w.c=z[l++];w.d=z[l++];m=4}else{w=new THREE.Face3;w.a=z[l++];w.b=z[l++];w.c=z[l++];m=3}if(j){j=z[l++];w.materials=e.materials[j]}j=e.faces.length;if(g)for(g=0;g<K;g++){u=a.uvs[g];v=z[l++];o=u[v*2];v=u[v*2+1];e.faceUvs[g][j]=new THREE.UV(o,v)}if(h)for(g=0;g<K;g++){u=a.uvs[g];y=[];for(h=0;h<m;h++){v=z[l++];o=
-u[v*2];v=u[v*2+1];y[h]=new THREE.UV(o,v)}e.faceVertexUvs[g][j]=y}if(n){n=z[l++]*3;h=new THREE.Vector3;h.x=B[n++];h.y=B[n++];h.z=B[n];w.normal=h}if(p)for(g=0;g<m;g++){n=z[l++]*3;h=new THREE.Vector3;h.x=B[n++];h.y=B[n++];h.z=B[n];w.vertexNormals.push(h)}if(A){p=z[l++];p=new THREE.Color(I[p]);w.color=p}if(d)for(g=0;g<m;g++){p=z[l++];p=new THREE.Color(I[p]);w.vertexColors.push(p)}e.faces.push(w)}}})(f);(function(){var d,g,h,j;if(a.skinWeights){d=0;for(g=a.skinWeights.length;d<g;d+=2){h=a.skinWeights[d];
+THREE.JSONLoader.prototype.createModel=function(a,c,b){var e=new THREE.Geometry,f=a.scale!==undefined?1/a.scale:1;this.init_materials(e,a.materials,b);(function(d){if(a.version===undefined||a.version!=2)console.error("Deprecated file format.");else{var g,h,j,l,k,m,p,n,v,A,w,u,y,o,z=a.faces;m=a.vertices;var B=a.normals,I=a.colors,K=0;for(g=0;g<a.uvs.length;g++)a.uvs[g].length&&K++;for(g=0;g<K;g++){e.faceUvs[g]=[];e.faceVertexUvs[g]=[]}l=0;for(k=m.length;l<k;){p=new THREE.Vertex;p.position.x=m[l++]*
+d;p.position.y=m[l++]*d;p.position.z=m[l++]*d;e.vertices.push(p)}l=0;for(k=z.length;l<k;){d=z[l++];m=d&1;j=d&2;g=d&4;h=d&8;n=d&16;p=d&32;A=d&64;d&=128;if(m){w=new THREE.Face4;w.a=z[l++];w.b=z[l++];w.c=z[l++];w.d=z[l++];m=4}else{w=new THREE.Face3;w.a=z[l++];w.b=z[l++];w.c=z[l++];m=3}if(j){j=z[l++];w.materials=e.materials[j]}j=e.faces.length;if(g)for(g=0;g<K;g++){u=a.uvs[g];v=z[l++];o=u[v*2];v=u[v*2+1];e.faceUvs[g][j]=new THREE.UV(o,v)}if(h)for(g=0;g<K;g++){u=a.uvs[g];y=[];for(h=0;h<m;h++){v=z[l++];
+o=u[v*2];v=u[v*2+1];y[h]=new THREE.UV(o,v)}e.faceVertexUvs[g][j]=y}if(n){n=z[l++]*3;h=new THREE.Vector3;h.x=B[n++];h.y=B[n++];h.z=B[n];w.normal=h}if(p)for(g=0;g<m;g++){n=z[l++]*3;h=new THREE.Vector3;h.x=B[n++];h.y=B[n++];h.z=B[n];w.vertexNormals.push(h)}if(A){p=z[l++];p=new THREE.Color(I[p]);w.color=p}if(d)for(g=0;g<m;g++){p=z[l++];p=new THREE.Color(I[p]);w.vertexColors.push(p)}e.faces.push(w)}}})(f);(function(){var d,g,h,j;if(a.skinWeights){d=0;for(g=a.skinWeights.length;d<g;d+=2){h=a.skinWeights[d];
 j=a.skinWeights[d+1];e.skinWeights.push(new THREE.Vector4(h,j,0,0))}}if(a.skinIndices){d=0;for(g=a.skinIndices.length;d<g;d+=2){h=a.skinIndices[d];j=a.skinIndices[d+1];e.skinIndices.push(new THREE.Vector4(h,j,0,0))}}e.bones=a.bones;e.animation=a.animation})();(function(d){if(a.morphTargets!==undefined){var g,h,j,l,k,m,p,n,v;g=0;for(h=a.morphTargets.length;g<h;g++){e.morphTargets[g]={};e.morphTargets[g].name=a.morphTargets[g].name;e.morphTargets[g].vertices=[];n=e.morphTargets[g].vertices;v=a.morphTargets[g].vertices;
 j=a.skinWeights[d+1];e.skinWeights.push(new THREE.Vector4(h,j,0,0))}}if(a.skinIndices){d=0;for(g=a.skinIndices.length;d<g;d+=2){h=a.skinIndices[d];j=a.skinIndices[d+1];e.skinIndices.push(new THREE.Vector4(h,j,0,0))}}e.bones=a.bones;e.animation=a.animation})();(function(d){if(a.morphTargets!==undefined){var g,h,j,l,k,m,p,n,v;g=0;for(h=a.morphTargets.length;g<h;g++){e.morphTargets[g]={};e.morphTargets[g].name=a.morphTargets[g].name;e.morphTargets[g].vertices=[];n=e.morphTargets[g].vertices;v=a.morphTargets[g].vertices;
-j=0;for(l=v.length;j<l;j+=3){k=v[j]/d;m=v[j+1]/d;p=v[j+2]/d;n.push(new THREE.Vertex(new THREE.Vector3(k,m,p)))}}}if(a.morphColors!==undefined){g=0;for(h=a.morphColors.length;g<h;g++){e.morphColors[g]={};e.morphColors[g].name=a.morphColors[g].name;e.morphColors[g].colors=[];l=e.morphColors[g].colors;k=a.morphColors[g].colors;d=0;for(j=k.length;d<j;d+=3){m=new THREE.Color(16755200);m.setRGB(k[d],k[d+1],k[d+2]);l.push(m)}}}})(f);(function(){if(a.edges!==undefined){var d,g,h;for(d=0;d<a.edges.length;d+=
+j=0;for(l=v.length;j<l;j+=3){k=v[j]*d;m=v[j+1]*d;p=v[j+2]*d;n.push(new THREE.Vertex(new THREE.Vector3(k,m,p)))}}}if(a.morphColors!==undefined){g=0;for(h=a.morphColors.length;g<h;g++){e.morphColors[g]={};e.morphColors[g].name=a.morphColors[g].name;e.morphColors[g].colors=[];l=e.morphColors[g].colors;k=a.morphColors[g].colors;d=0;for(j=k.length;d<j;d+=3){m=new THREE.Color(16755200);m.setRGB(k[d],k[d+1],k[d+2]);l.push(m)}}}})(f);(function(){if(a.edges!==undefined){var d,g,h;for(d=0;d<a.edges.length;d+=
 2){g=a.edges[d];h=a.edges[d+1];e.edges.push(new THREE.Edge(e.vertices[g],e.vertices[h],g,h))}}})();e.computeFaceNormals();c(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;
 2){g=a.edges[d];h=a.edges[d+1];e.edges.push(new THREE.Edge(e.vertices[g],e.vertices[h],g,h))}}})();e.computeFaceNormals();c(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 c=a.model,b=a.callback,e=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(c),f=a.bin_path?a.bin_path:THREE.Loader.prototype.extractUrlbase(c);a=(new Date).getTime();c=new Worker(c);var d=this.showProgress?THREE.Loader.prototype.updateProgress:null;c.onmessage=function(g){THREE.BinaryLoader.prototype.loadAjaxBuffers(g.data.buffers,g.data.materials,b,f,e,d)};c.onerror=function(g){alert("worker.onerror: "+g.message+"\n"+g.data);g.preventDefault()};
 THREE.BinaryLoader.prototype={load:function(a){var c=a.model,b=a.callback,e=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(c),f=a.bin_path?a.bin_path:THREE.Loader.prototype.extractUrlbase(c);a=(new Date).getTime();c=new Worker(c);var d=this.showProgress?THREE.Loader.prototype.updateProgress:null;c.onmessage=function(g){THREE.BinaryLoader.prototype.loadAjaxBuffers(g.data.buffers,g.data.materials,b,f,e,d)};c.onerror=function(g){alert("worker.onerror: "+g.message+"\n"+g.data);g.preventDefault()};
 c.postMessage(a)},loadAjaxBuffers:function(a,c,b,e,f,d){var g=new XMLHttpRequest,h=e+"/"+a,j=0;g.onreadystatechange=function(){if(g.readyState==4)g.status==200||g.status==0?THREE.BinaryLoader.prototype.createBinModel(g.responseText,b,f,c):alert("Couldn't load ["+h+"] ["+g.status+"]");else if(g.readyState==3){if(d){j==0&&(j=g.getResponseHeader("Content-Length"));d({total:j,loaded:g.responseText.length})}}else g.readyState==2&&(j=g.getResponseHeader("Content-Length"))};g.open("GET",h,!0);g.overrideMimeType("text/plain; charset=x-user-defined");
 c.postMessage(a)},loadAjaxBuffers:function(a,c,b,e,f,d){var g=new XMLHttpRequest,h=e+"/"+a,j=0;g.onreadystatechange=function(){if(g.readyState==4)g.status==200||g.status==0?THREE.BinaryLoader.prototype.createBinModel(g.responseText,b,f,c):alert("Couldn't load ["+h+"] ["+g.status+"]");else if(g.readyState==3){if(d){j==0&&(j=g.getResponseHeader("Content-Length"));d({total:j,loaded:g.responseText.length})}}else g.readyState==2&&(j=g.getResponseHeader("Content-Length"))};g.open("GET",h,!0);g.overrideMimeType("text/plain; charset=x-user-defined");
 g.setRequestHeader("Content-Type","text/plain");g.send(null)},createBinModel:function(a,c,b,e){var f=function(d){function g(t,x){var C=k(t,x),E=k(t,x+1),H=k(t,x+2),T=k(t,x+3),V=(T<<1&255|H>>7)-127;C|=(H&127)<<16|E<<8;if(C==0&&V==-127)return 0;return(1-2*(T>>7))*(1+C*Math.pow(2,-23))*Math.pow(2,V)}function h(t,x){var C=k(t,x),E=k(t,x+1),H=k(t,x+2);return(k(t,x+3)<<24)+(H<<16)+(E<<8)+C}function j(t,x){var C=k(t,x);return(k(t,x+1)<<8)+C}function l(t,x){var C=k(t,x);return C>127?C-256:C}function k(t,
 g.setRequestHeader("Content-Type","text/plain");g.send(null)},createBinModel:function(a,c,b,e){var f=function(d){function g(t,x){var C=k(t,x),E=k(t,x+1),H=k(t,x+2),T=k(t,x+3),V=(T<<1&255|H>>7)-127;C|=(H&127)<<16|E<<8;if(C==0&&V==-127)return 0;return(1-2*(T>>7))*(1+C*Math.pow(2,-23))*Math.pow(2,V)}function h(t,x){var C=k(t,x),E=k(t,x+1),H=k(t,x+2);return(k(t,x+3)<<24)+(H<<16)+(E<<8)+C}function j(t,x){var C=k(t,x);return(k(t,x+1)<<8)+C}function l(t,x){var C=k(t,x);return C>127?C-256:C}function k(t,
 x){return t.charCodeAt(x)&255}function m(t){var x,C,E;x=h(a,t);C=h(a,t+I);E=h(a,t+K);t=j(a,t+J);THREE.BinaryLoader.prototype.f3(u,x,C,E,t)}function p(t){var x,C,E,H,T,V;x=h(a,t);C=h(a,t+I);E=h(a,t+K);H=j(a,t+J);T=h(a,t+G);V=h(a,t+D);t=h(a,t+L);THREE.BinaryLoader.prototype.f3n(u,z,x,C,E,H,T,V,t)}function n(t){var x,C,E,H;x=h(a,t);C=h(a,t+R);E=h(a,t+O);H=h(a,t+S);t=j(a,t+P);THREE.BinaryLoader.prototype.f4(u,x,C,E,H,t)}function v(t){var x,C,E,H,T,V,ca,da;x=h(a,t);C=h(a,t+R);E=h(a,t+O);H=h(a,t+S);T=j(a,
 x){return t.charCodeAt(x)&255}function m(t){var x,C,E;x=h(a,t);C=h(a,t+I);E=h(a,t+K);t=j(a,t+J);THREE.BinaryLoader.prototype.f3(u,x,C,E,t)}function p(t){var x,C,E,H,T,V;x=h(a,t);C=h(a,t+I);E=h(a,t+K);H=j(a,t+J);T=h(a,t+G);V=h(a,t+D);t=h(a,t+L);THREE.BinaryLoader.prototype.f3n(u,z,x,C,E,H,T,V,t)}function n(t){var x,C,E,H;x=h(a,t);C=h(a,t+R);E=h(a,t+O);H=h(a,t+S);t=j(a,t+P);THREE.BinaryLoader.prototype.f4(u,x,C,E,H,t)}function v(t){var x,C,E,H,T,V,ca,da;x=h(a,t);C=h(a,t+R);E=h(a,t+O);H=h(a,t+S);T=j(a,
-t+P);V=h(a,t+F);ca=h(a,t+M);da=h(a,t+Q);t=h(a,t+U);THREE.BinaryLoader.prototype.f4n(u,z,x,C,E,H,T,V,ca,da,t)}function A(t){var x,C;x=h(a,t);C=h(a,t+N);t=h(a,t+W);THREE.BinaryLoader.prototype.uv3(u.faceVertexUvs[0],B[x*2],B[x*2+1],B[C*2],B[C*2+1],B[t*2],B[t*2+1])}function w(t){var x,C,E;x=h(a,t);C=h(a,t+ea);E=h(a,t+fa);t=h(a,t+ga);THREE.BinaryLoader.prototype.uv4(u.faceVertexUvs[0],B[x*2],B[x*2+1],B[C*2],B[C*2+1],B[E*2],B[E*2+1],B[t*2],B[t*2+1])}var u=this,y=0,o,z=[],B=[],I,K,J,G,D,L,R,O,S,P,F,M,Q,
-U,N,W,ea,fa,ga,Y,Z,$,aa,ba,X;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(u,e,d);o={signature:a.substr(y,8),header_bytes:k(a,y+8),vertex_coordinate_bytes:k(a,y+9),normal_coordinate_bytes:k(a,y+10),uv_coordinate_bytes:k(a,y+11),vertex_index_bytes:k(a,y+12),normal_index_bytes:k(a,y+13),uv_index_bytes:k(a,y+14),material_index_bytes:k(a,y+15),nvertices:h(a,y+16),nnormals:h(a,y+16+4),nuvs:h(a,y+16+8),ntri_flat:h(a,y+16+12),ntri_smooth:h(a,y+16+16),ntri_flat_uv:h(a,y+16+20),ntri_smooth_uv:h(a,
+t+P);V=h(a,t+F);ca=h(a,t+N);da=h(a,t+Q);t=h(a,t+U);THREE.BinaryLoader.prototype.f4n(u,z,x,C,E,H,T,V,ca,da,t)}function A(t){var x,C;x=h(a,t);C=h(a,t+M);t=h(a,t+W);THREE.BinaryLoader.prototype.uv3(u.faceVertexUvs[0],B[x*2],B[x*2+1],B[C*2],B[C*2+1],B[t*2],B[t*2+1])}function w(t){var x,C,E;x=h(a,t);C=h(a,t+ea);E=h(a,t+fa);t=h(a,t+ga);THREE.BinaryLoader.prototype.uv4(u.faceVertexUvs[0],B[x*2],B[x*2+1],B[C*2],B[C*2+1],B[E*2],B[E*2+1],B[t*2],B[t*2+1])}var u=this,y=0,o,z=[],B=[],I,K,J,G,D,L,R,O,S,P,F,N,Q,
+U,M,W,ea,fa,ga,Y,Z,$,aa,ba,X;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(u,e,d);o={signature:a.substr(y,8),header_bytes:k(a,y+8),vertex_coordinate_bytes:k(a,y+9),normal_coordinate_bytes:k(a,y+10),uv_coordinate_bytes:k(a,y+11),vertex_index_bytes:k(a,y+12),normal_index_bytes:k(a,y+13),uv_index_bytes:k(a,y+14),material_index_bytes:k(a,y+15),nvertices:h(a,y+16),nnormals:h(a,y+16+4),nuvs:h(a,y+16+8),ntri_flat:h(a,y+16+12),ntri_smooth:h(a,y+16+16),ntri_flat_uv:h(a,y+16+20),ntri_smooth_uv:h(a,
 y+16+24),nquad_flat:h(a,y+16+28),nquad_smooth:h(a,y+16+32),nquad_flat_uv:h(a,y+16+36),nquad_smooth_uv:h(a,y+16+40)};y+=o.header_bytes;I=o.vertex_index_bytes;K=o.vertex_index_bytes*2;J=o.vertex_index_bytes*3;G=o.vertex_index_bytes*3+o.material_index_bytes;D=o.vertex_index_bytes*3+o.material_index_bytes+o.normal_index_bytes;L=o.vertex_index_bytes*3+o.material_index_bytes+o.normal_index_bytes*2;R=o.vertex_index_bytes;O=o.vertex_index_bytes*2;S=o.vertex_index_bytes*3;P=o.vertex_index_bytes*4;F=o.vertex_index_bytes*
 y+16+24),nquad_flat:h(a,y+16+28),nquad_smooth:h(a,y+16+32),nquad_flat_uv:h(a,y+16+36),nquad_smooth_uv:h(a,y+16+40)};y+=o.header_bytes;I=o.vertex_index_bytes;K=o.vertex_index_bytes*2;J=o.vertex_index_bytes*3;G=o.vertex_index_bytes*3+o.material_index_bytes;D=o.vertex_index_bytes*3+o.material_index_bytes+o.normal_index_bytes;L=o.vertex_index_bytes*3+o.material_index_bytes+o.normal_index_bytes*2;R=o.vertex_index_bytes;O=o.vertex_index_bytes*2;S=o.vertex_index_bytes*3;P=o.vertex_index_bytes*4;F=o.vertex_index_bytes*
-4+o.material_index_bytes;M=o.vertex_index_bytes*4+o.material_index_bytes+o.normal_index_bytes;Q=o.vertex_index_bytes*4+o.material_index_bytes+o.normal_index_bytes*2;U=o.vertex_index_bytes*4+o.material_index_bytes+o.normal_index_bytes*3;N=o.uv_index_bytes;W=o.uv_index_bytes*2;ea=o.uv_index_bytes;fa=o.uv_index_bytes*2;ga=o.uv_index_bytes*3;d=o.vertex_index_bytes*3+o.material_index_bytes;X=o.vertex_index_bytes*4+o.material_index_bytes;Y=o.ntri_flat*d;Z=o.ntri_smooth*(d+o.normal_index_bytes*3);$=o.ntri_flat_uv*
+4+o.material_index_bytes;N=o.vertex_index_bytes*4+o.material_index_bytes+o.normal_index_bytes;Q=o.vertex_index_bytes*4+o.material_index_bytes+o.normal_index_bytes*2;U=o.vertex_index_bytes*4+o.material_index_bytes+o.normal_index_bytes*3;M=o.uv_index_bytes;W=o.uv_index_bytes*2;ea=o.uv_index_bytes;fa=o.uv_index_bytes*2;ga=o.uv_index_bytes*3;d=o.vertex_index_bytes*3+o.material_index_bytes;X=o.vertex_index_bytes*4+o.material_index_bytes;Y=o.ntri_flat*d;Z=o.ntri_smooth*(d+o.normal_index_bytes*3);$=o.ntri_flat_uv*
 (d+o.uv_index_bytes*3);aa=o.ntri_smooth_uv*(d+o.normal_index_bytes*3+o.uv_index_bytes*3);ba=o.nquad_flat*X;d=o.nquad_smooth*(X+o.normal_index_bytes*4);X=o.nquad_flat_uv*(X+o.uv_index_bytes*4);y+=function(t){for(var x,C,E,H=o.vertex_coordinate_bytes*3,T=t+o.nvertices*H;t<T;t+=H){x=g(a,t);C=g(a,t+o.vertex_coordinate_bytes);E=g(a,t+o.vertex_coordinate_bytes*2);THREE.BinaryLoader.prototype.v(u,x,C,E)}return o.nvertices*H}(y);y+=function(t){for(var x,C,E,H=o.normal_coordinate_bytes*3,T=t+o.nnormals*H;t<
 (d+o.uv_index_bytes*3);aa=o.ntri_smooth_uv*(d+o.normal_index_bytes*3+o.uv_index_bytes*3);ba=o.nquad_flat*X;d=o.nquad_smooth*(X+o.normal_index_bytes*4);X=o.nquad_flat_uv*(X+o.uv_index_bytes*4);y+=function(t){for(var x,C,E,H=o.vertex_coordinate_bytes*3,T=t+o.nvertices*H;t<T;t+=H){x=g(a,t);C=g(a,t+o.vertex_coordinate_bytes);E=g(a,t+o.vertex_coordinate_bytes*2);THREE.BinaryLoader.prototype.v(u,x,C,E)}return o.nvertices*H}(y);y+=function(t){for(var x,C,E,H=o.normal_coordinate_bytes*3,T=t+o.nnormals*H;t<
 T;t+=H){x=l(a,t);C=l(a,t+o.normal_coordinate_bytes);E=l(a,t+o.normal_coordinate_bytes*2);z.push(x/127,C/127,E/127)}return o.nnormals*H}(y);y+=function(t){for(var x,C,E=o.uv_coordinate_bytes*2,H=t+o.nuvs*E;t<H;t+=E){x=g(a,t);C=g(a,t+o.uv_coordinate_bytes);B.push(x,C)}return o.nuvs*E}(y);Y=y+Y;Z=Y+Z;$=Z+$;aa=$+aa;ba=aa+ba;d=ba+d;X=d+X;(function(t){var x,C=o.vertex_index_bytes*3+o.material_index_bytes,E=C+o.uv_index_bytes*3,H=t+o.ntri_flat_uv*E;for(x=t;x<H;x+=E){m(x);A(x+C)}return H-t})(Z);(function(t){var x,
 T;t+=H){x=l(a,t);C=l(a,t+o.normal_coordinate_bytes);E=l(a,t+o.normal_coordinate_bytes*2);z.push(x/127,C/127,E/127)}return o.nnormals*H}(y);y+=function(t){for(var x,C,E=o.uv_coordinate_bytes*2,H=t+o.nuvs*E;t<H;t+=E){x=g(a,t);C=g(a,t+o.uv_coordinate_bytes);B.push(x,C)}return o.nuvs*E}(y);Y=y+Y;Z=Y+Z;$=Z+$;aa=$+aa;ba=aa+ba;d=ba+d;X=d+X;(function(t){var x,C=o.vertex_index_bytes*3+o.material_index_bytes,E=C+o.uv_index_bytes*3,H=t+o.ntri_flat_uv*E;for(x=t;x<H;x+=E){m(x);A(x+C)}return H-t})(Z);(function(t){var x,
 C=o.vertex_index_bytes*3+o.material_index_bytes+o.normal_index_bytes*3,E=C+o.uv_index_bytes*3,H=t+o.ntri_smooth_uv*E;for(x=t;x<H;x+=E){p(x);A(x+C)}return H-t})($);(function(t){var x,C=o.vertex_index_bytes*4+o.material_index_bytes,E=C+o.uv_index_bytes*4,H=t+o.nquad_flat_uv*E;for(x=t;x<H;x+=E){n(x);w(x+C)}return H-t})(d);(function(t){var x,C=o.vertex_index_bytes*4+o.material_index_bytes+o.normal_index_bytes*4,E=C+o.uv_index_bytes*4,H=t+o.nquad_smooth_uv*E;for(x=t;x<H;x+=E){v(x);w(x+C)}return H-t})(X);
 C=o.vertex_index_bytes*3+o.material_index_bytes+o.normal_index_bytes*3,E=C+o.uv_index_bytes*3,H=t+o.ntri_smooth_uv*E;for(x=t;x<H;x+=E){p(x);A(x+C)}return H-t})($);(function(t){var x,C=o.vertex_index_bytes*4+o.material_index_bytes,E=C+o.uv_index_bytes*4,H=t+o.nquad_flat_uv*E;for(x=t;x<H;x+=E){n(x);w(x+C)}return H-t})(d);(function(t){var x,C=o.vertex_index_bytes*4+o.material_index_bytes+o.normal_index_bytes*4,E=C+o.uv_index_bytes*4,H=t+o.nquad_smooth_uv*E;for(x=t;x<H;x+=E){v(x);w(x+C)}return H-t})(X);
@@ -122,19 +122,19 @@ C=o.vertex_index_bytes*3+o.material_index_bytes+o.normal_index_bytes*3,E=C+o.uv_
 C;for(x=t;x<E;x+=C)v(x);return E-t})(ba);this.computeCentroids();this.computeFaceNormals()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;c(new f(b))},v:function(a,c,b,e){a.vertices.push(new THREE.Vertex(new THREE.Vector3(c,b,e)))},f3:function(a,c,b,e,f){a.faces.push(new THREE.Face3(c,b,e,null,null,a.materials[f]))},f4:function(a,c,b,e,f,d){a.faces.push(new THREE.Face4(c,b,e,f,null,null,a.materials[d]))},f3n:function(a,c,b,e,f,d,g,h,j){d=a.materials[d];var l=c[h*3],k=c[h*3+1];h=c[h*3+2];
 C;for(x=t;x<E;x+=C)v(x);return E-t})(ba);this.computeCentroids();this.computeFaceNormals()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;c(new f(b))},v:function(a,c,b,e){a.vertices.push(new THREE.Vertex(new THREE.Vector3(c,b,e)))},f3:function(a,c,b,e,f){a.faces.push(new THREE.Face3(c,b,e,null,null,a.materials[f]))},f4:function(a,c,b,e,f,d){a.faces.push(new THREE.Face4(c,b,e,f,null,null,a.materials[d]))},f3n:function(a,c,b,e,f,d,g,h,j){d=a.materials[d];var l=c[h*3],k=c[h*3+1];h=c[h*3+2];
 var m=c[j*3],p=c[j*3+1];j=c[j*3+2];a.faces.push(new THREE.Face3(b,e,f,[new THREE.Vector3(c[g*3],c[g*3+1],c[g*3+2]),new THREE.Vector3(l,k,h),new THREE.Vector3(m,p,j)],null,d))},f4n:function(a,c,b,e,f,d,g,h,j,l,k){g=a.materials[g];var m=c[j*3],p=c[j*3+1];j=c[j*3+2];var n=c[l*3],v=c[l*3+1];l=c[l*3+2];var A=c[k*3],w=c[k*3+1];k=c[k*3+2];a.faces.push(new THREE.Face4(b,e,f,d,[new THREE.Vector3(c[h*3],c[h*3+1],c[h*3+2]),new THREE.Vector3(m,p,j),new THREE.Vector3(n,v,l),new THREE.Vector3(A,w,k)],null,g))},
 var m=c[j*3],p=c[j*3+1];j=c[j*3+2];a.faces.push(new THREE.Face3(b,e,f,[new THREE.Vector3(c[g*3],c[g*3+1],c[g*3+2]),new THREE.Vector3(l,k,h),new THREE.Vector3(m,p,j)],null,d))},f4n:function(a,c,b,e,f,d,g,h,j,l,k){g=a.materials[g];var m=c[j*3],p=c[j*3+1];j=c[j*3+2];var n=c[l*3],v=c[l*3+1];l=c[l*3+2];var A=c[k*3],w=c[k*3+1];k=c[k*3+2];a.faces.push(new THREE.Face4(b,e,f,d,[new THREE.Vector3(c[h*3],c[h*3+1],c[h*3+2]),new THREE.Vector3(m,p,j),new THREE.Vector3(n,v,l),new THREE.Vector3(A,w,k)],null,g))},
 uv3:function(a,c,b,e,f,d,g){var h=[];h.push(new THREE.UV(c,b));h.push(new THREE.UV(e,f));h.push(new THREE.UV(d,g));a.push(h)},uv4:function(a,c,b,e,f,d,g,h,j){var l=[];l.push(new THREE.UV(c,b));l.push(new THREE.UV(e,f));l.push(new THREE.UV(d,g));l.push(new THREE.UV(h,j));a.push(l)}};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
 uv3:function(a,c,b,e,f,d,g){var h=[];h.push(new THREE.UV(c,b));h.push(new THREE.UV(e,f));h.push(new THREE.UV(d,g));a.push(h)},uv4:function(a,c,b,e,f,d,g,h,j){var l=[];l.push(new THREE.UV(c,b));l.push(new THREE.UV(e,f));l.push(new THREE.UV(d,g));l.push(new THREE.UV(h,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,c){var b=this,e=new Worker(a);e.postMessage(0);var f=THREE.Loader.prototype.extractUrlbase(a);e.onmessage=function(d){function g(N,W){return W=="relativeToHTML"?N:f+"/"+N}function h(){for(n in D.objects)if(!F.objects[n]){y=D.objects[n];if(y.geometry!==undefined){if(I=F.geometries[y.geometry]){G=[];for(U=0;U<y.materials.length;U++)G[U]=F.materials[y.materials[U]];o=y.position;r=y.rotation;q=y.quaternion;s=y.scale;q=0;G.length==0&&(G[0]=new THREE.MeshFaceMaterial);
-G.length>1&&(G=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(I,G);object.name=n;object.position.set(o[0],o[1],o[2]);if(q){object.quaternion.set(q[0],q[1],q[2],q[3]);object.useQuaternion=!0}else object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=y.visible;F.scene.addObject(object);F.objects[n]=object;if(y.meshCollider){var N=THREE.CollisionUtils.MeshColliderWBox(object);F.scene.collisions.colliders.push(N)}if(y.castsShadow){N=new THREE.ShadowVolume(I);F.scene.addChild(N);
-N.position=object.position;N.rotation=object.rotation;N.scale=object.scale}y.trigger&&y.trigger.toLowerCase()!="none"&&(F.triggers[object.name]={type:y.trigger,object:y})}}else{o=y.position;r=y.rotation;q=y.quaternion;s=y.scale;q=0;object=new THREE.Object3D;object.name=n;object.position.set(o[0],o[1],o[2]);if(q){object.quaternion.set(q[0],q[1],q[2],q[3]);object.useQuaternion=!0}else object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=y.visible!==undefined?y.visible:
-!1;F.scene.addObject(object);F.objects[n]=object;F.empties[n]=object}}}function j(N){return function(W){F.geometries[N]=W;h();R-=1;b.onLoadComplete();k()}}function l(N){return function(W){F.geometries[N]=W}}function k(){b.callbackProgress({totalModels:S,totalTextures:P,loadedModels:S-R,loadedTextures:P-O},F);b.onLoadProgress();R==0&&O==0&&c(F)}var m,p,n,v,A,w,u,y,o,z,B,I,K,J,G,D,L,R,O,S,P,F;D=d.data;d=new THREE.BinaryLoader;L=new THREE.JSONLoader;O=R=0;F={scene:new THREE.Scene,geometries:{},materials:{},
-textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};var M=!1;for(n in D.objects){y=D.objects[n];if(y.meshCollider){M=!0;break}}if(M)F.scene.collisions=new THREE.CollisionSystem;if(D.transform){M=D.transform.position;z=D.transform.rotation;var Q=D.transform.scale;M&&F.scene.position.set(M[0],M[1],M[2]);z&&F.scene.rotation.set(z[0],z[1],z[2]);Q&&F.scene.scale.set(Q[0],Q[1],Q[2]);(M||z||Q)&&F.scene.updateMatrix()}M=function(){O-=1;k();b.onLoadComplete()};for(A in D.cameras){z=
-D.cameras[A];if(z.type=="perspective")K=new THREE.Camera(z.fov,z.aspect,z.near,z.far);else if(z.type=="ortho"){K=new THREE.Camera;K.projectionMatrix=THREE.Matrix4.makeOrtho(z.left,z.right,z.top,z.bottom,z.near,z.far)}o=z.position;z=z.target;K.position.set(o[0],o[1],o[2]);K.target.position.set(z[0],z[1],z[2]);F.cameras[A]=K}for(v in D.lights){A=D.lights[v];K=A.color!==undefined?A.color:16777215;z=A.intensity!==undefined?A.intensity:1;if(A.type=="directional"){o=A.direction;light=new THREE.DirectionalLight(K,
-z);light.position.set(o[0],o[1],o[2]);light.position.normalize()}else if(A.type=="point"){o=A.position;light=new THREE.PointLight(K,z);light.position.set(o[0],o[1],o[2])}F.scene.addLight(light);F.lights[v]=light}for(w in D.fogs){v=D.fogs[w];if(v.type=="linear")J=new THREE.Fog(0,v.near,v.far);else v.type=="exp2"&&(J=new THREE.FogExp2(0,v.density));z=v.color;J.color.setRGB(z[0],z[1],z[2]);F.fogs[w]=J}if(F.cameras&&D.defaults.camera)F.currentCamera=F.cameras[D.defaults.camera];if(F.fogs&&D.defaults.fog)F.scene.fog=
-F.fogs[D.defaults.fog];z=D.defaults.bgcolor;F.bgColor=new THREE.Color;F.bgColor.setRGB(z[0],z[1],z[2]);F.bgColorAlpha=D.defaults.bgalpha;for(m in D.geometries){w=D.geometries[m];if(w.type=="bin_mesh"||w.type=="ascii_mesh"){R+=1;b.onLoadStart()}}S=R;for(m in D.geometries){w=D.geometries[m];if(w.type=="cube"){I=new THREE.Cube(w.width,w.height,w.depth,w.segmentsWidth,w.segmentsHeight,w.segmentsDepth,null,w.flipped,w.sides);F.geometries[m]=I}else if(w.type=="plane"){I=new THREE.Plane(w.width,w.height,
-w.segmentsWidth,w.segmentsHeight);F.geometries[m]=I}else if(w.type=="sphere"){I=new THREE.Sphere(w.radius,w.segmentsWidth,w.segmentsHeight);F.geometries[m]=I}else if(w.type=="cylinder"){I=new THREE.Cylinder(w.numSegs,w.topRad,w.botRad,w.height,w.topOffset,w.botOffset);F.geometries[m]=I}else if(w.type=="torus"){I=new THREE.Torus(w.radius,w.tube,w.segmentsR,w.segmentsT);F.geometries[m]=I}else if(w.type=="icosahedron"){I=new THREE.Icosahedron(w.subdivisions);F.geometries[m]=I}else if(w.type=="bin_mesh")d.load({model:g(w.url,
-D.urlBaseType),callback:j(m)});else if(w.type=="ascii_mesh")L.load({model:g(w.url,D.urlBaseType),callback:j(m)});else if(w.type=="embedded_mesh")(w=D.embeds[w.id])&&L.createModel(w,l(m),"")}for(u in D.textures){m=D.textures[u];if(m.url instanceof Array){O+=m.url.length;for(d=0;d<m.url.length;d++)b.onLoadStart()}else{O+=1;b.onLoadStart()}}P=O;for(u in D.textures){m=D.textures[u];if(m.mapping!=undefined&&THREE[m.mapping]!=undefined)m.mapping=new THREE[m.mapping];if(m.url instanceof Array){d=[];for(var U=
-0;U<m.url.length;U++)d[U]=g(m.url[U],D.urlBaseType);d=THREE.ImageUtils.loadTextureCube(d,m.mapping,M)}else{d=THREE.ImageUtils.loadTexture(g(m.url,D.urlBaseType),m.mapping,M);if(THREE[m.minFilter]!=undefined)d.minFilter=THREE[m.minFilter];if(THREE[m.magFilter]!=undefined)d.magFilter=THREE[m.magFilter]}F.textures[u]=d}for(p in D.materials){u=D.materials[p];for(B in u.parameters)if(B=="envMap"||B=="map"||B=="lightMap")u.parameters[B]=F.textures[u.parameters[B]];else if(B=="shading")u.parameters[B]=u.parameters[B]==
-"flat"?THREE.FlatShading:THREE.SmoothShading;else if(B=="blending")u.parameters[B]=THREE[u.parameters[B]]?THREE[u.parameters[B]]:THREE.NormalBlending;else if(B=="combine")u.parameters[B]=u.parameters[B]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(B=="vertexColors")if(u.parameters[B]=="face")u.parameters[B]=THREE.FaceColors;else if(u.parameters[B])u.parameters[B]=THREE.VertexColors;if(u.parameters.opacity!==undefined&&u.parameters.opacity<1)u.parameters.transparent=!0;u=new THREE[u.type](u.parameters);
-F.materials[p]=u}h();b.callbackSync(F)}}};
+THREE.SceneLoader.prototype={load:function(a,c){var b=this,e=new Worker(a);e.postMessage(0);var f=THREE.Loader.prototype.extractUrlbase(a);e.onmessage=function(d){function g(M,W){return W=="relativeToHTML"?M:f+"/"+M}function h(){for(n in D.objects)if(!F.objects[n]){y=D.objects[n];if(y.geometry!==undefined){if(I=F.geometries[y.geometry]){G=[];for(U=0;U<y.materials.length;U++)G[U]=F.materials[y.materials[U]];o=y.position;r=y.rotation;q=y.quaternion;s=y.scale;q=0;G.length==0&&(G[0]=new THREE.MeshFaceMaterial);
+G.length>1&&(G=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(I,G);object.name=n;object.position.set(o[0],o[1],o[2]);if(q){object.quaternion.set(q[0],q[1],q[2],q[3]);object.useQuaternion=!0}else object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=y.visible;F.scene.addObject(object);F.objects[n]=object;if(y.meshCollider){var M=THREE.CollisionUtils.MeshColliderWBox(object);F.scene.collisions.colliders.push(M)}if(y.castsShadow){M=new THREE.ShadowVolume(I);F.scene.addChild(M);
+M.position=object.position;M.rotation=object.rotation;M.scale=object.scale}if(y.trigger&&y.trigger.toLowerCase()!="none"){M={type:y.trigger,object:y};F.triggers[object.name]=M}}}else{o=y.position;r=y.rotation;q=y.quaternion;s=y.scale;q=0;object=new THREE.Object3D;object.name=n;object.position.set(o[0],o[1],o[2]);if(q){object.quaternion.set(q[0],q[1],q[2],q[3]);object.useQuaternion=!0}else object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=y.visible!==undefined?y.visible:
+!1;F.scene.addObject(object);F.objects[n]=object;F.empties[n]=object;if(y.trigger&&y.trigger.toLowerCase()!="none"){M={type:y.trigger,object:y};F.triggers[object.name]=M}}}}function j(M){return function(W){F.geometries[M]=W;h();R-=1;b.onLoadComplete();k()}}function l(M){return function(W){F.geometries[M]=W}}function k(){b.callbackProgress({totalModels:S,totalTextures:P,loadedModels:S-R,loadedTextures:P-O},F);b.onLoadProgress();R==0&&O==0&&c(F)}var m,p,n,v,A,w,u,y,o,z,B,I,K,J,G,D,L,R,O,S,P,F;D=d.data;
+d=new THREE.BinaryLoader;L=new THREE.JSONLoader;O=R=0;F={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};var N=!1;for(n in D.objects){y=D.objects[n];if(y.meshCollider){N=!0;break}}if(N)F.scene.collisions=new THREE.CollisionSystem;if(D.transform){N=D.transform.position;z=D.transform.rotation;var Q=D.transform.scale;N&&F.scene.position.set(N[0],N[1],N[2]);z&&F.scene.rotation.set(z[0],z[1],z[2]);Q&&F.scene.scale.set(Q[0],Q[1],
+Q[2]);(N||z||Q)&&F.scene.updateMatrix()}N=function(){O-=1;k();b.onLoadComplete()};for(A in D.cameras){z=D.cameras[A];if(z.type=="perspective")K=new THREE.Camera(z.fov,z.aspect,z.near,z.far);else if(z.type=="ortho"){K=new THREE.Camera;K.projectionMatrix=THREE.Matrix4.makeOrtho(z.left,z.right,z.top,z.bottom,z.near,z.far)}o=z.position;z=z.target;K.position.set(o[0],o[1],o[2]);K.target.position.set(z[0],z[1],z[2]);F.cameras[A]=K}for(v in D.lights){A=D.lights[v];K=A.color!==undefined?A.color:16777215;
+z=A.intensity!==undefined?A.intensity:1;if(A.type=="directional"){o=A.direction;light=new THREE.DirectionalLight(K,z);light.position.set(o[0],o[1],o[2]);light.position.normalize()}else if(A.type=="point"){o=A.position;light=new THREE.PointLight(K,z);light.position.set(o[0],o[1],o[2])}F.scene.addLight(light);F.lights[v]=light}for(w in D.fogs){v=D.fogs[w];if(v.type=="linear")J=new THREE.Fog(0,v.near,v.far);else v.type=="exp2"&&(J=new THREE.FogExp2(0,v.density));z=v.color;J.color.setRGB(z[0],z[1],z[2]);
+F.fogs[w]=J}if(F.cameras&&D.defaults.camera)F.currentCamera=F.cameras[D.defaults.camera];if(F.fogs&&D.defaults.fog)F.scene.fog=F.fogs[D.defaults.fog];z=D.defaults.bgcolor;F.bgColor=new THREE.Color;F.bgColor.setRGB(z[0],z[1],z[2]);F.bgColorAlpha=D.defaults.bgalpha;for(m in D.geometries){w=D.geometries[m];if(w.type=="bin_mesh"||w.type=="ascii_mesh"){R+=1;b.onLoadStart()}}S=R;for(m in D.geometries){w=D.geometries[m];if(w.type=="cube"){I=new THREE.Cube(w.width,w.height,w.depth,w.segmentsWidth,w.segmentsHeight,
+w.segmentsDepth,null,w.flipped,w.sides);F.geometries[m]=I}else if(w.type=="plane"){I=new THREE.Plane(w.width,w.height,w.segmentsWidth,w.segmentsHeight);F.geometries[m]=I}else if(w.type=="sphere"){I=new THREE.Sphere(w.radius,w.segmentsWidth,w.segmentsHeight);F.geometries[m]=I}else if(w.type=="cylinder"){I=new THREE.Cylinder(w.numSegs,w.topRad,w.botRad,w.height,w.topOffset,w.botOffset);F.geometries[m]=I}else if(w.type=="torus"){I=new THREE.Torus(w.radius,w.tube,w.segmentsR,w.segmentsT);F.geometries[m]=
+I}else if(w.type=="icosahedron"){I=new THREE.Icosahedron(w.subdivisions);F.geometries[m]=I}else if(w.type=="bin_mesh")d.load({model:g(w.url,D.urlBaseType),callback:j(m)});else if(w.type=="ascii_mesh")L.load({model:g(w.url,D.urlBaseType),callback:j(m)});else if(w.type=="embedded_mesh")(w=D.embeds[w.id])&&L.createModel(w,l(m),"")}for(u in D.textures){m=D.textures[u];if(m.url instanceof Array){O+=m.url.length;for(d=0;d<m.url.length;d++)b.onLoadStart()}else{O+=1;b.onLoadStart()}}P=O;for(u in D.textures){m=
+D.textures[u];if(m.mapping!=undefined&&THREE[m.mapping]!=undefined)m.mapping=new THREE[m.mapping];if(m.url instanceof Array){d=[];for(var U=0;U<m.url.length;U++)d[U]=g(m.url[U],D.urlBaseType);d=THREE.ImageUtils.loadTextureCube(d,m.mapping,N)}else{d=THREE.ImageUtils.loadTexture(g(m.url,D.urlBaseType),m.mapping,N);if(THREE[m.minFilter]!=undefined)d.minFilter=THREE[m.minFilter];if(THREE[m.magFilter]!=undefined)d.magFilter=THREE[m.magFilter]}F.textures[u]=d}for(p in D.materials){u=D.materials[p];for(B in u.parameters)if(B==
+"envMap"||B=="map"||B=="lightMap")u.parameters[B]=F.textures[u.parameters[B]];else if(B=="shading")u.parameters[B]=u.parameters[B]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(B=="blending")u.parameters[B]=THREE[u.parameters[B]]?THREE[u.parameters[B]]:THREE.NormalBlending;else if(B=="combine")u.parameters[B]=u.parameters[B]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(B=="vertexColors")if(u.parameters[B]=="face")u.parameters[B]=THREE.FaceColors;else if(u.parameters[B])u.parameters[B]=
+THREE.VertexColors;if(u.parameters.opacity!==undefined&&u.parameters.opacity<1)u.parameters.transparent=!0;u=new THREE[u.type](u.parameters);F.materials[p]=u}h();b.callbackSync(F)}}};
 THREE.MarchingCubes=function(a,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=
 THREE.MarchingCubes=function(a,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.hasPos=!1;this.hasNormal=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(b,e,f){return b+(e-b)*f};this.VIntX=function(b,e,f,d,g,h,j,l,k,m){g=(g-k)/(m-k);k=this.normal_cache;e[d]=h+g*this.delta;e[d+1]=j;e[d+2]=l;f[d]=this.lerp(k[b],k[b+3],g);f[d+1]=this.lerp(k[b+1],k[b+4],g);f[d+2]=this.lerp(k[b+2],k[b+5],g)};this.VIntY=function(b,e,f,d,g,h,j,l,k,m){g=(g-k)/(m-k);k=this.normal_cache;e[d]=h;e[d+1]=j+g*this.delta;e[d+
 0;this.hasPos=!1;this.hasNormal=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(b,e,f){return b+(e-b)*f};this.VIntX=function(b,e,f,d,g,h,j,l,k,m){g=(g-k)/(m-k);k=this.normal_cache;e[d]=h+g*this.delta;e[d+1]=j;e[d+2]=l;f[d]=this.lerp(k[b],k[b+3],g);f[d+1]=this.lerp(k[b+1],k[b+4],g);f[d+2]=this.lerp(k[b+2],k[b+5],g)};this.VIntY=function(b,e,f,d,g,h,j,l,k,m){g=(g-k)/(m-k);k=this.normal_cache;e[d]=h;e[d+1]=j+g*this.delta;e[d+
 2]=l;e=b+this.yd*3;f[d]=this.lerp(k[b],k[e],g);f[d+1]=this.lerp(k[b+1],k[e+1],g);f[d+2]=this.lerp(k[b+2],k[e+2],g)};this.VIntZ=function(b,e,f,d,g,h,j,l,k,m){g=(g-k)/(m-k);k=this.normal_cache;e[d]=h;e[d+1]=j;e[d+2]=l+g*this.delta;e=b+this.zd*3;f[d]=this.lerp(k[b],k[e],g);f[d+1]=this.lerp(k[b+1],k[e+1],g);f[d+2]=this.lerp(k[b+2],k[e+2],g)};this.compNorm=function(b){var e=b*3;if(this.normal_cache[e]==0){this.normal_cache[e]=this.field[b-1]-this.field[b+1];this.normal_cache[e+1]=this.field[b-this.yd]-
 2]=l;e=b+this.yd*3;f[d]=this.lerp(k[b],k[e],g);f[d+1]=this.lerp(k[b+1],k[e+1],g);f[d+2]=this.lerp(k[b+2],k[e+2],g)};this.VIntZ=function(b,e,f,d,g,h,j,l,k,m){g=(g-k)/(m-k);k=this.normal_cache;e[d]=h;e[d+1]=j;e[d+2]=l+g*this.delta;e=b+this.zd*3;f[d]=this.lerp(k[b],k[e],g);f[d+1]=this.lerp(k[b+1],k[e+1],g);f[d+2]=this.lerp(k[b+2],k[e+2],g)};this.compNorm=function(b){var e=b*3;if(this.normal_cache[e]==0){this.normal_cache[e]=this.field[b-1]-this.field[b+1];this.normal_cache[e+1]=this.field[b-this.yd]-

+ 61 - 62
build/custom/ThreeSVG.js

@@ -1,8 +1,7 @@
 // ThreeSVG.js r40 - http://github.com/mrdoob/three.js
 // ThreeSVG.js r40 - http://github.com/mrdoob/three.js
 var THREE=THREE||{};if(!window.Int32Array){window.Int32Array=Array;window.Float32Array=Array}THREE.Color=function(a){this.setHex(a)};
 var THREE=THREE||{};if(!window.Int32Array){window.Int32Array=Array;window.Float32Array=Array}THREE.Color=function(a){this.setHex(a)};
-THREE.Color.prototype={autoUpdate:!0,copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;this.hex=a.hex;this.__styleString=a.__styleString},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,b,c){var d,e,h,f,i,g;if(c==0)d=e=h=0;else{f=Math.floor(a*6);i=a*6-f;a=c*(1-b);g=c*(1-b*i);b=c*(1-b*(1-i));switch(f){case 1:d=g;e=c;h=a;break;case 2:d=a;e=c;h=b;break;case 3:d=a;e=g;h=c;break;case 4:d=b;e=a;h=c;break;case 5:d=c;e=a;
-h=g;break;case 6:case 0:d=c;e=b;h=a}}this.r=d;this.g=e;this.b=h;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGB();this.updateStyleString()}},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},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+","+~~(this.g*
-255)+","+~~(this.b*255)+")"},clone:function(){return new THREE.Color(this.hex)}};THREE.Vector2=function(a,b){this.set(a||0,b||0)};
+THREE.Color.prototype={copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;this.hex=a.hex},setHex:function(a){this.hex=~~a&16777215;this.updateRGB()},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;this.updateHex()},setHSV:function(a,b,c){var d,e,g,f,j,h;if(c==0)d=e=g=0;else{f=Math.floor(a*6);j=a*6-f;a=c*(1-b);h=c*(1-b*j);b=c*(1-b*(1-j));switch(f){case 1:d=h;e=c;g=a;break;case 2:d=a;e=c;g=b;break;case 3:d=a;e=h;g=c;break;case 4:d=b;e=a;g=c;break;case 5:d=c;e=a;g=h;break;case 6:case 0:d=c;e=b;g=a}}this.setRGB(d,
+e,g)},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(a,b){this.set(a||0,b||0)};
 THREE.Vector2.prototype={set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.set(a.x,a.y);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a);return this},negate:function(){this.set(-this.x,-this.y);return this},unit:function(){this.multiplyScalar(1/
 THREE.Vector2.prototype={set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.set(a.x,a.y);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a);return this},negate:function(){this.set(-this.x,-this.y);return this},unit:function(){this.multiplyScalar(1/
 this.length());return this},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y},clone:function(){return new THREE.Vector2(this.x,this.y)}};THREE.Vector3=function(a,b,c){this.set(a||0,b||0,c||0)};
 this.length());return this},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y},clone:function(){return new THREE.Vector2(this.x,this.y)}};THREE.Vector3=function(a,b,c){this.set(a||0,b||0,c||0)};
 THREE.Vector3.prototype={set:function(a,b,c){this.x=a;this.y=b;this.z=c;return this},copy:function(a){this.set(a.x,a.y,a.z);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z);return this},addScalar:function(a){this.set(this.x+a,this.y+a,this.z+a);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z);return this},cross:function(a,
 THREE.Vector3.prototype={set:function(a,b,c){this.x=a;this.y=b;this.z=c;return this},copy:function(a){this.set(a.x,a.y,a.z);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z);return this},addScalar:function(a){this.set(this.x+a,this.y+a,this.z+a);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z);return this},cross:function(a,
@@ -12,59 +11,59 @@ this.length();a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setPosit
 1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,b,c,d){this.set(a||0,b||0,c||0,d||1)};
 1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,b,c,d){this.set(a||0,b||0,c||0,d||1)};
 THREE.Vector4.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z,a.w+b.w);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z,this.w+a.w);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z,a.w-b.w);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z,this.w-a.w);return this},multiplyScalar:function(a){this.set(this.x*
 THREE.Vector4.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z,a.w+b.w);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z,this.w+a.w);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z,a.w-b.w);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z,this.w-a.w);return this},multiplyScalar:function(a){this.set(this.x*
 a,this.y*a,this.z*a,this.w*a);return this},divideScalar:function(a){this.set(this.x/a,this.y/a,this.z/a,this.w/a);return this},lerpSelf:function(a,b){this.set(this.x+(a.x-this.x)*b,this.y+(a.y-this.y)*b,this.z+(a.z-this.z)*b,this.w+(a.w-this.w)*b)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
 a,this.y*a,this.z*a,this.w*a);return this},divideScalar:function(a){this.set(this.x/a,this.y/a,this.z/a,this.w/a);return this},lerpSelf:function(a,b){this.set(this.x+(a.x-this.x)*b,this.y+(a.y-this.y)*b,this.z+(a.z-this.z)*b,this.w+(a.w-this.w)*b)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
-THREE.Ray.prototype={intersectScene:function(a){var b,c,d=a.objects,e=[];a=0;for(b=d.length;a<b;a++){c=d[a];c instanceof THREE.Mesh&&(e=e.concat(this.intersectObject(c)))}e.sort(function(h,f){return h.distance-f.distance});return e},intersectObject:function(a){function b(y,u,H,I){I=I.clone().subSelf(u);H=H.clone().subSelf(u);var D=y.clone().subSelf(u);y=I.dot(I);u=I.dot(H);I=I.dot(D);var w=H.dot(H);H=H.dot(D);D=1/(y*w-u*u);w=(w*I-u*H)*D;y=(y*H-u*I)*D;return w>0&&y>0&&w+y<1}var c,d,e,h,f,i,g,j,m,k,
-n,l=a.geometry,r=l.vertices,s=[];c=0;for(d=l.faces.length;c<d;c++){e=l.faces[c];k=this.origin.clone();n=this.direction.clone();g=a.matrixWorld;h=g.multiplyVector3(r[e.a].position.clone());f=g.multiplyVector3(r[e.b].position.clone());i=g.multiplyVector3(r[e.c].position.clone());g=e instanceof THREE.Face4?g.multiplyVector3(r[e.d].position.clone()):null;j=a.matrixRotationWorld.multiplyVector3(e.normal.clone());m=n.dot(j);if(a.doubleSided||(a.flipSided?m>0:m<0)){j=j.dot((new THREE.Vector3).sub(h,k))/
-m;k=k.addSelf(n.multiplyScalar(j));if(e instanceof THREE.Face3){if(b(k,h,f,i)){e={distance:this.origin.distanceTo(k),point:k,face:e,object:a};s.push(e)}}else if(e instanceof THREE.Face4&&(b(k,h,f,g)||b(k,f,i,g))){e={distance:this.origin.distanceTo(k),point:k,face:e,object:a};s.push(e)}}}return s}};
-THREE.Rectangle=function(){function a(){h=d-b;f=e-c}var b,c,d,e,h,f,i=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return h};this.getHeight=function(){return f};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(g,j,m,k){i=!1;b=g;c=j;d=m;e=k;a()};this.addPoint=function(g,j){if(i){i=!1;b=g;c=j;d=g;e=j}else{b=b<g?b:g;c=c<j?c:j;d=d>g?d:g;e=e>j?e:j}a()};
-this.add3Points=function(g,j,m,k,n,l){if(i){i=!1;b=g<m?g<n?g:n:m<n?m:n;c=j<k?j<l?j:l:k<l?k:l;d=g>m?g>n?g:n:m>n?m:n;e=j>k?j>l?j:l:k>l?k:l}else{b=g<m?g<n?g<b?g:b:n<b?n:b:m<n?m<b?m:b:n<b?n:b;c=j<k?j<l?j<c?j:c:l<c?l:c:k<l?k<c?k:c:l<c?l:c;d=g>m?g>n?g>d?g:d:n>d?n:d:m>n?m>d?m:d:n>d?n:d;e=j>k?j>l?j>e?j:e:l>e?l:e:k>l?k>e?k:e:l>e?l:e}a()};this.addRectangle=function(g){if(i){i=!1;b=g.getLeft();c=g.getTop();d=g.getRight();e=g.getBottom()}else{b=b<g.getLeft()?b:g.getLeft();c=c<g.getTop()?c:g.getTop();d=d>g.getRight()?
-d:g.getRight();e=e>g.getBottom()?e:g.getBottom()}a()};this.inflate=function(g){b-=g;c-=g;d+=g;e+=g;a()};this.minSelf=function(g){b=b>g.getLeft()?b:g.getLeft();c=c>g.getTop()?c:g.getTop();d=d<g.getRight()?d:g.getRight();e=e<g.getBottom()?e:g.getBottom();a()};this.instersects=function(g){return Math.min(d,g.getRight())-Math.max(b,g.getLeft())>=0&&Math.min(e,g.getBottom())-Math.max(c,g.getTop())>=0};this.empty=function(){i=!0;e=d=c=b=0;a()};this.isEmpty=function(){return i}};
+THREE.Ray.prototype={intersectScene:function(a){var b,c,d=a.objects,e=[];a=0;for(b=d.length;a<b;a++){c=d[a];c instanceof THREE.Mesh&&(e=e.concat(this.intersectObject(c)))}e.sort(function(g,f){return g.distance-f.distance});return e},intersectObject:function(a){function b(v,w,I,D){D=D.clone().subSelf(w);I=I.clone().subSelf(w);var N=v.clone().subSelf(w);v=D.dot(D);w=D.dot(I);D=D.dot(N);var x=I.dot(I);I=I.dot(N);N=1/(v*x-w*w);x=(x*D-w*I)*N;v=(v*I-w*D)*N;return x>0&&v>0&&x+v<1}var c,d,e,g,f,j,h,i,k,n,
+m,o=a.geometry,q=o.vertices,r=[];c=0;for(d=o.faces.length;c<d;c++){e=o.faces[c];n=this.origin.clone();m=this.direction.clone();h=a.matrixWorld;g=h.multiplyVector3(q[e.a].position.clone());f=h.multiplyVector3(q[e.b].position.clone());j=h.multiplyVector3(q[e.c].position.clone());h=e instanceof THREE.Face4?h.multiplyVector3(q[e.d].position.clone()):null;i=a.matrixRotationWorld.multiplyVector3(e.normal.clone());k=m.dot(i);if(a.doubleSided||(a.flipSided?k>0:k<0)){i=i.dot((new THREE.Vector3).sub(g,n))/
+k;n=n.addSelf(m.multiplyScalar(i));if(e instanceof THREE.Face3){if(b(n,g,f,j)){e={distance:this.origin.distanceTo(n),point:n,face:e,object:a};r.push(e)}}else if(e instanceof THREE.Face4&&(b(n,g,f,h)||b(n,f,j,h))){e={distance:this.origin.distanceTo(n),point:n,face:e,object:a};r.push(e)}}}return r}};
+THREE.Rectangle=function(){function a(){g=d-b;f=e-c}var b,c,d,e,g,f,j=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return g};this.getHeight=function(){return f};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(h,i,k,n){j=!1;b=h;c=i;d=k;e=n;a()};this.addPoint=function(h,i){if(j){j=!1;b=h;c=i;d=h;e=i}else{b=b<h?b:h;c=c<i?c:i;d=d>h?d:h;e=e>i?e:i}a()};
+this.add3Points=function(h,i,k,n,m,o){if(j){j=!1;b=h<k?h<m?h:m:k<m?k:m;c=i<n?i<o?i:o:n<o?n:o;d=h>k?h>m?h:m:k>m?k:m;e=i>n?i>o?i:o:n>o?n:o}else{b=h<k?h<m?h<b?h:b:m<b?m:b:k<m?k<b?k:b:m<b?m:b;c=i<n?i<o?i<c?i:c:o<c?o:c:n<o?n<c?n:c:o<c?o:c;d=h>k?h>m?h>d?h:d:m>d?m:d:k>m?k>d?k:d:m>d?m:d;e=i>n?i>o?i>e?i:e:o>e?o:e:n>o?n>e?n:e:o>e?o:e}a()};this.addRectangle=function(h){if(j){j=!1;b=h.getLeft();c=h.getTop();d=h.getRight();e=h.getBottom()}else{b=b<h.getLeft()?b:h.getLeft();c=c<h.getTop()?c:h.getTop();d=d>h.getRight()?
+d:h.getRight();e=e>h.getBottom()?e:h.getBottom()}a()};this.inflate=function(h){b-=h;c-=h;d+=h;e+=h;a()};this.minSelf=function(h){b=b>h.getLeft()?b:h.getLeft();c=c>h.getTop()?c:h.getTop();d=d<h.getRight()?d:h.getRight();e=e<h.getBottom()?e:h.getBottom();a()};this.instersects=function(h){return Math.min(d,h.getRight())-Math.max(b,h.getLeft())>=0&&Math.min(e,h.getBottom())-Math.max(c,h.getTop())>=0};this.empty=function(){j=!0;e=d=c=b=0;a()};this.isEmpty=function(){return j}};
 THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};
 THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};
-THREE.Matrix4=function(a,b,c,d,e,h,f,i,g,j,m,k,n,l,r,s){this.set(a||1,b||0,c||0,d||0,e||0,h||1,f||0,i||0,g||0,j||0,m||1,k||0,n||0,l||0,r||0,s||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={set:function(a,b,c,d,e,h,f,i,g,j,m,k,n,l,r,s){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=e;this.n22=h;this.n23=f;this.n24=i;this.n31=g;this.n32=j;this.n33=m;this.n34=k;this.n41=n;this.n42=l;this.n43=r;this.n44=s;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,b,c){var d=THREE.Matrix4.__v1,
-e=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;h.sub(a,b).normalize();if(h.length()===0)h.z=1;d.cross(c,h).normalize();if(d.length()===0){h.x+=1.0E-4;d.cross(c,h).normalize()}e.cross(h,d).normalize();this.n11=d.x;this.n12=e.x;this.n13=h.x;this.n21=d.y;this.n22=e.y;this.n23=h.y;this.n31=d.z;this.n32=e.z;this.n33=h.z;return this},multiplyVector3:function(a){var b=a.x,c=a.y,d=a.z,e=1/(this.n41*b+this.n42*c+this.n43*d+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*d+this.n14)*e;a.y=(this.n21*b+this.n22*c+this.n23*
+THREE.Matrix4=function(a,b,c,d,e,g,f,j,h,i,k,n,m,o,q,r){this.set(a||1,b||0,c||0,d||0,e||0,g||1,f||0,j||0,h||0,i||0,k||1,n||0,m||0,o||0,q||0,r||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={set:function(a,b,c,d,e,g,f,j,h,i,k,n,m,o,q,r){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=e;this.n22=g;this.n23=f;this.n24=j;this.n31=h;this.n32=i;this.n33=k;this.n34=n;this.n41=m;this.n42=o;this.n43=q;this.n44=r;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,b,c){var d=THREE.Matrix4.__v1,
+e=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,b).normalize();if(g.length()===0)g.z=1;d.cross(c,g).normalize();if(d.length()===0){g.x+=1.0E-4;d.cross(c,g).normalize()}e.cross(g,d).normalize();this.n11=d.x;this.n12=e.x;this.n13=g.x;this.n21=d.y;this.n22=e.y;this.n23=g.y;this.n31=d.z;this.n32=e.z;this.n33=g.z;return this},multiplyVector3:function(a){var b=a.x,c=a.y,d=a.z,e=1/(this.n41*b+this.n42*c+this.n43*d+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*d+this.n14)*e;a.y=(this.n21*b+this.n22*c+this.n23*
 d+this.n24)*e;a.z=(this.n31*b+this.n32*c+this.n33*d+this.n34)*e;return a},multiplyVector4:function(a){var b=a.x,c=a.y,d=a.z,e=a.w;a.x=this.n11*b+this.n12*c+this.n13*d+this.n14*e;a.y=this.n21*b+this.n22*c+this.n23*d+this.n24*e;a.z=this.n31*b+this.n32*c+this.n33*d+this.n34*e;a.w=this.n41*b+this.n42*c+this.n43*d+this.n44*e;return a},rotateAxis:function(a){var b=a.x,c=a.y,d=a.z;a.x=b*this.n11+c*this.n12+d*this.n13;a.y=b*this.n21+c*this.n22+d*this.n23;a.z=b*this.n31+c*this.n32+d*this.n33;a.normalize();
 d+this.n24)*e;a.z=(this.n31*b+this.n32*c+this.n33*d+this.n34)*e;return a},multiplyVector4:function(a){var b=a.x,c=a.y,d=a.z,e=a.w;a.x=this.n11*b+this.n12*c+this.n13*d+this.n14*e;a.y=this.n21*b+this.n22*c+this.n23*d+this.n24*e;a.z=this.n31*b+this.n32*c+this.n33*d+this.n34*e;a.w=this.n41*b+this.n42*c+this.n43*d+this.n44*e;return a},rotateAxis:function(a){var b=a.x,c=a.y,d=a.z;a.x=b*this.n11+c*this.n12+d*this.n13;a.y=b*this.n21+c*this.n22+d*this.n23;a.z=b*this.n31+c*this.n32+d*this.n33;a.normalize();
-return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var c=a.n11,d=a.n12,e=a.n13,h=a.n14,f=a.n21,i=a.n22,g=a.n23,j=a.n24,m=a.n31,k=a.n32,n=a.n33,l=a.n34,r=a.n41,s=a.n42,y=a.n43,u=a.n44,H=b.n11,I=b.n12,D=b.n13,w=b.n14,o=b.n21,O=b.n22,
-J=b.n23,K=b.n24,P=b.n31,C=b.n32,x=b.n33,F=b.n34;this.n11=c*H+d*o+e*P;this.n12=c*I+d*O+e*C;this.n13=c*D+d*J+e*x;this.n14=c*w+d*K+e*F+h;this.n21=f*H+i*o+g*P;this.n22=f*I+i*O+g*C;this.n23=f*D+i*J+g*x;this.n24=f*w+i*K+g*F+j;this.n31=m*H+k*o+n*P;this.n32=m*I+k*O+n*C;this.n33=m*D+k*J+n*x;this.n34=m*w+k*K+n*F+l;this.n41=r*H+s*o+y*P;this.n42=r*I+s*O+y*C;this.n43=r*D+s*J+y*x;this.n44=r*w+s*K+y*F+u;return this},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=
+return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var c=a.n11,d=a.n12,e=a.n13,g=a.n14,f=a.n21,j=a.n22,h=a.n23,i=a.n24,k=a.n31,n=a.n32,m=a.n33,o=a.n34,q=a.n41,r=a.n42,v=a.n43,w=a.n44,I=b.n11,D=b.n12,N=b.n13,x=b.n14,l=b.n21,J=b.n22,
+K=b.n23,P=b.n24,L=b.n31,B=b.n32,z=b.n33,M=b.n34;this.n11=c*I+d*l+e*L;this.n12=c*D+d*J+e*B;this.n13=c*N+d*K+e*z;this.n14=c*x+d*P+e*M+g;this.n21=f*I+j*l+h*L;this.n22=f*D+j*J+h*B;this.n23=f*N+j*K+h*z;this.n24=f*x+j*P+h*M+i;this.n31=k*I+n*l+m*L;this.n32=k*D+n*J+m*B;this.n33=k*N+n*K+m*z;this.n34=k*x+n*P+m*M+o;this.n41=q*I+r*l+v*L;this.n42=q*D+r*J+v*B;this.n43=q*N+r*K+v*z;this.n44=q*x+r*P+v*M+w;return this},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=
 this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplySelf:function(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=
 this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplySelf:function(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=
-this.n11,b=this.n12,c=this.n13,d=this.n14,e=this.n21,h=this.n22,f=this.n23,i=this.n24,g=this.n31,j=this.n32,m=this.n33,k=this.n34,n=this.n41,l=this.n42,r=this.n43,s=this.n44;return d*f*j*n-c*i*j*n-d*h*m*n+b*i*m*n+c*h*k*n-b*f*k*n-d*f*g*l+c*i*g*l+d*e*m*l-a*i*m*l-c*e*k*l+a*f*k*l+d*h*g*r-b*i*g*r-d*e*j*r+a*i*j*r+b*e*k*r-a*h*k*r-c*h*g*s+b*f*g*s+c*e*j*s-a*f*j*s-b*e*m*s+a*h*m*s},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=
+this.n11,b=this.n12,c=this.n13,d=this.n14,e=this.n21,g=this.n22,f=this.n23,j=this.n24,h=this.n31,i=this.n32,k=this.n33,n=this.n34,m=this.n41,o=this.n42,q=this.n43,r=this.n44;return d*f*i*m-c*j*i*m-d*g*k*m+b*j*k*m+c*g*n*m-b*f*n*m-d*f*h*o+c*j*h*o+d*e*k*o-a*j*k*o-c*e*n*o+a*f*n*o+d*g*h*q-b*j*h*q-d*e*i*q+a*j*i*q+b*e*n*q-a*g*n*q-c*g*h*r+b*f*h*r+c*e*i*r-a*f*i*r-b*e*k*r+a*g*k*r},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=
 this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;
 this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;
 this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=
 this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=
 this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},setScale:function(a,
 this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},setScale:function(a,
-b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotationX:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotationY:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotationZ:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,h=a.x,f=a.y,i=a.z,g=e*h,j=e*f;this.set(g*
-h+c,g*f-d*i,g*i+d*f,0,g*f+d*i,j*f+c,j*i-d*h,0,g*i-d*f,j*i+d*h,e*i*i+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX=new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3;
-this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(a){var b=a.x,c=a.y,d=a.z;a=Math.cos(b);b=Math.sin(b);var e=Math.cos(c);c=Math.sin(c);var h=Math.cos(d);d=Math.sin(d);var f=a*c,i=b*c;this.n11=e*h;this.n12=-e*d;this.n13=c;this.n21=i*h+a*d;this.n22=-i*d+a*h;this.n23=-b*e;this.n31=-f*h+b*d;this.n32=f*d+b*h;this.n33=a*e;return this},
-setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,e=a.w,h=b+b,f=c+c,i=d+d;a=b*h;var g=b*f;b*=i;var j=c*f;c*=i;d*=i;h*=e;f*=e;e*=i;this.n11=1-(j+d);this.n12=g-e;this.n13=b+f;this.n21=g+e;this.n22=1-(a+d);this.n23=c-h;this.n31=b-f;this.n32=c+h;this.n33=1-(a+j);return this},scale:function(a){var b=a.x,c=a.y;a=a.z;this.n11*=b;this.n12*=c;this.n13*=a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},extractPosition:function(a){this.n14=
+b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotationX:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotationY:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotationZ:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,g=a.x,f=a.y,j=a.z,h=e*g,i=e*f;this.set(h*
+g+c,h*f-d*j,h*j+d*f,0,h*f+d*j,i*f+c,i*j-d*g,0,h*j-d*f,i*j+d*g,e*j*j+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX=new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3;
+this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(a){var b=a.x,c=a.y,d=a.z;a=Math.cos(b);b=Math.sin(b);var e=Math.cos(c);c=Math.sin(c);var g=Math.cos(d);d=Math.sin(d);var f=a*c,j=b*c;this.n11=e*g;this.n12=-e*d;this.n13=c;this.n21=j*g+a*d;this.n22=-j*d+a*g;this.n23=-b*e;this.n31=-f*g+b*d;this.n32=f*d+b*g;this.n33=a*e;return this},
+setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,e=a.w,g=b+b,f=c+c,j=d+d;a=b*g;var h=b*f;b*=j;var i=c*f;c*=j;d*=j;g*=e;f*=e;e*=j;this.n11=1-(i+d);this.n12=h-e;this.n13=b+f;this.n21=h+e;this.n22=1-(a+d);this.n23=c-g;this.n31=b-f;this.n32=c+g;this.n33=1-(a+i);return this},scale:function(a){var b=a.x,c=a.y;a=a.z;this.n11*=b;this.n12*=c;this.n13*=a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},extractPosition:function(a){this.n14=
 a.n14;this.n24=a.n24;this.n34=a.n34},extractRotation:function(a,b){var c=1/b.x,d=1/b.y,e=1/b.z;this.n11=a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*d;this.n22=a.n22*d;this.n32=a.n32*d;this.n13=a.n13*e;this.n23=a.n23*e;this.n33=a.n33*e}};
 a.n14;this.n24=a.n24;this.n34=a.n34},extractRotation:function(a,b){var c=1/b.x,d=1/b.y,e=1/b.z;this.n11=a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*d;this.n22=a.n22*d;this.n32=a.n32*d;this.n13=a.n13*e;this.n23=a.n23*e;this.n33=a.n33*e}};
-THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,d=a.n12,e=a.n13,h=a.n14,f=a.n21,i=a.n22,g=a.n23,j=a.n24,m=a.n31,k=a.n32,n=a.n33,l=a.n34,r=a.n41,s=a.n42,y=a.n43,u=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=g*l*s-j*n*s+j*k*y-i*l*y-g*k*u+i*n*u;b.n12=h*n*s-e*l*s-h*k*y+d*l*y+e*k*u-d*n*u;b.n13=e*j*s-h*g*s+h*i*y-d*j*y-e*i*u+d*g*u;b.n14=h*g*k-e*j*k-h*i*n+d*j*n+e*i*l-d*g*l;b.n21=j*n*r-g*l*r-j*m*y+f*l*y+g*m*u-f*n*u;b.n22=e*l*r-h*n*r+h*m*y-c*l*y-e*m*u+c*n*u;b.n23=h*g*r-e*j*r-h*f*y+c*j*y+e*f*u-c*g*u;
-b.n24=e*j*m-h*g*m+h*f*n-c*j*n-e*f*l+c*g*l;b.n31=i*l*r-j*k*r+j*m*s-f*l*s-i*m*u+f*k*u;b.n32=h*k*r-d*l*r-h*m*s+c*l*s+d*m*u-c*k*u;b.n33=e*j*r-h*i*r+h*f*s-c*j*s-d*f*u+c*i*u;b.n34=h*i*m-d*j*m-h*f*k+c*j*k+d*f*l-c*i*l;b.n41=g*k*r-i*n*r-g*m*s+f*n*s+i*m*y-f*k*y;b.n42=d*n*r-e*k*r+e*m*s-c*n*s-d*m*y+c*k*y;b.n43=e*i*r-d*g*r-e*f*s+c*g*s+d*f*y-c*i*y;b.n44=d*g*m-e*i*m+e*f*k-c*g*k-d*f*n+c*i*n;b.multiplyScalar(1/a.determinant());return b};
-THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,e=-a.n33*a.n21+a.n31*a.n23,h=a.n32*a.n21-a.n31*a.n22,f=-a.n33*a.n12+a.n32*a.n13,i=a.n33*a.n11-a.n31*a.n13,g=-a.n32*a.n11+a.n31*a.n12,j=a.n23*a.n12-a.n22*a.n13,m=-a.n23*a.n11+a.n21*a.n13,k=a.n22*a.n11-a.n21*a.n12;a=a.n11*d+a.n21*f+a.n31*j;if(a==0)throw"matrix not invertible";a=1/a;c[0]=a*d;c[1]=a*e;c[2]=a*h;c[3]=a*f;c[4]=a*i;c[5]=a*g;c[6]=a*j;c[7]=a*m;c[8]=a*k;return b};
-THREE.Matrix4.makeFrustum=function(a,b,c,d,e,h){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=-(h+e)/(h-e);f.n34=-2*h*e/(h-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,h){var f,i,g,j;f=new THREE.Matrix4;i=b-a;g=c-d;j=h-e;f.n11=2/i;f.n12=0;f.n13=0;f.n14=-((b+a)/i);f.n21=0;f.n22=2/g;f.n23=0;f.n24=-((c+d)/g);f.n31=0;f.n32=0;f.n33=-2/j;f.n34=-((h+e)/j);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.Matrix4.makeInvert=function(a,b){var c=a.n11,d=a.n12,e=a.n13,g=a.n14,f=a.n21,j=a.n22,h=a.n23,i=a.n24,k=a.n31,n=a.n32,m=a.n33,o=a.n34,q=a.n41,r=a.n42,v=a.n43,w=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=h*o*r-i*m*r+i*n*v-j*o*v-h*n*w+j*m*w;b.n12=g*m*r-e*o*r-g*n*v+d*o*v+e*n*w-d*m*w;b.n13=e*i*r-g*h*r+g*j*v-d*i*v-e*j*w+d*h*w;b.n14=g*h*n-e*i*n-g*j*m+d*i*m+e*j*o-d*h*o;b.n21=i*m*q-h*o*q-i*k*v+f*o*v+h*k*w-f*m*w;b.n22=e*o*q-g*m*q+g*k*v-c*o*v-e*k*w+c*m*w;b.n23=g*h*q-e*i*q-g*f*v+c*i*v+e*f*w-c*h*w;
+b.n24=e*i*k-g*h*k+g*f*m-c*i*m-e*f*o+c*h*o;b.n31=j*o*q-i*n*q+i*k*r-f*o*r-j*k*w+f*n*w;b.n32=g*n*q-d*o*q-g*k*r+c*o*r+d*k*w-c*n*w;b.n33=e*i*q-g*j*q+g*f*r-c*i*r-d*f*w+c*j*w;b.n34=g*j*k-d*i*k-g*f*n+c*i*n+d*f*o-c*j*o;b.n41=h*n*q-j*m*q-h*k*r+f*m*r+j*k*v-f*n*v;b.n42=d*m*q-e*n*q+e*k*r-c*m*r-d*k*v+c*n*v;b.n43=e*j*q-d*h*q-e*f*r+c*h*r+d*f*v-c*j*v;b.n44=d*h*k-e*j*k+e*f*n-c*h*n-d*f*m+c*j*m;b.multiplyScalar(1/a.determinant());return b};
+THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,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,j=a.n33*a.n11-a.n31*a.n13,h=-a.n32*a.n11+a.n31*a.n12,i=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*i;if(a==0)throw"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*j;c[5]=a*h;c[6]=a*i;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,j,h,i;f=new THREE.Matrix4;j=b-a;h=c-d;i=g-e;f.n11=2/j;f.n12=0;f.n13=0;f.n14=-((b+a)/j);f.n21=0;f.n22=2/h;f.n23=0;f.n24=-((c+d)/h);f.n31=0;f.n32=0;f.n33=-2/i;f.n34=-((g+e)/i);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=undefined;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.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixAutoUpdate=!0;this.matrixWorldNeedsUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=
 THREE.Object3D=function(){this.parent=undefined;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.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixAutoUpdate=!0;this.matrixWorldNeedsUpdate=!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=""};
 !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)===
 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!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);for(var b=this;b.parent!==undefined;)b=b.parent;b!==undefined&&b instanceof THREE.Scene&&b.addChildRecurse(a)}},removeChild:function(a){var b=this.children.indexOf(a);if(b!==-1){a.parent=undefined;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);if(e!==undefined)return e}}},updateMatrix:function(){this.matrix.setPosition(this.position);
 -1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);for(var b=this;b.parent!==undefined;)b=b.parent;b!==undefined&&b instanceof THREE.Scene&&b.addChildRecurse(a)}},removeChild:function(a){var b=this.children.indexOf(a);if(b!==-1){a.parent=undefined;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);if(e!==undefined)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.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,this.scale);this.matrixWorldNeedsUpdate=!1;b=!0}a=0;for(var d=this.children.length;a<d;a++)this.children[a].update(this.matrixWorld,b,c)}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==undefined?d:1)};
 this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale);this.matrixWorldNeedsUpdate=!1;b=!0}a=0;for(var d=this.children.length;a<d;a++)this.children[a].update(this.matrixWorld,b,c)}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==undefined?d:1)};
-THREE.Quaternion.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b;a=Math.cos(d);d=Math.sin(d);b=Math.cos(-e);e=Math.sin(-e);var h=Math.cos(c);c=Math.sin(c);var f=a*b,i=d*e;this.w=f*h-i*c;this.x=f*c+i*h;this.y=d*b*h+a*e*c;this.z=a*e*h-d*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);this.x=a.x*d;this.y=
+THREE.Quaternion.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b;a=Math.cos(d);d=Math.sin(d);b=Math.cos(-e);e=Math.sin(-e);var g=Math.cos(c);c=Math.sin(c);var f=a*b,j=d*e;this.w=f*g-j*c;this.x=f*c+j*g;this.y=d*b*g+a*e*c;this.z=a*e*g-d*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);this.x=a.x*d;this.y=
 a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},
 a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},
-multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,h=a.x,f=a.y,i=a.z;a=a.w;this.x=b*a+e*h+c*i-d*f;this.y=c*a+e*f+d*h-b*i;this.z=d*a+e*i+b*f-c*h;this.w=e*a-b*h-c*f-d*i;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,h=this.x,f=this.y,i=this.z,g=this.w,j=g*c+f*e-i*d,m=
-g*d+i*c-h*e,k=g*e+h*d-f*c;c=-h*c-f*d-i*e;b.x=j*g+c*-h+m*-i-k*-f;b.y=m*g+c*-f+k*-h-j*-i;b.z=k*g+c*-i+j*-f-m*-h;return b}};
-THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var h=Math.acos(e),f=Math.sqrt(1-e*e);if(Math.abs(f)<0.001){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}e=Math.sin((1-d)*h)/f;d=Math.sin(d*h)/f;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
-THREE.Face3=function(a,b,c,d,e,h){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};
-THREE.Face4=function(a,b,c,d,e,h,f){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=f instanceof Array?f:[f];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.set(a||0,b||0)};
+multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,g=a.x,f=a.y,j=a.z;a=a.w;this.x=b*a+e*g+c*j-d*f;this.y=c*a+e*f+d*g-b*j;this.z=d*a+e*j+b*f-c*g;this.w=e*a-b*g-c*f-d*j;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,g=this.x,f=this.y,j=this.z,h=this.w,i=h*c+f*e-j*d,k=
+h*d+j*c-g*e,n=h*e+g*d-f*c;c=-g*c-f*d-j*e;b.x=i*h+c*-g+k*-j-n*-f;b.y=k*h+c*-f+n*-g-i*-j;b.z=n*h+c*-j+i*-f-k*-g;return b}};
+THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var g=Math.acos(e),f=Math.sqrt(1-e*e);if(Math.abs(f)<0.001){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}e=Math.sin((1-d)*g)/f;d=Math.sin(d*g)/f;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
+THREE.Face3=function(a,b,c,d,e,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.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.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
 THREE.Geometry.prototype={computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];c.centroid.set(0,0,0);if(c instanceof THREE.Face3){c.centroid.addSelf(this.vertices[c.a].position);c.centroid.addSelf(this.vertices[c.b].position);c.centroid.addSelf(this.vertices[c.c].position);c.centroid.divideScalar(3)}else if(c instanceof THREE.Face4){c.centroid.addSelf(this.vertices[c.a].position);c.centroid.addSelf(this.vertices[c.b].position);c.centroid.addSelf(this.vertices[c.c].position);
 THREE.Geometry.prototype={computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];c.centroid.set(0,0,0);if(c instanceof THREE.Face3){c.centroid.addSelf(this.vertices[c.a].position);c.centroid.addSelf(this.vertices[c.b].position);c.centroid.addSelf(this.vertices[c.c].position);c.centroid.divideScalar(3)}else if(c instanceof THREE.Face4){c.centroid.addSelf(this.vertices[c.a].position);c.centroid.addSelf(this.vertices[c.b].position);c.centroid.addSelf(this.vertices[c.c].position);
-c.centroid.addSelf(this.vertices[c.d].position);c.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var b,c,d,e,h,f,i=new THREE.Vector3,g=new THREE.Vector3;d=0;for(e=this.faces.length;d<e;d++){h=this.faces[d];if(a&&h.vertexNormals.length){i.set(0,0,0);b=0;for(c=h.vertexNormals.length;b<c;b++)i.addSelf(h.vertexNormals[b]);i.divideScalar(3)}else{b=this.vertices[h.a];c=this.vertices[h.b];f=this.vertices[h.c];i.sub(f.position,c.position);g.sub(b.position,c.position);i.crossSelf(g)}i.isZero()||
-i.normalize();h.normal.copy(i)}},computeVertexNormals:function(){var a,b,c,d;if(this.__tmpVertices==undefined){d=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{d=
+c.centroid.addSelf(this.vertices[c.d].position);c.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var b,c,d,e,g,f,j=new THREE.Vector3,h=new THREE.Vector3;d=0;for(e=this.faces.length;d<e;d++){g=this.faces[d];if(a&&g.vertexNormals.length){j.set(0,0,0);b=0;for(c=g.vertexNormals.length;b<c;b++)j.addSelf(g.vertexNormals[b]);j.divideScalar(3)}else{b=this.vertices[g.a];c=this.vertices[g.b];f=this.vertices[g.c];j.sub(f.position,c.position);h.sub(b.position,c.position);j.crossSelf(h)}j.isZero()||
+j.normalize();g.normal.copy(j)}},computeVertexNormals:function(){var a,b,c,d;if(this.__tmpVertices==undefined){d=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{d=
 this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal)}else if(c instanceof THREE.Face4){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal);d[c.d].addSelf(c.normal)}}a=0;for(b=this.vertices.length;a<b;a++)d[a].normalize();a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){c.vertexNormals[0].copy(d[c.a]);
 this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal)}else if(c instanceof THREE.Face4){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal);d[c.d].addSelf(c.normal)}}a=0;for(b=this.vertices.length;a<b;a++)d[a].normalize();a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){c.vertexNormals[0].copy(d[c.a]);
-c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c]);c.vertexNormals[3].copy(d[c.d])}}},computeTangents:function(){function a(t,G,z,E,p,q,A){i=t.vertices[G].position;g=t.vertices[z].position;j=t.vertices[E].position;m=f[p];k=f[q];n=f[A];l=g.x-i.x;r=j.x-i.x;s=g.y-i.y;y=j.y-i.y;u=g.z-i.z;H=j.z-i.z;I=k.u-m.u;D=n.u-m.u;w=k.v-m.v;o=n.v-m.v;O=1/(I*o-D*w);C.set((o*
-l-w*r)*O,(o*s-w*y)*O,(o*u-w*H)*O);x.set((I*r-D*l)*O,(I*y-D*s)*O,(I*H-D*u)*O);K[G].addSelf(C);K[z].addSelf(C);K[E].addSelf(C);P[G].addSelf(x);P[z].addSelf(x);P[E].addSelf(x)}var b,c,d,e,h,f,i,g,j,m,k,n,l,r,s,y,u,H,I,D,w,o,O,J,K=[],P=[],C=new THREE.Vector3,x=new THREE.Vector3,F=new THREE.Vector3,M=new THREE.Vector3,Q=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++){K[b]=new THREE.Vector3;P[b]=new THREE.Vector3}b=0;for(c=this.faces.length;b<c;b++){h=this.faces[b];f=this.faceVertexUvs[0][b];
-if(h instanceof THREE.Face3)a(this,h.a,h.b,h.c,0,1,2);else if(h instanceof THREE.Face4){a(this,h.a,h.b,h.c,0,1,2);a(this,h.a,h.b,h.d,0,1,3)}}var L=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){h=this.faces[b];for(d=0;d<h.vertexNormals.length;d++){Q.copy(h.vertexNormals[d]);e=h[L[d]];J=K[e];F.copy(J);F.subSelf(Q.multiplyScalar(Q.dot(J))).normalize();M.cross(h.vertexNormals[d],J);e=M.dot(P[e]);e=e<0?-1:1;h.vertexTangents[d]=new THREE.Vector4(F.x,F.y,F.z,e)}}this.hasTangents=!0},computeBoundingBox:function(){var a;
+c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c]);c.vertexNormals[3].copy(d[c.d])}}},computeTangents:function(){function a(F,t,C,A,y,s,p){j=F.vertices[t].position;h=F.vertices[C].position;i=F.vertices[A].position;k=f[y];n=f[s];m=f[p];o=h.x-j.x;q=i.x-j.x;r=h.y-j.y;v=i.y-j.y;w=h.z-j.z;I=i.z-j.z;D=n.u-k.u;N=m.u-k.u;x=n.v-k.v;l=m.v-k.v;J=1/(D*l-N*x);B.set((l*
+o-x*q)*J,(l*r-x*v)*J,(l*w-x*I)*J);z.set((D*q-N*o)*J,(D*v-N*r)*J,(D*I-N*w)*J);P[t].addSelf(B);P[C].addSelf(B);P[A].addSelf(B);L[t].addSelf(z);L[C].addSelf(z);L[A].addSelf(z)}var b,c,d,e,g,f,j,h,i,k,n,m,o,q,r,v,w,I,D,N,x,l,J,K,P=[],L=[],B=new THREE.Vector3,z=new THREE.Vector3,M=new THREE.Vector3,G=new THREE.Vector3,Q=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++){P[b]=new THREE.Vector3;L[b]=new THREE.Vector3}b=0;for(c=this.faces.length;b<c;b++){g=this.faces[b];f=this.faceVertexUvs[0][b];
+if(g instanceof THREE.Face3)a(this,g.a,g.b,g.c,0,1,2);else if(g instanceof THREE.Face4){a(this,g.a,g.b,g.c,0,1,2);a(this,g.a,g.b,g.d,0,1,3)}}var O=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){g=this.faces[b];for(d=0;d<g.vertexNormals.length;d++){Q.copy(g.vertexNormals[d]);e=g[O[d]];K=P[e];M.copy(K);M.subSelf(Q.multiplyScalar(Q.dot(K))).normalize();G.cross(g.vertexNormals[d],K);e=G.dot(L[e]);e=e<0?-1:1;g.vertexTangents[d]=new THREE.Vector4(M.x,M.y,M.z,e)}}this.hasTangents=!0},computeBoundingBox:function(){var a;
 if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,c=this.vertices.length;b<c;b++){a=this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;
 if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,c=this.vertices.length;b<c;b++){a=this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;
-else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,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(g,j){return Math.min(g,
-j)+"_"+Math.max(g,j)}function b(g,j,m){if(g[j]===undefined){g[j]={set:{},array:[]};g[j].set[m]=1;g[j].array.push(m)}else if(g[j].set[m]===undefined){g[j].set[m]=1;g[j].array.push(m)}}var c,d,e,h,f,i={};c=0;for(d=this.faces.length;c<d;c++){f=this.faces[c];if(f instanceof THREE.Face3){e=a(f.a,f.b);b(i,e,c);e=a(f.b,f.c);b(i,e,c);e=a(f.a,f.c);b(i,e,c)}else if(f instanceof THREE.Face4){e=a(f.b,f.d);b(i,e,c);e=a(f.a,f.b);b(i,e,c);e=a(f.a,f.d);b(i,e,c);e=a(f.b,f.c);b(i,e,c);e=a(f.c,f.d);b(i,e,c)}}c=0;for(d=
-this.edges.length;c<d;c++){f=this.edges[c];e=f.vertexIndices[0];h=f.vertexIndices[1];f.faceIndices=i[a(e,h)].array;for(e=0;e<f.faceIndices.length;e++){h=f.faceIndices[e];f.faces.push(this.faces[h])}}}};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()};
+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=this.boundingSphere===null?0:this.boundingSphere.radius,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(h,i){return Math.min(h,
+i)+"_"+Math.max(h,i)}function b(h,i,k){if(h[i]===undefined){h[i]={set:{},array:[]};h[i].set[k]=1;h[i].array.push(k)}else if(h[i].set[k]===undefined){h[i].set[k]=1;h[i].array.push(k)}}var c,d,e,g,f,j={};c=0;for(d=this.faces.length;c<d;c++){f=this.faces[c];if(f instanceof THREE.Face3){e=a(f.a,f.b);b(j,e,c);e=a(f.b,f.c);b(j,e,c);e=a(f.a,f.c);b(j,e,c)}else if(f instanceof THREE.Face4){e=a(f.b,f.d);b(j,e,c);e=a(f.a,f.b);b(j,e,c);e=a(f.a,f.d);b(j,e,c);e=a(f.b,f.c);b(j,e,c);e=a(f.c,f.d);b(j,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=j[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);this.position.addSelf(b.multiplyScalar(a));this.target.position.addSelf(b.multiplyScalar(a))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};
 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);this.position.addSelf(b.multiplyScalar(a));this.target.position.addSelf(b.multiplyScalar(a))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};
 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{this.matrixAutoUpdate&&this.updateMatrix();if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=
 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{this.matrixAutoUpdate&&this.updateMatrix();if(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;
 !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;
@@ -99,30 +98,30 @@ 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.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 if(a instanceof THREE.Sound){b=this.sounds.indexOf(a);b!==-1&&this.sounds.splice(b,1)}else if(!(a instanceof THREE.Camera)){b=this.objects.indexOf(a);if(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.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 if(a instanceof THREE.Sound){b=this.sounds.indexOf(a);b!==-1&&this.sounds.splice(b,1)}else if(!(a instanceof THREE.Camera)){b=this.objects.indexOf(a);if(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.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 C=g[i]=g[i]||new THREE.RenderableVertex;i++;return C}function b(C,x){return x.z-C.z}function c(C,x){var F=0,M=1,Q=C.z+C.w,L=x.z+x.w,t=-C.z+C.w,G=-x.z+x.w;if(Q>=0&&L>=0&&t>=0&&G>=0)return!0;else if(Q<0&&L<0||t<0&&G<0)return!1;else{if(Q<0)F=Math.max(F,Q/(Q-L));else L<0&&(M=Math.min(M,Q/(Q-L)));if(t<0)F=Math.max(F,t/(t-G));else G<0&&(M=Math.min(M,t/(t-G)));if(M<F)return!1;else{C.lerpSelf(x,F);x.lerpSelf(C,1-M);return!0}}}var d,e,h=[],f,i,g=[],j,m,k=[],n,l=
-[],r,s,y=[],u,H,I=[],D=new THREE.Vector4,w=new THREE.Vector4,o=new THREE.Matrix4,O=new THREE.Matrix4,J=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],K=new THREE.Vector4,P=new THREE.Vector4;this.projectVector=function(C,x){o.multiply(x.projectionMatrix,x.matrixWorldInverse);o.multiplyVector3(C);return C};this.unprojectVector=function(C,x){o.multiply(x.matrixWorld,THREE.Matrix4.makeInvert(x.projectionMatrix));o.multiplyVector3(C);return C};
-this.projectObjects=function(C,x,F){x=[];var M,Q,L;e=0;Q=C.objects;C=0;for(M=Q.length;C<M;C++){L=Q[C];var t;if(!(t=!L.visible))if(t=L instanceof THREE.Mesh){a:{t=void 0;for(var G=L.matrixWorld,z=-L.geometry.boundingSphere.radius*Math.max(L.scale.x,Math.max(L.scale.y,L.scale.z)),E=0;E<6;E++){t=J[E].x*G.n14+J[E].y*G.n24+J[E].z*G.n34+J[E].w;if(t<=z){t=!1;break a}}t=!0}t=!t}if(!t){t=h[e]=h[e]||new THREE.RenderableObject;e++;d=t;D.copy(L.position);o.multiplyVector3(D);d.object=L;d.z=D.z;x.push(d)}}F&&
-x.sort(b);return x};this.projectScene=function(C,x,F){var M=[],Q=x.near,L=x.far,t,G,z,E,p,q,A,N,B,v,R,U,W,X,S,V,T;H=s=n=m=0;x.matrixAutoUpdate&&x.update(undefined,!0);C.update(undefined,!1,x);o.multiply(x.projectionMatrix,x.matrixWorldInverse);J[0].set(o.n41-o.n11,o.n42-o.n12,o.n43-o.n13,o.n44-o.n14);J[1].set(o.n41+o.n11,o.n42+o.n12,o.n43+o.n13,o.n44+o.n14);J[2].set(o.n41+o.n21,o.n42+o.n22,o.n43+o.n23,o.n44+o.n24);J[3].set(o.n41-o.n21,o.n42-o.n22,o.n43-o.n23,o.n44-o.n24);J[4].set(o.n41-o.n31,o.n42-
-o.n32,o.n43-o.n33,o.n44-o.n34);J[5].set(o.n41+o.n31,o.n42+o.n32,o.n43+o.n33,o.n44+o.n34);for(t=0;t<6;t++){B=J[t];B.divideScalar(Math.sqrt(B.x*B.x+B.y*B.y+B.z*B.z))}B=this.projectObjects(C,x,!0);C=0;for(t=B.length;C<t;C++){v=B[C].object;if(v.visible){R=v.matrixWorld;U=v.matrixRotationWorld;W=v.materials;X=v.overdraw;i=0;if(v instanceof THREE.Mesh){S=v.geometry;E=S.vertices;V=S.faces;S=S.faceVertexUvs;G=0;for(z=E.length;G<z;G++){f=a();f.positionWorld.copy(E[G].position);R.multiplyVector3(f.positionWorld);
-f.positionScreen.copy(f.positionWorld);o.multiplyVector4(f.positionScreen);f.positionScreen.x/=f.positionScreen.w;f.positionScreen.y/=f.positionScreen.w;f.visible=f.positionScreen.z>Q&&f.positionScreen.z<L}E=0;for(G=V.length;E<G;E++){z=V[E];if(z instanceof THREE.Face3){p=g[z.a];q=g[z.b];A=g[z.c];if(p.visible&&q.visible&&A.visible&&(v.doubleSided||v.flipSided!=(A.positionScreen.x-p.positionScreen.x)*(q.positionScreen.y-p.positionScreen.y)-(A.positionScreen.y-p.positionScreen.y)*(q.positionScreen.x-
-p.positionScreen.x)<0)){N=k[m]=k[m]||new THREE.RenderableFace3;m++;j=N;j.v1.copy(p);j.v2.copy(q);j.v3.copy(A)}else continue}else if(z instanceof THREE.Face4){p=g[z.a];q=g[z.b];A=g[z.c];N=g[z.d];if(p.visible&&q.visible&&A.visible&&N.visible&&(v.doubleSided||v.flipSided!=((N.positionScreen.x-p.positionScreen.x)*(q.positionScreen.y-p.positionScreen.y)-(N.positionScreen.y-p.positionScreen.y)*(q.positionScreen.x-p.positionScreen.x)<0||(q.positionScreen.x-A.positionScreen.x)*(N.positionScreen.y-A.positionScreen.y)-
-(q.positionScreen.y-A.positionScreen.y)*(N.positionScreen.x-A.positionScreen.x)<0))){T=l[n]=l[n]||new THREE.RenderableFace4;n++;j=T;j.v1.copy(p);j.v2.copy(q);j.v3.copy(A);j.v4.copy(N)}else continue}j.normalWorld.copy(z.normal);U.multiplyVector3(j.normalWorld);j.centroidWorld.copy(z.centroid);R.multiplyVector3(j.centroidWorld);j.centroidScreen.copy(j.centroidWorld);o.multiplyVector3(j.centroidScreen);A=z.vertexNormals;p=0;for(q=A.length;p<q;p++){N=j.vertexNormalsWorld[p];N.copy(A[p]);U.multiplyVector3(N)}p=
-0;for(q=S.length;p<q;p++)if(T=S[p][E]){A=0;for(N=T.length;A<N;A++)j.uvs[p][A]=T[A]}j.meshMaterials=W;j.faceMaterials=z.materials;j.overdraw=X;j.z=j.centroidScreen.z;M.push(j)}}else if(v instanceof THREE.Line){O.multiply(o,R);E=v.geometry.vertices;p=a();p.positionScreen.copy(E[0].position);O.multiplyVector4(p.positionScreen);G=1;for(z=E.length;G<z;G++){p=a();p.positionScreen.copy(E[G].position);O.multiplyVector4(p.positionScreen);q=g[i-2];K.copy(p.positionScreen);P.copy(q.positionScreen);if(c(K,P)){K.multiplyScalar(1/
-K.w);P.multiplyScalar(1/P.w);R=y[s]=y[s]||new THREE.RenderableLine;s++;r=R;r.v1.positionScreen.copy(K);r.v2.positionScreen.copy(P);r.z=Math.max(K.z,P.z);r.materials=v.materials;M.push(r)}}}else if(v instanceof THREE.Particle){w.set(v.matrixWorld.n14,v.matrixWorld.n24,v.matrixWorld.n34,1);o.multiplyVector4(w);w.z/=w.w;if(w.z>0&&w.z<1){R=I[H]=I[H]||new THREE.RenderableParticle;H++;u=R;u.x=w.x/w.w;u.y=w.y/w.w;u.z=w.z;u.rotation=v.rotation.z;u.scale.x=v.scale.x*Math.abs(u.x-(w.x+x.projectionMatrix.n11)/
-(w.w+x.projectionMatrix.n14));u.scale.y=v.scale.y*Math.abs(u.y-(w.y+x.projectionMatrix.n22)/(w.w+x.projectionMatrix.n24));u.materials=v.materials;M.push(u)}}}}F&&M.sort(b);return M}};
-THREE.SVGRenderer=function(){function a(t,G,z){var E,p,q,A;E=0;for(p=t.lights.length;E<p;E++){q=t.lights[E];if(q instanceof THREE.DirectionalLight){A=G.normalWorld.dot(q.position)*q.intensity;if(A>0){z.r+=q.color.r*A;z.g+=q.color.g*A;z.b+=q.color.b*A}}else if(q instanceof THREE.PointLight){P.sub(q.position,G.centroidWorld);P.normalize();A=G.normalWorld.dot(P)*q.intensity;if(A>0){z.r+=q.color.r*A;z.g+=q.color.g*A;z.b+=q.color.b*A}}}}function b(t,G,z,E,p,q){h.data.vertices+=3;h.data.faces++;F=d(M++);
-F.setAttribute("d","M "+t.positionScreen.x+" "+t.positionScreen.y+" L "+G.positionScreen.x+" "+G.positionScreen.y+" L "+z.positionScreen.x+","+z.positionScreen.y+"z");if(p instanceof THREE.MeshBasicMaterial)D.__styleString=p.color.__styleString;else if(p instanceof THREE.MeshLambertMaterial)if(I){w.r=o.r;w.g=o.g;w.b=o.b;a(q,E,w);D.r=p.color.r*w.r;D.g=p.color.g*w.g;D.b=p.color.b*w.b;D.updateStyleString()}else D.__styleString=p.color.__styleString;else if(p instanceof THREE.MeshDepthMaterial){K=1-p.__2near/
-(p.__farPlusNear-E.z*p.__farMinusNear);D.setRGB(K,K,K)}else p instanceof THREE.MeshNormalMaterial&&D.setRGB(e(E.normalWorld.x),e(E.normalWorld.y),e(E.normalWorld.z));p.wireframe?F.setAttribute("style","fill: none; stroke: "+D.__styleString+"; stroke-width: "+p.wireframeLinewidth+"; stroke-opacity: "+p.opacity+"; stroke-linecap: "+p.wireframeLinecap+"; stroke-linejoin: "+p.wireframeLinejoin):F.setAttribute("style","fill: "+D.__styleString+"; fill-opacity: "+p.opacity);g.appendChild(F)}function c(t,
-G,z,E,p,q,A){h.data.vertices+=4;h.data.faces++;F=d(M++);F.setAttribute("d","M "+t.positionScreen.x+" "+t.positionScreen.y+" L "+G.positionScreen.x+" "+G.positionScreen.y+" L "+z.positionScreen.x+","+z.positionScreen.y+" L "+E.positionScreen.x+","+E.positionScreen.y+"z");if(q instanceof THREE.MeshBasicMaterial)D.__styleString=q.color.__styleString;else if(q instanceof THREE.MeshLambertMaterial)if(I){w.r=o.r;w.g=o.g;w.b=o.b;a(A,p,w);D.r=q.color.r*w.r;D.g=q.color.g*w.g;D.b=q.color.b*w.b;D.updateStyleString()}else D.__styleString=
-q.color.__styleString;else if(q instanceof THREE.MeshDepthMaterial){K=1-q.__2near/(q.__farPlusNear-p.z*q.__farMinusNear);D.setRGB(K,K,K)}else q instanceof THREE.MeshNormalMaterial&&D.setRGB(e(p.normalWorld.x),e(p.normalWorld.y),e(p.normalWorld.z));q.wireframe?F.setAttribute("style","fill: none; stroke: "+D.__styleString+"; stroke-width: "+q.wireframeLinewidth+"; stroke-opacity: "+q.opacity+"; stroke-linecap: "+q.wireframeLinecap+"; stroke-linejoin: "+q.wireframeLinejoin):F.setAttribute("style","fill: "+
-D.__styleString+"; fill-opacity: "+q.opacity);g.appendChild(F)}function d(t){if(C[t]==null){C[t]=document.createElementNS("http://www.w3.org/2000/svg","path");L==0&&C[t].setAttribute("shape-rendering","crispEdges")}return C[t]}function e(t){return t<0?Math.min((1+t)*0.5,0.5):0.5+Math.min(t*0.5,0.5)}var h=this,f=null,i=new THREE.Projector,g=document.createElementNS("http://www.w3.org/2000/svg","svg"),j,m,k,n,l,r,s,y,u=new THREE.Rectangle,H=new THREE.Rectangle,I=!1,D=new THREE.Color(16777215),w=new THREE.Color(16777215),
-o=new THREE.Color(0),O=new THREE.Color(0),J=new THREE.Color(0),K,P=new THREE.Vector3,C=[],x=[],F,M,Q,L=1;this.domElement=g;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.data={vertices:0,faces:0};this.setQuality=function(t){switch(t){case "high":L=1;break;case "low":L=0}};this.setSize=function(t,G){j=t;m=G;k=j/2;n=m/2;g.setAttribute("viewBox",-k+" "+-n+" "+j+" "+m);g.setAttribute("width",j);g.setAttribute("height",m);u.set(-k,-n,k,n)};this.clear=function(){for(;g.childNodes.length>
-0;)g.removeChild(g.childNodes[0])};this.render=function(t,G){var z,E,p,q,A,N,B,v;this.autoClear&&this.clear();h.data.vertices=0;h.data.faces=0;f=i.projectScene(t,G,this.sortElements);Q=M=0;if(I=t.lights.length>0){B=t.lights;o.setRGB(0,0,0);O.setRGB(0,0,0);J.setRGB(0,0,0);z=0;for(E=B.length;z<E;z++){p=B[z];q=p.color;if(p instanceof THREE.AmbientLight){o.r+=q.r;o.g+=q.g;o.b+=q.b}else if(p instanceof THREE.DirectionalLight){O.r+=q.r;O.g+=q.g;O.b+=q.b}else if(p instanceof THREE.PointLight){J.r+=q.r;J.g+=
-q.g;J.b+=q.b}}}z=0;for(E=f.length;z<E;z++){B=f[z];H.empty();if(B instanceof THREE.RenderableParticle){l=B;l.x*=k;l.y*=-n;p=0;for(q=B.materials.length;p<q;)p++}else if(B instanceof THREE.RenderableLine){l=B.v1;r=B.v2;l.positionScreen.x*=k;l.positionScreen.y*=-n;r.positionScreen.x*=k;r.positionScreen.y*=-n;H.addPoint(l.positionScreen.x,l.positionScreen.y);H.addPoint(r.positionScreen.x,r.positionScreen.y);if(u.instersects(H)){p=0;for(q=B.materials.length;p<q;)if((v=B.materials[p++])&&v.opacity!=0){A=
-l;N=r;var R=Q++;if(x[R]==null){x[R]=document.createElementNS("http://www.w3.org/2000/svg","line");L==0&&x[R].setAttribute("shape-rendering","crispEdges")}F=x[R];F.setAttribute("x1",A.positionScreen.x);F.setAttribute("y1",A.positionScreen.y);F.setAttribute("x2",N.positionScreen.x);F.setAttribute("y2",N.positionScreen.y);if(v instanceof THREE.LineBasicMaterial){D.__styleString=v.color.__styleString;F.setAttribute("style","fill: none; stroke: "+D.__styleString+"; stroke-width: "+v.linewidth+"; stroke-opacity: "+
-v.opacity+"; stroke-linecap: "+v.linecap+"; stroke-linejoin: "+v.linejoin);g.appendChild(F)}}}}else if(B instanceof THREE.RenderableFace3){l=B.v1;r=B.v2;s=B.v3;l.positionScreen.x*=k;l.positionScreen.y*=-n;r.positionScreen.x*=k;r.positionScreen.y*=-n;s.positionScreen.x*=k;s.positionScreen.y*=-n;H.addPoint(l.positionScreen.x,l.positionScreen.y);H.addPoint(r.positionScreen.x,r.positionScreen.y);H.addPoint(s.positionScreen.x,s.positionScreen.y);if(u.instersects(H)){p=0;for(q=B.meshMaterials.length;p<
-q;){v=B.meshMaterials[p++];if(v instanceof THREE.MeshFaceMaterial){A=0;for(N=B.faceMaterials.length;A<N;)(v=B.faceMaterials[A++])&&v.opacity!=0&&b(l,r,s,B,v,t)}else v&&v.opacity!=0&&b(l,r,s,B,v,t)}}}else if(B instanceof THREE.RenderableFace4){l=B.v1;r=B.v2;s=B.v3;y=B.v4;l.positionScreen.x*=k;l.positionScreen.y*=-n;r.positionScreen.x*=k;r.positionScreen.y*=-n;s.positionScreen.x*=k;s.positionScreen.y*=-n;y.positionScreen.x*=k;y.positionScreen.y*=-n;H.addPoint(l.positionScreen.x,l.positionScreen.y);
-H.addPoint(r.positionScreen.x,r.positionScreen.y);H.addPoint(s.positionScreen.x,s.positionScreen.y);H.addPoint(y.positionScreen.x,y.positionScreen.y);if(u.instersects(H)){p=0;for(q=B.meshMaterials.length;p<q;){v=B.meshMaterials[p++];if(v instanceof THREE.MeshFaceMaterial){A=0;for(N=B.faceMaterials.length;A<N;)(v=B.faceMaterials[A++])&&v.opacity!=0&&c(l,r,s,y,B,v,t)}else v&&v.opacity!=0&&c(l,r,s,y,B,v,t)}}}}}};
+THREE.Projector=function(){function a(){var B=h[j]=h[j]||new THREE.RenderableVertex;j++;return B}function b(B,z){return z.z-B.z}function c(B,z){var M=0,G=1,Q=B.z+B.w,O=z.z+z.w,F=-B.z+B.w,t=-z.z+z.w;if(Q>=0&&O>=0&&F>=0&&t>=0)return!0;else if(Q<0&&O<0||F<0&&t<0)return!1;else{if(Q<0)M=Math.max(M,Q/(Q-O));else O<0&&(G=Math.min(G,Q/(Q-O)));if(F<0)M=Math.max(M,F/(F-t));else t<0&&(G=Math.min(G,F/(F-t)));if(G<M)return!1;else{B.lerpSelf(z,M);z.lerpSelf(B,1-G);return!0}}}var d,e,g=[],f,j,h=[],i,k,n=[],m,o=
+[],q,r,v=[],w,I,D=[],N=new THREE.Vector4,x=new THREE.Vector4,l=new THREE.Matrix4,J=new THREE.Matrix4,K=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],P=new THREE.Vector4,L=new THREE.Vector4;this.projectVector=function(B,z){l.multiply(z.projectionMatrix,z.matrixWorldInverse);l.multiplyVector3(B);return B};this.unprojectVector=function(B,z){l.multiply(z.matrixWorld,THREE.Matrix4.makeInvert(z.projectionMatrix));l.multiplyVector3(B);return B};
+this.projectObjects=function(B,z,M){z=[];var G,Q,O;e=0;Q=B.objects;B=0;for(G=Q.length;B<G;B++){O=Q[B];var F;if(!(F=!O.visible))if(F=O instanceof THREE.Mesh){a:{F=void 0;for(var t=O.matrixWorld,C=-O.geometry.boundingSphere.radius*Math.max(O.scale.x,Math.max(O.scale.y,O.scale.z)),A=0;A<6;A++){F=K[A].x*t.n14+K[A].y*t.n24+K[A].z*t.n34+K[A].w;if(F<=C){F=!1;break a}}F=!0}F=!F}if(!F){F=g[e]=g[e]||new THREE.RenderableObject;e++;d=F;N.copy(O.position);l.multiplyVector3(N);d.object=O;d.z=N.z;z.push(d)}}M&&
+z.sort(b);return z};this.projectScene=function(B,z,M){var G=[],Q=z.near,O=z.far,F,t,C,A,y,s,p,E,R,u,H,S,W,X,T,V,U;I=r=m=k=0;z.matrixAutoUpdate&&z.update(undefined,!0);B.update(undefined,!1,z);l.multiply(z.projectionMatrix,z.matrixWorldInverse);K[0].set(l.n41-l.n11,l.n42-l.n12,l.n43-l.n13,l.n44-l.n14);K[1].set(l.n41+l.n11,l.n42+l.n12,l.n43+l.n13,l.n44+l.n14);K[2].set(l.n41+l.n21,l.n42+l.n22,l.n43+l.n23,l.n44+l.n24);K[3].set(l.n41-l.n21,l.n42-l.n22,l.n43-l.n23,l.n44-l.n24);K[4].set(l.n41-l.n31,l.n42-
+l.n32,l.n43-l.n33,l.n44-l.n34);K[5].set(l.n41+l.n31,l.n42+l.n32,l.n43+l.n33,l.n44+l.n34);for(F=0;F<6;F++){R=K[F];R.divideScalar(Math.sqrt(R.x*R.x+R.y*R.y+R.z*R.z))}R=this.projectObjects(B,z,!0);B=0;for(F=R.length;B<F;B++){u=R[B].object;if(u.visible){H=u.matrixWorld;S=u.matrixRotationWorld;W=u.materials;X=u.overdraw;j=0;if(u instanceof THREE.Mesh){T=u.geometry;A=T.vertices;V=T.faces;T=T.faceVertexUvs;t=0;for(C=A.length;t<C;t++){f=a();f.positionWorld.copy(A[t].position);H.multiplyVector3(f.positionWorld);
+f.positionScreen.copy(f.positionWorld);l.multiplyVector4(f.positionScreen);f.positionScreen.x/=f.positionScreen.w;f.positionScreen.y/=f.positionScreen.w;f.visible=f.positionScreen.z>Q&&f.positionScreen.z<O}A=0;for(t=V.length;A<t;A++){C=V[A];if(C instanceof THREE.Face3){y=h[C.a];s=h[C.b];p=h[C.c];if(y.visible&&s.visible&&p.visible&&(u.doubleSided||u.flipSided!=(p.positionScreen.x-y.positionScreen.x)*(s.positionScreen.y-y.positionScreen.y)-(p.positionScreen.y-y.positionScreen.y)*(s.positionScreen.x-
+y.positionScreen.x)<0)){E=n[k]=n[k]||new THREE.RenderableFace3;k++;i=E;i.v1.copy(y);i.v2.copy(s);i.v3.copy(p)}else continue}else if(C instanceof THREE.Face4){y=h[C.a];s=h[C.b];p=h[C.c];E=h[C.d];if(y.visible&&s.visible&&p.visible&&E.visible&&(u.doubleSided||u.flipSided!=((E.positionScreen.x-y.positionScreen.x)*(s.positionScreen.y-y.positionScreen.y)-(E.positionScreen.y-y.positionScreen.y)*(s.positionScreen.x-y.positionScreen.x)<0||(s.positionScreen.x-p.positionScreen.x)*(E.positionScreen.y-p.positionScreen.y)-
+(s.positionScreen.y-p.positionScreen.y)*(E.positionScreen.x-p.positionScreen.x)<0))){U=o[m]=o[m]||new THREE.RenderableFace4;m++;i=U;i.v1.copy(y);i.v2.copy(s);i.v3.copy(p);i.v4.copy(E)}else continue}i.normalWorld.copy(C.normal);S.multiplyVector3(i.normalWorld);i.centroidWorld.copy(C.centroid);H.multiplyVector3(i.centroidWorld);i.centroidScreen.copy(i.centroidWorld);l.multiplyVector3(i.centroidScreen);p=C.vertexNormals;y=0;for(s=p.length;y<s;y++){E=i.vertexNormalsWorld[y];E.copy(p[y]);S.multiplyVector3(E)}y=
+0;for(s=T.length;y<s;y++)if(U=T[y][A]){p=0;for(E=U.length;p<E;p++)i.uvs[y][p]=U[p]}i.meshMaterials=W;i.faceMaterials=C.materials;i.overdraw=X;i.z=i.centroidScreen.z;G.push(i)}}else if(u instanceof THREE.Line){J.multiply(l,H);A=u.geometry.vertices;y=a();y.positionScreen.copy(A[0].position);J.multiplyVector4(y.positionScreen);t=1;for(C=A.length;t<C;t++){y=a();y.positionScreen.copy(A[t].position);J.multiplyVector4(y.positionScreen);s=h[j-2];P.copy(y.positionScreen);L.copy(s.positionScreen);if(c(P,L)){P.multiplyScalar(1/
+P.w);L.multiplyScalar(1/L.w);H=v[r]=v[r]||new THREE.RenderableLine;r++;q=H;q.v1.positionScreen.copy(P);q.v2.positionScreen.copy(L);q.z=Math.max(P.z,L.z);q.materials=u.materials;G.push(q)}}}else if(u instanceof THREE.Particle){x.set(u.matrixWorld.n14,u.matrixWorld.n24,u.matrixWorld.n34,1);l.multiplyVector4(x);x.z/=x.w;if(x.z>0&&x.z<1){H=D[I]=D[I]||new THREE.RenderableParticle;I++;w=H;w.x=x.x/x.w;w.y=x.y/x.w;w.z=x.z;w.rotation=u.rotation.z;w.scale.x=u.scale.x*Math.abs(w.x-(x.x+z.projectionMatrix.n11)/
+(x.w+z.projectionMatrix.n14));w.scale.y=u.scale.y*Math.abs(w.y-(x.y+z.projectionMatrix.n22)/(x.w+z.projectionMatrix.n24));w.materials=u.materials;G.push(w)}}}}M&&G.sort(b);return G}};
+THREE.SVGRenderer=function(){function a(t,C,A){var y,s,p,E;y=0;for(s=t.lights.length;y<s;y++){p=t.lights[y];if(p instanceof THREE.DirectionalLight){E=C.normalWorld.dot(p.position)*p.intensity;if(E>0){A.r+=p.color.r*E;A.g+=p.color.g*E;A.b+=p.color.b*E}}else if(p instanceof THREE.PointLight){B.sub(p.position,C.centroidWorld);B.normalize();E=C.normalWorld.dot(B)*p.intensity;if(E>0){A.r+=p.color.r*E;A.g+=p.color.g*E;A.b+=p.color.b*E}}}}function b(t,C,A,y,s,p){f.data.vertices+=3;f.data.faces++;G=d(Q++);
+G.setAttribute("d","M "+t.positionScreen.x+" "+t.positionScreen.y+" L "+C.positionScreen.x+" "+C.positionScreen.y+" L "+A.positionScreen.x+","+A.positionScreen.y+"z");if(s instanceof THREE.MeshBasicMaterial)x.hex=s.color.hex;else if(s instanceof THREE.MeshLambertMaterial)if(N){l.r=J.r;l.g=J.g;l.b=J.b;a(p,y,l);x.r=Math.max(0,Math.min(s.color.r*l.r,1));x.g=Math.max(0,Math.min(s.color.g*l.g,1));x.b=Math.max(0,Math.min(s.color.b*l.b,1));x.updateHex()}else x.hex=s.color.hex;else if(s instanceof THREE.MeshDepthMaterial){L=
+1-s.__2near/(s.__farPlusNear-y.z*s.__farMinusNear);x.setRGB(L,L,L)}else s instanceof THREE.MeshNormalMaterial&&x.setRGB(e(y.normalWorld.x),e(y.normalWorld.y),e(y.normalWorld.z));s.wireframe?G.setAttribute("style","fill: none; stroke: #"+g(x.hex.toString(16))+"; stroke-width: "+s.wireframeLinewidth+"; stroke-opacity: "+s.opacity+"; stroke-linecap: "+s.wireframeLinecap+"; stroke-linejoin: "+s.wireframeLinejoin):G.setAttribute("style","fill: #"+g(x.hex.toString(16))+"; fill-opacity: "+s.opacity);i.appendChild(G)}
+function c(t,C,A,y,s,p,E){f.data.vertices+=4;f.data.faces++;G=d(Q++);G.setAttribute("d","M "+t.positionScreen.x+" "+t.positionScreen.y+" L "+C.positionScreen.x+" "+C.positionScreen.y+" L "+A.positionScreen.x+","+A.positionScreen.y+" L "+y.positionScreen.x+","+y.positionScreen.y+"z");if(p instanceof THREE.MeshBasicMaterial)x.hex=p.color.hex;else if(p instanceof THREE.MeshLambertMaterial)if(N){l.r=J.r;l.g=J.g;l.b=J.b;a(E,s,l);x.r=Math.max(0,Math.min(p.color.r*l.r,1));x.g=Math.max(0,Math.min(p.color.g*
+l.g,1));x.b=Math.max(0,Math.min(p.color.b*l.b,1));x.updateHex()}else x.hex=p.color.hex;else if(p instanceof THREE.MeshDepthMaterial){L=1-p.__2near/(p.__farPlusNear-s.z*p.__farMinusNear);x.setRGB(L,L,L)}else p instanceof THREE.MeshNormalMaterial&&x.setRGB(e(s.normalWorld.x),e(s.normalWorld.y),e(s.normalWorld.z));p.wireframe?G.setAttribute("style","fill: none; stroke: #"+g(x.hex.toString(16))+"; stroke-width: "+p.wireframeLinewidth+"; stroke-opacity: "+p.opacity+"; stroke-linecap: "+p.wireframeLinecap+
+"; stroke-linejoin: "+p.wireframeLinejoin):G.setAttribute("style","fill: #"+g(x.hex.toString(16))+"; fill-opacity: "+p.opacity);i.appendChild(G)}function d(t){if(z[t]==null){z[t]=document.createElementNS("http://www.w3.org/2000/svg","path");F==0&&z[t].setAttribute("shape-rendering","crispEdges")}return z[t]}function e(t){t=(t+1)*0.5;return t<0?0:t>1?1:t}function g(t){for(;t.length<6;)t="0"+t;return t}var f=this,j=null,h=new THREE.Projector,i=document.createElementNS("http://www.w3.org/2000/svg","svg"),
+k,n,m,o,q,r,v,w,I=new THREE.Rectangle,D=new THREE.Rectangle,N=!1,x=new THREE.Color(16777215),l=new THREE.Color(16777215),J=new THREE.Color(0),K=new THREE.Color(0),P=new THREE.Color(0),L,B=new THREE.Vector3,z=[],M=[],G,Q,O,F=1;this.domElement=i;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.data={vertices:0,faces:0};this.setQuality=function(t){switch(t){case "high":F=1;break;case "low":F=0}};this.setSize=function(t,C){k=t;n=C;m=k/2;o=n/2;i.setAttribute("viewBox",-m+" "+-o+" "+k+" "+
+n);i.setAttribute("width",k);i.setAttribute("height",n);I.set(-m,-o,m,o)};this.clear=function(){for(;i.childNodes.length>0;)i.removeChild(i.childNodes[0])};this.render=function(t,C){var A,y,s,p,E,R,u,H;this.autoClear&&this.clear();f.data.vertices=0;f.data.faces=0;j=h.projectScene(t,C,this.sortElements);O=Q=0;if(N=t.lights.length>0){u=t.lights;J.setRGB(0,0,0);K.setRGB(0,0,0);P.setRGB(0,0,0);A=0;for(y=u.length;A<y;A++){s=u[A];p=s.color;if(s instanceof THREE.AmbientLight){J.r+=p.r;J.g+=p.g;J.b+=p.b}else if(s instanceof
+THREE.DirectionalLight){K.r+=p.r;K.g+=p.g;K.b+=p.b}else if(s instanceof THREE.PointLight){P.r+=p.r;P.g+=p.g;P.b+=p.b}}}A=0;for(y=j.length;A<y;A++){u=j[A];D.empty();if(u instanceof THREE.RenderableParticle){q=u;q.x*=m;q.y*=-o;s=0;for(p=u.materials.length;s<p;)s++}else if(u instanceof THREE.RenderableLine){q=u.v1;r=u.v2;q.positionScreen.x*=m;q.positionScreen.y*=-o;r.positionScreen.x*=m;r.positionScreen.y*=-o;D.addPoint(q.positionScreen.x,q.positionScreen.y);D.addPoint(r.positionScreen.x,r.positionScreen.y);
+if(I.instersects(D)){s=0;for(p=u.materials.length;s<p;)if((H=u.materials[s++])&&H.opacity!=0){E=q;R=r;var S=O++;if(M[S]==null){M[S]=document.createElementNS("http://www.w3.org/2000/svg","line");F==0&&M[S].setAttribute("shape-rendering","crispEdges")}G=M[S];G.setAttribute("x1",E.positionScreen.x);G.setAttribute("y1",E.positionScreen.y);G.setAttribute("x2",R.positionScreen.x);G.setAttribute("y2",R.positionScreen.y);if(H instanceof THREE.LineBasicMaterial){G.setAttribute("style","fill: none; stroke: ##"+
+g(H.color.hex.toString(16))+"; stroke-width: "+H.linewidth+"; stroke-opacity: "+H.opacity+"; stroke-linecap: "+H.linecap+"; stroke-linejoin: "+H.linejoin);i.appendChild(G)}}}}else if(u instanceof THREE.RenderableFace3){q=u.v1;r=u.v2;v=u.v3;q.positionScreen.x*=m;q.positionScreen.y*=-o;r.positionScreen.x*=m;r.positionScreen.y*=-o;v.positionScreen.x*=m;v.positionScreen.y*=-o;D.addPoint(q.positionScreen.x,q.positionScreen.y);D.addPoint(r.positionScreen.x,r.positionScreen.y);D.addPoint(v.positionScreen.x,
+v.positionScreen.y);if(I.instersects(D)){s=0;for(p=u.meshMaterials.length;s<p;){H=u.meshMaterials[s++];if(H instanceof THREE.MeshFaceMaterial){E=0;for(R=u.faceMaterials.length;E<R;)(H=u.faceMaterials[E++])&&H.opacity!=0&&b(q,r,v,u,H,t)}else H&&H.opacity!=0&&b(q,r,v,u,H,t)}}}else if(u instanceof THREE.RenderableFace4){q=u.v1;r=u.v2;v=u.v3;w=u.v4;q.positionScreen.x*=m;q.positionScreen.y*=-o;r.positionScreen.x*=m;r.positionScreen.y*=-o;v.positionScreen.x*=m;v.positionScreen.y*=-o;w.positionScreen.x*=
+m;w.positionScreen.y*=-o;D.addPoint(q.positionScreen.x,q.positionScreen.y);D.addPoint(r.positionScreen.x,r.positionScreen.y);D.addPoint(v.positionScreen.x,v.positionScreen.y);D.addPoint(w.positionScreen.x,w.positionScreen.y);if(I.instersects(D)){s=0;for(p=u.meshMaterials.length;s<p;){H=u.meshMaterials[s++];if(H instanceof THREE.MeshFaceMaterial){E=0;for(R=u.faceMaterials.length;E<R;)(H=u.faceMaterials[E++])&&H.opacity!=0&&c(q,r,v,w,u,H,t)}else H&&H.opacity!=0&&c(q,r,v,w,u,H,t)}}}}}};
 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(a,b,c){c&&a.update(undefined,!1,b);c=a.sounds;var d,e=c.length;for(d=0;d<e;d++){a=c[d];this.soundPosition.set(a.matrixWorld.n14,a.matrixWorld.n24,a.matrixWorld.n34);this.soundPosition.subSelf(b.position);if(a.isPlaying&&a.isLoaded){a.isAddedToDOM||a.addToDOM(this.domElement);a.calculateVolumeAndPan(this.soundPosition)}}}};
 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(a,b,c){c&&a.update(undefined,!1,b);c=a.sounds;var d,e=c.length;for(d=0;d<e;d++){a=c[d];this.soundPosition.set(a.matrixWorld.n14,a.matrixWorld.n24,a.matrixWorld.n34);this.soundPosition.subSelf(b.position);if(a.isPlaying&&a.isLoaded){a.isAddedToDOM||a.addToDOM(this.domElement);a.calculateVolumeAndPan(this.soundPosition)}}}};
 THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};THREE.RenderableVertex.prototype.copy=function(a){this.positionWorld.copy(a.positionWorld);this.positionScreen.copy(a.positionScreen)};
 THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};THREE.RenderableVertex.prototype.copy=function(a){this.positionWorld.copy(a.positionWorld);this.positionScreen.copy(a.positionScreen)};
 THREE.RenderableFace3=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[[]];this.z=null};
 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};

+ 63 - 64
build/custom/ThreeWebGL.js

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

+ 1 - 1
examples/canvas_geometry_birds.html

@@ -420,7 +420,7 @@
 
 
 					color = bird.materials[ 0 ].color;
 					color = bird.materials[ 0 ].color;
 					color.r = color.g = color.b = ( 500 - bird.position.z ) / 1000;
 					color.r = color.g = color.b = ( 500 - bird.position.z ) / 1000;
-					color.updateStyleString();
+					color.updateHex();
 
 
 					bird.rotation.y = Math.atan2( - boid.velocity.z, boid.velocity.x );
 					bird.rotation.y = Math.atan2( - boid.velocity.z, boid.velocity.x );
 					bird.rotation.z = Math.asin( boid.velocity.y / boid.velocity.length() );
 					bird.rotation.z = Math.asin( boid.velocity.y / boid.velocity.length() );

+ 17 - 46
src/core/Color.js

@@ -10,15 +10,19 @@ THREE.Color = function ( hex ) {
 
 
 THREE.Color.prototype = {
 THREE.Color.prototype = {
 
 
-	autoUpdate : true,
-
 	copy : function ( color ) {
 	copy : function ( color ) {
 
 
 		this.r = color.r;
 		this.r = color.r;
 		this.g = color.g;
 		this.g = color.g;
 		this.b = color.b;
 		this.b = color.b;
 		this.hex = color.hex;
 		this.hex = color.hex;
-		this.__styleString = color.__styleString;
+
+	},
+
+	setHex : function ( hex ) {
+
+		this.hex = ( ~~ hex ) & 0xffffff;
+		this.updateRGB();
 
 
 	},
 	},
 
 
@@ -28,12 +32,7 @@ THREE.Color.prototype = {
 		this.g = g;
 		this.g = g;
 		this.b = b;
 		this.b = b;
 
 
-		if ( this.autoUpdate ) {
-
-			this.updateHex();
-			this.updateStyleString();
-
-		}
+		this.updateHex();
 
 
 	},
 	},
 
 
@@ -42,11 +41,11 @@ THREE.Color.prototype = {
 		// based on MochiKit implementation by Bob Ippolito
 		// based on MochiKit implementation by Bob Ippolito
 		// h,s,v ranges are < 0.0 - 1.0 >
 		// h,s,v ranges are < 0.0 - 1.0 >
 
 
-		var red, green, blue, i, f, p, q, t;
+		var r, g, b, i, f, p, q, t;
 
 
 		if ( v == 0.0 ) {
 		if ( v == 0.0 ) {
 
 
-			red = green = blue = 0;
+			r = g = b = 0;
 
 
 		} else {
 		} else {
 
 
@@ -58,41 +57,19 @@ THREE.Color.prototype = {
 
 
 			switch ( i ) {
 			switch ( i ) {
 
 
-				case 1: red = q; green = v; blue = p; break;
-				case 2: red = p; green = v; blue = t; break;
-				case 3: red = p; green = q; blue = v; break;
-				case 4: red = t; green = p; blue = v; break;
-				case 5: red = v; green = p; blue = q; break;
+				case 1: r = q; g = v; b = p; break;
+				case 2: r = p; g = v; b = t; break;
+				case 3: r = p; g = q; b = v; break;
+				case 4: r = t; g = p; b = v; break;
+				case 5: r = v; g = p; b = q; break;
 				case 6: // fall through
 				case 6: // fall through
-				case 0: red = v; green = t; blue = p; break;
+				case 0: r = v; g = t; b = p; break;
 
 
 			}
 			}
 
 
 		}
 		}
 
 
-		this.r = red;
-		this.g = green;
-		this.b = blue;
-
-		if ( this.autoUpdate ) {
-
-			this.updateHex();
-			this.updateStyleString();
-
-		}
-
-	},
-
-	setHex : function ( hex ) {
-
-		this.hex = ( ~~ hex ) & 0xffffff;
-
-		if ( this.autoUpdate ) {
-
-			this.updateRGB();
-			this.updateStyleString();
-
-		}
+		this.setRGB( r, g, b );
 
 
 	},
 	},
 
 
@@ -110,12 +87,6 @@ THREE.Color.prototype = {
 
 
 	},
 	},
 
 
-	updateStyleString : function () {
-
-		this.__styleString = 'rgb(' + ~~ ( this.r * 255 ) + ',' + ~~ ( this.g * 255 ) + ',' + ~~ ( this.b * 255 ) + ')';
-
-	},
-
 	clone : function () {
 	clone : function () {
 
 
 		return new THREE.Color( this.hex );
 		return new THREE.Color( this.hex );

+ 7 - 7
src/extras/io/JSONLoader.js

@@ -46,7 +46,7 @@ THREE.JSONLoader.prototype.createModel = function ( json, callback, texture_path
 
 
 	var scope = this,
 	var scope = this,
 	geometry = new THREE.Geometry(),
 	geometry = new THREE.Geometry(),
-	scale = ( json.scale !== undefined ) ? json.scale : 1.0;
+	scale = ( json.scale !== undefined ) ? 1.0 / json.scale : 1.0;
 
 
 	this.init_materials( geometry, json.materials, texture_path );
 	this.init_materials( geometry, json.materials, texture_path );
 
 
@@ -121,9 +121,9 @@ THREE.JSONLoader.prototype.createModel = function ( json, callback, texture_path
 
 
 			vertex = new THREE.Vertex();
 			vertex = new THREE.Vertex();
 
 
-			vertex.position.x = vertices[ offset ++ ] / scale;
-			vertex.position.y = vertices[ offset ++ ] / scale;
-			vertex.position.z = vertices[ offset ++ ] / scale;
+			vertex.position.x = vertices[ offset ++ ] * scale;
+			vertex.position.y = vertices[ offset ++ ] * scale;
+			vertex.position.z = vertices[ offset ++ ] * scale;
 
 
 			geometry.vertices.push( vertex );
 			geometry.vertices.push( vertex );
 
 
@@ -342,9 +342,9 @@ THREE.JSONLoader.prototype.createModel = function ( json, callback, texture_path
 
 
 				for( v = 0, vl = srcVertices.length; v < vl; v += 3 ) {
 				for( v = 0, vl = srcVertices.length; v < vl; v += 3 ) {
 
 
-					x = srcVertices[ v ] / scale;
-					y = srcVertices[ v + 1 ] / scale;
-					z = srcVertices[ v + 2 ] / scale;
+					x = srcVertices[ v ] * scale;
+					y = srcVertices[ v + 1 ] * scale;
+					z = srcVertices[ v + 2 ] * scale;
 
 
 					dstVertices.push( new THREE.Vertex( new THREE.Vector3( x, y, z ) ) );
 					dstVertices.push( new THREE.Vertex( new THREE.Vector3( x, y, z ) ) );
 
 

+ 42 - 37
src/renderers/CanvasRenderer.js

@@ -30,11 +30,11 @@ THREE.CanvasRenderer = function () {
 	_v1x, _v1y, _v2x, _v2y, _v3x, _v3y,
 	_v1x, _v1y, _v2x, _v2y, _v3x, _v3y,
 	_v4x, _v4y, _v5x, _v5y, _v6x, _v6y,
 	_v4x, _v4y, _v5x, _v5y, _v6x, _v6y,
 
 
-	_color = new THREE.Color(),
-	_color1 = new THREE.Color(),
-	_color2 = new THREE.Color(),
-	_color3 = new THREE.Color(),
-	_color4 = new THREE.Color(),
+	_color = new THREE.Color( 0x000000 ),
+	_color1 = new THREE.Color( 0x000000 ),
+	_color2 = new THREE.Color( 0x000000 ),
+	_color3 = new THREE.Color( 0x000000 ),
+	_color4 = new THREE.Color( 0x000000 ),
 
 
 	_near, _far,
 	_near, _far,
 
 
@@ -505,8 +505,8 @@ THREE.CanvasRenderer = function () {
 
 
 				}
 				}
 
 
-				setStrokeStyle( material.color.__styleString );
-				setFillStyle( material.color.__styleString );
+				setStrokeStyle( material.color );
+				setFillStyle( material.color );
 
 
 				_context.save();
 				_context.save();
 				_context.translate( v1.x, v1.y );
 				_context.translate( v1.x, v1.y );
@@ -533,12 +533,10 @@ THREE.CanvasRenderer = function () {
 
 
 			if ( material instanceof THREE.LineBasicMaterial ) {
 			if ( material instanceof THREE.LineBasicMaterial ) {
 
 
-				_color.__styleString = material.color.__styleString;
-
 				setLineWidth( material.linewidth );
 				setLineWidth( material.linewidth );
 				setLineCap( material.linecap );
 				setLineCap( material.linecap );
 				setLineJoin( material.linejoin );
 				setLineJoin( material.linejoin );
-				setStrokeStyle( _color.__styleString );
+				setStrokeStyle( material.color );
 
 
 				_context.stroke();
 				_context.stroke();
 				_bboxRect.inflate( material.linewidth * 2 );
 				_bboxRect.inflate( material.linewidth * 2 );
@@ -602,7 +600,7 @@ THREE.CanvasRenderer = function () {
 
 
 				} else {
 				} else {
 
 
-					material.wireframe ? strokePath( material.color.__styleString, material.wireframeLinewidth, material.wireframeLinecap, material.wireframeLinejoin ) : fillPath( material.color.__styleString );
+					material.wireframe ? strokePath( material.color, material.wireframeLinewidth, material.wireframeLinecap, material.wireframeLinejoin ) : fillPath( material.color );
 
 
 				}
 				}
 
 
@@ -633,7 +631,7 @@ THREE.CanvasRenderer = function () {
 						calculateLight( scene, element.v2.positionWorld, element.vertexNormalsWorld[ 1 ], _color2 );
 						calculateLight( scene, element.v2.positionWorld, element.vertexNormalsWorld[ 1 ], _color2 );
 						calculateLight( scene, element.v3.positionWorld, element.vertexNormalsWorld[ 2 ], _color3 );
 						calculateLight( scene, element.v3.positionWorld, element.vertexNormalsWorld[ 2 ], _color3 );
 
 
-						_color4.r = ( _color2.r + _color3.r ) * 0.5;
+						_color4.r =  ( _color2.r + _color3.r ) * 0.5;
 						_color4.g = ( _color2.g + _color3.g ) * 0.5;
 						_color4.g = ( _color2.g + _color3.g ) * 0.5;
 						_color4.b = ( _color2.b + _color3.b ) * 0.5;
 						_color4.b = ( _color2.b + _color3.b ) * 0.5;
 
 
@@ -649,19 +647,18 @@ THREE.CanvasRenderer = function () {
 
 
 						calculateLight( scene, element.centroidWorld, element.normalWorld, _light );
 						calculateLight( scene, element.centroidWorld, element.normalWorld, _light );
 
 
-						_color.r = material.color.r * _light.r;
-						_color.g = material.color.g * _light.g;
-						_color.b = material.color.b * _light.b;
-
-						_color.updateStyleString();
+						_color.r = Math.max( 0, Math.min( material.color.r * _light.r, 1 ) );
+						_color.g = Math.max( 0, Math.min( material.color.g * _light.g, 1 ) );
+						_color.b = Math.max( 0, Math.min( material.color.b * _light.b, 1 ) );
+						_color.updateHex();
 
 
-						material.wireframe ? strokePath( _color.__styleString, material.wireframeLinewidth, material.wireframeLinecap, material.wireframeLinejoin ) : fillPath( _color.__styleString );
+						material.wireframe ? strokePath( _color, material.wireframeLinewidth, material.wireframeLinecap, material.wireframeLinejoin ) : fillPath( _color );
 
 
 					}
 					}
 
 
 				} else {
 				} else {
 
 
-					material.wireframe ? strokePath( material.color.__styleString, material.wireframeLinewidth, material.wireframeLinecap, material.wireframeLinejoin ) : fillPath( material.color.__styleString );
+					material.wireframe ? strokePath( material.color, material.wireframeLinewidth, material.wireframeLinecap, material.wireframeLinejoin ) : fillPath( material.color );
 
 
 				}
 				}
 
 
@@ -687,9 +684,9 @@ THREE.CanvasRenderer = function () {
 				_color.r = normalToComponent( element.normalWorld.x );
 				_color.r = normalToComponent( element.normalWorld.x );
 				_color.g = normalToComponent( element.normalWorld.y );
 				_color.g = normalToComponent( element.normalWorld.y );
 				_color.b = normalToComponent( element.normalWorld.z );
 				_color.b = normalToComponent( element.normalWorld.z );
-				_color.updateStyleString();
+				_color.updateHex();
 
 
-				material.wireframe ? strokePath( _color.__styleString, material.wireframeLinewidth, material.wireframeLinecap, material.wireframeLinejoin ) : fillPath( _color.__styleString );
+				material.wireframe ? strokePath( _color, material.wireframeLinewidth, material.wireframeLinecap, material.wireframeLinejoin ) : fillPath( _color );
 
 
 			}
 			}
 
 
@@ -725,7 +722,7 @@ THREE.CanvasRenderer = function () {
 
 
 				drawQuad( _v1x, _v1y, _v2x, _v2y, _v3x, _v3y, _v4x, _v4y );
 				drawQuad( _v1x, _v1y, _v2x, _v2y, _v3x, _v3y, _v4x, _v4y );
 
 
-				material.wireframe ? strokePath( material.color.__styleString, material.wireframeLinewidth, material.wireframeLinecap, material.wireframeLinejoin ) : fillPath( material.color.__styleString );
+				material.wireframe ? strokePath( material.color, material.wireframeLinewidth, material.wireframeLinecap, material.wireframeLinejoin ) : fillPath( material.color );
 
 
 			} else if ( material instanceof THREE.MeshLambertMaterial ) {
 			} else if ( material instanceof THREE.MeshLambertMaterial ) {
 
 
@@ -760,15 +757,14 @@ THREE.CanvasRenderer = function () {
 
 
 						calculateLight( scene, element.centroidWorld, element.normalWorld, _light );
 						calculateLight( scene, element.centroidWorld, element.normalWorld, _light );
 
 
-						_color.r = material.color.r * _light.r;
-						_color.g = material.color.g * _light.g;
-						_color.b = material.color.b * _light.b;
-
-						_color.updateStyleString();
+						_color.r = Math.max( 0, Math.min( material.color.r * _light.r, 1 ) );
+						_color.g = Math.max( 0, Math.min( material.color.g * _light.g, 1 ) );
+						_color.b = Math.max( 0, Math.min( material.color.b * _light.b, 1 ) );
+						_color.updateHex();
 
 
 						drawQuad( _v1x, _v1y, _v2x, _v2y, _v3x, _v3y, _v4x, _v4y );
 						drawQuad( _v1x, _v1y, _v2x, _v2y, _v3x, _v3y, _v4x, _v4y );
 
 
-						material.wireframe ? strokePath( _color.__styleString, material.wireframeLinewidth, material.wireframeLinecap, material.wireframeLinejoin ) : fillPath( _color.__styleString );
+						material.wireframe ? strokePath( _color, material.wireframeLinewidth, material.wireframeLinecap, material.wireframeLinejoin ) : fillPath( _color );
 
 
 					}
 					}
 
 
@@ -776,7 +772,7 @@ THREE.CanvasRenderer = function () {
 
 
 					drawQuad( _v1x, _v1y, _v2x, _v2y, _v3x, _v3y, _v4x, _v4y );
 					drawQuad( _v1x, _v1y, _v2x, _v2y, _v3x, _v3y, _v4x, _v4y );
 
 
-					material.wireframe ? strokePath( material.color.__styleString, material.wireframeLinewidth, material.wireframeLinecap, material.wireframeLinejoin ) : fillPath( material.color.__styleString );
+					material.wireframe ? strokePath( material.color, material.wireframeLinewidth, material.wireframeLinecap, material.wireframeLinejoin ) : fillPath( material.color );
 
 
 				}
 				}
 
 
@@ -785,11 +781,11 @@ THREE.CanvasRenderer = function () {
 				_color.r = normalToComponent( element.normalWorld.x );
 				_color.r = normalToComponent( element.normalWorld.x );
 				_color.g = normalToComponent( element.normalWorld.y );
 				_color.g = normalToComponent( element.normalWorld.y );
 				_color.b = normalToComponent( element.normalWorld.z );
 				_color.b = normalToComponent( element.normalWorld.z );
-				_color.updateStyleString();
+				_color.updateHex();
 
 
 				drawQuad( _v1x, _v1y, _v2x, _v2y, _v3x, _v3y, _v4x, _v4y );
 				drawQuad( _v1x, _v1y, _v2x, _v2y, _v3x, _v3y, _v4x, _v4y );
 
 
-				material.wireframe ? strokePath( _color.__styleString, material.wireframeLinewidth, material.wireframeLinecap, material.wireframeLinejoin ) : fillPath( _color.__styleString );
+				material.wireframe ? strokePath( _color, material.wireframeLinewidth, material.wireframeLinecap, material.wireframeLinejoin ) : fillPath( _color );
 
 
 			} else if ( material instanceof THREE.MeshDepthMaterial ) {
 			} else if ( material instanceof THREE.MeshDepthMaterial ) {
 
 
@@ -1076,24 +1072,33 @@ THREE.CanvasRenderer = function () {
 
 
 	}
 	}
 
 
-	function setStrokeStyle( value ) {
+	function setStrokeStyle( color ) {
 
 
-		if ( _contextStrokeStyle != value ) {
+		if ( _contextStrokeStyle != color.hex ) {
 
 
-			_context.strokeStyle = _contextStrokeStyle  = value;
+			_contextStrokeStyle = color.hex;
+			_context.strokeStyle = '#' + pad( _contextStrokeStyle.toString( 16 ) );
 
 
 		}
 		}
 
 
 	}
 	}
 
 
-	function setFillStyle( value ) {
+	function setFillStyle( color ) {
 
 
-		if ( _contextFillStyle != value ) {
+		if ( _contextFillStyle != color.hex ) {
 
 
-			_context.fillStyle = _contextFillStyle = value;
+			_contextFillStyle = color.hex;
+			_context.fillStyle = '#' + pad( _contextFillStyle.toString( 16 ) );
 
 
 		}
 		}
 
 
 	}
 	}
 
 
+	function pad( str ) {
+
+		while ( str.length < 6 ) str = '0' + str;
+		return str;
+
+	}
+
 };
 };

+ 25 - 21
src/renderers/SVGRenderer.js

@@ -363,9 +363,7 @@ THREE.SVGRenderer = function () {
 
 
 		if ( material instanceof THREE.LineBasicMaterial ) {
 		if ( material instanceof THREE.LineBasicMaterial ) {
 
 
-			_color.__styleString = material.color.__styleString;
-
-			_svgNode.setAttribute( 'style', 'fill: none; stroke: ' + _color.__styleString + '; stroke-width: ' + material.linewidth + '; stroke-opacity: ' + material.opacity + '; stroke-linecap: ' + material.linecap + '; stroke-linejoin: ' + material.linejoin );
+			_svgNode.setAttribute( 'style', 'fill: none; stroke: #' + '#' + pad( material.color.hex.toString( 16 ) ) + '; stroke-width: ' + material.linewidth + '; stroke-opacity: ' + material.opacity + '; stroke-linecap: ' + material.linecap + '; stroke-linejoin: ' + material.linejoin );
 
 
 			_svg.appendChild( _svgNode );
 			_svg.appendChild( _svgNode );
 
 
@@ -383,7 +381,7 @@ THREE.SVGRenderer = function () {
 
 
 		if ( material instanceof THREE.MeshBasicMaterial ) {
 		if ( material instanceof THREE.MeshBasicMaterial ) {
 
 
-			_color.__styleString = material.color.__styleString;
+			_color.hex = material.color.hex;
 
 
 		} else if ( material instanceof THREE.MeshLambertMaterial ) {
 		} else if ( material instanceof THREE.MeshLambertMaterial ) {
 
 
@@ -395,15 +393,15 @@ THREE.SVGRenderer = function () {
 
 
 				calculateFaceLight( scene, element, _light );
 				calculateFaceLight( scene, element, _light );
 
 
-				_color.r = material.color.r * _light.r;
-				_color.g = material.color.g * _light.g;
-				_color.b = material.color.b * _light.b;
+				_color.r = Math.max( 0, Math.min( material.color.r * _light.r, 1 ) );
+				_color.g = Math.max( 0, Math.min( material.color.g * _light.g, 1 ) );
+				_color.b = Math.max( 0, Math.min( material.color.b * _light.b, 1 ) );
 
 
-				_color.updateStyleString();
+				_color.updateHex();
 
 
 			} else {
 			} else {
 
 
-				_color.__styleString = material.color.__styleString;
+				_color.hex = material.color.hex;
 
 
 			}
 			}
 
 
@@ -420,11 +418,11 @@ THREE.SVGRenderer = function () {
 
 
 		if ( material.wireframe ) {
 		if ( material.wireframe ) {
 
 
-			_svgNode.setAttribute( 'style', 'fill: none; stroke: ' + _color.__styleString + '; stroke-width: ' + material.wireframeLinewidth + '; stroke-opacity: ' + material.opacity + '; stroke-linecap: ' + material.wireframeLinecap + '; stroke-linejoin: ' + material.wireframeLinejoin );
+			_svgNode.setAttribute( 'style', 'fill: none; stroke: #' + pad( _color.hex.toString( 16 ) ) + '; stroke-width: ' + material.wireframeLinewidth + '; stroke-opacity: ' + material.opacity + '; stroke-linecap: ' + material.wireframeLinecap + '; stroke-linejoin: ' + material.wireframeLinejoin );
 
 
 		} else {
 		} else {
 
 
-			_svgNode.setAttribute( 'style', 'fill: ' + _color.__styleString + '; fill-opacity: ' + material.opacity );
+			_svgNode.setAttribute( 'style', 'fill: #' + pad( _color.hex.toString( 16 ) ) + '; fill-opacity: ' + material.opacity );
 
 
 		}
 		}
 
 
@@ -442,7 +440,7 @@ THREE.SVGRenderer = function () {
 
 
 		if ( material instanceof THREE.MeshBasicMaterial ) {
 		if ( material instanceof THREE.MeshBasicMaterial ) {
 
 
-			_color.__styleString = material.color.__styleString;
+			_color.hex = material.color.hex;
 
 
 		} else if ( material instanceof THREE.MeshLambertMaterial ) {
 		} else if ( material instanceof THREE.MeshLambertMaterial ) {
 
 
@@ -454,15 +452,15 @@ THREE.SVGRenderer = function () {
 
 
 				calculateFaceLight( scene, element, _light );
 				calculateFaceLight( scene, element, _light );
 
 
-				_color.r = material.color.r * _light.r;
-				_color.g = material.color.g * _light.g;
-				_color.b = material.color.b * _light.b;
+				_color.r = Math.max( 0, Math.min( material.color.r * _light.r, 1 ) );
+				_color.g = Math.max( 0, Math.min( material.color.g * _light.g, 1 ) );
+				_color.b = Math.max( 0, Math.min( material.color.b * _light.b, 1 ) );
 
 
-				_color.updateStyleString();
+				_color.updateHex();
 
 
 			} else {
 			} else {
 
 
-				_color.__styleString = material.color.__styleString;
+				_color.hex = material.color.hex;
 
 
 			}
 			}
 
 
@@ -479,11 +477,11 @@ THREE.SVGRenderer = function () {
 
 
 		if ( material.wireframe ) {
 		if ( material.wireframe ) {
 
 
-			_svgNode.setAttribute( 'style', 'fill: none; stroke: ' + _color.__styleString + '; stroke-width: ' + material.wireframeLinewidth + '; stroke-opacity: ' + material.opacity + '; stroke-linecap: ' + material.wireframeLinecap + '; stroke-linejoin: ' + material.wireframeLinejoin );
+			_svgNode.setAttribute( 'style', 'fill: none; stroke: #' + pad( _color.hex.toString( 16 ) ) + '; stroke-width: ' + material.wireframeLinewidth + '; stroke-opacity: ' + material.opacity + '; stroke-linecap: ' + material.wireframeLinecap + '; stroke-linejoin: ' + material.wireframeLinejoin );
 
 
 		} else {
 		} else {
 
 
-			_svgNode.setAttribute( 'style', 'fill: ' + _color.__styleString + '; fill-opacity: ' + material.opacity );
+			_svgNode.setAttribute( 'style', 'fill: #' + pad( _color.hex.toString( 16 ) ) + '; fill-opacity: ' + material.opacity );
 
 
 		}
 		}
 
 
@@ -553,9 +551,15 @@ THREE.SVGRenderer = function () {
 
 
 	function normalToComponent( normal ) {
 	function normalToComponent( normal ) {
 
 
-		// https://gist.github.com/665829
+		var component = ( normal + 1 ) * 0.5;
+		return component < 0 ? 0 : ( component > 1 ? 1 : component );
+
+	}
+
+	function pad( str ) {
 
 
-		return normal < 0 ? Math.min( ( 1 + normal ) * 0.5, 0.5 ) : 0.5 + Math.min( normal * 0.5, 0.5 );
+		while ( str.length < 6 ) str = '0' + str;
+		return str;
 
 
 	}
 	}
 
 

+ 7 - 3
src/renderers/WebGLRenderer.js

@@ -94,6 +94,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 	this.context = _gl;
 	this.context = _gl;
 
 
+	var _supportsVertexTextures = ( maxVertexTextures() > 0 );
 
 
 	// prepare stencil shadow polygon
 	// prepare stencil shadow polygon
 
 
@@ -4183,7 +4184,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 	this.supportsVertexTextures = function () {
 	this.supportsVertexTextures = function () {
 
 
-		return maxVertexTextures() > 0;
+		return _supportsVertexTextures;
 
 
 	};
 	};
 
 
@@ -4287,6 +4288,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 		program = _gl.createProgram(),
 		program = _gl.createProgram(),
 
 
 		prefix_fragment = [
 		prefix_fragment = [
+
 			"#ifdef GL_ES",
 			"#ifdef GL_ES",
 			"precision highp float;",
 			"precision highp float;",
 			"#endif",
 			"#endif",
@@ -4305,10 +4307,12 @@ THREE.WebGLRenderer = function ( parameters ) {
 			"uniform mat4 viewMatrix;",
 			"uniform mat4 viewMatrix;",
 			"uniform vec3 cameraPosition;",
 			"uniform vec3 cameraPosition;",
 			""
 			""
+
 		].join("\n"),
 		].join("\n"),
 
 
 		prefix_vertex = [
 		prefix_vertex = [
-			maxVertexTextures() > 0 ? "#define VERTEX_TEXTURES" : "",
+			
+			_supportsVertexTextures ? "#define VERTEX_TEXTURES" : "",
 
 
 			"#define MAX_DIR_LIGHTS " + parameters.maxDirLights,
 			"#define MAX_DIR_LIGHTS " + parameters.maxDirLights,
 			"#define MAX_POINT_LIGHTS " + parameters.maxPointLights,
 			"#define MAX_POINT_LIGHTS " + parameters.maxPointLights,
@@ -4322,7 +4326,6 @@ THREE.WebGLRenderer = function ( parameters ) {
 			parameters.skinning ? "#define USE_SKINNING" : "",
 			parameters.skinning ? "#define USE_SKINNING" : "",
 			parameters.morphTargets ? "#define USE_MORPHTARGETS" : "",
 			parameters.morphTargets ? "#define USE_MORPHTARGETS" : "",
 
 
-
 			parameters.sizeAttenuation ? "#define USE_SIZEATTENUATION" : "",
 			parameters.sizeAttenuation ? "#define USE_SIZEATTENUATION" : "",
 
 
 			"uniform mat4 objectMatrix;",
 			"uniform mat4 objectMatrix;",
@@ -4368,6 +4371,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 			"#endif",
 			"#endif",
 
 
 			""
 			""
+
 		].join("\n");
 		].join("\n");
 
 
 		_gl.attachShader( program, getShader( "fragment", prefix_fragment + fragmentShader ) );
 		_gl.attachShader( program, getShader( "fragment", prefix_fragment + fragmentShader ) );

Some files were not shown because too many files changed in this diff