Browse Source

Synced with mrdoob's branch.

alteredq 14 years ago
parent
commit
d12252421e

+ 12 - 0
README.md

@@ -141,6 +141,18 @@ This code creates a camera, then creates a scene, adds a cube on it, creates a &
 
 ### Change Log ###
 
+2011 03 31 - **r38** (225.720 KB, gzip: 55.881 KB)
+
+* Added `LensFlare` light. ([empaempa](http://github.com/empaempa))
+* Added `ShadowVolume` object (stencil shadows). ([empaempa](http://github.com/empaempa))
+* Improved Blender Exporter plus added Scene support. ([alteredq](http://github.com/alteredq))
+* Blender Importer for loading JSON files. ([alteredq](http://github.com/alteredq))
+* Added load/complete callbacks to `Loader` ([mrdoob](http://github.com/mrdoob))
+* Minor WebGL blend mode clean up. ([mrdoob](http://github.com/mrdoob))
+* *Materials now extend Material ([mrdoob](http://github.com/mrdoob))
+* `material.transparent` define whether material is transparent or not (before we were guessing). ([mrdoob](http://github.com/mrdoob))
+
+
 2011 03 22 - **r37** (208.495 KB, gzip: 51.376 KB)
 
 * Changed JSON file format. (**Re-exporting of models required**) ([alteredq](http://github.com/alteredq) and [mrdoob](http://github.com/mrdoob))

+ 1 - 1
REVISION

@@ -1 +1 @@
-37
+38

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


+ 1 - 1
build/custom/ThreeCanvas.js

@@ -1,4 +1,4 @@
-// ThreeCanvas.js r37 - http://github.com/mrdoob/three.js
+// ThreeCanvas.js r38 - http://github.com/mrdoob/three.js
 var THREE=THREE||{};THREE.Color=function(a){this.setHex(a)};
 THREE.Color.prototype={autoUpdate:!0,copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;this.hex=a.hex;this.__styleString=a.__styleString},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,b,c){var e,d,f,g,i,h;if(c==0)e=d=f=0;else{g=Math.floor(a*6);i=a*6-g;a=c*(1-b);h=c*(1-b*i);b=c*(1-b*(1-i));switch(g){case 1:e=h;d=c;f=a;break;case 2:e=a;d=c;f=b;break;case 3:e=a;d=h;f=c;break;case 4:e=b;d=a;f=c;break;case 5:e=c;d=a;
 f=h;break;case 6:case 0:e=c;d=b;f=a}}this.r=e;this.g=d;this.b=f;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGB();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+","+~~(this.g*

+ 1 - 1
build/custom/ThreeDOM.js

@@ -1,4 +1,4 @@
-// ThreeDOM.js r37 - http://github.com/mrdoob/three.js
+// ThreeDOM.js r38 - http://github.com/mrdoob/three.js
 var THREE=THREE||{};THREE.Color=function(a){this.setHex(a)};
 THREE.Color.prototype={autoUpdate:!0,copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;this.hex=a.hex;this.__styleString=a.__styleString},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,b,c){var e,d,g,f,i,h;if(c==0)e=d=g=0;else{f=Math.floor(a*6);i=a*6-f;a=c*(1-b);h=c*(1-b*i);b=c*(1-b*(1-i));switch(f){case 1:e=h;d=c;g=a;break;case 2:e=a;d=c;g=b;break;case 3:e=a;d=h;g=c;break;case 4:e=b;d=a;g=c;break;case 5:e=c;d=a;
 g=h;break;case 6:case 0:e=c;d=b;g=a}}this.r=e;this.g=d;this.b=g;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGB();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+","+~~(this.g*

+ 1 - 1
build/custom/ThreeExtras.js

@@ -1,4 +1,4 @@
-// ThreeExtras.js r37 - http://github.com/mrdoob/three.js
+// ThreeExtras.js r38 - http://github.com/mrdoob/three.js
 var GeometryUtils={merge:function(a,e){var b=e instanceof THREE.Mesh,c=a.vertices.length,d=b?e.geometry:e,f=a.vertices,g=d.vertices,h=a.faces,l=d.faces,k=a.faceVertexUvs[0];d=d.faceVertexUvs[0];b&&e.matrixAutoUpdate&&e.updateMatrix();for(var j=0,m=g.length;j<m;j++){var p=new THREE.Vertex(g[j].position.clone());b&&e.matrix.multiplyVector3(p.position);f.push(p)}j=0;for(m=l.length;j<m;j++){g=l[j];var w,t,z=g.vertexNormals;p=g.vertexColors;if(g instanceof THREE.Face3)w=new THREE.Face3(g.a+c,g.b+c,g.c+
 c);else g instanceof THREE.Face4&&(w=new THREE.Face4(g.a+c,g.b+c,g.c+c,g.d+c));w.normal.copy(g.normal);b=0;for(f=z.length;b<f;b++){t=z[b];w.vertexNormals.push(t.clone())}w.color.copy(g.color);b=0;for(f=p.length;b<f;b++){t=p[b];w.vertexColors.push(t.clone())}w.materials=g.materials.slice();w.centroid.copy(g.centroid);h.push(w)}j=0;for(m=d.length;j<m;j++){c=d[j];h=[];b=0;for(f=c.length;b<f;b++)h.push(new THREE.UV(c[b].u,c[b].v));k.push(h)}}},ImageUtils={loadTexture:function(a,e,b){var c=new Image,d=
 new THREE.Texture(c,e);c.onload=function(){d.needsUpdate=!0;b&&b(this)};c.src=a;return d},loadTextureCube:function(a,e,b){var c,d=[],f=new THREE.Texture(d,e);e=d.loadCount=0;for(c=a.length;e<c;++e){d[e]=new Image;d[e].onload=function(){d.loadCount+=1;if(d.loadCount==6)f.needsUpdate=!0;b&&b(this)};d[e].src=a[e]}return f}},SceneUtils={loadScene:function(a,e,b,c){var d=new Worker(a);d.postMessage(0);var f=THREE.Loader.prototype.extractUrlbase(a);d.onmessage=function(g){function h(X,Y){return Y=="relativeToHTML"?

+ 1 - 1
build/custom/ThreeSVG.js

@@ -1,4 +1,4 @@
-// ThreeSVG.js r37 - http://github.com/mrdoob/three.js
+// ThreeSVG.js r38 - http://github.com/mrdoob/three.js
 var THREE=THREE||{};THREE.Color=function(a){this.setHex(a)};
 THREE.Color.prototype={autoUpdate:!0,copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;this.hex=a.hex;this.__styleString=a.__styleString},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,b,c){var e,d,f,g,i,h;if(c==0)e=d=f=0;else{g=Math.floor(a*6);i=a*6-g;a=c*(1-b);h=c*(1-b*i);b=c*(1-b*(1-i));switch(g){case 1:e=h;d=c;f=a;break;case 2:e=a;d=c;f=b;break;case 3:e=a;d=h;f=c;break;case 4:e=b;d=a;f=c;break;case 5:e=c;d=a;
 f=h;break;case 6:case 0:e=c;d=b;f=a}}this.r=e;this.g=d;this.b=f;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGB();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+","+~~(this.g*

+ 245 - 239
build/custom/ThreeWebGL.js

@@ -1,154 +1,154 @@
-// ThreeWebGL.js r37 - http://github.com/mrdoob/three.js
-var THREE=THREE||{};THREE.Color=function(a){this.setHex(a)};
-THREE.Color.prototype={autoUpdate:!0,copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;this.hex=a.hex;this.__styleString=a.__styleString},setRGB:function(a,c,d){this.r=a;this.g=c;this.b=d;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,c,d){var g,f,i,j,o,p;if(d==0)g=f=i=0;else{j=Math.floor(a*6);o=a*6-j;a=d*(1-c);p=d*(1-c*o);c=d*(1-c*(1-o));switch(j){case 1:g=p;f=d;i=a;break;case 2:g=a;f=d;i=c;break;case 3:g=a;f=p;i=d;break;case 4:g=c;f=a;i=d;break;case 5:g=d;f=a;
-i=p;break;case 6:case 0:g=d;f=c;i=a}}this.r=g;this.g=f;this.b=i;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGB();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+","+~~(this.g*
-255)+","+~~(this.b*255)+")"},clone:function(){return new THREE.Color(this.hex)}};THREE.Vector2=function(a,c){this.set(a||0,c||0)};
-THREE.Vector2.prototype={set:function(a,c){this.x=a;this.y=c;return this},copy:function(a){this.set(a.x,a.y);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y);return this},add:function(a,c){this.set(a.x+c.x,a.y+c.y);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y);return this},sub:function(a,c){this.set(a.x-c.x,a.y-c.y);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a);return this},negate:function(){this.set(-this.x,-this.y);return this},unit:function(){this.multiplyScalar(1/
-this.length());return this},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y},clone:function(){return new THREE.Vector2(this.x,this.y)}};THREE.Vector3=function(a,c,d){this.set(a||0,c||0,d||0)};
-THREE.Vector3.prototype={set:function(a,c,d){this.x=a;this.y=c;this.z=d;return this},copy:function(a){this.set(a.x,a.y,a.z);return this},add:function(a,c){this.set(a.x+c.x,a.y+c.y,a.z+c.z);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z);return this},addScalar:function(a){this.set(this.x+a,this.y+a,this.z+a);return this},sub:function(a,c){this.set(a.x-c.x,a.y-c.y,a.z-c.z);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z);return this},cross:function(a,
-c){this.set(a.y*c.z-a.z*c.y,a.z*c.x-a.x*c.z,a.x*c.y-a.y*c.x);return this},crossSelf:function(a){var c=this.x,d=this.y,g=this.z;this.set(d*a.z-g*a.y,g*a.x-c*a.z,c*a.y-d*a.x);return this},multiply:function(a,c){this.set(a.x*c.x,a.y*c.y,a.z*c.z);return this},multiplySelf:function(a){this.set(this.x*a.x,this.y*a.y,this.z*a.z);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a,this.z*a);return this},divideSelf:function(a){this.set(this.x/a.x,this.y/a.y,this.z/a.z);return this},divideScalar:function(a){this.set(this.x/
-a,this.y/a,this.z/a);return this},negate:function(){this.set(-this.x,-this.y,-this.z);return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var c=this.x-a.x,d=this.y-a.y;a=this.z-a.z;return c*c+d*d+a*a},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},lengthManhattan:function(){return this.x+this.y+this.z},normalize:function(){var a=
-this.length();a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setPositionFromMatrix:function(a){this.x=a.n14;this.y=a.n24;this.z=a.n34},setRotationFromMatrix:function(a){this.y=Math.asin(a.n13);var c=Math.cos(this.y);if(Math.abs(c)>1.0E-5){this.x=Math.atan2(-a.n23/c,a.n33/c);this.z=Math.atan2(-a.n13/c,a.n11/c)}else{this.x=0;this.z=Math.atan2(a.n21,a.n22)}},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)}};THREE.Vector4=function(a,c,d,g){this.set(a||0,c||0,d||0,g||1)};
-THREE.Vector4.prototype={set:function(a,c,d,g){this.x=a;this.y=c;this.z=d;this.w=g;return this},copy:function(a){this.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,c){this.set(a.x+c.x,a.y+c.y,a.z+c.z,a.w+c.w);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z,this.w+a.w);return this},sub:function(a,c){this.set(a.x-c.x,a.y-c.y,a.z-c.z,a.w-c.w);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z,this.w-a.w);return this},multiplyScalar:function(a){this.set(this.x*
-a,this.y*a,this.z*a,this.w*a);return this},divideScalar:function(a){this.set(this.x/a,this.y/a,this.z/a,this.w/a);return this},lerpSelf:function(a,c){this.set(this.x+(a.x-this.x)*c,this.y+(a.y-this.y)*c,this.z+(a.z-this.z)*c,this.w+(a.w-this.w)*c)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(a,c){this.origin=a||new THREE.Vector3;this.direction=c||new THREE.Vector3};
-THREE.Ray.prototype={intersectScene:function(a){var c,d,g=a.objects,f=[];a=0;for(c=g.length;a<c;a++){d=g[a];d instanceof THREE.Mesh&&(f=f.concat(this.intersectObject(d)))}f.sort(function(i,j){return i.distance-j.distance});return f},intersectObject:function(a){function c(T,O,pa,Y){Y=Y.clone().subSelf(O);pa=pa.clone().subSelf(O);var qa=T.clone().subSelf(O);T=Y.dot(Y);O=Y.dot(pa);Y=Y.dot(qa);var V=pa.dot(pa);pa=pa.dot(qa);qa=1/(T*V-O*O);V=(V*Y-O*pa)*qa;T=(T*pa-O*Y)*qa;return V>0&&T>0&&V+T<1}var d,g,
-f,i,j,o,p,v,x,y,D,z=a.geometry,K=z.vertices,M=[];d=0;for(g=z.faces.length;d<g;d++){f=z.faces[d];y=this.origin.clone();D=this.direction.clone();p=a.matrixWorld;i=p.multiplyVector3(K[f.a].position.clone());j=p.multiplyVector3(K[f.b].position.clone());o=p.multiplyVector3(K[f.c].position.clone());p=f instanceof THREE.Face4?p.multiplyVector3(K[f.d].position.clone()):null;v=a.matrixRotationWorld.multiplyVector3(f.normal.clone());x=D.dot(v);if(x<0){v=v.dot((new THREE.Vector3).sub(i,y))/x;y=y.addSelf(D.multiplyScalar(v));
-if(f instanceof THREE.Face3){if(c(y,i,j,o)){f={distance:this.origin.distanceTo(y),point:y,face:f,object:a};M.push(f)}}else if(f instanceof THREE.Face4&&(c(y,i,j,p)||c(y,j,o,p))){f={distance:this.origin.distanceTo(y),point:y,face:f,object:a};M.push(f)}}}return M}};
-THREE.Rectangle=function(){function a(){i=g-c;j=f-d}var c,d,g,f,i,j,o=!0;this.getX=function(){return c};this.getY=function(){return d};this.getWidth=function(){return i};this.getHeight=function(){return j};this.getLeft=function(){return c};this.getTop=function(){return d};this.getRight=function(){return g};this.getBottom=function(){return f};this.set=function(p,v,x,y){o=!1;c=p;d=v;g=x;f=y;a()};this.addPoint=function(p,v){if(o){o=!1;c=p;d=v;g=p;f=v}else{c=c<p?c:p;d=d<v?d:v;g=g>p?g:p;f=f>v?f:v}a()};
-this.add3Points=function(p,v,x,y,D,z){if(o){o=!1;c=p<x?p<D?p:D:x<D?x:D;d=v<y?v<z?v:z:y<z?y:z;g=p>x?p>D?p:D:x>D?x:D;f=v>y?v>z?v:z:y>z?y:z}else{c=p<x?p<D?p<c?p:c:D<c?D:c:x<D?x<c?x:c:D<c?D:c;d=v<y?v<z?v<d?v:d:z<d?z:d:y<z?y<d?y:d:z<d?z:d;g=p>x?p>D?p>g?p:g:D>g?D:g:x>D?x>g?x:g:D>g?D:g;f=v>y?v>z?v>f?v:f:z>f?z:f:y>z?y>f?y:f:z>f?z:f}a()};this.addRectangle=function(p){if(o){o=!1;c=p.getLeft();d=p.getTop();g=p.getRight();f=p.getBottom()}else{c=c<p.getLeft()?c:p.getLeft();d=d<p.getTop()?d:p.getTop();g=g>p.getRight()?
-g:p.getRight();f=f>p.getBottom()?f:p.getBottom()}a()};this.inflate=function(p){c-=p;d-=p;g+=p;f+=p;a()};this.minSelf=function(p){c=c>p.getLeft()?c:p.getLeft();d=d>p.getTop()?d:p.getTop();g=g<p.getRight()?g:p.getRight();f=f<p.getBottom()?f:p.getBottom();a()};this.instersects=function(p){return Math.min(g,p.getRight())-Math.max(c,p.getLeft())>=0&&Math.min(f,p.getBottom())-Math.max(d,p.getTop())>=0};this.empty=function(){o=!0;f=g=d=c=0;a()};this.isEmpty=function(){return o}};
-THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,c=this.m;a=c[1];c[1]=c[3];c[3]=a;a=c[2];c[2]=c[6];c[6]=a;a=c[5];c[5]=c[7];c[7]=a;return this},transposeIntoArray:function(a){var c=this.m;a[0]=c[0];a[1]=c[3];a[2]=c[6];a[3]=c[1];a[4]=c[4];a[5]=c[7];a[6]=c[2];a[7]=c[5];a[8]=c[8];return this}};
-THREE.Matrix4=function(a,c,d,g,f,i,j,o,p,v,x,y,D,z,K,M){this.set(a||1,c||0,d||0,g||0,f||0,i||1,j||0,o||0,p||0,v||0,x||1,y||0,D||0,z||0,K||0,M||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={set:function(a,c,d,g,f,i,j,o,p,v,x,y,D,z,K,M){this.n11=a;this.n12=c;this.n13=d;this.n14=g;this.n21=f;this.n22=i;this.n23=j;this.n24=o;this.n31=p;this.n32=v;this.n33=x;this.n34=y;this.n41=D;this.n42=z;this.n43=K;this.n44=M;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,c,d){var g=THREE.Matrix4.__v1,
-f=THREE.Matrix4.__v2,i=THREE.Matrix4.__v3;i.sub(a,c).normalize();if(i.length()===0)i.z=1;g.cross(d,i).normalize();if(g.length()===0){i.x+=1.0E-4;g.cross(d,i).normalize()}f.cross(i,g).normalize();this.n11=g.x;this.n12=f.x;this.n13=i.x;this.n21=g.y;this.n22=f.y;this.n23=i.y;this.n31=g.z;this.n32=f.z;this.n33=i.z;return this},multiplyVector3:function(a){var c=a.x,d=a.y,g=a.z,f=1/(this.n41*c+this.n42*d+this.n43*g+this.n44);a.x=(this.n11*c+this.n12*d+this.n13*g+this.n14)*f;a.y=(this.n21*c+this.n22*d+this.n23*
-g+this.n24)*f;a.z=(this.n31*c+this.n32*d+this.n33*g+this.n34)*f;return a},multiplyVector4:function(a){var c=a.x,d=a.y,g=a.z,f=a.w;a.x=this.n11*c+this.n12*d+this.n13*g+this.n14*f;a.y=this.n21*c+this.n22*d+this.n23*g+this.n24*f;a.z=this.n31*c+this.n32*d+this.n33*g+this.n34*f;a.w=this.n41*c+this.n42*d+this.n43*g+this.n44*f;return a},rotateAxis:function(a){var c=a.x,d=a.y,g=a.z;a.x=c*this.n11+d*this.n12+g*this.n13;a.y=c*this.n21+d*this.n22+g*this.n23;a.z=c*this.n31+d*this.n32+g*this.n33;a.normalize();
-return a},crossVector:function(a){var c=new THREE.Vector4;c.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;c.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;c.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;c.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return c},multiply:function(a,c){var d=a.n11,g=a.n12,f=a.n13,i=a.n14,j=a.n21,o=a.n22,p=a.n23,v=a.n24,x=a.n31,y=a.n32,D=a.n33,z=a.n34,K=a.n41,M=a.n42,T=a.n43,O=a.n44,pa=c.n11,Y=c.n12,qa=c.n13,V=c.n14,E=c.n21,Fa=c.n22,
-ka=c.n23,Da=c.n24,$=c.n31,b=c.n32,Q=c.n33,la=c.n34;this.n11=d*pa+g*E+f*$;this.n12=d*Y+g*Fa+f*b;this.n13=d*qa+g*ka+f*Q;this.n14=d*V+g*Da+f*la+i;this.n21=j*pa+o*E+p*$;this.n22=j*Y+o*Fa+p*b;this.n23=j*qa+o*ka+p*Q;this.n24=j*V+o*Da+p*la+v;this.n31=x*pa+y*E+D*$;this.n32=x*Y+y*Fa+D*b;this.n33=x*qa+y*ka+D*Q;this.n34=x*V+y*Da+D*la+z;this.n41=K*pa+M*E+T*$;this.n42=K*Y+M*Fa+T*b;this.n43=K*qa+M*ka+T*Q;this.n44=K*V+M*Da+T*la+O;return this},multiplyToArray:function(a,c,d){this.multiply(a,c);d[0]=this.n11;d[1]=
-this.n21;d[2]=this.n31;d[3]=this.n41;d[4]=this.n12;d[5]=this.n22;d[6]=this.n32;d[7]=this.n42;d[8]=this.n13;d[9]=this.n23;d[10]=this.n33;d[11]=this.n43;d[12]=this.n14;d[13]=this.n24;d[14]=this.n34;d[15]=this.n44;return this},multiplySelf:function(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=
-a;return this},determinant:function(){var a=this.n11,c=this.n12,d=this.n13,g=this.n14,f=this.n21,i=this.n22,j=this.n23,o=this.n24,p=this.n31,v=this.n32,x=this.n33,y=this.n34,D=this.n41,z=this.n42,K=this.n43,M=this.n44;return g*j*v*D-d*o*v*D-g*i*x*D+c*o*x*D+d*i*y*D-c*j*y*D-g*j*p*z+d*o*p*z+g*f*x*z-a*o*x*z-d*f*y*z+a*j*y*z+g*i*p*K-c*o*p*K-g*f*v*K+a*o*v*K+c*f*y*K-a*i*y*K-d*i*p*M+c*j*p*M+d*f*v*M-a*j*v*M-c*f*x*M+a*i*x*M},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=
-this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=
-this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;
-a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,c){a[c]=this.n11;a[c+1]=this.n21;a[c+2]=this.n31;a[c+3]=this.n41;a[c+4]=this.n12;a[c+5]=this.n22;a[c+6]=this.n32;a[c+7]=this.n42;a[c+8]=this.n13;a[c+9]=this.n23;a[c+10]=this.n33;a[c+11]=this.n43;a[c+12]=this.n14;a[c+13]=this.n24;a[c+14]=this.n34;a[c+15]=this.n44;return a},setTranslation:function(a,c,d){this.set(1,0,0,a,0,1,0,c,0,0,1,d,0,0,
-0,1);return this},setScale:function(a,c,d){this.set(a,0,0,0,0,c,0,0,0,0,d,0,0,0,0,1);return this},setRotationX:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,c,-a,0,0,a,c,0,0,0,0,1);return this},setRotationY:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,0,a,0,0,1,0,0,-a,0,c,0,0,0,0,1);return this},setRotationZ:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,-a,0,0,a,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,c){var d=Math.cos(c),g=Math.sin(c),f=
-1-d,i=a.x,j=a.y,o=a.z,p=f*i,v=f*j;this.set(p*i+d,p*j-g*o,p*o+g*j,0,p*j+g*o,v*j+d,v*o-g*i,0,p*o-g*j,v*o+g*i,f*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 c=a.x,d=a.y,g=a.z;a=Math.cos(c);c=Math.sin(c);var f=Math.cos(d);d=Math.sin(d);var i=Math.cos(g);g=Math.sin(g);var j=a*d,o=c*d;this.n11=f*i;this.n12=-f*g;this.n13=d;this.n21=o*i+a*g;this.n22=-o*g+a*i;this.n23=-c*f;this.n31=-j*i+c*g;this.n32=j*g+c*i;this.n33=
-a*f;return this},setRotationFromQuaternion:function(a){var c=a.x,d=a.y,g=a.z,f=a.w,i=c+c,j=d+d,o=g+g;a=c*i;var p=c*j;c*=o;var v=d*j;d*=o;g*=o;i*=f;j*=f;f*=o;this.n11=1-(v+g);this.n12=p-f;this.n13=c+j;this.n21=p+f;this.n22=1-(a+g);this.n23=d-i;this.n31=c-j;this.n32=d+i;this.n33=1-(a+v);return this},scale:function(a){var c=a.x,d=a.y;a=a.z;this.n11*=c;this.n12*=d;this.n13*=a;this.n21*=c;this.n22*=d;this.n23*=a;this.n31*=c;this.n32*=d;this.n33*=a;this.n41*=c;this.n42*=d;this.n43*=a;return this},extractPosition:function(a){this.n14=
-a.n14;this.n24=a.n24;this.n34=a.n34},extractRotation:function(a,c){var d=1/c.x,g=1/c.y,f=1/c.z;this.n11=a.n11*d;this.n21=a.n21*d;this.n31=a.n31*d;this.n12=a.n12*g;this.n22=a.n22*g;this.n32=a.n32*g;this.n13=a.n13*f;this.n23=a.n23*f;this.n33=a.n33*f}};
-THREE.Matrix4.makeInvert=function(a,c){var d=a.n11,g=a.n12,f=a.n13,i=a.n14,j=a.n21,o=a.n22,p=a.n23,v=a.n24,x=a.n31,y=a.n32,D=a.n33,z=a.n34,K=a.n41,M=a.n42,T=a.n43,O=a.n44;c===undefined&&(c=new THREE.Matrix4);c.n11=p*z*M-v*D*M+v*y*T-o*z*T-p*y*O+o*D*O;c.n12=i*D*M-f*z*M-i*y*T+g*z*T+f*y*O-g*D*O;c.n13=f*v*M-i*p*M+i*o*T-g*v*T-f*o*O+g*p*O;c.n14=i*p*y-f*v*y-i*o*D+g*v*D+f*o*z-g*p*z;c.n21=v*D*K-p*z*K-v*x*T+j*z*T+p*x*O-j*D*O;c.n22=f*z*K-i*D*K+i*x*T-d*z*T-f*x*O+d*D*O;c.n23=i*p*K-f*v*K-i*j*T+d*v*T+f*j*O-d*p*O;
-c.n24=f*v*x-i*p*x+i*j*D-d*v*D-f*j*z+d*p*z;c.n31=o*z*K-v*y*K+v*x*M-j*z*M-o*x*O+j*y*O;c.n32=i*y*K-g*z*K-i*x*M+d*z*M+g*x*O-d*y*O;c.n33=f*v*K-i*o*K+i*j*M-d*v*M-g*j*O+d*o*O;c.n34=i*o*x-g*v*x-i*j*y+d*v*y+g*j*z-d*o*z;c.n41=p*y*K-o*D*K-p*x*M+j*D*M+o*x*T-j*y*T;c.n42=g*D*K-f*y*K+f*x*M-d*D*M-g*x*T+d*y*T;c.n43=f*o*K-g*p*K-f*j*M+d*p*M+g*j*T-d*o*T;c.n44=g*p*x-f*o*x+f*j*y-d*p*y-g*j*D+d*o*D;c.multiplyScalar(1/a.determinant());return c};
-THREE.Matrix4.makeInvert3x3=function(a){var c=a.m33,d=c.m,g=a.n33*a.n22-a.n32*a.n23,f=-a.n33*a.n21+a.n31*a.n23,i=a.n32*a.n21-a.n31*a.n22,j=-a.n33*a.n12+a.n32*a.n13,o=a.n33*a.n11-a.n31*a.n13,p=-a.n32*a.n11+a.n31*a.n12,v=a.n23*a.n12-a.n22*a.n13,x=-a.n23*a.n11+a.n21*a.n13,y=a.n22*a.n11-a.n21*a.n12;a=a.n11*g+a.n21*j+a.n31*v;if(a==0)throw"matrix not invertible";a=1/a;d[0]=a*g;d[1]=a*f;d[2]=a*i;d[3]=a*j;d[4]=a*o;d[5]=a*p;d[6]=a*v;d[7]=a*x;d[8]=a*y;return c};
-THREE.Matrix4.makeFrustum=function(a,c,d,g,f,i){var j;j=new THREE.Matrix4;j.n11=2*f/(c-a);j.n12=0;j.n13=(c+a)/(c-a);j.n14=0;j.n21=0;j.n22=2*f/(g-d);j.n23=(g+d)/(g-d);j.n24=0;j.n31=0;j.n32=0;j.n33=-(i+f)/(i-f);j.n34=-2*i*f/(i-f);j.n41=0;j.n42=0;j.n43=-1;j.n44=0;return j};THREE.Matrix4.makePerspective=function(a,c,d,g){var f;a=d*Math.tan(a*Math.PI/360);f=-a;return THREE.Matrix4.makeFrustum(f*c,a*c,f,a,d,g)};
-THREE.Matrix4.makeOrtho=function(a,c,d,g,f,i){var j,o,p,v;j=new THREE.Matrix4;o=c-a;p=d-g;v=i-f;j.n11=2/o;j.n12=0;j.n13=0;j.n14=-((c+a)/o);j.n21=0;j.n22=2/p;j.n23=0;j.n24=-((d+g)/p);j.n31=0;j.n32=0;j.n33=-2/v;j.n34=-((i+f)/v);j.n41=0;j.n42=0;j.n43=0;j.n44=1;return j};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
+// ThreeWebGL.js r38 - http://github.com/mrdoob/three.js
+var THREE=THREE||{};THREE.Color=function(b){this.setHex(b)};
+THREE.Color.prototype={autoUpdate:!0,copy:function(b){this.r=b.r;this.g=b.g;this.b=b.b;this.hex=b.hex;this.__styleString=b.__styleString},setRGB:function(b,d,e){this.r=b;this.g=d;this.b=e;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(b,d,e){var h,g,j,k,p,q;if(e==0)h=g=j=0;else{k=Math.floor(b*6);p=b*6-k;b=e*(1-d);q=e*(1-d*p);d=e*(1-d*(1-p));switch(k){case 1:h=q;g=e;j=b;break;case 2:h=b;g=e;j=d;break;case 3:h=b;g=q;j=e;break;case 4:h=d;g=b;j=e;break;case 5:h=e;g=b;
+j=q;break;case 6:case 0:h=e;g=d;j=b}}this.r=h;this.g=g;this.b=j;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHex:function(b){this.hex=~~b&16777215;if(this.autoUpdate){this.updateRGB();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+","+~~(this.g*
+255)+","+~~(this.b*255)+")"},clone:function(){return new THREE.Color(this.hex)}};THREE.Vector2=function(b,d){this.set(b||0,d||0)};
+THREE.Vector2.prototype={set:function(b,d){this.x=b;this.y=d;return this},copy:function(b){this.set(b.x,b.y);return this},addSelf:function(b){this.set(this.x+b.x,this.y+b.y);return this},add:function(b,d){this.set(b.x+d.x,b.y+d.y);return this},subSelf:function(b){this.set(this.x-b.x,this.y-b.y);return this},sub:function(b,d){this.set(b.x-d.x,b.y-d.y);return this},multiplyScalar:function(b){this.set(this.x*b,this.y*b);return this},negate:function(){this.set(-this.x,-this.y);return this},unit:function(){this.multiplyScalar(1/
+this.length());return this},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y},clone:function(){return new THREE.Vector2(this.x,this.y)}};THREE.Vector3=function(b,d,e){this.set(b||0,d||0,e||0)};
+THREE.Vector3.prototype={set:function(b,d,e){this.x=b;this.y=d;this.z=e;return this},copy:function(b){this.set(b.x,b.y,b.z);return this},add:function(b,d){this.set(b.x+d.x,b.y+d.y,b.z+d.z);return this},addSelf:function(b){this.set(this.x+b.x,this.y+b.y,this.z+b.z);return this},addScalar:function(b){this.set(this.x+b,this.y+b,this.z+b);return this},sub:function(b,d){this.set(b.x-d.x,b.y-d.y,b.z-d.z);return this},subSelf:function(b){this.set(this.x-b.x,this.y-b.y,this.z-b.z);return this},cross:function(b,
+d){this.set(b.y*d.z-b.z*d.y,b.z*d.x-b.x*d.z,b.x*d.y-b.y*d.x);return this},crossSelf:function(b){var d=this.x,e=this.y,h=this.z;this.set(e*b.z-h*b.y,h*b.x-d*b.z,d*b.y-e*b.x);return this},multiply:function(b,d){this.set(b.x*d.x,b.y*d.y,b.z*d.z);return this},multiplySelf:function(b){this.set(this.x*b.x,this.y*b.y,this.z*b.z);return this},multiplyScalar:function(b){this.set(this.x*b,this.y*b,this.z*b);return this},divideSelf:function(b){this.set(this.x/b.x,this.y/b.y,this.z/b.z);return this},divideScalar:function(b){this.set(this.x/
+b,this.y/b,this.z/b);return this},negate:function(){this.set(-this.x,-this.y,-this.z);return this},dot:function(b){return this.x*b.x+this.y*b.y+this.z*b.z},distanceTo:function(b){return Math.sqrt(this.distanceToSquared(b))},distanceToSquared:function(b){var d=this.x-b.x,e=this.y-b.y;b=this.z-b.z;return d*d+e*e+b*b},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},lengthManhattan:function(){return this.x+this.y+this.z},normalize:function(){var b=
+this.length();b>0?this.multiplyScalar(1/b):this.set(0,0,0);return this},setPositionFromMatrix:function(b){this.x=b.n14;this.y=b.n24;this.z=b.n34},setRotationFromMatrix:function(b){this.y=Math.asin(b.n13);var d=Math.cos(this.y);if(Math.abs(d)>1.0E-5){this.x=Math.atan2(-b.n23/d,b.n33/d);this.z=Math.atan2(-b.n13/d,b.n11/d)}else{this.x=0;this.z=Math.atan2(b.n21,b.n22)}},setLength:function(b){return this.normalize().multiplyScalar(b)},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)}};THREE.Vector4=function(b,d,e,h){this.set(b||0,d||0,e||0,h||1)};
+THREE.Vector4.prototype={set:function(b,d,e,h){this.x=b;this.y=d;this.z=e;this.w=h;return this},copy:function(b){this.set(b.x,b.y,b.z,b.w||1);return this},add:function(b,d){this.set(b.x+d.x,b.y+d.y,b.z+d.z,b.w+d.w);return this},addSelf:function(b){this.set(this.x+b.x,this.y+b.y,this.z+b.z,this.w+b.w);return this},sub:function(b,d){this.set(b.x-d.x,b.y-d.y,b.z-d.z,b.w-d.w);return this},subSelf:function(b){this.set(this.x-b.x,this.y-b.y,this.z-b.z,this.w-b.w);return this},multiplyScalar:function(b){this.set(this.x*
+b,this.y*b,this.z*b,this.w*b);return this},divideScalar:function(b){this.set(this.x/b,this.y/b,this.z/b,this.w/b);return this},lerpSelf:function(b,d){this.set(this.x+(b.x-this.x)*d,this.y+(b.y-this.y)*d,this.z+(b.z-this.z)*d,this.w+(b.w-this.w)*d)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(b,d){this.origin=b||new THREE.Vector3;this.direction=d||new THREE.Vector3};
+THREE.Ray.prototype={intersectScene:function(b){var d,e,h=b.objects,g=[];b=0;for(d=h.length;b<d;b++){e=h[b];e instanceof THREE.Mesh&&(g=g.concat(this.intersectObject(e)))}g.sort(function(j,k){return j.distance-k.distance});return g},intersectObject:function(b){function d(W,P,ra,aa){aa=aa.clone().subSelf(P);ra=ra.clone().subSelf(P);var sa=W.clone().subSelf(P);W=aa.dot(aa);P=aa.dot(ra);aa=aa.dot(sa);var Z=ra.dot(ra);ra=ra.dot(sa);sa=1/(W*Z-P*P);Z=(Z*aa-P*ra)*sa;W=(W*ra-P*aa)*sa;return Z>0&&W>0&&Z+W<
+1}var e,h,g,j,k,p,q,v,C,F,J,G=b.geometry,N=G.vertices,O=[];e=0;for(h=G.faces.length;e<h;e++){g=G.faces[e];F=this.origin.clone();J=this.direction.clone();q=b.matrixWorld;j=q.multiplyVector3(N[g.a].position.clone());k=q.multiplyVector3(N[g.b].position.clone());p=q.multiplyVector3(N[g.c].position.clone());q=g instanceof THREE.Face4?q.multiplyVector3(N[g.d].position.clone()):null;v=b.matrixRotationWorld.multiplyVector3(g.normal.clone());C=J.dot(v);if(C<0){v=v.dot((new THREE.Vector3).sub(j,F))/C;F=F.addSelf(J.multiplyScalar(v));
+if(g instanceof THREE.Face3){if(d(F,j,k,p)){g={distance:this.origin.distanceTo(F),point:F,face:g,object:b};O.push(g)}}else if(g instanceof THREE.Face4&&(d(F,j,k,q)||d(F,k,p,q))){g={distance:this.origin.distanceTo(F),point:F,face:g,object:b};O.push(g)}}}return O}};
+THREE.Rectangle=function(){function b(){j=h-d;k=g-e}var d,e,h,g,j,k,p=!0;this.getX=function(){return d};this.getY=function(){return e};this.getWidth=function(){return j};this.getHeight=function(){return k};this.getLeft=function(){return d};this.getTop=function(){return e};this.getRight=function(){return h};this.getBottom=function(){return g};this.set=function(q,v,C,F){p=!1;d=q;e=v;h=C;g=F;b()};this.addPoint=function(q,v){if(p){p=!1;d=q;e=v;h=q;g=v}else{d=d<q?d:q;e=e<v?e:v;h=h>q?h:q;g=g>v?g:v}b()};
+this.add3Points=function(q,v,C,F,J,G){if(p){p=!1;d=q<C?q<J?q:J:C<J?C:J;e=v<F?v<G?v:G:F<G?F:G;h=q>C?q>J?q:J:C>J?C:J;g=v>F?v>G?v:G:F>G?F:G}else{d=q<C?q<J?q<d?q:d:J<d?J:d:C<J?C<d?C:d:J<d?J:d;e=v<F?v<G?v<e?v:e:G<e?G:e:F<G?F<e?F:e:G<e?G:e;h=q>C?q>J?q>h?q:h:J>h?J:h:C>J?C>h?C:h:J>h?J:h;g=v>F?v>G?v>g?v:g:G>g?G:g:F>G?F>g?F:g:G>g?G:g}b()};this.addRectangle=function(q){if(p){p=!1;d=q.getLeft();e=q.getTop();h=q.getRight();g=q.getBottom()}else{d=d<q.getLeft()?d:q.getLeft();e=e<q.getTop()?e:q.getTop();h=h>q.getRight()?
+h:q.getRight();g=g>q.getBottom()?g:q.getBottom()}b()};this.inflate=function(q){d-=q;e-=q;h+=q;g+=q;b()};this.minSelf=function(q){d=d>q.getLeft()?d:q.getLeft();e=e>q.getTop()?e:q.getTop();h=h<q.getRight()?h:q.getRight();g=g<q.getBottom()?g:q.getBottom();b()};this.instersects=function(q){return Math.min(h,q.getRight())-Math.max(d,q.getLeft())>=0&&Math.min(g,q.getBottom())-Math.max(e,q.getTop())>=0};this.empty=function(){p=!0;g=h=e=d=0;b()};this.isEmpty=function(){return p}};
+THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var b,d=this.m;b=d[1];d[1]=d[3];d[3]=b;b=d[2];d[2]=d[6];d[6]=b;b=d[5];d[5]=d[7];d[7]=b;return this},transposeIntoArray:function(b){var d=this.m;b[0]=d[0];b[1]=d[3];b[2]=d[6];b[3]=d[1];b[4]=d[4];b[5]=d[7];b[6]=d[2];b[7]=d[5];b[8]=d[8];return this}};
+THREE.Matrix4=function(b,d,e,h,g,j,k,p,q,v,C,F,J,G,N,O){this.set(b||1,d||0,e||0,h||0,g||0,j||1,k||0,p||0,q||0,v||0,C||1,F||0,J||0,G||0,N||0,O||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={set:function(b,d,e,h,g,j,k,p,q,v,C,F,J,G,N,O){this.n11=b;this.n12=d;this.n13=e;this.n14=h;this.n21=g;this.n22=j;this.n23=k;this.n24=p;this.n31=q;this.n32=v;this.n33=C;this.n34=F;this.n41=J;this.n42=G;this.n43=N;this.n44=O;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,d,e){var h=THREE.Matrix4.__v1,
+g=THREE.Matrix4.__v2,j=THREE.Matrix4.__v3;j.sub(b,d).normalize();if(j.length()===0)j.z=1;h.cross(e,j).normalize();if(h.length()===0){j.x+=1.0E-4;h.cross(e,j).normalize()}g.cross(j,h).normalize();this.n11=h.x;this.n12=g.x;this.n13=j.x;this.n21=h.y;this.n22=g.y;this.n23=j.y;this.n31=h.z;this.n32=g.z;this.n33=j.z;return this},multiplyVector3:function(b){var d=b.x,e=b.y,h=b.z,g=1/(this.n41*d+this.n42*e+this.n43*h+this.n44);b.x=(this.n11*d+this.n12*e+this.n13*h+this.n14)*g;b.y=(this.n21*d+this.n22*e+this.n23*
+h+this.n24)*g;b.z=(this.n31*d+this.n32*e+this.n33*h+this.n34)*g;return b},multiplyVector4:function(b){var d=b.x,e=b.y,h=b.z,g=b.w;b.x=this.n11*d+this.n12*e+this.n13*h+this.n14*g;b.y=this.n21*d+this.n22*e+this.n23*h+this.n24*g;b.z=this.n31*d+this.n32*e+this.n33*h+this.n34*g;b.w=this.n41*d+this.n42*e+this.n43*h+this.n44*g;return b},rotateAxis:function(b){var d=b.x,e=b.y,h=b.z;b.x=d*this.n11+e*this.n12+h*this.n13;b.y=d*this.n21+e*this.n22+h*this.n23;b.z=d*this.n31+e*this.n32+h*this.n33;b.normalize();
+return b},crossVector:function(b){var d=new THREE.Vector4;d.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;d.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;d.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;d.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return d},multiply:function(b,d){var e=b.n11,h=b.n12,g=b.n13,j=b.n14,k=b.n21,p=b.n22,q=b.n23,v=b.n24,C=b.n31,F=b.n32,J=b.n33,G=b.n34,N=b.n41,O=b.n42,W=b.n43,P=b.n44,ra=d.n11,aa=d.n12,sa=d.n13,Z=d.n14,K=d.n21,Ia=d.n22,
+la=d.n23,Ga=d.n24,da=d.n31,c=d.n32,S=d.n33,ma=d.n34;this.n11=e*ra+h*K+g*da;this.n12=e*aa+h*Ia+g*c;this.n13=e*sa+h*la+g*S;this.n14=e*Z+h*Ga+g*ma+j;this.n21=k*ra+p*K+q*da;this.n22=k*aa+p*Ia+q*c;this.n23=k*sa+p*la+q*S;this.n24=k*Z+p*Ga+q*ma+v;this.n31=C*ra+F*K+J*da;this.n32=C*aa+F*Ia+J*c;this.n33=C*sa+F*la+J*S;this.n34=C*Z+F*Ga+J*ma+G;this.n41=N*ra+O*K+W*da;this.n42=N*aa+O*Ia+W*c;this.n43=N*sa+O*la+W*S;this.n44=N*Z+O*Ga+W*ma+P;return this},multiplyToArray:function(b,d,e){this.multiply(b,d);e[0]=this.n11;
+e[1]=this.n21;e[2]=this.n31;e[3]=this.n41;e[4]=this.n12;e[5]=this.n22;e[6]=this.n32;e[7]=this.n42;e[8]=this.n13;e[9]=this.n23;e[10]=this.n33;e[11]=this.n43;e[12]=this.n14;e[13]=this.n24;e[14]=this.n34;e[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=b;this.n23*=b;this.n24*=b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=
+b;return this},determinant:function(){var b=this.n11,d=this.n12,e=this.n13,h=this.n14,g=this.n21,j=this.n22,k=this.n23,p=this.n24,q=this.n31,v=this.n32,C=this.n33,F=this.n34,J=this.n41,G=this.n42,N=this.n43,O=this.n44;return h*k*v*J-e*p*v*J-h*j*C*J+d*p*C*J+e*j*F*J-d*k*F*J-h*k*q*G+e*p*q*G+h*g*C*G-b*p*C*G-e*g*F*G+b*k*F*G+h*j*q*N-d*p*q*N-h*g*v*N+b*p*v*N+d*g*F*N-b*j*F*N-e*j*q*O+d*k*q*O+e*g*v*O-b*k*v*O-d*g*C*O+b*j*C*O},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=
+this.n13;this.n13=b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32;b.n33=this.n33;b.n34=this.n34;b.n41=this.n41;b.n42=this.n42;b.n43=this.n43;b.n44=this.n44;return b},flatten:function(){this.flat[0]=
+this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(b){b[0]=this.n11;b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;
+b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return b},flattenToArrayOffset:function(b,d){b[d]=this.n11;b[d+1]=this.n21;b[d+2]=this.n31;b[d+3]=this.n41;b[d+4]=this.n12;b[d+5]=this.n22;b[d+6]=this.n32;b[d+7]=this.n42;b[d+8]=this.n13;b[d+9]=this.n23;b[d+10]=this.n33;b[d+11]=this.n43;b[d+12]=this.n14;b[d+13]=this.n24;b[d+14]=this.n34;b[d+15]=this.n44;return b},setTranslation:function(b,d,e){this.set(1,0,0,b,0,1,0,d,0,0,1,e,0,0,
+0,1);return this},setScale:function(b,d,e){this.set(b,0,0,0,0,d,0,0,0,0,e,0,0,0,0,1);return this},setRotationX:function(b){var d=Math.cos(b);b=Math.sin(b);this.set(1,0,0,0,0,d,-b,0,0,b,d,0,0,0,0,1);return this},setRotationY:function(b){var d=Math.cos(b);b=Math.sin(b);this.set(d,0,b,0,0,1,0,0,-b,0,d,0,0,0,0,1);return this},setRotationZ:function(b){var d=Math.cos(b);b=Math.sin(b);this.set(d,-b,0,0,b,d,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,d){var e=Math.cos(d),h=Math.sin(d),g=
+1-e,j=b.x,k=b.y,p=b.z,q=g*j,v=g*k;this.set(q*j+e,q*k-h*p,q*p+h*k,0,q*k+h*p,v*k+e,v*p-h*j,0,q*p-h*k,v*p+h*j,g*p*p+e,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},setRotationFromEuler:function(b){var d=b.x,e=b.y,h=b.z;b=Math.cos(d);d=Math.sin(d);var g=Math.cos(e);e=Math.sin(e);var j=Math.cos(h);h=Math.sin(h);var k=b*e,p=d*e;this.n11=g*j;this.n12=-g*h;this.n13=e;this.n21=p*j+b*h;this.n22=-p*h+b*j;this.n23=-d*g;this.n31=-k*j+d*h;this.n32=k*h+d*j;this.n33=
+b*g;return this},setRotationFromQuaternion:function(b){var d=b.x,e=b.y,h=b.z,g=b.w,j=d+d,k=e+e,p=h+h;b=d*j;var q=d*k;d*=p;var v=e*k;e*=p;h*=p;j*=g;k*=g;g*=p;this.n11=1-(v+h);this.n12=q-g;this.n13=d+k;this.n21=q+g;this.n22=1-(b+h);this.n23=e-j;this.n31=d-k;this.n32=e+j;this.n33=1-(b+v);return this},scale:function(b){var d=b.x,e=b.y;b=b.z;this.n11*=d;this.n12*=e;this.n13*=b;this.n21*=d;this.n22*=e;this.n23*=b;this.n31*=d;this.n32*=e;this.n33*=b;this.n41*=d;this.n42*=e;this.n43*=b;return this},extractPosition:function(b){this.n14=
+b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,d){var e=1/d.x,h=1/d.y,g=1/d.z;this.n11=b.n11*e;this.n21=b.n21*e;this.n31=b.n31*e;this.n12=b.n12*h;this.n22=b.n22*h;this.n32=b.n32*h;this.n13=b.n13*g;this.n23=b.n23*g;this.n33=b.n33*g}};
+THREE.Matrix4.makeInvert=function(b,d){var e=b.n11,h=b.n12,g=b.n13,j=b.n14,k=b.n21,p=b.n22,q=b.n23,v=b.n24,C=b.n31,F=b.n32,J=b.n33,G=b.n34,N=b.n41,O=b.n42,W=b.n43,P=b.n44;d===undefined&&(d=new THREE.Matrix4);d.n11=q*G*O-v*J*O+v*F*W-p*G*W-q*F*P+p*J*P;d.n12=j*J*O-g*G*O-j*F*W+h*G*W+g*F*P-h*J*P;d.n13=g*v*O-j*q*O+j*p*W-h*v*W-g*p*P+h*q*P;d.n14=j*q*F-g*v*F-j*p*J+h*v*J+g*p*G-h*q*G;d.n21=v*J*N-q*G*N-v*C*W+k*G*W+q*C*P-k*J*P;d.n22=g*G*N-j*J*N+j*C*W-e*G*W-g*C*P+e*J*P;d.n23=j*q*N-g*v*N-j*k*W+e*v*W+g*k*P-e*q*P;
+d.n24=g*v*C-j*q*C+j*k*J-e*v*J-g*k*G+e*q*G;d.n31=p*G*N-v*F*N+v*C*O-k*G*O-p*C*P+k*F*P;d.n32=j*F*N-h*G*N-j*C*O+e*G*O+h*C*P-e*F*P;d.n33=g*v*N-j*p*N+j*k*O-e*v*O-h*k*P+e*p*P;d.n34=j*p*C-h*v*C-j*k*F+e*v*F+h*k*G-e*p*G;d.n41=q*F*N-p*J*N-q*C*O+k*J*O+p*C*W-k*F*W;d.n42=h*J*N-g*F*N+g*C*O-e*J*O-h*C*W+e*F*W;d.n43=g*p*N-h*q*N-g*k*O+e*q*O+h*k*W-e*p*W;d.n44=h*q*C-g*p*C+g*k*F-e*q*F-h*k*J+e*p*J;d.multiplyScalar(1/b.determinant());return d};
+THREE.Matrix4.makeInvert3x3=function(b){var d=b.m33,e=d.m,h=b.n33*b.n22-b.n32*b.n23,g=-b.n33*b.n21+b.n31*b.n23,j=b.n32*b.n21-b.n31*b.n22,k=-b.n33*b.n12+b.n32*b.n13,p=b.n33*b.n11-b.n31*b.n13,q=-b.n32*b.n11+b.n31*b.n12,v=b.n23*b.n12-b.n22*b.n13,C=-b.n23*b.n11+b.n21*b.n13,F=b.n22*b.n11-b.n21*b.n12;b=b.n11*h+b.n21*k+b.n31*v;if(b==0)throw"matrix not invertible";b=1/b;e[0]=b*h;e[1]=b*g;e[2]=b*j;e[3]=b*k;e[4]=b*p;e[5]=b*q;e[6]=b*v;e[7]=b*C;e[8]=b*F;return d};
+THREE.Matrix4.makeFrustum=function(b,d,e,h,g,j){var k;k=new THREE.Matrix4;k.n11=2*g/(d-b);k.n12=0;k.n13=(d+b)/(d-b);k.n14=0;k.n21=0;k.n22=2*g/(h-e);k.n23=(h+e)/(h-e);k.n24=0;k.n31=0;k.n32=0;k.n33=-(j+g)/(j-g);k.n34=-2*j*g/(j-g);k.n41=0;k.n42=0;k.n43=-1;k.n44=0;return k};THREE.Matrix4.makePerspective=function(b,d,e,h){var g;b=e*Math.tan(b*Math.PI/360);g=-b;return THREE.Matrix4.makeFrustum(g*d,b*d,g,b,e,h)};
+THREE.Matrix4.makeOrtho=function(b,d,e,h,g,j){var k,p,q,v;k=new THREE.Matrix4;p=d-b;q=e-h;v=j-g;k.n11=2/p;k.n12=0;k.n13=0;k.n14=-((d+b)/p);k.n21=0;k.n22=2/q;k.n23=0;k.n24=-((e+h)/q);k.n31=0;k.n32=0;k.n33=-2/v;k.n34=-((j+g)/v);k.n41=0;k.n42=0;k.n43=0;k.n44=1;return k};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
 THREE.Object3D=function(){this.parent=undefined;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixAutoUpdate=!0;this.matrixWorldNeedsUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=
 !0;this._vector=new THREE.Vector3};
-THREE.Object3D.prototype={translate:function(a,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(a){if(this.children.indexOf(a)===-1){a.parent!==
-undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);for(var c=this;c instanceof THREE.Scene===!1&&c!==undefined;)c=c.parent;c!==undefined&&c.addChildRecurse(a)}},removeChild:function(a){var c=this.children.indexOf(a);if(c!==-1){a.parent=undefined;this.children.splice(c,1)}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation);if(this.scale.x!==1||this.scale.y!==
-1||this.scale.z!==1){this.matrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}this.matrixWorldNeedsUpdate=!0},update:function(a,c,d){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||c){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale);this.matrixWorldNeedsUpdate=!1;c=!0}a=0;for(var g=this.children.length;a<g;a++)this.children[a].update(this.matrixWorld,
-c,d)}};THREE.Quaternion=function(a,c,d,g){this.set(a||0,c||0,d||0,g!==undefined?g:1)};
-THREE.Quaternion.prototype={set:function(a,c,d,g){this.x=a;this.y=c;this.z=d;this.w=g;return this},setFromEuler:function(a){var c=0.5*Math.PI/360,d=a.x*c,g=a.y*c,f=a.z*c;a=Math.cos(g);g=Math.sin(g);c=Math.cos(-f);f=Math.sin(-f);var i=Math.cos(d);d=Math.sin(d);var j=a*c,o=g*f;this.w=j*i-o*d;this.x=j*d+o*i;this.y=g*c*i+a*f*d;this.z=a*f*i-g*c*d;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
--1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var c=this.x,d=this.y,g=this.z,f=this.w,i=a.x,j=a.y,o=a.z;a=a.w;this.x=c*a+f*i+d*o-g*j;this.y=d*a+f*j+g*i-c*o;this.z=g*a+f*o+c*j-d*i;this.w=f*a-c*i-d*j-g*o;return this},
-multiplyVector3:function(a,c){c||(c=a);var d=a.x,g=a.y,f=a.z,i=this.x,j=this.y,o=this.z,p=this.w,v=p*d+j*f-o*g,x=p*g+o*d-i*f,y=p*f+i*g-j*d;d=-i*d-j*g-o*f;c.x=v*p+d*-i+x*-o-y*-j;c.y=x*p+d*-j+y*-i-v*-o;c.z=y*p+d*-o+v*-j-x*-i;return c}};
-THREE.Quaternion.slerp=function(a,c,d,g){var f=a.w*c.w+a.x*c.x+a.y*c.y+a.z*c.z;if(Math.abs(f)>=1){d.w=a.w;d.x=a.x;d.y=a.y;d.z=a.z;return d}var i=Math.acos(f),j=Math.sqrt(1-f*f);if(Math.abs(j)<0.0010){d.w=0.5*(a.w+c.w);d.x=0.5*(a.x+c.x);d.y=0.5*(a.y+c.y);d.z=0.5*(a.z+c.z);return d}f=Math.sin((1-g)*i)/j;g=Math.sin(g*i)/j;d.w=a.w*f+c.w*g;d.x=a.x*f+c.x*g;d.y=a.y*f+c.y*g;d.z=a.z*f+c.z*g;return d};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
-THREE.Face3=function(a,c,d,g,f,i){this.a=a;this.b=c;this.c=d;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materials=i instanceof Array?i:[i];this.centroid=new THREE.Vector3};
-THREE.Face4=function(a,c,d,g,f,i,j){this.a=a;this.b=c;this.c=d;this.d=g;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=i instanceof THREE.Color?i:new THREE.Color;this.vertexColors=i instanceof Array?i:[];this.vertexTangents=[];this.materials=j instanceof Array?j:[j];this.centroid=new THREE.Vector3};THREE.UV=function(a,c){this.set(a||0,c||0)};
-THREE.UV.prototype={set:function(a,c){this.u=a;this.v=c;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
-THREE.Geometry.prototype={computeCentroids:function(){var a,c,d;a=0;for(c=this.faces.length;a<c;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 c,d,g,f,i,j,o=new THREE.Vector3,p=new THREE.Vector3;g=0;for(f=this.faces.length;g<f;g++){i=this.faces[g];if(a&&i.vertexNormals.length){o.set(0,0,0);c=0;for(d=i.vertexNormals.length;c<d;c++)o.addSelf(i.vertexNormals[c]);o.divideScalar(3)}else{c=this.vertices[i.a];d=this.vertices[i.b];j=this.vertices[i.c];o.sub(j.position,d.position);p.sub(c.position,d.position);o.crossSelf(p)}o.isZero()||
-o.normalize();i.normal.copy(o)}},computeVertexNormals:function(){var a,c,d,g;if(this.__tmpVertices==undefined){g=this.__tmpVertices=Array(this.vertices.length);a=0;for(c=this.vertices.length;a<c;a++)g[a]=new THREE.Vector3;a=0;for(c=this.faces.length;a<c;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{g=
-this.__tmpVertices;a=0;for(c=this.vertices.length;a<c;a++)g[a].set(0,0,0)}a=0;for(c=this.faces.length;a<c;a++){d=this.faces[a];if(d instanceof THREE.Face3){g[d.a].addSelf(d.normal);g[d.b].addSelf(d.normal);g[d.c].addSelf(d.normal)}else if(d instanceof THREE.Face4){g[d.a].addSelf(d.normal);g[d.b].addSelf(d.normal);g[d.c].addSelf(d.normal);g[d.d].addSelf(d.normal)}}a=0;for(c=this.vertices.length;a<c;a++)g[a].normalize();a=0;for(c=this.faces.length;a<c;a++){d=this.faces[a];if(d instanceof THREE.Face3){d.vertexNormals[0].copy(g[d.a]);
-d.vertexNormals[1].copy(g[d.b]);d.vertexNormals[2].copy(g[d.c])}else if(d instanceof THREE.Face4){d.vertexNormals[0].copy(g[d.a]);d.vertexNormals[1].copy(g[d.b]);d.vertexNormals[2].copy(g[d.c]);d.vertexNormals[3].copy(g[d.d])}}},computeTangents:function(){function a(W,na,aa,oa,U,ra,ma){o=W.vertices[na].position;p=W.vertices[aa].position;v=W.vertices[oa].position;x=j[U];y=j[ra];D=j[ma];z=p.x-o.x;K=v.x-o.x;M=p.y-o.y;T=v.y-o.y;O=p.z-o.z;pa=v.z-o.z;Y=y.u-x.u;qa=D.u-x.u;V=y.v-x.v;E=D.v-x.v;Fa=1/(Y*E-qa*
-V);b.set((E*z-V*K)*Fa,(E*M-V*T)*Fa,(E*O-V*pa)*Fa);Q.set((Y*K-qa*z)*Fa,(Y*T-qa*M)*Fa,(Y*pa-qa*O)*Fa);Da[na].addSelf(b);Da[aa].addSelf(b);Da[oa].addSelf(b);$[na].addSelf(Q);$[aa].addSelf(Q);$[oa].addSelf(Q)}var c,d,g,f,i,j,o,p,v,x,y,D,z,K,M,T,O,pa,Y,qa,V,E,Fa,ka,Da=[],$=[],b=new THREE.Vector3,Q=new THREE.Vector3,la=new THREE.Vector3,Ba=new THREE.Vector3,Ca=new THREE.Vector3;c=0;for(d=this.vertices.length;c<d;c++){Da[c]=new THREE.Vector3;$[c]=new THREE.Vector3}c=0;for(d=this.faces.length;c<d;c++){i=
-this.faces[c];j=this.faceVertexUvs[0][c];if(i instanceof THREE.Face3)a(this,i.a,i.b,i.c,0,1,2);else if(i instanceof THREE.Face4){a(this,i.a,i.b,i.c,0,1,2);a(this,i.a,i.b,i.d,0,1,3)}}var ta=["a","b","c","d"];c=0;for(d=this.faces.length;c<d;c++){i=this.faces[c];for(g=0;g<i.vertexNormals.length;g++){Ca.copy(i.vertexNormals[g]);f=i[ta[g]];ka=Da[f];la.copy(ka);la.subSelf(Ca.multiplyScalar(Ca.dot(ka))).normalize();Ba.cross(i.vertexNormals[g],ka);f=Ba.dot($[f]);f=f<0?-1:1;i.vertexTangents[g]=new THREE.Vector4(la.x,
-la.y,la.z,f)}}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 c=1,d=this.vertices.length;c<d;c++){a=this.vertices[c];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,c=0,d=this.vertices.length;c<d;c++)a=Math.max(a,this.vertices[c].position.length());this.boundingSphere=
-{radius:a}}};THREE.GeometryIdCounter=0;
-THREE.AnimationHandler=function(){var a=[],c={},d={};d.update=function(f){for(var i=0;i<a.length;i++)a[i].update(f)};d.addToUpdate=function(f){a.indexOf(f)===-1&&a.push(f)};d.removeFromUpdate=function(f){f=a.indexOf(f);f!==-1&&a.splice(f,1)};d.add=function(f){c[f.name]!==undefined&&console.log("THREE.AnimationHandler.add: Warning! "+f.name+" already exists in library. Overwriting.");c[f.name]=f;if(f.initialized!==!0){for(var i=0;i<f.hierarchy.length;i++){for(var j=0;j<f.hierarchy[i].keys.length;j++){if(f.hierarchy[i].keys[j].time<
-0)f.hierarchy[i].keys[j].time=0;if(f.hierarchy[i].keys[j].rot!==undefined&&!(f.hierarchy[i].keys[j].rot instanceof THREE.Quaternion)){var o=f.hierarchy[i].keys[j].rot;f.hierarchy[i].keys[j].rot=new THREE.Quaternion(o[0],o[1],o[2],o[3])}}if(f.hierarchy[i].keys[0].morphTargets!==undefined){o={};for(j=0;j<f.hierarchy[i].keys.length;j++)for(var p=0;p<f.hierarchy[i].keys[j].morphTargets.length;p++){var v=f.hierarchy[i].keys[j].morphTargets[p];o[v]=-1}f.hierarchy[i].usedMorphTargets=o;for(j=0;j<f.hierarchy[i].keys.length;j++){var x=
-{};for(v in o){for(p=0;p<f.hierarchy[i].keys[j].morphTargets.length;p++)if(f.hierarchy[i].keys[j].morphTargets[p]===v){x[v]=f.hierarchy[i].keys[j].morphTargetsInfluences[p];break}p===f.hierarchy[i].keys[j].morphTargets.length&&(x[v]=0)}f.hierarchy[i].keys[j].morphTargetsInfluences=x}}for(j=1;j<f.hierarchy[i].keys.length;j++)if(f.hierarchy[i].keys[j].time===f.hierarchy[i].keys[j-1].time){f.hierarchy[i].keys.splice(j,1);j--}for(j=1;j<f.hierarchy[i].keys.length;j++)f.hierarchy[i].keys[j].index=j}j=parseInt(f.length*
-f.fps,10);f.JIT={};f.JIT.hierarchy=[];for(i=0;i<f.hierarchy.length;i++)f.JIT.hierarchy.push(Array(j));f.initialized=!0}};d.get=function(f){if(typeof f==="string")if(c[f])return c[f];else{console.log("THREE.AnimationHandler.get: Couldn't find animation "+f);return null}};d.parse=function(f){var i=[];if(f instanceof THREE.SkinnedMesh)for(var j=0;j<f.bones.length;j++)i.push(f.bones[j]);else g(f,i);return i};var g=function(f,i){i.push(f);for(var j=0;j<f.children.length;j++)g(f.children[j],i)};d.LINEAR=
-0;d.CATMULLROM=1;d.CATMULLROM_FORWARD=2;return d}();THREE.Animation=function(a,c,d,g){this.root=a;this.data=THREE.AnimationHandler.get(c);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.isPaused=!0;this.loop=!0;this.interpolationType=d!==undefined?d:THREE.AnimationHandler.LINEAR;this.JITCompile=g!==undefined?g:!0;this.points=[];this.target=new THREE.Vector3};
-THREE.Animation.prototype.play=function(a,c){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==undefined?a:!0;this.currentTime=c!==undefined?c:0;var d,g=this.hierarchy.length,f;for(d=0;d<g;d++){f=this.hierarchy[d];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)f.useQuaternion=!0;f.matrixAutoUpdate=!0;if(f.animationCache===undefined){f.animationCache={};f.animationCache.prevKey={pos:0,rot:0,scl:0};f.animationCache.nextKey={pos:0,rot:0,scl:0};f.animationCache.originalMatrix=
-f instanceof THREE.Bone?f.skinMatrix:f.matrix}var i=f.animationCache.prevKey;f=f.animationCache.nextKey;i.pos=this.data.hierarchy[d].keys[0];i.rot=this.data.hierarchy[d].keys[0];i.scl=this.data.hierarchy[d].keys[0];f.pos=this.getNextKeyWith("pos",d,1);f.rot=this.getNextKeyWith("rot",d,1);f.scl=this.getNextKeyWith("scl",d,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
+THREE.Object3D.prototype={translate:function(b,d){this.matrix.rotateAxis(d);this.position.addSelf(d.multiplyScalar(b))},translateX:function(b){this.translate(b,this._vector.set(1,0,0))},translateY:function(b){this.translate(b,this._vector.set(0,1,0))},translateZ:function(b){this.translate(b,this._vector.set(0,0,1))},lookAt:function(b){this.matrix.lookAt(this.position,b,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(b){if(this.children.indexOf(b)===-1){b.parent!==
+undefined&&b.parent.removeChild(b);b.parent=this;this.children.push(b);for(var d=this;d instanceof THREE.Scene===!1&&d!==undefined;)d=d.parent;d!==undefined&&d.addChildRecurse(b)}},removeChild:function(b){var d=this.children.indexOf(b);if(d!==-1){b.parent=undefined;this.children.splice(d,1)}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation);if(this.scale.x!==1||this.scale.y!==
+1||this.scale.z!==1){this.matrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}this.matrixWorldNeedsUpdate=!0},update:function(b,d,e){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||d){b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale);this.matrixWorldNeedsUpdate=!1;d=!0}b=0;for(var h=this.children.length;b<h;b++)this.children[b].update(this.matrixWorld,
+d,e)}};THREE.Quaternion=function(b,d,e,h){this.set(b||0,d||0,e||0,h!==undefined?h:1)};
+THREE.Quaternion.prototype={set:function(b,d,e,h){this.x=b;this.y=d;this.z=e;this.w=h;return this},setFromEuler:function(b){var d=0.5*Math.PI/360,e=b.x*d,h=b.y*d,g=b.z*d;b=Math.cos(h);h=Math.sin(h);d=Math.cos(-g);g=Math.sin(-g);var j=Math.cos(e);e=Math.sin(e);var k=b*d,p=h*g;this.w=k*j-p*e;this.x=k*e+p*j;this.y=h*d*j+b*g*e;this.z=b*g*j-h*d*e;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
+-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var b=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(b==0)this.w=this.z=this.y=this.x=0;else{b=1/b;this.x*=b;this.y*=b;this.z*=b;this.w*=b}return this},multiplySelf:function(b){var d=this.x,e=this.y,h=this.z,g=this.w,j=b.x,k=b.y,p=b.z;b=b.w;this.x=d*b+g*j+e*p-h*k;this.y=e*b+g*k+h*j-d*p;this.z=h*b+g*p+d*k-e*j;this.w=g*b-d*j-e*k-h*p;return this},
+multiplyVector3:function(b,d){d||(d=b);var e=b.x,h=b.y,g=b.z,j=this.x,k=this.y,p=this.z,q=this.w,v=q*e+k*g-p*h,C=q*h+p*e-j*g,F=q*g+j*h-k*e;e=-j*e-k*h-p*g;d.x=v*q+e*-j+C*-p-F*-k;d.y=C*q+e*-k+F*-j-v*-p;d.z=F*q+e*-p+v*-k-C*-j;return d}};
+THREE.Quaternion.slerp=function(b,d,e,h){var g=b.w*d.w+b.x*d.x+b.y*d.y+b.z*d.z;if(Math.abs(g)>=1){e.w=b.w;e.x=b.x;e.y=b.y;e.z=b.z;return e}var j=Math.acos(g),k=Math.sqrt(1-g*g);if(Math.abs(k)<0.001){e.w=0.5*(b.w+d.w);e.x=0.5*(b.x+d.x);e.y=0.5*(b.y+d.y);e.z=0.5*(b.z+d.z);return e}g=Math.sin((1-h)*j)/k;h=Math.sin(h*j)/k;e.w=b.w*g+d.w*h;e.x=b.x*g+d.x*h;e.y=b.y*g+d.y*h;e.z=b.z*g+d.z*h;return e};THREE.Vertex=function(b){this.position=b||new THREE.Vector3};
+THREE.Face3=function(b,d,e,h,g,j){this.a=b;this.b=d;this.c=e;this.normal=h instanceof THREE.Vector3?h:new THREE.Vector3;this.vertexNormals=h instanceof Array?h:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=j instanceof Array?j:[j];this.centroid=new THREE.Vector3};
+THREE.Face4=function(b,d,e,h,g,j,k){this.a=b;this.b=d;this.c=e;this.d=h;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.color=j instanceof THREE.Color?j:new THREE.Color;this.vertexColors=j instanceof Array?j:[];this.vertexTangents=[];this.materials=k instanceof Array?k:[k];this.centroid=new THREE.Vector3};THREE.UV=function(b,d){this.set(b||0,d||0)};
+THREE.UV.prototype={set:function(b,d){this.u=b;this.v=d;return this},copy:function(b){this.set(b.u,b.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
+THREE.Geometry.prototype={computeCentroids:function(){var b,d,e;b=0;for(d=this.faces.length;b<d;b++){e=this.faces[b];e.centroid.set(0,0,0);if(e instanceof THREE.Face3){e.centroid.addSelf(this.vertices[e.a].position);e.centroid.addSelf(this.vertices[e.b].position);e.centroid.addSelf(this.vertices[e.c].position);e.centroid.divideScalar(3)}else if(e instanceof THREE.Face4){e.centroid.addSelf(this.vertices[e.a].position);e.centroid.addSelf(this.vertices[e.b].position);e.centroid.addSelf(this.vertices[e.c].position);
+e.centroid.addSelf(this.vertices[e.d].position);e.centroid.divideScalar(4)}}},computeFaceNormals:function(b){var d,e,h,g,j,k,p=new THREE.Vector3,q=new THREE.Vector3;h=0;for(g=this.faces.length;h<g;h++){j=this.faces[h];if(b&&j.vertexNormals.length){p.set(0,0,0);d=0;for(e=j.vertexNormals.length;d<e;d++)p.addSelf(j.vertexNormals[d]);p.divideScalar(3)}else{d=this.vertices[j.a];e=this.vertices[j.b];k=this.vertices[j.c];p.sub(k.position,e.position);q.sub(d.position,e.position);p.crossSelf(q)}p.isZero()||
+p.normalize();j.normal.copy(p)}},computeVertexNormals:function(){var b,d,e,h;if(this.__tmpVertices==undefined){h=this.__tmpVertices=Array(this.vertices.length);b=0;for(d=this.vertices.length;b<d;b++)h[b]=new THREE.Vector3;b=0;for(d=this.faces.length;b<d;b++){e=this.faces[b];if(e instanceof THREE.Face3)e.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(e instanceof THREE.Face4)e.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{h=
+this.__tmpVertices;b=0;for(d=this.vertices.length;b<d;b++)h[b].set(0,0,0)}b=0;for(d=this.faces.length;b<d;b++){e=this.faces[b];if(e instanceof THREE.Face3){h[e.a].addSelf(e.normal);h[e.b].addSelf(e.normal);h[e.c].addSelf(e.normal)}else if(e instanceof THREE.Face4){h[e.a].addSelf(e.normal);h[e.b].addSelf(e.normal);h[e.c].addSelf(e.normal);h[e.d].addSelf(e.normal)}}b=0;for(d=this.vertices.length;b<d;b++)h[b].normalize();b=0;for(d=this.faces.length;b<d;b++){e=this.faces[b];if(e instanceof THREE.Face3){e.vertexNormals[0].copy(h[e.a]);
+e.vertexNormals[1].copy(h[e.b]);e.vertexNormals[2].copy(h[e.c])}else if(e instanceof THREE.Face4){e.vertexNormals[0].copy(h[e.a]);e.vertexNormals[1].copy(h[e.b]);e.vertexNormals[2].copy(h[e.c]);e.vertexNormals[3].copy(h[e.d])}}},computeTangents:function(){function b($,oa,ea,pa,X,ua,na){p=$.vertices[oa].position;q=$.vertices[ea].position;v=$.vertices[pa].position;C=k[X];F=k[ua];J=k[na];G=q.x-p.x;N=v.x-p.x;O=q.y-p.y;W=v.y-p.y;P=q.z-p.z;ra=v.z-p.z;aa=F.u-C.u;sa=J.u-C.u;Z=F.v-C.v;K=J.v-C.v;Ia=1/(aa*K-
+sa*Z);c.set((K*G-Z*N)*Ia,(K*O-Z*W)*Ia,(K*P-Z*ra)*Ia);S.set((aa*N-sa*G)*Ia,(aa*W-sa*O)*Ia,(aa*ra-sa*P)*Ia);Ga[oa].addSelf(c);Ga[ea].addSelf(c);Ga[pa].addSelf(c);da[oa].addSelf(S);da[ea].addSelf(S);da[pa].addSelf(S)}var d,e,h,g,j,k,p,q,v,C,F,J,G,N,O,W,P,ra,aa,sa,Z,K,Ia,la,Ga=[],da=[],c=new THREE.Vector3,S=new THREE.Vector3,ma=new THREE.Vector3,Da=new THREE.Vector3,Ea=new THREE.Vector3;d=0;for(e=this.vertices.length;d<e;d++){Ga[d]=new THREE.Vector3;da[d]=new THREE.Vector3}d=0;for(e=this.faces.length;d<
+e;d++){j=this.faces[d];k=this.faceVertexUvs[0][d];if(j instanceof THREE.Face3)b(this,j.a,j.b,j.c,0,1,2);else if(j instanceof THREE.Face4){b(this,j.a,j.b,j.c,0,1,2);b(this,j.a,j.b,j.d,0,1,3)}}var wa=["a","b","c","d"];d=0;for(e=this.faces.length;d<e;d++){j=this.faces[d];for(h=0;h<j.vertexNormals.length;h++){Ea.copy(j.vertexNormals[h]);g=j[wa[h]];la=Ga[g];ma.copy(la);ma.subSelf(Ea.multiplyScalar(Ea.dot(la))).normalize();Da.cross(j.vertexNormals[h],la);g=Da.dot(da[g]);g=g<0?-1:1;j.vertexTangents[h]=new THREE.Vector4(ma.x,
+ma.y,ma.z,g)}}this.hasTangents=!0},computeBoundingBox:function(){var b;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var d=1,e=this.vertices.length;d<e;d++){b=this.vertices[d];if(b.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=b.position.x;else if(b.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=b.position.x;
+if(b.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=b.position.y;else if(b.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=b.position.y;if(b.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=b.position.z;else if(b.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=this.boundingSphere===null?0:this.boundingSphere.radius,d=0,e=this.vertices.length;d<e;d++)b=Math.max(b,this.vertices[d].position.length());this.boundingSphere=
+{radius:b}}};THREE.GeometryIdCounter=0;
+THREE.AnimationHandler=function(){var b=[],d={},e={};e.update=function(g){for(var j=0;j<b.length;j++)b[j].update(g)};e.addToUpdate=function(g){b.indexOf(g)===-1&&b.push(g)};e.removeFromUpdate=function(g){g=b.indexOf(g);g!==-1&&b.splice(g,1)};e.add=function(g){d[g.name]!==undefined&&console.log("THREE.AnimationHandler.add: Warning! "+g.name+" already exists in library. Overwriting.");d[g.name]=g;if(g.initialized!==!0){for(var j=0;j<g.hierarchy.length;j++){for(var k=0;k<g.hierarchy[j].keys.length;k++){if(g.hierarchy[j].keys[k].time<
+0)g.hierarchy[j].keys[k].time=0;if(g.hierarchy[j].keys[k].rot!==undefined&&!(g.hierarchy[j].keys[k].rot instanceof THREE.Quaternion)){var p=g.hierarchy[j].keys[k].rot;g.hierarchy[j].keys[k].rot=new THREE.Quaternion(p[0],p[1],p[2],p[3])}}if(g.hierarchy[j].keys[0].morphTargets!==undefined){p={};for(k=0;k<g.hierarchy[j].keys.length;k++)for(var q=0;q<g.hierarchy[j].keys[k].morphTargets.length;q++){var v=g.hierarchy[j].keys[k].morphTargets[q];p[v]=-1}g.hierarchy[j].usedMorphTargets=p;for(k=0;k<g.hierarchy[j].keys.length;k++){var C=
+{};for(v in p){for(q=0;q<g.hierarchy[j].keys[k].morphTargets.length;q++)if(g.hierarchy[j].keys[k].morphTargets[q]===v){C[v]=g.hierarchy[j].keys[k].morphTargetsInfluences[q];break}q===g.hierarchy[j].keys[k].morphTargets.length&&(C[v]=0)}g.hierarchy[j].keys[k].morphTargetsInfluences=C}}for(k=1;k<g.hierarchy[j].keys.length;k++)if(g.hierarchy[j].keys[k].time===g.hierarchy[j].keys[k-1].time){g.hierarchy[j].keys.splice(k,1);k--}for(k=1;k<g.hierarchy[j].keys.length;k++)g.hierarchy[j].keys[k].index=k}k=parseInt(g.length*
+g.fps,10);g.JIT={};g.JIT.hierarchy=[];for(j=0;j<g.hierarchy.length;j++)g.JIT.hierarchy.push(Array(k));g.initialized=!0}};e.get=function(g){if(typeof g==="string")if(d[g])return d[g];else{console.log("THREE.AnimationHandler.get: Couldn't find animation "+g);return null}};e.parse=function(g){var j=[];if(g instanceof THREE.SkinnedMesh)for(var k=0;k<g.bones.length;k++)j.push(g.bones[k]);else h(g,j);return j};var h=function(g,j){j.push(g);for(var k=0;k<g.children.length;k++)h(g.children[k],j)};e.LINEAR=
+0;e.CATMULLROM=1;e.CATMULLROM_FORWARD=2;return e}();THREE.Animation=function(b,d,e,h){this.root=b;this.data=THREE.AnimationHandler.get(d);this.hierarchy=THREE.AnimationHandler.parse(b);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.isPaused=!0;this.loop=!0;this.interpolationType=e!==undefined?e:THREE.AnimationHandler.LINEAR;this.JITCompile=h!==undefined?h:!0;this.points=[];this.target=new THREE.Vector3};
+THREE.Animation.prototype.play=function(b,d){if(!this.isPlaying){this.isPlaying=!0;this.loop=b!==undefined?b:!0;this.currentTime=d!==undefined?d:0;var e,h=this.hierarchy.length,g;for(e=0;e<h;e++){g=this.hierarchy[e];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)g.useQuaternion=!0;g.matrixAutoUpdate=!0;if(g.animationCache===undefined){g.animationCache={};g.animationCache.prevKey={pos:0,rot:0,scl:0};g.animationCache.nextKey={pos:0,rot:0,scl:0};g.animationCache.originalMatrix=
+g instanceof THREE.Bone?g.skinMatrix:g.matrix}var j=g.animationCache.prevKey;g=g.animationCache.nextKey;j.pos=this.data.hierarchy[e].keys[0];j.rot=this.data.hierarchy[e].keys[0];j.scl=this.data.hierarchy[e].keys[0];g.pos=this.getNextKeyWith("pos",e,1);g.rot=this.getNextKeyWith("rot",e,1);g.scl=this.getNextKeyWith("scl",e,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
 THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
-THREE.Animation.prototype.stop=function(){this.isPlaying=!1;this.isPaused=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==undefined){if(this.hierarchy[a]instanceof THREE.Bone)this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix;else this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix;delete this.hierarchy[a].animationCache}};
-THREE.Animation.prototype.update=function(a){if(this.isPlaying){var c=["pos","rot","scl"],d,g,f,i,j,o,p,v,x=this.data.JIT.hierarchy,y,D;this.currentTime+=a*this.timeScale;D=this.currentTime;y=this.currentTime%=this.data.length;v=parseInt(Math.min(y*this.data.fps,this.data.length*this.data.fps),10);for(var z=0,K=this.hierarchy.length;z<K;z++){a=this.hierarchy[z];p=a.animationCache;if(this.JITCompile&&x[z][v]!==undefined)if(a instanceof THREE.Bone){a.skinMatrix=x[z][v];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=
-!1}else{a.matrix=x[z][v];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=!0}else{if(this.JITCompile)if(a instanceof THREE.Bone)a.skinMatrix=a.animationCache.originalMatrix;else a.matrix=a.animationCache.originalMatrix;for(var M=0;M<3;M++){d=c[M];j=p.prevKey[d];o=p.nextKey[d];if(o.time<=D){if(y<D)if(this.loop){j=this.data.hierarchy[z].keys[0];for(o=this.getNextKeyWith(d,z,1);o.time<y;){j=o;o=this.getNextKeyWith(d,z,o.index+1)}}else{this.stop();return}else{do{j=o;o=this.getNextKeyWith(d,z,o.index+1)}while(o.time<
-y)}p.prevKey[d]=j;p.nextKey[d]=o}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;g=(y-j.time)/(o.time-j.time);f=j[d];i=o[d];if(g<0||g>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+g+" on bone "+z);g=g<0?0:1}if(d==="pos"){d=a.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){d.x=f[0]+(i[0]-f[0])*g;d.y=f[1]+(i[1]-f[1])*g;d.z=f[2]+(i[2]-f[2])*g}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=
-this.getPrevKeyWith("pos",z,j.index-1).pos;this.points[1]=f;this.points[2]=i;this.points[3]=this.getNextKeyWith("pos",z,o.index+1).pos;g=g*0.33+0.33;f=this.interpolateCatmullRom(this.points,g);d.x=f[0];d.y=f[1];d.z=f[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){g=this.interpolateCatmullRom(this.points,g*1.01);this.target.set(g[0],g[1],g[2]);this.target.subSelf(d);this.target.y=0;this.target.normalize();g=Math.atan2(this.target.x,this.target.z);a.rotation.set(0,g,0)}}}else if(d===
-"rot")THREE.Quaternion.slerp(f,i,a.quaternion,g);else if(d==="scl"){d=a.scale;d.x=f[0]+(i[0]-f[0])*g;d.y=f[1]+(i[1]-f[1])*g;d.z=f[2]+(i[2]-f[2])*g}}}}if(this.JITCompile&&x[0][v]===undefined){this.hierarchy[0].update(undefined,!0);for(z=0;z<this.hierarchy.length;z++)x[z][v]=this.hierarchy[z]instanceof THREE.Bone?this.hierarchy[z].skinMatrix.clone():this.hierarchy[z].matrix.clone()}}};
-THREE.Animation.prototype.interpolateCatmullRom=function(a,c){var d=[],g=[],f,i,j,o,p,v;f=(a.length-1)*c;i=Math.floor(f);f-=i;d[0]=i==0?i:i-1;d[1]=i;d[2]=i>a.length-2?i:i+1;d[3]=i>a.length-3?i:i+2;i=a[d[0]];o=a[d[1]];p=a[d[2]];v=a[d[3]];d=f*f;j=f*d;g[0]=this.interpolate(i[0],o[0],p[0],v[0],f,d,j);g[1]=this.interpolate(i[1],o[1],p[1],v[1],f,d,j);g[2]=this.interpolate(i[2],o[2],p[2],v[2],f,d,j);return g};
-THREE.Animation.prototype.interpolate=function(a,c,d,g,f,i,j){a=(d-a)*0.5;g=(g-c)*0.5;return(2*(c-d)+a+g)*j+(-3*(c-d)-2*a-g)*i+a*f+c};THREE.Animation.prototype.getNextKeyWith=function(a,c,d){var g=this.data.hierarchy[c].keys;if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)d=d<g.length-1?d:g.length-1;else d%=g.length;for(;d<g.length;d++)if(g[d][a]!==undefined)return g[d];return this.data.hierarchy[c].keys[0]};
-THREE.Animation.prototype.getPrevKeyWith=function(a,c,d){var g=this.data.hierarchy[c].keys;for(d=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?d>0?d:0:d>=0?d:d+g.length;d>=0;d--)if(g[d][a]!==undefined)return g[d];return this.data.hierarchy[c].keys[g.length-1]};
-THREE.Camera=function(a,c,d,g,f){THREE.Object3D.call(this);this.fov=a||50;this.aspect=c||1;this.near=d||0.1;this.far=g||2E3;this.target=f||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
-THREE.Camera.prototype.translate=function(a,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(a));this.target.position.addSelf(c.multiplyScalar(a))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};THREE.Camera.prototype.updateMatrix=function(){this.update(undefined,!0)};
-THREE.Camera.prototype.update=function(a,c,d){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);this.matrix.setPosition(this.position);a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);c=!0}else{this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=
-!1;c=!0;THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,c,d)};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,c,d){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=c||1;this.distance=d||0};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,c,d){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=c||1;this.distance=d||0};THREE.PointLight.prototype=new THREE.Light;
-THREE.PointLight.prototype.constructor=THREE.PointLight;THREE.Material=function(a){this.id=THREE.MaterialCounter.value++;a=a||{};this.opacity=a.opacity!==undefined?a.opacity:1;this.transparent=a.transparent!==undefined?a.transparent:!1;this.blending=a.blending!==undefined?a.blending:THREE.NormalBlending;this.depthTest=a.depthTest!==undefined?a.depthTest:!0};THREE.NoShading=0;THREE.FlatShading=1;THREE.SmoothShading=2;THREE.NoColors=0;THREE.FaceColors=1;THREE.VertexColors=2;THREE.NormalBlending=0;
+THREE.Animation.prototype.stop=function(){this.isPlaying=!1;this.isPaused=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var b=0;b<this.hierarchy.length;b++)if(this.hierarchy[b].animationCache!==undefined){if(this.hierarchy[b]instanceof THREE.Bone)this.hierarchy[b].skinMatrix=this.hierarchy[b].animationCache.originalMatrix;else this.hierarchy[b].matrix=this.hierarchy[b].animationCache.originalMatrix;delete this.hierarchy[b].animationCache}};
+THREE.Animation.prototype.update=function(b){if(this.isPlaying){var d=["pos","rot","scl"],e,h,g,j,k,p,q,v,C=this.data.JIT.hierarchy,F,J;this.currentTime+=b*this.timeScale;J=this.currentTime;F=this.currentTime%=this.data.length;v=parseInt(Math.min(F*this.data.fps,this.data.length*this.data.fps),10);for(var G=0,N=this.hierarchy.length;G<N;G++){b=this.hierarchy[G];q=b.animationCache;if(this.JITCompile&&C[G][v]!==undefined)if(b instanceof THREE.Bone){b.skinMatrix=C[G][v];b.matrixAutoUpdate=!1;b.matrixWorldNeedsUpdate=
+!1}else{b.matrix=C[G][v];b.matrixAutoUpdate=!1;b.matrixWorldNeedsUpdate=!0}else{if(this.JITCompile)if(b instanceof THREE.Bone)b.skinMatrix=b.animationCache.originalMatrix;else b.matrix=b.animationCache.originalMatrix;for(var O=0;O<3;O++){e=d[O];k=q.prevKey[e];p=q.nextKey[e];if(p.time<=J){if(F<J)if(this.loop){k=this.data.hierarchy[G].keys[0];for(p=this.getNextKeyWith(e,G,1);p.time<F;){k=p;p=this.getNextKeyWith(e,G,p.index+1)}}else{this.stop();return}else{do{k=p;p=this.getNextKeyWith(e,G,p.index+1)}while(p.time<
+F)}q.prevKey[e]=k;q.nextKey[e]=p}b.matrixAutoUpdate=!0;b.matrixWorldNeedsUpdate=!0;h=(F-k.time)/(p.time-k.time);g=k[e];j=p[e];if(h<0||h>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+h+" on bone "+G);h=h<0?0:1}if(e==="pos"){e=b.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){e.x=g[0]+(j[0]-g[0])*h;e.y=g[1]+(j[1]-g[1])*h;e.z=g[2]+(j[2]-g[2])*h}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=
+this.getPrevKeyWith("pos",G,k.index-1).pos;this.points[1]=g;this.points[2]=j;this.points[3]=this.getNextKeyWith("pos",G,p.index+1).pos;h=h*0.33+0.33;g=this.interpolateCatmullRom(this.points,h);e.x=g[0];e.y=g[1];e.z=g[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){h=this.interpolateCatmullRom(this.points,h*1.01);this.target.set(h[0],h[1],h[2]);this.target.subSelf(e);this.target.y=0;this.target.normalize();h=Math.atan2(this.target.x,this.target.z);b.rotation.set(0,h,0)}}}else if(e===
+"rot")THREE.Quaternion.slerp(g,j,b.quaternion,h);else if(e==="scl"){e=b.scale;e.x=g[0]+(j[0]-g[0])*h;e.y=g[1]+(j[1]-g[1])*h;e.z=g[2]+(j[2]-g[2])*h}}}}if(this.JITCompile&&C[0][v]===undefined){this.hierarchy[0].update(undefined,!0);for(G=0;G<this.hierarchy.length;G++)C[G][v]=this.hierarchy[G]instanceof THREE.Bone?this.hierarchy[G].skinMatrix.clone():this.hierarchy[G].matrix.clone()}}};
+THREE.Animation.prototype.interpolateCatmullRom=function(b,d){var e=[],h=[],g,j,k,p,q,v;g=(b.length-1)*d;j=Math.floor(g);g-=j;e[0]=j==0?j:j-1;e[1]=j;e[2]=j>b.length-2?j:j+1;e[3]=j>b.length-3?j:j+2;j=b[e[0]];p=b[e[1]];q=b[e[2]];v=b[e[3]];e=g*g;k=g*e;h[0]=this.interpolate(j[0],p[0],q[0],v[0],g,e,k);h[1]=this.interpolate(j[1],p[1],q[1],v[1],g,e,k);h[2]=this.interpolate(j[2],p[2],q[2],v[2],g,e,k);return h};
+THREE.Animation.prototype.interpolate=function(b,d,e,h,g,j,k){b=(e-b)*0.5;h=(h-d)*0.5;return(2*(d-e)+b+h)*k+(-3*(d-e)-2*b-h)*j+b*g+d};THREE.Animation.prototype.getNextKeyWith=function(b,d,e){var h=this.data.hierarchy[d].keys;if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)e=e<h.length-1?e:h.length-1;else e%=h.length;for(;e<h.length;e++)if(h[e][b]!==undefined)return h[e];return this.data.hierarchy[d].keys[0]};
+THREE.Animation.prototype.getPrevKeyWith=function(b,d,e){var h=this.data.hierarchy[d].keys;for(e=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?e>0?e:0:e>=0?e:e+h.length;e>=0;e--)if(h[e][b]!==undefined)return h[e];return this.data.hierarchy[d].keys[h.length-1]};
+THREE.Camera=function(b,d,e,h,g){THREE.Object3D.call(this);this.fov=b||50;this.aspect=d||1;this.near=e||0.1;this.far=h||2E3;this.target=g||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
+THREE.Camera.prototype.translate=function(b,d){this.matrix.rotateAxis(d);this.position.addSelf(d.multiplyScalar(b));this.target.position.addSelf(d.multiplyScalar(b))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};THREE.Camera.prototype.updateMatrix=function(){this.update(undefined,!0)};
+THREE.Camera.prototype.update=function(b,d,e){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);this.matrix.setPosition(this.position);b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);d=!0}else{this.matrixAutoUpdate&&(d|=this.updateMatrix());if(d||this.matrixWorldNeedsUpdate){b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=
+!1;d=!0;THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse)}}for(b=0;b<this.children.length;b++)this.children[b].update(this.matrixWorld,d,e)};THREE.Light=function(b){THREE.Object3D.call(this);this.color=new THREE.Color(b)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(b){THREE.Light.call(this,b)};THREE.AmbientLight.prototype=new THREE.Light;
+THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(b,d,e){THREE.Light.call(this,b);this.position=new THREE.Vector3(0,1,0);this.intensity=d||1;this.distance=e||0};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(b,d,e){THREE.Light.call(this,b);this.position=new THREE.Vector3;this.intensity=d||1;this.distance=e||0};THREE.PointLight.prototype=new THREE.Light;
+THREE.PointLight.prototype.constructor=THREE.PointLight;THREE.Material=function(b){this.id=THREE.MaterialCounter.value++;b=b||{};this.opacity=b.opacity!==undefined?b.opacity:1;this.transparent=b.transparent!==undefined?b.transparent:!1;this.blending=b.blending!==undefined?b.blending:THREE.NormalBlending;this.depthTest=b.depthTest!==undefined?b.depthTest:!0};THREE.NoShading=0;THREE.FlatShading=1;THREE.SmoothShading=2;THREE.NoColors=0;THREE.FaceColors=1;THREE.VertexColors=2;THREE.NormalBlending=0;
 THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.MultiplyBlending=3;THREE.AdditiveAlphaBlending=4;THREE.MaterialCounter={value:0};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};
-THREE.LineBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==undefined?new THREE.Color(a.color):new THREE.Color(16777215);this.linewidth=a.linewidth!==undefined?a.linewidth:1;this.linecap=a.linecap!==undefined?a.linecap:"round";this.linejoin=a.linejoin!==undefined?a.linejoin:"round";this.vertexColors=a.vertexColors?a.vertexColors:!1};THREE.LineBasicMaterial.prototype=new THREE.Material;THREE.LineBasicMaterial.prototype.constructor=THREE.LineBasicMaterial;
-THREE.MeshBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==undefined?new THREE.Color(a.color):new THREE.Color(16777215);this.map=a.map!==undefined?a.map:null;this.lightMap=a.lightMap!==undefined?a.lightMap:null;this.envMap=a.envMap!==undefined?a.envMap:null;this.combine=a.combine!==undefined?a.combine:THREE.MultiplyOperation;this.reflectivity=a.reflectivity!==undefined?a.reflectivity:1;this.refractionRatio=a.refractionRatio!==undefined?a.refractionRatio:0.98;this.shading=
-a.shading!==undefined?a.shading:THREE.SmoothShading;this.wireframe=a.wireframe!==undefined?a.wireframe:!1;this.wireframeLinewidth=a.wireframeLinewidth!==undefined?a.wireframeLinewidth:1;this.wireframeLinecap=a.wireframeLinecap!==undefined?a.wireframeLinecap:"round";this.wireframeLinejoin=a.wireframeLinejoin!==undefined?a.wireframeLinejoin:"round";this.vertexColors=a.vertexColors!==undefined?a.vertexColors:!1;this.skinning=a.skinning!==undefined?a.skinning:!1;this.morphTargets=a.morphTargets!==undefined?
-a.morphTargets:!1};THREE.MeshBasicMaterial.prototype=new THREE.Material;THREE.MeshBasicMaterial.prototype.constructor=THREE.MeshBasicMaterial;
-THREE.MeshLambertMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==undefined?new THREE.Color(a.color):new THREE.Color(16777215);this.map=a.map!==undefined?a.map:null;this.lightMap=a.lightMap!==undefined?a.lightMap:null;this.envMap=a.envMap!==undefined?a.envMap:null;this.combine=a.combine!==undefined?a.combine:THREE.MultiplyOperation;this.reflectivity=a.reflectivity!==undefined?a.reflectivity:1;this.refractionRatio=a.refractionRatio!==undefined?a.refractionRatio:0.98;this.shading=
-a.shading!==undefined?a.shading:THREE.SmoothShading;this.wireframe=a.wireframe!==undefined?a.wireframe:!1;this.wireframeLinewidth=a.wireframeLinewidth!==undefined?a.wireframeLinewidth:1;this.wireframeLinecap=a.wireframeLinecap!==undefined?a.wireframeLinecap:"round";this.wireframeLinejoin=a.wireframeLinejoin!==undefined?a.wireframeLinejoin:"round";this.vertexColors=a.vertexColors!==undefined?a.vertexColors:!1;this.skinning=a.skinning!==undefined?a.skinning:!1;this.morphTargets=a.morphTargets!==undefined?
-a.morphTargets:!1};THREE.MeshLambertMaterial.prototype=new THREE.Material;THREE.MeshLambertMaterial.prototype.constructor=THREE.MeshLambertMaterial;
-THREE.MeshPhongMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==undefined?new THREE.Color(a.color):new THREE.Color(16777215);this.ambient=a.ambient!==undefined?new THREE.Color(a.ambient):new THREE.Color(328965);this.specular=a.specular!==undefined?new THREE.Color(a.specular):new THREE.Color(1118481);this.shininess=a.shininess!==undefined?a.shininess:30;this.map=a.map!==undefined?a.map:null;this.lightMap=a.lightMap!==undefined?a.lightMap:null;this.envMap=a.envMap!==undefined?
-a.envMap:null;this.combine=a.combine!==undefined?a.combine:THREE.MultiplyOperation;this.reflectivity=a.reflectivity!==undefined?a.reflectivity:1;this.refractionRatio=a.refractionRatio!==undefined?a.refractionRatio:0.98;this.shading=a.shading!==undefined?a.shading:THREE.SmoothShading;this.wireframe=a.wireframe!==undefined?a.wireframe:!1;this.wireframeLinewidth=a.wireframeLinewidth!==undefined?a.wireframeLinewidth:1;this.wireframeLinecap=a.wireframeLinecap!==undefined?a.wireframeLinecap:"round";this.wireframeLinejoin=
-a.wireframeLinejoin!==undefined?a.wireframeLinejoin:"round";this.vertexColors=a.vertexColors!==undefined?a.vertexColors:!1;this.skinning=a.skinning!==undefined?a.skinning:!1;this.morphTargets=a.morphTargets!==undefined?a.morphTargets:!1};THREE.MeshPhongMaterial.prototype=new THREE.Material;THREE.MeshPhongMaterial.prototype.constructor=THREE.MeshPhongMaterial;
-THREE.MeshDepthMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.shading=a.shading!==undefined?a.shading:THREE.SmoothShading;this.wireframe=a.wireframe!==undefined?a.wireframe:!1;this.wireframeLinewidth=a.wireframeLinewidth!==undefined?a.wireframeLinewidth:1};THREE.MeshDepthMaterial.prototype=new THREE.Material;THREE.MeshDepthMaterial.prototype.constructor=THREE.MeshDepthMaterial;
-THREE.MeshNormalMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.shading=a.shading?a.shading:THREE.FlatShading;this.wireframe=a.wireframe?a.wireframe:!1;this.wireframeLinewidth=a.wireframeLinewidth?a.wireframeLinewidth:1};THREE.MeshNormalMaterial.prototype=new THREE.Material;THREE.MeshNormalMaterial.prototype.constructor=THREE.MeshNormalMaterial;THREE.MeshFaceMaterial=function(){};
-THREE.MeshShaderMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.fragmentShader=a.fragmentShader!==undefined?a.fragmentShader:"void main() {}";this.vertexShader=a.vertexShader!==undefined?a.vertexShader:"void main() {}";this.uniforms=a.uniforms!==undefined?a.uniforms:{};this.shading=a.shading!==undefined?a.shading:THREE.SmoothShading;this.wireframe=a.wireframe!==undefined?a.wireframe:!1;this.wireframeLinewidth=a.wireframeLinewidth!==undefined?a.wireframeLinewidth:1;this.lights=a.lights!==
-undefined?a.lights:!1;this.vertexColors=a.vertexColors!==undefined?a.vertexColors:!1;this.skinning=a.skinning!==undefined?a.skinning:!1;this.morphTargets=a.morphTargets!==undefined?a.morphTargets:!1};THREE.MeshShaderMaterial.prototype=new THREE.Material;THREE.MeshShaderMaterial.prototype.constructor=THREE.MeshShaderMaterial;
-THREE.ParticleBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==undefined?new THREE.Color(a.color):new THREE.Color(16777215);this.map=a.map!==undefined?a.map:null;this.size=a.size!==undefined?a.size:1;this.sizeAttenuation=a.sizeAttenuation!==undefined?a.sizeAttenuation:!0;this.vertexColors=a.vertexColors!==undefined?a.vertexColors:!1};THREE.ParticleBasicMaterial.prototype=new THREE.Material;THREE.ParticleBasicMaterial.prototype.constructor=THREE.ParticleBasicMaterial;
-THREE.ShadowVolumeDynamicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==undefined?new THREE.Color(a.color):new THREE.Color(16777215);this.map=a.map!==undefined?a.map:null;this.lightMap=a.lightMap!==undefined?a.lightMap:null;this.envMap=a.envMap!==undefined?a.envMap:null;this.combine=a.combine!==undefined?a.combine:THREE.MultiplyOperation;this.reflectivity=a.reflectivity!==undefined?a.reflectivity:1;this.refractionRatio=a.refractionRatio!==undefined?a.refractionRatio:
-0.98;this.shading=a.shading!==undefined?a.shading:THREE.SmoothShading;this.wireframe=a.wireframe!==undefined?a.wireframe:!1;this.wireframeLinewidth=a.wireframeLinewidth!==undefined?a.wireframeLinewidth:1;this.wireframeLinecap=a.wireframeLinecap!==undefined?a.wireframeLinecap:"round";this.wireframeLinejoin=a.wireframeLinejoin!==undefined?a.wireframeLinejoin:"round";this.vertexColors=a.vertexColors!==undefined?a.vertexColors:!1;this.skinning=a.skinning!==undefined?a.skinning:!1;this.morphTargets=a.morphTargets!==
-undefined?a.morphTargets:!1};THREE.ShadowVolumeDynamicMaterial.prototype=new THREE.Material;THREE.ShadowVolumeDynamicMaterial.prototype.constructor=THREE.ShadowVolumeDynamicMaterial;
-THREE.Texture=function(a,c,d,g,f,i){this.image=a;this.mapping=c!==undefined?c:new THREE.UVMapping;this.wrapS=d!==undefined?d:THREE.ClampToEdgeWrapping;this.wrapT=g!==undefined?g:THREE.ClampToEdgeWrapping;this.magFilter=f!==undefined?f:THREE.LinearFilter;this.minFilter=i!==undefined?i:THREE.LinearMipMapLinearFilter;this.needsUpdate=!1};THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter)}};
+THREE.LineBasicMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.color=b.color!==undefined?new THREE.Color(b.color):new THREE.Color(16777215);this.linewidth=b.linewidth!==undefined?b.linewidth:1;this.linecap=b.linecap!==undefined?b.linecap:"round";this.linejoin=b.linejoin!==undefined?b.linejoin:"round";this.vertexColors=b.vertexColors?b.vertexColors:!1};THREE.LineBasicMaterial.prototype=new THREE.Material;THREE.LineBasicMaterial.prototype.constructor=THREE.LineBasicMaterial;
+THREE.MeshBasicMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.color=b.color!==undefined?new THREE.Color(b.color):new THREE.Color(16777215);this.map=b.map!==undefined?b.map:null;this.lightMap=b.lightMap!==undefined?b.lightMap:null;this.envMap=b.envMap!==undefined?b.envMap:null;this.combine=b.combine!==undefined?b.combine:THREE.MultiplyOperation;this.reflectivity=b.reflectivity!==undefined?b.reflectivity:1;this.refractionRatio=b.refractionRatio!==undefined?b.refractionRatio:0.98;this.shading=
+b.shading!==undefined?b.shading:THREE.SmoothShading;this.wireframe=b.wireframe!==undefined?b.wireframe:!1;this.wireframeLinewidth=b.wireframeLinewidth!==undefined?b.wireframeLinewidth:1;this.wireframeLinecap=b.wireframeLinecap!==undefined?b.wireframeLinecap:"round";this.wireframeLinejoin=b.wireframeLinejoin!==undefined?b.wireframeLinejoin:"round";this.vertexColors=b.vertexColors!==undefined?b.vertexColors:!1;this.skinning=b.skinning!==undefined?b.skinning:!1;this.morphTargets=b.morphTargets!==undefined?
+b.morphTargets:!1};THREE.MeshBasicMaterial.prototype=new THREE.Material;THREE.MeshBasicMaterial.prototype.constructor=THREE.MeshBasicMaterial;
+THREE.MeshLambertMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.color=b.color!==undefined?new THREE.Color(b.color):new THREE.Color(16777215);this.map=b.map!==undefined?b.map:null;this.lightMap=b.lightMap!==undefined?b.lightMap:null;this.envMap=b.envMap!==undefined?b.envMap:null;this.combine=b.combine!==undefined?b.combine:THREE.MultiplyOperation;this.reflectivity=b.reflectivity!==undefined?b.reflectivity:1;this.refractionRatio=b.refractionRatio!==undefined?b.refractionRatio:0.98;this.shading=
+b.shading!==undefined?b.shading:THREE.SmoothShading;this.wireframe=b.wireframe!==undefined?b.wireframe:!1;this.wireframeLinewidth=b.wireframeLinewidth!==undefined?b.wireframeLinewidth:1;this.wireframeLinecap=b.wireframeLinecap!==undefined?b.wireframeLinecap:"round";this.wireframeLinejoin=b.wireframeLinejoin!==undefined?b.wireframeLinejoin:"round";this.vertexColors=b.vertexColors!==undefined?b.vertexColors:!1;this.skinning=b.skinning!==undefined?b.skinning:!1;this.morphTargets=b.morphTargets!==undefined?
+b.morphTargets:!1};THREE.MeshLambertMaterial.prototype=new THREE.Material;THREE.MeshLambertMaterial.prototype.constructor=THREE.MeshLambertMaterial;
+THREE.MeshPhongMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.color=b.color!==undefined?new THREE.Color(b.color):new THREE.Color(16777215);this.ambient=b.ambient!==undefined?new THREE.Color(b.ambient):new THREE.Color(328965);this.specular=b.specular!==undefined?new THREE.Color(b.specular):new THREE.Color(1118481);this.shininess=b.shininess!==undefined?b.shininess:30;this.map=b.map!==undefined?b.map:null;this.lightMap=b.lightMap!==undefined?b.lightMap:null;this.envMap=b.envMap!==undefined?
+b.envMap:null;this.combine=b.combine!==undefined?b.combine:THREE.MultiplyOperation;this.reflectivity=b.reflectivity!==undefined?b.reflectivity:1;this.refractionRatio=b.refractionRatio!==undefined?b.refractionRatio:0.98;this.shading=b.shading!==undefined?b.shading:THREE.SmoothShading;this.wireframe=b.wireframe!==undefined?b.wireframe:!1;this.wireframeLinewidth=b.wireframeLinewidth!==undefined?b.wireframeLinewidth:1;this.wireframeLinecap=b.wireframeLinecap!==undefined?b.wireframeLinecap:"round";this.wireframeLinejoin=
+b.wireframeLinejoin!==undefined?b.wireframeLinejoin:"round";this.vertexColors=b.vertexColors!==undefined?b.vertexColors:!1;this.skinning=b.skinning!==undefined?b.skinning:!1;this.morphTargets=b.morphTargets!==undefined?b.morphTargets:!1};THREE.MeshPhongMaterial.prototype=new THREE.Material;THREE.MeshPhongMaterial.prototype.constructor=THREE.MeshPhongMaterial;
+THREE.MeshDepthMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.shading=b.shading!==undefined?b.shading:THREE.SmoothShading;this.wireframe=b.wireframe!==undefined?b.wireframe:!1;this.wireframeLinewidth=b.wireframeLinewidth!==undefined?b.wireframeLinewidth:1};THREE.MeshDepthMaterial.prototype=new THREE.Material;THREE.MeshDepthMaterial.prototype.constructor=THREE.MeshDepthMaterial;
+THREE.MeshNormalMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.shading=b.shading?b.shading:THREE.FlatShading;this.wireframe=b.wireframe?b.wireframe:!1;this.wireframeLinewidth=b.wireframeLinewidth?b.wireframeLinewidth:1};THREE.MeshNormalMaterial.prototype=new THREE.Material;THREE.MeshNormalMaterial.prototype.constructor=THREE.MeshNormalMaterial;THREE.MeshFaceMaterial=function(){};
+THREE.MeshShaderMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.fragmentShader=b.fragmentShader!==undefined?b.fragmentShader:"void main() {}";this.vertexShader=b.vertexShader!==undefined?b.vertexShader:"void main() {}";this.uniforms=b.uniforms!==undefined?b.uniforms:{};this.attributes=b.attributes;this.shading=b.shading!==undefined?b.shading:THREE.SmoothShading;this.wireframe=b.wireframe!==undefined?b.wireframe:!1;this.wireframeLinewidth=b.wireframeLinewidth!==undefined?b.wireframeLinewidth:
+1;this.lights=b.lights!==undefined?b.lights:!1;this.vertexColors=b.vertexColors!==undefined?b.vertexColors:!1;this.skinning=b.skinning!==undefined?b.skinning:!1;this.morphTargets=b.morphTargets!==undefined?b.morphTargets:!1};THREE.MeshShaderMaterial.prototype=new THREE.Material;THREE.MeshShaderMaterial.prototype.constructor=THREE.MeshShaderMaterial;
+THREE.ParticleBasicMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.color=b.color!==undefined?new THREE.Color(b.color):new THREE.Color(16777215);this.map=b.map!==undefined?b.map:null;this.size=b.size!==undefined?b.size:1;this.sizeAttenuation=b.sizeAttenuation!==undefined?b.sizeAttenuation:!0;this.vertexColors=b.vertexColors!==undefined?b.vertexColors:!1};THREE.ParticleBasicMaterial.prototype=new THREE.Material;THREE.ParticleBasicMaterial.prototype.constructor=THREE.ParticleBasicMaterial;
+THREE.ShadowVolumeDynamicMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.color=b.color!==undefined?new THREE.Color(b.color):new THREE.Color(16777215);this.map=b.map!==undefined?b.map:null;this.lightMap=b.lightMap!==undefined?b.lightMap:null;this.envMap=b.envMap!==undefined?b.envMap:null;this.combine=b.combine!==undefined?b.combine:THREE.MultiplyOperation;this.reflectivity=b.reflectivity!==undefined?b.reflectivity:1;this.refractionRatio=b.refractionRatio!==undefined?b.refractionRatio:
+0.98;this.shading=b.shading!==undefined?b.shading:THREE.SmoothShading;this.wireframe=b.wireframe!==undefined?b.wireframe:!1;this.wireframeLinewidth=b.wireframeLinewidth!==undefined?b.wireframeLinewidth:1;this.wireframeLinecap=b.wireframeLinecap!==undefined?b.wireframeLinecap:"round";this.wireframeLinejoin=b.wireframeLinejoin!==undefined?b.wireframeLinejoin:"round";this.vertexColors=b.vertexColors!==undefined?b.vertexColors:!1;this.skinning=b.skinning!==undefined?b.skinning:!1;this.morphTargets=b.morphTargets!==
+undefined?b.morphTargets:!1};THREE.ShadowVolumeDynamicMaterial.prototype=new THREE.Material;THREE.ShadowVolumeDynamicMaterial.prototype.constructor=THREE.ShadowVolumeDynamicMaterial;
+THREE.Texture=function(b,d,e,h,g,j){this.image=b;this.mapping=d!==undefined?d:new THREE.UVMapping;this.wrapS=e!==undefined?e:THREE.ClampToEdgeWrapping;this.wrapT=h!==undefined?h:THREE.ClampToEdgeWrapping;this.magFilter=g!==undefined?g:THREE.LinearFilter;this.minFilter=j!==undefined?j:THREE.LinearMipMapLinearFilter;this.needsUpdate=!1};THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter)}};
 THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;
-THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;var Uniforms={clone:function(a){var c,d,g,f={};for(c in a){f[c]={};for(d in a[c]){g=a[c][d];f[c][d]=g instanceof THREE.Color||g instanceof THREE.Vector3||g instanceof THREE.Texture?g.clone():g}}return f},merge:function(a){var c,d,g,f={};for(c=0;c<a.length;c++){g=this.clone(a[c]);for(d in g)f[d]=g[d]}return f}};
-THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.matrixAutoUpdate=!1};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.ParticleSystem=function(a,c){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.sortParticles=!1};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;
-THREE.Line=function(a,c,d){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];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,c){THREE.Object3D.call(this);this.geometry=a;this.materials=c&&c.length?c:[c];this.flipSided=!1;this.doubleSided=!1;this.overdraw=!1;if(this.geometry){this.geometry.boundingSphere||this.geometry.computeBoundingSphere();this.boundRadius=a.boundingSphere.radius;if(this.geometry.morphTargets.length){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var d=0;d<this.geometry.morphTargets.length;d++){this.morphTargetInfluences.push(0);
-this.morphTargetDictionary[this.geometry.morphTargets[d].name]=d}}}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;THREE.Mesh.prototype.getMorphTargetIndexByName=function(a){if(this.morphTargetDictionary[a]!==undefined)return this.morphTargetDictionary[a];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+a+" does not exist. Returning 0.");return 0};
-THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
-THREE.Bone.prototype.update=function(a,c,d){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate){a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;c=!0}var g,f=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(g=0;g<f;g++){a=this.children[g];a instanceof THREE.Bone?a.update(this.skinMatrix,c,d):a.update(this.matrixWorld,!0,d)}}else for(g=0;g<f;g++)this.children[g].update(this.skinMatrix,
-c,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,c){THREE.Mesh.call(this,a,c);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var d,g,f,i,j,o;if(this.geometry.bones!==undefined){for(d=0;d<this.geometry.bones.length;d++){f=this.geometry.bones[d];i=f.pos;j=f.rotq;o=f.scl;g=this.addBone();g.name=f.name;g.position.set(i[0],i[1],i[2]);g.quaternion.set(j[0],j[1],j[2],j[3]);g.useQuaternion=!0;o!==undefined?g.scale.set(o[0],o[1],o[2]):g.scale.set(1,1,1)}for(d=0;d<this.bones.length;d++){f=this.geometry.bones[d];
-g=this.bones[d];f.parent===-1?this.addChild(g):this.bones[f.parent].addChild(g)}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,c,d){if(this.visible){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;c=!0}var g,f=this.children.length;for(g=0;g<f;g++){a=this.children[g];a instanceof THREE.Bone?a.update(this.identityMatrix,!1,d):a.update(this.matrixWorld,c,d)}d=this.bones.length;ba=this.bones;bm=this.boneMatrices;for(c=0;c<d;c++)ba[c].skinMatrix.flattenToArrayOffset(bm,
-c*16)}};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,c=[],d=0;d<this.bones.length;d++){a=this.bones[d];c.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 g;for(a=0;a<this.geometry.skinIndices.length;a++){d=this.geometry.vertices[a].position;var f=this.geometry.skinIndices[a].x,i=this.geometry.skinIndices[a].y;
-g=new THREE.Vector3(d.x,d.y,d.z);this.geometry.skinVerticesA.push(c[f].multiplyVector3(g));g=new THREE.Vector3(d.x,d.y,d.z);this.geometry.skinVerticesB.push(c[i].multiplyVector3(g));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,c){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.flipSided=!1;this.doubleSided=!1};THREE.Ribbon.prototype=new THREE.Object3D;THREE.Ribbon.prototype.constructor=THREE.Ribbon;
-THREE.Sound=function(a,c,d,g){THREE.Object3D.call(this);this.isLoaded=!1;this.isAddedToDOM=!1;this.isPlaying=!1;this.duration=-1;this.radius=c!==undefined?Math.abs(c):100;this.volume=Math.min(1,Math.max(0,d!==undefined?d:1));this.domElement=document.createElement("audio");this.domElement.volume=0;this.domElement.pan=0;this.domElement.loop=g!==undefined?g:!0;this.sources=a instanceof Array?a:[a];var f;d=this.sources.length;for(a=0;a<d;a++){c=this.sources[a];c.toLowerCase();if(c.indexOf(".mp3")!==-1)f=
-"audio/mpeg";else if(c.indexOf(".ogg")!==-1)f="audio/ogg";else c.indexOf(".wav")!==-1&&(f="audio/wav");if(this.domElement.canPlayType(f)){f=document.createElement("source");f.src=this.sources[a];this.domElement.THREESound=this;this.domElement.appendChild(f);this.domElement.addEventListener("canplay",this.onLoad,!0);this.domElement.load();break}}};THREE.Sound.prototype=new THREE.Object3D;THREE.Sound.prototype.constructor=THREE.Sound;THREE.Sound.prototype.supr=THREE.Object3D.prototype;
-THREE.Sound.prototype.onLoad=function(){var a=this.THREESound;if(!a.isLoaded){this.removeEventListener("canplay",this.onLoad,!0);a.isLoaded=!0;a.duration=this.duration;a.isPlaying&&a.play()}};THREE.Sound.prototype.addToDOM=function(a){this.isAddedToDOM=!0;a.appendChild(this.domElement)};THREE.Sound.prototype.play=function(a){this.isPlaying=!0;if(this.isLoaded){this.domElement.play();if(a)this.domElement.currentTime=a%this.duration}};THREE.Sound.prototype.pause=function(){this.isPlaying=!1;this.domElement.pause()};
-THREE.Sound.prototype.stop=function(){this.isPlaying=!1;this.domElement.pause();this.domElement.currentTime=0};THREE.Sound.prototype.calculateVolumeAndPan=function(a){a=a.length();this.domElement.volume=a<=this.radius?this.volume*(1-a/this.radius):0};
-THREE.Sound.prototype.update=function(a,c,d){if(this.matrixAutoUpdate){this.matrix.setPosition(this.position);c=!0}if(c||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;c=!0}var g=this.children.length;for(a=0;a<g;a++)this.children[a].update(this.matrixWorld,c,d)};THREE.LOD=function(){THREE.Object3D.call(this);this.LODs=[]};THREE.LOD.prototype=new THREE.Object3D;THREE.LOD.prototype.constructor=THREE.LOD;
-THREE.LOD.prototype.supr=THREE.Object3D.prototype;THREE.LOD.prototype.add=function(a,c){c===undefined&&(c=0);c=Math.abs(c);for(var d=0;d<this.LODs.length;d++)if(c<this.LODs[d].visibleAtDistance)break;this.LODs.splice(d,0,{visibleAtDistance:c,object3D:a});this.addChild(a)};
-THREE.LOD.prototype.update=function(a,c,d){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;c=!0}if(this.LODs.length>1){a=d.matrixWorldInverse;a=-(a.n31*this.position.x+a.n32*this.position.y+a.n33*this.position.z+a.n34);this.LODs[0].object3D.visible=!0;for(var g=1;g<this.LODs.length;g++)if(a>=this.LODs[g].visibleAtDistance){this.LODs[g-1].object3D.visible=
-!1;this.LODs[g].object3D.visible=!0}else break;for(;g<this.LODs.length;g++)this.LODs[g].object3D.visible=!1}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,c,d)};THREE.ShadowVolume=function(a,c){THREE.Mesh.call(this,a.geometry,c?[new THREE.ShadowVolumeDynamicMaterial]:[new THREE.ShadowVolumeDynamicMaterial]);a.addChild(this);this.calculateShadowVolumeGeometry(a.geometry)};THREE.ShadowVolume.prototype=new THREE.Mesh;THREE.ShadowVolume.prototype.constructor=THREE.ShadowVolume;
+THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;var Uniforms={clone:function(b){var d,e,h,g={};for(d in b){g[d]={};for(e in b[d]){h=b[d][e];g[d][e]=h instanceof THREE.Color||h instanceof THREE.Vector3||h instanceof THREE.Texture?h.clone():h}}return g},merge:function(b){var d,e,h,g={};for(d=0;d<b.length;d++){h=this.clone(b[d]);for(e in h)g[e]=h[e]}return g}};
+THREE.Particle=function(b){THREE.Object3D.call(this);this.materials=b instanceof Array?b:[b];this.matrixAutoUpdate=!1};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.ParticleSystem=function(b,d){THREE.Object3D.call(this);this.geometry=b;this.materials=d instanceof Array?d:[d];this.sortParticles=!1};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;
+THREE.Line=function(b,d,e){THREE.Object3D.call(this);this.geometry=b;this.materials=d instanceof Array?d:[d];this.type=e!=undefined?e:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;
+THREE.Mesh=function(b,d){THREE.Object3D.call(this);this.geometry=b;this.materials=d&&d.length?d:[d];this.flipSided=!1;this.doubleSided=!1;this.overdraw=!1;if(this.geometry){this.geometry.boundingSphere||this.geometry.computeBoundingSphere();this.boundRadius=b.boundingSphere.radius;if(this.geometry.morphTargets.length){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var e=0;e<this.geometry.morphTargets.length;e++){this.morphTargetInfluences.push(0);
+this.morphTargetDictionary[this.geometry.morphTargets[e].name]=e}}}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;THREE.Mesh.prototype.getMorphTargetIndexByName=function(b){if(this.morphTargetDictionary[b]!==undefined)return this.morphTargetDictionary[b];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+b+" does not exist. Returning 0.");return 0};
+THREE.Bone=function(b){THREE.Object3D.call(this);this.skin=b;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
+THREE.Bone.prototype.update=function(b,d,e){this.matrixAutoUpdate&&(d|=this.updateMatrix());if(d||this.matrixWorldNeedsUpdate){b?this.skinMatrix.multiply(b,this.matrix):this.skinMatrix.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;d=!0}var h,g=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(h=0;h<g;h++){b=this.children[h];b instanceof THREE.Bone?b.update(this.skinMatrix,d,e):b.update(this.matrixWorld,!0,e)}}else for(h=0;h<g;h++)this.children[h].update(this.skinMatrix,
+d,e)};THREE.Bone.prototype.addChild=function(b){if(this.children.indexOf(b)===-1){b.parent!==undefined&&b.parent.removeChild(b);b.parent=this;this.children.push(b);if(!(b instanceof THREE.Bone))this.hasNoneBoneChildren=!0}};if(!window.Float32Array)window.Float32Array=Array;
+THREE.SkinnedMesh=function(b,d){THREE.Mesh.call(this,b,d);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var e,h,g,j,k,p;if(this.geometry.bones!==undefined){for(e=0;e<this.geometry.bones.length;e++){g=this.geometry.bones[e];j=g.pos;k=g.rotq;p=g.scl;h=this.addBone();h.name=g.name;h.position.set(j[0],j[1],j[2]);h.quaternion.set(k[0],k[1],k[2],k[3]);h.useQuaternion=!0;p!==undefined?h.scale.set(p[0],p[1],p[2]):h.scale.set(1,1,1)}for(e=0;e<this.bones.length;e++){g=this.geometry.bones[e];
+h=this.bones[e];g.parent===-1?this.addChild(h):this.bones[g.parent].addChild(h)}this.boneMatrices=new Float32Array(16*this.bones.length);this.pose()}};THREE.SkinnedMesh.prototype=new THREE.Mesh;THREE.SkinnedMesh.prototype.constructor=THREE.SkinnedMesh;
+THREE.SkinnedMesh.prototype.update=function(b,d,e){if(this.visible){this.matrixAutoUpdate&&(d|=this.updateMatrix());if(d||this.matrixWorldNeedsUpdate){b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;d=!0}var h,g=this.children.length;for(h=0;h<g;h++){b=this.children[h];b instanceof THREE.Bone?b.update(this.identityMatrix,!1,e):b.update(this.matrixWorld,d,e)}e=this.bones.length;ba=this.bones;bm=this.boneMatrices;for(d=0;d<e;d++)ba[d].skinMatrix.flattenToArrayOffset(bm,
+d*16)}};THREE.SkinnedMesh.prototype.addBone=function(b){b===undefined&&(b=new THREE.Bone(this));this.bones.push(b);return b};
+THREE.SkinnedMesh.prototype.pose=function(){this.update(undefined,!0);for(var b,d=[],e=0;e<this.bones.length;e++){b=this.bones[e];d.push(THREE.Matrix4.makeInvert(b.skinMatrix));b.skinMatrix.flattenToArrayOffset(this.boneMatrices,e*16)}if(this.geometry.skinVerticesA===undefined){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];var h;for(b=0;b<this.geometry.skinIndices.length;b++){e=this.geometry.vertices[b].position;var g=this.geometry.skinIndices[b].x,j=this.geometry.skinIndices[b].y;
+h=new THREE.Vector3(e.x,e.y,e.z);this.geometry.skinVerticesA.push(d[g].multiplyVector3(h));h=new THREE.Vector3(e.x,e.y,e.z);this.geometry.skinVerticesB.push(d[j].multiplyVector3(h));if(this.geometry.skinWeights[b].x+this.geometry.skinWeights[b].y!==1){e=(1-(this.geometry.skinWeights[b].x+this.geometry.skinWeights[b].y))*0.5;this.geometry.skinWeights[b].x+=e;this.geometry.skinWeights[b].y+=e}}}};
+THREE.Ribbon=function(b,d){THREE.Object3D.call(this);this.geometry=b;this.materials=d instanceof Array?d:[d];this.flipSided=!1;this.doubleSided=!1};THREE.Ribbon.prototype=new THREE.Object3D;THREE.Ribbon.prototype.constructor=THREE.Ribbon;
+THREE.Sound=function(b,d,e,h){THREE.Object3D.call(this);this.isLoaded=!1;this.isAddedToDOM=!1;this.isPlaying=!1;this.duration=-1;this.radius=d!==undefined?Math.abs(d):100;this.volume=Math.min(1,Math.max(0,e!==undefined?e:1));this.domElement=document.createElement("audio");this.domElement.volume=0;this.domElement.pan=0;this.domElement.loop=h!==undefined?h:!0;this.sources=b instanceof Array?b:[b];var g;e=this.sources.length;for(b=0;b<e;b++){d=this.sources[b];d.toLowerCase();if(d.indexOf(".mp3")!==-1)g=
+"audio/mpeg";else if(d.indexOf(".ogg")!==-1)g="audio/ogg";else d.indexOf(".wav")!==-1&&(g="audio/wav");if(this.domElement.canPlayType(g)){g=document.createElement("source");g.src=this.sources[b];this.domElement.THREESound=this;this.domElement.appendChild(g);this.domElement.addEventListener("canplay",this.onLoad,!0);this.domElement.load();break}}};THREE.Sound.prototype=new THREE.Object3D;THREE.Sound.prototype.constructor=THREE.Sound;THREE.Sound.prototype.supr=THREE.Object3D.prototype;
+THREE.Sound.prototype.onLoad=function(){var b=this.THREESound;if(!b.isLoaded){this.removeEventListener("canplay",this.onLoad,!0);b.isLoaded=!0;b.duration=this.duration;b.isPlaying&&b.play()}};THREE.Sound.prototype.addToDOM=function(b){this.isAddedToDOM=!0;b.appendChild(this.domElement)};THREE.Sound.prototype.play=function(b){this.isPlaying=!0;if(this.isLoaded){this.domElement.play();if(b)this.domElement.currentTime=b%this.duration}};THREE.Sound.prototype.pause=function(){this.isPlaying=!1;this.domElement.pause()};
+THREE.Sound.prototype.stop=function(){this.isPlaying=!1;this.domElement.pause();this.domElement.currentTime=0};THREE.Sound.prototype.calculateVolumeAndPan=function(b){b=b.length();this.domElement.volume=b<=this.radius?this.volume*(1-b/this.radius):0};
+THREE.Sound.prototype.update=function(b,d,e){if(this.matrixAutoUpdate){this.matrix.setPosition(this.position);d=!0}if(d||this.matrixWorldNeedsUpdate){b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;d=!0}var h=this.children.length;for(b=0;b<h;b++)this.children[b].update(this.matrixWorld,d,e)};THREE.LOD=function(){THREE.Object3D.call(this);this.LODs=[]};THREE.LOD.prototype=new THREE.Object3D;THREE.LOD.prototype.constructor=THREE.LOD;
+THREE.LOD.prototype.supr=THREE.Object3D.prototype;THREE.LOD.prototype.add=function(b,d){d===undefined&&(d=0);d=Math.abs(d);for(var e=0;e<this.LODs.length;e++)if(d<this.LODs[e].visibleAtDistance)break;this.LODs.splice(e,0,{visibleAtDistance:d,object3D:b});this.addChild(b)};
+THREE.LOD.prototype.update=function(b,d,e){this.matrixAutoUpdate&&(d|=this.updateMatrix());if(d||this.matrixWorldNeedsUpdate){b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;d=!0}if(this.LODs.length>1){b=e.matrixWorldInverse;b=-(b.n31*this.position.x+b.n32*this.position.y+b.n33*this.position.z+b.n34);this.LODs[0].object3D.visible=!0;for(var h=1;h<this.LODs.length;h++)if(b>=this.LODs[h].visibleAtDistance){this.LODs[h-1].object3D.visible=
+!1;this.LODs[h].object3D.visible=!0}else break;for(;h<this.LODs.length;h++)this.LODs[h].object3D.visible=!1}for(b=0;b<this.children.length;b++)this.children[b].update(this.matrixWorld,d,e)};THREE.ShadowVolume=function(b,d){THREE.Mesh.call(this,b.geometry,d?[new THREE.ShadowVolumeDynamicMaterial]:[new THREE.ShadowVolumeDynamicMaterial]);b.addChild(this);this.calculateShadowVolumeGeometry(b.geometry)};THREE.ShadowVolume.prototype=new THREE.Mesh;THREE.ShadowVolume.prototype.constructor=THREE.ShadowVolume;
 THREE.ShadowVolume.prototype.supr=THREE.Mesh.prototype;
-THREE.ShadowVolume.prototype.calculateShadowVolumeGeometry=function(a){this.geometry=new THREE.Geometry;this.geometry.boundingSphere=a.boundingSphere;this.geometry.edgeFaces=[];var c=this.geometry.vertices,d=this.geometry.faces,g=this.geometry.edgeFaces,f=a.faces;a=a.vertices;var i=f.length,j,o,p,v,x,y=["a","b","c","d"];for(p=0;p<i;p++){o=c.length;j=f[p];if(j instanceof THREE.Face4){v=4;o=new THREE.Face4(o,o+1,o+2,o+3)}else{v=3;o=new THREE.Face3(o,o+1,o+2)}o.normal.copy(j.normal);d.push(o);for(o=
-0;o<v;o++){x=a[j[y[o]]];c.push(new THREE.Vertex(x.position.clone()))}}for(i=0;i<f.length-1;i++){a=d[i];for(j=i+1;j<f.length;j++){o=d[j];o=this.facesShareEdge(c,a,o);if(o!==undefined){o=new THREE.Face4(o.indices[0],o.indices[3],o.indices[2],o.indices[1]);o.normal.set(1,0,0);g.push(o)}}}};
-THREE.ShadowVolume.prototype.facesShareEdge=function(a,c,d){var g,f,i,j,o,p,v,x,y,D,z,K,M,T=0,O=["a","b","c","d"];g=c instanceof THREE.Face4?4:3;f=d instanceof THREE.Face4?4:3;for(K=0;K<g;K++){i=c[O[K]];o=a[i];for(M=0;M<f;M++){j=d[O[M]];p=a[j];if(Math.abs(o.position.x-p.position.x)<1.0E-4&&Math.abs(o.position.y-p.position.y)<1.0E-4&&Math.abs(o.position.z-p.position.z)<1.0E-4){T++;if(T===1){v=o;x=p;y=i;D=j;z=O[K]}if(T===2){z+=O[K];return z==="ad"||z==="ac"?{faces:[c,d],vertices:[v,x,p,o],indices:[y,
-D,j,i],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[c,d],vertices:[v,o,p,x],indices:[y,i,j,D],vertexTypes:[1,1,2,2],extrudable:!0}}}}}};THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.fog=null;this.objects=[];this.lights=[];this.sounds=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;
-THREE.Scene.prototype.addChild=function(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 if(a instanceof THREE.Sound)this.sounds.indexOf(a)===-1&&this.sounds.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a)}for(var c=0;c<a.children.length;c++)this.addChildRecurse(a.children[c])};
-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 c=this.lights.indexOf(a);c!==-1&&this.lights.splice(c,1)}else if(a instanceof THREE.Sound){c=this.sounds.indexOf(a);c!==-1&&this.sounds.splice(c,1)}else if(!(a instanceof THREE.Camera)){c=this.objects.indexOf(a);if(c!==-1){this.objects.splice(c,1);this.__objectsRemoved.push(a)}}for(c=0;c<a.children.length;c++)this.removeChildRecurse(a.children[c])};
-THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;THREE.Fog=function(a,c,d){this.color=new THREE.Color(a);this.near=c||1;this.far=d||1E3};THREE.FogExp2=function(a,c){this.color=new THREE.Color(a);this.density=c!==undefined?c:2.5E-4};
-THREE.Projector=function(){function a(){var b=p[o]=p[o]||new THREE.RenderableVertex;o++;return b}function c(b,Q){return Q.z-b.z}function d(b,Q){var la=0,Ba=1,Ca=b.z+b.w,ta=Q.z+Q.w,W=-b.z+b.w,na=-Q.z+Q.w;if(Ca>=0&&ta>=0&&W>=0&&na>=0)return!0;else if(Ca<0&&ta<0||W<0&&na<0)return!1;else{if(Ca<0)la=Math.max(la,Ca/(Ca-ta));else ta<0&&(Ba=Math.min(Ba,Ca/(Ca-ta)));if(W<0)la=Math.max(la,W/(W-na));else na<0&&(Ba=Math.min(Ba,W/(W-na)));if(Ba<la)return!1;else{b.lerpSelf(Q,la);Q.lerpSelf(b,1-Ba);return!0}}}var g,
-f,i=[],j,o,p=[],v,x,y=[],D,z=[],K,M,T=[],O,pa,Y=[],qa=new THREE.Vector4,V=new THREE.Vector4,E=new THREE.Matrix4,Fa=new THREE.Matrix4,ka=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Da=new THREE.Vector4,$=new THREE.Vector4;this.projectVector=function(b,Q){E.multiply(Q.projectionMatrix,Q.matrixWorldInverse);E.multiplyVector3(b);return b};this.unprojectVector=function(b,Q){E.multiply(Q.matrixWorld,THREE.Matrix4.makeInvert(Q.projectionMatrix));
-E.multiplyVector3(b);return b};this.projectObjects=function(b,Q,la){Q=[];var Ba,Ca,ta;f=0;Ca=b.objects;b=0;for(Ba=Ca.length;b<Ba;b++){ta=Ca[b];var W;if(!(W=!ta.visible))if(W=ta instanceof THREE.Mesh){a:{W=void 0;for(var na=ta.matrixWorld,aa=-ta.geometry.boundingSphere.radius*Math.max(ta.scale.x,Math.max(ta.scale.y,ta.scale.z)),oa=0;oa<6;oa++){W=ka[oa].x*na.n14+ka[oa].y*na.n24+ka[oa].z*na.n34+ka[oa].w;if(W<=aa){W=!1;break a}}W=!0}W=!W}if(!W){W=i[f]=i[f]||new THREE.RenderableObject;f++;g=W;qa.copy(ta.position);
-E.multiplyVector3(qa);g.object=ta;g.z=qa.z;Q.push(g)}}la&&Q.sort(c);return Q};this.projectScene=function(b,Q,la){var Ba=[],Ca=Q.near,ta=Q.far,W,na,aa,oa,U,ra,ma,xa,ua,ca,La,Qa,Ra,cb,Na,ab,Ta;pa=M=D=x=0;Q.matrixAutoUpdate&&Q.updateMatrix();b.update(undefined,!1,Q);E.multiply(Q.projectionMatrix,Q.matrixWorldInverse);ka[0].set(E.n41-E.n11,E.n42-E.n12,E.n43-E.n13,E.n44-E.n14);ka[1].set(E.n41+E.n11,E.n42+E.n12,E.n43+E.n13,E.n44+E.n14);ka[2].set(E.n41+E.n21,E.n42+E.n22,E.n43+E.n23,E.n44+E.n24);ka[3].set(E.n41-
-E.n21,E.n42-E.n22,E.n43-E.n23,E.n44-E.n24);ka[4].set(E.n41-E.n31,E.n42-E.n32,E.n43-E.n33,E.n44-E.n34);ka[5].set(E.n41+E.n31,E.n42+E.n32,E.n43+E.n33,E.n44+E.n34);for(W=0;W<6;W++){ua=ka[W];ua.divideScalar(Math.sqrt(ua.x*ua.x+ua.y*ua.y+ua.z*ua.z))}ua=this.projectObjects(b,Q,!0);b=0;for(W=ua.length;b<W;b++){ca=ua[b].object;if(ca.visible){La=ca.matrixWorld;Qa=ca.matrixRotationWorld;Ra=ca.materials;cb=ca.overdraw;o=0;if(ca instanceof THREE.Mesh){Na=ca.geometry;oa=Na.vertices;ab=Na.faces;Na=Na.faceVertexUvs;
-na=0;for(aa=oa.length;na<aa;na++){j=a();j.positionWorld.copy(oa[na].position);La.multiplyVector3(j.positionWorld);j.positionScreen.copy(j.positionWorld);E.multiplyVector4(j.positionScreen);j.positionScreen.x/=j.positionScreen.w;j.positionScreen.y/=j.positionScreen.w;j.visible=j.positionScreen.z>Ca&&j.positionScreen.z<ta}oa=0;for(na=ab.length;oa<na;oa++){aa=ab[oa];if(aa instanceof THREE.Face3){U=p[aa.a];ra=p[aa.b];ma=p[aa.c];if(U.visible&&ra.visible&&ma.visible&&(ca.doubleSided||ca.flipSided!=(ma.positionScreen.x-
-U.positionScreen.x)*(ra.positionScreen.y-U.positionScreen.y)-(ma.positionScreen.y-U.positionScreen.y)*(ra.positionScreen.x-U.positionScreen.x)<0)){xa=y[x]=y[x]||new THREE.RenderableFace3;x++;v=xa;v.v1.copy(U);v.v2.copy(ra);v.v3.copy(ma)}else continue}else if(aa instanceof THREE.Face4){U=p[aa.a];ra=p[aa.b];ma=p[aa.c];xa=p[aa.d];if(U.visible&&ra.visible&&ma.visible&&xa.visible&&(ca.doubleSided||ca.flipSided!=((xa.positionScreen.x-U.positionScreen.x)*(ra.positionScreen.y-U.positionScreen.y)-(xa.positionScreen.y-
-U.positionScreen.y)*(ra.positionScreen.x-U.positionScreen.x)<0||(ra.positionScreen.x-ma.positionScreen.x)*(xa.positionScreen.y-ma.positionScreen.y)-(ra.positionScreen.y-ma.positionScreen.y)*(xa.positionScreen.x-ma.positionScreen.x)<0))){Ta=z[D]=z[D]||new THREE.RenderableFace4;D++;v=Ta;v.v1.copy(U);v.v2.copy(ra);v.v3.copy(ma);v.v4.copy(xa)}else continue}v.normalWorld.copy(aa.normal);Qa.multiplyVector3(v.normalWorld);v.centroidWorld.copy(aa.centroid);La.multiplyVector3(v.centroidWorld);v.centroidScreen.copy(v.centroidWorld);
-E.multiplyVector3(v.centroidScreen);ma=aa.vertexNormals;U=0;for(ra=ma.length;U<ra;U++){xa=v.vertexNormalsWorld[U];xa.copy(ma[U]);Qa.multiplyVector3(xa)}U=0;for(ra=Na.length;U<ra;U++)if(Ta=Na[U][oa]){ma=0;for(xa=Ta.length;ma<xa;ma++)v.uvs[U][ma]=Ta[ma]}v.meshMaterials=Ra;v.faceMaterials=aa.materials;v.overdraw=cb;v.z=v.centroidScreen.z;Ba.push(v)}}else if(ca instanceof THREE.Line){Fa.multiply(E,La);oa=ca.geometry.vertices;U=a();U.positionScreen.copy(oa[0].position);Fa.multiplyVector4(U.positionScreen);
-na=1;for(aa=oa.length;na<aa;na++){U=a();U.positionScreen.copy(oa[na].position);Fa.multiplyVector4(U.positionScreen);ra=p[o-2];Da.copy(U.positionScreen);$.copy(ra.positionScreen);if(d(Da,$)){Da.multiplyScalar(1/Da.w);$.multiplyScalar(1/$.w);La=T[M]=T[M]||new THREE.RenderableLine;M++;K=La;K.v1.positionScreen.copy(Da);K.v2.positionScreen.copy($);K.z=Math.max(Da.z,$.z);K.materials=ca.materials;Ba.push(K)}}}else if(ca instanceof THREE.Particle){V.set(ca.position.x,ca.position.y,ca.position.z,1);E.multiplyVector4(V);
-V.z/=V.w;if(V.z>0&&V.z<1){La=Y[pa]=Y[pa]||new THREE.RenderableParticle;pa++;O=La;O.x=V.x/V.w;O.y=V.y/V.w;O.z=V.z;O.rotation=ca.rotation.z;O.scale.x=ca.scale.x*Math.abs(O.x-(V.x+Q.projectionMatrix.n11)/(V.w+Q.projectionMatrix.n14));O.scale.y=ca.scale.y*Math.abs(O.y-(V.y+Q.projectionMatrix.n22)/(V.w+Q.projectionMatrix.n24));O.materials=ca.materials;Ba.push(O)}}}}la&&Ba.sort(c);return Ba}};
-THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(a,c,d){d&&a.update(undefined,!1,c);d=a.sounds;var g,f=d.length;for(g=0;g<f;g++){a=d[g];this.soundPosition.set(a.matrixWorld.n14,a.matrixWorld.n24,a.matrixWorld.n34);this.soundPosition.subSelf(c.position);if(a.isPlaying&&a.isLoaded){a.isAddedToDOM||a.addToDOM(this.domElement);a.calculateVolumeAndPan(this.soundPosition)}}}};
+THREE.ShadowVolume.prototype.calculateShadowVolumeGeometry=function(b){this.geometry=new THREE.Geometry;this.geometry.boundingSphere=b.boundingSphere;this.geometry.edgeFaces=[];var d=this.geometry.vertices,e=this.geometry.faces,h=this.geometry.edgeFaces,g=b.faces;b=b.vertices;var j=g.length,k,p,q,v,C,F=["a","b","c","d"];for(q=0;q<j;q++){p=d.length;k=g[q];if(k instanceof THREE.Face4){v=4;p=new THREE.Face4(p,p+1,p+2,p+3)}else{v=3;p=new THREE.Face3(p,p+1,p+2)}p.normal.copy(k.normal);e.push(p);for(p=
+0;p<v;p++){C=b[k[F[p]]];d.push(new THREE.Vertex(C.position.clone()))}}for(j=0;j<g.length-1;j++){b=e[j];for(k=j+1;k<g.length;k++){p=e[k];p=this.facesShareEdge(d,b,p);if(p!==undefined){p=new THREE.Face4(p.indices[0],p.indices[3],p.indices[2],p.indices[1]);p.normal.set(1,0,0);h.push(p)}}}};
+THREE.ShadowVolume.prototype.facesShareEdge=function(b,d,e){var h,g,j,k,p,q,v,C,F,J,G,N,O,W=0,P=["a","b","c","d"];h=d instanceof THREE.Face4?4:3;g=e instanceof THREE.Face4?4:3;for(N=0;N<h;N++){j=d[P[N]];p=b[j];for(O=0;O<g;O++){k=e[P[O]];q=b[k];if(Math.abs(p.position.x-q.position.x)<1.0E-4&&Math.abs(p.position.y-q.position.y)<1.0E-4&&Math.abs(p.position.z-q.position.z)<1.0E-4){W++;if(W===1){v=p;C=q;F=j;J=k;G=P[N]}if(W===2){G+=P[N];return G==="ad"||G==="ac"?{faces:[d,e],vertices:[v,C,q,p],indices:[F,
+J,k,j],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[d,e],vertices:[v,p,q,C],indices:[F,j,k,J],vertexTypes:[1,1,2,2],extrudable:!0}}}}}};THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.fog=null;this.objects=[];this.lights=[];this.sounds=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;
+THREE.Scene.prototype.addChild=function(b){this.supr.addChild.call(this,b);this.addChildRecurse(b)};THREE.Scene.prototype.addChildRecurse=function(b){if(b instanceof THREE.Light)this.lights.indexOf(b)===-1&&this.lights.push(b);else if(b instanceof THREE.Sound)this.sounds.indexOf(b)===-1&&this.sounds.push(b);else if(!(b instanceof THREE.Camera||b instanceof THREE.Bone)&&this.objects.indexOf(b)===-1){this.objects.push(b);this.__objectsAdded.push(b)}for(var d=0;d<b.children.length;d++)this.addChildRecurse(b.children[d])};
+THREE.Scene.prototype.removeChild=function(b){this.supr.removeChild.call(this,b);this.removeChildRecurse(b)};THREE.Scene.prototype.removeChildRecurse=function(b){if(b instanceof THREE.Light){var d=this.lights.indexOf(b);d!==-1&&this.lights.splice(d,1)}else if(b instanceof THREE.Sound){d=this.sounds.indexOf(b);d!==-1&&this.sounds.splice(d,1)}else if(!(b instanceof THREE.Camera)){d=this.objects.indexOf(b);if(d!==-1){this.objects.splice(d,1);this.__objectsRemoved.push(b)}}for(d=0;d<b.children.length;d++)this.removeChildRecurse(b.children[d])};
+THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;THREE.Fog=function(b,d,e){this.color=new THREE.Color(b);this.near=d||1;this.far=e||1E3};THREE.FogExp2=function(b,d){this.color=new THREE.Color(b);this.density=d!==undefined?d:2.5E-4};
+THREE.Projector=function(){function b(){var c=q[p]=q[p]||new THREE.RenderableVertex;p++;return c}function d(c,S){return S.z-c.z}function e(c,S){var ma=0,Da=1,Ea=c.z+c.w,wa=S.z+S.w,$=-c.z+c.w,oa=-S.z+S.w;if(Ea>=0&&wa>=0&&$>=0&&oa>=0)return!0;else if(Ea<0&&wa<0||$<0&&oa<0)return!1;else{if(Ea<0)ma=Math.max(ma,Ea/(Ea-wa));else wa<0&&(Da=Math.min(Da,Ea/(Ea-wa)));if($<0)ma=Math.max(ma,$/($-oa));else oa<0&&(Da=Math.min(Da,$/($-oa)));if(Da<ma)return!1;else{c.lerpSelf(S,ma);S.lerpSelf(c,1-Da);return!0}}}var h,
+g,j=[],k,p,q=[],v,C,F=[],J,G=[],N,O,W=[],P,ra,aa=[],sa=new THREE.Vector4,Z=new THREE.Vector4,K=new THREE.Matrix4,Ia=new THREE.Matrix4,la=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Ga=new THREE.Vector4,da=new THREE.Vector4;this.projectVector=function(c,S){K.multiply(S.projectionMatrix,S.matrixWorldInverse);K.multiplyVector3(c);return c};this.unprojectVector=function(c,S){K.multiply(S.matrixWorld,THREE.Matrix4.makeInvert(S.projectionMatrix));
+K.multiplyVector3(c);return c};this.projectObjects=function(c,S,ma){S=[];var Da,Ea,wa;g=0;Ea=c.objects;c=0;for(Da=Ea.length;c<Da;c++){wa=Ea[c];var $;if(!($=!wa.visible))if($=wa instanceof THREE.Mesh){a:{$=void 0;for(var oa=wa.matrixWorld,ea=-wa.geometry.boundingSphere.radius*Math.max(wa.scale.x,Math.max(wa.scale.y,wa.scale.z)),pa=0;pa<6;pa++){$=la[pa].x*oa.n14+la[pa].y*oa.n24+la[pa].z*oa.n34+la[pa].w;if($<=ea){$=!1;break a}}$=!0}$=!$}if(!$){$=j[g]=j[g]||new THREE.RenderableObject;g++;h=$;sa.copy(wa.position);
+K.multiplyVector3(sa);h.object=wa;h.z=sa.z;S.push(h)}}ma&&S.sort(d);return S};this.projectScene=function(c,S,ma){var Da=[],Ea=S.near,wa=S.far,$,oa,ea,pa,X,ua,na,Aa,xa,fa,Oa,Ta,Ua,gb,Qa,eb,Wa;ra=O=J=C=0;S.matrixAutoUpdate&&S.updateMatrix();c.update(undefined,!1,S);K.multiply(S.projectionMatrix,S.matrixWorldInverse);la[0].set(K.n41-K.n11,K.n42-K.n12,K.n43-K.n13,K.n44-K.n14);la[1].set(K.n41+K.n11,K.n42+K.n12,K.n43+K.n13,K.n44+K.n14);la[2].set(K.n41+K.n21,K.n42+K.n22,K.n43+K.n23,K.n44+K.n24);la[3].set(K.n41-
+K.n21,K.n42-K.n22,K.n43-K.n23,K.n44-K.n24);la[4].set(K.n41-K.n31,K.n42-K.n32,K.n43-K.n33,K.n44-K.n34);la[5].set(K.n41+K.n31,K.n42+K.n32,K.n43+K.n33,K.n44+K.n34);for($=0;$<6;$++){xa=la[$];xa.divideScalar(Math.sqrt(xa.x*xa.x+xa.y*xa.y+xa.z*xa.z))}xa=this.projectObjects(c,S,!0);c=0;for($=xa.length;c<$;c++){fa=xa[c].object;if(fa.visible){Oa=fa.matrixWorld;Ta=fa.matrixRotationWorld;Ua=fa.materials;gb=fa.overdraw;p=0;if(fa instanceof THREE.Mesh){Qa=fa.geometry;pa=Qa.vertices;eb=Qa.faces;Qa=Qa.faceVertexUvs;
+oa=0;for(ea=pa.length;oa<ea;oa++){k=b();k.positionWorld.copy(pa[oa].position);Oa.multiplyVector3(k.positionWorld);k.positionScreen.copy(k.positionWorld);K.multiplyVector4(k.positionScreen);k.positionScreen.x/=k.positionScreen.w;k.positionScreen.y/=k.positionScreen.w;k.visible=k.positionScreen.z>Ea&&k.positionScreen.z<wa}pa=0;for(oa=eb.length;pa<oa;pa++){ea=eb[pa];if(ea instanceof THREE.Face3){X=q[ea.a];ua=q[ea.b];na=q[ea.c];if(X.visible&&ua.visible&&na.visible&&(fa.doubleSided||fa.flipSided!=(na.positionScreen.x-
+X.positionScreen.x)*(ua.positionScreen.y-X.positionScreen.y)-(na.positionScreen.y-X.positionScreen.y)*(ua.positionScreen.x-X.positionScreen.x)<0)){Aa=F[C]=F[C]||new THREE.RenderableFace3;C++;v=Aa;v.v1.copy(X);v.v2.copy(ua);v.v3.copy(na)}else continue}else if(ea instanceof THREE.Face4){X=q[ea.a];ua=q[ea.b];na=q[ea.c];Aa=q[ea.d];if(X.visible&&ua.visible&&na.visible&&Aa.visible&&(fa.doubleSided||fa.flipSided!=((Aa.positionScreen.x-X.positionScreen.x)*(ua.positionScreen.y-X.positionScreen.y)-(Aa.positionScreen.y-
+X.positionScreen.y)*(ua.positionScreen.x-X.positionScreen.x)<0||(ua.positionScreen.x-na.positionScreen.x)*(Aa.positionScreen.y-na.positionScreen.y)-(ua.positionScreen.y-na.positionScreen.y)*(Aa.positionScreen.x-na.positionScreen.x)<0))){Wa=G[J]=G[J]||new THREE.RenderableFace4;J++;v=Wa;v.v1.copy(X);v.v2.copy(ua);v.v3.copy(na);v.v4.copy(Aa)}else continue}v.normalWorld.copy(ea.normal);Ta.multiplyVector3(v.normalWorld);v.centroidWorld.copy(ea.centroid);Oa.multiplyVector3(v.centroidWorld);v.centroidScreen.copy(v.centroidWorld);
+K.multiplyVector3(v.centroidScreen);na=ea.vertexNormals;X=0;for(ua=na.length;X<ua;X++){Aa=v.vertexNormalsWorld[X];Aa.copy(na[X]);Ta.multiplyVector3(Aa)}X=0;for(ua=Qa.length;X<ua;X++)if(Wa=Qa[X][pa]){na=0;for(Aa=Wa.length;na<Aa;na++)v.uvs[X][na]=Wa[na]}v.meshMaterials=Ua;v.faceMaterials=ea.materials;v.overdraw=gb;v.z=v.centroidScreen.z;Da.push(v)}}else if(fa instanceof THREE.Line){Ia.multiply(K,Oa);pa=fa.geometry.vertices;X=b();X.positionScreen.copy(pa[0].position);Ia.multiplyVector4(X.positionScreen);
+oa=1;for(ea=pa.length;oa<ea;oa++){X=b();X.positionScreen.copy(pa[oa].position);Ia.multiplyVector4(X.positionScreen);ua=q[p-2];Ga.copy(X.positionScreen);da.copy(ua.positionScreen);if(e(Ga,da)){Ga.multiplyScalar(1/Ga.w);da.multiplyScalar(1/da.w);Oa=W[O]=W[O]||new THREE.RenderableLine;O++;N=Oa;N.v1.positionScreen.copy(Ga);N.v2.positionScreen.copy(da);N.z=Math.max(Ga.z,da.z);N.materials=fa.materials;Da.push(N)}}}else if(fa instanceof THREE.Particle){Z.set(fa.position.x,fa.position.y,fa.position.z,1);
+K.multiplyVector4(Z);Z.z/=Z.w;if(Z.z>0&&Z.z<1){Oa=aa[ra]=aa[ra]||new THREE.RenderableParticle;ra++;P=Oa;P.x=Z.x/Z.w;P.y=Z.y/Z.w;P.z=Z.z;P.rotation=fa.rotation.z;P.scale.x=fa.scale.x*Math.abs(P.x-(Z.x+S.projectionMatrix.n11)/(Z.w+S.projectionMatrix.n14));P.scale.y=fa.scale.y*Math.abs(P.y-(Z.y+S.projectionMatrix.n22)/(Z.w+S.projectionMatrix.n24));P.materials=fa.materials;Da.push(P)}}}}ma&&Da.sort(d);return Da}};
+THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(b,d,e){e&&b.update(undefined,!1,d);e=b.sounds;var h,g=e.length;for(h=0;h<g;h++){b=e[h];this.soundPosition.set(b.matrixWorld.n14,b.matrixWorld.n24,b.matrixWorld.n34);this.soundPosition.subSelf(d.position);if(b.isPlaying&&b.isLoaded){b.isAddedToDOM||b.addToDOM(this.domElement);b.calculateVolumeAndPan(this.soundPosition)}}}};
 THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",
 envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform int combine;\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",
 envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",
@@ -175,97 +175,103 @@ THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.
 vertexShader:["#define PHONG\nvarying vec3 vLightWeighting;\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.lights_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,
 THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.color_vertex,"#ifndef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\n#endif\nvViewPosition = cameraPosition - mPosition.xyz;\nvec3 transformedNormal = normalize( normalMatrix * normal );\nvNormal = transformedNormal;",THREE.ShaderChunk.lights_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsLib.particle,fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",
 THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["uniform float size;\nuniform float scale;",THREE.ShaderChunk.color_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;\n}"].join("\n")}};
-THREE.WebGLRenderer=function(a){function c(e,m,k){var h,n,u,r=e.vertices,t=r.length,q=e.colors,A=q.length,s=e.__vertexArray,G=e.__colorArray,B=e.__sortArray,L=e.__dirtyVertices,I=e.__dirtyColors;if(k.sortParticles){ca.multiplySelf(k.matrixWorld);for(h=0;h<t;h++){n=r[h].position;Ra.copy(n);ca.multiplyVector3(Ra);B[h]=[Ra.z,h]}B.sort(function(P,N){return N[0]-P[0]});for(h=0;h<t;h++){n=r[B[h][1]].position;u=h*3;s[u]=n.x;s[u+1]=n.y;s[u+2]=n.z}for(h=0;h<A;h++){u=h*3;color=q[B[h][1]];G[u]=color.r;G[u+1]=
-color.g;G[u+2]=color.b}}else{if(L)for(h=0;h<t;h++){n=r[h].position;u=h*3;s[u]=n.x;s[u+1]=n.y;s[u+2]=n.z}if(I)for(h=0;h<A;h++){color=q[h];u=h*3;G[u]=color.r;G[u+1]=color.g;G[u+2]=color.b}}if(L||k.sortParticles){b.bindBuffer(b.ARRAY_BUFFER,e.__webglVertexBuffer);b.bufferData(b.ARRAY_BUFFER,s,m)}if(I||k.sortParticles){b.bindBuffer(b.ARRAY_BUFFER,e.__webglColorBuffer);b.bufferData(b.ARRAY_BUFFER,G,m)}}function d(e,m){e.uniforms=Uniforms.clone(m.uniforms);e.vertexShader=m.vertexShader;e.fragmentShader=
-m.fragmentShader}function g(e,m,k,h,n){h.__webglProgram||ta.initMaterial(h,m,k,n);var u=h.program,r=u.uniforms,t=h.uniforms;if(u!=la){b.useProgram(u);la=u}b.uniformMatrix4fv(r.projectionMatrix,!1,La);if(k&&(h instanceof THREE.MeshBasicMaterial||h instanceof THREE.MeshLambertMaterial||h instanceof THREE.MeshPhongMaterial||h instanceof THREE.LineBasicMaterial||h instanceof THREE.ParticleBasicMaterial)){t.fogColor.value.setHex(k.color.hex);if(k instanceof THREE.Fog){t.fogNear.value=k.near;t.fogFar.value=
-k.far}else if(k instanceof THREE.FogExp2)t.fogDensity.value=k.density}if(h instanceof THREE.MeshPhongMaterial||h instanceof THREE.MeshLambertMaterial||h.lights){var q,A,s=0,G=0,B=0,L,I,P,N,R=cb,C=R.directional.colors,F=R.directional.positions,J=R.point.colors,da=R.point.positions,ya=R.point.distances,Oa=0,ea=0;k=A=N=0;for(q=m.length;k<q;k++){A=m[k];L=A.color;I=A.position;P=A.intensity;N=A.distance;if(A instanceof THREE.AmbientLight){s+=L.r;G+=L.g;B+=L.b}else if(A instanceof THREE.DirectionalLight){N=
-Oa*3;C[N]=L.r*P;C[N+1]=L.g*P;C[N+2]=L.b*P;F[N]=I.x;F[N+1]=I.y;F[N+2]=I.z;Oa+=1}else if(A instanceof THREE.PointLight){A=ea*3;J[A]=L.r*P;J[A+1]=L.g*P;J[A+2]=L.b*P;da[A]=I.x;da[A+1]=I.y;da[A+2]=I.z;ya[ea]=N;ea+=1}}for(k=Oa*3;k<C.length;k++)C[k]=0;for(k=ea*3;k<J.length;k++)J[k]=0;R.point.length=ea;R.directional.length=Oa;R.ambient[0]=s;R.ambient[1]=G;R.ambient[2]=B;k=cb;t.enableLighting.value=k.directional.length+k.point.length;t.ambientLightColor.value=k.ambient;t.directionalLightColor.value=k.directional.colors;
-t.directionalLightDirection.value=k.directional.positions;t.pointLightColor.value=k.point.colors;t.pointLightPosition.value=k.point.positions;t.pointLightDistance.value=k.point.distances}if(h instanceof THREE.MeshBasicMaterial||h instanceof THREE.MeshLambertMaterial||h instanceof THREE.MeshPhongMaterial){t.diffuse.value.setRGB(h.color.r,h.color.g,h.color.b);t.opacity.value=h.opacity;t.map.texture=h.map;t.lightMap.texture=h.lightMap;t.envMap.texture=h.envMap;t.reflectivity.value=h.reflectivity;t.refractionRatio.value=
-h.refractionRatio;t.combine.value=h.combine;t.useRefract.value=h.envMap&&h.envMap.mapping instanceof THREE.CubeRefractionMapping}if(h instanceof THREE.LineBasicMaterial){t.diffuse.value.setRGB(h.color.r,h.color.g,h.color.b);t.opacity.value=h.opacity}else if(h instanceof THREE.ParticleBasicMaterial){t.psColor.value.setRGB(h.color.r,h.color.g,h.color.b);t.opacity.value=h.opacity;t.size.value=h.size;t.scale.value=Q.height/2;t.map.texture=h.map}else if(h instanceof THREE.MeshPhongMaterial){t.ambient.value.setRGB(h.ambient.r,
-h.ambient.g,h.ambient.b);t.specular.value.setRGB(h.specular.r,h.specular.g,h.specular.b);t.shininess.value=h.shininess}else if(h instanceof THREE.MeshDepthMaterial){t.mNear.value=e.near;t.mFar.value=e.far;t.opacity.value=h.opacity}else if(h instanceof THREE.MeshNormalMaterial)t.opacity.value=h.opacity;for(var X in t)if(G=u.uniforms[X]){q=t[X];s=q.type;k=q.value;if(s=="i")b.uniform1i(G,k);else if(s=="f")b.uniform1f(G,k);else if(s=="fv1")b.uniform1fv(G,k);else if(s=="fv")b.uniform3fv(G,k);else if(s==
-"v2")b.uniform2f(G,k.x,k.y);else if(s=="v3")b.uniform3f(G,k.x,k.y,k.z);else if(s=="c")b.uniform3f(G,k.r,k.g,k.b);else if(s=="t"){b.uniform1i(G,k);if(q=q.texture)if(q.image instanceof Array&&q.image.length==6){if(q.image.length==6){if(q.needsUpdate){if(q.__webglInit){b.bindTexture(b.TEXTURE_CUBE_MAP,q.image.__webglTextureCube);for(s=0;s<6;++s)b.texSubImage2D(b.TEXTURE_CUBE_MAP_POSITIVE_X+s,0,0,0,b.RGBA,b.UNSIGNED_BYTE,q.image[s])}else{q.image.__webglTextureCube=b.createTexture();b.bindTexture(b.TEXTURE_CUBE_MAP,
-q.image.__webglTextureCube);for(s=0;s<6;++s)b.texImage2D(b.TEXTURE_CUBE_MAP_POSITIVE_X+s,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,q.image[s]);q.__webglInit=!0}V(b.TEXTURE_CUBE_MAP,q,q.image[0]);b.bindTexture(b.TEXTURE_CUBE_MAP,null);q.needsUpdate=!1}b.activeTexture(b.TEXTURE0+k);b.bindTexture(b.TEXTURE_CUBE_MAP,q.image.__webglTextureCube)}}else E(q,k)}}b.uniformMatrix4fv(r.modelViewMatrix,!1,n._modelViewMatrixArray);b.uniformMatrix3fv(r.normalMatrix,!1,n._normalMatrixArray);(h instanceof THREE.MeshShaderMaterial||
-h instanceof THREE.MeshPhongMaterial||h.envMap)&&b.uniform3f(r.cameraPosition,e.position.x,e.position.y,e.position.z);(h instanceof THREE.MeshShaderMaterial||h.envMap||h.skinning)&&b.uniformMatrix4fv(r.objectMatrix,!1,n._objectMatrixArray);(h instanceof THREE.MeshPhongMaterial||h instanceof THREE.MeshLambertMaterial||h instanceof THREE.MeshShaderMaterial||h.skinning)&&b.uniformMatrix4fv(r.viewMatrix,!1,Qa);if(h instanceof THREE.ShadowVolumeDynamicMaterial){e=t.directionalLightDirection.value;e[0]=
--m.position.x;e[1]=-m.position.y;e[2]=-m.position.z;b.uniform3fv(r.directionalLightDirection,e);b.uniformMatrix4fv(r.objectMatrix,!1,n._objectMatrixArray);b.uniformMatrix4fv(r.viewMatrix,!1,Qa)}if(h.skinning){b.uniformMatrix4fv(r.cameraInverseMatrix,!1,Qa);b.uniformMatrix4fv(r.boneGlobalMatrices,!1,n.boneMatrices)}return u}function f(e,m,k,h,n,u){if(h.opacity!=0){e=g(e,m,k,h,u).attributes;if(h.morphTargets){m=h.program.attributes;u.morphTargetBase!==-1?b.bindBuffer(b.ARRAY_BUFFER,n.__webglMorphTargetsBuffers[u.morphTargetBase]):
-b.bindBuffer(b.ARRAY_BUFFER,n.__webglVertexBuffer);b.vertexAttribPointer(m.position,3,b.FLOAT,!1,0,0);if(u.morphTargetForcedOrder.length){k=0;for(var r=u.morphTargetForcedOrder,t=u.morphTargetInfluences;k<h.numSupportedMorphTargets&&k<r.length;){b.bindBuffer(b.ARRAY_BUFFER,n.__webglMorphTargetsBuffers[r[k]]);b.vertexAttribPointer(m["morphTarget"+k],3,b.FLOAT,!1,0,0);u.__webglMorphTargetInfluences[k]=t[r[k]];k++}}else{r=[];var q=-1,A=0;t=u.morphTargetInfluences;var s,G=t.length;k=0;for(u.morphTargetBase!==
--1&&(r[u.morphTargetBase]=!0);k<h.numSupportedMorphTargets;){for(s=0;s<G;s++)if(!r[s]&&t[s]>q){A=s;q=t[A]}b.bindBuffer(b.ARRAY_BUFFER,n.__webglMorphTargetsBuffers[A]);b.vertexAttribPointer(m["morphTarget"+k],3,b.FLOAT,!1,0,0);u.__webglMorphTargetInfluences[k]=q;r[A]=1;q=-1;k++}}b.uniform1fv(h.program.uniforms.morphTargetInfluences,u.__webglMorphTargetInfluences)}else{b.bindBuffer(b.ARRAY_BUFFER,n.__webglVertexBuffer);b.vertexAttribPointer(e.position,3,b.FLOAT,!1,0,0)}if(e.color>=0){b.bindBuffer(b.ARRAY_BUFFER,
-n.__webglColorBuffer);b.vertexAttribPointer(e.color,3,b.FLOAT,!1,0,0)}if(e.normal>=0){b.bindBuffer(b.ARRAY_BUFFER,n.__webglNormalBuffer);b.vertexAttribPointer(e.normal,3,b.FLOAT,!1,0,0)}if(e.tangent>=0){b.bindBuffer(b.ARRAY_BUFFER,n.__webglTangentBuffer);b.vertexAttribPointer(e.tangent,4,b.FLOAT,!1,0,0)}if(e.uv>=0)if(n.__webglUVBuffer){b.bindBuffer(b.ARRAY_BUFFER,n.__webglUVBuffer);b.vertexAttribPointer(e.uv,2,b.FLOAT,!1,0,0);b.enableVertexAttribArray(e.uv)}else b.disableVertexAttribArray(e.uv);if(e.uv2>=
-0)if(n.__webglUV2Buffer){b.bindBuffer(b.ARRAY_BUFFER,n.__webglUV2Buffer);b.vertexAttribPointer(e.uv2,2,b.FLOAT,!1,0,0);b.enableVertexAttribArray(e.uv2)}else b.disableVertexAttribArray(e.uv2);if(h.skinning&&e.skinVertexA>=0&&e.skinVertexB>=0&&e.skinIndex>=0&&e.skinWeight>=0){b.bindBuffer(b.ARRAY_BUFFER,n.__webglSkinVertexABuffer);b.vertexAttribPointer(e.skinVertexA,4,b.FLOAT,!1,0,0);b.bindBuffer(b.ARRAY_BUFFER,n.__webglSkinVertexBBuffer);b.vertexAttribPointer(e.skinVertexB,4,b.FLOAT,!1,0,0);b.bindBuffer(b.ARRAY_BUFFER,
-n.__webglSkinIndicesBuffer);b.vertexAttribPointer(e.skinIndex,4,b.FLOAT,!1,0,0);b.bindBuffer(b.ARRAY_BUFFER,n.__webglSkinWeightsBuffer);b.vertexAttribPointer(e.skinWeight,4,b.FLOAT,!1,0,0)}if(u instanceof THREE.Mesh)if(h.wireframe){b.lineWidth(h.wireframeLinewidth);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,n.__webglLineBuffer);b.drawElements(b.LINES,n.__webglLineCount,b.UNSIGNED_SHORT,0)}else{b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,n.__webglFaceBuffer);b.drawElements(b.TRIANGLES,n.__webglFaceCount,b.UNSIGNED_SHORT,
-0)}else if(u instanceof THREE.Line){u=u.type==THREE.LineStrip?b.LINE_STRIP:b.LINES;b.lineWidth(h.linewidth);b.drawArrays(u,0,n.__webglLineCount)}else if(u instanceof THREE.ParticleSystem)b.drawArrays(b.POINTS,0,n.__webglParticleCount);else u instanceof THREE.Ribbon&&b.drawArrays(b.TRIANGLE_STRIP,0,n.__webglVertexCount)}}function i(e,m){if(!e.__webglVertexBuffer)e.__webglVertexBuffer=b.createBuffer();if(!e.__webglNormalBuffer)e.__webglNormalBuffer=b.createBuffer();if(e.hasPos){b.bindBuffer(b.ARRAY_BUFFER,
-e.__webglVertexBuffer);b.bufferData(b.ARRAY_BUFFER,e.positionArray,b.DYNAMIC_DRAW);b.enableVertexAttribArray(m.attributes.position);b.vertexAttribPointer(m.attributes.position,3,b.FLOAT,!1,0,0)}if(e.hasNormal){b.bindBuffer(b.ARRAY_BUFFER,e.__webglNormalBuffer);b.bufferData(b.ARRAY_BUFFER,e.normalArray,b.DYNAMIC_DRAW);b.enableVertexAttribArray(m.attributes.normal);b.vertexAttribPointer(m.attributes.normal,3,b.FLOAT,!1,0,0)}b.drawArrays(b.TRIANGLES,0,e.count);e.count=0}function j(e){if(W!=e.doubleSided){e.doubleSided?
-b.disable(b.CULL_FACE):b.enable(b.CULL_FACE);W=e.doubleSided}if(na!=e.flipSided){e.flipSided?b.frontFace(b.CW):b.frontFace(b.CCW);na=e.flipSided}}function o(e){if(oa!=e){e?b.enable(b.DEPTH_TEST):b.disable(b.DEPTH_TEST);oa=e}}function p(e){ua[0].set(e.n41-e.n11,e.n42-e.n12,e.n43-e.n13,e.n44-e.n14);ua[1].set(e.n41+e.n11,e.n42+e.n12,e.n43+e.n13,e.n44+e.n14);ua[2].set(e.n41+e.n21,e.n42+e.n22,e.n43+e.n23,e.n44+e.n24);ua[3].set(e.n41-e.n21,e.n42-e.n22,e.n43-e.n23,e.n44-e.n24);ua[4].set(e.n41-e.n31,e.n42-
-e.n32,e.n43-e.n33,e.n44-e.n34);ua[5].set(e.n41+e.n31,e.n42+e.n32,e.n43+e.n33,e.n44+e.n34);var m;for(e=0;e<6;e++){m=ua[e];m.divideScalar(Math.sqrt(m.x*m.x+m.y*m.y+m.z*m.z))}}function v(e){for(var m=e.matrixWorld,k=-e.geometry.boundingSphere.radius*Math.max(e.scale.x,Math.max(e.scale.y,e.scale.z)),h=0;h<6;h++){e=ua[h].x*m.n14+ua[h].y*m.n24+ua[h].z*m.n34+ua[h].w;if(e<=k)return!1}return!0}function x(e,m){e.list[e.count]=m;e.count+=1}function y(e){var m,k,h=e.object,n=e.opaque,u=e.transparent;u.count=
-0;e=n.count=0;for(m=h.materials.length;e<m;e++){k=h.materials[e];k.transparent?x(u,k):x(n,k)}}function D(e){var m,k,h,n,u=e.object,r=e.buffer,t=e.opaque,q=e.transparent;q.count=0;e=t.count=0;for(h=u.materials.length;e<h;e++){m=u.materials[e];if(m instanceof THREE.MeshFaceMaterial){m=0;for(k=r.materials.length;m<k;m++)(n=r.materials[m])&&(n.transparent?x(q,n):x(t,n))}else(n=m)&&(n.transparent?x(q,n):x(t,n))}}function z(e,m){return m.z-e.z}function K(e){b.enable(b.POLYGON_OFFSET_FILL);b.polygonOffset(0.1,
-1);b.enable(b.STENCIL_TEST);b.depthMask(!1);b.colorMask(!1,!1,!1,!1);b.stencilFunc(b.ALWAYS,1,255);b.stencilOpSeparate(b.BACK,b.KEEP,b.INCR,b.KEEP);b.stencilOpSeparate(b.FRONT,b.KEEP,b.DECR,b.KEEP);var m,k=e.lights.length,h,n=e.lights,u=[],r,t,q,A,s,G=e.__webglShadowVolumes.length;for(m=0;m<k;m++){h=e.lights[m];if(h instanceof THREE.DirectionalLight){u[0]=-h.position.x;u[1]=-h.position.y;u[2]=-h.position.z;for(s=0;s<G;s++){h=e.__webglShadowVolumes[s].object;r=e.__webglShadowVolumes[s].buffer;t=h.materials[0];
-t.program||ta.initMaterial(t,n,undefined,h);t=t.program;q=t.uniforms;A=t.attributes;if(la!==t){b.useProgram(t);la=t;b.uniformMatrix4fv(q.projectionMatrix,!1,La);b.uniformMatrix4fv(q.viewMatrix,!1,Qa);b.uniform3fv(q.directionalLightDirection,u)}h.matrixWorld.flattenToArray(h._objectMatrixArray);b.uniformMatrix4fv(q.objectMatrix,!1,h._objectMatrixArray);b.bindBuffer(b.ARRAY_BUFFER,r.__webglVertexBuffer);b.vertexAttribPointer(A.position,3,b.FLOAT,!1,0,0);b.bindBuffer(b.ARRAY_BUFFER,r.__webglNormalBuffer);
-b.vertexAttribPointer(A.normal,3,b.FLOAT,!1,0,0);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,r.__webglFaceBuffer);b.cullFace(b.FRONT);b.drawElements(b.TRIANGLES,r.__webglFaceCount,b.UNSIGNED_SHORT,0);b.cullFace(b.BACK);b.drawElements(b.TRIANGLES,r.__webglFaceCount,b.UNSIGNED_SHORT,0)}}}b.disable(b.POLYGON_OFFSET_FILL);b.colorMask(!0,!0,!0,!0);b.stencilFunc(b.NOTEQUAL,0,255);b.stencilOp(b.KEEP,b.KEEP,b.KEEP);b.disable(b.DEPTH_TEST);aa="";la=S.program;b.useProgram(S.program);b.uniformMatrix4fv(S.projectionLocation,
-!1,La);b.uniform1f(S.darknessLocation,S.darkness);b.bindBuffer(b.ARRAY_BUFFER,S.vertexBuffer);b.vertexAttribPointer(S.vertexLocation,3,b.FLOAT,!1,0,0);b.enableVertexAttribArray(S.vertexLocation);b.blendFunc(b.ONE,b.ONE_MINUS_SRC_ALPHA);b.blendEquation(b.FUNC_ADD);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,S.elementBuffer);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.disable(b.STENCIL_TEST);b.enable(b.DEPTH_TEST);b.depthMask(Ca)}function M(e,m){var k,h,n,u=e.__webglLensFlares.length,r,t,q;r=new THREE.Vector3;
-var A=xa/ma;t=ma*0.5;q=xa*0.5;var s=16/xa,G=[s*A,s],B=[1,1,0];s=[1,1];var L,I=H.readBackPixels,P,N,R=H.uniforms;k=H.attributes;b.useProgram(H.program);la=H.program;aa="";b.uniform1i(R.map,0);b.activeTexture(b.TEXTURE0);b.uniform1f(R.opacity,1);b.uniform1f(R.rotation,0);b.uniform2fv(R.scale,G);b.bindBuffer(b.ARRAY_BUFFER,H.vertexBuffer);b.vertexAttribPointer(k.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(k.uv,2,b.FLOAT,!1,16,8);b.bindTexture(b.TEXTURE_2D,H.tempTexture);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
-H.elementBuffer);b.disable(b.CULL_FACE);b.depthMask(!1);for(n=0;n<u;n++){k=e.__webglLensFlares[n].object;r.set(k.matrixWorld.n14,k.matrixWorld.n24,k.matrixWorld.n34);m.matrixWorldInverse.multiplyVector3(r);h=r.z;m.projectionMatrix.multiplyVector3(r);B[0]=r.x;B[1]=r.y;B[2]=r.z;s[0]=B[0]*t+t;s[1]=B[1]*q+q;b.copyTexSubImage2D(b.TEXTURE_2D,0,0,0,s[0]-8,s[1]-8,16,16);b.uniform3fv(R.screenPosition,B);b.uniform1i(R.renderPink,1);b.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);try{b.readPixels(s[0]-
-8,s[1]-8,16,16,b.RGBA,b.UNSIGNED_BYTE,H.readBackPixels)}catch(C){console.log("WebGLRenderer.renderLensFlare: readPixels failed!")}b.getError()&&console.log("WebGLRenderer.renderLensFlare: readPixels failed!");sampleDistance=parseInt(5*(1-Math.max(0,Math.min(-h,m.far))/m.far),10)+2;h=sampleDistance*4;L=sampleDistance*64;N=0;P=28-h+(448-L);H.readBackPixels[P+0]===255&&H.readBackPixels[P+1]===0&&H.readBackPixels[P+2]===255&&(N+=0.2);P=28+h+(448-L);I[P+0]===255&&I[P+1]===0&&I[P+2]===255&&(N+=0.2);P=28+
-h+(448+L);I[P+0]===255&&I[P+1]===0&&I[P+2]===255&&(N+=0.2);P=28-h+(448+L);I[P+0]===255&&I[P+1]===0&&I[P+2]===255&&(N+=0.2);P=476;I[P+0]===255&&I[P+1]===0&&I[P+2]===255&&(N+=0.2);k.positionScreen.x=B[0];k.positionScreen.y=B[1];k.positionScreen.z=B[2];k.customUpdateCallback?k.customUpdateCallback(N,k):k.updateLensFlares(N);b.uniform1i(R.renderPink,0);b.disable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}for(n=0;n<u;n++){k=e.__webglLensFlares[n].object;r=0;for(t=k.lensFlares.length;r<
-t;r++){q=k.lensFlares[r];if(q.opacity>0.0010&&q.scale>0.0010){B[0]=q.x;B[1]=q.y;B[2]=q.z;s=q.size*q.scale/xa;G[0]=s*A;G[1]=s;b.uniform3fv(R.screenPosition,B);b.uniform1f(R.rotation,q.rotation);b.uniform2fv(R.scale,G);b.uniform1f(R.opacity,q.opacity);qa(q.blending);E(q.texture,0);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}}}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(Ca)}function T(e,m){e._modelViewMatrix.multiplyToArray(m.matrixWorldInverse,e.matrixWorld,e._modelViewMatrixArray);
-THREE.Matrix4.makeInvert3x3(e._modelViewMatrix).transposeIntoArray(e._normalMatrixArray)}function O(e){var m,k,h;if(e instanceof THREE.Mesh){k=e.geometry;for(m in k.geometryGroups){h=k.geometryGroups[m];if(k.__dirtyVertices||k.__dirtyMorphTargets||k.__dirtyElements||k.__dirtyUvs||k.__dirtyNormals||k.__dirtyColors||k.__dirtyTangents){var n=b.DYNAMIC_DRAW,u=void 0,r=void 0,t=void 0,q=void 0;t=void 0;var A=void 0,s=void 0,G=void 0,B=void 0,L=void 0,I=void 0,P=void 0,N=void 0,R=void 0,C=void 0,F=void 0,
-J=void 0,da=void 0;s=void 0;G=void 0;q=void 0;B=void 0;q=void 0;C=void 0;F=void 0;s=void 0;C=void 0;F=void 0;J=void 0;da=void 0;C=void 0;F=void 0;J=void 0;da=void 0;C=void 0;F=void 0;J=void 0;da=void 0;C=void 0;F=void 0;J=void 0;q=void 0;B=void 0;A=void 0;t=void 0;t=void 0;var ya=void 0,Oa=void 0,ea=void 0,X=0,va=0,Va=0,Wa=0,Ga=0,Ha=0,Z=0,Ia=0,sa=0,w=0,wa=0,za=h.__vertexArray,db=h.__uvArray,eb=h.__uv2Array,Ma=h.__normalArray,fa=h.__tangentArray,Aa=h.__colorArray,ga=h.__skinVertexAArray,ha=h.__skinVertexBArray,
-ia=h.__skinIndexArray,ja=h.__skinWeightArray,fb=h.__morphTargetsArrays,Ja=h.__faceArray,Ka=h.__lineArray,mb=h.__needsSmoothNormals;I=h.__vertexColorType;L=h.__uvType;P=h.__normalType;var Ea=e.geometry,gb=Ea.__dirtyVertices,hb=Ea.__dirtyElements,bb=Ea.__dirtyUvs,ib=Ea.__dirtyNormals,jb=Ea.__dirtyTangents,kb=Ea.__dirtyColors,lb=Ea.__dirtyMorphTargets,Xa=Ea.vertices,nb=h.faces,rb=Ea.faces,ob=Ea.faceVertexUvs[0],pb=Ea.faceVertexUvs[1],Ya=Ea.skinVerticesA,Za=Ea.skinVerticesB,$a=Ea.skinIndices,Sa=Ea.skinWeights,
-Ua=Ea.edgeFaces,Pa=Ea.morphTargets;u=0;for(r=nb.length;u<r;u++){t=nb[u];q=rb[t];ob&&(N=ob[t]);pb&&(R=pb[t]);t=q.vertexNormals;A=q.normal;s=q.vertexColors;G=q.color;B=q.vertexTangents;if(q instanceof THREE.Face3){if(gb){C=Xa[q.a].position;F=Xa[q.b].position;J=Xa[q.c].position;za[va]=C.x;za[va+1]=C.y;za[va+2]=C.z;za[va+3]=F.x;za[va+4]=F.y;za[va+5]=F.z;za[va+6]=J.x;za[va+7]=J.y;za[va+8]=J.z;va+=9}if(lb){ya=0;for(Oa=Pa.length;ya<Oa;ya++){C=Pa[ya].vertices[q.a].position;F=Pa[ya].vertices[q.b].position;
-J=Pa[ya].vertices[q.c].position;ea=fb[ya];ea[wa+0]=C.x;ea[wa+1]=C.y;ea[wa+2]=C.z;ea[wa+3]=F.x;ea[wa+4]=F.y;ea[wa+5]=F.z;ea[wa+6]=J.x;ea[wa+7]=J.y;ea[wa+8]=J.z}wa+=9}if(Sa.length){C=Sa[q.a];F=Sa[q.b];J=Sa[q.c];ja[w]=C.x;ja[w+1]=C.y;ja[w+2]=C.z;ja[w+3]=C.w;ja[w+4]=F.x;ja[w+5]=F.y;ja[w+6]=F.z;ja[w+7]=F.w;ja[w+8]=J.x;ja[w+9]=J.y;ja[w+10]=J.z;ja[w+11]=J.w;C=$a[q.a];F=$a[q.b];J=$a[q.c];ia[w]=C.x;ia[w+1]=C.y;ia[w+2]=C.z;ia[w+3]=C.w;ia[w+4]=F.x;ia[w+5]=F.y;ia[w+6]=F.z;ia[w+7]=F.w;ia[w+8]=J.x;ia[w+9]=J.y;
-ia[w+10]=J.z;ia[w+11]=J.w;C=Ya[q.a];F=Ya[q.b];J=Ya[q.c];ga[w]=C.x;ga[w+1]=C.y;ga[w+2]=C.z;ga[w+3]=1;ga[w+4]=F.x;ga[w+5]=F.y;ga[w+6]=F.z;ga[w+7]=1;ga[w+8]=J.x;ga[w+9]=J.y;ga[w+10]=J.z;ga[w+11]=1;C=Za[q.a];F=Za[q.b];J=Za[q.c];ha[w]=C.x;ha[w+1]=C.y;ha[w+2]=C.z;ha[w+3]=1;ha[w+4]=F.x;ha[w+5]=F.y;ha[w+6]=F.z;ha[w+7]=1;ha[w+8]=J.x;ha[w+9]=J.y;ha[w+10]=J.z;ha[w+11]=1;w+=12}if(kb&&I){if(s.length==3&&I==THREE.VertexColors){q=s[0];C=s[1];F=s[2]}else F=C=q=G;Aa[sa]=q.r;Aa[sa+1]=q.g;Aa[sa+2]=q.b;Aa[sa+3]=C.r;
-Aa[sa+4]=C.g;Aa[sa+5]=C.b;Aa[sa+6]=F.r;Aa[sa+7]=F.g;Aa[sa+8]=F.b;sa+=9}if(jb&&Ea.hasTangents){s=B[0];G=B[1];q=B[2];fa[Z]=s.x;fa[Z+1]=s.y;fa[Z+2]=s.z;fa[Z+3]=s.w;fa[Z+4]=G.x;fa[Z+5]=G.y;fa[Z+6]=G.z;fa[Z+7]=G.w;fa[Z+8]=q.x;fa[Z+9]=q.y;fa[Z+10]=q.z;fa[Z+11]=q.w;Z+=12}if(ib&&P)if(t.length==3&&mb)for(B=0;B<3;B++){A=t[B];Ma[Ha]=A.x;Ma[Ha+1]=A.y;Ma[Ha+2]=A.z;Ha+=3}else for(B=0;B<3;B++){Ma[Ha]=A.x;Ma[Ha+1]=A.y;Ma[Ha+2]=A.z;Ha+=3}if(bb&&N!==undefined&&L)for(B=0;B<3;B++){t=N[B];db[Va]=t.u;db[Va+1]=t.v;Va+=
-2}if(bb&&R!==undefined&&L)for(B=0;B<3;B++){t=R[B];eb[Wa]=t.u;eb[Wa+1]=t.v;Wa+=2}if(hb){Ja[Ga]=X;Ja[Ga+1]=X+1;Ja[Ga+2]=X+2;Ga+=3;Ka[Ia]=X;Ka[Ia+1]=X+1;Ka[Ia+2]=X;Ka[Ia+3]=X+2;Ka[Ia+4]=X+1;Ka[Ia+5]=X+2;Ia+=6;X+=3}}else if(q instanceof THREE.Face4){if(gb){C=Xa[q.a].position;F=Xa[q.b].position;J=Xa[q.c].position;da=Xa[q.d].position;za[va]=C.x;za[va+1]=C.y;za[va+2]=C.z;za[va+3]=F.x;za[va+4]=F.y;za[va+5]=F.z;za[va+6]=J.x;za[va+7]=J.y;za[va+8]=J.z;za[va+9]=da.x;za[va+10]=da.y;za[va+11]=da.z;va+=12}if(lb){ya=
-0;for(Oa=Pa.length;ya<Oa;ya++){C=Pa[ya].vertices[q.a].position;F=Pa[ya].vertices[q.b].position;J=Pa[ya].vertices[q.c].position;da=Pa[ya].vertices[q.d].position;ea=fb[ya];ea[wa+0]=C.x;ea[wa+1]=C.y;ea[wa+2]=C.z;ea[wa+3]=F.x;ea[wa+4]=F.y;ea[wa+5]=F.z;ea[wa+6]=J.x;ea[wa+7]=J.y;ea[wa+8]=J.z;ea[wa+9]=da.x;ea[wa+10]=da.y;ea[wa+11]=da.z}wa+=12}if(Sa.length){C=Sa[q.a];F=Sa[q.b];J=Sa[q.c];da=Sa[q.d];ja[w]=C.x;ja[w+1]=C.y;ja[w+2]=C.z;ja[w+3]=C.w;ja[w+4]=F.x;ja[w+5]=F.y;ja[w+6]=F.z;ja[w+7]=F.w;ja[w+8]=J.x;ja[w+
-9]=J.y;ja[w+10]=J.z;ja[w+11]=J.w;ja[w+12]=da.x;ja[w+13]=da.y;ja[w+14]=da.z;ja[w+15]=da.w;C=$a[q.a];F=$a[q.b];J=$a[q.c];da=$a[q.d];ia[w]=C.x;ia[w+1]=C.y;ia[w+2]=C.z;ia[w+3]=C.w;ia[w+4]=F.x;ia[w+5]=F.y;ia[w+6]=F.z;ia[w+7]=F.w;ia[w+8]=J.x;ia[w+9]=J.y;ia[w+10]=J.z;ia[w+11]=J.w;ia[w+12]=da.x;ia[w+13]=da.y;ia[w+14]=da.z;ia[w+15]=da.w;C=Ya[q.a];F=Ya[q.b];J=Ya[q.c];da=Ya[q.d];ga[w]=C.x;ga[w+1]=C.y;ga[w+2]=C.z;ga[w+3]=1;ga[w+4]=F.x;ga[w+5]=F.y;ga[w+6]=F.z;ga[w+7]=1;ga[w+8]=J.x;ga[w+9]=J.y;ga[w+10]=J.z;ga[w+
-11]=1;ga[w+12]=da.x;ga[w+13]=da.y;ga[w+14]=da.z;ga[w+15]=1;C=Za[q.a];F=Za[q.b];J=Za[q.c];q=Za[q.d];ha[w]=C.x;ha[w+1]=C.y;ha[w+2]=C.z;ha[w+3]=1;ha[w+4]=F.x;ha[w+5]=F.y;ha[w+6]=F.z;ha[w+7]=1;ha[w+8]=J.x;ha[w+9]=J.y;ha[w+10]=J.z;ha[w+11]=1;ha[w+12]=q.x;ha[w+13]=q.y;ha[w+14]=q.z;ha[w+15]=1;w+=16}if(kb&&I){if(s.length==4&&I==THREE.VertexColors){q=s[0];C=s[1];F=s[2];s=s[3]}else s=F=C=q=G;Aa[sa]=q.r;Aa[sa+1]=q.g;Aa[sa+2]=q.b;Aa[sa+3]=C.r;Aa[sa+4]=C.g;Aa[sa+5]=C.b;Aa[sa+6]=F.r;Aa[sa+7]=F.g;Aa[sa+8]=F.b;Aa[sa+
-9]=s.r;Aa[sa+10]=s.g;Aa[sa+11]=s.b;sa+=12}if(jb&&Ea.hasTangents){s=B[0];G=B[1];q=B[2];B=B[3];fa[Z]=s.x;fa[Z+1]=s.y;fa[Z+2]=s.z;fa[Z+3]=s.w;fa[Z+4]=G.x;fa[Z+5]=G.y;fa[Z+6]=G.z;fa[Z+7]=G.w;fa[Z+8]=q.x;fa[Z+9]=q.y;fa[Z+10]=q.z;fa[Z+11]=q.w;fa[Z+12]=B.x;fa[Z+13]=B.y;fa[Z+14]=B.z;fa[Z+15]=B.w;Z+=16}if(ib&&P)if(t.length==4&&mb)for(B=0;B<4;B++){A=t[B];Ma[Ha]=A.x;Ma[Ha+1]=A.y;Ma[Ha+2]=A.z;Ha+=3}else for(B=0;B<4;B++){Ma[Ha]=A.x;Ma[Ha+1]=A.y;Ma[Ha+2]=A.z;Ha+=3}if(bb&&N!==undefined&&L)for(B=0;B<4;B++){t=N[B];
-db[Va]=t.u;db[Va+1]=t.v;Va+=2}if(bb&&R!==undefined&&L)for(B=0;B<4;B++){t=R[B];eb[Wa]=t.u;eb[Wa+1]=t.v;Wa+=2}if(hb){Ja[Ga]=X;Ja[Ga+1]=X+1;Ja[Ga+2]=X+3;Ja[Ga+3]=X+1;Ja[Ga+4]=X+2;Ja[Ga+5]=X+3;Ga+=6;Ka[Ia]=X;Ka[Ia+1]=X+1;Ka[Ia+2]=X;Ka[Ia+3]=X+3;Ka[Ia+4]=X+1;Ka[Ia+5]=X+2;Ka[Ia+6]=X+2;Ka[Ia+7]=X+3;Ia+=8;X+=4}}}if(Ua){u=0;for(r=Ua.length;u<r;u++){Ja[Ga]=Ua[u].a;Ja[Ga+1]=Ua[u].b;Ja[Ga+2]=Ua[u].c;Ja[Ga+3]=Ua[u].a;Ja[Ga+4]=Ua[u].c;Ja[Ga+5]=Ua[u].d;Ga+=6}}if(gb){b.bindBuffer(b.ARRAY_BUFFER,h.__webglVertexBuffer);
-b.bufferData(b.ARRAY_BUFFER,za,n)}if(lb){ya=0;for(Oa=Pa.length;ya<Oa;ya++){b.bindBuffer(b.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[ya]);b.bufferData(b.ARRAY_BUFFER,fb[ya],n)}}if(kb&&sa>0){b.bindBuffer(b.ARRAY_BUFFER,h.__webglColorBuffer);b.bufferData(b.ARRAY_BUFFER,Aa,n)}if(ib){b.bindBuffer(b.ARRAY_BUFFER,h.__webglNormalBuffer);b.bufferData(b.ARRAY_BUFFER,Ma,n)}if(jb&&Ea.hasTangents){b.bindBuffer(b.ARRAY_BUFFER,h.__webglTangentBuffer);b.bufferData(b.ARRAY_BUFFER,fa,n)}if(bb&&Va>0){b.bindBuffer(b.ARRAY_BUFFER,
-h.__webglUVBuffer);b.bufferData(b.ARRAY_BUFFER,db,n)}if(bb&&Wa>0){b.bindBuffer(b.ARRAY_BUFFER,h.__webglUV2Buffer);b.bufferData(b.ARRAY_BUFFER,eb,n)}if(hb){b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,Ja,n);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,Ka,n)}if(w>0){b.bindBuffer(b.ARRAY_BUFFER,h.__webglSkinVertexABuffer);b.bufferData(b.ARRAY_BUFFER,ga,n);b.bindBuffer(b.ARRAY_BUFFER,h.__webglSkinVertexBBuffer);
-b.bufferData(b.ARRAY_BUFFER,ha,n);b.bindBuffer(b.ARRAY_BUFFER,h.__webglSkinIndicesBuffer);b.bufferData(b.ARRAY_BUFFER,ia,n);b.bindBuffer(b.ARRAY_BUFFER,h.__webglSkinWeightsBuffer);b.bufferData(b.ARRAY_BUFFER,ja,n)}}}k.__dirtyVertices=!1;k.__dirtyMorphTargets=!1;k.__dirtyElements=!1;k.__dirtyUvs=!1;k.__dirtyNormals=!1;k.__dirtyTangents=!1;k.__dirtyColors=!1}else if(e instanceof THREE.Ribbon){k=e.geometry;if(k.__dirtyVertices||k.__dirtyColors){e=k;m=b.DYNAMIC_DRAW;P=e.vertices;n=e.colors;N=P.length;
-u=n.length;R=e.__vertexArray;r=e.__colorArray;X=e.__dirtyColors;if(e.__dirtyVertices){for(L=0;L<N;L++){I=P[L].position;h=L*3;R[h]=I.x;R[h+1]=I.y;R[h+2]=I.z}b.bindBuffer(b.ARRAY_BUFFER,e.__webglVertexBuffer);b.bufferData(b.ARRAY_BUFFER,R,m)}if(X){for(L=0;L<u;L++){color=n[L];h=L*3;r[h]=color.r;r[h+1]=color.g;r[h+2]=color.b}b.bindBuffer(b.ARRAY_BUFFER,e.__webglColorBuffer);b.bufferData(b.ARRAY_BUFFER,r,m)}}k.__dirtyVertices=!1;k.__dirtyColors=!1}else if(e instanceof THREE.Line){k=e.geometry;if(k.__dirtyVertices||
-k.__dirtyColors){e=k;m=b.DYNAMIC_DRAW;P=e.vertices;n=e.colors;N=P.length;u=n.length;R=e.__vertexArray;r=e.__colorArray;X=e.__dirtyColors;if(e.__dirtyVertices){for(L=0;L<N;L++){I=P[L].position;h=L*3;R[h]=I.x;R[h+1]=I.y;R[h+2]=I.z}b.bindBuffer(b.ARRAY_BUFFER,e.__webglVertexBuffer);b.bufferData(b.ARRAY_BUFFER,R,m)}if(X){for(L=0;L<u;L++){color=n[L];h=L*3;r[h]=color.r;r[h+1]=color.g;r[h+2]=color.b}b.bindBuffer(b.ARRAY_BUFFER,e.__webglColorBuffer);b.bufferData(b.ARRAY_BUFFER,r,m)}}k.__dirtyVertices=!1;
-k.__dirtyColors=!1}else if(e instanceof THREE.ParticleSystem){k=e.geometry;(k.__dirtyVertices||k.__dirtyColors||e.sortParticles)&&c(k,b.DYNAMIC_DRAW,e);k.__dirtyVertices=!1;k.__dirtyColors=!1}}function pa(e){function m(B){var L=[];k=0;for(h=B.length;k<h;k++)B[k]==undefined?L.push("undefined"):L.push(B[k].id);return L.join("_")}var k,h,n,u,r,t,q,A,s={},G=e.morphTargets!==undefined?e.morphTargets.length:0;e.geometryGroups={};n=0;for(u=e.faces.length;n<u;n++){r=e.faces[n];t=r.materials;q=m(t);s[q]==
-undefined&&(s[q]={hash:q,counter:0});A=s[q].hash+"_"+s[q].counter;e.geometryGroups[A]==undefined&&(e.geometryGroups[A]={faces:[],materials:t,vertices:0,numMorphTargets:G});r=r instanceof THREE.Face3?3:4;if(e.geometryGroups[A].vertices+r>65535){s[q].counter+=1;A=s[q].hash+"_"+s[q].counter;e.geometryGroups[A]==undefined&&(e.geometryGroups[A]={faces:[],materials:t,vertices:0,numMorphTargets:G})}e.geometryGroups[A].faces.push(n);e.geometryGroups[A].vertices+=r}}function Y(e,m,k){e.push({buffer:m,object:k,
-opaque:{list:[],count:0},transparent:{list:[],count:0}})}function qa(e){if(e!=aa){switch(e){case THREE.AdditiveAlphaBlending:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.SRC_ALPHA,b.ONE);break;case THREE.AdditiveBlending:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.SRC_ALPHA,b.ONE);break;case THREE.SubtractiveBlending:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.ZERO,b.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.ZERO,b.SRC_COLOR);break;default:b.blendEquationSeparate(b.FUNC_ADD,
-b.FUNC_ADD);b.blendFuncSeparate(b.SRC_ALPHA,b.ONE_MINUS_SRC_ALPHA,b.ONE,b.ONE_MINUS_SRC_ALPHA)}aa=e}}function V(e,m,k){if((k.width&k.width-1)==0&&(k.height&k.height-1)==0){b.texParameteri(e,b.TEXTURE_WRAP_S,$(m.wrapS));b.texParameteri(e,b.TEXTURE_WRAP_T,$(m.wrapT));b.texParameteri(e,b.TEXTURE_MAG_FILTER,$(m.magFilter));b.texParameteri(e,b.TEXTURE_MIN_FILTER,$(m.minFilter));b.generateMipmap(e)}else{b.texParameteri(e,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(e,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);
-b.texParameteri(e,b.TEXTURE_MAG_FILTER,Da(m.magFilter));b.texParameteri(e,b.TEXTURE_MIN_FILTER,Da(m.minFilter))}}function E(e,m){if(e.needsUpdate){if(e.__webglInit){b.bindTexture(b.TEXTURE_2D,e.__webglTexture);b.texSubImage2D(b.TEXTURE_2D,0,0,0,b.RGBA,b.UNSIGNED_BYTE,e.image)}else{e.__webglTexture=b.createTexture();b.bindTexture(b.TEXTURE_2D,e.__webglTexture);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,e.image);e.__webglInit=!0}V(b.TEXTURE_2D,e,e.image);b.bindTexture(b.TEXTURE_2D,null);
-e.needsUpdate=!1}b.activeTexture(b.TEXTURE0+m);b.bindTexture(b.TEXTURE_2D,e.__webglTexture)}function Fa(e){if(e&&!e.__webglFramebuffer){e.__webglFramebuffer=b.createFramebuffer();e.__webglRenderbuffer=b.createRenderbuffer();e.__webglTexture=b.createTexture();b.bindRenderbuffer(b.RENDERBUFFER,e.__webglRenderbuffer);b.renderbufferStorage(b.RENDERBUFFER,b.DEPTH_COMPONENT16,e.width,e.height);b.bindTexture(b.TEXTURE_2D,e.__webglTexture);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,$(e.wrapS));b.texParameteri(b.TEXTURE_2D,
-b.TEXTURE_WRAP_T,$(e.wrapT));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,$(e.magFilter));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,$(e.minFilter));b.texImage2D(b.TEXTURE_2D,0,$(e.format),e.width,e.height,0,$(e.format),$(e.type),null);b.bindFramebuffer(b.FRAMEBUFFER,e.__webglFramebuffer);b.framebufferTexture2D(b.FRAMEBUFFER,b.COLOR_ATTACHMENT0,b.TEXTURE_2D,e.__webglTexture,0);b.framebufferRenderbuffer(b.FRAMEBUFFER,b.DEPTH_ATTACHMENT,b.RENDERBUFFER,e.__webglRenderbuffer);b.bindTexture(b.TEXTURE_2D,
-null);b.bindRenderbuffer(b.RENDERBUFFER,null);b.bindFramebuffer(b.FRAMEBUFFER,null)}var m,k;if(e){m=e.__webglFramebuffer;k=e.width;e=e.height}else{m=null;k=ma;e=xa}if(m!=Ba){b.bindFramebuffer(b.FRAMEBUFFER,m);b.viewport(U,ra,k,e);Ba=m}}function ka(e,m){var k;if(e=="fragment")k=b.createShader(b.FRAGMENT_SHADER);else e=="vertex"&&(k=b.createShader(b.VERTEX_SHADER));b.shaderSource(k,m);b.compileShader(k);if(!b.getShaderParameter(k,b.COMPILE_STATUS)){console.error(b.getShaderInfoLog(k));console.error(m);
-return null}return k}function Da(e){switch(e){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return b.NEAREST;default:return b.LINEAR}}function $(e){switch(e){case THREE.RepeatWrapping:return b.REPEAT;case THREE.ClampToEdgeWrapping:return b.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return b.MIRRORED_REPEAT;case THREE.NearestFilter:return b.NEAREST;case THREE.NearestMipMapNearestFilter:return b.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return b.NEAREST_MIPMAP_LINEAR;
-case THREE.LinearFilter:return b.LINEAR;case THREE.LinearMipMapNearestFilter:return b.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return b.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return b.BYTE;case THREE.UnsignedByteType:return b.UNSIGNED_BYTE;case THREE.ShortType:return b.SHORT;case THREE.UnsignedShortType:return b.UNSIGNED_SHORT;case THREE.IntType:return b.INT;case THREE.UnsignedShortType:return b.UNSIGNED_INT;case THREE.FloatType:return b.FLOAT;case THREE.AlphaFormat:return b.ALPHA;
-case THREE.RGBFormat:return b.RGB;case THREE.RGBAFormat:return b.RGBA;case THREE.LuminanceFormat:return b.LUMINANCE;case THREE.LuminanceAlphaFormat:return b.LUMINANCE_ALPHA}return 0}var b,Q=document.createElement("canvas"),la=null,Ba=null,Ca=!0,ta=this,W=null,na=null,aa=null,oa=null,U=0,ra=0,ma=0,xa=0,ua=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ca=new THREE.Matrix4,La=new Float32Array(16),Qa=new Float32Array(16),Ra=new THREE.Vector4,
-cb={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},Na=!0,ab=!0,Ta=new THREE.Color(0),qb=0;if(a){if(a.stencil!=undefined)Na=a.stencil;if(a.antialias!==undefined)ab=a.antialias;a.clearColor!==undefined&&Ta.setHex(a.clearColor);if(a.clearAlpha!==undefined)qb=a.clearAlpha}this.maxMorphTargets=8;this.domElement=Q;this.autoClear=!0;this.sortObjects=!0;(function(e,m,k,h){try{if(!(b=Q.getContext("experimental-webgl",{antialias:e,stencil:h})))throw"Error creating WebGL context.";
-}catch(n){console.error(n)}b.clearColor(0,0,0,1);b.clearDepth(1);b.enable(b.DEPTH_TEST);b.depthFunc(b.LEQUAL);b.frontFace(b.CCW);b.cullFace(b.BACK);b.enable(b.CULL_FACE);b.enable(b.BLEND);b.blendEquation(b.FUNC_ADD);b.blendFunc(b.SRC_ALPHA,b.ONE_MINUS_SRC_ALPHA);b.clearColor(m.r,m.g,m.b,k)})(ab,Ta,qb,Na);this.context=b;if(Na){var S={};S.vertices=new Float32Array(12);S.faces=new Uint16Array(6);S.darkness=0.5;S.vertices[0]=-2;S.vertices[1]=-1;S.vertices[2]=-1;S.vertices[3]=2;S.vertices[4]=-1;S.vertices[5]=
--1;S.vertices[6]=2;S.vertices[7]=1;S.vertices[8]=-1;S.vertices[9]=-2;S.vertices[10]=1;S.vertices[11]=-1;S.faces[0]=0;S.faces[1]=1;S.faces[2]=2;S.faces[3]=0;S.faces[4]=2;S.faces[5]=3;S.vertexBuffer=b.createBuffer();S.elementBuffer=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,S.vertexBuffer);b.bufferData(b.ARRAY_BUFFER,S.vertices,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,S.elementBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,S.faces,b.STATIC_DRAW);S.program=b.createProgram();b.attachShader(S.program,
-ka("fragment",THREE.ShaderLib.shadowPost.fragmentShader));b.attachShader(S.program,ka("vertex",THREE.ShaderLib.shadowPost.vertexShader));b.linkProgram(S.program);S.vertexLocation=b.getAttribLocation(S.program,"position");S.projectionLocation=b.getUniformLocation(S.program,"projectionMatrix");S.darknessLocation=b.getUniformLocation(S.program,"darkness")}var H={};H.vertices=new Float32Array(16);H.faces=new Uint16Array(6);H.transparency=0.5;a=0;H.vertices[a++]=-1;H.vertices[a++]=-1;H.vertices[a++]=0;
-H.vertices[a++]=0;H.vertices[a++]=1;H.vertices[a++]=-1;H.vertices[a++]=1;H.vertices[a++]=0;H.vertices[a++]=1;H.vertices[a++]=1;H.vertices[a++]=1;H.vertices[a++]=1;H.vertices[a++]=-1;H.vertices[a++]=1;H.vertices[a++]=0;H.vertices[a++]=1;a=0;H.faces[a++]=0;H.faces[a++]=1;H.faces[a++]=2;H.faces[a++]=0;H.faces[a++]=2;H.faces[a++]=3;H.vertexBuffer=b.createBuffer();H.elementBuffer=b.createBuffer();H.tempTexture=b.createTexture();H.readBackPixels=new Uint8Array(1024);b.bindBuffer(b.ARRAY_BUFFER,H.vertexBuffer);
-b.bufferData(b.ARRAY_BUFFER,H.vertices,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,H.elementBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,H.faces,b.STATIC_DRAW);b.bindTexture(b.TEXTURE_2D,H.tempTexture);b.texImage2D(b.TEXTURE_2D,0,b.RGB,16,16,0,b.RGB,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,
-b.NEAREST);H.program=b.createProgram();b.attachShader(H.program,ka("fragment",THREE.ShaderLib.lensFlare.fragmentShader));b.attachShader(H.program,ka("vertex",THREE.ShaderLib.lensFlare.vertexShader));b.linkProgram(H.program);H.attributes={};H.uniforms={};H.attributes.vertex=b.getAttribLocation(H.program,"position");H.attributes.uv=b.getAttribLocation(H.program,"UV");H.uniforms.map=b.getUniformLocation(H.program,"map");H.uniforms.opacity=b.getUniformLocation(H.program,"opacity");H.uniforms.scale=b.getUniformLocation(H.program,
-"scale");H.uniforms.rotation=b.getUniformLocation(H.program,"rotation");H.uniforms.screenPosition=b.getUniformLocation(H.program,"screenPosition");H.uniforms.renderPink=b.getUniformLocation(H.program,"renderPink");this.setSize=function(e,m){Q.width=e;Q.height=m;this.setViewport(0,0,Q.width,Q.height)};this.setViewport=function(e,m,k,h){U=e;ra=m;ma=k;xa=h;b.viewport(U,ra,ma,xa)};this.setScissor=function(e,m,k,h){b.scissor(e,m,k,h)};this.enableScissorTest=function(e){e?b.enable(b.SCISSOR_TEST):b.disable(b.SCISSOR_TEST)};
-this.enableDepthBufferWrite=function(e){Ca=e;b.depthMask(e)};this.setClearColorHex=function(e,m){var k=new THREE.Color(e);b.clearColor(k.r,k.g,k.b,m)};this.setClearColor=function(e,m){b.clearColor(e.r,e.g,e.b,m)};this.clear=function(){b.clear(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT|b.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(e){S.darkness=e};this.initMaterial=function(e,m,k,h){var n,u,r,t;if(e instanceof THREE.MeshDepthMaterial)d(e,THREE.ShaderLib.depth);else if(e instanceof THREE.ShadowVolumeDynamicMaterial)d(e,
-THREE.ShaderLib.shadowVolumeDynamic);else if(e instanceof THREE.MeshNormalMaterial)d(e,THREE.ShaderLib.normal);else if(e instanceof THREE.MeshBasicMaterial)d(e,THREE.ShaderLib.basic);else if(e instanceof THREE.MeshLambertMaterial)d(e,THREE.ShaderLib.lambert);else if(e instanceof THREE.MeshPhongMaterial)d(e,THREE.ShaderLib.phong);else if(e instanceof THREE.LineBasicMaterial)d(e,THREE.ShaderLib.basic);else e instanceof THREE.ParticleBasicMaterial&&d(e,THREE.ShaderLib.particle_basic);if(!e.program){var q,
-A,s;q=s=t=0;for(r=m.length;q<r;q++){A=m[q];A instanceof THREE.DirectionalLight&&s++;A instanceof THREE.PointLight&&t++}if(t+s<=4)m=s;else{m=Math.ceil(4*s/(t+s));t=4-m}t={directional:m,point:t};m=50;if(h!==undefined&&h instanceof THREE.SkinnedMesh)m=h.bones.length;r={map:e.map,envMap:e.envMap,lightMap:e.lightMap,vertexColors:e.vertexColors,fog:k,sizeAttenuation:e.sizeAttenuation,skinning:e.skinning,morphTargets:e.morphTargets,maxDirLights:t.directional,maxPointLights:t.point,maxBones:m};k=e.fragmentShader;
-t=e.vertexShader;m=b.createProgram();q=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+r.maxDirLights,"#define MAX_POINT_LIGHTS "+r.maxPointLights,r.fog?"#define USE_FOG":"",r.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",r.map?"#define USE_MAP":"",r.envMap?"#define USE_ENVMAP":"",r.lightMap?"#define USE_LIGHTMAP":"",r.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");r=[b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>
-0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+r.maxDirLights,"#define MAX_POINT_LIGHTS "+r.maxPointLights,"#define MAX_BONES "+r.maxBones,r.map?"#define USE_MAP":"",r.envMap?"#define USE_ENVMAP":"",r.lightMap?"#define USE_LIGHTMAP":"",r.vertexColors?"#define USE_COLOR":"",r.skinning?"#define USE_SKINNING":"",r.morphTargets?"#define USE_MORPHTARGETS":"",r.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
-b.attachShader(m,ka("fragment",q+k));b.attachShader(m,ka("vertex",r+t));b.linkProgram(m);b.getProgramParameter(m,b.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+b.getProgramParameter(m,b.VALIDATE_STATUS)+", gl error ["+b.getError()+"]");m.uniforms={};m.attributes={};e.program=m;k=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(n in e.uniforms)k.push(n);
-n=e.program;t=0;for(m=k.length;t<m;t++){q=k[t];n.uniforms[q]=b.getUniformLocation(n,q)}k=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(n=0;n<this.maxMorphTargets;n++)k.push("morphTarget"+n);for(u in e.attributes)k.push(u);u=e.program;n=k;k=0;for(t=n.length;k<t;k++){m=n[k];u.attributes[m]=b.getAttribLocation(u,m)}u=e.program.attributes;b.enableVertexAttribArray(u.position);u.color>=0&&b.enableVertexAttribArray(u.color);u.normal>=0&&b.enableVertexAttribArray(u.normal);
-u.tangent>=0&&b.enableVertexAttribArray(u.tangent);if(e.skinning&&u.skinVertexA>=0&&u.skinVertexB>=0&&u.skinIndex>=0&&u.skinWeight>=0){b.enableVertexAttribArray(u.skinVertexA);b.enableVertexAttribArray(u.skinVertexB);b.enableVertexAttribArray(u.skinIndex);b.enableVertexAttribArray(u.skinWeight)}if(e.morphTargets){e.numSupportedMorphTargets=0;if(u.morphTarget0>=0){b.enableVertexAttribArray(u.morphTarget0);e.numSupportedMorphTargets++}if(u.morphTarget1>=0){b.enableVertexAttribArray(u.morphTarget1);
-e.numSupportedMorphTargets++}if(u.morphTarget2>=0){b.enableVertexAttribArray(u.morphTarget2);e.numSupportedMorphTargets++}if(u.morphTarget3>=0){b.enableVertexAttribArray(u.morphTarget3);e.numSupportedMorphTargets++}if(u.morphTarget4>=0){b.enableVertexAttribArray(u.morphTarget4);e.numSupportedMorphTargets++}if(u.morphTarget5>=0){b.enableVertexAttribArray(u.morphTarget5);e.numSupportedMorphTargets++}if(u.morphTarget6>=0){b.enableVertexAttribArray(u.morphTarget6);e.numSupportedMorphTargets++}if(u.morphTarget7>=
-0){b.enableVertexAttribArray(u.morphTarget7);e.numSupportedMorphTargets++}h.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);n=0;for(u=this.maxMorphTargets;n<u;n++)h.__webglMorphTargetInfluences[n]=0}}e.__webglProgram=!0};this.render=function(e,m,k,h){var n,u,r,t,q,A,s,G,B=e.lights,L=e.fog;m.matrixAutoUpdate&&m.updateMatrix();e.update(undefined,!1,m);m.matrixWorldInverse.flattenToArray(Qa);m.projectionMatrix.flattenToArray(La);ca.multiply(m.projectionMatrix,m.matrixWorldInverse);
-p(ca);this.initWebGLObjects(e);Fa(k);(this.autoClear||h)&&this.clear();q=e.__webglObjects.length;for(h=0;h<q;h++){n=e.__webglObjects[h];s=n.object;if(s.visible)if(!(s instanceof THREE.Mesh)||v(s)){s.matrixWorld.flattenToArray(s._objectMatrixArray);T(s,m);D(n);n.render=!0;if(this.sortObjects){Ra.copy(s.position);ca.multiplyVector3(Ra);n.z=Ra.z}}else n.render=!1;else n.render=!1}this.sortObjects&&e.__webglObjects.sort(z);A=e.__webglObjectsImmediate.length;for(h=0;h<A;h++){n=e.__webglObjectsImmediate[h];
-s=n.object;if(s.visible){s.matrixAutoUpdate&&s.matrixWorld.flattenToArray(s._objectMatrixArray);T(s,m);y(n)}}qa(THREE.NormalBlending);for(h=0;h<q;h++){n=e.__webglObjects[h];if(n.render){s=n.object;G=n.buffer;r=n.opaque;j(s);for(n=0;n<r.count;n++){t=r.list[n];o(t.depthTest);f(m,B,L,t,G,s)}}}for(h=0;h<A;h++){n=e.__webglObjectsImmediate[h];s=n.object;if(s.visible){r=n.opaque;j(s);for(n=0;n<r.count;n++){t=r.list[n];o(t.depthTest);u=g(m,B,L,t,s);s.render(function(I){i(I,u)})}}}for(h=0;h<q;h++){n=e.__webglObjects[h];
-if(n.render){s=n.object;G=n.buffer;r=n.transparent;j(s);for(n=0;n<r.count;n++){t=r.list[n];qa(t.blending);o(t.depthTest);f(m,B,L,t,G,s)}}}for(h=0;h<A;h++){n=e.__webglObjectsImmediate[h];s=n.object;if(s.visible){r=n.transparent;j(s);for(n=0;n<r.count;n++){t=r.list[n];qa(t.blending);o(t.depthTest);u=g(m,B,L,t,s);s.render(function(I){i(I,u)})}}}Na&&e.__webglShadowVolumes.length&&e.lights.length&&K(e);e.__webglLensFlares.length&&M(e,m);if(k&&k.minFilter!==THREE.NearestFilter&&k.minFilter!==THREE.LinearFilter){b.bindTexture(b.TEXTURE_2D,
-k.__webglTexture);b.generateMipmap(b.TEXTURE_2D);b.bindTexture(b.TEXTURE_2D,null)}};this.initWebGLObjects=function(e){if(!e.__webglObjects){e.__webglObjects=[];e.__webglObjectsImmediate=[];e.__webglShadowVolumes=[];e.__webglLensFlares=[]}for(;e.__objectsAdded.length;){var m=e.__objectsAdded[0],k=e,h=void 0,n=void 0,u=void 0;if(m._modelViewMatrix==undefined){m._modelViewMatrix=new THREE.Matrix4;m._normalMatrixArray=new Float32Array(9);m._modelViewMatrixArray=new Float32Array(16);m._objectMatrixArray=
-new Float32Array(16);m.matrixWorld.flattenToArray(m._objectMatrixArray)}if(m instanceof THREE.Mesh){n=m.geometry;n.geometryGroups==undefined&&pa(n);for(h in n.geometryGroups){u=n.geometryGroups[h];if(!u.__webglVertexBuffer){var r=u;r.__webglVertexBuffer=b.createBuffer();r.__webglNormalBuffer=b.createBuffer();r.__webglTangentBuffer=b.createBuffer();r.__webglColorBuffer=b.createBuffer();r.__webglUVBuffer=b.createBuffer();r.__webglUV2Buffer=b.createBuffer();r.__webglSkinVertexABuffer=b.createBuffer();
-r.__webglSkinVertexBBuffer=b.createBuffer();r.__webglSkinIndicesBuffer=b.createBuffer();r.__webglSkinWeightsBuffer=b.createBuffer();r.__webglFaceBuffer=b.createBuffer();r.__webglLineBuffer=b.createBuffer();if(r.numMorphTargets){var t=void 0,q=void 0;r.__webglMorphTargetsBuffers=[];t=0;for(q=r.numMorphTargets;t<q;t++)r.__webglMorphTargetsBuffers.push(b.createBuffer())}r=u;t=m;var A=void 0,s=void 0,G=void 0;G=void 0;var B=q=0,L=0;A=void 0;s=void 0;var I=void 0;s=void 0;var P=t.geometry;I=P.faces;var N=
-r.faces;A=0;for(s=N.length;A<s;A++){G=N[A];G=I[G];if(G instanceof THREE.Face3){q+=3;B+=1;L+=3}else if(G instanceof THREE.Face4){q+=4;B+=2;L+=4}}A=r;s=t;I=void 0;N=void 0;var R=void 0,C=void 0;R=void 0;G=[];I=0;for(N=s.materials.length;I<N;I++){R=s.materials[I];if(R instanceof THREE.MeshFaceMaterial){R=0;for(l=A.materials.length;R<l;R++)(C=A.materials[R])&&G.push(C)}else(C=R)&&G.push(C)}s=G;a:{A=void 0;I=void 0;N=s.length;for(A=0;A<N;A++){I=s[A];if(I.map||I.lightMap||I instanceof THREE.MeshShaderMaterial){A=
-!0;break a}}A=!1}a:{I=void 0;N=void 0;G=s.length;for(I=0;I<G;I++){N=s[I];if(!(N instanceof THREE.MeshBasicMaterial&&!N.envMap||N instanceof THREE.MeshDepthMaterial)){I=N&&N.shading!=undefined&&N.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}}I=!1}a:{N=void 0;G=void 0;R=s.length;for(N=0;N<R;N++){G=s[N];if(G.vertexColors){s=G.vertexColors;break a}}s=!1}r.__vertexArray=new Float32Array(q*3);if(I)r.__normalArray=new Float32Array(q*3);if(P.hasTangents)r.__tangentArray=new Float32Array(q*
-4);if(s)r.__colorArray=new Float32Array(q*3);if(A){if(P.faceUvs.length>0||P.faceVertexUvs.length>0)r.__uvArray=new Float32Array(q*2);if(P.faceUvs.length>1||P.faceVertexUvs.length>1)r.__uv2Array=new Float32Array(q*2)}if(t.geometry.skinWeights.length&&t.geometry.skinIndices.length){r.__skinVertexAArray=new Float32Array(q*4);r.__skinVertexBArray=new Float32Array(q*4);r.__skinIndexArray=new Float32Array(q*4);r.__skinWeightArray=new Float32Array(q*4)}r.__faceArray=new Uint16Array(B*3+(t.geometry.edgeFaces?
-t.geometry.edgeFaces.length*6:0));r.__lineArray=new Uint16Array(L*2);if(r.numMorphTargets){P=void 0;N=void 0;r.__morphTargetsArrays=[];P=0;for(N=r.numMorphTargets;P<N;P++)r.__morphTargetsArrays.push(new Float32Array(q*3))}r.__needsSmoothNormals=I==THREE.SmoothShading;r.__uvType=A;r.__vertexColorType=s;r.__normalType=I;r.__webglFaceCount=B*3+(t.geometry.edgeFaces?t.geometry.edgeFaces.length*6:0);r.__webglLineCount=L*2;n.__dirtyVertices=!0;n.__dirtyMorphTargets=!0;n.__dirtyElements=!0;n.__dirtyUvs=
-!0;n.__dirtyNormals=!0;n.__dirtyTangents=!0;n.__dirtyColors=!0}m instanceof THREE.ShadowVolume?Y(k.__webglShadowVolumes,u,m):Y(k.__webglObjects,u,m)}}else if(m instanceof THREE.LensFlare)Y(k.__webglLensFlares,undefined,m);else if(m instanceof THREE.Ribbon){n=m.geometry;if(!n.__webglVertexBuffer){h=n;h.__webglVertexBuffer=b.createBuffer();h.__webglColorBuffer=b.createBuffer();h=n;u=h.vertices.length;h.__vertexArray=new Float32Array(u*3);h.__colorArray=new Float32Array(u*3);h.__webglVertexCount=u;n.__dirtyVertices=
-!0;n.__dirtyColors=!0}Y(k.__webglObjects,n,m)}else if(m instanceof THREE.Line){n=m.geometry;if(!n.__webglVertexBuffer){h=n;h.__webglVertexBuffer=b.createBuffer();h.__webglColorBuffer=b.createBuffer();h=n;u=h.vertices.length;h.__vertexArray=new Float32Array(u*3);h.__colorArray=new Float32Array(u*3);h.__webglLineCount=u;n.__dirtyVertices=!0;n.__dirtyColors=!0}Y(k.__webglObjects,n,m)}else if(m instanceof THREE.ParticleSystem){n=m.geometry;if(!n.__webglVertexBuffer){h=n;h.__webglVertexBuffer=b.createBuffer();
-h.__webglColorBuffer=b.createBuffer();h=n;u=h.vertices.length;h.__vertexArray=new Float32Array(u*3);h.__colorArray=new Float32Array(u*3);h.__sortArray=[];h.__webglParticleCount=u;n.__dirtyVertices=!0;n.__dirtyColors=!0}Y(k.__webglObjects,n,m)}else THREE.MarchingCubes!==undefined&&m instanceof THREE.MarchingCubes&&k.__webglObjectsImmediate.push({object:m,opaque:{list:[],count:0},transparent:{list:[],count:0}});e.__objectsAdded.splice(0,1)}for(;e.__objectsRemoved.length;){m=e.__objectsRemoved[0];k=
-e;n=void 0;h=void 0;for(n=k.__webglObjects.length-1;n>=0;n--){h=k.__webglObjects[n].object;m==h&&k.__webglObjects.splice(n,1)}e.__objectsRemoved.splice(0,1)}m=0;for(k=e.__webglObjects.length;m<k;m++)O(e.__webglObjects[m].object,e);m=0;for(k=e.__webglShadowVolumes.length;m<k;m++)O(e.__webglShadowVolumes[m].object,e);m=0;for(k=e.__webglLensFlares.length;m<k;m++)O(e.__webglLensFlares[m].object,e)};this.setFaceCulling=function(e,m){if(e){!m||m=="ccw"?b.frontFace(b.CCW):b.frontFace(b.CW);if(e=="back")b.cullFace(b.BACK);
-else e=="front"?b.cullFace(b.FRONT):b.cullFace(b.FRONT_AND_BACK);b.enable(b.CULL_FACE)}else b.disable(b.CULL_FACE)};this.supportsVertexTextures=function(){return b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};
-THREE.WebGLRenderTarget=function(a,c,d){this.width=a;this.height=c;d=d||{};this.wrapS=d.wrapS!==undefined?d.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=d.wrapT!==undefined?d.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=d.magFilter!==undefined?d.magFilter:THREE.LinearFilter;this.minFilter=d.minFilter!==undefined?d.minFilter:THREE.LinearMipMapLinearFilter;this.format=d.format!==undefined?d.format:THREE.RGBFormat;this.type=d.type!==undefined?d.type:THREE.UnsignedByteType};
+THREE.WebGLRenderer=function(b){function d(f,o,n){var i,m,y,s=f.vertices,t=s.length,w=f.colors,r=w.length,u=f.__vertexArray,E=f.__colorArray,M=f.__sortArray,A=f.__dirtyVertices,Q=f.__dirtyColors;if(n.sortParticles){fa.multiplySelf(n.matrixWorld);for(i=0;i<t;i++){m=s[i].position;Ua.copy(m);fa.multiplyVector3(Ua);M[i]=[Ua.z,i]}M.sort(function(U,R){return R[0]-U[0]});for(i=0;i<t;i++){m=s[M[i][1]].position;y=i*3;u[y]=m.x;u[y+1]=m.y;u[y+2]=m.z}for(i=0;i<r;i++){y=i*3;color=w[M[i][1]];E[y]=color.r;E[y+1]=
+color.g;E[y+2]=color.b}}else{if(A)for(i=0;i<t;i++){m=s[i].position;y=i*3;u[y]=m.x;u[y+1]=m.y;u[y+2]=m.z}if(Q)for(i=0;i<r;i++){color=w[i];y=i*3;E[y]=color.r;E[y+1]=color.g;E[y+2]=color.b}}if(A||n.sortParticles){c.bindBuffer(c.ARRAY_BUFFER,f.__webglVertexBuffer);c.bufferData(c.ARRAY_BUFFER,u,o)}if(Q||n.sortParticles){c.bindBuffer(c.ARRAY_BUFFER,f.__webglColorBuffer);c.bufferData(c.ARRAY_BUFFER,E,o)}}function e(f,o){f.uniforms=Uniforms.clone(o.uniforms);f.vertexShader=o.vertexShader;f.fragmentShader=
+o.fragmentShader}function h(f,o,n,i,m){i.__webglProgram||wa.initMaterial(i,o,n,m);var y=i.program,s=y.uniforms,t=i.uniforms;if(y!=ma){c.useProgram(y);ma=y}c.uniformMatrix4fv(s.projectionMatrix,!1,Oa);if(n&&(i instanceof THREE.MeshBasicMaterial||i instanceof THREE.MeshLambertMaterial||i instanceof THREE.MeshPhongMaterial||i instanceof THREE.LineBasicMaterial||i instanceof THREE.ParticleBasicMaterial||i.fog)){t.fogColor.value.setHex(n.color.hex);if(n instanceof THREE.Fog){t.fogNear.value=n.near;t.fogFar.value=
+n.far}else if(n instanceof THREE.FogExp2)t.fogDensity.value=n.density}if(i instanceof THREE.MeshPhongMaterial||i instanceof THREE.MeshLambertMaterial||i.lights){var w,r,u=0,E=0,M=0,A,Q,U,R,T=gb,Fa=T.directional.colors,H=T.directional.positions,D=T.point.colors,I=T.point.positions,Y=T.point.distances,B=0,x=0;n=r=R=0;for(w=o.length;n<w;n++){r=o[n];A=r.color;Q=r.position;U=r.intensity;R=r.distance;if(r instanceof THREE.AmbientLight){u+=A.r;E+=A.g;M+=A.b}else if(r instanceof THREE.DirectionalLight){R=
+B*3;Fa[R]=A.r*U;Fa[R+1]=A.g*U;Fa[R+2]=A.b*U;H[R]=Q.x;H[R+1]=Q.y;H[R+2]=Q.z;B+=1}else if(r instanceof THREE.PointLight){r=x*3;D[r]=A.r*U;D[r+1]=A.g*U;D[r+2]=A.b*U;I[r]=Q.x;I[r+1]=Q.y;I[r+2]=Q.z;Y[x]=R;x+=1}}for(n=B*3;n<Fa.length;n++)Fa[n]=0;for(n=x*3;n<D.length;n++)D[n]=0;T.point.length=x;T.directional.length=B;T.ambient[0]=u;T.ambient[1]=E;T.ambient[2]=M;n=gb;t.enableLighting.value=n.directional.length+n.point.length;t.ambientLightColor.value=n.ambient;t.directionalLightColor.value=n.directional.colors;
+t.directionalLightDirection.value=n.directional.positions;t.pointLightColor.value=n.point.colors;t.pointLightPosition.value=n.point.positions;t.pointLightDistance.value=n.point.distances}if(i instanceof THREE.MeshBasicMaterial||i instanceof THREE.MeshLambertMaterial||i instanceof THREE.MeshPhongMaterial){t.diffuse.value.setRGB(i.color.r,i.color.g,i.color.b);t.opacity.value=i.opacity;t.map.texture=i.map;t.lightMap.texture=i.lightMap;t.envMap.texture=i.envMap;t.reflectivity.value=i.reflectivity;t.refractionRatio.value=
+i.refractionRatio;t.combine.value=i.combine;t.useRefract.value=i.envMap&&i.envMap.mapping instanceof THREE.CubeRefractionMapping}if(i instanceof THREE.LineBasicMaterial){t.diffuse.value.setRGB(i.color.r,i.color.g,i.color.b);t.opacity.value=i.opacity}else if(i instanceof THREE.ParticleBasicMaterial){t.psColor.value.setRGB(i.color.r,i.color.g,i.color.b);t.opacity.value=i.opacity;t.size.value=i.size;t.scale.value=S.height/2;t.map.texture=i.map}else if(i instanceof THREE.MeshPhongMaterial){t.ambient.value.setRGB(i.ambient.r,
+i.ambient.g,i.ambient.b);t.specular.value.setRGB(i.specular.r,i.specular.g,i.specular.b);t.shininess.value=i.shininess}else if(i instanceof THREE.MeshDepthMaterial){t.mNear.value=f.near;t.mFar.value=f.far;t.opacity.value=i.opacity}else if(i instanceof THREE.MeshNormalMaterial)t.opacity.value=i.opacity;for(var qa in t)if(E=y.uniforms[qa]){w=t[qa];u=w.type;n=w.value;if(u=="i")c.uniform1i(E,n);else if(u=="f")c.uniform1f(E,n);else if(u=="fv1")c.uniform1fv(E,n);else if(u=="fv")c.uniform3fv(E,n);else if(u==
+"v2")c.uniform2f(E,n.x,n.y);else if(u=="v3")c.uniform3f(E,n.x,n.y,n.z);else if(u=="v4")c.uniform4f(E,n.x,n.y,n.z,n.w);else if(u=="c")c.uniform3f(E,n.r,n.g,n.b);else if(u=="t"){c.uniform1i(E,n);if(w=w.texture)if(w.image instanceof Array&&w.image.length==6){if(w.image.length==6){if(w.needsUpdate){if(w.__webglInit){c.bindTexture(c.TEXTURE_CUBE_MAP,w.image.__webglTextureCube);for(u=0;u<6;++u)c.texSubImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+u,0,0,0,c.RGBA,c.UNSIGNED_BYTE,w.image[u])}else{w.image.__webglTextureCube=
+c.createTexture();c.bindTexture(c.TEXTURE_CUBE_MAP,w.image.__webglTextureCube);for(u=0;u<6;++u)c.texImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+u,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,w.image[u]);w.__webglInit=!0}Z(c.TEXTURE_CUBE_MAP,w,w.image[0]);c.bindTexture(c.TEXTURE_CUBE_MAP,null);w.needsUpdate=!1}c.activeTexture(c.TEXTURE0+n);c.bindTexture(c.TEXTURE_CUBE_MAP,w.image.__webglTextureCube)}}else K(w,n)}}c.uniformMatrix4fv(s.modelViewMatrix,!1,m._modelViewMatrixArray);c.uniformMatrix3fv(s.normalMatrix,!1,m._normalMatrixArray);
+(i instanceof THREE.MeshShaderMaterial||i instanceof THREE.MeshPhongMaterial||i.envMap)&&c.uniform3f(s.cameraPosition,f.position.x,f.position.y,f.position.z);(i instanceof THREE.MeshShaderMaterial||i.envMap||i.skinning)&&c.uniformMatrix4fv(s.objectMatrix,!1,m._objectMatrixArray);(i instanceof THREE.MeshPhongMaterial||i instanceof THREE.MeshLambertMaterial||i instanceof THREE.MeshShaderMaterial||i.skinning)&&c.uniformMatrix4fv(s.viewMatrix,!1,Ta);if(i instanceof THREE.ShadowVolumeDynamicMaterial){f=
+t.directionalLightDirection.value;f[0]=-o.position.x;f[1]=-o.position.y;f[2]=-o.position.z;c.uniform3fv(s.directionalLightDirection,f);c.uniformMatrix4fv(s.objectMatrix,!1,m._objectMatrixArray);c.uniformMatrix4fv(s.viewMatrix,!1,Ta)}if(i.skinning){c.uniformMatrix4fv(s.cameraInverseMatrix,!1,Ta);c.uniformMatrix4fv(s.boneGlobalMatrices,!1,m.boneMatrices)}return y}function g(f,o,n,i,m,y){if(i.opacity!=0){var s;f=h(f,o,n,i,y).attributes;if(i.morphTargets){o=i.program.attributes;y.morphTargetBase!==-1?
+c.bindBuffer(c.ARRAY_BUFFER,m.__webglMorphTargetsBuffers[y.morphTargetBase]):c.bindBuffer(c.ARRAY_BUFFER,m.__webglVertexBuffer);c.vertexAttribPointer(o.position,3,c.FLOAT,!1,0,0);if(y.morphTargetForcedOrder.length){n=0;for(var t=y.morphTargetForcedOrder,w=y.morphTargetInfluences;n<i.numSupportedMorphTargets&&n<t.length;){c.bindBuffer(c.ARRAY_BUFFER,m.__webglMorphTargetsBuffers[t[n]]);c.vertexAttribPointer(o["morphTarget"+n],3,c.FLOAT,!1,0,0);y.__webglMorphTargetInfluences[n]=w[t[n]];n++}}else{t=[];
+var r=-1,u=0;w=y.morphTargetInfluences;var E,M=w.length;n=0;for(y.morphTargetBase!==-1&&(t[y.morphTargetBase]=!0);n<i.numSupportedMorphTargets;){for(E=0;E<M;E++)if(!t[E]&&w[E]>r){u=E;r=w[u]}c.bindBuffer(c.ARRAY_BUFFER,m.__webglMorphTargetsBuffers[u]);c.vertexAttribPointer(o["morphTarget"+n],3,c.FLOAT,!1,0,0);y.__webglMorphTargetInfluences[n]=r;t[u]=1;r=-1;n++}}c.uniform1fv(i.program.uniforms.morphTargetInfluences,y.__webglMorphTargetInfluences)}else{c.bindBuffer(c.ARRAY_BUFFER,m.__webglVertexBuffer);
+c.vertexAttribPointer(f.position,3,c.FLOAT,!1,0,0)}if(m.__webglCustomAttributes)for(s in m.__webglCustomAttributes)if(f[s]>=0){o=m.__webglCustomAttributes[s];c.bindBuffer(c.ARRAY_BUFFER,o.buffer);c.vertexAttribPointer(f[s],o.size,c.FLOAT,!1,0,0)}if(f.color>=0){c.bindBuffer(c.ARRAY_BUFFER,m.__webglColorBuffer);c.vertexAttribPointer(f.color,3,c.FLOAT,!1,0,0)}if(f.normal>=0){c.bindBuffer(c.ARRAY_BUFFER,m.__webglNormalBuffer);c.vertexAttribPointer(f.normal,3,c.FLOAT,!1,0,0)}if(f.tangent>=0){c.bindBuffer(c.ARRAY_BUFFER,
+m.__webglTangentBuffer);c.vertexAttribPointer(f.tangent,4,c.FLOAT,!1,0,0)}if(f.uv>=0)if(m.__webglUVBuffer){c.bindBuffer(c.ARRAY_BUFFER,m.__webglUVBuffer);c.vertexAttribPointer(f.uv,2,c.FLOAT,!1,0,0);c.enableVertexAttribArray(f.uv)}else c.disableVertexAttribArray(f.uv);if(f.uv2>=0)if(m.__webglUV2Buffer){c.bindBuffer(c.ARRAY_BUFFER,m.__webglUV2Buffer);c.vertexAttribPointer(f.uv2,2,c.FLOAT,!1,0,0);c.enableVertexAttribArray(f.uv2)}else c.disableVertexAttribArray(f.uv2);if(i.skinning&&f.skinVertexA>=0&&
+f.skinVertexB>=0&&f.skinIndex>=0&&f.skinWeight>=0){c.bindBuffer(c.ARRAY_BUFFER,m.__webglSkinVertexABuffer);c.vertexAttribPointer(f.skinVertexA,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,m.__webglSkinVertexBBuffer);c.vertexAttribPointer(f.skinVertexB,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,m.__webglSkinIndicesBuffer);c.vertexAttribPointer(f.skinIndex,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,m.__webglSkinWeightsBuffer);c.vertexAttribPointer(f.skinWeight,4,c.FLOAT,!1,0,0)}if(y instanceof
+THREE.Mesh)if(i.wireframe){c.lineWidth(i.wireframeLinewidth);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,m.__webglLineBuffer);c.drawElements(c.LINES,m.__webglLineCount,c.UNSIGNED_SHORT,0)}else{c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,m.__webglFaceBuffer);c.drawElements(c.TRIANGLES,m.__webglFaceCount,c.UNSIGNED_SHORT,0)}else if(y instanceof THREE.Line){y=y.type==THREE.LineStrip?c.LINE_STRIP:c.LINES;c.lineWidth(i.linewidth);c.drawArrays(y,0,m.__webglLineCount)}else if(y instanceof THREE.ParticleSystem)c.drawArrays(c.POINTS,
+0,m.__webglParticleCount);else y instanceof THREE.Ribbon&&c.drawArrays(c.TRIANGLE_STRIP,0,m.__webglVertexCount)}}function j(f,o){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(o.attributes.position);c.vertexAttribPointer(o.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(o.attributes.normal);c.vertexAttribPointer(o.attributes.normal,3,c.FLOAT,!1,0,0)}c.drawArrays(c.TRIANGLES,0,f.count);f.count=0}function k(f){if($!=f.doubleSided){f.doubleSided?c.disable(c.CULL_FACE):c.enable(c.CULL_FACE);$=f.doubleSided}if(oa!=f.flipSided){f.flipSided?c.frontFace(c.CW):c.frontFace(c.CCW);oa=f.flipSided}}function p(f){if(pa!=f){f?c.enable(c.DEPTH_TEST):c.disable(c.DEPTH_TEST);
+pa=f}}function q(f){xa[0].set(f.n41-f.n11,f.n42-f.n12,f.n43-f.n13,f.n44-f.n14);xa[1].set(f.n41+f.n11,f.n42+f.n12,f.n43+f.n13,f.n44+f.n14);xa[2].set(f.n41+f.n21,f.n42+f.n22,f.n43+f.n23,f.n44+f.n24);xa[3].set(f.n41-f.n21,f.n42-f.n22,f.n43-f.n23,f.n44-f.n24);xa[4].set(f.n41-f.n31,f.n42-f.n32,f.n43-f.n33,f.n44-f.n34);xa[5].set(f.n41+f.n31,f.n42+f.n32,f.n43+f.n33,f.n44+f.n34);var o;for(f=0;f<6;f++){o=xa[f];o.divideScalar(Math.sqrt(o.x*o.x+o.y*o.y+o.z*o.z))}}function v(f){for(var o=f.matrixWorld,n=-f.geometry.boundingSphere.radius*
+Math.max(f.scale.x,Math.max(f.scale.y,f.scale.z)),i=0;i<6;i++){f=xa[i].x*o.n14+xa[i].y*o.n24+xa[i].z*o.n34+xa[i].w;if(f<=n)return!1}return!0}function C(f,o){f.list[f.count]=o;f.count+=1}function F(f){var o,n,i=f.object,m=f.opaque,y=f.transparent;y.count=0;f=m.count=0;for(o=i.materials.length;f<o;f++){n=i.materials[f];n.transparent?C(y,n):C(m,n)}}function J(f){var o,n,i,m,y=f.object,s=f.buffer,t=f.opaque,w=f.transparent;w.count=0;f=t.count=0;for(i=y.materials.length;f<i;f++){o=y.materials[f];if(o instanceof
+THREE.MeshFaceMaterial){o=0;for(n=s.materials.length;o<n;o++)(m=s.materials[o])&&(m.transparent?C(w,m):C(t,m))}else(m=o)&&(m.transparent?C(w,m):C(t,m))}}function G(f,o){return o.z-f.z}function N(f){c.enable(c.POLYGON_OFFSET_FILL);c.polygonOffset(0.1,1);c.enable(c.STENCIL_TEST);c.depthMask(!1);c.colorMask(!1,!1,!1,!1);c.stencilFunc(c.ALWAYS,1,255);c.stencilOpSeparate(c.BACK,c.KEEP,c.INCR,c.KEEP);c.stencilOpSeparate(c.FRONT,c.KEEP,c.DECR,c.KEEP);var o,n=f.lights.length,i,m=f.lights,y=[],s,t,w,r,u,E=
+f.__webglShadowVolumes.length;for(o=0;o<n;o++){i=f.lights[o];if(i instanceof THREE.DirectionalLight){y[0]=-i.position.x;y[1]=-i.position.y;y[2]=-i.position.z;for(u=0;u<E;u++){i=f.__webglShadowVolumes[u].object;s=f.__webglShadowVolumes[u].buffer;t=i.materials[0];t.program||wa.initMaterial(t,m,undefined,i);t=t.program;w=t.uniforms;r=t.attributes;if(ma!==t){c.useProgram(t);ma=t;c.uniformMatrix4fv(w.projectionMatrix,!1,Oa);c.uniformMatrix4fv(w.viewMatrix,!1,Ta);c.uniform3fv(w.directionalLightDirection,
+y)}i.matrixWorld.flattenToArray(i._objectMatrixArray);c.uniformMatrix4fv(w.objectMatrix,!1,i._objectMatrixArray);c.bindBuffer(c.ARRAY_BUFFER,s.__webglVertexBuffer);c.vertexAttribPointer(r.position,3,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,s.__webglNormalBuffer);c.vertexAttribPointer(r.normal,3,c.FLOAT,!1,0,0);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,s.__webglFaceBuffer);c.cullFace(c.FRONT);c.drawElements(c.TRIANGLES,s.__webglFaceCount,c.UNSIGNED_SHORT,0);c.cullFace(c.BACK);c.drawElements(c.TRIANGLES,
+s.__webglFaceCount,c.UNSIGNED_SHORT,0)}}}c.disable(c.POLYGON_OFFSET_FILL);c.colorMask(!0,!0,!0,!0);c.stencilFunc(c.NOTEQUAL,0,255);c.stencilOp(c.KEEP,c.KEEP,c.KEEP);c.disable(c.DEPTH_TEST);ea="";ma=V.program;c.useProgram(V.program);c.uniformMatrix4fv(V.projectionLocation,!1,Oa);c.uniform1f(V.darknessLocation,V.darkness);c.bindBuffer(c.ARRAY_BUFFER,V.vertexBuffer);c.vertexAttribPointer(V.vertexLocation,3,c.FLOAT,!1,0,0);c.enableVertexAttribArray(V.vertexLocation);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA);
+c.blendEquation(c.FUNC_ADD);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,V.elementBuffer);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0);c.disable(c.STENCIL_TEST);c.enable(c.DEPTH_TEST);c.depthMask(Ea)}function O(f,o){var n,i,m,y=f.__webglLensFlares.length,s,t,w;s=new THREE.Vector3;var r=Aa/na;t=na*0.5;w=Aa*0.5;var u=16/Aa,E=[u*r,u],M=[1,1,0];u=[1,1];var A,Q=L.readBackPixels,U,R,T=L.uniforms;n=L.attributes;c.useProgram(L.program);ma=L.program;ea="";c.uniform1i(T.map,0);c.activeTexture(c.TEXTURE0);c.uniform1f(T.opacity,
+1);c.uniform1f(T.rotation,0);c.uniform2fv(T.scale,E);c.bindBuffer(c.ARRAY_BUFFER,L.vertexBuffer);c.vertexAttribPointer(n.vertex,2,c.FLOAT,!1,16,0);c.vertexAttribPointer(n.uv,2,c.FLOAT,!1,16,8);c.bindTexture(c.TEXTURE_2D,L.tempTexture);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,L.elementBuffer);c.disable(c.CULL_FACE);c.depthMask(!1);for(m=0;m<y;m++){n=f.__webglLensFlares[m].object;s.set(n.matrixWorld.n14,n.matrixWorld.n24,n.matrixWorld.n34);o.matrixWorldInverse.multiplyVector3(s);i=s.z;o.projectionMatrix.multiplyVector3(s);
+M[0]=s.x;M[1]=s.y;M[2]=s.z;u[0]=M[0]*t+t;u[1]=M[1]*w+w;c.copyTexSubImage2D(c.TEXTURE_2D,0,0,0,u[0]-8,u[1]-8,16,16);c.uniform3fv(T.screenPosition,M);c.uniform1i(T.renderPink,1);c.enable(c.DEPTH_TEST);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0);try{c.readPixels(u[0]-8,u[1]-8,16,16,c.RGBA,c.UNSIGNED_BYTE,L.readBackPixels)}catch(Fa){console.log("WebGLRenderer.renderLensFlare: readPixels failed!")}c.getError()&&console.log("WebGLRenderer.renderLensFlare: readPixels failed!");sampleDistance=parseInt(5*
+(1-Math.max(0,Math.min(-i,o.far))/o.far),10)+2;i=sampleDistance*4;A=sampleDistance*64;R=0;U=28-i+(448-A);L.readBackPixels[U+0]===255&&L.readBackPixels[U+1]===0&&L.readBackPixels[U+2]===255&&(R+=0.2);U=28+i+(448-A);Q[U+0]===255&&Q[U+1]===0&&Q[U+2]===255&&(R+=0.2);U=28+i+(448+A);Q[U+0]===255&&Q[U+1]===0&&Q[U+2]===255&&(R+=0.2);U=28-i+(448+A);Q[U+0]===255&&Q[U+1]===0&&Q[U+2]===255&&(R+=0.2);U=476;Q[U+0]===255&&Q[U+1]===0&&Q[U+2]===255&&(R+=0.2);n.positionScreen.x=M[0];n.positionScreen.y=M[1];n.positionScreen.z=
+M[2];n.customUpdateCallback?n.customUpdateCallback(R,n):n.updateLensFlares(R);c.uniform1i(T.renderPink,0);c.disable(c.DEPTH_TEST);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0)}for(m=0;m<y;m++){n=f.__webglLensFlares[m].object;s=0;for(t=n.lensFlares.length;s<t;s++){w=n.lensFlares[s];if(w.opacity>0.001&&w.scale>0.001){M[0]=w.x;M[1]=w.y;M[2]=w.z;u=w.size*w.scale/Aa;E[0]=u*r;E[1]=u;c.uniform3fv(T.screenPosition,M);c.uniform1f(T.rotation,w.rotation);c.uniform2fv(T.scale,E);c.uniform1f(T.opacity,w.opacity);
+sa(w.blending);K(w.texture,0);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0)}}}c.enable(c.CULL_FACE);c.enable(c.DEPTH_TEST);c.depthMask(Ea)}function W(f,o){f._modelViewMatrix.multiplyToArray(o.matrixWorldInverse,f.matrixWorld,f._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(f._modelViewMatrix).transposeIntoArray(f._normalMatrixArray)}function P(f){var o,n,i,m,y;if(f instanceof THREE.Mesh){n=f.geometry;for(o in n.geometryGroups){i=n.geometryGroups[o];y=!1;for(m in i.__webglCustomAttributes)if(i.__webglCustomAttributes[m].needsUpdate){y=
+!0;break}if(n.__dirtyVertices||n.__dirtyMorphTargets||n.__dirtyElements||n.__dirtyUvs||n.__dirtyNormals||n.__dirtyColors||n.__dirtyTangents||y){y=c.DYNAMIC_DRAW;var s=void 0,t=void 0,w=void 0,r=void 0;w=void 0;var u=void 0,E=void 0,M=void 0,A=void 0,Q=void 0,U=void 0,R=void 0,T=void 0,Fa=void 0,H=void 0,D=void 0,I=void 0,Y=void 0;E=void 0;M=void 0;r=void 0;A=void 0;r=void 0;H=void 0;D=void 0;E=void 0;H=void 0;D=void 0;I=void 0;Y=void 0;H=void 0;D=void 0;I=void 0;Y=void 0;H=void 0;D=void 0;I=void 0;
+Y=void 0;H=void 0;D=void 0;I=void 0;r=void 0;A=void 0;u=void 0;w=void 0;w=void 0;var B=void 0,x=void 0,qa=void 0,Xa=void 0,ta=0,ya=0,Za=0,$a=0,Ja=0,Ka=0,ca=0,La=0,va=0,z=0,za=0;B=0;var Ba=i.__vertexArray,hb=i.__uvArray,ib=i.__uv2Array,Pa=i.__normalArray,ga=i.__tangentArray,Ca=i.__colorArray,ha=i.__skinVertexAArray,ia=i.__skinVertexBArray,ja=i.__skinIndexArray,ka=i.__skinWeightArray,jb=i.__morphTargetsArrays,Ra=i.__webglCustomAttributes;x=void 0;var Ma=i.__faceArray,Na=i.__lineArray,qb=i.__needsSmoothNormals;
+U=i.__vertexColorType;Q=i.__uvType;R=i.__normalType;var Ha=f.geometry,kb=Ha.__dirtyVertices,lb=Ha.__dirtyElements,fb=Ha.__dirtyUvs,mb=Ha.__dirtyNormals,nb=Ha.__dirtyTangents,ob=Ha.__dirtyColors,pb=Ha.__dirtyMorphTargets,ab=Ha.vertices,rb=i.faces,vb=Ha.faces,sb=Ha.faceVertexUvs[0],tb=Ha.faceVertexUvs[1],bb=Ha.skinVerticesA,cb=Ha.skinVerticesB,db=Ha.skinIndices,Va=Ha.skinWeights,Ya=Ha.edgeFaces,Sa=Ha.morphTargets;if(Ra)for(Xa in Ra)Ra[Xa].offset=0;s=0;for(t=rb.length;s<t;s++){w=rb[s];r=vb[w];sb&&(T=
+sb[w]);tb&&(Fa=tb[w]);w=r.vertexNormals;u=r.normal;E=r.vertexColors;M=r.color;A=r.vertexTangents;if(r instanceof THREE.Face3){if(kb){H=ab[r.a].position;D=ab[r.b].position;I=ab[r.c].position;Ba[ya]=H.x;Ba[ya+1]=H.y;Ba[ya+2]=H.z;Ba[ya+3]=D.x;Ba[ya+4]=D.y;Ba[ya+5]=D.z;Ba[ya+6]=I.x;Ba[ya+7]=I.y;Ba[ya+8]=I.z;ya+=9}if(Ra)for(Xa in Ra){x=Ra[Xa];if(x.needsUpdate){B=x.offset;if(x.size===1){x.array[B+0]=x.value[r.a];x.array[B+1]=x.value[r.b];x.array[B+2]=x.value[r.c];x.offset+=3}else{H=x.value[r.a];D=x.value[r.b];
+I=x.value[r.c];if(x.size===2){x.array[B+0]=H.x;x.array[B+1]=H.y;x.array[B+2]=D.x;x.array[B+3]=D.y;x.array[B+4]=I.x;x.array[B+5]=I.y;x.offset+=6}else if(x.size===3){x.array[B+0]=H.x;x.array[B+1]=H.y;x.array[B+2]=H.z;x.array[B+3]=D.x;x.array[B+4]=D.y;x.array[B+5]=D.z;x.array[B+6]=I.x;x.array[B+7]=I.y;x.array[B+8]=I.z;x.offset+=9}else{x.array[B+0]=H.x;x.array[B+1]=H.y;x.array[B+2]=H.z;x.array[B+3]=H.w;x.array[B+4]=D.x;x.array[B+5]=D.y;x.array[B+6]=D.z;x.array[B+7]=D.w;x.array[B+8]=I.x;x.array[B+9]=I.y;
+x.array[B+10]=I.z;x.array[B+11]=I.w;x.offset+=12}}}}if(pb){B=0;for(x=Sa.length;B<x;B++){H=Sa[B].vertices[r.a].position;D=Sa[B].vertices[r.b].position;I=Sa[B].vertices[r.c].position;qa=jb[B];qa[za+0]=H.x;qa[za+1]=H.y;qa[za+2]=H.z;qa[za+3]=D.x;qa[za+4]=D.y;qa[za+5]=D.z;qa[za+6]=I.x;qa[za+7]=I.y;qa[za+8]=I.z}za+=9}if(Va.length){H=Va[r.a];D=Va[r.b];I=Va[r.c];ka[z]=H.x;ka[z+1]=H.y;ka[z+2]=H.z;ka[z+3]=H.w;ka[z+4]=D.x;ka[z+5]=D.y;ka[z+6]=D.z;ka[z+7]=D.w;ka[z+8]=I.x;ka[z+9]=I.y;ka[z+10]=I.z;ka[z+11]=I.w;
+H=db[r.a];D=db[r.b];I=db[r.c];ja[z]=H.x;ja[z+1]=H.y;ja[z+2]=H.z;ja[z+3]=H.w;ja[z+4]=D.x;ja[z+5]=D.y;ja[z+6]=D.z;ja[z+7]=D.w;ja[z+8]=I.x;ja[z+9]=I.y;ja[z+10]=I.z;ja[z+11]=I.w;H=bb[r.a];D=bb[r.b];I=bb[r.c];ha[z]=H.x;ha[z+1]=H.y;ha[z+2]=H.z;ha[z+3]=1;ha[z+4]=D.x;ha[z+5]=D.y;ha[z+6]=D.z;ha[z+7]=1;ha[z+8]=I.x;ha[z+9]=I.y;ha[z+10]=I.z;ha[z+11]=1;H=cb[r.a];D=cb[r.b];I=cb[r.c];ia[z]=H.x;ia[z+1]=H.y;ia[z+2]=H.z;ia[z+3]=1;ia[z+4]=D.x;ia[z+5]=D.y;ia[z+6]=D.z;ia[z+7]=1;ia[z+8]=I.x;ia[z+9]=I.y;ia[z+10]=I.z;ia[z+
+11]=1;z+=12}if(ob&&U){if(E.length==3&&U==THREE.VertexColors){r=E[0];H=E[1];D=E[2]}else D=H=r=M;Ca[va]=r.r;Ca[va+1]=r.g;Ca[va+2]=r.b;Ca[va+3]=H.r;Ca[va+4]=H.g;Ca[va+5]=H.b;Ca[va+6]=D.r;Ca[va+7]=D.g;Ca[va+8]=D.b;va+=9}if(nb&&Ha.hasTangents){E=A[0];M=A[1];r=A[2];ga[ca]=E.x;ga[ca+1]=E.y;ga[ca+2]=E.z;ga[ca+3]=E.w;ga[ca+4]=M.x;ga[ca+5]=M.y;ga[ca+6]=M.z;ga[ca+7]=M.w;ga[ca+8]=r.x;ga[ca+9]=r.y;ga[ca+10]=r.z;ga[ca+11]=r.w;ca+=12}if(mb&&R)if(w.length==3&&qb)for(A=0;A<3;A++){u=w[A];Pa[Ka]=u.x;Pa[Ka+1]=u.y;Pa[Ka+
+2]=u.z;Ka+=3}else for(A=0;A<3;A++){Pa[Ka]=u.x;Pa[Ka+1]=u.y;Pa[Ka+2]=u.z;Ka+=3}if(fb&&T!==undefined&&Q)for(A=0;A<3;A++){w=T[A];hb[Za]=w.u;hb[Za+1]=w.v;Za+=2}if(fb&&Fa!==undefined&&Q)for(A=0;A<3;A++){w=Fa[A];ib[$a]=w.u;ib[$a+1]=w.v;$a+=2}if(lb){Ma[Ja]=ta;Ma[Ja+1]=ta+1;Ma[Ja+2]=ta+2;Ja+=3;Na[La]=ta;Na[La+1]=ta+1;Na[La+2]=ta;Na[La+3]=ta+2;Na[La+4]=ta+1;Na[La+5]=ta+2;La+=6;ta+=3}}else if(r instanceof THREE.Face4){if(kb){H=ab[r.a].position;D=ab[r.b].position;I=ab[r.c].position;Y=ab[r.d].position;Ba[ya]=
+H.x;Ba[ya+1]=H.y;Ba[ya+2]=H.z;Ba[ya+3]=D.x;Ba[ya+4]=D.y;Ba[ya+5]=D.z;Ba[ya+6]=I.x;Ba[ya+7]=I.y;Ba[ya+8]=I.z;Ba[ya+9]=Y.x;Ba[ya+10]=Y.y;Ba[ya+11]=Y.z;ya+=12}if(Ra)for(Xa in Ra){x=Ra[Xa];if(x.needsUpdate){B=x.offset;if(x.size===1){x.array[B+0]=x.value[r.a];x.array[B+1]=x.value[r.b];x.array[B+2]=x.value[r.c];x.array[B+2]=x.value[r.d];x.offset+=4}else{H=x.value[r.a];D=x.value[r.b];I=x.value[r.c];Y=x.value[r.d];if(x.size===2){x.array[B+0]=H.x;x.array[B+1]=H.y;x.array[B+2]=D.x;x.array[B+3]=D.y;x.array[B+
+4]=I.x;x.array[B+5]=I.y;x.array[B+6]=Y.x;x.array[B+7]=Y.y;x.offset+=8}else if(x.size===3){x.array[B+0]=H.x;x.array[B+1]=H.y;x.array[B+2]=H.z;x.array[B+3]=D.x;x.array[B+4]=D.y;x.array[B+5]=D.z;x.array[B+6]=I.x;x.array[B+7]=I.y;x.array[B+8]=I.z;x.array[B+9]=Y.x;x.array[B+10]=Y.y;x.array[B+11]=Y.z;x.offset+=12}else{x.array[B+0]=H.x;x.array[B+1]=H.y;x.array[B+2]=H.z;x.array[B+3]=H.w;x.array[B+4]=D.x;x.array[B+5]=D.y;x.array[B+6]=D.z;x.array[B+7]=D.w;x.array[B+8]=I.x;x.array[B+9]=I.y;x.array[B+10]=I.z;
+x.array[B+11]=I.w;x.array[B+12]=Y.x;x.array[B+13]=Y.y;x.array[B+14]=Y.z;x.array[B+15]=Y.w;x.offset+=16}}}}if(pb){B=0;for(x=Sa.length;B<x;B++){H=Sa[B].vertices[r.a].position;D=Sa[B].vertices[r.b].position;I=Sa[B].vertices[r.c].position;Y=Sa[B].vertices[r.d].position;qa=jb[B];qa[za+0]=H.x;qa[za+1]=H.y;qa[za+2]=H.z;qa[za+3]=D.x;qa[za+4]=D.y;qa[za+5]=D.z;qa[za+6]=I.x;qa[za+7]=I.y;qa[za+8]=I.z;qa[za+9]=Y.x;qa[za+10]=Y.y;qa[za+11]=Y.z}za+=12}if(Va.length){H=Va[r.a];D=Va[r.b];I=Va[r.c];Y=Va[r.d];ka[z]=H.x;
+ka[z+1]=H.y;ka[z+2]=H.z;ka[z+3]=H.w;ka[z+4]=D.x;ka[z+5]=D.y;ka[z+6]=D.z;ka[z+7]=D.w;ka[z+8]=I.x;ka[z+9]=I.y;ka[z+10]=I.z;ka[z+11]=I.w;ka[z+12]=Y.x;ka[z+13]=Y.y;ka[z+14]=Y.z;ka[z+15]=Y.w;H=db[r.a];D=db[r.b];I=db[r.c];Y=db[r.d];ja[z]=H.x;ja[z+1]=H.y;ja[z+2]=H.z;ja[z+3]=H.w;ja[z+4]=D.x;ja[z+5]=D.y;ja[z+6]=D.z;ja[z+7]=D.w;ja[z+8]=I.x;ja[z+9]=I.y;ja[z+10]=I.z;ja[z+11]=I.w;ja[z+12]=Y.x;ja[z+13]=Y.y;ja[z+14]=Y.z;ja[z+15]=Y.w;H=bb[r.a];D=bb[r.b];I=bb[r.c];Y=bb[r.d];ha[z]=H.x;ha[z+1]=H.y;ha[z+2]=H.z;ha[z+
+3]=1;ha[z+4]=D.x;ha[z+5]=D.y;ha[z+6]=D.z;ha[z+7]=1;ha[z+8]=I.x;ha[z+9]=I.y;ha[z+10]=I.z;ha[z+11]=1;ha[z+12]=Y.x;ha[z+13]=Y.y;ha[z+14]=Y.z;ha[z+15]=1;H=cb[r.a];D=cb[r.b];I=cb[r.c];r=cb[r.d];ia[z]=H.x;ia[z+1]=H.y;ia[z+2]=H.z;ia[z+3]=1;ia[z+4]=D.x;ia[z+5]=D.y;ia[z+6]=D.z;ia[z+7]=1;ia[z+8]=I.x;ia[z+9]=I.y;ia[z+10]=I.z;ia[z+11]=1;ia[z+12]=r.x;ia[z+13]=r.y;ia[z+14]=r.z;ia[z+15]=1;z+=16}if(ob&&U){if(E.length==4&&U==THREE.VertexColors){r=E[0];H=E[1];D=E[2];E=E[3]}else E=D=H=r=M;Ca[va]=r.r;Ca[va+1]=r.g;Ca[va+
+2]=r.b;Ca[va+3]=H.r;Ca[va+4]=H.g;Ca[va+5]=H.b;Ca[va+6]=D.r;Ca[va+7]=D.g;Ca[va+8]=D.b;Ca[va+9]=E.r;Ca[va+10]=E.g;Ca[va+11]=E.b;va+=12}if(nb&&Ha.hasTangents){E=A[0];M=A[1];r=A[2];A=A[3];ga[ca]=E.x;ga[ca+1]=E.y;ga[ca+2]=E.z;ga[ca+3]=E.w;ga[ca+4]=M.x;ga[ca+5]=M.y;ga[ca+6]=M.z;ga[ca+7]=M.w;ga[ca+8]=r.x;ga[ca+9]=r.y;ga[ca+10]=r.z;ga[ca+11]=r.w;ga[ca+12]=A.x;ga[ca+13]=A.y;ga[ca+14]=A.z;ga[ca+15]=A.w;ca+=16}if(mb&&R)if(w.length==4&&qb)for(A=0;A<4;A++){u=w[A];Pa[Ka]=u.x;Pa[Ka+1]=u.y;Pa[Ka+2]=u.z;Ka+=3}else for(A=
+0;A<4;A++){Pa[Ka]=u.x;Pa[Ka+1]=u.y;Pa[Ka+2]=u.z;Ka+=3}if(fb&&T!==undefined&&Q)for(A=0;A<4;A++){w=T[A];hb[Za]=w.u;hb[Za+1]=w.v;Za+=2}if(fb&&Fa!==undefined&&Q)for(A=0;A<4;A++){w=Fa[A];ib[$a]=w.u;ib[$a+1]=w.v;$a+=2}if(lb){Ma[Ja]=ta;Ma[Ja+1]=ta+1;Ma[Ja+2]=ta+3;Ma[Ja+3]=ta+1;Ma[Ja+4]=ta+2;Ma[Ja+5]=ta+3;Ja+=6;Na[La]=ta;Na[La+1]=ta+1;Na[La+2]=ta;Na[La+3]=ta+3;Na[La+4]=ta+1;Na[La+5]=ta+2;Na[La+6]=ta+2;Na[La+7]=ta+3;La+=8;ta+=4}}}if(Ya){s=0;for(t=Ya.length;s<t;s++){Ma[Ja]=Ya[s].a;Ma[Ja+1]=Ya[s].b;Ma[Ja+2]=
+Ya[s].c;Ma[Ja+3]=Ya[s].a;Ma[Ja+4]=Ya[s].c;Ma[Ja+5]=Ya[s].d;Ja+=6}}if(kb){c.bindBuffer(c.ARRAY_BUFFER,i.__webglVertexBuffer);c.bufferData(c.ARRAY_BUFFER,Ba,y)}if(Ra)for(Xa in Ra){x=Ra[Xa];if(x.needsUpdate){c.bindBuffer(c.ARRAY_BUFFER,x.buffer);c.bufferData(c.ARRAY_BUFFER,x.array,y);x.needsUpdate=!1}}if(pb){B=0;for(x=Sa.length;B<x;B++){c.bindBuffer(c.ARRAY_BUFFER,i.__webglMorphTargetsBuffers[B]);c.bufferData(c.ARRAY_BUFFER,jb[B],y)}}if(ob&&va>0){c.bindBuffer(c.ARRAY_BUFFER,i.__webglColorBuffer);c.bufferData(c.ARRAY_BUFFER,
+Ca,y)}if(mb){c.bindBuffer(c.ARRAY_BUFFER,i.__webglNormalBuffer);c.bufferData(c.ARRAY_BUFFER,Pa,y)}if(nb&&Ha.hasTangents){c.bindBuffer(c.ARRAY_BUFFER,i.__webglTangentBuffer);c.bufferData(c.ARRAY_BUFFER,ga,y)}if(fb&&Za>0){c.bindBuffer(c.ARRAY_BUFFER,i.__webglUVBuffer);c.bufferData(c.ARRAY_BUFFER,hb,y)}if(fb&&$a>0){c.bindBuffer(c.ARRAY_BUFFER,i.__webglUV2Buffer);c.bufferData(c.ARRAY_BUFFER,ib,y)}if(lb){c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,i.__webglFaceBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,Ma,y);
+c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,i.__webglLineBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,Na,y)}if(z>0){c.bindBuffer(c.ARRAY_BUFFER,i.__webglSkinVertexABuffer);c.bufferData(c.ARRAY_BUFFER,ha,y);c.bindBuffer(c.ARRAY_BUFFER,i.__webglSkinVertexBBuffer);c.bufferData(c.ARRAY_BUFFER,ia,y);c.bindBuffer(c.ARRAY_BUFFER,i.__webglSkinIndicesBuffer);c.bufferData(c.ARRAY_BUFFER,ja,y);c.bindBuffer(c.ARRAY_BUFFER,i.__webglSkinWeightsBuffer);c.bufferData(c.ARRAY_BUFFER,ka,y)}}}n.__dirtyVertices=!1;n.__dirtyMorphTargets=
+!1;n.__dirtyElements=!1;n.__dirtyUvs=!1;n.__dirtyNormals=!1;n.__dirtyTangents=!1;n.__dirtyColors=!1}else if(f instanceof THREE.Ribbon){n=f.geometry;if(n.__dirtyVertices||n.__dirtyColors){f=n;o=c.DYNAMIC_DRAW;U=f.vertices;i=f.colors;R=U.length;y=i.length;T=f.__vertexArray;s=f.__colorArray;Fa=f.__dirtyColors;if(f.__dirtyVertices){for(t=0;t<R;t++){Q=U[t].position;m=t*3;T[m]=Q.x;T[m+1]=Q.y;T[m+2]=Q.z}c.bindBuffer(c.ARRAY_BUFFER,f.__webglVertexBuffer);c.bufferData(c.ARRAY_BUFFER,T,o)}if(Fa){for(t=0;t<
+y;t++){color=i[t];m=t*3;s[m]=color.r;s[m+1]=color.g;s[m+2]=color.b}c.bindBuffer(c.ARRAY_BUFFER,f.__webglColorBuffer);c.bufferData(c.ARRAY_BUFFER,s,o)}}n.__dirtyVertices=!1;n.__dirtyColors=!1}else if(f instanceof THREE.Line){n=f.geometry;if(n.__dirtyVertices||n.__dirtyColors){f=n;o=c.DYNAMIC_DRAW;U=f.vertices;i=f.colors;R=U.length;y=i.length;T=f.__vertexArray;s=f.__colorArray;Fa=f.__dirtyColors;if(f.__dirtyVertices){for(t=0;t<R;t++){Q=U[t].position;m=t*3;T[m]=Q.x;T[m+1]=Q.y;T[m+2]=Q.z}c.bindBuffer(c.ARRAY_BUFFER,
+f.__webglVertexBuffer);c.bufferData(c.ARRAY_BUFFER,T,o)}if(Fa){for(t=0;t<y;t++){color=i[t];m=t*3;s[m]=color.r;s[m+1]=color.g;s[m+2]=color.b}c.bindBuffer(c.ARRAY_BUFFER,f.__webglColorBuffer);c.bufferData(c.ARRAY_BUFFER,s,o)}}n.__dirtyVertices=!1;n.__dirtyColors=!1}else if(f instanceof THREE.ParticleSystem){n=f.geometry;(n.__dirtyVertices||n.__dirtyColors||f.sortParticles)&&d(n,c.DYNAMIC_DRAW,f);n.__dirtyVertices=!1;n.__dirtyColors=!1}}function ra(f){function o(M){var A=[];n=0;for(i=M.length;n<i;n++)M[n]==
+undefined?A.push("undefined"):A.push(M[n].id);return A.join("_")}var n,i,m,y,s,t,w,r,u={},E=f.morphTargets!==undefined?f.morphTargets.length:0;f.geometryGroups={};m=0;for(y=f.faces.length;m<y;m++){s=f.faces[m];t=s.materials;w=o(t);u[w]==undefined&&(u[w]={hash:w,counter:0});r=u[w].hash+"_"+u[w].counter;f.geometryGroups[r]==undefined&&(f.geometryGroups[r]={faces:[],materials:t,vertices:0,numMorphTargets:E});s=s instanceof THREE.Face3?3:4;if(f.geometryGroups[r].vertices+s>65535){u[w].counter+=1;r=u[w].hash+
+"_"+u[w].counter;f.geometryGroups[r]==undefined&&(f.geometryGroups[r]={faces:[],materials:t,vertices:0,numMorphTargets:E})}f.geometryGroups[r].faces.push(m);f.geometryGroups[r].vertices+=s}}function aa(f,o,n){f.push({buffer:o,object:n,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function sa(f){if(f!=ea){switch(f){case THREE.AdditiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.SRC_ALPHA,c.ONE);break;case THREE.SubtractiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ZERO,c.ONE_MINUS_SRC_COLOR);
+break;case THREE.MultiplyBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ZERO,c.SRC_COLOR);break;default:c.blendEquationSeparate(c.FUNC_ADD,c.FUNC_ADD);c.blendFuncSeparate(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA,c.ONE,c.ONE_MINUS_SRC_ALPHA)}ea=f}}function Z(f,o,n){if((n.width&n.width-1)==0&&(n.height&n.height-1)==0){c.texParameteri(f,c.TEXTURE_WRAP_S,da(o.wrapS));c.texParameteri(f,c.TEXTURE_WRAP_T,da(o.wrapT));c.texParameteri(f,c.TEXTURE_MAG_FILTER,da(o.magFilter));c.texParameteri(f,c.TEXTURE_MIN_FILTER,
+da(o.minFilter));c.generateMipmap(f)}else{c.texParameteri(f,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(f,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);c.texParameteri(f,c.TEXTURE_MAG_FILTER,Ga(o.magFilter));c.texParameteri(f,c.TEXTURE_MIN_FILTER,Ga(o.minFilter))}}function K(f,o){if(f.needsUpdate){if(f.__webglInit){c.bindTexture(c.TEXTURE_2D,f.__webglTexture);c.texSubImage2D(c.TEXTURE_2D,0,0,0,c.RGBA,c.UNSIGNED_BYTE,f.image)}else{f.__webglTexture=c.createTexture();c.bindTexture(c.TEXTURE_2D,f.__webglTexture);
+c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,f.image);f.__webglInit=!0}Z(c.TEXTURE_2D,f,f.image);c.bindTexture(c.TEXTURE_2D,null);f.needsUpdate=!1}c.activeTexture(c.TEXTURE0+o);c.bindTexture(c.TEXTURE_2D,f.__webglTexture)}function Ia(f){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,da(f.wrapS));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,da(f.wrapT));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,da(f.magFilter));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,da(f.minFilter));c.texImage2D(c.TEXTURE_2D,0,da(f.format),f.width,f.height,0,da(f.format),da(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 o,n;if(f){o=f.__webglFramebuffer;n=f.width;f=f.height}else{o=null;n=na;f=Aa}if(o!=Da){c.bindFramebuffer(c.FRAMEBUFFER,o);c.viewport(X,ua,n,f);Da=o}}function la(f,o){var n;if(f=="fragment")n=c.createShader(c.FRAGMENT_SHADER);else f=="vertex"&&(n=c.createShader(c.VERTEX_SHADER));
+c.shaderSource(n,o);c.compileShader(n);if(!c.getShaderParameter(n,c.COMPILE_STATUS)){console.error(c.getShaderInfoLog(n));console.error(o);return null}return n}function Ga(f){switch(f){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return c.NEAREST;default:return c.LINEAR}}function da(f){switch(f){case THREE.RepeatWrapping:return c.REPEAT;case THREE.ClampToEdgeWrapping:return c.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return c.MIRRORED_REPEAT;
+case THREE.NearestFilter:return c.NEAREST;case THREE.NearestMipMapNearestFilter:return c.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return c.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return c.LINEAR;case THREE.LinearMipMapNearestFilter:return c.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return c.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return c.BYTE;case THREE.UnsignedByteType:return c.UNSIGNED_BYTE;case THREE.ShortType:return c.SHORT;case THREE.UnsignedShortType:return c.UNSIGNED_SHORT;
+case THREE.IntType:return c.INT;case THREE.UnsignedShortType:return c.UNSIGNED_INT;case THREE.FloatType:return c.FLOAT;case THREE.AlphaFormat:return c.ALPHA;case THREE.RGBFormat:return c.RGB;case THREE.RGBAFormat:return c.RGBA;case THREE.LuminanceFormat:return c.LUMINANCE;case THREE.LuminanceAlphaFormat:return c.LUMINANCE_ALPHA}return 0}var c,S=document.createElement("canvas"),ma=null,Da=null,Ea=!0,wa=this,$=null,oa=null,ea=null,pa=null,X=0,ua=0,na=0,Aa=0,xa=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,
+new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],fa=new THREE.Matrix4,Oa=new Float32Array(16),Ta=new Float32Array(16),Ua=new THREE.Vector4,gb={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},Qa=!0,eb=!0,Wa=new THREE.Color(0),ub=0;if(b){if(b.stencil!=undefined)Qa=b.stencil;if(b.antialias!==undefined)eb=b.antialias;b.clearColor!==undefined&&Wa.setHex(b.clearColor);if(b.clearAlpha!==undefined)ub=b.clearAlpha}this.maxMorphTargets=
+8;this.domElement=S;this.autoClear=!0;this.sortObjects=!0;(function(f,o,n,i){try{if(!(c=S.getContext("experimental-webgl",{antialias:f,stencil:i})))throw"Error creating WebGL context.";}catch(m){console.error(m)}c.clearColor(0,0,0,1);c.clearDepth(1);c.enable(c.DEPTH_TEST);c.depthFunc(c.LEQUAL);c.frontFace(c.CCW);c.cullFace(c.BACK);c.enable(c.CULL_FACE);c.enable(c.BLEND);c.blendEquation(c.FUNC_ADD);c.blendFunc(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA);c.clearColor(o.r,o.g,o.b,n)})(eb,Wa,ub,Qa);this.context=
+c;if(Qa){var V={};V.vertices=new Float32Array(12);V.faces=new Uint16Array(6);V.darkness=0.5;V.vertices[0]=-2;V.vertices[1]=-1;V.vertices[2]=-1;V.vertices[3]=2;V.vertices[4]=-1;V.vertices[5]=-1;V.vertices[6]=2;V.vertices[7]=1;V.vertices[8]=-1;V.vertices[9]=-2;V.vertices[10]=1;V.vertices[11]=-1;V.faces[0]=0;V.faces[1]=1;V.faces[2]=2;V.faces[3]=0;V.faces[4]=2;V.faces[5]=3;V.vertexBuffer=c.createBuffer();V.elementBuffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,V.vertexBuffer);c.bufferData(c.ARRAY_BUFFER,
+V.vertices,c.STATIC_DRAW);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,V.elementBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,V.faces,c.STATIC_DRAW);V.program=c.createProgram();c.attachShader(V.program,la("fragment",THREE.ShaderLib.shadowPost.fragmentShader));c.attachShader(V.program,la("vertex",THREE.ShaderLib.shadowPost.vertexShader));c.linkProgram(V.program);V.vertexLocation=c.getAttribLocation(V.program,"position");V.projectionLocation=c.getUniformLocation(V.program,"projectionMatrix");V.darknessLocation=
+c.getUniformLocation(V.program,"darkness")}var L={};L.vertices=new Float32Array(16);L.faces=new Uint16Array(6);L.transparency=0.5;b=0;L.vertices[b++]=-1;L.vertices[b++]=-1;L.vertices[b++]=0;L.vertices[b++]=0;L.vertices[b++]=1;L.vertices[b++]=-1;L.vertices[b++]=1;L.vertices[b++]=0;L.vertices[b++]=1;L.vertices[b++]=1;L.vertices[b++]=1;L.vertices[b++]=1;L.vertices[b++]=-1;L.vertices[b++]=1;L.vertices[b++]=0;L.vertices[b++]=1;b=0;L.faces[b++]=0;L.faces[b++]=1;L.faces[b++]=2;L.faces[b++]=0;L.faces[b++]=
+2;L.faces[b++]=3;L.vertexBuffer=c.createBuffer();L.elementBuffer=c.createBuffer();L.tempTexture=c.createTexture();L.readBackPixels=new Uint8Array(1024);c.bindBuffer(c.ARRAY_BUFFER,L.vertexBuffer);c.bufferData(c.ARRAY_BUFFER,L.vertices,c.STATIC_DRAW);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,L.elementBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,L.faces,c.STATIC_DRAW);c.bindTexture(c.TEXTURE_2D,L.tempTexture);c.texImage2D(c.TEXTURE_2D,0,c.RGB,16,16,0,c.RGB,c.UNSIGNED_BYTE,null);c.texParameteri(c.TEXTURE_2D,
+c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,c.NEAREST);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,c.NEAREST);L.program=c.createProgram();c.attachShader(L.program,la("fragment",THREE.ShaderLib.lensFlare.fragmentShader));c.attachShader(L.program,la("vertex",THREE.ShaderLib.lensFlare.vertexShader));c.linkProgram(L.program);L.attributes={};L.uniforms={};L.attributes.vertex=c.getAttribLocation(L.program,
+"position");L.attributes.uv=c.getAttribLocation(L.program,"UV");L.uniforms.map=c.getUniformLocation(L.program,"map");L.uniforms.opacity=c.getUniformLocation(L.program,"opacity");L.uniforms.scale=c.getUniformLocation(L.program,"scale");L.uniforms.rotation=c.getUniformLocation(L.program,"rotation");L.uniforms.screenPosition=c.getUniformLocation(L.program,"screenPosition");L.uniforms.renderPink=c.getUniformLocation(L.program,"renderPink");this.setSize=function(f,o){S.width=f;S.height=o;this.setViewport(0,
+0,S.width,S.height)};this.setViewport=function(f,o,n,i){X=f;ua=o;na=n;Aa=i;c.viewport(X,ua,na,Aa)};this.setScissor=function(f,o,n,i){c.scissor(f,o,n,i)};this.enableScissorTest=function(f){f?c.enable(c.SCISSOR_TEST):c.disable(c.SCISSOR_TEST)};this.enableDepthBufferWrite=function(f){Ea=f;c.depthMask(f)};this.setClearColorHex=function(f,o){var n=new THREE.Color(f);c.clearColor(n.r,n.g,n.b,o)};this.setClearColor=function(f,o){c.clearColor(f.r,f.g,f.b,o)};this.clear=function(){c.clear(c.COLOR_BUFFER_BIT|
+c.DEPTH_BUFFER_BIT|c.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(f){V.darkness=f};this.initMaterial=function(f,o,n,i){var m,y,s,t;if(f instanceof THREE.MeshDepthMaterial)e(f,THREE.ShaderLib.depth);else if(f instanceof THREE.ShadowVolumeDynamicMaterial)e(f,THREE.ShaderLib.shadowVolumeDynamic);else if(f instanceof THREE.MeshNormalMaterial)e(f,THREE.ShaderLib.normal);else if(f instanceof THREE.MeshBasicMaterial)e(f,THREE.ShaderLib.basic);else if(f instanceof THREE.MeshLambertMaterial)e(f,
+THREE.ShaderLib.lambert);else if(f instanceof THREE.MeshPhongMaterial)e(f,THREE.ShaderLib.phong);else if(f instanceof THREE.LineBasicMaterial)e(f,THREE.ShaderLib.basic);else f instanceof THREE.ParticleBasicMaterial&&e(f,THREE.ShaderLib.particle_basic);if(!f.program){var w,r,u;w=u=t=0;for(s=o.length;w<s;w++){r=o[w];r instanceof THREE.DirectionalLight&&u++;r instanceof THREE.PointLight&&t++}if(t+u<=4)o=u;else{o=Math.ceil(4*u/(t+u));t=4-o}t={directional:o,point:t};o=50;if(i!==undefined&&i instanceof
+THREE.SkinnedMesh)o=i.bones.length;s={map:f.map,envMap:f.envMap,lightMap:f.lightMap,vertexColors:f.vertexColors,fog:n,sizeAttenuation:f.sizeAttenuation,skinning:f.skinning,morphTargets:f.morphTargets,maxDirLights:t.directional,maxPointLights:t.point,maxBones:o};n=f.fragmentShader;t=f.vertexShader;o=c.createProgram();w=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+s.maxDirLights,"#define MAX_POINT_LIGHTS "+s.maxPointLights,s.fog?"#define USE_FOG":"",s.fog instanceof THREE.FogExp2?
+"#define FOG_EXP2":"",s.map?"#define USE_MAP":"",s.envMap?"#define USE_ENVMAP":"",s.lightMap?"#define USE_LIGHTMAP":"",s.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");s=[c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+s.maxDirLights,"#define MAX_POINT_LIGHTS "+s.maxPointLights,"#define MAX_BONES "+s.maxBones,s.map?"#define USE_MAP":"",s.envMap?"#define USE_ENVMAP":"",s.lightMap?"#define USE_LIGHTMAP":
+"",s.vertexColors?"#define USE_COLOR":"",s.skinning?"#define USE_SKINNING":"",s.morphTargets?"#define USE_MORPHTARGETS":"",s.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
+c.attachShader(o,la("fragment",w+n));c.attachShader(o,la("vertex",s+t));c.linkProgram(o);c.getProgramParameter(o,c.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+c.getProgramParameter(o,c.VALIDATE_STATUS)+", gl error ["+c.getError()+"]");o.uniforms={};o.attributes={};f.program=o;n=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(m in f.uniforms)n.push(m);
+m=f.program;t=0;for(o=n.length;t<o;t++){w=n[t];m.uniforms[w]=c.getUniformLocation(m,w)}n=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(m=0;m<this.maxMorphTargets;m++)n.push("morphTarget"+m);for(y in f.attributes)n.push(y);m=f.program;t=0;for(o=n.length;t<o;t++){w=n[t];m.attributes[w]=c.getAttribLocation(m,w)}m=f.program.attributes;c.enableVertexAttribArray(m.position);m.color>=0&&c.enableVertexAttribArray(m.color);m.normal>=0&&c.enableVertexAttribArray(m.normal);
+m.tangent>=0&&c.enableVertexAttribArray(m.tangent);if(f.skinning&&m.skinVertexA>=0&&m.skinVertexB>=0&&m.skinIndex>=0&&m.skinWeight>=0){c.enableVertexAttribArray(m.skinVertexA);c.enableVertexAttribArray(m.skinVertexB);c.enableVertexAttribArray(m.skinIndex);c.enableVertexAttribArray(m.skinWeight)}for(y in f.attributes)m[y]>=0&&c.enableVertexAttribArray(m[y]);if(f.morphTargets){f.numSupportedMorphTargets=0;if(m.morphTarget0>=0){c.enableVertexAttribArray(m.morphTarget0);f.numSupportedMorphTargets++}if(m.morphTarget1>=
+0){c.enableVertexAttribArray(m.morphTarget1);f.numSupportedMorphTargets++}if(m.morphTarget2>=0){c.enableVertexAttribArray(m.morphTarget2);f.numSupportedMorphTargets++}if(m.morphTarget3>=0){c.enableVertexAttribArray(m.morphTarget3);f.numSupportedMorphTargets++}if(m.morphTarget4>=0){c.enableVertexAttribArray(m.morphTarget4);f.numSupportedMorphTargets++}if(m.morphTarget5>=0){c.enableVertexAttribArray(m.morphTarget5);f.numSupportedMorphTargets++}if(m.morphTarget6>=0){c.enableVertexAttribArray(m.morphTarget6);
+f.numSupportedMorphTargets++}if(m.morphTarget7>=0){c.enableVertexAttribArray(m.morphTarget7);f.numSupportedMorphTargets++}i.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);m=0;for(y=this.maxMorphTargets;m<y;m++)i.__webglMorphTargetInfluences[m]=0}}f.__webglProgram=!0};this.render=function(f,o,n,i){var m,y,s,t,w,r,u,E,M=f.lights,A=f.fog;o.matrixAutoUpdate&&o.updateMatrix();f.update(undefined,!1,o);o.matrixWorldInverse.flattenToArray(Ta);o.projectionMatrix.flattenToArray(Oa);fa.multiply(o.projectionMatrix,
+o.matrixWorldInverse);q(fa);this.initWebGLObjects(f);Ia(n);(this.autoClear||i)&&this.clear();w=f.__webglObjects.length;for(i=0;i<w;i++){m=f.__webglObjects[i];u=m.object;if(u.visible)if(!(u instanceof THREE.Mesh)||v(u)){u.matrixWorld.flattenToArray(u._objectMatrixArray);W(u,o);J(m);m.render=!0;if(this.sortObjects){Ua.copy(u.position);fa.multiplyVector3(Ua);m.z=Ua.z}}else m.render=!1;else m.render=!1}this.sortObjects&&f.__webglObjects.sort(G);r=f.__webglObjectsImmediate.length;for(i=0;i<r;i++){m=f.__webglObjectsImmediate[i];
+u=m.object;if(u.visible){u.matrixAutoUpdate&&u.matrixWorld.flattenToArray(u._objectMatrixArray);W(u,o);F(m)}}sa(THREE.NormalBlending);for(i=0;i<w;i++){m=f.__webglObjects[i];if(m.render){u=m.object;E=m.buffer;s=m.opaque;k(u);for(m=0;m<s.count;m++){t=s.list[m];p(t.depthTest);g(o,M,A,t,E,u)}}}for(i=0;i<r;i++){m=f.__webglObjectsImmediate[i];u=m.object;if(u.visible){s=m.opaque;k(u);for(m=0;m<s.count;m++){t=s.list[m];p(t.depthTest);y=h(o,M,A,t,u);u.render(function(Q){j(Q,y)})}}}for(i=0;i<w;i++){m=f.__webglObjects[i];
+if(m.render){u=m.object;E=m.buffer;s=m.transparent;k(u);for(m=0;m<s.count;m++){t=s.list[m];sa(t.blending);p(t.depthTest);g(o,M,A,t,E,u)}}}for(i=0;i<r;i++){m=f.__webglObjectsImmediate[i];u=m.object;if(u.visible){s=m.transparent;k(u);for(m=0;m<s.count;m++){t=s.list[m];sa(t.blending);p(t.depthTest);y=h(o,M,A,t,u);u.render(function(Q){j(Q,y)})}}}Qa&&f.__webglShadowVolumes.length&&f.lights.length&&N(f);f.__webglLensFlares.length&&O(f,o);if(n&&n.minFilter!==THREE.NearestFilter&&n.minFilter!==THREE.LinearFilter){c.bindTexture(c.TEXTURE_2D,
+n.__webglTexture);c.generateMipmap(c.TEXTURE_2D);c.bindTexture(c.TEXTURE_2D,null)}};this.initWebGLObjects=function(f){if(!f.__webglObjects){f.__webglObjects=[];f.__webglObjectsImmediate=[];f.__webglShadowVolumes=[];f.__webglLensFlares=[]}for(;f.__objectsAdded.length;){var o=f.__objectsAdded[0],n=f,i=void 0,m=void 0,y=void 0;if(o._modelViewMatrix==undefined){o._modelViewMatrix=new THREE.Matrix4;o._normalMatrixArray=new Float32Array(9);o._modelViewMatrixArray=new Float32Array(16);o._objectMatrixArray=
+new Float32Array(16);o.matrixWorld.flattenToArray(o._objectMatrixArray)}if(o instanceof THREE.Mesh){m=o.geometry;m.geometryGroups==undefined&&ra(m);for(i in m.geometryGroups){y=m.geometryGroups[i];if(!y.__webglVertexBuffer){var s=y;s.__webglVertexBuffer=c.createBuffer();s.__webglNormalBuffer=c.createBuffer();s.__webglTangentBuffer=c.createBuffer();s.__webglColorBuffer=c.createBuffer();s.__webglUVBuffer=c.createBuffer();s.__webglUV2Buffer=c.createBuffer();s.__webglSkinVertexABuffer=c.createBuffer();
+s.__webglSkinVertexBBuffer=c.createBuffer();s.__webglSkinIndicesBuffer=c.createBuffer();s.__webglSkinWeightsBuffer=c.createBuffer();s.__webglFaceBuffer=c.createBuffer();s.__webglLineBuffer=c.createBuffer();if(s.numMorphTargets){var t=void 0,w=void 0;s.__webglMorphTargetsBuffers=[];t=0;for(w=s.numMorphTargets;t<w;t++)s.__webglMorphTargetsBuffers.push(c.createBuffer())}s=y;t=o;var r=void 0,u=void 0,E=void 0;E=void 0;var M=void 0,A=void 0,Q=void 0,U=Q=w=0;u=void 0;E=void 0;var R=void 0;r=void 0;u=void 0;
+M=t.geometry;R=M.faces;A=s.faces;r=0;for(u=A.length;r<u;r++){E=A[r];E=R[E];if(E instanceof THREE.Face3){w+=3;Q+=1;U+=3}else if(E instanceof THREE.Face4){w+=4;Q+=2;U+=4}}r=s;u=t;R=void 0;A=void 0;var T=void 0,Fa=void 0;T=void 0;E=[];R=0;for(A=u.materials.length;R<A;R++){T=u.materials[R];if(T instanceof THREE.MeshFaceMaterial){T=0;for(l=r.materials.length;T<l;T++)(Fa=r.materials[T])&&E.push(Fa)}else(Fa=T)&&E.push(Fa)}r=E;a:{u=void 0;R=void 0;A=r.length;for(u=0;u<A;u++){R=r[u];if(R.map||R.lightMap||
+R instanceof THREE.MeshShaderMaterial){u=!0;break a}}u=!1}a:{R=void 0;A=void 0;E=r.length;for(R=0;R<E;R++){A=r[R];if(!(A instanceof THREE.MeshBasicMaterial&&!A.envMap||A instanceof THREE.MeshDepthMaterial)){R=A&&A.shading!=undefined&&A.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}}R=!1}a:{A=void 0;E=void 0;T=r.length;for(A=0;A<T;A++){E=r[A];if(E.vertexColors){E=E.vertexColors;break a}}E=!1}s.__vertexArray=new Float32Array(w*3);if(R)s.__normalArray=new Float32Array(w*
+3);if(M.hasTangents)s.__tangentArray=new Float32Array(w*4);if(E)s.__colorArray=new Float32Array(w*3);if(u){if(M.faceUvs.length>0||M.faceVertexUvs.length>0)s.__uvArray=new Float32Array(w*2);if(M.faceUvs.length>1||M.faceVertexUvs.length>1)s.__uv2Array=new Float32Array(w*2)}if(t.geometry.skinWeights.length&&t.geometry.skinIndices.length){s.__skinVertexAArray=new Float32Array(w*4);s.__skinVertexBArray=new Float32Array(w*4);s.__skinIndexArray=new Float32Array(w*4);s.__skinWeightArray=new Float32Array(w*
+4)}s.__faceArray=new Uint16Array(Q*3+(t.geometry.edgeFaces?t.geometry.edgeFaces.length*6:0));s.__lineArray=new Uint16Array(U*2);if(s.numMorphTargets){s.__morphTargetsArrays=[];M=0;for(A=s.numMorphTargets;M<A;M++)s.__morphTargetsArrays.push(new Float32Array(w*3))}s.__needsSmoothNormals=R==THREE.SmoothShading;s.__uvType=u;s.__vertexColorType=E;s.__normalType=R;s.__webglFaceCount=Q*3+(t.geometry.edgeFaces?t.geometry.edgeFaces.length*6:0);s.__webglLineCount=U*2;M=0;for(A=r.length;M<A;M++)if(r[M].attributes){s.__webglCustomAttributes=
+{};for(a in r[M].attributes){u=r[M].attributes[a];Q=1;if(u.type==="v2")Q=2;else if(u.type==="v3")Q=3;else if(u.type==="v4")Q=4;else u.type==="c"&&(Q=3);u.size=Q;u.needsUpdate=!0;u.array=new Float32Array(w*Q);u.buffer=c.createBuffer();s.__webglCustomAttributes[a]=u}}m.__dirtyVertices=!0;m.__dirtyMorphTargets=!0;m.__dirtyElements=!0;m.__dirtyUvs=!0;m.__dirtyNormals=!0;m.__dirtyTangents=!0;m.__dirtyColors=!0}o instanceof THREE.ShadowVolume?aa(n.__webglShadowVolumes,y,o):aa(n.__webglObjects,y,o)}}else if(o instanceof
+THREE.LensFlare)aa(n.__webglLensFlares,undefined,o);else if(o instanceof THREE.Ribbon){m=o.geometry;if(!m.__webglVertexBuffer){i=m;i.__webglVertexBuffer=c.createBuffer();i.__webglColorBuffer=c.createBuffer();i=m;y=i.vertices.length;i.__vertexArray=new Float32Array(y*3);i.__colorArray=new Float32Array(y*3);i.__webglVertexCount=y;m.__dirtyVertices=!0;m.__dirtyColors=!0}aa(n.__webglObjects,m,o)}else if(o instanceof THREE.Line){m=o.geometry;if(!m.__webglVertexBuffer){i=m;i.__webglVertexBuffer=c.createBuffer();
+i.__webglColorBuffer=c.createBuffer();i=m;y=i.vertices.length;i.__vertexArray=new Float32Array(y*3);i.__colorArray=new Float32Array(y*3);i.__webglLineCount=y;m.__dirtyVertices=!0;m.__dirtyColors=!0}aa(n.__webglObjects,m,o)}else if(o instanceof THREE.ParticleSystem){m=o.geometry;if(!m.__webglVertexBuffer){i=m;i.__webglVertexBuffer=c.createBuffer();i.__webglColorBuffer=c.createBuffer();i=m;y=i.vertices.length;i.__vertexArray=new Float32Array(y*3);i.__colorArray=new Float32Array(y*3);i.__sortArray=[];
+i.__webglParticleCount=y;m.__dirtyVertices=!0;m.__dirtyColors=!0}aa(n.__webglObjects,m,o)}else THREE.MarchingCubes!==undefined&&o instanceof THREE.MarchingCubes&&n.__webglObjectsImmediate.push({object:o,opaque:{list:[],count:0},transparent:{list:[],count:0}});f.__objectsAdded.splice(0,1)}for(;f.__objectsRemoved.length;){o=f.__objectsRemoved[0];n=f;m=void 0;i=void 0;for(m=n.__webglObjects.length-1;m>=0;m--){i=n.__webglObjects[m].object;o==i&&n.__webglObjects.splice(m,1)}f.__objectsRemoved.splice(0,
+1)}o=0;for(n=f.__webglObjects.length;o<n;o++)P(f.__webglObjects[o].object,f);o=0;for(n=f.__webglShadowVolumes.length;o<n;o++)P(f.__webglShadowVolumes[o].object,f);o=0;for(n=f.__webglLensFlares.length;o<n;o++)P(f.__webglLensFlares[o].object,f)};this.setFaceCulling=function(f,o){if(f){!o||o=="ccw"?c.frontFace(c.CCW):c.frontFace(c.CW);if(f=="back")c.cullFace(c.BACK);else f=="front"?c.cullFace(c.FRONT):c.cullFace(c.FRONT_AND_BACK);c.enable(c.CULL_FACE)}else c.disable(c.CULL_FACE)};this.supportsVertexTextures=
+function(){return c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};
+THREE.WebGLRenderTarget=function(b,d,e){this.width=b;this.height=d;e=e||{};this.wrapS=e.wrapS!==undefined?e.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=e.wrapT!==undefined?e.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=e.magFilter!==undefined?e.magFilter:THREE.LinearFilter;this.minFilter=e.minFilter!==undefined?e.minFilter:THREE.LinearMipMapLinearFilter;this.format=e.format!==undefined?e.format:THREE.RGBFormat;this.type=e.type!==undefined?e.type:THREE.UnsignedByteType};

+ 3 - 3
examples/webgl_lights_pointlights.html

@@ -97,13 +97,13 @@
 
 				scene.addLight( new THREE.AmbientLight( 0x00000 ) );
 
-				light1 = new THREE.PointLight( 0xff0040, 1, 50 );
+				light1 = new THREE.PointLight( 0xff0040, 2, 50 );
 				scene.addLight( light1 );
 
-				light2 = new THREE.PointLight( 0x0040ff, 1, 50 );
+				light2 = new THREE.PointLight( 0x0040ff, 2, 50 );
 				scene.addLight( light2 );
 
-				light3 = new THREE.PointLight( 0x80ff80, 1, 50 );
+				light3 = new THREE.PointLight( 0x80ff80, 2, 50 );
 				scene.addLight( light3 );
 
 				var sphere = new Sphere( 0.5, 16, 8 );

+ 9 - 9
examples/webgl_stencilLensFlare.html

@@ -71,8 +71,8 @@
 				new THREE.ShadowVolume( mesh1 )
 				new THREE.ShadowVolume( mesh2 )
 				new THREE.ShadowVolume( mesh3 )
-	
-	
+
+
 				// moving objects
 
 				var cube = new Cube( 40, 40, 40 );
@@ -84,13 +84,13 @@
 
 				boxMesh = new THREE.Mesh( cube, material2 );
 				scene.addChild( boxMesh );
-				
+
 				new THREE.ShadowVolume( mesh );
 				new THREE.ShadowVolume( boxMesh );
 
 
 				// lights
-	
+
 				light = new THREE.PointLight( 0xffffff );
 				scene.addChild( light );
 
@@ -105,11 +105,11 @@
 				lightCube.visible = false;
 				scene.addChild( lightCube );
 
-				var lensFlare = new THREE.LensFlare( ImageUtils.loadTexture( "textures/lensflare0.png" ), 128, 0.0, THREE.AdditiveAlphaBlending );
-				lensFlare.add( ImageUtils.loadTexture( "textures/lensflare1.png" ), 256, 0.33, THREE.AdditiveAlphaBlending );
-				lensFlare.add( lensFlare.lensFlares[ 1 ].texture, 300, 0.66, THREE.AdditiveAlphaBlending );
-				lensFlare.add( lensFlare.lensFlares[ 1 ].texture, 400, 1.0, THREE.AdditiveAlphaBlending );
-				
+				var lensFlare = new THREE.LensFlare( ImageUtils.loadTexture( "textures/lensflare0.png" ), 128, 0.0, THREE.AdditiveBlending );
+				lensFlare.add( ImageUtils.loadTexture( "textures/lensflare1.png" ), 256, 0.33, THREE.AdditiveBlending );
+				lensFlare.add( lensFlare.lensFlares[ 1 ].texture, 300, 0.66, THREE.AdditiveBlending );
+				lensFlare.add( lensFlare.lensFlares[ 1 ].texture, 400, 1.0, THREE.AdditiveBlending );
+	
 				lightCube.addChild( lensFlare );
 
 

+ 1 - 0
src/materials/MeshShaderMaterial.js

@@ -30,6 +30,7 @@ THREE.MeshShaderMaterial = function ( parameters ) {
 	this.fragmentShader = parameters.fragmentShader !== undefined ? parameters.fragmentShader : "void main() {}";
 	this.vertexShader = parameters.vertexShader !== undefined ? parameters.vertexShader : "void main() {}";
 	this.uniforms = parameters.uniforms !== undefined ? parameters.uniforms : {};
+	this.attributes = parameters.attributes;
 
 	this.shading = parameters.shading !== undefined ? parameters.shading : THREE.SmoothShading;
 

+ 306 - 37
src/renderers/WebGLRenderer.js

@@ -96,55 +96,53 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 	// prepare stencil shadow polygon
 
-	if( stencil ) {
-		
+	if ( stencil ) {
+
 		var _stencilShadow      = {};
-		
+
 		_stencilShadow.vertices = new Float32Array( 12 );
 		_stencilShadow.faces    = new Uint16Array( 6 );
 		_stencilShadow.darkness = 0.5;
-		
+
 		_stencilShadow.vertices[ 0 * 3 + 0 ] = -2; _stencilShadow.vertices[ 0 * 3 + 1 ] = -1; _stencilShadow.vertices[ 0 * 3 + 2 ] = -1;
 		_stencilShadow.vertices[ 1 * 3 + 0 ] =  2; _stencilShadow.vertices[ 1 * 3 + 1 ] = -1; _stencilShadow.vertices[ 1 * 3 + 2 ] = -1;
 		_stencilShadow.vertices[ 2 * 3 + 0 ] =  2; _stencilShadow.vertices[ 2 * 3 + 1 ] =  1; _stencilShadow.vertices[ 2 * 3 + 2 ] = -1;
 		_stencilShadow.vertices[ 3 * 3 + 0 ] = -2; _stencilShadow.vertices[ 3 * 3 + 1 ] =  1; _stencilShadow.vertices[ 3 * 3 + 2 ] = -1;
-		
+
 		_stencilShadow.faces[ 0 ] = 0; _stencilShadow.faces[ 1 ] = 1; _stencilShadow.faces[ 2 ] = 2;
 		_stencilShadow.faces[ 3 ] = 0; _stencilShadow.faces[ 4 ] = 2; _stencilShadow.faces[ 5 ] = 3;
-	
-	
+
 		_stencilShadow.vertexBuffer  = _gl.createBuffer();
 		_stencilShadow.elementBuffer = _gl.createBuffer();
-		
+
 		_gl.bindBuffer( _gl.ARRAY_BUFFER, _stencilShadow.vertexBuffer );
 		_gl.bufferData( _gl.ARRAY_BUFFER,  _stencilShadow.vertices, _gl.STATIC_DRAW );
-	
+
 		_gl.bindBuffer( _gl.ELEMENT_ARRAY_BUFFER, _stencilShadow.elementBuffer );
 		_gl.bufferData( _gl.ELEMENT_ARRAY_BUFFER, _stencilShadow.faces, _gl.STATIC_DRAW );
-		
-	
+
 		_stencilShadow.program = _gl.createProgram();
-	
+
 		_gl.attachShader( _stencilShadow.program, getShader( "fragment", THREE.ShaderLib.shadowPost.fragmentShader ));
 		_gl.attachShader( _stencilShadow.program, getShader( "vertex",   THREE.ShaderLib.shadowPost.vertexShader   ));
-	
+
 		_gl.linkProgram( _stencilShadow.program );
-	
+
 		_stencilShadow.vertexLocation     = _gl.getAttribLocation ( _stencilShadow.program, "position"         );
 		_stencilShadow.projectionLocation = _gl.getUniformLocation( _stencilShadow.program, "projectionMatrix" );
 		_stencilShadow.darknessLocation   = _gl.getUniformLocation( _stencilShadow.program, "darkness"         );
 	}
-	
-	
+
+
 	// prepare lens flare
-	
+
 	var _lensFlare = {};
 	var i;
-	
+
 	_lensFlare.vertices     = new Float32Array( 8 + 8 );
 	_lensFlare.faces        = new Uint16Array( 6 );
 	_lensFlare.transparency = 0.5;
-	
+
 	i = 0;
 	_lensFlare.vertices[ i++ ] = -1; _lensFlare.vertices[ i++ ] = -1;	// vertex
 	_lensFlare.vertices[ i++ ] = 0;  _lensFlare.vertices[ i++ ] = 0;	// uv... etc.
@@ -163,7 +161,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 	_lensFlare.elementBuffer = _gl.createBuffer();
 	_lensFlare.tempTexture   = _gl.createTexture();
 	_lensFlare.readBackPixels = new Uint8Array( 16*16*4 );
-	
+
 	_gl.bindBuffer( _gl.ARRAY_BUFFER, _lensFlare.vertexBuffer );
 	_gl.bufferData( _gl.ARRAY_BUFFER,  _lensFlare.vertices, _gl.STATIC_DRAW );
 
@@ -177,7 +175,6 @@ THREE.WebGLRenderer = function ( parameters ) {
 	_gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_MAG_FILTER, _gl.NEAREST );
 	_gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_MIN_FILTER, _gl.NEAREST );
 
-
 	_lensFlare.program = _gl.createProgram();
 
 	_gl.attachShader( _lensFlare.program, getShader( "fragment", THREE.ShaderLib.lensFlare.fragmentShader ));
@@ -197,8 +194,6 @@ THREE.WebGLRenderer = function ( parameters ) {
 	_lensFlare.uniforms.renderPink     = _gl.getUniformLocation( _lensFlare.program, "renderPink" );
 
 
-
-
 	this.setSize = function ( width, height ) {
 
 		_canvas.width = width;
@@ -442,12 +437,14 @@ THREE.WebGLRenderer = function ( parameters ) {
 	function initMeshBuffers ( geometryGroup, object ) {
 
 		var f, fl, fi, face,
+		m, ml, size,
 		nvertices = 0, ntris = 0, nlines = 0,
 
 		uvType,
 		vertexColorType,
 		normalType,
 		materials,
+		attribute,
 
 		geometry = object.geometry,
 		obj_faces = geometry.faces,
@@ -532,7 +529,6 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 		if ( geometryGroup.numMorphTargets ) {
 
-			var m, ml;
 			geometryGroup.__morphTargetsArrays = []; 
 
 			for ( m = 0, ml = geometryGroup.numMorphTargets; m < ml; m++ ) {
@@ -552,11 +548,45 @@ THREE.WebGLRenderer = function ( parameters ) {
 		geometryGroup.__webglFaceCount = ntris * 3 + ( object.geometry.edgeFaces ? object.geometry.edgeFaces.length * 2 * 3 : 0 );
 		geometryGroup.__webglLineCount = nlines * 2;
 
+
+		// custom attributes
+
+		for ( m = 0, ml = materials.length; m < ml; m ++ ) {
+
+			if ( materials[ m ].attributes ) {
+
+				geometryGroup.__webglCustomAttributes = {};
+
+				for ( a in materials[ m ].attributes ) {
+
+					attribute = materials[ m ].attributes[ a ];
+
+					size = 1;		// "f" and "i"
+
+					if( attribute.type === "v2" ) size = 2;
+					else if( attribute.type === "v3" ) size = 3;
+					else if( attribute.type === "v4" ) size = 4;
+					else if( attribute.type === "c"  ) size = 3;
+
+					attribute.size = size;
+					attribute.needsUpdate = true;
+					attribute.array = new Float32Array( nvertices * size );
+					attribute.buffer = _gl.createBuffer();
+
+					geometryGroup.__webglCustomAttributes[ a ] = attribute;
+
+				}
+
+			}
+
+		}
+
 	};
 
+
 	function setMeshBuffers ( geometryGroup, object, hint ) {
 
-		var f, fl, fi, face, 
+		var f, fl, fi, face,
 		vertexNormals, faceNormal, normal,
 		vertexColors, faceColor,
 		vertexTangents,
@@ -570,6 +600,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 		m, ml, i,
 		vn, uvi, uv2i,
 		vk, vkl, vka,
+		a,
 
 		vertexIndex = 0,
 
@@ -583,6 +614,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 		offset_color = 0,
 		offset_skin = 0,
 		offset_morphTarget = 0,
+		offset_custom = 0,
 
 		vertexArray = geometryGroup.__vertexArray,
 		uvArray = geometryGroup.__uvArray,
@@ -598,6 +630,9 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 		morphTargetsArrays = geometryGroup.__morphTargetsArrays,
 
+		customAttributes = geometryGroup.__webglCustomAttributes,
+		customAttribute,
+
 		faceArray = geometryGroup.__faceArray,
 		lineArray = geometryGroup.__lineArray,
 
@@ -634,6 +669,17 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 		morphTargets = geometry.morphTargets;
 
+		if ( customAttributes ) {
+
+			for ( a in customAttributes ) {
+
+				customAttributes[ a ].offset = 0;
+
+			}
+
+		}
+
+
 		for ( f = 0, fl = chunk_faces.length; f < fl; f ++ ) {
 
 			fi = chunk_faces[ f ];
@@ -683,6 +729,83 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 				}
 
+				if ( customAttributes ) {
+
+					for ( a in customAttributes ) {
+
+						customAttribute = customAttributes[ a ];
+
+						if ( customAttribute.needsUpdate ) {
+
+							offset_custom = customAttribute.offset;
+
+							if( customAttribute.size === 1 ) {
+
+								customAttribute.array[ offset_custom + 0 ] = customAttribute.value[ face.a ];
+								customAttribute.array[ offset_custom + 1 ] = customAttribute.value[ face.b ];
+								customAttribute.array[ offset_custom + 2 ] = customAttribute.value[ face.c ];
+
+								customAttribute.offset += 3;
+
+							} else {
+
+								v1 = customAttribute.value[ face.a ];
+								v2 = customAttribute.value[ face.b ];
+								v3 = customAttribute.value[ face.c ];
+
+								if( customAttribute.size === 2 ) {
+
+									customAttribute.array[ offset_custom + 0 ] = v1.x;
+									customAttribute.array[ offset_custom + 1 ] = v1.y;
+									customAttribute.array[ offset_custom + 2 ] = v2.x;
+									customAttribute.array[ offset_custom + 3 ] = v2.y;
+									customAttribute.array[ offset_custom + 4 ] = v3.x;
+									customAttribute.array[ offset_custom + 5 ] = v3.y;
+
+									customAttribute.offset += 6;
+
+								} else if( customAttribute.size === 3 ) {
+
+									customAttribute.array[ offset_custom + 0 ] = v1.x;
+									customAttribute.array[ offset_custom + 1 ] = v1.y;
+									customAttribute.array[ offset_custom + 2 ] = v1.z;
+									customAttribute.array[ offset_custom + 3 ] = v2.x;
+									customAttribute.array[ offset_custom + 4 ] = v2.y;
+									customAttribute.array[ offset_custom + 5 ] = v2.z;
+									customAttribute.array[ offset_custom + 6 ] = v3.x;
+									customAttribute.array[ offset_custom + 7 ] = v3.y;
+									customAttribute.array[ offset_custom + 8 ] = v3.z;
+
+									customAttribute.offset += 9;
+
+								} else {
+
+									customAttribute.array[ offset_custom + 0  ] = v1.x;
+									customAttribute.array[ offset_custom + 1  ] = v1.y;
+									customAttribute.array[ offset_custom + 2  ] = v1.z;
+									customAttribute.array[ offset_custom + 3  ] = v1.w;
+									customAttribute.array[ offset_custom + 4  ] = v2.x;
+									customAttribute.array[ offset_custom + 5  ] = v2.y;
+									customAttribute.array[ offset_custom + 6  ] = v2.z;
+									customAttribute.array[ offset_custom + 7  ] = v2.w;
+									customAttribute.array[ offset_custom + 8  ] = v3.x;
+									customAttribute.array[ offset_custom + 9  ] = v3.y;
+									customAttribute.array[ offset_custom + 10 ] = v3.z;
+									customAttribute.array[ offset_custom + 11 ] = v3.w;
+
+									customAttribute.offset += 12;
+
+								}
+
+							}
+
+						}
+
+					}
+
+				}
+
+
 				if ( dirtyMorphTargets ) {
 
 					for ( vk = 0, vkl = morphTargets.length; vk < vkl; vk ++ ) {
@@ -972,6 +1095,94 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 				}
 
+				if ( customAttributes ) {
+
+					for ( a in customAttributes ) {
+
+						customAttribute = customAttributes[ a ];
+
+						if ( customAttribute.needsUpdate ) {
+
+							offset_custom = customAttribute.offset;
+
+							if( customAttribute.size === 1 ) {
+
+								customAttribute.array[ offset_custom + 0 ] = customAttribute.value[ face.a ];
+								customAttribute.array[ offset_custom + 1 ] = customAttribute.value[ face.b ];
+								customAttribute.array[ offset_custom + 2 ] = customAttribute.value[ face.c ];
+								customAttribute.array[ offset_custom + 2 ] = customAttribute.value[ face.d ];
+
+								customAttribute.offset += 4;
+
+							} else {
+
+								v1 = customAttribute.value[ face.a ];
+								v2 = customAttribute.value[ face.b ];
+								v3 = customAttribute.value[ face.c ];
+								v4 = customAttribute.value[ face.d ];
+
+								if( customAttribute.size === 2 ) {
+
+									customAttribute.array[ offset_custom + 0 ] = v1.x;
+									customAttribute.array[ offset_custom + 1 ] = v1.y;
+									customAttribute.array[ offset_custom + 2 ] = v2.x;
+									customAttribute.array[ offset_custom + 3 ] = v2.y;
+									customAttribute.array[ offset_custom + 4 ] = v3.x;
+									customAttribute.array[ offset_custom + 5 ] = v3.y;
+									customAttribute.array[ offset_custom + 6 ] = v4.x;
+									customAttribute.array[ offset_custom + 7 ] = v4.y;
+
+									customAttribute.offset += 8;
+
+								} else if( customAttribute.size === 3 ) {
+
+									customAttribute.array[ offset_custom + 0  ] = v1.x;
+									customAttribute.array[ offset_custom + 1  ] = v1.y;
+									customAttribute.array[ offset_custom + 2  ] = v1.z;
+									customAttribute.array[ offset_custom + 3  ] = v2.x;
+									customAttribute.array[ offset_custom + 4  ] = v2.y;
+									customAttribute.array[ offset_custom + 5  ] = v2.z;
+									customAttribute.array[ offset_custom + 6  ] = v3.x;
+									customAttribute.array[ offset_custom + 7  ] = v3.y;
+									customAttribute.array[ offset_custom + 8  ] = v3.z;
+									customAttribute.array[ offset_custom + 9  ] = v4.x;
+									customAttribute.array[ offset_custom + 10 ] = v4.y;
+									customAttribute.array[ offset_custom + 11 ] = v4.z;
+
+									customAttribute.offset += 12;
+
+								} else {
+
+									customAttribute.array[ offset_custom + 0  ] = v1.x;
+									customAttribute.array[ offset_custom + 1  ] = v1.y;
+									customAttribute.array[ offset_custom + 2  ] = v1.z;
+									customAttribute.array[ offset_custom + 3  ] = v1.w;
+									customAttribute.array[ offset_custom + 4  ] = v2.x;
+									customAttribute.array[ offset_custom + 5  ] = v2.y;
+									customAttribute.array[ offset_custom + 6  ] = v2.z;
+									customAttribute.array[ offset_custom + 7  ] = v2.w;
+									customAttribute.array[ offset_custom + 8  ] = v3.x;
+									customAttribute.array[ offset_custom + 9  ] = v3.y;
+									customAttribute.array[ offset_custom + 10 ] = v3.z;
+									customAttribute.array[ offset_custom + 11 ] = v3.w;
+									customAttribute.array[ offset_custom + 12 ] = v4.x;
+									customAttribute.array[ offset_custom + 13 ] = v4.y;
+									customAttribute.array[ offset_custom + 14 ] = v4.z;
+									customAttribute.array[ offset_custom + 15 ] = v4.w;
+
+									customAttribute.offset += 16;
+
+								}
+
+							}
+
+						}
+
+					}
+
+				}
+
+
 				if ( dirtyMorphTargets ) {
 
 					for ( vk = 0, vkl = morphTargets.length; vk < vkl; vk++ ) {
@@ -1187,7 +1398,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 				}
 
-				if( dirtyNormals && normalType ) {
+				if ( dirtyNormals && normalType ) {
 
 					if ( vertexNormals.length == 4 && needsSmoothNormals ) {
 
@@ -1307,6 +1518,25 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 		}
 
+		if ( customAttributes ) {
+
+			for ( a in customAttributes ) {
+
+				customAttribute = customAttributes[ a ];
+
+				if ( customAttribute.needsUpdate ) {
+
+					_gl.bindBuffer( _gl.ARRAY_BUFFER, customAttribute.buffer );
+					_gl.bufferData( _gl.ARRAY_BUFFER, customAttribute.array, hint );
+
+					customAttribute.needsUpdate = false;
+
+				}
+
+			}
+
+		}
+
 		if ( dirtyMorphTargets ) {
 
 			for ( vk = 0, vkl = morphTargets.length; vk < vkl; vk ++ ) {
@@ -1796,10 +2026,18 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 			}
 
+			for ( a in material.attributes ) {
+
+				if( attributes[ a ] >= 0 ) _gl.enableVertexAttribArray( attributes[ a ] );
+
+			}
+
+
 			if ( material.morphTargets ) {
 
 				material.numSupportedMorphTargets = 0;
 
+
 				if ( attributes.morphTarget0 >= 0 ) {
 
 					_gl.enableVertexAttribArray( attributes.morphTarget0 );
@@ -1897,7 +2135,8 @@ THREE.WebGLRenderer = function ( parameters ) {
 			 material instanceof THREE.MeshLambertMaterial ||
 			 material instanceof THREE.MeshPhongMaterial ||
 			 material instanceof THREE.LineBasicMaterial ||
-			 material instanceof THREE.ParticleBasicMaterial )
+			 material instanceof THREE.ParticleBasicMaterial ||
+			 material.fog )
 			) {
 
 			refreshUniformsFog( m_uniforms, fog );
@@ -2007,7 +2246,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 		if ( material.opacity == 0 ) return;
 
-		var program, attributes, linewidth, primitives;
+		var program, attributes, linewidth, primitives, a, attribute;
 
 		program = setProgram( camera, lights, fog, material, object );
 
@@ -2026,6 +2265,27 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 		}
 
+
+		// custom attributes
+
+		if ( geometryGroup.__webglCustomAttributes ) {
+
+			for( a in geometryGroup.__webglCustomAttributes ) {
+
+				if( attributes[ a ] >= 0 ) {
+
+					attribute = geometryGroup.__webglCustomAttributes[ a ];
+
+					_gl.bindBuffer( _gl.ARRAY_BUFFER, attribute.buffer );
+					_gl.vertexAttribPointer( attributes[ a ], attribute.size, _gl.FLOAT, false, 0, 0 );
+
+				}
+
+			}
+
+		}
+
+
 		// colors
 
 		if ( attributes.color >= 0 ) {
@@ -3205,7 +3465,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 	function updateObject ( object, scene ) {
 
-		var g, geometry, geometryGroup;
+		var g, geometry, geometryGroup, a, customAttributeDirty;
 
 		if ( object instanceof THREE.Mesh ) {
 
@@ -3217,9 +3477,21 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 				geometryGroup = geometry.geometryGroups[ g ];
 
+				customAttributeDirty = false;
+
+				for ( a in geometryGroup.__webglCustomAttributes ) {
+
+					if( geometryGroup.__webglCustomAttributes[ a ].needsUpdate ) {
+
+						customAttributeDirty = true;
+						break;
+					}
+
+				}
+
 				if ( geometry.__dirtyVertices || geometry.__dirtyMorphTargets || geometry.__dirtyElements ||
 					geometry.__dirtyUvs || geometry.__dirtyNormals ||
-					geometry.__dirtyColors || geometry.__dirtyTangents ) {
+					geometry.__dirtyColors || geometry.__dirtyTangents || customAttributeDirty ) {
 
 					setMeshBuffers( geometryGroup, object, _gl.DYNAMIC_DRAW );
 
@@ -3649,6 +3921,10 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 				_gl.uniform3f( location, value.x, value.y, value.z );
 
+			} else if( type == "v4" ) {
+
+				_gl.uniform4f( location, value.x, value.y, value.z, value.w );
+
 			} else if( type == "c" ) {
 
 				_gl.uniform3f( location, value.r, value.g, value.b );
@@ -3683,13 +3959,6 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 			switch ( blending ) {
 
-				case THREE.AdditiveAlphaBlending:
-
-					_gl.blendEquation( _gl.FUNC_ADD );
-					_gl.blendFunc( _gl.SRC_ALPHA, _gl.ONE );
-
-					break;
-
 				case THREE.AdditiveBlending:
 
 					_gl.blendEquation( _gl.FUNC_ADD );

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