Browse Source

Added Ribbon object.

It provides a lean way how to render TRIANGLE_STRIP primitives: needs just n+2 vertices for n triangles (one Ribbon = one strip). There are no faces, no indices, everything is rendered in one simple drawArray call.

Vertex colors are supported, normals not yet.
alteredq 14 years ago
parent
commit
e151ff394b
8 changed files with 968 additions and 514 deletions
  1. 190 187
      build/Three.js
  2. 191 188
      build/ThreeDebug.js
  3. 139 136
      build/ThreeExtras.js
  4. 342 0
      examples/ribbons_gl.html
  5. 1 0
      examples/uqbiquity_test.html
  6. 1 1
      src/objects/Object3D.js
  7. 103 2
      src/renderers/WebGLRenderer.js
  8. 1 0
      utils/build.py

+ 190 - 187
build/Three.js

@@ -1,103 +1,104 @@
 // Three.js r32 - http://github.com/mrdoob/three.js
 // Three.js r32 - http://github.com/mrdoob/three.js
 var THREE=THREE||{};THREE.Color=function(a){this.autoUpdate=!0;this.setHex(a)};
 var THREE=THREE||{};THREE.Color=function(a){this.autoUpdate=!0;this.setHex(a)};
-THREE.Color.prototype={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 e,g,i,l,n,k;if(c==0)e=g=i=0;else{l=Math.floor(a*6);n=a*6-l;a=c*(1-b);k=c*(1-b*n);b=c*(1-b*(1-n));switch(l){case 1:e=k;g=c;i=a;break;case 2:e=a;g=c;i=b;break;case 3:e=a;g=k;i=c;break;case 4:e=b;g=a;i=c;break;case 5:e=c;g=a;i=k;break;case 6:case 0:e=c;g=b;i=a}}this.r=e;this.g=g;this.b=i;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},
+THREE.Color.prototype={setRGB:function(a,b,d){this.r=a;this.g=b;this.b=d;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,b,d){var e,g,i,l,n,k;if(d==0)e=g=i=0;else{l=Math.floor(a*6);n=a*6-l;a=d*(1-b);k=d*(1-b*n);b=d*(1-b*(1-n));switch(l){case 1:e=k;g=d;i=a;break;case 2:e=a;g=d;i=b;break;case 3:e=a;g=k;i=d;break;case 4:e=b;g=a;i=d;break;case 5:e=d;g=a;i=k;break;case 6:case 0:e=d;g=b;i=a}}this.r=e;this.g=g;this.b=i;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},
 setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGBA();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGBA: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)},toString:function(){return"THREE.Color ( r: "+
 setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGBA();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGBA: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)},toString:function(){return"THREE.Color ( r: "+
 this.r+", g: "+this.g+", b: "+this.b+", hex: "+this.hex+" )"}};THREE.Vector2=function(a,b){this.x=a||0;this.y=b||0};
 this.r+", g: "+this.g+", b: "+this.b+", hex: "+this.hex+" )"}};THREE.Vector2=function(a,b){this.x=a||0;this.y=b||0};
 THREE.Vector2.prototype={set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.x=a.x;this.y=a.y;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},unit:function(){this.multiplyScalar(1/this.length());return this},length:function(){return Math.sqrt(this.x*
 THREE.Vector2.prototype={set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.x=a.x;this.y=a.y;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},unit:function(){this.multiplyScalar(1/this.length());return this},length:function(){return Math.sqrt(this.x*
-this.x+this.y*this.y)},lengthSq:function(){return this.x*this.x+this.y*this.y},negate:function(){this.x=-this.x;this.y=-this.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},toString:function(){return"THREE.Vector2 ("+this.x+", "+this.y+")"}};THREE.Vector3=function(a,b,c){this.x=a||0;this.y=b||0;this.z=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.x=a.x;this.y=a.y;this.z=a.z;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this},
-cross:function(a,b){this.x=a.y*b.z-a.z*b.y;this.y=a.z*b.x-a.x*b.z;this.z=a.x*b.y-a.y*b.x;return this},crossSelf:function(a){var b=this.x,c=this.y,e=this.z;this.x=c*a.z-e*a.y;this.y=e*a.x-b*a.z;this.z=b*a.y-c*a.x;return this},multiply:function(a,b){this.x=a.x*b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},multiplySelf:function(a){this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;return this},divideSelf:function(a){this.x/=a.x;this.y/=a.y;this.z/=
-a.z;return this},divideScalar:function(a){this.x/=a;this.y/=a;this.z/=a;return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},distanceTo:function(a){var b=this.x-a.x,c=this.y-a.y;a=this.z-a.z;return Math.sqrt(b*b+c*c+a*a)},distanceToSquared:function(a){var b=this.x-a.x,c=this.y-a.y;a=this.z-a.z;return b*b+c*c+a*a},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},lengthManhattan:function(){return this.x+
+this.x+this.y*this.y)},lengthSq:function(){return this.x*this.x+this.y*this.y},negate:function(){this.x=-this.x;this.y=-this.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},toString:function(){return"THREE.Vector2 ("+this.x+", "+this.y+")"}};THREE.Vector3=function(a,b,d){this.x=a||0;this.y=b||0;this.z=d||0};
+THREE.Vector3.prototype={set:function(a,b,d){this.x=a;this.y=b;this.z=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this},
+cross:function(a,b){this.x=a.y*b.z-a.z*b.y;this.y=a.z*b.x-a.x*b.z;this.z=a.x*b.y-a.y*b.x;return this},crossSelf:function(a){var b=this.x,d=this.y,e=this.z;this.x=d*a.z-e*a.y;this.y=e*a.x-b*a.z;this.z=b*a.y-d*a.x;return this},multiply:function(a,b){this.x=a.x*b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},multiplySelf:function(a){this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;return this},divideSelf:function(a){this.x/=a.x;this.y/=a.y;this.z/=
+a.z;return this},divideScalar:function(a){this.x/=a;this.y/=a;this.z/=a;return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},distanceTo:function(a){var b=this.x-a.x,d=this.y-a.y;a=this.z-a.z;return Math.sqrt(b*b+d*d+a*a)},distanceToSquared:function(a){var b=this.x-a.x,d=this.y-a.y;a=this.z-a.z;return b*b+d*d+a*a},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},lengthManhattan:function(){return this.x+
 this.y+this.z},negate:function(){this.x=-this.x;this.y=-this.y;this.z=-this.z;return this},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z);a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setLength:function(a){return this.normalize().multiplyScalar(a)},isZero:function(){return Math.abs(this.x)<1.0E-4&&Math.abs(this.y)<1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)},toString:function(){return"THREE.Vector3 ( "+
 this.y+this.z},negate:function(){this.x=-this.x;this.y=-this.y;this.z=-this.z;return this},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z);a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setLength:function(a){return this.normalize().multiplyScalar(a)},isZero:function(){return Math.abs(this.x)<1.0E-4&&Math.abs(this.y)<1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)},toString:function(){return"THREE.Vector3 ( "+
-this.x+", "+this.y+", "+this.z+" )"}};THREE.Vector4=function(a,b,c,e){this.x=a||0;this.y=b||0;this.z=c||0;this.w=e||1};
-THREE.Vector4.prototype={set:function(a,b,c,e){this.x=a;this.y=b;this.z=c;this.w=e;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w||1;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;
+this.x+", "+this.y+", "+this.z+" )"}};THREE.Vector4=function(a,b,d,e){this.x=a||0;this.y=b||0;this.z=d||0;this.w=e||1};
+THREE.Vector4.prototype={set:function(a,b,d,e){this.x=a;this.y=b;this.z=d;this.w=e;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w||1;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;
 return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){this.x/=a;this.y/=a;this.z/=a;this.w/=a;return this},lerpSelf:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},toString:function(){return"THREE.Vector4 ("+this.x+", "+this.y+", "+this.z+", "+this.w+")"}};
 return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){this.x/=a;this.y/=a;this.z/=a;this.w/=a;return this},lerpSelf:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},toString:function(){return"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=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
-THREE.Ray.prototype={intersectScene:function(a){var b,c,e=a.objects,g=[];a=0;for(b=e.length;a<b;a++){c=e[a];c instanceof THREE.Mesh&&(g=g.concat(this.intersectObject(c)))}g.sort(function(i,l){return i.distance-l.distance});return g},intersectObject:function(a){function b(G,r,Z,D){D=D.clone().subSelf(r);Z=Z.clone().subSelf(r);var K=G.clone().subSelf(r);G=D.dot(D);r=D.dot(Z);D=D.dot(K);var d=Z.dot(Z);Z=Z.dot(K);K=1/(G*d-r*r);d=(d*D-r*Z)*K;G=(G*Z-r*D)*K;return d>0&&G>0&&d+G<1}var c,e,g,i,l,n,k,o,s,w,
-t,x=a.geometry,F=x.vertices,H=[];c=0;for(e=x.faces.length;c<e;c++){g=x.faces[c];w=this.origin.clone();t=this.direction.clone();k=a.globalMatrix;k.extractRotationMatrix(a.rotationMatrix);i=k.multiplyVector3(F[g.a].position.clone());l=k.multiplyVector3(F[g.b].position.clone());n=k.multiplyVector3(F[g.c].position.clone());k=g instanceof THREE.Face4?k.multiplyVector3(F[g.d].position.clone()):null;o=a.rotationMatrix.multiplyVector3(g.normal.clone());s=t.dot(o);if(s<0){o=o.dot((new THREE.Vector3).sub(i,
-w))/s;w=w.addSelf(t.multiplyScalar(o));if(g instanceof THREE.Face3){if(b(w,i,l,n)){g={distance:this.origin.distanceTo(w),point:w,face:g,object:a};H.push(g)}}else if(g instanceof THREE.Face4&&(b(w,i,l,k)||b(w,l,n,k))){g={distance:this.origin.distanceTo(w),point:w,face:g,object:a};H.push(g)}}}return H}};
-THREE.Rectangle=function(){function a(){i=e-b;l=g-c}var b,c,e,g,i,l,n=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return i};this.getHeight=function(){return l};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return e};this.getBottom=function(){return g};this.set=function(k,o,s,w){n=!1;b=k;c=o;e=s;g=w;a()};this.addPoint=function(k,o){if(n){n=!1;b=k;c=o;e=k;g=o}else{b=b<k?b:k;c=c<o?c:o;e=e>k?e:k;g=g>o?g:o}a()};
-this.add3Points=function(k,o,s,w,t,x){if(n){n=!1;b=k<s?k<t?k:t:s<t?s:t;c=o<w?o<x?o:x:w<x?w:x;e=k>s?k>t?k:t:s>t?s:t;g=o>w?o>x?o:x:w>x?w:x}else{b=k<s?k<t?k<b?k:b:t<b?t:b:s<t?s<b?s:b:t<b?t:b;c=o<w?o<x?o<c?o:c:x<c?x:c:w<x?w<c?w:c:x<c?x:c;e=k>s?k>t?k>e?k:e:t>e?t:e:s>t?s>e?s:e:t>e?t:e;g=o>w?o>x?o>g?o:g:x>g?x:g:w>x?w>g?w:g:x>g?x:g}a()};this.addRectangle=function(k){if(n){n=!1;b=k.getLeft();c=k.getTop();e=k.getRight();g=k.getBottom()}else{b=b<k.getLeft()?b:k.getLeft();c=c<k.getTop()?c:k.getTop();e=e>k.getRight()?
-e:k.getRight();g=g>k.getBottom()?g:k.getBottom()}a()};this.inflate=function(k){b-=k;c-=k;e+=k;g+=k;a()};this.minSelf=function(k){b=b>k.getLeft()?b:k.getLeft();c=c>k.getTop()?c:k.getTop();e=e<k.getRight()?e:k.getRight();g=g<k.getBottom()?g:k.getBottom();a()};this.instersects=function(k){return Math.min(e,k.getRight())-Math.max(b,k.getLeft())>=0&&Math.min(g,k.getBottom())-Math.max(c,k.getTop())>=0};this.empty=function(){n=!0;g=e=c=b=0;a()};this.isEmpty=function(){return n};this.toString=function(){return"THREE.Rectangle ( left: "+
-b+", right: "+e+", top: "+c+", bottom: "+g+", width: "+i+", height: "+l+" )"}};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,e,g,i,l,n,k,o,s,w,t,x,F,H){this.n11=a||1;this.n12=b||0;this.n13=c||0;this.n14=e||0;this.n21=g||0;this.n22=i||1;this.n23=l||0;this.n24=n||0;this.n31=k||0;this.n32=o||0;this.n33=s||1;this.n34=w||0;this.n41=t||0;this.n42=x||0;this.n43=F||0;this.n44=H||1;this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={identity:function(){this.n11=1;this.n21=this.n14=this.n13=this.n12=0;this.n22=1;this.n32=this.n31=this.n24=this.n23=0;this.n33=1;this.n43=this.n42=this.n41=this.n34=0;this.n44=1;return this},set:function(a,b,c,e,g,i,l,n,k,o,s,w,t,x,F,H){this.n11=a;this.n12=b;this.n13=c;this.n14=e;this.n21=g;this.n22=i;this.n23=l;this.n24=n;this.n31=k;this.n32=o;this.n33=s;this.n34=w;this.n41=t;this.n42=x;this.n43=F;this.n44=H;return this},copy:function(a){this.n11=a.n11;this.n12=a.n12;this.n13=
-a.n13;this.n14=a.n14;this.n21=a.n21;this.n22=a.n22;this.n23=a.n23;this.n24=a.n24;this.n31=a.n31;this.n32=a.n32;this.n33=a.n33;this.n34=a.n34;this.n41=a.n41;this.n42=a.n42;this.n43=a.n43;this.n44=a.n44;return this},lookAt:function(a,b,c){var e=THREE.Matrix4.__tmpVec1,g=THREE.Matrix4.__tmpVec2,i=THREE.Matrix4.__tmpVec3;i.sub(a,b).normalize();e.cross(c,i).normalize();g.cross(i,e).normalize();this.n11=e.x;this.n12=e.y;this.n13=e.z;this.n14=-e.dot(a);this.n21=g.x;this.n22=g.y;this.n23=g.z;this.n24=-g.dot(a);
-this.n31=i.x;this.n32=i.y;this.n33=i.z;this.n34=-i.dot(a);this.n43=this.n42=this.n41=0;this.n44=1;return this},multiplyVector3:function(a){var b=a.x,c=a.y,e=a.z,g=1/(this.n41*b+this.n42*c+this.n43*e+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*e+this.n14)*g;a.y=(this.n21*b+this.n22*c+this.n23*e+this.n24)*g;a.z=(this.n31*b+this.n32*c+this.n33*e+this.n34)*g;return a},multiplyVector3OnlyZ:function(a){var b=a.x,c=a.y;a=a.z;return(this.n31*b+this.n32*c+this.n33*a+this.n34)*(1/(this.n41*b+this.n42*c+this.n43*
-a+this.n44))},multiplyVector4:function(a){var b=a.x,c=a.y,e=a.z,g=a.w;a.x=this.n11*b+this.n12*c+this.n13*e+this.n14*g;a.y=this.n21*b+this.n22*c+this.n23*e+this.n24*g;a.z=this.n31*b+this.n32*c+this.n33*e+this.n34*g;a.w=this.n41*b+this.n42*c+this.n43*e+this.n44*g;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,e=a.n12,g=a.n13,i=a.n14,l=a.n21,n=a.n22,k=a.n23,o=a.n24,s=a.n31,w=a.n32,t=a.n33,x=a.n34,F=a.n41,H=a.n42,G=a.n43,r=a.n44,Z=b.n11,D=b.n12,K=b.n13,d=b.n14,ga=b.n21,T=b.n22,N=b.n23,ba=b.n24,R=b.n31,aa=b.n32,V=b.n33,B=b.n34,I=b.n41,ka=b.n42,P=b.n43,ja=b.n44;this.n11=c*Z+e*ga+g*R+i*I;this.n12=c*D+e*T+g*aa+i*ka;this.n13=c*K+e*N+g*V+i*P;this.n14=c*d+e*ba+g*B+i*ja;this.n21=l*Z+n*ga+k*R+o*I;this.n22=l*D+n*T+k*aa+o*ka;
-this.n23=l*K+n*N+k*V+o*P;this.n24=l*d+n*ba+k*B+o*ja;this.n31=s*Z+w*ga+t*R+x*I;this.n32=s*D+w*T+t*aa+x*ka;this.n33=s*K+w*N+t*V+x*P;this.n34=s*d+w*ba+t*B+x*ja;this.n41=F*Z+H*ga+G*R+r*I;this.n42=F*D+H*T+G*aa+r*ka;this.n43=F*K+H*N+G*V+r*P;this.n44=F*d+H*ba+G*B+r*ja;return this},multiplyToArray:function(a,b,c){var e=a.n11,g=a.n12,i=a.n13,l=a.n14,n=a.n21,k=a.n22,o=a.n23,s=a.n24,w=a.n31,t=a.n32,x=a.n33,F=a.n34,H=a.n41,G=a.n42,r=a.n43;a=a.n44;var Z=b.n11,D=b.n12,K=b.n13,d=b.n14,ga=b.n21,T=b.n22,N=b.n23,ba=
-b.n24,R=b.n31,aa=b.n32,V=b.n33,B=b.n34,I=b.n41,ka=b.n42,P=b.n43;b=b.n44;this.n11=e*Z+g*ga+i*R+l*I;this.n12=e*D+g*T+i*aa+l*ka;this.n13=e*K+g*N+i*V+l*P;this.n14=e*d+g*ba+i*B+l*b;this.n21=n*Z+k*ga+o*R+s*I;this.n22=n*D+k*T+o*aa+s*ka;this.n23=n*K+k*N+o*V+s*P;this.n24=n*d+k*ba+o*B+s*b;this.n31=w*Z+t*ga+x*R+F*I;this.n32=w*D+t*T+x*aa+F*ka;this.n33=w*K+t*N+x*V+F*P;this.n34=w*d+t*ba+x*B+F*b;this.n41=H*Z+G*ga+r*R+a*I;this.n42=H*D+G*T+r*aa+a*ka;this.n43=H*K+G*N+r*V+a*P;this.n44=H*d+G*ba+r*B+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){var b=this.n11,c=this.n12,e=this.n13,g=this.n14,i=this.n21,l=this.n22,n=this.n23,k=this.n24,o=this.n31,s=this.n32,w=this.n33,t=this.n34,x=this.n41,F=this.n42,H=this.n43,G=this.n44,r=a.n11,Z=a.n21,D=a.n31,K=a.n41,d=a.n12,ga=a.n22,T=a.n32,N=a.n42,ba=
-a.n13,R=a.n23,aa=a.n33,V=a.n43,B=a.n14,I=a.n24,ka=a.n34;a=a.n44;this.n11=b*r+c*Z+e*D+g*K;this.n12=b*d+c*ga+e*T+g*N;this.n13=b*ba+c*R+e*aa+g*V;this.n14=b*B+c*I+e*ka+g*a;this.n21=i*r+l*Z+n*D+k*K;this.n22=i*d+l*ga+n*T+k*N;this.n23=i*ba+l*R+n*aa+k*V;this.n24=i*B+l*I+n*ka+k*a;this.n31=o*r+s*Z+w*D+t*K;this.n32=o*d+s*ga+w*T+t*N;this.n33=o*ba+s*R+w*aa+t*V;this.n34=o*B+s*I+w*ka+t*a;this.n41=x*r+F*Z+H*D+G*K;this.n42=x*d+F*ga+H*T+G*N;this.n43=x*ba+F*R+H*aa+G*V;this.n44=x*B+F*I+H*ka+G*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,e=this.n14,g=this.n21,i=this.n22,l=this.n23,n=this.n24,k=this.n31,o=this.n32,s=this.n33,w=this.n34,t=this.n41,x=this.n42,F=this.n43,H=this.n44;return e*l*o*t-c*n*o*t-e*i*s*t+b*n*s*t+c*i*w*t-b*l*w*t-e*l*k*x+c*n*k*x+e*g*s*x-a*n*s*x-c*g*w*x+a*l*w*x+
-e*i*k*F-b*n*k*F-e*g*o*F+a*n*o*F+b*g*w*F-a*i*w*F-c*i*k*H+b*l*k*H+c*g*o*H-a*l*o*H-b*g*s*H+a*i*s*H},transpose:function(){function a(b,c,e){var g=b[c];b[c]=b[e];b[e]=g}a(this,"n21","n12");a(this,"n31","n13");a(this,"n32","n23");a(this,"n41","n14");a(this,"n42","n24");a(this,"n43","n34");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;
+THREE.Ray.prototype={intersectScene:function(a){var b,d,e=a.objects,g=[];a=0;for(b=e.length;a<b;a++){d=e[a];d instanceof THREE.Mesh&&(g=g.concat(this.intersectObject(d)))}g.sort(function(i,l){return i.distance-l.distance});return g},intersectObject:function(a){function b(H,r,Z,E){E=E.clone().subSelf(r);Z=Z.clone().subSelf(r);var L=H.clone().subSelf(r);H=E.dot(E);r=E.dot(Z);E=E.dot(L);var c=Z.dot(Z);Z=Z.dot(L);L=1/(H*c-r*r);c=(c*E-r*Z)*L;H=(H*Z-r*E)*L;return c>0&&H>0&&c+H<1}var d,e,g,i,l,n,k,o,s,w,
+u,x=a.geometry,F=x.vertices,I=[];d=0;for(e=x.faces.length;d<e;d++){g=x.faces[d];w=this.origin.clone();u=this.direction.clone();k=a.globalMatrix;k.extractRotationMatrix(a.rotationMatrix);i=k.multiplyVector3(F[g.a].position.clone());l=k.multiplyVector3(F[g.b].position.clone());n=k.multiplyVector3(F[g.c].position.clone());k=g instanceof THREE.Face4?k.multiplyVector3(F[g.d].position.clone()):null;o=a.rotationMatrix.multiplyVector3(g.normal.clone());s=u.dot(o);if(s<0){o=o.dot((new THREE.Vector3).sub(i,
+w))/s;w=w.addSelf(u.multiplyScalar(o));if(g instanceof THREE.Face3){if(b(w,i,l,n)){g={distance:this.origin.distanceTo(w),point:w,face:g,object:a};I.push(g)}}else if(g instanceof THREE.Face4&&(b(w,i,l,k)||b(w,l,n,k))){g={distance:this.origin.distanceTo(w),point:w,face:g,object:a};I.push(g)}}}return I}};
+THREE.Rectangle=function(){function a(){i=e-b;l=g-d}var b,d,e,g,i,l,n=!0;this.getX=function(){return b};this.getY=function(){return d};this.getWidth=function(){return i};this.getHeight=function(){return l};this.getLeft=function(){return b};this.getTop=function(){return d};this.getRight=function(){return e};this.getBottom=function(){return g};this.set=function(k,o,s,w){n=!1;b=k;d=o;e=s;g=w;a()};this.addPoint=function(k,o){if(n){n=!1;b=k;d=o;e=k;g=o}else{b=b<k?b:k;d=d<o?d:o;e=e>k?e:k;g=g>o?g:o}a()};
+this.add3Points=function(k,o,s,w,u,x){if(n){n=!1;b=k<s?k<u?k:u:s<u?s:u;d=o<w?o<x?o:x:w<x?w:x;e=k>s?k>u?k:u:s>u?s:u;g=o>w?o>x?o:x:w>x?w:x}else{b=k<s?k<u?k<b?k:b:u<b?u:b:s<u?s<b?s:b:u<b?u:b;d=o<w?o<x?o<d?o:d:x<d?x:d:w<x?w<d?w:d:x<d?x:d;e=k>s?k>u?k>e?k:e:u>e?u:e:s>u?s>e?s:e:u>e?u:e;g=o>w?o>x?o>g?o:g:x>g?x:g:w>x?w>g?w:g:x>g?x:g}a()};this.addRectangle=function(k){if(n){n=!1;b=k.getLeft();d=k.getTop();e=k.getRight();g=k.getBottom()}else{b=b<k.getLeft()?b:k.getLeft();d=d<k.getTop()?d:k.getTop();e=e>k.getRight()?
+e:k.getRight();g=g>k.getBottom()?g:k.getBottom()}a()};this.inflate=function(k){b-=k;d-=k;e+=k;g+=k;a()};this.minSelf=function(k){b=b>k.getLeft()?b:k.getLeft();d=d>k.getTop()?d:k.getTop();e=e<k.getRight()?e:k.getRight();g=g<k.getBottom()?g:k.getBottom();a()};this.instersects=function(k){return Math.min(e,k.getRight())-Math.max(b,k.getLeft())>=0&&Math.min(g,k.getBottom())-Math.max(d,k.getTop())>=0};this.empty=function(){n=!0;g=e=d=b=0;a()};this.isEmpty=function(){return n};this.toString=function(){return"THREE.Rectangle ( left: "+
+b+", right: "+e+", top: "+d+", bottom: "+g+", width: "+i+", height: "+l+" )"}};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,d,e,g,i,l,n,k,o,s,w,u,x,F,I){this.n11=a||1;this.n12=b||0;this.n13=d||0;this.n14=e||0;this.n21=g||0;this.n22=i||1;this.n23=l||0;this.n24=n||0;this.n31=k||0;this.n32=o||0;this.n33=s||1;this.n34=w||0;this.n41=u||0;this.n42=x||0;this.n43=F||0;this.n44=I||1;this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={identity:function(){this.n11=1;this.n21=this.n14=this.n13=this.n12=0;this.n22=1;this.n32=this.n31=this.n24=this.n23=0;this.n33=1;this.n43=this.n42=this.n41=this.n34=0;this.n44=1;return this},set:function(a,b,d,e,g,i,l,n,k,o,s,w,u,x,F,I){this.n11=a;this.n12=b;this.n13=d;this.n14=e;this.n21=g;this.n22=i;this.n23=l;this.n24=n;this.n31=k;this.n32=o;this.n33=s;this.n34=w;this.n41=u;this.n42=x;this.n43=F;this.n44=I;return this},copy:function(a){this.n11=a.n11;this.n12=a.n12;this.n13=
+a.n13;this.n14=a.n14;this.n21=a.n21;this.n22=a.n22;this.n23=a.n23;this.n24=a.n24;this.n31=a.n31;this.n32=a.n32;this.n33=a.n33;this.n34=a.n34;this.n41=a.n41;this.n42=a.n42;this.n43=a.n43;this.n44=a.n44;return this},lookAt:function(a,b,d){var e=THREE.Matrix4.__tmpVec1,g=THREE.Matrix4.__tmpVec2,i=THREE.Matrix4.__tmpVec3;i.sub(a,b).normalize();e.cross(d,i).normalize();g.cross(i,e).normalize();this.n11=e.x;this.n12=e.y;this.n13=e.z;this.n14=-e.dot(a);this.n21=g.x;this.n22=g.y;this.n23=g.z;this.n24=-g.dot(a);
+this.n31=i.x;this.n32=i.y;this.n33=i.z;this.n34=-i.dot(a);this.n43=this.n42=this.n41=0;this.n44=1;return this},multiplyVector3:function(a){var b=a.x,d=a.y,e=a.z,g=1/(this.n41*b+this.n42*d+this.n43*e+this.n44);a.x=(this.n11*b+this.n12*d+this.n13*e+this.n14)*g;a.y=(this.n21*b+this.n22*d+this.n23*e+this.n24)*g;a.z=(this.n31*b+this.n32*d+this.n33*e+this.n34)*g;return a},multiplyVector3OnlyZ:function(a){var b=a.x,d=a.y;a=a.z;return(this.n31*b+this.n32*d+this.n33*a+this.n34)*(1/(this.n41*b+this.n42*d+this.n43*
+a+this.n44))},multiplyVector4:function(a){var b=a.x,d=a.y,e=a.z,g=a.w;a.x=this.n11*b+this.n12*d+this.n13*e+this.n14*g;a.y=this.n21*b+this.n22*d+this.n23*e+this.n24*g;a.z=this.n31*b+this.n32*d+this.n33*e+this.n34*g;a.w=this.n41*b+this.n42*d+this.n43*e+this.n44*g;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 d=a.n11,e=a.n12,g=a.n13,i=a.n14,l=a.n21,n=a.n22,k=a.n23,o=a.n24,s=a.n31,w=a.n32,u=a.n33,x=a.n34,F=a.n41,I=a.n42,H=a.n43,r=a.n44,Z=b.n11,E=b.n12,L=b.n13,c=b.n14,ia=b.n21,T=b.n22,O=b.n23,ca=b.n24,S=b.n31,ba=b.n32,V=b.n33,D=b.n34,J=b.n41,la=b.n42,Q=b.n43,ja=b.n44;this.n11=d*Z+e*ia+g*S+i*J;this.n12=d*E+e*T+g*ba+i*la;this.n13=d*L+e*O+g*V+i*Q;this.n14=d*c+e*ca+g*D+i*ja;this.n21=l*Z+n*ia+k*S+o*J;this.n22=l*E+n*T+k*ba+o*la;
+this.n23=l*L+n*O+k*V+o*Q;this.n24=l*c+n*ca+k*D+o*ja;this.n31=s*Z+w*ia+u*S+x*J;this.n32=s*E+w*T+u*ba+x*la;this.n33=s*L+w*O+u*V+x*Q;this.n34=s*c+w*ca+u*D+x*ja;this.n41=F*Z+I*ia+H*S+r*J;this.n42=F*E+I*T+H*ba+r*la;this.n43=F*L+I*O+H*V+r*Q;this.n44=F*c+I*ca+H*D+r*ja;return this},multiplyToArray:function(a,b,d){var e=a.n11,g=a.n12,i=a.n13,l=a.n14,n=a.n21,k=a.n22,o=a.n23,s=a.n24,w=a.n31,u=a.n32,x=a.n33,F=a.n34,I=a.n41,H=a.n42,r=a.n43;a=a.n44;var Z=b.n11,E=b.n12,L=b.n13,c=b.n14,ia=b.n21,T=b.n22,O=b.n23,ca=
+b.n24,S=b.n31,ba=b.n32,V=b.n33,D=b.n34,J=b.n41,la=b.n42,Q=b.n43;b=b.n44;this.n11=e*Z+g*ia+i*S+l*J;this.n12=e*E+g*T+i*ba+l*la;this.n13=e*L+g*O+i*V+l*Q;this.n14=e*c+g*ca+i*D+l*b;this.n21=n*Z+k*ia+o*S+s*J;this.n22=n*E+k*T+o*ba+s*la;this.n23=n*L+k*O+o*V+s*Q;this.n24=n*c+k*ca+o*D+s*b;this.n31=w*Z+u*ia+x*S+F*J;this.n32=w*E+u*T+x*ba+F*la;this.n33=w*L+u*O+x*V+F*Q;this.n34=w*c+u*ca+x*D+F*b;this.n41=I*Z+H*ia+r*S+a*J;this.n42=I*E+H*T+r*ba+a*la;this.n43=I*L+H*O+r*V+a*Q;this.n44=I*c+H*ca+r*D+a*b;d[0]=this.n11;
+d[1]=this.n21;d[2]=this.n31;d[3]=this.n41;d[4]=this.n12;d[5]=this.n22;d[6]=this.n32;d[7]=this.n42;d[8]=this.n13;d[9]=this.n23;d[10]=this.n33;d[11]=this.n43;d[12]=this.n14;d[13]=this.n24;d[14]=this.n34;d[15]=this.n44;return this},multiplySelf:function(a){var b=this.n11,d=this.n12,e=this.n13,g=this.n14,i=this.n21,l=this.n22,n=this.n23,k=this.n24,o=this.n31,s=this.n32,w=this.n33,u=this.n34,x=this.n41,F=this.n42,I=this.n43,H=this.n44,r=a.n11,Z=a.n21,E=a.n31,L=a.n41,c=a.n12,ia=a.n22,T=a.n32,O=a.n42,ca=
+a.n13,S=a.n23,ba=a.n33,V=a.n43,D=a.n14,J=a.n24,la=a.n34;a=a.n44;this.n11=b*r+d*Z+e*E+g*L;this.n12=b*c+d*ia+e*T+g*O;this.n13=b*ca+d*S+e*ba+g*V;this.n14=b*D+d*J+e*la+g*a;this.n21=i*r+l*Z+n*E+k*L;this.n22=i*c+l*ia+n*T+k*O;this.n23=i*ca+l*S+n*ba+k*V;this.n24=i*D+l*J+n*la+k*a;this.n31=o*r+s*Z+w*E+u*L;this.n32=o*c+s*ia+w*T+u*O;this.n33=o*ca+s*S+w*ba+u*V;this.n34=o*D+s*J+w*la+u*a;this.n41=x*r+F*Z+I*E+H*L;this.n42=x*c+F*ia+I*T+H*O;this.n43=x*ca+F*S+I*ba+H*V;this.n44=x*D+F*J+I*la+H*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,d=this.n13,e=this.n14,g=this.n21,i=this.n22,l=this.n23,n=this.n24,k=this.n31,o=this.n32,s=this.n33,w=this.n34,u=this.n41,x=this.n42,F=this.n43,I=this.n44;return e*l*o*u-d*n*o*u-e*i*s*u+b*n*s*u+d*i*w*u-b*l*w*u-e*l*k*x+d*n*k*x+e*g*s*x-a*n*s*x-d*g*w*x+a*l*w*x+
+e*i*k*F-b*n*k*F-e*g*o*F+a*n*o*F+b*g*w*F-a*i*w*F-d*i*k*I+b*l*k*I+d*g*o*I-a*l*o*I-b*g*s*I+a*i*s*I},transpose:function(){function a(b,d,e){var g=b[d];b[d]=b[e];b[e]=g}a(this,"n21","n12");a(this,"n31","n13");a(this,"n32","n23");a(this,"n41","n14");a(this,"n42","n24");a(this,"n43","n34");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(){var a=this.flat;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},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]=
 a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){var a=this.flat;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},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=
-this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);
-return this},setScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotX: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},setRotY: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},setRotZ: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},setRotAxis:function(a,b){var c=Math.cos(b),e=Math.sin(b),g=1-c,i=a.x,l=a.y,n=a.z,k=g*
-i,o=g*l;this.set(k*i+c,k*l-e*n,k*n+e*l,0,k*l+e*n,o*l+c,o*n-e*i,0,k*n-e*l,o*n+e*i,g*n*n+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},setRotationFromEuler:function(a){var b=a.x,c=a.y,e=a.z;a=Math.cos(c);c=Math.sin(c);var g=Math.cos(-e);e=Math.sin(-e);var i=Math.cos(b);b=Math.sin(b);var l=a*e,n=c*e;this.n11=a*g;this.n12=c*b-l*i;this.n13=l*b+c*i;this.n21=e;this.n22=g*i;this.n23=-g*b;this.n31=-c*g;this.n32=n*i+a*b;this.n33=-n*b+a*i},setRotationFromQuaternion:function(a){var b=
-a.x,c=a.y,e=a.z,g=a.w,i=b+b,l=c+c,n=e+e;a=b*i;var k=b*l;b*=n;var o=c*l;c*=n;e*=n;i*=g;l*=g;g*=n;this.n11=1-(o+e);this.n12=k-g;this.n13=b+l;this.n21=k+g;this.n22=1-(a+e);this.n23=c-i;this.n31=b-l;this.n32=c+i;this.n33=1-(a+o)},scale:function(a){var b=a.x,c=a.y;a=a.z;this.n11*=b;this.n12*=b;this.n13*=b;this.n21*=c;this.n22*=c;this.n23*=c;this.n31*=a;this.n32*=a;this.n33*=a;return this},extractRotationMatrix:function(a){a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=0;a.n21=this.n21;a.n22=this.n22;
-a.n23=this.n23;a.n24=0;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=0;a.n41=0;a.n42=0;a.n43=0;a.n44=1},toString:function(){return"| "+this.n11+" "+this.n12+" "+this.n13+" "+this.n14+" |\n| "+this.n21+" "+this.n22+" "+this.n23+" "+this.n24+" |\n| "+this.n31+" "+this.n32+" "+this.n33+" "+this.n34+" |\n| "+this.n41+" "+this.n42+" "+this.n43+" "+this.n44+" |"}};THREE.Matrix4.translationMatrix=function(a,b,c){var e=new THREE.Matrix4;e.setTranslation(a,b,c);return e};
-THREE.Matrix4.scaleMatrix=function(a,b,c){var e=new THREE.Matrix4;e.setScale(a,b,c);return e};THREE.Matrix4.rotationXMatrix=function(a){var b=new THREE.Matrix4;b.setRotX(a);return b};THREE.Matrix4.rotationYMatrix=function(a){var b=new THREE.Matrix4;b.setRotY(a);return b};THREE.Matrix4.rotationZMatrix=function(a){var b=new THREE.Matrix4;b.setRotZ(a);return b};THREE.Matrix4.rotationAxisAngleMatrix=function(a,b){var c=new THREE.Matrix4;c.setRotAxis(a,b);return c};
-THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,e=a.n12,g=a.n13,i=a.n14,l=a.n21,n=a.n22,k=a.n23,o=a.n24,s=a.n31,w=a.n32,t=a.n33,x=a.n34,F=a.n41,H=a.n42,G=a.n43,r=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=k*x*H-o*t*H+o*w*G-n*x*G-k*w*r+n*t*r;b.n12=i*t*H-g*x*H-i*w*G+e*x*G+g*w*r-e*t*r;b.n13=g*o*H-i*k*H+i*n*G-e*o*G-g*n*r+e*k*r;b.n14=i*k*w-g*o*w-i*n*t+e*o*t+g*n*x-e*k*x;b.n21=o*t*F-k*x*F-o*s*G+l*x*G+k*s*r-l*t*r;b.n22=g*x*F-i*t*F+i*s*G-c*x*G-g*s*r+c*t*r;b.n23=i*k*F-g*o*F-i*l*G+c*o*G+g*l*r-c*k*r;
-b.n24=g*o*s-i*k*s+i*l*t-c*o*t-g*l*x+c*k*x;b.n31=n*x*F-o*w*F+o*s*H-l*x*H-n*s*r+l*w*r;b.n32=i*w*F-e*x*F-i*s*H+c*x*H+e*s*r-c*w*r;b.n33=g*o*F-i*n*F+i*l*H-c*o*H-e*l*r+c*n*r;b.n34=i*n*s-e*o*s-i*l*w+c*o*w+e*l*x-c*n*x;b.n41=k*w*F-n*t*F-k*s*H+l*t*H+n*s*G-l*w*G;b.n42=e*t*F-g*w*F+g*s*H-c*t*H-e*s*G+c*w*G;b.n43=g*n*F-e*k*F-g*l*H+c*k*H+e*l*G-c*n*G;b.n44=e*k*s-g*n*s+g*l*w-c*k*w-e*l*t+c*n*t;b.multiplyScalar(1/a.determinant());return b};
-THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,e=a.n33*a.n22-a.n32*a.n23,g=-a.n33*a.n21+a.n31*a.n23,i=a.n32*a.n21-a.n31*a.n22,l=-a.n33*a.n12+a.n32*a.n13,n=a.n33*a.n11-a.n31*a.n13,k=-a.n32*a.n11+a.n31*a.n12,o=a.n23*a.n12-a.n22*a.n13,s=-a.n23*a.n11+a.n21*a.n13,w=a.n22*a.n11-a.n21*a.n12;a=a.n11*e+a.n21*l+a.n31*o;if(a==0)throw"matrix not invertible";a=1/a;c[0]=a*e;c[1]=a*g;c[2]=a*i;c[3]=a*l;c[4]=a*n;c[5]=a*k;c[6]=a*o;c[7]=a*s;c[8]=a*w;return b};
-THREE.Matrix4.makeFrustum=function(a,b,c,e,g,i){var l;l=new THREE.Matrix4;l.n11=2*g/(b-a);l.n12=0;l.n13=(b+a)/(b-a);l.n14=0;l.n21=0;l.n22=2*g/(e-c);l.n23=(e+c)/(e-c);l.n24=0;l.n31=0;l.n32=0;l.n33=-(i+g)/(i-g);l.n34=-2*i*g/(i-g);l.n41=0;l.n42=0;l.n43=-1;l.n44=0;return l};THREE.Matrix4.makePerspective=function(a,b,c,e){var g;a=c*Math.tan(a*Math.PI/360);g=-a;return THREE.Matrix4.makeFrustum(g*b,a*b,g,a,c,e)};
-THREE.Matrix4.makeOrtho=function(a,b,c,e,g,i){var l,n,k,o;l=new THREE.Matrix4;n=b-a;k=c-e;o=i-g;l.n11=2/n;l.n12=0;l.n13=0;l.n14=-((b+a)/n);l.n21=0;l.n22=2/k;l.n23=0;l.n24=-((c+e)/k);l.n31=0;l.n32=0;l.n33=-2/o;l.n34=-((i+g)/o);l.n41=0;l.n42=0;l.n43=0;l.n44=1;return l};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3;
-THREE.Quaternion=function(a,b,c,e){this.x=a||0;this.y=b||0;this.z=c||0;this.w=e!==undefined?e:1;this.api={isDirty:!1,that:this,get x(){return this.that.x},get y(){return this.that.y},get z(){return this.that.z},get w(){return this.that.w},set x(g){this.that.x=g;this.isDirty=!0},set y(g){this.that.y=g;this.isDirty=!0},set z(g){this.that.z=g;this.isDirty=!0},set w(g){this.that.w=g;this.isDirty=!0}};this.api.__proto__=THREE.Quaternion.prototype;return this.api};
-THREE.Quaternion.prototype.set=function(a,b,c,e){var g=this.that;g.x=a;g.y=b;g.z=c;g.w=e;this.isDirty=!0;return this};THREE.Quaternion.prototype.setFromEuler=function(a){var b=0.5*Math.PI/360,c=a.x*b,e=a.y*b,g=a.z*b;a=Math.cos(e);e=Math.sin(e);b=Math.cos(-g);g=Math.sin(-g);var i=Math.cos(c);c=Math.sin(c);var l=a*b,n=e*g,k=this.that;k.w=l*i-n*c;k.x=l*c+n*i;k.y=e*b*i+a*g*c;k.z=a*g*i-e*b*c;this.isDirty=!0;return this};
-THREE.Quaternion.prototype.calculateW=function(){var a=this.that,b=a.x,c=a.y,e=a.z;a.w=-Math.sqrt(Math.abs(1-b*b-c*c-e*e));this.isDirty=!0;return this};THREE.Quaternion.prototype.inverse=function(){var a=this.that;a.x*=-1;a.y*=-1;a.z*=-1;this.isDirty=!0;return this};THREE.Quaternion.prototype.length=function(){var a=this.that;return Math.sqrt(a.x*a.x+a.y*a.y+a.z*a.z+a.w*a.w)};
-THREE.Quaternion.prototype.normalize=function(){var a=this.that,b=a.x,c=a.y,e=a.z,g=a.w,i=Math.sqrt(b*b+c*c+e*e+g*g);if(i==0){a.x=0;a.y=0;a.z=0;a.w=0;this.isDirty=!0;return this}i=1/i;a.x=b*i;a.y=c*i;a.z=e*i;a.w=g*i;this.isDirty=!0;return this};
+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,d){this.set(1,0,0,a,0,1,0,b,0,0,1,d,0,0,0,1);
+return this},setScale:function(a,b,d){this.set(a,0,0,0,0,b,0,0,0,0,d,0,0,0,0,1);return this},setRotX: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},setRotY: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},setRotZ: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},setRotAxis:function(a,b){var d=Math.cos(b),e=Math.sin(b),g=1-d,i=a.x,l=a.y,n=a.z,k=g*
+i,o=g*l;this.set(k*i+d,k*l-e*n,k*n+e*l,0,k*l+e*n,o*l+d,o*n-e*i,0,k*n-e*l,o*n+e*i,g*n*n+d,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var b=a.x,d=a.y,e=a.z;a=Math.cos(d);d=Math.sin(d);var g=Math.cos(-e);e=Math.sin(-e);var i=Math.cos(b);b=Math.sin(b);var l=a*e,n=d*e;this.n11=a*g;this.n12=d*b-l*i;this.n13=l*b+d*i;this.n21=e;this.n22=g*i;this.n23=-g*b;this.n31=-d*g;this.n32=n*i+a*b;this.n33=-n*b+a*i},setRotationFromQuaternion:function(a){var b=
+a.x,d=a.y,e=a.z,g=a.w,i=b+b,l=d+d,n=e+e;a=b*i;var k=b*l;b*=n;var o=d*l;d*=n;e*=n;i*=g;l*=g;g*=n;this.n11=1-(o+e);this.n12=k-g;this.n13=b+l;this.n21=k+g;this.n22=1-(a+e);this.n23=d-i;this.n31=b-l;this.n32=d+i;this.n33=1-(a+o)},scale:function(a){var b=a.x,d=a.y;a=a.z;this.n11*=b;this.n12*=b;this.n13*=b;this.n21*=d;this.n22*=d;this.n23*=d;this.n31*=a;this.n32*=a;this.n33*=a;return this},extractRotationMatrix:function(a){a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=0;a.n21=this.n21;a.n22=this.n22;
+a.n23=this.n23;a.n24=0;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=0;a.n41=0;a.n42=0;a.n43=0;a.n44=1},toString:function(){return"| "+this.n11+" "+this.n12+" "+this.n13+" "+this.n14+" |\n| "+this.n21+" "+this.n22+" "+this.n23+" "+this.n24+" |\n| "+this.n31+" "+this.n32+" "+this.n33+" "+this.n34+" |\n| "+this.n41+" "+this.n42+" "+this.n43+" "+this.n44+" |"}};THREE.Matrix4.translationMatrix=function(a,b,d){var e=new THREE.Matrix4;e.setTranslation(a,b,d);return e};
+THREE.Matrix4.scaleMatrix=function(a,b,d){var e=new THREE.Matrix4;e.setScale(a,b,d);return e};THREE.Matrix4.rotationXMatrix=function(a){var b=new THREE.Matrix4;b.setRotX(a);return b};THREE.Matrix4.rotationYMatrix=function(a){var b=new THREE.Matrix4;b.setRotY(a);return b};THREE.Matrix4.rotationZMatrix=function(a){var b=new THREE.Matrix4;b.setRotZ(a);return b};THREE.Matrix4.rotationAxisAngleMatrix=function(a,b){var d=new THREE.Matrix4;d.setRotAxis(a,b);return d};
+THREE.Matrix4.makeInvert=function(a,b){var d=a.n11,e=a.n12,g=a.n13,i=a.n14,l=a.n21,n=a.n22,k=a.n23,o=a.n24,s=a.n31,w=a.n32,u=a.n33,x=a.n34,F=a.n41,I=a.n42,H=a.n43,r=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=k*x*I-o*u*I+o*w*H-n*x*H-k*w*r+n*u*r;b.n12=i*u*I-g*x*I-i*w*H+e*x*H+g*w*r-e*u*r;b.n13=g*o*I-i*k*I+i*n*H-e*o*H-g*n*r+e*k*r;b.n14=i*k*w-g*o*w-i*n*u+e*o*u+g*n*x-e*k*x;b.n21=o*u*F-k*x*F-o*s*H+l*x*H+k*s*r-l*u*r;b.n22=g*x*F-i*u*F+i*s*H-d*x*H-g*s*r+d*u*r;b.n23=i*k*F-g*o*F-i*l*H+d*o*H+g*l*r-d*k*r;
+b.n24=g*o*s-i*k*s+i*l*u-d*o*u-g*l*x+d*k*x;b.n31=n*x*F-o*w*F+o*s*I-l*x*I-n*s*r+l*w*r;b.n32=i*w*F-e*x*F-i*s*I+d*x*I+e*s*r-d*w*r;b.n33=g*o*F-i*n*F+i*l*I-d*o*I-e*l*r+d*n*r;b.n34=i*n*s-e*o*s-i*l*w+d*o*w+e*l*x-d*n*x;b.n41=k*w*F-n*u*F-k*s*I+l*u*I+n*s*H-l*w*H;b.n42=e*u*F-g*w*F+g*s*I-d*u*I-e*s*H+d*w*H;b.n43=g*n*F-e*k*F-g*l*I+d*k*I+e*l*H-d*n*H;b.n44=e*k*s-g*n*s+g*l*w-d*k*w-e*l*u+d*n*u;b.multiplyScalar(1/a.determinant());return b};
+THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,d=b.m,e=a.n33*a.n22-a.n32*a.n23,g=-a.n33*a.n21+a.n31*a.n23,i=a.n32*a.n21-a.n31*a.n22,l=-a.n33*a.n12+a.n32*a.n13,n=a.n33*a.n11-a.n31*a.n13,k=-a.n32*a.n11+a.n31*a.n12,o=a.n23*a.n12-a.n22*a.n13,s=-a.n23*a.n11+a.n21*a.n13,w=a.n22*a.n11-a.n21*a.n12;a=a.n11*e+a.n21*l+a.n31*o;if(a==0)throw"matrix not invertible";a=1/a;d[0]=a*e;d[1]=a*g;d[2]=a*i;d[3]=a*l;d[4]=a*n;d[5]=a*k;d[6]=a*o;d[7]=a*s;d[8]=a*w;return b};
+THREE.Matrix4.makeFrustum=function(a,b,d,e,g,i){var l;l=new THREE.Matrix4;l.n11=2*g/(b-a);l.n12=0;l.n13=(b+a)/(b-a);l.n14=0;l.n21=0;l.n22=2*g/(e-d);l.n23=(e+d)/(e-d);l.n24=0;l.n31=0;l.n32=0;l.n33=-(i+g)/(i-g);l.n34=-2*i*g/(i-g);l.n41=0;l.n42=0;l.n43=-1;l.n44=0;return l};THREE.Matrix4.makePerspective=function(a,b,d,e){var g;a=d*Math.tan(a*Math.PI/360);g=-a;return THREE.Matrix4.makeFrustum(g*b,a*b,g,a,d,e)};
+THREE.Matrix4.makeOrtho=function(a,b,d,e,g,i){var l,n,k,o;l=new THREE.Matrix4;n=b-a;k=d-e;o=i-g;l.n11=2/n;l.n12=0;l.n13=0;l.n14=-((b+a)/n);l.n21=0;l.n22=2/k;l.n23=0;l.n24=-((d+e)/k);l.n31=0;l.n32=0;l.n33=-2/o;l.n34=-((i+g)/o);l.n41=0;l.n42=0;l.n43=0;l.n44=1;return l};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3;
+THREE.Quaternion=function(a,b,d,e){this.x=a||0;this.y=b||0;this.z=d||0;this.w=e!==undefined?e:1;this.api={isDirty:!1,that:this,get x(){return this.that.x},get y(){return this.that.y},get z(){return this.that.z},get w(){return this.that.w},set x(g){this.that.x=g;this.isDirty=!0},set y(g){this.that.y=g;this.isDirty=!0},set z(g){this.that.z=g;this.isDirty=!0},set w(g){this.that.w=g;this.isDirty=!0}};this.api.__proto__=THREE.Quaternion.prototype;return this.api};
+THREE.Quaternion.prototype.set=function(a,b,d,e){var g=this.that;g.x=a;g.y=b;g.z=d;g.w=e;this.isDirty=!0;return this};THREE.Quaternion.prototype.setFromEuler=function(a){var b=0.5*Math.PI/360,d=a.x*b,e=a.y*b,g=a.z*b;a=Math.cos(e);e=Math.sin(e);b=Math.cos(-g);g=Math.sin(-g);var i=Math.cos(d);d=Math.sin(d);var l=a*b,n=e*g,k=this.that;k.w=l*i-n*d;k.x=l*d+n*i;k.y=e*b*i+a*g*d;k.z=a*g*i-e*b*d;this.isDirty=!0;return this};
+THREE.Quaternion.prototype.calculateW=function(){var a=this.that,b=a.x,d=a.y,e=a.z;a.w=-Math.sqrt(Math.abs(1-b*b-d*d-e*e));this.isDirty=!0;return this};THREE.Quaternion.prototype.inverse=function(){var a=this.that;a.x*=-1;a.y*=-1;a.z*=-1;this.isDirty=!0;return this};THREE.Quaternion.prototype.length=function(){var a=this.that;return Math.sqrt(a.x*a.x+a.y*a.y+a.z*a.z+a.w*a.w)};
+THREE.Quaternion.prototype.normalize=function(){var a=this.that,b=a.x,d=a.y,e=a.z,g=a.w,i=Math.sqrt(b*b+d*d+e*e+g*g);if(i==0){a.x=0;a.y=0;a.z=0;a.w=0;this.isDirty=!0;return this}i=1/i;a.x=b*i;a.y=d*i;a.z=e*i;a.w=g*i;this.isDirty=!0;return this};
 THREE.Quaternion.prototype.multiplySelf=function(a){var b=this.that;qax=b.x;qay=b.y;qaz=b.z;qaw=b.w;qbx=a.x;qby=a.y;qbz=a.z;qbw=a.w;b.x=qax*qbw+qaw*qbx+qay*qbz-qaz*qby;b.y=qay*qbw+qaw*qby+qaz*qbx-qax*qbz;b.z=qaz*qbw+qaw*qbz+qax*qby-qay*qbx;b.w=qaw*qbw-qax*qbx-qay*qby-qaz*qbz;this.isDirty=!0;return this};
 THREE.Quaternion.prototype.multiplySelf=function(a){var b=this.that;qax=b.x;qay=b.y;qaz=b.z;qaw=b.w;qbx=a.x;qby=a.y;qbz=a.z;qbw=a.w;b.x=qax*qbw+qaw*qbx+qay*qbz-qaz*qby;b.y=qay*qbw+qaw*qby+qaz*qbx-qax*qbz;b.z=qaz*qbw+qaw*qbz+qax*qby-qay*qbx;b.w=qaw*qbw-qax*qbx-qay*qby-qaz*qbz;this.isDirty=!0;return this};
-THREE.Quaternion.prototype.multiplyVector3=function(a,b){b||(b=a);var c=this.that,e=a.x,g=a.y,i=a.z,l=c.x,n=c.y,k=c.z;c=c.w;var o=c*e+n*i-k*g,s=c*g+k*e-l*i,w=c*i+l*g-n*e;e=-l*e-n*g-k*i;b.x=o*c+e*-l+s*-k-w*-n;b.y=s*c+e*-n+w*-l-o*-k;b.z=w*c+e*-k+o*-n-s*-l;return b};THREE.Quaternion.prototype.toMatrix3=function(){};THREE.Quaternion.prototype.toMatrix4=function(){};
-THREE.Quaternion.slerp=function(a,b,c,e){var g=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(g)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var i=Math.acos(g),l=Math.sqrt(1-g*g);if(Math.abs(l)<0.0010){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}g=Math.sin((1-e)*i)/l;e=Math.sin(e*i)/l;c.w=a.w*g+b.w*e;c.x=a.x*g+b.x*e;c.y=a.y*g+b.y*e;c.z=a.z*g+b.z*e;return c};
+THREE.Quaternion.prototype.multiplyVector3=function(a,b){b||(b=a);var d=this.that,e=a.x,g=a.y,i=a.z,l=d.x,n=d.y,k=d.z;d=d.w;var o=d*e+n*i-k*g,s=d*g+k*e-l*i,w=d*i+l*g-n*e;e=-l*e-n*g-k*i;b.x=o*d+e*-l+s*-k-w*-n;b.y=s*d+e*-n+w*-l-o*-k;b.z=w*d+e*-k+o*-n-s*-l;return b};THREE.Quaternion.prototype.toMatrix3=function(){};THREE.Quaternion.prototype.toMatrix4=function(){};
+THREE.Quaternion.slerp=function(a,b,d,e){var g=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(g)>=1){d.w=a.w;d.x=a.x;d.y=a.y;d.z=a.z;return d}var i=Math.acos(g),l=Math.sqrt(1-g*g);if(Math.abs(l)<0.0010){d.w=0.5*(a.w+b.w);d.x=0.5*(a.x+b.x);d.y=0.5*(a.y+b.y);d.z=0.5*(a.z+b.z);return d}g=Math.sin((1-e)*i)/l;e=Math.sin(e*i)/l;d.w=a.w*g+b.w*e;d.x=a.x*g+b.x*e;d.y=a.y*g+b.y*e;d.z=a.z*g+b.z*e;return d};
 THREE.Vertex=function(a,b){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=b||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=!0};THREE.Vertex.prototype={toString:function(){return"THREE.Vertex ( position: "+this.position+", normal: "+this.normal+" )"}};
 THREE.Vertex=function(a,b){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=b||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=!0};THREE.Vertex.prototype={toString:function(){return"THREE.Vertex ( position: "+this.position+", normal: "+this.normal+" )"}};
-THREE.Face3=function(a,b,c,e,g){this.a=a;this.b=b;this.c=c;this.centroid=new THREE.Vector3;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.materials=g instanceof Array?g:[g]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}};
-THREE.Face4=function(a,b,c,e,g,i){this.a=a;this.b=b;this.c=c;this.d=e;this.centroid=new THREE.Vector3;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.materials=i instanceof Array?i:[i]};THREE.Face4.prototype={toString:function(){return"THREE.Face4 ( "+this.a+", "+this.b+", "+this.c+" "+this.d+" )"}};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};
+THREE.Face3=function(a,b,d,e,g){this.a=a;this.b=b;this.c=d;this.centroid=new THREE.Vector3;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.materials=g instanceof Array?g:[g]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}};
+THREE.Face4=function(a,b,d,e,g,i){this.a=a;this.b=b;this.c=d;this.d=e;this.centroid=new THREE.Vector3;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.materials=i instanceof Array?i:[i]};THREE.Face4.prototype={toString:function(){return"THREE.Face4 ( "+this.a+", "+this.b+", "+this.c+" "+this.d+" )"}};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};
 THREE.UV.prototype={copy:function(a){this.u=a.u;this.v=a.v},toString:function(){return"THREE.UV ("+this.u+", "+this.v+")"}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.faces=[];this.uvs=[];this.uvs2=[];this.colors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.geometryChunks={};this.hasTangents=!1};
 THREE.UV.prototype={copy:function(a){this.u=a.u;this.v=a.v},toString:function(){return"THREE.UV ("+this.u+", "+this.v+")"}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.faces=[];this.uvs=[];this.uvs2=[];this.colors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.geometryChunks={};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);
-c.centroid.addSelf(this.vertices[c.d].position);c.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var b,c,e,g,i,l,n=new THREE.Vector3,k=new THREE.Vector3;e=0;for(g=this.vertices.length;e<g;e++){i=this.vertices[e];i.normal.set(0,0,0)}e=0;for(g=this.faces.length;e<g;e++){i=this.faces[e];if(a&&i.vertexNormals.length){n.set(0,0,0);b=0;for(c=i.normal.length;b<c;b++)n.addSelf(i.vertexNormals[b]);n.divideScalar(3)}else{b=this.vertices[i.a];c=this.vertices[i.b];l=this.vertices[i.c];n.sub(l.position,
-c.position);k.sub(b.position,c.position);n.crossSelf(k)}n.isZero()||n.normalize();i.normal.copy(n)}},computeVertexNormals:function(){var a,b,c,e;if(this.__tmpVertices==undefined){e=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)e[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{e=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)e[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){e[c.a].addSelf(c.normal);e[c.b].addSelf(c.normal);e[c.c].addSelf(c.normal)}else if(c instanceof THREE.Face4){e[c.a].addSelf(c.normal);e[c.b].addSelf(c.normal);e[c.c].addSelf(c.normal);e[c.d].addSelf(c.normal)}}a=0;for(b=this.vertices.length;a<b;a++)e[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(e[c.a]);c.vertexNormals[1].copy(e[c.b]);c.vertexNormals[2].copy(e[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(e[c.a]);c.vertexNormals[1].copy(e[c.b]);c.vertexNormals[2].copy(e[c.c]);c.vertexNormals[3].copy(e[c.d])}}},computeTangents:function(){function a(B,I,ka,P,ja,ca,Q){i=B.vertices[I].position;l=B.vertices[ka].position;n=B.vertices[P].position;k=g[ja];o=g[ca];s=g[Q];w=l.x-i.x;t=n.x-i.x;x=l.y-i.y;F=n.y-
-i.y;H=l.z-i.z;G=n.z-i.z;r=o.u-k.u;Z=s.u-k.u;D=o.v-k.v;K=s.v-k.v;d=1/(r*K-Z*D);N.set((K*w-D*t)*d,(K*x-D*F)*d,(K*H-D*G)*d);ba.set((r*t-Z*w)*d,(r*F-Z*x)*d,(r*G-Z*H)*d);ga[I].addSelf(N);ga[ka].addSelf(N);ga[P].addSelf(N);T[I].addSelf(ba);T[ka].addSelf(ba);T[P].addSelf(ba)}var b,c,e,g,i,l,n,k,o,s,w,t,x,F,H,G,r,Z,D,K,d,ga=[],T=[],N=new THREE.Vector3,ba=new THREE.Vector3,R=new THREE.Vector3,aa=new THREE.Vector3,V=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++){ga[b]=new THREE.Vector3;T[b]=new THREE.Vector3}b=
-0;for(c=this.faces.length;b<c;b++){e=this.faces[b];g=this.uvs[b];if(e instanceof THREE.Face3){a(this,e.a,e.b,e.c,0,1,2);this.vertices[e.a].normal.copy(e.vertexNormals[0]);this.vertices[e.b].normal.copy(e.vertexNormals[1]);this.vertices[e.c].normal.copy(e.vertexNormals[2])}else if(e instanceof THREE.Face4){a(this,e.a,e.b,e.c,0,1,2);a(this,e.a,e.b,e.d,0,1,3);this.vertices[e.a].normal.copy(e.vertexNormals[0]);this.vertices[e.b].normal.copy(e.vertexNormals[1]);this.vertices[e.c].normal.copy(e.vertexNormals[2]);
-this.vertices[e.d].normal.copy(e.vertexNormals[3])}}b=0;for(c=this.vertices.length;b<c;b++){V.copy(this.vertices[b].normal);e=ga[b];R.copy(e);R.subSelf(V.multiplyScalar(V.dot(e))).normalize();aa.cross(this.vertices[b].normal,e);e=aa.dot(T[b]);e=e<0?-1:1;this.vertices[b].tangent.set(R.x,R.y,R.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;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}},sortFacesByMaterial:function(){function a(s){var w=[];b=0;for(c=s.length;b<c;b++)s[b]==undefined?w.push("undefined"):w.push(s[b].id);return w.join("_")}var b,c,e,g,i,l,n,k,o={};e=0;for(g=this.faces.length;e<g;e++){i=this.faces[e];
+THREE.Geometry.prototype={computeCentroids:function(){var a,b,d;a=0;for(b=this.faces.length;a<b;a++){d=this.faces[a];d.centroid.set(0,0,0);if(d instanceof THREE.Face3){d.centroid.addSelf(this.vertices[d.a].position);d.centroid.addSelf(this.vertices[d.b].position);d.centroid.addSelf(this.vertices[d.c].position);d.centroid.divideScalar(3)}else if(d instanceof THREE.Face4){d.centroid.addSelf(this.vertices[d.a].position);d.centroid.addSelf(this.vertices[d.b].position);d.centroid.addSelf(this.vertices[d.c].position);
+d.centroid.addSelf(this.vertices[d.d].position);d.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var b,d,e,g,i,l,n=new THREE.Vector3,k=new THREE.Vector3;e=0;for(g=this.vertices.length;e<g;e++){i=this.vertices[e];i.normal.set(0,0,0)}e=0;for(g=this.faces.length;e<g;e++){i=this.faces[e];if(a&&i.vertexNormals.length){n.set(0,0,0);b=0;for(d=i.normal.length;b<d;b++)n.addSelf(i.vertexNormals[b]);n.divideScalar(3)}else{b=this.vertices[i.a];d=this.vertices[i.b];l=this.vertices[i.c];n.sub(l.position,
+d.position);k.sub(b.position,d.position);n.crossSelf(k)}n.isZero()||n.normalize();i.normal.copy(n)}},computeVertexNormals:function(){var a,b,d,e;if(this.__tmpVertices==undefined){e=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)e[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++){d=this.faces[a];if(d instanceof THREE.Face3)d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(d instanceof THREE.Face4)d.vertexNormals=[new THREE.Vector3,
+new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{e=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)e[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++){d=this.faces[a];if(d instanceof THREE.Face3){e[d.a].addSelf(d.normal);e[d.b].addSelf(d.normal);e[d.c].addSelf(d.normal)}else if(d instanceof THREE.Face4){e[d.a].addSelf(d.normal);e[d.b].addSelf(d.normal);e[d.c].addSelf(d.normal);e[d.d].addSelf(d.normal)}}a=0;for(b=this.vertices.length;a<b;a++)e[a].normalize();a=0;for(b=this.faces.length;a<
+b;a++){d=this.faces[a];if(d instanceof THREE.Face3){d.vertexNormals[0].copy(e[d.a]);d.vertexNormals[1].copy(e[d.b]);d.vertexNormals[2].copy(e[d.c])}else if(d instanceof THREE.Face4){d.vertexNormals[0].copy(e[d.a]);d.vertexNormals[1].copy(e[d.b]);d.vertexNormals[2].copy(e[d.c]);d.vertexNormals[3].copy(e[d.d])}}},computeTangents:function(){function a(D,J,la,Q,ja,ea,R){i=D.vertices[J].position;l=D.vertices[la].position;n=D.vertices[Q].position;k=g[ja];o=g[ea];s=g[R];w=l.x-i.x;u=n.x-i.x;x=l.y-i.y;F=n.y-
+i.y;I=l.z-i.z;H=n.z-i.z;r=o.u-k.u;Z=s.u-k.u;E=o.v-k.v;L=s.v-k.v;c=1/(r*L-Z*E);O.set((L*w-E*u)*c,(L*x-E*F)*c,(L*I-E*H)*c);ca.set((r*u-Z*w)*c,(r*F-Z*x)*c,(r*H-Z*I)*c);ia[J].addSelf(O);ia[la].addSelf(O);ia[Q].addSelf(O);T[J].addSelf(ca);T[la].addSelf(ca);T[Q].addSelf(ca)}var b,d,e,g,i,l,n,k,o,s,w,u,x,F,I,H,r,Z,E,L,c,ia=[],T=[],O=new THREE.Vector3,ca=new THREE.Vector3,S=new THREE.Vector3,ba=new THREE.Vector3,V=new THREE.Vector3;b=0;for(d=this.vertices.length;b<d;b++){ia[b]=new THREE.Vector3;T[b]=new THREE.Vector3}b=
+0;for(d=this.faces.length;b<d;b++){e=this.faces[b];g=this.uvs[b];if(e instanceof THREE.Face3){a(this,e.a,e.b,e.c,0,1,2);this.vertices[e.a].normal.copy(e.vertexNormals[0]);this.vertices[e.b].normal.copy(e.vertexNormals[1]);this.vertices[e.c].normal.copy(e.vertexNormals[2])}else if(e instanceof THREE.Face4){a(this,e.a,e.b,e.c,0,1,2);a(this,e.a,e.b,e.d,0,1,3);this.vertices[e.a].normal.copy(e.vertexNormals[0]);this.vertices[e.b].normal.copy(e.vertexNormals[1]);this.vertices[e.c].normal.copy(e.vertexNormals[2]);
+this.vertices[e.d].normal.copy(e.vertexNormals[3])}}b=0;for(d=this.vertices.length;b<d;b++){V.copy(this.vertices[b].normal);e=ia[b];S.copy(e);S.subSelf(V.multiplyScalar(V.dot(e))).normalize();ba.cross(this.vertices[b].normal,e);e=ba.dot(T[b]);e=e<0?-1:1;this.vertices[b].tangent.set(S.x,S.y,S.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,d=this.vertices.length;b<d;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,d=this.vertices.length;b<d;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}},sortFacesByMaterial:function(){function a(s){var w=[];b=0;for(d=s.length;b<d;b++)s[b]==undefined?w.push("undefined"):w.push(s[b].id);return w.join("_")}var b,d,e,g,i,l,n,k,o={};e=0;for(g=this.faces.length;e<g;e++){i=this.faces[e];
 l=i.materials;n=a(l);o[n]==undefined&&(o[n]={hash:n,counter:0});k=o[n].hash+"_"+o[n].counter;this.geometryChunks[k]==undefined&&(this.geometryChunks[k]={faces:[],materials:l,vertices:0});i=i instanceof THREE.Face3?3:4;if(this.geometryChunks[k].vertices+i>65535){o[n].counter+=1;k=o[n].hash+"_"+o[n].counter;this.geometryChunks[k]==undefined&&(this.geometryChunks[k]={faces:[],materials:l,vertices:0})}this.geometryChunks[k].faces.push(e);this.geometryChunks[k].vertices+=i}},toString:function(){return"THREE.Geometry ( vertices: "+
 l=i.materials;n=a(l);o[n]==undefined&&(o[n]={hash:n,counter:0});k=o[n].hash+"_"+o[n].counter;this.geometryChunks[k]==undefined&&(this.geometryChunks[k]={faces:[],materials:l,vertices:0});i=i instanceof THREE.Face3?3:4;if(this.geometryChunks[k].vertices+i>65535){o[n].counter+=1;k=o[n].hash+"_"+o[n].counter;this.geometryChunks[k]==undefined&&(this.geometryChunks[k]={faces:[],materials:l,vertices:0})}this.geometryChunks[k].faces.push(e);this.geometryChunks[k].vertices+=i}},toString:function(){return"THREE.Geometry ( vertices: "+
 this.vertices+", faces: "+this.faces+", uvs: "+this.uvs+" )"}};THREE.GeometryIdCounter=0;
 this.vertices+", faces: "+this.faces+", uvs: "+this.uvs+" )"}};THREE.GeometryIdCounter=0;
 THREE.Object3D=function(){this.id=THREE.Object3DCounter.value++;this.visible=!0;this.autoUpdateMatrix=!0;this.matrixNeedsToUpdate=!0;this.parent=undefined;this.children=[];this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.localMatrix=new THREE.Matrix4;this.globalMatrix=new THREE.Matrix4;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.screenPosition=new THREE.Vector4;this.boundRadius=0;this.boundRadiusScale=1;this.rotationMatrix=
 THREE.Object3D=function(){this.id=THREE.Object3DCounter.value++;this.visible=!0;this.autoUpdateMatrix=!0;this.matrixNeedsToUpdate=!0;this.parent=undefined;this.children=[];this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.localMatrix=new THREE.Matrix4;this.globalMatrix=new THREE.Matrix4;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.screenPosition=new THREE.Vector4;this.boundRadius=0;this.boundRadiusScale=1;this.rotationMatrix=
-new THREE.Matrix4};THREE.Object3D.prototype.update=function(a,b,c){if(this.visible){this.autoUpdateMatrix&&(b|=this.updateMatrix());if(b||this.matrixNeedsToUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsToUpdate=!1;b=!0}var e=this.children.length;for(a=0;a<e;a++)this.children[a].update(this.globalMatrix,b,c)}};
+new THREE.Matrix4};THREE.Object3D.prototype.update=function(a,b,d){if(this.visible){this.autoUpdateMatrix&&(b|=this.updateMatrix());if(b||this.matrixNeedsToUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsToUpdate=!1;b=!0}var e=this.children.length;for(a=0;a<e;a++)this.children[a].update(this.globalMatrix,b,d)}};
 THREE.Object3D.prototype.updateMatrix=function(){this.localMatrix.setPosition(this.position);if(this.useQuaternion){if(this.quaternion.isDirty){this.localMatrix.setRotationFromQuaternion(this.quaternion);this.quaternion.isDirty=!1}}else this.localMatrix.setRotationFromEuler(this.rotation);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1){this.localMatrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}return!0};
 THREE.Object3D.prototype.updateMatrix=function(){this.localMatrix.setPosition(this.position);if(this.useQuaternion){if(this.quaternion.isDirty){this.localMatrix.setRotationFromQuaternion(this.quaternion);this.quaternion.isDirty=!1}}else this.localMatrix.setRotationFromEuler(this.rotation);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1){this.localMatrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}return!0};
 THREE.Object3D.prototype.addChild=function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a)}};THREE.Object3D.prototype.removeChild=function(a){var b=this.children.indexOf(a);if(b!==-1){this.children.splice(b,1);a.parent=undefined}};THREE.Object3DCounter={value:0};THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.autoUpdateMatrix=!1};THREE.Particle.prototype=new THREE.Object3D;
 THREE.Object3D.prototype.addChild=function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a)}};THREE.Object3D.prototype.removeChild=function(a){var b=this.children.indexOf(a);if(b!==-1){this.children.splice(b,1);a.parent=undefined}};THREE.Object3DCounter={value:0};THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.autoUpdateMatrix=!1};THREE.Particle.prototype=new THREE.Object3D;
-THREE.Particle.prototype.constructor=THREE.Particle;THREE.ParticleSystem=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.sortParticles=!1};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;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.Particle.prototype.constructor=THREE.Particle;THREE.ParticleSystem=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.sortParticles=!1};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;THREE.Line=function(a,b,d){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.type=d!=undefined?d:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;
 THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b&&b.length?b:[b];this.flipSided=!1;this.doubleSided=!1;this.overdraw=!1;if(this.geometry){this.geometry.boundingSphere||this.geometry.computeBoundingSphere();this.boundRadius=a.boundingSphere.radius}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;
 THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b&&b.length?b:[b];this.flipSided=!1;this.doubleSided=!1;this.overdraw=!1;if(this.geometry){this.geometry.boundingSphere||this.geometry.computeBoundingSphere();this.boundRadius=a.boundingSphere.radius}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;
-THREE.Mesh.prototype.update=function(a,b,c){if(this.visible){this.autoUpdateMatrix&&(b|=this.updateMatrix());if(b||this.matrixNeedsToUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsToUpdate=!1;b=!0}for(a=0;a<this.children.length;a++)this.children[a].update(this.globalMatrix,b,c)}};THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;
+THREE.Mesh.prototype.update=function(a,b,d){if(this.visible){this.autoUpdateMatrix&&(b|=this.updateMatrix());if(b||this.matrixNeedsToUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsToUpdate=!1;b=!0}for(a=0;a<this.children.length;a++)this.children[a].update(this.globalMatrix,b,d)}};THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;
 THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
 THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
-THREE.Bone.prototype.update=function(a,b,c){this.autoUpdateMatrix&&(b|=this.updateMatrix());if(b||this.matrixNeedsToUpdate){a?this.skinMatrix.multiply(a,this.localMatrix):this.skinMatrix.copy(this.localMatrix);this.matrixNeedsToUpdate=!1;b=!0}var e,g=this.children.length;if(this.hasNoneBoneChildren){this.globalMatrix.multiply(this.skin.globalMatrix,this.skinMatrix);for(e=0;e<g;e++){a=this.children[e];a instanceof THREE.Bone?a.update(this.skinMatrix,b,c):a.update(this.globalMatrix,!0,c)}}else for(e=
-0;e<g;e++)this.children[e].update(this.skinMatrix,b,c)};THREE.Bone.prototype.addChild=function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);if(!(a instanceof THREE.Bone))this.hasNoneBoneChildren=!0}};if(!window.Float32Array)window.Float32Array=Array;
-THREE.SkinnedMesh=function(a,b){THREE.Mesh.call(this,a,b);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var c,e,g,i,l,n;if(this.geometry.bones!==undefined){for(c=0;c<this.geometry.bones.length;c++){g=this.geometry.bones[c];i=g.pos;l=g.rotq;n=g.scl;e=this.addBone();e.name=g.name;e.position.set(i[0],i[1],i[2]);e.quaternion.set(l[0],l[1],l[2],l[3]);n!==undefined?e.scale.set(n[0],n[1],n[2]):e.scale.set(1,1,1)}for(c=0;c<this.bones.length;c++){g=this.geometry.bones[c];e=this.bones[c];
+THREE.Bone.prototype.update=function(a,b,d){this.autoUpdateMatrix&&(b|=this.updateMatrix());if(b||this.matrixNeedsToUpdate){a?this.skinMatrix.multiply(a,this.localMatrix):this.skinMatrix.copy(this.localMatrix);this.matrixNeedsToUpdate=!1;b=!0}var e,g=this.children.length;if(this.hasNoneBoneChildren){this.globalMatrix.multiply(this.skin.globalMatrix,this.skinMatrix);for(e=0;e<g;e++){a=this.children[e];a instanceof THREE.Bone?a.update(this.skinMatrix,b,d):a.update(this.globalMatrix,!0,d)}}else for(e=
+0;e<g;e++)this.children[e].update(this.skinMatrix,b,d)};THREE.Bone.prototype.addChild=function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);if(!(a instanceof THREE.Bone))this.hasNoneBoneChildren=!0}};if(!window.Float32Array)window.Float32Array=Array;
+THREE.SkinnedMesh=function(a,b){THREE.Mesh.call(this,a,b);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var d,e,g,i,l,n;if(this.geometry.bones!==undefined){for(d=0;d<this.geometry.bones.length;d++){g=this.geometry.bones[d];i=g.pos;l=g.rotq;n=g.scl;e=this.addBone();e.name=g.name;e.position.set(i[0],i[1],i[2]);e.quaternion.set(l[0],l[1],l[2],l[3]);n!==undefined?e.scale.set(n[0],n[1],n[2]):e.scale.set(1,1,1)}for(d=0;d<this.bones.length;d++){g=this.geometry.bones[d];e=this.bones[d];
 g.parent===-1?this.addChild(e):this.bones[g.parent].addChild(e)}this.boneMatrices=new Float32Array(16*this.bones.length);this.pose()}};THREE.SkinnedMesh.prototype=new THREE.Mesh;THREE.SkinnedMesh.prototype.constructor=THREE.SkinnedMesh;
 g.parent===-1?this.addChild(e):this.bones[g.parent].addChild(e)}this.boneMatrices=new Float32Array(16*this.bones.length);this.pose()}};THREE.SkinnedMesh.prototype=new THREE.Mesh;THREE.SkinnedMesh.prototype.constructor=THREE.SkinnedMesh;
-THREE.SkinnedMesh.prototype.update=function(a,b,c){if(this.visible){this.autoUpdateMatrix&&(b|=this.updateMatrix());if(b||this.matrixNeedsToUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsToUpdate=!1;b=!0}var e,g=this.children.length;for(e=0;e<g;e++){a=this.children[e];a instanceof THREE.Bone?a.update(this.identityMatrix,!1,c):a.update(this.globalMatrix,b,c)}}};
+THREE.SkinnedMesh.prototype.update=function(a,b,d){if(this.visible){this.autoUpdateMatrix&&(b|=this.updateMatrix());if(b||this.matrixNeedsToUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsToUpdate=!1;b=!0}var e,g=this.children.length;for(e=0;e<g;e++){a=this.children[e];a instanceof THREE.Bone?a.update(this.identityMatrix,!1,d):a.update(this.globalMatrix,b,d)}}};
 THREE.SkinnedMesh.prototype.addBone=function(a){a===undefined&&(a=new THREE.Bone(this));this.bones.push(a);return a};
 THREE.SkinnedMesh.prototype.addBone=function(a){a===undefined&&(a=new THREE.Bone(this));this.bones.push(a);return a};
-THREE.SkinnedMesh.prototype.pose=function(){this.update(undefined,!0);for(var a,b=[],c=0;c<this.bones.length;c++){a=this.bones[c];b.push(THREE.Matrix4.makeInvert(a.skinMatrix));a.skinMatrix.flattenToArrayOffset(this.boneMatrices,c*16)}if(this.geometry.skinVerticesA===undefined){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];var e;for(a=0;a<this.geometry.skinIndices.length;a++){c=this.geometry.vertices[a].position;var g=this.geometry.skinIndices[a].x,i=this.geometry.skinIndices[a].y;
-e=new THREE.Vector3(c.x,c.y,c.z);this.geometry.skinVerticesA.push(b[g].multiplyVector3(e));e=new THREE.Vector3(c.x,c.y,c.z);this.geometry.skinVerticesB.push(b[i].multiplyVector3(e));if(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y!==1){c=(1-(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y))*0.5;this.geometry.skinWeights[a].x+=c;this.geometry.skinWeights[a].y+=c}}}};
-THREE.AnimationHandler=function(){var a=[],b={};b.update=function(c){for(var e=0;e<a.length;e++)a[e].update(c)};b.add=function(c){a.indexOf(c)===-1&&a.push(c)};b.remove=function(c){a.indexOf(c)!==-1&&a.splice(childIndex,1)};b.initData=function(c){if(c.initialized!==!0){for(var e=0;e<c.hierarchy.length;e++)for(var g=0;g<c.hierarchy[e].keys.length;g++){if(c.hierarchy[e].keys[g].time<0)c.hierarchy[e].keys[g].time=0;c.hierarchy[e].keys[g].index=g;if(c.hierarchy[e].keys[g].rot!==undefined&&!(c.hierarchy[e].keys[g].rot instanceof
-THREE.Quaternion)){var i=c.hierarchy[e].keys[g].rot;c.hierarchy[e].keys[g].rot=new THREE.Quaternion(i[0],i[1],i[2],i[3])}}g=parseInt(c.length*c.fps,10);c.JIT={};c.JIT.hierarchy=[];for(e=0;e<c.hierarchy.length;e++)c.JIT.hierarchy.push(Array(g));c.initialized=!0}};return b}();
-THREE.Animation=function(a,b){this.root=a;this.data=b;this.hierarchy=[];this.startTime=0;this.isPlaying=!1;this.loop=!0;this.offset=0;this.data.initialized||THREE.AnimationHandler.initData(this.data);if(a instanceof THREE.SkinnedMesh)for(var c=0;c<this.root.bones.length;c++)this.hierarchy.push(this.root.bones[c])};
+THREE.SkinnedMesh.prototype.pose=function(){this.update(undefined,!0);for(var a,b=[],d=0;d<this.bones.length;d++){a=this.bones[d];b.push(THREE.Matrix4.makeInvert(a.skinMatrix));a.skinMatrix.flattenToArrayOffset(this.boneMatrices,d*16)}if(this.geometry.skinVerticesA===undefined){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];var e;for(a=0;a<this.geometry.skinIndices.length;a++){d=this.geometry.vertices[a].position;var g=this.geometry.skinIndices[a].x,i=this.geometry.skinIndices[a].y;
+e=new THREE.Vector3(d.x,d.y,d.z);this.geometry.skinVerticesA.push(b[g].multiplyVector3(e));e=new THREE.Vector3(d.x,d.y,d.z);this.geometry.skinVerticesB.push(b[i].multiplyVector3(e));if(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y!==1){d=(1-(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y))*0.5;this.geometry.skinWeights[a].x+=d;this.geometry.skinWeights[a].y+=d}}}};
+THREE.Ribbon=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.flipSided=!1;this.doubleSided=!1};THREE.Ribbon.prototype=new THREE.Object3D;THREE.Ribbon.prototype.constructor=THREE.Ribbon;
+THREE.AnimationHandler=function(){var a=[],b={};b.update=function(d){for(var e=0;e<a.length;e++)a[e].update(d)};b.add=function(d){a.indexOf(d)===-1&&a.push(d)};b.remove=function(d){a.indexOf(d)!==-1&&a.splice(childIndex,1)};b.initData=function(d){if(d.initialized!==!0){for(var e=0;e<d.hierarchy.length;e++)for(var g=0;g<d.hierarchy[e].keys.length;g++){if(d.hierarchy[e].keys[g].time<0)d.hierarchy[e].keys[g].time=0;d.hierarchy[e].keys[g].index=g;if(d.hierarchy[e].keys[g].rot!==undefined&&!(d.hierarchy[e].keys[g].rot instanceof
+THREE.Quaternion)){var i=d.hierarchy[e].keys[g].rot;d.hierarchy[e].keys[g].rot=new THREE.Quaternion(i[0],i[1],i[2],i[3])}}g=parseInt(d.length*d.fps,10);d.JIT={};d.JIT.hierarchy=[];for(e=0;e<d.hierarchy.length;e++)d.JIT.hierarchy.push(Array(g));d.initialized=!0}};return b}();
+THREE.Animation=function(a,b){this.root=a;this.data=b;this.hierarchy=[];this.startTime=0;this.isPlaying=!1;this.loop=!0;this.offset=0;this.data.initialized||THREE.AnimationHandler.initData(this.data);if(a instanceof THREE.SkinnedMesh)for(var d=0;d<this.root.bones.length;d++)this.hierarchy.push(this.root.bones[d])};
 THREE.Animation.prototype.play=function(){if(!this.isPlaying){this.isPlaying=!0;this.startTime=(new Date).getTime()*0.0010;for(var a=0;a<this.hierarchy.length;a++){this.hierarchy[a].useQuaternion=!0;this.hierarchy[a].autoUpdateMatrix=!0;if(this.hierarchy[a].prevKey===undefined){this.hierarchy[a].prevKey={pos:0,rot:0,scl:0};this.hierarchy[a].nextKey={pos:0,rot:0,scl:0}}this.hierarchy[a].prevKey.pos=this.data.hierarchy[a].keys[0];this.hierarchy[a].prevKey.rot=this.data.hierarchy[a].keys[0];this.hierarchy[a].prevKey.scl=
 THREE.Animation.prototype.play=function(){if(!this.isPlaying){this.isPlaying=!0;this.startTime=(new Date).getTime()*0.0010;for(var a=0;a<this.hierarchy.length;a++){this.hierarchy[a].useQuaternion=!0;this.hierarchy[a].autoUpdateMatrix=!0;if(this.hierarchy[a].prevKey===undefined){this.hierarchy[a].prevKey={pos:0,rot:0,scl:0};this.hierarchy[a].nextKey={pos:0,rot:0,scl:0}}this.hierarchy[a].prevKey.pos=this.data.hierarchy[a].keys[0];this.hierarchy[a].prevKey.rot=this.data.hierarchy[a].keys[0];this.hierarchy[a].prevKey.scl=
 this.data.hierarchy[a].keys[0];this.hierarchy[a].nextKey.pos=this.getNextKeyWith("pos",a,1);this.hierarchy[a].nextKey.rot=this.getNextKeyWith("rot",a,1);this.hierarchy[a].nextKey.scl=this.getNextKeyWith("scl",a,1)}this.update();THREE.AnimationHandler.add(this)}};THREE.Animation.prototype.pause=function(){THREE.AnimationHandler.remove(this)};THREE.Animation.prototype.stop=function(){this.isPlaying=!1;THREE.AnimationHandler.remove(this)};
 this.data.hierarchy[a].keys[0];this.hierarchy[a].nextKey.pos=this.getNextKeyWith("pos",a,1);this.hierarchy[a].nextKey.rot=this.getNextKeyWith("rot",a,1);this.hierarchy[a].nextKey.scl=this.getNextKeyWith("scl",a,1)}this.update();THREE.AnimationHandler.add(this)}};THREE.Animation.prototype.pause=function(){THREE.AnimationHandler.remove(this)};THREE.Animation.prototype.stop=function(){this.isPlaying=!1;THREE.AnimationHandler.remove(this)};
-THREE.Animation.prototype.update=function(){if(this.isPlaying){var a=["pos","rot","scl"],b,c,e,g,i,l,n=this.data.JIT.hierarchy,k=(new Date).getTime()*0.0010-this.startTime+this.offset,o=k;if(k>this.data.length){for(;k>this.data.length;)k-=this.data.length;this.startTime=(new Date).getTime()*0.0010-k;k=(new Date).getTime()*0.0010-this.startTime}l=Math.min(parseInt(k*this.data.fps),parseInt(this.data.length*this.data.fps));for(var s=0,w=this.hierarchy.length;s<w;s++){i=this.hierarchy[s];if(n[s][l]!==
-undefined){i.skinMatrix=n[s][l];i.autoUpdateMatrix=!1;i.matrixNeedsToUpdate=!1;i.skinMatrix.flattenToArrayOffset(this.root.boneMatrices,s*16)}else for(var t=0;t<3;t++){c=a[t];e=i.prevKey[c];g=i.nextKey[c];if(g.time<o){if(k<o)if(this.loop){e=this.data.hierarchy[s].keys[0];g=this.getNextKeyWith(c,s,1)}else{this.stop();return}else{do{e=g;g=this.getNextKeyWith(c,s,g.index+1)}while(g.time<k)}i.prevKey[c]=e;i.nextKey[c]=g}i.autoUpdateMatrix=!0;i.matrixNeedsToUpdate=!0;b=(k-e.time)/(g.time-e.time);e=e[c];
-g=g[c];if(c==="rot"){if(b<0||b>1){console.log("Scale out of bounds:"+b);b=b<0?0:1}THREE.Quaternion.slerp(e,g,i.quaternion,b)}else{c=c==="pos"?i.position:i.scale;c.x=e[0]+(g[0]-e[0])*b;c.y=e[1]+(g[1]-e[1])*b;c.z=e[2]+(g[2]-e[2])*b}}}if(n[0][l]===undefined){this.hierarchy[0].update(undefined,!0);for(s=0;s<this.hierarchy.length;s++)n[s][l]=this.hierarchy[s].skinMatrix.clone()}}};THREE.Animation.prototype.updateObject=function(){};
-THREE.Animation.prototype.getNextKeyWith=function(a,b,c){for(var e=this.data.hierarchy[b].keys;c<e.length;c++)if(e[c][a]!==undefined)return e[c];return this.data.hierarchy[b].keys[0]};
-THREE.Camera=function(a,b,c,e,g,i){THREE.Object3D.call(this);this.FOV=a||50;this.aspect=b||1;this.zNear=c||0.1;this.zFar=e||2E3;this.screenCenterY=this.screenCenterX=0;this.target=i||new THREE.Object3D;this.useTarget=!0;this.up=new THREE.Vector3(0,1,0);this.inverseMatrix=new THREE.Matrix4;this.projectionMatrix=null;this.tmpVec=new THREE.Vector3;this.translateX=function(l){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(l);this.tmpVec.crossSelf(this.up);this.position.addSelf(this.tmpVec);
+THREE.Animation.prototype.update=function(){if(this.isPlaying){var a=["pos","rot","scl"],b,d,e,g,i,l,n=this.data.JIT.hierarchy,k=(new Date).getTime()*0.0010-this.startTime+this.offset,o=k;if(k>this.data.length){for(;k>this.data.length;)k-=this.data.length;this.startTime=(new Date).getTime()*0.0010-k;k=(new Date).getTime()*0.0010-this.startTime}l=Math.min(parseInt(k*this.data.fps),parseInt(this.data.length*this.data.fps));for(var s=0,w=this.hierarchy.length;s<w;s++){i=this.hierarchy[s];if(n[s][l]!==
+undefined){i.skinMatrix=n[s][l];i.autoUpdateMatrix=!1;i.matrixNeedsToUpdate=!1;i.skinMatrix.flattenToArrayOffset(this.root.boneMatrices,s*16)}else for(var u=0;u<3;u++){d=a[u];e=i.prevKey[d];g=i.nextKey[d];if(g.time<o){if(k<o)if(this.loop){e=this.data.hierarchy[s].keys[0];g=this.getNextKeyWith(d,s,1)}else{this.stop();return}else{do{e=g;g=this.getNextKeyWith(d,s,g.index+1)}while(g.time<k)}i.prevKey[d]=e;i.nextKey[d]=g}i.autoUpdateMatrix=!0;i.matrixNeedsToUpdate=!0;b=(k-e.time)/(g.time-e.time);e=e[d];
+g=g[d];if(d==="rot"){if(b<0||b>1){console.log("Scale out of bounds:"+b);b=b<0?0:1}THREE.Quaternion.slerp(e,g,i.quaternion,b)}else{d=d==="pos"?i.position:i.scale;d.x=e[0]+(g[0]-e[0])*b;d.y=e[1]+(g[1]-e[1])*b;d.z=e[2]+(g[2]-e[2])*b}}}if(n[0][l]===undefined){this.hierarchy[0].update(undefined,!0);for(s=0;s<this.hierarchy.length;s++)n[s][l]=this.hierarchy[s].skinMatrix.clone()}}};THREE.Animation.prototype.updateObject=function(){};
+THREE.Animation.prototype.getNextKeyWith=function(a,b,d){for(var e=this.data.hierarchy[b].keys;d<e.length;d++)if(e[d][a]!==undefined)return e[d];return this.data.hierarchy[b].keys[0]};
+THREE.Camera=function(a,b,d,e,g,i){THREE.Object3D.call(this);this.FOV=a||50;this.aspect=b||1;this.zNear=d||0.1;this.zFar=e||2E3;this.screenCenterY=this.screenCenterX=0;this.target=i||new THREE.Object3D;this.useTarget=!0;this.up=new THREE.Vector3(0,1,0);this.inverseMatrix=new THREE.Matrix4;this.projectionMatrix=null;this.tmpVec=new THREE.Vector3;this.translateX=function(l){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(l);this.tmpVec.crossSelf(this.up);this.position.addSelf(this.tmpVec);
 this.target.position.addSelf(this.tmpVec)};this.translateZ=function(l){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(l);this.position.subSelf(this.tmpVec);this.target.position.subSelf(this.tmpVec)};this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
 this.target.position.addSelf(this.tmpVec)};this.translateZ=function(l){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(l);this.position.subSelf(this.tmpVec);this.target.position.subSelf(this.tmpVec)};this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
 THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.FOV,this.aspect,this.zNear,this.zFar)};
 THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.FOV,this.aspect,this.zNear,this.zFar)};
-THREE.Camera.prototype.update=function(a,b,c){if(this.useTarget){this.localMatrix.lookAt(this.position,this.target.position,this.up);a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);THREE.Matrix4.makeInvert(this.globalMatrix,this.inverseMatrix);b=!0}else{this.autoUpdateMatrix&&(b|=this.updateMatrix());if(b||this.matrixNeedsToUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsToUpdate=!1;b=!0;THREE.Matrix4.makeInvert(this.globalMatrix,
-this.inverseMatrix)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.globalMatrix,b,c)};
-THREE.Camera.prototype.frustumContains=function(a){var b=a.globalMatrix.n14,c=a.globalMatrix.n24,e=a.globalMatrix.n34,g=this.inverseMatrix,i=a.boundRadius*a.boundRadiusScale,l=g.n31*b+g.n32*c+g.n33*e+g.n34;if(l-i>-this.zNear)return!1;if(l+i<-this.zFar)return!1;l-=i;var n=this.projectionMatrix,k=1/(n.n43*l),o=k*this.screenCenterX,s=(g.n11*b+g.n12*c+g.n13*e+g.n14)*n.n11*o;i=n.n11*i*o;if(s+i<-this.screenCenterX)return!1;if(s-i>this.screenCenterX)return!1;b=(g.n21*b+g.n22*c+g.n23*e+g.n24)*n.n22*k*this.screenCenterY;
+THREE.Camera.prototype.update=function(a,b,d){if(this.useTarget){this.localMatrix.lookAt(this.position,this.target.position,this.up);a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);THREE.Matrix4.makeInvert(this.globalMatrix,this.inverseMatrix);b=!0}else{this.autoUpdateMatrix&&(b|=this.updateMatrix());if(b||this.matrixNeedsToUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsToUpdate=!1;b=!0;THREE.Matrix4.makeInvert(this.globalMatrix,
+this.inverseMatrix)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.globalMatrix,b,d)};
+THREE.Camera.prototype.frustumContains=function(a){var b=a.globalMatrix.n14,d=a.globalMatrix.n24,e=a.globalMatrix.n34,g=this.inverseMatrix,i=a.boundRadius*a.boundRadiusScale,l=g.n31*b+g.n32*d+g.n33*e+g.n34;if(l-i>-this.zNear)return!1;if(l+i<-this.zFar)return!1;l-=i;var n=this.projectionMatrix,k=1/(n.n43*l),o=k*this.screenCenterX,s=(g.n11*b+g.n12*d+g.n13*e+g.n14)*n.n11*o;i=n.n11*i*o;if(s+i<-this.screenCenterX)return!1;if(s-i>this.screenCenterX)return!1;b=(g.n21*b+g.n22*d+g.n23*e+g.n24)*n.n22*k*this.screenCenterY;
 if(b+i<-this.screenCenterY)return!1;if(b-i>this.screenCenterY)return!1;a.screenPosition.set(s,b,l,i);return!0};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;
 if(b+i<-this.screenCenterY)return!1;if(b-i>this.screenCenterY)return!1;a.screenPosition.set(s,b,l,i);return!0};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;
 THREE.DirectionalLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=b||1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=b||1};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;THREE.FlatShading=0;THREE.SmoothShading=1;
 THREE.DirectionalLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=b||1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=b||1};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;THREE.FlatShading=0;THREE.SmoothShading=1;
 THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.BillboardBlending=3;THREE.MaterialCounter={value:0};
 THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.BillboardBlending=3;THREE.MaterialCounter={value:0};
@@ -132,124 +133,126 @@ THREE.ParticleBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;th
 undefined)this.depth_test=a.depth_test;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors}};THREE.ParticleBasicMaterial.prototype={toString:function(){return"THREE.ParticleBasicMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>opacity: "+this.opacity+"<br/>map: "+this.map+"<br/>size: "+this.size+"<br/>blending: "+this.blending+"<br/>depth_test: "+this.depth_test+"<br/>vertex_colors: "+this.vertex_colors+"<br/>)"}};
 undefined)this.depth_test=a.depth_test;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors}};THREE.ParticleBasicMaterial.prototype={toString:function(){return"THREE.ParticleBasicMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>opacity: "+this.opacity+"<br/>map: "+this.map+"<br/>size: "+this.size+"<br/>blending: "+this.blending+"<br/>depth_test: "+this.depth_test+"<br/>vertex_colors: "+this.vertex_colors+"<br/>)"}};
 THREE.ParticleCircleMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}};
 THREE.ParticleCircleMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}};
 THREE.ParticleCircleMaterial.prototype={toString:function(){return"THREE.ParticleCircleMaterial (<br/>color: "+this.color+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>)"}};THREE.ParticleDOMMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.domElement=a};THREE.ParticleDOMMaterial.prototype={toString:function(){return"THREE.ParticleDOMMaterial ( domElement: "+this.domElement+" )"}};
 THREE.ParticleCircleMaterial.prototype={toString:function(){return"THREE.ParticleCircleMaterial (<br/>color: "+this.color+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>)"}};THREE.ParticleDOMMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.domElement=a};THREE.ParticleDOMMaterial.prototype={toString:function(){return"THREE.ParticleDOMMaterial ( domElement: "+this.domElement+" )"}};
-THREE.Texture=function(a,b,c,e,g,i){this.image=a;this.mapping=b!==undefined?b:new THREE.UVMapping;this.wrap_s=c!==undefined?c:THREE.ClampToEdgeWrapping;this.wrap_t=e!==undefined?e:THREE.ClampToEdgeWrapping;this.mag_filter=g!==undefined?g:THREE.LinearFilter;this.min_filter=i!==undefined?i:THREE.LinearMipMapLinearFilter};
+THREE.Texture=function(a,b,d,e,g,i){this.image=a;this.mapping=b!==undefined?b:new THREE.UVMapping;this.wrap_s=d!==undefined?d:THREE.ClampToEdgeWrapping;this.wrap_t=e!==undefined?e:THREE.ClampToEdgeWrapping;this.mag_filter=g!==undefined?g:THREE.LinearFilter;this.min_filter=i!==undefined?i:THREE.LinearMipMapLinearFilter};
 THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrap_s,this.wrap_t,this.mag_filter,this.min_filter)},toString:function(){return"THREE.Texture (<br/>image: "+this.image+"<br/>wrap_s: "+this.wrap_s+"<br/>wrap_t: "+this.wrap_t+"<br/>mag_filter: "+this.mag_filter+"<br/>min_filter: "+this.min_filter+"<br/>)"}};THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;
 THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrap_s,this.wrap_t,this.mag_filter,this.min_filter)},toString:function(){return"THREE.Texture (<br/>image: "+this.image+"<br/>wrap_s: "+this.wrap_s+"<br/>wrap_t: "+this.wrap_t+"<br/>mag_filter: "+this.mag_filter+"<br/>min_filter: "+this.min_filter+"<br/>)"}};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.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.RenderTarget=function(a,b,c){this.width=a;this.height=b;c=c||{};this.wrap_s=c.wrap_s!==undefined?c.wrap_s:THREE.ClampToEdgeWrapping;this.wrap_t=c.wrap_t!==undefined?c.wrap_t:THREE.ClampToEdgeWrapping;this.mag_filter=c.mag_filter!==undefined?c.mag_filter:THREE.LinearFilter;this.min_filter=c.min_filter!==undefined?c.min_filter:THREE.LinearMipMapLinearFilter;this.format=c.format!==undefined?c.format:THREE.RGBFormat;this.type=c.type!==undefined?c.type:THREE.UnsignedByteType};
-var Uniforms={clone:function(a){var b,c,e,g={};for(b in a){g[b]={};for(c in a[b]){e=a[b][c];g[b][c]=e instanceof THREE.Color||e instanceof THREE.Vector3||e instanceof THREE.Texture?e.clone():e}}return g},merge:function(a){var b,c,e,g={};for(b=0;b<a.length;b++){e=this.clone(a[b]);for(c in e)g[c]=e[c]}return g}};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};
+THREE.RenderTarget=function(a,b,d){this.width=a;this.height=b;d=d||{};this.wrap_s=d.wrap_s!==undefined?d.wrap_s:THREE.ClampToEdgeWrapping;this.wrap_t=d.wrap_t!==undefined?d.wrap_t:THREE.ClampToEdgeWrapping;this.mag_filter=d.mag_filter!==undefined?d.mag_filter:THREE.LinearFilter;this.min_filter=d.min_filter!==undefined?d.min_filter:THREE.LinearMipMapLinearFilter;this.format=d.format!==undefined?d.format:THREE.RGBFormat;this.type=d.type!==undefined?d.type:THREE.UnsignedByteType};
+var Uniforms={clone:function(a){var b,d,e,g={};for(b in a){g[b]={};for(d in a[b]){e=a[b][d];g[b][d]=e instanceof THREE.Color||e instanceof THREE.Vector3||e instanceof THREE.Texture?e.clone():e}}return g},merge:function(a){var b,d,e,g={};for(b=0;b<a.length;b++){e=this.clone(a[b]);for(d in e)g[d]=e[d]}return g}};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};
 THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};THREE.Scene=function(){THREE.Object3D.call(this);this.objects=[];this.lights=[];this.fog=null};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;THREE.Scene.prototype.addChild=function(a){this.supr.addChild.call(this,a);this.addChildRecurse(a)};
 THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};THREE.Scene=function(){THREE.Object3D.call(this);this.objects=[];this.lights=[];this.fog=null};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;THREE.Scene.prototype.addChild=function(a){this.supr.addChild.call(this,a);this.addChildRecurse(a)};
 THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else a instanceof THREE.Camera||a instanceof THREE.Bone||this.objects.indexOf(a)===-1&&this.objects.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.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else a instanceof THREE.Camera||a instanceof THREE.Bone||this.objects.indexOf(a)===-1&&this.objects.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.Camera)){b=this.objects.indexOf(a);b!==-1&&this.objects.splice(b,1)}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.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.Camera)){b=this.objects.indexOf(a);b!==-1&&this.objects.splice(b,1)}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.Fog=function(a,b,c){this.color=new THREE.Color(a);this.near=b||1;this.far=c||1E3};THREE.FogExp2=function(a,b){this.color=new THREE.Color(a);this.density=b||2.5E-4};
-THREE.Projector=function(){function a(T,N){return N.z-T.z}function b(T,N){var ba=0,R=1,aa=T.z+T.w,V=N.z+N.w,B=-T.z+T.w,I=-N.z+N.w;if(aa>=0&&V>=0&&B>=0&&I>=0)return!0;else if(aa<0&&V<0||B<0&&I<0)return!1;else{if(aa<0)ba=Math.max(ba,aa/(aa-V));else V<0&&(R=Math.min(R,aa/(aa-V)));if(B<0)ba=Math.max(ba,B/(B-I));else I<0&&(R=Math.min(R,B/(B-I)));if(R<ba)return!1;else{T.lerpSelf(N,ba);N.lerpSelf(T,1-R);return!0}}}var c,e,g=[],i,l,n,k=[],o,s,w=[],t,x,F=[],H=new THREE.Vector4,G=new THREE.Vector4,r=new THREE.Matrix4,
-Z=new THREE.Matrix4,D=[],K=new THREE.Vector4,d=new THREE.Vector4,ga;this.projectObjects=function(T,N,ba){N=[];var R,aa,V;e=0;aa=T.objects;T=0;for(R=aa.length;T<R;T++){V=aa[T];var B;if(!(B=!V.visible))if(B=V instanceof THREE.Mesh){a:{B=void 0;for(var I=V.globalMatrix,ka=-V.geometry.boundingSphere.radius*Math.max(V.scale.x,Math.max(V.scale.y,V.scale.z)),P=0;P<6;P++){B=D[P].x*I.n14+D[P].y*I.n24+D[P].z*I.n34+D[P].w;if(B<=ka){B=!1;break a}}B=!0}B=!B}if(!B){c=g[e]=g[e]||new THREE.RenderableObject;H.copy(V.position);
-r.multiplyVector3(H);c.object=V;c.z=H.z;N.push(c);e++}}ba&&N.sort(a);return N};this.projectScene=function(T,N,ba){var R=[],aa=N.near,V=N.far,B,I,ka,P,ja,ca,Q,ra,wa,f,m,p,j,h,q,v;n=s=x=0;N.autoUpdateMatrix&&N.update();r.multiply(N.projectionMatrix,N.globalMatrix);D[0]=new THREE.Vector4(r.n41-r.n11,r.n42-r.n12,r.n43-r.n13,r.n44-r.n14);D[1]=new THREE.Vector4(r.n41+r.n11,r.n42+r.n12,r.n43+r.n13,r.n44+r.n14);D[2]=new THREE.Vector4(r.n41+r.n21,r.n42+r.n22,r.n43+r.n23,r.n44+r.n24);D[3]=new THREE.Vector4(r.n41-
-r.n21,r.n42-r.n22,r.n43-r.n23,r.n44-r.n24);D[4]=new THREE.Vector4(r.n41-r.n31,r.n42-r.n32,r.n43-r.n33,r.n44-r.n34);D[5]=new THREE.Vector4(r.n41+r.n31,r.n42+r.n32,r.n43+r.n33,r.n44+r.n34);B=0;for(ca=D.length;B<ca;B++){Q=D[B];Q.divideScalar(Math.sqrt(Q.x*Q.x+Q.y*Q.y+Q.z*Q.z))}T.update(undefined,!1,N);ca=this.projectObjects(T,N,!0);T=0;for(B=ca.length;T<B;T++){Q=ca[T].object;if(Q.visible){Q.autoUpdateMatrix&&Q.updateMatrix();ra=Q.globalMatrix;ra.extractRotationMatrix(Q.rotationMatrix);m=Q.rotationMatrix;
-wa=Q.materials;f=Q.overdraw;if(Q instanceof THREE.Mesh){p=Q.geometry;j=p.vertices;I=0;for(ka=j.length;I<ka;I++){h=j[I];h.positionWorld.copy(h.position);ra.multiplyVector3(h.positionWorld);P=h.positionScreen;P.copy(h.positionWorld);r.multiplyVector4(P);P.x/=P.w;P.y/=P.w;h.__visible=P.z>aa&&P.z<V}p=p.faces;I=0;for(ka=p.length;I<ka;I++){h=p[I];if(h instanceof THREE.Face3){P=j[h.a];ja=j[h.b];q=j[h.c];if(P.__visible&&ja.__visible&&q.__visible&&(Q.doubleSided||Q.flipSided!=(q.positionScreen.x-P.positionScreen.x)*
-(ja.positionScreen.y-P.positionScreen.y)-(q.positionScreen.y-P.positionScreen.y)*(ja.positionScreen.x-P.positionScreen.x)<0)){i=k[n]=k[n]||new THREE.RenderableFace3;i.v1.positionWorld.copy(P.positionWorld);i.v2.positionWorld.copy(ja.positionWorld);i.v3.positionWorld.copy(q.positionWorld);i.v1.positionScreen.copy(P.positionScreen);i.v2.positionScreen.copy(ja.positionScreen);i.v3.positionScreen.copy(q.positionScreen);i.normalWorld.copy(h.normal);m.multiplyVector3(i.normalWorld);i.centroidWorld.copy(h.centroid);
-ra.multiplyVector3(i.centroidWorld);i.centroidScreen.copy(i.centroidWorld);r.multiplyVector3(i.centroidScreen);q=h.vertexNormals;ga=i.vertexNormalsWorld;P=0;for(ja=q.length;P<ja;P++){v=ga[P]=ga[P]||new THREE.Vector3;v.copy(q[P]);m.multiplyVector3(v)}i.z=i.centroidScreen.z;i.meshMaterials=wa;i.faceMaterials=h.materials;i.overdraw=f;if(Q.geometry.uvs[I]){i.uvs[0]=Q.geometry.uvs[I][0];i.uvs[1]=Q.geometry.uvs[I][1];i.uvs[2]=Q.geometry.uvs[I][2]}R.push(i);n++}}else if(h instanceof THREE.Face4){P=j[h.a];
-ja=j[h.b];q=j[h.c];v=j[h.d];if(P.__visible&&ja.__visible&&q.__visible&&v.__visible&&(Q.doubleSided||Q.flipSided!=((v.positionScreen.x-P.positionScreen.x)*(ja.positionScreen.y-P.positionScreen.y)-(v.positionScreen.y-P.positionScreen.y)*(ja.positionScreen.x-P.positionScreen.x)<0||(ja.positionScreen.x-q.positionScreen.x)*(v.positionScreen.y-q.positionScreen.y)-(ja.positionScreen.y-q.positionScreen.y)*(v.positionScreen.x-q.positionScreen.x)<0))){i=k[n]=k[n]||new THREE.RenderableFace3;i.v1.positionWorld.copy(P.positionWorld);
-i.v2.positionWorld.copy(ja.positionWorld);i.v3.positionWorld.copy(v.positionWorld);i.v1.positionScreen.copy(P.positionScreen);i.v2.positionScreen.copy(ja.positionScreen);i.v3.positionScreen.copy(v.positionScreen);i.normalWorld.copy(h.normal);m.multiplyVector3(i.normalWorld);i.centroidWorld.copy(h.centroid);ra.multiplyVector3(i.centroidWorld);i.centroidScreen.copy(i.centroidWorld);r.multiplyVector3(i.centroidScreen);i.z=i.centroidScreen.z;i.meshMaterials=wa;i.faceMaterials=h.materials;i.overdraw=f;
-if(Q.geometry.uvs[I]){i.uvs[0]=Q.geometry.uvs[I][0];i.uvs[1]=Q.geometry.uvs[I][1];i.uvs[2]=Q.geometry.uvs[I][3]}R.push(i);n++;l=k[n]=k[n]||new THREE.RenderableFace3;l.v1.positionWorld.copy(ja.positionWorld);l.v2.positionWorld.copy(q.positionWorld);l.v3.positionWorld.copy(v.positionWorld);l.v1.positionScreen.copy(ja.positionScreen);l.v2.positionScreen.copy(q.positionScreen);l.v3.positionScreen.copy(v.positionScreen);l.normalWorld.copy(i.normalWorld);l.centroidWorld.copy(i.centroidWorld);l.centroidScreen.copy(i.centroidScreen);
-l.z=l.centroidScreen.z;l.meshMaterials=wa;l.faceMaterials=h.materials;l.overdraw=f;if(Q.geometry.uvs[I]){l.uvs[0]=Q.geometry.uvs[I][1];l.uvs[1]=Q.geometry.uvs[I][2];l.uvs[2]=Q.geometry.uvs[I][3]}R.push(l);n++}}}}else if(Q instanceof THREE.Line){Z.multiply(r,ra);j=Q.geometry.vertices;h=j[0];h.positionScreen.copy(h.position);Z.multiplyVector4(h.positionScreen);I=1;for(ka=j.length;I<ka;I++){P=j[I];P.positionScreen.copy(P.position);Z.multiplyVector4(P.positionScreen);ja=j[I-1];K.copy(P.positionScreen);
-d.copy(ja.positionScreen);if(b(K,d)){K.multiplyScalar(1/K.w);d.multiplyScalar(1/d.w);o=w[s]=w[s]||new THREE.RenderableLine;o.v1.positionScreen.copy(K);o.v2.positionScreen.copy(d);o.z=Math.max(K.z,d.z);o.materials=Q.materials;R.push(o);s++}}}else if(Q instanceof THREE.Particle){G.set(Q.position.x,Q.position.y,Q.position.z,1);r.multiplyVector4(G);G.z/=G.w;if(G.z>0&&G.z<1){t=F[x]=F[x]||new THREE.RenderableParticle;t.x=G.x/G.w;t.y=G.y/G.w;t.z=G.z;t.rotation=Q.rotation.z;t.scale.x=Q.scale.x*Math.abs(t.x-
-(G.x+N.projectionMatrix.n11)/(G.w+N.projectionMatrix.n14));t.scale.y=Q.scale.y*Math.abs(t.y-(G.y+N.projectionMatrix.n22)/(G.w+N.projectionMatrix.n24));t.materials=Q.materials;R.push(t);x++}}}}ba&&R.sort(a);return R};this.unprojectVector=function(T,N){var ba=THREE.Matrix4.makeInvert(N.globalMatrix);ba.multiplySelf(THREE.Matrix4.makeInvert(N.projectionMatrix));ba.multiplyVector3(T);return T}};
-THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,c,e,g,i;this.domElement=document.createElement("div");this.setSize=function(l,n){c=l;e=n;g=c/2;i=e/2};this.render=function(l,n){var k,o,s,w,t,x,F,H;a=b.projectScene(l,n);k=0;for(o=a.length;k<o;k++){t=a[k];if(t instanceof THREE.RenderableParticle){F=t.x*g+g;H=t.y*i+i;s=0;for(w=t.material.length;s<w;s++){x=t.material[s];if(x instanceof THREE.ParticleDOMMaterial){x=x.domElement;x.style.left=F+"px";x.style.top=H+"px"}}}}}};
-THREE.CanvasRenderer=function(){function a(na){if(t!=na)o.globalAlpha=t=na}function b(na){if(x!=na){switch(na){case THREE.NormalBlending:o.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:o.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:o.globalCompositeOperation="darker"}x=na}}var c=null,e=new THREE.Projector,g=document.createElement("canvas"),i,l,n,k,o=g.getContext("2d"),s=new THREE.Color(0),w=0,t=1,x=0,F=null,H=null,G=1,r,Z,D,K,d,ga,T,N,ba,R=new THREE.Color,
-aa=new THREE.Color,V=new THREE.Color,B=new THREE.Color,I=new THREE.Color,ka,P,ja,ca,Q,ra,wa,f,m,p=new THREE.Rectangle,j=new THREE.Rectangle,h=new THREE.Rectangle,q=!1,v=new THREE.Color,C=new THREE.Color,W=new THREE.Color,L=new THREE.Color,S=Math.PI*2,E=new THREE.Vector3,da,ea,va,la,ha,ia,fa=16;da=document.createElement("canvas");da.width=da.height=2;ea=da.getContext("2d");ea.fillStyle="rgba(0,0,0,1)";ea.fillRect(0,0,2,2);va=ea.getImageData(0,0,2,2);la=va.data;ha=document.createElement("canvas");ha.width=
-ha.height=fa;ia=ha.getContext("2d");ia.translate(-fa/2,-fa/2);ia.scale(fa,fa);fa--;this.domElement=g;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setSize=function(na,y){i=na;l=y;n=i/2;k=l/2;g.width=i;g.height=l;p.set(-n,-k,n,k);t=1;x=0;H=F=null;G=1};this.setClearColor=function(na,y){s=na;w=y;j.set(-n,-k,n,k);o.setTransform(1,0,0,-1,n,k);this.clear()};this.setClearColorHex=function(na,y){s.setHex(na);w=y;j.set(-n,-k,n,k);o.setTransform(1,0,0,-1,n,k);this.clear()};this.clear=function(){o.setTransform(1,
-0,0,-1,n,k);if(!j.isEmpty()){j.inflate(1);j.minSelf(p);if(s.hex==0&&w==0)o.clearRect(j.getX(),j.getY(),j.getWidth(),j.getHeight());else{b(THREE.NormalBlending);a(1);o.fillStyle="rgba("+Math.floor(s.r*255)+","+Math.floor(s.g*255)+","+Math.floor(s.b*255)+","+w+")";o.fillRect(j.getX(),j.getY(),j.getWidth(),j.getHeight())}j.empty()}};this.render=function(na,y){function Fa(z){var X,Y,A,U=z.lights;C.setRGB(0,0,0);W.setRGB(0,0,0);L.setRGB(0,0,0);z=0;for(X=U.length;z<X;z++){Y=U[z];A=Y.color;if(Y instanceof
-THREE.AmbientLight){C.r+=A.r;C.g+=A.g;C.b+=A.b}else if(Y instanceof THREE.DirectionalLight){W.r+=A.r;W.g+=A.g;W.b+=A.b}else if(Y instanceof THREE.PointLight){L.r+=A.r;L.g+=A.g;L.b+=A.b}}}function za(z,X,Y,A){var U,ma,xa,Da,Ea=z.lights;z=0;for(U=Ea.length;z<U;z++){ma=Ea[z];xa=ma.color;Da=ma.intensity;if(ma instanceof THREE.DirectionalLight){ma=Y.dot(ma.position)*Da;if(ma>0){A.r+=xa.r*ma;A.g+=xa.g*ma;A.b+=xa.b*ma}}else if(ma instanceof THREE.PointLight){E.sub(ma.position,X);E.normalize();ma=Y.dot(E)*
-Da;if(ma>0){A.r+=xa.r*ma;A.g+=xa.g*ma;A.b+=xa.b*ma}}}}function Ga(z,X,Y){if(Y.opacity!=0){a(Y.opacity);b(Y.blending);var A,U,ma,xa,Da,Ea;if(Y instanceof THREE.ParticleBasicMaterial){if(Y.map&&Y.map.image.loaded){xa=Y.map.image;Da=xa.width>>1;Ea=xa.height>>1;U=X.scale.x*n;ma=X.scale.y*k;Y=U*Da;A=ma*Ea;h.set(z.x-Y,z.y-A,z.x+Y,z.y+A);if(p.instersects(h)){o.save();o.translate(z.x,z.y);o.rotate(-X.rotation);o.scale(U,-ma);o.translate(-Da,-Ea);o.drawImage(xa,0,0);o.restore()}}}else if(Y instanceof THREE.ParticleCircleMaterial){if(q){v.r=
-C.r+W.r+L.r;v.g=C.g+W.g+L.g;v.b=C.b+W.b+L.b;R.r=Y.color.r*v.r;R.g=Y.color.g*v.g;R.b=Y.color.b*v.b;R.updateStyleString()}else R.__styleString=Y.color.__styleString;Y=X.scale.x*n;A=X.scale.y*k;h.set(z.x-Y,z.y-A,z.x+Y,z.y+A);if(p.instersects(h)){U=R.__styleString;if(H!=U)o.fillStyle=H=U;o.save();o.translate(z.x,z.y);o.rotate(-X.rotation);o.scale(Y,A);o.beginPath();o.arc(0,0,1,0,S,!0);o.closePath();o.fill();o.restore()}}}}function O(z,X,Y,A){if(A.opacity!=0){a(A.opacity);b(A.blending);o.beginPath();o.moveTo(z.positionScreen.x,
-z.positionScreen.y);o.lineTo(X.positionScreen.x,X.positionScreen.y);o.closePath();if(A instanceof THREE.LineBasicMaterial){R.__styleString=A.color.__styleString;z=A.linewidth;if(G!=z)o.lineWidth=G=z;z=R.__styleString;if(F!=z)o.strokeStyle=F=z;o.stroke();h.inflate(A.linewidth*2)}}}function M(z,X,Y,A,U,ma){if(U.opacity!=0){a(U.opacity);b(U.blending);K=z.positionScreen.x;d=z.positionScreen.y;ga=X.positionScreen.x;T=X.positionScreen.y;N=Y.positionScreen.x;ba=Y.positionScreen.y;o.beginPath();o.moveTo(K,
-d);o.lineTo(ga,T);o.lineTo(N,ba);o.lineTo(K,d);o.closePath();if(U instanceof THREE.MeshBasicMaterial)if(U.map)U.map.image.loaded&&U.map.mapping instanceof THREE.UVMapping&&Ca(K,d,ga,T,N,ba,U.map.image,A.uvs[0].u,A.uvs[0].v,A.uvs[1].u,A.uvs[1].v,A.uvs[2].u,A.uvs[2].v);else if(U.env_map){if(U.env_map.image.loaded&&U.env_map.mapping instanceof THREE.SphericalReflectionMapping){z=y.globalMatrix;E.copy(A.vertexNormalsWorld[0]);ca=(E.x*z.n11+E.y*z.n12+E.z*z.n13)*0.5+0.5;Q=-(E.x*z.n21+E.y*z.n22+E.z*z.n23)*
-0.5+0.5;E.copy(A.vertexNormalsWorld[1]);ra=(E.x*z.n11+E.y*z.n12+E.z*z.n13)*0.5+0.5;wa=-(E.x*z.n21+E.y*z.n22+E.z*z.n23)*0.5+0.5;E.copy(A.vertexNormalsWorld[2]);f=(E.x*z.n11+E.y*z.n12+E.z*z.n13)*0.5+0.5;m=-(E.x*z.n21+E.y*z.n22+E.z*z.n23)*0.5+0.5;Ca(K,d,ga,T,N,ba,U.env_map.image,ca,Q,ra,wa,f,m)}}else U.wireframe?J(U.color.__styleString,U.wireframe_linewidth):oa(U.color.__styleString);else if(U instanceof THREE.MeshLambertMaterial){if(U.map&&!U.wireframe){U.map.mapping instanceof THREE.UVMapping&&Ca(K,
-d,ga,T,N,ba,U.map.image,A.uvs[0].u,A.uvs[0].v,A.uvs[1].u,A.uvs[1].v,A.uvs[2].u,A.uvs[2].v);b(THREE.SubtractiveBlending)}if(q)if(!U.wireframe&&U.shading==THREE.SmoothShading&&A.vertexNormalsWorld.length==3){aa.r=V.r=B.r=C.r;aa.g=V.g=B.g=C.g;aa.b=V.b=B.b=C.b;za(ma,A.v1.positionWorld,A.vertexNormalsWorld[0],aa);za(ma,A.v2.positionWorld,A.vertexNormalsWorld[1],V);za(ma,A.v3.positionWorld,A.vertexNormalsWorld[2],B);I.r=(V.r+B.r)*0.5;I.g=(V.g+B.g)*0.5;I.b=(V.b+B.b)*0.5;ja=Aa(aa,V,B,I);Ca(K,d,ga,T,N,ba,
-ja,0,0,1,0,0,1)}else{v.r=C.r;v.g=C.g;v.b=C.b;za(ma,A.centroidWorld,A.normalWorld,v);R.r=U.color.r*v.r;R.g=U.color.g*v.g;R.b=U.color.b*v.b;R.updateStyleString();U.wireframe?J(R.__styleString,U.wireframe_linewidth):oa(R.__styleString)}else U.wireframe?J(U.color.__styleString,U.wireframe_linewidth):oa(U.color.__styleString)}else if(U instanceof THREE.MeshDepthMaterial){ka=y.near;P=y.far;aa.r=aa.g=aa.b=1-u(z.positionScreen.z,ka,P);V.r=V.g=V.b=1-u(X.positionScreen.z,ka,P);B.r=B.g=B.b=1-u(Y.positionScreen.z,
-ka,P);I.r=(V.r+B.r)*0.5;I.g=(V.g+B.g)*0.5;I.b=(V.b+B.b)*0.5;ja=Aa(aa,V,B,I);Ca(K,d,ga,T,N,ba,ja,0,0,1,0,0,1)}else if(U instanceof THREE.MeshNormalMaterial){R.r=Ba(A.normalWorld.x);R.g=Ba(A.normalWorld.y);R.b=Ba(A.normalWorld.z);R.updateStyleString();U.wireframe?J(R.__styleString,U.wireframe_linewidth):oa(R.__styleString)}}}function J(z,X){if(F!=z)o.strokeStyle=F=z;if(G!=X)o.lineWidth=G=X;o.stroke();h.inflate(X*2)}function oa(z){if(H!=z)o.fillStyle=H=z;o.fill()}function Ca(z,X,Y,A,U,ma,xa,Da,Ea,Ia,
-ya,Ja,Qa){var Ka,La;Ka=xa.width-1;La=xa.height-1;Da*=Ka;Ea*=La;Ia*=Ka;ya*=La;Ja*=Ka;Qa*=La;Y-=z;A-=X;U-=z;ma-=X;Ia-=Da;ya-=Ea;Ja-=Da;Qa-=Ea;Ka=Ia*Qa-Ja*ya;if(Ka!=0){La=1/Ka;Ka=(Qa*Y-ya*U)*La;ya=(Qa*A-ya*ma)*La;Y=(Ia*U-Ja*Y)*La;A=(Ia*ma-Ja*A)*La;z=z-Ka*Da-Y*Ea;X=X-ya*Da-A*Ea;o.save();o.transform(Ka,ya,Y,A,z,X);o.clip();o.drawImage(xa,0,0);o.restore()}}function Aa(z,X,Y,A){var U=~~(z.r*255),ma=~~(z.g*255);z=~~(z.b*255);var xa=~~(X.r*255),Da=~~(X.g*255);X=~~(X.b*255);var Ea=~~(Y.r*255),Ia=~~(Y.g*255);
-Y=~~(Y.b*255);var ya=~~(A.r*255),Ja=~~(A.g*255);A=~~(A.b*255);la[0]=U<0?0:U>255?255:U;la[1]=ma<0?0:ma>255?255:ma;la[2]=z<0?0:z>255?255:z;la[4]=xa<0?0:xa>255?255:xa;la[5]=Da<0?0:Da>255?255:Da;la[6]=X<0?0:X>255?255:X;la[8]=Ea<0?0:Ea>255?255:Ea;la[9]=Ia<0?0:Ia>255?255:Ia;la[10]=Y<0?0:Y>255?255:Y;la[12]=ya<0?0:ya>255?255:ya;la[13]=Ja<0?0:Ja>255?255:Ja;la[14]=A<0?0:A>255?255:A;ea.putImageData(va,0,0);ia.drawImage(da,0,0);return ha}function u(z,X,Y){z=(z-X)/(Y-X);return z*z*(3-2*z)}function Ba(z){z=(z+
-1)*0.5;return z<0?0:z>1?1:z}function Oa(z,X){var Y=X.x-z.x,A=X.y-z.y,U=1/Math.sqrt(Y*Y+A*A);Y*=U;A*=U;X.x+=Y;X.y+=A;z.x-=Y;z.y-=A}var Ma,Ha,$,sa,pa,ta,ua,qa;this.autoClear?this.clear():o.setTransform(1,0,0,-1,n,k);c=e.projectScene(na,y,this.sortElements);(q=na.lights.length>0)&&Fa(na);Ma=0;for(Ha=c.length;Ma<Ha;Ma++){$=c[Ma];h.empty();if($ instanceof THREE.RenderableParticle){r=$;r.x*=n;r.y*=k;sa=0;for(pa=$.materials.length;sa<pa;sa++)Ga(r,$,$.materials[sa],na)}else if($ instanceof THREE.RenderableLine){r=
-$.v1;Z=$.v2;r.positionScreen.x*=n;r.positionScreen.y*=k;Z.positionScreen.x*=n;Z.positionScreen.y*=k;h.addPoint(r.positionScreen.x,r.positionScreen.y);h.addPoint(Z.positionScreen.x,Z.positionScreen.y);if(p.instersects(h)){sa=0;for(pa=$.materials.length;sa<pa;)O(r,Z,$,$.materials[sa++],na)}}else if($ instanceof THREE.RenderableFace3){r=$.v1;Z=$.v2;D=$.v3;r.positionScreen.x*=n;r.positionScreen.y*=k;Z.positionScreen.x*=n;Z.positionScreen.y*=k;D.positionScreen.x*=n;D.positionScreen.y*=k;if($.overdraw){Oa(r.positionScreen,
-Z.positionScreen);Oa(Z.positionScreen,D.positionScreen);Oa(D.positionScreen,r.positionScreen)}h.add3Points(r.positionScreen.x,r.positionScreen.y,Z.positionScreen.x,Z.positionScreen.y,D.positionScreen.x,D.positionScreen.y);if(p.instersects(h)){sa=0;for(pa=$.meshMaterials.length;sa<pa;){qa=$.meshMaterials[sa++];if(qa instanceof THREE.MeshFaceMaterial){ta=0;for(ua=$.faceMaterials.length;ta<ua;)(qa=$.faceMaterials[ta++])&&M(r,Z,D,$,qa,na)}else M(r,Z,D,$,qa,na)}}}j.addRectangle(h)}o.setTransform(1,0,0,
+THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;THREE.Fog=function(a,b,d){this.color=new THREE.Color(a);this.near=b||1;this.far=d||1E3};THREE.FogExp2=function(a,b){this.color=new THREE.Color(a);this.density=b||2.5E-4};
+THREE.Projector=function(){function a(T,O){return O.z-T.z}function b(T,O){var ca=0,S=1,ba=T.z+T.w,V=O.z+O.w,D=-T.z+T.w,J=-O.z+O.w;if(ba>=0&&V>=0&&D>=0&&J>=0)return!0;else if(ba<0&&V<0||D<0&&J<0)return!1;else{if(ba<0)ca=Math.max(ca,ba/(ba-V));else V<0&&(S=Math.min(S,ba/(ba-V)));if(D<0)ca=Math.max(ca,D/(D-J));else J<0&&(S=Math.min(S,D/(D-J)));if(S<ca)return!1;else{T.lerpSelf(O,ca);O.lerpSelf(T,1-S);return!0}}}var d,e,g=[],i,l,n,k=[],o,s,w=[],u,x,F=[],I=new THREE.Vector4,H=new THREE.Vector4,r=new THREE.Matrix4,
+Z=new THREE.Matrix4,E=[],L=new THREE.Vector4,c=new THREE.Vector4,ia;this.projectObjects=function(T,O,ca){O=[];var S,ba,V;e=0;ba=T.objects;T=0;for(S=ba.length;T<S;T++){V=ba[T];var D;if(!(D=!V.visible))if(D=V instanceof THREE.Mesh){a:{D=void 0;for(var J=V.globalMatrix,la=-V.geometry.boundingSphere.radius*Math.max(V.scale.x,Math.max(V.scale.y,V.scale.z)),Q=0;Q<6;Q++){D=E[Q].x*J.n14+E[Q].y*J.n24+E[Q].z*J.n34+E[Q].w;if(D<=la){D=!1;break a}}D=!0}D=!D}if(!D){d=g[e]=g[e]||new THREE.RenderableObject;I.copy(V.position);
+r.multiplyVector3(I);d.object=V;d.z=I.z;O.push(d);e++}}ca&&O.sort(a);return O};this.projectScene=function(T,O,ca){var S=[],ba=O.near,V=O.far,D,J,la,Q,ja,ea,R,ra,wa,f,m,p,j,h,q,t;n=s=x=0;O.autoUpdateMatrix&&O.update();r.multiply(O.projectionMatrix,O.globalMatrix);E[0]=new THREE.Vector4(r.n41-r.n11,r.n42-r.n12,r.n43-r.n13,r.n44-r.n14);E[1]=new THREE.Vector4(r.n41+r.n11,r.n42+r.n12,r.n43+r.n13,r.n44+r.n14);E[2]=new THREE.Vector4(r.n41+r.n21,r.n42+r.n22,r.n43+r.n23,r.n44+r.n24);E[3]=new THREE.Vector4(r.n41-
+r.n21,r.n42-r.n22,r.n43-r.n23,r.n44-r.n24);E[4]=new THREE.Vector4(r.n41-r.n31,r.n42-r.n32,r.n43-r.n33,r.n44-r.n34);E[5]=new THREE.Vector4(r.n41+r.n31,r.n42+r.n32,r.n43+r.n33,r.n44+r.n34);D=0;for(ea=E.length;D<ea;D++){R=E[D];R.divideScalar(Math.sqrt(R.x*R.x+R.y*R.y+R.z*R.z))}T.update(undefined,!1,O);ea=this.projectObjects(T,O,!0);T=0;for(D=ea.length;T<D;T++){R=ea[T].object;if(R.visible){R.autoUpdateMatrix&&R.updateMatrix();ra=R.globalMatrix;ra.extractRotationMatrix(R.rotationMatrix);m=R.rotationMatrix;
+wa=R.materials;f=R.overdraw;if(R instanceof THREE.Mesh){p=R.geometry;j=p.vertices;J=0;for(la=j.length;J<la;J++){h=j[J];h.positionWorld.copy(h.position);ra.multiplyVector3(h.positionWorld);Q=h.positionScreen;Q.copy(h.positionWorld);r.multiplyVector4(Q);Q.x/=Q.w;Q.y/=Q.w;h.__visible=Q.z>ba&&Q.z<V}p=p.faces;J=0;for(la=p.length;J<la;J++){h=p[J];if(h instanceof THREE.Face3){Q=j[h.a];ja=j[h.b];q=j[h.c];if(Q.__visible&&ja.__visible&&q.__visible&&(R.doubleSided||R.flipSided!=(q.positionScreen.x-Q.positionScreen.x)*
+(ja.positionScreen.y-Q.positionScreen.y)-(q.positionScreen.y-Q.positionScreen.y)*(ja.positionScreen.x-Q.positionScreen.x)<0)){i=k[n]=k[n]||new THREE.RenderableFace3;i.v1.positionWorld.copy(Q.positionWorld);i.v2.positionWorld.copy(ja.positionWorld);i.v3.positionWorld.copy(q.positionWorld);i.v1.positionScreen.copy(Q.positionScreen);i.v2.positionScreen.copy(ja.positionScreen);i.v3.positionScreen.copy(q.positionScreen);i.normalWorld.copy(h.normal);m.multiplyVector3(i.normalWorld);i.centroidWorld.copy(h.centroid);
+ra.multiplyVector3(i.centroidWorld);i.centroidScreen.copy(i.centroidWorld);r.multiplyVector3(i.centroidScreen);q=h.vertexNormals;ia=i.vertexNormalsWorld;Q=0;for(ja=q.length;Q<ja;Q++){t=ia[Q]=ia[Q]||new THREE.Vector3;t.copy(q[Q]);m.multiplyVector3(t)}i.z=i.centroidScreen.z;i.meshMaterials=wa;i.faceMaterials=h.materials;i.overdraw=f;if(R.geometry.uvs[J]){i.uvs[0]=R.geometry.uvs[J][0];i.uvs[1]=R.geometry.uvs[J][1];i.uvs[2]=R.geometry.uvs[J][2]}S.push(i);n++}}else if(h instanceof THREE.Face4){Q=j[h.a];
+ja=j[h.b];q=j[h.c];t=j[h.d];if(Q.__visible&&ja.__visible&&q.__visible&&t.__visible&&(R.doubleSided||R.flipSided!=((t.positionScreen.x-Q.positionScreen.x)*(ja.positionScreen.y-Q.positionScreen.y)-(t.positionScreen.y-Q.positionScreen.y)*(ja.positionScreen.x-Q.positionScreen.x)<0||(ja.positionScreen.x-q.positionScreen.x)*(t.positionScreen.y-q.positionScreen.y)-(ja.positionScreen.y-q.positionScreen.y)*(t.positionScreen.x-q.positionScreen.x)<0))){i=k[n]=k[n]||new THREE.RenderableFace3;i.v1.positionWorld.copy(Q.positionWorld);
+i.v2.positionWorld.copy(ja.positionWorld);i.v3.positionWorld.copy(t.positionWorld);i.v1.positionScreen.copy(Q.positionScreen);i.v2.positionScreen.copy(ja.positionScreen);i.v3.positionScreen.copy(t.positionScreen);i.normalWorld.copy(h.normal);m.multiplyVector3(i.normalWorld);i.centroidWorld.copy(h.centroid);ra.multiplyVector3(i.centroidWorld);i.centroidScreen.copy(i.centroidWorld);r.multiplyVector3(i.centroidScreen);i.z=i.centroidScreen.z;i.meshMaterials=wa;i.faceMaterials=h.materials;i.overdraw=f;
+if(R.geometry.uvs[J]){i.uvs[0]=R.geometry.uvs[J][0];i.uvs[1]=R.geometry.uvs[J][1];i.uvs[2]=R.geometry.uvs[J][3]}S.push(i);n++;l=k[n]=k[n]||new THREE.RenderableFace3;l.v1.positionWorld.copy(ja.positionWorld);l.v2.positionWorld.copy(q.positionWorld);l.v3.positionWorld.copy(t.positionWorld);l.v1.positionScreen.copy(ja.positionScreen);l.v2.positionScreen.copy(q.positionScreen);l.v3.positionScreen.copy(t.positionScreen);l.normalWorld.copy(i.normalWorld);l.centroidWorld.copy(i.centroidWorld);l.centroidScreen.copy(i.centroidScreen);
+l.z=l.centroidScreen.z;l.meshMaterials=wa;l.faceMaterials=h.materials;l.overdraw=f;if(R.geometry.uvs[J]){l.uvs[0]=R.geometry.uvs[J][1];l.uvs[1]=R.geometry.uvs[J][2];l.uvs[2]=R.geometry.uvs[J][3]}S.push(l);n++}}}}else if(R instanceof THREE.Line){Z.multiply(r,ra);j=R.geometry.vertices;h=j[0];h.positionScreen.copy(h.position);Z.multiplyVector4(h.positionScreen);J=1;for(la=j.length;J<la;J++){Q=j[J];Q.positionScreen.copy(Q.position);Z.multiplyVector4(Q.positionScreen);ja=j[J-1];L.copy(Q.positionScreen);
+c.copy(ja.positionScreen);if(b(L,c)){L.multiplyScalar(1/L.w);c.multiplyScalar(1/c.w);o=w[s]=w[s]||new THREE.RenderableLine;o.v1.positionScreen.copy(L);o.v2.positionScreen.copy(c);o.z=Math.max(L.z,c.z);o.materials=R.materials;S.push(o);s++}}}else if(R instanceof THREE.Particle){H.set(R.position.x,R.position.y,R.position.z,1);r.multiplyVector4(H);H.z/=H.w;if(H.z>0&&H.z<1){u=F[x]=F[x]||new THREE.RenderableParticle;u.x=H.x/H.w;u.y=H.y/H.w;u.z=H.z;u.rotation=R.rotation.z;u.scale.x=R.scale.x*Math.abs(u.x-
+(H.x+O.projectionMatrix.n11)/(H.w+O.projectionMatrix.n14));u.scale.y=R.scale.y*Math.abs(u.y-(H.y+O.projectionMatrix.n22)/(H.w+O.projectionMatrix.n24));u.materials=R.materials;S.push(u);x++}}}}ca&&S.sort(a);return S};this.unprojectVector=function(T,O){var ca=THREE.Matrix4.makeInvert(O.globalMatrix);ca.multiplySelf(THREE.Matrix4.makeInvert(O.projectionMatrix));ca.multiplyVector3(T);return T}};
+THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,d,e,g,i;this.domElement=document.createElement("div");this.setSize=function(l,n){d=l;e=n;g=d/2;i=e/2};this.render=function(l,n){var k,o,s,w,u,x,F,I;a=b.projectScene(l,n);k=0;for(o=a.length;k<o;k++){u=a[k];if(u instanceof THREE.RenderableParticle){F=u.x*g+g;I=u.y*i+i;s=0;for(w=u.material.length;s<w;s++){x=u.material[s];if(x instanceof THREE.ParticleDOMMaterial){x=x.domElement;x.style.left=F+"px";x.style.top=I+"px"}}}}}};
+THREE.CanvasRenderer=function(){function a(na){if(u!=na)o.globalAlpha=u=na}function b(na){if(x!=na){switch(na){case THREE.NormalBlending:o.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:o.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:o.globalCompositeOperation="darker"}x=na}}var d=null,e=new THREE.Projector,g=document.createElement("canvas"),i,l,n,k,o=g.getContext("2d"),s=new THREE.Color(0),w=0,u=1,x=0,F=null,I=null,H=1,r,Z,E,L,c,ia,T,O,ca,S=new THREE.Color,
+ba=new THREE.Color,V=new THREE.Color,D=new THREE.Color,J=new THREE.Color,la,Q,ja,ea,R,ra,wa,f,m,p=new THREE.Rectangle,j=new THREE.Rectangle,h=new THREE.Rectangle,q=!1,t=new THREE.Color,A=new THREE.Color,W=new THREE.Color,G=new THREE.Color,M=Math.PI*2,C=new THREE.Vector3,aa,da,ua,ka,fa,ga,ha=16;aa=document.createElement("canvas");aa.width=aa.height=2;da=aa.getContext("2d");da.fillStyle="rgba(0,0,0,1)";da.fillRect(0,0,2,2);ua=da.getImageData(0,0,2,2);ka=ua.data;fa=document.createElement("canvas");fa.width=
+fa.height=ha;ga=fa.getContext("2d");ga.translate(-ha/2,-ha/2);ga.scale(ha,ha);ha--;this.domElement=g;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setSize=function(na,y){i=na;l=y;n=i/2;k=l/2;g.width=i;g.height=l;p.set(-n,-k,n,k);u=1;x=0;I=F=null;H=1};this.setClearColor=function(na,y){s=na;w=y;j.set(-n,-k,n,k);o.setTransform(1,0,0,-1,n,k);this.clear()};this.setClearColorHex=function(na,y){s.setHex(na);w=y;j.set(-n,-k,n,k);o.setTransform(1,0,0,-1,n,k);this.clear()};this.clear=function(){o.setTransform(1,
+0,0,-1,n,k);if(!j.isEmpty()){j.inflate(1);j.minSelf(p);if(s.hex==0&&w==0)o.clearRect(j.getX(),j.getY(),j.getWidth(),j.getHeight());else{b(THREE.NormalBlending);a(1);o.fillStyle="rgba("+Math.floor(s.r*255)+","+Math.floor(s.g*255)+","+Math.floor(s.b*255)+","+w+")";o.fillRect(j.getX(),j.getY(),j.getWidth(),j.getHeight())}j.empty()}};this.render=function(na,y){function Fa(z){var X,Y,B,U=z.lights;A.setRGB(0,0,0);W.setRGB(0,0,0);G.setRGB(0,0,0);z=0;for(X=U.length;z<X;z++){Y=U[z];B=Y.color;if(Y instanceof
+THREE.AmbientLight){A.r+=B.r;A.g+=B.g;A.b+=B.b}else if(Y instanceof THREE.DirectionalLight){W.r+=B.r;W.g+=B.g;W.b+=B.b}else if(Y instanceof THREE.PointLight){G.r+=B.r;G.g+=B.g;G.b+=B.b}}}function za(z,X,Y,B){var U,ma,xa,Da,Ea=z.lights;z=0;for(U=Ea.length;z<U;z++){ma=Ea[z];xa=ma.color;Da=ma.intensity;if(ma instanceof THREE.DirectionalLight){ma=Y.dot(ma.position)*Da;if(ma>0){B.r+=xa.r*ma;B.g+=xa.g*ma;B.b+=xa.b*ma}}else if(ma instanceof THREE.PointLight){C.sub(ma.position,X);C.normalize();ma=Y.dot(C)*
+Da;if(ma>0){B.r+=xa.r*ma;B.g+=xa.g*ma;B.b+=xa.b*ma}}}}function Ga(z,X,Y){if(Y.opacity!=0){a(Y.opacity);b(Y.blending);var B,U,ma,xa,Da,Ea;if(Y instanceof THREE.ParticleBasicMaterial){if(Y.map&&Y.map.image.loaded){xa=Y.map.image;Da=xa.width>>1;Ea=xa.height>>1;U=X.scale.x*n;ma=X.scale.y*k;Y=U*Da;B=ma*Ea;h.set(z.x-Y,z.y-B,z.x+Y,z.y+B);if(p.instersects(h)){o.save();o.translate(z.x,z.y);o.rotate(-X.rotation);o.scale(U,-ma);o.translate(-Da,-Ea);o.drawImage(xa,0,0);o.restore()}}}else if(Y instanceof THREE.ParticleCircleMaterial){if(q){t.r=
+A.r+W.r+G.r;t.g=A.g+W.g+G.g;t.b=A.b+W.b+G.b;S.r=Y.color.r*t.r;S.g=Y.color.g*t.g;S.b=Y.color.b*t.b;S.updateStyleString()}else S.__styleString=Y.color.__styleString;Y=X.scale.x*n;B=X.scale.y*k;h.set(z.x-Y,z.y-B,z.x+Y,z.y+B);if(p.instersects(h)){U=S.__styleString;if(I!=U)o.fillStyle=I=U;o.save();o.translate(z.x,z.y);o.rotate(-X.rotation);o.scale(Y,B);o.beginPath();o.arc(0,0,1,0,M,!0);o.closePath();o.fill();o.restore()}}}}function P(z,X,Y,B){if(B.opacity!=0){a(B.opacity);b(B.blending);o.beginPath();o.moveTo(z.positionScreen.x,
+z.positionScreen.y);o.lineTo(X.positionScreen.x,X.positionScreen.y);o.closePath();if(B instanceof THREE.LineBasicMaterial){S.__styleString=B.color.__styleString;z=B.linewidth;if(H!=z)o.lineWidth=H=z;z=S.__styleString;if(F!=z)o.strokeStyle=F=z;o.stroke();h.inflate(B.linewidth*2)}}}function N(z,X,Y,B,U,ma){if(U.opacity!=0){a(U.opacity);b(U.blending);L=z.positionScreen.x;c=z.positionScreen.y;ia=X.positionScreen.x;T=X.positionScreen.y;O=Y.positionScreen.x;ca=Y.positionScreen.y;o.beginPath();o.moveTo(L,
+c);o.lineTo(ia,T);o.lineTo(O,ca);o.lineTo(L,c);o.closePath();if(U instanceof THREE.MeshBasicMaterial)if(U.map)U.map.image.loaded&&U.map.mapping instanceof THREE.UVMapping&&Ca(L,c,ia,T,O,ca,U.map.image,B.uvs[0].u,B.uvs[0].v,B.uvs[1].u,B.uvs[1].v,B.uvs[2].u,B.uvs[2].v);else if(U.env_map){if(U.env_map.image.loaded&&U.env_map.mapping instanceof THREE.SphericalReflectionMapping){z=y.globalMatrix;C.copy(B.vertexNormalsWorld[0]);ea=(C.x*z.n11+C.y*z.n12+C.z*z.n13)*0.5+0.5;R=-(C.x*z.n21+C.y*z.n22+C.z*z.n23)*
+0.5+0.5;C.copy(B.vertexNormalsWorld[1]);ra=(C.x*z.n11+C.y*z.n12+C.z*z.n13)*0.5+0.5;wa=-(C.x*z.n21+C.y*z.n22+C.z*z.n23)*0.5+0.5;C.copy(B.vertexNormalsWorld[2]);f=(C.x*z.n11+C.y*z.n12+C.z*z.n13)*0.5+0.5;m=-(C.x*z.n21+C.y*z.n22+C.z*z.n23)*0.5+0.5;Ca(L,c,ia,T,O,ca,U.env_map.image,ea,R,ra,wa,f,m)}}else U.wireframe?K(U.color.__styleString,U.wireframe_linewidth):oa(U.color.__styleString);else if(U instanceof THREE.MeshLambertMaterial){if(U.map&&!U.wireframe){U.map.mapping instanceof THREE.UVMapping&&Ca(L,
+c,ia,T,O,ca,U.map.image,B.uvs[0].u,B.uvs[0].v,B.uvs[1].u,B.uvs[1].v,B.uvs[2].u,B.uvs[2].v);b(THREE.SubtractiveBlending)}if(q)if(!U.wireframe&&U.shading==THREE.SmoothShading&&B.vertexNormalsWorld.length==3){ba.r=V.r=D.r=A.r;ba.g=V.g=D.g=A.g;ba.b=V.b=D.b=A.b;za(ma,B.v1.positionWorld,B.vertexNormalsWorld[0],ba);za(ma,B.v2.positionWorld,B.vertexNormalsWorld[1],V);za(ma,B.v3.positionWorld,B.vertexNormalsWorld[2],D);J.r=(V.r+D.r)*0.5;J.g=(V.g+D.g)*0.5;J.b=(V.b+D.b)*0.5;ja=Aa(ba,V,D,J);Ca(L,c,ia,T,O,ca,
+ja,0,0,1,0,0,1)}else{t.r=A.r;t.g=A.g;t.b=A.b;za(ma,B.centroidWorld,B.normalWorld,t);S.r=U.color.r*t.r;S.g=U.color.g*t.g;S.b=U.color.b*t.b;S.updateStyleString();U.wireframe?K(S.__styleString,U.wireframe_linewidth):oa(S.__styleString)}else U.wireframe?K(U.color.__styleString,U.wireframe_linewidth):oa(U.color.__styleString)}else if(U instanceof THREE.MeshDepthMaterial){la=y.near;Q=y.far;ba.r=ba.g=ba.b=1-v(z.positionScreen.z,la,Q);V.r=V.g=V.b=1-v(X.positionScreen.z,la,Q);D.r=D.g=D.b=1-v(Y.positionScreen.z,
+la,Q);J.r=(V.r+D.r)*0.5;J.g=(V.g+D.g)*0.5;J.b=(V.b+D.b)*0.5;ja=Aa(ba,V,D,J);Ca(L,c,ia,T,O,ca,ja,0,0,1,0,0,1)}else if(U instanceof THREE.MeshNormalMaterial){S.r=Ba(B.normalWorld.x);S.g=Ba(B.normalWorld.y);S.b=Ba(B.normalWorld.z);S.updateStyleString();U.wireframe?K(S.__styleString,U.wireframe_linewidth):oa(S.__styleString)}}}function K(z,X){if(F!=z)o.strokeStyle=F=z;if(H!=X)o.lineWidth=H=X;o.stroke();h.inflate(X*2)}function oa(z){if(I!=z)o.fillStyle=I=z;o.fill()}function Ca(z,X,Y,B,U,ma,xa,Da,Ea,Ia,
+ya,Ja,Qa){var Ka,La;Ka=xa.width-1;La=xa.height-1;Da*=Ka;Ea*=La;Ia*=Ka;ya*=La;Ja*=Ka;Qa*=La;Y-=z;B-=X;U-=z;ma-=X;Ia-=Da;ya-=Ea;Ja-=Da;Qa-=Ea;Ka=Ia*Qa-Ja*ya;if(Ka!=0){La=1/Ka;Ka=(Qa*Y-ya*U)*La;ya=(Qa*B-ya*ma)*La;Y=(Ia*U-Ja*Y)*La;B=(Ia*ma-Ja*B)*La;z=z-Ka*Da-Y*Ea;X=X-ya*Da-B*Ea;o.save();o.transform(Ka,ya,Y,B,z,X);o.clip();o.drawImage(xa,0,0);o.restore()}}function Aa(z,X,Y,B){var U=~~(z.r*255),ma=~~(z.g*255);z=~~(z.b*255);var xa=~~(X.r*255),Da=~~(X.g*255);X=~~(X.b*255);var Ea=~~(Y.r*255),Ia=~~(Y.g*255);
+Y=~~(Y.b*255);var ya=~~(B.r*255),Ja=~~(B.g*255);B=~~(B.b*255);ka[0]=U<0?0:U>255?255:U;ka[1]=ma<0?0:ma>255?255:ma;ka[2]=z<0?0:z>255?255:z;ka[4]=xa<0?0:xa>255?255:xa;ka[5]=Da<0?0:Da>255?255:Da;ka[6]=X<0?0:X>255?255:X;ka[8]=Ea<0?0:Ea>255?255:Ea;ka[9]=Ia<0?0:Ia>255?255:Ia;ka[10]=Y<0?0:Y>255?255:Y;ka[12]=ya<0?0:ya>255?255:ya;ka[13]=Ja<0?0:Ja>255?255:Ja;ka[14]=B<0?0:B>255?255:B;da.putImageData(ua,0,0);ga.drawImage(aa,0,0);return fa}function v(z,X,Y){z=(z-X)/(Y-X);return z*z*(3-2*z)}function Ba(z){z=(z+
+1)*0.5;return z<0?0:z>1?1:z}function Oa(z,X){var Y=X.x-z.x,B=X.y-z.y,U=1/Math.sqrt(Y*Y+B*B);Y*=U;B*=U;X.x+=Y;X.y+=B;z.x-=Y;z.y-=B}var Ma,Ha,$,sa,pa,ta,va,qa;this.autoClear?this.clear():o.setTransform(1,0,0,-1,n,k);d=e.projectScene(na,y,this.sortElements);(q=na.lights.length>0)&&Fa(na);Ma=0;for(Ha=d.length;Ma<Ha;Ma++){$=d[Ma];h.empty();if($ instanceof THREE.RenderableParticle){r=$;r.x*=n;r.y*=k;sa=0;for(pa=$.materials.length;sa<pa;sa++)Ga(r,$,$.materials[sa],na)}else if($ instanceof THREE.RenderableLine){r=
+$.v1;Z=$.v2;r.positionScreen.x*=n;r.positionScreen.y*=k;Z.positionScreen.x*=n;Z.positionScreen.y*=k;h.addPoint(r.positionScreen.x,r.positionScreen.y);h.addPoint(Z.positionScreen.x,Z.positionScreen.y);if(p.instersects(h)){sa=0;for(pa=$.materials.length;sa<pa;)P(r,Z,$,$.materials[sa++],na)}}else if($ instanceof THREE.RenderableFace3){r=$.v1;Z=$.v2;E=$.v3;r.positionScreen.x*=n;r.positionScreen.y*=k;Z.positionScreen.x*=n;Z.positionScreen.y*=k;E.positionScreen.x*=n;E.positionScreen.y*=k;if($.overdraw){Oa(r.positionScreen,
+Z.positionScreen);Oa(Z.positionScreen,E.positionScreen);Oa(E.positionScreen,r.positionScreen)}h.add3Points(r.positionScreen.x,r.positionScreen.y,Z.positionScreen.x,Z.positionScreen.y,E.positionScreen.x,E.positionScreen.y);if(p.instersects(h)){sa=0;for(pa=$.meshMaterials.length;sa<pa;){qa=$.meshMaterials[sa++];if(qa instanceof THREE.MeshFaceMaterial){ta=0;for(va=$.faceMaterials.length;ta<va;)(qa=$.faceMaterials[ta++])&&N(r,Z,E,$,qa,na)}else N(r,Z,E,$,qa,na)}}}j.addRectangle(h)}o.setTransform(1,0,0,
 1,0,0)}};
 1,0,0)}};
-THREE.SVGRenderer=function(){function a(ca,Q,ra){var wa,f,m,p;wa=0;for(f=ca.lights.length;wa<f;wa++){m=ca.lights[wa];if(m instanceof THREE.DirectionalLight){p=Q.normalWorld.dot(m.position)*m.intensity;if(p>0){ra.r+=m.color.r*p;ra.g+=m.color.g*p;ra.b+=m.color.b*p}}else if(m instanceof THREE.PointLight){ba.sub(m.position,Q.centroidWorld);ba.normalize();p=Q.normalWorld.dot(ba)*m.intensity;if(p>0){ra.r+=m.color.r*p;ra.g+=m.color.g*p;ra.b+=m.color.b*p}}}}function b(ca,Q,ra,wa,f,m){B=e(I++);B.setAttribute("d","M "+
-ca.positionScreen.x+" "+ca.positionScreen.y+" L "+Q.positionScreen.x+" "+Q.positionScreen.y+" L "+ra.positionScreen.x+","+ra.positionScreen.y+"z");if(f instanceof THREE.MeshBasicMaterial)D.__styleString=f.color.__styleString;else if(f instanceof THREE.MeshLambertMaterial)if(Z){K.r=d.r;K.g=d.g;K.b=d.b;a(m,wa,K);D.r=f.color.r*K.r;D.g=f.color.g*K.g;D.b=f.color.b*K.b;D.updateStyleString()}else D.__styleString=f.color.__styleString;else if(f instanceof THREE.MeshDepthMaterial){N=1-f.__2near/(f.__farPlusNear-
-wa.z*f.__farMinusNear);D.setRGB(N,N,N)}else f instanceof THREE.MeshNormalMaterial&&D.setRGB(g(wa.normalWorld.x),g(wa.normalWorld.y),g(wa.normalWorld.z));f.wireframe?B.setAttribute("style","fill: none; stroke: "+D.__styleString+"; stroke-width: "+f.wireframe_linewidth+"; stroke-opacity: "+f.opacity+"; stroke-linecap: "+f.wireframe_linecap+"; stroke-linejoin: "+f.wireframe_linejoin):B.setAttribute("style","fill: "+D.__styleString+"; fill-opacity: "+f.opacity);n.appendChild(B)}function c(ca,Q,ra,wa,
-f,m,p){B=e(I++);B.setAttribute("d","M "+ca.positionScreen.x+" "+ca.positionScreen.y+" L "+Q.positionScreen.x+" "+Q.positionScreen.y+" L "+ra.positionScreen.x+","+ra.positionScreen.y+" L "+wa.positionScreen.x+","+wa.positionScreen.y+"z");if(m instanceof THREE.MeshBasicMaterial)D.__styleString=m.color.__styleString;else if(m instanceof THREE.MeshLambertMaterial)if(Z){K.r=d.r;K.g=d.g;K.b=d.b;a(p,f,K);D.r=m.color.r*K.r;D.g=m.color.g*K.g;D.b=m.color.b*K.b;D.updateStyleString()}else D.__styleString=m.color.__styleString;
-else if(m instanceof THREE.MeshDepthMaterial){N=1-m.__2near/(m.__farPlusNear-f.z*m.__farMinusNear);D.setRGB(N,N,N)}else m instanceof THREE.MeshNormalMaterial&&D.setRGB(g(f.normalWorld.x),g(f.normalWorld.y),g(f.normalWorld.z));m.wireframe?B.setAttribute("style","fill: none; stroke: "+D.__styleString+"; stroke-width: "+m.wireframe_linewidth+"; stroke-opacity: "+m.opacity+"; stroke-linecap: "+m.wireframe_linecap+"; stroke-linejoin: "+m.wireframe_linejoin):B.setAttribute("style","fill: "+D.__styleString+
-"; fill-opacity: "+m.opacity);n.appendChild(B)}function e(ca){if(R[ca]==null){R[ca]=document.createElementNS("http://www.w3.org/2000/svg","path");ja==0&&R[ca].setAttribute("shape-rendering","crispEdges")}return R[ca]}function g(ca){return ca<0?Math.min((1+ca)*0.5,0.5):0.5+Math.min(ca*0.5,0.5)}var i=null,l=new THREE.Projector,n=document.createElementNS("http://www.w3.org/2000/svg","svg"),k,o,s,w,t,x,F,H,G=new THREE.Rectangle,r=new THREE.Rectangle,Z=!1,D=new THREE.Color(16777215),K=new THREE.Color(16777215),
-d=new THREE.Color(0),ga=new THREE.Color(0),T=new THREE.Color(0),N,ba=new THREE.Vector3,R=[],aa=[],V=[],B,I,ka,P,ja=1;this.domElement=n;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(ca){switch(ca){case "high":ja=1;break;case "low":ja=0}};this.setSize=function(ca,Q){k=ca;o=Q;s=k/2;w=o/2;n.setAttribute("viewBox",-s+" "+-w+" "+k+" "+o);n.setAttribute("width",k);n.setAttribute("height",o);G.set(-s,-w,s,w)};this.clear=function(){for(;n.childNodes.length>0;)n.removeChild(n.childNodes[0])};
-this.render=function(ca,Q){var ra,wa,f,m,p,j,h,q;this.autoClear&&this.clear();i=l.projectScene(ca,Q,this.sortElements);P=ka=I=0;if(Z=ca.lights.length>0){h=ca.lights;d.setRGB(0,0,0);ga.setRGB(0,0,0);T.setRGB(0,0,0);ra=0;for(wa=h.length;ra<wa;ra++){f=h[ra];m=f.color;if(f instanceof THREE.AmbientLight){d.r+=m.r;d.g+=m.g;d.b+=m.b}else if(f instanceof THREE.DirectionalLight){ga.r+=m.r;ga.g+=m.g;ga.b+=m.b}else if(f instanceof THREE.PointLight){T.r+=m.r;T.g+=m.g;T.b+=m.b}}}ra=0;for(wa=i.length;ra<wa;ra++){h=
-i[ra];r.empty();if(h instanceof THREE.RenderableParticle){t=h;t.x*=s;t.y*=-w;f=0;for(m=h.materials.length;f<m;f++)if(q=h.materials[f]){p=t;j=h;var v=ka++;if(aa[v]==null){aa[v]=document.createElementNS("http://www.w3.org/2000/svg","circle");ja==0&&aa[v].setAttribute("shape-rendering","crispEdges")}B=aa[v];B.setAttribute("cx",p.x);B.setAttribute("cy",p.y);B.setAttribute("r",j.scale.x*s);if(q instanceof THREE.ParticleCircleMaterial){if(Z){K.r=d.r+ga.r+T.r;K.g=d.g+ga.g+T.g;K.b=d.b+ga.b+T.b;D.r=q.color.r*
-K.r;D.g=q.color.g*K.g;D.b=q.color.b*K.b;D.updateStyleString()}else D=q.color;B.setAttribute("style","fill: "+D.__styleString)}n.appendChild(B)}}else if(h instanceof THREE.RenderableLine){t=h.v1;x=h.v2;t.positionScreen.x*=s;t.positionScreen.y*=-w;x.positionScreen.x*=s;x.positionScreen.y*=-w;r.addPoint(t.positionScreen.x,t.positionScreen.y);r.addPoint(x.positionScreen.x,x.positionScreen.y);if(G.instersects(r)){f=0;for(m=h.materials.length;f<m;)if(q=h.materials[f++]){p=t;j=x;v=P++;if(V[v]==null){V[v]=
-document.createElementNS("http://www.w3.org/2000/svg","line");ja==0&&V[v].setAttribute("shape-rendering","crispEdges")}B=V[v];B.setAttribute("x1",p.positionScreen.x);B.setAttribute("y1",p.positionScreen.y);B.setAttribute("x2",j.positionScreen.x);B.setAttribute("y2",j.positionScreen.y);if(q instanceof THREE.LineBasicMaterial){D.__styleString=q.color.__styleString;B.setAttribute("style","fill: none; stroke: "+D.__styleString+"; stroke-width: "+q.linewidth+"; stroke-opacity: "+q.opacity+"; stroke-linecap: "+
-q.linecap+"; stroke-linejoin: "+q.linejoin);n.appendChild(B)}}}}else if(h instanceof THREE.RenderableFace3){t=h.v1;x=h.v2;F=h.v3;t.positionScreen.x*=s;t.positionScreen.y*=-w;x.positionScreen.x*=s;x.positionScreen.y*=-w;F.positionScreen.x*=s;F.positionScreen.y*=-w;r.addPoint(t.positionScreen.x,t.positionScreen.y);r.addPoint(x.positionScreen.x,x.positionScreen.y);r.addPoint(F.positionScreen.x,F.positionScreen.y);if(G.instersects(r)){f=0;for(m=h.meshMaterials.length;f<m;){q=h.meshMaterials[f++];if(q instanceof
-THREE.MeshFaceMaterial){p=0;for(j=h.faceMaterials.length;p<j;)(q=h.faceMaterials[p++])&&b(t,x,F,h,q,ca)}else q&&b(t,x,F,h,q,ca)}}}else if(h instanceof THREE.RenderableFace4){t=h.v1;x=h.v2;F=h.v3;H=h.v4;t.positionScreen.x*=s;t.positionScreen.y*=-w;x.positionScreen.x*=s;x.positionScreen.y*=-w;F.positionScreen.x*=s;F.positionScreen.y*=-w;H.positionScreen.x*=s;H.positionScreen.y*=-w;r.addPoint(t.positionScreen.x,t.positionScreen.y);r.addPoint(x.positionScreen.x,x.positionScreen.y);r.addPoint(F.positionScreen.x,
-F.positionScreen.y);r.addPoint(H.positionScreen.x,H.positionScreen.y);if(G.instersects(r)){f=0;for(m=h.meshMaterials.length;f<m;){q=h.meshMaterials[f++];if(q instanceof THREE.MeshFaceMaterial){p=0;for(j=h.faceMaterials.length;p<j;)(q=h.faceMaterials[p++])&&c(t,x,F,H,h,q,ca)}else q&&c(t,x,F,H,h,q,ca)}}}}}};
-THREE.WebGLRenderer=function(a){function b(f,m,p){var j,h,q,v=f.vertices,C=v.length,W=f.colors,L=W.length,S=f.__vertexArray,E=f.__colorArray,da=f.__sortArray,ea=f.__dirtyVertices,va=f.__dirtyColors;if(p.sortParticles){I.multiplySelf(p.globalMatrix);for(j=0;j<C;j++){h=v[j].position;ca.copy(h);I.multiplyVector3(ca);da[j]=[ca.z,j]}da.sort(function(la,ha){return ha[0]-la[0]});for(j=0;j<C;j++){h=v[da[j][1]].position;q=j*3;S[q]=h.x;S[q+1]=h.y;S[q+2]=h.z}for(j=0;j<L;j++){q=j*3;color=W[da[j][1]];E[q]=color.r;
-E[q+1]=color.g;E[q+2]=color.b}}else{if(ea)for(j=0;j<C;j++){h=v[j].position;q=j*3;S[q]=h.x;S[q+1]=h.y;S[q+2]=h.z}if(va)for(j=0;j<L;j++){color=W[j];q=j*3;E[q]=color.r;E[q+1]=color.g;E[q+2]=color.b}}if(ea||p.sortParticles){d.bindBuffer(d.ARRAY_BUFFER,f.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,S,m)}if(va||p.sortParticles){d.bindBuffer(d.ARRAY_BUFFER,f.__webGLColorBuffer);d.bufferData(d.ARRAY_BUFFER,E,m)}}function c(f,m){f.fragment_shader=m.fragment_shader;f.vertex_shader=m.vertex_shader;f.uniforms=
-Uniforms.clone(m.uniforms)}function e(f,m,p,j,h){j.program||N.initMaterial(j,m,p);var q=j.program,v=q.uniforms,C=j.uniforms;if(q!=ga){d.useProgram(q);ga=q;d.uniformMatrix4fv(v.projectionMatrix,!1,ka)}if(p&&(j instanceof THREE.MeshBasicMaterial||j instanceof THREE.MeshLambertMaterial||j instanceof THREE.MeshPhongMaterial||j instanceof THREE.LineBasicMaterial||j instanceof THREE.ParticleBasicMaterial)){C.fogColor.value.setHex(p.color.hex);if(p instanceof THREE.Fog){C.fogNear.value=p.near;C.fogFar.value=
-p.far}else if(p instanceof THREE.FogExp2)C.fogDensity.value=p.density}if(j instanceof THREE.MeshPhongMaterial||j instanceof THREE.MeshLambertMaterial){var W,L,S=0,E=0,da=0,ea,va,la,ha=N.lights,ia=ha.directional.colors,fa=ha.directional.positions,na=ha.point.colors,y=ha.point.positions,Fa=0,za=0;p=L=L=0;for(W=m.length;p<W;p++){L=m[p];ea=L.color;va=L.position;la=L.intensity;if(L instanceof THREE.AmbientLight){S+=ea.r;E+=ea.g;da+=ea.b}else if(L instanceof THREE.DirectionalLight){L=Fa*3;ia[L]=ea.r*la;
-ia[L+1]=ea.g*la;ia[L+2]=ea.b*la;fa[L]=va.x;fa[L+1]=va.y;fa[L+2]=va.z;Fa+=1}else if(L instanceof THREE.PointLight){L=za*3;na[L]=ea.r*la;na[L+1]=ea.g*la;na[L+2]=ea.b*la;y[L]=va.x;y[L+1]=va.y;y[L+2]=va.z;za+=1}}for(p=Fa*3;p<ia.length;p++)ia[p]=0;for(p=za*3;p<na.length;p++)na[p]=0;ha.point.length=za;ha.directional.length=Fa;ha.ambient[0]=S;ha.ambient[1]=E;ha.ambient[2]=da;m=N.lights;C.enableLighting.value=m.directional.length+m.point.length;C.ambientLightColor.value=m.ambient;C.directionalLightColor.value=
-m.directional.colors;C.directionalLightDirection.value=m.directional.positions;C.pointLightColor.value=m.point.colors;C.pointLightPosition.value=m.point.positions}if(j instanceof THREE.MeshBasicMaterial||j instanceof THREE.MeshLambertMaterial||j instanceof THREE.MeshPhongMaterial){C.diffuse.value.setRGB(j.color.r*j.opacity,j.color.g*j.opacity,j.color.b*j.opacity);C.opacity.value=j.opacity;C.map.texture=j.map;C.light_map.texture=j.light_map;C.env_map.texture=j.env_map;C.reflectivity.value=j.reflectivity;
-C.refraction_ratio.value=j.refraction_ratio;C.combine.value=j.combine;C.useRefract.value=j.env_map&&j.env_map.mapping instanceof THREE.CubeRefractionMapping}if(j instanceof THREE.LineBasicMaterial){C.diffuse.value.setRGB(j.color.r*j.opacity,j.color.g*j.opacity,j.color.b*j.opacity);C.opacity.value=j.opacity}else if(j instanceof THREE.ParticleBasicMaterial){C.psColor.value.setRGB(j.color.r*j.opacity,j.color.g*j.opacity,j.color.b*j.opacity);C.opacity.value=j.opacity;C.size.value=j.size;C.map.texture=
-j.map}else if(j instanceof THREE.MeshPhongMaterial){C.ambient.value.setRGB(j.ambient.r,j.ambient.g,j.ambient.b);C.specular.value.setRGB(j.specular.r,j.specular.g,j.specular.b);C.shininess.value=j.shininess}else if(j instanceof THREE.MeshDepthMaterial){C.mNear.value=f.near;C.mFar.value=f.far;C.opacity.value=j.opacity}else if(j instanceof THREE.MeshNormalMaterial)C.opacity.value=j.opacity;for(var Ga in C)if(S=q.uniforms[Ga]){p=C[Ga];W=p.type;m=p.value;if(W=="i")d.uniform1i(S,m);else if(W=="f")d.uniform1f(S,
-m);else if(W=="fv1")d.uniform1fv(S,m);else if(W=="fv")d.uniform3fv(S,m);else if(W=="v2")d.uniform2f(S,m.x,m.y);else if(W=="v3")d.uniform3f(S,m.x,m.y,m.z);else if(W=="c")d.uniform3f(S,m.r,m.g,m.b);else if(W=="t"){d.uniform1i(S,m);if(p=p.texture)if(p.image instanceof Array&&p.image.length==6){if(p.image.length==6){if(!p.image.__webGLTextureCube&&!p.image.__cubeMapInitialized&&p.image.loadCount==6){p.image.__webGLTextureCube=d.createTexture();d.bindTexture(d.TEXTURE_CUBE_MAP,p.image.__webGLTextureCube);
-d.texParameteri(d.TEXTURE_CUBE_MAP,d.TEXTURE_WRAP_S,d.CLAMP_TO_EDGE);d.texParameteri(d.TEXTURE_CUBE_MAP,d.TEXTURE_WRAP_T,d.CLAMP_TO_EDGE);d.texParameteri(d.TEXTURE_CUBE_MAP,d.TEXTURE_MAG_FILTER,d.LINEAR);d.texParameteri(d.TEXTURE_CUBE_MAP,d.TEXTURE_MIN_FILTER,d.LINEAR_MIPMAP_LINEAR);for(W=0;W<6;++W)d.texImage2D(d.TEXTURE_CUBE_MAP_POSITIVE_X+W,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,p.image[W]);d.generateMipmap(d.TEXTURE_CUBE_MAP);d.bindTexture(d.TEXTURE_CUBE_MAP,null);p.image.__cubeMapInitialized=!0}d.activeTexture(d.TEXTURE0+
-m);d.bindTexture(d.TEXTURE_CUBE_MAP,p.image.__webGLTextureCube)}}else{if(!p.__webGLTexture&&p.image.loaded){p.__webGLTexture=d.createTexture();d.bindTexture(d.TEXTURE_2D,p.__webGLTexture);d.texImage2D(d.TEXTURE_2D,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,p.image);d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_S,D(p.wrap_s));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_T,D(p.wrap_t));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MAG_FILTER,D(p.mag_filter));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MIN_FILTER,D(p.min_filter));
-d.generateMipmap(d.TEXTURE_2D);d.bindTexture(d.TEXTURE_2D,null)}d.activeTexture(d.TEXTURE0+m);d.bindTexture(d.TEXTURE_2D,p.__webGLTexture)}}}d.uniformMatrix4fv(v.modelViewMatrix,!1,h._modelViewMatrixArray);d.uniformMatrix3fv(v.normalMatrix,!1,h._normalMatrixArray);(j instanceof THREE.MeshShaderMaterial||j instanceof THREE.MeshPhongMaterial||j.env_map)&&d.uniform3f(v.cameraPosition,f.position.x,f.position.y,f.position.z);(j instanceof THREE.MeshShaderMaterial||j.env_map||j.skinning)&&d.uniformMatrix4fv(v.objectMatrix,
-!1,h._objectMatrixArray);(j instanceof THREE.MeshPhongMaterial||j instanceof THREE.MeshLambertMaterial||j instanceof THREE.MeshShaderMaterial||j.skinning)&&d.uniformMatrix4fv(v.viewMatrix,!1,ja);if(j.skinning){d.uniformMatrix4fv(v.cameraInverseMatrix,!1,P);d.uniformMatrix4fv(v.uBoneGlobalMatrices,!1,h.boneMatrices)}return q}function g(f,m,p,j,h,q){f=e(f,m,p,j,q).attributes;d.bindBuffer(d.ARRAY_BUFFER,h.__webGLVertexBuffer);d.vertexAttribPointer(f.position,3,d.FLOAT,!1,0,0);if(f.color>=0){d.bindBuffer(d.ARRAY_BUFFER,
-h.__webGLColorBuffer);d.vertexAttribPointer(f.color,3,d.FLOAT,!1,0,0)}if(f.normal>=0){d.bindBuffer(d.ARRAY_BUFFER,h.__webGLNormalBuffer);d.vertexAttribPointer(f.normal,3,d.FLOAT,!1,0,0)}if(f.tangent>=0){d.bindBuffer(d.ARRAY_BUFFER,h.__webGLTangentBuffer);d.vertexAttribPointer(f.tangent,4,d.FLOAT,!1,0,0)}if(f.uv>=0)if(h.__webGLUVBuffer){d.bindBuffer(d.ARRAY_BUFFER,h.__webGLUVBuffer);d.vertexAttribPointer(f.uv,2,d.FLOAT,!1,0,0);d.enableVertexAttribArray(f.uv)}else d.disableVertexAttribArray(f.uv);if(f.uv2>=
-0)if(h.__webGLUV2Buffer){d.bindBuffer(d.ARRAY_BUFFER,h.__webGLUV2Buffer);d.vertexAttribPointer(f.uv2,2,d.FLOAT,!1,0,0);d.enableVertexAttribArray(f.uv2)}else d.disableVertexAttribArray(f.uv2);if(j.skinning&&f.skinVertexA>=0&&f.skinVertexB>=0&&f.skinIndex>=0&&f.skinWeight>=0){d.bindBuffer(d.ARRAY_BUFFER,h.__webGLSkinVertexABuffer);d.vertexAttribPointer(f.skinVertexA,4,d.FLOAT,!1,0,0);d.bindBuffer(d.ARRAY_BUFFER,h.__webGLSkinVertexBBuffer);d.vertexAttribPointer(f.skinVertexB,4,d.FLOAT,!1,0,0);d.bindBuffer(d.ARRAY_BUFFER,
-h.__webGLSkinIndicesBuffer);d.vertexAttribPointer(f.skinIndex,4,d.FLOAT,!1,0,0);d.bindBuffer(d.ARRAY_BUFFER,h.__webGLSkinWeightsBuffer);d.vertexAttribPointer(f.skinWeight,4,d.FLOAT,!1,0,0)}if(q instanceof THREE.Mesh)if(j.wireframe){d.lineWidth(j.wireframe_linewidth);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,h.__webGLLineBuffer);d.drawElements(d.LINES,h.__webGLLineCount,d.UNSIGNED_SHORT,0)}else{d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,h.__webGLFaceBuffer);d.drawElements(d.TRIANGLES,h.__webGLFaceCount,d.UNSIGNED_SHORT,
-0)}else if(q instanceof THREE.Line){q=q.type==THREE.LineStrip?d.LINE_STRIP:d.LINES;d.lineWidth(j.linewidth);d.drawArrays(q,0,h.__webGLLineCount)}else q instanceof THREE.ParticleSystem&&d.drawArrays(d.POINTS,0,h.__webGLParticleCount)}function i(f,m){if(!f.__webGLVertexBuffer)f.__webGLVertexBuffer=d.createBuffer();if(!f.__webGLNormalBuffer)f.__webGLNormalBuffer=d.createBuffer();if(f.hasPos){d.bindBuffer(d.ARRAY_BUFFER,f.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,f.positionArray,d.DYNAMIC_DRAW);
-d.enableVertexAttribArray(m.attributes.position);d.vertexAttribPointer(m.attributes.position,3,d.FLOAT,!1,0,0)}if(f.hasNormal){d.bindBuffer(d.ARRAY_BUFFER,f.__webGLNormalBuffer);d.bufferData(d.ARRAY_BUFFER,f.normalArray,d.DYNAMIC_DRAW);d.enableVertexAttribArray(m.attributes.normal);d.vertexAttribPointer(m.attributes.normal,3,d.FLOAT,!1,0,0)}d.drawArrays(d.TRIANGLES,0,f.count);f.count=0}function l(f){if(ba!=f.doubleSided){f.doubleSided?d.disable(d.CULL_FACE):d.enable(d.CULL_FACE);ba=f.doubleSided}if(R!=
-f.flipSided){f.flipSided?d.frontFace(d.CW):d.frontFace(d.CCW);R=f.flipSided}}function n(f){if(V!=f){f?d.enable(d.DEPTH_TEST):d.disable(d.DEPTH_TEST);V=f}}function k(f){B[0].set(f.n41-f.n11,f.n42-f.n12,f.n43-f.n13,f.n44-f.n14);B[1].set(f.n41+f.n11,f.n42+f.n12,f.n43+f.n13,f.n44+f.n14);B[2].set(f.n41+f.n21,f.n42+f.n22,f.n43+f.n23,f.n44+f.n24);B[3].set(f.n41-f.n21,f.n42-f.n22,f.n43-f.n23,f.n44-f.n24);B[4].set(f.n41-f.n31,f.n42-f.n32,f.n43-f.n33,f.n44-f.n34);B[5].set(f.n41+f.n31,f.n42+f.n32,f.n43+f.n33,
-f.n44+f.n34);var m;for(f=0;f<5;f++){m=B[f];m.divideScalar(Math.sqrt(m.x*m.x+m.y*m.y+m.z*m.z))}}function o(f){for(var m=f.globalMatrix,p=-f.geometry.boundingSphere.radius*Math.max(f.scale.x,Math.max(f.scale.y,f.scale.z)),j=0;j<6;j++){f=B[j].x*m.n14+B[j].y*m.n24+B[j].z*m.n34+B[j].w;if(f<=p)return!1}return!0}function s(f,m){f.list[f.count]=m;f.count+=1}function w(f){var m,p,j=f.object,h=f.opaque,q=f.transparent;q.count=0;f=h.count=0;for(m=j.materials.length;f<m;f++){p=j.materials[f];p.opacity&&p.opacity<
-1||p.blending!=THREE.NormalBlending?s(q,p):s(h,p)}}function t(f){var m,p,j,h,q=f.object,v=f.buffer,C=f.opaque,W=f.transparent;W.count=0;f=C.count=0;for(j=q.materials.length;f<j;f++){m=q.materials[f];if(m instanceof THREE.MeshFaceMaterial){m=0;for(p=v.materials.length;m<p;m++)(h=v.materials[m])&&(h.opacity&&h.opacity<1||h.blending!=THREE.NormalBlending?s(W,h):s(C,h))}else{h=m;h.opacity&&h.opacity<1||h.blending!=THREE.NormalBlending?s(W,h):s(C,h)}}}function x(f,m){return m.z-f.z}function F(f,m,p,j,
-h){if(m[p]==undefined){f.push({buffer:j,object:h,opaque:{list:[],count:0},transparent:{list:[],count:0}});m[p]=1}}function H(f,m){f._modelViewMatrix.multiplyToArray(m.globalMatrix,f.globalMatrix,f._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(f._modelViewMatrix).transposeIntoArray(f._normalMatrixArray)}function G(f){if(f!=aa){switch(f){case THREE.AdditiveBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.ONE,d.ONE);break;case THREE.SubtractiveBlending:d.blendFunc(d.DST_COLOR,d.ZERO);break;case THREE.BillboardBlending:d.blendEquation(d.FUNC_ADD);
-d.blendFunc(d.SRC_ALPHA,d.ONE_MINUS_SRC_ALPHA);break;default:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.ONE,d.ONE_MINUS_SRC_ALPHA)}aa=f}}function r(f,m){if(f&&!f.__webGLFramebuffer){f.__webGLFramebuffer=d.createFramebuffer();f.__webGLRenderbuffer=d.createRenderbuffer();f.__webGLTexture=d.createTexture();d.bindRenderbuffer(d.RENDERBUFFER,f.__webGLRenderbuffer);d.renderbufferStorage(d.RENDERBUFFER,d.DEPTH_COMPONENT16,f.width,f.height);d.bindTexture(d.TEXTURE_2D,f.__webGLTexture);d.texParameteri(d.TEXTURE_2D,
-d.TEXTURE_WRAP_S,D(f.wrap_s));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_T,D(f.wrap_t));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MAG_FILTER,D(f.mag_filter));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MIN_FILTER,D(f.min_filter));d.texImage2D(d.TEXTURE_2D,0,D(f.format),f.width,f.height,0,D(f.format),D(f.type),null);d.bindFramebuffer(d.FRAMEBUFFER,f.__webGLFramebuffer);d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0,d.TEXTURE_2D,f.__webGLTexture,0);d.framebufferRenderbuffer(d.FRAMEBUFFER,d.DEPTH_ATTACHMENT,
-d.RENDERBUFFER,f.__webGLRenderbuffer);d.bindTexture(d.TEXTURE_2D,null);d.bindRenderbuffer(d.RENDERBUFFER,null);d.bindFramebuffer(d.FRAMEBUFFER,null)}var p,j,h;if(f){p=f.__webGLFramebuffer;j=f.width;h=f.height}else{p=null;j=K.width;h=K.height}if(p!=T){d.bindFramebuffer(d.FRAMEBUFFER,p);d.viewport(0,0,j,h);m&&d.clear(d.COLOR_BUFFER_BIT|d.DEPTH_BUFFER_BIT);T=p}}function Z(f,m){var p;if(f=="fragment")p=d.createShader(d.FRAGMENT_SHADER);else f=="vertex"&&(p=d.createShader(d.VERTEX_SHADER));d.shaderSource(p,
-m);d.compileShader(p);if(!d.getShaderParameter(p,d.COMPILE_STATUS)){alert(d.getShaderInfoLog(p));return null}return p}function D(f){switch(f){case THREE.RepeatWrapping:return d.REPEAT;case THREE.ClampToEdgeWrapping:return d.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return d.MIRRORED_REPEAT;case THREE.NearestFilter:return d.NEAREST;case THREE.NearestMipMapNearestFilter:return d.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return d.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return d.LINEAR;
-case THREE.LinearMipMapNearestFilter:return d.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return d.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return d.BYTE;case THREE.UnsignedByteType:return d.UNSIGNED_BYTE;case THREE.ShortType:return d.SHORT;case THREE.UnsignedShortType:return d.UNSIGNED_SHORT;case THREE.IntType:return d.INT;case THREE.UnsignedShortType:return d.UNSIGNED_INT;case THREE.FloatType:return d.FLOAT;case THREE.AlphaFormat:return d.ALPHA;case THREE.RGBFormat:return d.RGB;case THREE.RGBAFormat:return d.RGBA;
-case THREE.LuminanceFormat:return d.LUMINANCE;case THREE.LuminanceAlphaFormat:return d.LUMINANCE_ALPHA}return 0}var K=document.createElement("canvas"),d,ga=null,T=null,N=this,ba=null,R=null,aa=null,V=null,B=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],I=new THREE.Matrix4,ka=new Float32Array(16),P=new Float32Array(16),ja=new Float32Array(16),ca=new THREE.Vector4,Q=!0,ra=new THREE.Color(0),wa=0;if(a){if(a.antialias!==undefined)Q=a.antialias;
-a.clearColor!==undefined&&ra.setHex(a.clearColor);if(a.clearAlpha!==undefined)wa=a.clearAlpha}this.domElement=K;this.autoClear=!0;this.sortObjects=!1;(function(f,m,p){try{d=K.getContext("experimental-webgl",{antialias:f})}catch(j){console.log(j)}if(!d){alert("WebGL not supported");throw"cannot create webgl context";}d.clearColor(0,0,0,1);d.clearDepth(1);d.enable(d.DEPTH_TEST);d.depthFunc(d.LEQUAL);d.frontFace(d.CCW);d.cullFace(d.BACK);d.enable(d.CULL_FACE);d.enable(d.BLEND);d.blendFunc(d.ONE,d.ONE_MINUS_SRC_ALPHA);
-d.clearColor(m.r,m.g,m.b,p);_cullEnabled=!0})(Q,ra,wa);this.context=d;this.lights={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}};this.setSize=function(f,m){K.width=f;K.height=m;d.viewport(0,0,K.width,K.height)};this.setClearColorHex=function(f,m){var p=new THREE.Color(f);d.clearColor(p.r,p.g,p.b,m)};this.setClearColor=function(f,m){d.clearColor(f.r,f.g,f.b,m)};this.clear=function(){d.clear(d.COLOR_BUFFER_BIT|d.DEPTH_BUFFER_BIT)};this.initMaterial=
-function(f,m,p){var j,h;if(f instanceof THREE.MeshDepthMaterial)c(f,THREE.ShaderLib.depth);else if(f instanceof THREE.MeshNormalMaterial)c(f,THREE.ShaderLib.normal);else if(f instanceof THREE.MeshBasicMaterial)c(f,THREE.ShaderLib.basic);else if(f instanceof THREE.MeshLambertMaterial)c(f,THREE.ShaderLib.lambert);else if(f instanceof THREE.MeshPhongMaterial)c(f,THREE.ShaderLib.phong);else if(f instanceof THREE.LineBasicMaterial)c(f,THREE.ShaderLib.basic);else f instanceof THREE.ParticleBasicMaterial&&
-c(f,THREE.ShaderLib.particle_basic);var q,v,C,W;h=C=W=0;for(q=m.length;h<q;h++){v=m[h];v instanceof THREE.DirectionalLight&&C++;v instanceof THREE.PointLight&&W++}if(W+C<=4)m=C;else{m=Math.ceil(4*C/(W+C));W=4-m}h={directional:m,point:W};W=f.fragment_shader;m=f.vertex_shader;q={fog:p,map:f.map,env_map:f.env_map,light_map:f.light_map,vertex_colors:f.vertex_colors,skinning:f.skinning,maxDirLights:h.directional,maxPointLights:h.point};p=d.createProgram();h=["#ifdef GL_ES\nprecision highp float;\n#endif",
-"#define MAX_DIR_LIGHTS "+q.maxDirLights,"#define MAX_POINT_LIGHTS "+q.maxPointLights,q.fog?"#define USE_FOG":"",q.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",q.map?"#define USE_MAP":"",q.env_map?"#define USE_ENVMAP":"",q.light_map?"#define USE_LIGHTMAP":"",q.vertex_colors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");q=[d.getParameter(d.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+q.maxDirLights,"#define MAX_POINT_LIGHTS "+
-q.maxPointLights,q.map?"#define USE_MAP":"",q.env_map?"#define USE_ENVMAP":"",q.light_map?"#define USE_LIGHTMAP":"",q.vertex_colors?"#define USE_COLOR":"",q.skinning?"#define USE_SKINNING":"","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 vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n");
-d.attachShader(p,Z("fragment",h+W));d.attachShader(p,Z("vertex",q+m));d.linkProgram(p);d.getProgramParameter(p,d.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+d.getProgramParameter(p,d.VALIDATE_STATUS)+", gl error ["+d.getError()+"]");p.uniforms={};p.attributes={};f.program=p;p=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","uBoneGlobalMatrices"];for(j in f.uniforms)p.push(j);j=f.program;W=0;for(m=p.length;W<
-m;W++){h=p[W];j.uniforms[h]=d.getUniformLocation(j,h)}j=f.program;p=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];W=0;for(m=p.length;W<m;W++){h=p[W];j.attributes[h]=d.getAttribLocation(j,h)}j=f.program.attributes;d.enableVertexAttribArray(j.position);j.color>=0&&d.enableVertexAttribArray(j.color);j.normal>=0&&d.enableVertexAttribArray(j.normal);j.tangent>=0&&d.enableVertexAttribArray(j.tangent);if(f.skinning&&j.skinVertexA>=0&&j.skinVertexB>=
-0&&j.skinIndex>=0&&j.skinWeight>=0){d.enableVertexAttribArray(j.skinVertexA);d.enableVertexAttribArray(j.skinVertexB);d.enableVertexAttribArray(j.skinIndex);d.enableVertexAttribArray(j.skinWeight)}};this.render=function(f,m,p,j){var h,q,v,C,W,L,S,E,da=f.lights,ea=f.fog;m.autoUpdateMatrix&&m.update();m.globalMatrix.flattenToArray(ja);m.projectionMatrix.flattenToArray(ka);m.inverseMatrix.flattenToArray(P);I.multiply(m.projectionMatrix,m.globalMatrix);k(I);THREE.AnimationHandler&&THREE.AnimationHandler.update();
-f.update(undefined,!1,m);this.initWebGLObjects(f,m);r(p,j!==undefined?j:!0);this.autoClear&&this.clear();W=f.__webGLObjects.length;for(j=0;j<W;j++){h=f.__webGLObjects[j];S=h.object;if(S.visible)if(!(S instanceof THREE.Mesh)||o(S)){S.globalMatrix.flattenToArray(S._objectMatrixArray);H(S,m);t(h);h.render=!0;if(this.sortObjects){ca.copy(S.position);I.multiplyVector3(ca);h.z=ca.z}}else h.render=!1;else h.render=!1}this.sortObjects&&f.__webGLObjects.sort(x);L=f.__webGLObjectsImmediate.length;for(j=0;j<
-L;j++){h=f.__webGLObjectsImmediate[j];S=h.object;if(S.visible){S.autoUpdateMatrix&&S.globalMatrix.flattenToArray(S._objectMatrixArray);H(S,m);w(h)}}G(THREE.NormalBlending);for(j=0;j<W;j++){h=f.__webGLObjects[j];if(h.render){S=h.object;E=h.buffer;v=h.opaque;l(S);for(h=0;h<v.count;h++){C=v.list[h];n(C.depth_test);g(m,da,ea,C,E,S)}}}for(j=0;j<L;j++){h=f.__webGLObjectsImmediate[j];S=h.object;if(S.visible){v=h.opaque;l(S);for(h=0;h<v.count;h++){C=v.list[h];n(C.depth_test);q=e(m,da,ea,C,S);S.render(function(va){i(va,
-q)})}}}for(j=0;j<W;j++){h=f.__webGLObjects[j];if(h.render){S=h.object;E=h.buffer;v=h.transparent;l(S);for(h=0;h<v.count;h++){C=v.list[h];G(C.blending);n(C.depth_test);g(m,da,ea,C,E,S)}}}for(j=0;j<L;j++){h=f.__webGLObjectsImmediate[j];S=h.object;if(S.visible){v=h.transparent;l(S);for(h=0;h<v.count;h++){C=v.list[h];G(C.blending);n(C.depth_test);q=e(m,da,ea,C,S);S.render(function(va){i(va,q)})}}}if(p&&p.min_filter!==THREE.NearestFilter&&p.min_filter!==THREE.LinearFilter){d.bindTexture(d.TEXTURE_2D,p.__webGLTexture);
-d.generateMipmap(d.TEXTURE_2D);d.bindTexture(d.TEXTURE_2D,null)}};this.initWebGLObjects=function(f){var m,p,j;if(!f.__webGLObjects){f.__webGLObjects=[];f.__webGLObjectsMap={};f.__webGLObjectsImmediate=[]}m=0;for(p=f.objects.length;m<p;m++){j=f.objects[m];var h=f,q=void 0,v=void 0,C=void 0,W=void 0;v=j.geometry;if(h.__webGLObjectsMap[j.id]==undefined){h.__webGLObjectsMap[j.id]={};j._modelViewMatrix=new THREE.Matrix4;j._normalMatrixArray=new Float32Array(9);j._modelViewMatrixArray=new Float32Array(16);
-j._objectMatrixArray=new Float32Array(16);j.globalMatrix.flattenToArray(j._objectMatrixArray)}W=h.__webGLObjectsMap[j.id];objlist=h.__webGLObjects;if(j instanceof THREE.Mesh){for(q in v.geometryChunks){C=v.geometryChunks[q];if(!C.__webGLVertexBuffer){h=C;h.__webGLVertexBuffer=d.createBuffer();h.__webGLNormalBuffer=d.createBuffer();h.__webGLTangentBuffer=d.createBuffer();h.__webGLColorBuffer=d.createBuffer();h.__webGLUVBuffer=d.createBuffer();h.__webGLUV2Buffer=d.createBuffer();h.__webGLSkinVertexABuffer=
-d.createBuffer();h.__webGLSkinVertexBBuffer=d.createBuffer();h.__webGLSkinIndicesBuffer=d.createBuffer();h.__webGLSkinWeightsBuffer=d.createBuffer();h.__webGLFaceBuffer=d.createBuffer();h.__webGLLineBuffer=d.createBuffer();h=C;var L=j,S=void 0,E=void 0,da=0,ea=0,va=0,la=L.geometry.faces,ha=h.faces;S=0;for(E=ha.length;S<E;S++){fi=ha[S];face=la[fi];if(face instanceof THREE.Face3){da+=3;ea+=1;va+=3}else if(face instanceof THREE.Face4){da+=4;ea+=2;va+=4}}h.__vertexArray=new Float32Array(da*3);h.__normalArray=
-new Float32Array(da*3);h.__tangentArray=new Float32Array(da*4);h.__colorArray=new Float32Array(da*3);h.__uvArray=new Float32Array(da*2);h.__uv2Array=new Float32Array(da*2);h.__skinVertexAArray=new Float32Array(da*4);h.__skinVertexBArray=new Float32Array(da*4);h.__skinIndexArray=new Float32Array(da*4);h.__skinWeightArray=new Float32Array(da*4);h.__faceArray=new Uint16Array(ea*3);h.__lineArray=new Uint16Array(va*2);E=S=h;da=void 0;la=void 0;var ia=void 0,fa=void 0;ia=void 0;ha=!1;da=0;for(la=L.materials.length;da<
-la;da++){ia=L.materials[da];if(ia instanceof THREE.MeshFaceMaterial){ia=0;for(fa=E.materials.length;ia<fa;ia++)if(E.materials[ia]&&E.materials[ia].shading!=undefined&&E.materials[ia].shading==THREE.SmoothShading){ha=!0;break}}else if(ia&&ia.shading!=undefined&&ia.shading==THREE.SmoothShading){ha=!0;break}if(ha)break}S.__needsSmoothNormals=ha;h.__webGLFaceCount=ea*3;h.__webGLLineCount=va*2;v.__dirtyVertices=!0;v.__dirtyElements=!0;v.__dirtyUvs=!0;v.__dirtyNormals=!0;v.__dirtyTangents=!0;v.__dirtyColors=
-!0}if(v.__dirtyVertices||v.__dirtyElements||v.__dirtyUvs||v.__dirtyNormals||v.__dirtyColors||v.__dirtyTangents){h=C;ea=d.DYNAMIC_DRAW;va=void 0;S=void 0;var na=void 0,y=void 0,Fa=void 0,za=void 0,Ga=void 0;na=void 0;var O=void 0,M=void 0,J=void 0,oa=void 0;O=void 0;M=void 0;J=void 0;y=void 0;O=void 0;M=void 0;J=void 0;oa=void 0;O=void 0;M=void 0;J=void 0;oa=void 0;O=void 0;M=void 0;J=void 0;oa=void 0;O=void 0;M=void 0;J=void 0;oa=void 0;O=void 0;M=void 0;J=void 0;oa=void 0;y=void 0;za=void 0;Fa=void 0;
-Ga=void 0;var Ca=fa=ia=ha=la=da=L=E=0,Aa=0,u=0,Ba=h.__vertexArray,Oa=h.__uvArray,Ma=h.__uv2Array,Ha=h.__normalArray,$=h.__tangentArray,sa=h.__colorArray,pa=h.__skinVertexAArray,ta=h.__skinVertexBArray,ua=h.__skinIndexArray,qa=h.__skinWeightArray,z=h.__faceArray,X=h.__lineArray,Y=h.__needsSmoothNormals,A=j.geometry,U=A.__dirtyVertices,ma=A.__dirtyElements,xa=A.__dirtyUvs,Da=A.__dirtyNormals,Ea=A.__dirtyTangents,Ia=A.__dirtyColors,ya=A.vertices,Ja=h.faces,Qa=A.faces,Ka=A.uvs,La=A.uvs2,Na=A.colors,Ra=
-A.skinVerticesA,Sa=A.skinVerticesB,Ta=A.skinIndices,Pa=A.skinWeights;va=0;for(S=Ja.length;va<S;va++){na=Ja[va];y=Qa[na];Ga=Ka[na];na=La[na];Fa=y.vertexNormals;za=y.normal;if(y instanceof THREE.Face3){if(U){O=ya[y.a].position;M=ya[y.b].position;J=ya[y.c].position;Ba[L]=O.x;Ba[L+1]=O.y;Ba[L+2]=O.z;Ba[L+3]=M.x;Ba[L+4]=M.y;Ba[L+5]=M.z;Ba[L+6]=J.x;Ba[L+7]=J.y;Ba[L+8]=J.z;L+=9}if(Pa.length){O=Pa[y.a];M=Pa[y.b];J=Pa[y.c];qa[u]=O.x;qa[u+1]=O.y;qa[u+2]=O.z;qa[u+3]=O.w;qa[u+4]=M.x;qa[u+5]=M.y;qa[u+6]=M.z;qa[u+
-7]=M.w;qa[u+8]=J.x;qa[u+9]=J.y;qa[u+10]=J.z;qa[u+11]=J.w;O=Ta[y.a];M=Ta[y.b];J=Ta[y.c];ua[u]=O.x;ua[u+1]=O.y;ua[u+2]=O.z;ua[u+3]=O.w;ua[u+4]=M.x;ua[u+5]=M.y;ua[u+6]=M.z;ua[u+7]=M.w;ua[u+8]=J.x;ua[u+9]=J.y;ua[u+10]=J.z;ua[u+11]=J.w;O=Ra[y.a];M=Ra[y.b];J=Ra[y.c];pa[u]=O.x;pa[u+1]=O.y;pa[u+2]=O.z;pa[u+3]=1;pa[u+4]=M.x;pa[u+5]=M.y;pa[u+6]=M.z;pa[u+7]=1;pa[u+8]=J.x;pa[u+9]=J.y;pa[u+10]=J.z;pa[u+11]=1;O=Sa[y.a];M=Sa[y.b];J=Sa[y.c];ta[u]=O.x;ta[u+1]=O.y;ta[u+2]=O.z;ta[u+3]=1;ta[u+4]=M.x;ta[u+5]=M.y;ta[u+
-6]=M.z;ta[u+7]=1;ta[u+8]=J.x;ta[u+9]=J.y;ta[u+10]=J.z;ta[u+11]=1;u+=12}if(Ia&&Na.length){O=Na[y.a];M=Na[y.b];J=Na[y.c];sa[Aa]=O.r;sa[Aa+1]=O.g;sa[Aa+2]=O.b;sa[Aa+3]=M.r;sa[Aa+4]=M.g;sa[Aa+5]=M.b;sa[Aa+6]=J.r;sa[Aa+7]=J.g;sa[Aa+8]=J.b;Aa+=9}if(Ea&&A.hasTangents){O=ya[y.a].tangent;M=ya[y.b].tangent;J=ya[y.c].tangent;$[fa]=O.x;$[fa+1]=O.y;$[fa+2]=O.z;$[fa+3]=O.w;$[fa+4]=M.x;$[fa+5]=M.y;$[fa+6]=M.z;$[fa+7]=M.w;$[fa+8]=J.x;$[fa+9]=J.y;$[fa+10]=J.z;$[fa+11]=J.w;fa+=12}if(Da)if(Fa.length==3&&Y)for(y=0;y<
-3;y++){za=Fa[y];Ha[ia]=za.x;Ha[ia+1]=za.y;Ha[ia+2]=za.z;ia+=3}else for(y=0;y<3;y++){Ha[ia]=za.x;Ha[ia+1]=za.y;Ha[ia+2]=za.z;ia+=3}if(xa&&Ga)for(y=0;y<3;y++){Fa=Ga[y];Oa[da]=Fa.u;Oa[da+1]=Fa.v;da+=2}if(xa&&na)for(y=0;y<3;y++){Ga=na[y];Ma[la]=Ga.u;Ma[la+1]=Ga.v;la+=2}if(ma){z[ha]=E;z[ha+1]=E+1;z[ha+2]=E+2;ha+=3;X[Ca]=E;X[Ca+1]=E+1;X[Ca+2]=E;X[Ca+3]=E+2;X[Ca+4]=E+1;X[Ca+5]=E+2;Ca+=6;E+=3}}else if(y instanceof THREE.Face4){if(U){O=ya[y.a].position;M=ya[y.b].position;J=ya[y.c].position;oa=ya[y.d].position;
-Ba[L]=O.x;Ba[L+1]=O.y;Ba[L+2]=O.z;Ba[L+3]=M.x;Ba[L+4]=M.y;Ba[L+5]=M.z;Ba[L+6]=J.x;Ba[L+7]=J.y;Ba[L+8]=J.z;Ba[L+9]=oa.x;Ba[L+10]=oa.y;Ba[L+11]=oa.z;L+=12}if(Pa.length){O=Pa[y.a];M=Pa[y.b];J=Pa[y.c];oa=Pa[y.d];qa[u]=O.x;qa[u+1]=O.y;qa[u+2]=O.z;qa[u+3]=O.w;qa[u+4]=M.x;qa[u+5]=M.y;qa[u+6]=M.z;qa[u+7]=M.w;qa[u+8]=J.x;qa[u+9]=J.y;qa[u+10]=J.z;qa[u+11]=J.w;qa[u+12]=oa.x;qa[u+13]=oa.y;qa[u+14]=oa.z;qa[u+15]=oa.w;O=Ta[y.a];M=Ta[y.b];J=Ta[y.c];oa=Ta[y.d];ua[u]=O.x;ua[u+1]=O.y;ua[u+2]=O.z;ua[u+3]=O.w;ua[u+4]=
-M.x;ua[u+5]=M.y;ua[u+6]=M.z;ua[u+7]=M.w;ua[u+8]=J.x;ua[u+9]=J.y;ua[u+10]=J.z;ua[u+11]=J.w;ua[u+12]=oa.x;ua[u+13]=oa.y;ua[u+14]=oa.z;ua[u+15]=oa.w;O=Ra[y.a];M=Ra[y.b];J=Ra[y.c];oa=Ra[y.d];pa[u]=O.x;pa[u+1]=O.y;pa[u+2]=O.z;pa[u+3]=1;pa[u+4]=M.x;pa[u+5]=M.y;pa[u+6]=M.z;pa[u+7]=1;pa[u+8]=J.x;pa[u+9]=J.y;pa[u+10]=J.z;pa[u+11]=1;pa[u+12]=oa.x;pa[u+13]=oa.y;pa[u+14]=oa.z;pa[u+15]=1;O=Sa[y.a];M=Sa[y.b];J=Sa[y.c];oa=Sa[y.d];ta[u]=O.x;ta[u+1]=O.y;ta[u+2]=O.z;ta[u+3]=1;ta[u+4]=M.x;ta[u+5]=M.y;ta[u+6]=M.z;ta[u+
-7]=1;ta[u+8]=J.x;ta[u+9]=J.y;ta[u+10]=J.z;ta[u+11]=1;ta[u+12]=oa.x;ta[u+13]=oa.y;ta[u+14]=oa.z;ta[u+15]=1;u+=16}if(Ia&&Na.length){O=Na[y.a];M=Na[y.b];J=Na[y.c];oa=Na[y.d];sa[Aa]=O.r;sa[Aa+1]=O.g;sa[Aa+2]=O.b;sa[Aa+3]=M.r;sa[Aa+4]=M.g;sa[Aa+5]=M.b;sa[Aa+6]=J.r;sa[Aa+7]=J.g;sa[Aa+8]=J.b;sa[Aa+9]=oa.r;sa[Aa+10]=oa.g;sa[Aa+11]=oa.b;Aa+=12}if(Ea&&A.hasTangents){O=ya[y.a].tangent;M=ya[y.b].tangent;J=ya[y.c].tangent;y=ya[y.d].tangent;$[fa]=O.x;$[fa+1]=O.y;$[fa+2]=O.z;$[fa+3]=O.w;$[fa+4]=M.x;$[fa+5]=M.y;
-$[fa+6]=M.z;$[fa+7]=M.w;$[fa+8]=J.x;$[fa+9]=J.y;$[fa+10]=J.z;$[fa+11]=J.w;$[fa+12]=y.x;$[fa+13]=y.y;$[fa+14]=y.z;$[fa+15]=y.w;fa+=16}if(Da)if(Fa.length==4&&Y)for(y=0;y<4;y++){za=Fa[y];Ha[ia]=za.x;Ha[ia+1]=za.y;Ha[ia+2]=za.z;ia+=3}else for(y=0;y<4;y++){Ha[ia]=za.x;Ha[ia+1]=za.y;Ha[ia+2]=za.z;ia+=3}if(xa&&Ga)for(y=0;y<4;y++){Fa=Ga[y];Oa[da]=Fa.u;Oa[da+1]=Fa.v;da+=2}if(xa&&na)for(y=0;y<4;y++){Ga=na[y];Ma[la]=Ga.u;Ma[la+1]=Ga.v;la+=2}if(ma){z[ha]=E;z[ha+1]=E+1;z[ha+2]=E+2;z[ha+3]=E;z[ha+4]=E+2;z[ha+5]=
-E+3;ha+=6;X[Ca]=E;X[Ca+1]=E+1;X[Ca+2]=E;X[Ca+3]=E+3;X[Ca+4]=E+1;X[Ca+5]=E+2;X[Ca+6]=E+2;X[Ca+7]=E+3;Ca+=8;E+=4}}}if(U){d.bindBuffer(d.ARRAY_BUFFER,h.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,Ba,ea)}if(Ia&&Na.length){d.bindBuffer(d.ARRAY_BUFFER,h.__webGLColorBuffer);d.bufferData(d.ARRAY_BUFFER,sa,ea)}if(Da){d.bindBuffer(d.ARRAY_BUFFER,h.__webGLNormalBuffer);d.bufferData(d.ARRAY_BUFFER,Ha,ea)}if(Ea&&A.hasTangents){d.bindBuffer(d.ARRAY_BUFFER,h.__webGLTangentBuffer);d.bufferData(d.ARRAY_BUFFER,
-$,ea)}if(xa&&da>0){d.bindBuffer(d.ARRAY_BUFFER,h.__webGLUVBuffer);d.bufferData(d.ARRAY_BUFFER,Oa,ea)}if(xa&&la>0){d.bindBuffer(d.ARRAY_BUFFER,h.__webGLUV2Buffer);d.bufferData(d.ARRAY_BUFFER,Ma,ea)}if(ma){d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,h.__webGLFaceBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,z,ea);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,h.__webGLLineBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,X,ea)}if(u>0){d.bindBuffer(d.ARRAY_BUFFER,h.__webGLSkinVertexABuffer);d.bufferData(d.ARRAY_BUFFER,pa,ea);
-d.bindBuffer(d.ARRAY_BUFFER,h.__webGLSkinVertexBBuffer);d.bufferData(d.ARRAY_BUFFER,ta,ea);d.bindBuffer(d.ARRAY_BUFFER,h.__webGLSkinIndicesBuffer);d.bufferData(d.ARRAY_BUFFER,ua,ea);d.bindBuffer(d.ARRAY_BUFFER,h.__webGLSkinWeightsBuffer);d.bufferData(d.ARRAY_BUFFER,qa,ea)}}F(objlist,W,q,C,j)}v.__dirtyVertices=!1;v.__dirtyElements=!1;v.__dirtyUvs=!1;v.__dirtyNormals=!1;v.__dirtyTangents=!1;v.__dirtyColors=!1}else if(j instanceof THREE.Line){if(!v.__webGLVertexBuffer){q=v;q.__webGLVertexBuffer=d.createBuffer();
-q.__webGLColorBuffer=d.createBuffer();q=v;C=q.vertices.length;q.__vertexArray=new Float32Array(C*3);q.__colorArray=new Float32Array(C*3);q.__webGLLineCount=C;v.__dirtyVertices=!0;v.__dirtyColors=!0}if(v.__dirtyVertices||v.__dirtyColors){q=v;C=d.DYNAMIC_DRAW;E=void 0;E=void 0;L=void 0;h=void 0;da=q.vertices;ea=q.colors;la=da.length;va=ea.length;ha=q.__vertexArray;S=q.__colorArray;ia=q.__dirtyColors;if(q.__dirtyVertices){for(E=0;E<la;E++){L=da[E].position;h=E*3;ha[h]=L.x;ha[h+1]=L.y;ha[h+2]=L.z}d.bindBuffer(d.ARRAY_BUFFER,
-q.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,ha,C)}if(ia){for(E=0;E<va;E++){color=ea[E];h=E*3;S[h]=color.r;S[h+1]=color.g;S[h+2]=color.b}d.bindBuffer(d.ARRAY_BUFFER,q.__webGLColorBuffer);d.bufferData(d.ARRAY_BUFFER,S,C)}}F(objlist,W,0,v,j);v.__dirtyVertices=!1;v.__dirtyColors=!1}else if(j instanceof THREE.ParticleSystem){if(!v.__webGLVertexBuffer){q=v;q.__webGLVertexBuffer=d.createBuffer();q.__webGLColorBuffer=d.createBuffer();q=v;C=q.vertices.length;q.__vertexArray=new Float32Array(C*3);q.__colorArray=
-new Float32Array(C*3);q.__sortArray=[];q.__webGLParticleCount=C;v.__dirtyVertices=!0;v.__dirtyColors=!0}(v.__dirtyVertices||v.__dirtyColors||j.sortParticles)&&b(v,d.DYNAMIC_DRAW,j,camera);F(objlist,W,0,v,j);v.__dirtyVertices=!1;v.__dirtyColors=!1}else if(j instanceof THREE.MarchingCubes){v=W;if(v[0]==undefined){h.__webGLObjectsImmediate.push({object:j,opaque:{list:[],count:0},transparent:{list:[],count:0}});v[0]=1}}}};this.removeObject=function(f,m){var p,j;for(p=f.__webGLObjects.length-1;p>=0;p--){j=
-f.__webGLObjects[p].object;m==j&&f.__webGLObjects.splice(p,1)}};this.setFaceCulling=function(f,m){if(f){!m||m=="ccw"?d.frontFace(d.CCW):d.frontFace(d.CW);if(f=="back")d.cullFace(d.BACK);else f=="front"?d.cullFace(d.FRONT):d.cullFace(d.FRONT_AND_BACK);d.enable(d.CULL_FACE)}else d.disable(d.CULL_FACE)};this.supportsVertexTextures=function(){return d.getParameter(d.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};
+THREE.SVGRenderer=function(){function a(ea,R,ra){var wa,f,m,p;wa=0;for(f=ea.lights.length;wa<f;wa++){m=ea.lights[wa];if(m instanceof THREE.DirectionalLight){p=R.normalWorld.dot(m.position)*m.intensity;if(p>0){ra.r+=m.color.r*p;ra.g+=m.color.g*p;ra.b+=m.color.b*p}}else if(m instanceof THREE.PointLight){ca.sub(m.position,R.centroidWorld);ca.normalize();p=R.normalWorld.dot(ca)*m.intensity;if(p>0){ra.r+=m.color.r*p;ra.g+=m.color.g*p;ra.b+=m.color.b*p}}}}function b(ea,R,ra,wa,f,m){D=e(J++);D.setAttribute("d","M "+
+ea.positionScreen.x+" "+ea.positionScreen.y+" L "+R.positionScreen.x+" "+R.positionScreen.y+" L "+ra.positionScreen.x+","+ra.positionScreen.y+"z");if(f instanceof THREE.MeshBasicMaterial)E.__styleString=f.color.__styleString;else if(f instanceof THREE.MeshLambertMaterial)if(Z){L.r=c.r;L.g=c.g;L.b=c.b;a(m,wa,L);E.r=f.color.r*L.r;E.g=f.color.g*L.g;E.b=f.color.b*L.b;E.updateStyleString()}else E.__styleString=f.color.__styleString;else if(f instanceof THREE.MeshDepthMaterial){O=1-f.__2near/(f.__farPlusNear-
+wa.z*f.__farMinusNear);E.setRGB(O,O,O)}else f instanceof THREE.MeshNormalMaterial&&E.setRGB(g(wa.normalWorld.x),g(wa.normalWorld.y),g(wa.normalWorld.z));f.wireframe?D.setAttribute("style","fill: none; stroke: "+E.__styleString+"; stroke-width: "+f.wireframe_linewidth+"; stroke-opacity: "+f.opacity+"; stroke-linecap: "+f.wireframe_linecap+"; stroke-linejoin: "+f.wireframe_linejoin):D.setAttribute("style","fill: "+E.__styleString+"; fill-opacity: "+f.opacity);n.appendChild(D)}function d(ea,R,ra,wa,
+f,m,p){D=e(J++);D.setAttribute("d","M "+ea.positionScreen.x+" "+ea.positionScreen.y+" L "+R.positionScreen.x+" "+R.positionScreen.y+" L "+ra.positionScreen.x+","+ra.positionScreen.y+" L "+wa.positionScreen.x+","+wa.positionScreen.y+"z");if(m instanceof THREE.MeshBasicMaterial)E.__styleString=m.color.__styleString;else if(m instanceof THREE.MeshLambertMaterial)if(Z){L.r=c.r;L.g=c.g;L.b=c.b;a(p,f,L);E.r=m.color.r*L.r;E.g=m.color.g*L.g;E.b=m.color.b*L.b;E.updateStyleString()}else E.__styleString=m.color.__styleString;
+else if(m instanceof THREE.MeshDepthMaterial){O=1-m.__2near/(m.__farPlusNear-f.z*m.__farMinusNear);E.setRGB(O,O,O)}else m instanceof THREE.MeshNormalMaterial&&E.setRGB(g(f.normalWorld.x),g(f.normalWorld.y),g(f.normalWorld.z));m.wireframe?D.setAttribute("style","fill: none; stroke: "+E.__styleString+"; stroke-width: "+m.wireframe_linewidth+"; stroke-opacity: "+m.opacity+"; stroke-linecap: "+m.wireframe_linecap+"; stroke-linejoin: "+m.wireframe_linejoin):D.setAttribute("style","fill: "+E.__styleString+
+"; fill-opacity: "+m.opacity);n.appendChild(D)}function e(ea){if(S[ea]==null){S[ea]=document.createElementNS("http://www.w3.org/2000/svg","path");ja==0&&S[ea].setAttribute("shape-rendering","crispEdges")}return S[ea]}function g(ea){return ea<0?Math.min((1+ea)*0.5,0.5):0.5+Math.min(ea*0.5,0.5)}var i=null,l=new THREE.Projector,n=document.createElementNS("http://www.w3.org/2000/svg","svg"),k,o,s,w,u,x,F,I,H=new THREE.Rectangle,r=new THREE.Rectangle,Z=!1,E=new THREE.Color(16777215),L=new THREE.Color(16777215),
+c=new THREE.Color(0),ia=new THREE.Color(0),T=new THREE.Color(0),O,ca=new THREE.Vector3,S=[],ba=[],V=[],D,J,la,Q,ja=1;this.domElement=n;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(ea){switch(ea){case "high":ja=1;break;case "low":ja=0}};this.setSize=function(ea,R){k=ea;o=R;s=k/2;w=o/2;n.setAttribute("viewBox",-s+" "+-w+" "+k+" "+o);n.setAttribute("width",k);n.setAttribute("height",o);H.set(-s,-w,s,w)};this.clear=function(){for(;n.childNodes.length>0;)n.removeChild(n.childNodes[0])};
+this.render=function(ea,R){var ra,wa,f,m,p,j,h,q;this.autoClear&&this.clear();i=l.projectScene(ea,R,this.sortElements);Q=la=J=0;if(Z=ea.lights.length>0){h=ea.lights;c.setRGB(0,0,0);ia.setRGB(0,0,0);T.setRGB(0,0,0);ra=0;for(wa=h.length;ra<wa;ra++){f=h[ra];m=f.color;if(f instanceof THREE.AmbientLight){c.r+=m.r;c.g+=m.g;c.b+=m.b}else if(f instanceof THREE.DirectionalLight){ia.r+=m.r;ia.g+=m.g;ia.b+=m.b}else if(f instanceof THREE.PointLight){T.r+=m.r;T.g+=m.g;T.b+=m.b}}}ra=0;for(wa=i.length;ra<wa;ra++){h=
+i[ra];r.empty();if(h instanceof THREE.RenderableParticle){u=h;u.x*=s;u.y*=-w;f=0;for(m=h.materials.length;f<m;f++)if(q=h.materials[f]){p=u;j=h;var t=la++;if(ba[t]==null){ba[t]=document.createElementNS("http://www.w3.org/2000/svg","circle");ja==0&&ba[t].setAttribute("shape-rendering","crispEdges")}D=ba[t];D.setAttribute("cx",p.x);D.setAttribute("cy",p.y);D.setAttribute("r",j.scale.x*s);if(q instanceof THREE.ParticleCircleMaterial){if(Z){L.r=c.r+ia.r+T.r;L.g=c.g+ia.g+T.g;L.b=c.b+ia.b+T.b;E.r=q.color.r*
+L.r;E.g=q.color.g*L.g;E.b=q.color.b*L.b;E.updateStyleString()}else E=q.color;D.setAttribute("style","fill: "+E.__styleString)}n.appendChild(D)}}else if(h instanceof THREE.RenderableLine){u=h.v1;x=h.v2;u.positionScreen.x*=s;u.positionScreen.y*=-w;x.positionScreen.x*=s;x.positionScreen.y*=-w;r.addPoint(u.positionScreen.x,u.positionScreen.y);r.addPoint(x.positionScreen.x,x.positionScreen.y);if(H.instersects(r)){f=0;for(m=h.materials.length;f<m;)if(q=h.materials[f++]){p=u;j=x;t=Q++;if(V[t]==null){V[t]=
+document.createElementNS("http://www.w3.org/2000/svg","line");ja==0&&V[t].setAttribute("shape-rendering","crispEdges")}D=V[t];D.setAttribute("x1",p.positionScreen.x);D.setAttribute("y1",p.positionScreen.y);D.setAttribute("x2",j.positionScreen.x);D.setAttribute("y2",j.positionScreen.y);if(q instanceof THREE.LineBasicMaterial){E.__styleString=q.color.__styleString;D.setAttribute("style","fill: none; stroke: "+E.__styleString+"; stroke-width: "+q.linewidth+"; stroke-opacity: "+q.opacity+"; stroke-linecap: "+
+q.linecap+"; stroke-linejoin: "+q.linejoin);n.appendChild(D)}}}}else if(h instanceof THREE.RenderableFace3){u=h.v1;x=h.v2;F=h.v3;u.positionScreen.x*=s;u.positionScreen.y*=-w;x.positionScreen.x*=s;x.positionScreen.y*=-w;F.positionScreen.x*=s;F.positionScreen.y*=-w;r.addPoint(u.positionScreen.x,u.positionScreen.y);r.addPoint(x.positionScreen.x,x.positionScreen.y);r.addPoint(F.positionScreen.x,F.positionScreen.y);if(H.instersects(r)){f=0;for(m=h.meshMaterials.length;f<m;){q=h.meshMaterials[f++];if(q instanceof
+THREE.MeshFaceMaterial){p=0;for(j=h.faceMaterials.length;p<j;)(q=h.faceMaterials[p++])&&b(u,x,F,h,q,ea)}else q&&b(u,x,F,h,q,ea)}}}else if(h instanceof THREE.RenderableFace4){u=h.v1;x=h.v2;F=h.v3;I=h.v4;u.positionScreen.x*=s;u.positionScreen.y*=-w;x.positionScreen.x*=s;x.positionScreen.y*=-w;F.positionScreen.x*=s;F.positionScreen.y*=-w;I.positionScreen.x*=s;I.positionScreen.y*=-w;r.addPoint(u.positionScreen.x,u.positionScreen.y);r.addPoint(x.positionScreen.x,x.positionScreen.y);r.addPoint(F.positionScreen.x,
+F.positionScreen.y);r.addPoint(I.positionScreen.x,I.positionScreen.y);if(H.instersects(r)){f=0;for(m=h.meshMaterials.length;f<m;){q=h.meshMaterials[f++];if(q instanceof THREE.MeshFaceMaterial){p=0;for(j=h.faceMaterials.length;p<j;)(q=h.faceMaterials[p++])&&d(u,x,F,I,h,q,ea)}else q&&d(u,x,F,I,h,q,ea)}}}}}};
+THREE.WebGLRenderer=function(a){function b(f,m,p){var j,h,q,t=f.vertices,A=t.length,W=f.colors,G=W.length,M=f.__vertexArray,C=f.__colorArray,aa=f.__sortArray,da=f.__dirtyVertices,ua=f.__dirtyColors;if(p.sortParticles){J.multiplySelf(p.globalMatrix);for(j=0;j<A;j++){h=t[j].position;ea.copy(h);J.multiplyVector3(ea);aa[j]=[ea.z,j]}aa.sort(function(ka,fa){return fa[0]-ka[0]});for(j=0;j<A;j++){h=t[aa[j][1]].position;q=j*3;M[q]=h.x;M[q+1]=h.y;M[q+2]=h.z}for(j=0;j<G;j++){q=j*3;color=W[aa[j][1]];C[q]=color.r;
+C[q+1]=color.g;C[q+2]=color.b}}else{if(da)for(j=0;j<A;j++){h=t[j].position;q=j*3;M[q]=h.x;M[q+1]=h.y;M[q+2]=h.z}if(ua)for(j=0;j<G;j++){color=W[j];q=j*3;C[q]=color.r;C[q+1]=color.g;C[q+2]=color.b}}if(da||p.sortParticles){c.bindBuffer(c.ARRAY_BUFFER,f.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,M,m)}if(ua||p.sortParticles){c.bindBuffer(c.ARRAY_BUFFER,f.__webGLColorBuffer);c.bufferData(c.ARRAY_BUFFER,C,m)}}function d(f,m){f.fragment_shader=m.fragment_shader;f.vertex_shader=m.vertex_shader;f.uniforms=
+Uniforms.clone(m.uniforms)}function e(f,m,p,j,h){j.program||O.initMaterial(j,m,p);var q=j.program,t=q.uniforms,A=j.uniforms;if(q!=ia){c.useProgram(q);ia=q;c.uniformMatrix4fv(t.projectionMatrix,!1,la)}if(p&&(j instanceof THREE.MeshBasicMaterial||j instanceof THREE.MeshLambertMaterial||j instanceof THREE.MeshPhongMaterial||j instanceof THREE.LineBasicMaterial||j instanceof THREE.ParticleBasicMaterial)){A.fogColor.value.setHex(p.color.hex);if(p instanceof THREE.Fog){A.fogNear.value=p.near;A.fogFar.value=
+p.far}else if(p instanceof THREE.FogExp2)A.fogDensity.value=p.density}if(j instanceof THREE.MeshPhongMaterial||j instanceof THREE.MeshLambertMaterial){var W,G,M=0,C=0,aa=0,da,ua,ka,fa=O.lights,ga=fa.directional.colors,ha=fa.directional.positions,na=fa.point.colors,y=fa.point.positions,Fa=0,za=0;p=G=G=0;for(W=m.length;p<W;p++){G=m[p];da=G.color;ua=G.position;ka=G.intensity;if(G instanceof THREE.AmbientLight){M+=da.r;C+=da.g;aa+=da.b}else if(G instanceof THREE.DirectionalLight){G=Fa*3;ga[G]=da.r*ka;
+ga[G+1]=da.g*ka;ga[G+2]=da.b*ka;ha[G]=ua.x;ha[G+1]=ua.y;ha[G+2]=ua.z;Fa+=1}else if(G instanceof THREE.PointLight){G=za*3;na[G]=da.r*ka;na[G+1]=da.g*ka;na[G+2]=da.b*ka;y[G]=ua.x;y[G+1]=ua.y;y[G+2]=ua.z;za+=1}}for(p=Fa*3;p<ga.length;p++)ga[p]=0;for(p=za*3;p<na.length;p++)na[p]=0;fa.point.length=za;fa.directional.length=Fa;fa.ambient[0]=M;fa.ambient[1]=C;fa.ambient[2]=aa;m=O.lights;A.enableLighting.value=m.directional.length+m.point.length;A.ambientLightColor.value=m.ambient;A.directionalLightColor.value=
+m.directional.colors;A.directionalLightDirection.value=m.directional.positions;A.pointLightColor.value=m.point.colors;A.pointLightPosition.value=m.point.positions}if(j instanceof THREE.MeshBasicMaterial||j instanceof THREE.MeshLambertMaterial||j instanceof THREE.MeshPhongMaterial){A.diffuse.value.setRGB(j.color.r*j.opacity,j.color.g*j.opacity,j.color.b*j.opacity);A.opacity.value=j.opacity;A.map.texture=j.map;A.light_map.texture=j.light_map;A.env_map.texture=j.env_map;A.reflectivity.value=j.reflectivity;
+A.refraction_ratio.value=j.refraction_ratio;A.combine.value=j.combine;A.useRefract.value=j.env_map&&j.env_map.mapping instanceof THREE.CubeRefractionMapping}if(j instanceof THREE.LineBasicMaterial){A.diffuse.value.setRGB(j.color.r*j.opacity,j.color.g*j.opacity,j.color.b*j.opacity);A.opacity.value=j.opacity}else if(j instanceof THREE.ParticleBasicMaterial){A.psColor.value.setRGB(j.color.r*j.opacity,j.color.g*j.opacity,j.color.b*j.opacity);A.opacity.value=j.opacity;A.size.value=j.size;A.map.texture=
+j.map}else if(j instanceof THREE.MeshPhongMaterial){A.ambient.value.setRGB(j.ambient.r,j.ambient.g,j.ambient.b);A.specular.value.setRGB(j.specular.r,j.specular.g,j.specular.b);A.shininess.value=j.shininess}else if(j instanceof THREE.MeshDepthMaterial){A.mNear.value=f.zNear;A.mFar.value=f.zFar;A.opacity.value=j.opacity}else if(j instanceof THREE.MeshNormalMaterial)A.opacity.value=j.opacity;for(var Ga in A)if(M=q.uniforms[Ga]){p=A[Ga];W=p.type;m=p.value;if(W=="i")c.uniform1i(M,m);else if(W=="f")c.uniform1f(M,
+m);else if(W=="fv1")c.uniform1fv(M,m);else if(W=="fv")c.uniform3fv(M,m);else if(W=="v2")c.uniform2f(M,m.x,m.y);else if(W=="v3")c.uniform3f(M,m.x,m.y,m.z);else if(W=="c")c.uniform3f(M,m.r,m.g,m.b);else if(W=="t"){c.uniform1i(M,m);if(p=p.texture)if(p.image instanceof Array&&p.image.length==6){if(p.image.length==6){if(!p.image.__webGLTextureCube&&!p.image.__cubeMapInitialized&&p.image.loadCount==6){p.image.__webGLTextureCube=c.createTexture();c.bindTexture(c.TEXTURE_CUBE_MAP,p.image.__webGLTextureCube);
+c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_MAG_FILTER,c.LINEAR);c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_MIN_FILTER,c.LINEAR_MIPMAP_LINEAR);for(W=0;W<6;++W)c.texImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+W,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,p.image[W]);c.generateMipmap(c.TEXTURE_CUBE_MAP);c.bindTexture(c.TEXTURE_CUBE_MAP,null);p.image.__cubeMapInitialized=!0}c.activeTexture(c.TEXTURE0+
+m);c.bindTexture(c.TEXTURE_CUBE_MAP,p.image.__webGLTextureCube)}}else{if(!p.__webGLTexture&&p.image.loaded){p.__webGLTexture=c.createTexture();c.bindTexture(c.TEXTURE_2D,p.__webGLTexture);c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,p.image);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,E(p.wrap_s));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,E(p.wrap_t));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,E(p.mag_filter));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,E(p.min_filter));
+c.generateMipmap(c.TEXTURE_2D);c.bindTexture(c.TEXTURE_2D,null)}c.activeTexture(c.TEXTURE0+m);c.bindTexture(c.TEXTURE_2D,p.__webGLTexture)}}}c.uniformMatrix4fv(t.modelViewMatrix,!1,h._modelViewMatrixArray);c.uniformMatrix3fv(t.normalMatrix,!1,h._normalMatrixArray);(j instanceof THREE.MeshShaderMaterial||j instanceof THREE.MeshPhongMaterial||j.env_map)&&c.uniform3f(t.cameraPosition,f.position.x,f.position.y,f.position.z);(j instanceof THREE.MeshShaderMaterial||j.env_map||j.skinning)&&c.uniformMatrix4fv(t.objectMatrix,
+!1,h._objectMatrixArray);(j instanceof THREE.MeshPhongMaterial||j instanceof THREE.MeshLambertMaterial||j instanceof THREE.MeshShaderMaterial||j.skinning)&&c.uniformMatrix4fv(t.viewMatrix,!1,ja);if(j.skinning){c.uniformMatrix4fv(t.cameraInverseMatrix,!1,Q);c.uniformMatrix4fv(t.uBoneGlobalMatrices,!1,h.boneMatrices)}return q}function g(f,m,p,j,h,q){f=e(f,m,p,j,q).attributes;c.bindBuffer(c.ARRAY_BUFFER,h.__webGLVertexBuffer);c.vertexAttribPointer(f.position,3,c.FLOAT,!1,0,0);if(f.color>=0){c.bindBuffer(c.ARRAY_BUFFER,
+h.__webGLColorBuffer);c.vertexAttribPointer(f.color,3,c.FLOAT,!1,0,0)}if(f.normal>=0){c.bindBuffer(c.ARRAY_BUFFER,h.__webGLNormalBuffer);c.vertexAttribPointer(f.normal,3,c.FLOAT,!1,0,0)}if(f.tangent>=0){c.bindBuffer(c.ARRAY_BUFFER,h.__webGLTangentBuffer);c.vertexAttribPointer(f.tangent,4,c.FLOAT,!1,0,0)}if(f.uv>=0)if(h.__webGLUVBuffer){c.bindBuffer(c.ARRAY_BUFFER,h.__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(h.__webGLUV2Buffer){c.bindBuffer(c.ARRAY_BUFFER,h.__webGLUV2Buffer);c.vertexAttribPointer(f.uv2,2,c.FLOAT,!1,0,0);c.enableVertexAttribArray(f.uv2)}else c.disableVertexAttribArray(f.uv2);if(j.skinning&&f.skinVertexA>=0&&f.skinVertexB>=0&&f.skinIndex>=0&&f.skinWeight>=0){c.bindBuffer(c.ARRAY_BUFFER,h.__webGLSkinVertexABuffer);c.vertexAttribPointer(f.skinVertexA,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,h.__webGLSkinVertexBBuffer);c.vertexAttribPointer(f.skinVertexB,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,
+h.__webGLSkinIndicesBuffer);c.vertexAttribPointer(f.skinIndex,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,h.__webGLSkinWeightsBuffer);c.vertexAttribPointer(f.skinWeight,4,c.FLOAT,!1,0,0)}if(q instanceof THREE.Mesh)if(j.wireframe){c.lineWidth(j.wireframe_linewidth);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,h.__webGLLineBuffer);c.drawElements(c.LINES,h.__webGLLineCount,c.UNSIGNED_SHORT,0)}else{c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,h.__webGLFaceBuffer);c.drawElements(c.TRIANGLES,h.__webGLFaceCount,c.UNSIGNED_SHORT,
+0)}else if(q instanceof THREE.Line){q=q.type==THREE.LineStrip?c.LINE_STRIP:c.LINES;c.lineWidth(j.linewidth);c.drawArrays(q,0,h.__webGLLineCount)}else if(q instanceof THREE.ParticleSystem)c.drawArrays(c.POINTS,0,h.__webGLParticleCount);else q instanceof THREE.Ribbon&&c.drawArrays(c.TRIANGLE_STRIP,0,h.__webGLVertexCount)}function i(f,m){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(m.attributes.position);c.vertexAttribPointer(m.attributes.position,3,c.FLOAT,!1,0,0)}if(f.hasNormal){c.bindBuffer(c.ARRAY_BUFFER,f.__webGLNormalBuffer);c.bufferData(c.ARRAY_BUFFER,f.normalArray,c.DYNAMIC_DRAW);c.enableVertexAttribArray(m.attributes.normal);c.vertexAttribPointer(m.attributes.normal,3,c.FLOAT,!1,0,0)}c.drawArrays(c.TRIANGLES,0,f.count);f.count=0}function l(f){if(ca!=f.doubleSided){f.doubleSided?
+c.disable(c.CULL_FACE):c.enable(c.CULL_FACE);ca=f.doubleSided}if(S!=f.flipSided){f.flipSided?c.frontFace(c.CW):c.frontFace(c.CCW);S=f.flipSided}}function n(f){if(V!=f){f?c.enable(c.DEPTH_TEST):c.disable(c.DEPTH_TEST);V=f}}function k(f){D[0].set(f.n41-f.n11,f.n42-f.n12,f.n43-f.n13,f.n44-f.n14);D[1].set(f.n41+f.n11,f.n42+f.n12,f.n43+f.n13,f.n44+f.n14);D[2].set(f.n41+f.n21,f.n42+f.n22,f.n43+f.n23,f.n44+f.n24);D[3].set(f.n41-f.n21,f.n42-f.n22,f.n43-f.n23,f.n44-f.n24);D[4].set(f.n41-f.n31,f.n42-f.n32,
+f.n43-f.n33,f.n44-f.n34);D[5].set(f.n41+f.n31,f.n42+f.n32,f.n43+f.n33,f.n44+f.n34);var m;for(f=0;f<5;f++){m=D[f];m.divideScalar(Math.sqrt(m.x*m.x+m.y*m.y+m.z*m.z))}}function o(f){for(var m=f.globalMatrix,p=-f.geometry.boundingSphere.radius*Math.max(f.scale.x,Math.max(f.scale.y,f.scale.z)),j=0;j<6;j++){f=D[j].x*m.n14+D[j].y*m.n24+D[j].z*m.n34+D[j].w;if(f<=p)return!1}return!0}function s(f,m){f.list[f.count]=m;f.count+=1}function w(f){var m,p,j=f.object,h=f.opaque,q=f.transparent;q.count=0;f=h.count=
+0;for(m=j.materials.length;f<m;f++){p=j.materials[f];p.opacity&&p.opacity<1||p.blending!=THREE.NormalBlending?s(q,p):s(h,p)}}function u(f){var m,p,j,h,q=f.object,t=f.buffer,A=f.opaque,W=f.transparent;W.count=0;f=A.count=0;for(j=q.materials.length;f<j;f++){m=q.materials[f];if(m instanceof THREE.MeshFaceMaterial){m=0;for(p=t.materials.length;m<p;m++)(h=t.materials[m])&&(h.opacity&&h.opacity<1||h.blending!=THREE.NormalBlending?s(W,h):s(A,h))}else{h=m;h.opacity&&h.opacity<1||h.blending!=THREE.NormalBlending?
+s(W,h):s(A,h)}}}function x(f,m){return m.z-f.z}function F(f,m,p,j,h){if(m[p]==undefined){f.push({buffer:j,object:h,opaque:{list:[],count:0},transparent:{list:[],count:0}});m[p]=1}}function I(f,m){f._modelViewMatrix.multiplyToArray(m.globalMatrix,f.globalMatrix,f._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(f._modelViewMatrix).transposeIntoArray(f._normalMatrixArray)}function H(f){if(f!=ba){switch(f){case THREE.AdditiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ONE,c.ONE);break;case THREE.SubtractiveBlending:c.blendFunc(c.DST_COLOR,
+c.ZERO);break;case THREE.BillboardBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA);break;default:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA)}ba=f}}function r(f,m){if(f&&!f.__webGLFramebuffer){f.__webGLFramebuffer=c.createFramebuffer();f.__webGLRenderbuffer=c.createRenderbuffer();f.__webGLTexture=c.createTexture();c.bindRenderbuffer(c.RENDERBUFFER,f.__webGLRenderbuffer);c.renderbufferStorage(c.RENDERBUFFER,c.DEPTH_COMPONENT16,f.width,f.height);
+c.bindTexture(c.TEXTURE_2D,f.__webGLTexture);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,E(f.wrap_s));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,E(f.wrap_t));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,E(f.mag_filter));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,E(f.min_filter));c.texImage2D(c.TEXTURE_2D,0,E(f.format),f.width,f.height,0,E(f.format),E(f.type),null);c.bindFramebuffer(c.FRAMEBUFFER,f.__webGLFramebuffer);c.framebufferTexture2D(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,c.TEXTURE_2D,
+f.__webGLTexture,0);c.framebufferRenderbuffer(c.FRAMEBUFFER,c.DEPTH_ATTACHMENT,c.RENDERBUFFER,f.__webGLRenderbuffer);c.bindTexture(c.TEXTURE_2D,null);c.bindRenderbuffer(c.RENDERBUFFER,null);c.bindFramebuffer(c.FRAMEBUFFER,null)}var p,j,h;if(f){p=f.__webGLFramebuffer;j=f.width;h=f.height}else{p=null;j=L.width;h=L.height}if(p!=T){c.bindFramebuffer(c.FRAMEBUFFER,p);c.viewport(0,0,j,h);m&&c.clear(c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT);T=p}}function Z(f,m){var p;if(f=="fragment")p=c.createShader(c.FRAGMENT_SHADER);
+else f=="vertex"&&(p=c.createShader(c.VERTEX_SHADER));c.shaderSource(p,m);c.compileShader(p);if(!c.getShaderParameter(p,c.COMPILE_STATUS)){alert(c.getShaderInfoLog(p));return null}return p}function E(f){switch(f){case THREE.RepeatWrapping:return c.REPEAT;case THREE.ClampToEdgeWrapping:return c.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return c.MIRRORED_REPEAT;case THREE.NearestFilter:return c.NEAREST;case THREE.NearestMipMapNearestFilter:return c.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return c.NEAREST_MIPMAP_LINEAR;
+case THREE.LinearFilter:return c.LINEAR;case THREE.LinearMipMapNearestFilter:return c.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return c.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return c.BYTE;case THREE.UnsignedByteType:return c.UNSIGNED_BYTE;case THREE.ShortType:return c.SHORT;case THREE.UnsignedShortType:return c.UNSIGNED_SHORT;case THREE.IntType:return c.INT;case THREE.UnsignedShortType:return c.UNSIGNED_INT;case THREE.FloatType:return c.FLOAT;case THREE.AlphaFormat:return c.ALPHA;
+case THREE.RGBFormat:return c.RGB;case THREE.RGBAFormat:return c.RGBA;case THREE.LuminanceFormat:return c.LUMINANCE;case THREE.LuminanceAlphaFormat:return c.LUMINANCE_ALPHA}return 0}var L=document.createElement("canvas"),c,ia=null,T=null,O=this,ca=null,S=null,ba=null,V=null,D=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],J=new THREE.Matrix4,la=new Float32Array(16),Q=new Float32Array(16),ja=new Float32Array(16),ea=new THREE.Vector4,R=
+!0,ra=new THREE.Color(0),wa=0;if(a){if(a.antialias!==undefined)R=a.antialias;a.clearColor!==undefined&&ra.setHex(a.clearColor);if(a.clearAlpha!==undefined)wa=a.clearAlpha}this.domElement=L;this.autoClear=!0;this.sortObjects=!1;(function(f,m,p){try{c=L.getContext("experimental-webgl",{antialias:f})}catch(j){console.log(j)}if(!c){alert("WebGL not supported");throw"cannot create webgl context";}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.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA);c.clearColor(m.r,m.g,m.b,p);_cullEnabled=!0})(R,ra,wa);this.context=c;this.lights={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}};this.setSize=function(f,m){L.width=f;L.height=m;c.viewport(0,0,L.width,L.height)};this.setClearColorHex=function(f,m){var p=new THREE.Color(f);c.clearColor(p.r,p.g,p.b,m)};this.setClearColor=function(f,m){c.clearColor(f.r,f.g,f.b,m)};
+this.clear=function(){c.clear(c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT)};this.initMaterial=function(f,m,p){var j,h;if(f instanceof THREE.MeshDepthMaterial)d(f,THREE.ShaderLib.depth);else if(f instanceof THREE.MeshNormalMaterial)d(f,THREE.ShaderLib.normal);else if(f instanceof THREE.MeshBasicMaterial)d(f,THREE.ShaderLib.basic);else if(f instanceof THREE.MeshLambertMaterial)d(f,THREE.ShaderLib.lambert);else if(f instanceof THREE.MeshPhongMaterial)d(f,THREE.ShaderLib.phong);else if(f instanceof THREE.LineBasicMaterial)d(f,
+THREE.ShaderLib.basic);else f instanceof THREE.ParticleBasicMaterial&&d(f,THREE.ShaderLib.particle_basic);var q,t,A,W;h=A=W=0;for(q=m.length;h<q;h++){t=m[h];t instanceof THREE.DirectionalLight&&A++;t instanceof THREE.PointLight&&W++}if(W+A<=4)m=A;else{m=Math.ceil(4*A/(W+A));W=4-m}h={directional:m,point:W};W=f.fragment_shader;m=f.vertex_shader;q={fog:p,map:f.map,env_map:f.env_map,light_map:f.light_map,vertex_colors:f.vertex_colors,skinning:f.skinning,maxDirLights:h.directional,maxPointLights:h.point};
+p=c.createProgram();h=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+q.maxDirLights,"#define MAX_POINT_LIGHTS "+q.maxPointLights,q.fog?"#define USE_FOG":"",q.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",q.map?"#define USE_MAP":"",q.env_map?"#define USE_ENVMAP":"",q.light_map?"#define USE_LIGHTMAP":"",q.vertex_colors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");q=[c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":
+"","#define MAX_DIR_LIGHTS "+q.maxDirLights,"#define MAX_POINT_LIGHTS "+q.maxPointLights,q.map?"#define USE_MAP":"",q.env_map?"#define USE_ENVMAP":"",q.light_map?"#define USE_LIGHTMAP":"",q.vertex_colors?"#define USE_COLOR":"",q.skinning?"#define USE_SKINNING":"","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 vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n");
+c.attachShader(p,Z("fragment",h+W));c.attachShader(p,Z("vertex",q+m));c.linkProgram(p);c.getProgramParameter(p,c.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+c.getProgramParameter(p,c.VALIDATE_STATUS)+", gl error ["+c.getError()+"]");p.uniforms={};p.attributes={};f.program=p;p=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","uBoneGlobalMatrices"];for(j in f.uniforms)p.push(j);j=f.program;W=0;for(m=p.length;W<
+m;W++){h=p[W];j.uniforms[h]=c.getUniformLocation(j,h)}j=f.program;p=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];W=0;for(m=p.length;W<m;W++){h=p[W];j.attributes[h]=c.getAttribLocation(j,h)}j=f.program.attributes;c.enableVertexAttribArray(j.position);j.color>=0&&c.enableVertexAttribArray(j.color);j.normal>=0&&c.enableVertexAttribArray(j.normal);j.tangent>=0&&c.enableVertexAttribArray(j.tangent);if(f.skinning&&j.skinVertexA>=0&&j.skinVertexB>=
+0&&j.skinIndex>=0&&j.skinWeight>=0){c.enableVertexAttribArray(j.skinVertexA);c.enableVertexAttribArray(j.skinVertexB);c.enableVertexAttribArray(j.skinIndex);c.enableVertexAttribArray(j.skinWeight)}};this.render=function(f,m,p,j){var h,q,t,A,W,G,M,C,aa=f.lights,da=f.fog;m.autoUpdateMatrix&&m.update();m.globalMatrix.flattenToArray(ja);m.projectionMatrix.flattenToArray(la);m.inverseMatrix.flattenToArray(Q);J.multiply(m.projectionMatrix,m.globalMatrix);k(J);THREE.AnimationHandler&&THREE.AnimationHandler.update();
+f.update(undefined,!1,m);this.initWebGLObjects(f,m);r(p,j!==undefined?j:!0);this.autoClear&&this.clear();W=f.__webGLObjects.length;for(j=0;j<W;j++){h=f.__webGLObjects[j];M=h.object;if(M.visible)if(!(M instanceof THREE.Mesh)||o(M)){M.globalMatrix.flattenToArray(M._objectMatrixArray);I(M,m);u(h);h.render=!0;if(this.sortObjects){ea.copy(M.position);J.multiplyVector3(ea);h.z=ea.z}}else h.render=!1;else h.render=!1}this.sortObjects&&f.__webGLObjects.sort(x);G=f.__webGLObjectsImmediate.length;for(j=0;j<
+G;j++){h=f.__webGLObjectsImmediate[j];M=h.object;if(M.visible){M.autoUpdateMatrix&&M.globalMatrix.flattenToArray(M._objectMatrixArray);I(M,m);w(h)}}H(THREE.NormalBlending);for(j=0;j<W;j++){h=f.__webGLObjects[j];if(h.render){M=h.object;C=h.buffer;t=h.opaque;l(M);for(h=0;h<t.count;h++){A=t.list[h];n(A.depth_test);g(m,aa,da,A,C,M)}}}for(j=0;j<G;j++){h=f.__webGLObjectsImmediate[j];M=h.object;if(M.visible){t=h.opaque;l(M);for(h=0;h<t.count;h++){A=t.list[h];n(A.depth_test);q=e(m,aa,da,A,M);M.render(function(ua){i(ua,
+q)})}}}for(j=0;j<W;j++){h=f.__webGLObjects[j];if(h.render){M=h.object;C=h.buffer;t=h.transparent;l(M);for(h=0;h<t.count;h++){A=t.list[h];H(A.blending);n(A.depth_test);g(m,aa,da,A,C,M)}}}for(j=0;j<G;j++){h=f.__webGLObjectsImmediate[j];M=h.object;if(M.visible){t=h.transparent;l(M);for(h=0;h<t.count;h++){A=t.list[h];H(A.blending);n(A.depth_test);q=e(m,aa,da,A,M);M.render(function(ua){i(ua,q)})}}}if(p&&p.min_filter!==THREE.NearestFilter&&p.min_filter!==THREE.LinearFilter){c.bindTexture(c.TEXTURE_2D,p.__webGLTexture);
+c.generateMipmap(c.TEXTURE_2D);c.bindTexture(c.TEXTURE_2D,null)}};this.initWebGLObjects=function(f){var m,p,j;if(!f.__webGLObjects){f.__webGLObjects=[];f.__webGLObjectsMap={};f.__webGLObjectsImmediate=[]}m=0;for(p=f.objects.length;m<p;m++){j=f.objects[m];var h=f,q=void 0,t=void 0,A=void 0,W=void 0;t=j.geometry;if(h.__webGLObjectsMap[j.id]==undefined){h.__webGLObjectsMap[j.id]={};j._modelViewMatrix=new THREE.Matrix4;j._normalMatrixArray=new Float32Array(9);j._modelViewMatrixArray=new Float32Array(16);
+j._objectMatrixArray=new Float32Array(16);j.globalMatrix.flattenToArray(j._objectMatrixArray)}W=h.__webGLObjectsMap[j.id];objlist=h.__webGLObjects;if(j instanceof THREE.Mesh){for(q in t.geometryChunks){A=t.geometryChunks[q];if(!A.__webGLVertexBuffer){h=A;h.__webGLVertexBuffer=c.createBuffer();h.__webGLNormalBuffer=c.createBuffer();h.__webGLTangentBuffer=c.createBuffer();h.__webGLColorBuffer=c.createBuffer();h.__webGLUVBuffer=c.createBuffer();h.__webGLUV2Buffer=c.createBuffer();h.__webGLSkinVertexABuffer=
+c.createBuffer();h.__webGLSkinVertexBBuffer=c.createBuffer();h.__webGLSkinIndicesBuffer=c.createBuffer();h.__webGLSkinWeightsBuffer=c.createBuffer();h.__webGLFaceBuffer=c.createBuffer();h.__webGLLineBuffer=c.createBuffer();h=A;var G=j,M=void 0,C=void 0,aa=0,da=0,ua=0,ka=G.geometry.faces,fa=h.faces;M=0;for(C=fa.length;M<C;M++){fi=fa[M];face=ka[fi];if(face instanceof THREE.Face3){aa+=3;da+=1;ua+=3}else if(face instanceof THREE.Face4){aa+=4;da+=2;ua+=4}}h.__vertexArray=new Float32Array(aa*3);h.__normalArray=
+new Float32Array(aa*3);h.__tangentArray=new Float32Array(aa*4);h.__colorArray=new Float32Array(aa*3);h.__uvArray=new Float32Array(aa*2);h.__uv2Array=new Float32Array(aa*2);h.__skinVertexAArray=new Float32Array(aa*4);h.__skinVertexBArray=new Float32Array(aa*4);h.__skinIndexArray=new Float32Array(aa*4);h.__skinWeightArray=new Float32Array(aa*4);h.__faceArray=new Uint16Array(da*3);h.__lineArray=new Uint16Array(ua*2);C=M=h;aa=void 0;ka=void 0;var ga=void 0,ha=void 0;ga=void 0;fa=!1;aa=0;for(ka=G.materials.length;aa<
+ka;aa++){ga=G.materials[aa];if(ga instanceof THREE.MeshFaceMaterial){ga=0;for(ha=C.materials.length;ga<ha;ga++)if(C.materials[ga]&&C.materials[ga].shading!=undefined&&C.materials[ga].shading==THREE.SmoothShading){fa=!0;break}}else if(ga&&ga.shading!=undefined&&ga.shading==THREE.SmoothShading){fa=!0;break}if(fa)break}M.__needsSmoothNormals=fa;h.__webGLFaceCount=da*3;h.__webGLLineCount=ua*2;t.__dirtyVertices=!0;t.__dirtyElements=!0;t.__dirtyUvs=!0;t.__dirtyNormals=!0;t.__dirtyTangents=!0;t.__dirtyColors=
+!0}if(t.__dirtyVertices||t.__dirtyElements||t.__dirtyUvs||t.__dirtyNormals||t.__dirtyColors||t.__dirtyTangents){h=A;da=c.DYNAMIC_DRAW;ua=void 0;M=void 0;var na=void 0,y=void 0,Fa=void 0,za=void 0,Ga=void 0;na=void 0;var P=void 0,N=void 0,K=void 0,oa=void 0;P=void 0;N=void 0;K=void 0;y=void 0;P=void 0;N=void 0;K=void 0;oa=void 0;P=void 0;N=void 0;K=void 0;oa=void 0;P=void 0;N=void 0;K=void 0;oa=void 0;P=void 0;N=void 0;K=void 0;oa=void 0;P=void 0;N=void 0;K=void 0;oa=void 0;y=void 0;za=void 0;Fa=void 0;
+Ga=void 0;var Ca=ha=ga=fa=ka=aa=G=C=0,Aa=0,v=0,Ba=h.__vertexArray,Oa=h.__uvArray,Ma=h.__uv2Array,Ha=h.__normalArray,$=h.__tangentArray,sa=h.__colorArray,pa=h.__skinVertexAArray,ta=h.__skinVertexBArray,va=h.__skinIndexArray,qa=h.__skinWeightArray,z=h.__faceArray,X=h.__lineArray,Y=h.__needsSmoothNormals,B=j.geometry,U=B.__dirtyVertices,ma=B.__dirtyElements,xa=B.__dirtyUvs,Da=B.__dirtyNormals,Ea=B.__dirtyTangents,Ia=B.__dirtyColors,ya=B.vertices,Ja=h.faces,Qa=B.faces,Ka=B.uvs,La=B.uvs2,Na=B.colors,Ra=
+B.skinVerticesA,Sa=B.skinVerticesB,Ta=B.skinIndices,Pa=B.skinWeights;ua=0;for(M=Ja.length;ua<M;ua++){na=Ja[ua];y=Qa[na];Ga=Ka[na];na=La[na];Fa=y.vertexNormals;za=y.normal;if(y instanceof THREE.Face3){if(U){P=ya[y.a].position;N=ya[y.b].position;K=ya[y.c].position;Ba[G]=P.x;Ba[G+1]=P.y;Ba[G+2]=P.z;Ba[G+3]=N.x;Ba[G+4]=N.y;Ba[G+5]=N.z;Ba[G+6]=K.x;Ba[G+7]=K.y;Ba[G+8]=K.z;G+=9}if(Pa.length){P=Pa[y.a];N=Pa[y.b];K=Pa[y.c];qa[v]=P.x;qa[v+1]=P.y;qa[v+2]=P.z;qa[v+3]=P.w;qa[v+4]=N.x;qa[v+5]=N.y;qa[v+6]=N.z;qa[v+
+7]=N.w;qa[v+8]=K.x;qa[v+9]=K.y;qa[v+10]=K.z;qa[v+11]=K.w;P=Ta[y.a];N=Ta[y.b];K=Ta[y.c];va[v]=P.x;va[v+1]=P.y;va[v+2]=P.z;va[v+3]=P.w;va[v+4]=N.x;va[v+5]=N.y;va[v+6]=N.z;va[v+7]=N.w;va[v+8]=K.x;va[v+9]=K.y;va[v+10]=K.z;va[v+11]=K.w;P=Ra[y.a];N=Ra[y.b];K=Ra[y.c];pa[v]=P.x;pa[v+1]=P.y;pa[v+2]=P.z;pa[v+3]=1;pa[v+4]=N.x;pa[v+5]=N.y;pa[v+6]=N.z;pa[v+7]=1;pa[v+8]=K.x;pa[v+9]=K.y;pa[v+10]=K.z;pa[v+11]=1;P=Sa[y.a];N=Sa[y.b];K=Sa[y.c];ta[v]=P.x;ta[v+1]=P.y;ta[v+2]=P.z;ta[v+3]=1;ta[v+4]=N.x;ta[v+5]=N.y;ta[v+
+6]=N.z;ta[v+7]=1;ta[v+8]=K.x;ta[v+9]=K.y;ta[v+10]=K.z;ta[v+11]=1;v+=12}if(Ia&&Na.length){P=Na[y.a];N=Na[y.b];K=Na[y.c];sa[Aa]=P.r;sa[Aa+1]=P.g;sa[Aa+2]=P.b;sa[Aa+3]=N.r;sa[Aa+4]=N.g;sa[Aa+5]=N.b;sa[Aa+6]=K.r;sa[Aa+7]=K.g;sa[Aa+8]=K.b;Aa+=9}if(Ea&&B.hasTangents){P=ya[y.a].tangent;N=ya[y.b].tangent;K=ya[y.c].tangent;$[ha]=P.x;$[ha+1]=P.y;$[ha+2]=P.z;$[ha+3]=P.w;$[ha+4]=N.x;$[ha+5]=N.y;$[ha+6]=N.z;$[ha+7]=N.w;$[ha+8]=K.x;$[ha+9]=K.y;$[ha+10]=K.z;$[ha+11]=K.w;ha+=12}if(Da)if(Fa.length==3&&Y)for(y=0;y<
+3;y++){za=Fa[y];Ha[ga]=za.x;Ha[ga+1]=za.y;Ha[ga+2]=za.z;ga+=3}else for(y=0;y<3;y++){Ha[ga]=za.x;Ha[ga+1]=za.y;Ha[ga+2]=za.z;ga+=3}if(xa&&Ga)for(y=0;y<3;y++){Fa=Ga[y];Oa[aa]=Fa.u;Oa[aa+1]=Fa.v;aa+=2}if(xa&&na)for(y=0;y<3;y++){Ga=na[y];Ma[ka]=Ga.u;Ma[ka+1]=Ga.v;ka+=2}if(ma){z[fa]=C;z[fa+1]=C+1;z[fa+2]=C+2;fa+=3;X[Ca]=C;X[Ca+1]=C+1;X[Ca+2]=C;X[Ca+3]=C+2;X[Ca+4]=C+1;X[Ca+5]=C+2;Ca+=6;C+=3}}else if(y instanceof THREE.Face4){if(U){P=ya[y.a].position;N=ya[y.b].position;K=ya[y.c].position;oa=ya[y.d].position;
+Ba[G]=P.x;Ba[G+1]=P.y;Ba[G+2]=P.z;Ba[G+3]=N.x;Ba[G+4]=N.y;Ba[G+5]=N.z;Ba[G+6]=K.x;Ba[G+7]=K.y;Ba[G+8]=K.z;Ba[G+9]=oa.x;Ba[G+10]=oa.y;Ba[G+11]=oa.z;G+=12}if(Pa.length){P=Pa[y.a];N=Pa[y.b];K=Pa[y.c];oa=Pa[y.d];qa[v]=P.x;qa[v+1]=P.y;qa[v+2]=P.z;qa[v+3]=P.w;qa[v+4]=N.x;qa[v+5]=N.y;qa[v+6]=N.z;qa[v+7]=N.w;qa[v+8]=K.x;qa[v+9]=K.y;qa[v+10]=K.z;qa[v+11]=K.w;qa[v+12]=oa.x;qa[v+13]=oa.y;qa[v+14]=oa.z;qa[v+15]=oa.w;P=Ta[y.a];N=Ta[y.b];K=Ta[y.c];oa=Ta[y.d];va[v]=P.x;va[v+1]=P.y;va[v+2]=P.z;va[v+3]=P.w;va[v+4]=
+N.x;va[v+5]=N.y;va[v+6]=N.z;va[v+7]=N.w;va[v+8]=K.x;va[v+9]=K.y;va[v+10]=K.z;va[v+11]=K.w;va[v+12]=oa.x;va[v+13]=oa.y;va[v+14]=oa.z;va[v+15]=oa.w;P=Ra[y.a];N=Ra[y.b];K=Ra[y.c];oa=Ra[y.d];pa[v]=P.x;pa[v+1]=P.y;pa[v+2]=P.z;pa[v+3]=1;pa[v+4]=N.x;pa[v+5]=N.y;pa[v+6]=N.z;pa[v+7]=1;pa[v+8]=K.x;pa[v+9]=K.y;pa[v+10]=K.z;pa[v+11]=1;pa[v+12]=oa.x;pa[v+13]=oa.y;pa[v+14]=oa.z;pa[v+15]=1;P=Sa[y.a];N=Sa[y.b];K=Sa[y.c];oa=Sa[y.d];ta[v]=P.x;ta[v+1]=P.y;ta[v+2]=P.z;ta[v+3]=1;ta[v+4]=N.x;ta[v+5]=N.y;ta[v+6]=N.z;ta[v+
+7]=1;ta[v+8]=K.x;ta[v+9]=K.y;ta[v+10]=K.z;ta[v+11]=1;ta[v+12]=oa.x;ta[v+13]=oa.y;ta[v+14]=oa.z;ta[v+15]=1;v+=16}if(Ia&&Na.length){P=Na[y.a];N=Na[y.b];K=Na[y.c];oa=Na[y.d];sa[Aa]=P.r;sa[Aa+1]=P.g;sa[Aa+2]=P.b;sa[Aa+3]=N.r;sa[Aa+4]=N.g;sa[Aa+5]=N.b;sa[Aa+6]=K.r;sa[Aa+7]=K.g;sa[Aa+8]=K.b;sa[Aa+9]=oa.r;sa[Aa+10]=oa.g;sa[Aa+11]=oa.b;Aa+=12}if(Ea&&B.hasTangents){P=ya[y.a].tangent;N=ya[y.b].tangent;K=ya[y.c].tangent;y=ya[y.d].tangent;$[ha]=P.x;$[ha+1]=P.y;$[ha+2]=P.z;$[ha+3]=P.w;$[ha+4]=N.x;$[ha+5]=N.y;
+$[ha+6]=N.z;$[ha+7]=N.w;$[ha+8]=K.x;$[ha+9]=K.y;$[ha+10]=K.z;$[ha+11]=K.w;$[ha+12]=y.x;$[ha+13]=y.y;$[ha+14]=y.z;$[ha+15]=y.w;ha+=16}if(Da)if(Fa.length==4&&Y)for(y=0;y<4;y++){za=Fa[y];Ha[ga]=za.x;Ha[ga+1]=za.y;Ha[ga+2]=za.z;ga+=3}else for(y=0;y<4;y++){Ha[ga]=za.x;Ha[ga+1]=za.y;Ha[ga+2]=za.z;ga+=3}if(xa&&Ga)for(y=0;y<4;y++){Fa=Ga[y];Oa[aa]=Fa.u;Oa[aa+1]=Fa.v;aa+=2}if(xa&&na)for(y=0;y<4;y++){Ga=na[y];Ma[ka]=Ga.u;Ma[ka+1]=Ga.v;ka+=2}if(ma){z[fa]=C;z[fa+1]=C+1;z[fa+2]=C+2;z[fa+3]=C;z[fa+4]=C+2;z[fa+5]=
+C+3;fa+=6;X[Ca]=C;X[Ca+1]=C+1;X[Ca+2]=C;X[Ca+3]=C+3;X[Ca+4]=C+1;X[Ca+5]=C+2;X[Ca+6]=C+2;X[Ca+7]=C+3;Ca+=8;C+=4}}}if(U){c.bindBuffer(c.ARRAY_BUFFER,h.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,Ba,da)}if(Ia&&Na.length){c.bindBuffer(c.ARRAY_BUFFER,h.__webGLColorBuffer);c.bufferData(c.ARRAY_BUFFER,sa,da)}if(Da){c.bindBuffer(c.ARRAY_BUFFER,h.__webGLNormalBuffer);c.bufferData(c.ARRAY_BUFFER,Ha,da)}if(Ea&&B.hasTangents){c.bindBuffer(c.ARRAY_BUFFER,h.__webGLTangentBuffer);c.bufferData(c.ARRAY_BUFFER,
+$,da)}if(xa&&aa>0){c.bindBuffer(c.ARRAY_BUFFER,h.__webGLUVBuffer);c.bufferData(c.ARRAY_BUFFER,Oa,da)}if(xa&&ka>0){c.bindBuffer(c.ARRAY_BUFFER,h.__webGLUV2Buffer);c.bufferData(c.ARRAY_BUFFER,Ma,da)}if(ma){c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,h.__webGLFaceBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,z,da);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,h.__webGLLineBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,X,da)}if(v>0){c.bindBuffer(c.ARRAY_BUFFER,h.__webGLSkinVertexABuffer);c.bufferData(c.ARRAY_BUFFER,pa,da);
+c.bindBuffer(c.ARRAY_BUFFER,h.__webGLSkinVertexBBuffer);c.bufferData(c.ARRAY_BUFFER,ta,da);c.bindBuffer(c.ARRAY_BUFFER,h.__webGLSkinIndicesBuffer);c.bufferData(c.ARRAY_BUFFER,va,da);c.bindBuffer(c.ARRAY_BUFFER,h.__webGLSkinWeightsBuffer);c.bufferData(c.ARRAY_BUFFER,qa,da)}}F(objlist,W,q,A,j)}t.__dirtyVertices=!1;t.__dirtyElements=!1;t.__dirtyUvs=!1;t.__dirtyNormals=!1;t.__dirtyTangents=!1;t.__dirtyColors=!1}else if(j instanceof THREE.Ribbon){if(!t.__webGLVertexBuffer){q=t;q.__webGLVertexBuffer=c.createBuffer();
+q.__webGLColorBuffer=c.createBuffer();q=t;A=q.vertices.length;q.__vertexArray=new Float32Array(A*3);q.__colorArray=new Float32Array(A*3);q.__webGLVertexCount=A;t.__dirtyVertices=!0;t.__dirtyColors=!0}if(t.__dirtyVertices||t.__dirtyColors){q=t;A=c.DYNAMIC_DRAW;C=void 0;C=void 0;G=void 0;h=void 0;aa=q.vertices;da=q.colors;ka=aa.length;ua=da.length;fa=q.__vertexArray;M=q.__colorArray;ga=q.__dirtyColors;if(q.__dirtyVertices){for(C=0;C<ka;C++){G=aa[C].position;h=C*3;fa[h]=G.x;fa[h+1]=G.y;fa[h+2]=G.z}c.bindBuffer(c.ARRAY_BUFFER,
+q.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,fa,A)}if(ga){for(C=0;C<ua;C++){color=da[C];h=C*3;M[h]=color.r;M[h+1]=color.g;M[h+2]=color.b}c.bindBuffer(c.ARRAY_BUFFER,q.__webGLColorBuffer);c.bufferData(c.ARRAY_BUFFER,M,A)}}F(objlist,W,0,t,j);t.__dirtyVertices=!1;t.__dirtyColors=!1}else if(j instanceof THREE.Line){if(!t.__webGLVertexBuffer){q=t;q.__webGLVertexBuffer=c.createBuffer();q.__webGLColorBuffer=c.createBuffer();q=t;A=q.vertices.length;q.__vertexArray=new Float32Array(A*3);q.__colorArray=
+new Float32Array(A*3);q.__webGLLineCount=A;t.__dirtyVertices=!0;t.__dirtyColors=!0}if(t.__dirtyVertices||t.__dirtyColors){q=t;A=c.DYNAMIC_DRAW;C=void 0;C=void 0;G=void 0;h=void 0;aa=q.vertices;da=q.colors;ka=aa.length;ua=da.length;fa=q.__vertexArray;M=q.__colorArray;ga=q.__dirtyColors;if(q.__dirtyVertices){for(C=0;C<ka;C++){G=aa[C].position;h=C*3;fa[h]=G.x;fa[h+1]=G.y;fa[h+2]=G.z}c.bindBuffer(c.ARRAY_BUFFER,q.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,fa,A)}if(ga){for(C=0;C<ua;C++){color=da[C];
+h=C*3;M[h]=color.r;M[h+1]=color.g;M[h+2]=color.b}c.bindBuffer(c.ARRAY_BUFFER,q.__webGLColorBuffer);c.bufferData(c.ARRAY_BUFFER,M,A)}}F(objlist,W,0,t,j);t.__dirtyVertices=!1;t.__dirtyColors=!1}else if(j instanceof THREE.ParticleSystem){if(!t.__webGLVertexBuffer){q=t;q.__webGLVertexBuffer=c.createBuffer();q.__webGLColorBuffer=c.createBuffer();q=t;A=q.vertices.length;q.__vertexArray=new Float32Array(A*3);q.__colorArray=new Float32Array(A*3);q.__sortArray=[];q.__webGLParticleCount=A;t.__dirtyVertices=
+!0;t.__dirtyColors=!0}(t.__dirtyVertices||t.__dirtyColors||j.sortParticles)&&b(t,c.DYNAMIC_DRAW,j,camera);F(objlist,W,0,t,j);t.__dirtyVertices=!1;t.__dirtyColors=!1}else if(j instanceof THREE.MarchingCubes){t=W;if(t[0]==undefined){h.__webGLObjectsImmediate.push({object:j,opaque:{list:[],count:0},transparent:{list:[],count:0}});t[0]=1}}}};this.removeObject=function(f,m){var p,j;for(p=f.__webGLObjects.length-1;p>=0;p--){j=f.__webGLObjects[p].object;m==j&&f.__webGLObjects.splice(p,1)}};this.setFaceCulling=
+function(f,m){if(f){!m||m=="ccw"?c.frontFace(c.CCW):c.frontFace(c.CW);if(f=="back")c.cullFace(c.BACK);else f=="front"?c.cullFace(c.FRONT):c.cullFace(c.FRONT_AND_BACK);c.enable(c.CULL_FACE)}else c.disable(c.CULL_FACE)};this.supportsVertexTextures=function(){return c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};
 THREE.Snippets={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",
 THREE.Snippets={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",
 envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube env_map;\nuniform int combine;\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( env_map, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refraction_ratio;\nuniform bool useRefract;\n#endif",
 envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube env_map;\nuniform int combine;\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( env_map, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refraction_ratio;\nuniform bool useRefract;\n#endif",
 envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refraction_ratio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",
 envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refraction_ratio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",

+ 191 - 188
build/ThreeDebug.js

@@ -1,103 +1,104 @@
 // ThreeDebug.js r32 - http://github.com/mrdoob/three.js
 // ThreeDebug.js r32 - http://github.com/mrdoob/three.js
 var THREE=THREE||{};THREE.Color=function(a){this.autoUpdate=!0;this.setHex(a)};
 var THREE=THREE||{};THREE.Color=function(a){this.autoUpdate=!0;this.setHex(a)};
-THREE.Color.prototype={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 e,g,i,l,o,k;if(c==0)e=g=i=0;else{l=Math.floor(a*6);o=a*6-l;a=c*(1-b);k=c*(1-b*o);b=c*(1-b*(1-o));switch(l){case 1:e=k;g=c;i=a;break;case 2:e=a;g=c;i=b;break;case 3:e=a;g=k;i=c;break;case 4:e=b;g=a;i=c;break;case 5:e=c;g=a;i=k;break;case 6:case 0:e=c;g=b;i=a}}this.r=e;this.g=g;this.b=i;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},
+THREE.Color.prototype={setRGB:function(a,b,d){this.r=a;this.g=b;this.b=d;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,b,d){var e,g,i,l,o,k;if(d==0)e=g=i=0;else{l=Math.floor(a*6);o=a*6-l;a=d*(1-b);k=d*(1-b*o);b=d*(1-b*(1-o));switch(l){case 1:e=k;g=d;i=a;break;case 2:e=a;g=d;i=b;break;case 3:e=a;g=k;i=d;break;case 4:e=b;g=a;i=d;break;case 5:e=d;g=a;i=k;break;case 6:case 0:e=d;g=b;i=a}}this.r=e;this.g=g;this.b=i;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},
 setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGBA();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGBA: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)},toString:function(){return"THREE.Color ( r: "+
 setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGBA();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGBA: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)},toString:function(){return"THREE.Color ( r: "+
 this.r+", g: "+this.g+", b: "+this.b+", hex: "+this.hex+" )"}};THREE.Vector2=function(a,b){this.x=a||0;this.y=b||0};
 this.r+", g: "+this.g+", b: "+this.b+", hex: "+this.hex+" )"}};THREE.Vector2=function(a,b){this.x=a||0;this.y=b||0};
 THREE.Vector2.prototype={set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.x=a.x;this.y=a.y;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},unit:function(){this.multiplyScalar(1/this.length());return this},length:function(){return Math.sqrt(this.x*
 THREE.Vector2.prototype={set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.x=a.x;this.y=a.y;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},unit:function(){this.multiplyScalar(1/this.length());return this},length:function(){return Math.sqrt(this.x*
-this.x+this.y*this.y)},lengthSq:function(){return this.x*this.x+this.y*this.y},negate:function(){this.x=-this.x;this.y=-this.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},toString:function(){return"THREE.Vector2 ("+this.x+", "+this.y+")"}};THREE.Vector3=function(a,b,c){this.x=a||0;this.y=b||0;this.z=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.x=a.x;this.y=a.y;this.z=a.z;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this},
-cross:function(a,b){this.x=a.y*b.z-a.z*b.y;this.y=a.z*b.x-a.x*b.z;this.z=a.x*b.y-a.y*b.x;return this},crossSelf:function(a){var b=this.x,c=this.y,e=this.z;this.x=c*a.z-e*a.y;this.y=e*a.x-b*a.z;this.z=b*a.y-c*a.x;return this},multiply:function(a,b){this.x=a.x*b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},multiplySelf:function(a){this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;return this},divideSelf:function(a){this.x/=a.x;this.y/=a.y;this.z/=
-a.z;return this},divideScalar:function(a){this.x/=a;this.y/=a;this.z/=a;return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},distanceTo:function(a){var b=this.x-a.x,c=this.y-a.y;a=this.z-a.z;return Math.sqrt(b*b+c*c+a*a)},distanceToSquared:function(a){var b=this.x-a.x,c=this.y-a.y;a=this.z-a.z;return b*b+c*c+a*a},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},lengthManhattan:function(){return this.x+
+this.x+this.y*this.y)},lengthSq:function(){return this.x*this.x+this.y*this.y},negate:function(){this.x=-this.x;this.y=-this.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},toString:function(){return"THREE.Vector2 ("+this.x+", "+this.y+")"}};THREE.Vector3=function(a,b,d){this.x=a||0;this.y=b||0;this.z=d||0};
+THREE.Vector3.prototype={set:function(a,b,d){this.x=a;this.y=b;this.z=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this},
+cross:function(a,b){this.x=a.y*b.z-a.z*b.y;this.y=a.z*b.x-a.x*b.z;this.z=a.x*b.y-a.y*b.x;return this},crossSelf:function(a){var b=this.x,d=this.y,e=this.z;this.x=d*a.z-e*a.y;this.y=e*a.x-b*a.z;this.z=b*a.y-d*a.x;return this},multiply:function(a,b){this.x=a.x*b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},multiplySelf:function(a){this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;return this},divideSelf:function(a){this.x/=a.x;this.y/=a.y;this.z/=
+a.z;return this},divideScalar:function(a){this.x/=a;this.y/=a;this.z/=a;return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},distanceTo:function(a){var b=this.x-a.x,d=this.y-a.y;a=this.z-a.z;return Math.sqrt(b*b+d*d+a*a)},distanceToSquared:function(a){var b=this.x-a.x,d=this.y-a.y;a=this.z-a.z;return b*b+d*d+a*a},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},lengthManhattan:function(){return this.x+
 this.y+this.z},negate:function(){this.x=-this.x;this.y=-this.y;this.z=-this.z;return this},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z);a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setLength:function(a){return this.normalize().multiplyScalar(a)},isZero:function(){return Math.abs(this.x)<1.0E-4&&Math.abs(this.y)<1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)},toString:function(){return"THREE.Vector3 ( "+
 this.y+this.z},negate:function(){this.x=-this.x;this.y=-this.y;this.z=-this.z;return this},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z);a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setLength:function(a){return this.normalize().multiplyScalar(a)},isZero:function(){return Math.abs(this.x)<1.0E-4&&Math.abs(this.y)<1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)},toString:function(){return"THREE.Vector3 ( "+
-this.x+", "+this.y+", "+this.z+" )"}};THREE.Vector4=function(a,b,c,e){this.x=a||0;this.y=b||0;this.z=c||0;this.w=e||1};
-THREE.Vector4.prototype={set:function(a,b,c,e){this.x=a;this.y=b;this.z=c;this.w=e;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w||1;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;
+this.x+", "+this.y+", "+this.z+" )"}};THREE.Vector4=function(a,b,d,e){this.x=a||0;this.y=b||0;this.z=d||0;this.w=e||1};
+THREE.Vector4.prototype={set:function(a,b,d,e){this.x=a;this.y=b;this.z=d;this.w=e;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w||1;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;
 return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){this.x/=a;this.y/=a;this.z/=a;this.w/=a;return this},lerpSelf:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},toString:function(){return"THREE.Vector4 ("+this.x+", "+this.y+", "+this.z+", "+this.w+")"}};
 return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){this.x/=a;this.y/=a;this.z/=a;this.w/=a;return this},lerpSelf:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},toString:function(){return"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=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
-THREE.Ray.prototype={intersectScene:function(a){var b,c,e=a.objects,g=[];a=0;for(b=e.length;a<b;a++){c=e[a];c instanceof THREE.Mesh&&(g=g.concat(this.intersectObject(c)))}g.sort(function(i,l){return i.distance-l.distance});return g},intersectObject:function(a){function b(G,r,Z,D){D=D.clone().subSelf(r);Z=Z.clone().subSelf(r);var K=G.clone().subSelf(r);G=D.dot(D);r=D.dot(Z);D=D.dot(K);var d=Z.dot(Z);Z=Z.dot(K);K=1/(G*d-r*r);d=(d*D-r*Z)*K;G=(G*Z-r*D)*K;return d>0&&G>0&&d+G<1}var c,e,g,i,l,o,k,m,s,w,
-t,x=a.geometry,F=x.vertices,H=[];c=0;for(e=x.faces.length;c<e;c++){g=x.faces[c];w=this.origin.clone();t=this.direction.clone();k=a.globalMatrix;k.extractRotationMatrix(a.rotationMatrix);i=k.multiplyVector3(F[g.a].position.clone());l=k.multiplyVector3(F[g.b].position.clone());o=k.multiplyVector3(F[g.c].position.clone());k=g instanceof THREE.Face4?k.multiplyVector3(F[g.d].position.clone()):null;m=a.rotationMatrix.multiplyVector3(g.normal.clone());s=t.dot(m);if(s<0){m=m.dot((new THREE.Vector3).sub(i,
-w))/s;w=w.addSelf(t.multiplyScalar(m));if(g instanceof THREE.Face3){if(b(w,i,l,o)){g={distance:this.origin.distanceTo(w),point:w,face:g,object:a};H.push(g)}}else if(g instanceof THREE.Face4&&(b(w,i,l,k)||b(w,l,o,k))){g={distance:this.origin.distanceTo(w),point:w,face:g,object:a};H.push(g)}}}return H}};
-THREE.Rectangle=function(){function a(){i=e-b;l=g-c}var b,c,e,g,i,l,o=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return i};this.getHeight=function(){return l};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return e};this.getBottom=function(){return g};this.set=function(k,m,s,w){o=!1;b=k;c=m;e=s;g=w;a()};this.addPoint=function(k,m){if(o){o=!1;b=k;c=m;e=k;g=m}else{b=b<k?b:k;c=c<m?c:m;e=e>k?e:k;g=g>m?g:m}a()};
-this.add3Points=function(k,m,s,w,t,x){if(o){o=!1;b=k<s?k<t?k:t:s<t?s:t;c=m<w?m<x?m:x:w<x?w:x;e=k>s?k>t?k:t:s>t?s:t;g=m>w?m>x?m:x:w>x?w:x}else{b=k<s?k<t?k<b?k:b:t<b?t:b:s<t?s<b?s:b:t<b?t:b;c=m<w?m<x?m<c?m:c:x<c?x:c:w<x?w<c?w:c:x<c?x:c;e=k>s?k>t?k>e?k:e:t>e?t:e:s>t?s>e?s:e:t>e?t:e;g=m>w?m>x?m>g?m:g:x>g?x:g:w>x?w>g?w:g:x>g?x:g}a()};this.addRectangle=function(k){if(o){o=!1;b=k.getLeft();c=k.getTop();e=k.getRight();g=k.getBottom()}else{b=b<k.getLeft()?b:k.getLeft();c=c<k.getTop()?c:k.getTop();e=e>k.getRight()?
-e:k.getRight();g=g>k.getBottom()?g:k.getBottom()}a()};this.inflate=function(k){b-=k;c-=k;e+=k;g+=k;a()};this.minSelf=function(k){b=b>k.getLeft()?b:k.getLeft();c=c>k.getTop()?c:k.getTop();e=e<k.getRight()?e:k.getRight();g=g<k.getBottom()?g:k.getBottom();a()};this.instersects=function(k){return Math.min(e,k.getRight())-Math.max(b,k.getLeft())>=0&&Math.min(g,k.getBottom())-Math.max(c,k.getTop())>=0};this.empty=function(){o=!0;g=e=c=b=0;a()};this.isEmpty=function(){return o};this.toString=function(){return"THREE.Rectangle ( left: "+
-b+", right: "+e+", top: "+c+", bottom: "+g+", width: "+i+", height: "+l+" )"}};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,e,g,i,l,o,k,m,s,w,t,x,F,H){this.n11=a||1;this.n12=b||0;this.n13=c||0;this.n14=e||0;this.n21=g||0;this.n22=i||1;this.n23=l||0;this.n24=o||0;this.n31=k||0;this.n32=m||0;this.n33=s||1;this.n34=w||0;this.n41=t||0;this.n42=x||0;this.n43=F||0;this.n44=H||1;this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={identity:function(){this.n11=1;this.n21=this.n14=this.n13=this.n12=0;this.n22=1;this.n32=this.n31=this.n24=this.n23=0;this.n33=1;this.n43=this.n42=this.n41=this.n34=0;this.n44=1;return this},set:function(a,b,c,e,g,i,l,o,k,m,s,w,t,x,F,H){this.n11=a;this.n12=b;this.n13=c;this.n14=e;this.n21=g;this.n22=i;this.n23=l;this.n24=o;this.n31=k;this.n32=m;this.n33=s;this.n34=w;this.n41=t;this.n42=x;this.n43=F;this.n44=H;return this},copy:function(a){this.n11=a.n11;this.n12=a.n12;this.n13=
-a.n13;this.n14=a.n14;this.n21=a.n21;this.n22=a.n22;this.n23=a.n23;this.n24=a.n24;this.n31=a.n31;this.n32=a.n32;this.n33=a.n33;this.n34=a.n34;this.n41=a.n41;this.n42=a.n42;this.n43=a.n43;this.n44=a.n44;return this},lookAt:function(a,b,c){var e=THREE.Matrix4.__tmpVec1,g=THREE.Matrix4.__tmpVec2,i=THREE.Matrix4.__tmpVec3;i.sub(a,b).normalize();e.cross(c,i).normalize();g.cross(i,e).normalize();this.n11=e.x;this.n12=e.y;this.n13=e.z;this.n14=-e.dot(a);this.n21=g.x;this.n22=g.y;this.n23=g.z;this.n24=-g.dot(a);
-this.n31=i.x;this.n32=i.y;this.n33=i.z;this.n34=-i.dot(a);this.n43=this.n42=this.n41=0;this.n44=1;return this},multiplyVector3:function(a){var b=a.x,c=a.y,e=a.z,g=1/(this.n41*b+this.n42*c+this.n43*e+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*e+this.n14)*g;a.y=(this.n21*b+this.n22*c+this.n23*e+this.n24)*g;a.z=(this.n31*b+this.n32*c+this.n33*e+this.n34)*g;return a},multiplyVector3OnlyZ:function(a){var b=a.x,c=a.y;a=a.z;return(this.n31*b+this.n32*c+this.n33*a+this.n34)*(1/(this.n41*b+this.n42*c+this.n43*
-a+this.n44))},multiplyVector4:function(a){var b=a.x,c=a.y,e=a.z,g=a.w;a.x=this.n11*b+this.n12*c+this.n13*e+this.n14*g;a.y=this.n21*b+this.n22*c+this.n23*e+this.n24*g;a.z=this.n31*b+this.n32*c+this.n33*e+this.n34*g;a.w=this.n41*b+this.n42*c+this.n43*e+this.n44*g;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,e=a.n12,g=a.n13,i=a.n14,l=a.n21,o=a.n22,k=a.n23,m=a.n24,s=a.n31,w=a.n32,t=a.n33,x=a.n34,F=a.n41,H=a.n42,G=a.n43,r=a.n44,Z=b.n11,D=b.n12,K=b.n13,d=b.n14,ga=b.n21,T=b.n22,N=b.n23,ba=b.n24,R=b.n31,aa=b.n32,V=b.n33,B=b.n34,I=b.n41,ka=b.n42,P=b.n43,ja=b.n44;this.n11=c*Z+e*ga+g*R+i*I;this.n12=c*D+e*T+g*aa+i*ka;this.n13=c*K+e*N+g*V+i*P;this.n14=c*d+e*ba+g*B+i*ja;this.n21=l*Z+o*ga+k*R+m*I;this.n22=l*D+o*T+k*aa+m*ka;
-this.n23=l*K+o*N+k*V+m*P;this.n24=l*d+o*ba+k*B+m*ja;this.n31=s*Z+w*ga+t*R+x*I;this.n32=s*D+w*T+t*aa+x*ka;this.n33=s*K+w*N+t*V+x*P;this.n34=s*d+w*ba+t*B+x*ja;this.n41=F*Z+H*ga+G*R+r*I;this.n42=F*D+H*T+G*aa+r*ka;this.n43=F*K+H*N+G*V+r*P;this.n44=F*d+H*ba+G*B+r*ja;return this},multiplyToArray:function(a,b,c){var e=a.n11,g=a.n12,i=a.n13,l=a.n14,o=a.n21,k=a.n22,m=a.n23,s=a.n24,w=a.n31,t=a.n32,x=a.n33,F=a.n34,H=a.n41,G=a.n42,r=a.n43;a=a.n44;var Z=b.n11,D=b.n12,K=b.n13,d=b.n14,ga=b.n21,T=b.n22,N=b.n23,ba=
-b.n24,R=b.n31,aa=b.n32,V=b.n33,B=b.n34,I=b.n41,ka=b.n42,P=b.n43;b=b.n44;this.n11=e*Z+g*ga+i*R+l*I;this.n12=e*D+g*T+i*aa+l*ka;this.n13=e*K+g*N+i*V+l*P;this.n14=e*d+g*ba+i*B+l*b;this.n21=o*Z+k*ga+m*R+s*I;this.n22=o*D+k*T+m*aa+s*ka;this.n23=o*K+k*N+m*V+s*P;this.n24=o*d+k*ba+m*B+s*b;this.n31=w*Z+t*ga+x*R+F*I;this.n32=w*D+t*T+x*aa+F*ka;this.n33=w*K+t*N+x*V+F*P;this.n34=w*d+t*ba+x*B+F*b;this.n41=H*Z+G*ga+r*R+a*I;this.n42=H*D+G*T+r*aa+a*ka;this.n43=H*K+G*N+r*V+a*P;this.n44=H*d+G*ba+r*B+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){var b=this.n11,c=this.n12,e=this.n13,g=this.n14,i=this.n21,l=this.n22,o=this.n23,k=this.n24,m=this.n31,s=this.n32,w=this.n33,t=this.n34,x=this.n41,F=this.n42,H=this.n43,G=this.n44,r=a.n11,Z=a.n21,D=a.n31,K=a.n41,d=a.n12,ga=a.n22,T=a.n32,N=a.n42,ba=
-a.n13,R=a.n23,aa=a.n33,V=a.n43,B=a.n14,I=a.n24,ka=a.n34;a=a.n44;this.n11=b*r+c*Z+e*D+g*K;this.n12=b*d+c*ga+e*T+g*N;this.n13=b*ba+c*R+e*aa+g*V;this.n14=b*B+c*I+e*ka+g*a;this.n21=i*r+l*Z+o*D+k*K;this.n22=i*d+l*ga+o*T+k*N;this.n23=i*ba+l*R+o*aa+k*V;this.n24=i*B+l*I+o*ka+k*a;this.n31=m*r+s*Z+w*D+t*K;this.n32=m*d+s*ga+w*T+t*N;this.n33=m*ba+s*R+w*aa+t*V;this.n34=m*B+s*I+w*ka+t*a;this.n41=x*r+F*Z+H*D+G*K;this.n42=x*d+F*ga+H*T+G*N;this.n43=x*ba+F*R+H*aa+G*V;this.n44=x*B+F*I+H*ka+G*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,e=this.n14,g=this.n21,i=this.n22,l=this.n23,o=this.n24,k=this.n31,m=this.n32,s=this.n33,w=this.n34,t=this.n41,x=this.n42,F=this.n43,H=this.n44;return e*l*m*t-c*o*m*t-e*i*s*t+b*o*s*t+c*i*w*t-b*l*w*t-e*l*k*x+c*o*k*x+e*g*s*x-a*o*s*x-c*g*w*x+a*l*w*x+
-e*i*k*F-b*o*k*F-e*g*m*F+a*o*m*F+b*g*w*F-a*i*w*F-c*i*k*H+b*l*k*H+c*g*m*H-a*l*m*H-b*g*s*H+a*i*s*H},transpose:function(){function a(b,c,e){var g=b[c];b[c]=b[e];b[e]=g}a(this,"n21","n12");a(this,"n31","n13");a(this,"n32","n23");a(this,"n41","n14");a(this,"n42","n24");a(this,"n43","n34");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;
+THREE.Ray.prototype={intersectScene:function(a){var b,d,e=a.objects,g=[];a=0;for(b=e.length;a<b;a++){d=e[a];d instanceof THREE.Mesh&&(g=g.concat(this.intersectObject(d)))}g.sort(function(i,l){return i.distance-l.distance});return g},intersectObject:function(a){function b(H,r,Z,E){E=E.clone().subSelf(r);Z=Z.clone().subSelf(r);var L=H.clone().subSelf(r);H=E.dot(E);r=E.dot(Z);E=E.dot(L);var c=Z.dot(Z);Z=Z.dot(L);L=1/(H*c-r*r);c=(c*E-r*Z)*L;H=(H*Z-r*E)*L;return c>0&&H>0&&c+H<1}var d,e,g,i,l,o,k,m,s,w,
+u,x=a.geometry,F=x.vertices,I=[];d=0;for(e=x.faces.length;d<e;d++){g=x.faces[d];w=this.origin.clone();u=this.direction.clone();k=a.globalMatrix;k.extractRotationMatrix(a.rotationMatrix);i=k.multiplyVector3(F[g.a].position.clone());l=k.multiplyVector3(F[g.b].position.clone());o=k.multiplyVector3(F[g.c].position.clone());k=g instanceof THREE.Face4?k.multiplyVector3(F[g.d].position.clone()):null;m=a.rotationMatrix.multiplyVector3(g.normal.clone());s=u.dot(m);if(s<0){m=m.dot((new THREE.Vector3).sub(i,
+w))/s;w=w.addSelf(u.multiplyScalar(m));if(g instanceof THREE.Face3){if(b(w,i,l,o)){g={distance:this.origin.distanceTo(w),point:w,face:g,object:a};I.push(g)}}else if(g instanceof THREE.Face4&&(b(w,i,l,k)||b(w,l,o,k))){g={distance:this.origin.distanceTo(w),point:w,face:g,object:a};I.push(g)}}}return I}};
+THREE.Rectangle=function(){function a(){i=e-b;l=g-d}var b,d,e,g,i,l,o=!0;this.getX=function(){return b};this.getY=function(){return d};this.getWidth=function(){return i};this.getHeight=function(){return l};this.getLeft=function(){return b};this.getTop=function(){return d};this.getRight=function(){return e};this.getBottom=function(){return g};this.set=function(k,m,s,w){o=!1;b=k;d=m;e=s;g=w;a()};this.addPoint=function(k,m){if(o){o=!1;b=k;d=m;e=k;g=m}else{b=b<k?b:k;d=d<m?d:m;e=e>k?e:k;g=g>m?g:m}a()};
+this.add3Points=function(k,m,s,w,u,x){if(o){o=!1;b=k<s?k<u?k:u:s<u?s:u;d=m<w?m<x?m:x:w<x?w:x;e=k>s?k>u?k:u:s>u?s:u;g=m>w?m>x?m:x:w>x?w:x}else{b=k<s?k<u?k<b?k:b:u<b?u:b:s<u?s<b?s:b:u<b?u:b;d=m<w?m<x?m<d?m:d:x<d?x:d:w<x?w<d?w:d:x<d?x:d;e=k>s?k>u?k>e?k:e:u>e?u:e:s>u?s>e?s:e:u>e?u:e;g=m>w?m>x?m>g?m:g:x>g?x:g:w>x?w>g?w:g:x>g?x:g}a()};this.addRectangle=function(k){if(o){o=!1;b=k.getLeft();d=k.getTop();e=k.getRight();g=k.getBottom()}else{b=b<k.getLeft()?b:k.getLeft();d=d<k.getTop()?d:k.getTop();e=e>k.getRight()?
+e:k.getRight();g=g>k.getBottom()?g:k.getBottom()}a()};this.inflate=function(k){b-=k;d-=k;e+=k;g+=k;a()};this.minSelf=function(k){b=b>k.getLeft()?b:k.getLeft();d=d>k.getTop()?d:k.getTop();e=e<k.getRight()?e:k.getRight();g=g<k.getBottom()?g:k.getBottom();a()};this.instersects=function(k){return Math.min(e,k.getRight())-Math.max(b,k.getLeft())>=0&&Math.min(g,k.getBottom())-Math.max(d,k.getTop())>=0};this.empty=function(){o=!0;g=e=d=b=0;a()};this.isEmpty=function(){return o};this.toString=function(){return"THREE.Rectangle ( left: "+
+b+", right: "+e+", top: "+d+", bottom: "+g+", width: "+i+", height: "+l+" )"}};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,d,e,g,i,l,o,k,m,s,w,u,x,F,I){this.n11=a||1;this.n12=b||0;this.n13=d||0;this.n14=e||0;this.n21=g||0;this.n22=i||1;this.n23=l||0;this.n24=o||0;this.n31=k||0;this.n32=m||0;this.n33=s||1;this.n34=w||0;this.n41=u||0;this.n42=x||0;this.n43=F||0;this.n44=I||1;this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={identity:function(){this.n11=1;this.n21=this.n14=this.n13=this.n12=0;this.n22=1;this.n32=this.n31=this.n24=this.n23=0;this.n33=1;this.n43=this.n42=this.n41=this.n34=0;this.n44=1;return this},set:function(a,b,d,e,g,i,l,o,k,m,s,w,u,x,F,I){this.n11=a;this.n12=b;this.n13=d;this.n14=e;this.n21=g;this.n22=i;this.n23=l;this.n24=o;this.n31=k;this.n32=m;this.n33=s;this.n34=w;this.n41=u;this.n42=x;this.n43=F;this.n44=I;return this},copy:function(a){this.n11=a.n11;this.n12=a.n12;this.n13=
+a.n13;this.n14=a.n14;this.n21=a.n21;this.n22=a.n22;this.n23=a.n23;this.n24=a.n24;this.n31=a.n31;this.n32=a.n32;this.n33=a.n33;this.n34=a.n34;this.n41=a.n41;this.n42=a.n42;this.n43=a.n43;this.n44=a.n44;return this},lookAt:function(a,b,d){var e=THREE.Matrix4.__tmpVec1,g=THREE.Matrix4.__tmpVec2,i=THREE.Matrix4.__tmpVec3;i.sub(a,b).normalize();e.cross(d,i).normalize();g.cross(i,e).normalize();this.n11=e.x;this.n12=e.y;this.n13=e.z;this.n14=-e.dot(a);this.n21=g.x;this.n22=g.y;this.n23=g.z;this.n24=-g.dot(a);
+this.n31=i.x;this.n32=i.y;this.n33=i.z;this.n34=-i.dot(a);this.n43=this.n42=this.n41=0;this.n44=1;return this},multiplyVector3:function(a){var b=a.x,d=a.y,e=a.z,g=1/(this.n41*b+this.n42*d+this.n43*e+this.n44);a.x=(this.n11*b+this.n12*d+this.n13*e+this.n14)*g;a.y=(this.n21*b+this.n22*d+this.n23*e+this.n24)*g;a.z=(this.n31*b+this.n32*d+this.n33*e+this.n34)*g;return a},multiplyVector3OnlyZ:function(a){var b=a.x,d=a.y;a=a.z;return(this.n31*b+this.n32*d+this.n33*a+this.n34)*(1/(this.n41*b+this.n42*d+this.n43*
+a+this.n44))},multiplyVector4:function(a){var b=a.x,d=a.y,e=a.z,g=a.w;a.x=this.n11*b+this.n12*d+this.n13*e+this.n14*g;a.y=this.n21*b+this.n22*d+this.n23*e+this.n24*g;a.z=this.n31*b+this.n32*d+this.n33*e+this.n34*g;a.w=this.n41*b+this.n42*d+this.n43*e+this.n44*g;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 d=a.n11,e=a.n12,g=a.n13,i=a.n14,l=a.n21,o=a.n22,k=a.n23,m=a.n24,s=a.n31,w=a.n32,u=a.n33,x=a.n34,F=a.n41,I=a.n42,H=a.n43,r=a.n44,Z=b.n11,E=b.n12,L=b.n13,c=b.n14,ia=b.n21,T=b.n22,O=b.n23,ca=b.n24,S=b.n31,ba=b.n32,V=b.n33,D=b.n34,J=b.n41,la=b.n42,Q=b.n43,ja=b.n44;this.n11=d*Z+e*ia+g*S+i*J;this.n12=d*E+e*T+g*ba+i*la;this.n13=d*L+e*O+g*V+i*Q;this.n14=d*c+e*ca+g*D+i*ja;this.n21=l*Z+o*ia+k*S+m*J;this.n22=l*E+o*T+k*ba+m*la;
+this.n23=l*L+o*O+k*V+m*Q;this.n24=l*c+o*ca+k*D+m*ja;this.n31=s*Z+w*ia+u*S+x*J;this.n32=s*E+w*T+u*ba+x*la;this.n33=s*L+w*O+u*V+x*Q;this.n34=s*c+w*ca+u*D+x*ja;this.n41=F*Z+I*ia+H*S+r*J;this.n42=F*E+I*T+H*ba+r*la;this.n43=F*L+I*O+H*V+r*Q;this.n44=F*c+I*ca+H*D+r*ja;return this},multiplyToArray:function(a,b,d){var e=a.n11,g=a.n12,i=a.n13,l=a.n14,o=a.n21,k=a.n22,m=a.n23,s=a.n24,w=a.n31,u=a.n32,x=a.n33,F=a.n34,I=a.n41,H=a.n42,r=a.n43;a=a.n44;var Z=b.n11,E=b.n12,L=b.n13,c=b.n14,ia=b.n21,T=b.n22,O=b.n23,ca=
+b.n24,S=b.n31,ba=b.n32,V=b.n33,D=b.n34,J=b.n41,la=b.n42,Q=b.n43;b=b.n44;this.n11=e*Z+g*ia+i*S+l*J;this.n12=e*E+g*T+i*ba+l*la;this.n13=e*L+g*O+i*V+l*Q;this.n14=e*c+g*ca+i*D+l*b;this.n21=o*Z+k*ia+m*S+s*J;this.n22=o*E+k*T+m*ba+s*la;this.n23=o*L+k*O+m*V+s*Q;this.n24=o*c+k*ca+m*D+s*b;this.n31=w*Z+u*ia+x*S+F*J;this.n32=w*E+u*T+x*ba+F*la;this.n33=w*L+u*O+x*V+F*Q;this.n34=w*c+u*ca+x*D+F*b;this.n41=I*Z+H*ia+r*S+a*J;this.n42=I*E+H*T+r*ba+a*la;this.n43=I*L+H*O+r*V+a*Q;this.n44=I*c+H*ca+r*D+a*b;d[0]=this.n11;
+d[1]=this.n21;d[2]=this.n31;d[3]=this.n41;d[4]=this.n12;d[5]=this.n22;d[6]=this.n32;d[7]=this.n42;d[8]=this.n13;d[9]=this.n23;d[10]=this.n33;d[11]=this.n43;d[12]=this.n14;d[13]=this.n24;d[14]=this.n34;d[15]=this.n44;return this},multiplySelf:function(a){var b=this.n11,d=this.n12,e=this.n13,g=this.n14,i=this.n21,l=this.n22,o=this.n23,k=this.n24,m=this.n31,s=this.n32,w=this.n33,u=this.n34,x=this.n41,F=this.n42,I=this.n43,H=this.n44,r=a.n11,Z=a.n21,E=a.n31,L=a.n41,c=a.n12,ia=a.n22,T=a.n32,O=a.n42,ca=
+a.n13,S=a.n23,ba=a.n33,V=a.n43,D=a.n14,J=a.n24,la=a.n34;a=a.n44;this.n11=b*r+d*Z+e*E+g*L;this.n12=b*c+d*ia+e*T+g*O;this.n13=b*ca+d*S+e*ba+g*V;this.n14=b*D+d*J+e*la+g*a;this.n21=i*r+l*Z+o*E+k*L;this.n22=i*c+l*ia+o*T+k*O;this.n23=i*ca+l*S+o*ba+k*V;this.n24=i*D+l*J+o*la+k*a;this.n31=m*r+s*Z+w*E+u*L;this.n32=m*c+s*ia+w*T+u*O;this.n33=m*ca+s*S+w*ba+u*V;this.n34=m*D+s*J+w*la+u*a;this.n41=x*r+F*Z+I*E+H*L;this.n42=x*c+F*ia+I*T+H*O;this.n43=x*ca+F*S+I*ba+H*V;this.n44=x*D+F*J+I*la+H*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,d=this.n13,e=this.n14,g=this.n21,i=this.n22,l=this.n23,o=this.n24,k=this.n31,m=this.n32,s=this.n33,w=this.n34,u=this.n41,x=this.n42,F=this.n43,I=this.n44;return e*l*m*u-d*o*m*u-e*i*s*u+b*o*s*u+d*i*w*u-b*l*w*u-e*l*k*x+d*o*k*x+e*g*s*x-a*o*s*x-d*g*w*x+a*l*w*x+
+e*i*k*F-b*o*k*F-e*g*m*F+a*o*m*F+b*g*w*F-a*i*w*F-d*i*k*I+b*l*k*I+d*g*m*I-a*l*m*I-b*g*s*I+a*i*s*I},transpose:function(){function a(b,d,e){var g=b[d];b[d]=b[e];b[e]=g}a(this,"n21","n12");a(this,"n31","n13");a(this,"n32","n23");a(this,"n41","n14");a(this,"n42","n24");a(this,"n43","n34");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(){var a=this.flat;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},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]=
 a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){var a=this.flat;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},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=
-this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);
-return this},setScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotX: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},setRotY: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},setRotZ: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},setRotAxis:function(a,b){var c=Math.cos(b),e=Math.sin(b),g=1-c,i=a.x,l=a.y,o=a.z,k=g*
-i,m=g*l;this.set(k*i+c,k*l-e*o,k*o+e*l,0,k*l+e*o,m*l+c,m*o-e*i,0,k*o-e*l,m*o+e*i,g*o*o+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},setRotationFromEuler:function(a){var b=a.x,c=a.y,e=a.z;a=Math.cos(c);c=Math.sin(c);var g=Math.cos(-e);e=Math.sin(-e);var i=Math.cos(b);b=Math.sin(b);var l=a*e,o=c*e;this.n11=a*g;this.n12=c*b-l*i;this.n13=l*b+c*i;this.n21=e;this.n22=g*i;this.n23=-g*b;this.n31=-c*g;this.n32=o*i+a*b;this.n33=-o*b+a*i},setRotationFromQuaternion:function(a){var b=
-a.x,c=a.y,e=a.z,g=a.w,i=b+b,l=c+c,o=e+e;a=b*i;var k=b*l;b*=o;var m=c*l;c*=o;e*=o;i*=g;l*=g;g*=o;this.n11=1-(m+e);this.n12=k-g;this.n13=b+l;this.n21=k+g;this.n22=1-(a+e);this.n23=c-i;this.n31=b-l;this.n32=c+i;this.n33=1-(a+m)},scale:function(a){var b=a.x,c=a.y;a=a.z;this.n11*=b;this.n12*=b;this.n13*=b;this.n21*=c;this.n22*=c;this.n23*=c;this.n31*=a;this.n32*=a;this.n33*=a;return this},extractRotationMatrix:function(a){a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=0;a.n21=this.n21;a.n22=this.n22;
-a.n23=this.n23;a.n24=0;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=0;a.n41=0;a.n42=0;a.n43=0;a.n44=1},toString:function(){return"| "+this.n11+" "+this.n12+" "+this.n13+" "+this.n14+" |\n| "+this.n21+" "+this.n22+" "+this.n23+" "+this.n24+" |\n| "+this.n31+" "+this.n32+" "+this.n33+" "+this.n34+" |\n| "+this.n41+" "+this.n42+" "+this.n43+" "+this.n44+" |"}};THREE.Matrix4.translationMatrix=function(a,b,c){var e=new THREE.Matrix4;e.setTranslation(a,b,c);return e};
-THREE.Matrix4.scaleMatrix=function(a,b,c){var e=new THREE.Matrix4;e.setScale(a,b,c);return e};THREE.Matrix4.rotationXMatrix=function(a){var b=new THREE.Matrix4;b.setRotX(a);return b};THREE.Matrix4.rotationYMatrix=function(a){var b=new THREE.Matrix4;b.setRotY(a);return b};THREE.Matrix4.rotationZMatrix=function(a){var b=new THREE.Matrix4;b.setRotZ(a);return b};THREE.Matrix4.rotationAxisAngleMatrix=function(a,b){var c=new THREE.Matrix4;c.setRotAxis(a,b);return c};
-THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,e=a.n12,g=a.n13,i=a.n14,l=a.n21,o=a.n22,k=a.n23,m=a.n24,s=a.n31,w=a.n32,t=a.n33,x=a.n34,F=a.n41,H=a.n42,G=a.n43,r=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=k*x*H-m*t*H+m*w*G-o*x*G-k*w*r+o*t*r;b.n12=i*t*H-g*x*H-i*w*G+e*x*G+g*w*r-e*t*r;b.n13=g*m*H-i*k*H+i*o*G-e*m*G-g*o*r+e*k*r;b.n14=i*k*w-g*m*w-i*o*t+e*m*t+g*o*x-e*k*x;b.n21=m*t*F-k*x*F-m*s*G+l*x*G+k*s*r-l*t*r;b.n22=g*x*F-i*t*F+i*s*G-c*x*G-g*s*r+c*t*r;b.n23=i*k*F-g*m*F-i*l*G+c*m*G+g*l*r-c*k*r;
-b.n24=g*m*s-i*k*s+i*l*t-c*m*t-g*l*x+c*k*x;b.n31=o*x*F-m*w*F+m*s*H-l*x*H-o*s*r+l*w*r;b.n32=i*w*F-e*x*F-i*s*H+c*x*H+e*s*r-c*w*r;b.n33=g*m*F-i*o*F+i*l*H-c*m*H-e*l*r+c*o*r;b.n34=i*o*s-e*m*s-i*l*w+c*m*w+e*l*x-c*o*x;b.n41=k*w*F-o*t*F-k*s*H+l*t*H+o*s*G-l*w*G;b.n42=e*t*F-g*w*F+g*s*H-c*t*H-e*s*G+c*w*G;b.n43=g*o*F-e*k*F-g*l*H+c*k*H+e*l*G-c*o*G;b.n44=e*k*s-g*o*s+g*l*w-c*k*w-e*l*t+c*o*t;b.multiplyScalar(1/a.determinant());return b};
-THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,e=a.n33*a.n22-a.n32*a.n23,g=-a.n33*a.n21+a.n31*a.n23,i=a.n32*a.n21-a.n31*a.n22,l=-a.n33*a.n12+a.n32*a.n13,o=a.n33*a.n11-a.n31*a.n13,k=-a.n32*a.n11+a.n31*a.n12,m=a.n23*a.n12-a.n22*a.n13,s=-a.n23*a.n11+a.n21*a.n13,w=a.n22*a.n11-a.n21*a.n12;a=a.n11*e+a.n21*l+a.n31*m;if(a==0)throw"matrix not invertible";a=1/a;c[0]=a*e;c[1]=a*g;c[2]=a*i;c[3]=a*l;c[4]=a*o;c[5]=a*k;c[6]=a*m;c[7]=a*s;c[8]=a*w;return b};
-THREE.Matrix4.makeFrustum=function(a,b,c,e,g,i){var l;l=new THREE.Matrix4;l.n11=2*g/(b-a);l.n12=0;l.n13=(b+a)/(b-a);l.n14=0;l.n21=0;l.n22=2*g/(e-c);l.n23=(e+c)/(e-c);l.n24=0;l.n31=0;l.n32=0;l.n33=-(i+g)/(i-g);l.n34=-2*i*g/(i-g);l.n41=0;l.n42=0;l.n43=-1;l.n44=0;return l};THREE.Matrix4.makePerspective=function(a,b,c,e){var g;a=c*Math.tan(a*Math.PI/360);g=-a;return THREE.Matrix4.makeFrustum(g*b,a*b,g,a,c,e)};
-THREE.Matrix4.makeOrtho=function(a,b,c,e,g,i){var l,o,k,m;l=new THREE.Matrix4;o=b-a;k=c-e;m=i-g;l.n11=2/o;l.n12=0;l.n13=0;l.n14=-((b+a)/o);l.n21=0;l.n22=2/k;l.n23=0;l.n24=-((c+e)/k);l.n31=0;l.n32=0;l.n33=-2/m;l.n34=-((i+g)/m);l.n41=0;l.n42=0;l.n43=0;l.n44=1;return l};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3;
-THREE.Quaternion=function(a,b,c,e){this.x=a||0;this.y=b||0;this.z=c||0;this.w=e!==undefined?e:1;this.api={isDirty:!1,that:this,get x(){return this.that.x},get y(){return this.that.y},get z(){return this.that.z},get w(){return this.that.w},set x(g){this.that.x=g;this.isDirty=!0},set y(g){this.that.y=g;this.isDirty=!0},set z(g){this.that.z=g;this.isDirty=!0},set w(g){this.that.w=g;this.isDirty=!0}};this.api.__proto__=THREE.Quaternion.prototype;return this.api};
-THREE.Quaternion.prototype.set=function(a,b,c,e){var g=this.that;g.x=a;g.y=b;g.z=c;g.w=e;this.isDirty=!0;return this};THREE.Quaternion.prototype.setFromEuler=function(a){var b=0.5*Math.PI/360,c=a.x*b,e=a.y*b,g=a.z*b;a=Math.cos(e);e=Math.sin(e);b=Math.cos(-g);g=Math.sin(-g);var i=Math.cos(c);c=Math.sin(c);var l=a*b,o=e*g,k=this.that;k.w=l*i-o*c;k.x=l*c+o*i;k.y=e*b*i+a*g*c;k.z=a*g*i-e*b*c;this.isDirty=!0;return this};
-THREE.Quaternion.prototype.calculateW=function(){var a=this.that,b=a.x,c=a.y,e=a.z;a.w=-Math.sqrt(Math.abs(1-b*b-c*c-e*e));this.isDirty=!0;return this};THREE.Quaternion.prototype.inverse=function(){var a=this.that;a.x*=-1;a.y*=-1;a.z*=-1;this.isDirty=!0;return this};THREE.Quaternion.prototype.length=function(){var a=this.that;return Math.sqrt(a.x*a.x+a.y*a.y+a.z*a.z+a.w*a.w)};
-THREE.Quaternion.prototype.normalize=function(){var a=this.that,b=a.x,c=a.y,e=a.z,g=a.w,i=Math.sqrt(b*b+c*c+e*e+g*g);if(i==0){a.x=0;a.y=0;a.z=0;a.w=0;this.isDirty=!0;return this}i=1/i;a.x=b*i;a.y=c*i;a.z=e*i;a.w=g*i;this.isDirty=!0;return this};
+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,d){this.set(1,0,0,a,0,1,0,b,0,0,1,d,0,0,0,1);
+return this},setScale:function(a,b,d){this.set(a,0,0,0,0,b,0,0,0,0,d,0,0,0,0,1);return this},setRotX: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},setRotY: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},setRotZ: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},setRotAxis:function(a,b){var d=Math.cos(b),e=Math.sin(b),g=1-d,i=a.x,l=a.y,o=a.z,k=g*
+i,m=g*l;this.set(k*i+d,k*l-e*o,k*o+e*l,0,k*l+e*o,m*l+d,m*o-e*i,0,k*o-e*l,m*o+e*i,g*o*o+d,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var b=a.x,d=a.y,e=a.z;a=Math.cos(d);d=Math.sin(d);var g=Math.cos(-e);e=Math.sin(-e);var i=Math.cos(b);b=Math.sin(b);var l=a*e,o=d*e;this.n11=a*g;this.n12=d*b-l*i;this.n13=l*b+d*i;this.n21=e;this.n22=g*i;this.n23=-g*b;this.n31=-d*g;this.n32=o*i+a*b;this.n33=-o*b+a*i},setRotationFromQuaternion:function(a){var b=
+a.x,d=a.y,e=a.z,g=a.w,i=b+b,l=d+d,o=e+e;a=b*i;var k=b*l;b*=o;var m=d*l;d*=o;e*=o;i*=g;l*=g;g*=o;this.n11=1-(m+e);this.n12=k-g;this.n13=b+l;this.n21=k+g;this.n22=1-(a+e);this.n23=d-i;this.n31=b-l;this.n32=d+i;this.n33=1-(a+m)},scale:function(a){var b=a.x,d=a.y;a=a.z;this.n11*=b;this.n12*=b;this.n13*=b;this.n21*=d;this.n22*=d;this.n23*=d;this.n31*=a;this.n32*=a;this.n33*=a;return this},extractRotationMatrix:function(a){a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=0;a.n21=this.n21;a.n22=this.n22;
+a.n23=this.n23;a.n24=0;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=0;a.n41=0;a.n42=0;a.n43=0;a.n44=1},toString:function(){return"| "+this.n11+" "+this.n12+" "+this.n13+" "+this.n14+" |\n| "+this.n21+" "+this.n22+" "+this.n23+" "+this.n24+" |\n| "+this.n31+" "+this.n32+" "+this.n33+" "+this.n34+" |\n| "+this.n41+" "+this.n42+" "+this.n43+" "+this.n44+" |"}};THREE.Matrix4.translationMatrix=function(a,b,d){var e=new THREE.Matrix4;e.setTranslation(a,b,d);return e};
+THREE.Matrix4.scaleMatrix=function(a,b,d){var e=new THREE.Matrix4;e.setScale(a,b,d);return e};THREE.Matrix4.rotationXMatrix=function(a){var b=new THREE.Matrix4;b.setRotX(a);return b};THREE.Matrix4.rotationYMatrix=function(a){var b=new THREE.Matrix4;b.setRotY(a);return b};THREE.Matrix4.rotationZMatrix=function(a){var b=new THREE.Matrix4;b.setRotZ(a);return b};THREE.Matrix4.rotationAxisAngleMatrix=function(a,b){var d=new THREE.Matrix4;d.setRotAxis(a,b);return d};
+THREE.Matrix4.makeInvert=function(a,b){var d=a.n11,e=a.n12,g=a.n13,i=a.n14,l=a.n21,o=a.n22,k=a.n23,m=a.n24,s=a.n31,w=a.n32,u=a.n33,x=a.n34,F=a.n41,I=a.n42,H=a.n43,r=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=k*x*I-m*u*I+m*w*H-o*x*H-k*w*r+o*u*r;b.n12=i*u*I-g*x*I-i*w*H+e*x*H+g*w*r-e*u*r;b.n13=g*m*I-i*k*I+i*o*H-e*m*H-g*o*r+e*k*r;b.n14=i*k*w-g*m*w-i*o*u+e*m*u+g*o*x-e*k*x;b.n21=m*u*F-k*x*F-m*s*H+l*x*H+k*s*r-l*u*r;b.n22=g*x*F-i*u*F+i*s*H-d*x*H-g*s*r+d*u*r;b.n23=i*k*F-g*m*F-i*l*H+d*m*H+g*l*r-d*k*r;
+b.n24=g*m*s-i*k*s+i*l*u-d*m*u-g*l*x+d*k*x;b.n31=o*x*F-m*w*F+m*s*I-l*x*I-o*s*r+l*w*r;b.n32=i*w*F-e*x*F-i*s*I+d*x*I+e*s*r-d*w*r;b.n33=g*m*F-i*o*F+i*l*I-d*m*I-e*l*r+d*o*r;b.n34=i*o*s-e*m*s-i*l*w+d*m*w+e*l*x-d*o*x;b.n41=k*w*F-o*u*F-k*s*I+l*u*I+o*s*H-l*w*H;b.n42=e*u*F-g*w*F+g*s*I-d*u*I-e*s*H+d*w*H;b.n43=g*o*F-e*k*F-g*l*I+d*k*I+e*l*H-d*o*H;b.n44=e*k*s-g*o*s+g*l*w-d*k*w-e*l*u+d*o*u;b.multiplyScalar(1/a.determinant());return b};
+THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,d=b.m,e=a.n33*a.n22-a.n32*a.n23,g=-a.n33*a.n21+a.n31*a.n23,i=a.n32*a.n21-a.n31*a.n22,l=-a.n33*a.n12+a.n32*a.n13,o=a.n33*a.n11-a.n31*a.n13,k=-a.n32*a.n11+a.n31*a.n12,m=a.n23*a.n12-a.n22*a.n13,s=-a.n23*a.n11+a.n21*a.n13,w=a.n22*a.n11-a.n21*a.n12;a=a.n11*e+a.n21*l+a.n31*m;if(a==0)throw"matrix not invertible";a=1/a;d[0]=a*e;d[1]=a*g;d[2]=a*i;d[3]=a*l;d[4]=a*o;d[5]=a*k;d[6]=a*m;d[7]=a*s;d[8]=a*w;return b};
+THREE.Matrix4.makeFrustum=function(a,b,d,e,g,i){var l;l=new THREE.Matrix4;l.n11=2*g/(b-a);l.n12=0;l.n13=(b+a)/(b-a);l.n14=0;l.n21=0;l.n22=2*g/(e-d);l.n23=(e+d)/(e-d);l.n24=0;l.n31=0;l.n32=0;l.n33=-(i+g)/(i-g);l.n34=-2*i*g/(i-g);l.n41=0;l.n42=0;l.n43=-1;l.n44=0;return l};THREE.Matrix4.makePerspective=function(a,b,d,e){var g;a=d*Math.tan(a*Math.PI/360);g=-a;return THREE.Matrix4.makeFrustum(g*b,a*b,g,a,d,e)};
+THREE.Matrix4.makeOrtho=function(a,b,d,e,g,i){var l,o,k,m;l=new THREE.Matrix4;o=b-a;k=d-e;m=i-g;l.n11=2/o;l.n12=0;l.n13=0;l.n14=-((b+a)/o);l.n21=0;l.n22=2/k;l.n23=0;l.n24=-((d+e)/k);l.n31=0;l.n32=0;l.n33=-2/m;l.n34=-((i+g)/m);l.n41=0;l.n42=0;l.n43=0;l.n44=1;return l};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3;
+THREE.Quaternion=function(a,b,d,e){this.x=a||0;this.y=b||0;this.z=d||0;this.w=e!==undefined?e:1;this.api={isDirty:!1,that:this,get x(){return this.that.x},get y(){return this.that.y},get z(){return this.that.z},get w(){return this.that.w},set x(g){this.that.x=g;this.isDirty=!0},set y(g){this.that.y=g;this.isDirty=!0},set z(g){this.that.z=g;this.isDirty=!0},set w(g){this.that.w=g;this.isDirty=!0}};this.api.__proto__=THREE.Quaternion.prototype;return this.api};
+THREE.Quaternion.prototype.set=function(a,b,d,e){var g=this.that;g.x=a;g.y=b;g.z=d;g.w=e;this.isDirty=!0;return this};THREE.Quaternion.prototype.setFromEuler=function(a){var b=0.5*Math.PI/360,d=a.x*b,e=a.y*b,g=a.z*b;a=Math.cos(e);e=Math.sin(e);b=Math.cos(-g);g=Math.sin(-g);var i=Math.cos(d);d=Math.sin(d);var l=a*b,o=e*g,k=this.that;k.w=l*i-o*d;k.x=l*d+o*i;k.y=e*b*i+a*g*d;k.z=a*g*i-e*b*d;this.isDirty=!0;return this};
+THREE.Quaternion.prototype.calculateW=function(){var a=this.that,b=a.x,d=a.y,e=a.z;a.w=-Math.sqrt(Math.abs(1-b*b-d*d-e*e));this.isDirty=!0;return this};THREE.Quaternion.prototype.inverse=function(){var a=this.that;a.x*=-1;a.y*=-1;a.z*=-1;this.isDirty=!0;return this};THREE.Quaternion.prototype.length=function(){var a=this.that;return Math.sqrt(a.x*a.x+a.y*a.y+a.z*a.z+a.w*a.w)};
+THREE.Quaternion.prototype.normalize=function(){var a=this.that,b=a.x,d=a.y,e=a.z,g=a.w,i=Math.sqrt(b*b+d*d+e*e+g*g);if(i==0){a.x=0;a.y=0;a.z=0;a.w=0;this.isDirty=!0;return this}i=1/i;a.x=b*i;a.y=d*i;a.z=e*i;a.w=g*i;this.isDirty=!0;return this};
 THREE.Quaternion.prototype.multiplySelf=function(a){var b=this.that;qax=b.x;qay=b.y;qaz=b.z;qaw=b.w;qbx=a.x;qby=a.y;qbz=a.z;qbw=a.w;b.x=qax*qbw+qaw*qbx+qay*qbz-qaz*qby;b.y=qay*qbw+qaw*qby+qaz*qbx-qax*qbz;b.z=qaz*qbw+qaw*qbz+qax*qby-qay*qbx;b.w=qaw*qbw-qax*qbx-qay*qby-qaz*qbz;this.isDirty=!0;return this};
 THREE.Quaternion.prototype.multiplySelf=function(a){var b=this.that;qax=b.x;qay=b.y;qaz=b.z;qaw=b.w;qbx=a.x;qby=a.y;qbz=a.z;qbw=a.w;b.x=qax*qbw+qaw*qbx+qay*qbz-qaz*qby;b.y=qay*qbw+qaw*qby+qaz*qbx-qax*qbz;b.z=qaz*qbw+qaw*qbz+qax*qby-qay*qbx;b.w=qaw*qbw-qax*qbx-qay*qby-qaz*qbz;this.isDirty=!0;return this};
-THREE.Quaternion.prototype.multiplyVector3=function(a,b){b||(b=a);var c=this.that,e=a.x,g=a.y,i=a.z,l=c.x,o=c.y,k=c.z;c=c.w;var m=c*e+o*i-k*g,s=c*g+k*e-l*i,w=c*i+l*g-o*e;e=-l*e-o*g-k*i;b.x=m*c+e*-l+s*-k-w*-o;b.y=s*c+e*-o+w*-l-m*-k;b.z=w*c+e*-k+m*-o-s*-l;return b};THREE.Quaternion.prototype.toMatrix3=function(){};THREE.Quaternion.prototype.toMatrix4=function(){};
-THREE.Quaternion.slerp=function(a,b,c,e){var g=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(g)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var i=Math.acos(g),l=Math.sqrt(1-g*g);if(Math.abs(l)<0.0010){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}g=Math.sin((1-e)*i)/l;e=Math.sin(e*i)/l;c.w=a.w*g+b.w*e;c.x=a.x*g+b.x*e;c.y=a.y*g+b.y*e;c.z=a.z*g+b.z*e;return c};
+THREE.Quaternion.prototype.multiplyVector3=function(a,b){b||(b=a);var d=this.that,e=a.x,g=a.y,i=a.z,l=d.x,o=d.y,k=d.z;d=d.w;var m=d*e+o*i-k*g,s=d*g+k*e-l*i,w=d*i+l*g-o*e;e=-l*e-o*g-k*i;b.x=m*d+e*-l+s*-k-w*-o;b.y=s*d+e*-o+w*-l-m*-k;b.z=w*d+e*-k+m*-o-s*-l;return b};THREE.Quaternion.prototype.toMatrix3=function(){};THREE.Quaternion.prototype.toMatrix4=function(){};
+THREE.Quaternion.slerp=function(a,b,d,e){var g=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(g)>=1){d.w=a.w;d.x=a.x;d.y=a.y;d.z=a.z;return d}var i=Math.acos(g),l=Math.sqrt(1-g*g);if(Math.abs(l)<0.0010){d.w=0.5*(a.w+b.w);d.x=0.5*(a.x+b.x);d.y=0.5*(a.y+b.y);d.z=0.5*(a.z+b.z);return d}g=Math.sin((1-e)*i)/l;e=Math.sin(e*i)/l;d.w=a.w*g+b.w*e;d.x=a.x*g+b.x*e;d.y=a.y*g+b.y*e;d.z=a.z*g+b.z*e;return d};
 THREE.Vertex=function(a,b){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=b||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=!0};THREE.Vertex.prototype={toString:function(){return"THREE.Vertex ( position: "+this.position+", normal: "+this.normal+" )"}};
 THREE.Vertex=function(a,b){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=b||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=!0};THREE.Vertex.prototype={toString:function(){return"THREE.Vertex ( position: "+this.position+", normal: "+this.normal+" )"}};
-THREE.Face3=function(a,b,c,e,g){this.a=a;this.b=b;this.c=c;this.centroid=new THREE.Vector3;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.materials=g instanceof Array?g:[g]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}};
-THREE.Face4=function(a,b,c,e,g,i){this.a=a;this.b=b;this.c=c;this.d=e;this.centroid=new THREE.Vector3;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.materials=i instanceof Array?i:[i]};THREE.Face4.prototype={toString:function(){return"THREE.Face4 ( "+this.a+", "+this.b+", "+this.c+" "+this.d+" )"}};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};
+THREE.Face3=function(a,b,d,e,g){this.a=a;this.b=b;this.c=d;this.centroid=new THREE.Vector3;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.materials=g instanceof Array?g:[g]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}};
+THREE.Face4=function(a,b,d,e,g,i){this.a=a;this.b=b;this.c=d;this.d=e;this.centroid=new THREE.Vector3;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.materials=i instanceof Array?i:[i]};THREE.Face4.prototype={toString:function(){return"THREE.Face4 ( "+this.a+", "+this.b+", "+this.c+" "+this.d+" )"}};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};
 THREE.UV.prototype={copy:function(a){this.u=a.u;this.v=a.v},toString:function(){return"THREE.UV ("+this.u+", "+this.v+")"}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.faces=[];this.uvs=[];this.uvs2=[];this.colors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.geometryChunks={};this.hasTangents=!1};
 THREE.UV.prototype={copy:function(a){this.u=a.u;this.v=a.v},toString:function(){return"THREE.UV ("+this.u+", "+this.v+")"}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.faces=[];this.uvs=[];this.uvs2=[];this.colors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.geometryChunks={};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);
-c.centroid.addSelf(this.vertices[c.d].position);c.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var b,c,e,g,i,l,o=new THREE.Vector3,k=new THREE.Vector3;e=0;for(g=this.vertices.length;e<g;e++){i=this.vertices[e];i.normal.set(0,0,0)}e=0;for(g=this.faces.length;e<g;e++){i=this.faces[e];if(a&&i.vertexNormals.length){o.set(0,0,0);b=0;for(c=i.normal.length;b<c;b++)o.addSelf(i.vertexNormals[b]);o.divideScalar(3)}else{b=this.vertices[i.a];c=this.vertices[i.b];l=this.vertices[i.c];o.sub(l.position,
-c.position);k.sub(b.position,c.position);o.crossSelf(k)}o.isZero()||o.normalize();i.normal.copy(o)}},computeVertexNormals:function(){var a,b,c,e;if(this.__tmpVertices==undefined){e=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)e[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{e=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)e[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){e[c.a].addSelf(c.normal);e[c.b].addSelf(c.normal);e[c.c].addSelf(c.normal)}else if(c instanceof THREE.Face4){e[c.a].addSelf(c.normal);e[c.b].addSelf(c.normal);e[c.c].addSelf(c.normal);e[c.d].addSelf(c.normal)}}a=0;for(b=this.vertices.length;a<b;a++)e[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(e[c.a]);c.vertexNormals[1].copy(e[c.b]);c.vertexNormals[2].copy(e[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(e[c.a]);c.vertexNormals[1].copy(e[c.b]);c.vertexNormals[2].copy(e[c.c]);c.vertexNormals[3].copy(e[c.d])}}},computeTangents:function(){function a(B,I,ka,P,ja,ca,Q){i=B.vertices[I].position;l=B.vertices[ka].position;o=B.vertices[P].position;k=g[ja];m=g[ca];s=g[Q];w=l.x-i.x;t=o.x-i.x;x=l.y-i.y;F=o.y-
-i.y;H=l.z-i.z;G=o.z-i.z;r=m.u-k.u;Z=s.u-k.u;D=m.v-k.v;K=s.v-k.v;d=1/(r*K-Z*D);N.set((K*w-D*t)*d,(K*x-D*F)*d,(K*H-D*G)*d);ba.set((r*t-Z*w)*d,(r*F-Z*x)*d,(r*G-Z*H)*d);ga[I].addSelf(N);ga[ka].addSelf(N);ga[P].addSelf(N);T[I].addSelf(ba);T[ka].addSelf(ba);T[P].addSelf(ba)}var b,c,e,g,i,l,o,k,m,s,w,t,x,F,H,G,r,Z,D,K,d,ga=[],T=[],N=new THREE.Vector3,ba=new THREE.Vector3,R=new THREE.Vector3,aa=new THREE.Vector3,V=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++){ga[b]=new THREE.Vector3;T[b]=new THREE.Vector3}b=
-0;for(c=this.faces.length;b<c;b++){e=this.faces[b];g=this.uvs[b];if(e instanceof THREE.Face3){a(this,e.a,e.b,e.c,0,1,2);this.vertices[e.a].normal.copy(e.vertexNormals[0]);this.vertices[e.b].normal.copy(e.vertexNormals[1]);this.vertices[e.c].normal.copy(e.vertexNormals[2])}else if(e instanceof THREE.Face4){a(this,e.a,e.b,e.c,0,1,2);a(this,e.a,e.b,e.d,0,1,3);this.vertices[e.a].normal.copy(e.vertexNormals[0]);this.vertices[e.b].normal.copy(e.vertexNormals[1]);this.vertices[e.c].normal.copy(e.vertexNormals[2]);
-this.vertices[e.d].normal.copy(e.vertexNormals[3])}}b=0;for(c=this.vertices.length;b<c;b++){V.copy(this.vertices[b].normal);e=ga[b];R.copy(e);R.subSelf(V.multiplyScalar(V.dot(e))).normalize();aa.cross(this.vertices[b].normal,e);e=aa.dot(T[b]);e=e<0?-1:1;this.vertices[b].tangent.set(R.x,R.y,R.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;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}},sortFacesByMaterial:function(){function a(s){var w=[];b=0;for(c=s.length;b<c;b++)s[b]==undefined?w.push("undefined"):w.push(s[b].id);return w.join("_")}var b,c,e,g,i,l,o,k,m={};e=0;for(g=this.faces.length;e<g;e++){i=this.faces[e];
+THREE.Geometry.prototype={computeCentroids:function(){var a,b,d;a=0;for(b=this.faces.length;a<b;a++){d=this.faces[a];d.centroid.set(0,0,0);if(d instanceof THREE.Face3){d.centroid.addSelf(this.vertices[d.a].position);d.centroid.addSelf(this.vertices[d.b].position);d.centroid.addSelf(this.vertices[d.c].position);d.centroid.divideScalar(3)}else if(d instanceof THREE.Face4){d.centroid.addSelf(this.vertices[d.a].position);d.centroid.addSelf(this.vertices[d.b].position);d.centroid.addSelf(this.vertices[d.c].position);
+d.centroid.addSelf(this.vertices[d.d].position);d.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var b,d,e,g,i,l,o=new THREE.Vector3,k=new THREE.Vector3;e=0;for(g=this.vertices.length;e<g;e++){i=this.vertices[e];i.normal.set(0,0,0)}e=0;for(g=this.faces.length;e<g;e++){i=this.faces[e];if(a&&i.vertexNormals.length){o.set(0,0,0);b=0;for(d=i.normal.length;b<d;b++)o.addSelf(i.vertexNormals[b]);o.divideScalar(3)}else{b=this.vertices[i.a];d=this.vertices[i.b];l=this.vertices[i.c];o.sub(l.position,
+d.position);k.sub(b.position,d.position);o.crossSelf(k)}o.isZero()||o.normalize();i.normal.copy(o)}},computeVertexNormals:function(){var a,b,d,e;if(this.__tmpVertices==undefined){e=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)e[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++){d=this.faces[a];if(d instanceof THREE.Face3)d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(d instanceof THREE.Face4)d.vertexNormals=[new THREE.Vector3,
+new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{e=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)e[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++){d=this.faces[a];if(d instanceof THREE.Face3){e[d.a].addSelf(d.normal);e[d.b].addSelf(d.normal);e[d.c].addSelf(d.normal)}else if(d instanceof THREE.Face4){e[d.a].addSelf(d.normal);e[d.b].addSelf(d.normal);e[d.c].addSelf(d.normal);e[d.d].addSelf(d.normal)}}a=0;for(b=this.vertices.length;a<b;a++)e[a].normalize();a=0;for(b=this.faces.length;a<
+b;a++){d=this.faces[a];if(d instanceof THREE.Face3){d.vertexNormals[0].copy(e[d.a]);d.vertexNormals[1].copy(e[d.b]);d.vertexNormals[2].copy(e[d.c])}else if(d instanceof THREE.Face4){d.vertexNormals[0].copy(e[d.a]);d.vertexNormals[1].copy(e[d.b]);d.vertexNormals[2].copy(e[d.c]);d.vertexNormals[3].copy(e[d.d])}}},computeTangents:function(){function a(D,J,la,Q,ja,ea,R){i=D.vertices[J].position;l=D.vertices[la].position;o=D.vertices[Q].position;k=g[ja];m=g[ea];s=g[R];w=l.x-i.x;u=o.x-i.x;x=l.y-i.y;F=o.y-
+i.y;I=l.z-i.z;H=o.z-i.z;r=m.u-k.u;Z=s.u-k.u;E=m.v-k.v;L=s.v-k.v;c=1/(r*L-Z*E);O.set((L*w-E*u)*c,(L*x-E*F)*c,(L*I-E*H)*c);ca.set((r*u-Z*w)*c,(r*F-Z*x)*c,(r*H-Z*I)*c);ia[J].addSelf(O);ia[la].addSelf(O);ia[Q].addSelf(O);T[J].addSelf(ca);T[la].addSelf(ca);T[Q].addSelf(ca)}var b,d,e,g,i,l,o,k,m,s,w,u,x,F,I,H,r,Z,E,L,c,ia=[],T=[],O=new THREE.Vector3,ca=new THREE.Vector3,S=new THREE.Vector3,ba=new THREE.Vector3,V=new THREE.Vector3;b=0;for(d=this.vertices.length;b<d;b++){ia[b]=new THREE.Vector3;T[b]=new THREE.Vector3}b=
+0;for(d=this.faces.length;b<d;b++){e=this.faces[b];g=this.uvs[b];if(e instanceof THREE.Face3){a(this,e.a,e.b,e.c,0,1,2);this.vertices[e.a].normal.copy(e.vertexNormals[0]);this.vertices[e.b].normal.copy(e.vertexNormals[1]);this.vertices[e.c].normal.copy(e.vertexNormals[2])}else if(e instanceof THREE.Face4){a(this,e.a,e.b,e.c,0,1,2);a(this,e.a,e.b,e.d,0,1,3);this.vertices[e.a].normal.copy(e.vertexNormals[0]);this.vertices[e.b].normal.copy(e.vertexNormals[1]);this.vertices[e.c].normal.copy(e.vertexNormals[2]);
+this.vertices[e.d].normal.copy(e.vertexNormals[3])}}b=0;for(d=this.vertices.length;b<d;b++){V.copy(this.vertices[b].normal);e=ia[b];S.copy(e);S.subSelf(V.multiplyScalar(V.dot(e))).normalize();ba.cross(this.vertices[b].normal,e);e=ba.dot(T[b]);e=e<0?-1:1;this.vertices[b].tangent.set(S.x,S.y,S.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,d=this.vertices.length;b<d;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,d=this.vertices.length;b<d;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}},sortFacesByMaterial:function(){function a(s){var w=[];b=0;for(d=s.length;b<d;b++)s[b]==undefined?w.push("undefined"):w.push(s[b].id);return w.join("_")}var b,d,e,g,i,l,o,k,m={};e=0;for(g=this.faces.length;e<g;e++){i=this.faces[e];
 l=i.materials;o=a(l);m[o]==undefined&&(m[o]={hash:o,counter:0});k=m[o].hash+"_"+m[o].counter;this.geometryChunks[k]==undefined&&(this.geometryChunks[k]={faces:[],materials:l,vertices:0});i=i instanceof THREE.Face3?3:4;if(this.geometryChunks[k].vertices+i>65535){m[o].counter+=1;k=m[o].hash+"_"+m[o].counter;this.geometryChunks[k]==undefined&&(this.geometryChunks[k]={faces:[],materials:l,vertices:0})}this.geometryChunks[k].faces.push(e);this.geometryChunks[k].vertices+=i}},toString:function(){return"THREE.Geometry ( vertices: "+
 l=i.materials;o=a(l);m[o]==undefined&&(m[o]={hash:o,counter:0});k=m[o].hash+"_"+m[o].counter;this.geometryChunks[k]==undefined&&(this.geometryChunks[k]={faces:[],materials:l,vertices:0});i=i instanceof THREE.Face3?3:4;if(this.geometryChunks[k].vertices+i>65535){m[o].counter+=1;k=m[o].hash+"_"+m[o].counter;this.geometryChunks[k]==undefined&&(this.geometryChunks[k]={faces:[],materials:l,vertices:0})}this.geometryChunks[k].faces.push(e);this.geometryChunks[k].vertices+=i}},toString:function(){return"THREE.Geometry ( vertices: "+
 this.vertices+", faces: "+this.faces+", uvs: "+this.uvs+" )"}};THREE.GeometryIdCounter=0;
 this.vertices+", faces: "+this.faces+", uvs: "+this.uvs+" )"}};THREE.GeometryIdCounter=0;
 THREE.Object3D=function(){this.id=THREE.Object3DCounter.value++;this.visible=!0;this.autoUpdateMatrix=!0;this.matrixNeedsToUpdate=!0;this.parent=undefined;this.children=[];this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.localMatrix=new THREE.Matrix4;this.globalMatrix=new THREE.Matrix4;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.screenPosition=new THREE.Vector4;this.boundRadius=0;this.boundRadiusScale=1;this.rotationMatrix=
 THREE.Object3D=function(){this.id=THREE.Object3DCounter.value++;this.visible=!0;this.autoUpdateMatrix=!0;this.matrixNeedsToUpdate=!0;this.parent=undefined;this.children=[];this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.localMatrix=new THREE.Matrix4;this.globalMatrix=new THREE.Matrix4;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.screenPosition=new THREE.Vector4;this.boundRadius=0;this.boundRadiusScale=1;this.rotationMatrix=
-new THREE.Matrix4};THREE.Object3D.prototype.update=function(a,b,c){if(this.visible){this.autoUpdateMatrix&&(b|=this.updateMatrix());if(b||this.matrixNeedsToUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsToUpdate=!1;b=!0}var e=this.children.length;for(a=0;a<e;a++)this.children[a].update(this.globalMatrix,b,c)}};
+new THREE.Matrix4};THREE.Object3D.prototype.update=function(a,b,d){if(this.visible){this.autoUpdateMatrix&&(b|=this.updateMatrix());if(b||this.matrixNeedsToUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsToUpdate=!1;b=!0}var e=this.children.length;for(a=0;a<e;a++)this.children[a].update(this.globalMatrix,b,d)}};
 THREE.Object3D.prototype.updateMatrix=function(){this.localMatrix.setPosition(this.position);if(this.useQuaternion){if(this.quaternion.isDirty){this.localMatrix.setRotationFromQuaternion(this.quaternion);this.quaternion.isDirty=!1}}else this.localMatrix.setRotationFromEuler(this.rotation);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1){this.localMatrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}return!0};
 THREE.Object3D.prototype.updateMatrix=function(){this.localMatrix.setPosition(this.position);if(this.useQuaternion){if(this.quaternion.isDirty){this.localMatrix.setRotationFromQuaternion(this.quaternion);this.quaternion.isDirty=!1}}else this.localMatrix.setRotationFromEuler(this.rotation);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1){this.localMatrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}return!0};
 THREE.Object3D.prototype.addChild=function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a)}};THREE.Object3D.prototype.removeChild=function(a){var b=this.children.indexOf(a);if(b!==-1){this.children.splice(b,1);a.parent=undefined}};THREE.Object3DCounter={value:0};THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.autoUpdateMatrix=!1};THREE.Particle.prototype=new THREE.Object3D;
 THREE.Object3D.prototype.addChild=function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a)}};THREE.Object3D.prototype.removeChild=function(a){var b=this.children.indexOf(a);if(b!==-1){this.children.splice(b,1);a.parent=undefined}};THREE.Object3DCounter={value:0};THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.autoUpdateMatrix=!1};THREE.Particle.prototype=new THREE.Object3D;
-THREE.Particle.prototype.constructor=THREE.Particle;THREE.ParticleSystem=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.sortParticles=!1};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;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.Particle.prototype.constructor=THREE.Particle;THREE.ParticleSystem=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.sortParticles=!1};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;THREE.Line=function(a,b,d){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.type=d!=undefined?d:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;
 THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b&&b.length?b:[b];this.flipSided=!1;this.doubleSided=!1;this.overdraw=!1;if(this.geometry){this.geometry.boundingSphere||this.geometry.computeBoundingSphere();this.boundRadius=a.boundingSphere.radius}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;
 THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b&&b.length?b:[b];this.flipSided=!1;this.doubleSided=!1;this.overdraw=!1;if(this.geometry){this.geometry.boundingSphere||this.geometry.computeBoundingSphere();this.boundRadius=a.boundingSphere.radius}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;
-THREE.Mesh.prototype.update=function(a,b,c){if(this.visible){this.autoUpdateMatrix&&(b|=this.updateMatrix());if(b||this.matrixNeedsToUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsToUpdate=!1;b=!0}for(a=0;a<this.children.length;a++)this.children[a].update(this.globalMatrix,b,c)}};THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;
+THREE.Mesh.prototype.update=function(a,b,d){if(this.visible){this.autoUpdateMatrix&&(b|=this.updateMatrix());if(b||this.matrixNeedsToUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsToUpdate=!1;b=!0}for(a=0;a<this.children.length;a++)this.children[a].update(this.globalMatrix,b,d)}};THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;
 THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
 THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
-THREE.Bone.prototype.update=function(a,b,c){this.autoUpdateMatrix&&(b|=this.updateMatrix());if(b||this.matrixNeedsToUpdate){a?this.skinMatrix.multiply(a,this.localMatrix):this.skinMatrix.copy(this.localMatrix);this.matrixNeedsToUpdate=!1;b=!0}var e,g=this.children.length;if(this.hasNoneBoneChildren){this.globalMatrix.multiply(this.skin.globalMatrix,this.skinMatrix);for(e=0;e<g;e++){a=this.children[e];a instanceof THREE.Bone?a.update(this.skinMatrix,b,c):a.update(this.globalMatrix,!0,c)}}else for(e=
-0;e<g;e++)this.children[e].update(this.skinMatrix,b,c)};THREE.Bone.prototype.addChild=function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);if(!(a instanceof THREE.Bone))this.hasNoneBoneChildren=!0}};if(!window.Float32Array)window.Float32Array=Array;
-THREE.SkinnedMesh=function(a,b){THREE.Mesh.call(this,a,b);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var c,e,g,i,l,o;if(this.geometry.bones!==undefined){for(c=0;c<this.geometry.bones.length;c++){g=this.geometry.bones[c];i=g.pos;l=g.rotq;o=g.scl;e=this.addBone();e.name=g.name;e.position.set(i[0],i[1],i[2]);e.quaternion.set(l[0],l[1],l[2],l[3]);o!==undefined?e.scale.set(o[0],o[1],o[2]):e.scale.set(1,1,1)}for(c=0;c<this.bones.length;c++){g=this.geometry.bones[c];e=this.bones[c];
+THREE.Bone.prototype.update=function(a,b,d){this.autoUpdateMatrix&&(b|=this.updateMatrix());if(b||this.matrixNeedsToUpdate){a?this.skinMatrix.multiply(a,this.localMatrix):this.skinMatrix.copy(this.localMatrix);this.matrixNeedsToUpdate=!1;b=!0}var e,g=this.children.length;if(this.hasNoneBoneChildren){this.globalMatrix.multiply(this.skin.globalMatrix,this.skinMatrix);for(e=0;e<g;e++){a=this.children[e];a instanceof THREE.Bone?a.update(this.skinMatrix,b,d):a.update(this.globalMatrix,!0,d)}}else for(e=
+0;e<g;e++)this.children[e].update(this.skinMatrix,b,d)};THREE.Bone.prototype.addChild=function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);if(!(a instanceof THREE.Bone))this.hasNoneBoneChildren=!0}};if(!window.Float32Array)window.Float32Array=Array;
+THREE.SkinnedMesh=function(a,b){THREE.Mesh.call(this,a,b);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var d,e,g,i,l,o;if(this.geometry.bones!==undefined){for(d=0;d<this.geometry.bones.length;d++){g=this.geometry.bones[d];i=g.pos;l=g.rotq;o=g.scl;e=this.addBone();e.name=g.name;e.position.set(i[0],i[1],i[2]);e.quaternion.set(l[0],l[1],l[2],l[3]);o!==undefined?e.scale.set(o[0],o[1],o[2]):e.scale.set(1,1,1)}for(d=0;d<this.bones.length;d++){g=this.geometry.bones[d];e=this.bones[d];
 g.parent===-1?this.addChild(e):this.bones[g.parent].addChild(e)}this.boneMatrices=new Float32Array(16*this.bones.length);this.pose()}};THREE.SkinnedMesh.prototype=new THREE.Mesh;THREE.SkinnedMesh.prototype.constructor=THREE.SkinnedMesh;
 g.parent===-1?this.addChild(e):this.bones[g.parent].addChild(e)}this.boneMatrices=new Float32Array(16*this.bones.length);this.pose()}};THREE.SkinnedMesh.prototype=new THREE.Mesh;THREE.SkinnedMesh.prototype.constructor=THREE.SkinnedMesh;
-THREE.SkinnedMesh.prototype.update=function(a,b,c){if(this.visible){this.autoUpdateMatrix&&(b|=this.updateMatrix());if(b||this.matrixNeedsToUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsToUpdate=!1;b=!0}var e,g=this.children.length;for(e=0;e<g;e++){a=this.children[e];a instanceof THREE.Bone?a.update(this.identityMatrix,!1,c):a.update(this.globalMatrix,b,c)}}};
+THREE.SkinnedMesh.prototype.update=function(a,b,d){if(this.visible){this.autoUpdateMatrix&&(b|=this.updateMatrix());if(b||this.matrixNeedsToUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsToUpdate=!1;b=!0}var e,g=this.children.length;for(e=0;e<g;e++){a=this.children[e];a instanceof THREE.Bone?a.update(this.identityMatrix,!1,d):a.update(this.globalMatrix,b,d)}}};
 THREE.SkinnedMesh.prototype.addBone=function(a){a===undefined&&(a=new THREE.Bone(this));this.bones.push(a);return a};
 THREE.SkinnedMesh.prototype.addBone=function(a){a===undefined&&(a=new THREE.Bone(this));this.bones.push(a);return a};
-THREE.SkinnedMesh.prototype.pose=function(){this.update(undefined,!0);for(var a,b=[],c=0;c<this.bones.length;c++){a=this.bones[c];b.push(THREE.Matrix4.makeInvert(a.skinMatrix));a.skinMatrix.flattenToArrayOffset(this.boneMatrices,c*16)}if(this.geometry.skinVerticesA===undefined){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];var e;for(a=0;a<this.geometry.skinIndices.length;a++){c=this.geometry.vertices[a].position;var g=this.geometry.skinIndices[a].x,i=this.geometry.skinIndices[a].y;
-e=new THREE.Vector3(c.x,c.y,c.z);this.geometry.skinVerticesA.push(b[g].multiplyVector3(e));e=new THREE.Vector3(c.x,c.y,c.z);this.geometry.skinVerticesB.push(b[i].multiplyVector3(e));if(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y!==1){c=(1-(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y))*0.5;this.geometry.skinWeights[a].x+=c;this.geometry.skinWeights[a].y+=c}}}};
-THREE.AnimationHandler=function(){var a=[],b={};b.update=function(c){for(var e=0;e<a.length;e++)a[e].update(c)};b.add=function(c){a.indexOf(c)===-1&&a.push(c)};b.remove=function(c){a.indexOf(c)!==-1&&a.splice(childIndex,1)};b.initData=function(c){if(c.initialized!==!0){for(var e=0;e<c.hierarchy.length;e++)for(var g=0;g<c.hierarchy[e].keys.length;g++){if(c.hierarchy[e].keys[g].time<0)c.hierarchy[e].keys[g].time=0;c.hierarchy[e].keys[g].index=g;if(c.hierarchy[e].keys[g].rot!==undefined&&!(c.hierarchy[e].keys[g].rot instanceof
-THREE.Quaternion)){var i=c.hierarchy[e].keys[g].rot;c.hierarchy[e].keys[g].rot=new THREE.Quaternion(i[0],i[1],i[2],i[3])}}g=parseInt(c.length*c.fps,10);c.JIT={};c.JIT.hierarchy=[];for(e=0;e<c.hierarchy.length;e++)c.JIT.hierarchy.push(Array(g));c.initialized=!0}};return b}();
-THREE.Animation=function(a,b){this.root=a;this.data=b;this.hierarchy=[];this.startTime=0;this.isPlaying=!1;this.loop=!0;this.offset=0;this.data.initialized||THREE.AnimationHandler.initData(this.data);if(a instanceof THREE.SkinnedMesh)for(var c=0;c<this.root.bones.length;c++)this.hierarchy.push(this.root.bones[c])};
+THREE.SkinnedMesh.prototype.pose=function(){this.update(undefined,!0);for(var a,b=[],d=0;d<this.bones.length;d++){a=this.bones[d];b.push(THREE.Matrix4.makeInvert(a.skinMatrix));a.skinMatrix.flattenToArrayOffset(this.boneMatrices,d*16)}if(this.geometry.skinVerticesA===undefined){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];var e;for(a=0;a<this.geometry.skinIndices.length;a++){d=this.geometry.vertices[a].position;var g=this.geometry.skinIndices[a].x,i=this.geometry.skinIndices[a].y;
+e=new THREE.Vector3(d.x,d.y,d.z);this.geometry.skinVerticesA.push(b[g].multiplyVector3(e));e=new THREE.Vector3(d.x,d.y,d.z);this.geometry.skinVerticesB.push(b[i].multiplyVector3(e));if(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y!==1){d=(1-(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y))*0.5;this.geometry.skinWeights[a].x+=d;this.geometry.skinWeights[a].y+=d}}}};
+THREE.Ribbon=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.flipSided=!1;this.doubleSided=!1};THREE.Ribbon.prototype=new THREE.Object3D;THREE.Ribbon.prototype.constructor=THREE.Ribbon;
+THREE.AnimationHandler=function(){var a=[],b={};b.update=function(d){for(var e=0;e<a.length;e++)a[e].update(d)};b.add=function(d){a.indexOf(d)===-1&&a.push(d)};b.remove=function(d){a.indexOf(d)!==-1&&a.splice(childIndex,1)};b.initData=function(d){if(d.initialized!==!0){for(var e=0;e<d.hierarchy.length;e++)for(var g=0;g<d.hierarchy[e].keys.length;g++){if(d.hierarchy[e].keys[g].time<0)d.hierarchy[e].keys[g].time=0;d.hierarchy[e].keys[g].index=g;if(d.hierarchy[e].keys[g].rot!==undefined&&!(d.hierarchy[e].keys[g].rot instanceof
+THREE.Quaternion)){var i=d.hierarchy[e].keys[g].rot;d.hierarchy[e].keys[g].rot=new THREE.Quaternion(i[0],i[1],i[2],i[3])}}g=parseInt(d.length*d.fps,10);d.JIT={};d.JIT.hierarchy=[];for(e=0;e<d.hierarchy.length;e++)d.JIT.hierarchy.push(Array(g));d.initialized=!0}};return b}();
+THREE.Animation=function(a,b){this.root=a;this.data=b;this.hierarchy=[];this.startTime=0;this.isPlaying=!1;this.loop=!0;this.offset=0;this.data.initialized||THREE.AnimationHandler.initData(this.data);if(a instanceof THREE.SkinnedMesh)for(var d=0;d<this.root.bones.length;d++)this.hierarchy.push(this.root.bones[d])};
 THREE.Animation.prototype.play=function(){if(!this.isPlaying){this.isPlaying=!0;this.startTime=(new Date).getTime()*0.0010;for(var a=0;a<this.hierarchy.length;a++){this.hierarchy[a].useQuaternion=!0;this.hierarchy[a].autoUpdateMatrix=!0;if(this.hierarchy[a].prevKey===undefined){this.hierarchy[a].prevKey={pos:0,rot:0,scl:0};this.hierarchy[a].nextKey={pos:0,rot:0,scl:0}}this.hierarchy[a].prevKey.pos=this.data.hierarchy[a].keys[0];this.hierarchy[a].prevKey.rot=this.data.hierarchy[a].keys[0];this.hierarchy[a].prevKey.scl=
 THREE.Animation.prototype.play=function(){if(!this.isPlaying){this.isPlaying=!0;this.startTime=(new Date).getTime()*0.0010;for(var a=0;a<this.hierarchy.length;a++){this.hierarchy[a].useQuaternion=!0;this.hierarchy[a].autoUpdateMatrix=!0;if(this.hierarchy[a].prevKey===undefined){this.hierarchy[a].prevKey={pos:0,rot:0,scl:0};this.hierarchy[a].nextKey={pos:0,rot:0,scl:0}}this.hierarchy[a].prevKey.pos=this.data.hierarchy[a].keys[0];this.hierarchy[a].prevKey.rot=this.data.hierarchy[a].keys[0];this.hierarchy[a].prevKey.scl=
 this.data.hierarchy[a].keys[0];this.hierarchy[a].nextKey.pos=this.getNextKeyWith("pos",a,1);this.hierarchy[a].nextKey.rot=this.getNextKeyWith("rot",a,1);this.hierarchy[a].nextKey.scl=this.getNextKeyWith("scl",a,1)}this.update();THREE.AnimationHandler.add(this)}};THREE.Animation.prototype.pause=function(){THREE.AnimationHandler.remove(this)};THREE.Animation.prototype.stop=function(){this.isPlaying=!1;THREE.AnimationHandler.remove(this)};
 this.data.hierarchy[a].keys[0];this.hierarchy[a].nextKey.pos=this.getNextKeyWith("pos",a,1);this.hierarchy[a].nextKey.rot=this.getNextKeyWith("rot",a,1);this.hierarchy[a].nextKey.scl=this.getNextKeyWith("scl",a,1)}this.update();THREE.AnimationHandler.add(this)}};THREE.Animation.prototype.pause=function(){THREE.AnimationHandler.remove(this)};THREE.Animation.prototype.stop=function(){this.isPlaying=!1;THREE.AnimationHandler.remove(this)};
-THREE.Animation.prototype.update=function(){if(this.isPlaying){var a=["pos","rot","scl"],b,c,e,g,i,l,o=this.data.JIT.hierarchy,k=(new Date).getTime()*0.0010-this.startTime+this.offset,m=k;if(k>this.data.length){for(;k>this.data.length;)k-=this.data.length;this.startTime=(new Date).getTime()*0.0010-k;k=(new Date).getTime()*0.0010-this.startTime}l=Math.min(parseInt(k*this.data.fps),parseInt(this.data.length*this.data.fps));for(var s=0,w=this.hierarchy.length;s<w;s++){i=this.hierarchy[s];if(o[s][l]!==
-undefined){i.skinMatrix=o[s][l];i.autoUpdateMatrix=!1;i.matrixNeedsToUpdate=!1;i.skinMatrix.flattenToArrayOffset(this.root.boneMatrices,s*16)}else for(var t=0;t<3;t++){c=a[t];e=i.prevKey[c];g=i.nextKey[c];if(g.time<m){if(k<m)if(this.loop){e=this.data.hierarchy[s].keys[0];g=this.getNextKeyWith(c,s,1)}else{this.stop();return}else{do{e=g;g=this.getNextKeyWith(c,s,g.index+1)}while(g.time<k)}i.prevKey[c]=e;i.nextKey[c]=g}i.autoUpdateMatrix=!0;i.matrixNeedsToUpdate=!0;b=(k-e.time)/(g.time-e.time);e=e[c];
-g=g[c];if(c==="rot"){if(b<0||b>1){console.log("Scale out of bounds:"+b);b=b<0?0:1}THREE.Quaternion.slerp(e,g,i.quaternion,b)}else{c=c==="pos"?i.position:i.scale;c.x=e[0]+(g[0]-e[0])*b;c.y=e[1]+(g[1]-e[1])*b;c.z=e[2]+(g[2]-e[2])*b}}}if(o[0][l]===undefined){this.hierarchy[0].update(undefined,!0);for(s=0;s<this.hierarchy.length;s++)o[s][l]=this.hierarchy[s].skinMatrix.clone()}}};THREE.Animation.prototype.updateObject=function(){};
-THREE.Animation.prototype.getNextKeyWith=function(a,b,c){for(var e=this.data.hierarchy[b].keys;c<e.length;c++)if(e[c][a]!==undefined)return e[c];return this.data.hierarchy[b].keys[0]};
-THREE.Camera=function(a,b,c,e,g,i){THREE.Object3D.call(this);this.FOV=a||50;this.aspect=b||1;this.zNear=c||0.1;this.zFar=e||2E3;this.screenCenterY=this.screenCenterX=0;this.target=i||new THREE.Object3D;this.useTarget=!0;this.up=new THREE.Vector3(0,1,0);this.inverseMatrix=new THREE.Matrix4;this.projectionMatrix=null;this.tmpVec=new THREE.Vector3;this.translateX=function(l){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(l);this.tmpVec.crossSelf(this.up);this.position.addSelf(this.tmpVec);
+THREE.Animation.prototype.update=function(){if(this.isPlaying){var a=["pos","rot","scl"],b,d,e,g,i,l,o=this.data.JIT.hierarchy,k=(new Date).getTime()*0.0010-this.startTime+this.offset,m=k;if(k>this.data.length){for(;k>this.data.length;)k-=this.data.length;this.startTime=(new Date).getTime()*0.0010-k;k=(new Date).getTime()*0.0010-this.startTime}l=Math.min(parseInt(k*this.data.fps),parseInt(this.data.length*this.data.fps));for(var s=0,w=this.hierarchy.length;s<w;s++){i=this.hierarchy[s];if(o[s][l]!==
+undefined){i.skinMatrix=o[s][l];i.autoUpdateMatrix=!1;i.matrixNeedsToUpdate=!1;i.skinMatrix.flattenToArrayOffset(this.root.boneMatrices,s*16)}else for(var u=0;u<3;u++){d=a[u];e=i.prevKey[d];g=i.nextKey[d];if(g.time<m){if(k<m)if(this.loop){e=this.data.hierarchy[s].keys[0];g=this.getNextKeyWith(d,s,1)}else{this.stop();return}else{do{e=g;g=this.getNextKeyWith(d,s,g.index+1)}while(g.time<k)}i.prevKey[d]=e;i.nextKey[d]=g}i.autoUpdateMatrix=!0;i.matrixNeedsToUpdate=!0;b=(k-e.time)/(g.time-e.time);e=e[d];
+g=g[d];if(d==="rot"){if(b<0||b>1){console.log("Scale out of bounds:"+b);b=b<0?0:1}THREE.Quaternion.slerp(e,g,i.quaternion,b)}else{d=d==="pos"?i.position:i.scale;d.x=e[0]+(g[0]-e[0])*b;d.y=e[1]+(g[1]-e[1])*b;d.z=e[2]+(g[2]-e[2])*b}}}if(o[0][l]===undefined){this.hierarchy[0].update(undefined,!0);for(s=0;s<this.hierarchy.length;s++)o[s][l]=this.hierarchy[s].skinMatrix.clone()}}};THREE.Animation.prototype.updateObject=function(){};
+THREE.Animation.prototype.getNextKeyWith=function(a,b,d){for(var e=this.data.hierarchy[b].keys;d<e.length;d++)if(e[d][a]!==undefined)return e[d];return this.data.hierarchy[b].keys[0]};
+THREE.Camera=function(a,b,d,e,g,i){THREE.Object3D.call(this);this.FOV=a||50;this.aspect=b||1;this.zNear=d||0.1;this.zFar=e||2E3;this.screenCenterY=this.screenCenterX=0;this.target=i||new THREE.Object3D;this.useTarget=!0;this.up=new THREE.Vector3(0,1,0);this.inverseMatrix=new THREE.Matrix4;this.projectionMatrix=null;this.tmpVec=new THREE.Vector3;this.translateX=function(l){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(l);this.tmpVec.crossSelf(this.up);this.position.addSelf(this.tmpVec);
 this.target.position.addSelf(this.tmpVec)};this.translateZ=function(l){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(l);this.position.subSelf(this.tmpVec);this.target.position.subSelf(this.tmpVec)};this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
 this.target.position.addSelf(this.tmpVec)};this.translateZ=function(l){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(l);this.position.subSelf(this.tmpVec);this.target.position.subSelf(this.tmpVec)};this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
 THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.FOV,this.aspect,this.zNear,this.zFar)};
 THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.FOV,this.aspect,this.zNear,this.zFar)};
-THREE.Camera.prototype.update=function(a,b,c){if(this.useTarget){this.localMatrix.lookAt(this.position,this.target.position,this.up);a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);THREE.Matrix4.makeInvert(this.globalMatrix,this.inverseMatrix);b=!0}else{this.autoUpdateMatrix&&(b|=this.updateMatrix());if(b||this.matrixNeedsToUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsToUpdate=!1;b=!0;THREE.Matrix4.makeInvert(this.globalMatrix,
-this.inverseMatrix)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.globalMatrix,b,c)};
-THREE.Camera.prototype.frustumContains=function(a){var b=a.globalMatrix.n14,c=a.globalMatrix.n24,e=a.globalMatrix.n34,g=this.inverseMatrix,i=a.boundRadius*a.boundRadiusScale,l=g.n31*b+g.n32*c+g.n33*e+g.n34;if(l-i>-this.zNear)return!1;if(l+i<-this.zFar)return!1;l-=i;var o=this.projectionMatrix,k=1/(o.n43*l),m=k*this.screenCenterX,s=(g.n11*b+g.n12*c+g.n13*e+g.n14)*o.n11*m;i=o.n11*i*m;if(s+i<-this.screenCenterX)return!1;if(s-i>this.screenCenterX)return!1;b=(g.n21*b+g.n22*c+g.n23*e+g.n24)*o.n22*k*this.screenCenterY;
+THREE.Camera.prototype.update=function(a,b,d){if(this.useTarget){this.localMatrix.lookAt(this.position,this.target.position,this.up);a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);THREE.Matrix4.makeInvert(this.globalMatrix,this.inverseMatrix);b=!0}else{this.autoUpdateMatrix&&(b|=this.updateMatrix());if(b||this.matrixNeedsToUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsToUpdate=!1;b=!0;THREE.Matrix4.makeInvert(this.globalMatrix,
+this.inverseMatrix)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.globalMatrix,b,d)};
+THREE.Camera.prototype.frustumContains=function(a){var b=a.globalMatrix.n14,d=a.globalMatrix.n24,e=a.globalMatrix.n34,g=this.inverseMatrix,i=a.boundRadius*a.boundRadiusScale,l=g.n31*b+g.n32*d+g.n33*e+g.n34;if(l-i>-this.zNear)return!1;if(l+i<-this.zFar)return!1;l-=i;var o=this.projectionMatrix,k=1/(o.n43*l),m=k*this.screenCenterX,s=(g.n11*b+g.n12*d+g.n13*e+g.n14)*o.n11*m;i=o.n11*i*m;if(s+i<-this.screenCenterX)return!1;if(s-i>this.screenCenterX)return!1;b=(g.n21*b+g.n22*d+g.n23*e+g.n24)*o.n22*k*this.screenCenterY;
 if(b+i<-this.screenCenterY)return!1;if(b-i>this.screenCenterY)return!1;a.screenPosition.set(s,b,l,i);return!0};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;
 if(b+i<-this.screenCenterY)return!1;if(b-i>this.screenCenterY)return!1;a.screenPosition.set(s,b,l,i);return!0};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;
 THREE.DirectionalLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=b||1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=b||1};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;THREE.FlatShading=0;THREE.SmoothShading=1;
 THREE.DirectionalLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=b||1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=b||1};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;THREE.FlatShading=0;THREE.SmoothShading=1;
 THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.BillboardBlending=3;THREE.MaterialCounter={value:0};
 THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.BillboardBlending=3;THREE.MaterialCounter={value:0};
@@ -132,124 +133,126 @@ THREE.ParticleBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;th
 undefined)this.depth_test=a.depth_test;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors}};THREE.ParticleBasicMaterial.prototype={toString:function(){return"THREE.ParticleBasicMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>opacity: "+this.opacity+"<br/>map: "+this.map+"<br/>size: "+this.size+"<br/>blending: "+this.blending+"<br/>depth_test: "+this.depth_test+"<br/>vertex_colors: "+this.vertex_colors+"<br/>)"}};
 undefined)this.depth_test=a.depth_test;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors}};THREE.ParticleBasicMaterial.prototype={toString:function(){return"THREE.ParticleBasicMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>opacity: "+this.opacity+"<br/>map: "+this.map+"<br/>size: "+this.size+"<br/>blending: "+this.blending+"<br/>depth_test: "+this.depth_test+"<br/>vertex_colors: "+this.vertex_colors+"<br/>)"}};
 THREE.ParticleCircleMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}};
 THREE.ParticleCircleMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}};
 THREE.ParticleCircleMaterial.prototype={toString:function(){return"THREE.ParticleCircleMaterial (<br/>color: "+this.color+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>)"}};THREE.ParticleDOMMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.domElement=a};THREE.ParticleDOMMaterial.prototype={toString:function(){return"THREE.ParticleDOMMaterial ( domElement: "+this.domElement+" )"}};
 THREE.ParticleCircleMaterial.prototype={toString:function(){return"THREE.ParticleCircleMaterial (<br/>color: "+this.color+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>)"}};THREE.ParticleDOMMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.domElement=a};THREE.ParticleDOMMaterial.prototype={toString:function(){return"THREE.ParticleDOMMaterial ( domElement: "+this.domElement+" )"}};
-THREE.Texture=function(a,b,c,e,g,i){this.image=a;this.mapping=b!==undefined?b:new THREE.UVMapping;this.wrap_s=c!==undefined?c:THREE.ClampToEdgeWrapping;this.wrap_t=e!==undefined?e:THREE.ClampToEdgeWrapping;this.mag_filter=g!==undefined?g:THREE.LinearFilter;this.min_filter=i!==undefined?i:THREE.LinearMipMapLinearFilter};
+THREE.Texture=function(a,b,d,e,g,i){this.image=a;this.mapping=b!==undefined?b:new THREE.UVMapping;this.wrap_s=d!==undefined?d:THREE.ClampToEdgeWrapping;this.wrap_t=e!==undefined?e:THREE.ClampToEdgeWrapping;this.mag_filter=g!==undefined?g:THREE.LinearFilter;this.min_filter=i!==undefined?i:THREE.LinearMipMapLinearFilter};
 THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrap_s,this.wrap_t,this.mag_filter,this.min_filter)},toString:function(){return"THREE.Texture (<br/>image: "+this.image+"<br/>wrap_s: "+this.wrap_s+"<br/>wrap_t: "+this.wrap_t+"<br/>mag_filter: "+this.mag_filter+"<br/>min_filter: "+this.min_filter+"<br/>)"}};THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;
 THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrap_s,this.wrap_t,this.mag_filter,this.min_filter)},toString:function(){return"THREE.Texture (<br/>image: "+this.image+"<br/>wrap_s: "+this.wrap_s+"<br/>wrap_t: "+this.wrap_t+"<br/>mag_filter: "+this.mag_filter+"<br/>min_filter: "+this.min_filter+"<br/>)"}};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.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.RenderTarget=function(a,b,c){this.width=a;this.height=b;c=c||{};this.wrap_s=c.wrap_s!==undefined?c.wrap_s:THREE.ClampToEdgeWrapping;this.wrap_t=c.wrap_t!==undefined?c.wrap_t:THREE.ClampToEdgeWrapping;this.mag_filter=c.mag_filter!==undefined?c.mag_filter:THREE.LinearFilter;this.min_filter=c.min_filter!==undefined?c.min_filter:THREE.LinearMipMapLinearFilter;this.format=c.format!==undefined?c.format:THREE.RGBFormat;this.type=c.type!==undefined?c.type:THREE.UnsignedByteType};
-var Uniforms={clone:function(a){var b,c,e,g={};for(b in a){g[b]={};for(c in a[b]){e=a[b][c];g[b][c]=e instanceof THREE.Color||e instanceof THREE.Vector3||e instanceof THREE.Texture?e.clone():e}}return g},merge:function(a){var b,c,e,g={};for(b=0;b<a.length;b++){e=this.clone(a[b]);for(c in e)g[c]=e[c]}return g}};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};
+THREE.RenderTarget=function(a,b,d){this.width=a;this.height=b;d=d||{};this.wrap_s=d.wrap_s!==undefined?d.wrap_s:THREE.ClampToEdgeWrapping;this.wrap_t=d.wrap_t!==undefined?d.wrap_t:THREE.ClampToEdgeWrapping;this.mag_filter=d.mag_filter!==undefined?d.mag_filter:THREE.LinearFilter;this.min_filter=d.min_filter!==undefined?d.min_filter:THREE.LinearMipMapLinearFilter;this.format=d.format!==undefined?d.format:THREE.RGBFormat;this.type=d.type!==undefined?d.type:THREE.UnsignedByteType};
+var Uniforms={clone:function(a){var b,d,e,g={};for(b in a){g[b]={};for(d in a[b]){e=a[b][d];g[b][d]=e instanceof THREE.Color||e instanceof THREE.Vector3||e instanceof THREE.Texture?e.clone():e}}return g},merge:function(a){var b,d,e,g={};for(b=0;b<a.length;b++){e=this.clone(a[b]);for(d in e)g[d]=e[d]}return g}};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};
 THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};THREE.Scene=function(){THREE.Object3D.call(this);this.objects=[];this.lights=[];this.fog=null};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;THREE.Scene.prototype.addChild=function(a){this.supr.addChild.call(this,a);this.addChildRecurse(a)};
 THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};THREE.Scene=function(){THREE.Object3D.call(this);this.objects=[];this.lights=[];this.fog=null};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;THREE.Scene.prototype.addChild=function(a){this.supr.addChild.call(this,a);this.addChildRecurse(a)};
 THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else a instanceof THREE.Camera||a instanceof THREE.Bone||this.objects.indexOf(a)===-1&&this.objects.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.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else a instanceof THREE.Camera||a instanceof THREE.Bone||this.objects.indexOf(a)===-1&&this.objects.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.Camera)){b=this.objects.indexOf(a);b!==-1&&this.objects.splice(b,1)}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.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.Camera)){b=this.objects.indexOf(a);b!==-1&&this.objects.splice(b,1)}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.Fog=function(a,b,c){this.color=new THREE.Color(a);this.near=b||1;this.far=c||1E3};THREE.FogExp2=function(a,b){this.color=new THREE.Color(a);this.density=b||2.5E-4};
-THREE.Projector=function(){function a(T,N){return N.z-T.z}function b(T,N){var ba=0,R=1,aa=T.z+T.w,V=N.z+N.w,B=-T.z+T.w,I=-N.z+N.w;if(aa>=0&&V>=0&&B>=0&&I>=0)return!0;else if(aa<0&&V<0||B<0&&I<0)return!1;else{if(aa<0)ba=Math.max(ba,aa/(aa-V));else V<0&&(R=Math.min(R,aa/(aa-V)));if(B<0)ba=Math.max(ba,B/(B-I));else I<0&&(R=Math.min(R,B/(B-I)));if(R<ba)return!1;else{T.lerpSelf(N,ba);N.lerpSelf(T,1-R);return!0}}}var c,e,g=[],i,l,o,k=[],m,s,w=[],t,x,F=[],H=new THREE.Vector4,G=new THREE.Vector4,r=new THREE.Matrix4,
-Z=new THREE.Matrix4,D=[],K=new THREE.Vector4,d=new THREE.Vector4,ga;this.projectObjects=function(T,N,ba){N=[];var R,aa,V;e=0;aa=T.objects;T=0;for(R=aa.length;T<R;T++){V=aa[T];var B;if(!(B=!V.visible))if(B=V instanceof THREE.Mesh){a:{B=void 0;for(var I=V.globalMatrix,ka=-V.geometry.boundingSphere.radius*Math.max(V.scale.x,Math.max(V.scale.y,V.scale.z)),P=0;P<6;P++){B=D[P].x*I.n14+D[P].y*I.n24+D[P].z*I.n34+D[P].w;if(B<=ka){B=!1;break a}}B=!0}B=!B}if(!B){c=g[e]=g[e]||new THREE.RenderableObject;H.copy(V.position);
-r.multiplyVector3(H);c.object=V;c.z=H.z;N.push(c);e++}}ba&&N.sort(a);return N};this.projectScene=function(T,N,ba){var R=[],aa=N.near,V=N.far,B,I,ka,P,ja,ca,Q,ra,wa,f,n,p,j,h,q,v;o=s=x=0;N.autoUpdateMatrix&&N.update();r.multiply(N.projectionMatrix,N.globalMatrix);D[0]=new THREE.Vector4(r.n41-r.n11,r.n42-r.n12,r.n43-r.n13,r.n44-r.n14);D[1]=new THREE.Vector4(r.n41+r.n11,r.n42+r.n12,r.n43+r.n13,r.n44+r.n14);D[2]=new THREE.Vector4(r.n41+r.n21,r.n42+r.n22,r.n43+r.n23,r.n44+r.n24);D[3]=new THREE.Vector4(r.n41-
-r.n21,r.n42-r.n22,r.n43-r.n23,r.n44-r.n24);D[4]=new THREE.Vector4(r.n41-r.n31,r.n42-r.n32,r.n43-r.n33,r.n44-r.n34);D[5]=new THREE.Vector4(r.n41+r.n31,r.n42+r.n32,r.n43+r.n33,r.n44+r.n34);B=0;for(ca=D.length;B<ca;B++){Q=D[B];Q.divideScalar(Math.sqrt(Q.x*Q.x+Q.y*Q.y+Q.z*Q.z))}T.update(undefined,!1,N);ca=this.projectObjects(T,N,!0);T=0;for(B=ca.length;T<B;T++){Q=ca[T].object;if(Q.visible){Q.autoUpdateMatrix&&Q.updateMatrix();ra=Q.globalMatrix;ra.extractRotationMatrix(Q.rotationMatrix);n=Q.rotationMatrix;
-wa=Q.materials;f=Q.overdraw;if(Q instanceof THREE.Mesh){p=Q.geometry;j=p.vertices;I=0;for(ka=j.length;I<ka;I++){h=j[I];h.positionWorld.copy(h.position);ra.multiplyVector3(h.positionWorld);P=h.positionScreen;P.copy(h.positionWorld);r.multiplyVector4(P);P.x/=P.w;P.y/=P.w;h.__visible=P.z>aa&&P.z<V}p=p.faces;I=0;for(ka=p.length;I<ka;I++){h=p[I];if(h instanceof THREE.Face3){P=j[h.a];ja=j[h.b];q=j[h.c];if(P.__visible&&ja.__visible&&q.__visible&&(Q.doubleSided||Q.flipSided!=(q.positionScreen.x-P.positionScreen.x)*
-(ja.positionScreen.y-P.positionScreen.y)-(q.positionScreen.y-P.positionScreen.y)*(ja.positionScreen.x-P.positionScreen.x)<0)){i=k[o]=k[o]||new THREE.RenderableFace3;i.v1.positionWorld.copy(P.positionWorld);i.v2.positionWorld.copy(ja.positionWorld);i.v3.positionWorld.copy(q.positionWorld);i.v1.positionScreen.copy(P.positionScreen);i.v2.positionScreen.copy(ja.positionScreen);i.v3.positionScreen.copy(q.positionScreen);i.normalWorld.copy(h.normal);n.multiplyVector3(i.normalWorld);i.centroidWorld.copy(h.centroid);
-ra.multiplyVector3(i.centroidWorld);i.centroidScreen.copy(i.centroidWorld);r.multiplyVector3(i.centroidScreen);q=h.vertexNormals;ga=i.vertexNormalsWorld;P=0;for(ja=q.length;P<ja;P++){v=ga[P]=ga[P]||new THREE.Vector3;v.copy(q[P]);n.multiplyVector3(v)}i.z=i.centroidScreen.z;i.meshMaterials=wa;i.faceMaterials=h.materials;i.overdraw=f;if(Q.geometry.uvs[I]){i.uvs[0]=Q.geometry.uvs[I][0];i.uvs[1]=Q.geometry.uvs[I][1];i.uvs[2]=Q.geometry.uvs[I][2]}R.push(i);o++}}else if(h instanceof THREE.Face4){P=j[h.a];
-ja=j[h.b];q=j[h.c];v=j[h.d];if(P.__visible&&ja.__visible&&q.__visible&&v.__visible&&(Q.doubleSided||Q.flipSided!=((v.positionScreen.x-P.positionScreen.x)*(ja.positionScreen.y-P.positionScreen.y)-(v.positionScreen.y-P.positionScreen.y)*(ja.positionScreen.x-P.positionScreen.x)<0||(ja.positionScreen.x-q.positionScreen.x)*(v.positionScreen.y-q.positionScreen.y)-(ja.positionScreen.y-q.positionScreen.y)*(v.positionScreen.x-q.positionScreen.x)<0))){i=k[o]=k[o]||new THREE.RenderableFace3;i.v1.positionWorld.copy(P.positionWorld);
-i.v2.positionWorld.copy(ja.positionWorld);i.v3.positionWorld.copy(v.positionWorld);i.v1.positionScreen.copy(P.positionScreen);i.v2.positionScreen.copy(ja.positionScreen);i.v3.positionScreen.copy(v.positionScreen);i.normalWorld.copy(h.normal);n.multiplyVector3(i.normalWorld);i.centroidWorld.copy(h.centroid);ra.multiplyVector3(i.centroidWorld);i.centroidScreen.copy(i.centroidWorld);r.multiplyVector3(i.centroidScreen);i.z=i.centroidScreen.z;i.meshMaterials=wa;i.faceMaterials=h.materials;i.overdraw=f;
-if(Q.geometry.uvs[I]){i.uvs[0]=Q.geometry.uvs[I][0];i.uvs[1]=Q.geometry.uvs[I][1];i.uvs[2]=Q.geometry.uvs[I][3]}R.push(i);o++;l=k[o]=k[o]||new THREE.RenderableFace3;l.v1.positionWorld.copy(ja.positionWorld);l.v2.positionWorld.copy(q.positionWorld);l.v3.positionWorld.copy(v.positionWorld);l.v1.positionScreen.copy(ja.positionScreen);l.v2.positionScreen.copy(q.positionScreen);l.v3.positionScreen.copy(v.positionScreen);l.normalWorld.copy(i.normalWorld);l.centroidWorld.copy(i.centroidWorld);l.centroidScreen.copy(i.centroidScreen);
-l.z=l.centroidScreen.z;l.meshMaterials=wa;l.faceMaterials=h.materials;l.overdraw=f;if(Q.geometry.uvs[I]){l.uvs[0]=Q.geometry.uvs[I][1];l.uvs[1]=Q.geometry.uvs[I][2];l.uvs[2]=Q.geometry.uvs[I][3]}R.push(l);o++}}}}else if(Q instanceof THREE.Line){Z.multiply(r,ra);j=Q.geometry.vertices;h=j[0];h.positionScreen.copy(h.position);Z.multiplyVector4(h.positionScreen);I=1;for(ka=j.length;I<ka;I++){P=j[I];P.positionScreen.copy(P.position);Z.multiplyVector4(P.positionScreen);ja=j[I-1];K.copy(P.positionScreen);
-d.copy(ja.positionScreen);if(b(K,d)){K.multiplyScalar(1/K.w);d.multiplyScalar(1/d.w);m=w[s]=w[s]||new THREE.RenderableLine;m.v1.positionScreen.copy(K);m.v2.positionScreen.copy(d);m.z=Math.max(K.z,d.z);m.materials=Q.materials;R.push(m);s++}}}else if(Q instanceof THREE.Particle){G.set(Q.position.x,Q.position.y,Q.position.z,1);r.multiplyVector4(G);G.z/=G.w;if(G.z>0&&G.z<1){t=F[x]=F[x]||new THREE.RenderableParticle;t.x=G.x/G.w;t.y=G.y/G.w;t.z=G.z;t.rotation=Q.rotation.z;t.scale.x=Q.scale.x*Math.abs(t.x-
-(G.x+N.projectionMatrix.n11)/(G.w+N.projectionMatrix.n14));t.scale.y=Q.scale.y*Math.abs(t.y-(G.y+N.projectionMatrix.n22)/(G.w+N.projectionMatrix.n24));t.materials=Q.materials;R.push(t);x++}}}}ba&&R.sort(a);return R};this.unprojectVector=function(T,N){var ba=THREE.Matrix4.makeInvert(N.globalMatrix);ba.multiplySelf(THREE.Matrix4.makeInvert(N.projectionMatrix));ba.multiplyVector3(T);return T}};
-THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,c,e,g,i;this.domElement=document.createElement("div");this.setSize=function(l,o){c=l;e=o;g=c/2;i=e/2};this.render=function(l,o){var k,m,s,w,t,x,F,H;a=b.projectScene(l,o);k=0;for(m=a.length;k<m;k++){t=a[k];if(t instanceof THREE.RenderableParticle){F=t.x*g+g;H=t.y*i+i;s=0;for(w=t.material.length;s<w;s++){x=t.material[s];if(x instanceof THREE.ParticleDOMMaterial){x=x.domElement;x.style.left=F+"px";x.style.top=H+"px"}}}}}};
-THREE.CanvasRenderer=function(){function a(na){if(t!=na)m.globalAlpha=t=na}function b(na){if(x!=na){switch(na){case THREE.NormalBlending:m.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:m.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:m.globalCompositeOperation="darker"}x=na}}var c=null,e=new THREE.Projector,g=document.createElement("canvas"),i,l,o,k,m=g.getContext("2d"),s=new THREE.Color(0),w=0,t=1,x=0,F=null,H=null,G=1,r,Z,D,K,d,ga,T,N,ba,R=new THREE.Color,
-aa=new THREE.Color,V=new THREE.Color,B=new THREE.Color,I=new THREE.Color,ka,P,ja,ca,Q,ra,wa,f,n,p=new THREE.Rectangle,j=new THREE.Rectangle,h=new THREE.Rectangle,q=!1,v=new THREE.Color,C=new THREE.Color,W=new THREE.Color,L=new THREE.Color,S=Math.PI*2,E=new THREE.Vector3,da,ea,va,la,ha,ia,fa=16;da=document.createElement("canvas");da.width=da.height=2;ea=da.getContext("2d");ea.fillStyle="rgba(0,0,0,1)";ea.fillRect(0,0,2,2);va=ea.getImageData(0,0,2,2);la=va.data;ha=document.createElement("canvas");ha.width=
-ha.height=fa;ia=ha.getContext("2d");ia.translate(-fa/2,-fa/2);ia.scale(fa,fa);fa--;this.domElement=g;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setSize=function(na,z){i=na;l=z;o=i/2;k=l/2;g.width=i;g.height=l;p.set(-o,-k,o,k);t=1;x=0;H=F=null;G=1};this.setClearColor=function(na,z){s=na;w=z;j.set(-o,-k,o,k);m.setTransform(1,0,0,-1,o,k);this.clear()};this.setClearColorHex=function(na,z){s.setHex(na);w=z;j.set(-o,-k,o,k);m.setTransform(1,0,0,-1,o,k);this.clear()};this.clear=function(){m.setTransform(1,
-0,0,-1,o,k);if(!j.isEmpty()){j.inflate(1);j.minSelf(p);if(s.hex==0&&w==0)m.clearRect(j.getX(),j.getY(),j.getWidth(),j.getHeight());else{b(THREE.NormalBlending);a(1);m.fillStyle="rgba("+Math.floor(s.r*255)+","+Math.floor(s.g*255)+","+Math.floor(s.b*255)+","+w+")";m.fillRect(j.getX(),j.getY(),j.getWidth(),j.getHeight())}j.empty()}};this.render=function(na,z){function Fa(y){var X,Y,A,U=y.lights;C.setRGB(0,0,0);W.setRGB(0,0,0);L.setRGB(0,0,0);y=0;for(X=U.length;y<X;y++){Y=U[y];A=Y.color;if(Y instanceof
-THREE.AmbientLight){C.r+=A.r;C.g+=A.g;C.b+=A.b}else if(Y instanceof THREE.DirectionalLight){W.r+=A.r;W.g+=A.g;W.b+=A.b}else if(Y instanceof THREE.PointLight){L.r+=A.r;L.g+=A.g;L.b+=A.b}}}function za(y,X,Y,A){var U,ma,xa,Da,Ea=y.lights;y=0;for(U=Ea.length;y<U;y++){ma=Ea[y];xa=ma.color;Da=ma.intensity;if(ma instanceof THREE.DirectionalLight){ma=Y.dot(ma.position)*Da;if(ma>0){A.r+=xa.r*ma;A.g+=xa.g*ma;A.b+=xa.b*ma}}else if(ma instanceof THREE.PointLight){E.sub(ma.position,X);E.normalize();ma=Y.dot(E)*
-Da;if(ma>0){A.r+=xa.r*ma;A.g+=xa.g*ma;A.b+=xa.b*ma}}}}function Ga(y,X,Y){if(Y.opacity!=0){a(Y.opacity);b(Y.blending);var A,U,ma,xa,Da,Ea;if(Y instanceof THREE.ParticleBasicMaterial){if(Y.map&&Y.map.image.loaded){xa=Y.map.image;Da=xa.width>>1;Ea=xa.height>>1;U=X.scale.x*o;ma=X.scale.y*k;Y=U*Da;A=ma*Ea;h.set(y.x-Y,y.y-A,y.x+Y,y.y+A);if(!p.instersects(h))return;m.save();m.translate(y.x,y.y);m.rotate(-X.rotation);m.scale(U,-ma);m.translate(-Da,-Ea);m.drawImage(xa,0,0);m.restore()}m.beginPath();m.moveTo(y.x-
-10,y.y);m.lineTo(y.x+10,y.y);m.moveTo(y.x,y.y-10);m.lineTo(y.x,y.y+10);m.closePath();m.strokeStyle="rgb(255,255,0)";m.stroke()}else if(Y instanceof THREE.ParticleCircleMaterial){if(q){v.r=C.r+W.r+L.r;v.g=C.g+W.g+L.g;v.b=C.b+W.b+L.b;R.r=Y.color.r*v.r;R.g=Y.color.g*v.g;R.b=Y.color.b*v.b;R.updateStyleString()}else R.__styleString=Y.color.__styleString;Y=X.scale.x*o;A=X.scale.y*k;h.set(y.x-Y,y.y-A,y.x+Y,y.y+A);if(p.instersects(h)){U=R.__styleString;if(H!=U)m.fillStyle=H=U;m.save();m.translate(y.x,y.y);
-m.rotate(-X.rotation);m.scale(Y,A);m.beginPath();m.arc(0,0,1,0,S,!0);m.closePath();m.fill();m.restore()}}}}function O(y,X,Y,A){if(A.opacity!=0){a(A.opacity);b(A.blending);m.beginPath();m.moveTo(y.positionScreen.x,y.positionScreen.y);m.lineTo(X.positionScreen.x,X.positionScreen.y);m.closePath();if(A instanceof THREE.LineBasicMaterial){R.__styleString=A.color.__styleString;y=A.linewidth;if(G!=y)m.lineWidth=G=y;y=R.__styleString;if(F!=y)m.strokeStyle=F=y;m.stroke();h.inflate(A.linewidth*2)}}}function M(y,
-X,Y,A,U,ma){if(U.opacity!=0){a(U.opacity);b(U.blending);K=y.positionScreen.x;d=y.positionScreen.y;ga=X.positionScreen.x;T=X.positionScreen.y;N=Y.positionScreen.x;ba=Y.positionScreen.y;m.beginPath();m.moveTo(K,d);m.lineTo(ga,T);m.lineTo(N,ba);m.lineTo(K,d);m.closePath();if(U instanceof THREE.MeshBasicMaterial)if(U.map)U.map.image.loaded&&U.map.mapping instanceof THREE.UVMapping&&Ca(K,d,ga,T,N,ba,U.map.image,A.uvs[0].u,A.uvs[0].v,A.uvs[1].u,A.uvs[1].v,A.uvs[2].u,A.uvs[2].v);else if(U.env_map){if(U.env_map.image.loaded&&
-U.env_map.mapping instanceof THREE.SphericalReflectionMapping){y=z.globalMatrix;E.copy(A.vertexNormalsWorld[0]);ca=(E.x*y.n11+E.y*y.n12+E.z*y.n13)*0.5+0.5;Q=-(E.x*y.n21+E.y*y.n22+E.z*y.n23)*0.5+0.5;E.copy(A.vertexNormalsWorld[1]);ra=(E.x*y.n11+E.y*y.n12+E.z*y.n13)*0.5+0.5;wa=-(E.x*y.n21+E.y*y.n22+E.z*y.n23)*0.5+0.5;E.copy(A.vertexNormalsWorld[2]);f=(E.x*y.n11+E.y*y.n12+E.z*y.n13)*0.5+0.5;n=-(E.x*y.n21+E.y*y.n22+E.z*y.n23)*0.5+0.5;Ca(K,d,ga,T,N,ba,U.env_map.image,ca,Q,ra,wa,f,n)}}else U.wireframe?
-J(U.color.__styleString,U.wireframe_linewidth):oa(U.color.__styleString);else if(U instanceof THREE.MeshLambertMaterial){if(U.map&&!U.wireframe){U.map.mapping instanceof THREE.UVMapping&&Ca(K,d,ga,T,N,ba,U.map.image,A.uvs[0].u,A.uvs[0].v,A.uvs[1].u,A.uvs[1].v,A.uvs[2].u,A.uvs[2].v);b(THREE.SubtractiveBlending)}if(q)if(!U.wireframe&&U.shading==THREE.SmoothShading&&A.vertexNormalsWorld.length==3){aa.r=V.r=B.r=C.r;aa.g=V.g=B.g=C.g;aa.b=V.b=B.b=C.b;za(ma,A.v1.positionWorld,A.vertexNormalsWorld[0],aa);
-za(ma,A.v2.positionWorld,A.vertexNormalsWorld[1],V);za(ma,A.v3.positionWorld,A.vertexNormalsWorld[2],B);I.r=(V.r+B.r)*0.5;I.g=(V.g+B.g)*0.5;I.b=(V.b+B.b)*0.5;ja=Aa(aa,V,B,I);Ca(K,d,ga,T,N,ba,ja,0,0,1,0,0,1)}else{v.r=C.r;v.g=C.g;v.b=C.b;za(ma,A.centroidWorld,A.normalWorld,v);R.r=U.color.r*v.r;R.g=U.color.g*v.g;R.b=U.color.b*v.b;R.updateStyleString();U.wireframe?J(R.__styleString,U.wireframe_linewidth):oa(R.__styleString)}else U.wireframe?J(U.color.__styleString,U.wireframe_linewidth):oa(U.color.__styleString)}else if(U instanceof
-THREE.MeshDepthMaterial){ka=z.near;P=z.far;aa.r=aa.g=aa.b=1-u(y.positionScreen.z,ka,P);V.r=V.g=V.b=1-u(X.positionScreen.z,ka,P);B.r=B.g=B.b=1-u(Y.positionScreen.z,ka,P);I.r=(V.r+B.r)*0.5;I.g=(V.g+B.g)*0.5;I.b=(V.b+B.b)*0.5;ja=Aa(aa,V,B,I);Ca(K,d,ga,T,N,ba,ja,0,0,1,0,0,1)}else if(U instanceof THREE.MeshNormalMaterial){R.r=Ba(A.normalWorld.x);R.g=Ba(A.normalWorld.y);R.b=Ba(A.normalWorld.z);R.updateStyleString();U.wireframe?J(R.__styleString,U.wireframe_linewidth):oa(R.__styleString)}}}function J(y,
-X){if(F!=y)m.strokeStyle=F=y;if(G!=X)m.lineWidth=G=X;m.stroke();h.inflate(X*2)}function oa(y){if(H!=y)m.fillStyle=H=y;m.fill()}function Ca(y,X,Y,A,U,ma,xa,Da,Ea,Ia,ya,Ja,Qa){var Ka,La;Ka=xa.width-1;La=xa.height-1;Da*=Ka;Ea*=La;Ia*=Ka;ya*=La;Ja*=Ka;Qa*=La;Y-=y;A-=X;U-=y;ma-=X;Ia-=Da;ya-=Ea;Ja-=Da;Qa-=Ea;Ka=Ia*Qa-Ja*ya;if(Ka!=0){La=1/Ka;Ka=(Qa*Y-ya*U)*La;ya=(Qa*A-ya*ma)*La;Y=(Ia*U-Ja*Y)*La;A=(Ia*ma-Ja*A)*La;y=y-Ka*Da-Y*Ea;X=X-ya*Da-A*Ea;m.save();m.transform(Ka,ya,Y,A,y,X);m.clip();m.drawImage(xa,0,
-0);m.restore()}}function Aa(y,X,Y,A){var U=~~(y.r*255),ma=~~(y.g*255);y=~~(y.b*255);var xa=~~(X.r*255),Da=~~(X.g*255);X=~~(X.b*255);var Ea=~~(Y.r*255),Ia=~~(Y.g*255);Y=~~(Y.b*255);var ya=~~(A.r*255),Ja=~~(A.g*255);A=~~(A.b*255);la[0]=U<0?0:U>255?255:U;la[1]=ma<0?0:ma>255?255:ma;la[2]=y<0?0:y>255?255:y;la[4]=xa<0?0:xa>255?255:xa;la[5]=Da<0?0:Da>255?255:Da;la[6]=X<0?0:X>255?255:X;la[8]=Ea<0?0:Ea>255?255:Ea;la[9]=Ia<0?0:Ia>255?255:Ia;la[10]=Y<0?0:Y>255?255:Y;la[12]=ya<0?0:ya>255?255:ya;la[13]=Ja<0?0:
-Ja>255?255:Ja;la[14]=A<0?0:A>255?255:A;ea.putImageData(va,0,0);ia.drawImage(da,0,0);return ha}function u(y,X,Y){y=(y-X)/(Y-X);return y*y*(3-2*y)}function Ba(y){y=(y+1)*0.5;return y<0?0:y>1?1:y}function Oa(y,X){var Y=X.x-y.x,A=X.y-y.y,U=1/Math.sqrt(Y*Y+A*A);Y*=U;A*=U;X.x+=Y;X.y+=A;y.x-=Y;y.y-=A}var Ma,Ha,$,sa,pa,ta,ua,qa;this.autoClear?this.clear():m.setTransform(1,0,0,-1,o,k);c=e.projectScene(na,z,this.sortElements);m.fillStyle="rgba( 0, 255, 255, 0.5 )";m.fillRect(p.getX(),p.getY(),p.getWidth(),
-p.getHeight());(q=na.lights.length>0)&&Fa(na);Ma=0;for(Ha=c.length;Ma<Ha;Ma++){$=c[Ma];h.empty();if($ instanceof THREE.RenderableParticle){r=$;r.x*=o;r.y*=k;sa=0;for(pa=$.materials.length;sa<pa;sa++)Ga(r,$,$.materials[sa],na)}else if($ instanceof THREE.RenderableLine){r=$.v1;Z=$.v2;r.positionScreen.x*=o;r.positionScreen.y*=k;Z.positionScreen.x*=o;Z.positionScreen.y*=k;h.addPoint(r.positionScreen.x,r.positionScreen.y);h.addPoint(Z.positionScreen.x,Z.positionScreen.y);if(p.instersects(h)){sa=0;for(pa=
-$.materials.length;sa<pa;)O(r,Z,$,$.materials[sa++],na)}}else if($ instanceof THREE.RenderableFace3){r=$.v1;Z=$.v2;D=$.v3;r.positionScreen.x*=o;r.positionScreen.y*=k;Z.positionScreen.x*=o;Z.positionScreen.y*=k;D.positionScreen.x*=o;D.positionScreen.y*=k;if($.overdraw){Oa(r.positionScreen,Z.positionScreen);Oa(Z.positionScreen,D.positionScreen);Oa(D.positionScreen,r.positionScreen)}h.add3Points(r.positionScreen.x,r.positionScreen.y,Z.positionScreen.x,Z.positionScreen.y,D.positionScreen.x,D.positionScreen.y);
-if(p.instersects(h)){sa=0;for(pa=$.meshMaterials.length;sa<pa;){qa=$.meshMaterials[sa++];if(qa instanceof THREE.MeshFaceMaterial){ta=0;for(ua=$.faceMaterials.length;ta<ua;)(qa=$.faceMaterials[ta++])&&M(r,Z,D,$,qa,na)}else M(r,Z,D,$,qa,na)}}}j.addRectangle(h)}m.lineWidth=1;m.strokeStyle="rgba( 255, 0, 0, 0.5 )";m.strokeRect(j.getX(),j.getY(),j.getWidth(),j.getHeight());m.setTransform(1,0,0,1,0,0)}};
-THREE.SVGRenderer=function(){function a(ca,Q,ra){var wa,f,n,p;wa=0;for(f=ca.lights.length;wa<f;wa++){n=ca.lights[wa];if(n instanceof THREE.DirectionalLight){p=Q.normalWorld.dot(n.position)*n.intensity;if(p>0){ra.r+=n.color.r*p;ra.g+=n.color.g*p;ra.b+=n.color.b*p}}else if(n instanceof THREE.PointLight){ba.sub(n.position,Q.centroidWorld);ba.normalize();p=Q.normalWorld.dot(ba)*n.intensity;if(p>0){ra.r+=n.color.r*p;ra.g+=n.color.g*p;ra.b+=n.color.b*p}}}}function b(ca,Q,ra,wa,f,n){B=e(I++);B.setAttribute("d",
-"M "+ca.positionScreen.x+" "+ca.positionScreen.y+" L "+Q.positionScreen.x+" "+Q.positionScreen.y+" L "+ra.positionScreen.x+","+ra.positionScreen.y+"z");if(f instanceof THREE.MeshBasicMaterial)D.__styleString=f.color.__styleString;else if(f instanceof THREE.MeshLambertMaterial)if(Z){K.r=d.r;K.g=d.g;K.b=d.b;a(n,wa,K);D.r=f.color.r*K.r;D.g=f.color.g*K.g;D.b=f.color.b*K.b;D.updateStyleString()}else D.__styleString=f.color.__styleString;else if(f instanceof THREE.MeshDepthMaterial){N=1-f.__2near/(f.__farPlusNear-
-wa.z*f.__farMinusNear);D.setRGB(N,N,N)}else f instanceof THREE.MeshNormalMaterial&&D.setRGB(g(wa.normalWorld.x),g(wa.normalWorld.y),g(wa.normalWorld.z));f.wireframe?B.setAttribute("style","fill: none; stroke: "+D.__styleString+"; stroke-width: "+f.wireframe_linewidth+"; stroke-opacity: "+f.opacity+"; stroke-linecap: "+f.wireframe_linecap+"; stroke-linejoin: "+f.wireframe_linejoin):B.setAttribute("style","fill: "+D.__styleString+"; fill-opacity: "+f.opacity);o.appendChild(B)}function c(ca,Q,ra,wa,
-f,n,p){B=e(I++);B.setAttribute("d","M "+ca.positionScreen.x+" "+ca.positionScreen.y+" L "+Q.positionScreen.x+" "+Q.positionScreen.y+" L "+ra.positionScreen.x+","+ra.positionScreen.y+" L "+wa.positionScreen.x+","+wa.positionScreen.y+"z");if(n instanceof THREE.MeshBasicMaterial)D.__styleString=n.color.__styleString;else if(n instanceof THREE.MeshLambertMaterial)if(Z){K.r=d.r;K.g=d.g;K.b=d.b;a(p,f,K);D.r=n.color.r*K.r;D.g=n.color.g*K.g;D.b=n.color.b*K.b;D.updateStyleString()}else D.__styleString=n.color.__styleString;
-else if(n instanceof THREE.MeshDepthMaterial){N=1-n.__2near/(n.__farPlusNear-f.z*n.__farMinusNear);D.setRGB(N,N,N)}else n instanceof THREE.MeshNormalMaterial&&D.setRGB(g(f.normalWorld.x),g(f.normalWorld.y),g(f.normalWorld.z));n.wireframe?B.setAttribute("style","fill: none; stroke: "+D.__styleString+"; stroke-width: "+n.wireframe_linewidth+"; stroke-opacity: "+n.opacity+"; stroke-linecap: "+n.wireframe_linecap+"; stroke-linejoin: "+n.wireframe_linejoin):B.setAttribute("style","fill: "+D.__styleString+
-"; fill-opacity: "+n.opacity);o.appendChild(B)}function e(ca){if(R[ca]==null){R[ca]=document.createElementNS("http://www.w3.org/2000/svg","path");ja==0&&R[ca].setAttribute("shape-rendering","crispEdges")}return R[ca]}function g(ca){return ca<0?Math.min((1+ca)*0.5,0.5):0.5+Math.min(ca*0.5,0.5)}var i=null,l=new THREE.Projector,o=document.createElementNS("http://www.w3.org/2000/svg","svg"),k,m,s,w,t,x,F,H,G=new THREE.Rectangle,r=new THREE.Rectangle,Z=!1,D=new THREE.Color(16777215),K=new THREE.Color(16777215),
-d=new THREE.Color(0),ga=new THREE.Color(0),T=new THREE.Color(0),N,ba=new THREE.Vector3,R=[],aa=[],V=[],B,I,ka,P,ja=1;this.domElement=o;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(ca){switch(ca){case "high":ja=1;break;case "low":ja=0}};this.setSize=function(ca,Q){k=ca;m=Q;s=k/2;w=m/2;o.setAttribute("viewBox",-s+" "+-w+" "+k+" "+m);o.setAttribute("width",k);o.setAttribute("height",m);G.set(-s,-w,s,w)};this.clear=function(){for(;o.childNodes.length>0;)o.removeChild(o.childNodes[0])};
-this.render=function(ca,Q){var ra,wa,f,n,p,j,h,q;this.autoClear&&this.clear();i=l.projectScene(ca,Q,this.sortElements);P=ka=I=0;if(Z=ca.lights.length>0){h=ca.lights;d.setRGB(0,0,0);ga.setRGB(0,0,0);T.setRGB(0,0,0);ra=0;for(wa=h.length;ra<wa;ra++){f=h[ra];n=f.color;if(f instanceof THREE.AmbientLight){d.r+=n.r;d.g+=n.g;d.b+=n.b}else if(f instanceof THREE.DirectionalLight){ga.r+=n.r;ga.g+=n.g;ga.b+=n.b}else if(f instanceof THREE.PointLight){T.r+=n.r;T.g+=n.g;T.b+=n.b}}}ra=0;for(wa=i.length;ra<wa;ra++){h=
-i[ra];r.empty();if(h instanceof THREE.RenderableParticle){t=h;t.x*=s;t.y*=-w;f=0;for(n=h.materials.length;f<n;f++)if(q=h.materials[f]){p=t;j=h;var v=ka++;if(aa[v]==null){aa[v]=document.createElementNS("http://www.w3.org/2000/svg","circle");ja==0&&aa[v].setAttribute("shape-rendering","crispEdges")}B=aa[v];B.setAttribute("cx",p.x);B.setAttribute("cy",p.y);B.setAttribute("r",j.scale.x*s);if(q instanceof THREE.ParticleCircleMaterial){if(Z){K.r=d.r+ga.r+T.r;K.g=d.g+ga.g+T.g;K.b=d.b+ga.b+T.b;D.r=q.color.r*
-K.r;D.g=q.color.g*K.g;D.b=q.color.b*K.b;D.updateStyleString()}else D=q.color;B.setAttribute("style","fill: "+D.__styleString)}o.appendChild(B)}}else if(h instanceof THREE.RenderableLine){t=h.v1;x=h.v2;t.positionScreen.x*=s;t.positionScreen.y*=-w;x.positionScreen.x*=s;x.positionScreen.y*=-w;r.addPoint(t.positionScreen.x,t.positionScreen.y);r.addPoint(x.positionScreen.x,x.positionScreen.y);if(G.instersects(r)){f=0;for(n=h.materials.length;f<n;)if(q=h.materials[f++]){p=t;j=x;v=P++;if(V[v]==null){V[v]=
-document.createElementNS("http://www.w3.org/2000/svg","line");ja==0&&V[v].setAttribute("shape-rendering","crispEdges")}B=V[v];B.setAttribute("x1",p.positionScreen.x);B.setAttribute("y1",p.positionScreen.y);B.setAttribute("x2",j.positionScreen.x);B.setAttribute("y2",j.positionScreen.y);if(q instanceof THREE.LineBasicMaterial){D.__styleString=q.color.__styleString;B.setAttribute("style","fill: none; stroke: "+D.__styleString+"; stroke-width: "+q.linewidth+"; stroke-opacity: "+q.opacity+"; stroke-linecap: "+
-q.linecap+"; stroke-linejoin: "+q.linejoin);o.appendChild(B)}}}}else if(h instanceof THREE.RenderableFace3){t=h.v1;x=h.v2;F=h.v3;t.positionScreen.x*=s;t.positionScreen.y*=-w;x.positionScreen.x*=s;x.positionScreen.y*=-w;F.positionScreen.x*=s;F.positionScreen.y*=-w;r.addPoint(t.positionScreen.x,t.positionScreen.y);r.addPoint(x.positionScreen.x,x.positionScreen.y);r.addPoint(F.positionScreen.x,F.positionScreen.y);if(G.instersects(r)){f=0;for(n=h.meshMaterials.length;f<n;){q=h.meshMaterials[f++];if(q instanceof
-THREE.MeshFaceMaterial){p=0;for(j=h.faceMaterials.length;p<j;)(q=h.faceMaterials[p++])&&b(t,x,F,h,q,ca)}else q&&b(t,x,F,h,q,ca)}}}else if(h instanceof THREE.RenderableFace4){t=h.v1;x=h.v2;F=h.v3;H=h.v4;t.positionScreen.x*=s;t.positionScreen.y*=-w;x.positionScreen.x*=s;x.positionScreen.y*=-w;F.positionScreen.x*=s;F.positionScreen.y*=-w;H.positionScreen.x*=s;H.positionScreen.y*=-w;r.addPoint(t.positionScreen.x,t.positionScreen.y);r.addPoint(x.positionScreen.x,x.positionScreen.y);r.addPoint(F.positionScreen.x,
-F.positionScreen.y);r.addPoint(H.positionScreen.x,H.positionScreen.y);if(G.instersects(r)){f=0;for(n=h.meshMaterials.length;f<n;){q=h.meshMaterials[f++];if(q instanceof THREE.MeshFaceMaterial){p=0;for(j=h.faceMaterials.length;p<j;)(q=h.faceMaterials[p++])&&c(t,x,F,H,h,q,ca)}else q&&c(t,x,F,H,h,q,ca)}}}}}};
-THREE.WebGLRenderer=function(a){function b(f,n,p){var j,h,q,v=f.vertices,C=v.length,W=f.colors,L=W.length,S=f.__vertexArray,E=f.__colorArray,da=f.__sortArray,ea=f.__dirtyVertices,va=f.__dirtyColors;if(p.sortParticles){I.multiplySelf(p.globalMatrix);for(j=0;j<C;j++){h=v[j].position;ca.copy(h);I.multiplyVector3(ca);da[j]=[ca.z,j]}da.sort(function(la,ha){return ha[0]-la[0]});for(j=0;j<C;j++){h=v[da[j][1]].position;q=j*3;S[q]=h.x;S[q+1]=h.y;S[q+2]=h.z}for(j=0;j<L;j++){q=j*3;color=W[da[j][1]];E[q]=color.r;
-E[q+1]=color.g;E[q+2]=color.b}}else{if(ea)for(j=0;j<C;j++){h=v[j].position;q=j*3;S[q]=h.x;S[q+1]=h.y;S[q+2]=h.z}if(va)for(j=0;j<L;j++){color=W[j];q=j*3;E[q]=color.r;E[q+1]=color.g;E[q+2]=color.b}}if(ea||p.sortParticles){d.bindBuffer(d.ARRAY_BUFFER,f.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,S,n)}if(va||p.sortParticles){d.bindBuffer(d.ARRAY_BUFFER,f.__webGLColorBuffer);d.bufferData(d.ARRAY_BUFFER,E,n)}}function c(f,n){f.fragment_shader=n.fragment_shader;f.vertex_shader=n.vertex_shader;f.uniforms=
-Uniforms.clone(n.uniforms)}function e(f,n,p,j,h){j.program||N.initMaterial(j,n,p);var q=j.program,v=q.uniforms,C=j.uniforms;if(q!=ga){d.useProgram(q);ga=q;d.uniformMatrix4fv(v.projectionMatrix,!1,ka)}if(p&&(j instanceof THREE.MeshBasicMaterial||j instanceof THREE.MeshLambertMaterial||j instanceof THREE.MeshPhongMaterial||j instanceof THREE.LineBasicMaterial||j instanceof THREE.ParticleBasicMaterial)){C.fogColor.value.setHex(p.color.hex);if(p instanceof THREE.Fog){C.fogNear.value=p.near;C.fogFar.value=
-p.far}else if(p instanceof THREE.FogExp2)C.fogDensity.value=p.density}if(j instanceof THREE.MeshPhongMaterial||j instanceof THREE.MeshLambertMaterial){var W,L,S=0,E=0,da=0,ea,va,la,ha=N.lights,ia=ha.directional.colors,fa=ha.directional.positions,na=ha.point.colors,z=ha.point.positions,Fa=0,za=0;p=L=L=0;for(W=n.length;p<W;p++){L=n[p];ea=L.color;va=L.position;la=L.intensity;if(L instanceof THREE.AmbientLight){S+=ea.r;E+=ea.g;da+=ea.b}else if(L instanceof THREE.DirectionalLight){L=Fa*3;ia[L]=ea.r*la;
-ia[L+1]=ea.g*la;ia[L+2]=ea.b*la;fa[L]=va.x;fa[L+1]=va.y;fa[L+2]=va.z;Fa+=1}else if(L instanceof THREE.PointLight){L=za*3;na[L]=ea.r*la;na[L+1]=ea.g*la;na[L+2]=ea.b*la;z[L]=va.x;z[L+1]=va.y;z[L+2]=va.z;za+=1}}for(p=Fa*3;p<ia.length;p++)ia[p]=0;for(p=za*3;p<na.length;p++)na[p]=0;ha.point.length=za;ha.directional.length=Fa;ha.ambient[0]=S;ha.ambient[1]=E;ha.ambient[2]=da;n=N.lights;C.enableLighting.value=n.directional.length+n.point.length;C.ambientLightColor.value=n.ambient;C.directionalLightColor.value=
-n.directional.colors;C.directionalLightDirection.value=n.directional.positions;C.pointLightColor.value=n.point.colors;C.pointLightPosition.value=n.point.positions}if(j instanceof THREE.MeshBasicMaterial||j instanceof THREE.MeshLambertMaterial||j instanceof THREE.MeshPhongMaterial){C.diffuse.value.setRGB(j.color.r*j.opacity,j.color.g*j.opacity,j.color.b*j.opacity);C.opacity.value=j.opacity;C.map.texture=j.map;C.light_map.texture=j.light_map;C.env_map.texture=j.env_map;C.reflectivity.value=j.reflectivity;
-C.refraction_ratio.value=j.refraction_ratio;C.combine.value=j.combine;C.useRefract.value=j.env_map&&j.env_map.mapping instanceof THREE.CubeRefractionMapping}if(j instanceof THREE.LineBasicMaterial){C.diffuse.value.setRGB(j.color.r*j.opacity,j.color.g*j.opacity,j.color.b*j.opacity);C.opacity.value=j.opacity}else if(j instanceof THREE.ParticleBasicMaterial){C.psColor.value.setRGB(j.color.r*j.opacity,j.color.g*j.opacity,j.color.b*j.opacity);C.opacity.value=j.opacity;C.size.value=j.size;C.map.texture=
-j.map}else if(j instanceof THREE.MeshPhongMaterial){C.ambient.value.setRGB(j.ambient.r,j.ambient.g,j.ambient.b);C.specular.value.setRGB(j.specular.r,j.specular.g,j.specular.b);C.shininess.value=j.shininess}else if(j instanceof THREE.MeshDepthMaterial){C.mNear.value=f.near;C.mFar.value=f.far;C.opacity.value=j.opacity}else if(j instanceof THREE.MeshNormalMaterial)C.opacity.value=j.opacity;for(var Ga in C)if(S=q.uniforms[Ga]){p=C[Ga];W=p.type;n=p.value;if(W=="i")d.uniform1i(S,n);else if(W=="f")d.uniform1f(S,
-n);else if(W=="fv1")d.uniform1fv(S,n);else if(W=="fv")d.uniform3fv(S,n);else if(W=="v2")d.uniform2f(S,n.x,n.y);else if(W=="v3")d.uniform3f(S,n.x,n.y,n.z);else if(W=="c")d.uniform3f(S,n.r,n.g,n.b);else if(W=="t"){d.uniform1i(S,n);if(p=p.texture)if(p.image instanceof Array&&p.image.length==6){if(p.image.length==6){if(!p.image.__webGLTextureCube&&!p.image.__cubeMapInitialized&&p.image.loadCount==6){p.image.__webGLTextureCube=d.createTexture();d.bindTexture(d.TEXTURE_CUBE_MAP,p.image.__webGLTextureCube);
-d.texParameteri(d.TEXTURE_CUBE_MAP,d.TEXTURE_WRAP_S,d.CLAMP_TO_EDGE);d.texParameteri(d.TEXTURE_CUBE_MAP,d.TEXTURE_WRAP_T,d.CLAMP_TO_EDGE);d.texParameteri(d.TEXTURE_CUBE_MAP,d.TEXTURE_MAG_FILTER,d.LINEAR);d.texParameteri(d.TEXTURE_CUBE_MAP,d.TEXTURE_MIN_FILTER,d.LINEAR_MIPMAP_LINEAR);for(W=0;W<6;++W)d.texImage2D(d.TEXTURE_CUBE_MAP_POSITIVE_X+W,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,p.image[W]);d.generateMipmap(d.TEXTURE_CUBE_MAP);d.bindTexture(d.TEXTURE_CUBE_MAP,null);p.image.__cubeMapInitialized=!0}d.activeTexture(d.TEXTURE0+
-n);d.bindTexture(d.TEXTURE_CUBE_MAP,p.image.__webGLTextureCube)}}else{if(!p.__webGLTexture&&p.image.loaded){p.__webGLTexture=d.createTexture();d.bindTexture(d.TEXTURE_2D,p.__webGLTexture);d.texImage2D(d.TEXTURE_2D,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,p.image);d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_S,D(p.wrap_s));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_T,D(p.wrap_t));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MAG_FILTER,D(p.mag_filter));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MIN_FILTER,D(p.min_filter));
-d.generateMipmap(d.TEXTURE_2D);d.bindTexture(d.TEXTURE_2D,null)}d.activeTexture(d.TEXTURE0+n);d.bindTexture(d.TEXTURE_2D,p.__webGLTexture)}}}d.uniformMatrix4fv(v.modelViewMatrix,!1,h._modelViewMatrixArray);d.uniformMatrix3fv(v.normalMatrix,!1,h._normalMatrixArray);(j instanceof THREE.MeshShaderMaterial||j instanceof THREE.MeshPhongMaterial||j.env_map)&&d.uniform3f(v.cameraPosition,f.position.x,f.position.y,f.position.z);(j instanceof THREE.MeshShaderMaterial||j.env_map||j.skinning)&&d.uniformMatrix4fv(v.objectMatrix,
-!1,h._objectMatrixArray);(j instanceof THREE.MeshPhongMaterial||j instanceof THREE.MeshLambertMaterial||j instanceof THREE.MeshShaderMaterial||j.skinning)&&d.uniformMatrix4fv(v.viewMatrix,!1,ja);if(j.skinning){d.uniformMatrix4fv(v.cameraInverseMatrix,!1,P);d.uniformMatrix4fv(v.uBoneGlobalMatrices,!1,h.boneMatrices)}return q}function g(f,n,p,j,h,q){f=e(f,n,p,j,q).attributes;d.bindBuffer(d.ARRAY_BUFFER,h.__webGLVertexBuffer);d.vertexAttribPointer(f.position,3,d.FLOAT,!1,0,0);if(f.color>=0){d.bindBuffer(d.ARRAY_BUFFER,
-h.__webGLColorBuffer);d.vertexAttribPointer(f.color,3,d.FLOAT,!1,0,0)}if(f.normal>=0){d.bindBuffer(d.ARRAY_BUFFER,h.__webGLNormalBuffer);d.vertexAttribPointer(f.normal,3,d.FLOAT,!1,0,0)}if(f.tangent>=0){d.bindBuffer(d.ARRAY_BUFFER,h.__webGLTangentBuffer);d.vertexAttribPointer(f.tangent,4,d.FLOAT,!1,0,0)}if(f.uv>=0)if(h.__webGLUVBuffer){d.bindBuffer(d.ARRAY_BUFFER,h.__webGLUVBuffer);d.vertexAttribPointer(f.uv,2,d.FLOAT,!1,0,0);d.enableVertexAttribArray(f.uv)}else d.disableVertexAttribArray(f.uv);if(f.uv2>=
-0)if(h.__webGLUV2Buffer){d.bindBuffer(d.ARRAY_BUFFER,h.__webGLUV2Buffer);d.vertexAttribPointer(f.uv2,2,d.FLOAT,!1,0,0);d.enableVertexAttribArray(f.uv2)}else d.disableVertexAttribArray(f.uv2);if(j.skinning&&f.skinVertexA>=0&&f.skinVertexB>=0&&f.skinIndex>=0&&f.skinWeight>=0){d.bindBuffer(d.ARRAY_BUFFER,h.__webGLSkinVertexABuffer);d.vertexAttribPointer(f.skinVertexA,4,d.FLOAT,!1,0,0);d.bindBuffer(d.ARRAY_BUFFER,h.__webGLSkinVertexBBuffer);d.vertexAttribPointer(f.skinVertexB,4,d.FLOAT,!1,0,0);d.bindBuffer(d.ARRAY_BUFFER,
-h.__webGLSkinIndicesBuffer);d.vertexAttribPointer(f.skinIndex,4,d.FLOAT,!1,0,0);d.bindBuffer(d.ARRAY_BUFFER,h.__webGLSkinWeightsBuffer);d.vertexAttribPointer(f.skinWeight,4,d.FLOAT,!1,0,0)}if(q instanceof THREE.Mesh)if(j.wireframe){d.lineWidth(j.wireframe_linewidth);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,h.__webGLLineBuffer);d.drawElements(d.LINES,h.__webGLLineCount,d.UNSIGNED_SHORT,0)}else{d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,h.__webGLFaceBuffer);d.drawElements(d.TRIANGLES,h.__webGLFaceCount,d.UNSIGNED_SHORT,
-0)}else if(q instanceof THREE.Line){q=q.type==THREE.LineStrip?d.LINE_STRIP:d.LINES;d.lineWidth(j.linewidth);d.drawArrays(q,0,h.__webGLLineCount)}else q instanceof THREE.ParticleSystem&&d.drawArrays(d.POINTS,0,h.__webGLParticleCount)}function i(f,n){if(!f.__webGLVertexBuffer)f.__webGLVertexBuffer=d.createBuffer();if(!f.__webGLNormalBuffer)f.__webGLNormalBuffer=d.createBuffer();if(f.hasPos){d.bindBuffer(d.ARRAY_BUFFER,f.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,f.positionArray,d.DYNAMIC_DRAW);
-d.enableVertexAttribArray(n.attributes.position);d.vertexAttribPointer(n.attributes.position,3,d.FLOAT,!1,0,0)}if(f.hasNormal){d.bindBuffer(d.ARRAY_BUFFER,f.__webGLNormalBuffer);d.bufferData(d.ARRAY_BUFFER,f.normalArray,d.DYNAMIC_DRAW);d.enableVertexAttribArray(n.attributes.normal);d.vertexAttribPointer(n.attributes.normal,3,d.FLOAT,!1,0,0)}d.drawArrays(d.TRIANGLES,0,f.count);f.count=0}function l(f){if(ba!=f.doubleSided){f.doubleSided?d.disable(d.CULL_FACE):d.enable(d.CULL_FACE);ba=f.doubleSided}if(R!=
-f.flipSided){f.flipSided?d.frontFace(d.CW):d.frontFace(d.CCW);R=f.flipSided}}function o(f){if(V!=f){f?d.enable(d.DEPTH_TEST):d.disable(d.DEPTH_TEST);V=f}}function k(f){B[0].set(f.n41-f.n11,f.n42-f.n12,f.n43-f.n13,f.n44-f.n14);B[1].set(f.n41+f.n11,f.n42+f.n12,f.n43+f.n13,f.n44+f.n14);B[2].set(f.n41+f.n21,f.n42+f.n22,f.n43+f.n23,f.n44+f.n24);B[3].set(f.n41-f.n21,f.n42-f.n22,f.n43-f.n23,f.n44-f.n24);B[4].set(f.n41-f.n31,f.n42-f.n32,f.n43-f.n33,f.n44-f.n34);B[5].set(f.n41+f.n31,f.n42+f.n32,f.n43+f.n33,
-f.n44+f.n34);var n;for(f=0;f<5;f++){n=B[f];n.divideScalar(Math.sqrt(n.x*n.x+n.y*n.y+n.z*n.z))}}function m(f){for(var n=f.globalMatrix,p=-f.geometry.boundingSphere.radius*Math.max(f.scale.x,Math.max(f.scale.y,f.scale.z)),j=0;j<6;j++){f=B[j].x*n.n14+B[j].y*n.n24+B[j].z*n.n34+B[j].w;if(f<=p)return!1}return!0}function s(f,n){f.list[f.count]=n;f.count+=1}function w(f){var n,p,j=f.object,h=f.opaque,q=f.transparent;q.count=0;f=h.count=0;for(n=j.materials.length;f<n;f++){p=j.materials[f];p.opacity&&p.opacity<
-1||p.blending!=THREE.NormalBlending?s(q,p):s(h,p)}}function t(f){var n,p,j,h,q=f.object,v=f.buffer,C=f.opaque,W=f.transparent;W.count=0;f=C.count=0;for(j=q.materials.length;f<j;f++){n=q.materials[f];if(n instanceof THREE.MeshFaceMaterial){n=0;for(p=v.materials.length;n<p;n++)(h=v.materials[n])&&(h.opacity&&h.opacity<1||h.blending!=THREE.NormalBlending?s(W,h):s(C,h))}else{h=n;h.opacity&&h.opacity<1||h.blending!=THREE.NormalBlending?s(W,h):s(C,h)}}}function x(f,n){return n.z-f.z}function F(f,n,p,j,
-h){if(n[p]==undefined){f.push({buffer:j,object:h,opaque:{list:[],count:0},transparent:{list:[],count:0}});n[p]=1}}function H(f,n){f._modelViewMatrix.multiplyToArray(n.globalMatrix,f.globalMatrix,f._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(f._modelViewMatrix).transposeIntoArray(f._normalMatrixArray)}function G(f){if(f!=aa){switch(f){case THREE.AdditiveBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.ONE,d.ONE);break;case THREE.SubtractiveBlending:d.blendFunc(d.DST_COLOR,d.ZERO);break;case THREE.BillboardBlending:d.blendEquation(d.FUNC_ADD);
-d.blendFunc(d.SRC_ALPHA,d.ONE_MINUS_SRC_ALPHA);break;default:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.ONE,d.ONE_MINUS_SRC_ALPHA)}aa=f}}function r(f,n){if(f&&!f.__webGLFramebuffer){f.__webGLFramebuffer=d.createFramebuffer();f.__webGLRenderbuffer=d.createRenderbuffer();f.__webGLTexture=d.createTexture();d.bindRenderbuffer(d.RENDERBUFFER,f.__webGLRenderbuffer);d.renderbufferStorage(d.RENDERBUFFER,d.DEPTH_COMPONENT16,f.width,f.height);d.bindTexture(d.TEXTURE_2D,f.__webGLTexture);d.texParameteri(d.TEXTURE_2D,
-d.TEXTURE_WRAP_S,D(f.wrap_s));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_T,D(f.wrap_t));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MAG_FILTER,D(f.mag_filter));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MIN_FILTER,D(f.min_filter));d.texImage2D(d.TEXTURE_2D,0,D(f.format),f.width,f.height,0,D(f.format),D(f.type),null);d.bindFramebuffer(d.FRAMEBUFFER,f.__webGLFramebuffer);d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0,d.TEXTURE_2D,f.__webGLTexture,0);d.framebufferRenderbuffer(d.FRAMEBUFFER,d.DEPTH_ATTACHMENT,
-d.RENDERBUFFER,f.__webGLRenderbuffer);d.bindTexture(d.TEXTURE_2D,null);d.bindRenderbuffer(d.RENDERBUFFER,null);d.bindFramebuffer(d.FRAMEBUFFER,null)}var p,j,h;if(f){p=f.__webGLFramebuffer;j=f.width;h=f.height}else{p=null;j=K.width;h=K.height}if(p!=T){d.bindFramebuffer(d.FRAMEBUFFER,p);d.viewport(0,0,j,h);n&&d.clear(d.COLOR_BUFFER_BIT|d.DEPTH_BUFFER_BIT);T=p}}function Z(f,n){var p;if(f=="fragment")p=d.createShader(d.FRAGMENT_SHADER);else f=="vertex"&&(p=d.createShader(d.VERTEX_SHADER));d.shaderSource(p,
-n);d.compileShader(p);if(!d.getShaderParameter(p,d.COMPILE_STATUS)){alert(d.getShaderInfoLog(p));return null}return p}function D(f){switch(f){case THREE.RepeatWrapping:return d.REPEAT;case THREE.ClampToEdgeWrapping:return d.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return d.MIRRORED_REPEAT;case THREE.NearestFilter:return d.NEAREST;case THREE.NearestMipMapNearestFilter:return d.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return d.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return d.LINEAR;
-case THREE.LinearMipMapNearestFilter:return d.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return d.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return d.BYTE;case THREE.UnsignedByteType:return d.UNSIGNED_BYTE;case THREE.ShortType:return d.SHORT;case THREE.UnsignedShortType:return d.UNSIGNED_SHORT;case THREE.IntType:return d.INT;case THREE.UnsignedShortType:return d.UNSIGNED_INT;case THREE.FloatType:return d.FLOAT;case THREE.AlphaFormat:return d.ALPHA;case THREE.RGBFormat:return d.RGB;case THREE.RGBAFormat:return d.RGBA;
-case THREE.LuminanceFormat:return d.LUMINANCE;case THREE.LuminanceAlphaFormat:return d.LUMINANCE_ALPHA}return 0}var K=document.createElement("canvas"),d,ga=null,T=null,N=this,ba=null,R=null,aa=null,V=null,B=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],I=new THREE.Matrix4,ka=new Float32Array(16),P=new Float32Array(16),ja=new Float32Array(16),ca=new THREE.Vector4,Q=!0,ra=new THREE.Color(0),wa=0;if(a){if(a.antialias!==undefined)Q=a.antialias;
-a.clearColor!==undefined&&ra.setHex(a.clearColor);if(a.clearAlpha!==undefined)wa=a.clearAlpha}this.domElement=K;this.autoClear=!0;this.sortObjects=!1;(function(f,n,p){try{d=K.getContext("experimental-webgl",{antialias:f})}catch(j){console.log(j)}if(!d){alert("WebGL not supported");throw"cannot create webgl context";}d.clearColor(0,0,0,1);d.clearDepth(1);d.enable(d.DEPTH_TEST);d.depthFunc(d.LEQUAL);d.frontFace(d.CCW);d.cullFace(d.BACK);d.enable(d.CULL_FACE);d.enable(d.BLEND);d.blendFunc(d.ONE,d.ONE_MINUS_SRC_ALPHA);
-d.clearColor(n.r,n.g,n.b,p);_cullEnabled=!0})(Q,ra,wa);this.context=d;this.lights={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}};this.setSize=function(f,n){K.width=f;K.height=n;d.viewport(0,0,K.width,K.height)};this.setClearColorHex=function(f,n){var p=new THREE.Color(f);d.clearColor(p.r,p.g,p.b,n)};this.setClearColor=function(f,n){d.clearColor(f.r,f.g,f.b,n)};this.clear=function(){d.clear(d.COLOR_BUFFER_BIT|d.DEPTH_BUFFER_BIT)};this.initMaterial=
-function(f,n,p){var j,h;if(f instanceof THREE.MeshDepthMaterial)c(f,THREE.ShaderLib.depth);else if(f instanceof THREE.MeshNormalMaterial)c(f,THREE.ShaderLib.normal);else if(f instanceof THREE.MeshBasicMaterial)c(f,THREE.ShaderLib.basic);else if(f instanceof THREE.MeshLambertMaterial)c(f,THREE.ShaderLib.lambert);else if(f instanceof THREE.MeshPhongMaterial)c(f,THREE.ShaderLib.phong);else if(f instanceof THREE.LineBasicMaterial)c(f,THREE.ShaderLib.basic);else f instanceof THREE.ParticleBasicMaterial&&
-c(f,THREE.ShaderLib.particle_basic);var q,v,C,W;h=C=W=0;for(q=n.length;h<q;h++){v=n[h];v instanceof THREE.DirectionalLight&&C++;v instanceof THREE.PointLight&&W++}if(W+C<=4)n=C;else{n=Math.ceil(4*C/(W+C));W=4-n}h={directional:n,point:W};W=f.fragment_shader;n=f.vertex_shader;q={fog:p,map:f.map,env_map:f.env_map,light_map:f.light_map,vertex_colors:f.vertex_colors,skinning:f.skinning,maxDirLights:h.directional,maxPointLights:h.point};p=d.createProgram();h=["#ifdef GL_ES\nprecision highp float;\n#endif",
-"#define MAX_DIR_LIGHTS "+q.maxDirLights,"#define MAX_POINT_LIGHTS "+q.maxPointLights,q.fog?"#define USE_FOG":"",q.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",q.map?"#define USE_MAP":"",q.env_map?"#define USE_ENVMAP":"",q.light_map?"#define USE_LIGHTMAP":"",q.vertex_colors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");q=[d.getParameter(d.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+q.maxDirLights,"#define MAX_POINT_LIGHTS "+
-q.maxPointLights,q.map?"#define USE_MAP":"",q.env_map?"#define USE_ENVMAP":"",q.light_map?"#define USE_LIGHTMAP":"",q.vertex_colors?"#define USE_COLOR":"",q.skinning?"#define USE_SKINNING":"","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 vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n");
-d.attachShader(p,Z("fragment",h+W));d.attachShader(p,Z("vertex",q+n));d.linkProgram(p);d.getProgramParameter(p,d.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+d.getProgramParameter(p,d.VALIDATE_STATUS)+", gl error ["+d.getError()+"]");p.uniforms={};p.attributes={};f.program=p;p=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","uBoneGlobalMatrices"];for(j in f.uniforms)p.push(j);j=f.program;W=0;for(n=p.length;W<
-n;W++){h=p[W];j.uniforms[h]=d.getUniformLocation(j,h)}j=f.program;p=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];W=0;for(n=p.length;W<n;W++){h=p[W];j.attributes[h]=d.getAttribLocation(j,h)}j=f.program.attributes;d.enableVertexAttribArray(j.position);j.color>=0&&d.enableVertexAttribArray(j.color);j.normal>=0&&d.enableVertexAttribArray(j.normal);j.tangent>=0&&d.enableVertexAttribArray(j.tangent);if(f.skinning&&j.skinVertexA>=0&&j.skinVertexB>=
-0&&j.skinIndex>=0&&j.skinWeight>=0){d.enableVertexAttribArray(j.skinVertexA);d.enableVertexAttribArray(j.skinVertexB);d.enableVertexAttribArray(j.skinIndex);d.enableVertexAttribArray(j.skinWeight)}};this.render=function(f,n,p,j){var h,q,v,C,W,L,S,E,da=f.lights,ea=f.fog;n.autoUpdateMatrix&&n.update();n.globalMatrix.flattenToArray(ja);n.projectionMatrix.flattenToArray(ka);n.inverseMatrix.flattenToArray(P);I.multiply(n.projectionMatrix,n.globalMatrix);k(I);THREE.AnimationHandler&&THREE.AnimationHandler.update();
-f.update(undefined,!1,n);this.initWebGLObjects(f,n);r(p,j!==undefined?j:!0);this.autoClear&&this.clear();W=f.__webGLObjects.length;for(j=0;j<W;j++){h=f.__webGLObjects[j];S=h.object;if(S.visible)if(!(S instanceof THREE.Mesh)||m(S)){S.globalMatrix.flattenToArray(S._objectMatrixArray);H(S,n);t(h);h.render=!0;if(this.sortObjects){ca.copy(S.position);I.multiplyVector3(ca);h.z=ca.z}}else h.render=!1;else h.render=!1}this.sortObjects&&f.__webGLObjects.sort(x);L=f.__webGLObjectsImmediate.length;for(j=0;j<
-L;j++){h=f.__webGLObjectsImmediate[j];S=h.object;if(S.visible){S.autoUpdateMatrix&&S.globalMatrix.flattenToArray(S._objectMatrixArray);H(S,n);w(h)}}G(THREE.NormalBlending);for(j=0;j<W;j++){h=f.__webGLObjects[j];if(h.render){S=h.object;E=h.buffer;v=h.opaque;l(S);for(h=0;h<v.count;h++){C=v.list[h];o(C.depth_test);g(n,da,ea,C,E,S)}}}for(j=0;j<L;j++){h=f.__webGLObjectsImmediate[j];S=h.object;if(S.visible){v=h.opaque;l(S);for(h=0;h<v.count;h++){C=v.list[h];o(C.depth_test);q=e(n,da,ea,C,S);S.render(function(va){i(va,
-q)})}}}for(j=0;j<W;j++){h=f.__webGLObjects[j];if(h.render){S=h.object;E=h.buffer;v=h.transparent;l(S);for(h=0;h<v.count;h++){C=v.list[h];G(C.blending);o(C.depth_test);g(n,da,ea,C,E,S)}}}for(j=0;j<L;j++){h=f.__webGLObjectsImmediate[j];S=h.object;if(S.visible){v=h.transparent;l(S);for(h=0;h<v.count;h++){C=v.list[h];G(C.blending);o(C.depth_test);q=e(n,da,ea,C,S);S.render(function(va){i(va,q)})}}}if(p&&p.min_filter!==THREE.NearestFilter&&p.min_filter!==THREE.LinearFilter){d.bindTexture(d.TEXTURE_2D,p.__webGLTexture);
-d.generateMipmap(d.TEXTURE_2D);d.bindTexture(d.TEXTURE_2D,null)}};this.initWebGLObjects=function(f){var n,p,j;if(!f.__webGLObjects){f.__webGLObjects=[];f.__webGLObjectsMap={};f.__webGLObjectsImmediate=[]}n=0;for(p=f.objects.length;n<p;n++){j=f.objects[n];var h=f,q=void 0,v=void 0,C=void 0,W=void 0;v=j.geometry;if(h.__webGLObjectsMap[j.id]==undefined){h.__webGLObjectsMap[j.id]={};j._modelViewMatrix=new THREE.Matrix4;j._normalMatrixArray=new Float32Array(9);j._modelViewMatrixArray=new Float32Array(16);
-j._objectMatrixArray=new Float32Array(16);j.globalMatrix.flattenToArray(j._objectMatrixArray)}W=h.__webGLObjectsMap[j.id];objlist=h.__webGLObjects;if(j instanceof THREE.Mesh){for(q in v.geometryChunks){C=v.geometryChunks[q];if(!C.__webGLVertexBuffer){h=C;h.__webGLVertexBuffer=d.createBuffer();h.__webGLNormalBuffer=d.createBuffer();h.__webGLTangentBuffer=d.createBuffer();h.__webGLColorBuffer=d.createBuffer();h.__webGLUVBuffer=d.createBuffer();h.__webGLUV2Buffer=d.createBuffer();h.__webGLSkinVertexABuffer=
-d.createBuffer();h.__webGLSkinVertexBBuffer=d.createBuffer();h.__webGLSkinIndicesBuffer=d.createBuffer();h.__webGLSkinWeightsBuffer=d.createBuffer();h.__webGLFaceBuffer=d.createBuffer();h.__webGLLineBuffer=d.createBuffer();h=C;var L=j,S=void 0,E=void 0,da=0,ea=0,va=0,la=L.geometry.faces,ha=h.faces;S=0;for(E=ha.length;S<E;S++){fi=ha[S];face=la[fi];if(face instanceof THREE.Face3){da+=3;ea+=1;va+=3}else if(face instanceof THREE.Face4){da+=4;ea+=2;va+=4}}h.__vertexArray=new Float32Array(da*3);h.__normalArray=
-new Float32Array(da*3);h.__tangentArray=new Float32Array(da*4);h.__colorArray=new Float32Array(da*3);h.__uvArray=new Float32Array(da*2);h.__uv2Array=new Float32Array(da*2);h.__skinVertexAArray=new Float32Array(da*4);h.__skinVertexBArray=new Float32Array(da*4);h.__skinIndexArray=new Float32Array(da*4);h.__skinWeightArray=new Float32Array(da*4);h.__faceArray=new Uint16Array(ea*3);h.__lineArray=new Uint16Array(va*2);E=S=h;da=void 0;la=void 0;var ia=void 0,fa=void 0;ia=void 0;ha=!1;da=0;for(la=L.materials.length;da<
-la;da++){ia=L.materials[da];if(ia instanceof THREE.MeshFaceMaterial){ia=0;for(fa=E.materials.length;ia<fa;ia++)if(E.materials[ia]&&E.materials[ia].shading!=undefined&&E.materials[ia].shading==THREE.SmoothShading){ha=!0;break}}else if(ia&&ia.shading!=undefined&&ia.shading==THREE.SmoothShading){ha=!0;break}if(ha)break}S.__needsSmoothNormals=ha;h.__webGLFaceCount=ea*3;h.__webGLLineCount=va*2;v.__dirtyVertices=!0;v.__dirtyElements=!0;v.__dirtyUvs=!0;v.__dirtyNormals=!0;v.__dirtyTangents=!0;v.__dirtyColors=
-!0}if(v.__dirtyVertices||v.__dirtyElements||v.__dirtyUvs||v.__dirtyNormals||v.__dirtyColors||v.__dirtyTangents){h=C;ea=d.DYNAMIC_DRAW;va=void 0;S=void 0;var na=void 0,z=void 0,Fa=void 0,za=void 0,Ga=void 0;na=void 0;var O=void 0,M=void 0,J=void 0,oa=void 0;O=void 0;M=void 0;J=void 0;z=void 0;O=void 0;M=void 0;J=void 0;oa=void 0;O=void 0;M=void 0;J=void 0;oa=void 0;O=void 0;M=void 0;J=void 0;oa=void 0;O=void 0;M=void 0;J=void 0;oa=void 0;O=void 0;M=void 0;J=void 0;oa=void 0;z=void 0;za=void 0;Fa=void 0;
-Ga=void 0;var Ca=fa=ia=ha=la=da=L=E=0,Aa=0,u=0,Ba=h.__vertexArray,Oa=h.__uvArray,Ma=h.__uv2Array,Ha=h.__normalArray,$=h.__tangentArray,sa=h.__colorArray,pa=h.__skinVertexAArray,ta=h.__skinVertexBArray,ua=h.__skinIndexArray,qa=h.__skinWeightArray,y=h.__faceArray,X=h.__lineArray,Y=h.__needsSmoothNormals,A=j.geometry,U=A.__dirtyVertices,ma=A.__dirtyElements,xa=A.__dirtyUvs,Da=A.__dirtyNormals,Ea=A.__dirtyTangents,Ia=A.__dirtyColors,ya=A.vertices,Ja=h.faces,Qa=A.faces,Ka=A.uvs,La=A.uvs2,Na=A.colors,Ra=
-A.skinVerticesA,Sa=A.skinVerticesB,Ta=A.skinIndices,Pa=A.skinWeights;va=0;for(S=Ja.length;va<S;va++){na=Ja[va];z=Qa[na];Ga=Ka[na];na=La[na];Fa=z.vertexNormals;za=z.normal;if(z instanceof THREE.Face3){if(U){O=ya[z.a].position;M=ya[z.b].position;J=ya[z.c].position;Ba[L]=O.x;Ba[L+1]=O.y;Ba[L+2]=O.z;Ba[L+3]=M.x;Ba[L+4]=M.y;Ba[L+5]=M.z;Ba[L+6]=J.x;Ba[L+7]=J.y;Ba[L+8]=J.z;L+=9}if(Pa.length){O=Pa[z.a];M=Pa[z.b];J=Pa[z.c];qa[u]=O.x;qa[u+1]=O.y;qa[u+2]=O.z;qa[u+3]=O.w;qa[u+4]=M.x;qa[u+5]=M.y;qa[u+6]=M.z;qa[u+
-7]=M.w;qa[u+8]=J.x;qa[u+9]=J.y;qa[u+10]=J.z;qa[u+11]=J.w;O=Ta[z.a];M=Ta[z.b];J=Ta[z.c];ua[u]=O.x;ua[u+1]=O.y;ua[u+2]=O.z;ua[u+3]=O.w;ua[u+4]=M.x;ua[u+5]=M.y;ua[u+6]=M.z;ua[u+7]=M.w;ua[u+8]=J.x;ua[u+9]=J.y;ua[u+10]=J.z;ua[u+11]=J.w;O=Ra[z.a];M=Ra[z.b];J=Ra[z.c];pa[u]=O.x;pa[u+1]=O.y;pa[u+2]=O.z;pa[u+3]=1;pa[u+4]=M.x;pa[u+5]=M.y;pa[u+6]=M.z;pa[u+7]=1;pa[u+8]=J.x;pa[u+9]=J.y;pa[u+10]=J.z;pa[u+11]=1;O=Sa[z.a];M=Sa[z.b];J=Sa[z.c];ta[u]=O.x;ta[u+1]=O.y;ta[u+2]=O.z;ta[u+3]=1;ta[u+4]=M.x;ta[u+5]=M.y;ta[u+
-6]=M.z;ta[u+7]=1;ta[u+8]=J.x;ta[u+9]=J.y;ta[u+10]=J.z;ta[u+11]=1;u+=12}if(Ia&&Na.length){O=Na[z.a];M=Na[z.b];J=Na[z.c];sa[Aa]=O.r;sa[Aa+1]=O.g;sa[Aa+2]=O.b;sa[Aa+3]=M.r;sa[Aa+4]=M.g;sa[Aa+5]=M.b;sa[Aa+6]=J.r;sa[Aa+7]=J.g;sa[Aa+8]=J.b;Aa+=9}if(Ea&&A.hasTangents){O=ya[z.a].tangent;M=ya[z.b].tangent;J=ya[z.c].tangent;$[fa]=O.x;$[fa+1]=O.y;$[fa+2]=O.z;$[fa+3]=O.w;$[fa+4]=M.x;$[fa+5]=M.y;$[fa+6]=M.z;$[fa+7]=M.w;$[fa+8]=J.x;$[fa+9]=J.y;$[fa+10]=J.z;$[fa+11]=J.w;fa+=12}if(Da)if(Fa.length==3&&Y)for(z=0;z<
-3;z++){za=Fa[z];Ha[ia]=za.x;Ha[ia+1]=za.y;Ha[ia+2]=za.z;ia+=3}else for(z=0;z<3;z++){Ha[ia]=za.x;Ha[ia+1]=za.y;Ha[ia+2]=za.z;ia+=3}if(xa&&Ga)for(z=0;z<3;z++){Fa=Ga[z];Oa[da]=Fa.u;Oa[da+1]=Fa.v;da+=2}if(xa&&na)for(z=0;z<3;z++){Ga=na[z];Ma[la]=Ga.u;Ma[la+1]=Ga.v;la+=2}if(ma){y[ha]=E;y[ha+1]=E+1;y[ha+2]=E+2;ha+=3;X[Ca]=E;X[Ca+1]=E+1;X[Ca+2]=E;X[Ca+3]=E+2;X[Ca+4]=E+1;X[Ca+5]=E+2;Ca+=6;E+=3}}else if(z instanceof THREE.Face4){if(U){O=ya[z.a].position;M=ya[z.b].position;J=ya[z.c].position;oa=ya[z.d].position;
-Ba[L]=O.x;Ba[L+1]=O.y;Ba[L+2]=O.z;Ba[L+3]=M.x;Ba[L+4]=M.y;Ba[L+5]=M.z;Ba[L+6]=J.x;Ba[L+7]=J.y;Ba[L+8]=J.z;Ba[L+9]=oa.x;Ba[L+10]=oa.y;Ba[L+11]=oa.z;L+=12}if(Pa.length){O=Pa[z.a];M=Pa[z.b];J=Pa[z.c];oa=Pa[z.d];qa[u]=O.x;qa[u+1]=O.y;qa[u+2]=O.z;qa[u+3]=O.w;qa[u+4]=M.x;qa[u+5]=M.y;qa[u+6]=M.z;qa[u+7]=M.w;qa[u+8]=J.x;qa[u+9]=J.y;qa[u+10]=J.z;qa[u+11]=J.w;qa[u+12]=oa.x;qa[u+13]=oa.y;qa[u+14]=oa.z;qa[u+15]=oa.w;O=Ta[z.a];M=Ta[z.b];J=Ta[z.c];oa=Ta[z.d];ua[u]=O.x;ua[u+1]=O.y;ua[u+2]=O.z;ua[u+3]=O.w;ua[u+4]=
-M.x;ua[u+5]=M.y;ua[u+6]=M.z;ua[u+7]=M.w;ua[u+8]=J.x;ua[u+9]=J.y;ua[u+10]=J.z;ua[u+11]=J.w;ua[u+12]=oa.x;ua[u+13]=oa.y;ua[u+14]=oa.z;ua[u+15]=oa.w;O=Ra[z.a];M=Ra[z.b];J=Ra[z.c];oa=Ra[z.d];pa[u]=O.x;pa[u+1]=O.y;pa[u+2]=O.z;pa[u+3]=1;pa[u+4]=M.x;pa[u+5]=M.y;pa[u+6]=M.z;pa[u+7]=1;pa[u+8]=J.x;pa[u+9]=J.y;pa[u+10]=J.z;pa[u+11]=1;pa[u+12]=oa.x;pa[u+13]=oa.y;pa[u+14]=oa.z;pa[u+15]=1;O=Sa[z.a];M=Sa[z.b];J=Sa[z.c];oa=Sa[z.d];ta[u]=O.x;ta[u+1]=O.y;ta[u+2]=O.z;ta[u+3]=1;ta[u+4]=M.x;ta[u+5]=M.y;ta[u+6]=M.z;ta[u+
-7]=1;ta[u+8]=J.x;ta[u+9]=J.y;ta[u+10]=J.z;ta[u+11]=1;ta[u+12]=oa.x;ta[u+13]=oa.y;ta[u+14]=oa.z;ta[u+15]=1;u+=16}if(Ia&&Na.length){O=Na[z.a];M=Na[z.b];J=Na[z.c];oa=Na[z.d];sa[Aa]=O.r;sa[Aa+1]=O.g;sa[Aa+2]=O.b;sa[Aa+3]=M.r;sa[Aa+4]=M.g;sa[Aa+5]=M.b;sa[Aa+6]=J.r;sa[Aa+7]=J.g;sa[Aa+8]=J.b;sa[Aa+9]=oa.r;sa[Aa+10]=oa.g;sa[Aa+11]=oa.b;Aa+=12}if(Ea&&A.hasTangents){O=ya[z.a].tangent;M=ya[z.b].tangent;J=ya[z.c].tangent;z=ya[z.d].tangent;$[fa]=O.x;$[fa+1]=O.y;$[fa+2]=O.z;$[fa+3]=O.w;$[fa+4]=M.x;$[fa+5]=M.y;
-$[fa+6]=M.z;$[fa+7]=M.w;$[fa+8]=J.x;$[fa+9]=J.y;$[fa+10]=J.z;$[fa+11]=J.w;$[fa+12]=z.x;$[fa+13]=z.y;$[fa+14]=z.z;$[fa+15]=z.w;fa+=16}if(Da)if(Fa.length==4&&Y)for(z=0;z<4;z++){za=Fa[z];Ha[ia]=za.x;Ha[ia+1]=za.y;Ha[ia+2]=za.z;ia+=3}else for(z=0;z<4;z++){Ha[ia]=za.x;Ha[ia+1]=za.y;Ha[ia+2]=za.z;ia+=3}if(xa&&Ga)for(z=0;z<4;z++){Fa=Ga[z];Oa[da]=Fa.u;Oa[da+1]=Fa.v;da+=2}if(xa&&na)for(z=0;z<4;z++){Ga=na[z];Ma[la]=Ga.u;Ma[la+1]=Ga.v;la+=2}if(ma){y[ha]=E;y[ha+1]=E+1;y[ha+2]=E+2;y[ha+3]=E;y[ha+4]=E+2;y[ha+5]=
-E+3;ha+=6;X[Ca]=E;X[Ca+1]=E+1;X[Ca+2]=E;X[Ca+3]=E+3;X[Ca+4]=E+1;X[Ca+5]=E+2;X[Ca+6]=E+2;X[Ca+7]=E+3;Ca+=8;E+=4}}}if(U){d.bindBuffer(d.ARRAY_BUFFER,h.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,Ba,ea)}if(Ia&&Na.length){d.bindBuffer(d.ARRAY_BUFFER,h.__webGLColorBuffer);d.bufferData(d.ARRAY_BUFFER,sa,ea)}if(Da){d.bindBuffer(d.ARRAY_BUFFER,h.__webGLNormalBuffer);d.bufferData(d.ARRAY_BUFFER,Ha,ea)}if(Ea&&A.hasTangents){d.bindBuffer(d.ARRAY_BUFFER,h.__webGLTangentBuffer);d.bufferData(d.ARRAY_BUFFER,
-$,ea)}if(xa&&da>0){d.bindBuffer(d.ARRAY_BUFFER,h.__webGLUVBuffer);d.bufferData(d.ARRAY_BUFFER,Oa,ea)}if(xa&&la>0){d.bindBuffer(d.ARRAY_BUFFER,h.__webGLUV2Buffer);d.bufferData(d.ARRAY_BUFFER,Ma,ea)}if(ma){d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,h.__webGLFaceBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,y,ea);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,h.__webGLLineBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,X,ea)}if(u>0){d.bindBuffer(d.ARRAY_BUFFER,h.__webGLSkinVertexABuffer);d.bufferData(d.ARRAY_BUFFER,pa,ea);
-d.bindBuffer(d.ARRAY_BUFFER,h.__webGLSkinVertexBBuffer);d.bufferData(d.ARRAY_BUFFER,ta,ea);d.bindBuffer(d.ARRAY_BUFFER,h.__webGLSkinIndicesBuffer);d.bufferData(d.ARRAY_BUFFER,ua,ea);d.bindBuffer(d.ARRAY_BUFFER,h.__webGLSkinWeightsBuffer);d.bufferData(d.ARRAY_BUFFER,qa,ea)}}F(objlist,W,q,C,j)}v.__dirtyVertices=!1;v.__dirtyElements=!1;v.__dirtyUvs=!1;v.__dirtyNormals=!1;v.__dirtyTangents=!1;v.__dirtyColors=!1}else if(j instanceof THREE.Line){if(!v.__webGLVertexBuffer){q=v;q.__webGLVertexBuffer=d.createBuffer();
-q.__webGLColorBuffer=d.createBuffer();q=v;C=q.vertices.length;q.__vertexArray=new Float32Array(C*3);q.__colorArray=new Float32Array(C*3);q.__webGLLineCount=C;v.__dirtyVertices=!0;v.__dirtyColors=!0}if(v.__dirtyVertices||v.__dirtyColors){q=v;C=d.DYNAMIC_DRAW;E=void 0;E=void 0;L=void 0;h=void 0;da=q.vertices;ea=q.colors;la=da.length;va=ea.length;ha=q.__vertexArray;S=q.__colorArray;ia=q.__dirtyColors;if(q.__dirtyVertices){for(E=0;E<la;E++){L=da[E].position;h=E*3;ha[h]=L.x;ha[h+1]=L.y;ha[h+2]=L.z}d.bindBuffer(d.ARRAY_BUFFER,
-q.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,ha,C)}if(ia){for(E=0;E<va;E++){color=ea[E];h=E*3;S[h]=color.r;S[h+1]=color.g;S[h+2]=color.b}d.bindBuffer(d.ARRAY_BUFFER,q.__webGLColorBuffer);d.bufferData(d.ARRAY_BUFFER,S,C)}}F(objlist,W,0,v,j);v.__dirtyVertices=!1;v.__dirtyColors=!1}else if(j instanceof THREE.ParticleSystem){if(!v.__webGLVertexBuffer){q=v;q.__webGLVertexBuffer=d.createBuffer();q.__webGLColorBuffer=d.createBuffer();q=v;C=q.vertices.length;q.__vertexArray=new Float32Array(C*3);q.__colorArray=
-new Float32Array(C*3);q.__sortArray=[];q.__webGLParticleCount=C;v.__dirtyVertices=!0;v.__dirtyColors=!0}(v.__dirtyVertices||v.__dirtyColors||j.sortParticles)&&b(v,d.DYNAMIC_DRAW,j,camera);F(objlist,W,0,v,j);v.__dirtyVertices=!1;v.__dirtyColors=!1}else if(j instanceof THREE.MarchingCubes){v=W;if(v[0]==undefined){h.__webGLObjectsImmediate.push({object:j,opaque:{list:[],count:0},transparent:{list:[],count:0}});v[0]=1}}}};this.removeObject=function(f,n){var p,j;for(p=f.__webGLObjects.length-1;p>=0;p--){j=
-f.__webGLObjects[p].object;n==j&&f.__webGLObjects.splice(p,1)}};this.setFaceCulling=function(f,n){if(f){!n||n=="ccw"?d.frontFace(d.CCW):d.frontFace(d.CW);if(f=="back")d.cullFace(d.BACK);else f=="front"?d.cullFace(d.FRONT):d.cullFace(d.FRONT_AND_BACK);d.enable(d.CULL_FACE)}else d.disable(d.CULL_FACE)};this.supportsVertexTextures=function(){return d.getParameter(d.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};
+THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;THREE.Fog=function(a,b,d){this.color=new THREE.Color(a);this.near=b||1;this.far=d||1E3};THREE.FogExp2=function(a,b){this.color=new THREE.Color(a);this.density=b||2.5E-4};
+THREE.Projector=function(){function a(T,O){return O.z-T.z}function b(T,O){var ca=0,S=1,ba=T.z+T.w,V=O.z+O.w,D=-T.z+T.w,J=-O.z+O.w;if(ba>=0&&V>=0&&D>=0&&J>=0)return!0;else if(ba<0&&V<0||D<0&&J<0)return!1;else{if(ba<0)ca=Math.max(ca,ba/(ba-V));else V<0&&(S=Math.min(S,ba/(ba-V)));if(D<0)ca=Math.max(ca,D/(D-J));else J<0&&(S=Math.min(S,D/(D-J)));if(S<ca)return!1;else{T.lerpSelf(O,ca);O.lerpSelf(T,1-S);return!0}}}var d,e,g=[],i,l,o,k=[],m,s,w=[],u,x,F=[],I=new THREE.Vector4,H=new THREE.Vector4,r=new THREE.Matrix4,
+Z=new THREE.Matrix4,E=[],L=new THREE.Vector4,c=new THREE.Vector4,ia;this.projectObjects=function(T,O,ca){O=[];var S,ba,V;e=0;ba=T.objects;T=0;for(S=ba.length;T<S;T++){V=ba[T];var D;if(!(D=!V.visible))if(D=V instanceof THREE.Mesh){a:{D=void 0;for(var J=V.globalMatrix,la=-V.geometry.boundingSphere.radius*Math.max(V.scale.x,Math.max(V.scale.y,V.scale.z)),Q=0;Q<6;Q++){D=E[Q].x*J.n14+E[Q].y*J.n24+E[Q].z*J.n34+E[Q].w;if(D<=la){D=!1;break a}}D=!0}D=!D}if(!D){d=g[e]=g[e]||new THREE.RenderableObject;I.copy(V.position);
+r.multiplyVector3(I);d.object=V;d.z=I.z;O.push(d);e++}}ca&&O.sort(a);return O};this.projectScene=function(T,O,ca){var S=[],ba=O.near,V=O.far,D,J,la,Q,ja,ea,R,ra,wa,f,n,p,j,h,q,t;o=s=x=0;O.autoUpdateMatrix&&O.update();r.multiply(O.projectionMatrix,O.globalMatrix);E[0]=new THREE.Vector4(r.n41-r.n11,r.n42-r.n12,r.n43-r.n13,r.n44-r.n14);E[1]=new THREE.Vector4(r.n41+r.n11,r.n42+r.n12,r.n43+r.n13,r.n44+r.n14);E[2]=new THREE.Vector4(r.n41+r.n21,r.n42+r.n22,r.n43+r.n23,r.n44+r.n24);E[3]=new THREE.Vector4(r.n41-
+r.n21,r.n42-r.n22,r.n43-r.n23,r.n44-r.n24);E[4]=new THREE.Vector4(r.n41-r.n31,r.n42-r.n32,r.n43-r.n33,r.n44-r.n34);E[5]=new THREE.Vector4(r.n41+r.n31,r.n42+r.n32,r.n43+r.n33,r.n44+r.n34);D=0;for(ea=E.length;D<ea;D++){R=E[D];R.divideScalar(Math.sqrt(R.x*R.x+R.y*R.y+R.z*R.z))}T.update(undefined,!1,O);ea=this.projectObjects(T,O,!0);T=0;for(D=ea.length;T<D;T++){R=ea[T].object;if(R.visible){R.autoUpdateMatrix&&R.updateMatrix();ra=R.globalMatrix;ra.extractRotationMatrix(R.rotationMatrix);n=R.rotationMatrix;
+wa=R.materials;f=R.overdraw;if(R instanceof THREE.Mesh){p=R.geometry;j=p.vertices;J=0;for(la=j.length;J<la;J++){h=j[J];h.positionWorld.copy(h.position);ra.multiplyVector3(h.positionWorld);Q=h.positionScreen;Q.copy(h.positionWorld);r.multiplyVector4(Q);Q.x/=Q.w;Q.y/=Q.w;h.__visible=Q.z>ba&&Q.z<V}p=p.faces;J=0;for(la=p.length;J<la;J++){h=p[J];if(h instanceof THREE.Face3){Q=j[h.a];ja=j[h.b];q=j[h.c];if(Q.__visible&&ja.__visible&&q.__visible&&(R.doubleSided||R.flipSided!=(q.positionScreen.x-Q.positionScreen.x)*
+(ja.positionScreen.y-Q.positionScreen.y)-(q.positionScreen.y-Q.positionScreen.y)*(ja.positionScreen.x-Q.positionScreen.x)<0)){i=k[o]=k[o]||new THREE.RenderableFace3;i.v1.positionWorld.copy(Q.positionWorld);i.v2.positionWorld.copy(ja.positionWorld);i.v3.positionWorld.copy(q.positionWorld);i.v1.positionScreen.copy(Q.positionScreen);i.v2.positionScreen.copy(ja.positionScreen);i.v3.positionScreen.copy(q.positionScreen);i.normalWorld.copy(h.normal);n.multiplyVector3(i.normalWorld);i.centroidWorld.copy(h.centroid);
+ra.multiplyVector3(i.centroidWorld);i.centroidScreen.copy(i.centroidWorld);r.multiplyVector3(i.centroidScreen);q=h.vertexNormals;ia=i.vertexNormalsWorld;Q=0;for(ja=q.length;Q<ja;Q++){t=ia[Q]=ia[Q]||new THREE.Vector3;t.copy(q[Q]);n.multiplyVector3(t)}i.z=i.centroidScreen.z;i.meshMaterials=wa;i.faceMaterials=h.materials;i.overdraw=f;if(R.geometry.uvs[J]){i.uvs[0]=R.geometry.uvs[J][0];i.uvs[1]=R.geometry.uvs[J][1];i.uvs[2]=R.geometry.uvs[J][2]}S.push(i);o++}}else if(h instanceof THREE.Face4){Q=j[h.a];
+ja=j[h.b];q=j[h.c];t=j[h.d];if(Q.__visible&&ja.__visible&&q.__visible&&t.__visible&&(R.doubleSided||R.flipSided!=((t.positionScreen.x-Q.positionScreen.x)*(ja.positionScreen.y-Q.positionScreen.y)-(t.positionScreen.y-Q.positionScreen.y)*(ja.positionScreen.x-Q.positionScreen.x)<0||(ja.positionScreen.x-q.positionScreen.x)*(t.positionScreen.y-q.positionScreen.y)-(ja.positionScreen.y-q.positionScreen.y)*(t.positionScreen.x-q.positionScreen.x)<0))){i=k[o]=k[o]||new THREE.RenderableFace3;i.v1.positionWorld.copy(Q.positionWorld);
+i.v2.positionWorld.copy(ja.positionWorld);i.v3.positionWorld.copy(t.positionWorld);i.v1.positionScreen.copy(Q.positionScreen);i.v2.positionScreen.copy(ja.positionScreen);i.v3.positionScreen.copy(t.positionScreen);i.normalWorld.copy(h.normal);n.multiplyVector3(i.normalWorld);i.centroidWorld.copy(h.centroid);ra.multiplyVector3(i.centroidWorld);i.centroidScreen.copy(i.centroidWorld);r.multiplyVector3(i.centroidScreen);i.z=i.centroidScreen.z;i.meshMaterials=wa;i.faceMaterials=h.materials;i.overdraw=f;
+if(R.geometry.uvs[J]){i.uvs[0]=R.geometry.uvs[J][0];i.uvs[1]=R.geometry.uvs[J][1];i.uvs[2]=R.geometry.uvs[J][3]}S.push(i);o++;l=k[o]=k[o]||new THREE.RenderableFace3;l.v1.positionWorld.copy(ja.positionWorld);l.v2.positionWorld.copy(q.positionWorld);l.v3.positionWorld.copy(t.positionWorld);l.v1.positionScreen.copy(ja.positionScreen);l.v2.positionScreen.copy(q.positionScreen);l.v3.positionScreen.copy(t.positionScreen);l.normalWorld.copy(i.normalWorld);l.centroidWorld.copy(i.centroidWorld);l.centroidScreen.copy(i.centroidScreen);
+l.z=l.centroidScreen.z;l.meshMaterials=wa;l.faceMaterials=h.materials;l.overdraw=f;if(R.geometry.uvs[J]){l.uvs[0]=R.geometry.uvs[J][1];l.uvs[1]=R.geometry.uvs[J][2];l.uvs[2]=R.geometry.uvs[J][3]}S.push(l);o++}}}}else if(R instanceof THREE.Line){Z.multiply(r,ra);j=R.geometry.vertices;h=j[0];h.positionScreen.copy(h.position);Z.multiplyVector4(h.positionScreen);J=1;for(la=j.length;J<la;J++){Q=j[J];Q.positionScreen.copy(Q.position);Z.multiplyVector4(Q.positionScreen);ja=j[J-1];L.copy(Q.positionScreen);
+c.copy(ja.positionScreen);if(b(L,c)){L.multiplyScalar(1/L.w);c.multiplyScalar(1/c.w);m=w[s]=w[s]||new THREE.RenderableLine;m.v1.positionScreen.copy(L);m.v2.positionScreen.copy(c);m.z=Math.max(L.z,c.z);m.materials=R.materials;S.push(m);s++}}}else if(R instanceof THREE.Particle){H.set(R.position.x,R.position.y,R.position.z,1);r.multiplyVector4(H);H.z/=H.w;if(H.z>0&&H.z<1){u=F[x]=F[x]||new THREE.RenderableParticle;u.x=H.x/H.w;u.y=H.y/H.w;u.z=H.z;u.rotation=R.rotation.z;u.scale.x=R.scale.x*Math.abs(u.x-
+(H.x+O.projectionMatrix.n11)/(H.w+O.projectionMatrix.n14));u.scale.y=R.scale.y*Math.abs(u.y-(H.y+O.projectionMatrix.n22)/(H.w+O.projectionMatrix.n24));u.materials=R.materials;S.push(u);x++}}}}ca&&S.sort(a);return S};this.unprojectVector=function(T,O){var ca=THREE.Matrix4.makeInvert(O.globalMatrix);ca.multiplySelf(THREE.Matrix4.makeInvert(O.projectionMatrix));ca.multiplyVector3(T);return T}};
+THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,d,e,g,i;this.domElement=document.createElement("div");this.setSize=function(l,o){d=l;e=o;g=d/2;i=e/2};this.render=function(l,o){var k,m,s,w,u,x,F,I;a=b.projectScene(l,o);k=0;for(m=a.length;k<m;k++){u=a[k];if(u instanceof THREE.RenderableParticle){F=u.x*g+g;I=u.y*i+i;s=0;for(w=u.material.length;s<w;s++){x=u.material[s];if(x instanceof THREE.ParticleDOMMaterial){x=x.domElement;x.style.left=F+"px";x.style.top=I+"px"}}}}}};
+THREE.CanvasRenderer=function(){function a(na){if(u!=na)m.globalAlpha=u=na}function b(na){if(x!=na){switch(na){case THREE.NormalBlending:m.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:m.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:m.globalCompositeOperation="darker"}x=na}}var d=null,e=new THREE.Projector,g=document.createElement("canvas"),i,l,o,k,m=g.getContext("2d"),s=new THREE.Color(0),w=0,u=1,x=0,F=null,I=null,H=1,r,Z,E,L,c,ia,T,O,ca,S=new THREE.Color,
+ba=new THREE.Color,V=new THREE.Color,D=new THREE.Color,J=new THREE.Color,la,Q,ja,ea,R,ra,wa,f,n,p=new THREE.Rectangle,j=new THREE.Rectangle,h=new THREE.Rectangle,q=!1,t=new THREE.Color,A=new THREE.Color,W=new THREE.Color,G=new THREE.Color,M=Math.PI*2,C=new THREE.Vector3,aa,da,ua,ka,fa,ga,ha=16;aa=document.createElement("canvas");aa.width=aa.height=2;da=aa.getContext("2d");da.fillStyle="rgba(0,0,0,1)";da.fillRect(0,0,2,2);ua=da.getImageData(0,0,2,2);ka=ua.data;fa=document.createElement("canvas");fa.width=
+fa.height=ha;ga=fa.getContext("2d");ga.translate(-ha/2,-ha/2);ga.scale(ha,ha);ha--;this.domElement=g;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setSize=function(na,z){i=na;l=z;o=i/2;k=l/2;g.width=i;g.height=l;p.set(-o,-k,o,k);u=1;x=0;I=F=null;H=1};this.setClearColor=function(na,z){s=na;w=z;j.set(-o,-k,o,k);m.setTransform(1,0,0,-1,o,k);this.clear()};this.setClearColorHex=function(na,z){s.setHex(na);w=z;j.set(-o,-k,o,k);m.setTransform(1,0,0,-1,o,k);this.clear()};this.clear=function(){m.setTransform(1,
+0,0,-1,o,k);if(!j.isEmpty()){j.inflate(1);j.minSelf(p);if(s.hex==0&&w==0)m.clearRect(j.getX(),j.getY(),j.getWidth(),j.getHeight());else{b(THREE.NormalBlending);a(1);m.fillStyle="rgba("+Math.floor(s.r*255)+","+Math.floor(s.g*255)+","+Math.floor(s.b*255)+","+w+")";m.fillRect(j.getX(),j.getY(),j.getWidth(),j.getHeight())}j.empty()}};this.render=function(na,z){function Fa(y){var X,Y,B,U=y.lights;A.setRGB(0,0,0);W.setRGB(0,0,0);G.setRGB(0,0,0);y=0;for(X=U.length;y<X;y++){Y=U[y];B=Y.color;if(Y instanceof
+THREE.AmbientLight){A.r+=B.r;A.g+=B.g;A.b+=B.b}else if(Y instanceof THREE.DirectionalLight){W.r+=B.r;W.g+=B.g;W.b+=B.b}else if(Y instanceof THREE.PointLight){G.r+=B.r;G.g+=B.g;G.b+=B.b}}}function za(y,X,Y,B){var U,ma,xa,Da,Ea=y.lights;y=0;for(U=Ea.length;y<U;y++){ma=Ea[y];xa=ma.color;Da=ma.intensity;if(ma instanceof THREE.DirectionalLight){ma=Y.dot(ma.position)*Da;if(ma>0){B.r+=xa.r*ma;B.g+=xa.g*ma;B.b+=xa.b*ma}}else if(ma instanceof THREE.PointLight){C.sub(ma.position,X);C.normalize();ma=Y.dot(C)*
+Da;if(ma>0){B.r+=xa.r*ma;B.g+=xa.g*ma;B.b+=xa.b*ma}}}}function Ga(y,X,Y){if(Y.opacity!=0){a(Y.opacity);b(Y.blending);var B,U,ma,xa,Da,Ea;if(Y instanceof THREE.ParticleBasicMaterial){if(Y.map&&Y.map.image.loaded){xa=Y.map.image;Da=xa.width>>1;Ea=xa.height>>1;U=X.scale.x*o;ma=X.scale.y*k;Y=U*Da;B=ma*Ea;h.set(y.x-Y,y.y-B,y.x+Y,y.y+B);if(!p.instersects(h))return;m.save();m.translate(y.x,y.y);m.rotate(-X.rotation);m.scale(U,-ma);m.translate(-Da,-Ea);m.drawImage(xa,0,0);m.restore()}m.beginPath();m.moveTo(y.x-
+10,y.y);m.lineTo(y.x+10,y.y);m.moveTo(y.x,y.y-10);m.lineTo(y.x,y.y+10);m.closePath();m.strokeStyle="rgb(255,255,0)";m.stroke()}else if(Y instanceof THREE.ParticleCircleMaterial){if(q){t.r=A.r+W.r+G.r;t.g=A.g+W.g+G.g;t.b=A.b+W.b+G.b;S.r=Y.color.r*t.r;S.g=Y.color.g*t.g;S.b=Y.color.b*t.b;S.updateStyleString()}else S.__styleString=Y.color.__styleString;Y=X.scale.x*o;B=X.scale.y*k;h.set(y.x-Y,y.y-B,y.x+Y,y.y+B);if(p.instersects(h)){U=S.__styleString;if(I!=U)m.fillStyle=I=U;m.save();m.translate(y.x,y.y);
+m.rotate(-X.rotation);m.scale(Y,B);m.beginPath();m.arc(0,0,1,0,M,!0);m.closePath();m.fill();m.restore()}}}}function P(y,X,Y,B){if(B.opacity!=0){a(B.opacity);b(B.blending);m.beginPath();m.moveTo(y.positionScreen.x,y.positionScreen.y);m.lineTo(X.positionScreen.x,X.positionScreen.y);m.closePath();if(B instanceof THREE.LineBasicMaterial){S.__styleString=B.color.__styleString;y=B.linewidth;if(H!=y)m.lineWidth=H=y;y=S.__styleString;if(F!=y)m.strokeStyle=F=y;m.stroke();h.inflate(B.linewidth*2)}}}function N(y,
+X,Y,B,U,ma){if(U.opacity!=0){a(U.opacity);b(U.blending);L=y.positionScreen.x;c=y.positionScreen.y;ia=X.positionScreen.x;T=X.positionScreen.y;O=Y.positionScreen.x;ca=Y.positionScreen.y;m.beginPath();m.moveTo(L,c);m.lineTo(ia,T);m.lineTo(O,ca);m.lineTo(L,c);m.closePath();if(U instanceof THREE.MeshBasicMaterial)if(U.map)U.map.image.loaded&&U.map.mapping instanceof THREE.UVMapping&&Ca(L,c,ia,T,O,ca,U.map.image,B.uvs[0].u,B.uvs[0].v,B.uvs[1].u,B.uvs[1].v,B.uvs[2].u,B.uvs[2].v);else if(U.env_map){if(U.env_map.image.loaded&&
+U.env_map.mapping instanceof THREE.SphericalReflectionMapping){y=z.globalMatrix;C.copy(B.vertexNormalsWorld[0]);ea=(C.x*y.n11+C.y*y.n12+C.z*y.n13)*0.5+0.5;R=-(C.x*y.n21+C.y*y.n22+C.z*y.n23)*0.5+0.5;C.copy(B.vertexNormalsWorld[1]);ra=(C.x*y.n11+C.y*y.n12+C.z*y.n13)*0.5+0.5;wa=-(C.x*y.n21+C.y*y.n22+C.z*y.n23)*0.5+0.5;C.copy(B.vertexNormalsWorld[2]);f=(C.x*y.n11+C.y*y.n12+C.z*y.n13)*0.5+0.5;n=-(C.x*y.n21+C.y*y.n22+C.z*y.n23)*0.5+0.5;Ca(L,c,ia,T,O,ca,U.env_map.image,ea,R,ra,wa,f,n)}}else U.wireframe?
+K(U.color.__styleString,U.wireframe_linewidth):oa(U.color.__styleString);else if(U instanceof THREE.MeshLambertMaterial){if(U.map&&!U.wireframe){U.map.mapping instanceof THREE.UVMapping&&Ca(L,c,ia,T,O,ca,U.map.image,B.uvs[0].u,B.uvs[0].v,B.uvs[1].u,B.uvs[1].v,B.uvs[2].u,B.uvs[2].v);b(THREE.SubtractiveBlending)}if(q)if(!U.wireframe&&U.shading==THREE.SmoothShading&&B.vertexNormalsWorld.length==3){ba.r=V.r=D.r=A.r;ba.g=V.g=D.g=A.g;ba.b=V.b=D.b=A.b;za(ma,B.v1.positionWorld,B.vertexNormalsWorld[0],ba);
+za(ma,B.v2.positionWorld,B.vertexNormalsWorld[1],V);za(ma,B.v3.positionWorld,B.vertexNormalsWorld[2],D);J.r=(V.r+D.r)*0.5;J.g=(V.g+D.g)*0.5;J.b=(V.b+D.b)*0.5;ja=Aa(ba,V,D,J);Ca(L,c,ia,T,O,ca,ja,0,0,1,0,0,1)}else{t.r=A.r;t.g=A.g;t.b=A.b;za(ma,B.centroidWorld,B.normalWorld,t);S.r=U.color.r*t.r;S.g=U.color.g*t.g;S.b=U.color.b*t.b;S.updateStyleString();U.wireframe?K(S.__styleString,U.wireframe_linewidth):oa(S.__styleString)}else U.wireframe?K(U.color.__styleString,U.wireframe_linewidth):oa(U.color.__styleString)}else if(U instanceof
+THREE.MeshDepthMaterial){la=z.near;Q=z.far;ba.r=ba.g=ba.b=1-v(y.positionScreen.z,la,Q);V.r=V.g=V.b=1-v(X.positionScreen.z,la,Q);D.r=D.g=D.b=1-v(Y.positionScreen.z,la,Q);J.r=(V.r+D.r)*0.5;J.g=(V.g+D.g)*0.5;J.b=(V.b+D.b)*0.5;ja=Aa(ba,V,D,J);Ca(L,c,ia,T,O,ca,ja,0,0,1,0,0,1)}else if(U instanceof THREE.MeshNormalMaterial){S.r=Ba(B.normalWorld.x);S.g=Ba(B.normalWorld.y);S.b=Ba(B.normalWorld.z);S.updateStyleString();U.wireframe?K(S.__styleString,U.wireframe_linewidth):oa(S.__styleString)}}}function K(y,
+X){if(F!=y)m.strokeStyle=F=y;if(H!=X)m.lineWidth=H=X;m.stroke();h.inflate(X*2)}function oa(y){if(I!=y)m.fillStyle=I=y;m.fill()}function Ca(y,X,Y,B,U,ma,xa,Da,Ea,Ia,ya,Ja,Qa){var Ka,La;Ka=xa.width-1;La=xa.height-1;Da*=Ka;Ea*=La;Ia*=Ka;ya*=La;Ja*=Ka;Qa*=La;Y-=y;B-=X;U-=y;ma-=X;Ia-=Da;ya-=Ea;Ja-=Da;Qa-=Ea;Ka=Ia*Qa-Ja*ya;if(Ka!=0){La=1/Ka;Ka=(Qa*Y-ya*U)*La;ya=(Qa*B-ya*ma)*La;Y=(Ia*U-Ja*Y)*La;B=(Ia*ma-Ja*B)*La;y=y-Ka*Da-Y*Ea;X=X-ya*Da-B*Ea;m.save();m.transform(Ka,ya,Y,B,y,X);m.clip();m.drawImage(xa,0,
+0);m.restore()}}function Aa(y,X,Y,B){var U=~~(y.r*255),ma=~~(y.g*255);y=~~(y.b*255);var xa=~~(X.r*255),Da=~~(X.g*255);X=~~(X.b*255);var Ea=~~(Y.r*255),Ia=~~(Y.g*255);Y=~~(Y.b*255);var ya=~~(B.r*255),Ja=~~(B.g*255);B=~~(B.b*255);ka[0]=U<0?0:U>255?255:U;ka[1]=ma<0?0:ma>255?255:ma;ka[2]=y<0?0:y>255?255:y;ka[4]=xa<0?0:xa>255?255:xa;ka[5]=Da<0?0:Da>255?255:Da;ka[6]=X<0?0:X>255?255:X;ka[8]=Ea<0?0:Ea>255?255:Ea;ka[9]=Ia<0?0:Ia>255?255:Ia;ka[10]=Y<0?0:Y>255?255:Y;ka[12]=ya<0?0:ya>255?255:ya;ka[13]=Ja<0?0:
+Ja>255?255:Ja;ka[14]=B<0?0:B>255?255:B;da.putImageData(ua,0,0);ga.drawImage(aa,0,0);return fa}function v(y,X,Y){y=(y-X)/(Y-X);return y*y*(3-2*y)}function Ba(y){y=(y+1)*0.5;return y<0?0:y>1?1:y}function Oa(y,X){var Y=X.x-y.x,B=X.y-y.y,U=1/Math.sqrt(Y*Y+B*B);Y*=U;B*=U;X.x+=Y;X.y+=B;y.x-=Y;y.y-=B}var Ma,Ha,$,sa,pa,ta,va,qa;this.autoClear?this.clear():m.setTransform(1,0,0,-1,o,k);d=e.projectScene(na,z,this.sortElements);m.fillStyle="rgba( 0, 255, 255, 0.5 )";m.fillRect(p.getX(),p.getY(),p.getWidth(),
+p.getHeight());(q=na.lights.length>0)&&Fa(na);Ma=0;for(Ha=d.length;Ma<Ha;Ma++){$=d[Ma];h.empty();if($ instanceof THREE.RenderableParticle){r=$;r.x*=o;r.y*=k;sa=0;for(pa=$.materials.length;sa<pa;sa++)Ga(r,$,$.materials[sa],na)}else if($ instanceof THREE.RenderableLine){r=$.v1;Z=$.v2;r.positionScreen.x*=o;r.positionScreen.y*=k;Z.positionScreen.x*=o;Z.positionScreen.y*=k;h.addPoint(r.positionScreen.x,r.positionScreen.y);h.addPoint(Z.positionScreen.x,Z.positionScreen.y);if(p.instersects(h)){sa=0;for(pa=
+$.materials.length;sa<pa;)P(r,Z,$,$.materials[sa++],na)}}else if($ instanceof THREE.RenderableFace3){r=$.v1;Z=$.v2;E=$.v3;r.positionScreen.x*=o;r.positionScreen.y*=k;Z.positionScreen.x*=o;Z.positionScreen.y*=k;E.positionScreen.x*=o;E.positionScreen.y*=k;if($.overdraw){Oa(r.positionScreen,Z.positionScreen);Oa(Z.positionScreen,E.positionScreen);Oa(E.positionScreen,r.positionScreen)}h.add3Points(r.positionScreen.x,r.positionScreen.y,Z.positionScreen.x,Z.positionScreen.y,E.positionScreen.x,E.positionScreen.y);
+if(p.instersects(h)){sa=0;for(pa=$.meshMaterials.length;sa<pa;){qa=$.meshMaterials[sa++];if(qa instanceof THREE.MeshFaceMaterial){ta=0;for(va=$.faceMaterials.length;ta<va;)(qa=$.faceMaterials[ta++])&&N(r,Z,E,$,qa,na)}else N(r,Z,E,$,qa,na)}}}j.addRectangle(h)}m.lineWidth=1;m.strokeStyle="rgba( 255, 0, 0, 0.5 )";m.strokeRect(j.getX(),j.getY(),j.getWidth(),j.getHeight());m.setTransform(1,0,0,1,0,0)}};
+THREE.SVGRenderer=function(){function a(ea,R,ra){var wa,f,n,p;wa=0;for(f=ea.lights.length;wa<f;wa++){n=ea.lights[wa];if(n instanceof THREE.DirectionalLight){p=R.normalWorld.dot(n.position)*n.intensity;if(p>0){ra.r+=n.color.r*p;ra.g+=n.color.g*p;ra.b+=n.color.b*p}}else if(n instanceof THREE.PointLight){ca.sub(n.position,R.centroidWorld);ca.normalize();p=R.normalWorld.dot(ca)*n.intensity;if(p>0){ra.r+=n.color.r*p;ra.g+=n.color.g*p;ra.b+=n.color.b*p}}}}function b(ea,R,ra,wa,f,n){D=e(J++);D.setAttribute("d",
+"M "+ea.positionScreen.x+" "+ea.positionScreen.y+" L "+R.positionScreen.x+" "+R.positionScreen.y+" L "+ra.positionScreen.x+","+ra.positionScreen.y+"z");if(f instanceof THREE.MeshBasicMaterial)E.__styleString=f.color.__styleString;else if(f instanceof THREE.MeshLambertMaterial)if(Z){L.r=c.r;L.g=c.g;L.b=c.b;a(n,wa,L);E.r=f.color.r*L.r;E.g=f.color.g*L.g;E.b=f.color.b*L.b;E.updateStyleString()}else E.__styleString=f.color.__styleString;else if(f instanceof THREE.MeshDepthMaterial){O=1-f.__2near/(f.__farPlusNear-
+wa.z*f.__farMinusNear);E.setRGB(O,O,O)}else f instanceof THREE.MeshNormalMaterial&&E.setRGB(g(wa.normalWorld.x),g(wa.normalWorld.y),g(wa.normalWorld.z));f.wireframe?D.setAttribute("style","fill: none; stroke: "+E.__styleString+"; stroke-width: "+f.wireframe_linewidth+"; stroke-opacity: "+f.opacity+"; stroke-linecap: "+f.wireframe_linecap+"; stroke-linejoin: "+f.wireframe_linejoin):D.setAttribute("style","fill: "+E.__styleString+"; fill-opacity: "+f.opacity);o.appendChild(D)}function d(ea,R,ra,wa,
+f,n,p){D=e(J++);D.setAttribute("d","M "+ea.positionScreen.x+" "+ea.positionScreen.y+" L "+R.positionScreen.x+" "+R.positionScreen.y+" L "+ra.positionScreen.x+","+ra.positionScreen.y+" L "+wa.positionScreen.x+","+wa.positionScreen.y+"z");if(n instanceof THREE.MeshBasicMaterial)E.__styleString=n.color.__styleString;else if(n instanceof THREE.MeshLambertMaterial)if(Z){L.r=c.r;L.g=c.g;L.b=c.b;a(p,f,L);E.r=n.color.r*L.r;E.g=n.color.g*L.g;E.b=n.color.b*L.b;E.updateStyleString()}else E.__styleString=n.color.__styleString;
+else if(n instanceof THREE.MeshDepthMaterial){O=1-n.__2near/(n.__farPlusNear-f.z*n.__farMinusNear);E.setRGB(O,O,O)}else n instanceof THREE.MeshNormalMaterial&&E.setRGB(g(f.normalWorld.x),g(f.normalWorld.y),g(f.normalWorld.z));n.wireframe?D.setAttribute("style","fill: none; stroke: "+E.__styleString+"; stroke-width: "+n.wireframe_linewidth+"; stroke-opacity: "+n.opacity+"; stroke-linecap: "+n.wireframe_linecap+"; stroke-linejoin: "+n.wireframe_linejoin):D.setAttribute("style","fill: "+E.__styleString+
+"; fill-opacity: "+n.opacity);o.appendChild(D)}function e(ea){if(S[ea]==null){S[ea]=document.createElementNS("http://www.w3.org/2000/svg","path");ja==0&&S[ea].setAttribute("shape-rendering","crispEdges")}return S[ea]}function g(ea){return ea<0?Math.min((1+ea)*0.5,0.5):0.5+Math.min(ea*0.5,0.5)}var i=null,l=new THREE.Projector,o=document.createElementNS("http://www.w3.org/2000/svg","svg"),k,m,s,w,u,x,F,I,H=new THREE.Rectangle,r=new THREE.Rectangle,Z=!1,E=new THREE.Color(16777215),L=new THREE.Color(16777215),
+c=new THREE.Color(0),ia=new THREE.Color(0),T=new THREE.Color(0),O,ca=new THREE.Vector3,S=[],ba=[],V=[],D,J,la,Q,ja=1;this.domElement=o;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(ea){switch(ea){case "high":ja=1;break;case "low":ja=0}};this.setSize=function(ea,R){k=ea;m=R;s=k/2;w=m/2;o.setAttribute("viewBox",-s+" "+-w+" "+k+" "+m);o.setAttribute("width",k);o.setAttribute("height",m);H.set(-s,-w,s,w)};this.clear=function(){for(;o.childNodes.length>0;)o.removeChild(o.childNodes[0])};
+this.render=function(ea,R){var ra,wa,f,n,p,j,h,q;this.autoClear&&this.clear();i=l.projectScene(ea,R,this.sortElements);Q=la=J=0;if(Z=ea.lights.length>0){h=ea.lights;c.setRGB(0,0,0);ia.setRGB(0,0,0);T.setRGB(0,0,0);ra=0;for(wa=h.length;ra<wa;ra++){f=h[ra];n=f.color;if(f instanceof THREE.AmbientLight){c.r+=n.r;c.g+=n.g;c.b+=n.b}else if(f instanceof THREE.DirectionalLight){ia.r+=n.r;ia.g+=n.g;ia.b+=n.b}else if(f instanceof THREE.PointLight){T.r+=n.r;T.g+=n.g;T.b+=n.b}}}ra=0;for(wa=i.length;ra<wa;ra++){h=
+i[ra];r.empty();if(h instanceof THREE.RenderableParticle){u=h;u.x*=s;u.y*=-w;f=0;for(n=h.materials.length;f<n;f++)if(q=h.materials[f]){p=u;j=h;var t=la++;if(ba[t]==null){ba[t]=document.createElementNS("http://www.w3.org/2000/svg","circle");ja==0&&ba[t].setAttribute("shape-rendering","crispEdges")}D=ba[t];D.setAttribute("cx",p.x);D.setAttribute("cy",p.y);D.setAttribute("r",j.scale.x*s);if(q instanceof THREE.ParticleCircleMaterial){if(Z){L.r=c.r+ia.r+T.r;L.g=c.g+ia.g+T.g;L.b=c.b+ia.b+T.b;E.r=q.color.r*
+L.r;E.g=q.color.g*L.g;E.b=q.color.b*L.b;E.updateStyleString()}else E=q.color;D.setAttribute("style","fill: "+E.__styleString)}o.appendChild(D)}}else if(h instanceof THREE.RenderableLine){u=h.v1;x=h.v2;u.positionScreen.x*=s;u.positionScreen.y*=-w;x.positionScreen.x*=s;x.positionScreen.y*=-w;r.addPoint(u.positionScreen.x,u.positionScreen.y);r.addPoint(x.positionScreen.x,x.positionScreen.y);if(H.instersects(r)){f=0;for(n=h.materials.length;f<n;)if(q=h.materials[f++]){p=u;j=x;t=Q++;if(V[t]==null){V[t]=
+document.createElementNS("http://www.w3.org/2000/svg","line");ja==0&&V[t].setAttribute("shape-rendering","crispEdges")}D=V[t];D.setAttribute("x1",p.positionScreen.x);D.setAttribute("y1",p.positionScreen.y);D.setAttribute("x2",j.positionScreen.x);D.setAttribute("y2",j.positionScreen.y);if(q instanceof THREE.LineBasicMaterial){E.__styleString=q.color.__styleString;D.setAttribute("style","fill: none; stroke: "+E.__styleString+"; stroke-width: "+q.linewidth+"; stroke-opacity: "+q.opacity+"; stroke-linecap: "+
+q.linecap+"; stroke-linejoin: "+q.linejoin);o.appendChild(D)}}}}else if(h instanceof THREE.RenderableFace3){u=h.v1;x=h.v2;F=h.v3;u.positionScreen.x*=s;u.positionScreen.y*=-w;x.positionScreen.x*=s;x.positionScreen.y*=-w;F.positionScreen.x*=s;F.positionScreen.y*=-w;r.addPoint(u.positionScreen.x,u.positionScreen.y);r.addPoint(x.positionScreen.x,x.positionScreen.y);r.addPoint(F.positionScreen.x,F.positionScreen.y);if(H.instersects(r)){f=0;for(n=h.meshMaterials.length;f<n;){q=h.meshMaterials[f++];if(q instanceof
+THREE.MeshFaceMaterial){p=0;for(j=h.faceMaterials.length;p<j;)(q=h.faceMaterials[p++])&&b(u,x,F,h,q,ea)}else q&&b(u,x,F,h,q,ea)}}}else if(h instanceof THREE.RenderableFace4){u=h.v1;x=h.v2;F=h.v3;I=h.v4;u.positionScreen.x*=s;u.positionScreen.y*=-w;x.positionScreen.x*=s;x.positionScreen.y*=-w;F.positionScreen.x*=s;F.positionScreen.y*=-w;I.positionScreen.x*=s;I.positionScreen.y*=-w;r.addPoint(u.positionScreen.x,u.positionScreen.y);r.addPoint(x.positionScreen.x,x.positionScreen.y);r.addPoint(F.positionScreen.x,
+F.positionScreen.y);r.addPoint(I.positionScreen.x,I.positionScreen.y);if(H.instersects(r)){f=0;for(n=h.meshMaterials.length;f<n;){q=h.meshMaterials[f++];if(q instanceof THREE.MeshFaceMaterial){p=0;for(j=h.faceMaterials.length;p<j;)(q=h.faceMaterials[p++])&&d(u,x,F,I,h,q,ea)}else q&&d(u,x,F,I,h,q,ea)}}}}}};
+THREE.WebGLRenderer=function(a){function b(f,n,p){var j,h,q,t=f.vertices,A=t.length,W=f.colors,G=W.length,M=f.__vertexArray,C=f.__colorArray,aa=f.__sortArray,da=f.__dirtyVertices,ua=f.__dirtyColors;if(p.sortParticles){J.multiplySelf(p.globalMatrix);for(j=0;j<A;j++){h=t[j].position;ea.copy(h);J.multiplyVector3(ea);aa[j]=[ea.z,j]}aa.sort(function(ka,fa){return fa[0]-ka[0]});for(j=0;j<A;j++){h=t[aa[j][1]].position;q=j*3;M[q]=h.x;M[q+1]=h.y;M[q+2]=h.z}for(j=0;j<G;j++){q=j*3;color=W[aa[j][1]];C[q]=color.r;
+C[q+1]=color.g;C[q+2]=color.b}}else{if(da)for(j=0;j<A;j++){h=t[j].position;q=j*3;M[q]=h.x;M[q+1]=h.y;M[q+2]=h.z}if(ua)for(j=0;j<G;j++){color=W[j];q=j*3;C[q]=color.r;C[q+1]=color.g;C[q+2]=color.b}}if(da||p.sortParticles){c.bindBuffer(c.ARRAY_BUFFER,f.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,M,n)}if(ua||p.sortParticles){c.bindBuffer(c.ARRAY_BUFFER,f.__webGLColorBuffer);c.bufferData(c.ARRAY_BUFFER,C,n)}}function d(f,n){f.fragment_shader=n.fragment_shader;f.vertex_shader=n.vertex_shader;f.uniforms=
+Uniforms.clone(n.uniforms)}function e(f,n,p,j,h){j.program||O.initMaterial(j,n,p);var q=j.program,t=q.uniforms,A=j.uniforms;if(q!=ia){c.useProgram(q);ia=q;c.uniformMatrix4fv(t.projectionMatrix,!1,la)}if(p&&(j instanceof THREE.MeshBasicMaterial||j instanceof THREE.MeshLambertMaterial||j instanceof THREE.MeshPhongMaterial||j instanceof THREE.LineBasicMaterial||j instanceof THREE.ParticleBasicMaterial)){A.fogColor.value.setHex(p.color.hex);if(p instanceof THREE.Fog){A.fogNear.value=p.near;A.fogFar.value=
+p.far}else if(p instanceof THREE.FogExp2)A.fogDensity.value=p.density}if(j instanceof THREE.MeshPhongMaterial||j instanceof THREE.MeshLambertMaterial){var W,G,M=0,C=0,aa=0,da,ua,ka,fa=O.lights,ga=fa.directional.colors,ha=fa.directional.positions,na=fa.point.colors,z=fa.point.positions,Fa=0,za=0;p=G=G=0;for(W=n.length;p<W;p++){G=n[p];da=G.color;ua=G.position;ka=G.intensity;if(G instanceof THREE.AmbientLight){M+=da.r;C+=da.g;aa+=da.b}else if(G instanceof THREE.DirectionalLight){G=Fa*3;ga[G]=da.r*ka;
+ga[G+1]=da.g*ka;ga[G+2]=da.b*ka;ha[G]=ua.x;ha[G+1]=ua.y;ha[G+2]=ua.z;Fa+=1}else if(G instanceof THREE.PointLight){G=za*3;na[G]=da.r*ka;na[G+1]=da.g*ka;na[G+2]=da.b*ka;z[G]=ua.x;z[G+1]=ua.y;z[G+2]=ua.z;za+=1}}for(p=Fa*3;p<ga.length;p++)ga[p]=0;for(p=za*3;p<na.length;p++)na[p]=0;fa.point.length=za;fa.directional.length=Fa;fa.ambient[0]=M;fa.ambient[1]=C;fa.ambient[2]=aa;n=O.lights;A.enableLighting.value=n.directional.length+n.point.length;A.ambientLightColor.value=n.ambient;A.directionalLightColor.value=
+n.directional.colors;A.directionalLightDirection.value=n.directional.positions;A.pointLightColor.value=n.point.colors;A.pointLightPosition.value=n.point.positions}if(j instanceof THREE.MeshBasicMaterial||j instanceof THREE.MeshLambertMaterial||j instanceof THREE.MeshPhongMaterial){A.diffuse.value.setRGB(j.color.r*j.opacity,j.color.g*j.opacity,j.color.b*j.opacity);A.opacity.value=j.opacity;A.map.texture=j.map;A.light_map.texture=j.light_map;A.env_map.texture=j.env_map;A.reflectivity.value=j.reflectivity;
+A.refraction_ratio.value=j.refraction_ratio;A.combine.value=j.combine;A.useRefract.value=j.env_map&&j.env_map.mapping instanceof THREE.CubeRefractionMapping}if(j instanceof THREE.LineBasicMaterial){A.diffuse.value.setRGB(j.color.r*j.opacity,j.color.g*j.opacity,j.color.b*j.opacity);A.opacity.value=j.opacity}else if(j instanceof THREE.ParticleBasicMaterial){A.psColor.value.setRGB(j.color.r*j.opacity,j.color.g*j.opacity,j.color.b*j.opacity);A.opacity.value=j.opacity;A.size.value=j.size;A.map.texture=
+j.map}else if(j instanceof THREE.MeshPhongMaterial){A.ambient.value.setRGB(j.ambient.r,j.ambient.g,j.ambient.b);A.specular.value.setRGB(j.specular.r,j.specular.g,j.specular.b);A.shininess.value=j.shininess}else if(j instanceof THREE.MeshDepthMaterial){A.mNear.value=f.zNear;A.mFar.value=f.zFar;A.opacity.value=j.opacity}else if(j instanceof THREE.MeshNormalMaterial)A.opacity.value=j.opacity;for(var Ga in A)if(M=q.uniforms[Ga]){p=A[Ga];W=p.type;n=p.value;if(W=="i")c.uniform1i(M,n);else if(W=="f")c.uniform1f(M,
+n);else if(W=="fv1")c.uniform1fv(M,n);else if(W=="fv")c.uniform3fv(M,n);else if(W=="v2")c.uniform2f(M,n.x,n.y);else if(W=="v3")c.uniform3f(M,n.x,n.y,n.z);else if(W=="c")c.uniform3f(M,n.r,n.g,n.b);else if(W=="t"){c.uniform1i(M,n);if(p=p.texture)if(p.image instanceof Array&&p.image.length==6){if(p.image.length==6){if(!p.image.__webGLTextureCube&&!p.image.__cubeMapInitialized&&p.image.loadCount==6){p.image.__webGLTextureCube=c.createTexture();c.bindTexture(c.TEXTURE_CUBE_MAP,p.image.__webGLTextureCube);
+c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_MAG_FILTER,c.LINEAR);c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_MIN_FILTER,c.LINEAR_MIPMAP_LINEAR);for(W=0;W<6;++W)c.texImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+W,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,p.image[W]);c.generateMipmap(c.TEXTURE_CUBE_MAP);c.bindTexture(c.TEXTURE_CUBE_MAP,null);p.image.__cubeMapInitialized=!0}c.activeTexture(c.TEXTURE0+
+n);c.bindTexture(c.TEXTURE_CUBE_MAP,p.image.__webGLTextureCube)}}else{if(!p.__webGLTexture&&p.image.loaded){p.__webGLTexture=c.createTexture();c.bindTexture(c.TEXTURE_2D,p.__webGLTexture);c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,p.image);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,E(p.wrap_s));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,E(p.wrap_t));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,E(p.mag_filter));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,E(p.min_filter));
+c.generateMipmap(c.TEXTURE_2D);c.bindTexture(c.TEXTURE_2D,null)}c.activeTexture(c.TEXTURE0+n);c.bindTexture(c.TEXTURE_2D,p.__webGLTexture)}}}c.uniformMatrix4fv(t.modelViewMatrix,!1,h._modelViewMatrixArray);c.uniformMatrix3fv(t.normalMatrix,!1,h._normalMatrixArray);(j instanceof THREE.MeshShaderMaterial||j instanceof THREE.MeshPhongMaterial||j.env_map)&&c.uniform3f(t.cameraPosition,f.position.x,f.position.y,f.position.z);(j instanceof THREE.MeshShaderMaterial||j.env_map||j.skinning)&&c.uniformMatrix4fv(t.objectMatrix,
+!1,h._objectMatrixArray);(j instanceof THREE.MeshPhongMaterial||j instanceof THREE.MeshLambertMaterial||j instanceof THREE.MeshShaderMaterial||j.skinning)&&c.uniformMatrix4fv(t.viewMatrix,!1,ja);if(j.skinning){c.uniformMatrix4fv(t.cameraInverseMatrix,!1,Q);c.uniformMatrix4fv(t.uBoneGlobalMatrices,!1,h.boneMatrices)}return q}function g(f,n,p,j,h,q){f=e(f,n,p,j,q).attributes;c.bindBuffer(c.ARRAY_BUFFER,h.__webGLVertexBuffer);c.vertexAttribPointer(f.position,3,c.FLOAT,!1,0,0);if(f.color>=0){c.bindBuffer(c.ARRAY_BUFFER,
+h.__webGLColorBuffer);c.vertexAttribPointer(f.color,3,c.FLOAT,!1,0,0)}if(f.normal>=0){c.bindBuffer(c.ARRAY_BUFFER,h.__webGLNormalBuffer);c.vertexAttribPointer(f.normal,3,c.FLOAT,!1,0,0)}if(f.tangent>=0){c.bindBuffer(c.ARRAY_BUFFER,h.__webGLTangentBuffer);c.vertexAttribPointer(f.tangent,4,c.FLOAT,!1,0,0)}if(f.uv>=0)if(h.__webGLUVBuffer){c.bindBuffer(c.ARRAY_BUFFER,h.__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(h.__webGLUV2Buffer){c.bindBuffer(c.ARRAY_BUFFER,h.__webGLUV2Buffer);c.vertexAttribPointer(f.uv2,2,c.FLOAT,!1,0,0);c.enableVertexAttribArray(f.uv2)}else c.disableVertexAttribArray(f.uv2);if(j.skinning&&f.skinVertexA>=0&&f.skinVertexB>=0&&f.skinIndex>=0&&f.skinWeight>=0){c.bindBuffer(c.ARRAY_BUFFER,h.__webGLSkinVertexABuffer);c.vertexAttribPointer(f.skinVertexA,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,h.__webGLSkinVertexBBuffer);c.vertexAttribPointer(f.skinVertexB,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,
+h.__webGLSkinIndicesBuffer);c.vertexAttribPointer(f.skinIndex,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,h.__webGLSkinWeightsBuffer);c.vertexAttribPointer(f.skinWeight,4,c.FLOAT,!1,0,0)}if(q instanceof THREE.Mesh)if(j.wireframe){c.lineWidth(j.wireframe_linewidth);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,h.__webGLLineBuffer);c.drawElements(c.LINES,h.__webGLLineCount,c.UNSIGNED_SHORT,0)}else{c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,h.__webGLFaceBuffer);c.drawElements(c.TRIANGLES,h.__webGLFaceCount,c.UNSIGNED_SHORT,
+0)}else if(q instanceof THREE.Line){q=q.type==THREE.LineStrip?c.LINE_STRIP:c.LINES;c.lineWidth(j.linewidth);c.drawArrays(q,0,h.__webGLLineCount)}else if(q instanceof THREE.ParticleSystem)c.drawArrays(c.POINTS,0,h.__webGLParticleCount);else q instanceof THREE.Ribbon&&c.drawArrays(c.TRIANGLE_STRIP,0,h.__webGLVertexCount)}function i(f,n){if(!f.__webGLVertexBuffer)f.__webGLVertexBuffer=c.createBuffer();if(!f.__webGLNormalBuffer)f.__webGLNormalBuffer=c.createBuffer();if(f.hasPos){c.bindBuffer(c.ARRAY_BUFFER,
+f.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,f.positionArray,c.DYNAMIC_DRAW);c.enableVertexAttribArray(n.attributes.position);c.vertexAttribPointer(n.attributes.position,3,c.FLOAT,!1,0,0)}if(f.hasNormal){c.bindBuffer(c.ARRAY_BUFFER,f.__webGLNormalBuffer);c.bufferData(c.ARRAY_BUFFER,f.normalArray,c.DYNAMIC_DRAW);c.enableVertexAttribArray(n.attributes.normal);c.vertexAttribPointer(n.attributes.normal,3,c.FLOAT,!1,0,0)}c.drawArrays(c.TRIANGLES,0,f.count);f.count=0}function l(f){if(ca!=f.doubleSided){f.doubleSided?
+c.disable(c.CULL_FACE):c.enable(c.CULL_FACE);ca=f.doubleSided}if(S!=f.flipSided){f.flipSided?c.frontFace(c.CW):c.frontFace(c.CCW);S=f.flipSided}}function o(f){if(V!=f){f?c.enable(c.DEPTH_TEST):c.disable(c.DEPTH_TEST);V=f}}function k(f){D[0].set(f.n41-f.n11,f.n42-f.n12,f.n43-f.n13,f.n44-f.n14);D[1].set(f.n41+f.n11,f.n42+f.n12,f.n43+f.n13,f.n44+f.n14);D[2].set(f.n41+f.n21,f.n42+f.n22,f.n43+f.n23,f.n44+f.n24);D[3].set(f.n41-f.n21,f.n42-f.n22,f.n43-f.n23,f.n44-f.n24);D[4].set(f.n41-f.n31,f.n42-f.n32,
+f.n43-f.n33,f.n44-f.n34);D[5].set(f.n41+f.n31,f.n42+f.n32,f.n43+f.n33,f.n44+f.n34);var n;for(f=0;f<5;f++){n=D[f];n.divideScalar(Math.sqrt(n.x*n.x+n.y*n.y+n.z*n.z))}}function m(f){for(var n=f.globalMatrix,p=-f.geometry.boundingSphere.radius*Math.max(f.scale.x,Math.max(f.scale.y,f.scale.z)),j=0;j<6;j++){f=D[j].x*n.n14+D[j].y*n.n24+D[j].z*n.n34+D[j].w;if(f<=p)return!1}return!0}function s(f,n){f.list[f.count]=n;f.count+=1}function w(f){var n,p,j=f.object,h=f.opaque,q=f.transparent;q.count=0;f=h.count=
+0;for(n=j.materials.length;f<n;f++){p=j.materials[f];p.opacity&&p.opacity<1||p.blending!=THREE.NormalBlending?s(q,p):s(h,p)}}function u(f){var n,p,j,h,q=f.object,t=f.buffer,A=f.opaque,W=f.transparent;W.count=0;f=A.count=0;for(j=q.materials.length;f<j;f++){n=q.materials[f];if(n instanceof THREE.MeshFaceMaterial){n=0;for(p=t.materials.length;n<p;n++)(h=t.materials[n])&&(h.opacity&&h.opacity<1||h.blending!=THREE.NormalBlending?s(W,h):s(A,h))}else{h=n;h.opacity&&h.opacity<1||h.blending!=THREE.NormalBlending?
+s(W,h):s(A,h)}}}function x(f,n){return n.z-f.z}function F(f,n,p,j,h){if(n[p]==undefined){f.push({buffer:j,object:h,opaque:{list:[],count:0},transparent:{list:[],count:0}});n[p]=1}}function I(f,n){f._modelViewMatrix.multiplyToArray(n.globalMatrix,f.globalMatrix,f._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(f._modelViewMatrix).transposeIntoArray(f._normalMatrixArray)}function H(f){if(f!=ba){switch(f){case THREE.AdditiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ONE,c.ONE);break;case THREE.SubtractiveBlending:c.blendFunc(c.DST_COLOR,
+c.ZERO);break;case THREE.BillboardBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA);break;default:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA)}ba=f}}function r(f,n){if(f&&!f.__webGLFramebuffer){f.__webGLFramebuffer=c.createFramebuffer();f.__webGLRenderbuffer=c.createRenderbuffer();f.__webGLTexture=c.createTexture();c.bindRenderbuffer(c.RENDERBUFFER,f.__webGLRenderbuffer);c.renderbufferStorage(c.RENDERBUFFER,c.DEPTH_COMPONENT16,f.width,f.height);
+c.bindTexture(c.TEXTURE_2D,f.__webGLTexture);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,E(f.wrap_s));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,E(f.wrap_t));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,E(f.mag_filter));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,E(f.min_filter));c.texImage2D(c.TEXTURE_2D,0,E(f.format),f.width,f.height,0,E(f.format),E(f.type),null);c.bindFramebuffer(c.FRAMEBUFFER,f.__webGLFramebuffer);c.framebufferTexture2D(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,c.TEXTURE_2D,
+f.__webGLTexture,0);c.framebufferRenderbuffer(c.FRAMEBUFFER,c.DEPTH_ATTACHMENT,c.RENDERBUFFER,f.__webGLRenderbuffer);c.bindTexture(c.TEXTURE_2D,null);c.bindRenderbuffer(c.RENDERBUFFER,null);c.bindFramebuffer(c.FRAMEBUFFER,null)}var p,j,h;if(f){p=f.__webGLFramebuffer;j=f.width;h=f.height}else{p=null;j=L.width;h=L.height}if(p!=T){c.bindFramebuffer(c.FRAMEBUFFER,p);c.viewport(0,0,j,h);n&&c.clear(c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT);T=p}}function Z(f,n){var p;if(f=="fragment")p=c.createShader(c.FRAGMENT_SHADER);
+else f=="vertex"&&(p=c.createShader(c.VERTEX_SHADER));c.shaderSource(p,n);c.compileShader(p);if(!c.getShaderParameter(p,c.COMPILE_STATUS)){alert(c.getShaderInfoLog(p));return null}return p}function E(f){switch(f){case THREE.RepeatWrapping:return c.REPEAT;case THREE.ClampToEdgeWrapping:return c.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return c.MIRRORED_REPEAT;case THREE.NearestFilter:return c.NEAREST;case THREE.NearestMipMapNearestFilter:return c.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return c.NEAREST_MIPMAP_LINEAR;
+case THREE.LinearFilter:return c.LINEAR;case THREE.LinearMipMapNearestFilter:return c.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return c.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return c.BYTE;case THREE.UnsignedByteType:return c.UNSIGNED_BYTE;case THREE.ShortType:return c.SHORT;case THREE.UnsignedShortType:return c.UNSIGNED_SHORT;case THREE.IntType:return c.INT;case THREE.UnsignedShortType:return c.UNSIGNED_INT;case THREE.FloatType:return c.FLOAT;case THREE.AlphaFormat:return c.ALPHA;
+case THREE.RGBFormat:return c.RGB;case THREE.RGBAFormat:return c.RGBA;case THREE.LuminanceFormat:return c.LUMINANCE;case THREE.LuminanceAlphaFormat:return c.LUMINANCE_ALPHA}return 0}var L=document.createElement("canvas"),c,ia=null,T=null,O=this,ca=null,S=null,ba=null,V=null,D=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],J=new THREE.Matrix4,la=new Float32Array(16),Q=new Float32Array(16),ja=new Float32Array(16),ea=new THREE.Vector4,R=
+!0,ra=new THREE.Color(0),wa=0;if(a){if(a.antialias!==undefined)R=a.antialias;a.clearColor!==undefined&&ra.setHex(a.clearColor);if(a.clearAlpha!==undefined)wa=a.clearAlpha}this.domElement=L;this.autoClear=!0;this.sortObjects=!1;(function(f,n,p){try{c=L.getContext("experimental-webgl",{antialias:f})}catch(j){console.log(j)}if(!c){alert("WebGL not supported");throw"cannot create webgl context";}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.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA);c.clearColor(n.r,n.g,n.b,p);_cullEnabled=!0})(R,ra,wa);this.context=c;this.lights={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}};this.setSize=function(f,n){L.width=f;L.height=n;c.viewport(0,0,L.width,L.height)};this.setClearColorHex=function(f,n){var p=new THREE.Color(f);c.clearColor(p.r,p.g,p.b,n)};this.setClearColor=function(f,n){c.clearColor(f.r,f.g,f.b,n)};
+this.clear=function(){c.clear(c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT)};this.initMaterial=function(f,n,p){var j,h;if(f instanceof THREE.MeshDepthMaterial)d(f,THREE.ShaderLib.depth);else if(f instanceof THREE.MeshNormalMaterial)d(f,THREE.ShaderLib.normal);else if(f instanceof THREE.MeshBasicMaterial)d(f,THREE.ShaderLib.basic);else if(f instanceof THREE.MeshLambertMaterial)d(f,THREE.ShaderLib.lambert);else if(f instanceof THREE.MeshPhongMaterial)d(f,THREE.ShaderLib.phong);else if(f instanceof THREE.LineBasicMaterial)d(f,
+THREE.ShaderLib.basic);else f instanceof THREE.ParticleBasicMaterial&&d(f,THREE.ShaderLib.particle_basic);var q,t,A,W;h=A=W=0;for(q=n.length;h<q;h++){t=n[h];t instanceof THREE.DirectionalLight&&A++;t instanceof THREE.PointLight&&W++}if(W+A<=4)n=A;else{n=Math.ceil(4*A/(W+A));W=4-n}h={directional:n,point:W};W=f.fragment_shader;n=f.vertex_shader;q={fog:p,map:f.map,env_map:f.env_map,light_map:f.light_map,vertex_colors:f.vertex_colors,skinning:f.skinning,maxDirLights:h.directional,maxPointLights:h.point};
+p=c.createProgram();h=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+q.maxDirLights,"#define MAX_POINT_LIGHTS "+q.maxPointLights,q.fog?"#define USE_FOG":"",q.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",q.map?"#define USE_MAP":"",q.env_map?"#define USE_ENVMAP":"",q.light_map?"#define USE_LIGHTMAP":"",q.vertex_colors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");q=[c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":
+"","#define MAX_DIR_LIGHTS "+q.maxDirLights,"#define MAX_POINT_LIGHTS "+q.maxPointLights,q.map?"#define USE_MAP":"",q.env_map?"#define USE_ENVMAP":"",q.light_map?"#define USE_LIGHTMAP":"",q.vertex_colors?"#define USE_COLOR":"",q.skinning?"#define USE_SKINNING":"","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 vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n");
+c.attachShader(p,Z("fragment",h+W));c.attachShader(p,Z("vertex",q+n));c.linkProgram(p);c.getProgramParameter(p,c.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+c.getProgramParameter(p,c.VALIDATE_STATUS)+", gl error ["+c.getError()+"]");p.uniforms={};p.attributes={};f.program=p;p=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","uBoneGlobalMatrices"];for(j in f.uniforms)p.push(j);j=f.program;W=0;for(n=p.length;W<
+n;W++){h=p[W];j.uniforms[h]=c.getUniformLocation(j,h)}j=f.program;p=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];W=0;for(n=p.length;W<n;W++){h=p[W];j.attributes[h]=c.getAttribLocation(j,h)}j=f.program.attributes;c.enableVertexAttribArray(j.position);j.color>=0&&c.enableVertexAttribArray(j.color);j.normal>=0&&c.enableVertexAttribArray(j.normal);j.tangent>=0&&c.enableVertexAttribArray(j.tangent);if(f.skinning&&j.skinVertexA>=0&&j.skinVertexB>=
+0&&j.skinIndex>=0&&j.skinWeight>=0){c.enableVertexAttribArray(j.skinVertexA);c.enableVertexAttribArray(j.skinVertexB);c.enableVertexAttribArray(j.skinIndex);c.enableVertexAttribArray(j.skinWeight)}};this.render=function(f,n,p,j){var h,q,t,A,W,G,M,C,aa=f.lights,da=f.fog;n.autoUpdateMatrix&&n.update();n.globalMatrix.flattenToArray(ja);n.projectionMatrix.flattenToArray(la);n.inverseMatrix.flattenToArray(Q);J.multiply(n.projectionMatrix,n.globalMatrix);k(J);THREE.AnimationHandler&&THREE.AnimationHandler.update();
+f.update(undefined,!1,n);this.initWebGLObjects(f,n);r(p,j!==undefined?j:!0);this.autoClear&&this.clear();W=f.__webGLObjects.length;for(j=0;j<W;j++){h=f.__webGLObjects[j];M=h.object;if(M.visible)if(!(M instanceof THREE.Mesh)||m(M)){M.globalMatrix.flattenToArray(M._objectMatrixArray);I(M,n);u(h);h.render=!0;if(this.sortObjects){ea.copy(M.position);J.multiplyVector3(ea);h.z=ea.z}}else h.render=!1;else h.render=!1}this.sortObjects&&f.__webGLObjects.sort(x);G=f.__webGLObjectsImmediate.length;for(j=0;j<
+G;j++){h=f.__webGLObjectsImmediate[j];M=h.object;if(M.visible){M.autoUpdateMatrix&&M.globalMatrix.flattenToArray(M._objectMatrixArray);I(M,n);w(h)}}H(THREE.NormalBlending);for(j=0;j<W;j++){h=f.__webGLObjects[j];if(h.render){M=h.object;C=h.buffer;t=h.opaque;l(M);for(h=0;h<t.count;h++){A=t.list[h];o(A.depth_test);g(n,aa,da,A,C,M)}}}for(j=0;j<G;j++){h=f.__webGLObjectsImmediate[j];M=h.object;if(M.visible){t=h.opaque;l(M);for(h=0;h<t.count;h++){A=t.list[h];o(A.depth_test);q=e(n,aa,da,A,M);M.render(function(ua){i(ua,
+q)})}}}for(j=0;j<W;j++){h=f.__webGLObjects[j];if(h.render){M=h.object;C=h.buffer;t=h.transparent;l(M);for(h=0;h<t.count;h++){A=t.list[h];H(A.blending);o(A.depth_test);g(n,aa,da,A,C,M)}}}for(j=0;j<G;j++){h=f.__webGLObjectsImmediate[j];M=h.object;if(M.visible){t=h.transparent;l(M);for(h=0;h<t.count;h++){A=t.list[h];H(A.blending);o(A.depth_test);q=e(n,aa,da,A,M);M.render(function(ua){i(ua,q)})}}}if(p&&p.min_filter!==THREE.NearestFilter&&p.min_filter!==THREE.LinearFilter){c.bindTexture(c.TEXTURE_2D,p.__webGLTexture);
+c.generateMipmap(c.TEXTURE_2D);c.bindTexture(c.TEXTURE_2D,null)}};this.initWebGLObjects=function(f){var n,p,j;if(!f.__webGLObjects){f.__webGLObjects=[];f.__webGLObjectsMap={};f.__webGLObjectsImmediate=[]}n=0;for(p=f.objects.length;n<p;n++){j=f.objects[n];var h=f,q=void 0,t=void 0,A=void 0,W=void 0;t=j.geometry;if(h.__webGLObjectsMap[j.id]==undefined){h.__webGLObjectsMap[j.id]={};j._modelViewMatrix=new THREE.Matrix4;j._normalMatrixArray=new Float32Array(9);j._modelViewMatrixArray=new Float32Array(16);
+j._objectMatrixArray=new Float32Array(16);j.globalMatrix.flattenToArray(j._objectMatrixArray)}W=h.__webGLObjectsMap[j.id];objlist=h.__webGLObjects;if(j instanceof THREE.Mesh){for(q in t.geometryChunks){A=t.geometryChunks[q];if(!A.__webGLVertexBuffer){h=A;h.__webGLVertexBuffer=c.createBuffer();h.__webGLNormalBuffer=c.createBuffer();h.__webGLTangentBuffer=c.createBuffer();h.__webGLColorBuffer=c.createBuffer();h.__webGLUVBuffer=c.createBuffer();h.__webGLUV2Buffer=c.createBuffer();h.__webGLSkinVertexABuffer=
+c.createBuffer();h.__webGLSkinVertexBBuffer=c.createBuffer();h.__webGLSkinIndicesBuffer=c.createBuffer();h.__webGLSkinWeightsBuffer=c.createBuffer();h.__webGLFaceBuffer=c.createBuffer();h.__webGLLineBuffer=c.createBuffer();h=A;var G=j,M=void 0,C=void 0,aa=0,da=0,ua=0,ka=G.geometry.faces,fa=h.faces;M=0;for(C=fa.length;M<C;M++){fi=fa[M];face=ka[fi];if(face instanceof THREE.Face3){aa+=3;da+=1;ua+=3}else if(face instanceof THREE.Face4){aa+=4;da+=2;ua+=4}}h.__vertexArray=new Float32Array(aa*3);h.__normalArray=
+new Float32Array(aa*3);h.__tangentArray=new Float32Array(aa*4);h.__colorArray=new Float32Array(aa*3);h.__uvArray=new Float32Array(aa*2);h.__uv2Array=new Float32Array(aa*2);h.__skinVertexAArray=new Float32Array(aa*4);h.__skinVertexBArray=new Float32Array(aa*4);h.__skinIndexArray=new Float32Array(aa*4);h.__skinWeightArray=new Float32Array(aa*4);h.__faceArray=new Uint16Array(da*3);h.__lineArray=new Uint16Array(ua*2);C=M=h;aa=void 0;ka=void 0;var ga=void 0,ha=void 0;ga=void 0;fa=!1;aa=0;for(ka=G.materials.length;aa<
+ka;aa++){ga=G.materials[aa];if(ga instanceof THREE.MeshFaceMaterial){ga=0;for(ha=C.materials.length;ga<ha;ga++)if(C.materials[ga]&&C.materials[ga].shading!=undefined&&C.materials[ga].shading==THREE.SmoothShading){fa=!0;break}}else if(ga&&ga.shading!=undefined&&ga.shading==THREE.SmoothShading){fa=!0;break}if(fa)break}M.__needsSmoothNormals=fa;h.__webGLFaceCount=da*3;h.__webGLLineCount=ua*2;t.__dirtyVertices=!0;t.__dirtyElements=!0;t.__dirtyUvs=!0;t.__dirtyNormals=!0;t.__dirtyTangents=!0;t.__dirtyColors=
+!0}if(t.__dirtyVertices||t.__dirtyElements||t.__dirtyUvs||t.__dirtyNormals||t.__dirtyColors||t.__dirtyTangents){h=A;da=c.DYNAMIC_DRAW;ua=void 0;M=void 0;var na=void 0,z=void 0,Fa=void 0,za=void 0,Ga=void 0;na=void 0;var P=void 0,N=void 0,K=void 0,oa=void 0;P=void 0;N=void 0;K=void 0;z=void 0;P=void 0;N=void 0;K=void 0;oa=void 0;P=void 0;N=void 0;K=void 0;oa=void 0;P=void 0;N=void 0;K=void 0;oa=void 0;P=void 0;N=void 0;K=void 0;oa=void 0;P=void 0;N=void 0;K=void 0;oa=void 0;z=void 0;za=void 0;Fa=void 0;
+Ga=void 0;var Ca=ha=ga=fa=ka=aa=G=C=0,Aa=0,v=0,Ba=h.__vertexArray,Oa=h.__uvArray,Ma=h.__uv2Array,Ha=h.__normalArray,$=h.__tangentArray,sa=h.__colorArray,pa=h.__skinVertexAArray,ta=h.__skinVertexBArray,va=h.__skinIndexArray,qa=h.__skinWeightArray,y=h.__faceArray,X=h.__lineArray,Y=h.__needsSmoothNormals,B=j.geometry,U=B.__dirtyVertices,ma=B.__dirtyElements,xa=B.__dirtyUvs,Da=B.__dirtyNormals,Ea=B.__dirtyTangents,Ia=B.__dirtyColors,ya=B.vertices,Ja=h.faces,Qa=B.faces,Ka=B.uvs,La=B.uvs2,Na=B.colors,Ra=
+B.skinVerticesA,Sa=B.skinVerticesB,Ta=B.skinIndices,Pa=B.skinWeights;ua=0;for(M=Ja.length;ua<M;ua++){na=Ja[ua];z=Qa[na];Ga=Ka[na];na=La[na];Fa=z.vertexNormals;za=z.normal;if(z instanceof THREE.Face3){if(U){P=ya[z.a].position;N=ya[z.b].position;K=ya[z.c].position;Ba[G]=P.x;Ba[G+1]=P.y;Ba[G+2]=P.z;Ba[G+3]=N.x;Ba[G+4]=N.y;Ba[G+5]=N.z;Ba[G+6]=K.x;Ba[G+7]=K.y;Ba[G+8]=K.z;G+=9}if(Pa.length){P=Pa[z.a];N=Pa[z.b];K=Pa[z.c];qa[v]=P.x;qa[v+1]=P.y;qa[v+2]=P.z;qa[v+3]=P.w;qa[v+4]=N.x;qa[v+5]=N.y;qa[v+6]=N.z;qa[v+
+7]=N.w;qa[v+8]=K.x;qa[v+9]=K.y;qa[v+10]=K.z;qa[v+11]=K.w;P=Ta[z.a];N=Ta[z.b];K=Ta[z.c];va[v]=P.x;va[v+1]=P.y;va[v+2]=P.z;va[v+3]=P.w;va[v+4]=N.x;va[v+5]=N.y;va[v+6]=N.z;va[v+7]=N.w;va[v+8]=K.x;va[v+9]=K.y;va[v+10]=K.z;va[v+11]=K.w;P=Ra[z.a];N=Ra[z.b];K=Ra[z.c];pa[v]=P.x;pa[v+1]=P.y;pa[v+2]=P.z;pa[v+3]=1;pa[v+4]=N.x;pa[v+5]=N.y;pa[v+6]=N.z;pa[v+7]=1;pa[v+8]=K.x;pa[v+9]=K.y;pa[v+10]=K.z;pa[v+11]=1;P=Sa[z.a];N=Sa[z.b];K=Sa[z.c];ta[v]=P.x;ta[v+1]=P.y;ta[v+2]=P.z;ta[v+3]=1;ta[v+4]=N.x;ta[v+5]=N.y;ta[v+
+6]=N.z;ta[v+7]=1;ta[v+8]=K.x;ta[v+9]=K.y;ta[v+10]=K.z;ta[v+11]=1;v+=12}if(Ia&&Na.length){P=Na[z.a];N=Na[z.b];K=Na[z.c];sa[Aa]=P.r;sa[Aa+1]=P.g;sa[Aa+2]=P.b;sa[Aa+3]=N.r;sa[Aa+4]=N.g;sa[Aa+5]=N.b;sa[Aa+6]=K.r;sa[Aa+7]=K.g;sa[Aa+8]=K.b;Aa+=9}if(Ea&&B.hasTangents){P=ya[z.a].tangent;N=ya[z.b].tangent;K=ya[z.c].tangent;$[ha]=P.x;$[ha+1]=P.y;$[ha+2]=P.z;$[ha+3]=P.w;$[ha+4]=N.x;$[ha+5]=N.y;$[ha+6]=N.z;$[ha+7]=N.w;$[ha+8]=K.x;$[ha+9]=K.y;$[ha+10]=K.z;$[ha+11]=K.w;ha+=12}if(Da)if(Fa.length==3&&Y)for(z=0;z<
+3;z++){za=Fa[z];Ha[ga]=za.x;Ha[ga+1]=za.y;Ha[ga+2]=za.z;ga+=3}else for(z=0;z<3;z++){Ha[ga]=za.x;Ha[ga+1]=za.y;Ha[ga+2]=za.z;ga+=3}if(xa&&Ga)for(z=0;z<3;z++){Fa=Ga[z];Oa[aa]=Fa.u;Oa[aa+1]=Fa.v;aa+=2}if(xa&&na)for(z=0;z<3;z++){Ga=na[z];Ma[ka]=Ga.u;Ma[ka+1]=Ga.v;ka+=2}if(ma){y[fa]=C;y[fa+1]=C+1;y[fa+2]=C+2;fa+=3;X[Ca]=C;X[Ca+1]=C+1;X[Ca+2]=C;X[Ca+3]=C+2;X[Ca+4]=C+1;X[Ca+5]=C+2;Ca+=6;C+=3}}else if(z instanceof THREE.Face4){if(U){P=ya[z.a].position;N=ya[z.b].position;K=ya[z.c].position;oa=ya[z.d].position;
+Ba[G]=P.x;Ba[G+1]=P.y;Ba[G+2]=P.z;Ba[G+3]=N.x;Ba[G+4]=N.y;Ba[G+5]=N.z;Ba[G+6]=K.x;Ba[G+7]=K.y;Ba[G+8]=K.z;Ba[G+9]=oa.x;Ba[G+10]=oa.y;Ba[G+11]=oa.z;G+=12}if(Pa.length){P=Pa[z.a];N=Pa[z.b];K=Pa[z.c];oa=Pa[z.d];qa[v]=P.x;qa[v+1]=P.y;qa[v+2]=P.z;qa[v+3]=P.w;qa[v+4]=N.x;qa[v+5]=N.y;qa[v+6]=N.z;qa[v+7]=N.w;qa[v+8]=K.x;qa[v+9]=K.y;qa[v+10]=K.z;qa[v+11]=K.w;qa[v+12]=oa.x;qa[v+13]=oa.y;qa[v+14]=oa.z;qa[v+15]=oa.w;P=Ta[z.a];N=Ta[z.b];K=Ta[z.c];oa=Ta[z.d];va[v]=P.x;va[v+1]=P.y;va[v+2]=P.z;va[v+3]=P.w;va[v+4]=
+N.x;va[v+5]=N.y;va[v+6]=N.z;va[v+7]=N.w;va[v+8]=K.x;va[v+9]=K.y;va[v+10]=K.z;va[v+11]=K.w;va[v+12]=oa.x;va[v+13]=oa.y;va[v+14]=oa.z;va[v+15]=oa.w;P=Ra[z.a];N=Ra[z.b];K=Ra[z.c];oa=Ra[z.d];pa[v]=P.x;pa[v+1]=P.y;pa[v+2]=P.z;pa[v+3]=1;pa[v+4]=N.x;pa[v+5]=N.y;pa[v+6]=N.z;pa[v+7]=1;pa[v+8]=K.x;pa[v+9]=K.y;pa[v+10]=K.z;pa[v+11]=1;pa[v+12]=oa.x;pa[v+13]=oa.y;pa[v+14]=oa.z;pa[v+15]=1;P=Sa[z.a];N=Sa[z.b];K=Sa[z.c];oa=Sa[z.d];ta[v]=P.x;ta[v+1]=P.y;ta[v+2]=P.z;ta[v+3]=1;ta[v+4]=N.x;ta[v+5]=N.y;ta[v+6]=N.z;ta[v+
+7]=1;ta[v+8]=K.x;ta[v+9]=K.y;ta[v+10]=K.z;ta[v+11]=1;ta[v+12]=oa.x;ta[v+13]=oa.y;ta[v+14]=oa.z;ta[v+15]=1;v+=16}if(Ia&&Na.length){P=Na[z.a];N=Na[z.b];K=Na[z.c];oa=Na[z.d];sa[Aa]=P.r;sa[Aa+1]=P.g;sa[Aa+2]=P.b;sa[Aa+3]=N.r;sa[Aa+4]=N.g;sa[Aa+5]=N.b;sa[Aa+6]=K.r;sa[Aa+7]=K.g;sa[Aa+8]=K.b;sa[Aa+9]=oa.r;sa[Aa+10]=oa.g;sa[Aa+11]=oa.b;Aa+=12}if(Ea&&B.hasTangents){P=ya[z.a].tangent;N=ya[z.b].tangent;K=ya[z.c].tangent;z=ya[z.d].tangent;$[ha]=P.x;$[ha+1]=P.y;$[ha+2]=P.z;$[ha+3]=P.w;$[ha+4]=N.x;$[ha+5]=N.y;
+$[ha+6]=N.z;$[ha+7]=N.w;$[ha+8]=K.x;$[ha+9]=K.y;$[ha+10]=K.z;$[ha+11]=K.w;$[ha+12]=z.x;$[ha+13]=z.y;$[ha+14]=z.z;$[ha+15]=z.w;ha+=16}if(Da)if(Fa.length==4&&Y)for(z=0;z<4;z++){za=Fa[z];Ha[ga]=za.x;Ha[ga+1]=za.y;Ha[ga+2]=za.z;ga+=3}else for(z=0;z<4;z++){Ha[ga]=za.x;Ha[ga+1]=za.y;Ha[ga+2]=za.z;ga+=3}if(xa&&Ga)for(z=0;z<4;z++){Fa=Ga[z];Oa[aa]=Fa.u;Oa[aa+1]=Fa.v;aa+=2}if(xa&&na)for(z=0;z<4;z++){Ga=na[z];Ma[ka]=Ga.u;Ma[ka+1]=Ga.v;ka+=2}if(ma){y[fa]=C;y[fa+1]=C+1;y[fa+2]=C+2;y[fa+3]=C;y[fa+4]=C+2;y[fa+5]=
+C+3;fa+=6;X[Ca]=C;X[Ca+1]=C+1;X[Ca+2]=C;X[Ca+3]=C+3;X[Ca+4]=C+1;X[Ca+5]=C+2;X[Ca+6]=C+2;X[Ca+7]=C+3;Ca+=8;C+=4}}}if(U){c.bindBuffer(c.ARRAY_BUFFER,h.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,Ba,da)}if(Ia&&Na.length){c.bindBuffer(c.ARRAY_BUFFER,h.__webGLColorBuffer);c.bufferData(c.ARRAY_BUFFER,sa,da)}if(Da){c.bindBuffer(c.ARRAY_BUFFER,h.__webGLNormalBuffer);c.bufferData(c.ARRAY_BUFFER,Ha,da)}if(Ea&&B.hasTangents){c.bindBuffer(c.ARRAY_BUFFER,h.__webGLTangentBuffer);c.bufferData(c.ARRAY_BUFFER,
+$,da)}if(xa&&aa>0){c.bindBuffer(c.ARRAY_BUFFER,h.__webGLUVBuffer);c.bufferData(c.ARRAY_BUFFER,Oa,da)}if(xa&&ka>0){c.bindBuffer(c.ARRAY_BUFFER,h.__webGLUV2Buffer);c.bufferData(c.ARRAY_BUFFER,Ma,da)}if(ma){c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,h.__webGLFaceBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,y,da);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,h.__webGLLineBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,X,da)}if(v>0){c.bindBuffer(c.ARRAY_BUFFER,h.__webGLSkinVertexABuffer);c.bufferData(c.ARRAY_BUFFER,pa,da);
+c.bindBuffer(c.ARRAY_BUFFER,h.__webGLSkinVertexBBuffer);c.bufferData(c.ARRAY_BUFFER,ta,da);c.bindBuffer(c.ARRAY_BUFFER,h.__webGLSkinIndicesBuffer);c.bufferData(c.ARRAY_BUFFER,va,da);c.bindBuffer(c.ARRAY_BUFFER,h.__webGLSkinWeightsBuffer);c.bufferData(c.ARRAY_BUFFER,qa,da)}}F(objlist,W,q,A,j)}t.__dirtyVertices=!1;t.__dirtyElements=!1;t.__dirtyUvs=!1;t.__dirtyNormals=!1;t.__dirtyTangents=!1;t.__dirtyColors=!1}else if(j instanceof THREE.Ribbon){if(!t.__webGLVertexBuffer){q=t;q.__webGLVertexBuffer=c.createBuffer();
+q.__webGLColorBuffer=c.createBuffer();q=t;A=q.vertices.length;q.__vertexArray=new Float32Array(A*3);q.__colorArray=new Float32Array(A*3);q.__webGLVertexCount=A;t.__dirtyVertices=!0;t.__dirtyColors=!0}if(t.__dirtyVertices||t.__dirtyColors){q=t;A=c.DYNAMIC_DRAW;C=void 0;C=void 0;G=void 0;h=void 0;aa=q.vertices;da=q.colors;ka=aa.length;ua=da.length;fa=q.__vertexArray;M=q.__colorArray;ga=q.__dirtyColors;if(q.__dirtyVertices){for(C=0;C<ka;C++){G=aa[C].position;h=C*3;fa[h]=G.x;fa[h+1]=G.y;fa[h+2]=G.z}c.bindBuffer(c.ARRAY_BUFFER,
+q.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,fa,A)}if(ga){for(C=0;C<ua;C++){color=da[C];h=C*3;M[h]=color.r;M[h+1]=color.g;M[h+2]=color.b}c.bindBuffer(c.ARRAY_BUFFER,q.__webGLColorBuffer);c.bufferData(c.ARRAY_BUFFER,M,A)}}F(objlist,W,0,t,j);t.__dirtyVertices=!1;t.__dirtyColors=!1}else if(j instanceof THREE.Line){if(!t.__webGLVertexBuffer){q=t;q.__webGLVertexBuffer=c.createBuffer();q.__webGLColorBuffer=c.createBuffer();q=t;A=q.vertices.length;q.__vertexArray=new Float32Array(A*3);q.__colorArray=
+new Float32Array(A*3);q.__webGLLineCount=A;t.__dirtyVertices=!0;t.__dirtyColors=!0}if(t.__dirtyVertices||t.__dirtyColors){q=t;A=c.DYNAMIC_DRAW;C=void 0;C=void 0;G=void 0;h=void 0;aa=q.vertices;da=q.colors;ka=aa.length;ua=da.length;fa=q.__vertexArray;M=q.__colorArray;ga=q.__dirtyColors;if(q.__dirtyVertices){for(C=0;C<ka;C++){G=aa[C].position;h=C*3;fa[h]=G.x;fa[h+1]=G.y;fa[h+2]=G.z}c.bindBuffer(c.ARRAY_BUFFER,q.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,fa,A)}if(ga){for(C=0;C<ua;C++){color=da[C];
+h=C*3;M[h]=color.r;M[h+1]=color.g;M[h+2]=color.b}c.bindBuffer(c.ARRAY_BUFFER,q.__webGLColorBuffer);c.bufferData(c.ARRAY_BUFFER,M,A)}}F(objlist,W,0,t,j);t.__dirtyVertices=!1;t.__dirtyColors=!1}else if(j instanceof THREE.ParticleSystem){if(!t.__webGLVertexBuffer){q=t;q.__webGLVertexBuffer=c.createBuffer();q.__webGLColorBuffer=c.createBuffer();q=t;A=q.vertices.length;q.__vertexArray=new Float32Array(A*3);q.__colorArray=new Float32Array(A*3);q.__sortArray=[];q.__webGLParticleCount=A;t.__dirtyVertices=
+!0;t.__dirtyColors=!0}(t.__dirtyVertices||t.__dirtyColors||j.sortParticles)&&b(t,c.DYNAMIC_DRAW,j,camera);F(objlist,W,0,t,j);t.__dirtyVertices=!1;t.__dirtyColors=!1}else if(j instanceof THREE.MarchingCubes){t=W;if(t[0]==undefined){h.__webGLObjectsImmediate.push({object:j,opaque:{list:[],count:0},transparent:{list:[],count:0}});t[0]=1}}}};this.removeObject=function(f,n){var p,j;for(p=f.__webGLObjects.length-1;p>=0;p--){j=f.__webGLObjects[p].object;n==j&&f.__webGLObjects.splice(p,1)}};this.setFaceCulling=
+function(f,n){if(f){!n||n=="ccw"?c.frontFace(c.CCW):c.frontFace(c.CW);if(f=="back")c.cullFace(c.BACK);else f=="front"?c.cullFace(c.FRONT):c.cullFace(c.FRONT_AND_BACK);c.enable(c.CULL_FACE)}else c.disable(c.CULL_FACE)};this.supportsVertexTextures=function(){return c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};
 THREE.Snippets={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",
 THREE.Snippets={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",
 envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube env_map;\nuniform int combine;\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( env_map, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refraction_ratio;\nuniform bool useRefract;\n#endif",
 envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube env_map;\nuniform int combine;\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( env_map, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refraction_ratio;\nuniform bool useRefract;\n#endif",
 envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refraction_ratio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",
 envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refraction_ratio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",

+ 139 - 136
build/ThreeExtras.js

@@ -13,7 +13,7 @@ this.x+", "+this.y+", "+this.z+" )"}};THREE.Vector4=function(a,b,c,d){this.x=a||
 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.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w||1;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;
 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.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w||1;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;
 return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){this.x/=a;this.y/=a;this.z/=a;this.w/=a;return this},lerpSelf:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},toString:function(){return"THREE.Vector4 ("+this.x+", "+this.y+", "+this.z+", "+this.w+")"}};
 return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){this.x/=a;this.y/=a;this.z/=a;this.w/=a;return this},lerpSelf:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},toString:function(){return"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=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,f=[];a=0;for(b=d.length;a<b;a++){c=d[a];c instanceof THREE.Mesh&&(f=f.concat(this.intersectObject(c)))}f.sort(function(g,h){return g.distance-h.distance});return f},intersectObject:function(a){function b(F,v,H,q){q=q.clone().subSelf(v);H=H.clone().subSelf(v);var J=F.clone().subSelf(v);F=q.dot(q);v=q.dot(H);q=q.dot(J);var e=H.dot(H);H=H.dot(J);J=1/(F*e-v*v);e=(e*q-v*H)*J;F=(F*H-v*q)*J;return e>0&&F>0&&e+F<1}var c,d,f,g,h,k,j,m,o,w,
+THREE.Ray.prototype={intersectScene:function(a){var b,c,d=a.objects,f=[];a=0;for(b=d.length;a<b;a++){c=d[a];c instanceof THREE.Mesh&&(f=f.concat(this.intersectObject(c)))}f.sort(function(g,h){return g.distance-h.distance});return f},intersectObject:function(a){function b(F,v,I,q){q=q.clone().subSelf(v);I=I.clone().subSelf(v);var J=F.clone().subSelf(v);F=q.dot(q);v=q.dot(I);q=q.dot(J);var e=I.dot(I);I=I.dot(J);J=1/(F*e-v*v);e=(e*q-v*I)*J;F=(F*I-v*q)*J;return e>0&&F>0&&e+F<1}var c,d,f,g,h,k,j,m,o,w,
 u,t=a.geometry,x=t.vertices,A=[];c=0;for(d=t.faces.length;c<d;c++){f=t.faces[c];w=this.origin.clone();u=this.direction.clone();j=a.globalMatrix;j.extractRotationMatrix(a.rotationMatrix);g=j.multiplyVector3(x[f.a].position.clone());h=j.multiplyVector3(x[f.b].position.clone());k=j.multiplyVector3(x[f.c].position.clone());j=f instanceof THREE.Face4?j.multiplyVector3(x[f.d].position.clone()):null;m=a.rotationMatrix.multiplyVector3(f.normal.clone());o=u.dot(m);if(o<0){m=m.dot((new THREE.Vector3).sub(g,
 u,t=a.geometry,x=t.vertices,A=[];c=0;for(d=t.faces.length;c<d;c++){f=t.faces[c];w=this.origin.clone();u=this.direction.clone();j=a.globalMatrix;j.extractRotationMatrix(a.rotationMatrix);g=j.multiplyVector3(x[f.a].position.clone());h=j.multiplyVector3(x[f.b].position.clone());k=j.multiplyVector3(x[f.c].position.clone());j=f instanceof THREE.Face4?j.multiplyVector3(x[f.d].position.clone()):null;m=a.rotationMatrix.multiplyVector3(f.normal.clone());o=u.dot(m);if(o<0){m=m.dot((new THREE.Vector3).sub(g,
 w))/o;w=w.addSelf(u.multiplyScalar(m));if(f instanceof THREE.Face3){if(b(w,g,h,k)){f={distance:this.origin.distanceTo(w),point:w,face:f,object:a};A.push(f)}}else if(f instanceof THREE.Face4&&(b(w,g,h,j)||b(w,h,k,j))){f={distance:this.origin.distanceTo(w),point:w,face:f,object:a};A.push(f)}}}return A}};
 w))/o;w=w.addSelf(u.multiplyScalar(m));if(f instanceof THREE.Face3){if(b(w,g,h,k)){f={distance:this.origin.distanceTo(w),point:w,face:f,object:a};A.push(f)}}else if(f instanceof THREE.Face4&&(b(w,g,h,j)||b(w,h,k,j))){f={distance:this.origin.distanceTo(w),point:w,face:f,object:a};A.push(f)}}}return A}};
 THREE.Rectangle=function(){function a(){g=d-b;h=f-c}var b,c,d,f,g,h,k=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return g};this.getHeight=function(){return h};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return f};this.set=function(j,m,o,w){k=!1;b=j;c=m;d=o;f=w;a()};this.addPoint=function(j,m){if(k){k=!1;b=j;c=m;d=j;f=m}else{b=b<j?b:j;c=c<m?c:m;d=d>j?d:j;f=f>m?f:m}a()};
 THREE.Rectangle=function(){function a(){g=d-b;h=f-c}var b,c,d,f,g,h,k=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return g};this.getHeight=function(){return h};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return f};this.set=function(j,m,o,w){k=!1;b=j;c=m;d=o;f=w;a()};this.addPoint=function(j,m){if(k){k=!1;b=j;c=m;d=j;f=m}else{b=b<j?b:j;c=c<m?c:m;d=d>j?d:j;f=f>m?f:m}a()};
@@ -25,11 +25,11 @@ THREE.Matrix4.prototype={identity:function(){this.n11=1;this.n21=this.n14=this.n
 a.n13;this.n14=a.n14;this.n21=a.n21;this.n22=a.n22;this.n23=a.n23;this.n24=a.n24;this.n31=a.n31;this.n32=a.n32;this.n33=a.n33;this.n34=a.n34;this.n41=a.n41;this.n42=a.n42;this.n43=a.n43;this.n44=a.n44;return this},lookAt:function(a,b,c){var d=THREE.Matrix4.__tmpVec1,f=THREE.Matrix4.__tmpVec2,g=THREE.Matrix4.__tmpVec3;g.sub(a,b).normalize();d.cross(c,g).normalize();f.cross(g,d).normalize();this.n11=d.x;this.n12=d.y;this.n13=d.z;this.n14=-d.dot(a);this.n21=f.x;this.n22=f.y;this.n23=f.z;this.n24=-f.dot(a);
 a.n13;this.n14=a.n14;this.n21=a.n21;this.n22=a.n22;this.n23=a.n23;this.n24=a.n24;this.n31=a.n31;this.n32=a.n32;this.n33=a.n33;this.n34=a.n34;this.n41=a.n41;this.n42=a.n42;this.n43=a.n43;this.n44=a.n44;return this},lookAt:function(a,b,c){var d=THREE.Matrix4.__tmpVec1,f=THREE.Matrix4.__tmpVec2,g=THREE.Matrix4.__tmpVec3;g.sub(a,b).normalize();d.cross(c,g).normalize();f.cross(g,d).normalize();this.n11=d.x;this.n12=d.y;this.n13=d.z;this.n14=-d.dot(a);this.n21=f.x;this.n22=f.y;this.n23=f.z;this.n24=-f.dot(a);
 this.n31=g.x;this.n32=g.y;this.n33=g.z;this.n34=-g.dot(a);this.n43=this.n42=this.n41=0;this.n44=1;return this},multiplyVector3:function(a){var b=a.x,c=a.y,d=a.z,f=1/(this.n41*b+this.n42*c+this.n43*d+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*d+this.n14)*f;a.y=(this.n21*b+this.n22*c+this.n23*d+this.n24)*f;a.z=(this.n31*b+this.n32*c+this.n33*d+this.n34)*f;return a},multiplyVector3OnlyZ:function(a){var b=a.x,c=a.y;a=a.z;return(this.n31*b+this.n32*c+this.n33*a+this.n34)*(1/(this.n41*b+this.n42*c+this.n43*
 this.n31=g.x;this.n32=g.y;this.n33=g.z;this.n34=-g.dot(a);this.n43=this.n42=this.n41=0;this.n44=1;return this},multiplyVector3:function(a){var b=a.x,c=a.y,d=a.z,f=1/(this.n41*b+this.n42*c+this.n43*d+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*d+this.n14)*f;a.y=(this.n21*b+this.n22*c+this.n23*d+this.n24)*f;a.z=(this.n31*b+this.n32*c+this.n33*d+this.n34)*f;return a},multiplyVector3OnlyZ:function(a){var b=a.x,c=a.y;a=a.z;return(this.n31*b+this.n32*c+this.n33*a+this.n34)*(1/(this.n41*b+this.n42*c+this.n43*
 a+this.n44))},multiplyVector4:function(a){var b=a.x,c=a.y,d=a.z,f=a.w;a.x=this.n11*b+this.n12*c+this.n13*d+this.n14*f;a.y=this.n21*b+this.n22*c+this.n23*d+this.n24*f;a.z=this.n31*b+this.n32*c+this.n33*d+this.n34*f;a.w=this.n41*b+this.n42*c+this.n43*d+this.n44*f;return a},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+this.n44))},multiplyVector4:function(a){var b=a.x,c=a.y,d=a.z,f=a.w;a.x=this.n11*b+this.n12*c+this.n13*d+this.n14*f;a.y=this.n21*b+this.n22*c+this.n23*d+this.n24*f;a.z=this.n31*b+this.n32*c+this.n33*d+this.n34*f;a.w=this.n41*b+this.n42*c+this.n43*d+this.n44*f;return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*
-a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var c=a.n11,d=a.n12,f=a.n13,g=a.n14,h=a.n21,k=a.n22,j=a.n23,m=a.n24,o=a.n31,w=a.n32,u=a.n33,t=a.n34,x=a.n41,A=a.n42,F=a.n43,v=a.n44,H=b.n11,q=b.n12,J=b.n13,e=b.n14,ba=b.n21,L=b.n22,M=b.n23,V=b.n24,S=b.n31,Y=b.n32,Z=b.n33,G=b.n34,T=b.n41,la=b.n42,W=b.n43,ja=b.n44;this.n11=c*H+d*ba+f*S+g*T;this.n12=c*q+d*L+f*Y+g*la;this.n13=c*J+d*M+f*Z+g*W;this.n14=c*e+d*V+f*G+g*ja;this.n21=h*H+k*ba+j*S+m*T;this.n22=h*q+k*L+j*Y+m*la;this.n23=
-h*J+k*M+j*Z+m*W;this.n24=h*e+k*V+j*G+m*ja;this.n31=o*H+w*ba+u*S+t*T;this.n32=o*q+w*L+u*Y+t*la;this.n33=o*J+w*M+u*Z+t*W;this.n34=o*e+w*V+u*G+t*ja;this.n41=x*H+A*ba+F*S+v*T;this.n42=x*q+A*L+F*Y+v*la;this.n43=x*J+A*M+F*Z+v*W;this.n44=x*e+A*V+F*G+v*ja;return this},multiplyToArray:function(a,b,c){var d=a.n11,f=a.n12,g=a.n13,h=a.n14,k=a.n21,j=a.n22,m=a.n23,o=a.n24,w=a.n31,u=a.n32,t=a.n33,x=a.n34,A=a.n41,F=a.n42,v=a.n43;a=a.n44;var H=b.n11,q=b.n12,J=b.n13,e=b.n14,ba=b.n21,L=b.n22,M=b.n23,V=b.n24,S=b.n31,
-Y=b.n32,Z=b.n33,G=b.n34,T=b.n41,la=b.n42,W=b.n43;b=b.n44;this.n11=d*H+f*ba+g*S+h*T;this.n12=d*q+f*L+g*Y+h*la;this.n13=d*J+f*M+g*Z+h*W;this.n14=d*e+f*V+g*G+h*b;this.n21=k*H+j*ba+m*S+o*T;this.n22=k*q+j*L+m*Y+o*la;this.n23=k*J+j*M+m*Z+o*W;this.n24=k*e+j*V+m*G+o*b;this.n31=w*H+u*ba+t*S+x*T;this.n32=w*q+u*L+t*Y+x*la;this.n33=w*J+u*M+t*Z+x*W;this.n34=w*e+u*V+t*G+x*b;this.n41=A*H+F*ba+v*S+a*T;this.n42=A*q+F*L+v*Y+a*la;this.n43=A*J+F*M+v*Z+a*W;this.n44=A*e+F*V+v*G+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){var b=this.n11,c=this.n12,d=this.n13,f=this.n14,g=this.n21,h=this.n22,k=this.n23,j=this.n24,m=this.n31,o=this.n32,w=this.n33,u=this.n34,t=this.n41,x=this.n42,A=this.n43,F=this.n44,v=a.n11,H=a.n21,q=a.n31,J=a.n41,e=a.n12,ba=a.n22,L=a.n32,M=a.n42,V=a.n13,S=a.n23,Y=a.n33,Z=a.n43,
-G=a.n14,T=a.n24,la=a.n34;a=a.n44;this.n11=b*v+c*H+d*q+f*J;this.n12=b*e+c*ba+d*L+f*M;this.n13=b*V+c*S+d*Y+f*Z;this.n14=b*G+c*T+d*la+f*a;this.n21=g*v+h*H+k*q+j*J;this.n22=g*e+h*ba+k*L+j*M;this.n23=g*V+h*S+k*Y+j*Z;this.n24=g*G+h*T+k*la+j*a;this.n31=m*v+o*H+w*q+u*J;this.n32=m*e+o*ba+w*L+u*M;this.n33=m*V+o*S+w*Y+u*Z;this.n34=m*G+o*T+w*la+u*a;this.n41=t*v+x*H+A*q+F*J;this.n42=t*e+x*ba+A*L+F*M;this.n43=t*V+x*S+A*Y+F*Z;this.n44=t*G+x*T+A*la+F*a;return this},multiplyScalar:function(a){this.n11*=a;this.n12*=
+a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var c=a.n11,d=a.n12,f=a.n13,g=a.n14,h=a.n21,k=a.n22,j=a.n23,m=a.n24,o=a.n31,w=a.n32,u=a.n33,t=a.n34,x=a.n41,A=a.n42,F=a.n43,v=a.n44,I=b.n11,q=b.n12,J=b.n13,e=b.n14,ba=b.n21,L=b.n22,M=b.n23,V=b.n24,S=b.n31,Y=b.n32,Z=b.n33,G=b.n34,U=b.n41,na=b.n42,W=b.n43,ka=b.n44;this.n11=c*I+d*ba+f*S+g*U;this.n12=c*q+d*L+f*Y+g*na;this.n13=c*J+d*M+f*Z+g*W;this.n14=c*e+d*V+f*G+g*ka;this.n21=h*I+k*ba+j*S+m*U;this.n22=h*q+k*L+j*Y+m*na;this.n23=
+h*J+k*M+j*Z+m*W;this.n24=h*e+k*V+j*G+m*ka;this.n31=o*I+w*ba+u*S+t*U;this.n32=o*q+w*L+u*Y+t*na;this.n33=o*J+w*M+u*Z+t*W;this.n34=o*e+w*V+u*G+t*ka;this.n41=x*I+A*ba+F*S+v*U;this.n42=x*q+A*L+F*Y+v*na;this.n43=x*J+A*M+F*Z+v*W;this.n44=x*e+A*V+F*G+v*ka;return this},multiplyToArray:function(a,b,c){var d=a.n11,f=a.n12,g=a.n13,h=a.n14,k=a.n21,j=a.n22,m=a.n23,o=a.n24,w=a.n31,u=a.n32,t=a.n33,x=a.n34,A=a.n41,F=a.n42,v=a.n43;a=a.n44;var I=b.n11,q=b.n12,J=b.n13,e=b.n14,ba=b.n21,L=b.n22,M=b.n23,V=b.n24,S=b.n31,
+Y=b.n32,Z=b.n33,G=b.n34,U=b.n41,na=b.n42,W=b.n43;b=b.n44;this.n11=d*I+f*ba+g*S+h*U;this.n12=d*q+f*L+g*Y+h*na;this.n13=d*J+f*M+g*Z+h*W;this.n14=d*e+f*V+g*G+h*b;this.n21=k*I+j*ba+m*S+o*U;this.n22=k*q+j*L+m*Y+o*na;this.n23=k*J+j*M+m*Z+o*W;this.n24=k*e+j*V+m*G+o*b;this.n31=w*I+u*ba+t*S+x*U;this.n32=w*q+u*L+t*Y+x*na;this.n33=w*J+u*M+t*Z+x*W;this.n34=w*e+u*V+t*G+x*b;this.n41=A*I+F*ba+v*S+a*U;this.n42=A*q+F*L+v*Y+a*na;this.n43=A*J+F*M+v*Z+a*W;this.n44=A*e+F*V+v*G+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){var b=this.n11,c=this.n12,d=this.n13,f=this.n14,g=this.n21,h=this.n22,k=this.n23,j=this.n24,m=this.n31,o=this.n32,w=this.n33,u=this.n34,t=this.n41,x=this.n42,A=this.n43,F=this.n44,v=a.n11,I=a.n21,q=a.n31,J=a.n41,e=a.n12,ba=a.n22,L=a.n32,M=a.n42,V=a.n13,S=a.n23,Y=a.n33,Z=a.n43,
+G=a.n14,U=a.n24,na=a.n34;a=a.n44;this.n11=b*v+c*I+d*q+f*J;this.n12=b*e+c*ba+d*L+f*M;this.n13=b*V+c*S+d*Y+f*Z;this.n14=b*G+c*U+d*na+f*a;this.n21=g*v+h*I+k*q+j*J;this.n22=g*e+h*ba+k*L+j*M;this.n23=g*V+h*S+k*Y+j*Z;this.n24=g*G+h*U+k*na+j*a;this.n31=m*v+o*I+w*q+u*J;this.n32=m*e+o*ba+w*L+u*M;this.n33=m*V+o*S+w*Y+u*Z;this.n34=m*G+o*U+w*na+u*a;this.n41=t*v+x*I+A*q+F*J;this.n42=t*e+x*ba+A*L+F*M;this.n43=t*V+x*S+A*Y+F*Z;this.n44=t*G+x*U+A*na+F*a;return this},multiplyScalar:function(a){this.n11*=a;this.n12*=
 a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,d=this.n14,f=this.n21,g=this.n22,h=this.n23,k=this.n24,j=this.n31,m=this.n32,o=this.n33,w=this.n34,u=this.n41,t=this.n42,x=this.n43,A=this.n44;return d*h*m*u-c*k*m*u-d*g*o*u+b*k*o*u+c*g*w*u-b*h*w*u-d*h*j*t+c*k*j*t+d*f*o*t-a*k*o*t-c*f*w*t+a*h*w*t+d*g*j*x-b*k*
 a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,d=this.n14,f=this.n21,g=this.n22,h=this.n23,k=this.n24,j=this.n31,m=this.n32,o=this.n33,w=this.n34,u=this.n41,t=this.n42,x=this.n43,A=this.n44;return d*h*m*u-c*k*m*u-d*g*o*u+b*k*o*u+c*g*w*u-b*h*w*u-d*h*j*t+c*k*j*t+d*f*o*t-a*k*o*t-c*f*w*t+a*h*w*t+d*g*j*x-b*k*
 j*x-d*f*m*x+a*k*m*x+b*f*w*x-a*g*w*x-c*g*j*A+b*h*j*A+c*f*m*A-a*h*m*A-b*f*o*A+a*g*o*A},transpose:function(){function a(b,c,d){var f=b[c];b[c]=b[d];b[d]=f}a(this,"n21","n12");a(this,"n31","n13");a(this,"n32","n23");a(this,"n41","n14");a(this,"n42","n24");a(this,"n43","n34");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;
 j*x-d*f*m*x+a*k*m*x+b*f*w*x-a*g*w*x-c*g*j*A+b*h*j*A+c*f*m*A-a*h*m*A-b*f*o*A+a*g*o*A},transpose:function(){function a(b,c,d){var f=b[c];b[c]=b[d];b[d]=f}a(this,"n21","n12");a(this,"n31","n13");a(this,"n32","n23");a(this,"n41","n14");a(this,"n42","n24");a(this,"n43","n34");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(){var a=this.flat;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},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]=
 a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){var a=this.flat;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},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]=
@@ -59,8 +59,8 @@ THREE.Geometry.prototype={computeCentroids:function(){var a,b,c;a=0;for(b=this.f
 c.centroid.addSelf(this.vertices[c.d].position);c.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var b,c,d,f,g,h,k=new THREE.Vector3,j=new THREE.Vector3;d=0;for(f=this.vertices.length;d<f;d++){g=this.vertices[d];g.normal.set(0,0,0)}d=0;for(f=this.faces.length;d<f;d++){g=this.faces[d];if(a&&g.vertexNormals.length){k.set(0,0,0);b=0;for(c=g.normal.length;b<c;b++)k.addSelf(g.vertexNormals[b]);k.divideScalar(3)}else{b=this.vertices[g.a];c=this.vertices[g.b];h=this.vertices[g.c];k.sub(h.position,
 c.centroid.addSelf(this.vertices[c.d].position);c.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var b,c,d,f,g,h,k=new THREE.Vector3,j=new THREE.Vector3;d=0;for(f=this.vertices.length;d<f;d++){g=this.vertices[d];g.normal.set(0,0,0)}d=0;for(f=this.faces.length;d<f;d++){g=this.faces[d];if(a&&g.vertexNormals.length){k.set(0,0,0);b=0;for(c=g.normal.length;b<c;b++)k.addSelf(g.vertexNormals[b]);k.divideScalar(3)}else{b=this.vertices[g.a];c=this.vertices[g.b];h=this.vertices[g.c];k.sub(h.position,
 c.position);j.sub(b.position,c.position);k.crossSelf(j)}k.isZero()||k.normalize();g.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,
 c.position);j.sub(b.position,c.position);k.crossSelf(j)}k.isZero()||k.normalize();g.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=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<
 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]);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(G,T,la,W,ja,ia,$){g=G.vertices[T].position;h=G.vertices[la].position;k=G.vertices[W].position;j=f[ja];m=f[ia];o=f[$];w=h.x-g.x;u=k.x-g.x;t=h.y-g.y;x=k.y-
-g.y;A=h.z-g.z;F=k.z-g.z;v=m.u-j.u;H=o.u-j.u;q=m.v-j.v;J=o.v-j.v;e=1/(v*J-H*q);M.set((J*w-q*u)*e,(J*t-q*x)*e,(J*A-q*F)*e);V.set((v*u-H*w)*e,(v*x-H*t)*e,(v*F-H*A)*e);ba[T].addSelf(M);ba[la].addSelf(M);ba[W].addSelf(M);L[T].addSelf(V);L[la].addSelf(V);L[W].addSelf(V)}var b,c,d,f,g,h,k,j,m,o,w,u,t,x,A,F,v,H,q,J,e,ba=[],L=[],M=new THREE.Vector3,V=new THREE.Vector3,S=new THREE.Vector3,Y=new THREE.Vector3,Z=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++){ba[b]=new THREE.Vector3;L[b]=new THREE.Vector3}b=
+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(G,U,na,W,ka,ia,$){g=G.vertices[U].position;h=G.vertices[na].position;k=G.vertices[W].position;j=f[ka];m=f[ia];o=f[$];w=h.x-g.x;u=k.x-g.x;t=h.y-g.y;x=k.y-
+g.y;A=h.z-g.z;F=k.z-g.z;v=m.u-j.u;I=o.u-j.u;q=m.v-j.v;J=o.v-j.v;e=1/(v*J-I*q);M.set((J*w-q*u)*e,(J*t-q*x)*e,(J*A-q*F)*e);V.set((v*u-I*w)*e,(v*x-I*t)*e,(v*F-I*A)*e);ba[U].addSelf(M);ba[na].addSelf(M);ba[W].addSelf(M);L[U].addSelf(V);L[na].addSelf(V);L[W].addSelf(V)}var b,c,d,f,g,h,k,j,m,o,w,u,t,x,A,F,v,I,q,J,e,ba=[],L=[],M=new THREE.Vector3,V=new THREE.Vector3,S=new THREE.Vector3,Y=new THREE.Vector3,Z=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++){ba[b]=new THREE.Vector3;L[b]=new THREE.Vector3}b=
 0;for(c=this.faces.length;b<c;b++){d=this.faces[b];f=this.uvs[b];if(d instanceof THREE.Face3){a(this,d.a,d.b,d.c,0,1,2);this.vertices[d.a].normal.copy(d.vertexNormals[0]);this.vertices[d.b].normal.copy(d.vertexNormals[1]);this.vertices[d.c].normal.copy(d.vertexNormals[2])}else if(d instanceof THREE.Face4){a(this,d.a,d.b,d.c,0,1,2);a(this,d.a,d.b,d.d,0,1,3);this.vertices[d.a].normal.copy(d.vertexNormals[0]);this.vertices[d.b].normal.copy(d.vertexNormals[1]);this.vertices[d.c].normal.copy(d.vertexNormals[2]);
 0;for(c=this.faces.length;b<c;b++){d=this.faces[b];f=this.uvs[b];if(d instanceof THREE.Face3){a(this,d.a,d.b,d.c,0,1,2);this.vertices[d.a].normal.copy(d.vertexNormals[0]);this.vertices[d.b].normal.copy(d.vertexNormals[1]);this.vertices[d.c].normal.copy(d.vertexNormals[2])}else if(d instanceof THREE.Face4){a(this,d.a,d.b,d.c,0,1,2);a(this,d.a,d.b,d.d,0,1,3);this.vertices[d.a].normal.copy(d.vertexNormals[0]);this.vertices[d.b].normal.copy(d.vertexNormals[1]);this.vertices[d.c].normal.copy(d.vertexNormals[2]);
 this.vertices[d.d].normal.copy(d.vertexNormals[3])}}b=0;for(c=this.vertices.length;b<c;b++){Z.copy(this.vertices[b].normal);d=ba[b];S.copy(d);S.subSelf(Z.multiplyScalar(Z.dot(d))).normalize();Y.cross(this.vertices[b].normal,d);d=Y.dot(L[b]);d=d<0?-1:1;this.vertices[b].tangent.set(S.x,S.y,S.z,d)}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],
 this.vertices[d.d].normal.copy(d.vertexNormals[3])}}b=0;for(c=this.vertices.length;b<c;b++){Z.copy(this.vertices[b].normal);d=ba[b];S.copy(d);S.subSelf(Z.multiplyScalar(Z.dot(d))).normalize();Y.cross(this.vertices[b].normal,d);d=Y.dot(L[b]);d=d<0?-1:1;this.vertices[b].tangent.set(S.x,S.y,S.z,d)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],
 z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,c=this.vertices.length;b<c;b++){a=this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>
 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>
@@ -83,6 +83,7 @@ THREE.SkinnedMesh.prototype.update=function(a,b,c){if(this.visible){this.autoUpd
 THREE.SkinnedMesh.prototype.addBone=function(a){a===undefined&&(a=new THREE.Bone(this));this.bones.push(a);return a};
 THREE.SkinnedMesh.prototype.addBone=function(a){a===undefined&&(a=new THREE.Bone(this));this.bones.push(a);return a};
 THREE.SkinnedMesh.prototype.pose=function(){this.update(undefined,!0);for(var a,b=[],c=0;c<this.bones.length;c++){a=this.bones[c];b.push(THREE.Matrix4.makeInvert(a.skinMatrix));a.skinMatrix.flattenToArrayOffset(this.boneMatrices,c*16)}if(this.geometry.skinVerticesA===undefined){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];var d;for(a=0;a<this.geometry.skinIndices.length;a++){c=this.geometry.vertices[a].position;var f=this.geometry.skinIndices[a].x,g=this.geometry.skinIndices[a].y;
 THREE.SkinnedMesh.prototype.pose=function(){this.update(undefined,!0);for(var a,b=[],c=0;c<this.bones.length;c++){a=this.bones[c];b.push(THREE.Matrix4.makeInvert(a.skinMatrix));a.skinMatrix.flattenToArrayOffset(this.boneMatrices,c*16)}if(this.geometry.skinVerticesA===undefined){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];var d;for(a=0;a<this.geometry.skinIndices.length;a++){c=this.geometry.vertices[a].position;var f=this.geometry.skinIndices[a].x,g=this.geometry.skinIndices[a].y;
 d=new THREE.Vector3(c.x,c.y,c.z);this.geometry.skinVerticesA.push(b[f].multiplyVector3(d));d=new THREE.Vector3(c.x,c.y,c.z);this.geometry.skinVerticesB.push(b[g].multiplyVector3(d));if(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y!==1){c=(1-(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y))*0.5;this.geometry.skinWeights[a].x+=c;this.geometry.skinWeights[a].y+=c}}}};
 d=new THREE.Vector3(c.x,c.y,c.z);this.geometry.skinVerticesA.push(b[f].multiplyVector3(d));d=new THREE.Vector3(c.x,c.y,c.z);this.geometry.skinVerticesB.push(b[g].multiplyVector3(d));if(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y!==1){c=(1-(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y))*0.5;this.geometry.skinWeights[a].x+=c;this.geometry.skinWeights[a].y+=c}}}};
+THREE.Ribbon=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.flipSided=!1;this.doubleSided=!1};THREE.Ribbon.prototype=new THREE.Object3D;THREE.Ribbon.prototype.constructor=THREE.Ribbon;
 THREE.AnimationHandler=function(){var a=[],b={};b.update=function(c){for(var d=0;d<a.length;d++)a[d].update(c)};b.add=function(c){a.indexOf(c)===-1&&a.push(c)};b.remove=function(c){a.indexOf(c)!==-1&&a.splice(childIndex,1)};b.initData=function(c){if(c.initialized!==!0){for(var d=0;d<c.hierarchy.length;d++)for(var f=0;f<c.hierarchy[d].keys.length;f++){if(c.hierarchy[d].keys[f].time<0)c.hierarchy[d].keys[f].time=0;c.hierarchy[d].keys[f].index=f;if(c.hierarchy[d].keys[f].rot!==undefined&&!(c.hierarchy[d].keys[f].rot instanceof
 THREE.AnimationHandler=function(){var a=[],b={};b.update=function(c){for(var d=0;d<a.length;d++)a[d].update(c)};b.add=function(c){a.indexOf(c)===-1&&a.push(c)};b.remove=function(c){a.indexOf(c)!==-1&&a.splice(childIndex,1)};b.initData=function(c){if(c.initialized!==!0){for(var d=0;d<c.hierarchy.length;d++)for(var f=0;f<c.hierarchy[d].keys.length;f++){if(c.hierarchy[d].keys[f].time<0)c.hierarchy[d].keys[f].time=0;c.hierarchy[d].keys[f].index=f;if(c.hierarchy[d].keys[f].rot!==undefined&&!(c.hierarchy[d].keys[f].rot instanceof
 THREE.Quaternion)){var g=c.hierarchy[d].keys[f].rot;c.hierarchy[d].keys[f].rot=new THREE.Quaternion(g[0],g[1],g[2],g[3])}}f=parseInt(c.length*c.fps,10);c.JIT={};c.JIT.hierarchy=[];for(d=0;d<c.hierarchy.length;d++)c.JIT.hierarchy.push(Array(f));c.initialized=!0}};return b}();
 THREE.Quaternion)){var g=c.hierarchy[d].keys[f].rot;c.hierarchy[d].keys[f].rot=new THREE.Quaternion(g[0],g[1],g[2],g[3])}}f=parseInt(c.length*c.fps,10);c.JIT={};c.JIT.hierarchy=[];for(d=0;d<c.hierarchy.length;d++)c.JIT.hierarchy.push(Array(f));c.initialized=!0}};return b}();
 THREE.Animation=function(a,b){this.root=a;this.data=b;this.hierarchy=[];this.startTime=0;this.isPlaying=!1;this.loop=!0;this.offset=0;this.data.initialized||THREE.AnimationHandler.initData(this.data);if(a instanceof THREE.SkinnedMesh)for(var c=0;c<this.root.bones.length;c++)this.hierarchy.push(this.root.bones[c])};
 THREE.Animation=function(a,b){this.root=a;this.data=b;this.hierarchy=[];this.startTime=0;this.isPlaying=!1;this.loop=!0;this.offset=0;this.data.initialized||THREE.AnimationHandler.initData(this.data);if(a instanceof THREE.SkinnedMesh)for(var c=0;c<this.root.bones.length;c++)this.hierarchy.push(this.root.bones[c])};
@@ -141,120 +142,122 @@ THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=f
 THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else a instanceof THREE.Camera||a instanceof THREE.Bone||this.objects.indexOf(a)===-1&&this.objects.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.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else a instanceof THREE.Camera||a instanceof THREE.Bone||this.objects.indexOf(a)===-1&&this.objects.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.Camera)){b=this.objects.indexOf(a);b!==-1&&this.objects.splice(b,1)}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.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.Camera)){b=this.objects.indexOf(a);b!==-1&&this.objects.splice(b,1)}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.Fog=function(a,b,c){this.color=new THREE.Color(a);this.near=b||1;this.far=c||1E3};THREE.FogExp2=function(a,b){this.color=new THREE.Color(a);this.density=b||2.5E-4};
 THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;THREE.Fog=function(a,b,c){this.color=new THREE.Color(a);this.near=b||1;this.far=c||1E3};THREE.FogExp2=function(a,b){this.color=new THREE.Color(a);this.density=b||2.5E-4};
-THREE.Projector=function(){function a(L,M){return M.z-L.z}function b(L,M){var V=0,S=1,Y=L.z+L.w,Z=M.z+M.w,G=-L.z+L.w,T=-M.z+M.w;if(Y>=0&&Z>=0&&G>=0&&T>=0)return!0;else if(Y<0&&Z<0||G<0&&T<0)return!1;else{if(Y<0)V=Math.max(V,Y/(Y-Z));else Z<0&&(S=Math.min(S,Y/(Y-Z)));if(G<0)V=Math.max(V,G/(G-T));else T<0&&(S=Math.min(S,G/(G-T)));if(S<V)return!1;else{L.lerpSelf(M,V);M.lerpSelf(L,1-S);return!0}}}var c,d,f=[],g,h,k,j=[],m,o,w=[],u,t,x=[],A=new THREE.Vector4,F=new THREE.Vector4,v=new THREE.Matrix4,H=new THREE.Matrix4,
-q=[],J=new THREE.Vector4,e=new THREE.Vector4,ba;this.projectObjects=function(L,M,V){M=[];var S,Y,Z;d=0;Y=L.objects;L=0;for(S=Y.length;L<S;L++){Z=Y[L];var G;if(!(G=!Z.visible))if(G=Z instanceof THREE.Mesh){a:{G=void 0;for(var T=Z.globalMatrix,la=-Z.geometry.boundingSphere.radius*Math.max(Z.scale.x,Math.max(Z.scale.y,Z.scale.z)),W=0;W<6;W++){G=q[W].x*T.n14+q[W].y*T.n24+q[W].z*T.n34+q[W].w;if(G<=la){G=!1;break a}}G=!0}G=!G}if(!G){c=f[d]=f[d]||new THREE.RenderableObject;A.copy(Z.position);v.multiplyVector3(A);
-c.object=Z;c.z=A.z;M.push(c);d++}}V&&M.sort(a);return M};this.projectScene=function(L,M,V){var S=[],Y=M.near,Z=M.far,G,T,la,W,ja,ia,$,ra,ya,l,z,B,p,n,E,I;k=o=t=0;M.autoUpdateMatrix&&M.update();v.multiply(M.projectionMatrix,M.globalMatrix);q[0]=new THREE.Vector4(v.n41-v.n11,v.n42-v.n12,v.n43-v.n13,v.n44-v.n14);q[1]=new THREE.Vector4(v.n41+v.n11,v.n42+v.n12,v.n43+v.n13,v.n44+v.n14);q[2]=new THREE.Vector4(v.n41+v.n21,v.n42+v.n22,v.n43+v.n23,v.n44+v.n24);q[3]=new THREE.Vector4(v.n41-v.n21,v.n42-v.n22,
+THREE.Projector=function(){function a(L,M){return M.z-L.z}function b(L,M){var V=0,S=1,Y=L.z+L.w,Z=M.z+M.w,G=-L.z+L.w,U=-M.z+M.w;if(Y>=0&&Z>=0&&G>=0&&U>=0)return!0;else if(Y<0&&Z<0||G<0&&U<0)return!1;else{if(Y<0)V=Math.max(V,Y/(Y-Z));else Z<0&&(S=Math.min(S,Y/(Y-Z)));if(G<0)V=Math.max(V,G/(G-U));else U<0&&(S=Math.min(S,G/(G-U)));if(S<V)return!1;else{L.lerpSelf(M,V);M.lerpSelf(L,1-S);return!0}}}var c,d,f=[],g,h,k,j=[],m,o,w=[],u,t,x=[],A=new THREE.Vector4,F=new THREE.Vector4,v=new THREE.Matrix4,I=new THREE.Matrix4,
+q=[],J=new THREE.Vector4,e=new THREE.Vector4,ba;this.projectObjects=function(L,M,V){M=[];var S,Y,Z;d=0;Y=L.objects;L=0;for(S=Y.length;L<S;L++){Z=Y[L];var G;if(!(G=!Z.visible))if(G=Z instanceof THREE.Mesh){a:{G=void 0;for(var U=Z.globalMatrix,na=-Z.geometry.boundingSphere.radius*Math.max(Z.scale.x,Math.max(Z.scale.y,Z.scale.z)),W=0;W<6;W++){G=q[W].x*U.n14+q[W].y*U.n24+q[W].z*U.n34+q[W].w;if(G<=na){G=!1;break a}}G=!0}G=!G}if(!G){c=f[d]=f[d]||new THREE.RenderableObject;A.copy(Z.position);v.multiplyVector3(A);
+c.object=Z;c.z=A.z;M.push(c);d++}}V&&M.sort(a);return M};this.projectScene=function(L,M,V){var S=[],Y=M.near,Z=M.far,G,U,na,W,ka,ia,$,ra,ya,l,z,C,p,n,B,H;k=o=t=0;M.autoUpdateMatrix&&M.update();v.multiply(M.projectionMatrix,M.globalMatrix);q[0]=new THREE.Vector4(v.n41-v.n11,v.n42-v.n12,v.n43-v.n13,v.n44-v.n14);q[1]=new THREE.Vector4(v.n41+v.n11,v.n42+v.n12,v.n43+v.n13,v.n44+v.n14);q[2]=new THREE.Vector4(v.n41+v.n21,v.n42+v.n22,v.n43+v.n23,v.n44+v.n24);q[3]=new THREE.Vector4(v.n41-v.n21,v.n42-v.n22,
 v.n43-v.n23,v.n44-v.n24);q[4]=new THREE.Vector4(v.n41-v.n31,v.n42-v.n32,v.n43-v.n33,v.n44-v.n34);q[5]=new THREE.Vector4(v.n41+v.n31,v.n42+v.n32,v.n43+v.n33,v.n44+v.n34);G=0;for(ia=q.length;G<ia;G++){$=q[G];$.divideScalar(Math.sqrt($.x*$.x+$.y*$.y+$.z*$.z))}L.update(undefined,!1,M);ia=this.projectObjects(L,M,!0);L=0;for(G=ia.length;L<G;L++){$=ia[L].object;if($.visible){$.autoUpdateMatrix&&$.updateMatrix();ra=$.globalMatrix;ra.extractRotationMatrix($.rotationMatrix);z=$.rotationMatrix;ya=$.materials;
 v.n43-v.n23,v.n44-v.n24);q[4]=new THREE.Vector4(v.n41-v.n31,v.n42-v.n32,v.n43-v.n33,v.n44-v.n34);q[5]=new THREE.Vector4(v.n41+v.n31,v.n42+v.n32,v.n43+v.n33,v.n44+v.n34);G=0;for(ia=q.length;G<ia;G++){$=q[G];$.divideScalar(Math.sqrt($.x*$.x+$.y*$.y+$.z*$.z))}L.update(undefined,!1,M);ia=this.projectObjects(L,M,!0);L=0;for(G=ia.length;L<G;L++){$=ia[L].object;if($.visible){$.autoUpdateMatrix&&$.updateMatrix();ra=$.globalMatrix;ra.extractRotationMatrix($.rotationMatrix);z=$.rotationMatrix;ya=$.materials;
-l=$.overdraw;if($ instanceof THREE.Mesh){B=$.geometry;p=B.vertices;T=0;for(la=p.length;T<la;T++){n=p[T];n.positionWorld.copy(n.position);ra.multiplyVector3(n.positionWorld);W=n.positionScreen;W.copy(n.positionWorld);v.multiplyVector4(W);W.x/=W.w;W.y/=W.w;n.__visible=W.z>Y&&W.z<Z}B=B.faces;T=0;for(la=B.length;T<la;T++){n=B[T];if(n instanceof THREE.Face3){W=p[n.a];ja=p[n.b];E=p[n.c];if(W.__visible&&ja.__visible&&E.__visible&&($.doubleSided||$.flipSided!=(E.positionScreen.x-W.positionScreen.x)*(ja.positionScreen.y-
-W.positionScreen.y)-(E.positionScreen.y-W.positionScreen.y)*(ja.positionScreen.x-W.positionScreen.x)<0)){g=j[k]=j[k]||new THREE.RenderableFace3;g.v1.positionWorld.copy(W.positionWorld);g.v2.positionWorld.copy(ja.positionWorld);g.v3.positionWorld.copy(E.positionWorld);g.v1.positionScreen.copy(W.positionScreen);g.v2.positionScreen.copy(ja.positionScreen);g.v3.positionScreen.copy(E.positionScreen);g.normalWorld.copy(n.normal);z.multiplyVector3(g.normalWorld);g.centroidWorld.copy(n.centroid);ra.multiplyVector3(g.centroidWorld);
-g.centroidScreen.copy(g.centroidWorld);v.multiplyVector3(g.centroidScreen);E=n.vertexNormals;ba=g.vertexNormalsWorld;W=0;for(ja=E.length;W<ja;W++){I=ba[W]=ba[W]||new THREE.Vector3;I.copy(E[W]);z.multiplyVector3(I)}g.z=g.centroidScreen.z;g.meshMaterials=ya;g.faceMaterials=n.materials;g.overdraw=l;if($.geometry.uvs[T]){g.uvs[0]=$.geometry.uvs[T][0];g.uvs[1]=$.geometry.uvs[T][1];g.uvs[2]=$.geometry.uvs[T][2]}S.push(g);k++}}else if(n instanceof THREE.Face4){W=p[n.a];ja=p[n.b];E=p[n.c];I=p[n.d];if(W.__visible&&
-ja.__visible&&E.__visible&&I.__visible&&($.doubleSided||$.flipSided!=((I.positionScreen.x-W.positionScreen.x)*(ja.positionScreen.y-W.positionScreen.y)-(I.positionScreen.y-W.positionScreen.y)*(ja.positionScreen.x-W.positionScreen.x)<0||(ja.positionScreen.x-E.positionScreen.x)*(I.positionScreen.y-E.positionScreen.y)-(ja.positionScreen.y-E.positionScreen.y)*(I.positionScreen.x-E.positionScreen.x)<0))){g=j[k]=j[k]||new THREE.RenderableFace3;g.v1.positionWorld.copy(W.positionWorld);g.v2.positionWorld.copy(ja.positionWorld);
-g.v3.positionWorld.copy(I.positionWorld);g.v1.positionScreen.copy(W.positionScreen);g.v2.positionScreen.copy(ja.positionScreen);g.v3.positionScreen.copy(I.positionScreen);g.normalWorld.copy(n.normal);z.multiplyVector3(g.normalWorld);g.centroidWorld.copy(n.centroid);ra.multiplyVector3(g.centroidWorld);g.centroidScreen.copy(g.centroidWorld);v.multiplyVector3(g.centroidScreen);g.z=g.centroidScreen.z;g.meshMaterials=ya;g.faceMaterials=n.materials;g.overdraw=l;if($.geometry.uvs[T]){g.uvs[0]=$.geometry.uvs[T][0];
-g.uvs[1]=$.geometry.uvs[T][1];g.uvs[2]=$.geometry.uvs[T][3]}S.push(g);k++;h=j[k]=j[k]||new THREE.RenderableFace3;h.v1.positionWorld.copy(ja.positionWorld);h.v2.positionWorld.copy(E.positionWorld);h.v3.positionWorld.copy(I.positionWorld);h.v1.positionScreen.copy(ja.positionScreen);h.v2.positionScreen.copy(E.positionScreen);h.v3.positionScreen.copy(I.positionScreen);h.normalWorld.copy(g.normalWorld);h.centroidWorld.copy(g.centroidWorld);h.centroidScreen.copy(g.centroidScreen);h.z=h.centroidScreen.z;
-h.meshMaterials=ya;h.faceMaterials=n.materials;h.overdraw=l;if($.geometry.uvs[T]){h.uvs[0]=$.geometry.uvs[T][1];h.uvs[1]=$.geometry.uvs[T][2];h.uvs[2]=$.geometry.uvs[T][3]}S.push(h);k++}}}}else if($ instanceof THREE.Line){H.multiply(v,ra);p=$.geometry.vertices;n=p[0];n.positionScreen.copy(n.position);H.multiplyVector4(n.positionScreen);T=1;for(la=p.length;T<la;T++){W=p[T];W.positionScreen.copy(W.position);H.multiplyVector4(W.positionScreen);ja=p[T-1];J.copy(W.positionScreen);e.copy(ja.positionScreen);
+l=$.overdraw;if($ instanceof THREE.Mesh){C=$.geometry;p=C.vertices;U=0;for(na=p.length;U<na;U++){n=p[U];n.positionWorld.copy(n.position);ra.multiplyVector3(n.positionWorld);W=n.positionScreen;W.copy(n.positionWorld);v.multiplyVector4(W);W.x/=W.w;W.y/=W.w;n.__visible=W.z>Y&&W.z<Z}C=C.faces;U=0;for(na=C.length;U<na;U++){n=C[U];if(n instanceof THREE.Face3){W=p[n.a];ka=p[n.b];B=p[n.c];if(W.__visible&&ka.__visible&&B.__visible&&($.doubleSided||$.flipSided!=(B.positionScreen.x-W.positionScreen.x)*(ka.positionScreen.y-
+W.positionScreen.y)-(B.positionScreen.y-W.positionScreen.y)*(ka.positionScreen.x-W.positionScreen.x)<0)){g=j[k]=j[k]||new THREE.RenderableFace3;g.v1.positionWorld.copy(W.positionWorld);g.v2.positionWorld.copy(ka.positionWorld);g.v3.positionWorld.copy(B.positionWorld);g.v1.positionScreen.copy(W.positionScreen);g.v2.positionScreen.copy(ka.positionScreen);g.v3.positionScreen.copy(B.positionScreen);g.normalWorld.copy(n.normal);z.multiplyVector3(g.normalWorld);g.centroidWorld.copy(n.centroid);ra.multiplyVector3(g.centroidWorld);
+g.centroidScreen.copy(g.centroidWorld);v.multiplyVector3(g.centroidScreen);B=n.vertexNormals;ba=g.vertexNormalsWorld;W=0;for(ka=B.length;W<ka;W++){H=ba[W]=ba[W]||new THREE.Vector3;H.copy(B[W]);z.multiplyVector3(H)}g.z=g.centroidScreen.z;g.meshMaterials=ya;g.faceMaterials=n.materials;g.overdraw=l;if($.geometry.uvs[U]){g.uvs[0]=$.geometry.uvs[U][0];g.uvs[1]=$.geometry.uvs[U][1];g.uvs[2]=$.geometry.uvs[U][2]}S.push(g);k++}}else if(n instanceof THREE.Face4){W=p[n.a];ka=p[n.b];B=p[n.c];H=p[n.d];if(W.__visible&&
+ka.__visible&&B.__visible&&H.__visible&&($.doubleSided||$.flipSided!=((H.positionScreen.x-W.positionScreen.x)*(ka.positionScreen.y-W.positionScreen.y)-(H.positionScreen.y-W.positionScreen.y)*(ka.positionScreen.x-W.positionScreen.x)<0||(ka.positionScreen.x-B.positionScreen.x)*(H.positionScreen.y-B.positionScreen.y)-(ka.positionScreen.y-B.positionScreen.y)*(H.positionScreen.x-B.positionScreen.x)<0))){g=j[k]=j[k]||new THREE.RenderableFace3;g.v1.positionWorld.copy(W.positionWorld);g.v2.positionWorld.copy(ka.positionWorld);
+g.v3.positionWorld.copy(H.positionWorld);g.v1.positionScreen.copy(W.positionScreen);g.v2.positionScreen.copy(ka.positionScreen);g.v3.positionScreen.copy(H.positionScreen);g.normalWorld.copy(n.normal);z.multiplyVector3(g.normalWorld);g.centroidWorld.copy(n.centroid);ra.multiplyVector3(g.centroidWorld);g.centroidScreen.copy(g.centroidWorld);v.multiplyVector3(g.centroidScreen);g.z=g.centroidScreen.z;g.meshMaterials=ya;g.faceMaterials=n.materials;g.overdraw=l;if($.geometry.uvs[U]){g.uvs[0]=$.geometry.uvs[U][0];
+g.uvs[1]=$.geometry.uvs[U][1];g.uvs[2]=$.geometry.uvs[U][3]}S.push(g);k++;h=j[k]=j[k]||new THREE.RenderableFace3;h.v1.positionWorld.copy(ka.positionWorld);h.v2.positionWorld.copy(B.positionWorld);h.v3.positionWorld.copy(H.positionWorld);h.v1.positionScreen.copy(ka.positionScreen);h.v2.positionScreen.copy(B.positionScreen);h.v3.positionScreen.copy(H.positionScreen);h.normalWorld.copy(g.normalWorld);h.centroidWorld.copy(g.centroidWorld);h.centroidScreen.copy(g.centroidScreen);h.z=h.centroidScreen.z;
+h.meshMaterials=ya;h.faceMaterials=n.materials;h.overdraw=l;if($.geometry.uvs[U]){h.uvs[0]=$.geometry.uvs[U][1];h.uvs[1]=$.geometry.uvs[U][2];h.uvs[2]=$.geometry.uvs[U][3]}S.push(h);k++}}}}else if($ instanceof THREE.Line){I.multiply(v,ra);p=$.geometry.vertices;n=p[0];n.positionScreen.copy(n.position);I.multiplyVector4(n.positionScreen);U=1;for(na=p.length;U<na;U++){W=p[U];W.positionScreen.copy(W.position);I.multiplyVector4(W.positionScreen);ka=p[U-1];J.copy(W.positionScreen);e.copy(ka.positionScreen);
 if(b(J,e)){J.multiplyScalar(1/J.w);e.multiplyScalar(1/e.w);m=w[o]=w[o]||new THREE.RenderableLine;m.v1.positionScreen.copy(J);m.v2.positionScreen.copy(e);m.z=Math.max(J.z,e.z);m.materials=$.materials;S.push(m);o++}}}else if($ instanceof THREE.Particle){F.set($.position.x,$.position.y,$.position.z,1);v.multiplyVector4(F);F.z/=F.w;if(F.z>0&&F.z<1){u=x[t]=x[t]||new THREE.RenderableParticle;u.x=F.x/F.w;u.y=F.y/F.w;u.z=F.z;u.rotation=$.rotation.z;u.scale.x=$.scale.x*Math.abs(u.x-(F.x+M.projectionMatrix.n11)/
 if(b(J,e)){J.multiplyScalar(1/J.w);e.multiplyScalar(1/e.w);m=w[o]=w[o]||new THREE.RenderableLine;m.v1.positionScreen.copy(J);m.v2.positionScreen.copy(e);m.z=Math.max(J.z,e.z);m.materials=$.materials;S.push(m);o++}}}else if($ instanceof THREE.Particle){F.set($.position.x,$.position.y,$.position.z,1);v.multiplyVector4(F);F.z/=F.w;if(F.z>0&&F.z<1){u=x[t]=x[t]||new THREE.RenderableParticle;u.x=F.x/F.w;u.y=F.y/F.w;u.z=F.z;u.rotation=$.rotation.z;u.scale.x=$.scale.x*Math.abs(u.x-(F.x+M.projectionMatrix.n11)/
 (F.w+M.projectionMatrix.n14));u.scale.y=$.scale.y*Math.abs(u.y-(F.y+M.projectionMatrix.n22)/(F.w+M.projectionMatrix.n24));u.materials=$.materials;S.push(u);t++}}}}V&&S.sort(a);return S};this.unprojectVector=function(L,M){var V=THREE.Matrix4.makeInvert(M.globalMatrix);V.multiplySelf(THREE.Matrix4.makeInvert(M.projectionMatrix));V.multiplyVector3(L);return L}};
 (F.w+M.projectionMatrix.n14));u.scale.y=$.scale.y*Math.abs(u.y-(F.y+M.projectionMatrix.n22)/(F.w+M.projectionMatrix.n24));u.materials=$.materials;S.push(u);t++}}}}V&&S.sort(a);return S};this.unprojectVector=function(L,M){var V=THREE.Matrix4.makeInvert(M.globalMatrix);V.multiplySelf(THREE.Matrix4.makeInvert(M.projectionMatrix));V.multiplyVector3(L);return L}};
 THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,c,d,f,g;this.domElement=document.createElement("div");this.setSize=function(h,k){c=h;d=k;f=c/2;g=d/2};this.render=function(h,k){var j,m,o,w,u,t,x,A;a=b.projectScene(h,k);j=0;for(m=a.length;j<m;j++){u=a[j];if(u instanceof THREE.RenderableParticle){x=u.x*f+f;A=u.y*g+g;o=0;for(w=u.material.length;o<w;o++){t=u.material[o];if(t instanceof THREE.ParticleDOMMaterial){t=t.domElement;t.style.left=x+"px";t.style.top=A+"px"}}}}}};
 THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,c,d,f,g;this.domElement=document.createElement("div");this.setSize=function(h,k){c=h;d=k;f=c/2;g=d/2};this.render=function(h,k){var j,m,o,w,u,t,x,A;a=b.projectScene(h,k);j=0;for(m=a.length;j<m;j++){u=a[j];if(u instanceof THREE.RenderableParticle){x=u.x*f+f;A=u.y*g+g;o=0;for(w=u.material.length;o<w;o++){t=u.material[o];if(t instanceof THREE.ParticleDOMMaterial){t=t.domElement;t.style.left=x+"px";t.style.top=A+"px"}}}}}};
-THREE.CanvasRenderer=function(){function a(sa){if(u!=sa)m.globalAlpha=u=sa}function b(sa){if(t!=sa){switch(sa){case THREE.NormalBlending:m.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:m.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:m.globalCompositeOperation="darker"}t=sa}}var c=null,d=new THREE.Projector,f=document.createElement("canvas"),g,h,k,j,m=f.getContext("2d"),o=new THREE.Color(0),w=0,u=1,t=0,x=null,A=null,F=1,v,H,q,J,e,ba,L,M,V,S=new THREE.Color,
-Y=new THREE.Color,Z=new THREE.Color,G=new THREE.Color,T=new THREE.Color,la,W,ja,ia,$,ra,ya,l,z,B=new THREE.Rectangle,p=new THREE.Rectangle,n=new THREE.Rectangle,E=!1,I=new THREE.Color,P=new THREE.Color,da=new THREE.Color,y=new THREE.Color,C=Math.PI*2,D=new THREE.Vector3,Q,U,pa,ka,ma,na,oa=16;Q=document.createElement("canvas");Q.width=Q.height=2;U=Q.getContext("2d");U.fillStyle="rgba(0,0,0,1)";U.fillRect(0,0,2,2);pa=U.getImageData(0,0,2,2);ka=pa.data;ma=document.createElement("canvas");ma.width=ma.height=
-oa;na=ma.getContext("2d");na.translate(-oa/2,-oa/2);na.scale(oa,oa);oa--;this.domElement=f;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setSize=function(sa,N){g=sa;h=N;k=g/2;j=h/2;f.width=g;f.height=h;B.set(-k,-j,k,j);u=1;t=0;A=x=null;F=1};this.setClearColor=function(sa,N){o=sa;w=N;p.set(-k,-j,k,j);m.setTransform(1,0,0,-1,k,j);this.clear()};this.setClearColorHex=function(sa,N){o.setHex(sa);w=N;p.set(-k,-j,k,j);m.setTransform(1,0,0,-1,k,j);this.clear()};this.clear=function(){m.setTransform(1,
-0,0,-1,k,j);if(!p.isEmpty()){p.inflate(1);p.minSelf(B);if(o.hex==0&&w==0)m.clearRect(p.getX(),p.getY(),p.getWidth(),p.getHeight());else{b(THREE.NormalBlending);a(1);m.fillStyle="rgba("+Math.floor(o.r*255)+","+Math.floor(o.g*255)+","+Math.floor(o.b*255)+","+w+")";m.fillRect(p.getX(),p.getY(),p.getWidth(),p.getHeight())}p.empty()}};this.render=function(sa,N){function Ia(O){var fa,ga,R,ea=O.lights;P.setRGB(0,0,0);da.setRGB(0,0,0);y.setRGB(0,0,0);O=0;for(fa=ea.length;O<fa;O++){ga=ea[O];R=ga.color;if(ga instanceof
-THREE.AmbientLight){P.r+=R.r;P.g+=R.g;P.b+=R.b}else if(ga instanceof THREE.DirectionalLight){da.r+=R.r;da.g+=R.g;da.b+=R.b}else if(ga instanceof THREE.PointLight){y.r+=R.r;y.g+=R.g;y.b+=R.b}}}function Ca(O,fa,ga,R){var ea,qa,Aa,Ga,Ha=O.lights;O=0;for(ea=Ha.length;O<ea;O++){qa=Ha[O];Aa=qa.color;Ga=qa.intensity;if(qa instanceof THREE.DirectionalLight){qa=ga.dot(qa.position)*Ga;if(qa>0){R.r+=Aa.r*qa;R.g+=Aa.g*qa;R.b+=Aa.b*qa}}else if(qa instanceof THREE.PointLight){D.sub(qa.position,fa);D.normalize();
-qa=ga.dot(D)*Ga;if(qa>0){R.r+=Aa.r*qa;R.g+=Aa.g*qa;R.b+=Aa.b*qa}}}}function Ja(O,fa,ga){if(ga.opacity!=0){a(ga.opacity);b(ga.blending);var R,ea,qa,Aa,Ga,Ha;if(ga instanceof THREE.ParticleBasicMaterial){if(ga.map&&ga.map.image.loaded){Aa=ga.map.image;Ga=Aa.width>>1;Ha=Aa.height>>1;ea=fa.scale.x*k;qa=fa.scale.y*j;ga=ea*Ga;R=qa*Ha;n.set(O.x-ga,O.y-R,O.x+ga,O.y+R);if(B.instersects(n)){m.save();m.translate(O.x,O.y);m.rotate(-fa.rotation);m.scale(ea,-qa);m.translate(-Ga,-Ha);m.drawImage(Aa,0,0);m.restore()}}}else if(ga instanceof
-THREE.ParticleCircleMaterial){if(E){I.r=P.r+da.r+y.r;I.g=P.g+da.g+y.g;I.b=P.b+da.b+y.b;S.r=ga.color.r*I.r;S.g=ga.color.g*I.g;S.b=ga.color.b*I.b;S.updateStyleString()}else S.__styleString=ga.color.__styleString;ga=fa.scale.x*k;R=fa.scale.y*j;n.set(O.x-ga,O.y-R,O.x+ga,O.y+R);if(B.instersects(n)){ea=S.__styleString;if(A!=ea)m.fillStyle=A=ea;m.save();m.translate(O.x,O.y);m.rotate(-fa.rotation);m.scale(ga,R);m.beginPath();m.arc(0,0,1,0,C,!0);m.closePath();m.fill();m.restore()}}}}function ca(O,fa,ga,R){if(R.opacity!=
-0){a(R.opacity);b(R.blending);m.beginPath();m.moveTo(O.positionScreen.x,O.positionScreen.y);m.lineTo(fa.positionScreen.x,fa.positionScreen.y);m.closePath();if(R instanceof THREE.LineBasicMaterial){S.__styleString=R.color.__styleString;O=R.linewidth;if(F!=O)m.lineWidth=F=O;O=S.__styleString;if(x!=O)m.strokeStyle=x=O;m.stroke();n.inflate(R.linewidth*2)}}}function aa(O,fa,ga,R,ea,qa){if(ea.opacity!=0){a(ea.opacity);b(ea.blending);J=O.positionScreen.x;e=O.positionScreen.y;ba=fa.positionScreen.x;L=fa.positionScreen.y;
-M=ga.positionScreen.x;V=ga.positionScreen.y;m.beginPath();m.moveTo(J,e);m.lineTo(ba,L);m.lineTo(M,V);m.lineTo(J,e);m.closePath();if(ea instanceof THREE.MeshBasicMaterial)if(ea.map)ea.map.image.loaded&&ea.map.mapping instanceof THREE.UVMapping&&Fa(J,e,ba,L,M,V,ea.map.image,R.uvs[0].u,R.uvs[0].v,R.uvs[1].u,R.uvs[1].v,R.uvs[2].u,R.uvs[2].v);else if(ea.env_map){if(ea.env_map.image.loaded&&ea.env_map.mapping instanceof THREE.SphericalReflectionMapping){O=N.globalMatrix;D.copy(R.vertexNormalsWorld[0]);
-ia=(D.x*O.n11+D.y*O.n12+D.z*O.n13)*0.5+0.5;$=-(D.x*O.n21+D.y*O.n22+D.z*O.n23)*0.5+0.5;D.copy(R.vertexNormalsWorld[1]);ra=(D.x*O.n11+D.y*O.n12+D.z*O.n13)*0.5+0.5;ya=-(D.x*O.n21+D.y*O.n22+D.z*O.n23)*0.5+0.5;D.copy(R.vertexNormalsWorld[2]);l=(D.x*O.n11+D.y*O.n12+D.z*O.n13)*0.5+0.5;z=-(D.x*O.n21+D.y*O.n22+D.z*O.n23)*0.5+0.5;Fa(J,e,ba,L,M,V,ea.env_map.image,ia,$,ra,ya,l,z)}}else ea.wireframe?X(ea.color.__styleString,ea.wireframe_linewidth):ta(ea.color.__styleString);else if(ea instanceof THREE.MeshLambertMaterial){if(ea.map&&
-!ea.wireframe){ea.map.mapping instanceof THREE.UVMapping&&Fa(J,e,ba,L,M,V,ea.map.image,R.uvs[0].u,R.uvs[0].v,R.uvs[1].u,R.uvs[1].v,R.uvs[2].u,R.uvs[2].v);b(THREE.SubtractiveBlending)}if(E)if(!ea.wireframe&&ea.shading==THREE.SmoothShading&&R.vertexNormalsWorld.length==3){Y.r=Z.r=G.r=P.r;Y.g=Z.g=G.g=P.g;Y.b=Z.b=G.b=P.b;Ca(qa,R.v1.positionWorld,R.vertexNormalsWorld[0],Y);Ca(qa,R.v2.positionWorld,R.vertexNormalsWorld[1],Z);Ca(qa,R.v3.positionWorld,R.vertexNormalsWorld[2],G);T.r=(Z.r+G.r)*0.5;T.g=(Z.g+
-G.g)*0.5;T.b=(Z.b+G.b)*0.5;ja=Da(Y,Z,G,T);Fa(J,e,ba,L,M,V,ja,0,0,1,0,0,1)}else{I.r=P.r;I.g=P.g;I.b=P.b;Ca(qa,R.centroidWorld,R.normalWorld,I);S.r=ea.color.r*I.r;S.g=ea.color.g*I.g;S.b=ea.color.b*I.b;S.updateStyleString();ea.wireframe?X(S.__styleString,ea.wireframe_linewidth):ta(S.__styleString)}else ea.wireframe?X(ea.color.__styleString,ea.wireframe_linewidth):ta(ea.color.__styleString)}else if(ea instanceof THREE.MeshDepthMaterial){la=N.near;W=N.far;Y.r=Y.g=Y.b=1-K(O.positionScreen.z,la,W);Z.r=Z.g=
-Z.b=1-K(fa.positionScreen.z,la,W);G.r=G.g=G.b=1-K(ga.positionScreen.z,la,W);T.r=(Z.r+G.r)*0.5;T.g=(Z.g+G.g)*0.5;T.b=(Z.b+G.b)*0.5;ja=Da(Y,Z,G,T);Fa(J,e,ba,L,M,V,ja,0,0,1,0,0,1)}else if(ea instanceof THREE.MeshNormalMaterial){S.r=Ea(R.normalWorld.x);S.g=Ea(R.normalWorld.y);S.b=Ea(R.normalWorld.z);S.updateStyleString();ea.wireframe?X(S.__styleString,ea.wireframe_linewidth):ta(S.__styleString)}}}function X(O,fa){if(x!=O)m.strokeStyle=x=O;if(F!=fa)m.lineWidth=F=fa;m.stroke();n.inflate(fa*2)}function ta(O){if(A!=
-O)m.fillStyle=A=O;m.fill()}function Fa(O,fa,ga,R,ea,qa,Aa,Ga,Ha,La,Ba,Ma,Ta){var Na,Oa;Na=Aa.width-1;Oa=Aa.height-1;Ga*=Na;Ha*=Oa;La*=Na;Ba*=Oa;Ma*=Na;Ta*=Oa;ga-=O;R-=fa;ea-=O;qa-=fa;La-=Ga;Ba-=Ha;Ma-=Ga;Ta-=Ha;Na=La*Ta-Ma*Ba;if(Na!=0){Oa=1/Na;Na=(Ta*ga-Ba*ea)*Oa;Ba=(Ta*R-Ba*qa)*Oa;ga=(La*ea-Ma*ga)*Oa;R=(La*qa-Ma*R)*Oa;O=O-Na*Ga-ga*Ha;fa=fa-Ba*Ga-R*Ha;m.save();m.transform(Na,Ba,ga,R,O,fa);m.clip();m.drawImage(Aa,0,0);m.restore()}}function Da(O,fa,ga,R){var ea=~~(O.r*255),qa=~~(O.g*255);O=~~(O.b*255);
-var Aa=~~(fa.r*255),Ga=~~(fa.g*255);fa=~~(fa.b*255);var Ha=~~(ga.r*255),La=~~(ga.g*255);ga=~~(ga.b*255);var Ba=~~(R.r*255),Ma=~~(R.g*255);R=~~(R.b*255);ka[0]=ea<0?0:ea>255?255:ea;ka[1]=qa<0?0:qa>255?255:qa;ka[2]=O<0?0:O>255?255:O;ka[4]=Aa<0?0:Aa>255?255:Aa;ka[5]=Ga<0?0:Ga>255?255:Ga;ka[6]=fa<0?0:fa>255?255:fa;ka[8]=Ha<0?0:Ha>255?255:Ha;ka[9]=La<0?0:La>255?255:La;ka[10]=ga<0?0:ga>255?255:ga;ka[12]=Ba<0?0:Ba>255?255:Ba;ka[13]=Ma<0?0:Ma>255?255:Ma;ka[14]=R<0?0:R>255?255:R;U.putImageData(pa,0,0);na.drawImage(Q,
-0,0);return ma}function K(O,fa,ga){O=(O-fa)/(ga-fa);return O*O*(3-2*O)}function Ea(O){O=(O+1)*0.5;return O<0?0:O>1?1:O}function Ra(O,fa){var ga=fa.x-O.x,R=fa.y-O.y,ea=1/Math.sqrt(ga*ga+R*R);ga*=ea;R*=ea;fa.x+=ga;fa.y+=R;O.x-=ga;O.y-=R}var Pa,Ka,ha,wa,ua,xa,za,va;this.autoClear?this.clear():m.setTransform(1,0,0,-1,k,j);c=d.projectScene(sa,N,this.sortElements);(E=sa.lights.length>0)&&Ia(sa);Pa=0;for(Ka=c.length;Pa<Ka;Pa++){ha=c[Pa];n.empty();if(ha instanceof THREE.RenderableParticle){v=ha;v.x*=k;v.y*=
-j;wa=0;for(ua=ha.materials.length;wa<ua;wa++)Ja(v,ha,ha.materials[wa],sa)}else if(ha instanceof THREE.RenderableLine){v=ha.v1;H=ha.v2;v.positionScreen.x*=k;v.positionScreen.y*=j;H.positionScreen.x*=k;H.positionScreen.y*=j;n.addPoint(v.positionScreen.x,v.positionScreen.y);n.addPoint(H.positionScreen.x,H.positionScreen.y);if(B.instersects(n)){wa=0;for(ua=ha.materials.length;wa<ua;)ca(v,H,ha,ha.materials[wa++],sa)}}else if(ha instanceof THREE.RenderableFace3){v=ha.v1;H=ha.v2;q=ha.v3;v.positionScreen.x*=
-k;v.positionScreen.y*=j;H.positionScreen.x*=k;H.positionScreen.y*=j;q.positionScreen.x*=k;q.positionScreen.y*=j;if(ha.overdraw){Ra(v.positionScreen,H.positionScreen);Ra(H.positionScreen,q.positionScreen);Ra(q.positionScreen,v.positionScreen)}n.add3Points(v.positionScreen.x,v.positionScreen.y,H.positionScreen.x,H.positionScreen.y,q.positionScreen.x,q.positionScreen.y);if(B.instersects(n)){wa=0;for(ua=ha.meshMaterials.length;wa<ua;){va=ha.meshMaterials[wa++];if(va instanceof THREE.MeshFaceMaterial){xa=
-0;for(za=ha.faceMaterials.length;xa<za;)(va=ha.faceMaterials[xa++])&&aa(v,H,q,ha,va,sa)}else aa(v,H,q,ha,va,sa)}}}p.addRectangle(n)}m.setTransform(1,0,0,1,0,0)}};
-THREE.SVGRenderer=function(){function a(ia,$,ra){var ya,l,z,B;ya=0;for(l=ia.lights.length;ya<l;ya++){z=ia.lights[ya];if(z instanceof THREE.DirectionalLight){B=$.normalWorld.dot(z.position)*z.intensity;if(B>0){ra.r+=z.color.r*B;ra.g+=z.color.g*B;ra.b+=z.color.b*B}}else if(z instanceof THREE.PointLight){V.sub(z.position,$.centroidWorld);V.normalize();B=$.normalWorld.dot(V)*z.intensity;if(B>0){ra.r+=z.color.r*B;ra.g+=z.color.g*B;ra.b+=z.color.b*B}}}}function b(ia,$,ra,ya,l,z){G=d(T++);G.setAttribute("d",
-"M "+ia.positionScreen.x+" "+ia.positionScreen.y+" L "+$.positionScreen.x+" "+$.positionScreen.y+" L "+ra.positionScreen.x+","+ra.positionScreen.y+"z");if(l instanceof THREE.MeshBasicMaterial)q.__styleString=l.color.__styleString;else if(l instanceof THREE.MeshLambertMaterial)if(H){J.r=e.r;J.g=e.g;J.b=e.b;a(z,ya,J);q.r=l.color.r*J.r;q.g=l.color.g*J.g;q.b=l.color.b*J.b;q.updateStyleString()}else q.__styleString=l.color.__styleString;else if(l instanceof THREE.MeshDepthMaterial){M=1-l.__2near/(l.__farPlusNear-
+THREE.CanvasRenderer=function(){function a(sa){if(u!=sa)m.globalAlpha=u=sa}function b(sa){if(t!=sa){switch(sa){case THREE.NormalBlending:m.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:m.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:m.globalCompositeOperation="darker"}t=sa}}var c=null,d=new THREE.Projector,f=document.createElement("canvas"),g,h,k,j,m=f.getContext("2d"),o=new THREE.Color(0),w=0,u=1,t=0,x=null,A=null,F=1,v,I,q,J,e,ba,L,M,V,S=new THREE.Color,
+Y=new THREE.Color,Z=new THREE.Color,G=new THREE.Color,U=new THREE.Color,na,W,ka,ia,$,ra,ya,l,z,C=new THREE.Rectangle,p=new THREE.Rectangle,n=new THREE.Rectangle,B=!1,H=new THREE.Color,N=new THREE.Color,ca=new THREE.Color,y=new THREE.Color,E=Math.PI*2,D=new THREE.Vector3,P,T,oa,la,ja,ma,pa=16;P=document.createElement("canvas");P.width=P.height=2;T=P.getContext("2d");T.fillStyle="rgba(0,0,0,1)";T.fillRect(0,0,2,2);oa=T.getImageData(0,0,2,2);la=oa.data;ja=document.createElement("canvas");ja.width=ja.height=
+pa;ma=ja.getContext("2d");ma.translate(-pa/2,-pa/2);ma.scale(pa,pa);pa--;this.domElement=f;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setSize=function(sa,O){g=sa;h=O;k=g/2;j=h/2;f.width=g;f.height=h;C.set(-k,-j,k,j);u=1;t=0;A=x=null;F=1};this.setClearColor=function(sa,O){o=sa;w=O;p.set(-k,-j,k,j);m.setTransform(1,0,0,-1,k,j);this.clear()};this.setClearColorHex=function(sa,O){o.setHex(sa);w=O;p.set(-k,-j,k,j);m.setTransform(1,0,0,-1,k,j);this.clear()};this.clear=function(){m.setTransform(1,
+0,0,-1,k,j);if(!p.isEmpty()){p.inflate(1);p.minSelf(C);if(o.hex==0&&w==0)m.clearRect(p.getX(),p.getY(),p.getWidth(),p.getHeight());else{b(THREE.NormalBlending);a(1);m.fillStyle="rgba("+Math.floor(o.r*255)+","+Math.floor(o.g*255)+","+Math.floor(o.b*255)+","+w+")";m.fillRect(p.getX(),p.getY(),p.getWidth(),p.getHeight())}p.empty()}};this.render=function(sa,O){function Ia(Q){var fa,ga,R,ea=Q.lights;N.setRGB(0,0,0);ca.setRGB(0,0,0);y.setRGB(0,0,0);Q=0;for(fa=ea.length;Q<fa;Q++){ga=ea[Q];R=ga.color;if(ga instanceof
+THREE.AmbientLight){N.r+=R.r;N.g+=R.g;N.b+=R.b}else if(ga instanceof THREE.DirectionalLight){ca.r+=R.r;ca.g+=R.g;ca.b+=R.b}else if(ga instanceof THREE.PointLight){y.r+=R.r;y.g+=R.g;y.b+=R.b}}}function Ca(Q,fa,ga,R){var ea,qa,Aa,Ga,Ha=Q.lights;Q=0;for(ea=Ha.length;Q<ea;Q++){qa=Ha[Q];Aa=qa.color;Ga=qa.intensity;if(qa instanceof THREE.DirectionalLight){qa=ga.dot(qa.position)*Ga;if(qa>0){R.r+=Aa.r*qa;R.g+=Aa.g*qa;R.b+=Aa.b*qa}}else if(qa instanceof THREE.PointLight){D.sub(qa.position,fa);D.normalize();
+qa=ga.dot(D)*Ga;if(qa>0){R.r+=Aa.r*qa;R.g+=Aa.g*qa;R.b+=Aa.b*qa}}}}function Ja(Q,fa,ga){if(ga.opacity!=0){a(ga.opacity);b(ga.blending);var R,ea,qa,Aa,Ga,Ha;if(ga instanceof THREE.ParticleBasicMaterial){if(ga.map&&ga.map.image.loaded){Aa=ga.map.image;Ga=Aa.width>>1;Ha=Aa.height>>1;ea=fa.scale.x*k;qa=fa.scale.y*j;ga=ea*Ga;R=qa*Ha;n.set(Q.x-ga,Q.y-R,Q.x+ga,Q.y+R);if(C.instersects(n)){m.save();m.translate(Q.x,Q.y);m.rotate(-fa.rotation);m.scale(ea,-qa);m.translate(-Ga,-Ha);m.drawImage(Aa,0,0);m.restore()}}}else if(ga instanceof
+THREE.ParticleCircleMaterial){if(B){H.r=N.r+ca.r+y.r;H.g=N.g+ca.g+y.g;H.b=N.b+ca.b+y.b;S.r=ga.color.r*H.r;S.g=ga.color.g*H.g;S.b=ga.color.b*H.b;S.updateStyleString()}else S.__styleString=ga.color.__styleString;ga=fa.scale.x*k;R=fa.scale.y*j;n.set(Q.x-ga,Q.y-R,Q.x+ga,Q.y+R);if(C.instersects(n)){ea=S.__styleString;if(A!=ea)m.fillStyle=A=ea;m.save();m.translate(Q.x,Q.y);m.rotate(-fa.rotation);m.scale(ga,R);m.beginPath();m.arc(0,0,1,0,E,!0);m.closePath();m.fill();m.restore()}}}}function da(Q,fa,ga,R){if(R.opacity!=
+0){a(R.opacity);b(R.blending);m.beginPath();m.moveTo(Q.positionScreen.x,Q.positionScreen.y);m.lineTo(fa.positionScreen.x,fa.positionScreen.y);m.closePath();if(R instanceof THREE.LineBasicMaterial){S.__styleString=R.color.__styleString;Q=R.linewidth;if(F!=Q)m.lineWidth=F=Q;Q=S.__styleString;if(x!=Q)m.strokeStyle=x=Q;m.stroke();n.inflate(R.linewidth*2)}}}function aa(Q,fa,ga,R,ea,qa){if(ea.opacity!=0){a(ea.opacity);b(ea.blending);J=Q.positionScreen.x;e=Q.positionScreen.y;ba=fa.positionScreen.x;L=fa.positionScreen.y;
+M=ga.positionScreen.x;V=ga.positionScreen.y;m.beginPath();m.moveTo(J,e);m.lineTo(ba,L);m.lineTo(M,V);m.lineTo(J,e);m.closePath();if(ea instanceof THREE.MeshBasicMaterial)if(ea.map)ea.map.image.loaded&&ea.map.mapping instanceof THREE.UVMapping&&Fa(J,e,ba,L,M,V,ea.map.image,R.uvs[0].u,R.uvs[0].v,R.uvs[1].u,R.uvs[1].v,R.uvs[2].u,R.uvs[2].v);else if(ea.env_map){if(ea.env_map.image.loaded&&ea.env_map.mapping instanceof THREE.SphericalReflectionMapping){Q=O.globalMatrix;D.copy(R.vertexNormalsWorld[0]);
+ia=(D.x*Q.n11+D.y*Q.n12+D.z*Q.n13)*0.5+0.5;$=-(D.x*Q.n21+D.y*Q.n22+D.z*Q.n23)*0.5+0.5;D.copy(R.vertexNormalsWorld[1]);ra=(D.x*Q.n11+D.y*Q.n12+D.z*Q.n13)*0.5+0.5;ya=-(D.x*Q.n21+D.y*Q.n22+D.z*Q.n23)*0.5+0.5;D.copy(R.vertexNormalsWorld[2]);l=(D.x*Q.n11+D.y*Q.n12+D.z*Q.n13)*0.5+0.5;z=-(D.x*Q.n21+D.y*Q.n22+D.z*Q.n23)*0.5+0.5;Fa(J,e,ba,L,M,V,ea.env_map.image,ia,$,ra,ya,l,z)}}else ea.wireframe?X(ea.color.__styleString,ea.wireframe_linewidth):ta(ea.color.__styleString);else if(ea instanceof THREE.MeshLambertMaterial){if(ea.map&&
+!ea.wireframe){ea.map.mapping instanceof THREE.UVMapping&&Fa(J,e,ba,L,M,V,ea.map.image,R.uvs[0].u,R.uvs[0].v,R.uvs[1].u,R.uvs[1].v,R.uvs[2].u,R.uvs[2].v);b(THREE.SubtractiveBlending)}if(B)if(!ea.wireframe&&ea.shading==THREE.SmoothShading&&R.vertexNormalsWorld.length==3){Y.r=Z.r=G.r=N.r;Y.g=Z.g=G.g=N.g;Y.b=Z.b=G.b=N.b;Ca(qa,R.v1.positionWorld,R.vertexNormalsWorld[0],Y);Ca(qa,R.v2.positionWorld,R.vertexNormalsWorld[1],Z);Ca(qa,R.v3.positionWorld,R.vertexNormalsWorld[2],G);U.r=(Z.r+G.r)*0.5;U.g=(Z.g+
+G.g)*0.5;U.b=(Z.b+G.b)*0.5;ka=Da(Y,Z,G,U);Fa(J,e,ba,L,M,V,ka,0,0,1,0,0,1)}else{H.r=N.r;H.g=N.g;H.b=N.b;Ca(qa,R.centroidWorld,R.normalWorld,H);S.r=ea.color.r*H.r;S.g=ea.color.g*H.g;S.b=ea.color.b*H.b;S.updateStyleString();ea.wireframe?X(S.__styleString,ea.wireframe_linewidth):ta(S.__styleString)}else ea.wireframe?X(ea.color.__styleString,ea.wireframe_linewidth):ta(ea.color.__styleString)}else if(ea instanceof THREE.MeshDepthMaterial){na=O.near;W=O.far;Y.r=Y.g=Y.b=1-K(Q.positionScreen.z,na,W);Z.r=Z.g=
+Z.b=1-K(fa.positionScreen.z,na,W);G.r=G.g=G.b=1-K(ga.positionScreen.z,na,W);U.r=(Z.r+G.r)*0.5;U.g=(Z.g+G.g)*0.5;U.b=(Z.b+G.b)*0.5;ka=Da(Y,Z,G,U);Fa(J,e,ba,L,M,V,ka,0,0,1,0,0,1)}else if(ea instanceof THREE.MeshNormalMaterial){S.r=Ea(R.normalWorld.x);S.g=Ea(R.normalWorld.y);S.b=Ea(R.normalWorld.z);S.updateStyleString();ea.wireframe?X(S.__styleString,ea.wireframe_linewidth):ta(S.__styleString)}}}function X(Q,fa){if(x!=Q)m.strokeStyle=x=Q;if(F!=fa)m.lineWidth=F=fa;m.stroke();n.inflate(fa*2)}function ta(Q){if(A!=
+Q)m.fillStyle=A=Q;m.fill()}function Fa(Q,fa,ga,R,ea,qa,Aa,Ga,Ha,La,Ba,Ma,Ta){var Na,Oa;Na=Aa.width-1;Oa=Aa.height-1;Ga*=Na;Ha*=Oa;La*=Na;Ba*=Oa;Ma*=Na;Ta*=Oa;ga-=Q;R-=fa;ea-=Q;qa-=fa;La-=Ga;Ba-=Ha;Ma-=Ga;Ta-=Ha;Na=La*Ta-Ma*Ba;if(Na!=0){Oa=1/Na;Na=(Ta*ga-Ba*ea)*Oa;Ba=(Ta*R-Ba*qa)*Oa;ga=(La*ea-Ma*ga)*Oa;R=(La*qa-Ma*R)*Oa;Q=Q-Na*Ga-ga*Ha;fa=fa-Ba*Ga-R*Ha;m.save();m.transform(Na,Ba,ga,R,Q,fa);m.clip();m.drawImage(Aa,0,0);m.restore()}}function Da(Q,fa,ga,R){var ea=~~(Q.r*255),qa=~~(Q.g*255);Q=~~(Q.b*255);
+var Aa=~~(fa.r*255),Ga=~~(fa.g*255);fa=~~(fa.b*255);var Ha=~~(ga.r*255),La=~~(ga.g*255);ga=~~(ga.b*255);var Ba=~~(R.r*255),Ma=~~(R.g*255);R=~~(R.b*255);la[0]=ea<0?0:ea>255?255:ea;la[1]=qa<0?0:qa>255?255:qa;la[2]=Q<0?0:Q>255?255:Q;la[4]=Aa<0?0:Aa>255?255:Aa;la[5]=Ga<0?0:Ga>255?255:Ga;la[6]=fa<0?0:fa>255?255:fa;la[8]=Ha<0?0:Ha>255?255:Ha;la[9]=La<0?0:La>255?255:La;la[10]=ga<0?0:ga>255?255:ga;la[12]=Ba<0?0:Ba>255?255:Ba;la[13]=Ma<0?0:Ma>255?255:Ma;la[14]=R<0?0:R>255?255:R;T.putImageData(oa,0,0);ma.drawImage(P,
+0,0);return ja}function K(Q,fa,ga){Q=(Q-fa)/(ga-fa);return Q*Q*(3-2*Q)}function Ea(Q){Q=(Q+1)*0.5;return Q<0?0:Q>1?1:Q}function Ra(Q,fa){var ga=fa.x-Q.x,R=fa.y-Q.y,ea=1/Math.sqrt(ga*ga+R*R);ga*=ea;R*=ea;fa.x+=ga;fa.y+=R;Q.x-=ga;Q.y-=R}var Pa,Ka,ha,wa,ua,xa,za,va;this.autoClear?this.clear():m.setTransform(1,0,0,-1,k,j);c=d.projectScene(sa,O,this.sortElements);(B=sa.lights.length>0)&&Ia(sa);Pa=0;for(Ka=c.length;Pa<Ka;Pa++){ha=c[Pa];n.empty();if(ha instanceof THREE.RenderableParticle){v=ha;v.x*=k;v.y*=
+j;wa=0;for(ua=ha.materials.length;wa<ua;wa++)Ja(v,ha,ha.materials[wa],sa)}else if(ha instanceof THREE.RenderableLine){v=ha.v1;I=ha.v2;v.positionScreen.x*=k;v.positionScreen.y*=j;I.positionScreen.x*=k;I.positionScreen.y*=j;n.addPoint(v.positionScreen.x,v.positionScreen.y);n.addPoint(I.positionScreen.x,I.positionScreen.y);if(C.instersects(n)){wa=0;for(ua=ha.materials.length;wa<ua;)da(v,I,ha,ha.materials[wa++],sa)}}else if(ha instanceof THREE.RenderableFace3){v=ha.v1;I=ha.v2;q=ha.v3;v.positionScreen.x*=
+k;v.positionScreen.y*=j;I.positionScreen.x*=k;I.positionScreen.y*=j;q.positionScreen.x*=k;q.positionScreen.y*=j;if(ha.overdraw){Ra(v.positionScreen,I.positionScreen);Ra(I.positionScreen,q.positionScreen);Ra(q.positionScreen,v.positionScreen)}n.add3Points(v.positionScreen.x,v.positionScreen.y,I.positionScreen.x,I.positionScreen.y,q.positionScreen.x,q.positionScreen.y);if(C.instersects(n)){wa=0;for(ua=ha.meshMaterials.length;wa<ua;){va=ha.meshMaterials[wa++];if(va instanceof THREE.MeshFaceMaterial){xa=
+0;for(za=ha.faceMaterials.length;xa<za;)(va=ha.faceMaterials[xa++])&&aa(v,I,q,ha,va,sa)}else aa(v,I,q,ha,va,sa)}}}p.addRectangle(n)}m.setTransform(1,0,0,1,0,0)}};
+THREE.SVGRenderer=function(){function a(ia,$,ra){var ya,l,z,C;ya=0;for(l=ia.lights.length;ya<l;ya++){z=ia.lights[ya];if(z instanceof THREE.DirectionalLight){C=$.normalWorld.dot(z.position)*z.intensity;if(C>0){ra.r+=z.color.r*C;ra.g+=z.color.g*C;ra.b+=z.color.b*C}}else if(z instanceof THREE.PointLight){V.sub(z.position,$.centroidWorld);V.normalize();C=$.normalWorld.dot(V)*z.intensity;if(C>0){ra.r+=z.color.r*C;ra.g+=z.color.g*C;ra.b+=z.color.b*C}}}}function b(ia,$,ra,ya,l,z){G=d(U++);G.setAttribute("d",
+"M "+ia.positionScreen.x+" "+ia.positionScreen.y+" L "+$.positionScreen.x+" "+$.positionScreen.y+" L "+ra.positionScreen.x+","+ra.positionScreen.y+"z");if(l instanceof THREE.MeshBasicMaterial)q.__styleString=l.color.__styleString;else if(l instanceof THREE.MeshLambertMaterial)if(I){J.r=e.r;J.g=e.g;J.b=e.b;a(z,ya,J);q.r=l.color.r*J.r;q.g=l.color.g*J.g;q.b=l.color.b*J.b;q.updateStyleString()}else q.__styleString=l.color.__styleString;else if(l instanceof THREE.MeshDepthMaterial){M=1-l.__2near/(l.__farPlusNear-
 ya.z*l.__farMinusNear);q.setRGB(M,M,M)}else l instanceof THREE.MeshNormalMaterial&&q.setRGB(f(ya.normalWorld.x),f(ya.normalWorld.y),f(ya.normalWorld.z));l.wireframe?G.setAttribute("style","fill: none; stroke: "+q.__styleString+"; stroke-width: "+l.wireframe_linewidth+"; stroke-opacity: "+l.opacity+"; stroke-linecap: "+l.wireframe_linecap+"; stroke-linejoin: "+l.wireframe_linejoin):G.setAttribute("style","fill: "+q.__styleString+"; fill-opacity: "+l.opacity);k.appendChild(G)}function c(ia,$,ra,ya,
 ya.z*l.__farMinusNear);q.setRGB(M,M,M)}else l instanceof THREE.MeshNormalMaterial&&q.setRGB(f(ya.normalWorld.x),f(ya.normalWorld.y),f(ya.normalWorld.z));l.wireframe?G.setAttribute("style","fill: none; stroke: "+q.__styleString+"; stroke-width: "+l.wireframe_linewidth+"; stroke-opacity: "+l.opacity+"; stroke-linecap: "+l.wireframe_linecap+"; stroke-linejoin: "+l.wireframe_linejoin):G.setAttribute("style","fill: "+q.__styleString+"; fill-opacity: "+l.opacity);k.appendChild(G)}function c(ia,$,ra,ya,
-l,z,B){G=d(T++);G.setAttribute("d","M "+ia.positionScreen.x+" "+ia.positionScreen.y+" L "+$.positionScreen.x+" "+$.positionScreen.y+" L "+ra.positionScreen.x+","+ra.positionScreen.y+" L "+ya.positionScreen.x+","+ya.positionScreen.y+"z");if(z instanceof THREE.MeshBasicMaterial)q.__styleString=z.color.__styleString;else if(z instanceof THREE.MeshLambertMaterial)if(H){J.r=e.r;J.g=e.g;J.b=e.b;a(B,l,J);q.r=z.color.r*J.r;q.g=z.color.g*J.g;q.b=z.color.b*J.b;q.updateStyleString()}else q.__styleString=z.color.__styleString;
+l,z,C){G=d(U++);G.setAttribute("d","M "+ia.positionScreen.x+" "+ia.positionScreen.y+" L "+$.positionScreen.x+" "+$.positionScreen.y+" L "+ra.positionScreen.x+","+ra.positionScreen.y+" L "+ya.positionScreen.x+","+ya.positionScreen.y+"z");if(z instanceof THREE.MeshBasicMaterial)q.__styleString=z.color.__styleString;else if(z instanceof THREE.MeshLambertMaterial)if(I){J.r=e.r;J.g=e.g;J.b=e.b;a(C,l,J);q.r=z.color.r*J.r;q.g=z.color.g*J.g;q.b=z.color.b*J.b;q.updateStyleString()}else q.__styleString=z.color.__styleString;
 else if(z instanceof THREE.MeshDepthMaterial){M=1-z.__2near/(z.__farPlusNear-l.z*z.__farMinusNear);q.setRGB(M,M,M)}else z instanceof THREE.MeshNormalMaterial&&q.setRGB(f(l.normalWorld.x),f(l.normalWorld.y),f(l.normalWorld.z));z.wireframe?G.setAttribute("style","fill: none; stroke: "+q.__styleString+"; stroke-width: "+z.wireframe_linewidth+"; stroke-opacity: "+z.opacity+"; stroke-linecap: "+z.wireframe_linecap+"; stroke-linejoin: "+z.wireframe_linejoin):G.setAttribute("style","fill: "+q.__styleString+
 else if(z instanceof THREE.MeshDepthMaterial){M=1-z.__2near/(z.__farPlusNear-l.z*z.__farMinusNear);q.setRGB(M,M,M)}else z instanceof THREE.MeshNormalMaterial&&q.setRGB(f(l.normalWorld.x),f(l.normalWorld.y),f(l.normalWorld.z));z.wireframe?G.setAttribute("style","fill: none; stroke: "+q.__styleString+"; stroke-width: "+z.wireframe_linewidth+"; stroke-opacity: "+z.opacity+"; stroke-linecap: "+z.wireframe_linecap+"; stroke-linejoin: "+z.wireframe_linejoin):G.setAttribute("style","fill: "+q.__styleString+
-"; fill-opacity: "+z.opacity);k.appendChild(G)}function d(ia){if(S[ia]==null){S[ia]=document.createElementNS("http://www.w3.org/2000/svg","path");ja==0&&S[ia].setAttribute("shape-rendering","crispEdges")}return S[ia]}function f(ia){return ia<0?Math.min((1+ia)*0.5,0.5):0.5+Math.min(ia*0.5,0.5)}var g=null,h=new THREE.Projector,k=document.createElementNS("http://www.w3.org/2000/svg","svg"),j,m,o,w,u,t,x,A,F=new THREE.Rectangle,v=new THREE.Rectangle,H=!1,q=new THREE.Color(16777215),J=new THREE.Color(16777215),
-e=new THREE.Color(0),ba=new THREE.Color(0),L=new THREE.Color(0),M,V=new THREE.Vector3,S=[],Y=[],Z=[],G,T,la,W,ja=1;this.domElement=k;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(ia){switch(ia){case "high":ja=1;break;case "low":ja=0}};this.setSize=function(ia,$){j=ia;m=$;o=j/2;w=m/2;k.setAttribute("viewBox",-o+" "+-w+" "+j+" "+m);k.setAttribute("width",j);k.setAttribute("height",m);F.set(-o,-w,o,w)};this.clear=function(){for(;k.childNodes.length>0;)k.removeChild(k.childNodes[0])};
-this.render=function(ia,$){var ra,ya,l,z,B,p,n,E;this.autoClear&&this.clear();g=h.projectScene(ia,$,this.sortElements);W=la=T=0;if(H=ia.lights.length>0){n=ia.lights;e.setRGB(0,0,0);ba.setRGB(0,0,0);L.setRGB(0,0,0);ra=0;for(ya=n.length;ra<ya;ra++){l=n[ra];z=l.color;if(l instanceof THREE.AmbientLight){e.r+=z.r;e.g+=z.g;e.b+=z.b}else if(l instanceof THREE.DirectionalLight){ba.r+=z.r;ba.g+=z.g;ba.b+=z.b}else if(l instanceof THREE.PointLight){L.r+=z.r;L.g+=z.g;L.b+=z.b}}}ra=0;for(ya=g.length;ra<ya;ra++){n=
-g[ra];v.empty();if(n instanceof THREE.RenderableParticle){u=n;u.x*=o;u.y*=-w;l=0;for(z=n.materials.length;l<z;l++)if(E=n.materials[l]){B=u;p=n;var I=la++;if(Y[I]==null){Y[I]=document.createElementNS("http://www.w3.org/2000/svg","circle");ja==0&&Y[I].setAttribute("shape-rendering","crispEdges")}G=Y[I];G.setAttribute("cx",B.x);G.setAttribute("cy",B.y);G.setAttribute("r",p.scale.x*o);if(E instanceof THREE.ParticleCircleMaterial){if(H){J.r=e.r+ba.r+L.r;J.g=e.g+ba.g+L.g;J.b=e.b+ba.b+L.b;q.r=E.color.r*
-J.r;q.g=E.color.g*J.g;q.b=E.color.b*J.b;q.updateStyleString()}else q=E.color;G.setAttribute("style","fill: "+q.__styleString)}k.appendChild(G)}}else if(n instanceof THREE.RenderableLine){u=n.v1;t=n.v2;u.positionScreen.x*=o;u.positionScreen.y*=-w;t.positionScreen.x*=o;t.positionScreen.y*=-w;v.addPoint(u.positionScreen.x,u.positionScreen.y);v.addPoint(t.positionScreen.x,t.positionScreen.y);if(F.instersects(v)){l=0;for(z=n.materials.length;l<z;)if(E=n.materials[l++]){B=u;p=t;I=W++;if(Z[I]==null){Z[I]=
-document.createElementNS("http://www.w3.org/2000/svg","line");ja==0&&Z[I].setAttribute("shape-rendering","crispEdges")}G=Z[I];G.setAttribute("x1",B.positionScreen.x);G.setAttribute("y1",B.positionScreen.y);G.setAttribute("x2",p.positionScreen.x);G.setAttribute("y2",p.positionScreen.y);if(E instanceof THREE.LineBasicMaterial){q.__styleString=E.color.__styleString;G.setAttribute("style","fill: none; stroke: "+q.__styleString+"; stroke-width: "+E.linewidth+"; stroke-opacity: "+E.opacity+"; stroke-linecap: "+
-E.linecap+"; stroke-linejoin: "+E.linejoin);k.appendChild(G)}}}}else if(n instanceof THREE.RenderableFace3){u=n.v1;t=n.v2;x=n.v3;u.positionScreen.x*=o;u.positionScreen.y*=-w;t.positionScreen.x*=o;t.positionScreen.y*=-w;x.positionScreen.x*=o;x.positionScreen.y*=-w;v.addPoint(u.positionScreen.x,u.positionScreen.y);v.addPoint(t.positionScreen.x,t.positionScreen.y);v.addPoint(x.positionScreen.x,x.positionScreen.y);if(F.instersects(v)){l=0;for(z=n.meshMaterials.length;l<z;){E=n.meshMaterials[l++];if(E instanceof
-THREE.MeshFaceMaterial){B=0;for(p=n.faceMaterials.length;B<p;)(E=n.faceMaterials[B++])&&b(u,t,x,n,E,ia)}else E&&b(u,t,x,n,E,ia)}}}else if(n instanceof THREE.RenderableFace4){u=n.v1;t=n.v2;x=n.v3;A=n.v4;u.positionScreen.x*=o;u.positionScreen.y*=-w;t.positionScreen.x*=o;t.positionScreen.y*=-w;x.positionScreen.x*=o;x.positionScreen.y*=-w;A.positionScreen.x*=o;A.positionScreen.y*=-w;v.addPoint(u.positionScreen.x,u.positionScreen.y);v.addPoint(t.positionScreen.x,t.positionScreen.y);v.addPoint(x.positionScreen.x,
-x.positionScreen.y);v.addPoint(A.positionScreen.x,A.positionScreen.y);if(F.instersects(v)){l=0;for(z=n.meshMaterials.length;l<z;){E=n.meshMaterials[l++];if(E instanceof THREE.MeshFaceMaterial){B=0;for(p=n.faceMaterials.length;B<p;)(E=n.faceMaterials[B++])&&c(u,t,x,A,n,E,ia)}else E&&c(u,t,x,A,n,E,ia)}}}}}};
-THREE.WebGLRenderer=function(a){function b(l,z,B){var p,n,E,I=l.vertices,P=I.length,da=l.colors,y=da.length,C=l.__vertexArray,D=l.__colorArray,Q=l.__sortArray,U=l.__dirtyVertices,pa=l.__dirtyColors;if(B.sortParticles){T.multiplySelf(B.globalMatrix);for(p=0;p<P;p++){n=I[p].position;ia.copy(n);T.multiplyVector3(ia);Q[p]=[ia.z,p]}Q.sort(function(ka,ma){return ma[0]-ka[0]});for(p=0;p<P;p++){n=I[Q[p][1]].position;E=p*3;C[E]=n.x;C[E+1]=n.y;C[E+2]=n.z}for(p=0;p<y;p++){E=p*3;color=da[Q[p][1]];D[E]=color.r;
-D[E+1]=color.g;D[E+2]=color.b}}else{if(U)for(p=0;p<P;p++){n=I[p].position;E=p*3;C[E]=n.x;C[E+1]=n.y;C[E+2]=n.z}if(pa)for(p=0;p<y;p++){color=da[p];E=p*3;D[E]=color.r;D[E+1]=color.g;D[E+2]=color.b}}if(U||B.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,l.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,C,z)}if(pa||B.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,l.__webGLColorBuffer);e.bufferData(e.ARRAY_BUFFER,D,z)}}function c(l,z){l.fragment_shader=z.fragment_shader;l.vertex_shader=z.vertex_shader;l.uniforms=
-Uniforms.clone(z.uniforms)}function d(l,z,B,p,n){p.program||M.initMaterial(p,z,B);var E=p.program,I=E.uniforms,P=p.uniforms;if(E!=ba){e.useProgram(E);ba=E;e.uniformMatrix4fv(I.projectionMatrix,!1,la)}if(B&&(p instanceof THREE.MeshBasicMaterial||p instanceof THREE.MeshLambertMaterial||p instanceof THREE.MeshPhongMaterial||p instanceof THREE.LineBasicMaterial||p instanceof THREE.ParticleBasicMaterial)){P.fogColor.value.setHex(B.color.hex);if(B instanceof THREE.Fog){P.fogNear.value=B.near;P.fogFar.value=
-B.far}else if(B instanceof THREE.FogExp2)P.fogDensity.value=B.density}if(p instanceof THREE.MeshPhongMaterial||p instanceof THREE.MeshLambertMaterial){var da,y,C=0,D=0,Q=0,U,pa,ka,ma=M.lights,na=ma.directional.colors,oa=ma.directional.positions,sa=ma.point.colors,N=ma.point.positions,Ia=0,Ca=0;B=y=y=0;for(da=z.length;B<da;B++){y=z[B];U=y.color;pa=y.position;ka=y.intensity;if(y instanceof THREE.AmbientLight){C+=U.r;D+=U.g;Q+=U.b}else if(y instanceof THREE.DirectionalLight){y=Ia*3;na[y]=U.r*ka;na[y+
-1]=U.g*ka;na[y+2]=U.b*ka;oa[y]=pa.x;oa[y+1]=pa.y;oa[y+2]=pa.z;Ia+=1}else if(y instanceof THREE.PointLight){y=Ca*3;sa[y]=U.r*ka;sa[y+1]=U.g*ka;sa[y+2]=U.b*ka;N[y]=pa.x;N[y+1]=pa.y;N[y+2]=pa.z;Ca+=1}}for(B=Ia*3;B<na.length;B++)na[B]=0;for(B=Ca*3;B<sa.length;B++)sa[B]=0;ma.point.length=Ca;ma.directional.length=Ia;ma.ambient[0]=C;ma.ambient[1]=D;ma.ambient[2]=Q;z=M.lights;P.enableLighting.value=z.directional.length+z.point.length;P.ambientLightColor.value=z.ambient;P.directionalLightColor.value=z.directional.colors;
-P.directionalLightDirection.value=z.directional.positions;P.pointLightColor.value=z.point.colors;P.pointLightPosition.value=z.point.positions}if(p instanceof THREE.MeshBasicMaterial||p instanceof THREE.MeshLambertMaterial||p instanceof THREE.MeshPhongMaterial){P.diffuse.value.setRGB(p.color.r*p.opacity,p.color.g*p.opacity,p.color.b*p.opacity);P.opacity.value=p.opacity;P.map.texture=p.map;P.light_map.texture=p.light_map;P.env_map.texture=p.env_map;P.reflectivity.value=p.reflectivity;P.refraction_ratio.value=
-p.refraction_ratio;P.combine.value=p.combine;P.useRefract.value=p.env_map&&p.env_map.mapping instanceof THREE.CubeRefractionMapping}if(p instanceof THREE.LineBasicMaterial){P.diffuse.value.setRGB(p.color.r*p.opacity,p.color.g*p.opacity,p.color.b*p.opacity);P.opacity.value=p.opacity}else if(p instanceof THREE.ParticleBasicMaterial){P.psColor.value.setRGB(p.color.r*p.opacity,p.color.g*p.opacity,p.color.b*p.opacity);P.opacity.value=p.opacity;P.size.value=p.size;P.map.texture=p.map}else if(p instanceof
-THREE.MeshPhongMaterial){P.ambient.value.setRGB(p.ambient.r,p.ambient.g,p.ambient.b);P.specular.value.setRGB(p.specular.r,p.specular.g,p.specular.b);P.shininess.value=p.shininess}else if(p instanceof THREE.MeshDepthMaterial){P.mNear.value=l.near;P.mFar.value=l.far;P.opacity.value=p.opacity}else if(p instanceof THREE.MeshNormalMaterial)P.opacity.value=p.opacity;for(var Ja in P)if(C=E.uniforms[Ja]){B=P[Ja];da=B.type;z=B.value;if(da=="i")e.uniform1i(C,z);else if(da=="f")e.uniform1f(C,z);else if(da==
-"fv1")e.uniform1fv(C,z);else if(da=="fv")e.uniform3fv(C,z);else if(da=="v2")e.uniform2f(C,z.x,z.y);else if(da=="v3")e.uniform3f(C,z.x,z.y,z.z);else if(da=="c")e.uniform3f(C,z.r,z.g,z.b);else if(da=="t"){e.uniform1i(C,z);if(B=B.texture)if(B.image instanceof Array&&B.image.length==6){if(B.image.length==6){if(!B.image.__webGLTextureCube&&!B.image.__cubeMapInitialized&&B.image.loadCount==6){B.image.__webGLTextureCube=e.createTexture();e.bindTexture(e.TEXTURE_CUBE_MAP,B.image.__webGLTextureCube);e.texParameteri(e.TEXTURE_CUBE_MAP,
-e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE);e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE);e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_MAG_FILTER,e.LINEAR);e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_MIN_FILTER,e.LINEAR_MIPMAP_LINEAR);for(da=0;da<6;++da)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+da,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,B.image[da]);e.generateMipmap(e.TEXTURE_CUBE_MAP);e.bindTexture(e.TEXTURE_CUBE_MAP,null);B.image.__cubeMapInitialized=!0}e.activeTexture(e.TEXTURE0+z);e.bindTexture(e.TEXTURE_CUBE_MAP,
-B.image.__webGLTextureCube)}}else{if(!B.__webGLTexture&&B.image.loaded){B.__webGLTexture=e.createTexture();e.bindTexture(e.TEXTURE_2D,B.__webGLTexture);e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,B.image);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,q(B.wrap_s));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,q(B.wrap_t));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,q(B.mag_filter));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,q(B.min_filter));e.generateMipmap(e.TEXTURE_2D);
-e.bindTexture(e.TEXTURE_2D,null)}e.activeTexture(e.TEXTURE0+z);e.bindTexture(e.TEXTURE_2D,B.__webGLTexture)}}}e.uniformMatrix4fv(I.modelViewMatrix,!1,n._modelViewMatrixArray);e.uniformMatrix3fv(I.normalMatrix,!1,n._normalMatrixArray);(p instanceof THREE.MeshShaderMaterial||p instanceof THREE.MeshPhongMaterial||p.env_map)&&e.uniform3f(I.cameraPosition,l.position.x,l.position.y,l.position.z);(p instanceof THREE.MeshShaderMaterial||p.env_map||p.skinning)&&e.uniformMatrix4fv(I.objectMatrix,!1,n._objectMatrixArray);
-(p instanceof THREE.MeshPhongMaterial||p instanceof THREE.MeshLambertMaterial||p instanceof THREE.MeshShaderMaterial||p.skinning)&&e.uniformMatrix4fv(I.viewMatrix,!1,ja);if(p.skinning){e.uniformMatrix4fv(I.cameraInverseMatrix,!1,W);e.uniformMatrix4fv(I.uBoneGlobalMatrices,!1,n.boneMatrices)}return E}function f(l,z,B,p,n,E){l=d(l,z,B,p,E).attributes;e.bindBuffer(e.ARRAY_BUFFER,n.__webGLVertexBuffer);e.vertexAttribPointer(l.position,3,e.FLOAT,!1,0,0);if(l.color>=0){e.bindBuffer(e.ARRAY_BUFFER,n.__webGLColorBuffer);
+"; fill-opacity: "+z.opacity);k.appendChild(G)}function d(ia){if(S[ia]==null){S[ia]=document.createElementNS("http://www.w3.org/2000/svg","path");ka==0&&S[ia].setAttribute("shape-rendering","crispEdges")}return S[ia]}function f(ia){return ia<0?Math.min((1+ia)*0.5,0.5):0.5+Math.min(ia*0.5,0.5)}var g=null,h=new THREE.Projector,k=document.createElementNS("http://www.w3.org/2000/svg","svg"),j,m,o,w,u,t,x,A,F=new THREE.Rectangle,v=new THREE.Rectangle,I=!1,q=new THREE.Color(16777215),J=new THREE.Color(16777215),
+e=new THREE.Color(0),ba=new THREE.Color(0),L=new THREE.Color(0),M,V=new THREE.Vector3,S=[],Y=[],Z=[],G,U,na,W,ka=1;this.domElement=k;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(ia){switch(ia){case "high":ka=1;break;case "low":ka=0}};this.setSize=function(ia,$){j=ia;m=$;o=j/2;w=m/2;k.setAttribute("viewBox",-o+" "+-w+" "+j+" "+m);k.setAttribute("width",j);k.setAttribute("height",m);F.set(-o,-w,o,w)};this.clear=function(){for(;k.childNodes.length>0;)k.removeChild(k.childNodes[0])};
+this.render=function(ia,$){var ra,ya,l,z,C,p,n,B;this.autoClear&&this.clear();g=h.projectScene(ia,$,this.sortElements);W=na=U=0;if(I=ia.lights.length>0){n=ia.lights;e.setRGB(0,0,0);ba.setRGB(0,0,0);L.setRGB(0,0,0);ra=0;for(ya=n.length;ra<ya;ra++){l=n[ra];z=l.color;if(l instanceof THREE.AmbientLight){e.r+=z.r;e.g+=z.g;e.b+=z.b}else if(l instanceof THREE.DirectionalLight){ba.r+=z.r;ba.g+=z.g;ba.b+=z.b}else if(l instanceof THREE.PointLight){L.r+=z.r;L.g+=z.g;L.b+=z.b}}}ra=0;for(ya=g.length;ra<ya;ra++){n=
+g[ra];v.empty();if(n instanceof THREE.RenderableParticle){u=n;u.x*=o;u.y*=-w;l=0;for(z=n.materials.length;l<z;l++)if(B=n.materials[l]){C=u;p=n;var H=na++;if(Y[H]==null){Y[H]=document.createElementNS("http://www.w3.org/2000/svg","circle");ka==0&&Y[H].setAttribute("shape-rendering","crispEdges")}G=Y[H];G.setAttribute("cx",C.x);G.setAttribute("cy",C.y);G.setAttribute("r",p.scale.x*o);if(B instanceof THREE.ParticleCircleMaterial){if(I){J.r=e.r+ba.r+L.r;J.g=e.g+ba.g+L.g;J.b=e.b+ba.b+L.b;q.r=B.color.r*
+J.r;q.g=B.color.g*J.g;q.b=B.color.b*J.b;q.updateStyleString()}else q=B.color;G.setAttribute("style","fill: "+q.__styleString)}k.appendChild(G)}}else if(n instanceof THREE.RenderableLine){u=n.v1;t=n.v2;u.positionScreen.x*=o;u.positionScreen.y*=-w;t.positionScreen.x*=o;t.positionScreen.y*=-w;v.addPoint(u.positionScreen.x,u.positionScreen.y);v.addPoint(t.positionScreen.x,t.positionScreen.y);if(F.instersects(v)){l=0;for(z=n.materials.length;l<z;)if(B=n.materials[l++]){C=u;p=t;H=W++;if(Z[H]==null){Z[H]=
+document.createElementNS("http://www.w3.org/2000/svg","line");ka==0&&Z[H].setAttribute("shape-rendering","crispEdges")}G=Z[H];G.setAttribute("x1",C.positionScreen.x);G.setAttribute("y1",C.positionScreen.y);G.setAttribute("x2",p.positionScreen.x);G.setAttribute("y2",p.positionScreen.y);if(B instanceof THREE.LineBasicMaterial){q.__styleString=B.color.__styleString;G.setAttribute("style","fill: none; stroke: "+q.__styleString+"; stroke-width: "+B.linewidth+"; stroke-opacity: "+B.opacity+"; stroke-linecap: "+
+B.linecap+"; stroke-linejoin: "+B.linejoin);k.appendChild(G)}}}}else if(n instanceof THREE.RenderableFace3){u=n.v1;t=n.v2;x=n.v3;u.positionScreen.x*=o;u.positionScreen.y*=-w;t.positionScreen.x*=o;t.positionScreen.y*=-w;x.positionScreen.x*=o;x.positionScreen.y*=-w;v.addPoint(u.positionScreen.x,u.positionScreen.y);v.addPoint(t.positionScreen.x,t.positionScreen.y);v.addPoint(x.positionScreen.x,x.positionScreen.y);if(F.instersects(v)){l=0;for(z=n.meshMaterials.length;l<z;){B=n.meshMaterials[l++];if(B instanceof
+THREE.MeshFaceMaterial){C=0;for(p=n.faceMaterials.length;C<p;)(B=n.faceMaterials[C++])&&b(u,t,x,n,B,ia)}else B&&b(u,t,x,n,B,ia)}}}else if(n instanceof THREE.RenderableFace4){u=n.v1;t=n.v2;x=n.v3;A=n.v4;u.positionScreen.x*=o;u.positionScreen.y*=-w;t.positionScreen.x*=o;t.positionScreen.y*=-w;x.positionScreen.x*=o;x.positionScreen.y*=-w;A.positionScreen.x*=o;A.positionScreen.y*=-w;v.addPoint(u.positionScreen.x,u.positionScreen.y);v.addPoint(t.positionScreen.x,t.positionScreen.y);v.addPoint(x.positionScreen.x,
+x.positionScreen.y);v.addPoint(A.positionScreen.x,A.positionScreen.y);if(F.instersects(v)){l=0;for(z=n.meshMaterials.length;l<z;){B=n.meshMaterials[l++];if(B instanceof THREE.MeshFaceMaterial){C=0;for(p=n.faceMaterials.length;C<p;)(B=n.faceMaterials[C++])&&c(u,t,x,A,n,B,ia)}else B&&c(u,t,x,A,n,B,ia)}}}}}};
+THREE.WebGLRenderer=function(a){function b(l,z,C){var p,n,B,H=l.vertices,N=H.length,ca=l.colors,y=ca.length,E=l.__vertexArray,D=l.__colorArray,P=l.__sortArray,T=l.__dirtyVertices,oa=l.__dirtyColors;if(C.sortParticles){U.multiplySelf(C.globalMatrix);for(p=0;p<N;p++){n=H[p].position;ia.copy(n);U.multiplyVector3(ia);P[p]=[ia.z,p]}P.sort(function(la,ja){return ja[0]-la[0]});for(p=0;p<N;p++){n=H[P[p][1]].position;B=p*3;E[B]=n.x;E[B+1]=n.y;E[B+2]=n.z}for(p=0;p<y;p++){B=p*3;color=ca[P[p][1]];D[B]=color.r;
+D[B+1]=color.g;D[B+2]=color.b}}else{if(T)for(p=0;p<N;p++){n=H[p].position;B=p*3;E[B]=n.x;E[B+1]=n.y;E[B+2]=n.z}if(oa)for(p=0;p<y;p++){color=ca[p];B=p*3;D[B]=color.r;D[B+1]=color.g;D[B+2]=color.b}}if(T||C.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,l.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,E,z)}if(oa||C.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,l.__webGLColorBuffer);e.bufferData(e.ARRAY_BUFFER,D,z)}}function c(l,z){l.fragment_shader=z.fragment_shader;l.vertex_shader=z.vertex_shader;l.uniforms=
+Uniforms.clone(z.uniforms)}function d(l,z,C,p,n){p.program||M.initMaterial(p,z,C);var B=p.program,H=B.uniforms,N=p.uniforms;if(B!=ba){e.useProgram(B);ba=B;e.uniformMatrix4fv(H.projectionMatrix,!1,na)}if(C&&(p instanceof THREE.MeshBasicMaterial||p instanceof THREE.MeshLambertMaterial||p instanceof THREE.MeshPhongMaterial||p instanceof THREE.LineBasicMaterial||p instanceof THREE.ParticleBasicMaterial)){N.fogColor.value.setHex(C.color.hex);if(C instanceof THREE.Fog){N.fogNear.value=C.near;N.fogFar.value=
+C.far}else if(C instanceof THREE.FogExp2)N.fogDensity.value=C.density}if(p instanceof THREE.MeshPhongMaterial||p instanceof THREE.MeshLambertMaterial){var ca,y,E=0,D=0,P=0,T,oa,la,ja=M.lights,ma=ja.directional.colors,pa=ja.directional.positions,sa=ja.point.colors,O=ja.point.positions,Ia=0,Ca=0;C=y=y=0;for(ca=z.length;C<ca;C++){y=z[C];T=y.color;oa=y.position;la=y.intensity;if(y instanceof THREE.AmbientLight){E+=T.r;D+=T.g;P+=T.b}else if(y instanceof THREE.DirectionalLight){y=Ia*3;ma[y]=T.r*la;ma[y+
+1]=T.g*la;ma[y+2]=T.b*la;pa[y]=oa.x;pa[y+1]=oa.y;pa[y+2]=oa.z;Ia+=1}else if(y instanceof THREE.PointLight){y=Ca*3;sa[y]=T.r*la;sa[y+1]=T.g*la;sa[y+2]=T.b*la;O[y]=oa.x;O[y+1]=oa.y;O[y+2]=oa.z;Ca+=1}}for(C=Ia*3;C<ma.length;C++)ma[C]=0;for(C=Ca*3;C<sa.length;C++)sa[C]=0;ja.point.length=Ca;ja.directional.length=Ia;ja.ambient[0]=E;ja.ambient[1]=D;ja.ambient[2]=P;z=M.lights;N.enableLighting.value=z.directional.length+z.point.length;N.ambientLightColor.value=z.ambient;N.directionalLightColor.value=z.directional.colors;
+N.directionalLightDirection.value=z.directional.positions;N.pointLightColor.value=z.point.colors;N.pointLightPosition.value=z.point.positions}if(p instanceof THREE.MeshBasicMaterial||p instanceof THREE.MeshLambertMaterial||p instanceof THREE.MeshPhongMaterial){N.diffuse.value.setRGB(p.color.r*p.opacity,p.color.g*p.opacity,p.color.b*p.opacity);N.opacity.value=p.opacity;N.map.texture=p.map;N.light_map.texture=p.light_map;N.env_map.texture=p.env_map;N.reflectivity.value=p.reflectivity;N.refraction_ratio.value=
+p.refraction_ratio;N.combine.value=p.combine;N.useRefract.value=p.env_map&&p.env_map.mapping instanceof THREE.CubeRefractionMapping}if(p instanceof THREE.LineBasicMaterial){N.diffuse.value.setRGB(p.color.r*p.opacity,p.color.g*p.opacity,p.color.b*p.opacity);N.opacity.value=p.opacity}else if(p instanceof THREE.ParticleBasicMaterial){N.psColor.value.setRGB(p.color.r*p.opacity,p.color.g*p.opacity,p.color.b*p.opacity);N.opacity.value=p.opacity;N.size.value=p.size;N.map.texture=p.map}else if(p instanceof
+THREE.MeshPhongMaterial){N.ambient.value.setRGB(p.ambient.r,p.ambient.g,p.ambient.b);N.specular.value.setRGB(p.specular.r,p.specular.g,p.specular.b);N.shininess.value=p.shininess}else if(p instanceof THREE.MeshDepthMaterial){N.mNear.value=l.zNear;N.mFar.value=l.zFar;N.opacity.value=p.opacity}else if(p instanceof THREE.MeshNormalMaterial)N.opacity.value=p.opacity;for(var Ja in N)if(E=B.uniforms[Ja]){C=N[Ja];ca=C.type;z=C.value;if(ca=="i")e.uniform1i(E,z);else if(ca=="f")e.uniform1f(E,z);else if(ca==
+"fv1")e.uniform1fv(E,z);else if(ca=="fv")e.uniform3fv(E,z);else if(ca=="v2")e.uniform2f(E,z.x,z.y);else if(ca=="v3")e.uniform3f(E,z.x,z.y,z.z);else if(ca=="c")e.uniform3f(E,z.r,z.g,z.b);else if(ca=="t"){e.uniform1i(E,z);if(C=C.texture)if(C.image instanceof Array&&C.image.length==6){if(C.image.length==6){if(!C.image.__webGLTextureCube&&!C.image.__cubeMapInitialized&&C.image.loadCount==6){C.image.__webGLTextureCube=e.createTexture();e.bindTexture(e.TEXTURE_CUBE_MAP,C.image.__webGLTextureCube);e.texParameteri(e.TEXTURE_CUBE_MAP,
+e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE);e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE);e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_MAG_FILTER,e.LINEAR);e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_MIN_FILTER,e.LINEAR_MIPMAP_LINEAR);for(ca=0;ca<6;++ca)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+ca,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,C.image[ca]);e.generateMipmap(e.TEXTURE_CUBE_MAP);e.bindTexture(e.TEXTURE_CUBE_MAP,null);C.image.__cubeMapInitialized=!0}e.activeTexture(e.TEXTURE0+z);e.bindTexture(e.TEXTURE_CUBE_MAP,
+C.image.__webGLTextureCube)}}else{if(!C.__webGLTexture&&C.image.loaded){C.__webGLTexture=e.createTexture();e.bindTexture(e.TEXTURE_2D,C.__webGLTexture);e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,C.image);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,q(C.wrap_s));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,q(C.wrap_t));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,q(C.mag_filter));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,q(C.min_filter));e.generateMipmap(e.TEXTURE_2D);
+e.bindTexture(e.TEXTURE_2D,null)}e.activeTexture(e.TEXTURE0+z);e.bindTexture(e.TEXTURE_2D,C.__webGLTexture)}}}e.uniformMatrix4fv(H.modelViewMatrix,!1,n._modelViewMatrixArray);e.uniformMatrix3fv(H.normalMatrix,!1,n._normalMatrixArray);(p instanceof THREE.MeshShaderMaterial||p instanceof THREE.MeshPhongMaterial||p.env_map)&&e.uniform3f(H.cameraPosition,l.position.x,l.position.y,l.position.z);(p instanceof THREE.MeshShaderMaterial||p.env_map||p.skinning)&&e.uniformMatrix4fv(H.objectMatrix,!1,n._objectMatrixArray);
+(p instanceof THREE.MeshPhongMaterial||p instanceof THREE.MeshLambertMaterial||p instanceof THREE.MeshShaderMaterial||p.skinning)&&e.uniformMatrix4fv(H.viewMatrix,!1,ka);if(p.skinning){e.uniformMatrix4fv(H.cameraInverseMatrix,!1,W);e.uniformMatrix4fv(H.uBoneGlobalMatrices,!1,n.boneMatrices)}return B}function f(l,z,C,p,n,B){l=d(l,z,C,p,B).attributes;e.bindBuffer(e.ARRAY_BUFFER,n.__webGLVertexBuffer);e.vertexAttribPointer(l.position,3,e.FLOAT,!1,0,0);if(l.color>=0){e.bindBuffer(e.ARRAY_BUFFER,n.__webGLColorBuffer);
 e.vertexAttribPointer(l.color,3,e.FLOAT,!1,0,0)}if(l.normal>=0){e.bindBuffer(e.ARRAY_BUFFER,n.__webGLNormalBuffer);e.vertexAttribPointer(l.normal,3,e.FLOAT,!1,0,0)}if(l.tangent>=0){e.bindBuffer(e.ARRAY_BUFFER,n.__webGLTangentBuffer);e.vertexAttribPointer(l.tangent,4,e.FLOAT,!1,0,0)}if(l.uv>=0)if(n.__webGLUVBuffer){e.bindBuffer(e.ARRAY_BUFFER,n.__webGLUVBuffer);e.vertexAttribPointer(l.uv,2,e.FLOAT,!1,0,0);e.enableVertexAttribArray(l.uv)}else e.disableVertexAttribArray(l.uv);if(l.uv2>=0)if(n.__webGLUV2Buffer){e.bindBuffer(e.ARRAY_BUFFER,
 e.vertexAttribPointer(l.color,3,e.FLOAT,!1,0,0)}if(l.normal>=0){e.bindBuffer(e.ARRAY_BUFFER,n.__webGLNormalBuffer);e.vertexAttribPointer(l.normal,3,e.FLOAT,!1,0,0)}if(l.tangent>=0){e.bindBuffer(e.ARRAY_BUFFER,n.__webGLTangentBuffer);e.vertexAttribPointer(l.tangent,4,e.FLOAT,!1,0,0)}if(l.uv>=0)if(n.__webGLUVBuffer){e.bindBuffer(e.ARRAY_BUFFER,n.__webGLUVBuffer);e.vertexAttribPointer(l.uv,2,e.FLOAT,!1,0,0);e.enableVertexAttribArray(l.uv)}else e.disableVertexAttribArray(l.uv);if(l.uv2>=0)if(n.__webGLUV2Buffer){e.bindBuffer(e.ARRAY_BUFFER,
 n.__webGLUV2Buffer);e.vertexAttribPointer(l.uv2,2,e.FLOAT,!1,0,0);e.enableVertexAttribArray(l.uv2)}else e.disableVertexAttribArray(l.uv2);if(p.skinning&&l.skinVertexA>=0&&l.skinVertexB>=0&&l.skinIndex>=0&&l.skinWeight>=0){e.bindBuffer(e.ARRAY_BUFFER,n.__webGLSkinVertexABuffer);e.vertexAttribPointer(l.skinVertexA,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,n.__webGLSkinVertexBBuffer);e.vertexAttribPointer(l.skinVertexB,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,n.__webGLSkinIndicesBuffer);e.vertexAttribPointer(l.skinIndex,
 n.__webGLUV2Buffer);e.vertexAttribPointer(l.uv2,2,e.FLOAT,!1,0,0);e.enableVertexAttribArray(l.uv2)}else e.disableVertexAttribArray(l.uv2);if(p.skinning&&l.skinVertexA>=0&&l.skinVertexB>=0&&l.skinIndex>=0&&l.skinWeight>=0){e.bindBuffer(e.ARRAY_BUFFER,n.__webGLSkinVertexABuffer);e.vertexAttribPointer(l.skinVertexA,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,n.__webGLSkinVertexBBuffer);e.vertexAttribPointer(l.skinVertexB,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,n.__webGLSkinIndicesBuffer);e.vertexAttribPointer(l.skinIndex,
-4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,n.__webGLSkinWeightsBuffer);e.vertexAttribPointer(l.skinWeight,4,e.FLOAT,!1,0,0)}if(E instanceof THREE.Mesh)if(p.wireframe){e.lineWidth(p.wireframe_linewidth);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n.__webGLLineBuffer);e.drawElements(e.LINES,n.__webGLLineCount,e.UNSIGNED_SHORT,0)}else{e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n.__webGLFaceBuffer);e.drawElements(e.TRIANGLES,n.__webGLFaceCount,e.UNSIGNED_SHORT,0)}else if(E instanceof THREE.Line){E=E.type==THREE.LineStrip?
-e.LINE_STRIP:e.LINES;e.lineWidth(p.linewidth);e.drawArrays(E,0,n.__webGLLineCount)}else E instanceof THREE.ParticleSystem&&e.drawArrays(e.POINTS,0,n.__webGLParticleCount)}function g(l,z){if(!l.__webGLVertexBuffer)l.__webGLVertexBuffer=e.createBuffer();if(!l.__webGLNormalBuffer)l.__webGLNormalBuffer=e.createBuffer();if(l.hasPos){e.bindBuffer(e.ARRAY_BUFFER,l.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,l.positionArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(z.attributes.position);e.vertexAttribPointer(z.attributes.position,
-3,e.FLOAT,!1,0,0)}if(l.hasNormal){e.bindBuffer(e.ARRAY_BUFFER,l.__webGLNormalBuffer);e.bufferData(e.ARRAY_BUFFER,l.normalArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(z.attributes.normal);e.vertexAttribPointer(z.attributes.normal,3,e.FLOAT,!1,0,0)}e.drawArrays(e.TRIANGLES,0,l.count);l.count=0}function h(l){if(V!=l.doubleSided){l.doubleSided?e.disable(e.CULL_FACE):e.enable(e.CULL_FACE);V=l.doubleSided}if(S!=l.flipSided){l.flipSided?e.frontFace(e.CW):e.frontFace(e.CCW);S=l.flipSided}}function k(l){if(Z!=
-l){l?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST);Z=l}}function j(l){G[0].set(l.n41-l.n11,l.n42-l.n12,l.n43-l.n13,l.n44-l.n14);G[1].set(l.n41+l.n11,l.n42+l.n12,l.n43+l.n13,l.n44+l.n14);G[2].set(l.n41+l.n21,l.n42+l.n22,l.n43+l.n23,l.n44+l.n24);G[3].set(l.n41-l.n21,l.n42-l.n22,l.n43-l.n23,l.n44-l.n24);G[4].set(l.n41-l.n31,l.n42-l.n32,l.n43-l.n33,l.n44-l.n34);G[5].set(l.n41+l.n31,l.n42+l.n32,l.n43+l.n33,l.n44+l.n34);var z;for(l=0;l<5;l++){z=G[l];z.divideScalar(Math.sqrt(z.x*z.x+z.y*z.y+z.z*z.z))}}
-function m(l){for(var z=l.globalMatrix,B=-l.geometry.boundingSphere.radius*Math.max(l.scale.x,Math.max(l.scale.y,l.scale.z)),p=0;p<6;p++){l=G[p].x*z.n14+G[p].y*z.n24+G[p].z*z.n34+G[p].w;if(l<=B)return!1}return!0}function o(l,z){l.list[l.count]=z;l.count+=1}function w(l){var z,B,p=l.object,n=l.opaque,E=l.transparent;E.count=0;l=n.count=0;for(z=p.materials.length;l<z;l++){B=p.materials[l];B.opacity&&B.opacity<1||B.blending!=THREE.NormalBlending?o(E,B):o(n,B)}}function u(l){var z,B,p,n,E=l.object,I=
-l.buffer,P=l.opaque,da=l.transparent;da.count=0;l=P.count=0;for(p=E.materials.length;l<p;l++){z=E.materials[l];if(z instanceof THREE.MeshFaceMaterial){z=0;for(B=I.materials.length;z<B;z++)(n=I.materials[z])&&(n.opacity&&n.opacity<1||n.blending!=THREE.NormalBlending?o(da,n):o(P,n))}else{n=z;n.opacity&&n.opacity<1||n.blending!=THREE.NormalBlending?o(da,n):o(P,n)}}}function t(l,z){return z.z-l.z}function x(l,z,B,p,n){if(z[B]==undefined){l.push({buffer:p,object:n,opaque:{list:[],count:0},transparent:{list:[],
-count:0}});z[B]=1}}function A(l,z){l._modelViewMatrix.multiplyToArray(z.globalMatrix,l.globalMatrix,l._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(l._modelViewMatrix).transposeIntoArray(l._normalMatrixArray)}function F(l){if(l!=Y){switch(l){case THREE.AdditiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ONE,e.ONE);break;case THREE.SubtractiveBlending:e.blendFunc(e.DST_COLOR,e.ZERO);break;case THREE.BillboardBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA);
-break;default:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA)}Y=l}}function v(l,z){if(l&&!l.__webGLFramebuffer){l.__webGLFramebuffer=e.createFramebuffer();l.__webGLRenderbuffer=e.createRenderbuffer();l.__webGLTexture=e.createTexture();e.bindRenderbuffer(e.RENDERBUFFER,l.__webGLRenderbuffer);e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_COMPONENT16,l.width,l.height);e.bindTexture(e.TEXTURE_2D,l.__webGLTexture);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,q(l.wrap_s));e.texParameteri(e.TEXTURE_2D,
-e.TEXTURE_WRAP_T,q(l.wrap_t));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,q(l.mag_filter));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,q(l.min_filter));e.texImage2D(e.TEXTURE_2D,0,q(l.format),l.width,l.height,0,q(l.format),q(l.type),null);e.bindFramebuffer(e.FRAMEBUFFER,l.__webGLFramebuffer);e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,l.__webGLTexture,0);e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,l.__webGLRenderbuffer);e.bindTexture(e.TEXTURE_2D,
-null);e.bindRenderbuffer(e.RENDERBUFFER,null);e.bindFramebuffer(e.FRAMEBUFFER,null)}var B,p,n;if(l){B=l.__webGLFramebuffer;p=l.width;n=l.height}else{B=null;p=J.width;n=J.height}if(B!=L){e.bindFramebuffer(e.FRAMEBUFFER,B);e.viewport(0,0,p,n);z&&e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT);L=B}}function H(l,z){var B;if(l=="fragment")B=e.createShader(e.FRAGMENT_SHADER);else l=="vertex"&&(B=e.createShader(e.VERTEX_SHADER));e.shaderSource(B,z);e.compileShader(B);if(!e.getShaderParameter(B,e.COMPILE_STATUS)){alert(e.getShaderInfoLog(B));
-return null}return B}function q(l){switch(l){case THREE.RepeatWrapping:return e.REPEAT;case THREE.ClampToEdgeWrapping:return e.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return e.MIRRORED_REPEAT;case THREE.NearestFilter:return e.NEAREST;case THREE.NearestMipMapNearestFilter:return e.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return e.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return e.LINEAR;case THREE.LinearMipMapNearestFilter:return e.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return e.LINEAR_MIPMAP_LINEAR;
-case THREE.ByteType:return e.BYTE;case THREE.UnsignedByteType:return e.UNSIGNED_BYTE;case THREE.ShortType:return e.SHORT;case THREE.UnsignedShortType:return e.UNSIGNED_SHORT;case THREE.IntType:return e.INT;case THREE.UnsignedShortType:return e.UNSIGNED_INT;case THREE.FloatType:return e.FLOAT;case THREE.AlphaFormat:return e.ALPHA;case THREE.RGBFormat:return e.RGB;case THREE.RGBAFormat:return e.RGBA;case THREE.LuminanceFormat:return e.LUMINANCE;case THREE.LuminanceAlphaFormat:return e.LUMINANCE_ALPHA}return 0}
-var J=document.createElement("canvas"),e,ba=null,L=null,M=this,V=null,S=null,Y=null,Z=null,G=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],T=new THREE.Matrix4,la=new Float32Array(16),W=new Float32Array(16),ja=new Float32Array(16),ia=new THREE.Vector4,$=!0,ra=new THREE.Color(0),ya=0;if(a){if(a.antialias!==undefined)$=a.antialias;a.clearColor!==undefined&&ra.setHex(a.clearColor);if(a.clearAlpha!==undefined)ya=a.clearAlpha}this.domElement=
-J;this.autoClear=!0;this.sortObjects=!1;(function(l,z,B){try{e=J.getContext("experimental-webgl",{antialias:l})}catch(p){console.log(p)}if(!e){alert("WebGL not supported");throw"cannot create webgl context";}e.clearColor(0,0,0,1);e.clearDepth(1);e.enable(e.DEPTH_TEST);e.depthFunc(e.LEQUAL);e.frontFace(e.CCW);e.cullFace(e.BACK);e.enable(e.CULL_FACE);e.enable(e.BLEND);e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA);e.clearColor(z.r,z.g,z.b,B);_cullEnabled=!0})($,ra,ya);this.context=e;this.lights={ambient:[0,
-0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}};this.setSize=function(l,z){J.width=l;J.height=z;e.viewport(0,0,J.width,J.height)};this.setClearColorHex=function(l,z){var B=new THREE.Color(l);e.clearColor(B.r,B.g,B.b,z)};this.setClearColor=function(l,z){e.clearColor(l.r,l.g,l.b,z)};this.clear=function(){e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT)};this.initMaterial=function(l,z,B){var p,n;if(l instanceof THREE.MeshDepthMaterial)c(l,THREE.ShaderLib.depth);
-else if(l instanceof THREE.MeshNormalMaterial)c(l,THREE.ShaderLib.normal);else if(l instanceof THREE.MeshBasicMaterial)c(l,THREE.ShaderLib.basic);else if(l instanceof THREE.MeshLambertMaterial)c(l,THREE.ShaderLib.lambert);else if(l instanceof THREE.MeshPhongMaterial)c(l,THREE.ShaderLib.phong);else if(l instanceof THREE.LineBasicMaterial)c(l,THREE.ShaderLib.basic);else l instanceof THREE.ParticleBasicMaterial&&c(l,THREE.ShaderLib.particle_basic);var E,I,P,da;n=P=da=0;for(E=z.length;n<E;n++){I=z[n];
-I instanceof THREE.DirectionalLight&&P++;I instanceof THREE.PointLight&&da++}if(da+P<=4)z=P;else{z=Math.ceil(4*P/(da+P));da=4-z}n={directional:z,point:da};da=l.fragment_shader;z=l.vertex_shader;E={fog:B,map:l.map,env_map:l.env_map,light_map:l.light_map,vertex_colors:l.vertex_colors,skinning:l.skinning,maxDirLights:n.directional,maxPointLights:n.point};B=e.createProgram();n=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+E.maxDirLights,"#define MAX_POINT_LIGHTS "+E.maxPointLights,
-E.fog?"#define USE_FOG":"",E.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",E.map?"#define USE_MAP":"",E.env_map?"#define USE_ENVMAP":"",E.light_map?"#define USE_LIGHTMAP":"",E.vertex_colors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");E=[e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+E.maxDirLights,"#define MAX_POINT_LIGHTS "+E.maxPointLights,E.map?"#define USE_MAP":"",E.env_map?"#define USE_ENVMAP":
-"",E.light_map?"#define USE_LIGHTMAP":"",E.vertex_colors?"#define USE_COLOR":"",E.skinning?"#define USE_SKINNING":"","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 vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n");
-e.attachShader(B,H("fragment",n+da));e.attachShader(B,H("vertex",E+z));e.linkProgram(B);e.getProgramParameter(B,e.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+e.getProgramParameter(B,e.VALIDATE_STATUS)+", gl error ["+e.getError()+"]");B.uniforms={};B.attributes={};l.program=B;B=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","uBoneGlobalMatrices"];for(p in l.uniforms)B.push(p);p=l.program;da=0;for(z=B.length;da<
-z;da++){n=B[da];p.uniforms[n]=e.getUniformLocation(p,n)}p=l.program;B=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];da=0;for(z=B.length;da<z;da++){n=B[da];p.attributes[n]=e.getAttribLocation(p,n)}p=l.program.attributes;e.enableVertexAttribArray(p.position);p.color>=0&&e.enableVertexAttribArray(p.color);p.normal>=0&&e.enableVertexAttribArray(p.normal);p.tangent>=0&&e.enableVertexAttribArray(p.tangent);if(l.skinning&&p.skinVertexA>=0&&p.skinVertexB>=
-0&&p.skinIndex>=0&&p.skinWeight>=0){e.enableVertexAttribArray(p.skinVertexA);e.enableVertexAttribArray(p.skinVertexB);e.enableVertexAttribArray(p.skinIndex);e.enableVertexAttribArray(p.skinWeight)}};this.render=function(l,z,B,p){var n,E,I,P,da,y,C,D,Q=l.lights,U=l.fog;z.autoUpdateMatrix&&z.update();z.globalMatrix.flattenToArray(ja);z.projectionMatrix.flattenToArray(la);z.inverseMatrix.flattenToArray(W);T.multiply(z.projectionMatrix,z.globalMatrix);j(T);THREE.AnimationHandler&&THREE.AnimationHandler.update();
-l.update(undefined,!1,z);this.initWebGLObjects(l,z);v(B,p!==undefined?p:!0);this.autoClear&&this.clear();da=l.__webGLObjects.length;for(p=0;p<da;p++){n=l.__webGLObjects[p];C=n.object;if(C.visible)if(!(C instanceof THREE.Mesh)||m(C)){C.globalMatrix.flattenToArray(C._objectMatrixArray);A(C,z);u(n);n.render=!0;if(this.sortObjects){ia.copy(C.position);T.multiplyVector3(ia);n.z=ia.z}}else n.render=!1;else n.render=!1}this.sortObjects&&l.__webGLObjects.sort(t);y=l.__webGLObjectsImmediate.length;for(p=0;p<
-y;p++){n=l.__webGLObjectsImmediate[p];C=n.object;if(C.visible){C.autoUpdateMatrix&&C.globalMatrix.flattenToArray(C._objectMatrixArray);A(C,z);w(n)}}F(THREE.NormalBlending);for(p=0;p<da;p++){n=l.__webGLObjects[p];if(n.render){C=n.object;D=n.buffer;I=n.opaque;h(C);for(n=0;n<I.count;n++){P=I.list[n];k(P.depth_test);f(z,Q,U,P,D,C)}}}for(p=0;p<y;p++){n=l.__webGLObjectsImmediate[p];C=n.object;if(C.visible){I=n.opaque;h(C);for(n=0;n<I.count;n++){P=I.list[n];k(P.depth_test);E=d(z,Q,U,P,C);C.render(function(pa){g(pa,
-E)})}}}for(p=0;p<da;p++){n=l.__webGLObjects[p];if(n.render){C=n.object;D=n.buffer;I=n.transparent;h(C);for(n=0;n<I.count;n++){P=I.list[n];F(P.blending);k(P.depth_test);f(z,Q,U,P,D,C)}}}for(p=0;p<y;p++){n=l.__webGLObjectsImmediate[p];C=n.object;if(C.visible){I=n.transparent;h(C);for(n=0;n<I.count;n++){P=I.list[n];F(P.blending);k(P.depth_test);E=d(z,Q,U,P,C);C.render(function(pa){g(pa,E)})}}}if(B&&B.min_filter!==THREE.NearestFilter&&B.min_filter!==THREE.LinearFilter){e.bindTexture(e.TEXTURE_2D,B.__webGLTexture);
-e.generateMipmap(e.TEXTURE_2D);e.bindTexture(e.TEXTURE_2D,null)}};this.initWebGLObjects=function(l){var z,B,p;if(!l.__webGLObjects){l.__webGLObjects=[];l.__webGLObjectsMap={};l.__webGLObjectsImmediate=[]}z=0;for(B=l.objects.length;z<B;z++){p=l.objects[z];var n=l,E=void 0,I=void 0,P=void 0,da=void 0;I=p.geometry;if(n.__webGLObjectsMap[p.id]==undefined){n.__webGLObjectsMap[p.id]={};p._modelViewMatrix=new THREE.Matrix4;p._normalMatrixArray=new Float32Array(9);p._modelViewMatrixArray=new Float32Array(16);
-p._objectMatrixArray=new Float32Array(16);p.globalMatrix.flattenToArray(p._objectMatrixArray)}da=n.__webGLObjectsMap[p.id];objlist=n.__webGLObjects;if(p instanceof THREE.Mesh){for(E in I.geometryChunks){P=I.geometryChunks[E];if(!P.__webGLVertexBuffer){n=P;n.__webGLVertexBuffer=e.createBuffer();n.__webGLNormalBuffer=e.createBuffer();n.__webGLTangentBuffer=e.createBuffer();n.__webGLColorBuffer=e.createBuffer();n.__webGLUVBuffer=e.createBuffer();n.__webGLUV2Buffer=e.createBuffer();n.__webGLSkinVertexABuffer=
-e.createBuffer();n.__webGLSkinVertexBBuffer=e.createBuffer();n.__webGLSkinIndicesBuffer=e.createBuffer();n.__webGLSkinWeightsBuffer=e.createBuffer();n.__webGLFaceBuffer=e.createBuffer();n.__webGLLineBuffer=e.createBuffer();n=P;var y=p,C=void 0,D=void 0,Q=0,U=0,pa=0,ka=y.geometry.faces,ma=n.faces;C=0;for(D=ma.length;C<D;C++){fi=ma[C];face=ka[fi];if(face instanceof THREE.Face3){Q+=3;U+=1;pa+=3}else if(face instanceof THREE.Face4){Q+=4;U+=2;pa+=4}}n.__vertexArray=new Float32Array(Q*3);n.__normalArray=
-new Float32Array(Q*3);n.__tangentArray=new Float32Array(Q*4);n.__colorArray=new Float32Array(Q*3);n.__uvArray=new Float32Array(Q*2);n.__uv2Array=new Float32Array(Q*2);n.__skinVertexAArray=new Float32Array(Q*4);n.__skinVertexBArray=new Float32Array(Q*4);n.__skinIndexArray=new Float32Array(Q*4);n.__skinWeightArray=new Float32Array(Q*4);n.__faceArray=new Uint16Array(U*3);n.__lineArray=new Uint16Array(pa*2);D=C=n;Q=void 0;ka=void 0;var na=void 0,oa=void 0;na=void 0;ma=!1;Q=0;for(ka=y.materials.length;Q<
-ka;Q++){na=y.materials[Q];if(na instanceof THREE.MeshFaceMaterial){na=0;for(oa=D.materials.length;na<oa;na++)if(D.materials[na]&&D.materials[na].shading!=undefined&&D.materials[na].shading==THREE.SmoothShading){ma=!0;break}}else if(na&&na.shading!=undefined&&na.shading==THREE.SmoothShading){ma=!0;break}if(ma)break}C.__needsSmoothNormals=ma;n.__webGLFaceCount=U*3;n.__webGLLineCount=pa*2;I.__dirtyVertices=!0;I.__dirtyElements=!0;I.__dirtyUvs=!0;I.__dirtyNormals=!0;I.__dirtyTangents=!0;I.__dirtyColors=
-!0}if(I.__dirtyVertices||I.__dirtyElements||I.__dirtyUvs||I.__dirtyNormals||I.__dirtyColors||I.__dirtyTangents){n=P;U=e.DYNAMIC_DRAW;pa=void 0;C=void 0;var sa=void 0,N=void 0,Ia=void 0,Ca=void 0,Ja=void 0;sa=void 0;var ca=void 0,aa=void 0,X=void 0,ta=void 0;ca=void 0;aa=void 0;X=void 0;N=void 0;ca=void 0;aa=void 0;X=void 0;ta=void 0;ca=void 0;aa=void 0;X=void 0;ta=void 0;ca=void 0;aa=void 0;X=void 0;ta=void 0;ca=void 0;aa=void 0;X=void 0;ta=void 0;ca=void 0;aa=void 0;X=void 0;ta=void 0;N=void 0;Ca=
-void 0;Ia=void 0;Ja=void 0;var Fa=oa=na=ma=ka=Q=y=D=0,Da=0,K=0,Ea=n.__vertexArray,Ra=n.__uvArray,Pa=n.__uv2Array,Ka=n.__normalArray,ha=n.__tangentArray,wa=n.__colorArray,ua=n.__skinVertexAArray,xa=n.__skinVertexBArray,za=n.__skinIndexArray,va=n.__skinWeightArray,O=n.__faceArray,fa=n.__lineArray,ga=n.__needsSmoothNormals,R=p.geometry,ea=R.__dirtyVertices,qa=R.__dirtyElements,Aa=R.__dirtyUvs,Ga=R.__dirtyNormals,Ha=R.__dirtyTangents,La=R.__dirtyColors,Ba=R.vertices,Ma=n.faces,Ta=R.faces,Na=R.uvs,Oa=
-R.uvs2,Qa=R.colors,Ua=R.skinVerticesA,Va=R.skinVerticesB,Wa=R.skinIndices,Sa=R.skinWeights;pa=0;for(C=Ma.length;pa<C;pa++){sa=Ma[pa];N=Ta[sa];Ja=Na[sa];sa=Oa[sa];Ia=N.vertexNormals;Ca=N.normal;if(N instanceof THREE.Face3){if(ea){ca=Ba[N.a].position;aa=Ba[N.b].position;X=Ba[N.c].position;Ea[y]=ca.x;Ea[y+1]=ca.y;Ea[y+2]=ca.z;Ea[y+3]=aa.x;Ea[y+4]=aa.y;Ea[y+5]=aa.z;Ea[y+6]=X.x;Ea[y+7]=X.y;Ea[y+8]=X.z;y+=9}if(Sa.length){ca=Sa[N.a];aa=Sa[N.b];X=Sa[N.c];va[K]=ca.x;va[K+1]=ca.y;va[K+2]=ca.z;va[K+3]=ca.w;
-va[K+4]=aa.x;va[K+5]=aa.y;va[K+6]=aa.z;va[K+7]=aa.w;va[K+8]=X.x;va[K+9]=X.y;va[K+10]=X.z;va[K+11]=X.w;ca=Wa[N.a];aa=Wa[N.b];X=Wa[N.c];za[K]=ca.x;za[K+1]=ca.y;za[K+2]=ca.z;za[K+3]=ca.w;za[K+4]=aa.x;za[K+5]=aa.y;za[K+6]=aa.z;za[K+7]=aa.w;za[K+8]=X.x;za[K+9]=X.y;za[K+10]=X.z;za[K+11]=X.w;ca=Ua[N.a];aa=Ua[N.b];X=Ua[N.c];ua[K]=ca.x;ua[K+1]=ca.y;ua[K+2]=ca.z;ua[K+3]=1;ua[K+4]=aa.x;ua[K+5]=aa.y;ua[K+6]=aa.z;ua[K+7]=1;ua[K+8]=X.x;ua[K+9]=X.y;ua[K+10]=X.z;ua[K+11]=1;ca=Va[N.a];aa=Va[N.b];X=Va[N.c];xa[K]=ca.x;
-xa[K+1]=ca.y;xa[K+2]=ca.z;xa[K+3]=1;xa[K+4]=aa.x;xa[K+5]=aa.y;xa[K+6]=aa.z;xa[K+7]=1;xa[K+8]=X.x;xa[K+9]=X.y;xa[K+10]=X.z;xa[K+11]=1;K+=12}if(La&&Qa.length){ca=Qa[N.a];aa=Qa[N.b];X=Qa[N.c];wa[Da]=ca.r;wa[Da+1]=ca.g;wa[Da+2]=ca.b;wa[Da+3]=aa.r;wa[Da+4]=aa.g;wa[Da+5]=aa.b;wa[Da+6]=X.r;wa[Da+7]=X.g;wa[Da+8]=X.b;Da+=9}if(Ha&&R.hasTangents){ca=Ba[N.a].tangent;aa=Ba[N.b].tangent;X=Ba[N.c].tangent;ha[oa]=ca.x;ha[oa+1]=ca.y;ha[oa+2]=ca.z;ha[oa+3]=ca.w;ha[oa+4]=aa.x;ha[oa+5]=aa.y;ha[oa+6]=aa.z;ha[oa+7]=aa.w;
-ha[oa+8]=X.x;ha[oa+9]=X.y;ha[oa+10]=X.z;ha[oa+11]=X.w;oa+=12}if(Ga)if(Ia.length==3&&ga)for(N=0;N<3;N++){Ca=Ia[N];Ka[na]=Ca.x;Ka[na+1]=Ca.y;Ka[na+2]=Ca.z;na+=3}else for(N=0;N<3;N++){Ka[na]=Ca.x;Ka[na+1]=Ca.y;Ka[na+2]=Ca.z;na+=3}if(Aa&&Ja)for(N=0;N<3;N++){Ia=Ja[N];Ra[Q]=Ia.u;Ra[Q+1]=Ia.v;Q+=2}if(Aa&&sa)for(N=0;N<3;N++){Ja=sa[N];Pa[ka]=Ja.u;Pa[ka+1]=Ja.v;ka+=2}if(qa){O[ma]=D;O[ma+1]=D+1;O[ma+2]=D+2;ma+=3;fa[Fa]=D;fa[Fa+1]=D+1;fa[Fa+2]=D;fa[Fa+3]=D+2;fa[Fa+4]=D+1;fa[Fa+5]=D+2;Fa+=6;D+=3}}else if(N instanceof
-THREE.Face4){if(ea){ca=Ba[N.a].position;aa=Ba[N.b].position;X=Ba[N.c].position;ta=Ba[N.d].position;Ea[y]=ca.x;Ea[y+1]=ca.y;Ea[y+2]=ca.z;Ea[y+3]=aa.x;Ea[y+4]=aa.y;Ea[y+5]=aa.z;Ea[y+6]=X.x;Ea[y+7]=X.y;Ea[y+8]=X.z;Ea[y+9]=ta.x;Ea[y+10]=ta.y;Ea[y+11]=ta.z;y+=12}if(Sa.length){ca=Sa[N.a];aa=Sa[N.b];X=Sa[N.c];ta=Sa[N.d];va[K]=ca.x;va[K+1]=ca.y;va[K+2]=ca.z;va[K+3]=ca.w;va[K+4]=aa.x;va[K+5]=aa.y;va[K+6]=aa.z;va[K+7]=aa.w;va[K+8]=X.x;va[K+9]=X.y;va[K+10]=X.z;va[K+11]=X.w;va[K+12]=ta.x;va[K+13]=ta.y;va[K+14]=
-ta.z;va[K+15]=ta.w;ca=Wa[N.a];aa=Wa[N.b];X=Wa[N.c];ta=Wa[N.d];za[K]=ca.x;za[K+1]=ca.y;za[K+2]=ca.z;za[K+3]=ca.w;za[K+4]=aa.x;za[K+5]=aa.y;za[K+6]=aa.z;za[K+7]=aa.w;za[K+8]=X.x;za[K+9]=X.y;za[K+10]=X.z;za[K+11]=X.w;za[K+12]=ta.x;za[K+13]=ta.y;za[K+14]=ta.z;za[K+15]=ta.w;ca=Ua[N.a];aa=Ua[N.b];X=Ua[N.c];ta=Ua[N.d];ua[K]=ca.x;ua[K+1]=ca.y;ua[K+2]=ca.z;ua[K+3]=1;ua[K+4]=aa.x;ua[K+5]=aa.y;ua[K+6]=aa.z;ua[K+7]=1;ua[K+8]=X.x;ua[K+9]=X.y;ua[K+10]=X.z;ua[K+11]=1;ua[K+12]=ta.x;ua[K+13]=ta.y;ua[K+14]=ta.z;ua[K+
-15]=1;ca=Va[N.a];aa=Va[N.b];X=Va[N.c];ta=Va[N.d];xa[K]=ca.x;xa[K+1]=ca.y;xa[K+2]=ca.z;xa[K+3]=1;xa[K+4]=aa.x;xa[K+5]=aa.y;xa[K+6]=aa.z;xa[K+7]=1;xa[K+8]=X.x;xa[K+9]=X.y;xa[K+10]=X.z;xa[K+11]=1;xa[K+12]=ta.x;xa[K+13]=ta.y;xa[K+14]=ta.z;xa[K+15]=1;K+=16}if(La&&Qa.length){ca=Qa[N.a];aa=Qa[N.b];X=Qa[N.c];ta=Qa[N.d];wa[Da]=ca.r;wa[Da+1]=ca.g;wa[Da+2]=ca.b;wa[Da+3]=aa.r;wa[Da+4]=aa.g;wa[Da+5]=aa.b;wa[Da+6]=X.r;wa[Da+7]=X.g;wa[Da+8]=X.b;wa[Da+9]=ta.r;wa[Da+10]=ta.g;wa[Da+11]=ta.b;Da+=12}if(Ha&&R.hasTangents){ca=
-Ba[N.a].tangent;aa=Ba[N.b].tangent;X=Ba[N.c].tangent;N=Ba[N.d].tangent;ha[oa]=ca.x;ha[oa+1]=ca.y;ha[oa+2]=ca.z;ha[oa+3]=ca.w;ha[oa+4]=aa.x;ha[oa+5]=aa.y;ha[oa+6]=aa.z;ha[oa+7]=aa.w;ha[oa+8]=X.x;ha[oa+9]=X.y;ha[oa+10]=X.z;ha[oa+11]=X.w;ha[oa+12]=N.x;ha[oa+13]=N.y;ha[oa+14]=N.z;ha[oa+15]=N.w;oa+=16}if(Ga)if(Ia.length==4&&ga)for(N=0;N<4;N++){Ca=Ia[N];Ka[na]=Ca.x;Ka[na+1]=Ca.y;Ka[na+2]=Ca.z;na+=3}else for(N=0;N<4;N++){Ka[na]=Ca.x;Ka[na+1]=Ca.y;Ka[na+2]=Ca.z;na+=3}if(Aa&&Ja)for(N=0;N<4;N++){Ia=Ja[N];Ra[Q]=
-Ia.u;Ra[Q+1]=Ia.v;Q+=2}if(Aa&&sa)for(N=0;N<4;N++){Ja=sa[N];Pa[ka]=Ja.u;Pa[ka+1]=Ja.v;ka+=2}if(qa){O[ma]=D;O[ma+1]=D+1;O[ma+2]=D+2;O[ma+3]=D;O[ma+4]=D+2;O[ma+5]=D+3;ma+=6;fa[Fa]=D;fa[Fa+1]=D+1;fa[Fa+2]=D;fa[Fa+3]=D+3;fa[Fa+4]=D+1;fa[Fa+5]=D+2;fa[Fa+6]=D+2;fa[Fa+7]=D+3;Fa+=8;D+=4}}}if(ea){e.bindBuffer(e.ARRAY_BUFFER,n.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,Ea,U)}if(La&&Qa.length){e.bindBuffer(e.ARRAY_BUFFER,n.__webGLColorBuffer);e.bufferData(e.ARRAY_BUFFER,wa,U)}if(Ga){e.bindBuffer(e.ARRAY_BUFFER,
-n.__webGLNormalBuffer);e.bufferData(e.ARRAY_BUFFER,Ka,U)}if(Ha&&R.hasTangents){e.bindBuffer(e.ARRAY_BUFFER,n.__webGLTangentBuffer);e.bufferData(e.ARRAY_BUFFER,ha,U)}if(Aa&&Q>0){e.bindBuffer(e.ARRAY_BUFFER,n.__webGLUVBuffer);e.bufferData(e.ARRAY_BUFFER,Ra,U)}if(Aa&&ka>0){e.bindBuffer(e.ARRAY_BUFFER,n.__webGLUV2Buffer);e.bufferData(e.ARRAY_BUFFER,Pa,U)}if(qa){e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n.__webGLFaceBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,O,U);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n.__webGLLineBuffer);
-e.bufferData(e.ELEMENT_ARRAY_BUFFER,fa,U)}if(K>0){e.bindBuffer(e.ARRAY_BUFFER,n.__webGLSkinVertexABuffer);e.bufferData(e.ARRAY_BUFFER,ua,U);e.bindBuffer(e.ARRAY_BUFFER,n.__webGLSkinVertexBBuffer);e.bufferData(e.ARRAY_BUFFER,xa,U);e.bindBuffer(e.ARRAY_BUFFER,n.__webGLSkinIndicesBuffer);e.bufferData(e.ARRAY_BUFFER,za,U);e.bindBuffer(e.ARRAY_BUFFER,n.__webGLSkinWeightsBuffer);e.bufferData(e.ARRAY_BUFFER,va,U)}}x(objlist,da,E,P,p)}I.__dirtyVertices=!1;I.__dirtyElements=!1;I.__dirtyUvs=!1;I.__dirtyNormals=
-!1;I.__dirtyTangents=!1;I.__dirtyColors=!1}else if(p instanceof THREE.Line){if(!I.__webGLVertexBuffer){E=I;E.__webGLVertexBuffer=e.createBuffer();E.__webGLColorBuffer=e.createBuffer();E=I;P=E.vertices.length;E.__vertexArray=new Float32Array(P*3);E.__colorArray=new Float32Array(P*3);E.__webGLLineCount=P;I.__dirtyVertices=!0;I.__dirtyColors=!0}if(I.__dirtyVertices||I.__dirtyColors){E=I;P=e.DYNAMIC_DRAW;D=void 0;D=void 0;y=void 0;n=void 0;Q=E.vertices;U=E.colors;ka=Q.length;pa=U.length;ma=E.__vertexArray;
-C=E.__colorArray;na=E.__dirtyColors;if(E.__dirtyVertices){for(D=0;D<ka;D++){y=Q[D].position;n=D*3;ma[n]=y.x;ma[n+1]=y.y;ma[n+2]=y.z}e.bindBuffer(e.ARRAY_BUFFER,E.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,ma,P)}if(na){for(D=0;D<pa;D++){color=U[D];n=D*3;C[n]=color.r;C[n+1]=color.g;C[n+2]=color.b}e.bindBuffer(e.ARRAY_BUFFER,E.__webGLColorBuffer);e.bufferData(e.ARRAY_BUFFER,C,P)}}x(objlist,da,0,I,p);I.__dirtyVertices=!1;I.__dirtyColors=!1}else if(p instanceof THREE.ParticleSystem){if(!I.__webGLVertexBuffer){E=
-I;E.__webGLVertexBuffer=e.createBuffer();E.__webGLColorBuffer=e.createBuffer();E=I;P=E.vertices.length;E.__vertexArray=new Float32Array(P*3);E.__colorArray=new Float32Array(P*3);E.__sortArray=[];E.__webGLParticleCount=P;I.__dirtyVertices=!0;I.__dirtyColors=!0}(I.__dirtyVertices||I.__dirtyColors||p.sortParticles)&&b(I,e.DYNAMIC_DRAW,p,camera);x(objlist,da,0,I,p);I.__dirtyVertices=!1;I.__dirtyColors=!1}else if(p instanceof THREE.MarchingCubes){I=da;if(I[0]==undefined){n.__webGLObjectsImmediate.push({object:p,
-opaque:{list:[],count:0},transparent:{list:[],count:0}});I[0]=1}}}};this.removeObject=function(l,z){var B,p;for(B=l.__webGLObjects.length-1;B>=0;B--){p=l.__webGLObjects[B].object;z==p&&l.__webGLObjects.splice(B,1)}};this.setFaceCulling=function(l,z){if(l){!z||z=="ccw"?e.frontFace(e.CCW):e.frontFace(e.CW);if(l=="back")e.cullFace(e.BACK);else l=="front"?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK);e.enable(e.CULL_FACE)}else e.disable(e.CULL_FACE)};this.supportsVertexTextures=function(){return e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>
-0}};
-THREE.Snippets={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube env_map;\nuniform int combine;\n#endif",
-envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( env_map, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refraction_ratio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refraction_ratio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
-map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\n#endif",map_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\nuniform sampler2D light_map;\n#endif",
-lightmap_pars_vertex:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\n#endif",lightmap_fragment:"#ifdef USE_LIGHTMAP\ngl_FragColor = gl_FragColor * texture2D( light_map, vUv2 );\n#endif",lightmap_vertex:"#ifdef USE_LIGHTMAP\nvUv2 = uv2;\n#endif",lights_pars_vertex:"uniform bool enableLighting;\nuniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n#ifdef PHONG\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\n#endif",
+4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,n.__webGLSkinWeightsBuffer);e.vertexAttribPointer(l.skinWeight,4,e.FLOAT,!1,0,0)}if(B instanceof THREE.Mesh)if(p.wireframe){e.lineWidth(p.wireframe_linewidth);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n.__webGLLineBuffer);e.drawElements(e.LINES,n.__webGLLineCount,e.UNSIGNED_SHORT,0)}else{e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n.__webGLFaceBuffer);e.drawElements(e.TRIANGLES,n.__webGLFaceCount,e.UNSIGNED_SHORT,0)}else if(B instanceof THREE.Line){B=B.type==THREE.LineStrip?
+e.LINE_STRIP:e.LINES;e.lineWidth(p.linewidth);e.drawArrays(B,0,n.__webGLLineCount)}else if(B instanceof THREE.ParticleSystem)e.drawArrays(e.POINTS,0,n.__webGLParticleCount);else B instanceof THREE.Ribbon&&e.drawArrays(e.TRIANGLE_STRIP,0,n.__webGLVertexCount)}function g(l,z){if(!l.__webGLVertexBuffer)l.__webGLVertexBuffer=e.createBuffer();if(!l.__webGLNormalBuffer)l.__webGLNormalBuffer=e.createBuffer();if(l.hasPos){e.bindBuffer(e.ARRAY_BUFFER,l.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,l.positionArray,
+e.DYNAMIC_DRAW);e.enableVertexAttribArray(z.attributes.position);e.vertexAttribPointer(z.attributes.position,3,e.FLOAT,!1,0,0)}if(l.hasNormal){e.bindBuffer(e.ARRAY_BUFFER,l.__webGLNormalBuffer);e.bufferData(e.ARRAY_BUFFER,l.normalArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(z.attributes.normal);e.vertexAttribPointer(z.attributes.normal,3,e.FLOAT,!1,0,0)}e.drawArrays(e.TRIANGLES,0,l.count);l.count=0}function h(l){if(V!=l.doubleSided){l.doubleSided?e.disable(e.CULL_FACE):e.enable(e.CULL_FACE);V=
+l.doubleSided}if(S!=l.flipSided){l.flipSided?e.frontFace(e.CW):e.frontFace(e.CCW);S=l.flipSided}}function k(l){if(Z!=l){l?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST);Z=l}}function j(l){G[0].set(l.n41-l.n11,l.n42-l.n12,l.n43-l.n13,l.n44-l.n14);G[1].set(l.n41+l.n11,l.n42+l.n12,l.n43+l.n13,l.n44+l.n14);G[2].set(l.n41+l.n21,l.n42+l.n22,l.n43+l.n23,l.n44+l.n24);G[3].set(l.n41-l.n21,l.n42-l.n22,l.n43-l.n23,l.n44-l.n24);G[4].set(l.n41-l.n31,l.n42-l.n32,l.n43-l.n33,l.n44-l.n34);G[5].set(l.n41+l.n31,l.n42+
+l.n32,l.n43+l.n33,l.n44+l.n34);var z;for(l=0;l<5;l++){z=G[l];z.divideScalar(Math.sqrt(z.x*z.x+z.y*z.y+z.z*z.z))}}function m(l){for(var z=l.globalMatrix,C=-l.geometry.boundingSphere.radius*Math.max(l.scale.x,Math.max(l.scale.y,l.scale.z)),p=0;p<6;p++){l=G[p].x*z.n14+G[p].y*z.n24+G[p].z*z.n34+G[p].w;if(l<=C)return!1}return!0}function o(l,z){l.list[l.count]=z;l.count+=1}function w(l){var z,C,p=l.object,n=l.opaque,B=l.transparent;B.count=0;l=n.count=0;for(z=p.materials.length;l<z;l++){C=p.materials[l];
+C.opacity&&C.opacity<1||C.blending!=THREE.NormalBlending?o(B,C):o(n,C)}}function u(l){var z,C,p,n,B=l.object,H=l.buffer,N=l.opaque,ca=l.transparent;ca.count=0;l=N.count=0;for(p=B.materials.length;l<p;l++){z=B.materials[l];if(z instanceof THREE.MeshFaceMaterial){z=0;for(C=H.materials.length;z<C;z++)(n=H.materials[z])&&(n.opacity&&n.opacity<1||n.blending!=THREE.NormalBlending?o(ca,n):o(N,n))}else{n=z;n.opacity&&n.opacity<1||n.blending!=THREE.NormalBlending?o(ca,n):o(N,n)}}}function t(l,z){return z.z-
+l.z}function x(l,z,C,p,n){if(z[C]==undefined){l.push({buffer:p,object:n,opaque:{list:[],count:0},transparent:{list:[],count:0}});z[C]=1}}function A(l,z){l._modelViewMatrix.multiplyToArray(z.globalMatrix,l.globalMatrix,l._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(l._modelViewMatrix).transposeIntoArray(l._normalMatrixArray)}function F(l){if(l!=Y){switch(l){case THREE.AdditiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ONE,e.ONE);break;case THREE.SubtractiveBlending:e.blendFunc(e.DST_COLOR,
+e.ZERO);break;case THREE.BillboardBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA);break;default:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA)}Y=l}}function v(l,z){if(l&&!l.__webGLFramebuffer){l.__webGLFramebuffer=e.createFramebuffer();l.__webGLRenderbuffer=e.createRenderbuffer();l.__webGLTexture=e.createTexture();e.bindRenderbuffer(e.RENDERBUFFER,l.__webGLRenderbuffer);e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_COMPONENT16,l.width,l.height);
+e.bindTexture(e.TEXTURE_2D,l.__webGLTexture);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,q(l.wrap_s));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,q(l.wrap_t));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,q(l.mag_filter));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,q(l.min_filter));e.texImage2D(e.TEXTURE_2D,0,q(l.format),l.width,l.height,0,q(l.format),q(l.type),null);e.bindFramebuffer(e.FRAMEBUFFER,l.__webGLFramebuffer);e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,
+l.__webGLTexture,0);e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,l.__webGLRenderbuffer);e.bindTexture(e.TEXTURE_2D,null);e.bindRenderbuffer(e.RENDERBUFFER,null);e.bindFramebuffer(e.FRAMEBUFFER,null)}var C,p,n;if(l){C=l.__webGLFramebuffer;p=l.width;n=l.height}else{C=null;p=J.width;n=J.height}if(C!=L){e.bindFramebuffer(e.FRAMEBUFFER,C);e.viewport(0,0,p,n);z&&e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT);L=C}}function I(l,z){var C;if(l=="fragment")C=e.createShader(e.FRAGMENT_SHADER);
+else l=="vertex"&&(C=e.createShader(e.VERTEX_SHADER));e.shaderSource(C,z);e.compileShader(C);if(!e.getShaderParameter(C,e.COMPILE_STATUS)){alert(e.getShaderInfoLog(C));return null}return C}function q(l){switch(l){case THREE.RepeatWrapping:return e.REPEAT;case THREE.ClampToEdgeWrapping:return e.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return e.MIRRORED_REPEAT;case THREE.NearestFilter:return e.NEAREST;case THREE.NearestMipMapNearestFilter:return e.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return e.NEAREST_MIPMAP_LINEAR;
+case THREE.LinearFilter:return e.LINEAR;case THREE.LinearMipMapNearestFilter:return e.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return e.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return e.BYTE;case THREE.UnsignedByteType:return e.UNSIGNED_BYTE;case THREE.ShortType:return e.SHORT;case THREE.UnsignedShortType:return e.UNSIGNED_SHORT;case THREE.IntType:return e.INT;case THREE.UnsignedShortType:return e.UNSIGNED_INT;case THREE.FloatType:return e.FLOAT;case THREE.AlphaFormat:return e.ALPHA;
+case THREE.RGBFormat:return e.RGB;case THREE.RGBAFormat:return e.RGBA;case THREE.LuminanceFormat:return e.LUMINANCE;case THREE.LuminanceAlphaFormat:return e.LUMINANCE_ALPHA}return 0}var J=document.createElement("canvas"),e,ba=null,L=null,M=this,V=null,S=null,Y=null,Z=null,G=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],U=new THREE.Matrix4,na=new Float32Array(16),W=new Float32Array(16),ka=new Float32Array(16),ia=new THREE.Vector4,$=!0,
+ra=new THREE.Color(0),ya=0;if(a){if(a.antialias!==undefined)$=a.antialias;a.clearColor!==undefined&&ra.setHex(a.clearColor);if(a.clearAlpha!==undefined)ya=a.clearAlpha}this.domElement=J;this.autoClear=!0;this.sortObjects=!1;(function(l,z,C){try{e=J.getContext("experimental-webgl",{antialias:l})}catch(p){console.log(p)}if(!e){alert("WebGL not supported");throw"cannot create webgl context";}e.clearColor(0,0,0,1);e.clearDepth(1);e.enable(e.DEPTH_TEST);e.depthFunc(e.LEQUAL);e.frontFace(e.CCW);e.cullFace(e.BACK);
+e.enable(e.CULL_FACE);e.enable(e.BLEND);e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA);e.clearColor(z.r,z.g,z.b,C);_cullEnabled=!0})($,ra,ya);this.context=e;this.lights={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}};this.setSize=function(l,z){J.width=l;J.height=z;e.viewport(0,0,J.width,J.height)};this.setClearColorHex=function(l,z){var C=new THREE.Color(l);e.clearColor(C.r,C.g,C.b,z)};this.setClearColor=function(l,z){e.clearColor(l.r,l.g,l.b,z)};
+this.clear=function(){e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT)};this.initMaterial=function(l,z,C){var p,n;if(l instanceof THREE.MeshDepthMaterial)c(l,THREE.ShaderLib.depth);else if(l instanceof THREE.MeshNormalMaterial)c(l,THREE.ShaderLib.normal);else if(l instanceof THREE.MeshBasicMaterial)c(l,THREE.ShaderLib.basic);else if(l instanceof THREE.MeshLambertMaterial)c(l,THREE.ShaderLib.lambert);else if(l instanceof THREE.MeshPhongMaterial)c(l,THREE.ShaderLib.phong);else if(l instanceof THREE.LineBasicMaterial)c(l,
+THREE.ShaderLib.basic);else l instanceof THREE.ParticleBasicMaterial&&c(l,THREE.ShaderLib.particle_basic);var B,H,N,ca;n=N=ca=0;for(B=z.length;n<B;n++){H=z[n];H instanceof THREE.DirectionalLight&&N++;H instanceof THREE.PointLight&&ca++}if(ca+N<=4)z=N;else{z=Math.ceil(4*N/(ca+N));ca=4-z}n={directional:z,point:ca};ca=l.fragment_shader;z=l.vertex_shader;B={fog:C,map:l.map,env_map:l.env_map,light_map:l.light_map,vertex_colors:l.vertex_colors,skinning:l.skinning,maxDirLights:n.directional,maxPointLights:n.point};
+C=e.createProgram();n=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+B.maxDirLights,"#define MAX_POINT_LIGHTS "+B.maxPointLights,B.fog?"#define USE_FOG":"",B.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",B.map?"#define USE_MAP":"",B.env_map?"#define USE_ENVMAP":"",B.light_map?"#define USE_LIGHTMAP":"",B.vertex_colors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");B=[e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":
+"","#define MAX_DIR_LIGHTS "+B.maxDirLights,"#define MAX_POINT_LIGHTS "+B.maxPointLights,B.map?"#define USE_MAP":"",B.env_map?"#define USE_ENVMAP":"",B.light_map?"#define USE_LIGHTMAP":"",B.vertex_colors?"#define USE_COLOR":"",B.skinning?"#define USE_SKINNING":"","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 vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n");
+e.attachShader(C,I("fragment",n+ca));e.attachShader(C,I("vertex",B+z));e.linkProgram(C);e.getProgramParameter(C,e.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+e.getProgramParameter(C,e.VALIDATE_STATUS)+", gl error ["+e.getError()+"]");C.uniforms={};C.attributes={};l.program=C;C=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","uBoneGlobalMatrices"];for(p in l.uniforms)C.push(p);p=l.program;ca=0;for(z=C.length;ca<
+z;ca++){n=C[ca];p.uniforms[n]=e.getUniformLocation(p,n)}p=l.program;C=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];ca=0;for(z=C.length;ca<z;ca++){n=C[ca];p.attributes[n]=e.getAttribLocation(p,n)}p=l.program.attributes;e.enableVertexAttribArray(p.position);p.color>=0&&e.enableVertexAttribArray(p.color);p.normal>=0&&e.enableVertexAttribArray(p.normal);p.tangent>=0&&e.enableVertexAttribArray(p.tangent);if(l.skinning&&p.skinVertexA>=0&&p.skinVertexB>=
+0&&p.skinIndex>=0&&p.skinWeight>=0){e.enableVertexAttribArray(p.skinVertexA);e.enableVertexAttribArray(p.skinVertexB);e.enableVertexAttribArray(p.skinIndex);e.enableVertexAttribArray(p.skinWeight)}};this.render=function(l,z,C,p){var n,B,H,N,ca,y,E,D,P=l.lights,T=l.fog;z.autoUpdateMatrix&&z.update();z.globalMatrix.flattenToArray(ka);z.projectionMatrix.flattenToArray(na);z.inverseMatrix.flattenToArray(W);U.multiply(z.projectionMatrix,z.globalMatrix);j(U);THREE.AnimationHandler&&THREE.AnimationHandler.update();
+l.update(undefined,!1,z);this.initWebGLObjects(l,z);v(C,p!==undefined?p:!0);this.autoClear&&this.clear();ca=l.__webGLObjects.length;for(p=0;p<ca;p++){n=l.__webGLObjects[p];E=n.object;if(E.visible)if(!(E instanceof THREE.Mesh)||m(E)){E.globalMatrix.flattenToArray(E._objectMatrixArray);A(E,z);u(n);n.render=!0;if(this.sortObjects){ia.copy(E.position);U.multiplyVector3(ia);n.z=ia.z}}else n.render=!1;else n.render=!1}this.sortObjects&&l.__webGLObjects.sort(t);y=l.__webGLObjectsImmediate.length;for(p=0;p<
+y;p++){n=l.__webGLObjectsImmediate[p];E=n.object;if(E.visible){E.autoUpdateMatrix&&E.globalMatrix.flattenToArray(E._objectMatrixArray);A(E,z);w(n)}}F(THREE.NormalBlending);for(p=0;p<ca;p++){n=l.__webGLObjects[p];if(n.render){E=n.object;D=n.buffer;H=n.opaque;h(E);for(n=0;n<H.count;n++){N=H.list[n];k(N.depth_test);f(z,P,T,N,D,E)}}}for(p=0;p<y;p++){n=l.__webGLObjectsImmediate[p];E=n.object;if(E.visible){H=n.opaque;h(E);for(n=0;n<H.count;n++){N=H.list[n];k(N.depth_test);B=d(z,P,T,N,E);E.render(function(oa){g(oa,
+B)})}}}for(p=0;p<ca;p++){n=l.__webGLObjects[p];if(n.render){E=n.object;D=n.buffer;H=n.transparent;h(E);for(n=0;n<H.count;n++){N=H.list[n];F(N.blending);k(N.depth_test);f(z,P,T,N,D,E)}}}for(p=0;p<y;p++){n=l.__webGLObjectsImmediate[p];E=n.object;if(E.visible){H=n.transparent;h(E);for(n=0;n<H.count;n++){N=H.list[n];F(N.blending);k(N.depth_test);B=d(z,P,T,N,E);E.render(function(oa){g(oa,B)})}}}if(C&&C.min_filter!==THREE.NearestFilter&&C.min_filter!==THREE.LinearFilter){e.bindTexture(e.TEXTURE_2D,C.__webGLTexture);
+e.generateMipmap(e.TEXTURE_2D);e.bindTexture(e.TEXTURE_2D,null)}};this.initWebGLObjects=function(l){var z,C,p;if(!l.__webGLObjects){l.__webGLObjects=[];l.__webGLObjectsMap={};l.__webGLObjectsImmediate=[]}z=0;for(C=l.objects.length;z<C;z++){p=l.objects[z];var n=l,B=void 0,H=void 0,N=void 0,ca=void 0;H=p.geometry;if(n.__webGLObjectsMap[p.id]==undefined){n.__webGLObjectsMap[p.id]={};p._modelViewMatrix=new THREE.Matrix4;p._normalMatrixArray=new Float32Array(9);p._modelViewMatrixArray=new Float32Array(16);
+p._objectMatrixArray=new Float32Array(16);p.globalMatrix.flattenToArray(p._objectMatrixArray)}ca=n.__webGLObjectsMap[p.id];objlist=n.__webGLObjects;if(p instanceof THREE.Mesh){for(B in H.geometryChunks){N=H.geometryChunks[B];if(!N.__webGLVertexBuffer){n=N;n.__webGLVertexBuffer=e.createBuffer();n.__webGLNormalBuffer=e.createBuffer();n.__webGLTangentBuffer=e.createBuffer();n.__webGLColorBuffer=e.createBuffer();n.__webGLUVBuffer=e.createBuffer();n.__webGLUV2Buffer=e.createBuffer();n.__webGLSkinVertexABuffer=
+e.createBuffer();n.__webGLSkinVertexBBuffer=e.createBuffer();n.__webGLSkinIndicesBuffer=e.createBuffer();n.__webGLSkinWeightsBuffer=e.createBuffer();n.__webGLFaceBuffer=e.createBuffer();n.__webGLLineBuffer=e.createBuffer();n=N;var y=p,E=void 0,D=void 0,P=0,T=0,oa=0,la=y.geometry.faces,ja=n.faces;E=0;for(D=ja.length;E<D;E++){fi=ja[E];face=la[fi];if(face instanceof THREE.Face3){P+=3;T+=1;oa+=3}else if(face instanceof THREE.Face4){P+=4;T+=2;oa+=4}}n.__vertexArray=new Float32Array(P*3);n.__normalArray=
+new Float32Array(P*3);n.__tangentArray=new Float32Array(P*4);n.__colorArray=new Float32Array(P*3);n.__uvArray=new Float32Array(P*2);n.__uv2Array=new Float32Array(P*2);n.__skinVertexAArray=new Float32Array(P*4);n.__skinVertexBArray=new Float32Array(P*4);n.__skinIndexArray=new Float32Array(P*4);n.__skinWeightArray=new Float32Array(P*4);n.__faceArray=new Uint16Array(T*3);n.__lineArray=new Uint16Array(oa*2);D=E=n;P=void 0;la=void 0;var ma=void 0,pa=void 0;ma=void 0;ja=!1;P=0;for(la=y.materials.length;P<
+la;P++){ma=y.materials[P];if(ma instanceof THREE.MeshFaceMaterial){ma=0;for(pa=D.materials.length;ma<pa;ma++)if(D.materials[ma]&&D.materials[ma].shading!=undefined&&D.materials[ma].shading==THREE.SmoothShading){ja=!0;break}}else if(ma&&ma.shading!=undefined&&ma.shading==THREE.SmoothShading){ja=!0;break}if(ja)break}E.__needsSmoothNormals=ja;n.__webGLFaceCount=T*3;n.__webGLLineCount=oa*2;H.__dirtyVertices=!0;H.__dirtyElements=!0;H.__dirtyUvs=!0;H.__dirtyNormals=!0;H.__dirtyTangents=!0;H.__dirtyColors=
+!0}if(H.__dirtyVertices||H.__dirtyElements||H.__dirtyUvs||H.__dirtyNormals||H.__dirtyColors||H.__dirtyTangents){n=N;T=e.DYNAMIC_DRAW;oa=void 0;E=void 0;var sa=void 0,O=void 0,Ia=void 0,Ca=void 0,Ja=void 0;sa=void 0;var da=void 0,aa=void 0,X=void 0,ta=void 0;da=void 0;aa=void 0;X=void 0;O=void 0;da=void 0;aa=void 0;X=void 0;ta=void 0;da=void 0;aa=void 0;X=void 0;ta=void 0;da=void 0;aa=void 0;X=void 0;ta=void 0;da=void 0;aa=void 0;X=void 0;ta=void 0;da=void 0;aa=void 0;X=void 0;ta=void 0;O=void 0;Ca=
+void 0;Ia=void 0;Ja=void 0;var Fa=pa=ma=ja=la=P=y=D=0,Da=0,K=0,Ea=n.__vertexArray,Ra=n.__uvArray,Pa=n.__uv2Array,Ka=n.__normalArray,ha=n.__tangentArray,wa=n.__colorArray,ua=n.__skinVertexAArray,xa=n.__skinVertexBArray,za=n.__skinIndexArray,va=n.__skinWeightArray,Q=n.__faceArray,fa=n.__lineArray,ga=n.__needsSmoothNormals,R=p.geometry,ea=R.__dirtyVertices,qa=R.__dirtyElements,Aa=R.__dirtyUvs,Ga=R.__dirtyNormals,Ha=R.__dirtyTangents,La=R.__dirtyColors,Ba=R.vertices,Ma=n.faces,Ta=R.faces,Na=R.uvs,Oa=
+R.uvs2,Qa=R.colors,Ua=R.skinVerticesA,Va=R.skinVerticesB,Wa=R.skinIndices,Sa=R.skinWeights;oa=0;for(E=Ma.length;oa<E;oa++){sa=Ma[oa];O=Ta[sa];Ja=Na[sa];sa=Oa[sa];Ia=O.vertexNormals;Ca=O.normal;if(O instanceof THREE.Face3){if(ea){da=Ba[O.a].position;aa=Ba[O.b].position;X=Ba[O.c].position;Ea[y]=da.x;Ea[y+1]=da.y;Ea[y+2]=da.z;Ea[y+3]=aa.x;Ea[y+4]=aa.y;Ea[y+5]=aa.z;Ea[y+6]=X.x;Ea[y+7]=X.y;Ea[y+8]=X.z;y+=9}if(Sa.length){da=Sa[O.a];aa=Sa[O.b];X=Sa[O.c];va[K]=da.x;va[K+1]=da.y;va[K+2]=da.z;va[K+3]=da.w;
+va[K+4]=aa.x;va[K+5]=aa.y;va[K+6]=aa.z;va[K+7]=aa.w;va[K+8]=X.x;va[K+9]=X.y;va[K+10]=X.z;va[K+11]=X.w;da=Wa[O.a];aa=Wa[O.b];X=Wa[O.c];za[K]=da.x;za[K+1]=da.y;za[K+2]=da.z;za[K+3]=da.w;za[K+4]=aa.x;za[K+5]=aa.y;za[K+6]=aa.z;za[K+7]=aa.w;za[K+8]=X.x;za[K+9]=X.y;za[K+10]=X.z;za[K+11]=X.w;da=Ua[O.a];aa=Ua[O.b];X=Ua[O.c];ua[K]=da.x;ua[K+1]=da.y;ua[K+2]=da.z;ua[K+3]=1;ua[K+4]=aa.x;ua[K+5]=aa.y;ua[K+6]=aa.z;ua[K+7]=1;ua[K+8]=X.x;ua[K+9]=X.y;ua[K+10]=X.z;ua[K+11]=1;da=Va[O.a];aa=Va[O.b];X=Va[O.c];xa[K]=da.x;
+xa[K+1]=da.y;xa[K+2]=da.z;xa[K+3]=1;xa[K+4]=aa.x;xa[K+5]=aa.y;xa[K+6]=aa.z;xa[K+7]=1;xa[K+8]=X.x;xa[K+9]=X.y;xa[K+10]=X.z;xa[K+11]=1;K+=12}if(La&&Qa.length){da=Qa[O.a];aa=Qa[O.b];X=Qa[O.c];wa[Da]=da.r;wa[Da+1]=da.g;wa[Da+2]=da.b;wa[Da+3]=aa.r;wa[Da+4]=aa.g;wa[Da+5]=aa.b;wa[Da+6]=X.r;wa[Da+7]=X.g;wa[Da+8]=X.b;Da+=9}if(Ha&&R.hasTangents){da=Ba[O.a].tangent;aa=Ba[O.b].tangent;X=Ba[O.c].tangent;ha[pa]=da.x;ha[pa+1]=da.y;ha[pa+2]=da.z;ha[pa+3]=da.w;ha[pa+4]=aa.x;ha[pa+5]=aa.y;ha[pa+6]=aa.z;ha[pa+7]=aa.w;
+ha[pa+8]=X.x;ha[pa+9]=X.y;ha[pa+10]=X.z;ha[pa+11]=X.w;pa+=12}if(Ga)if(Ia.length==3&&ga)for(O=0;O<3;O++){Ca=Ia[O];Ka[ma]=Ca.x;Ka[ma+1]=Ca.y;Ka[ma+2]=Ca.z;ma+=3}else for(O=0;O<3;O++){Ka[ma]=Ca.x;Ka[ma+1]=Ca.y;Ka[ma+2]=Ca.z;ma+=3}if(Aa&&Ja)for(O=0;O<3;O++){Ia=Ja[O];Ra[P]=Ia.u;Ra[P+1]=Ia.v;P+=2}if(Aa&&sa)for(O=0;O<3;O++){Ja=sa[O];Pa[la]=Ja.u;Pa[la+1]=Ja.v;la+=2}if(qa){Q[ja]=D;Q[ja+1]=D+1;Q[ja+2]=D+2;ja+=3;fa[Fa]=D;fa[Fa+1]=D+1;fa[Fa+2]=D;fa[Fa+3]=D+2;fa[Fa+4]=D+1;fa[Fa+5]=D+2;Fa+=6;D+=3}}else if(O instanceof
+THREE.Face4){if(ea){da=Ba[O.a].position;aa=Ba[O.b].position;X=Ba[O.c].position;ta=Ba[O.d].position;Ea[y]=da.x;Ea[y+1]=da.y;Ea[y+2]=da.z;Ea[y+3]=aa.x;Ea[y+4]=aa.y;Ea[y+5]=aa.z;Ea[y+6]=X.x;Ea[y+7]=X.y;Ea[y+8]=X.z;Ea[y+9]=ta.x;Ea[y+10]=ta.y;Ea[y+11]=ta.z;y+=12}if(Sa.length){da=Sa[O.a];aa=Sa[O.b];X=Sa[O.c];ta=Sa[O.d];va[K]=da.x;va[K+1]=da.y;va[K+2]=da.z;va[K+3]=da.w;va[K+4]=aa.x;va[K+5]=aa.y;va[K+6]=aa.z;va[K+7]=aa.w;va[K+8]=X.x;va[K+9]=X.y;va[K+10]=X.z;va[K+11]=X.w;va[K+12]=ta.x;va[K+13]=ta.y;va[K+14]=
+ta.z;va[K+15]=ta.w;da=Wa[O.a];aa=Wa[O.b];X=Wa[O.c];ta=Wa[O.d];za[K]=da.x;za[K+1]=da.y;za[K+2]=da.z;za[K+3]=da.w;za[K+4]=aa.x;za[K+5]=aa.y;za[K+6]=aa.z;za[K+7]=aa.w;za[K+8]=X.x;za[K+9]=X.y;za[K+10]=X.z;za[K+11]=X.w;za[K+12]=ta.x;za[K+13]=ta.y;za[K+14]=ta.z;za[K+15]=ta.w;da=Ua[O.a];aa=Ua[O.b];X=Ua[O.c];ta=Ua[O.d];ua[K]=da.x;ua[K+1]=da.y;ua[K+2]=da.z;ua[K+3]=1;ua[K+4]=aa.x;ua[K+5]=aa.y;ua[K+6]=aa.z;ua[K+7]=1;ua[K+8]=X.x;ua[K+9]=X.y;ua[K+10]=X.z;ua[K+11]=1;ua[K+12]=ta.x;ua[K+13]=ta.y;ua[K+14]=ta.z;ua[K+
+15]=1;da=Va[O.a];aa=Va[O.b];X=Va[O.c];ta=Va[O.d];xa[K]=da.x;xa[K+1]=da.y;xa[K+2]=da.z;xa[K+3]=1;xa[K+4]=aa.x;xa[K+5]=aa.y;xa[K+6]=aa.z;xa[K+7]=1;xa[K+8]=X.x;xa[K+9]=X.y;xa[K+10]=X.z;xa[K+11]=1;xa[K+12]=ta.x;xa[K+13]=ta.y;xa[K+14]=ta.z;xa[K+15]=1;K+=16}if(La&&Qa.length){da=Qa[O.a];aa=Qa[O.b];X=Qa[O.c];ta=Qa[O.d];wa[Da]=da.r;wa[Da+1]=da.g;wa[Da+2]=da.b;wa[Da+3]=aa.r;wa[Da+4]=aa.g;wa[Da+5]=aa.b;wa[Da+6]=X.r;wa[Da+7]=X.g;wa[Da+8]=X.b;wa[Da+9]=ta.r;wa[Da+10]=ta.g;wa[Da+11]=ta.b;Da+=12}if(Ha&&R.hasTangents){da=
+Ba[O.a].tangent;aa=Ba[O.b].tangent;X=Ba[O.c].tangent;O=Ba[O.d].tangent;ha[pa]=da.x;ha[pa+1]=da.y;ha[pa+2]=da.z;ha[pa+3]=da.w;ha[pa+4]=aa.x;ha[pa+5]=aa.y;ha[pa+6]=aa.z;ha[pa+7]=aa.w;ha[pa+8]=X.x;ha[pa+9]=X.y;ha[pa+10]=X.z;ha[pa+11]=X.w;ha[pa+12]=O.x;ha[pa+13]=O.y;ha[pa+14]=O.z;ha[pa+15]=O.w;pa+=16}if(Ga)if(Ia.length==4&&ga)for(O=0;O<4;O++){Ca=Ia[O];Ka[ma]=Ca.x;Ka[ma+1]=Ca.y;Ka[ma+2]=Ca.z;ma+=3}else for(O=0;O<4;O++){Ka[ma]=Ca.x;Ka[ma+1]=Ca.y;Ka[ma+2]=Ca.z;ma+=3}if(Aa&&Ja)for(O=0;O<4;O++){Ia=Ja[O];Ra[P]=
+Ia.u;Ra[P+1]=Ia.v;P+=2}if(Aa&&sa)for(O=0;O<4;O++){Ja=sa[O];Pa[la]=Ja.u;Pa[la+1]=Ja.v;la+=2}if(qa){Q[ja]=D;Q[ja+1]=D+1;Q[ja+2]=D+2;Q[ja+3]=D;Q[ja+4]=D+2;Q[ja+5]=D+3;ja+=6;fa[Fa]=D;fa[Fa+1]=D+1;fa[Fa+2]=D;fa[Fa+3]=D+3;fa[Fa+4]=D+1;fa[Fa+5]=D+2;fa[Fa+6]=D+2;fa[Fa+7]=D+3;Fa+=8;D+=4}}}if(ea){e.bindBuffer(e.ARRAY_BUFFER,n.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,Ea,T)}if(La&&Qa.length){e.bindBuffer(e.ARRAY_BUFFER,n.__webGLColorBuffer);e.bufferData(e.ARRAY_BUFFER,wa,T)}if(Ga){e.bindBuffer(e.ARRAY_BUFFER,
+n.__webGLNormalBuffer);e.bufferData(e.ARRAY_BUFFER,Ka,T)}if(Ha&&R.hasTangents){e.bindBuffer(e.ARRAY_BUFFER,n.__webGLTangentBuffer);e.bufferData(e.ARRAY_BUFFER,ha,T)}if(Aa&&P>0){e.bindBuffer(e.ARRAY_BUFFER,n.__webGLUVBuffer);e.bufferData(e.ARRAY_BUFFER,Ra,T)}if(Aa&&la>0){e.bindBuffer(e.ARRAY_BUFFER,n.__webGLUV2Buffer);e.bufferData(e.ARRAY_BUFFER,Pa,T)}if(qa){e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n.__webGLFaceBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,Q,T);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n.__webGLLineBuffer);
+e.bufferData(e.ELEMENT_ARRAY_BUFFER,fa,T)}if(K>0){e.bindBuffer(e.ARRAY_BUFFER,n.__webGLSkinVertexABuffer);e.bufferData(e.ARRAY_BUFFER,ua,T);e.bindBuffer(e.ARRAY_BUFFER,n.__webGLSkinVertexBBuffer);e.bufferData(e.ARRAY_BUFFER,xa,T);e.bindBuffer(e.ARRAY_BUFFER,n.__webGLSkinIndicesBuffer);e.bufferData(e.ARRAY_BUFFER,za,T);e.bindBuffer(e.ARRAY_BUFFER,n.__webGLSkinWeightsBuffer);e.bufferData(e.ARRAY_BUFFER,va,T)}}x(objlist,ca,B,N,p)}H.__dirtyVertices=!1;H.__dirtyElements=!1;H.__dirtyUvs=!1;H.__dirtyNormals=
+!1;H.__dirtyTangents=!1;H.__dirtyColors=!1}else if(p instanceof THREE.Ribbon){if(!H.__webGLVertexBuffer){B=H;B.__webGLVertexBuffer=e.createBuffer();B.__webGLColorBuffer=e.createBuffer();B=H;N=B.vertices.length;B.__vertexArray=new Float32Array(N*3);B.__colorArray=new Float32Array(N*3);B.__webGLVertexCount=N;H.__dirtyVertices=!0;H.__dirtyColors=!0}if(H.__dirtyVertices||H.__dirtyColors){B=H;N=e.DYNAMIC_DRAW;D=void 0;D=void 0;y=void 0;n=void 0;P=B.vertices;T=B.colors;la=P.length;oa=T.length;ja=B.__vertexArray;
+E=B.__colorArray;ma=B.__dirtyColors;if(B.__dirtyVertices){for(D=0;D<la;D++){y=P[D].position;n=D*3;ja[n]=y.x;ja[n+1]=y.y;ja[n+2]=y.z}e.bindBuffer(e.ARRAY_BUFFER,B.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,ja,N)}if(ma){for(D=0;D<oa;D++){color=T[D];n=D*3;E[n]=color.r;E[n+1]=color.g;E[n+2]=color.b}e.bindBuffer(e.ARRAY_BUFFER,B.__webGLColorBuffer);e.bufferData(e.ARRAY_BUFFER,E,N)}}x(objlist,ca,0,H,p);H.__dirtyVertices=!1;H.__dirtyColors=!1}else if(p instanceof THREE.Line){if(!H.__webGLVertexBuffer){B=
+H;B.__webGLVertexBuffer=e.createBuffer();B.__webGLColorBuffer=e.createBuffer();B=H;N=B.vertices.length;B.__vertexArray=new Float32Array(N*3);B.__colorArray=new Float32Array(N*3);B.__webGLLineCount=N;H.__dirtyVertices=!0;H.__dirtyColors=!0}if(H.__dirtyVertices||H.__dirtyColors){B=H;N=e.DYNAMIC_DRAW;D=void 0;D=void 0;y=void 0;n=void 0;P=B.vertices;T=B.colors;la=P.length;oa=T.length;ja=B.__vertexArray;E=B.__colorArray;ma=B.__dirtyColors;if(B.__dirtyVertices){for(D=0;D<la;D++){y=P[D].position;n=D*3;ja[n]=
+y.x;ja[n+1]=y.y;ja[n+2]=y.z}e.bindBuffer(e.ARRAY_BUFFER,B.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,ja,N)}if(ma){for(D=0;D<oa;D++){color=T[D];n=D*3;E[n]=color.r;E[n+1]=color.g;E[n+2]=color.b}e.bindBuffer(e.ARRAY_BUFFER,B.__webGLColorBuffer);e.bufferData(e.ARRAY_BUFFER,E,N)}}x(objlist,ca,0,H,p);H.__dirtyVertices=!1;H.__dirtyColors=!1}else if(p instanceof THREE.ParticleSystem){if(!H.__webGLVertexBuffer){B=H;B.__webGLVertexBuffer=e.createBuffer();B.__webGLColorBuffer=e.createBuffer();B=H;N=B.vertices.length;
+B.__vertexArray=new Float32Array(N*3);B.__colorArray=new Float32Array(N*3);B.__sortArray=[];B.__webGLParticleCount=N;H.__dirtyVertices=!0;H.__dirtyColors=!0}(H.__dirtyVertices||H.__dirtyColors||p.sortParticles)&&b(H,e.DYNAMIC_DRAW,p,camera);x(objlist,ca,0,H,p);H.__dirtyVertices=!1;H.__dirtyColors=!1}else if(p instanceof THREE.MarchingCubes){H=ca;if(H[0]==undefined){n.__webGLObjectsImmediate.push({object:p,opaque:{list:[],count:0},transparent:{list:[],count:0}});H[0]=1}}}};this.removeObject=function(l,
+z){var C,p;for(C=l.__webGLObjects.length-1;C>=0;C--){p=l.__webGLObjects[C].object;z==p&&l.__webGLObjects.splice(C,1)}};this.setFaceCulling=function(l,z){if(l){!z||z=="ccw"?e.frontFace(e.CCW):e.frontFace(e.CW);if(l=="back")e.cullFace(e.BACK);else l=="front"?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK);e.enable(e.CULL_FACE)}else e.disable(e.CULL_FACE)};this.supportsVertexTextures=function(){return e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};
+THREE.Snippets={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",
+envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube env_map;\nuniform int combine;\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( env_map, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refraction_ratio;\nuniform bool useRefract;\n#endif",
+envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refraction_ratio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",
+map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\n#endif",map_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\nuniform sampler2D light_map;\n#endif",lightmap_pars_vertex:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\n#endif",
+lightmap_fragment:"#ifdef USE_LIGHTMAP\ngl_FragColor = gl_FragColor * texture2D( light_map, vUv2 );\n#endif",lightmap_vertex:"#ifdef USE_LIGHTMAP\nvUv2 = uv2;\n#endif",lights_pars_vertex:"uniform bool enableLighting;\nuniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n#ifdef PHONG\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\n#endif",
 lights_vertex:"if ( !enableLighting ) {\nvLightWeighting = vec3( 1.0 );\n} else {\nvLightWeighting = ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nfloat directionalLightWeighting = max( dot( transformedNormal, normalize( lDirection.xyz ) ), 0.0 );\nvLightWeighting += directionalLightColor[ i ] * directionalLightWeighting;\n}\n#endif\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 pointLightVector = normalize( lPosition.xyz - mvPosition.xyz );\nfloat pointLightWeighting = max( dot( transformedNormal, pointLightVector ), 0.0 );\nvLightWeighting += pointLightColor[ i ] * pointLightWeighting;\n#ifdef PHONG\nvPointLightVector[ i ] = pointLightVector;\n#endif\n}\n#endif\n}",
 lights_vertex:"if ( !enableLighting ) {\nvLightWeighting = vec3( 1.0 );\n} else {\nvLightWeighting = ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nfloat directionalLightWeighting = max( dot( transformedNormal, normalize( lDirection.xyz ) ), 0.0 );\nvLightWeighting += directionalLightColor[ i ] * directionalLightWeighting;\n}\n#endif\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 pointLightVector = normalize( lPosition.xyz - mvPosition.xyz );\nfloat pointLightWeighting = max( dot( transformedNormal, pointLightVector ), 0.0 );\nvLightWeighting += pointLightColor[ i ] * pointLightWeighting;\n#ifdef PHONG\nvPointLightVector[ i ] = pointLightVector;\n#endif\n}\n#endif\n}",
 lights_pars_fragment:"#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",lights_fragment:"vec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );\nvec4 mColor = vec4( diffuse, opacity );\nvec4 mSpecular = vec4( specular, opacity );\n#if MAX_POINT_LIGHTS > 0\nvec4 pointDiffuse  = vec4( 0.0 );\nvec4 pointSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec3 pointVector = normalize( vPointLightVector[ i ] );\nvec3 pointHalfVector = normalize( vPointLightVector[ i ] + vViewPosition );\nfloat pointDotNormalHalf = dot( normal, pointHalfVector );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = 0.0;\nif ( pointDotNormalHalf >= 0.0 )\npointSpecularWeight = pow( pointDotNormalHalf, shininess );\npointDiffuse  += mColor * pointDiffuseWeight;\npointSpecular += mSpecular * pointSpecularWeight;\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec4 dirDiffuse  = vec4( 0.0 );\nvec4 dirSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nvec3 dirHalfVector = normalize( lDirection.xyz + vViewPosition );\nfloat dirDotNormalHalf = dot( normal, dirHalfVector );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = 0.0;\nif ( dirDotNormalHalf >= 0.0 )\ndirSpecularWeight = pow( dirDotNormalHalf, shininess );\ndirDiffuse  += mColor * dirDiffuseWeight;\ndirSpecular += mSpecular * dirSpecularWeight;\n}\n#endif\nvec4 totalLight = vec4( ambient, opacity );\n#if MAX_DIR_LIGHTS > 0\ntotalLight += dirDiffuse + dirSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalLight += pointDiffuse + pointSpecular;\n#endif\ngl_FragColor = gl_FragColor * totalLight;",
 lights_pars_fragment:"#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",lights_fragment:"vec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );\nvec4 mColor = vec4( diffuse, opacity );\nvec4 mSpecular = vec4( specular, opacity );\n#if MAX_POINT_LIGHTS > 0\nvec4 pointDiffuse  = vec4( 0.0 );\nvec4 pointSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec3 pointVector = normalize( vPointLightVector[ i ] );\nvec3 pointHalfVector = normalize( vPointLightVector[ i ] + vViewPosition );\nfloat pointDotNormalHalf = dot( normal, pointHalfVector );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = 0.0;\nif ( pointDotNormalHalf >= 0.0 )\npointSpecularWeight = pow( pointDotNormalHalf, shininess );\npointDiffuse  += mColor * pointDiffuseWeight;\npointSpecular += mSpecular * pointSpecularWeight;\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec4 dirDiffuse  = vec4( 0.0 );\nvec4 dirSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nvec3 dirHalfVector = normalize( lDirection.xyz + vViewPosition );\nfloat dirDotNormalHalf = dot( normal, dirHalfVector );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = 0.0;\nif ( dirDotNormalHalf >= 0.0 )\ndirSpecularWeight = pow( dirDotNormalHalf, shininess );\ndirDiffuse  += mColor * dirDiffuseWeight;\ndirSpecular += mSpecular * dirSpecularWeight;\n}\n#endif\nvec4 totalLight = vec4( ambient, opacity );\n#if MAX_DIR_LIGHTS > 0\ntotalLight += dirDiffuse + dirSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalLight += pointDiffuse + pointSpecular;\n#endif\ngl_FragColor = gl_FragColor * totalLight;",
 color_pars_fragment:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_fragment:"#ifdef USE_COLOR\ngl_FragColor = gl_FragColor * vec4( vColor, opacity );\n#endif",color_pars_vertex:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\nvColor = color;\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\nuniform mat4 uBoneGlobalMatrices[20];\n#endif",skinning_vertex:"#ifdef USE_SKINNING\ngl_Position  = ( uBoneGlobalMatrices[ int( skinIndex.x ) ] * skinVertexA ) * skinWeight.x;\ngl_Position += ( uBoneGlobalMatrices[ int( skinIndex.y ) ] * skinVertexB ) * skinWeight.y;\ngl_Position  = projectionMatrix * viewMatrix * objectMatrix * gl_Position;\n#else\ngl_Position = projectionMatrix * mvPosition;\n#endif"};
 color_pars_fragment:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_fragment:"#ifdef USE_COLOR\ngl_FragColor = gl_FragColor * vec4( vColor, opacity );\n#endif",color_pars_vertex:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\nvColor = color;\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\nuniform mat4 uBoneGlobalMatrices[20];\n#endif",skinning_vertex:"#ifdef USE_SKINNING\ngl_Position  = ( uBoneGlobalMatrices[ int( skinIndex.x ) ] * skinVertexA ) * skinWeight.x;\ngl_Position += ( uBoneGlobalMatrices[ int( skinIndex.y ) ] * skinVertexB ) * skinWeight.y;\ngl_Position  = projectionMatrix * viewMatrix * objectMatrix * gl_Position;\n#else\ngl_Position = projectionMatrix * mvPosition;\n#endif"};
@@ -278,13 +281,13 @@ c;c=d.style;c.fontFamily="monospace";c.fontSize="13px";c.textAlign="center";c.ba
 var GeometryUtils={merge:function(a,b){var c=b instanceof THREE.Mesh,d=a.vertices.length,f=c?b.geometry:b,g=a.vertices,h=f.vertices,k=a.faces,j=f.faces,m=a.uvs;f=f.uvs;c&&b.autoUpdateMatrix&&b.updateMatrix();for(var o=0,w=h.length;o<w;o++){var u=new THREE.Vertex(h[o].position.clone());c&&b.localMatrix.multiplyVector3(u.position);g.push(u)}o=0;for(w=j.length;o<w;o++){h=j[o];var t,x=h.vertexNormals;if(h instanceof THREE.Face3)t=new THREE.Face3(h.a+d,h.b+d,h.c+d);else h instanceof THREE.Face4&&(t=new THREE.Face4(h.a+
 var GeometryUtils={merge:function(a,b){var c=b instanceof THREE.Mesh,d=a.vertices.length,f=c?b.geometry:b,g=a.vertices,h=f.vertices,k=a.faces,j=f.faces,m=a.uvs;f=f.uvs;c&&b.autoUpdateMatrix&&b.updateMatrix();for(var o=0,w=h.length;o<w;o++){var u=new THREE.Vertex(h[o].position.clone());c&&b.localMatrix.multiplyVector3(u.position);g.push(u)}o=0;for(w=j.length;o<w;o++){h=j[o];var t,x=h.vertexNormals;if(h instanceof THREE.Face3)t=new THREE.Face3(h.a+d,h.b+d,h.c+d);else h instanceof THREE.Face4&&(t=new THREE.Face4(h.a+
 d,h.b+d,h.c+d,h.d+d));t.centroid.copy(h.centroid);t.normal.copy(h.normal);c=0;for(g=x.length;c<g;c++){u=x[c];t.vertexNormals.push(u.clone())}t.materials=h.materials.slice();k.push(t)}o=0;for(w=f.length;o<w;o++){d=f[o];k=[];c=0;for(g=d.length;c<g;c++)k.push(new THREE.UV(d[c].u,d[c].v));m.push(k)}}},ImageUtils={loadTexture:function(a,b,c){var d=new Image;d.onload=function(){this.loaded=!0;c&&c(this)};d.src=a;return new THREE.Texture(d,b)},loadArray:function(a,b){var c,d,f=[];c=f.loadCount=0;for(d=a.length;c<
 d,h.b+d,h.c+d,h.d+d));t.centroid.copy(h.centroid);t.normal.copy(h.normal);c=0;for(g=x.length;c<g;c++){u=x[c];t.vertexNormals.push(u.clone())}t.materials=h.materials.slice();k.push(t)}o=0;for(w=f.length;o<w;o++){d=f[o];k=[];c=0;for(g=d.length;c<g;c++)k.push(new THREE.UV(d[c].u,d[c].v));m.push(k)}}},ImageUtils={loadTexture:function(a,b,c){var d=new Image;d.onload=function(){this.loaded=!0;c&&c(this)};d.src=a;return new THREE.Texture(d,b)},loadArray:function(a,b){var c,d,f=[];c=f.loadCount=0;for(d=a.length;c<
 d;++c){f[c]=new Image;f[c].loaded=0;f[c].onload=function(){f.loadCount+=1;this.loaded=!0;b&&b(this)};f[c].src=a[c]}return f}},SceneUtils={loadScene:function(a,b,c,d){a=new Worker(a);a.postMessage(0);a.onmessage=function(f){function g(){for(o in L.objects)if(!G.objects[o]){A=L.objects[o];if(q=G.geometries[A.geometry]){ba=[];for(i=0;i<A.materials.length;i++)ba[i]=G.materials[A.materials[i]];F=A.position;r=A.rotation;s=A.scale;object=new THREE.Mesh(q,ba);object.position.set(F[0],F[1],F[2]);object.rotation.set(r[0],
 d;++c){f[c]=new Image;f[c].loaded=0;f[c].onload=function(){f.loadCount+=1;this.loaded=!0;b&&b(this)};f[c].src=a[c]}return f}},SceneUtils={loadScene:function(a,b,c,d){a=new Worker(a);a.postMessage(0);a.onmessage=function(f){function g(){for(o in L.objects)if(!G.objects[o]){A=L.objects[o];if(q=G.geometries[A.geometry]){ba=[];for(i=0;i<A.materials.length;i++)ba[i]=G.materials[A.materials[i]];F=A.position;r=A.rotation;s=A.scale;object=new THREE.Mesh(q,ba);object.position.set(F[0],F[1],F[2]);object.rotation.set(r[0],
-r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=A.visible;G.scene.addObject(object);G.objects[o]=object}}}function h(T){return function(la){G.geometries[T]=la;g();V-=1;k()}}function k(){d({total_models:Y,total_textures:Z,loaded_models:Y-V,loaded_textures:Z-S},G);V==0&&S==0&&c(G)}var j,m,o,w,u,t,x,A,F,v,H,q,J,e,ba,L,M,V,S,Y,Z,G;L=f.data;M=new THREE.Loader;S=V=0;G={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{}};f=function(){S-=1;k()};
+r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=A.visible;G.scene.addObject(object);G.objects[o]=object}}}function h(U){return function(na){G.geometries[U]=na;g();V-=1;k()}}function k(){d({total_models:Y,total_textures:Z,loaded_models:Y-V,loaded_textures:Z-S},G);V==0&&S==0&&c(G)}var j,m,o,w,u,t,x,A,F,v,I,q,J,e,ba,L,M,V,S,Y,Z,G;L=f.data;M=new THREE.Loader;S=V=0;G={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{}};f=function(){S-=1;k()};
 for(u in L.cameras){v=L.cameras[u];if(v.type=="perspective")J=new THREE.Camera(v.fov,v.aspect,v.near,v.far);else if(v.type=="ortho"){J=new THREE.Camera;J.projectionMatrix=THREE.Matrix4.makeOrtho(v.left,v.right,v.top,v.bottom,v.near,v.far)}F=v.position;v=v.target;J.position.set(F[0],F[1],F[2]);J.target.position.set(v[0],v[1],v[2]);G.cameras[u]=J}for(w in L.lights){u=L.lights[w];if(u.type=="directional"){F=u.direction;light=new THREE.DirectionalLight;light.position.set(F[0],F[1],F[2]);light.position.normalize()}else if(u.type==
 for(u in L.cameras){v=L.cameras[u];if(v.type=="perspective")J=new THREE.Camera(v.fov,v.aspect,v.near,v.far);else if(v.type=="ortho"){J=new THREE.Camera;J.projectionMatrix=THREE.Matrix4.makeOrtho(v.left,v.right,v.top,v.bottom,v.near,v.far)}F=v.position;v=v.target;J.position.set(F[0],F[1],F[2]);J.target.position.set(v[0],v[1],v[2]);G.cameras[u]=J}for(w in L.lights){u=L.lights[w];if(u.type=="directional"){F=u.direction;light=new THREE.DirectionalLight;light.position.set(F[0],F[1],F[2]);light.position.normalize()}else if(u.type==
 "point"){F=u.position;light=new THREE.PointLight;light.position.set(F[0],F[1],F[2])}v=u.color;i=u.intensity||1;light.color.setRGB(v[0]*i,v[1]*i,v[2]*i);G.scene.addLight(light);G.lights[w]=light}for(t in L.fogs){w=L.fogs[t];if(w.type=="linear")e=new THREE.Fog(0,w.near,w.far);else w.type=="exp2"&&(e=new THREE.FogExp2(0,w.density));v=w.color;e.color.setRGB(v[0],v[1],v[2]);G.fogs[t]=e}if(G.cameras&&L.defaults.camera)G.currentCamera=G.cameras[L.defaults.camera];if(G.fogs&&L.defaults.fog)G.scene.fog=G.fogs[L.defaults.fog];
 "point"){F=u.position;light=new THREE.PointLight;light.position.set(F[0],F[1],F[2])}v=u.color;i=u.intensity||1;light.color.setRGB(v[0]*i,v[1]*i,v[2]*i);G.scene.addLight(light);G.lights[w]=light}for(t in L.fogs){w=L.fogs[t];if(w.type=="linear")e=new THREE.Fog(0,w.near,w.far);else w.type=="exp2"&&(e=new THREE.FogExp2(0,w.density));v=w.color;e.color.setRGB(v[0],v[1],v[2]);G.fogs[t]=e}if(G.cameras&&L.defaults.camera)G.currentCamera=G.cameras[L.defaults.camera];if(G.fogs&&L.defaults.fog)G.scene.fog=G.fogs[L.defaults.fog];
 v=L.defaults.bgcolor;G.bgColor=new THREE.Color;G.bgColor.setRGB(v[0],v[1],v[2]);G.bgColorAlpha=L.defaults.bgalpha;for(j in L.geometries){t=L.geometries[j];if(t.type=="bin_mesh"||t.type=="ascii_mesh")V+=1}Y=V;for(j in L.geometries){t=L.geometries[j];if(t.type=="cube"){q=new Cube(t.width,t.height,t.depth,t.segments_width,t.segments_height,null,t.flipped,t.sides);G.geometries[j]=q}else if(t.type=="plane"){q=new Plane(t.width,t.height,t.segments_width,t.segments_height);G.geometries[j]=q}else if(t.type==
 v=L.defaults.bgcolor;G.bgColor=new THREE.Color;G.bgColor.setRGB(v[0],v[1],v[2]);G.bgColorAlpha=L.defaults.bgalpha;for(j in L.geometries){t=L.geometries[j];if(t.type=="bin_mesh"||t.type=="ascii_mesh")V+=1}Y=V;for(j in L.geometries){t=L.geometries[j];if(t.type=="cube"){q=new Cube(t.width,t.height,t.depth,t.segments_width,t.segments_height,null,t.flipped,t.sides);G.geometries[j]=q}else if(t.type=="plane"){q=new Plane(t.width,t.height,t.segments_width,t.segments_height);G.geometries[j]=q}else if(t.type==
 "sphere"){q=new Sphere(t.radius,t.segments_width,t.segments_height);G.geometries[j]=q}else if(t.type=="cylinder"){q=new Cylinder(t.numSegs,t.topRad,t.botRad,t.height,t.topOffset,t.botOffset);G.geometries[j]=q}else if(t.type=="torus"){q=new Torus(t.radius,t.tube,t.segmentsR,t.segmentsT);G.geometries[j]=q}else if(t.type=="icosahedron"){q=new Icosahedron(t.subdivisions);G.geometries[j]=q}else if(t.type=="bin_mesh")M.loadBinary({model:t.url,callback:h(j)});else t.type=="ascii_mesh"&&M.loadAscii({model:t.url,
 "sphere"){q=new Sphere(t.radius,t.segments_width,t.segments_height);G.geometries[j]=q}else if(t.type=="cylinder"){q=new Cylinder(t.numSegs,t.topRad,t.botRad,t.height,t.topOffset,t.botOffset);G.geometries[j]=q}else if(t.type=="torus"){q=new Torus(t.radius,t.tube,t.segmentsR,t.segmentsT);G.geometries[j]=q}else if(t.type=="icosahedron"){q=new Icosahedron(t.subdivisions);G.geometries[j]=q}else if(t.type=="bin_mesh")M.loadBinary({model:t.url,callback:h(j)});else t.type=="ascii_mesh"&&M.loadAscii({model:t.url,
 callback:h(j)})}for(x in L.textures){j=L.textures[x];S+=j.url instanceof Array?j.url.length:1}Z=S;for(x in L.textures){j=L.textures[x];if(j.mapping!=undefined&&THREE[j.mapping]!=undefined)j.mapping=new THREE[j.mapping];if(j.url instanceof Array){t=ImageUtils.loadArray(j.url,f);t=new THREE.Texture(t,j.mapping)}else{t=ImageUtils.loadTexture(j.url,j.mapping,f);if(THREE[j.min_filter]!=undefined)t.min_filter=THREE[j.min_filter];if(THREE[j.mag_filter]!=undefined)t.mag_filter=THREE[j.mag_filter]}G.textures[x]=
 callback:h(j)})}for(x in L.textures){j=L.textures[x];S+=j.url instanceof Array?j.url.length:1}Z=S;for(x in L.textures){j=L.textures[x];if(j.mapping!=undefined&&THREE[j.mapping]!=undefined)j.mapping=new THREE[j.mapping];if(j.url instanceof Array){t=ImageUtils.loadArray(j.url,f);t=new THREE.Texture(t,j.mapping)}else{t=ImageUtils.loadTexture(j.url,j.mapping,f);if(THREE[j.min_filter]!=undefined)t.min_filter=THREE[j.min_filter];if(THREE[j.mag_filter]!=undefined)t.mag_filter=THREE[j.mag_filter]}G.textures[x]=
-t}for(m in L.materials){x=L.materials[m];for(H in x.parameters)if(H=="env_map"||H=="map"||H=="light_map")x.parameters[H]=G.textures[x.parameters[H]];else if(H=="shading")x.parameters[H]=x.parameters[H]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(H=="blending")x.parameters[H]=THREE[x.parameters[H]]?THREE[x.parameters[H]]:THREE.NormalBlending;else H=="combine"&&(x.parameters[H]=x.parameters[H]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation);x=new THREE[x.type](x.parameters);G.materials[m]=
+t}for(m in L.materials){x=L.materials[m];for(I in x.parameters)if(I=="env_map"||I=="map"||I=="light_map")x.parameters[I]=G.textures[x.parameters[I]];else if(I=="shading")x.parameters[I]=x.parameters[I]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(I=="blending")x.parameters[I]=THREE[x.parameters[I]]?THREE[x.parameters[I]]:THREE.NormalBlending;else I=="combine"&&(x.parameters[I]=x.parameters[I]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation);x=new THREE[x.type](x.parameters);G.materials[m]=
 x}g();b(G)}},addMesh:function(a,b,c,d,f,g,h,k,j,m){b=new THREE.Mesh(b,m);b.scale.x=b.scale.y=b.scale.z=c;b.position.x=d;b.position.y=f;b.position.z=g;b.rotation.x=h;b.rotation.y=k;b.rotation.z=j;a.addObject(b);return b},addPanoramaCubeWebGL:function(a,b,c){var d=ShaderUtils.lib.cube;d.uniforms.tCube.texture=c;c=new THREE.MeshShaderMaterial({fragment_shader:d.fragment_shader,vertex_shader:d.vertex_shader,uniforms:d.uniforms});b=new THREE.Mesh(new Cube(b,b,b,1,1,null,!0),c);a.addObject(b);return b},
 x}g();b(G)}},addMesh:function(a,b,c,d,f,g,h,k,j,m){b=new THREE.Mesh(b,m);b.scale.x=b.scale.y=b.scale.z=c;b.position.x=d;b.position.y=f;b.position.z=g;b.rotation.x=h;b.rotation.y=k;b.rotation.z=j;a.addObject(b);return b},addPanoramaCubeWebGL:function(a,b,c){var d=ShaderUtils.lib.cube;d.uniforms.tCube.texture=c;c=new THREE.MeshShaderMaterial({fragment_shader:d.fragment_shader,vertex_shader:d.vertex_shader,uniforms:d.uniforms});b=new THREE.Mesh(new Cube(b,b,b,1,1,null,!0),c);a.addObject(b);return b},
 addPanoramaCube:function(a,b,c){var d=[];d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[0])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[1])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[2])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[3])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[4])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[5])}));b=new THREE.Mesh(new Cube(b,b,b,1,1,d,!0),new THREE.MeshFaceMaterial);
 addPanoramaCube:function(a,b,c){var d=[];d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[0])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[1])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[2])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[3])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[4])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[5])}));b=new THREE.Mesh(new Cube(b,b,b,1,1,d,!0),new THREE.MeshFaceMaterial);
 a.addObject(b);return b},addPanoramaCubePlanes:function(a,b,c){var d=b/2;b=new Plane(b,b);var f=Math.PI/2,g=Math.PI;SceneUtils.addMesh(a,b,1,0,0,-d,0,0,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[5])}));SceneUtils.addMesh(a,b,1,-d,0,0,0,f,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[0])}));SceneUtils.addMesh(a,b,1,d,0,0,0,-f,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[1])}));SceneUtils.addMesh(a,b,1,0,d,0,f,0,g,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[2])}));
 a.addObject(b);return b},addPanoramaCubePlanes:function(a,b,c){var d=b/2;b=new Plane(b,b);var f=Math.PI/2,g=Math.PI;SceneUtils.addMesh(a,b,1,0,0,-d,0,0,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[5])}));SceneUtils.addMesh(a,b,1,-d,0,0,0,f,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[0])}));SceneUtils.addMesh(a,b,1,d,0,0,0,-f,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[1])}));SceneUtils.addMesh(a,b,1,0,d,0,f,0,g,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[2])}));
@@ -297,10 +300,10 @@ cube:{uniforms:{tCube:{type:"t",value:1,texture:null}},vertex_shader:"varying ve
 value:0,texture:null},uImageIncrement:{type:"v2",value:new THREE.Vector2(0.001953125,0)},cKernel:{type:"fv1",value:[]}},vertex_shader:"varying vec2 vUv;\nuniform vec2 uImageIncrement;\nvoid main(void) {\nvUv = uv - ((KERNEL_SIZE - 1.0) / 2.0) * uImageIncrement;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragment_shader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform vec2 uImageIncrement;\nuniform float cKernel[KERNEL_SIZE];\nvoid main(void) {\nvec2 imageCoord = vUv;\nvec4 sum = vec4( 0.0, 0.0, 0.0, 0.0 );\nfor( int i=0; i<KERNEL_SIZE; ++i ) {\nsum += texture2D( tDiffuse, imageCoord ) * cKernel[i];\nimageCoord += uImageIncrement;\n}\ngl_FragColor = sum;\n}"},
 value:0,texture:null},uImageIncrement:{type:"v2",value:new THREE.Vector2(0.001953125,0)},cKernel:{type:"fv1",value:[]}},vertex_shader:"varying vec2 vUv;\nuniform vec2 uImageIncrement;\nvoid main(void) {\nvUv = uv - ((KERNEL_SIZE - 1.0) / 2.0) * uImageIncrement;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragment_shader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform vec2 uImageIncrement;\nuniform float cKernel[KERNEL_SIZE];\nvoid main(void) {\nvec2 imageCoord = vUv;\nvec4 sum = vec4( 0.0, 0.0, 0.0, 0.0 );\nfor( int i=0; i<KERNEL_SIZE; ++i ) {\nsum += texture2D( tDiffuse, imageCoord ) * cKernel[i];\nimageCoord += uImageIncrement;\n}\ngl_FragColor = sum;\n}"},
 film:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},time:{type:"f",value:0},grayscale:{type:"i",value:1}},vertex_shader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragment_shader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float time;\nuniform bool grayscale;\nconst float fNintensity = 0.5;\nconst float fSintensity = 0.05;\nconst float fScount = 4096.0;\nvoid main() {\nvec4 cTextureScreen = texture2D( tDiffuse, vUv );\nfloat x = vUv.x * vUv.y * time *  1000.0;\nx = mod( x, 13.0 ) * mod( x, 123.0 );\nfloat dx = mod( x, 0.01 );\nvec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx * 100.0, 0.0, 1.0 );\nvec2 sc = vec2( sin(vUv.y * fScount), cos(vUv.y * fScount) );\ncResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * fSintensity;\ncResult = cTextureScreen.rgb + clamp( fNintensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );\nif( grayscale ) {\ncResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );\n}\ngl_FragColor =  vec4( cResult, cTextureScreen.a );\n}"},
 film:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},time:{type:"f",value:0},grayscale:{type:"i",value:1}},vertex_shader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragment_shader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float time;\nuniform bool grayscale;\nconst float fNintensity = 0.5;\nconst float fSintensity = 0.05;\nconst float fScount = 4096.0;\nvoid main() {\nvec4 cTextureScreen = texture2D( tDiffuse, vUv );\nfloat x = vUv.x * vUv.y * time *  1000.0;\nx = mod( x, 13.0 ) * mod( x, 123.0 );\nfloat dx = mod( x, 0.01 );\nvec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx * 100.0, 0.0, 1.0 );\nvec2 sc = vec2( sin(vUv.y * fScount), cos(vUv.y * fScount) );\ncResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * fSintensity;\ncResult = cTextureScreen.rgb + clamp( fNintensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );\nif( grayscale ) {\ncResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );\n}\ngl_FragColor =  vec4( cResult, cTextureScreen.a );\n}"},
 screen:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},opacity:{type:"f",value:1}},vertex_shader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragment_shader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float opacity;\nvoid main() {\nvec4 texel = texture2D( tDiffuse, vUv );\ngl_FragColor = opacity * texel;\n}"},basic:{uniforms:{},vertex_shader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",
 screen:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},opacity:{type:"f",value:1}},vertex_shader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragment_shader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float opacity;\nvoid main() {\nvec4 texel = texture2D( tDiffuse, vUv );\ngl_FragColor = opacity * texel;\n}"},basic:{uniforms:{},vertex_shader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",
-fragment_shader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(a){var b,c,d,f,g=2*Math.ceil(a*3)+1;g>25&&(g=25);f=(g-1)*0.5;c=Array(g);for(b=d=0;b<g;++b){c[b]=Math.exp(-((b-f)*(b-f))/(2*a*a));d+=c[b]}for(b=0;b<g;++b)c[b]/=d;return c}},Cube=function(a,b,c,d,f,g,h,k){function j(A,F,v,H,q,J,e,ba){var L,M,V=d||1,S=f||1,Y=V+1,Z=S+1,G=q/2,T=J/2;q/=V;var la=J/S,W=m.vertices.length;if(A=="x"&&F=="y"||A=="y"&&F=="x")L="z";else if(A=="x"&&F=="z"||A=="z"&&F=="x")L="y";
-else if(A=="z"&&F=="y"||A=="y"&&F=="z")L="x";for(M=0;M<Z;M++)for(J=0;J<Y;J++){var ja=new THREE.Vector3;ja[A]=(J*q-G)*v;ja[F]=(M*la-T)*H;ja[L]=e;m.vertices.push(new THREE.Vertex(ja))}for(M=0;M<S;M++)for(J=0;J<V;J++){m.faces.push(new THREE.Face4(J+Y*M+W,J+Y*(M+1)+W,J+1+Y*(M+1)+W,J+1+Y*M+W,null,ba));m.uvs.push([new THREE.UV(J/V,M/S),new THREE.UV(J/V,(M+1)/S),new THREE.UV((J+1)/V,(M+1)/S),new THREE.UV((J+1)/V,M/S)])}}THREE.Geometry.call(this);var m=this,o=a/2,w=b/2,u=c/2;h=h?-1:1;if(g!==undefined)if(g instanceof
+fragment_shader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(a){var b,c,d,f,g=2*Math.ceil(a*3)+1;g>25&&(g=25);f=(g-1)*0.5;c=Array(g);for(b=d=0;b<g;++b){c[b]=Math.exp(-((b-f)*(b-f))/(2*a*a));d+=c[b]}for(b=0;b<g;++b)c[b]/=d;return c}},Cube=function(a,b,c,d,f,g,h,k){function j(A,F,v,I,q,J,e,ba){var L,M,V=d||1,S=f||1,Y=V+1,Z=S+1,G=q/2,U=J/2;q/=V;var na=J/S,W=m.vertices.length;if(A=="x"&&F=="y"||A=="y"&&F=="x")L="z";else if(A=="x"&&F=="z"||A=="z"&&F=="x")L="y";
+else if(A=="z"&&F=="y"||A=="y"&&F=="z")L="x";for(M=0;M<Z;M++)for(J=0;J<Y;J++){var ka=new THREE.Vector3;ka[A]=(J*q-G)*v;ka[F]=(M*na-U)*I;ka[L]=e;m.vertices.push(new THREE.Vertex(ka))}for(M=0;M<S;M++)for(J=0;J<V;J++){m.faces.push(new THREE.Face4(J+Y*M+W,J+Y*(M+1)+W,J+1+Y*(M+1)+W,J+1+Y*M+W,null,ba));m.uvs.push([new THREE.UV(J/V,M/S),new THREE.UV(J/V,(M+1)/S),new THREE.UV((J+1)/V,(M+1)/S),new THREE.UV((J+1)/V,M/S)])}}THREE.Geometry.call(this);var m=this,o=a/2,w=b/2,u=c/2;h=h?-1:1;if(g!==undefined)if(g instanceof
 Array)this.materials=g;else{this.materials=[];for(var t=0;t<6;t++)this.materials.push([g])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(k!=undefined)for(var x in k)this.sides[x]!=undefined&&(this.sides[x]=k[x]);this.sides.px&&j("z","y",1*h,-1,c,b,-o,this.materials[0]);this.sides.nx&&j("z","y",-1*h,-1,c,b,o,this.materials[1]);this.sides.py&&j("x","z",1*h,1,a,c,w,this.materials[2]);this.sides.ny&&j("x","z",1*h,-1,a,c,-w,this.materials[3]);this.sides.pz&&j("x","y",1*h,-1,
 Array)this.materials=g;else{this.materials=[];for(var t=0;t<6;t++)this.materials.push([g])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(k!=undefined)for(var x in k)this.sides[x]!=undefined&&(this.sides[x]=k[x]);this.sides.px&&j("z","y",1*h,-1,c,b,-o,this.materials[0]);this.sides.nx&&j("z","y",-1*h,-1,c,b,o,this.materials[1]);this.sides.py&&j("x","z",1*h,1,a,c,w,this.materials[2]);this.sides.ny&&j("x","z",1*h,-1,a,c,-w,this.materials[3]);this.sides.pz&&j("x","y",1*h,-1,
-a,b,u,this.materials[4]);this.sides.nz&&j("x","y",-1*h,-1,a,b,-u,this.materials[5]);(function(){for(var A=[],F=[],v=0,H=m.vertices.length;v<H;v++){for(var q=m.vertices[v],J=!1,e=0,ba=A.length;e<ba;e++){var L=A[e];if(q.position.x==L.position.x&&q.position.y==L.position.y&&q.position.z==L.position.z){F[v]=e;J=!0;break}}if(!J){F[v]=A.length;A.push(new THREE.Vertex(q.position.clone()))}}v=0;for(H=m.faces.length;v<H;v++){q=m.faces[v];q.a=F[q.a];q.b=F[q.b];q.c=F[q.c];q.d=F[q.d]}m.vertices=A})();this.computeCentroids();
+a,b,u,this.materials[4]);this.sides.nz&&j("x","y",-1*h,-1,a,b,-u,this.materials[5]);(function(){for(var A=[],F=[],v=0,I=m.vertices.length;v<I;v++){for(var q=m.vertices[v],J=!1,e=0,ba=A.length;e<ba;e++){var L=A[e];if(q.position.x==L.position.x&&q.position.y==L.position.y&&q.position.z==L.position.z){F[v]=e;J=!0;break}}if(!J){F[v]=A.length;A.push(new THREE.Vertex(q.position.clone()))}}v=0;for(I=m.faces.length;v<I;v++){q=m.faces[v];q.a=F[q.a];q.b=F[q.b];q.c=F[q.c];q.d=F[q.d]}m.vertices=A})();this.computeCentroids();
 this.computeFaceNormals();this.sortFacesByMaterial()};Cube.prototype=new THREE.Geometry;Cube.prototype.constructor=Cube;
 this.computeFaceNormals();this.sortFacesByMaterial()};Cube.prototype=new THREE.Geometry;Cube.prototype.constructor=Cube;
 var Cylinder=function(a,b,c,d,f){function g(m,o,w){h.vertices.push(new THREE.Vertex(new THREE.Vector3(m,o,w)))}THREE.Geometry.call(this);var h=this,k=Math.PI,j;for(j=0;j<a;j++)g(Math.sin(2*k*j/a)*b,Math.cos(2*k*j/a)*b,0);for(j=0;j<a;j++)g(Math.sin(2*k*j/a)*c,Math.cos(2*k*j/a)*c,d);for(j=0;j<a;j++)h.faces.push(new THREE.Face4(j,j+a,a+(j+1)%a,(j+1)%a));if(c!=0){g(0,0,-f);for(j=a;j<a+a/2;j++)h.faces.push(new THREE.Face4(2*a,(2*j-2*a)%a,(2*j-2*a+1)%a,(2*j-2*a+2)%a))}if(b!=0){g(0,0,d+f);for(j=a+a/2;j<
 var Cylinder=function(a,b,c,d,f){function g(m,o,w){h.vertices.push(new THREE.Vertex(new THREE.Vector3(m,o,w)))}THREE.Geometry.call(this);var h=this,k=Math.PI,j;for(j=0;j<a;j++)g(Math.sin(2*k*j/a)*b,Math.cos(2*k*j/a)*b,0);for(j=0;j<a;j++)g(Math.sin(2*k*j/a)*c,Math.cos(2*k*j/a)*c,d);for(j=0;j<a;j++)h.faces.push(new THREE.Face4(j,j+a,a+(j+1)%a,(j+1)%a));if(c!=0){g(0,0,-f);for(j=a;j<a+a/2;j++)h.faces.push(new THREE.Face4(2*a,(2*j-2*a)%a,(2*j-2*a+1)%a,(2*j-2*a+2)%a))}if(b!=0){g(0,0,d+f);for(j=a+a/2;j<
 2*a;j++)h.faces.push(new THREE.Face4((2*j-2*a+2)%a+a,(2*j-2*a+1)%a+a,(2*j-2*a)%a+a,2*a+1))}this.computeCentroids();this.computeFaceNormals();this.sortFacesByMaterial()};Cylinder.prototype=new THREE.Geometry;Cylinder.prototype.constructor=Cylinder;
 2*a;j++)h.faces.push(new THREE.Face4((2*j-2*a+2)%a+a,(2*j-2*a+1)%a+a,(2*j-2*a)%a+a,2*a+1))}this.computeCentroids();this.computeFaceNormals();this.sortFacesByMaterial()};Cylinder.prototype=new THREE.Geometry;Cylinder.prototype.constructor=Cylinder;
@@ -319,13 +322,13 @@ g[k+1],f[k+1],f[k]));this.uvs.push([new THREE.UV(m/c,k/a.length),new THREE.UV(m/
 THREE.MarchingCubes=function(a,b){THREE.Object3D.call(this);this.materials=b instanceof Array?b:[b];this.init=function(c){this.isolation=80;this.size=c;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
 THREE.MarchingCubes=function(a,b){THREE.Object3D.call(this);this.materials=b instanceof Array?b:[b];this.init=function(c){this.isolation=80;this.size=c;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
 0;this.hasPos=!1;this.hasNormal=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(c,d,f){return c+(d-c)*f};this.VIntX=function(c,d,f,g,h,k,j,m,o,w){h=(h-o)/(w-o);o=this.normal_cache;d[g]=k+h*this.delta;d[g+1]=j;d[g+2]=m;f[g]=this.lerp(o[c],o[c+3],h);f[g+1]=this.lerp(o[c+1],o[c+4],h);f[g+2]=this.lerp(o[c+2],o[c+5],h)};this.VIntY=function(c,d,f,g,h,k,j,m,o,w){h=(h-o)/(w-o);o=this.normal_cache;d[g]=k;d[g+1]=j+h*this.delta;d[g+
 0;this.hasPos=!1;this.hasNormal=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(c,d,f){return c+(d-c)*f};this.VIntX=function(c,d,f,g,h,k,j,m,o,w){h=(h-o)/(w-o);o=this.normal_cache;d[g]=k+h*this.delta;d[g+1]=j;d[g+2]=m;f[g]=this.lerp(o[c],o[c+3],h);f[g+1]=this.lerp(o[c+1],o[c+4],h);f[g+2]=this.lerp(o[c+2],o[c+5],h)};this.VIntY=function(c,d,f,g,h,k,j,m,o,w){h=(h-o)/(w-o);o=this.normal_cache;d[g]=k;d[g+1]=j+h*this.delta;d[g+
 2]=m;d=c+this.yd*3;f[g]=this.lerp(o[c],o[d],h);f[g+1]=this.lerp(o[c+1],o[d+1],h);f[g+2]=this.lerp(o[c+2],o[d+2],h)};this.VIntZ=function(c,d,f,g,h,k,j,m,o,w){h=(h-o)/(w-o);o=this.normal_cache;d[g]=k;d[g+1]=j;d[g+2]=m+h*this.delta;d=c+this.zd*3;f[g]=this.lerp(o[c],o[d],h);f[g+1]=this.lerp(o[c+1],o[d+1],h);f[g+2]=this.lerp(o[c+2],o[d+2],h)};this.compNorm=function(c){var d=c*3;if(this.normal_cache[d]==0){this.normal_cache[d]=this.field[c-1]-this.field[c+1];this.normal_cache[d+1]=this.field[c-this.yd]-
 2]=m;d=c+this.yd*3;f[g]=this.lerp(o[c],o[d],h);f[g+1]=this.lerp(o[c+1],o[d+1],h);f[g+2]=this.lerp(o[c+2],o[d+2],h)};this.VIntZ=function(c,d,f,g,h,k,j,m,o,w){h=(h-o)/(w-o);o=this.normal_cache;d[g]=k;d[g+1]=j;d[g+2]=m+h*this.delta;d=c+this.zd*3;f[g]=this.lerp(o[c],o[d],h);f[g+1]=this.lerp(o[c+1],o[d+1],h);f[g+2]=this.lerp(o[c+2],o[d+2],h)};this.compNorm=function(c){var d=c*3;if(this.normal_cache[d]==0){this.normal_cache[d]=this.field[c-1]-this.field[c+1];this.normal_cache[d+1]=this.field[c-this.yd]-
-this.field[c+this.yd];this.normal_cache[d+2]=this.field[c-this.zd]-this.field[c+this.zd]}};this.polygonize=function(c,d,f,g,h,k){var j=g+1,m=g+this.yd,o=g+this.zd,w=j+this.yd,u=j+this.zd,t=g+this.yd+this.zd,x=j+this.yd+this.zd,A=0,F=this.field[g],v=this.field[j],H=this.field[m],q=this.field[w],J=this.field[o],e=this.field[u],ba=this.field[t],L=this.field[x];F<h&&(A|=1);v<h&&(A|=2);H<h&&(A|=8);q<h&&(A|=4);J<h&&(A|=16);e<h&&(A|=32);ba<h&&(A|=128);L<h&&(A|=64);var M=THREE.edgeTable[A];if(M==0)return 0;
-var V=this.delta,S=c+V,Y=d+V;V=f+V;if(M&1){this.compNorm(g);this.compNorm(j);this.VIntX(g*3,this.vlist,this.nlist,0,h,c,d,f,F,v)}if(M&2){this.compNorm(j);this.compNorm(w);this.VIntY(j*3,this.vlist,this.nlist,3,h,S,d,f,v,q)}if(M&4){this.compNorm(m);this.compNorm(w);this.VIntX(m*3,this.vlist,this.nlist,6,h,c,Y,f,H,q)}if(M&8){this.compNorm(g);this.compNorm(m);this.VIntY(g*3,this.vlist,this.nlist,9,h,c,d,f,F,H)}if(M&16){this.compNorm(o);this.compNorm(u);this.VIntX(o*3,this.vlist,this.nlist,12,h,c,d,V,
+this.field[c+this.yd];this.normal_cache[d+2]=this.field[c-this.zd]-this.field[c+this.zd]}};this.polygonize=function(c,d,f,g,h,k){var j=g+1,m=g+this.yd,o=g+this.zd,w=j+this.yd,u=j+this.zd,t=g+this.yd+this.zd,x=j+this.yd+this.zd,A=0,F=this.field[g],v=this.field[j],I=this.field[m],q=this.field[w],J=this.field[o],e=this.field[u],ba=this.field[t],L=this.field[x];F<h&&(A|=1);v<h&&(A|=2);I<h&&(A|=8);q<h&&(A|=4);J<h&&(A|=16);e<h&&(A|=32);ba<h&&(A|=128);L<h&&(A|=64);var M=THREE.edgeTable[A];if(M==0)return 0;
+var V=this.delta,S=c+V,Y=d+V;V=f+V;if(M&1){this.compNorm(g);this.compNorm(j);this.VIntX(g*3,this.vlist,this.nlist,0,h,c,d,f,F,v)}if(M&2){this.compNorm(j);this.compNorm(w);this.VIntY(j*3,this.vlist,this.nlist,3,h,S,d,f,v,q)}if(M&4){this.compNorm(m);this.compNorm(w);this.VIntX(m*3,this.vlist,this.nlist,6,h,c,Y,f,I,q)}if(M&8){this.compNorm(g);this.compNorm(m);this.VIntY(g*3,this.vlist,this.nlist,9,h,c,d,f,F,I)}if(M&16){this.compNorm(o);this.compNorm(u);this.VIntX(o*3,this.vlist,this.nlist,12,h,c,d,V,
 J,e)}if(M&32){this.compNorm(u);this.compNorm(x);this.VIntY(u*3,this.vlist,this.nlist,15,h,S,d,V,e,L)}if(M&64){this.compNorm(t);this.compNorm(x);this.VIntX(t*3,this.vlist,this.nlist,18,h,c,Y,V,ba,L)}if(M&128){this.compNorm(o);this.compNorm(t);this.VIntY(o*3,this.vlist,this.nlist,21,h,c,d,V,J,ba)}if(M&256){this.compNorm(g);this.compNorm(o);this.VIntZ(g*3,this.vlist,this.nlist,24,h,c,d,f,F,J)}if(M&512){this.compNorm(j);this.compNorm(u);this.VIntZ(j*3,this.vlist,this.nlist,27,h,S,d,f,v,e)}if(M&1024){this.compNorm(w);
 J,e)}if(M&32){this.compNorm(u);this.compNorm(x);this.VIntY(u*3,this.vlist,this.nlist,15,h,S,d,V,e,L)}if(M&64){this.compNorm(t);this.compNorm(x);this.VIntX(t*3,this.vlist,this.nlist,18,h,c,Y,V,ba,L)}if(M&128){this.compNorm(o);this.compNorm(t);this.VIntY(o*3,this.vlist,this.nlist,21,h,c,d,V,J,ba)}if(M&256){this.compNorm(g);this.compNorm(o);this.VIntZ(g*3,this.vlist,this.nlist,24,h,c,d,f,F,J)}if(M&512){this.compNorm(j);this.compNorm(u);this.VIntZ(j*3,this.vlist,this.nlist,27,h,S,d,f,v,e)}if(M&1024){this.compNorm(w);
-this.compNorm(x);this.VIntZ(w*3,this.vlist,this.nlist,30,h,S,Y,f,q,L)}if(M&2048){this.compNorm(m);this.compNorm(t);this.VIntZ(m*3,this.vlist,this.nlist,33,h,c,Y,f,H,ba)}A<<=4;for(h=g=0;THREE.triTable[A+h]!=-1;){c=A+h;d=c+1;f=c+2;this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[c],3*THREE.triTable[d],3*THREE.triTable[f],k);h+=3;g++}return g};this.posnormtriv=function(c,d,f,g,h,k){var j=this.count*3;this.positionArray[j]=c[f];this.positionArray[j+1]=c[f+1];this.positionArray[j+2]=c[f+2];this.positionArray[j+
+this.compNorm(x);this.VIntZ(w*3,this.vlist,this.nlist,30,h,S,Y,f,q,L)}if(M&2048){this.compNorm(m);this.compNorm(t);this.VIntZ(m*3,this.vlist,this.nlist,33,h,c,Y,f,I,ba)}A<<=4;for(h=g=0;THREE.triTable[A+h]!=-1;){c=A+h;d=c+1;f=c+2;this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[c],3*THREE.triTable[d],3*THREE.triTable[f],k);h+=3;g++}return g};this.posnormtriv=function(c,d,f,g,h,k){var j=this.count*3;this.positionArray[j]=c[f];this.positionArray[j+1]=c[f+1];this.positionArray[j+2]=c[f+2];this.positionArray[j+
 3]=c[g];this.positionArray[j+4]=c[g+1];this.positionArray[j+5]=c[g+2];this.positionArray[j+6]=c[h];this.positionArray[j+7]=c[h+1];this.positionArray[j+8]=c[h+2];this.normalArray[j]=d[f];this.normalArray[j+1]=d[f+1];this.normalArray[j+2]=d[f+2];this.normalArray[j+3]=d[g];this.normalArray[j+4]=d[g+1];this.normalArray[j+5]=d[g+2];this.normalArray[j+6]=d[h];this.normalArray[j+7]=d[h+1];this.normalArray[j+8]=d[h+2];this.hasPos=!0;this.hasNormal=!0;this.count+=3;this.count>=this.maxCount-3&&k(this)};this.begin=
 3]=c[g];this.positionArray[j+4]=c[g+1];this.positionArray[j+5]=c[g+2];this.positionArray[j+6]=c[h];this.positionArray[j+7]=c[h+1];this.positionArray[j+8]=c[h+2];this.normalArray[j]=d[f];this.normalArray[j+1]=d[f+1];this.normalArray[j+2]=d[f+2];this.normalArray[j+3]=d[g];this.normalArray[j+4]=d[g+1];this.normalArray[j+5]=d[g+2];this.normalArray[j+6]=d[h];this.normalArray[j+7]=d[h+1];this.normalArray[j+8]=d[h+2];this.hasPos=!0;this.hasNormal=!0;this.count+=3;this.count>=this.maxCount-3&&k(this)};this.begin=
 function(){this.count=0;this.hasPos=!1;this.hasNormal=!1};this.end=function(c){if(this.count!=0){for(var d=this.count*3;d<this.positionArray.length;d++)this.positionArray[d]=0;c(this)}};this.addBall=function(c,d,f,g,h){var k=this.size*Math.sqrt(g/h),j=f*this.size,m=d*this.size,o=c*this.size,w=Math.floor(j-k);w<1&&(w=1);j=Math.floor(j+k);j>this.size-1&&(j=this.size-1);var u=Math.floor(m-k);u<1&&(u=1);m=Math.floor(m+k);m>this.size-1&&(m=this.size-1);var t=Math.floor(o-k);t<1&&(t=1);k=Math.floor(o+k);
 function(){this.count=0;this.hasPos=!1;this.hasNormal=!1};this.end=function(c){if(this.count!=0){for(var d=this.count*3;d<this.positionArray.length;d++)this.positionArray[d]=0;c(this)}};this.addBall=function(c,d,f,g,h){var k=this.size*Math.sqrt(g/h),j=f*this.size,m=d*this.size,o=c*this.size,w=Math.floor(j-k);w<1&&(w=1);j=Math.floor(j+k);j>this.size-1&&(j=this.size-1);var u=Math.floor(m-k);u<1&&(u=1);m=Math.floor(m+k);m>this.size-1&&(m=this.size-1);var t=Math.floor(o-k);t<1&&(t=1);k=Math.floor(o+k);
-k>this.size-1&&(k=this.size-1);for(var x,A,F,v,H,q;w<j;w++){o=this.size2*w;A=w/this.size-f;H=A*A;for(A=u;A<m;A++){F=o+this.size*A;x=A/this.size-d;q=x*x;for(x=t;x<k;x++){v=x/this.size-c;v=g/(1.0E-6+v*v+q+H)-h;v>0&&(this.field[F+x]+=v)}}}};this.addPlaneX=function(c,d){var f,g,h,k,j,m=this.size,o=this.yd,w=this.zd,u=this.field,t=m*Math.sqrt(c/d);t>m&&(t=m);for(f=0;f<t;f++){g=f/m;g*=g;k=c/(1.0E-4+g)-d;if(k>0)for(g=0;g<m;g++){j=f+g*o;for(h=0;h<m;h++)u[w*h+j]+=k}}};this.addPlaneY=function(c,d){var f,g,
+k>this.size-1&&(k=this.size-1);for(var x,A,F,v,I,q;w<j;w++){o=this.size2*w;A=w/this.size-f;I=A*A;for(A=u;A<m;A++){F=o+this.size*A;x=A/this.size-d;q=x*x;for(x=t;x<k;x++){v=x/this.size-c;v=g/(1.0E-6+v*v+q+I)-h;v>0&&(this.field[F+x]+=v)}}}};this.addPlaneX=function(c,d){var f,g,h,k,j,m=this.size,o=this.yd,w=this.zd,u=this.field,t=m*Math.sqrt(c/d);t>m&&(t=m);for(f=0;f<t;f++){g=f/m;g*=g;k=c/(1.0E-4+g)-d;if(k>0)for(g=0;g<m;g++){j=f+g*o;for(h=0;h<m;h++)u[w*h+j]+=k}}};this.addPlaneY=function(c,d){var f,g,
 h,k,j,m,o=this.size,w=this.yd,u=this.zd,t=this.field,x=o*Math.sqrt(c/d);x>o&&(x=o);for(g=0;g<x;g++){f=g/o;f*=f;k=c/(1.0E-4+f)-d;if(k>0){j=g*w;for(f=0;f<o;f++){m=j+f;for(h=0;h<o;h++)t[u*h+m]+=k}}}};this.addPlaneZ=function(c,d){var f,g,h,k,j,m;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(c/d);dist>size&&(dist=size);for(h=0;h<dist;h++){f=h/size;f*=f;k=c/(1.0E-4+f)-d;if(k>0){j=zd*h;for(g=0;g<size;g++){m=j+g*yd;for(f=0;f<size;f++)field[m+f]+=k}}}};this.reset=function(){var c;
 h,k,j,m,o=this.size,w=this.yd,u=this.zd,t=this.field,x=o*Math.sqrt(c/d);x>o&&(x=o);for(g=0;g<x;g++){f=g/o;f*=f;k=c/(1.0E-4+f)-d;if(k>0){j=g*w;for(f=0;f<o;f++){m=j+f;for(h=0;h<o;h++)t[u*h+m]+=k}}}};this.addPlaneZ=function(c,d){var f,g,h,k,j,m;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(c/d);dist>size&&(dist=size);for(h=0;h<dist;h++){f=h/size;f*=f;k=c/(1.0E-4+f)-d;if(k>0){j=zd*h;for(g=0;g<size;g++){m=j+g*yd;for(f=0;f<size;f++)field[m+f]+=k}}}};this.reset=function(){var c;
 for(c=0;c<this.size3;c++){this.normal_cache[c*3]=0;this.field[c]=0}};this.render=function(c){this.begin();var d,f,g,h,k,j,m,o,w,u=this.size-2;for(h=1;h<u;h++){w=this.size2*h;m=(h-this.halfsize)/this.halfsize;for(g=1;g<u;g++){o=w+this.size*g;j=(g-this.halfsize)/this.halfsize;for(f=1;f<u;f++){k=(f-this.halfsize)/this.halfsize;d=o+f;this.polygonize(k,j,m,d,this.isolation,c)}}}this.end(c)};this.generateGeometry=function(){var c=0,d=new THREE.Geometry;this.render(function(f){var g,h,k,j,m,o,w,u;for(g=
 for(c=0;c<this.size3;c++){this.normal_cache[c*3]=0;this.field[c]=0}};this.render=function(c){this.begin();var d,f,g,h,k,j,m,o,w,u=this.size-2;for(h=1;h<u;h++){w=this.size2*h;m=(h-this.halfsize)/this.halfsize;for(g=1;g<u;g++){o=w+this.size*g;j=(g-this.halfsize)/this.halfsize;for(f=1;f<u;f++){k=(f-this.halfsize)/this.halfsize;d=o+f;this.polygonize(k,j,m,d,this.isolation,c)}}}this.end(c)};this.generateGeometry=function(){var c=0,d=new THREE.Geometry;this.render(function(f){var g,h,k,j,m,o,w,u;for(g=
 0;g<f.count;g++){m=g*3;w=m+1;u=m+2;h=f.positionArray[m];k=f.positionArray[w];j=f.positionArray[u];o=new THREE.Vector3(h,k,j);h=f.normalArray[m];k=f.normalArray[w];j=f.normalArray[u];m=new THREE.Vector3(h,k,j);m.normalize();m=new THREE.Vertex(o,m);d.vertices.push(m)}nfaces=f.count/3;for(g=0;g<nfaces;g++){m=(c+g)*3;w=m+1;u=m+2;o=d.vertices[m].normal;h=d.vertices[w].normal;k=d.vertices[u].normal;m=new THREE.Face3(m,w,u,[o,h,k]);d.faces.push(m)}c+=nfaces;f.count=0});d.sortFacesByMaterial();return d};
 0;g<f.count;g++){m=g*3;w=m+1;u=m+2;h=f.positionArray[m];k=f.positionArray[w];j=f.positionArray[u];o=new THREE.Vector3(h,k,j);h=f.normalArray[m];k=f.normalArray[w];j=f.normalArray[u];m=new THREE.Vector3(h,k,j);m.normalize();m=new THREE.Vertex(o,m);d.vertices.push(m)}nfaces=f.count/3;for(g=0;g<nfaces;g++){m=(c+g)*3;w=m+1;u=m+2;o=d.vertices[m].normal;h=d.vertices[w].normal;k=d.vertices[u].normal;m=new THREE.Face3(m,w,u,[o,h,k]);d.faces.push(m)}c+=nfaces;f.count=0});d.sortFacesByMaterial();return d};
@@ -358,20 +361,20 @@ THREE.Loader.prototype={addStatusElement:function(){var a=document.createElement
 b},loadAsciiOld:function(a,b){var c=document.createElement("script");c.type="text/javascript";c.onload=b;c.src=a;document.getElementsByTagName("head")[0].appendChild(c)},loadAscii:function(a){var b=a.model,c=a.callback,d=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(b);a=(new Date).getTime();b=new Worker(b);b.onmessage=function(f){THREE.Loader.prototype.createModel(f.data,c,d)};b.postMessage(a)},loadBinary:function(a){var b=a.model,c=a.callback,d=a.texture_path?a.texture_path:
 b},loadAsciiOld:function(a,b){var c=document.createElement("script");c.type="text/javascript";c.onload=b;c.src=a;document.getElementsByTagName("head")[0].appendChild(c)},loadAscii:function(a){var b=a.model,c=a.callback,d=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(b);a=(new Date).getTime();b=new Worker(b);b.onmessage=function(f){THREE.Loader.prototype.createModel(f.data,c,d)};b.postMessage(a)},loadBinary:function(a){var b=a.model,c=a.callback,d=a.texture_path?a.texture_path:
 THREE.Loader.prototype.extractUrlbase(b),f=a.bin_path?a.bin_path:THREE.Loader.prototype.extractUrlbase(b);a=(new Date).getTime();b=new Worker(b);var g=this.showProgress?THREE.Loader.prototype.updateProgress:null;b.onmessage=function(h){THREE.Loader.prototype.loadAjaxBuffers(h.data.buffers,h.data.materials,c,f,d,g)};b.onerror=function(h){alert("worker.onerror: "+h.message+"\n"+h.data);h.preventDefault()};b.postMessage(a)},loadAjaxBuffers:function(a,b,c,d,f,g){var h=new XMLHttpRequest,k=d+"/"+a,j=0;
 THREE.Loader.prototype.extractUrlbase(b),f=a.bin_path?a.bin_path:THREE.Loader.prototype.extractUrlbase(b);a=(new Date).getTime();b=new Worker(b);var g=this.showProgress?THREE.Loader.prototype.updateProgress:null;b.onmessage=function(h){THREE.Loader.prototype.loadAjaxBuffers(h.data.buffers,h.data.materials,c,f,d,g)};b.onerror=function(h){alert("worker.onerror: "+h.message+"\n"+h.data);h.preventDefault()};b.postMessage(a)},loadAjaxBuffers:function(a,b,c,d,f,g){var h=new XMLHttpRequest,k=d+"/"+a,j=0;
 h.onreadystatechange=function(){if(h.readyState==4)h.status==200||h.status==0?THREE.Loader.prototype.createBinModel(h.responseText,c,f,b):alert("Couldn't load ["+k+"] ["+h.status+"]");else if(h.readyState==3){if(g){j==0&&(j=h.getResponseHeader("Content-Length"));g({total:j,loaded:h.responseText.length})}}else h.readyState==2&&(j=h.getResponseHeader("Content-Length"))};h.open("GET",k,!0);h.overrideMimeType("text/plain; charset=x-user-defined");h.setRequestHeader("Content-Type","text/plain");h.send(null)},
 h.onreadystatechange=function(){if(h.readyState==4)h.status==200||h.status==0?THREE.Loader.prototype.createBinModel(h.responseText,c,f,b):alert("Couldn't load ["+k+"] ["+h.status+"]");else if(h.readyState==3){if(g){j==0&&(j=h.getResponseHeader("Content-Length"));g({total:j,loaded:h.responseText.length})}}else h.readyState==2&&(j=h.getResponseHeader("Content-Length"))};h.open("GET",k,!0);h.overrideMimeType("text/plain; charset=x-user-defined");h.setRequestHeader("Content-Type","text/plain");h.send(null)},
-createBinModel:function(a,b,c,d){var f=function(g){function h(y,C){var D=o(y,C),Q=o(y,C+1),U=o(y,C+2),pa=o(y,C+3),ka=(pa<<1&255|U>>7)-127;D|=(U&127)<<16|Q<<8;if(D==0&&ka==-127)return 0;return(1-2*(pa>>7))*(1+D*Math.pow(2,-23))*Math.pow(2,ka)}function k(y,C){var D=o(y,C),Q=o(y,C+1),U=o(y,C+2);return(o(y,C+3)<<24)+(U<<16)+(Q<<8)+D}function j(y,C){var D=o(y,C);return(o(y,C+1)<<8)+D}function m(y,C){var D=o(y,C);return D>127?D-256:D}function o(y,C){return y.charCodeAt(C)&255}function w(y){var C,D,Q;C=
-k(a,y);D=k(a,y+ba);Q=k(a,y+L);y=j(a,y+M);THREE.Loader.prototype.f3(v,C,D,Q,y)}function u(y){var C,D,Q,U,pa,ka;C=k(a,y);D=k(a,y+ba);Q=k(a,y+L);U=j(a,y+M);pa=k(a,y+V);ka=k(a,y+S);y=k(a,y+Y);THREE.Loader.prototype.f3n(v,J,C,D,Q,U,pa,ka,y)}function t(y){var C,D,Q,U;C=k(a,y);D=k(a,y+Z);Q=k(a,y+G);U=k(a,y+T);y=j(a,y+la);THREE.Loader.prototype.f4(v,C,D,Q,U,y)}function x(y){var C,D,Q,U,pa,ka,ma,na;C=k(a,y);D=k(a,y+Z);Q=k(a,y+G);U=k(a,y+T);pa=j(a,y+la);ka=k(a,y+W);ma=k(a,y+ja);na=k(a,y+ia);y=k(a,y+$);THREE.Loader.prototype.f4n(v,
-J,C,D,Q,U,pa,ka,ma,na,y)}function A(y){var C,D;C=k(a,y);D=k(a,y+ra);y=k(a,y+ya);THREE.Loader.prototype.uv3(v.uvs,e[C*2],e[C*2+1],e[D*2],e[D*2+1],e[y*2],e[y*2+1])}function F(y){var C,D,Q;C=k(a,y);D=k(a,y+l);Q=k(a,y+z);y=k(a,y+B);THREE.Loader.prototype.uv4(v.uvs,e[C*2],e[C*2+1],e[D*2],e[D*2+1],e[Q*2],e[Q*2+1],e[y*2],e[y*2+1])}var v=this,H=0,q,J=[],e=[],ba,L,M,V,S,Y,Z,G,T,la,W,ja,ia,$,ra,ya,l,z,B,p,n,E,I,P,da;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(v,d,g);q={signature:a.substr(H,
-8),header_bytes:o(a,H+8),vertex_coordinate_bytes:o(a,H+9),normal_coordinate_bytes:o(a,H+10),uv_coordinate_bytes:o(a,H+11),vertex_index_bytes:o(a,H+12),normal_index_bytes:o(a,H+13),uv_index_bytes:o(a,H+14),material_index_bytes:o(a,H+15),nvertices:k(a,H+16),nnormals:k(a,H+16+4),nuvs:k(a,H+16+8),ntri_flat:k(a,H+16+12),ntri_smooth:k(a,H+16+16),ntri_flat_uv:k(a,H+16+20),ntri_smooth_uv:k(a,H+16+24),nquad_flat:k(a,H+16+28),nquad_smooth:k(a,H+16+32),nquad_flat_uv:k(a,H+16+36),nquad_smooth_uv:k(a,H+16+40)};
-H+=q.header_bytes;ba=q.vertex_index_bytes;L=q.vertex_index_bytes*2;M=q.vertex_index_bytes*3;V=q.vertex_index_bytes*3+q.material_index_bytes;S=q.vertex_index_bytes*3+q.material_index_bytes+q.normal_index_bytes;Y=q.vertex_index_bytes*3+q.material_index_bytes+q.normal_index_bytes*2;Z=q.vertex_index_bytes;G=q.vertex_index_bytes*2;T=q.vertex_index_bytes*3;la=q.vertex_index_bytes*4;W=q.vertex_index_bytes*4+q.material_index_bytes;ja=q.vertex_index_bytes*4+q.material_index_bytes+q.normal_index_bytes;ia=q.vertex_index_bytes*
-4+q.material_index_bytes+q.normal_index_bytes*2;$=q.vertex_index_bytes*4+q.material_index_bytes+q.normal_index_bytes*3;ra=q.uv_index_bytes;ya=q.uv_index_bytes*2;l=q.uv_index_bytes;z=q.uv_index_bytes*2;B=q.uv_index_bytes*3;g=q.vertex_index_bytes*3+q.material_index_bytes;da=q.vertex_index_bytes*4+q.material_index_bytes;p=q.ntri_flat*g;n=q.ntri_smooth*(g+q.normal_index_bytes*3);E=q.ntri_flat_uv*(g+q.uv_index_bytes*3);I=q.ntri_smooth_uv*(g+q.normal_index_bytes*3+q.uv_index_bytes*3);P=q.nquad_flat*da;
-g=q.nquad_smooth*(da+q.normal_index_bytes*4);da=q.nquad_flat_uv*(da+q.uv_index_bytes*4);H+=function(y){for(var C,D,Q,U=q.vertex_coordinate_bytes*3,pa=y+q.nvertices*U;y<pa;y+=U){C=h(a,y);D=h(a,y+q.vertex_coordinate_bytes);Q=h(a,y+q.vertex_coordinate_bytes*2);THREE.Loader.prototype.v(v,C,D,Q)}return q.nvertices*U}(H);H+=function(y){for(var C,D,Q,U=q.normal_coordinate_bytes*3,pa=y+q.nnormals*U;y<pa;y+=U){C=m(a,y);D=m(a,y+q.normal_coordinate_bytes);Q=m(a,y+q.normal_coordinate_bytes*2);J.push(C/127,D/
-127,Q/127)}return q.nnormals*U}(H);H+=function(y){for(var C,D,Q=q.uv_coordinate_bytes*2,U=y+q.nuvs*Q;y<U;y+=Q){C=h(a,y);D=h(a,y+q.uv_coordinate_bytes);e.push(C,D)}return q.nuvs*Q}(H);p=H+p;n=p+n;E=n+E;I=E+I;P=I+P;g=P+g;da=g+da;(function(y){var C,D=q.vertex_index_bytes*3+q.material_index_bytes,Q=D+q.uv_index_bytes*3,U=y+q.ntri_flat_uv*Q;for(C=y;C<U;C+=Q){w(C);A(C+D)}return U-y})(n);(function(y){var C,D=q.vertex_index_bytes*3+q.material_index_bytes+q.normal_index_bytes*3,Q=D+q.uv_index_bytes*3,U=y+
-q.ntri_smooth_uv*Q;for(C=y;C<U;C+=Q){u(C);A(C+D)}return U-y})(E);(function(y){var C,D=q.vertex_index_bytes*4+q.material_index_bytes,Q=D+q.uv_index_bytes*4,U=y+q.nquad_flat_uv*Q;for(C=y;C<U;C+=Q){t(C);F(C+D)}return U-y})(g);(function(y){var C,D=q.vertex_index_bytes*4+q.material_index_bytes+q.normal_index_bytes*4,Q=D+q.uv_index_bytes*4,U=y+q.nquad_smooth_uv*Q;for(C=y;C<U;C+=Q){x(C);F(C+D)}return U-y})(da);(function(y){var C,D=q.vertex_index_bytes*3+q.material_index_bytes,Q=y+q.ntri_flat*D;for(C=y;C<
-Q;C+=D)w(C);return Q-y})(H);(function(y){var C,D=q.vertex_index_bytes*3+q.material_index_bytes+q.normal_index_bytes*3,Q=y+q.ntri_smooth*D;for(C=y;C<Q;C+=D)u(C);return Q-y})(p);(function(y){var C,D=q.vertex_index_bytes*4+q.material_index_bytes,Q=y+q.nquad_flat*D;for(C=y;C<Q;C+=D)t(C);return Q-y})(I);(function(y){var C,D=q.vertex_index_bytes*4+q.material_index_bytes+q.normal_index_bytes*4,Q=y+q.nquad_smooth*D;for(C=y;C<Q;C+=D)x(C);return Q-y})(P);this.computeCentroids();this.computeFaceNormals();this.sortFacesByMaterial()};
+createBinModel:function(a,b,c,d){var f=function(g){function h(y,E){var D=o(y,E),P=o(y,E+1),T=o(y,E+2),oa=o(y,E+3),la=(oa<<1&255|T>>7)-127;D|=(T&127)<<16|P<<8;if(D==0&&la==-127)return 0;return(1-2*(oa>>7))*(1+D*Math.pow(2,-23))*Math.pow(2,la)}function k(y,E){var D=o(y,E),P=o(y,E+1),T=o(y,E+2);return(o(y,E+3)<<24)+(T<<16)+(P<<8)+D}function j(y,E){var D=o(y,E);return(o(y,E+1)<<8)+D}function m(y,E){var D=o(y,E);return D>127?D-256:D}function o(y,E){return y.charCodeAt(E)&255}function w(y){var E,D,P;E=
+k(a,y);D=k(a,y+ba);P=k(a,y+L);y=j(a,y+M);THREE.Loader.prototype.f3(v,E,D,P,y)}function u(y){var E,D,P,T,oa,la;E=k(a,y);D=k(a,y+ba);P=k(a,y+L);T=j(a,y+M);oa=k(a,y+V);la=k(a,y+S);y=k(a,y+Y);THREE.Loader.prototype.f3n(v,J,E,D,P,T,oa,la,y)}function t(y){var E,D,P,T;E=k(a,y);D=k(a,y+Z);P=k(a,y+G);T=k(a,y+U);y=j(a,y+na);THREE.Loader.prototype.f4(v,E,D,P,T,y)}function x(y){var E,D,P,T,oa,la,ja,ma;E=k(a,y);D=k(a,y+Z);P=k(a,y+G);T=k(a,y+U);oa=j(a,y+na);la=k(a,y+W);ja=k(a,y+ka);ma=k(a,y+ia);y=k(a,y+$);THREE.Loader.prototype.f4n(v,
+J,E,D,P,T,oa,la,ja,ma,y)}function A(y){var E,D;E=k(a,y);D=k(a,y+ra);y=k(a,y+ya);THREE.Loader.prototype.uv3(v.uvs,e[E*2],e[E*2+1],e[D*2],e[D*2+1],e[y*2],e[y*2+1])}function F(y){var E,D,P;E=k(a,y);D=k(a,y+l);P=k(a,y+z);y=k(a,y+C);THREE.Loader.prototype.uv4(v.uvs,e[E*2],e[E*2+1],e[D*2],e[D*2+1],e[P*2],e[P*2+1],e[y*2],e[y*2+1])}var v=this,I=0,q,J=[],e=[],ba,L,M,V,S,Y,Z,G,U,na,W,ka,ia,$,ra,ya,l,z,C,p,n,B,H,N,ca;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(v,d,g);q={signature:a.substr(I,
+8),header_bytes:o(a,I+8),vertex_coordinate_bytes:o(a,I+9),normal_coordinate_bytes:o(a,I+10),uv_coordinate_bytes:o(a,I+11),vertex_index_bytes:o(a,I+12),normal_index_bytes:o(a,I+13),uv_index_bytes:o(a,I+14),material_index_bytes:o(a,I+15),nvertices:k(a,I+16),nnormals:k(a,I+16+4),nuvs:k(a,I+16+8),ntri_flat:k(a,I+16+12),ntri_smooth:k(a,I+16+16),ntri_flat_uv:k(a,I+16+20),ntri_smooth_uv:k(a,I+16+24),nquad_flat:k(a,I+16+28),nquad_smooth:k(a,I+16+32),nquad_flat_uv:k(a,I+16+36),nquad_smooth_uv:k(a,I+16+40)};
+I+=q.header_bytes;ba=q.vertex_index_bytes;L=q.vertex_index_bytes*2;M=q.vertex_index_bytes*3;V=q.vertex_index_bytes*3+q.material_index_bytes;S=q.vertex_index_bytes*3+q.material_index_bytes+q.normal_index_bytes;Y=q.vertex_index_bytes*3+q.material_index_bytes+q.normal_index_bytes*2;Z=q.vertex_index_bytes;G=q.vertex_index_bytes*2;U=q.vertex_index_bytes*3;na=q.vertex_index_bytes*4;W=q.vertex_index_bytes*4+q.material_index_bytes;ka=q.vertex_index_bytes*4+q.material_index_bytes+q.normal_index_bytes;ia=q.vertex_index_bytes*
+4+q.material_index_bytes+q.normal_index_bytes*2;$=q.vertex_index_bytes*4+q.material_index_bytes+q.normal_index_bytes*3;ra=q.uv_index_bytes;ya=q.uv_index_bytes*2;l=q.uv_index_bytes;z=q.uv_index_bytes*2;C=q.uv_index_bytes*3;g=q.vertex_index_bytes*3+q.material_index_bytes;ca=q.vertex_index_bytes*4+q.material_index_bytes;p=q.ntri_flat*g;n=q.ntri_smooth*(g+q.normal_index_bytes*3);B=q.ntri_flat_uv*(g+q.uv_index_bytes*3);H=q.ntri_smooth_uv*(g+q.normal_index_bytes*3+q.uv_index_bytes*3);N=q.nquad_flat*ca;
+g=q.nquad_smooth*(ca+q.normal_index_bytes*4);ca=q.nquad_flat_uv*(ca+q.uv_index_bytes*4);I+=function(y){for(var E,D,P,T=q.vertex_coordinate_bytes*3,oa=y+q.nvertices*T;y<oa;y+=T){E=h(a,y);D=h(a,y+q.vertex_coordinate_bytes);P=h(a,y+q.vertex_coordinate_bytes*2);THREE.Loader.prototype.v(v,E,D,P)}return q.nvertices*T}(I);I+=function(y){for(var E,D,P,T=q.normal_coordinate_bytes*3,oa=y+q.nnormals*T;y<oa;y+=T){E=m(a,y);D=m(a,y+q.normal_coordinate_bytes);P=m(a,y+q.normal_coordinate_bytes*2);J.push(E/127,D/
+127,P/127)}return q.nnormals*T}(I);I+=function(y){for(var E,D,P=q.uv_coordinate_bytes*2,T=y+q.nuvs*P;y<T;y+=P){E=h(a,y);D=h(a,y+q.uv_coordinate_bytes);e.push(E,D)}return q.nuvs*P}(I);p=I+p;n=p+n;B=n+B;H=B+H;N=H+N;g=N+g;ca=g+ca;(function(y){var E,D=q.vertex_index_bytes*3+q.material_index_bytes,P=D+q.uv_index_bytes*3,T=y+q.ntri_flat_uv*P;for(E=y;E<T;E+=P){w(E);A(E+D)}return T-y})(n);(function(y){var E,D=q.vertex_index_bytes*3+q.material_index_bytes+q.normal_index_bytes*3,P=D+q.uv_index_bytes*3,T=y+
+q.ntri_smooth_uv*P;for(E=y;E<T;E+=P){u(E);A(E+D)}return T-y})(B);(function(y){var E,D=q.vertex_index_bytes*4+q.material_index_bytes,P=D+q.uv_index_bytes*4,T=y+q.nquad_flat_uv*P;for(E=y;E<T;E+=P){t(E);F(E+D)}return T-y})(g);(function(y){var E,D=q.vertex_index_bytes*4+q.material_index_bytes+q.normal_index_bytes*4,P=D+q.uv_index_bytes*4,T=y+q.nquad_smooth_uv*P;for(E=y;E<T;E+=P){x(E);F(E+D)}return T-y})(ca);(function(y){var E,D=q.vertex_index_bytes*3+q.material_index_bytes,P=y+q.ntri_flat*D;for(E=y;E<
+P;E+=D)w(E);return P-y})(I);(function(y){var E,D=q.vertex_index_bytes*3+q.material_index_bytes+q.normal_index_bytes*3,P=y+q.ntri_smooth*D;for(E=y;E<P;E+=D)u(E);return P-y})(p);(function(y){var E,D=q.vertex_index_bytes*4+q.material_index_bytes,P=y+q.nquad_flat*D;for(E=y;E<P;E+=D)t(E);return P-y})(H);(function(y){var E,D=q.vertex_index_bytes*4+q.material_index_bytes+q.normal_index_bytes*4,P=y+q.nquad_smooth*D;for(E=y;E<P;E+=D)x(E);return P-y})(N);this.computeCentroids();this.computeFaceNormals();this.sortFacesByMaterial()};
 f.prototype=new THREE.Geometry;f.prototype.constructor=f;b(new f(c))},createModel:function(a,b,c){var d=function(f){var g=this;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(g,a.materials,f);(function(){var h,k,j,m,o;h=0;for(k=a.vertices.length;h<k;h+=3){j=a.vertices[h];m=a.vertices[h+1];o=a.vertices[h+2];THREE.Loader.prototype.v(g,j,m,o)}if(a.colors){h=0;for(k=a.colors.length;h<k;h+=3){j=a.colors[h];m=a.colors[h+1];o=a.colors[h+2];THREE.Loader.prototype.vc(g,j,m,o)}}})();(function(){function h(x,
 f.prototype=new THREE.Geometry;f.prototype.constructor=f;b(new f(c))},createModel:function(a,b,c){var d=function(f){var g=this;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(g,a.materials,f);(function(){var h,k,j,m,o;h=0;for(k=a.vertices.length;h<k;h+=3){j=a.vertices[h];m=a.vertices[h+1];o=a.vertices[h+2];THREE.Loader.prototype.v(g,j,m,o)}if(a.colors){h=0;for(k=a.colors.length;h<k;h+=3){j=a.colors[h];m=a.colors[h+1];o=a.colors[h+2];THREE.Loader.prototype.vc(g,j,m,o)}}})();(function(){function h(x,
-A){THREE.Loader.prototype.f3(g,x[A],x[A+1],x[A+2],x[A+3])}function k(x,A){THREE.Loader.prototype.f3n(g,a.normals,x[A],x[A+1],x[A+2],x[A+3],x[A+4],x[A+5],x[A+6])}function j(x,A){THREE.Loader.prototype.f4(g,x[A],x[A+1],x[A+2],x[A+3],x[A+4])}function m(x,A){THREE.Loader.prototype.f4n(g,a.normals,x[A],x[A+1],x[A+2],x[A+3],x[A+4],x[A+5],x[A+6],x[A+7],x[A+8])}function o(x,A){var F,v,H,q,J,e,ba,L,M;F=x[A];v=x[A+1];H=x[A+2];q=a.uvs[F*2];ba=a.uvs[F*2+1];J=a.uvs[v*2];L=a.uvs[v*2+1];e=a.uvs[H*2];M=a.uvs[H*2+
-1];THREE.Loader.prototype.uv3(g.uvs,q,ba,J,L,e,M);if(a.uvs2&&a.uvs2.length){q=a.uvs2[F*2];ba=a.uvs2[F*2+1];J=a.uvs2[v*2];L=a.uvs2[v*2+1];e=a.uvs2[H*2];M=a.uvs2[H*2+1];THREE.Loader.prototype.uv3(g.uvs2,q,1-ba,J,1-L,e,1-M)}}function w(x,A){var F,v,H,q,J,e,ba,L,M,V,S,Y;F=x[A];v=x[A+1];H=x[A+2];q=x[A+3];J=a.uvs[F*2];M=a.uvs[F*2+1];e=a.uvs[v*2];V=a.uvs[v*2+1];ba=a.uvs[H*2];S=a.uvs[H*2+1];L=a.uvs[q*2];Y=a.uvs[q*2+1];THREE.Loader.prototype.uv4(g.uvs,J,M,e,V,ba,S,L,Y);if(a.uvs2){J=a.uvs2[F*2];M=a.uvs2[F*
-2+1];e=a.uvs2[v*2];V=a.uvs2[v*2+1];ba=a.uvs2[H*2];S=a.uvs2[H*2+1];L=a.uvs2[q*2];Y=a.uvs2[q*2+1];THREE.Loader.prototype.uv4(g.uvs2,J,1-M,e,1-V,ba,1-S,L,1-Y)}}var u,t;u=0;for(t=a.triangles_uv.length;u<t;u+=7){h(a.triangles_uv,u);o(a.triangles_uv,u+4)}u=0;for(t=a.triangles_n_uv.length;u<t;u+=10){k(a.triangles_n_uv,u);o(a.triangles_n_uv,u+7)}u=0;for(t=a.quads_uv.length;u<t;u+=9){j(a.quads_uv,u);w(a.quads_uv,u+5)}u=0;for(t=a.quads_n_uv.length;u<t;u+=13){m(a.quads_n_uv,u);w(a.quads_n_uv,u+9)}u=0;for(t=
+A){THREE.Loader.prototype.f3(g,x[A],x[A+1],x[A+2],x[A+3])}function k(x,A){THREE.Loader.prototype.f3n(g,a.normals,x[A],x[A+1],x[A+2],x[A+3],x[A+4],x[A+5],x[A+6])}function j(x,A){THREE.Loader.prototype.f4(g,x[A],x[A+1],x[A+2],x[A+3],x[A+4])}function m(x,A){THREE.Loader.prototype.f4n(g,a.normals,x[A],x[A+1],x[A+2],x[A+3],x[A+4],x[A+5],x[A+6],x[A+7],x[A+8])}function o(x,A){var F,v,I,q,J,e,ba,L,M;F=x[A];v=x[A+1];I=x[A+2];q=a.uvs[F*2];ba=a.uvs[F*2+1];J=a.uvs[v*2];L=a.uvs[v*2+1];e=a.uvs[I*2];M=a.uvs[I*2+
+1];THREE.Loader.prototype.uv3(g.uvs,q,ba,J,L,e,M);if(a.uvs2&&a.uvs2.length){q=a.uvs2[F*2];ba=a.uvs2[F*2+1];J=a.uvs2[v*2];L=a.uvs2[v*2+1];e=a.uvs2[I*2];M=a.uvs2[I*2+1];THREE.Loader.prototype.uv3(g.uvs2,q,1-ba,J,1-L,e,1-M)}}function w(x,A){var F,v,I,q,J,e,ba,L,M,V,S,Y;F=x[A];v=x[A+1];I=x[A+2];q=x[A+3];J=a.uvs[F*2];M=a.uvs[F*2+1];e=a.uvs[v*2];V=a.uvs[v*2+1];ba=a.uvs[I*2];S=a.uvs[I*2+1];L=a.uvs[q*2];Y=a.uvs[q*2+1];THREE.Loader.prototype.uv4(g.uvs,J,M,e,V,ba,S,L,Y);if(a.uvs2){J=a.uvs2[F*2];M=a.uvs2[F*
+2+1];e=a.uvs2[v*2];V=a.uvs2[v*2+1];ba=a.uvs2[I*2];S=a.uvs2[I*2+1];L=a.uvs2[q*2];Y=a.uvs2[q*2+1];THREE.Loader.prototype.uv4(g.uvs2,J,1-M,e,1-V,ba,1-S,L,1-Y)}}var u,t;u=0;for(t=a.triangles_uv.length;u<t;u+=7){h(a.triangles_uv,u);o(a.triangles_uv,u+4)}u=0;for(t=a.triangles_n_uv.length;u<t;u+=10){k(a.triangles_n_uv,u);o(a.triangles_n_uv,u+7)}u=0;for(t=a.quads_uv.length;u<t;u+=9){j(a.quads_uv,u);w(a.quads_uv,u+5)}u=0;for(t=a.quads_n_uv.length;u<t;u+=13){m(a.quads_n_uv,u);w(a.quads_n_uv,u+9)}u=0;for(t=
 a.triangles.length;u<t;u+=4)h(a.triangles,u);u=0;for(t=a.triangles_n.length;u<t;u+=7)k(a.triangles_n,u);u=0;for(t=a.quads.length;u<t;u+=5)j(a.quads,u);u=0;for(t=a.quads_n.length;u<t;u+=9)m(a.quads_n,u)})();(function(){var h,k,j,m;if(a.skinWeights){h=0;for(k=a.skinWeights.length;h<k;h+=2){j=a.skinWeights[h];m=a.skinWeights[h+1];THREE.Loader.prototype.sw(g,j,m,0,0)}}if(a.skinIndices){h=0;for(k=a.skinIndices.length;h<k;h+=2){j=a.skinIndices[h];m=a.skinIndices[h+1];THREE.Loader.prototype.si(g,j,m,0,0)}}THREE.Loader.prototype.bones(g,
 a.triangles.length;u<t;u+=4)h(a.triangles,u);u=0;for(t=a.triangles_n.length;u<t;u+=7)k(a.triangles_n,u);u=0;for(t=a.quads.length;u<t;u+=5)j(a.quads,u);u=0;for(t=a.quads_n.length;u<t;u+=9)m(a.quads_n,u)})();(function(){var h,k,j,m;if(a.skinWeights){h=0;for(k=a.skinWeights.length;h<k;h+=2){j=a.skinWeights[h];m=a.skinWeights[h+1];THREE.Loader.prototype.sw(g,j,m,0,0)}}if(a.skinIndices){h=0;for(k=a.skinIndices.length;h<k;h+=2){j=a.skinIndices[h];m=a.skinIndices[h+1];THREE.Loader.prototype.si(g,j,m,0,0)}}THREE.Loader.prototype.bones(g,
 a.bones);THREE.Loader.prototype.animation(g,a.animation)})();this.computeCentroids();this.computeFaceNormals();this.sortFacesByMaterial()};d.prototype=new THREE.Geometry;d.prototype.constructor=d;b(new d(c))},bones:function(a,b){a.bones=b},animation:function(a,b){a.animation=b},si:function(a,b,c,d,f){a.skinIndices.push(new THREE.Vector4(b,c,d,f))},sw:function(a,b,c,d,f){a.skinWeights.push(new THREE.Vector4(b,c,d,f))},v:function(a,b,c,d){a.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,d)))},
 a.bones);THREE.Loader.prototype.animation(g,a.animation)})();this.computeCentroids();this.computeFaceNormals();this.sortFacesByMaterial()};d.prototype=new THREE.Geometry;d.prototype.constructor=d;b(new d(c))},bones:function(a,b){a.bones=b},animation:function(a,b){a.animation=b},si:function(a,b,c,d,f){a.skinIndices.push(new THREE.Vector4(b,c,d,f))},sw:function(a,b,c,d,f){a.skinWeights.push(new THREE.Vector4(b,c,d,f))},v:function(a,b,c,d){a.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,d)))},
 vc:function(a,b,c,d){var f=new THREE.Color(16777215);f.setRGB(b,c,d);a.colors.push(f)},f3:function(a,b,c,d,f){a.faces.push(new THREE.Face3(b,c,d,null,a.materials[f]))},f4:function(a,b,c,d,f,g){a.faces.push(new THREE.Face4(b,c,d,f,null,a.materials[g]))},f3n:function(a,b,c,d,f,g,h,k,j){g=a.materials[g];var m=b[k*3],o=b[k*3+1];k=b[k*3+2];var w=b[j*3],u=b[j*3+1];j=b[j*3+2];a.faces.push(new THREE.Face3(c,d,f,[new THREE.Vector3(b[h*3],b[h*3+1],b[h*3+2]),new THREE.Vector3(m,o,k),new THREE.Vector3(w,u,j)],
 vc:function(a,b,c,d){var f=new THREE.Color(16777215);f.setRGB(b,c,d);a.colors.push(f)},f3:function(a,b,c,d,f){a.faces.push(new THREE.Face3(b,c,d,null,a.materials[f]))},f4:function(a,b,c,d,f,g){a.faces.push(new THREE.Face4(b,c,d,f,null,a.materials[g]))},f3n:function(a,b,c,d,f,g,h,k,j){g=a.materials[g];var m=b[k*3],o=b[k*3+1];k=b[k*3+2];var w=b[j*3],u=b[j*3+1];j=b[j*3+2];a.faces.push(new THREE.Face3(c,d,f,[new THREE.Vector3(b[h*3],b[h*3+1],b[h*3+2]),new THREE.Vector3(m,o,k),new THREE.Vector3(w,u,j)],

+ 342 - 0
examples/ribbons_gl.html

@@ -0,0 +1,342 @@
+<!DOCTYPE HTML>
+<html lang="en">
+	<head>
+		<title>three.js - ribbons - webgl</title>
+		<meta charset="utf-8">
+		<style type="text/css">
+			body {
+				background-color: #000000;
+				margin: 0px;
+				overflow: hidden;
+                font-family:Monospace;
+                font-size:13px;
+                text-align:center;
+                font-weight: bold;
+				text-align:center;
+			}
+
+			a {
+				color:#0078ff;
+			}
+			
+            #info {
+				color:#fff;
+                position: absolute;
+                top: 0px; width: 100%;
+                padding: 5px;
+				z-index:100;
+				
+            }			
+			
+			
+		</style>
+	</head>
+	<body>
+	
+        <div id="info">
+			<a href="http://github.com/mrdoob/three.js" target="_blank">three.js</a> - webgl ribbons example
+		</div>
+		
+		<script type="text/javascript" src="../build/ThreeExtrasRibbon.js"></script>		
+		<script type="text/javascript" src="js/Stats.js"></script>
+
+		<script type="text/javascript">
+		
+			if ( ! THREE.Detector.webgl ) THREE.Detector.addGetWebGLMessage();
+
+			var container, stats;
+			var camera, scene, renderer, ribbon, geometry, geometry2, materials = [], ribbons = [],
+				parameters, i, i2, h, color, x, y, z, z2, s, n, n2, nribbons, grid;
+				
+			var mouseX = 0, mouseY = 0;
+
+			var windowHalfX = window.innerWidth / 2;
+			var windowHalfY = window.innerHeight / 2;
+
+			var postprocessing = {			
+				
+				enabled  : true
+				
+			};
+
+			init();
+			setInterval( loop, 1000 / 60 );
+
+			function init() {
+
+				container = document.createElement( 'div' );
+				document.body.appendChild( container );
+
+				camera = new THREE.Camera( 70, window.innerWidth / window.innerHeight, 1, 3000 );
+				camera.position.z = 1200;
+
+				scene = new THREE.Scene();
+				scene.fog = new THREE.FogExp2( 0x000000, 0.0016 );
+				
+				renderer = new THREE.WebGLRenderer();
+				renderer.setSize( window.innerWidth, window.innerHeight );
+				container.appendChild( renderer.domElement );
+				
+				renderer.setClearColor( scene.fog.color, 1 );
+				
+				geometry = new THREE.Geometry();			
+				geometry2 = new THREE.Geometry();
+				
+				n = 1000;
+				n2 = 2 * n;
+				
+				for ( i = -n; i < n; i++ ) {
+
+					i2 = i + n;
+					
+					x = i * 1.175;
+					y = ( i2 % 2 ) * 5;
+					
+					if ( i2 % 2 )  {
+					
+						z = 10 * Math.sin( i2 * 0.3 ) * Math.cos( i2 * 0.1 );
+						
+					}
+					
+					vector = new THREE.Vector3( x, y, z );
+					geometry.vertices.push( new THREE.Vertex( vector ) );
+
+
+					vector = new THREE.Vector3( x, y, z );
+					geometry2.vertices.push( new THREE.Vertex( vector ) );
+
+					h = i2%2 ? 1 : 0.15;
+					if( i2%4 <= 2 ) h -= 0.15;
+
+					color = new THREE.Color( 0xffffff );
+					color.setHSV( 0.1 , 0, h );
+					geometry.colors.push( color );
+					geometry2.colors.push( color );
+
+				}
+				
+				var material_base = new THREE.MeshBasicMaterial( { color:0xffffff, vertex_colors:true } );
+				
+				renderer.initMaterial( material_base, scene.lights, scene.fog );
+				
+				xgrid = 34;
+				ygrid = 15;
+				nribbons = xgrid * ygrid;
+				
+				c = 0;
+				for ( i = 0; i < xgrid; i++ )
+				for ( j = 0; j < ygrid; j++ ) {
+					
+					materials[c] = new THREE.MeshBasicMaterial( { color:0xffffff, vertex_colors:true } );
+					materials[c].program = material_base.program;
+					materials[c].uniforms = Uniforms.clone( THREE.ShaderLib[ 'basic' ].uniforms );
+
+					ribbon = new THREE.Ribbon( i % 2 ? geometry : geometry2, materials[c] );
+					ribbon.rotation.x = 1.57;
+					ribbon.rotation.y = 1.57;
+					ribbon.rotation.z = -3.14;
+					
+					x = 40 * ( i - xgrid/2 );
+					y = 40 * ( j - ygrid/2 );
+					z = 0;
+					ribbon.position.set( x, y, z );
+					
+					materials[c].color.setHSV( i/xgrid, 0.3 +  0.7*j/ygrid, 1 );					
+					
+					ribbon.doubleSided = true;
+					ribbon.autoUpdateMatrix = false;
+					ribbon.updateMatrix();
+					
+					ribbons.push( ribbon );
+					scene.addObject( ribbon );
+					
+					c++;
+					
+				}
+
+				scene.autoUpdateMatrix = false;				
+
+				initPostprocessing();
+				renderer.autoClear = false;
+				
+				stats = new Stats();
+				stats.domElement.style.position = 'absolute';
+				stats.domElement.style.top = '0px';
+				container.appendChild( stats.domElement );
+
+				document.addEventListener( 'mousemove', onDocumentMouseMove, false );
+				document.addEventListener( 'touchstart', onDocumentTouchStart, false );
+				document.addEventListener( 'touchmove', onDocumentTouchMove, false );
+				
+			}
+
+			function onDocumentMouseMove( event ) {
+
+				mouseX = event.clientX - windowHalfX;
+				mouseY = event.clientY - windowHalfY;
+				
+			}
+
+			function onDocumentTouchStart( event ) {
+
+				if ( event.touches.length == 1 ) {
+
+					event.preventDefault();
+
+					mouseX = event.touches[ 0 ].pageX - windowHalfX;
+					mouseY = event.touches[ 0 ].pageY - windowHalfY;
+					
+				}
+			}
+
+			function onDocumentTouchMove( event ) {
+
+				if ( event.touches.length == 1 ) {
+
+					event.preventDefault();
+
+					mouseX = event.touches[ 0 ].pageX - windowHalfX;
+					mouseY = event.touches[ 0 ].pageY - windowHalfY;
+					
+				}
+				
+			}
+			
+			function initPostprocessing() {
+				
+				postprocessing.scene = new THREE.Scene();		
+				
+				postprocessing.camera = new THREE.Camera();
+				postprocessing.camera.projectionMatrix = THREE.Matrix4.makeOrtho( window.innerWidth / - 2, window.innerWidth / 2,  window.innerHeight / 2, window.innerHeight / - 2, -10000, 10000 );
+				postprocessing.camera.position.z = 100;
+				
+				var pars = { min_filter: THREE.LinearFilter, mag_filter: THREE.LinearFilter };
+                postprocessing.rtTexture1 = new THREE.RenderTarget( window.innerWidth, window.innerHeight, pars );
+                postprocessing.rtTexture2 = new THREE.RenderTarget( 512, 512, pars );
+                postprocessing.rtTexture3 = new THREE.RenderTarget( 512, 512, pars );
+
+				var screen_shader = ShaderUtils.lib["screen"];
+				var screen_uniforms = Uniforms.clone( screen_shader.uniforms );
+				
+				screen_uniforms["tDiffuse"].texture = postprocessing.rtTexture1;
+				screen_uniforms["opacity"].value = 1.0;
+				
+                postprocessing.materialScreen = new THREE.MeshShaderMaterial( {
+
+                    uniforms: screen_uniforms,
+                    vertex_shader: screen_shader.vertex_shader,
+                    fragment_shader: screen_shader.fragment_shader,
+					blending: THREE.AdditiveBlending
+
+                } );
+				
+				
+				var convolution_shader = ShaderUtils.lib["convolution"];
+				var convolution_uniforms = Uniforms.clone( convolution_shader.uniforms );
+
+				postprocessing.blurx = new THREE.Vector2( 0.001953125, 0.0 ),
+				postprocessing.blury = new THREE.Vector2( 0.0, 0.001953125 );
+
+				convolution_uniforms["tDiffuse"].texture = postprocessing.rtTexture1;
+				convolution_uniforms["uImageIncrement"].value = postprocessing.blurx;
+				convolution_uniforms["cKernel"].value = ShaderUtils.buildKernel( 4.0 );
+				
+                postprocessing.materialConvolution = new THREE.MeshShaderMaterial( {
+
+                    uniforms: convolution_uniforms,
+                    vertex_shader:   "#define KERNEL_SIZE 25.0\n" + convolution_shader.vertex_shader,
+                    fragment_shader: "#define KERNEL_SIZE 25\n"   + convolution_shader.fragment_shader
+
+                } );
+				
+				
+				postprocessing.quad = new THREE.Mesh( new Plane( window.innerWidth, window.innerHeight ), postprocessing.materialConvolution );
+				postprocessing.quad.position.z = -500;
+				postprocessing.scene.addObject( postprocessing.quad );
+
+			}			
+
+			function loop() {
+
+				var time = new Date().getTime() * 0.00005;
+				
+				camera.position.x += ( mouseX - camera.position.x ) * 0.036;
+				camera.position.y += ( - (mouseY) - camera.position.y ) * 0.036;
+				
+				for ( i = -n; i < n; i++ ) {
+
+					i2 = i + n;
+					
+					z  =  10 * Math.sin( i2 * 0.1 + time*30 );
+					z2 =  20 * Math.cos( Math.sin( i2 * 0.1 + time * 20 ) );
+					
+					geometry.vertices[i2].position.z = z;
+					geometry2.vertices[i2].position.z = z2;	
+					
+				}
+				
+				geometry.__dirtyVertices = true;
+				geometry2.__dirtyVertices = true;
+
+
+				for( i = 0; i < nribbons; i++ ) {
+					
+					h = ( 360 * ( i/nribbons + time ) % 360 ) / 360;
+					materials[i].color.setHSV( h, 0.5+0.5*(i%20/20), 1 );					
+					
+				}
+
+				//renderer.render( scene, camera );
+
+				if ( postprocessing.enabled ) {
+				
+					renderer.clear();
+					
+					// Render scene into texture
+					
+					renderer.render( scene, camera, postprocessing.rtTexture1 );
+
+					// Render quad with blured scene into texture (convolution pass 1)
+					
+					postprocessing.quad.materials = [ postprocessing.materialConvolution ];
+					
+					postprocessing.materialConvolution.uniforms.tDiffuse.texture = postprocessing.rtTexture1;
+					postprocessing.materialConvolution.uniforms.uImageIncrement.value = postprocessing.blurx;
+					
+					renderer.render( postprocessing.scene, postprocessing.camera, postprocessing.rtTexture2 );
+					
+					// Render quad with blured scene into texture (convolution pass 2)
+					
+					postprocessing.materialConvolution.uniforms.tDiffuse.texture = postprocessing.rtTexture2;
+					postprocessing.materialConvolution.uniforms.uImageIncrement.value = postprocessing.blury;
+					
+					renderer.render( postprocessing.scene, postprocessing.camera, postprocessing.rtTexture3 );
+					
+					// Render original scene with superimposed blur to texture
+					
+					postprocessing.quad.materials = [ postprocessing.materialScreen ];
+					
+					postprocessing.materialScreen.uniforms.tDiffuse.texture = postprocessing.rtTexture3;
+					postprocessing.materialScreen.uniforms.opacity.value = 1.2;
+					
+					renderer.render( postprocessing.scene, postprocessing.camera, postprocessing.rtTexture1, false );
+
+					// Render to screen
+
+					postprocessing.materialScreen.uniforms.tDiffuse.texture = postprocessing.rtTexture1;
+					renderer.render( postprocessing.scene, postprocessing.camera );					
+					
+				} else {
+					
+					renderer.clear();
+					renderer.render( scene, camera );
+					
+				}
+
+				stats.update();
+			}
+
+
+		</script>
+	</body>
+</html>

+ 1 - 0
examples/uqbiquity_test.html

@@ -39,6 +39,7 @@
 		<script type="text/javascript" src="../src/objects/Mesh.js"></script>
 		<script type="text/javascript" src="../src/objects/Mesh.js"></script>
 		<script type="text/javascript" src="../src/objects/Bone.js"></script>
 		<script type="text/javascript" src="../src/objects/Bone.js"></script>
 		<script type="text/javascript" src="../src/objects/SkinnedMesh.js"></script>
 		<script type="text/javascript" src="../src/objects/SkinnedMesh.js"></script>
+		<script type="text/javascript" src="../src/objects/Ribbon.js"></script>
 		<script type="text/javascript" src="../src/animation/AnimationHandler.js"></script>
 		<script type="text/javascript" src="../src/animation/AnimationHandler.js"></script>
 		<script type="text/javascript" src="../src/animation/Animation.js"></script>
 		<script type="text/javascript" src="../src/animation/Animation.js"></script>
 		<script type="text/javascript" src="../src/cameras/Camera.js"></script>
 		<script type="text/javascript" src="../src/cameras/Camera.js"></script>

+ 1 - 1
src/objects/Object3D.js

@@ -132,7 +132,7 @@ THREE.Object3D.prototype.addChild = function( child ) {
 		if( child.parent !== undefined )
 		if( child.parent !== undefined )
 			child.parent.removeChild( child );
 			child.parent.removeChild( child );
 		
 		
-		child.parent = this;		
+		child.parent = this;
 		this.children.push( child );
 		this.children.push( child );
 
 
 	}
 	}

+ 103 - 2
src/renderers/WebGLRenderer.js

@@ -205,6 +205,13 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 	};
 	};
 
 
+	function createRibbonBuffers ( geometry ) {
+
+		geometry.__webGLVertexBuffer = _gl.createBuffer();
+		geometry.__webGLColorBuffer = _gl.createBuffer();
+
+	};
+
 	function createMeshBuffers ( geometryChunk ) {
 	function createMeshBuffers ( geometryChunk ) {
 
 
 		geometryChunk.__webGLVertexBuffer = _gl.createBuffer();
 		geometryChunk.__webGLVertexBuffer = _gl.createBuffer();
@@ -235,6 +242,17 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 	};
 	};
 
 
+	function initRibbonBuffers ( geometry ) {
+
+		var nvertices = geometry.vertices.length;
+
+		geometry.__vertexArray = new Float32Array( nvertices * 3 );
+		geometry.__colorArray = new Float32Array( nvertices * 3 );
+
+		geometry.__webGLVertexCount = nvertices;
+
+	};
+	
 	function initParticleBuffers ( geometry ) {
 	function initParticleBuffers ( geometry ) {
 
 
 		var nvertices = geometry.vertices.length;
 		var nvertices = geometry.vertices.length;
@@ -1039,6 +1057,60 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 	};
 	};
 
 
+	function setRibbonBuffers ( geometry, hint ) {
+
+		var v, c, vertex, offset,
+			vertices = geometry.vertices,
+			colors = geometry.colors,
+			vl = vertices.length,
+			cl = colors.length,
+
+			vertexArray = geometry.__vertexArray,
+			colorArray = geometry.__colorArray,
+		
+			dirtyVertices = geometry.__dirtyVertices, 
+			dirtyColors = geometry.__dirtyColors;
+
+		if ( dirtyVertices ) {
+
+			for ( v = 0; v < vl; v++ ) {
+
+				vertex = vertices[ v ].position;
+
+				offset = v * 3;
+
+				vertexArray[ offset ]     = vertex.x;
+				vertexArray[ offset + 1 ] = vertex.y;
+				vertexArray[ offset + 2 ] = vertex.z;
+
+			}
+
+			_gl.bindBuffer( _gl.ARRAY_BUFFER, geometry.__webGLVertexBuffer );
+			_gl.bufferData( _gl.ARRAY_BUFFER, vertexArray, hint );
+
+		}
+
+		if ( dirtyColors ) {
+
+			for ( c = 0; c < cl; c++ ) {
+
+				color = colors[ c ];
+
+				offset = c * 3;
+
+				colorArray[ offset ]     = color.r;
+				colorArray[ offset + 1 ] = color.g;
+				colorArray[ offset + 2 ] = color.b;
+
+			}
+
+			_gl.bindBuffer( _gl.ARRAY_BUFFER, geometry.__webGLColorBuffer );
+			_gl.bufferData( _gl.ARRAY_BUFFER, colorArray, hint );
+
+		}
+
+	};
+	
 	function setParticleBuffers ( geometry, hint, object, camera ) {
 	function setParticleBuffers ( geometry, hint, object, camera ) {
 
 
 		var v, c, vertex, offset,
 		var v, c, vertex, offset,
@@ -1377,8 +1449,8 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 		} else if ( material instanceof THREE.MeshDepthMaterial ) {
 		} else if ( material instanceof THREE.MeshDepthMaterial ) {
 
 
-			m_uniforms.mNear.value = camera.near;
-			m_uniforms.mFar.value = camera.far;
+			m_uniforms.mNear.value = camera.zNear;
+			m_uniforms.mFar.value = camera.zFar;
 			m_uniforms.opacity.value = material.opacity;
 			m_uniforms.opacity.value = material.opacity;
 			
 			
 		} else if ( material instanceof THREE.MeshNormalMaterial ) {
 		} else if ( material instanceof THREE.MeshNormalMaterial ) {
@@ -1560,6 +1632,12 @@ THREE.WebGLRenderer = function ( parameters ) {
 			
 			
 			_gl.drawArrays( _gl.POINTS, 0, geometryChunk.__webGLParticleCount );
 			_gl.drawArrays( _gl.POINTS, 0, geometryChunk.__webGLParticleCount );
 			
 			
+		// render ribbon
+		
+		} else if ( object instanceof THREE.Ribbon ) {
+			
+			_gl.drawArrays( _gl.TRIANGLE_STRIP, 0, geometryChunk.__webGLVertexCount );
+			
 		}
 		}
 
 
 	};
 	};
@@ -2066,6 +2144,29 @@ THREE.WebGLRenderer = function ( parameters ) {
 			geometry.__dirtyTangents = false;
 			geometry.__dirtyTangents = false;
 			geometry.__dirtyColors = false;
 			geometry.__dirtyColors = false;
 
 
+		} else if ( object instanceof THREE.Ribbon ) {
+
+			if( ! geometry.__webGLVertexBuffer ) {
+
+				createRibbonBuffers( geometry );
+				initRibbonBuffers( geometry );
+
+				geometry.__dirtyVertices = true;
+				geometry.__dirtyColors = true;
+
+			}
+
+			if( geometry.__dirtyVertices || geometry.__dirtyColors ) {
+
+				setRibbonBuffers( geometry, _gl.DYNAMIC_DRAW );
+
+			}
+
+			add_buffer( objlist, objmap, 0, geometry, object );
+
+			geometry.__dirtyVertices = false;
+			geometry.__dirtyColors = false;
+			
 		} else if ( object instanceof THREE.Line ) {
 		} else if ( object instanceof THREE.Line ) {
 
 
 			if( ! geometry.__webGLVertexBuffer ) {
 			if( ! geometry.__webGLVertexBuffer ) {

+ 1 - 0
utils/build.py

@@ -34,6 +34,7 @@ COMMON_FILES = [
 'objects/Mesh.js',
 'objects/Mesh.js',
 'objects/Bone.js',
 'objects/Bone.js',
 'objects/SkinnedMesh.js',
 'objects/SkinnedMesh.js',
+'objects/Ribbon.js',
 'animation/AnimationHandler.js',
 'animation/AnimationHandler.js',
 'animation/Animation.js',
 'animation/Animation.js',
 'cameras/Camera.js',
 'cameras/Camera.js',