2
0
Эх сурвалжийг харах

Merging with alteredq's branch.

Mr.doob 14 жил өмнө
parent
commit
e8847848ad

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 303 - 293
build/Three.js


+ 1 - 1
build/custom/ThreeCanvas.js

@@ -48,7 +48,7 @@ b,c)}};THREE.Quaternion=function(a,b,c,e){this.set(a||0,b||0,c||0,e!==undefined?
 THREE.Quaternion.prototype={set:function(a,b,c,e){this.x=a;this.y=b;this.z=c;this.w=e;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,e=a.y*b,d=a.z*b;a=Math.cos(e);e=Math.sin(e);b=Math.cos(-d);d=Math.sin(-d);var g=Math.cos(c);c=Math.sin(c);var f=a*b,i=e*d;this.w=f*g-i*c;this.x=f*c+i*g;this.y=e*b*g+a*d*c;this.z=a*d*g-e*b*c;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
 -1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var b=this.x,c=this.y,e=this.z,d=this.w,g=a.x,f=a.y,i=a.z;a=a.w;this.x=b*a+d*g+c*i-e*f;this.y=c*a+d*f+e*g-b*i;this.z=e*a+d*i+b*f-c*g;this.w=d*a-b*g-c*f-e*i;return this},
 multiplyVector3:function(a,b){b||(b=a);var c=a.x,e=a.y,d=a.z,g=this.x,f=this.y,i=this.z,h=this.w,j=h*c+f*d-i*e,k=h*e+i*c-g*d,n=h*d+g*e-f*c;c=-g*c-f*e-i*d;b.x=j*h+c*-g+k*-i-n*-f;b.y=k*h+c*-f+n*-g-j*-i;b.z=n*h+c*-i+j*-f-k*-g;return b}};
-THREE.Quaternion.slerp=function(a,b,c,e){var d=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(d)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var g=Math.acos(d),f=Math.sqrt(1-d*d);if(Math.abs(f)<0.001){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}d=Math.sin((1-e)*g)/f;e=Math.sin(e*g)/f;c.w=a.w*d+b.w*e;c.x=a.x*d+b.x*e;c.y=a.y*d+b.y*e;c.z=a.z*d+b.z*e;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
+THREE.Quaternion.slerp=function(a,b,c,e){var d=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(d)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var g=Math.acos(d),f=Math.sqrt(1-d*d);if(Math.abs(f)<0.0010){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}d=Math.sin((1-e)*g)/f;e=Math.sin(e*g)/f;c.w=a.w*d+b.w*e;c.x=a.x*d+b.x*e;c.y=a.y*d+b.y*e;c.z=a.z*d+b.z*e;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
 THREE.Face3=function(a,b,c,e,d,g){this.a=a;this.b=b;this.c=c;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=d instanceof THREE.Color?d:new THREE.Color;this.vertexColors=d instanceof Array?d:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};
 THREE.Face4=function(a,b,c,e,d,g,f){this.a=a;this.b=b;this.c=c;this.d=e;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=f instanceof Array?f:[f];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.set(a||0,b||0)};
 THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};

+ 1 - 1
build/custom/ThreeDOM.js

@@ -48,7 +48,7 @@ b,c)}};THREE.Quaternion=function(a,b,c,e){this.set(a||0,b||0,c||0,e!==undefined?
 THREE.Quaternion.prototype={set:function(a,b,c,e){this.x=a;this.y=b;this.z=c;this.w=e;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,e=a.y*b,d=a.z*b;a=Math.cos(e);e=Math.sin(e);b=Math.cos(-d);d=Math.sin(-d);var g=Math.cos(c);c=Math.sin(c);var f=a*b,i=e*d;this.w=f*g-i*c;this.x=f*c+i*g;this.y=e*b*g+a*d*c;this.z=a*d*g-e*b*c;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
 -1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var b=this.x,c=this.y,e=this.z,d=this.w,g=a.x,f=a.y,i=a.z;a=a.w;this.x=b*a+d*g+c*i-e*f;this.y=c*a+d*f+e*g-b*i;this.z=e*a+d*i+b*f-c*g;this.w=d*a-b*g-c*f-e*i;return this},
 multiplyVector3:function(a,b){b||(b=a);var c=a.x,e=a.y,d=a.z,g=this.x,f=this.y,i=this.z,h=this.w,j=h*c+f*d-i*e,l=h*e+i*c-g*d,m=h*d+g*e-f*c;c=-g*c-f*e-i*d;b.x=j*h+c*-g+l*-i-m*-f;b.y=l*h+c*-f+m*-g-j*-i;b.z=m*h+c*-i+j*-f-l*-g;return b}};
-THREE.Quaternion.slerp=function(a,b,c,e){var d=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(d)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var g=Math.acos(d),f=Math.sqrt(1-d*d);if(Math.abs(f)<0.001){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}d=Math.sin((1-e)*g)/f;e=Math.sin(e*g)/f;c.w=a.w*d+b.w*e;c.x=a.x*d+b.x*e;c.y=a.y*d+b.y*e;c.z=a.z*d+b.z*e;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
+THREE.Quaternion.slerp=function(a,b,c,e){var d=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(d)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var g=Math.acos(d),f=Math.sqrt(1-d*d);if(Math.abs(f)<0.0010){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}d=Math.sin((1-e)*g)/f;e=Math.sin(e*g)/f;c.w=a.w*d+b.w*e;c.x=a.x*d+b.x*e;c.y=a.y*d+b.y*e;c.z=a.z*d+b.z*e;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
 THREE.Face3=function(a,b,c,e,d,g){this.a=a;this.b=b;this.c=c;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=d instanceof THREE.Color?d:new THREE.Color;this.vertexColors=d instanceof Array?d:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};
 THREE.Face4=function(a,b,c,e,d,g,f){this.a=a;this.b=b;this.c=c;this.d=e;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=f instanceof Array?f:[f];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.set(a||0,b||0)};
 THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 7 - 7
build/custom/ThreeExtras.js


+ 1 - 1
build/custom/ThreeSVG.js

@@ -48,7 +48,7 @@ b,c)}};THREE.Quaternion=function(a,b,c,e){this.set(a||0,b||0,c||0,e!==undefined?
 THREE.Quaternion.prototype={set:function(a,b,c,e){this.x=a;this.y=b;this.z=c;this.w=e;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,e=a.y*b,d=a.z*b;a=Math.cos(e);e=Math.sin(e);b=Math.cos(-d);d=Math.sin(-d);var g=Math.cos(c);c=Math.sin(c);var f=a*b,i=e*d;this.w=f*g-i*c;this.x=f*c+i*g;this.y=e*b*g+a*d*c;this.z=a*d*g-e*b*c;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
 -1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var b=this.x,c=this.y,e=this.z,d=this.w,g=a.x,f=a.y,i=a.z;a=a.w;this.x=b*a+d*g+c*i-e*f;this.y=c*a+d*f+e*g-b*i;this.z=e*a+d*i+b*f-c*g;this.w=d*a-b*g-c*f-e*i;return this},
 multiplyVector3:function(a,b){b||(b=a);var c=a.x,e=a.y,d=a.z,g=this.x,f=this.y,i=this.z,h=this.w,j=h*c+f*d-i*e,l=h*e+i*c-g*d,m=h*d+g*e-f*c;c=-g*c-f*e-i*d;b.x=j*h+c*-g+l*-i-m*-f;b.y=l*h+c*-f+m*-g-j*-i;b.z=m*h+c*-i+j*-f-l*-g;return b}};
-THREE.Quaternion.slerp=function(a,b,c,e){var d=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(d)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var g=Math.acos(d),f=Math.sqrt(1-d*d);if(Math.abs(f)<0.001){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}d=Math.sin((1-e)*g)/f;e=Math.sin(e*g)/f;c.w=a.w*d+b.w*e;c.x=a.x*d+b.x*e;c.y=a.y*d+b.y*e;c.z=a.z*d+b.z*e;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
+THREE.Quaternion.slerp=function(a,b,c,e){var d=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(d)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var g=Math.acos(d),f=Math.sqrt(1-d*d);if(Math.abs(f)<0.0010){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}d=Math.sin((1-e)*g)/f;e=Math.sin(e*g)/f;c.w=a.w*d+b.w*e;c.x=a.x*d+b.x*e;c.y=a.y*d+b.y*e;c.z=a.z*d+b.z*e;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
 THREE.Face3=function(a,b,c,e,d,g){this.a=a;this.b=b;this.c=c;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=d instanceof THREE.Color?d:new THREE.Color;this.vertexColors=d instanceof Array?d:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};
 THREE.Face4=function(a,b,c,e,d,g,f){this.a=a;this.b=b;this.c=c;this.d=e;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=f instanceof Array?f:[f];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.set(a||0,b||0)};
 THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};

+ 231 - 235
build/custom/ThreeWebGL.js

@@ -1,90 +1,90 @@
 // 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,e,d){this.r=b;this.g=e;this.b=d;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(b,e,d){var h,g,k,i,p,q;if(d==0)h=g=k=0;else{i=Math.floor(b*6);p=b*6-i;b=d*(1-e);q=d*(1-e*p);e=d*(1-e*(1-p));switch(i){case 1:h=q;g=d;k=b;break;case 2:h=b;g=d;k=e;break;case 3:h=b;g=q;k=d;break;case 4:h=e;g=b;k=d;break;case 5:h=d;g=b;
-k=q;break;case 6:case 0:h=d;g=e;k=b}}this.r=h;this.g=g;this.b=k;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,e){this.set(b||0,e||0)};
-THREE.Vector2.prototype={set:function(b,e){this.x=b;this.y=e;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,e){this.set(b.x+e.x,b.y+e.y);return this},subSelf:function(b){this.set(this.x-b.x,this.y-b.y);return this},sub:function(b,e){this.set(b.x-e.x,b.y-e.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,e,d){this.set(b||0,e||0,d||0)};
-THREE.Vector3.prototype={set:function(b,e,d){this.x=b;this.y=e;this.z=d;return this},copy:function(b){this.set(b.x,b.y,b.z);return this},add:function(b,e){this.set(b.x+e.x,b.y+e.y,b.z+e.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,e){this.set(b.x-e.x,b.y-e.y,b.z-e.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,
-e){this.set(b.y*e.z-b.z*e.y,b.z*e.x-b.x*e.z,b.x*e.y-b.y*e.x);return this},crossSelf:function(b){var e=this.x,d=this.y,h=this.z;this.set(d*b.z-h*b.y,h*b.x-e*b.z,e*b.y-d*b.x);return this},multiply:function(b,e){this.set(b.x*e.x,b.y*e.y,b.z*e.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 e=this.x-b.x,d=this.y-b.y;b=this.z-b.z;return e*e+d*d+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 e=Math.cos(this.y);if(Math.abs(e)>1.0E-5){this.x=Math.atan2(-b.n23/e,b.n33/e);this.z=Math.atan2(-b.n13/e,b.n11/e)}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,e,d,h){this.set(b||0,e||0,d||0,h||1)};
-THREE.Vector4.prototype={set:function(b,e,d,h){this.x=b;this.y=e;this.z=d;this.w=h;return this},copy:function(b){this.set(b.x,b.y,b.z,b.w||1);return this},add:function(b,e){this.set(b.x+e.x,b.y+e.y,b.z+e.z,b.w+e.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,e){this.set(b.x-e.x,b.y-e.y,b.z-e.z,b.w-e.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,e){this.set(this.x+(b.x-this.x)*e,this.y+(b.y-this.y)*e,this.z+(b.z-this.z)*e,this.w+(b.w-this.w)*e)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(b,e){this.origin=b||new THREE.Vector3;this.direction=e||new THREE.Vector3};
-THREE.Ray.prototype={intersectScene:function(b){var e,d,h=b.objects,g=[];b=0;for(e=h.length;b<e;b++){d=h[b];d instanceof THREE.Mesh&&(g=g.concat(this.intersectObject(d)))}g.sort(function(k,i){return k.distance-i.distance});return g},intersectObject:function(b){function e(U,L,sa,da){da=da.clone().subSelf(L);sa=sa.clone().subSelf(L);var oa=U.clone().subSelf(L);U=da.dot(da);L=da.dot(sa);da=da.dot(oa);var Z=sa.dot(sa);sa=sa.dot(oa);oa=1/(U*Z-L*L);Z=(Z*da-L*sa)*oa;U=(U*sa-L*da)*oa;return Z>0&&U>0&&Z+U<
-1}var d,h,g,k,i,p,q,u,D,E,I,F=b.geometry,M=F.vertices,N=[];d=0;for(h=F.faces.length;d<h;d++){g=F.faces[d];E=this.origin.clone();I=this.direction.clone();q=b.matrixWorld;k=q.multiplyVector3(M[g.a].position.clone());i=q.multiplyVector3(M[g.b].position.clone());p=q.multiplyVector3(M[g.c].position.clone());q=g instanceof THREE.Face4?q.multiplyVector3(M[g.d].position.clone()):null;u=b.matrixRotationWorld.multiplyVector3(g.normal.clone());D=I.dot(u);if(b.doubleSided||(b.flipSided?D>0:D<0)){u=u.dot((new THREE.Vector3).sub(k,
-E))/D;E=E.addSelf(I.multiplyScalar(u));if(g instanceof THREE.Face3){if(e(E,k,i,p)){g={distance:this.origin.distanceTo(E),point:E,face:g,object:b};N.push(g)}}else if(g instanceof THREE.Face4&&(e(E,k,i,q)||e(E,i,p,q))){g={distance:this.origin.distanceTo(E),point:E,face:g,object:b};N.push(g)}}}return N}};
-THREE.Rectangle=function(){function b(){k=h-e;i=g-d}var e,d,h,g,k,i,p=!0;this.getX=function(){return e};this.getY=function(){return d};this.getWidth=function(){return k};this.getHeight=function(){return i};this.getLeft=function(){return e};this.getTop=function(){return d};this.getRight=function(){return h};this.getBottom=function(){return g};this.set=function(q,u,D,E){p=!1;e=q;d=u;h=D;g=E;b()};this.addPoint=function(q,u){if(p){p=!1;e=q;d=u;h=q;g=u}else{e=e<q?e:q;d=d<u?d:u;h=h>q?h:q;g=g>u?g:u}b()};
-this.add3Points=function(q,u,D,E,I,F){if(p){p=!1;e=q<D?q<I?q:I:D<I?D:I;d=u<E?u<F?u:F:E<F?E:F;h=q>D?q>I?q:I:D>I?D:I;g=u>E?u>F?u:F:E>F?E:F}else{e=q<D?q<I?q<e?q:e:I<e?I:e:D<I?D<e?D:e:I<e?I:e;d=u<E?u<F?u<d?u:d:F<d?F:d:E<F?E<d?E:d:F<d?F:d;h=q>D?q>I?q>h?q:h:I>h?I:h:D>I?D>h?D:h:I>h?I:h;g=u>E?u>F?u>g?u:g:F>g?F:g:E>F?E>g?E:g:F>g?F:g}b()};this.addRectangle=function(q){if(p){p=!1;e=q.getLeft();d=q.getTop();h=q.getRight();g=q.getBottom()}else{e=e<q.getLeft()?e:q.getLeft();d=d<q.getTop()?d:q.getTop();h=h>q.getRight()?
-h:q.getRight();g=g>q.getBottom()?g:q.getBottom()}b()};this.inflate=function(q){e-=q;d-=q;h+=q;g+=q;b()};this.minSelf=function(q){e=e>q.getLeft()?e:q.getLeft();d=d>q.getTop()?d: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(e,q.getLeft())>=0&&Math.min(g,q.getBottom())-Math.max(d,q.getTop())>=0};this.empty=function(){p=!0;g=h=d=e=0;b()};this.isEmpty=function(){return p}};
-THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var b,e=this.m;b=e[1];e[1]=e[3];e[3]=b;b=e[2];e[2]=e[6];e[6]=b;b=e[5];e[5]=e[7];e[7]=b;return this},transposeIntoArray:function(b){var e=this.m;b[0]=e[0];b[1]=e[3];b[2]=e[6];b[3]=e[1];b[4]=e[4];b[5]=e[7];b[6]=e[2];b[7]=e[5];b[8]=e[8];return this}};
-THREE.Matrix4=function(b,e,d,h,g,k,i,p,q,u,D,E,I,F,M,N){this.set(b||1,e||0,d||0,h||0,g||0,k||1,i||0,p||0,q||0,u||0,D||1,E||0,I||0,F||0,M||0,N||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={set:function(b,e,d,h,g,k,i,p,q,u,D,E,I,F,M,N){this.n11=b;this.n12=e;this.n13=d;this.n14=h;this.n21=g;this.n22=k;this.n23=i;this.n24=p;this.n31=q;this.n32=u;this.n33=D;this.n34=E;this.n41=I;this.n42=F;this.n43=M;this.n44=N;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,e,d){var h=THREE.Matrix4.__v1,
-g=THREE.Matrix4.__v2,k=THREE.Matrix4.__v3;k.sub(b,e).normalize();if(k.length()===0)k.z=1;h.cross(d,k).normalize();if(h.length()===0){k.x+=1.0E-4;h.cross(d,k).normalize()}g.cross(k,h).normalize();this.n11=h.x;this.n12=g.x;this.n13=k.x;this.n21=h.y;this.n22=g.y;this.n23=k.y;this.n31=h.z;this.n32=g.z;this.n33=k.z;return this},multiplyVector3:function(b){var e=b.x,d=b.y,h=b.z,g=1/(this.n41*e+this.n42*d+this.n43*h+this.n44);b.x=(this.n11*e+this.n12*d+this.n13*h+this.n14)*g;b.y=(this.n21*e+this.n22*d+this.n23*
-h+this.n24)*g;b.z=(this.n31*e+this.n32*d+this.n33*h+this.n34)*g;return b},multiplyVector4:function(b){var e=b.x,d=b.y,h=b.z,g=b.w;b.x=this.n11*e+this.n12*d+this.n13*h+this.n14*g;b.y=this.n21*e+this.n22*d+this.n23*h+this.n24*g;b.z=this.n31*e+this.n32*d+this.n33*h+this.n34*g;b.w=this.n41*e+this.n42*d+this.n43*h+this.n44*g;return b},rotateAxis:function(b){var e=b.x,d=b.y,h=b.z;b.x=e*this.n11+d*this.n12+h*this.n13;b.y=e*this.n21+d*this.n22+h*this.n23;b.z=e*this.n31+d*this.n32+h*this.n33;b.normalize();
-return b},crossVector:function(b){var e=new THREE.Vector4;e.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;e.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;e.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;e.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return e},multiply:function(b,e){var d=b.n11,h=b.n12,g=b.n13,k=b.n14,i=b.n21,p=b.n22,q=b.n23,u=b.n24,D=b.n31,E=b.n32,I=b.n33,F=b.n34,M=b.n41,N=b.n42,U=b.n43,L=b.n44,sa=e.n11,da=e.n12,oa=e.n13,Z=e.n14,K=e.n21,Ia=e.n22,
-ca=e.n23,Ea=e.n24,fa=e.n31,c=e.n32,R=e.n33,pa=e.n34;this.n11=d*sa+h*K+g*fa;this.n12=d*da+h*Ia+g*c;this.n13=d*oa+h*ca+g*R;this.n14=d*Z+h*Ea+g*pa+k;this.n21=i*sa+p*K+q*fa;this.n22=i*da+p*Ia+q*c;this.n23=i*oa+p*ca+q*R;this.n24=i*Z+p*Ea+q*pa+u;this.n31=D*sa+E*K+I*fa;this.n32=D*da+E*Ia+I*c;this.n33=D*oa+E*ca+I*R;this.n34=D*Z+E*Ea+I*pa+F;this.n41=M*sa+N*K+U*fa;this.n42=M*da+N*Ia+U*c;this.n43=M*oa+N*ca+U*R;this.n44=M*Z+N*Ea+U*pa+L;return this},multiplyToArray:function(b,e,d){this.multiply(b,e);d[0]=this.n11;
-d[1]=this.n21;d[2]=this.n31;d[3]=this.n41;d[4]=this.n12;d[5]=this.n22;d[6]=this.n32;d[7]=this.n42;d[8]=this.n13;d[9]=this.n23;d[10]=this.n33;d[11]=this.n43;d[12]=this.n14;d[13]=this.n24;d[14]=this.n34;d[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=b;this.n23*=b;this.n24*=b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=
-b;return this},determinant:function(){var b=this.n11,e=this.n12,d=this.n13,h=this.n14,g=this.n21,k=this.n22,i=this.n23,p=this.n24,q=this.n31,u=this.n32,D=this.n33,E=this.n34,I=this.n41,F=this.n42,M=this.n43,N=this.n44;return h*i*u*I-d*p*u*I-h*k*D*I+e*p*D*I+d*k*E*I-e*i*E*I-h*i*q*F+d*p*q*F+h*g*D*F-b*p*D*F-d*g*E*F+b*i*E*F+h*k*q*M-e*p*q*M-h*g*u*M+b*p*u*M+e*g*E*M-b*k*E*M-d*k*q*N+e*i*q*N+d*g*u*N-b*i*u*N-e*g*D*N+b*k*D*N},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=
+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,k,j,p,q;if(e==0)h=g=k=0;else{j=Math.floor(b*6);p=b*6-j;b=e*(1-d);q=e*(1-d*p);d=e*(1-d*(1-p));switch(j){case 1:h=q;g=e;k=b;break;case 2:h=b;g=e;k=d;break;case 3:h=b;g=q;k=e;break;case 4:h=d;g=b;k=e;break;case 5:h=e;g=b;
+k=q;break;case 6:case 0:h=e;g=d;k=b}}this.r=h;this.g=g;this.b=k;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(k,j){return k.distance-j.distance});return g},intersectObject:function(b){function d(V,P,sa,da){da=da.clone().subSelf(P);sa=sa.clone().subSelf(P);var oa=V.clone().subSelf(P);V=da.dot(da);P=da.dot(sa);da=da.dot(oa);var Z=sa.dot(sa);sa=sa.dot(oa);oa=1/(V*Z-P*P);Z=(Z*da-P*sa)*oa;V=(V*sa-P*da)*oa;return Z>0&&V>0&&Z+V<
+1}var e,h,g,k,j,p,q,v,E,G,I,H=b.geometry,L=H.vertices,M=[];e=0;for(h=H.faces.length;e<h;e++){g=H.faces[e];G=this.origin.clone();I=this.direction.clone();q=b.matrixWorld;k=q.multiplyVector3(L[g.a].position.clone());j=q.multiplyVector3(L[g.b].position.clone());p=q.multiplyVector3(L[g.c].position.clone());q=g instanceof THREE.Face4?q.multiplyVector3(L[g.d].position.clone()):null;v=b.matrixRotationWorld.multiplyVector3(g.normal.clone());E=I.dot(v);if(b.doubleSided||(b.flipSided?E>0:E<0)){v=v.dot((new THREE.Vector3).sub(k,
+G))/E;G=G.addSelf(I.multiplyScalar(v));if(g instanceof THREE.Face3){if(d(G,k,j,p)){g={distance:this.origin.distanceTo(G),point:G,face:g,object:b};M.push(g)}}else if(g instanceof THREE.Face4&&(d(G,k,j,q)||d(G,j,p,q))){g={distance:this.origin.distanceTo(G),point:G,face:g,object:b};M.push(g)}}}return M}};
+THREE.Rectangle=function(){function b(){k=h-d;j=g-e}var d,e,h,g,k,j,p=!0;this.getX=function(){return d};this.getY=function(){return e};this.getWidth=function(){return k};this.getHeight=function(){return j};this.getLeft=function(){return d};this.getTop=function(){return e};this.getRight=function(){return h};this.getBottom=function(){return g};this.set=function(q,v,E,G){p=!1;d=q;e=v;h=E;g=G;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,E,G,I,H){if(p){p=!1;d=q<E?q<I?q:I:E<I?E:I;e=v<G?v<H?v:H:G<H?G:H;h=q>E?q>I?q:I:E>I?E:I;g=v>G?v>H?v:H:G>H?G:H}else{d=q<E?q<I?q<d?q:d:I<d?I:d:E<I?E<d?E:d:I<d?I:d;e=v<G?v<H?v<e?v:e:H<e?H:e:G<H?G<e?G:e:H<e?H:e;h=q>E?q>I?q>h?q:h:I>h?I:h:E>I?E>h?E:h:I>h?I:h;g=v>G?v>H?v>g?v:g:H>g?H:g:G>H?G>g?G:g:H>g?H: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,k,j,p,q,v,E,G,I,H,L,M){this.set(b||1,d||0,e||0,h||0,g||0,k||1,j||0,p||0,q||0,v||0,E||1,G||0,I||0,H||0,L||0,M||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={set:function(b,d,e,h,g,k,j,p,q,v,E,G,I,H,L,M){this.n11=b;this.n12=d;this.n13=e;this.n14=h;this.n21=g;this.n22=k;this.n23=j;this.n24=p;this.n31=q;this.n32=v;this.n33=E;this.n34=G;this.n41=I;this.n42=H;this.n43=L;this.n44=M;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,d,e){var h=THREE.Matrix4.__v1,
+g=THREE.Matrix4.__v2,k=THREE.Matrix4.__v3;k.sub(b,d).normalize();if(k.length()===0)k.z=1;h.cross(e,k).normalize();if(h.length()===0){k.x+=1.0E-4;h.cross(e,k).normalize()}g.cross(k,h).normalize();this.n11=h.x;this.n12=g.x;this.n13=k.x;this.n21=h.y;this.n22=g.y;this.n23=k.y;this.n31=h.z;this.n32=g.z;this.n33=k.z;return this},multiplyVector3:function(b){var d=b.x,e=b.y,h=b.z,g=1/(this.n41*d+this.n42*e+this.n43*h+this.n44);b.x=(this.n11*d+this.n12*e+this.n13*h+this.n14)*g;b.y=(this.n21*d+this.n22*e+this.n23*
+h+this.n24)*g;b.z=(this.n31*d+this.n32*e+this.n33*h+this.n34)*g;return b},multiplyVector4:function(b){var d=b.x,e=b.y,h=b.z,g=b.w;b.x=this.n11*d+this.n12*e+this.n13*h+this.n14*g;b.y=this.n21*d+this.n22*e+this.n23*h+this.n24*g;b.z=this.n31*d+this.n32*e+this.n33*h+this.n34*g;b.w=this.n41*d+this.n42*e+this.n43*h+this.n44*g;return b},rotateAxis:function(b){var d=b.x,e=b.y,h=b.z;b.x=d*this.n11+e*this.n12+h*this.n13;b.y=d*this.n21+e*this.n22+h*this.n23;b.z=d*this.n31+e*this.n32+h*this.n33;b.normalize();
+return b},crossVector:function(b){var d=new THREE.Vector4;d.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;d.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;d.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;d.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return d},multiply:function(b,d){var e=b.n11,h=b.n12,g=b.n13,k=b.n14,j=b.n21,p=b.n22,q=b.n23,v=b.n24,E=b.n31,G=b.n32,I=b.n33,H=b.n34,L=b.n41,M=b.n42,V=b.n43,P=b.n44,sa=d.n11,da=d.n12,oa=d.n13,Z=d.n14,K=d.n21,Ia=d.n22,
+ca=d.n23,Ea=d.n24,fa=d.n31,c=d.n32,R=d.n33,pa=d.n34;this.n11=e*sa+h*K+g*fa;this.n12=e*da+h*Ia+g*c;this.n13=e*oa+h*ca+g*R;this.n14=e*Z+h*Ea+g*pa+k;this.n21=j*sa+p*K+q*fa;this.n22=j*da+p*Ia+q*c;this.n23=j*oa+p*ca+q*R;this.n24=j*Z+p*Ea+q*pa+v;this.n31=E*sa+G*K+I*fa;this.n32=E*da+G*Ia+I*c;this.n33=E*oa+G*ca+I*R;this.n34=E*Z+G*Ea+I*pa+H;this.n41=L*sa+M*K+V*fa;this.n42=L*da+M*Ia+V*c;this.n43=L*oa+M*ca+V*R;this.n44=L*Z+M*Ea+V*pa+P;return this},multiplyToArray:function(b,d,e){this.multiply(b,d);e[0]=this.n11;
+e[1]=this.n21;e[2]=this.n31;e[3]=this.n41;e[4]=this.n12;e[5]=this.n22;e[6]=this.n32;e[7]=this.n42;e[8]=this.n13;e[9]=this.n23;e[10]=this.n33;e[11]=this.n43;e[12]=this.n14;e[13]=this.n24;e[14]=this.n34;e[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=b;this.n23*=b;this.n24*=b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=
+b;return this},determinant:function(){var b=this.n11,d=this.n12,e=this.n13,h=this.n14,g=this.n21,k=this.n22,j=this.n23,p=this.n24,q=this.n31,v=this.n32,E=this.n33,G=this.n34,I=this.n41,H=this.n42,L=this.n43,M=this.n44;return h*j*v*I-e*p*v*I-h*k*E*I+d*p*E*I+e*k*G*I-d*j*G*I-h*j*q*H+e*p*q*H+h*g*E*H-b*p*E*H-e*g*G*H+b*j*G*H+h*k*q*L-d*p*q*L-h*g*v*L+b*p*v*L+d*g*G*L-b*k*G*L-e*k*q*M+d*j*q*M+e*g*v*M-b*j*v*M-d*g*E*M+b*k*E*M},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=
 this.n13;this.n13=b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32;b.n33=this.n33;b.n34=this.n34;b.n41=this.n41;b.n42=this.n42;b.n43=this.n43;b.n44=this.n44;return b},flatten:function(){this.flat[0]=
 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,e){b[e]=this.n11;b[e+1]=this.n21;b[e+2]=this.n31;b[e+3]=this.n41;b[e+4]=this.n12;b[e+5]=this.n22;b[e+6]=this.n32;b[e+7]=this.n42;b[e+8]=this.n13;b[e+9]=this.n23;b[e+10]=this.n33;b[e+11]=this.n43;b[e+12]=this.n14;b[e+13]=this.n24;b[e+14]=this.n34;b[e+15]=this.n44;return b},setTranslation:function(b,e,d){this.set(1,0,0,b,0,1,0,e,0,0,1,d,0,0,
-0,1);return this},setScale:function(b,e,d){this.set(b,0,0,0,0,e,0,0,0,0,d,0,0,0,0,1);return this},setRotationX:function(b){var e=Math.cos(b);b=Math.sin(b);this.set(1,0,0,0,0,e,-b,0,0,b,e,0,0,0,0,1);return this},setRotationY:function(b){var e=Math.cos(b);b=Math.sin(b);this.set(e,0,b,0,0,1,0,0,-b,0,e,0,0,0,0,1);return this},setRotationZ:function(b){var e=Math.cos(b);b=Math.sin(b);this.set(e,-b,0,0,b,e,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,e){var d=Math.cos(e),h=Math.sin(e),g=
-1-d,k=b.x,i=b.y,p=b.z,q=g*k,u=g*i;this.set(q*k+d,q*i-h*p,q*p+h*i,0,q*i+h*p,u*i+d,u*p-h*k,0,q*p-h*i,u*p+h*k,g*p*p+d,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},setRotationFromEuler:function(b){var e=b.x,d=b.y,h=b.z;b=Math.cos(e);e=Math.sin(e);var g=Math.cos(d);d=Math.sin(d);var k=Math.cos(h);h=Math.sin(h);var i=b*d,p=e*d;this.n11=g*k;this.n12=-g*h;this.n13=d;this.n21=p*k+b*h;this.n22=-p*h+b*k;this.n23=-e*g;this.n31=-i*k+e*h;this.n32=i*h+e*k;this.n33=
-b*g;return this},setRotationFromQuaternion:function(b){var e=b.x,d=b.y,h=b.z,g=b.w,k=e+e,i=d+d,p=h+h;b=e*k;var q=e*i;e*=p;var u=d*i;d*=p;h*=p;k*=g;i*=g;g*=p;this.n11=1-(u+h);this.n12=q-g;this.n13=e+i;this.n21=q+g;this.n22=1-(b+h);this.n23=d-k;this.n31=e-i;this.n32=d+k;this.n33=1-(b+u);return this},scale:function(b){var e=b.x,d=b.y;b=b.z;this.n11*=e;this.n12*=d;this.n13*=b;this.n21*=e;this.n22*=d;this.n23*=b;this.n31*=e;this.n32*=d;this.n33*=b;this.n41*=e;this.n42*=d;this.n43*=b;return this},extractPosition:function(b){this.n14=
-b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,e){var d=1/e.x,h=1/e.y,g=1/e.z;this.n11=b.n11*d;this.n21=b.n21*d;this.n31=b.n31*d;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,e){var d=b.n11,h=b.n12,g=b.n13,k=b.n14,i=b.n21,p=b.n22,q=b.n23,u=b.n24,D=b.n31,E=b.n32,I=b.n33,F=b.n34,M=b.n41,N=b.n42,U=b.n43,L=b.n44;e===undefined&&(e=new THREE.Matrix4);e.n11=q*F*N-u*I*N+u*E*U-p*F*U-q*E*L+p*I*L;e.n12=k*I*N-g*F*N-k*E*U+h*F*U+g*E*L-h*I*L;e.n13=g*u*N-k*q*N+k*p*U-h*u*U-g*p*L+h*q*L;e.n14=k*q*E-g*u*E-k*p*I+h*u*I+g*p*F-h*q*F;e.n21=u*I*M-q*F*M-u*D*U+i*F*U+q*D*L-i*I*L;e.n22=g*F*M-k*I*M+k*D*U-d*F*U-g*D*L+d*I*L;e.n23=k*q*M-g*u*M-k*i*U+d*u*U+g*i*L-d*q*L;
-e.n24=g*u*D-k*q*D+k*i*I-d*u*I-g*i*F+d*q*F;e.n31=p*F*M-u*E*M+u*D*N-i*F*N-p*D*L+i*E*L;e.n32=k*E*M-h*F*M-k*D*N+d*F*N+h*D*L-d*E*L;e.n33=g*u*M-k*p*M+k*i*N-d*u*N-h*i*L+d*p*L;e.n34=k*p*D-h*u*D-k*i*E+d*u*E+h*i*F-d*p*F;e.n41=q*E*M-p*I*M-q*D*N+i*I*N+p*D*U-i*E*U;e.n42=h*I*M-g*E*M+g*D*N-d*I*N-h*D*U+d*E*U;e.n43=g*p*M-h*q*M-g*i*N+d*q*N+h*i*U-d*p*U;e.n44=h*q*D-g*p*D+g*i*E-d*q*E-h*i*I+d*p*I;e.multiplyScalar(1/b.determinant());return e};
-THREE.Matrix4.makeInvert3x3=function(b){var e=b.m33,d=e.m,h=b.n33*b.n22-b.n32*b.n23,g=-b.n33*b.n21+b.n31*b.n23,k=b.n32*b.n21-b.n31*b.n22,i=-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,u=b.n23*b.n12-b.n22*b.n13,D=-b.n23*b.n11+b.n21*b.n13,E=b.n22*b.n11-b.n21*b.n12;b=b.n11*h+b.n21*i+b.n31*u;if(b==0)throw"matrix not invertible";b=1/b;d[0]=b*h;d[1]=b*g;d[2]=b*k;d[3]=b*i;d[4]=b*p;d[5]=b*q;d[6]=b*u;d[7]=b*D;d[8]=b*E;return e};
-THREE.Matrix4.makeFrustum=function(b,e,d,h,g,k){var i;i=new THREE.Matrix4;i.n11=2*g/(e-b);i.n12=0;i.n13=(e+b)/(e-b);i.n14=0;i.n21=0;i.n22=2*g/(h-d);i.n23=(h+d)/(h-d);i.n24=0;i.n31=0;i.n32=0;i.n33=-(k+g)/(k-g);i.n34=-2*k*g/(k-g);i.n41=0;i.n42=0;i.n43=-1;i.n44=0;return i};THREE.Matrix4.makePerspective=function(b,e,d,h){var g;b=d*Math.tan(b*Math.PI/360);g=-b;return THREE.Matrix4.makeFrustum(g*e,b*e,g,b,d,h)};
-THREE.Matrix4.makeOrtho=function(b,e,d,h,g,k){var i,p,q,u;i=new THREE.Matrix4;p=e-b;q=d-h;u=k-g;i.n11=2/p;i.n12=0;i.n13=0;i.n14=-((e+b)/p);i.n21=0;i.n22=2/q;i.n23=0;i.n24=-((d+h)/q);i.n31=0;i.n32=0;i.n33=-2/u;i.n34=-((k+g)/u);i.n41=0;i.n42=0;i.n43=0;i.n44=1;return i};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
+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,k=b.x,j=b.y,p=b.z,q=g*k,v=g*j;this.set(q*k+e,q*j-h*p,q*p+h*j,0,q*j+h*p,v*j+e,v*p-h*k,0,q*p-h*j,v*p+h*k,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 k=Math.cos(h);h=Math.sin(h);var j=b*e,p=d*e;this.n11=g*k;this.n12=-g*h;this.n13=e;this.n21=p*k+b*h;this.n22=-p*h+b*k;this.n23=-d*g;this.n31=-j*k+d*h;this.n32=j*h+d*k;this.n33=
+b*g;return this},setRotationFromQuaternion:function(b){var d=b.x,e=b.y,h=b.z,g=b.w,k=d+d,j=e+e,p=h+h;b=d*k;var q=d*j;d*=p;var v=e*j;e*=p;h*=p;k*=g;j*=g;g*=p;this.n11=1-(v+h);this.n12=q-g;this.n13=d+j;this.n21=q+g;this.n22=1-(b+h);this.n23=e-k;this.n31=d-j;this.n32=e+k;this.n33=1-(b+v);return this},scale:function(b){var d=b.x,e=b.y;b=b.z;this.n11*=d;this.n12*=e;this.n13*=b;this.n21*=d;this.n22*=e;this.n23*=b;this.n31*=d;this.n32*=e;this.n33*=b;this.n41*=d;this.n42*=e;this.n43*=b;return this},extractPosition:function(b){this.n14=
+b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,d){var e=1/d.x,h=1/d.y,g=1/d.z;this.n11=b.n11*e;this.n21=b.n21*e;this.n31=b.n31*e;this.n12=b.n12*h;this.n22=b.n22*h;this.n32=b.n32*h;this.n13=b.n13*g;this.n23=b.n23*g;this.n33=b.n33*g}};
+THREE.Matrix4.makeInvert=function(b,d){var e=b.n11,h=b.n12,g=b.n13,k=b.n14,j=b.n21,p=b.n22,q=b.n23,v=b.n24,E=b.n31,G=b.n32,I=b.n33,H=b.n34,L=b.n41,M=b.n42,V=b.n43,P=b.n44;d===undefined&&(d=new THREE.Matrix4);d.n11=q*H*M-v*I*M+v*G*V-p*H*V-q*G*P+p*I*P;d.n12=k*I*M-g*H*M-k*G*V+h*H*V+g*G*P-h*I*P;d.n13=g*v*M-k*q*M+k*p*V-h*v*V-g*p*P+h*q*P;d.n14=k*q*G-g*v*G-k*p*I+h*v*I+g*p*H-h*q*H;d.n21=v*I*L-q*H*L-v*E*V+j*H*V+q*E*P-j*I*P;d.n22=g*H*L-k*I*L+k*E*V-e*H*V-g*E*P+e*I*P;d.n23=k*q*L-g*v*L-k*j*V+e*v*V+g*j*P-e*q*P;
+d.n24=g*v*E-k*q*E+k*j*I-e*v*I-g*j*H+e*q*H;d.n31=p*H*L-v*G*L+v*E*M-j*H*M-p*E*P+j*G*P;d.n32=k*G*L-h*H*L-k*E*M+e*H*M+h*E*P-e*G*P;d.n33=g*v*L-k*p*L+k*j*M-e*v*M-h*j*P+e*p*P;d.n34=k*p*E-h*v*E-k*j*G+e*v*G+h*j*H-e*p*H;d.n41=q*G*L-p*I*L-q*E*M+j*I*M+p*E*V-j*G*V;d.n42=h*I*L-g*G*L+g*E*M-e*I*M-h*E*V+e*G*V;d.n43=g*p*L-h*q*L-g*j*M+e*q*M+h*j*V-e*p*V;d.n44=h*q*E-g*p*E+g*j*G-e*q*G-h*j*I+e*p*I;d.multiplyScalar(1/b.determinant());return d};
+THREE.Matrix4.makeInvert3x3=function(b){var d=b.m33,e=d.m,h=b.n33*b.n22-b.n32*b.n23,g=-b.n33*b.n21+b.n31*b.n23,k=b.n32*b.n21-b.n31*b.n22,j=-b.n33*b.n12+b.n32*b.n13,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,E=-b.n23*b.n11+b.n21*b.n13,G=b.n22*b.n11-b.n21*b.n12;b=b.n11*h+b.n21*j+b.n31*v;if(b==0)throw"matrix not invertible";b=1/b;e[0]=b*h;e[1]=b*g;e[2]=b*k;e[3]=b*j;e[4]=b*p;e[5]=b*q;e[6]=b*v;e[7]=b*E;e[8]=b*G;return d};
+THREE.Matrix4.makeFrustum=function(b,d,e,h,g,k){var j;j=new THREE.Matrix4;j.n11=2*g/(d-b);j.n12=0;j.n13=(d+b)/(d-b);j.n14=0;j.n21=0;j.n22=2*g/(h-e);j.n23=(h+e)/(h-e);j.n24=0;j.n31=0;j.n32=0;j.n33=-(k+g)/(k-g);j.n34=-2*k*g/(k-g);j.n41=0;j.n42=0;j.n43=-1;j.n44=0;return j};THREE.Matrix4.makePerspective=function(b,d,e,h){var g;b=e*Math.tan(b*Math.PI/360);g=-b;return THREE.Matrix4.makeFrustum(g*d,b*d,g,b,e,h)};
+THREE.Matrix4.makeOrtho=function(b,d,e,h,g,k){var j,p,q,v;j=new THREE.Matrix4;p=d-b;q=e-h;v=k-g;j.n11=2/p;j.n12=0;j.n13=0;j.n14=-((d+b)/p);j.n21=0;j.n22=2/q;j.n23=0;j.n24=-((e+h)/q);j.n31=0;j.n32=0;j.n33=-2/v;j.n34=-((k+g)/v);j.n41=0;j.n42=0;j.n43=0;j.n44=1;return j};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
 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(b,e){this.matrix.rotateAxis(e);this.position.addSelf(e.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 e=this;e instanceof THREE.Scene===!1&&e!==undefined;)e=e.parent;e!==undefined&&e.addChildRecurse(b)}},removeChild:function(b){var e=this.children.indexOf(b);if(e!==-1){b.parent=undefined;this.children.splice(e,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,e,d){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||e){b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale);this.matrixWorldNeedsUpdate=!1;e=!0}b=0;for(var h=this.children.length;b<h;b++)this.children[b].update(this.matrixWorld,
-e,d)}};THREE.Quaternion=function(b,e,d,h){this.set(b||0,e||0,d||0,h!==undefined?h:1)};
-THREE.Quaternion.prototype={set:function(b,e,d,h){this.x=b;this.y=e;this.z=d;this.w=h;return this},setFromEuler:function(b){var e=0.5*Math.PI/360,d=b.x*e,h=b.y*e,g=b.z*e;b=Math.cos(h);h=Math.sin(h);e=Math.cos(-g);g=Math.sin(-g);var k=Math.cos(d);d=Math.sin(d);var i=b*e,p=h*g;this.w=i*k-p*d;this.x=i*d+p*k;this.y=h*e*k+b*g*d;this.z=b*g*k-h*e*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 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 e=this.x,d=this.y,h=this.z,g=this.w,k=b.x,i=b.y,p=b.z;b=b.w;this.x=e*b+g*k+d*p-h*i;this.y=d*b+g*i+h*k-e*p;this.z=h*b+g*p+e*i-d*k;this.w=g*b-e*k-d*i-h*p;return this},
-multiplyVector3:function(b,e){e||(e=b);var d=b.x,h=b.y,g=b.z,k=this.x,i=this.y,p=this.z,q=this.w,u=q*d+i*g-p*h,D=q*h+p*d-k*g,E=q*g+k*h-i*d;d=-k*d-i*h-p*g;e.x=u*q+d*-k+D*-p-E*-i;e.y=D*q+d*-i+E*-k-u*-p;e.z=E*q+d*-p+u*-i-D*-k;return e}};
-THREE.Quaternion.slerp=function(b,e,d,h){var g=b.w*e.w+b.x*e.x+b.y*e.y+b.z*e.z;if(Math.abs(g)>=1){d.w=b.w;d.x=b.x;d.y=b.y;d.z=b.z;return d}var k=Math.acos(g),i=Math.sqrt(1-g*g);if(Math.abs(i)<0.001){d.w=0.5*(b.w+e.w);d.x=0.5*(b.x+e.x);d.y=0.5*(b.y+e.y);d.z=0.5*(b.z+e.z);return d}g=Math.sin((1-h)*k)/i;h=Math.sin(h*k)/i;d.w=b.w*g+e.w*h;d.x=b.x*g+e.x*h;d.y=b.y*g+e.y*h;d.z=b.z*g+e.z*h;return d};THREE.Vertex=function(b){this.position=b||new THREE.Vector3};
-THREE.Face3=function(b,e,d,h,g,k){this.a=b;this.b=e;this.c=d;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=k instanceof Array?k:[k];this.centroid=new THREE.Vector3};
-THREE.Face4=function(b,e,d,h,g,k,i){this.a=b;this.b=e;this.c=d;this.d=h;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.color=k instanceof THREE.Color?k:new THREE.Color;this.vertexColors=k instanceof Array?k:[];this.vertexTangents=[];this.materials=i instanceof Array?i:[i];this.centroid=new THREE.Vector3};THREE.UV=function(b,e){this.set(b||0,e||0)};
-THREE.UV.prototype={set:function(b,e){this.u=b;this.v=e;return this},copy:function(b){this.set(b.u,b.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
-THREE.Geometry.prototype={computeCentroids:function(){var b,e,d;b=0;for(e=this.faces.length;b<e;b++){d=this.faces[b];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(b){var e,d,h,g,k,i,p=new THREE.Vector3,q=new THREE.Vector3;h=0;for(g=this.faces.length;h<g;h++){k=this.faces[h];if(b&&k.vertexNormals.length){p.set(0,0,0);e=0;for(d=k.vertexNormals.length;e<d;e++)p.addSelf(k.vertexNormals[e]);p.divideScalar(3)}else{e=this.vertices[k.a];d=this.vertices[k.b];i=this.vertices[k.c];p.sub(i.position,d.position);q.sub(e.position,d.position);p.crossSelf(q)}p.isZero()||
-p.normalize();k.normal.copy(p)}},computeVertexNormals:function(){var b,e,d,h;if(this.__tmpVertices==undefined){h=this.__tmpVertices=Array(this.vertices.length);b=0;for(e=this.vertices.length;b<e;b++)h[b]=new THREE.Vector3;b=0;for(e=this.faces.length;b<e;b++){d=this.faces[b];if(d instanceof THREE.Face3)d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(d instanceof THREE.Face4)d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{h=
-this.__tmpVertices;b=0;for(e=this.vertices.length;b<e;b++)h[b].set(0,0,0)}b=0;for(e=this.faces.length;b<e;b++){d=this.faces[b];if(d instanceof THREE.Face3){h[d.a].addSelf(d.normal);h[d.b].addSelf(d.normal);h[d.c].addSelf(d.normal)}else if(d instanceof THREE.Face4){h[d.a].addSelf(d.normal);h[d.b].addSelf(d.normal);h[d.c].addSelf(d.normal);h[d.d].addSelf(d.normal)}}b=0;for(e=this.vertices.length;b<e;b++)h[b].normalize();b=0;for(e=this.faces.length;b<e;b++){d=this.faces[b];if(d instanceof THREE.Face3){d.vertexNormals[0].copy(h[d.a]);
-d.vertexNormals[1].copy(h[d.b]);d.vertexNormals[2].copy(h[d.c])}else if(d instanceof THREE.Face4){d.vertexNormals[0].copy(h[d.a]);d.vertexNormals[1].copy(h[d.b]);d.vertexNormals[2].copy(h[d.c]);d.vertexNormals[3].copy(h[d.d])}}},computeTangents:function(){function b(aa,ma,na,ga,Y,wa,qa){p=aa.vertices[ma].position;q=aa.vertices[na].position;u=aa.vertices[ga].position;D=i[Y];E=i[wa];I=i[qa];F=q.x-p.x;M=u.x-p.x;N=q.y-p.y;U=u.y-p.y;L=q.z-p.z;sa=u.z-p.z;da=E.u-D.u;oa=I.u-D.u;Z=E.v-D.v;K=I.v-D.v;Ia=1/(da*
-K-oa*Z);c.set((K*F-Z*M)*Ia,(K*N-Z*U)*Ia,(K*L-Z*sa)*Ia);R.set((da*M-oa*F)*Ia,(da*U-oa*N)*Ia,(da*sa-oa*L)*Ia);Ea[ma].addSelf(c);Ea[na].addSelf(c);Ea[ga].addSelf(c);fa[ma].addSelf(R);fa[na].addSelf(R);fa[ga].addSelf(R)}var e,d,h,g,k,i,p,q,u,D,E,I,F,M,N,U,L,sa,da,oa,Z,K,Ia,ca,Ea=[],fa=[],c=new THREE.Vector3,R=new THREE.Vector3,pa=new THREE.Vector3,ra=new THREE.Vector3,Fa=new THREE.Vector3;e=0;for(d=this.vertices.length;e<d;e++){Ea[e]=new THREE.Vector3;fa[e]=new THREE.Vector3}e=0;for(d=this.faces.length;e<
-d;e++){k=this.faces[e];i=this.faceVertexUvs[0][e];if(k instanceof THREE.Face3)b(this,k.a,k.b,k.c,0,1,2);else if(k instanceof THREE.Face4){b(this,k.a,k.b,k.c,0,1,2);b(this,k.a,k.b,k.d,0,1,3)}}var ta=["a","b","c","d"];e=0;for(d=this.faces.length;e<d;e++){k=this.faces[e];for(h=0;h<k.vertexNormals.length;h++){Fa.copy(k.vertexNormals[h]);g=k[ta[h]];ca=Ea[g];pa.copy(ca);pa.subSelf(Fa.multiplyScalar(Fa.dot(ca))).normalize();ra.cross(k.vertexNormals[h],ca);g=ra.dot(fa[g]);g=g<0?-1:1;k.vertexTangents[h]=new THREE.Vector4(pa.x,
-pa.y,pa.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 e=1,d=this.vertices.length;e<d;e++){b=this.vertices[e];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,e=0,d=this.vertices.length;e<d;e++)b=Math.max(b,this.vertices[e].position.length());this.boundingSphere=
-{radius:b}},computeEdgeFaces:function(){function b(q,u){return Math.min(q,u)+"_"+Math.max(q,u)}function e(q,u,D){if(q[u]===undefined){q[u]={set:{},array:[]};q[u].set[D]=1;q[u].array.push(D)}else if(q[u].set[D]===undefined){q[u].set[D]=1;q[u].array.push(D)}}var d,h,g,k,i,p={};d=0;for(h=this.faces.length;d<h;d++){i=this.faces[d];if(i instanceof THREE.Face3){g=b(i.a,i.b);e(p,g,d);g=b(i.b,i.c);e(p,g,d);g=b(i.a,i.c);e(p,g,d)}else if(i instanceof THREE.Face4){g=b(i.b,i.d);e(p,g,d);g=b(i.a,i.b);e(p,g,d);
-g=b(i.a,i.d);e(p,g,d);g=b(i.b,i.c);e(p,g,d);g=b(i.c,i.d);e(p,g,d)}}d=0;for(h=this.edges.length;d<h;d++){i=this.edges[d];g=i.vertexIndices[0];k=i.vertexIndices[1];i.faceIndices=p[b(g,k)].array;for(g=0;g<i.faceIndices.length;g++){k=i.faceIndices[g];i.faces.push(this.faces[k])}}}};THREE.GeometryIdCounter=0;
-THREE.AnimationHandler=function(){var b=[],e={},d={};d.update=function(g){for(var k=0;k<b.length;k++)b[k].update(g)};d.addToUpdate=function(g){b.indexOf(g)===-1&&b.push(g)};d.removeFromUpdate=function(g){g=b.indexOf(g);g!==-1&&b.splice(g,1)};d.add=function(g){e[g.name]!==undefined&&console.log("THREE.AnimationHandler.add: Warning! "+g.name+" already exists in library. Overwriting.");e[g.name]=g;if(g.initialized!==!0){for(var k=0;k<g.hierarchy.length;k++){for(var i=0;i<g.hierarchy[k].keys.length;i++){if(g.hierarchy[k].keys[i].time<
-0)g.hierarchy[k].keys[i].time=0;if(g.hierarchy[k].keys[i].rot!==undefined&&!(g.hierarchy[k].keys[i].rot instanceof THREE.Quaternion)){var p=g.hierarchy[k].keys[i].rot;g.hierarchy[k].keys[i].rot=new THREE.Quaternion(p[0],p[1],p[2],p[3])}}if(g.hierarchy[k].keys[0].morphTargets!==undefined){p={};for(i=0;i<g.hierarchy[k].keys.length;i++)for(var q=0;q<g.hierarchy[k].keys[i].morphTargets.length;q++){var u=g.hierarchy[k].keys[i].morphTargets[q];p[u]=-1}g.hierarchy[k].usedMorphTargets=p;for(i=0;i<g.hierarchy[k].keys.length;i++){var D=
-{};for(u in p){for(q=0;q<g.hierarchy[k].keys[i].morphTargets.length;q++)if(g.hierarchy[k].keys[i].morphTargets[q]===u){D[u]=g.hierarchy[k].keys[i].morphTargetsInfluences[q];break}q===g.hierarchy[k].keys[i].morphTargets.length&&(D[u]=0)}g.hierarchy[k].keys[i].morphTargetsInfluences=D}}for(i=1;i<g.hierarchy[k].keys.length;i++)if(g.hierarchy[k].keys[i].time===g.hierarchy[k].keys[i-1].time){g.hierarchy[k].keys.splice(i,1);i--}for(i=1;i<g.hierarchy[k].keys.length;i++)g.hierarchy[k].keys[i].index=i}i=parseInt(g.length*
-g.fps,10);g.JIT={};g.JIT.hierarchy=[];for(k=0;k<g.hierarchy.length;k++)g.JIT.hierarchy.push(Array(i));g.initialized=!0}};d.get=function(g){if(typeof g==="string")if(e[g])return e[g];else{console.log("THREE.AnimationHandler.get: Couldn't find animation "+g);return null}};d.parse=function(g){var k=[];if(g instanceof THREE.SkinnedMesh)for(var i=0;i<g.bones.length;i++)k.push(g.bones[i]);else h(g,k);return k};var h=function(g,k){k.push(g);for(var i=0;i<g.children.length;i++)h(g.children[i],k)};d.LINEAR=
-0;d.CATMULLROM=1;d.CATMULLROM_FORWARD=2;return d}();THREE.Animation=function(b,e,d,h){this.root=b;this.data=THREE.AnimationHandler.get(e);this.hierarchy=THREE.AnimationHandler.parse(b);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=h!==undefined?h:!0;this.points=[];this.target=new THREE.Vector3};
-THREE.Animation.prototype.play=function(b,e){if(!this.isPlaying){this.isPlaying=!0;this.loop=b!==undefined?b:!0;this.currentTime=e!==undefined?e:0;var d,h=this.hierarchy.length,g;for(d=0;d<h;d++){g=this.hierarchy[d];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 k=g.animationCache.prevKey;g=g.animationCache.nextKey;k.pos=this.data.hierarchy[d].keys[0];k.rot=this.data.hierarchy[d].keys[0];k.scl=this.data.hierarchy[d].keys[0];g.pos=this.getNextKeyWith("pos",d,1);g.rot=this.getNextKeyWith("rot",d,1);g.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 k=Math.cos(e);e=Math.sin(e);var j=b*d,p=h*g;this.w=j*k-p*e;this.x=j*e+p*k;this.y=h*d*k+b*g*e;this.z=b*g*k-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,k=b.x,j=b.y,p=b.z;b=b.w;this.x=d*b+g*k+e*p-h*j;this.y=e*b+g*j+h*k-d*p;this.z=h*b+g*p+d*j-e*k;this.w=g*b-d*k-e*j-h*p;return this},
+multiplyVector3:function(b,d){d||(d=b);var e=b.x,h=b.y,g=b.z,k=this.x,j=this.y,p=this.z,q=this.w,v=q*e+j*g-p*h,E=q*h+p*e-k*g,G=q*g+k*h-j*e;e=-k*e-j*h-p*g;d.x=v*q+e*-k+E*-p-G*-j;d.y=E*q+e*-j+G*-k-v*-p;d.z=G*q+e*-p+v*-j-E*-k;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 k=Math.acos(g),j=Math.sqrt(1-g*g);if(Math.abs(j)<0.0010){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)*k)/j;h=Math.sin(h*k)/j;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,k){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=k instanceof Array?k:[k];this.centroid=new THREE.Vector3};
+THREE.Face4=function(b,d,e,h,g,k,j){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=k instanceof THREE.Color?k:new THREE.Color;this.vertexColors=k instanceof Array?k:[];this.vertexTangents=[];this.materials=j instanceof Array?j:[j];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.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
+THREE.Geometry.prototype={computeCentroids:function(){var b,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,k,j,p=new THREE.Vector3,q=new THREE.Vector3;h=0;for(g=this.faces.length;h<g;h++){k=this.faces[h];if(b&&k.vertexNormals.length){p.set(0,0,0);d=0;for(e=k.vertexNormals.length;d<e;d++)p.addSelf(k.vertexNormals[d]);p.divideScalar(3)}else{d=this.vertices[k.a];e=this.vertices[k.b];j=this.vertices[k.c];p.sub(j.position,e.position);q.sub(d.position,e.position);p.crossSelf(q)}p.isZero()||
+p.normalize();k.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(aa,ma,na,ga,Y,wa,qa){p=aa.vertices[ma].position;q=aa.vertices[na].position;v=aa.vertices[ga].position;E=j[Y];G=j[wa];I=j[qa];H=q.x-p.x;L=v.x-p.x;M=q.y-p.y;V=v.y-p.y;P=q.z-p.z;sa=v.z-p.z;da=G.u-E.u;oa=I.u-E.u;Z=G.v-E.v;K=I.v-E.v;Ia=1/(da*
+K-oa*Z);c.set((K*H-Z*L)*Ia,(K*M-Z*V)*Ia,(K*P-Z*sa)*Ia);R.set((da*L-oa*H)*Ia,(da*V-oa*M)*Ia,(da*sa-oa*P)*Ia);Ea[ma].addSelf(c);Ea[na].addSelf(c);Ea[ga].addSelf(c);fa[ma].addSelf(R);fa[na].addSelf(R);fa[ga].addSelf(R)}var d,e,h,g,k,j,p,q,v,E,G,I,H,L,M,V,P,sa,da,oa,Z,K,Ia,ca,Ea=[],fa=[],c=new THREE.Vector3,R=new THREE.Vector3,pa=new THREE.Vector3,ra=new THREE.Vector3,Fa=new THREE.Vector3;d=0;for(e=this.vertices.length;d<e;d++){Ea[d]=new THREE.Vector3;fa[d]=new THREE.Vector3}d=0;for(e=this.faces.length;d<
+e;d++){k=this.faces[d];j=this.faceVertexUvs[0][d];if(k instanceof THREE.Face3)b(this,k.a,k.b,k.c,0,1,2);else if(k instanceof THREE.Face4){b(this,k.a,k.b,k.c,0,1,2);b(this,k.a,k.b,k.d,0,1,3)}}var ta=["a","b","c","d"];d=0;for(e=this.faces.length;d<e;d++){k=this.faces[d];for(h=0;h<k.vertexNormals.length;h++){Fa.copy(k.vertexNormals[h]);g=k[ta[h]];ca=Ea[g];pa.copy(ca);pa.subSelf(Fa.multiplyScalar(Fa.dot(ca))).normalize();ra.cross(k.vertexNormals[h],ca);g=ra.dot(fa[g]);g=g<0?-1:1;k.vertexTangents[h]=new THREE.Vector4(pa.x,
+pa.y,pa.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}},computeEdgeFaces:function(){function b(q,v){return Math.min(q,v)+"_"+Math.max(q,v)}function d(q,v,E){if(q[v]===undefined){q[v]={set:{},array:[]};q[v].set[E]=1;q[v].array.push(E)}else if(q[v].set[E]===undefined){q[v].set[E]=1;q[v].array.push(E)}}var e,h,g,k,j,p={};e=0;for(h=this.faces.length;e<h;e++){j=this.faces[e];if(j instanceof THREE.Face3){g=b(j.a,j.b);d(p,g,e);g=b(j.b,j.c);d(p,g,e);g=b(j.a,j.c);d(p,g,e)}else if(j instanceof THREE.Face4){g=b(j.b,j.d);d(p,g,e);g=b(j.a,j.b);d(p,g,e);
+g=b(j.a,j.d);d(p,g,e);g=b(j.b,j.c);d(p,g,e);g=b(j.c,j.d);d(p,g,e)}}e=0;for(h=this.edges.length;e<h;e++){j=this.edges[e];g=j.vertexIndices[0];k=j.vertexIndices[1];j.faceIndices=p[b(g,k)].array;for(g=0;g<j.faceIndices.length;g++){k=j.faceIndices[g];j.faces.push(this.faces[k])}}}};THREE.GeometryIdCounter=0;
+THREE.AnimationHandler=function(){var b=[],d={},e={};e.update=function(g){for(var k=0;k<b.length;k++)b[k].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 k=0;k<g.hierarchy.length;k++){for(var j=0;j<g.hierarchy[k].keys.length;j++){if(g.hierarchy[k].keys[j].time<
+0)g.hierarchy[k].keys[j].time=0;if(g.hierarchy[k].keys[j].rot!==undefined&&!(g.hierarchy[k].keys[j].rot instanceof THREE.Quaternion)){var p=g.hierarchy[k].keys[j].rot;g.hierarchy[k].keys[j].rot=new THREE.Quaternion(p[0],p[1],p[2],p[3])}}if(g.hierarchy[k].keys[0].morphTargets!==undefined){p={};for(j=0;j<g.hierarchy[k].keys.length;j++)for(var q=0;q<g.hierarchy[k].keys[j].morphTargets.length;q++){var v=g.hierarchy[k].keys[j].morphTargets[q];p[v]=-1}g.hierarchy[k].usedMorphTargets=p;for(j=0;j<g.hierarchy[k].keys.length;j++){var E=
+{};for(v in p){for(q=0;q<g.hierarchy[k].keys[j].morphTargets.length;q++)if(g.hierarchy[k].keys[j].morphTargets[q]===v){E[v]=g.hierarchy[k].keys[j].morphTargetsInfluences[q];break}q===g.hierarchy[k].keys[j].morphTargets.length&&(E[v]=0)}g.hierarchy[k].keys[j].morphTargetsInfluences=E}}for(j=1;j<g.hierarchy[k].keys.length;j++)if(g.hierarchy[k].keys[j].time===g.hierarchy[k].keys[j-1].time){g.hierarchy[k].keys.splice(j,1);j--}for(j=1;j<g.hierarchy[k].keys.length;j++)g.hierarchy[k].keys[j].index=j}j=parseInt(g.length*
+g.fps,10);g.JIT={};g.JIT.hierarchy=[];for(k=0;k<g.hierarchy.length;k++)g.JIT.hierarchy.push(Array(j));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 k=[];if(g instanceof THREE.SkinnedMesh)for(var j=0;j<g.bones.length;j++)k.push(g.bones[j]);else h(g,k);return k};var h=function(g,k){k.push(g);for(var j=0;j<g.children.length;j++)h(g.children[j],k)};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 k=g.animationCache.prevKey;g=g.animationCache.nextKey;k.pos=this.data.hierarchy[e].keys[0];k.rot=this.data.hierarchy[e].keys[0];k.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 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 e=["pos","rot","scl"],d,h,g,k,i,p,q,u,D=this.data.JIT.hierarchy,E,I;this.currentTime+=b*this.timeScale;I=this.currentTime;E=this.currentTime%=this.data.length;u=parseInt(Math.min(E*this.data.fps,this.data.length*this.data.fps),10);for(var F=0,M=this.hierarchy.length;F<M;F++){b=this.hierarchy[F];q=b.animationCache;if(this.JITCompile&&D[F][u]!==undefined)if(b instanceof THREE.Bone){b.skinMatrix=D[F][u];b.matrixAutoUpdate=!1;b.matrixWorldNeedsUpdate=
-!1}else{b.matrix=D[F][u];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 N=0;N<3;N++){d=e[N];i=q.prevKey[d];p=q.nextKey[d];if(p.time<=I){if(E<I)if(this.loop){i=this.data.hierarchy[F].keys[0];for(p=this.getNextKeyWith(d,F,1);p.time<E;){i=p;p=this.getNextKeyWith(d,F,p.index+1)}}else{this.stop();return}else{do{i=p;p=this.getNextKeyWith(d,F,p.index+1)}while(p.time<
-E)}q.prevKey[d]=i;q.nextKey[d]=p}b.matrixAutoUpdate=!0;b.matrixWorldNeedsUpdate=!0;h=(E-i.time)/(p.time-i.time);g=i[d];k=p[d];if(h<0||h>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+h+" on bone "+F);h=h<0?0:1}if(d==="pos"){d=b.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){d.x=g[0]+(k[0]-g[0])*h;d.y=g[1]+(k[1]-g[1])*h;d.z=g[2]+(k[2]-g[2])*h}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=
-this.getPrevKeyWith("pos",F,i.index-1).pos;this.points[1]=g;this.points[2]=k;this.points[3]=this.getNextKeyWith("pos",F,p.index+1).pos;h=h*0.33+0.33;g=this.interpolateCatmullRom(this.points,h);d.x=g[0];d.y=g[1];d.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(d);this.target.y=0;this.target.normalize();h=Math.atan2(this.target.x,this.target.z);b.rotation.set(0,h,0)}}}else if(d===
-"rot")THREE.Quaternion.slerp(g,k,b.quaternion,h);else if(d==="scl"){d=b.scale;d.x=g[0]+(k[0]-g[0])*h;d.y=g[1]+(k[1]-g[1])*h;d.z=g[2]+(k[2]-g[2])*h}}}}if(this.JITCompile&&D[0][u]===undefined){this.hierarchy[0].update(undefined,!0);for(F=0;F<this.hierarchy.length;F++)D[F][u]=this.hierarchy[F]instanceof THREE.Bone?this.hierarchy[F].skinMatrix.clone():this.hierarchy[F].matrix.clone()}}};
-THREE.Animation.prototype.interpolateCatmullRom=function(b,e){var d=[],h=[],g,k,i,p,q,u;g=(b.length-1)*e;k=Math.floor(g);g-=k;d[0]=k==0?k:k-1;d[1]=k;d[2]=k>b.length-2?k:k+1;d[3]=k>b.length-3?k:k+2;k=b[d[0]];p=b[d[1]];q=b[d[2]];u=b[d[3]];d=g*g;i=g*d;h[0]=this.interpolate(k[0],p[0],q[0],u[0],g,d,i);h[1]=this.interpolate(k[1],p[1],q[1],u[1],g,d,i);h[2]=this.interpolate(k[2],p[2],q[2],u[2],g,d,i);return h};
-THREE.Animation.prototype.interpolate=function(b,e,d,h,g,k,i){b=(d-b)*0.5;h=(h-e)*0.5;return(2*(e-d)+b+h)*i+(-3*(e-d)-2*b-h)*k+b*g+e};THREE.Animation.prototype.getNextKeyWith=function(b,e,d){var h=this.data.hierarchy[e].keys;if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)d=d<h.length-1?d:h.length-1;else d%=h.length;for(;d<h.length;d++)if(h[d][b]!==undefined)return h[d];return this.data.hierarchy[e].keys[0]};
-THREE.Animation.prototype.getPrevKeyWith=function(b,e,d){var h=this.data.hierarchy[e].keys;for(d=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?d>0?d:0:d>=0?d:d+h.length;d>=0;d--)if(h[d][b]!==undefined)return h[d];return this.data.hierarchy[e].keys[h.length-1]};
-THREE.Camera=function(b,e,d,h,g){THREE.Object3D.call(this);this.fov=b||50;this.aspect=e||1;this.near=d||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,e){this.matrix.rotateAxis(e);this.position.addSelf(e.multiplyScalar(b));this.target.position.addSelf(e.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,e,d){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);e=!0}else{this.matrixAutoUpdate&&(e|=this.updateMatrix());if(e||this.matrixWorldNeedsUpdate){b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=
-!1;e=!0;THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse)}}for(b=0;b<this.children.length;b++)this.children[b].update(this.matrixWorld,e,d)};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,e,d){THREE.Light.call(this,b);this.position=new THREE.Vector3(0,1,0);this.intensity=e||1;this.distance=d||0};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(b,e,d){THREE.Light.call(this,b);this.position=new THREE.Vector3;this.intensity=e||1;this.distance=d||0};THREE.PointLight.prototype=new THREE.Light;
+THREE.Animation.prototype.update=function(b){if(this.isPlaying){var d=["pos","rot","scl"],e,h,g,k,j,p,q,v,E=this.data.JIT.hierarchy,G,I;this.currentTime+=b*this.timeScale;I=this.currentTime;G=this.currentTime%=this.data.length;v=parseInt(Math.min(G*this.data.fps,this.data.length*this.data.fps),10);for(var H=0,L=this.hierarchy.length;H<L;H++){b=this.hierarchy[H];q=b.animationCache;if(this.JITCompile&&E[H][v]!==undefined)if(b instanceof THREE.Bone){b.skinMatrix=E[H][v];b.matrixAutoUpdate=!1;b.matrixWorldNeedsUpdate=
+!1}else{b.matrix=E[H][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 M=0;M<3;M++){e=d[M];j=q.prevKey[e];p=q.nextKey[e];if(p.time<=I){if(G<I)if(this.loop){j=this.data.hierarchy[H].keys[0];for(p=this.getNextKeyWith(e,H,1);p.time<G;){j=p;p=this.getNextKeyWith(e,H,p.index+1)}}else{this.stop();return}else{do{j=p;p=this.getNextKeyWith(e,H,p.index+1)}while(p.time<
+G)}q.prevKey[e]=j;q.nextKey[e]=p}b.matrixAutoUpdate=!0;b.matrixWorldNeedsUpdate=!0;h=(G-j.time)/(p.time-j.time);g=j[e];k=p[e];if(h<0||h>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+h+" on bone "+H);h=h<0?0:1}if(e==="pos"){e=b.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){e.x=g[0]+(k[0]-g[0])*h;e.y=g[1]+(k[1]-g[1])*h;e.z=g[2]+(k[2]-g[2])*h}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=
+this.getPrevKeyWith("pos",H,j.index-1).pos;this.points[1]=g;this.points[2]=k;this.points[3]=this.getNextKeyWith("pos",H,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,k,b.quaternion,h);else if(e==="scl"){e=b.scale;e.x=g[0]+(k[0]-g[0])*h;e.y=g[1]+(k[1]-g[1])*h;e.z=g[2]+(k[2]-g[2])*h}}}}if(this.JITCompile&&E[0][v]===undefined){this.hierarchy[0].update(undefined,!0);for(H=0;H<this.hierarchy.length;H++)E[H][v]=this.hierarchy[H]instanceof THREE.Bone?this.hierarchy[H].skinMatrix.clone():this.hierarchy[H].matrix.clone()}}};
+THREE.Animation.prototype.interpolateCatmullRom=function(b,d){var e=[],h=[],g,k,j,p,q,v;g=(b.length-1)*d;k=Math.floor(g);g-=k;e[0]=k==0?k:k-1;e[1]=k;e[2]=k>b.length-2?k:k+1;e[3]=k>b.length-3?k:k+2;k=b[e[0]];p=b[e[1]];q=b[e[2]];v=b[e[3]];e=g*g;j=g*e;h[0]=this.interpolate(k[0],p[0],q[0],v[0],g,e,j);h[1]=this.interpolate(k[1],p[1],q[1],v[1],g,e,j);h[2]=this.interpolate(k[2],p[2],q[2],v[2],g,e,j);return h};
+THREE.Animation.prototype.interpolate=function(b,d,e,h,g,k,j){b=(e-b)*0.5;h=(h-d)*0.5;return(2*(d-e)+b+h)*j+(-3*(d-e)-2*b-h)*k+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(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;
@@ -105,54 +105,51 @@ THREE.ParticleBasicMaterial=function(b){THREE.Material.call(this,b);b=b||{};this
 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,e,d,h,g,k){this.image=b;this.mapping=e!==undefined?e:new THREE.UVMapping;this.wrapS=d!==undefined?d:THREE.ClampToEdgeWrapping;this.wrapT=h!==undefined?h:THREE.ClampToEdgeWrapping;this.magFilter=g!==undefined?g:THREE.LinearFilter;this.minFilter=k!==undefined?k:THREE.LinearMipMapLinearFilter;this.needsUpdate=!1};THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter)}};
+THREE.Texture=function(b,d,e,h,g,k){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=k!==undefined?k: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(b){var e,d,h,g={};for(e in b){g[e]={};for(d in b[e]){h=b[e][d];g[e][d]=h instanceof THREE.Color||h instanceof THREE.Vector3||h instanceof THREE.Texture?h.clone():h}}return g},merge:function(b){var e,d,h,g={};for(e=0;e<b.length;e++){h=this.clone(b[e]);for(d in h)g[d]=h[d]}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,e){THREE.Object3D.call(this);this.geometry=b;this.materials=e instanceof Array?e:[e];this.sortParticles=!1};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;
-THREE.Line=function(b,e,d){THREE.Object3D.call(this);this.geometry=b;this.materials=e instanceof Array?e:[e];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(b,e){THREE.Object3D.call(this);this.geometry=b;this.materials=e&&e.length?e:[e];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 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(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.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,e,d){this.matrixAutoUpdate&&(e|=this.updateMatrix());if(e||this.matrixWorldNeedsUpdate){b?this.skinMatrix.multiply(b,this.matrix):this.skinMatrix.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;e=!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,e,d):b.update(this.matrixWorld,!0,d)}}else for(h=0;h<g;h++)this.children[h].update(this.skinMatrix,
-e,d)};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,e){THREE.Mesh.call(this,b,e);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var d,h,g,k,i,p;if(this.geometry.bones!==undefined){for(d=0;d<this.geometry.bones.length;d++){g=this.geometry.bones[d];k=g.pos;i=g.rotq;p=g.scl;h=this.addBone();h.name=g.name;h.position.set(k[0],k[1],k[2]);h.quaternion.set(i[0],i[1],i[2],i[3]);h.useQuaternion=!0;p!==undefined?h.scale.set(p[0],p[1],p[2]):h.scale.set(1,1,1)}for(d=0;d<this.bones.length;d++){g=this.geometry.bones[d];
-h=this.bones[d];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,e,d){if(this.visible){this.matrixAutoUpdate&&(e|=this.updateMatrix());if(e||this.matrixWorldNeedsUpdate){b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;e=!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,d):b.update(this.matrixWorld,e,d)}d=this.bones.length;ba=this.bones;bm=this.boneMatrices;for(e=0;e<d;e++)ba[e].skinMatrix.flattenToArrayOffset(bm,
-e*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,e=[],d=0;d<this.bones.length;d++){b=this.bones[d];e.push(THREE.Matrix4.makeInvert(b.skinMatrix));b.skinMatrix.flattenToArrayOffset(this.boneMatrices,d*16)}if(this.geometry.skinVerticesA===undefined){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];var h;for(b=0;b<this.geometry.skinIndices.length;b++){d=this.geometry.vertices[b].position;var g=this.geometry.skinIndices[b].x,k=this.geometry.skinIndices[b].y;
-h=new THREE.Vector3(d.x,d.y,d.z);this.geometry.skinVerticesA.push(e[g].multiplyVector3(h));h=new THREE.Vector3(d.x,d.y,d.z);this.geometry.skinVerticesB.push(e[k].multiplyVector3(h));if(this.geometry.skinWeights[b].x+this.geometry.skinWeights[b].y!==1){d=(1-(this.geometry.skinWeights[b].x+this.geometry.skinWeights[b].y))*0.5;this.geometry.skinWeights[b].x+=d;this.geometry.skinWeights[b].y+=d}}}};
-THREE.Ribbon=function(b,e){THREE.Object3D.call(this);this.geometry=b;this.materials=e instanceof Array?e:[e];this.flipSided=!1;this.doubleSided=!1};THREE.Ribbon.prototype=new THREE.Object3D;THREE.Ribbon.prototype.constructor=THREE.Ribbon;
-THREE.Sound=function(b,e,d,h){THREE.Object3D.call(this);this.isLoaded=!1;this.isAddedToDOM=!1;this.isPlaying=!1;this.duration=-1;this.radius=e!==undefined?Math.abs(e):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=h!==undefined?h:!0;this.sources=b instanceof Array?b:[b];var g;d=this.sources.length;for(b=0;b<d;b++){e=this.sources[b];e.toLowerCase();if(e.indexOf(".mp3")!==-1)g=
-"audio/mpeg";else if(e.indexOf(".ogg")!==-1)g="audio/ogg";else e.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.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,k,j,p;if(this.geometry.bones!==undefined){for(e=0;e<this.geometry.bones.length;e++){g=this.geometry.bones[e];k=g.pos;j=g.rotq;p=g.scl;h=this.addBone();h.name=g.name;h.position.set(k[0],k[1],k[2]);h.quaternion.set(j[0],j[1],j[2],j[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,k=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[k].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,e,d){if(this.matrixAutoUpdate){this.matrix.setPosition(this.position);e=!0}if(e||this.matrixWorldNeedsUpdate){b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;e=!0}var h=this.children.length;for(b=0;b<h;b++)this.children[b].update(this.matrixWorld,e,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(b,e){e===undefined&&(e=0);e=Math.abs(e);for(var d=0;d<this.LODs.length;d++)if(e<this.LODs[d].visibleAtDistance)break;this.LODs.splice(d,0,{visibleAtDistance:e,object3D:b});this.addChild(b)};
-THREE.LOD.prototype.update=function(b,e,d){this.matrixAutoUpdate&&(e|=this.updateMatrix());if(e||this.matrixWorldNeedsUpdate){b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;e=!0}if(this.LODs.length>1){b=d.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,e,d)};THREE.ShadowVolume=function(b,e){if(b instanceof THREE.Mesh){THREE.Mesh.call(this,b.geometry,e?[new THREE.ShadowVolumeDynamicMaterial]:[new THREE.ShadowVolumeDynamicMaterial]);b.addChild(this)}else THREE.Mesh.call(this,b,e?[new THREE.ShadowVolumeDynamicMaterial]:[new THREE.ShadowVolumeDynamicMaterial]);this.calculateShadowVolumeGeometry()};
-THREE.ShadowVolume.prototype=new THREE.Mesh;THREE.ShadowVolume.prototype.constructor=THREE.ShadowVolume;THREE.ShadowVolume.prototype.supr=THREE.Mesh.prototype;
-THREE.ShadowVolume.prototype.calculateShadowVolumeGeometry=function(){if(this.geometry.edges&&this.geometry.edges.length){var b,e,d,h,g,k,i,p,q,u,D,E,I,F,M=new THREE.Geometry;M.vertices=this.geometry.vertices;h=M.faces=this.geometry.faces;var N=M.egdes=this.geometry.edges,U=M.edgeFaces=[];g=0;var L=[];b=0;for(e=h.length;b<e;b++){d=h[b];L.push(g);g+=d instanceof THREE.Face3?3:4;d.vertexNormals[0]=d.normal;d.vertexNormals[1]=d.normal;d.vertexNormals[2]=d.normal;if(d instanceof THREE.Face4)d.vertexNormals[3]=
-d.normal}b=0;for(e=N.length;b<e;b++){p=N[b];d=p.faces[0];h=p.faces[1];g=p.faceIndices[0];k=p.faceIndices[1];i=p.vertexIndices[0];p=p.vertexIndices[1];if(d.a===i){q="a";D=L[g]+0}else if(d.b===i){q="b";D=L[g]+1}else if(d.c===i){q="c";D=L[g]+2}else if(d.d===i){q="d";D=L[g]+3}if(d.a===p){q+="a";E=L[g]+0}else if(d.b===p){q+="b";E=L[g]+1}else if(d.c===p){q+="c";E=L[g]+2}else if(d.d===p){q+="d";E=L[g]+3}if(h.a===i){u="a";I=L[k]+0}else if(h.b===i){u="b";I=L[k]+1}else if(h.c===i){u="c";I=L[k]+2}else if(h.d===
-i){u="d";I=L[k]+3}if(h.a===p){u+="a";F=L[k]+0}else if(h.b===p){u+="b";F=L[k]+1}else if(h.c===p){u+="c";F=L[k]+2}else if(h.d===p){u+="d";F=L[k]+3}if(q==="ac"||q==="ad"||q==="ca"||q==="da"){if(D>E){d=D;D=E;E=d}}else if(D<E){d=D;D=E;E=d}if(u==="ac"||u==="ad"||u==="ca"||u==="da"){if(I>F){d=I;I=F;F=d}}else if(I<F){d=I;I=F;F=d}d=new THREE.Face4(D,E,I,F);d.normal.set(1,0,0);U.push(d)}this.geometry=M}else this.calculateShadowVolumeGeometryWithoutEdgeInfo(this.geometry)};
-THREE.ShadowVolume.prototype.calculateShadowVolumeGeometryWithoutEdgeInfo=function(b){this.geometry=new THREE.Geometry;this.geometry.boundingSphere=b.boundingSphere;this.geometry.edgeFaces=[];var e=this.geometry.vertices,d=this.geometry.faces,h=this.geometry.edgeFaces,g=b.faces;b=b.vertices;var k=g.length,i,p,q,u,D,E=["a","b","c","d"];for(q=0;q<k;q++){p=e.length;i=g[q];if(i instanceof THREE.Face4){u=4;p=new THREE.Face4(p,p+1,p+2,p+3)}else{u=3;p=new THREE.Face3(p,p+1,p+2)}p.normal.copy(i.normal);d.push(p);
-for(p=0;p<u;p++){D=b[i[E[p]]];e.push(new THREE.Vertex(D.position.clone()))}}for(k=0;k<g.length-1;k++){b=d[k];for(i=k+1;i<g.length;i++){p=d[i];p=this.facesShareEdge(e,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,e,d){var h,g,k,i,p,q,u,D,E,I,F,M,N,U=0,L=["a","b","c","d"];h=e instanceof THREE.Face4?4:3;g=d instanceof THREE.Face4?4:3;for(M=0;M<h;M++){k=e[L[M]];p=b[k];for(N=0;N<g;N++){i=d[L[N]];q=b[i];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){U++;if(U===1){u=p;D=q;E=k;I=i;F=L[M]}if(U===2){F+=L[M];return F==="ad"||F==="ac"?{faces:[e,d],vertices:[u,D,q,p],indices:[E,
-I,i,k],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[e,d],vertices:[u,p,q,D],indices:[E,k,i,I],vertexTypes:[1,1,2,2],extrudable:!0}}}}}};THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.fog=null;this.objects=[];this.lights=[];this.sounds=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;
-THREE.Scene.prototype.addChild=function(b){this.supr.addChild.call(this,b);this.addChildRecurse(b)};THREE.Scene.prototype.addChildRecurse=function(b){if(b instanceof THREE.Light)this.lights.indexOf(b)===-1&&this.lights.push(b);else if(b instanceof THREE.Sound)this.sounds.indexOf(b)===-1&&this.sounds.push(b);else if(!(b instanceof THREE.Camera||b instanceof THREE.Bone)&&this.objects.indexOf(b)===-1){this.objects.push(b);this.__objectsAdded.push(b)}for(var e=0;e<b.children.length;e++)this.addChildRecurse(b.children[e])};
-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 e=this.lights.indexOf(b);e!==-1&&this.lights.splice(e,1)}else if(b instanceof THREE.Sound){e=this.sounds.indexOf(b);e!==-1&&this.sounds.splice(e,1)}else if(!(b instanceof THREE.Camera)){e=this.objects.indexOf(b);if(e!==-1){this.objects.splice(e,1);this.__objectsRemoved.push(b)}}for(e=0;e<b.children.length;e++)this.removeChildRecurse(b.children[e])};
-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,e,d){this.color=new THREE.Color(b);this.near=e||1;this.far=d||1E3};THREE.FogExp2=function(b,e){this.color=new THREE.Color(b);this.density=e!==undefined?e:2.5E-4};
-THREE.Projector=function(){function b(){var c=q[p]=q[p]||new THREE.RenderableVertex;p++;return c}function e(c,R){return R.z-c.z}function d(c,R){var pa=0,ra=1,Fa=c.z+c.w,ta=R.z+R.w,aa=-c.z+c.w,ma=-R.z+R.w;if(Fa>=0&&ta>=0&&aa>=0&&ma>=0)return!0;else if(Fa<0&&ta<0||aa<0&&ma<0)return!1;else{if(Fa<0)pa=Math.max(pa,Fa/(Fa-ta));else ta<0&&(ra=Math.min(ra,Fa/(Fa-ta)));if(aa<0)pa=Math.max(pa,aa/(aa-ma));else ma<0&&(ra=Math.min(ra,aa/(aa-ma)));if(ra<pa)return!1;else{c.lerpSelf(R,pa);R.lerpSelf(c,1-ra);return!0}}}
-var h,g,k=[],i,p,q=[],u,D,E=[],I,F=[],M,N,U=[],L,sa,da=[],oa=new THREE.Vector4,Z=new THREE.Vector4,K=new THREE.Matrix4,Ia=new THREE.Matrix4,ca=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Ea=new THREE.Vector4,fa=new THREE.Vector4;this.projectVector=function(c,R){K.multiply(R.projectionMatrix,R.matrixWorldInverse);K.multiplyVector3(c);return c};this.unprojectVector=function(c,R){K.multiply(R.matrixWorld,THREE.Matrix4.makeInvert(R.projectionMatrix));
+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(b){this.geometry=new THREE.Geometry;this.geometry.boundingSphere=b.boundingSphere;this.geometry.edgeFaces=[];var d=this.geometry.vertices,e=this.geometry.faces,h=this.geometry.edgeFaces,g=b.faces;b=b.vertices;var k=g.length,j,p,q,v,E,G=["a","b","c","d"];for(q=0;q<k;q++){p=d.length;j=g[q];if(j 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(j.normal);e.push(p);for(p=
+0;p<v;p++){E=b[j[G[p]]];d.push(new THREE.Vertex(E.position.clone()))}}for(k=0;k<g.length-1;k++){b=e[k];for(j=k+1;j<g.length;j++){p=e[j];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,k,j,p,q,v,E,G,I,H,L,M,V=0,P=["a","b","c","d"];h=d instanceof THREE.Face4?4:3;g=e instanceof THREE.Face4?4:3;for(L=0;L<h;L++){k=d[P[L]];p=b[k];for(M=0;M<g;M++){j=e[P[M]];q=b[j];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){V++;if(V===1){v=p;E=q;G=k;I=j;H=P[L]}if(V===2){H+=P[L];return H==="ad"||H==="ac"?{faces:[d,e],vertices:[v,E,q,p],indices:[G,
+I,j,k],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[d,e],vertices:[v,p,q,E],indices:[G,k,j,I],vertexTypes:[1,1,2,2],extrudable:!0}}}}}};THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.fog=null;this.objects=[];this.lights=[];this.sounds=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;
+THREE.Scene.prototype.addChild=function(b){this.supr.addChild.call(this,b);this.addChildRecurse(b)};THREE.Scene.prototype.addChildRecurse=function(b){if(b instanceof THREE.Light)this.lights.indexOf(b)===-1&&this.lights.push(b);else if(b instanceof THREE.Sound)this.sounds.indexOf(b)===-1&&this.sounds.push(b);else if(!(b instanceof THREE.Camera||b instanceof THREE.Bone)&&this.objects.indexOf(b)===-1){this.objects.push(b);this.__objectsAdded.push(b)}for(var d=0;d<b.children.length;d++)this.addChildRecurse(b.children[d])};
+THREE.Scene.prototype.removeChild=function(b){this.supr.removeChild.call(this,b);this.removeChildRecurse(b)};THREE.Scene.prototype.removeChildRecurse=function(b){if(b instanceof THREE.Light){var d=this.lights.indexOf(b);d!==-1&&this.lights.splice(d,1)}else if(b instanceof THREE.Sound){d=this.sounds.indexOf(b);d!==-1&&this.sounds.splice(d,1)}else if(!(b instanceof THREE.Camera)){d=this.objects.indexOf(b);if(d!==-1){this.objects.splice(d,1);this.__objectsRemoved.push(b)}}for(d=0;d<b.children.length;d++)this.removeChildRecurse(b.children[d])};
+THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;THREE.Fog=function(b,d,e){this.color=new THREE.Color(b);this.near=d||1;this.far=e||1E3};THREE.FogExp2=function(b,d){this.color=new THREE.Color(b);this.density=d!==undefined?d:2.5E-4};
+THREE.Projector=function(){function b(){var c=q[p]=q[p]||new THREE.RenderableVertex;p++;return c}function d(c,R){return R.z-c.z}function e(c,R){var pa=0,ra=1,Fa=c.z+c.w,ta=R.z+R.w,aa=-c.z+c.w,ma=-R.z+R.w;if(Fa>=0&&ta>=0&&aa>=0&&ma>=0)return!0;else if(Fa<0&&ta<0||aa<0&&ma<0)return!1;else{if(Fa<0)pa=Math.max(pa,Fa/(Fa-ta));else ta<0&&(ra=Math.min(ra,Fa/(Fa-ta)));if(aa<0)pa=Math.max(pa,aa/(aa-ma));else ma<0&&(ra=Math.min(ra,aa/(aa-ma)));if(ra<pa)return!1;else{c.lerpSelf(R,pa);R.lerpSelf(c,1-ra);return!0}}}
+var h,g,k=[],j,p,q=[],v,E,G=[],I,H=[],L,M,V=[],P,sa,da=[],oa=new THREE.Vector4,Z=new THREE.Vector4,K=new THREE.Matrix4,Ia=new THREE.Matrix4,ca=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Ea=new THREE.Vector4,fa=new THREE.Vector4;this.projectVector=function(c,R){K.multiply(R.projectionMatrix,R.matrixWorldInverse);K.multiplyVector3(c);return c};this.unprojectVector=function(c,R){K.multiply(R.matrixWorld,THREE.Matrix4.makeInvert(R.projectionMatrix));
 K.multiplyVector3(c);return c};this.projectObjects=function(c,R,pa){R=[];var ra,Fa,ta;g=0;Fa=c.objects;c=0;for(ra=Fa.length;c<ra;c++){ta=Fa[c];var aa;if(!(aa=!ta.visible))if(aa=ta instanceof THREE.Mesh){a:{aa=void 0;for(var ma=ta.matrixWorld,na=-ta.geometry.boundingSphere.radius*Math.max(ta.scale.x,Math.max(ta.scale.y,ta.scale.z)),ga=0;ga<6;ga++){aa=ca[ga].x*ma.n14+ca[ga].y*ma.n24+ca[ga].z*ma.n34+ca[ga].w;if(aa<=na){aa=!1;break a}}aa=!0}aa=!aa}if(!aa){aa=k[g]=k[g]||new THREE.RenderableObject;g++;
-h=aa;oa.copy(ta.position);K.multiplyVector3(oa);h.object=ta;h.z=oa.z;R.push(h)}}pa&&R.sort(e);return R};this.projectScene=function(c,R,pa){var ra=[],Fa=R.near,ta=R.far,aa,ma,na,ga,Y,wa,qa,ya,za,$,Pa,Ta,Xa,Ua,Sa,Ya,Za;sa=N=I=D=0;R.matrixAutoUpdate&&R.updateMatrix();c.update(undefined,!1,R);K.multiply(R.projectionMatrix,R.matrixWorldInverse);ca[0].set(K.n41-K.n11,K.n42-K.n12,K.n43-K.n13,K.n44-K.n14);ca[1].set(K.n41+K.n11,K.n42+K.n12,K.n43+K.n13,K.n44+K.n14);ca[2].set(K.n41+K.n21,K.n42+K.n22,K.n43+K.n23,
-K.n44+K.n24);ca[3].set(K.n41-K.n21,K.n42-K.n22,K.n43-K.n23,K.n44-K.n24);ca[4].set(K.n41-K.n31,K.n42-K.n32,K.n43-K.n33,K.n44-K.n34);ca[5].set(K.n41+K.n31,K.n42+K.n32,K.n43+K.n33,K.n44+K.n34);for(aa=0;aa<6;aa++){za=ca[aa];za.divideScalar(Math.sqrt(za.x*za.x+za.y*za.y+za.z*za.z))}za=this.projectObjects(c,R,!0);c=0;for(aa=za.length;c<aa;c++){$=za[c].object;if($.visible){Pa=$.matrixWorld;Ta=$.matrixRotationWorld;Xa=$.materials;Ua=$.overdraw;p=0;if($ instanceof THREE.Mesh){Sa=$.geometry;ga=Sa.vertices;
-Ya=Sa.faces;Sa=Sa.faceVertexUvs;ma=0;for(na=ga.length;ma<na;ma++){i=b();i.positionWorld.copy(ga[ma].position);Pa.multiplyVector3(i.positionWorld);i.positionScreen.copy(i.positionWorld);K.multiplyVector4(i.positionScreen);i.positionScreen.x/=i.positionScreen.w;i.positionScreen.y/=i.positionScreen.w;i.visible=i.positionScreen.z>Fa&&i.positionScreen.z<ta}ga=0;for(ma=Ya.length;ga<ma;ga++){na=Ya[ga];if(na instanceof THREE.Face3){Y=q[na.a];wa=q[na.b];qa=q[na.c];if(Y.visible&&wa.visible&&qa.visible&&($.doubleSided||
-$.flipSided!=(qa.positionScreen.x-Y.positionScreen.x)*(wa.positionScreen.y-Y.positionScreen.y)-(qa.positionScreen.y-Y.positionScreen.y)*(wa.positionScreen.x-Y.positionScreen.x)<0)){ya=E[D]=E[D]||new THREE.RenderableFace3;D++;u=ya;u.v1.copy(Y);u.v2.copy(wa);u.v3.copy(qa)}else continue}else if(na instanceof THREE.Face4){Y=q[na.a];wa=q[na.b];qa=q[na.c];ya=q[na.d];if(Y.visible&&wa.visible&&qa.visible&&ya.visible&&($.doubleSided||$.flipSided!=((ya.positionScreen.x-Y.positionScreen.x)*(wa.positionScreen.y-
-Y.positionScreen.y)-(ya.positionScreen.y-Y.positionScreen.y)*(wa.positionScreen.x-Y.positionScreen.x)<0||(wa.positionScreen.x-qa.positionScreen.x)*(ya.positionScreen.y-qa.positionScreen.y)-(wa.positionScreen.y-qa.positionScreen.y)*(ya.positionScreen.x-qa.positionScreen.x)<0))){Za=F[I]=F[I]||new THREE.RenderableFace4;I++;u=Za;u.v1.copy(Y);u.v2.copy(wa);u.v3.copy(qa);u.v4.copy(ya)}else continue}u.normalWorld.copy(na.normal);Ta.multiplyVector3(u.normalWorld);u.centroidWorld.copy(na.centroid);Pa.multiplyVector3(u.centroidWorld);
-u.centroidScreen.copy(u.centroidWorld);K.multiplyVector3(u.centroidScreen);qa=na.vertexNormals;Y=0;for(wa=qa.length;Y<wa;Y++){ya=u.vertexNormalsWorld[Y];ya.copy(qa[Y]);Ta.multiplyVector3(ya)}Y=0;for(wa=Sa.length;Y<wa;Y++)if(Za=Sa[Y][ga]){qa=0;for(ya=Za.length;qa<ya;qa++)u.uvs[Y][qa]=Za[qa]}u.meshMaterials=Xa;u.faceMaterials=na.materials;u.overdraw=Ua;u.z=u.centroidScreen.z;ra.push(u)}}else if($ instanceof THREE.Line){Ia.multiply(K,Pa);ga=$.geometry.vertices;Y=b();Y.positionScreen.copy(ga[0].position);
-Ia.multiplyVector4(Y.positionScreen);ma=1;for(na=ga.length;ma<na;ma++){Y=b();Y.positionScreen.copy(ga[ma].position);Ia.multiplyVector4(Y.positionScreen);wa=q[p-2];Ea.copy(Y.positionScreen);fa.copy(wa.positionScreen);if(d(Ea,fa)){Ea.multiplyScalar(1/Ea.w);fa.multiplyScalar(1/fa.w);Pa=U[N]=U[N]||new THREE.RenderableLine;N++;M=Pa;M.v1.positionScreen.copy(Ea);M.v2.positionScreen.copy(fa);M.z=Math.max(Ea.z,fa.z);M.materials=$.materials;ra.push(M)}}}else if($ instanceof THREE.Particle){Z.set($.position.x,
-$.position.y,$.position.z,1);K.multiplyVector4(Z);Z.z/=Z.w;if(Z.z>0&&Z.z<1){Pa=da[sa]=da[sa]||new THREE.RenderableParticle;sa++;L=Pa;L.x=Z.x/Z.w;L.y=Z.y/Z.w;L.z=Z.z;L.rotation=$.rotation.z;L.scale.x=$.scale.x*Math.abs(L.x-(Z.x+R.projectionMatrix.n11)/(Z.w+R.projectionMatrix.n14));L.scale.y=$.scale.y*Math.abs(L.y-(Z.y+R.projectionMatrix.n22)/(Z.w+R.projectionMatrix.n24));L.materials=$.materials;ra.push(L)}}}}pa&&ra.sort(e);return ra}};
-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,e,d){d&&b.update(undefined,!1,e);d=b.sounds;var h,g=d.length;for(h=0;h<g;h++){b=d[h];this.soundPosition.set(b.matrixWorld.n14,b.matrixWorld.n24,b.matrixWorld.n34);this.soundPosition.subSelf(e.position);if(b.isPlaying&&b.isLoaded){b.isAddedToDOM||b.addToDOM(this.domElement);b.calculateVolumeAndPan(this.soundPosition)}}}};
+h=aa;oa.copy(ta.position);K.multiplyVector3(oa);h.object=ta;h.z=oa.z;R.push(h)}}pa&&R.sort(d);return R};this.projectScene=function(c,R,pa){var ra=[],Fa=R.near,ta=R.far,aa,ma,na,ga,Y,wa,qa,ya,za,$,Pa,Ua,Ya,Va,Sa,Za,$a;sa=M=I=E=0;R.matrixAutoUpdate&&R.updateMatrix();c.update(undefined,!1,R);K.multiply(R.projectionMatrix,R.matrixWorldInverse);ca[0].set(K.n41-K.n11,K.n42-K.n12,K.n43-K.n13,K.n44-K.n14);ca[1].set(K.n41+K.n11,K.n42+K.n12,K.n43+K.n13,K.n44+K.n14);ca[2].set(K.n41+K.n21,K.n42+K.n22,K.n43+K.n23,
+K.n44+K.n24);ca[3].set(K.n41-K.n21,K.n42-K.n22,K.n43-K.n23,K.n44-K.n24);ca[4].set(K.n41-K.n31,K.n42-K.n32,K.n43-K.n33,K.n44-K.n34);ca[5].set(K.n41+K.n31,K.n42+K.n32,K.n43+K.n33,K.n44+K.n34);for(aa=0;aa<6;aa++){za=ca[aa];za.divideScalar(Math.sqrt(za.x*za.x+za.y*za.y+za.z*za.z))}za=this.projectObjects(c,R,!0);c=0;for(aa=za.length;c<aa;c++){$=za[c].object;if($.visible){Pa=$.matrixWorld;Ua=$.matrixRotationWorld;Ya=$.materials;Va=$.overdraw;p=0;if($ instanceof THREE.Mesh){Sa=$.geometry;ga=Sa.vertices;
+Za=Sa.faces;Sa=Sa.faceVertexUvs;ma=0;for(na=ga.length;ma<na;ma++){j=b();j.positionWorld.copy(ga[ma].position);Pa.multiplyVector3(j.positionWorld);j.positionScreen.copy(j.positionWorld);K.multiplyVector4(j.positionScreen);j.positionScreen.x/=j.positionScreen.w;j.positionScreen.y/=j.positionScreen.w;j.visible=j.positionScreen.z>Fa&&j.positionScreen.z<ta}ga=0;for(ma=Za.length;ga<ma;ga++){na=Za[ga];if(na instanceof THREE.Face3){Y=q[na.a];wa=q[na.b];qa=q[na.c];if(Y.visible&&wa.visible&&qa.visible&&($.doubleSided||
+$.flipSided!=(qa.positionScreen.x-Y.positionScreen.x)*(wa.positionScreen.y-Y.positionScreen.y)-(qa.positionScreen.y-Y.positionScreen.y)*(wa.positionScreen.x-Y.positionScreen.x)<0)){ya=G[E]=G[E]||new THREE.RenderableFace3;E++;v=ya;v.v1.copy(Y);v.v2.copy(wa);v.v3.copy(qa)}else continue}else if(na instanceof THREE.Face4){Y=q[na.a];wa=q[na.b];qa=q[na.c];ya=q[na.d];if(Y.visible&&wa.visible&&qa.visible&&ya.visible&&($.doubleSided||$.flipSided!=((ya.positionScreen.x-Y.positionScreen.x)*(wa.positionScreen.y-
+Y.positionScreen.y)-(ya.positionScreen.y-Y.positionScreen.y)*(wa.positionScreen.x-Y.positionScreen.x)<0||(wa.positionScreen.x-qa.positionScreen.x)*(ya.positionScreen.y-qa.positionScreen.y)-(wa.positionScreen.y-qa.positionScreen.y)*(ya.positionScreen.x-qa.positionScreen.x)<0))){$a=H[I]=H[I]||new THREE.RenderableFace4;I++;v=$a;v.v1.copy(Y);v.v2.copy(wa);v.v3.copy(qa);v.v4.copy(ya)}else continue}v.normalWorld.copy(na.normal);Ua.multiplyVector3(v.normalWorld);v.centroidWorld.copy(na.centroid);Pa.multiplyVector3(v.centroidWorld);
+v.centroidScreen.copy(v.centroidWorld);K.multiplyVector3(v.centroidScreen);qa=na.vertexNormals;Y=0;for(wa=qa.length;Y<wa;Y++){ya=v.vertexNormalsWorld[Y];ya.copy(qa[Y]);Ua.multiplyVector3(ya)}Y=0;for(wa=Sa.length;Y<wa;Y++)if($a=Sa[Y][ga]){qa=0;for(ya=$a.length;qa<ya;qa++)v.uvs[Y][qa]=$a[qa]}v.meshMaterials=Ya;v.faceMaterials=na.materials;v.overdraw=Va;v.z=v.centroidScreen.z;ra.push(v)}}else if($ instanceof THREE.Line){Ia.multiply(K,Pa);ga=$.geometry.vertices;Y=b();Y.positionScreen.copy(ga[0].position);
+Ia.multiplyVector4(Y.positionScreen);ma=1;for(na=ga.length;ma<na;ma++){Y=b();Y.positionScreen.copy(ga[ma].position);Ia.multiplyVector4(Y.positionScreen);wa=q[p-2];Ea.copy(Y.positionScreen);fa.copy(wa.positionScreen);if(e(Ea,fa)){Ea.multiplyScalar(1/Ea.w);fa.multiplyScalar(1/fa.w);Pa=V[M]=V[M]||new THREE.RenderableLine;M++;L=Pa;L.v1.positionScreen.copy(Ea);L.v2.positionScreen.copy(fa);L.z=Math.max(Ea.z,fa.z);L.materials=$.materials;ra.push(L)}}}else if($ instanceof THREE.Particle){Z.set($.position.x,
+$.position.y,$.position.z,1);K.multiplyVector4(Z);Z.z/=Z.w;if(Z.z>0&&Z.z<1){Pa=da[sa]=da[sa]||new THREE.RenderableParticle;sa++;P=Pa;P.x=Z.x/Z.w;P.y=Z.y/Z.w;P.z=Z.z;P.rotation=$.rotation.z;P.scale.x=$.scale.x*Math.abs(P.x-(Z.x+R.projectionMatrix.n11)/(Z.w+R.projectionMatrix.n14));P.scale.y=$.scale.y*Math.abs(P.y-(Z.y+R.projectionMatrix.n22)/(Z.w+R.projectionMatrix.n24));P.materials=$.materials;ra.push(P)}}}}pa&&ra.sort(d);return ra}};
+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",
@@ -171,7 +168,7 @@ lensFlare:{vertexShader:"uniform \tvec3 \tscreenPosition;\nuniform\tvec2\tscale;
 fragmentShader:"#ifdef GL_ES\nprecision highp float;\n#endif\nuniform\tsampler2D\tmap;\nuniform\tsampler2D\tocclusionMap;\nuniform\tfloat\t\topacity;\nuniform    int         renderType;\nvarying\tvec2\t\tvUV;\nvoid main( void )\n{\nif( renderType == 0 ) {\ngl_FragColor = vec4( texture2D( map, vUV ).rgb, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nfloat visibility = texture2D( occlusionMap, vec2( 0.5, 0.1 )).a +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 )).a +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 )).a +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 )).a;\nvisibility = ( 1.0 - visibility / 4.0 );\nvec4 color = texture2D( map, vUV );\ncolor.a *= opacity * visibility;\ngl_FragColor = color;\n}\n}"},
 sprite:{vertexShader:"uniform\tint\t\tuseScreenCoordinates;\nuniform    int     affectedByDistance;\nuniform\tvec3\tscreenPosition;\nuniform \tmat4 \tmodelViewMatrix;\nuniform \tmat4 \tprojectionMatrix;\nuniform    float   rotation;\nuniform    vec2    scale;\nuniform    vec2    alignment;\nuniform    vec2    uvOffset;\nuniform\tvec2    uvScale;\nattribute \tvec2 \tposition;\nattribute  vec2\tuv;\nvarying\tvec2\tvUV;\nvoid main(void)\n{\nvUV = uvOffset + uv * uvScale;\nvec2 alignedPosition = position + alignment;\nvec2 rotatedPosition;\nrotatedPosition.x = ( cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y ) * scale.x;\nrotatedPosition.y = ( sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y ) * scale.y;\nvec4 finalPosition;\nif( useScreenCoordinates != 0 ) {\nfinalPosition = vec4( screenPosition.xy + rotatedPosition, screenPosition.z, 1.0 );\n} else {\nfinalPosition = projectionMatrix * modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\nfinalPosition.xy += rotatedPosition * ( affectedByDistance == 1 ? 1.0 : finalPosition.z );\n}\ngl_Position = finalPosition;\n}",
 fragmentShader:"#ifdef GL_ES\nprecision highp float;\n#endif\nuniform\tsampler2D\tmap;\nuniform\tfloat\t\topacity;\nvarying\tvec2\t\tvUV;\nvoid main( void )\n{\nvec4 color = texture2D( map, vUV );\ncolor.a *= opacity;\ngl_FragColor = color;\n}"},shadowPost:{vertexShader:"uniform \tmat4 \tprojectionMatrix;\nattribute \tvec3 \tposition;\nvoid main(void)\n{\ngl_Position = projectionMatrix * vec4( position, 1.0 );\n}",fragmentShader:"#ifdef GL_ES\nprecision highp float;\n#endif\nuniform \tfloat \tdarkness;\nvoid main( void )\n{\ngl_FragColor = vec4( 0, 0, 0, darkness );\n}"},
-shadowVolumeDynamic:{uniforms:{directionalLightDirection:{type:"fv",value:[]}},vertexShader:"uniform \tvec3 \tdirectionalLightDirection;\nvoid main() {\nvec4 pos      = objectMatrix * vec4( position, 1.0 );\nvec3 norm     = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nvec4 extruded = vec4( directionalLightDirection * 5000.0 * step( 0.0, dot( directionalLightDirection, norm )), 0.0 );\ngl_Position   = projectionMatrix * viewMatrix * ( pos + extruded );\n}",fragmentShader:"void main() {\ngl_FragColor = vec4( 1.0 );\n}"},
+shadowVolumeDynamic:{uniforms:{directionalLightDirection:{type:"fv",value:[]}},vertexShader:"uniform \tvec3 \tdirectionalLightDirection;\nvoid main() {\nvec4 pos      = objectMatrix * vec4( position, 1.0 );\nvec3 norm     = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nvec4 extruded = vec4( directionalLightDirection * 5000.0 * step( 0.0, dot( directionalLightDirection, norm )), 0.0 );\ngl_Position   = projectionMatrix * viewMatrix * ( pos + extruded );\n}",fragmentShader:"void main() {\ngl_FragColor = vec4( 1, 1, 1, 1 );\n}"},
 depth:{uniforms:{mNear:{type:"f",value:1},mFar:{type:"f",value:2E3},opacity:{type:"f",value:1}},fragmentShader:"uniform float mNear;\nuniform float mFar;\nuniform float opacity;\nvoid main() {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat color = 1.0 - smoothstep( mNear, mFar, depth );\ngl_FragColor = vec4( vec3( color ), opacity );\n}",vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}"},normal:{uniforms:{opacity:{type:"f",value:1}},
 fragmentShader:"uniform float opacity;\nvarying vec3 vNormal;\nvoid main() {\ngl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, opacity );\n}",vertexShader:"varying vec3 vNormal;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvNormal = normalize( normalMatrix * normal );\ngl_Position = projectionMatrix * mvPosition;\n}"},basic:{uniforms:THREE.UniformsLib.common,fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,
 THREE.ShaderChunk.lightmap_pars_fragment,THREE.ShaderChunk.envmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( diffuse, opacity );",THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:[THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.color_pars_vertex,
@@ -183,118 +180,117 @@ THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.
 vertexShader:["#define PHONG\nvarying vec3 vLightWeighting;\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.lights_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,
 THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.color_vertex,"#ifndef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\n#endif\nvViewPosition = cameraPosition - mPosition.xyz;\nvec3 transformedNormal = normalize( normalMatrix * normal );\nvNormal = transformedNormal;",THREE.ShaderChunk.lights_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsLib.particle,fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",
 THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["uniform float size;\nuniform float scale;",THREE.ShaderChunk.color_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;\n}"].join("\n")}};
-THREE.WebGLRenderer=function(b){function e(f,s,n){var m,o,w,x=f.vertices,v=x.length,A=f.colors,t=A.length,y=f.__vertexArray,z=f.__colorArray,G=f.__sortArray,B=f.__dirtyVertices,O=f.__dirtyColors;if(n.sortParticles){Pa.multiplySelf(n.matrixWorld);for(m=0;m<v;m++){o=x[m].position;Ua.copy(o);Pa.multiplyVector3(Ua);G[m]=[Ua.z,m]}G.sort(function(W,P){return P[0]-W[0]});for(m=0;m<v;m++){o=x[G[m][1]].position;w=m*3;y[w]=o.x;y[w+1]=o.y;y[w+2]=o.z}for(m=0;m<t;m++){w=m*3;color=A[G[m][1]];z[w]=color.r;z[w+1]=
-color.g;z[w+2]=color.b}}else{if(B)for(m=0;m<v;m++){o=x[m].position;w=m*3;y[w]=o.x;y[w+1]=o.y;y[w+2]=o.z}if(O)for(m=0;m<t;m++){color=A[m];w=m*3;z[w]=color.r;z[w+1]=color.g;z[w+2]=color.b}}if(B||n.sortParticles){c.bindBuffer(c.ARRAY_BUFFER,f.__webglVertexBuffer);c.bufferData(c.ARRAY_BUFFER,y,s)}if(O||n.sortParticles){c.bindBuffer(c.ARRAY_BUFFER,f.__webglColorBuffer);c.bufferData(c.ARRAY_BUFFER,z,s)}}function d(f,s,n,m,o){m.program||aa.initMaterial(m,s,n,o);var w=m.program,x=w.uniforms,v=m.uniforms;
-if(w!=ra){c.useProgram(w);ra=w}c.uniformMatrix4fv(x.projectionMatrix,!1,Ta);if(n&&(m instanceof THREE.MeshBasicMaterial||m instanceof THREE.MeshLambertMaterial||m instanceof THREE.MeshPhongMaterial||m instanceof THREE.LineBasicMaterial||m instanceof THREE.ParticleBasicMaterial||m.fog)){v.fogColor.value.setHex(n.color.hex);if(n instanceof THREE.Fog){v.fogNear.value=n.near;v.fogFar.value=n.far}else if(n instanceof THREE.FogExp2)v.fogDensity.value=n.density}if(m instanceof THREE.MeshPhongMaterial||m instanceof
-THREE.MeshLambertMaterial||m.lights){var A,t,y=0,z=0,G=0,B,O,W,P,X=Sa,Ga=X.directional.colors,S=X.directional.positions,Q=X.point.colors,T=X.point.positions,ua=X.point.distances,r=0,H=0;n=t=P=0;for(A=s.length;n<A;n++){t=s[n];B=t.color;O=t.position;W=t.intensity;P=t.distance;if(t instanceof THREE.AmbientLight){y+=B.r;z+=B.g;G+=B.b}else if(t instanceof THREE.DirectionalLight){P=r*3;Ga[P]=B.r*W;Ga[P+1]=B.g*W;Ga[P+2]=B.b*W;S[P]=O.x;S[P+1]=O.y;S[P+2]=O.z;r+=1}else if(t instanceof THREE.PointLight){t=H*
-3;Q[t]=B.r*W;Q[t+1]=B.g*W;Q[t+2]=B.b*W;T[t]=O.x;T[t+1]=O.y;T[t+2]=O.z;ua[H]=P;H+=1}}for(n=r*3;n<Ga.length;n++)Ga[n]=0;for(n=H*3;n<Q.length;n++)Q[n]=0;X.point.length=H;X.directional.length=r;X.ambient[0]=y;X.ambient[1]=z;X.ambient[2]=G;n=Sa;v.enableLighting.value=n.directional.length+n.point.length;v.ambientLightColor.value=n.ambient;v.directionalLightColor.value=n.directional.colors;v.directionalLightDirection.value=n.directional.positions;v.pointLightColor.value=n.point.colors;v.pointLightPosition.value=
-n.point.positions;v.pointLightDistance.value=n.point.distances}if(m instanceof THREE.MeshBasicMaterial||m instanceof THREE.MeshLambertMaterial||m instanceof THREE.MeshPhongMaterial){v.diffuse.value.setRGB(m.color.r,m.color.g,m.color.b);v.opacity.value=m.opacity;v.map.texture=m.map;v.lightMap.texture=m.lightMap;v.envMap.texture=m.envMap;v.reflectivity.value=m.reflectivity;v.refractionRatio.value=m.refractionRatio;v.combine.value=m.combine;v.useRefract.value=m.envMap&&m.envMap.mapping instanceof THREE.CubeRefractionMapping}if(m instanceof
-THREE.LineBasicMaterial){v.diffuse.value.setRGB(m.color.r,m.color.g,m.color.b);v.opacity.value=m.opacity}else if(m instanceof THREE.ParticleBasicMaterial){v.psColor.value.setRGB(m.color.r,m.color.g,m.color.b);v.opacity.value=m.opacity;v.size.value=m.size;v.scale.value=R.height/2;v.map.texture=m.map}else if(m instanceof THREE.MeshPhongMaterial){v.ambient.value.setRGB(m.ambient.r,m.ambient.g,m.ambient.b);v.specular.value.setRGB(m.specular.r,m.specular.g,m.specular.b);v.shininess.value=m.shininess}else if(m instanceof
-THREE.MeshDepthMaterial){v.mNear.value=f.near;v.mFar.value=f.far;v.opacity.value=m.opacity}else if(m instanceof THREE.MeshNormalMaterial)v.opacity.value=m.opacity;for(var j in v)if(z=w.uniforms[j]){A=v[j];y=A.type;n=A.value;if(y=="i")c.uniform1i(z,n);else if(y=="f")c.uniform1f(z,n);else if(y=="fv1")c.uniform1fv(z,n);else if(y=="fv")c.uniform3fv(z,n);else if(y=="v2")c.uniform2f(z,n.x,n.y);else if(y=="v3")c.uniform3f(z,n.x,n.y,n.z);else if(y=="v4")c.uniform4f(z,n.x,n.y,n.z,n.w);else if(y=="c")c.uniform3f(z,
-n.r,n.g,n.b);else if(y=="t"){c.uniform1i(z,n);if(A=A.texture)if(A.image instanceof Array&&A.image.length==6){if(A.image.length==6){if(A.needsUpdate){if(A.__webglInit){c.bindTexture(c.TEXTURE_CUBE_MAP,A.image.__webglTextureCube);for(y=0;y<6;++y)c.texSubImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+y,0,0,0,c.RGBA,c.UNSIGNED_BYTE,A.image[y])}else{A.image.__webglTextureCube=c.createTexture();c.bindTexture(c.TEXTURE_CUBE_MAP,A.image.__webglTextureCube);for(y=0;y<6;++y)c.texImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+
-y,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,A.image[y]);A.__webglInit=!0}Z(c.TEXTURE_CUBE_MAP,A,A.image[0]);c.bindTexture(c.TEXTURE_CUBE_MAP,null);A.needsUpdate=!1}c.activeTexture(c.TEXTURE0+n);c.bindTexture(c.TEXTURE_CUBE_MAP,A.image.__webglTextureCube)}}else K(A,n)}}c.uniformMatrix4fv(x.modelViewMatrix,!1,o._modelViewMatrixArray);c.uniformMatrix3fv(x.normalMatrix,!1,o._normalMatrixArray);(m instanceof THREE.MeshShaderMaterial||m instanceof THREE.MeshPhongMaterial||m.envMap)&&c.uniform3f(x.cameraPosition,
-f.position.x,f.position.y,f.position.z);(m instanceof THREE.MeshShaderMaterial||m.envMap||m.skinning)&&c.uniformMatrix4fv(x.objectMatrix,!1,o._objectMatrixArray);(m instanceof THREE.MeshPhongMaterial||m instanceof THREE.MeshLambertMaterial||m instanceof THREE.MeshShaderMaterial||m.skinning)&&c.uniformMatrix4fv(x.viewMatrix,!1,Xa);if(m instanceof THREE.ShadowVolumeDynamicMaterial){f=v.directionalLightDirection.value;f[0]=-s[1].position.x;f[1]=-s[1].position.y;f[2]=-s[1].position.z;c.uniform3fv(x.directionalLightDirection,
-f);c.uniformMatrix4fv(x.objectMatrix,!1,o._objectMatrixArray);c.uniformMatrix4fv(x.viewMatrix,!1,Xa)}if(m.skinning){c.uniformMatrix4fv(x.cameraInverseMatrix,!1,Xa);c.uniformMatrix4fv(x.boneGlobalMatrices,!1,o.boneMatrices)}return w}function h(f,s,n,m,o,w){if(m.opacity!=0){var x;f=d(f,s,n,m,w).attributes;if(m.morphTargets){s=m.program.attributes;w.morphTargetBase!==-1?c.bindBuffer(c.ARRAY_BUFFER,o.__webglMorphTargetsBuffers[w.morphTargetBase]):c.bindBuffer(c.ARRAY_BUFFER,o.__webglVertexBuffer);c.vertexAttribPointer(s.position,
-3,c.FLOAT,!1,0,0);if(w.morphTargetForcedOrder.length){n=0;for(var v=w.morphTargetForcedOrder,A=w.morphTargetInfluences;n<m.numSupportedMorphTargets&&n<v.length;){c.bindBuffer(c.ARRAY_BUFFER,o.__webglMorphTargetsBuffers[v[n]]);c.vertexAttribPointer(s["morphTarget"+n],3,c.FLOAT,!1,0,0);w.__webglMorphTargetInfluences[n]=A[v[n]];n++}}else{v=[];var t=-1,y=0;A=w.morphTargetInfluences;var z,G=A.length;n=0;for(w.morphTargetBase!==-1&&(v[w.morphTargetBase]=!0);n<m.numSupportedMorphTargets;){for(z=0;z<G;z++)if(!v[z]&&
-A[z]>t){y=z;t=A[y]}c.bindBuffer(c.ARRAY_BUFFER,o.__webglMorphTargetsBuffers[y]);c.vertexAttribPointer(s["morphTarget"+n],3,c.FLOAT,!1,0,0);w.__webglMorphTargetInfluences[n]=t;v[y]=1;t=-1;n++}}c.uniform1fv(m.program.uniforms.morphTargetInfluences,w.__webglMorphTargetInfluences)}else{c.bindBuffer(c.ARRAY_BUFFER,o.__webglVertexBuffer);c.vertexAttribPointer(f.position,3,c.FLOAT,!1,0,0)}if(o.__webglCustomAttributes)for(x in o.__webglCustomAttributes)if(f[x]>=0){s=o.__webglCustomAttributes[x];c.bindBuffer(c.ARRAY_BUFFER,
-s.buffer);c.vertexAttribPointer(f[x],s.size,c.FLOAT,!1,0,0)}if(f.color>=0){c.bindBuffer(c.ARRAY_BUFFER,o.__webglColorBuffer);c.vertexAttribPointer(f.color,3,c.FLOAT,!1,0,0)}if(f.normal>=0){c.bindBuffer(c.ARRAY_BUFFER,o.__webglNormalBuffer);c.vertexAttribPointer(f.normal,3,c.FLOAT,!1,0,0)}if(f.tangent>=0){c.bindBuffer(c.ARRAY_BUFFER,o.__webglTangentBuffer);c.vertexAttribPointer(f.tangent,4,c.FLOAT,!1,0,0)}if(f.uv>=0)if(o.__webglUVBuffer){c.bindBuffer(c.ARRAY_BUFFER,o.__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(o.__webglUV2Buffer){c.bindBuffer(c.ARRAY_BUFFER,o.__webglUV2Buffer);c.vertexAttribPointer(f.uv2,2,c.FLOAT,!1,0,0);c.enableVertexAttribArray(f.uv2)}else c.disableVertexAttribArray(f.uv2);if(m.skinning&&f.skinVertexA>=0&&f.skinVertexB>=0&&f.skinIndex>=0&&f.skinWeight>=0){c.bindBuffer(c.ARRAY_BUFFER,o.__webglSkinVertexABuffer);c.vertexAttribPointer(f.skinVertexA,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,
-o.__webglSkinVertexBBuffer);c.vertexAttribPointer(f.skinVertexB,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,o.__webglSkinIndicesBuffer);c.vertexAttribPointer(f.skinIndex,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,o.__webglSkinWeightsBuffer);c.vertexAttribPointer(f.skinWeight,4,c.FLOAT,!1,0,0)}if(w instanceof THREE.Mesh)if(m.wireframe){c.lineWidth(m.wireframeLinewidth);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,o.__webglLineBuffer);c.drawElements(c.LINES,o.__webglLineCount,c.UNSIGNED_SHORT,0)}else{c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,
-o.__webglFaceBuffer);c.drawElements(c.TRIANGLES,o.__webglFaceCount,c.UNSIGNED_SHORT,0)}else if(w instanceof THREE.Line){w=w.type==THREE.LineStrip?c.LINE_STRIP:c.LINES;c.lineWidth(m.linewidth);c.drawArrays(w,0,o.__webglLineCount)}else if(w instanceof THREE.ParticleSystem)c.drawArrays(c.POINTS,0,o.__webglParticleCount);else w instanceof THREE.Ribbon&&c.drawArrays(c.TRIANGLE_STRIP,0,o.__webglVertexCount)}}function g(f,s,n){if(!f.__webglVertexBuffer)f.__webglVertexBuffer=c.createBuffer();if(!f.__webglNormalBuffer)f.__webglNormalBuffer=
-c.createBuffer();if(f.hasPos){c.bindBuffer(c.ARRAY_BUFFER,f.__webglVertexBuffer);c.bufferData(c.ARRAY_BUFFER,f.positionArray,c.DYNAMIC_DRAW);c.enableVertexAttribArray(s.attributes.position);c.vertexAttribPointer(s.attributes.position,3,c.FLOAT,!1,0,0)}if(f.hasNormal){c.bindBuffer(c.ARRAY_BUFFER,f.__webglNormalBuffer);if(n==THREE.FlatShading){var m,o,w,x,v,A,t,y,z,G,B=f.count*3;for(G=0;G<B;G+=9){n=f.normalArray;m=n[G];o=n[G+1];w=n[G+2];x=n[G+3];A=n[G+4];y=n[G+5];v=n[G+6];t=n[G+7];z=n[G+8];m=(m+x+v)/
-3;o=(o+A+t)/3;w=(w+y+z)/3;n[G]=m;n[G+1]=o;n[G+2]=w;n[G+3]=m;n[G+4]=o;n[G+5]=w;n[G+6]=m;n[G+7]=o;n[G+8]=w}}c.bufferData(c.ARRAY_BUFFER,f.normalArray,c.DYNAMIC_DRAW);c.enableVertexAttribArray(s.attributes.normal);c.vertexAttribPointer(s.attributes.normal,3,c.FLOAT,!1,0,0)}c.drawArrays(c.TRIANGLES,0,f.count);f.count=0}function k(f){if(ma!=f.doubleSided){f.doubleSided?c.disable(c.CULL_FACE):c.enable(c.CULL_FACE);ma=f.doubleSided}if(na!=f.flipSided){f.flipSided?c.frontFace(c.CW):c.frontFace(c.CCW);na=
-f.flipSided}}function i(f){if(Y!=f){f?c.enable(c.DEPTH_TEST):c.disable(c.DEPTH_TEST);Y=f}}function p(f){$[0].set(f.n41-f.n11,f.n42-f.n12,f.n43-f.n13,f.n44-f.n14);$[1].set(f.n41+f.n11,f.n42+f.n12,f.n43+f.n13,f.n44+f.n14);$[2].set(f.n41+f.n21,f.n42+f.n22,f.n43+f.n23,f.n44+f.n24);$[3].set(f.n41-f.n21,f.n42-f.n22,f.n43-f.n23,f.n44-f.n24);$[4].set(f.n41-f.n31,f.n42-f.n32,f.n43-f.n33,f.n44-f.n34);$[5].set(f.n41+f.n31,f.n42+f.n32,f.n43+f.n33,f.n44+f.n34);var s;for(f=0;f<6;f++){s=$[f];s.divideScalar(Math.sqrt(s.x*
-s.x+s.y*s.y+s.z*s.z))}}function q(f){for(var s=f.matrixWorld,n=-f.geometry.boundingSphere.radius*Math.max(f.scale.x,Math.max(f.scale.y,f.scale.z)),m=0;m<6;m++){f=$[m].x*s.n14+$[m].y*s.n24+$[m].z*s.n34+$[m].w;if(f<=n)return!1}return!0}function u(f,s){f.list[f.count]=s;f.count+=1}function D(f){var s,n,m=f.object,o=f.opaque,w=f.transparent;w.count=0;f=o.count=0;for(s=m.materials.length;f<s;f++){n=m.materials[f];n.transparent?u(w,n):u(o,n)}}function E(f){var s,n,m,o,w=f.object,x=f.buffer,v=f.opaque,A=
-f.transparent;A.count=0;f=v.count=0;for(m=w.materials.length;f<m;f++){s=w.materials[f];if(s instanceof THREE.MeshFaceMaterial){s=0;for(n=x.materials.length;s<n;s++)(o=x.materials[s])&&(o.transparent?u(A,o):u(v,o))}else(o=s)&&(o.transparent?u(A,o):u(v,o))}}function I(f,s){return s.z-f.z}function F(f){c.enable(c.POLYGON_OFFSET_FILL);c.polygonOffset(0.1,1);c.enable(c.STENCIL_TEST);c.enable(c.DEPTH_TEST);c.depthMask(!1);c.colorMask(!1,!1,!1,!1);c.stencilFunc(c.ALWAYS,1,255);c.stencilOpSeparate(c.BACK,
-c.KEEP,c.INCR,c.KEEP);c.stencilOpSeparate(c.FRONT,c.KEEP,c.DECR,c.KEEP);var s,n=f.lights.length,m,o=f.lights,w=[],x,v,A,t,y,z=f.__webglShadowVolumes.length;for(s=0;s<n;s++){m=f.lights[s];if(m instanceof THREE.DirectionalLight){w[0]=-m.position.x;w[1]=-m.position.y;w[2]=-m.position.z;for(y=0;y<z;y++){m=f.__webglShadowVolumes[y].object;x=f.__webglShadowVolumes[y].buffer;v=m.materials[0];v.program||aa.initMaterial(v,o,undefined,m);v=v.program;A=v.uniforms;t=v.attributes;if(ra!==v){c.useProgram(v);ra=
-v;c.uniformMatrix4fv(A.projectionMatrix,!1,Ta);c.uniformMatrix4fv(A.viewMatrix,!1,Xa);c.uniform3fv(A.directionalLightDirection,w)}m.matrixWorld.flattenToArray(m._objectMatrixArray);c.uniformMatrix4fv(A.objectMatrix,!1,m._objectMatrixArray);c.bindBuffer(c.ARRAY_BUFFER,x.__webglVertexBuffer);c.vertexAttribPointer(t.position,3,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,x.__webglNormalBuffer);c.vertexAttribPointer(t.normal,3,c.FLOAT,!1,0,0);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,x.__webglFaceBuffer);c.cullFace(c.FRONT);
-c.drawElements(c.TRIANGLES,x.__webglFaceCount,c.UNSIGNED_SHORT,0);c.cullFace(c.BACK);c.drawElements(c.TRIANGLES,x.__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);ga="";ra=V.program;c.useProgram(V.program);c.uniformMatrix4fv(V.projectionLocation,!1,Ta);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(ta)}function M(f,s){var n,m,o;n=_sprite.attributes;var w=_sprite.uniforms,x=za/ya,v,A=[],t=ya*0.5,y=za*0.5,z=!0;c.useProgram(_sprite.program);ra=_sprite.program;ga="";c.disable(c.CULL_FACE);c.enable(c.BLEND);
-c.depthMask(!0);c.bindBuffer(c.ARRAY_BUFFER,_sprite.vertexBuffer);c.vertexAttribPointer(n.position,2,c.FLOAT,!1,16,0);c.vertexAttribPointer(n.uv,2,c.FLOAT,!1,16,8);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,_sprite.elementBuffer);c.uniformMatrix4fv(w.projectionMatrix,!1,Ta);c.activeTexture(c.TEXTURE0);c.uniform1i(w.map,0);n=0;for(m=f.__webglSprites.length;n<m;n++){o=f.__webglSprites[n];if(o.useScreenCoordinates)o.z=-o.position.z;else{o._modelViewMatrix.multiplyToArray(s.matrixWorldInverse,o.matrixWorld,
-o._modelViewMatrixArray);o.z=-o._modelViewMatrix.n34}}f.__webglSprites.sort(I);n=0;for(m=f.__webglSprites.length;n<m;n++){o=f.__webglSprites[n];if(o.material===undefined&&o.map&&o.map.image&&o.map.image.width){if(o.useScreenCoordinates){c.uniform1i(w.useScreenCoordinates,1);c.uniform3f(w.screenPosition,(o.position.x-t)/t,(y-o.position.y)/y,Math.max(0,Math.min(1,o.position.z)))}else{c.uniform1i(w.useScreenCoordinates,0);c.uniform1i(w.affectedByDistance,o.affectedByDistance?1:0);c.uniformMatrix4fv(w.modelViewMatrix,
-!1,o._modelViewMatrixArray)}v=o.map.image.width/(o.affectedByDistance?1:za);A[0]=v*x*o.scale.x;A[1]=v*o.scale.y;c.uniform2f(w.uvScale,o.uvScale.x,o.uvScale.y);c.uniform2f(w.uvOffset,o.uvOffset.x,o.uvOffset.y);c.uniform2f(w.alignment,o.alignment.x,o.alignment.y);c.uniform1f(w.opacity,o.opacity);c.uniform1f(w.rotation,o.rotation);c.uniform2fv(w.scale,A);if(o.mergeWith3D&&!z){c.enable(c.DEPTH_TEST);z=!0}else if(!o.mergeWith3D&&z){c.disable(c.DEPTH_TEST);z=!1}oa(o.blending);K(o.map,0);c.drawElements(c.TRIANGLES,
-6,c.UNSIGNED_SHORT,0)}}c.enable(c.CULL_FACE);c.enable(c.DEPTH_TEST);c.depthMask(ta)}function N(f,s){var n,m,o=f.__webglLensFlares.length,w,x,v,A=new THREE.Vector3,t=za/ya,y=ya*0.5,z=za*0.5,G=16/za,B=[G*t,G],O=[1,1,0],W=[1,1],P=J.uniforms;n=J.attributes;c.useProgram(J.program);ra=J.program;ga="";c.uniform1i(P.occlusionMap,0);c.uniform1i(P.map,1);c.bindBuffer(c.ARRAY_BUFFER,J.vertexBuffer);c.vertexAttribPointer(n.vertex,2,c.FLOAT,!1,16,0);c.vertexAttribPointer(n.uv,2,c.FLOAT,!1,16,8);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,
-J.elementBuffer);c.disable(c.CULL_FACE);c.depthMask(!1);c.activeTexture(c.TEXTURE0);c.bindTexture(c.TEXTURE_2D,J.occlusionTexture);c.activeTexture(c.TEXTURE1);for(m=0;m<o;m++){n=f.__webglLensFlares[m].object;A.set(n.matrixWorld.n14,n.matrixWorld.n24,n.matrixWorld.n34);s.matrixWorldInverse.multiplyVector3(A);s.projectionMatrix.multiplyVector3(A);O[0]=A.x;O[1]=A.y;O[2]=A.z;W[0]=O[0]*y+y;W[1]=O[1]*z+z;if(J.hasVertexTexture||W[0]>0&&W[0]<ya&&W[1]>0&&W[1]<za){c.bindTexture(c.TEXTURE_2D,J.tempTexture);
-c.copyTexImage2D(c.TEXTURE_2D,0,c.RGB,W[0]-8,W[1]-8,16,16,0);c.uniform1i(P.renderType,0);c.uniform2fv(P.scale,B);c.uniform3fv(P.screenPosition,O);c.disable(c.BLEND);c.enable(c.DEPTH_TEST);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0);c.bindTexture(c.TEXTURE_2D,J.occlusionTexture);c.copyTexImage2D(c.TEXTURE_2D,0,c.RGBA,W[0]-8,W[1]-8,16,16,0);c.uniform1i(P.renderType,1);c.disable(c.DEPTH_TEST);c.bindTexture(c.TEXTURE_2D,J.tempTexture);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0);n.positionScreen.x=
-O[0];n.positionScreen.y=O[1];n.positionScreen.z=O[2];n.customUpdateCallback?n.customUpdateCallback(n):n.updateLensFlares();c.uniform1i(P.renderType,2);c.enable(c.BLEND);w=0;for(x=n.lensFlares.length;w<x;w++){v=n.lensFlares[w];if(v.opacity>0.001&&v.scale>0.001){O[0]=v.x;O[1]=v.y;O[2]=v.z;G=v.size*v.scale/za;B[0]=G*t;B[1]=G;c.uniform3fv(P.screenPosition,O);c.uniform2fv(P.scale,B);c.uniform1f(P.rotation,v.rotation);c.uniform1f(P.opacity,v.opacity);oa(v.blending);K(v.texture,1);c.drawElements(c.TRIANGLES,
-6,c.UNSIGNED_SHORT,0)}}}}c.enable(c.CULL_FACE);c.enable(c.DEPTH_TEST);c.depthMask(ta)}function U(f,s){f._modelViewMatrix.multiplyToArray(s.matrixWorldInverse,f.matrixWorld,f._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(f._modelViewMatrix).transposeIntoArray(f._normalMatrixArray)}function L(f){var s,n,m,o,w;if(f instanceof THREE.Mesh){n=f.geometry;for(s in n.geometryGroups){m=n.geometryGroups[s];w=!1;for(o in m.__webglCustomAttributes)if(m.__webglCustomAttributes[o].needsUpdate){w=!0;break}if(n.__dirtyVertices||
-n.__dirtyMorphTargets||n.__dirtyElements||n.__dirtyUvs||n.__dirtyNormals||n.__dirtyColors||n.__dirtyTangents||w){w=c.DYNAMIC_DRAW;var x=void 0,v=void 0,A=void 0,t=void 0;A=void 0;var y=void 0,z=void 0,G=void 0,B=void 0,O=void 0,W=void 0,P=void 0,X=void 0,Ga=void 0,S=void 0,Q=void 0,T=void 0,ua=void 0;z=void 0;G=void 0;t=void 0;B=void 0;t=void 0;var r=void 0,H=void 0;z=void 0;r=void 0;H=void 0;var j=void 0,Ka=void 0;r=void 0;H=void 0;j=void 0;Ka=void 0;r=void 0;H=void 0;j=void 0;Ka=void 0;r=void 0;
-H=void 0;j=void 0;t=void 0;B=void 0;y=void 0;A=void 0;A=void 0;r=void 0;H=void 0;j=void 0;var Va=void 0,va=0,Aa=0,ab=0,bb=0,Ja=0,La=0,ea=0,Ma=0,xa=0,C=0,Ba=0;H=r=0;var Ca=m.__vertexArray,hb=m.__uvArray,ib=m.__uv2Array,Qa=m.__normalArray,ha=m.__tangentArray,Da=m.__colorArray,ia=m.__skinVertexAArray,ja=m.__skinVertexBArray,ka=m.__skinIndexArray,la=m.__skinWeightArray,jb=m.__morphTargetsArrays,Ra=m.__webglCustomAttributes;j=void 0;var Na=m.__faceArray,Oa=m.__lineArray,qb=m.__needsSmoothNormals;W=m.__vertexColorType;
-O=m.__uvType;P=m.__normalType;var Ha=f.geometry,kb=Ha.__dirtyVertices,lb=Ha.__dirtyElements,gb=Ha.__dirtyUvs,mb=Ha.__dirtyNormals,nb=Ha.__dirtyTangents,ob=Ha.__dirtyColors,pb=Ha.__dirtyMorphTargets,cb=Ha.vertices,rb=m.faces,wb=Ha.faces,sb=Ha.faceVertexUvs[0],tb=Ha.faceVertexUvs[1],db=Ha.skinVerticesA,eb=Ha.skinVerticesB,fb=Ha.skinIndices,Wa=Ha.skinWeights,$a=f instanceof THREE.ShadowVolume?Ha.edgeFaces:undefined;morphTargets=Ha.morphTargets;if(Ra)for(Va in Ra){Ra[Va].offset=0;Ra[Va].offsetSrc=0}x=
-0;for(v=rb.length;x<v;x++){A=rb[x];t=wb[A];sb&&(X=sb[A]);tb&&(Ga=tb[A]);A=t.vertexNormals;y=t.normal;z=t.vertexColors;G=t.color;B=t.vertexTangents;if(t instanceof THREE.Face3){if(kb){S=cb[t.a].position;Q=cb[t.b].position;T=cb[t.c].position;Ca[Aa]=S.x;Ca[Aa+1]=S.y;Ca[Aa+2]=S.z;Ca[Aa+3]=Q.x;Ca[Aa+4]=Q.y;Ca[Aa+5]=Q.z;Ca[Aa+6]=T.x;Ca[Aa+7]=T.y;Ca[Aa+8]=T.z;Aa+=9}if(Ra)for(Va in Ra){j=Ra[Va];if(j.needsUpdate){r=j.offset;H=j.offsetSrc;if(j.size===1){if(j.boundTo===undefined||j.boundTo==="vertices"){j.array[r+
-0]=j.value[t.a];j.array[r+1]=j.value[t.b];j.array[r+2]=j.value[t.c]}else if(j.boundTo==="faces"){j.array[r+0]=j.value[H];j.array[r+1]=j.value[H];j.array[r+2]=j.value[H];j.offsetSrc++}else if(j.boundTo==="faceVertices"){j.array[r+0]=j.value[H+0];j.array[r+1]=j.value[H+1];j.array[r+2]=j.value[H+2];j.offsetSrc+=3}j.offset+=3}else{if(j.boundTo===undefined||j.boundTo==="vertices"){S=j.value[t.a];Q=j.value[t.b];T=j.value[t.c]}else if(j.boundTo==="faces"){S=j.value[H];Q=j.value[H];T=j.value[H];j.offsetSrc++}else if(j.boundTo===
-"faceVertices"){S=j.value[H+0];Q=j.value[H+1];T=j.value[H+2];j.offsetSrc+=3}if(j.size===2){j.array[r+0]=S.x;j.array[r+1]=S.y;j.array[r+2]=Q.x;j.array[r+3]=Q.y;j.array[r+4]=T.x;j.array[r+5]=T.y;j.offset+=6}else if(j.size===3){if(j.type==="c"){j.array[r+0]=S.r;j.array[r+1]=S.g;j.array[r+2]=S.b;j.array[r+3]=Q.r;j.array[r+4]=Q.g;j.array[r+5]=Q.b;j.array[r+6]=T.r;j.array[r+7]=T.g;j.array[r+8]=T.b}else{j.array[r+0]=S.x;j.array[r+1]=S.y;j.array[r+2]=S.z;j.array[r+3]=Q.x;j.array[r+4]=Q.y;j.array[r+5]=Q.z;
-j.array[r+6]=T.x;j.array[r+7]=T.y;j.array[r+8]=T.z}j.offset+=9}else{j.array[r+0]=S.x;j.array[r+1]=S.y;j.array[r+2]=S.z;j.array[r+3]=S.w;j.array[r+4]=Q.x;j.array[r+5]=Q.y;j.array[r+6]=Q.z;j.array[r+7]=Q.w;j.array[r+8]=T.x;j.array[r+9]=T.y;j.array[r+10]=T.z;j.array[r+11]=T.w;j.offset+=12}}}}if(pb){r=0;for(H=morphTargets.length;r<H;r++){S=morphTargets[r].vertices[t.a].position;Q=morphTargets[r].vertices[t.b].position;T=morphTargets[r].vertices[t.c].position;j=jb[r];j[Ba+0]=S.x;j[Ba+1]=S.y;j[Ba+2]=S.z;
-j[Ba+3]=Q.x;j[Ba+4]=Q.y;j[Ba+5]=Q.z;j[Ba+6]=T.x;j[Ba+7]=T.y;j[Ba+8]=T.z}Ba+=9}if(Wa.length){r=Wa[t.a];H=Wa[t.b];j=Wa[t.c];la[C]=r.x;la[C+1]=r.y;la[C+2]=r.z;la[C+3]=r.w;la[C+4]=H.x;la[C+5]=H.y;la[C+6]=H.z;la[C+7]=H.w;la[C+8]=j.x;la[C+9]=j.y;la[C+10]=j.z;la[C+11]=j.w;r=fb[t.a];H=fb[t.b];j=fb[t.c];ka[C]=r.x;ka[C+1]=r.y;ka[C+2]=r.z;ka[C+3]=r.w;ka[C+4]=H.x;ka[C+5]=H.y;ka[C+6]=H.z;ka[C+7]=H.w;ka[C+8]=j.x;ka[C+9]=j.y;ka[C+10]=j.z;ka[C+11]=j.w;r=db[t.a];H=db[t.b];j=db[t.c];ia[C]=r.x;ia[C+1]=r.y;ia[C+2]=r.z;
-ia[C+3]=1;ia[C+4]=H.x;ia[C+5]=H.y;ia[C+6]=H.z;ia[C+7]=1;ia[C+8]=j.x;ia[C+9]=j.y;ia[C+10]=j.z;ia[C+11]=1;r=eb[t.a];H=eb[t.b];j=eb[t.c];ja[C]=r.x;ja[C+1]=r.y;ja[C+2]=r.z;ja[C+3]=1;ja[C+4]=H.x;ja[C+5]=H.y;ja[C+6]=H.z;ja[C+7]=1;ja[C+8]=j.x;ja[C+9]=j.y;ja[C+10]=j.z;ja[C+11]=1;C+=12}if(ob&&W){if(z.length==3&&W==THREE.VertexColors){t=z[0];r=z[1];H=z[2]}else H=r=t=G;Da[xa]=t.r;Da[xa+1]=t.g;Da[xa+2]=t.b;Da[xa+3]=r.r;Da[xa+4]=r.g;Da[xa+5]=r.b;Da[xa+6]=H.r;Da[xa+7]=H.g;Da[xa+8]=H.b;xa+=9}if(nb&&Ha.hasTangents){z=
-B[0];G=B[1];t=B[2];ha[ea]=z.x;ha[ea+1]=z.y;ha[ea+2]=z.z;ha[ea+3]=z.w;ha[ea+4]=G.x;ha[ea+5]=G.y;ha[ea+6]=G.z;ha[ea+7]=G.w;ha[ea+8]=t.x;ha[ea+9]=t.y;ha[ea+10]=t.z;ha[ea+11]=t.w;ea+=12}if(mb&&P)if(A.length==3&&qb)for(B=0;B<3;B++){y=A[B];Qa[La]=y.x;Qa[La+1]=y.y;Qa[La+2]=y.z;La+=3}else for(B=0;B<3;B++){Qa[La]=y.x;Qa[La+1]=y.y;Qa[La+2]=y.z;La+=3}if(gb&&X!==undefined&&O)for(B=0;B<3;B++){A=X[B];hb[ab]=A.u;hb[ab+1]=A.v;ab+=2}if(gb&&Ga!==undefined&&O)for(B=0;B<3;B++){A=Ga[B];ib[bb]=A.u;ib[bb+1]=A.v;bb+=2}if(lb){Na[Ja]=
-va;Na[Ja+1]=va+1;Na[Ja+2]=va+2;Ja+=3;Oa[Ma]=va;Oa[Ma+1]=va+1;Oa[Ma+2]=va;Oa[Ma+3]=va+2;Oa[Ma+4]=va+1;Oa[Ma+5]=va+2;Ma+=6;va+=3}}else if(t instanceof THREE.Face4){if(kb){S=cb[t.a].position;Q=cb[t.b].position;T=cb[t.c].position;ua=cb[t.d].position;Ca[Aa]=S.x;Ca[Aa+1]=S.y;Ca[Aa+2]=S.z;Ca[Aa+3]=Q.x;Ca[Aa+4]=Q.y;Ca[Aa+5]=Q.z;Ca[Aa+6]=T.x;Ca[Aa+7]=T.y;Ca[Aa+8]=T.z;Ca[Aa+9]=ua.x;Ca[Aa+10]=ua.y;Ca[Aa+11]=ua.z;Aa+=12}if(Ra)for(Va in Ra){j=Ra[Va];if(j.needsUpdate){r=j.offset;H=j.offsetSrc;if(j.size===1){if(j.boundTo===
-undefined||j.boundTo==="vertices"){j.array[r+0]=j.value[t.a];j.array[r+1]=j.value[t.b];j.array[r+2]=j.value[t.c];j.array[r+2]=j.value[t.d]}else if(j.boundTo==="faces"){j.array[r+0]=j.value[H];j.array[r+1]=j.value[H];j.array[r+2]=j.value[H];j.array[r+2]=j.value[H];j.offsetSrc++}else if(j.boundTo==="faceVertices"){j.array[r+0]=j.value[H+0];j.array[r+1]=j.value[H+1];j.array[r+2]=j.value[H+2];j.array[r+2]=j.value[H+3];j.offsetSrc+=4}j.offset+=4}else{if(j.boundTo===undefined||j.boundTo==="vertices"){S=
-j.value[t.a];Q=j.value[t.b];T=j.value[t.c];ua=j.value[t.d]}else if(j.boundTo==="faces"){S=j.value[H];Q=j.value[H];T=j.value[H];ua=j.value[H];j.offsetSrc++}else if(j.boundTo==="faceVertices"){S=j.value[H+0];Q=j.value[H+1];T=j.value[H+2];ua=j.value[H+3];j.offsetSrc+=4}if(j.size===2){j.array[r+0]=S.x;j.array[r+1]=S.y;j.array[r+2]=Q.x;j.array[r+3]=Q.y;j.array[r+4]=T.x;j.array[r+5]=T.y;j.array[r+6]=ua.x;j.array[r+7]=ua.y;j.offset+=8}else if(j.size===3){if(j.type==="c"){j.array[r+0]=S.r;j.array[r+1]=S.g;
-j.array[r+2]=S.b;j.array[r+3]=Q.r;j.array[r+4]=Q.g;j.array[r+5]=Q.b;j.array[r+6]=T.r;j.array[r+7]=T.g;j.array[r+8]=T.b;j.array[r+9]=ua.r;j.array[r+10]=ua.g;j.array[r+11]=ua.b}else{j.array[r+0]=S.x;j.array[r+1]=S.y;j.array[r+2]=S.z;j.array[r+3]=Q.x;j.array[r+4]=Q.y;j.array[r+5]=Q.z;j.array[r+6]=T.x;j.array[r+7]=T.y;j.array[r+8]=T.z;j.array[r+9]=ua.x;j.array[r+10]=ua.y;j.array[r+11]=ua.z}j.offset+=12}else{j.array[r+0]=S.x;j.array[r+1]=S.y;j.array[r+2]=S.z;j.array[r+3]=S.w;j.array[r+4]=Q.x;j.array[r+
-5]=Q.y;j.array[r+6]=Q.z;j.array[r+7]=Q.w;j.array[r+8]=T.x;j.array[r+9]=T.y;j.array[r+10]=T.z;j.array[r+11]=T.w;j.array[r+12]=ua.x;j.array[r+13]=ua.y;j.array[r+14]=ua.z;j.array[r+15]=ua.w;j.offset+=16}}}}if(pb){r=0;for(H=morphTargets.length;r<H;r++){S=morphTargets[r].vertices[t.a].position;Q=morphTargets[r].vertices[t.b].position;T=morphTargets[r].vertices[t.c].position;ua=morphTargets[r].vertices[t.d].position;j=jb[r];j[Ba+0]=S.x;j[Ba+1]=S.y;j[Ba+2]=S.z;j[Ba+3]=Q.x;j[Ba+4]=Q.y;j[Ba+5]=Q.z;j[Ba+6]=
-T.x;j[Ba+7]=T.y;j[Ba+8]=T.z;j[Ba+9]=ua.x;j[Ba+10]=ua.y;j[Ba+11]=ua.z}Ba+=12}if(Wa.length){r=Wa[t.a];H=Wa[t.b];j=Wa[t.c];Ka=Wa[t.d];la[C]=r.x;la[C+1]=r.y;la[C+2]=r.z;la[C+3]=r.w;la[C+4]=H.x;la[C+5]=H.y;la[C+6]=H.z;la[C+7]=H.w;la[C+8]=j.x;la[C+9]=j.y;la[C+10]=j.z;la[C+11]=j.w;la[C+12]=Ka.x;la[C+13]=Ka.y;la[C+14]=Ka.z;la[C+15]=Ka.w;r=fb[t.a];H=fb[t.b];j=fb[t.c];Ka=fb[t.d];ka[C]=r.x;ka[C+1]=r.y;ka[C+2]=r.z;ka[C+3]=r.w;ka[C+4]=H.x;ka[C+5]=H.y;ka[C+6]=H.z;ka[C+7]=H.w;ka[C+8]=j.x;ka[C+9]=j.y;ka[C+10]=j.z;
-ka[C+11]=j.w;ka[C+12]=Ka.x;ka[C+13]=Ka.y;ka[C+14]=Ka.z;ka[C+15]=Ka.w;r=db[t.a];H=db[t.b];j=db[t.c];Ka=db[t.d];ia[C]=r.x;ia[C+1]=r.y;ia[C+2]=r.z;ia[C+3]=1;ia[C+4]=H.x;ia[C+5]=H.y;ia[C+6]=H.z;ia[C+7]=1;ia[C+8]=j.x;ia[C+9]=j.y;ia[C+10]=j.z;ia[C+11]=1;ia[C+12]=Ka.x;ia[C+13]=Ka.y;ia[C+14]=Ka.z;ia[C+15]=1;r=eb[t.a];H=eb[t.b];j=eb[t.c];t=eb[t.d];ja[C]=r.x;ja[C+1]=r.y;ja[C+2]=r.z;ja[C+3]=1;ja[C+4]=H.x;ja[C+5]=H.y;ja[C+6]=H.z;ja[C+7]=1;ja[C+8]=j.x;ja[C+9]=j.y;ja[C+10]=j.z;ja[C+11]=1;ja[C+12]=t.x;ja[C+13]=
-t.y;ja[C+14]=t.z;ja[C+15]=1;C+=16}if(ob&&W){if(z.length==4&&W==THREE.VertexColors){t=z[0];r=z[1];H=z[2];z=z[3]}else z=H=r=t=G;Da[xa]=t.r;Da[xa+1]=t.g;Da[xa+2]=t.b;Da[xa+3]=r.r;Da[xa+4]=r.g;Da[xa+5]=r.b;Da[xa+6]=H.r;Da[xa+7]=H.g;Da[xa+8]=H.b;Da[xa+9]=z.r;Da[xa+10]=z.g;Da[xa+11]=z.b;xa+=12}if(nb&&Ha.hasTangents){z=B[0];G=B[1];t=B[2];B=B[3];ha[ea]=z.x;ha[ea+1]=z.y;ha[ea+2]=z.z;ha[ea+3]=z.w;ha[ea+4]=G.x;ha[ea+5]=G.y;ha[ea+6]=G.z;ha[ea+7]=G.w;ha[ea+8]=t.x;ha[ea+9]=t.y;ha[ea+10]=t.z;ha[ea+11]=t.w;ha[ea+
-12]=B.x;ha[ea+13]=B.y;ha[ea+14]=B.z;ha[ea+15]=B.w;ea+=16}if(mb&&P)if(A.length==4&&qb)for(B=0;B<4;B++){y=A[B];Qa[La]=y.x;Qa[La+1]=y.y;Qa[La+2]=y.z;La+=3}else for(B=0;B<4;B++){Qa[La]=y.x;Qa[La+1]=y.y;Qa[La+2]=y.z;La+=3}if(gb&&X!==undefined&&O)for(B=0;B<4;B++){A=X[B];hb[ab]=A.u;hb[ab+1]=A.v;ab+=2}if(gb&&Ga!==undefined&&O)for(B=0;B<4;B++){A=Ga[B];ib[bb]=A.u;ib[bb+1]=A.v;bb+=2}if(lb){Na[Ja]=va;Na[Ja+1]=va+1;Na[Ja+2]=va+3;Na[Ja+3]=va+1;Na[Ja+4]=va+2;Na[Ja+5]=va+3;Ja+=6;Oa[Ma]=va;Oa[Ma+1]=va+1;Oa[Ma+2]=
-va;Oa[Ma+3]=va+3;Oa[Ma+4]=va+1;Oa[Ma+5]=va+2;Oa[Ma+6]=va+2;Oa[Ma+7]=va+3;Ma+=8;va+=4}}}if($a){x=0;for(v=$a.length;x<v;x++){Na[Ja]=$a[x].a;Na[Ja+1]=$a[x].b;Na[Ja+2]=$a[x].c;Na[Ja+3]=$a[x].a;Na[Ja+4]=$a[x].c;Na[Ja+5]=$a[x].d;Ja+=6}}if(kb){c.bindBuffer(c.ARRAY_BUFFER,m.__webglVertexBuffer);c.bufferData(c.ARRAY_BUFFER,Ca,w)}if(Ra)for(Va in Ra){j=Ra[Va];if(j.needsUpdate){c.bindBuffer(c.ARRAY_BUFFER,j.buffer);c.bufferData(c.ARRAY_BUFFER,j.array,w);j.needsUpdate=!1}}if(pb){r=0;for(H=morphTargets.length;r<
-H;r++){c.bindBuffer(c.ARRAY_BUFFER,m.__webglMorphTargetsBuffers[r]);c.bufferData(c.ARRAY_BUFFER,jb[r],w)}}if(ob&&xa>0){c.bindBuffer(c.ARRAY_BUFFER,m.__webglColorBuffer);c.bufferData(c.ARRAY_BUFFER,Da,w)}if(mb){c.bindBuffer(c.ARRAY_BUFFER,m.__webglNormalBuffer);c.bufferData(c.ARRAY_BUFFER,Qa,w)}if(nb&&Ha.hasTangents){c.bindBuffer(c.ARRAY_BUFFER,m.__webglTangentBuffer);c.bufferData(c.ARRAY_BUFFER,ha,w)}if(gb&&ab>0){c.bindBuffer(c.ARRAY_BUFFER,m.__webglUVBuffer);c.bufferData(c.ARRAY_BUFFER,hb,w)}if(gb&&
-bb>0){c.bindBuffer(c.ARRAY_BUFFER,m.__webglUV2Buffer);c.bufferData(c.ARRAY_BUFFER,ib,w)}if(lb){c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,m.__webglFaceBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,Na,w);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,m.__webglLineBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,Oa,w)}if(C>0){c.bindBuffer(c.ARRAY_BUFFER,m.__webglSkinVertexABuffer);c.bufferData(c.ARRAY_BUFFER,ia,w);c.bindBuffer(c.ARRAY_BUFFER,m.__webglSkinVertexBBuffer);c.bufferData(c.ARRAY_BUFFER,ja,w);c.bindBuffer(c.ARRAY_BUFFER,
-m.__webglSkinIndicesBuffer);c.bufferData(c.ARRAY_BUFFER,ka,w);c.bindBuffer(c.ARRAY_BUFFER,m.__webglSkinWeightsBuffer);c.bufferData(c.ARRAY_BUFFER,la,w)}}}n.__dirtyVertices=!1;n.__dirtyMorphTargets=!1;n.__dirtyElements=!1;n.__dirtyUvs=!1;n.__dirtyNormals=!1;n.__dirtyTangents=!1;n.__dirtyColors=!1}else if(f instanceof THREE.Ribbon){n=f.geometry;if(n.__dirtyVertices||n.__dirtyColors){f=n;s=c.DYNAMIC_DRAW;W=f.vertices;m=f.colors;P=W.length;w=m.length;X=f.__vertexArray;x=f.__colorArray;Ga=f.__dirtyColors;
-if(f.__dirtyVertices){for(v=0;v<P;v++){O=W[v].position;o=v*3;X[o]=O.x;X[o+1]=O.y;X[o+2]=O.z}c.bindBuffer(c.ARRAY_BUFFER,f.__webglVertexBuffer);c.bufferData(c.ARRAY_BUFFER,X,s)}if(Ga){for(v=0;v<w;v++){color=m[v];o=v*3;x[o]=color.r;x[o+1]=color.g;x[o+2]=color.b}c.bindBuffer(c.ARRAY_BUFFER,f.__webglColorBuffer);c.bufferData(c.ARRAY_BUFFER,x,s)}}n.__dirtyVertices=!1;n.__dirtyColors=!1}else if(f instanceof THREE.Line){n=f.geometry;if(n.__dirtyVertices||n.__dirtyColors){f=n;s=c.DYNAMIC_DRAW;W=f.vertices;
-m=f.colors;P=W.length;w=m.length;X=f.__vertexArray;x=f.__colorArray;Ga=f.__dirtyColors;if(f.__dirtyVertices){for(v=0;v<P;v++){O=W[v].position;o=v*3;X[o]=O.x;X[o+1]=O.y;X[o+2]=O.z}c.bindBuffer(c.ARRAY_BUFFER,f.__webglVertexBuffer);c.bufferData(c.ARRAY_BUFFER,X,s)}if(Ga){for(v=0;v<w;v++){color=m[v];o=v*3;x[o]=color.r;x[o+1]=color.g;x[o+2]=color.b}c.bindBuffer(c.ARRAY_BUFFER,f.__webglColorBuffer);c.bufferData(c.ARRAY_BUFFER,x,s)}}n.__dirtyVertices=!1;n.__dirtyColors=!1}else if(f instanceof THREE.ParticleSystem){n=
-f.geometry;(n.__dirtyVertices||n.__dirtyColors||f.sortParticles)&&e(n,c.DYNAMIC_DRAW,f);n.__dirtyVertices=!1;n.__dirtyColors=!1}}function sa(f){function s(G){var B=[];n=0;for(m=G.length;n<m;n++)G[n]==undefined?B.push("undefined"):B.push(G[n].id);return B.join("_")}var n,m,o,w,x,v,A,t,y={},z=f.morphTargets!==undefined?f.morphTargets.length:0;f.geometryGroups={};o=0;for(w=f.faces.length;o<w;o++){x=f.faces[o];v=x.materials;A=s(v);y[A]==undefined&&(y[A]={hash:A,counter:0});t=y[A].hash+"_"+y[A].counter;
-f.geometryGroups[t]==undefined&&(f.geometryGroups[t]={faces:[],materials:v,vertices:0,numMorphTargets:z});x=x instanceof THREE.Face3?3:4;if(f.geometryGroups[t].vertices+x>65535){y[A].counter+=1;t=y[A].hash+"_"+y[A].counter;f.geometryGroups[t]==undefined&&(f.geometryGroups[t]={faces:[],materials:v,vertices:0,numMorphTargets:z})}f.geometryGroups[t].faces.push(o);f.geometryGroups[t].vertices+=x}}function da(f,s,n){f.push({buffer:s,object:n,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function oa(f){if(f!=
-ga){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)}ga=f}}function Z(f,s,n){if((n.width&n.width-1)==0&&(n.height&
-n.height-1)==0){c.texParameteri(f,c.TEXTURE_WRAP_S,fa(s.wrapS));c.texParameteri(f,c.TEXTURE_WRAP_T,fa(s.wrapT));c.texParameteri(f,c.TEXTURE_MAG_FILTER,fa(s.magFilter));c.texParameteri(f,c.TEXTURE_MIN_FILTER,fa(s.minFilter));c.generateMipmap(f)}else{c.texParameteri(f,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(f,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);c.texParameteri(f,c.TEXTURE_MAG_FILTER,Ea(s.magFilter));c.texParameteri(f,c.TEXTURE_MIN_FILTER,Ea(s.minFilter))}}function K(f,s){if(f.needsUpdate){if(f.__webglInit){c.bindTexture(c.TEXTURE_2D,
-f.__webglTexture);c.texSubImage2D(c.TEXTURE_2D,0,0,0,c.RGBA,c.UNSIGNED_BYTE,f.image)}else{f.__webglTexture=c.createTexture();c.bindTexture(c.TEXTURE_2D,f.__webglTexture);c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,f.image);f.__webglInit=!0}Z(c.TEXTURE_2D,f,f.image);c.bindTexture(c.TEXTURE_2D,null);f.needsUpdate=!1}c.activeTexture(c.TEXTURE0+s);c.bindTexture(c.TEXTURE_2D,f.__webglTexture)}function Ia(f){if(f&&!f.__webglFramebuffer){if(f.depthBuffer===undefined)f.depthBuffer=!0;if(f.stencilBuffer===
-undefined)f.stencilBuffer=!0;f.__webglFramebuffer=c.createFramebuffer();f.__webglRenderbuffer=c.createRenderbuffer();f.__webglTexture=c.createTexture();c.bindTexture(c.TEXTURE_2D,f.__webglTexture);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,fa(f.wrapS));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,fa(f.wrapT));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,fa(f.magFilter));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,fa(f.minFilter));c.texImage2D(c.TEXTURE_2D,0,fa(f.format),f.width,f.height,
-0,fa(f.format),fa(f.type),null);c.bindRenderbuffer(c.RENDERBUFFER,f.__webglRenderbuffer);c.bindFramebuffer(c.FRAMEBUFFER,f.__webglFramebuffer);c.framebufferTexture2D(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,c.TEXTURE_2D,f.__webglTexture,0);if(f.depthBuffer&&!f.stencilBuffer){c.renderbufferStorage(c.RENDERBUFFER,c.DEPTH_COMPONENT16,f.width,f.height);c.framebufferRenderbuffer(c.FRAMEBUFFER,c.DEPTH_ATTACHMENT,c.RENDERBUFFER,f.__webglRenderbuffer)}else if(f.depthBuffer&&f.stencilBuffer){c.renderbufferStorage(c.RENDERBUFFER,
-c.DEPTH_STENCIL,f.width,f.height);c.framebufferRenderbuffer(c.FRAMEBUFFER,c.DEPTH_STENCIL_ATTACHMENT,c.RENDERBUFFER,f.__webglRenderbuffer)}else c.renderbufferStorage(c.RENDERBUFFER,c.RGBA4,f.width,f.height);c.bindTexture(c.TEXTURE_2D,null);c.bindRenderbuffer(c.RENDERBUFFER,null);c.bindFramebuffer(c.FRAMEBUFFER,null)}var s,n;if(f){s=f.__webglFramebuffer;n=f.width;f=f.height}else{s=null;n=ya;f=za}if(s!=Fa){c.bindFramebuffer(c.FRAMEBUFFER,s);c.viewport(wa,qa,n,f);Fa=s}}function ca(f,s){var n;if(f=="fragment")n=
-c.createShader(c.FRAGMENT_SHADER);else f=="vertex"&&(n=c.createShader(c.VERTEX_SHADER));c.shaderSource(n,s);c.compileShader(n);if(!c.getShaderParameter(n,c.COMPILE_STATUS)){console.error(c.getShaderInfoLog(n));console.error(s);return null}return n}function Ea(f){switch(f){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return c.NEAREST;default:return c.LINEAR}}function fa(f){switch(f){case THREE.RepeatWrapping:return c.REPEAT;case THREE.ClampToEdgeWrapping:return c.CLAMP_TO_EDGE;
-case THREE.MirroredRepeatWrapping:return c.MIRRORED_REPEAT;case THREE.NearestFilter:return c.NEAREST;case THREE.NearestMipMapNearestFilter:return c.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return c.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return c.LINEAR;case THREE.LinearMipMapNearestFilter:return c.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return c.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return c.BYTE;case THREE.UnsignedByteType:return c.UNSIGNED_BYTE;case THREE.ShortType:return c.SHORT;
-case THREE.UnsignedShortType:return c.UNSIGNED_SHORT;case THREE.IntType:return c.INT;case THREE.UnsignedShortType:return c.UNSIGNED_INT;case THREE.FloatType:return c.FLOAT;case THREE.AlphaFormat:return c.ALPHA;case THREE.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,R=document.createElement("canvas"),pa=[],ra=null,Fa=null,ta=!0,aa=this,ma=null,na=null,ga=null,Y=null,wa=
-0,qa=0,ya=0,za=0,$=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Pa=new THREE.Matrix4,Ta=new Float32Array(16),Xa=new Float32Array(16),Ua=new THREE.Vector4,Sa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},Ya=!0,Za=!0,ub=new THREE.Color(0),vb=0;if(b){if(b.stencil!=undefined)Ya=b.stencil;if(b.antialias!==undefined)Za=b.antialias;b.clearColor!==undefined&&ub.setHex(b.clearColor);
-if(b.clearAlpha!==undefined)vb=b.clearAlpha}this.maxMorphTargets=8;this.domElement=R;this.autoClear=!0;this.sortObjects=!0;(function(f,s,n,m){try{if(!(c=R.getContext("experimental-webgl",{antialias:f,stencil:m})))throw"Error creating WebGL context.";}catch(o){console.error(o)}console.log(navigator.userAgent+" | "+c.getParameter(c.VERSION)+" | "+c.getParameter(c.VENDOR)+" | "+c.getParameter(c.RENDERER)+" | "+c.getParameter(c.SHADING_LANGUAGE_VERSION));c.clearColor(0,0,0,1);c.clearDepth(1);c.enable(c.DEPTH_TEST);
-c.depthFunc(c.LEQUAL);c.frontFace(c.CCW);c.cullFace(c.BACK);c.enable(c.CULL_FACE);c.enable(c.BLEND);c.blendEquation(c.FUNC_ADD);c.blendFunc(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA);c.clearColor(s.r,s.g,s.b,n)})(Za,ub,vb,Ya);this.context=c;if(Ya){var V={};V.vertices=new Float32Array(12);V.faces=new Uint16Array(6);V.darkness=0.5;V.vertices[0]=-20;V.vertices[1]=-20;V.vertices[2]=-1;V.vertices[3]=20;V.vertices[4]=-20;V.vertices[5]=-1;V.vertices[6]=20;V.vertices[7]=20;V.vertices[8]=-1;V.vertices[9]=-20;V.vertices[10]=
-20;V.vertices[11]=-1;V.faces[0]=0;V.faces[1]=1;V.faces[2]=2;V.faces[3]=0;V.faces[4]=2;V.faces[5]=3;V.vertexBuffer=c.createBuffer();V.elementBuffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,V.vertexBuffer);c.bufferData(c.ARRAY_BUFFER,V.vertices,c.STATIC_DRAW);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,V.elementBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,V.faces,c.STATIC_DRAW);V.program=c.createProgram();c.attachShader(V.program,ca("fragment",THREE.ShaderLib.shadowPost.fragmentShader));c.attachShader(V.program,
-ca("vertex",THREE.ShaderLib.shadowPost.vertexShader));c.linkProgram(V.program);V.vertexLocation=c.getAttribLocation(V.program,"position");V.projectionLocation=c.getUniformLocation(V.program,"projectionMatrix");V.darknessLocation=c.getUniformLocation(V.program,"darkness")}var J={};J.vertices=new Float32Array(16);J.faces=new Uint16Array(6);b=0;J.vertices[b++]=-1;J.vertices[b++]=-1;J.vertices[b++]=0;J.vertices[b++]=0;J.vertices[b++]=1;J.vertices[b++]=-1;J.vertices[b++]=1;J.vertices[b++]=0;J.vertices[b++]=
-1;J.vertices[b++]=1;J.vertices[b++]=1;J.vertices[b++]=1;J.vertices[b++]=-1;J.vertices[b++]=1;J.vertices[b++]=0;J.vertices[b++]=1;b=0;J.faces[b++]=0;J.faces[b++]=1;J.faces[b++]=2;J.faces[b++]=0;J.faces[b++]=2;J.faces[b++]=3;J.vertexBuffer=c.createBuffer();J.elementBuffer=c.createBuffer();J.tempTexture=c.createTexture();J.occlusionTexture=c.createTexture();c.bindBuffer(c.ARRAY_BUFFER,J.vertexBuffer);c.bufferData(c.ARRAY_BUFFER,J.vertices,c.STATIC_DRAW);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,J.elementBuffer);
-c.bufferData(c.ELEMENT_ARRAY_BUFFER,J.faces,c.STATIC_DRAW);c.bindTexture(c.TEXTURE_2D,J.tempTexture);c.texImage2D(c.TEXTURE_2D,0,c.RGB,16,16,0,c.RGB,c.UNSIGNED_BYTE,null);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,c.NEAREST);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,c.NEAREST);c.bindTexture(c.TEXTURE_2D,J.occlusionTexture);c.texImage2D(c.TEXTURE_2D,0,c.RGBA,
-16,16,0,c.RGBA,c.UNSIGNED_BYTE,null);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,c.NEAREST);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,c.NEAREST);if(c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0){J.hasVertexTexture=!1;J.program=c.createProgram();c.attachShader(J.program,ca("fragment",THREE.ShaderLib.lensFlare.fragmentShader));c.attachShader(J.program,ca("vertex",
-THREE.ShaderLib.lensFlare.vertexShader))}else{J.hasVertexTexture=!0;J.program=c.createProgram();c.attachShader(J.program,ca("fragment",THREE.ShaderLib.lensFlareVertexTexture.fragmentShader));c.attachShader(J.program,ca("vertex",THREE.ShaderLib.lensFlareVertexTexture.vertexShader))}c.linkProgram(J.program);J.attributes={};J.uniforms={};J.attributes.vertex=c.getAttribLocation(J.program,"position");J.attributes.uv=c.getAttribLocation(J.program,"UV");J.uniforms.renderType=c.getUniformLocation(J.program,
-"renderType");J.uniforms.map=c.getUniformLocation(J.program,"map");J.uniforms.occlusionMap=c.getUniformLocation(J.program,"occlusionMap");J.uniforms.opacity=c.getUniformLocation(J.program,"opacity");J.uniforms.scale=c.getUniformLocation(J.program,"scale");J.uniforms.rotation=c.getUniformLocation(J.program,"rotation");J.uniforms.screenPosition=c.getUniformLocation(J.program,"screenPosition");c.enableVertexAttribArray(J.attributes.vertex);c.enableVertexAttribArray(J.attributes.uv);_sprite={};_sprite.vertices=
-new Float32Array(16);_sprite.faces=new Uint16Array(6);b=0;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=0;_sprite.vertices[b++]=0;_sprite.vertices[b++]=1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=0;_sprite.vertices[b++]=1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=0;_sprite.vertices[b++]=1;b=0;_sprite.faces[b++]=0;_sprite.faces[b++]=1;_sprite.faces[b++]=
-2;_sprite.faces[b++]=0;_sprite.faces[b++]=2;_sprite.faces[b++]=3;_sprite.vertexBuffer=c.createBuffer();_sprite.elementBuffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,_sprite.vertexBuffer);c.bufferData(c.ARRAY_BUFFER,_sprite.vertices,c.STATIC_DRAW);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,_sprite.elementBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,_sprite.faces,c.STATIC_DRAW);_sprite.program=c.createProgram();c.attachShader(_sprite.program,ca("fragment",THREE.ShaderLib.sprite.fragmentShader));c.attachShader(_sprite.program,
-ca("vertex",THREE.ShaderLib.sprite.vertexShader));c.linkProgram(_sprite.program);_sprite.attributes={};_sprite.uniforms={};_sprite.attributes.position=c.getAttribLocation(_sprite.program,"position");_sprite.attributes.uv=c.getAttribLocation(_sprite.program,"uv");_sprite.uniforms.uvOffset=c.getUniformLocation(_sprite.program,"uvOffset");_sprite.uniforms.uvScale=c.getUniformLocation(_sprite.program,"uvScale");_sprite.uniforms.rotation=c.getUniformLocation(_sprite.program,"rotation");_sprite.uniforms.scale=
-c.getUniformLocation(_sprite.program,"scale");_sprite.uniforms.alignment=c.getUniformLocation(_sprite.program,"alignment");_sprite.uniforms.map=c.getUniformLocation(_sprite.program,"map");_sprite.uniforms.opacity=c.getUniformLocation(_sprite.program,"opacity");_sprite.uniforms.useScreenCoordinates=c.getUniformLocation(_sprite.program,"useScreenCoordinates");_sprite.uniforms.affectedByDistance=c.getUniformLocation(_sprite.program,"affectedByDistance");_sprite.uniforms.screenPosition=c.getUniformLocation(_sprite.program,
-"screenPosition");_sprite.uniforms.modelViewMatrix=c.getUniformLocation(_sprite.program,"modelViewMatrix");_sprite.uniforms.projectionMatrix=c.getUniformLocation(_sprite.program,"projectionMatrix");c.enableVertexAttribArray(_sprite.attributes.position);c.enableVertexAttribArray(_sprite.attributes.uv);this.setSize=function(f,s){R.width=f;R.height=s;this.setViewport(0,0,R.width,R.height)};this.setViewport=function(f,s,n,m){wa=f;qa=s;ya=n;za=m;c.viewport(wa,qa,ya,za)};this.setScissor=function(f,s,n,
-m){c.scissor(f,s,n,m)};this.enableScissorTest=function(f){f?c.enable(c.SCISSOR_TEST):c.disable(c.SCISSOR_TEST)};this.enableDepthBufferWrite=function(f){ta=f;c.depthMask(f)};this.setClearColorHex=function(f,s){var n=new THREE.Color(f);c.clearColor(n.r,n.g,n.b,s)};this.setClearColor=function(f,s){c.clearColor(f.r,f.g,f.b,s)};this.clear=function(){c.clear(c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT|c.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(f){V.darkness=f};this.initMaterial=function(f,
-s,n,m){var o,w,x;if(f instanceof THREE.MeshDepthMaterial)x="depth";else if(f instanceof THREE.ShadowVolumeDynamicMaterial)x="shadowVolumeDynamic";else if(f instanceof THREE.MeshNormalMaterial)x="normal";else if(f instanceof THREE.MeshBasicMaterial)x="basic";else if(f instanceof THREE.MeshLambertMaterial)x="lambert";else if(f instanceof THREE.MeshPhongMaterial)x="phong";else if(f instanceof THREE.LineBasicMaterial)x="basic";else f instanceof THREE.ParticleBasicMaterial&&(x="particle_basic");if(x){var v=
-THREE.ShaderLib[x];f.uniforms=Uniforms.clone(v.uniforms);f.vertexShader=v.vertexShader;f.fragmentShader=v.fragmentShader}var A,t,y;A=y=v=0;for(t=s.length;A<t;A++){w=s[A];w instanceof THREE.DirectionalLight&&y++;w instanceof THREE.PointLight&&v++}if(v+y<=4)s=y;else{s=Math.ceil(4*y/(v+y));v=4-s}w={directional:s,point:v};y=50;if(m!==undefined&&m instanceof THREE.SkinnedMesh)y=m.bones.length;var z;a:{A=f.fragmentShader;t=f.vertexShader;v=f.uniforms;s=f.attributes;n={map:!!f.map,envMap:!!f.envMap,lightMap:!!f.lightMap,
-vertexColors:f.vertexColors,fog:n,sizeAttenuation:f.sizeAttenuation,skinning:f.skinning,morphTargets:f.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:w.directional,maxPointLights:w.point,maxBones:y};var G;w=[];if(x)w.push(x);else{w.push(A);w.push(t)}for(G in n){w.push(G);w.push(n[G])}x=w.join();G=0;for(w=pa.length;G<w;G++)if(pa[G].code==x){z=pa[G].program;break a}G=c.createProgram();prefix_fragment=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+n.maxDirLights,
-"#define MAX_POINT_LIGHTS "+n.maxPointLights,n.fog?"#define USE_FOG":"",n.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.lightMap?"#define USE_LIGHTMAP":"",n.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");prefix_vertex=[c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+n.maxDirLights,"#define MAX_POINT_LIGHTS "+n.maxPointLights,
-"#define MAX_BONES "+n.maxBones,n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.lightMap?"#define USE_LIGHTMAP":"",n.vertexColors?"#define USE_COLOR":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
-c.attachShader(G,ca("fragment",prefix_fragment+A));c.attachShader(G,ca("vertex",prefix_vertex+t));c.linkProgram(G);c.getProgramParameter(G,c.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+c.getProgramParameter(G,c.VALIDATE_STATUS)+", gl error ["+c.getError()+"]");G.uniforms={};G.attributes={};var B;A=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(B in v)A.push(B);
-B=A;v=0;for(A=B.length;v<A;v++){t=B[v];G.uniforms[t]=c.getUniformLocation(G,t)}A=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(B=0;B<n.maxMorphTargets;B++)A.push("morphTarget"+B);for(z in s)A.push(z);z=A;B=0;for(s=z.length;B<s;B++){n=z[B];G.attributes[n]=c.getAttribLocation(G,n)}pa.push({program:G,code:x});z=G}f.program=z;z=f.program.attributes;c.enableVertexAttribArray(z.position);z.color>=0&&c.enableVertexAttribArray(z.color);z.normal>=
+THREE.WebGLRenderer=function(b){function d(f,s,m){var n,o,w,x=f.vertices,u=x.length,A=f.colors,t=A.length,y=f.__vertexArray,z=f.__colorArray,D=f.__sortArray,B=f.__dirtyVertices,N=f.__dirtyColors;if(m.sortParticles){Pa.multiplySelf(m.matrixWorld);for(n=0;n<u;n++){o=x[n].position;Va.copy(o);Pa.multiplyVector3(Va);D[n]=[Va.z,n]}D.sort(function(W,O){return O[0]-W[0]});for(n=0;n<u;n++){o=x[D[n][1]].position;w=n*3;y[w]=o.x;y[w+1]=o.y;y[w+2]=o.z}for(n=0;n<t;n++){w=n*3;color=A[D[n][1]];z[w]=color.r;z[w+1]=
+color.g;z[w+2]=color.b}}else{if(B)for(n=0;n<u;n++){o=x[n].position;w=n*3;y[w]=o.x;y[w+1]=o.y;y[w+2]=o.z}if(N)for(n=0;n<t;n++){color=A[n];w=n*3;z[w]=color.r;z[w+1]=color.g;z[w+2]=color.b}}if(B||m.sortParticles){c.bindBuffer(c.ARRAY_BUFFER,f.__webglVertexBuffer);c.bufferData(c.ARRAY_BUFFER,y,s)}if(N||m.sortParticles){c.bindBuffer(c.ARRAY_BUFFER,f.__webglColorBuffer);c.bufferData(c.ARRAY_BUFFER,z,s)}}function e(f,s,m,n,o){n.program||aa.initMaterial(n,s,m,o);var w=n.program,x=w.uniforms,u=n.uniforms;
+if(w!=ra){c.useProgram(w);ra=w}c.uniformMatrix4fv(x.projectionMatrix,!1,Ua);if(m&&(n instanceof THREE.MeshBasicMaterial||n instanceof THREE.MeshLambertMaterial||n instanceof THREE.MeshPhongMaterial||n instanceof THREE.LineBasicMaterial||n instanceof THREE.ParticleBasicMaterial||n.fog)){u.fogColor.value=m.color;if(m instanceof THREE.Fog){u.fogNear.value=m.near;u.fogFar.value=m.far}else if(m instanceof THREE.FogExp2)u.fogDensity.value=m.density}if(n instanceof THREE.MeshPhongMaterial||n instanceof THREE.MeshLambertMaterial||
+n.lights){var A,t,y=0,z=0,D=0,B,N,W,O,X=Sa,Ga=X.directional.colors,S=X.directional.positions,Q=X.point.colors,T=X.point.positions,ua=X.point.distances,r=0,F=0;m=t=O=0;for(A=s.length;m<A;m++){t=s[m];B=t.color;N=t.position;W=t.intensity;O=t.distance;if(t instanceof THREE.AmbientLight){y+=B.r;z+=B.g;D+=B.b}else if(t instanceof THREE.DirectionalLight){O=r*3;Ga[O]=B.r*W;Ga[O+1]=B.g*W;Ga[O+2]=B.b*W;S[O]=N.x;S[O+1]=N.y;S[O+2]=N.z;r+=1}else if(t instanceof THREE.PointLight){t=F*3;Q[t]=B.r*W;Q[t+1]=B.g*W;
+Q[t+2]=B.b*W;T[t]=N.x;T[t+1]=N.y;T[t+2]=N.z;ua[F]=O;F+=1}}for(m=r*3;m<Ga.length;m++)Ga[m]=0;for(m=F*3;m<Q.length;m++)Q[m]=0;X.point.length=F;X.directional.length=r;X.ambient[0]=y;X.ambient[1]=z;X.ambient[2]=D;m=Sa;u.enableLighting.value=m.directional.length+m.point.length;u.ambientLightColor.value=m.ambient;u.directionalLightColor.value=m.directional.colors;u.directionalLightDirection.value=m.directional.positions;u.pointLightColor.value=m.point.colors;u.pointLightPosition.value=m.point.positions;
+u.pointLightDistance.value=m.point.distances}if(n instanceof THREE.MeshBasicMaterial||n instanceof THREE.MeshLambertMaterial||n instanceof THREE.MeshPhongMaterial){u.diffuse.value=n.color;u.opacity.value=n.opacity;u.map.texture=n.map;u.lightMap.texture=n.lightMap;u.envMap.texture=n.envMap;u.reflectivity.value=n.reflectivity;u.refractionRatio.value=n.refractionRatio;u.combine.value=n.combine;u.useRefract.value=n.envMap&&n.envMap.mapping instanceof THREE.CubeRefractionMapping}if(n instanceof THREE.LineBasicMaterial){u.diffuse.value=
+n.color;u.opacity.value=n.opacity}else if(n instanceof THREE.ParticleBasicMaterial){u.psColor.value=n.color;u.opacity.value=n.opacity;u.size.value=n.size;u.scale.value=R.height/2;u.map.texture=n.map}else if(n instanceof THREE.MeshPhongMaterial){u.ambient.value=n.ambient;u.specular.value=n.specular;u.shininess.value=n.shininess}else if(n instanceof THREE.MeshDepthMaterial){u.mNear.value=f.near;u.mFar.value=f.far;u.opacity.value=n.opacity}else if(n instanceof THREE.MeshNormalMaterial)u.opacity.value=
+n.opacity;for(var i in u)if(z=w.uniforms[i]){A=u[i];y=A.type;m=A.value;if(y=="i")c.uniform1i(z,m);else if(y=="f")c.uniform1f(z,m);else if(y=="fv1")c.uniform1fv(z,m);else if(y=="fv")c.uniform3fv(z,m);else if(y=="v2")c.uniform2f(z,m.x,m.y);else if(y=="v3")c.uniform3f(z,m.x,m.y,m.z);else if(y=="v4")c.uniform4f(z,m.x,m.y,m.z,m.w);else if(y=="c")c.uniform3f(z,m.r,m.g,m.b);else if(y=="t"){c.uniform1i(z,m);if(A=A.texture)if(A.image instanceof Array&&A.image.length==6){if(A.image.length==6){if(A.needsUpdate){if(A.__webglInit){c.bindTexture(c.TEXTURE_CUBE_MAP,
+A.image.__webglTextureCube);for(y=0;y<6;++y)c.texSubImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+y,0,0,0,c.RGBA,c.UNSIGNED_BYTE,A.image[y])}else{A.image.__webglTextureCube=c.createTexture();c.bindTexture(c.TEXTURE_CUBE_MAP,A.image.__webglTextureCube);for(y=0;y<6;++y)c.texImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+y,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,A.image[y]);A.__webglInit=!0}Z(c.TEXTURE_CUBE_MAP,A,A.image[0]);c.bindTexture(c.TEXTURE_CUBE_MAP,null);A.needsUpdate=!1}c.activeTexture(c.TEXTURE0+m);c.bindTexture(c.TEXTURE_CUBE_MAP,
+A.image.__webglTextureCube)}}else K(A,m)}}c.uniformMatrix4fv(x.modelViewMatrix,!1,o._modelViewMatrixArray);c.uniformMatrix3fv(x.normalMatrix,!1,o._normalMatrixArray);(n instanceof THREE.MeshShaderMaterial||n instanceof THREE.MeshPhongMaterial||n.envMap)&&c.uniform3f(x.cameraPosition,f.position.x,f.position.y,f.position.z);(n instanceof THREE.MeshShaderMaterial||n.envMap||n.skinning)&&c.uniformMatrix4fv(x.objectMatrix,!1,o._objectMatrixArray);(n instanceof THREE.MeshPhongMaterial||n instanceof THREE.MeshLambertMaterial||
+n instanceof THREE.MeshShaderMaterial||n.skinning)&&c.uniformMatrix4fv(x.viewMatrix,!1,Ya);if(n instanceof THREE.ShadowVolumeDynamicMaterial){f=u.directionalLightDirection.value;f[0]=-s.position.x;f[1]=-s.position.y;f[2]=-s.position.z;c.uniform3fv(x.directionalLightDirection,f);c.uniformMatrix4fv(x.objectMatrix,!1,o._objectMatrixArray);c.uniformMatrix4fv(x.viewMatrix,!1,Ya)}if(n.skinning){c.uniformMatrix4fv(x.cameraInverseMatrix,!1,Ya);c.uniformMatrix4fv(x.boneGlobalMatrices,!1,o.boneMatrices)}return w}
+function h(f,s,m,n,o,w){if(n.opacity!=0){var x;f=e(f,s,m,n,w).attributes;if(n.morphTargets){s=n.program.attributes;w.morphTargetBase!==-1?c.bindBuffer(c.ARRAY_BUFFER,o.__webglMorphTargetsBuffers[w.morphTargetBase]):c.bindBuffer(c.ARRAY_BUFFER,o.__webglVertexBuffer);c.vertexAttribPointer(s.position,3,c.FLOAT,!1,0,0);if(w.morphTargetForcedOrder.length){m=0;for(var u=w.morphTargetForcedOrder,A=w.morphTargetInfluences;m<n.numSupportedMorphTargets&&m<u.length;){c.bindBuffer(c.ARRAY_BUFFER,o.__webglMorphTargetsBuffers[u[m]]);
+c.vertexAttribPointer(s["morphTarget"+m],3,c.FLOAT,!1,0,0);w.__webglMorphTargetInfluences[m]=A[u[m]];m++}}else{u=[];var t=-1,y=0;A=w.morphTargetInfluences;var z,D=A.length;m=0;for(w.morphTargetBase!==-1&&(u[w.morphTargetBase]=!0);m<n.numSupportedMorphTargets;){for(z=0;z<D;z++)if(!u[z]&&A[z]>t){y=z;t=A[y]}c.bindBuffer(c.ARRAY_BUFFER,o.__webglMorphTargetsBuffers[y]);c.vertexAttribPointer(s["morphTarget"+m],3,c.FLOAT,!1,0,0);w.__webglMorphTargetInfluences[m]=t;u[y]=1;t=-1;m++}}c.uniform1fv(n.program.uniforms.morphTargetInfluences,
+w.__webglMorphTargetInfluences)}else{c.bindBuffer(c.ARRAY_BUFFER,o.__webglVertexBuffer);c.vertexAttribPointer(f.position,3,c.FLOAT,!1,0,0)}if(o.__webglCustomAttributes)for(x in o.__webglCustomAttributes)if(f[x]>=0){s=o.__webglCustomAttributes[x];c.bindBuffer(c.ARRAY_BUFFER,s.buffer);c.vertexAttribPointer(f[x],s.size,c.FLOAT,!1,0,0)}if(f.color>=0){c.bindBuffer(c.ARRAY_BUFFER,o.__webglColorBuffer);c.vertexAttribPointer(f.color,3,c.FLOAT,!1,0,0)}if(f.normal>=0){c.bindBuffer(c.ARRAY_BUFFER,o.__webglNormalBuffer);
+c.vertexAttribPointer(f.normal,3,c.FLOAT,!1,0,0)}if(f.tangent>=0){c.bindBuffer(c.ARRAY_BUFFER,o.__webglTangentBuffer);c.vertexAttribPointer(f.tangent,4,c.FLOAT,!1,0,0)}if(f.uv>=0)if(o.__webglUVBuffer){c.bindBuffer(c.ARRAY_BUFFER,o.__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(o.__webglUV2Buffer){c.bindBuffer(c.ARRAY_BUFFER,o.__webglUV2Buffer);c.vertexAttribPointer(f.uv2,2,c.FLOAT,!1,0,0);c.enableVertexAttribArray(f.uv2)}else c.disableVertexAttribArray(f.uv2);
+if(n.skinning&&f.skinVertexA>=0&&f.skinVertexB>=0&&f.skinIndex>=0&&f.skinWeight>=0){c.bindBuffer(c.ARRAY_BUFFER,o.__webglSkinVertexABuffer);c.vertexAttribPointer(f.skinVertexA,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,o.__webglSkinVertexBBuffer);c.vertexAttribPointer(f.skinVertexB,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,o.__webglSkinIndicesBuffer);c.vertexAttribPointer(f.skinIndex,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,o.__webglSkinWeightsBuffer);c.vertexAttribPointer(f.skinWeight,
+4,c.FLOAT,!1,0,0)}if(w instanceof THREE.Mesh)if(n.wireframe){c.lineWidth(n.wireframeLinewidth);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,o.__webglLineBuffer);c.drawElements(c.LINES,o.__webglLineCount,c.UNSIGNED_SHORT,0)}else{c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,o.__webglFaceBuffer);c.drawElements(c.TRIANGLES,o.__webglFaceCount,c.UNSIGNED_SHORT,0)}else if(w instanceof THREE.Line){w=w.type==THREE.LineStrip?c.LINE_STRIP:c.LINES;c.lineWidth(n.linewidth);c.drawArrays(w,0,o.__webglLineCount)}else if(w instanceof
+THREE.ParticleSystem)c.drawArrays(c.POINTS,0,o.__webglParticleCount);else w instanceof THREE.Ribbon&&c.drawArrays(c.TRIANGLE_STRIP,0,o.__webglVertexCount)}}function g(f,s,m){if(!f.__webglVertexBuffer)f.__webglVertexBuffer=c.createBuffer();if(!f.__webglNormalBuffer)f.__webglNormalBuffer=c.createBuffer();if(f.hasPos){c.bindBuffer(c.ARRAY_BUFFER,f.__webglVertexBuffer);c.bufferData(c.ARRAY_BUFFER,f.positionArray,c.DYNAMIC_DRAW);c.enableVertexAttribArray(s.attributes.position);c.vertexAttribPointer(s.attributes.position,
+3,c.FLOAT,!1,0,0)}if(f.hasNormal){c.bindBuffer(c.ARRAY_BUFFER,f.__webglNormalBuffer);if(m==THREE.FlatShading){var n,o,w,x,u,A,t,y,z,D,B=f.count*3;for(D=0;D<B;D+=9){m=f.normalArray;n=m[D];o=m[D+1];w=m[D+2];x=m[D+3];A=m[D+4];y=m[D+5];u=m[D+6];t=m[D+7];z=m[D+8];n=(n+x+u)/3;o=(o+A+t)/3;w=(w+y+z)/3;m[D]=n;m[D+1]=o;m[D+2]=w;m[D+3]=n;m[D+4]=o;m[D+5]=w;m[D+6]=n;m[D+7]=o;m[D+8]=w}}c.bufferData(c.ARRAY_BUFFER,f.normalArray,c.DYNAMIC_DRAW);c.enableVertexAttribArray(s.attributes.normal);c.vertexAttribPointer(s.attributes.normal,
+3,c.FLOAT,!1,0,0)}c.drawArrays(c.TRIANGLES,0,f.count);f.count=0}function k(f){if(ma!=f.doubleSided){f.doubleSided?c.disable(c.CULL_FACE):c.enable(c.CULL_FACE);ma=f.doubleSided}if(na!=f.flipSided){f.flipSided?c.frontFace(c.CW):c.frontFace(c.CCW);na=f.flipSided}}function j(f){if(Y!=f){f?c.enable(c.DEPTH_TEST):c.disable(c.DEPTH_TEST);Y=f}}function p(f){$[0].set(f.n41-f.n11,f.n42-f.n12,f.n43-f.n13,f.n44-f.n14);$[1].set(f.n41+f.n11,f.n42+f.n12,f.n43+f.n13,f.n44+f.n14);$[2].set(f.n41+f.n21,f.n42+f.n22,
+f.n43+f.n23,f.n44+f.n24);$[3].set(f.n41-f.n21,f.n42-f.n22,f.n43-f.n23,f.n44-f.n24);$[4].set(f.n41-f.n31,f.n42-f.n32,f.n43-f.n33,f.n44-f.n34);$[5].set(f.n41+f.n31,f.n42+f.n32,f.n43+f.n33,f.n44+f.n34);var s;for(f=0;f<6;f++){s=$[f];s.divideScalar(Math.sqrt(s.x*s.x+s.y*s.y+s.z*s.z))}}function q(f){for(var s=f.matrixWorld,m=-f.geometry.boundingSphere.radius*Math.max(f.scale.x,Math.max(f.scale.y,f.scale.z)),n=0;n<6;n++){f=$[n].x*s.n14+$[n].y*s.n24+$[n].z*s.n34+$[n].w;if(f<=m)return!1}return!0}function v(f,
+s){f.list[f.count]=s;f.count+=1}function E(f){var s,m,n=f.object,o=f.opaque,w=f.transparent;w.count=0;f=o.count=0;for(s=n.materials.length;f<s;f++){m=n.materials[f];m.transparent?v(w,m):v(o,m)}}function G(f){var s,m,n,o,w=f.object,x=f.buffer,u=f.opaque,A=f.transparent;A.count=0;f=u.count=0;for(n=w.materials.length;f<n;f++){s=w.materials[f];if(s instanceof THREE.MeshFaceMaterial){s=0;for(m=x.materials.length;s<m;s++)(o=x.materials[s])&&(o.transparent?v(A,o):v(u,o))}else(o=s)&&(o.transparent?v(A,o):
+v(u,o))}}function I(f,s){return s.z-f.z}function H(f){c.enable(c.POLYGON_OFFSET_FILL);c.polygonOffset(0.1,1);c.enable(c.STENCIL_TEST);c.enable(c.DEPTH_TEST);c.depthMask(!1);c.colorMask(!1,!1,!1,!1);c.stencilFunc(c.ALWAYS,1,255);c.stencilOpSeparate(c.BACK,c.KEEP,c.INCR,c.KEEP);c.stencilOpSeparate(c.FRONT,c.KEEP,c.DECR,c.KEEP);var s,m=f.lights.length,n,o=f.lights,w=[],x,u,A,t,y,z=f.__webglShadowVolumes.length;for(s=0;s<m;s++){n=f.lights[s];if(n instanceof THREE.DirectionalLight){w[0]=-n.position.x;
+w[1]=-n.position.y;w[2]=-n.position.z;for(y=0;y<z;y++){n=f.__webglShadowVolumes[y].object;x=f.__webglShadowVolumes[y].buffer;u=n.materials[0];u.program||aa.initMaterial(u,o,undefined,n);u=u.program;A=u.uniforms;t=u.attributes;if(ra!==u){c.useProgram(u);ra=u;c.uniformMatrix4fv(A.projectionMatrix,!1,Ua);c.uniformMatrix4fv(A.viewMatrix,!1,Ya);c.uniform3fv(A.directionalLightDirection,w)}n.matrixWorld.flattenToArray(n._objectMatrixArray);c.uniformMatrix4fv(A.objectMatrix,!1,n._objectMatrixArray);c.bindBuffer(c.ARRAY_BUFFER,
+x.__webglVertexBuffer);c.vertexAttribPointer(t.position,3,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,x.__webglNormalBuffer);c.vertexAttribPointer(t.normal,3,c.FLOAT,!1,0,0);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,x.__webglFaceBuffer);c.cullFace(c.FRONT);c.drawElements(c.TRIANGLES,x.__webglFaceCount,c.UNSIGNED_SHORT,0);c.cullFace(c.BACK);c.drawElements(c.TRIANGLES,x.__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);ga="";ra=U.program;c.useProgram(U.program);c.uniformMatrix4fv(U.projectionLocation,!1,Ua);c.uniform1f(U.darknessLocation,U.darkness);c.bindBuffer(c.ARRAY_BUFFER,U.vertexBuffer);c.vertexAttribPointer(U.vertexLocation,3,c.FLOAT,!1,0,0);c.enableVertexAttribArray(U.vertexLocation);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA);c.blendEquation(c.FUNC_ADD);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,U.elementBuffer);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0);c.disable(c.STENCIL_TEST);
+c.enable(c.DEPTH_TEST);c.depthMask(ta)}function L(f,s){var m,n,o;m=_sprite.attributes;var w=_sprite.uniforms,x=za/ya,u,A=[],t=ya*0.5,y=za*0.5,z=!0;c.useProgram(_sprite.program);ra=_sprite.program;ga="";if(!rb){c.enableVertexAttribArray(_sprite.attributes.position);c.enableVertexAttribArray(_sprite.attributes.uv);rb=!0}c.disable(c.CULL_FACE);c.enable(c.BLEND);c.depthMask(!0);c.bindBuffer(c.ARRAY_BUFFER,_sprite.vertexBuffer);c.vertexAttribPointer(m.position,2,c.FLOAT,!1,16,0);c.vertexAttribPointer(m.uv,
+2,c.FLOAT,!1,16,8);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,_sprite.elementBuffer);c.uniformMatrix4fv(w.projectionMatrix,!1,Ua);c.activeTexture(c.TEXTURE0);c.uniform1i(w.map,0);m=0;for(n=f.__webglSprites.length;m<n;m++){o=f.__webglSprites[m];if(o.useScreenCoordinates)o.z=-o.position.z;else{o._modelViewMatrix.multiplyToArray(s.matrixWorldInverse,o.matrixWorld,o._modelViewMatrixArray);o.z=-o._modelViewMatrix.n34}}f.__webglSprites.sort(I);m=0;for(n=f.__webglSprites.length;m<n;m++){o=f.__webglSprites[m];if(o.material===
+undefined&&o.map&&o.map.image&&o.map.image.width){if(o.useScreenCoordinates){c.uniform1i(w.useScreenCoordinates,1);c.uniform3f(w.screenPosition,(o.position.x-t)/t,(y-o.position.y)/y,Math.max(0,Math.min(1,o.position.z)))}else{c.uniform1i(w.useScreenCoordinates,0);c.uniform1i(w.affectedByDistance,o.affectedByDistance?1:0);c.uniformMatrix4fv(w.modelViewMatrix,!1,o._modelViewMatrixArray)}u=o.map.image.width/(o.affectedByDistance?1:za);A[0]=u*x*o.scale.x;A[1]=u*o.scale.y;c.uniform2f(w.uvScale,o.uvScale.x,
+o.uvScale.y);c.uniform2f(w.uvOffset,o.uvOffset.x,o.uvOffset.y);c.uniform2f(w.alignment,o.alignment.x,o.alignment.y);c.uniform1f(w.opacity,o.opacity);c.uniform1f(w.rotation,o.rotation);c.uniform2fv(w.scale,A);if(o.mergeWith3D&&!z){c.enable(c.DEPTH_TEST);z=!0}else if(!o.mergeWith3D&&z){c.disable(c.DEPTH_TEST);z=!1}oa(o.blending);K(o.map,0);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0)}}c.enable(c.CULL_FACE);c.enable(c.DEPTH_TEST);c.depthMask(ta)}function M(f,s){var m,n,o=f.__webglLensFlares.length,
+w,x,u,A=new THREE.Vector3,t=za/ya,y=ya*0.5,z=za*0.5,D=16/za,B=[D*t,D],N=[1,1,0],W=[1,1],O=J.uniforms;m=J.attributes;c.useProgram(J.program);ra=J.program;ga="";if(!sb){c.enableVertexAttribArray(J.attributes.vertex);c.enableVertexAttribArray(J.attributes.uv);sb=!0}c.uniform1i(O.occlusionMap,0);c.uniform1i(O.map,1);c.bindBuffer(c.ARRAY_BUFFER,J.vertexBuffer);c.vertexAttribPointer(m.vertex,2,c.FLOAT,!1,16,0);c.vertexAttribPointer(m.uv,2,c.FLOAT,!1,16,8);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,J.elementBuffer);
+c.disable(c.CULL_FACE);c.depthMask(!1);c.activeTexture(c.TEXTURE0);c.bindTexture(c.TEXTURE_2D,J.occlusionTexture);c.activeTexture(c.TEXTURE1);for(n=0;n<o;n++){m=f.__webglLensFlares[n].object;A.set(m.matrixWorld.n14,m.matrixWorld.n24,m.matrixWorld.n34);s.matrixWorldInverse.multiplyVector3(A);s.projectionMatrix.multiplyVector3(A);N[0]=A.x;N[1]=A.y;N[2]=A.z;W[0]=N[0]*y+y;W[1]=N[1]*z+z;if(J.hasVertexTexture||W[0]>0&&W[0]<ya&&W[1]>0&&W[1]<za){c.bindTexture(c.TEXTURE_2D,J.tempTexture);c.copyTexImage2D(c.TEXTURE_2D,
+0,c.RGB,W[0]-8,W[1]-8,16,16,0);c.uniform1i(O.renderType,0);c.uniform2fv(O.scale,B);c.uniform3fv(O.screenPosition,N);c.disable(c.BLEND);c.enable(c.DEPTH_TEST);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0);c.bindTexture(c.TEXTURE_2D,J.occlusionTexture);c.copyTexImage2D(c.TEXTURE_2D,0,c.RGBA,W[0]-8,W[1]-8,16,16,0);c.uniform1i(O.renderType,1);c.disable(c.DEPTH_TEST);c.bindTexture(c.TEXTURE_2D,J.tempTexture);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0);m.positionScreen.x=N[0];m.positionScreen.y=
+N[1];m.positionScreen.z=N[2];m.customUpdateCallback?m.customUpdateCallback(m):m.updateLensFlares();c.uniform1i(O.renderType,2);c.enable(c.BLEND);w=0;for(x=m.lensFlares.length;w<x;w++){u=m.lensFlares[w];if(u.opacity>0.0010&&u.scale>0.0010){N[0]=u.x;N[1]=u.y;N[2]=u.z;D=u.size*u.scale/za;B[0]=D*t;B[1]=D;c.uniform3fv(O.screenPosition,N);c.uniform2fv(O.scale,B);c.uniform1f(O.rotation,u.rotation);c.uniform1f(O.opacity,u.opacity);oa(u.blending);K(u.texture,1);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,
+0)}}}}c.enable(c.CULL_FACE);c.enable(c.DEPTH_TEST);c.depthMask(ta)}function V(f,s){f._modelViewMatrix.multiplyToArray(s.matrixWorldInverse,f.matrixWorld,f._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(f._modelViewMatrix).transposeIntoArray(f._normalMatrixArray)}function P(f){var s,m,n,o,w;if(f instanceof THREE.Mesh){m=f.geometry;for(s in m.geometryGroups){n=m.geometryGroups[s];w=!1;for(o in n.__webglCustomAttributes)if(n.__webglCustomAttributes[o].needsUpdate){w=!0;break}if(m.__dirtyVertices||
+m.__dirtyMorphTargets||m.__dirtyElements||m.__dirtyUvs||m.__dirtyNormals||m.__dirtyColors||m.__dirtyTangents||w){w=c.DYNAMIC_DRAW;var x=void 0,u=void 0,A=void 0,t=void 0;A=void 0;var y=void 0,z=void 0,D=void 0,B=void 0,N=void 0,W=void 0,O=void 0,X=void 0,Ga=void 0,S=void 0,Q=void 0,T=void 0,ua=void 0;z=void 0;D=void 0;t=void 0;B=void 0;t=void 0;var r=void 0,F=void 0;z=void 0;r=void 0;F=void 0;var i=void 0,Ka=void 0;r=void 0;F=void 0;i=void 0;Ka=void 0;r=void 0;F=void 0;i=void 0;Ka=void 0;r=void 0;
+F=void 0;i=void 0;t=void 0;B=void 0;y=void 0;A=void 0;A=void 0;r=void 0;F=void 0;i=void 0;var Wa=void 0,va=0,Aa=0,bb=0,cb=0,Ja=0,La=0,ea=0,Ma=0,xa=0,C=0,Ba=0;F=r=0;var Ca=n.__vertexArray,ib=n.__uvArray,jb=n.__uv2Array,Qa=n.__normalArray,ha=n.__tangentArray,Da=n.__colorArray,ia=n.__skinVertexAArray,ja=n.__skinVertexBArray,ka=n.__skinIndexArray,la=n.__skinWeightArray,kb=n.__morphTargetsArrays,Ra=n.__webglCustomAttributes;i=void 0;var Na=n.__faceArray,Oa=n.__lineArray,tb=n.__needsSmoothNormals;W=n.__vertexColorType;
+N=n.__uvType;O=n.__normalType;var Ha=f.geometry,lb=Ha.__dirtyVertices,mb=Ha.__dirtyElements,hb=Ha.__dirtyUvs,nb=Ha.__dirtyNormals,ob=Ha.__dirtyTangents,pb=Ha.__dirtyColors,qb=Ha.__dirtyMorphTargets,db=Ha.vertices,ub=n.faces,zb=Ha.faces,vb=Ha.faceVertexUvs[0],wb=Ha.faceVertexUvs[1],eb=Ha.skinVerticesA,fb=Ha.skinVerticesB,gb=Ha.skinIndices,Xa=Ha.skinWeights,ab=Ha.edgeFaces,Ta=Ha.morphTargets;if(Ra)for(Wa in Ra){Ra[Wa].offset=0;Ra[Wa].offsetSrc=0}x=0;for(u=ub.length;x<u;x++){A=ub[x];t=zb[A];vb&&(X=vb[A]);
+wb&&(Ga=wb[A]);A=t.vertexNormals;y=t.normal;z=t.vertexColors;D=t.color;B=t.vertexTangents;if(t instanceof THREE.Face3){if(lb){S=db[t.a].position;Q=db[t.b].position;T=db[t.c].position;Ca[Aa]=S.x;Ca[Aa+1]=S.y;Ca[Aa+2]=S.z;Ca[Aa+3]=Q.x;Ca[Aa+4]=Q.y;Ca[Aa+5]=Q.z;Ca[Aa+6]=T.x;Ca[Aa+7]=T.y;Ca[Aa+8]=T.z;Aa+=9}if(Ra)for(Wa in Ra){i=Ra[Wa];if(i.needsUpdate){r=i.offset;F=i.offsetSrc;if(i.size===1){if(i.boundTo===undefined||i.boundTo==="vertices"){i.array[r+0]=i.value[t.a];i.array[r+1]=i.value[t.b];i.array[r+
+2]=i.value[t.c]}else if(i.boundTo==="faces"){i.array[r+0]=i.value[F];i.array[r+1]=i.value[F];i.array[r+2]=i.value[F];i.offsetSrc++}else if(i.boundTo==="faceVertices"){i.array[r+0]=i.value[F+0];i.array[r+1]=i.value[F+1];i.array[r+2]=i.value[F+2];i.offsetSrc+=3}i.offset+=3}else{if(i.boundTo===undefined||i.boundTo==="vertices"){S=i.value[t.a];Q=i.value[t.b];T=i.value[t.c]}else if(i.boundTo==="faces"){S=i.value[F];Q=i.value[F];T=i.value[F];i.offsetSrc++}else if(i.boundTo==="faceVertices"){S=i.value[F+
+0];Q=i.value[F+1];T=i.value[F+2];i.offsetSrc+=3}if(i.size===2){i.array[r+0]=S.x;i.array[r+1]=S.y;i.array[r+2]=Q.x;i.array[r+3]=Q.y;i.array[r+4]=T.x;i.array[r+5]=T.y;i.offset+=6}else if(i.size===3){if(i.type==="c"){i.array[r+0]=S.r;i.array[r+1]=S.g;i.array[r+2]=S.b;i.array[r+3]=Q.r;i.array[r+4]=Q.g;i.array[r+5]=Q.b;i.array[r+6]=T.r;i.array[r+7]=T.g;i.array[r+8]=T.b}else{i.array[r+0]=S.x;i.array[r+1]=S.y;i.array[r+2]=S.z;i.array[r+3]=Q.x;i.array[r+4]=Q.y;i.array[r+5]=Q.z;i.array[r+6]=T.x;i.array[r+
+7]=T.y;i.array[r+8]=T.z}i.offset+=9}else{i.array[r+0]=S.x;i.array[r+1]=S.y;i.array[r+2]=S.z;i.array[r+3]=S.w;i.array[r+4]=Q.x;i.array[r+5]=Q.y;i.array[r+6]=Q.z;i.array[r+7]=Q.w;i.array[r+8]=T.x;i.array[r+9]=T.y;i.array[r+10]=T.z;i.array[r+11]=T.w;i.offset+=12}}}}if(qb){r=0;for(F=Ta.length;r<F;r++){S=Ta[r].vertices[t.a].position;Q=Ta[r].vertices[t.b].position;T=Ta[r].vertices[t.c].position;i=kb[r];i[Ba+0]=S.x;i[Ba+1]=S.y;i[Ba+2]=S.z;i[Ba+3]=Q.x;i[Ba+4]=Q.y;i[Ba+5]=Q.z;i[Ba+6]=T.x;i[Ba+7]=T.y;i[Ba+
+8]=T.z}Ba+=9}if(Xa.length){r=Xa[t.a];F=Xa[t.b];i=Xa[t.c];la[C]=r.x;la[C+1]=r.y;la[C+2]=r.z;la[C+3]=r.w;la[C+4]=F.x;la[C+5]=F.y;la[C+6]=F.z;la[C+7]=F.w;la[C+8]=i.x;la[C+9]=i.y;la[C+10]=i.z;la[C+11]=i.w;r=gb[t.a];F=gb[t.b];i=gb[t.c];ka[C]=r.x;ka[C+1]=r.y;ka[C+2]=r.z;ka[C+3]=r.w;ka[C+4]=F.x;ka[C+5]=F.y;ka[C+6]=F.z;ka[C+7]=F.w;ka[C+8]=i.x;ka[C+9]=i.y;ka[C+10]=i.z;ka[C+11]=i.w;r=eb[t.a];F=eb[t.b];i=eb[t.c];ia[C]=r.x;ia[C+1]=r.y;ia[C+2]=r.z;ia[C+3]=1;ia[C+4]=F.x;ia[C+5]=F.y;ia[C+6]=F.z;ia[C+7]=1;ia[C+8]=
+i.x;ia[C+9]=i.y;ia[C+10]=i.z;ia[C+11]=1;r=fb[t.a];F=fb[t.b];i=fb[t.c];ja[C]=r.x;ja[C+1]=r.y;ja[C+2]=r.z;ja[C+3]=1;ja[C+4]=F.x;ja[C+5]=F.y;ja[C+6]=F.z;ja[C+7]=1;ja[C+8]=i.x;ja[C+9]=i.y;ja[C+10]=i.z;ja[C+11]=1;C+=12}if(pb&&W){if(z.length==3&&W==THREE.VertexColors){t=z[0];r=z[1];F=z[2]}else F=r=t=D;Da[xa]=t.r;Da[xa+1]=t.g;Da[xa+2]=t.b;Da[xa+3]=r.r;Da[xa+4]=r.g;Da[xa+5]=r.b;Da[xa+6]=F.r;Da[xa+7]=F.g;Da[xa+8]=F.b;xa+=9}if(ob&&Ha.hasTangents){z=B[0];D=B[1];t=B[2];ha[ea]=z.x;ha[ea+1]=z.y;ha[ea+2]=z.z;ha[ea+
+3]=z.w;ha[ea+4]=D.x;ha[ea+5]=D.y;ha[ea+6]=D.z;ha[ea+7]=D.w;ha[ea+8]=t.x;ha[ea+9]=t.y;ha[ea+10]=t.z;ha[ea+11]=t.w;ea+=12}if(nb&&O)if(A.length==3&&tb)for(B=0;B<3;B++){y=A[B];Qa[La]=y.x;Qa[La+1]=y.y;Qa[La+2]=y.z;La+=3}else for(B=0;B<3;B++){Qa[La]=y.x;Qa[La+1]=y.y;Qa[La+2]=y.z;La+=3}if(hb&&X!==undefined&&N)for(B=0;B<3;B++){A=X[B];ib[bb]=A.u;ib[bb+1]=A.v;bb+=2}if(hb&&Ga!==undefined&&N)for(B=0;B<3;B++){A=Ga[B];jb[cb]=A.u;jb[cb+1]=A.v;cb+=2}if(mb){Na[Ja]=va;Na[Ja+1]=va+1;Na[Ja+2]=va+2;Ja+=3;Oa[Ma]=va;Oa[Ma+
+1]=va+1;Oa[Ma+2]=va;Oa[Ma+3]=va+2;Oa[Ma+4]=va+1;Oa[Ma+5]=va+2;Ma+=6;va+=3}}else if(t instanceof THREE.Face4){if(lb){S=db[t.a].position;Q=db[t.b].position;T=db[t.c].position;ua=db[t.d].position;Ca[Aa]=S.x;Ca[Aa+1]=S.y;Ca[Aa+2]=S.z;Ca[Aa+3]=Q.x;Ca[Aa+4]=Q.y;Ca[Aa+5]=Q.z;Ca[Aa+6]=T.x;Ca[Aa+7]=T.y;Ca[Aa+8]=T.z;Ca[Aa+9]=ua.x;Ca[Aa+10]=ua.y;Ca[Aa+11]=ua.z;Aa+=12}if(Ra)for(Wa in Ra){i=Ra[Wa];if(i.needsUpdate){r=i.offset;F=i.offsetSrc;if(i.size===1){if(i.boundTo===undefined||i.boundTo==="vertices"){i.array[r+
+0]=i.value[t.a];i.array[r+1]=i.value[t.b];i.array[r+2]=i.value[t.c];i.array[r+2]=i.value[t.d]}else if(i.boundTo==="faces"){i.array[r+0]=i.value[F];i.array[r+1]=i.value[F];i.array[r+2]=i.value[F];i.array[r+2]=i.value[F];i.offsetSrc++}else if(i.boundTo==="faceVertices"){i.array[r+0]=i.value[F+0];i.array[r+1]=i.value[F+1];i.array[r+2]=i.value[F+2];i.array[r+2]=i.value[F+3];i.offsetSrc+=4}i.offset+=4}else{if(i.boundTo===undefined||i.boundTo==="vertices"){S=i.value[t.a];Q=i.value[t.b];T=i.value[t.c];ua=
+i.value[t.d]}else if(i.boundTo==="faces"){S=i.value[F];Q=i.value[F];T=i.value[F];ua=i.value[F];i.offsetSrc++}else if(i.boundTo==="faceVertices"){S=i.value[F+0];Q=i.value[F+1];T=i.value[F+2];ua=i.value[F+3];i.offsetSrc+=4}if(i.size===2){i.array[r+0]=S.x;i.array[r+1]=S.y;i.array[r+2]=Q.x;i.array[r+3]=Q.y;i.array[r+4]=T.x;i.array[r+5]=T.y;i.array[r+6]=ua.x;i.array[r+7]=ua.y;i.offset+=8}else if(i.size===3){if(i.type==="c"){i.array[r+0]=S.r;i.array[r+1]=S.g;i.array[r+2]=S.b;i.array[r+3]=Q.r;i.array[r+
+4]=Q.g;i.array[r+5]=Q.b;i.array[r+6]=T.r;i.array[r+7]=T.g;i.array[r+8]=T.b;i.array[r+9]=ua.r;i.array[r+10]=ua.g;i.array[r+11]=ua.b}else{i.array[r+0]=S.x;i.array[r+1]=S.y;i.array[r+2]=S.z;i.array[r+3]=Q.x;i.array[r+4]=Q.y;i.array[r+5]=Q.z;i.array[r+6]=T.x;i.array[r+7]=T.y;i.array[r+8]=T.z;i.array[r+9]=ua.x;i.array[r+10]=ua.y;i.array[r+11]=ua.z}i.offset+=12}else{i.array[r+0]=S.x;i.array[r+1]=S.y;i.array[r+2]=S.z;i.array[r+3]=S.w;i.array[r+4]=Q.x;i.array[r+5]=Q.y;i.array[r+6]=Q.z;i.array[r+7]=Q.w;i.array[r+
+8]=T.x;i.array[r+9]=T.y;i.array[r+10]=T.z;i.array[r+11]=T.w;i.array[r+12]=ua.x;i.array[r+13]=ua.y;i.array[r+14]=ua.z;i.array[r+15]=ua.w;i.offset+=16}}}}if(qb){r=0;for(F=Ta.length;r<F;r++){S=Ta[r].vertices[t.a].position;Q=Ta[r].vertices[t.b].position;T=Ta[r].vertices[t.c].position;ua=Ta[r].vertices[t.d].position;i=kb[r];i[Ba+0]=S.x;i[Ba+1]=S.y;i[Ba+2]=S.z;i[Ba+3]=Q.x;i[Ba+4]=Q.y;i[Ba+5]=Q.z;i[Ba+6]=T.x;i[Ba+7]=T.y;i[Ba+8]=T.z;i[Ba+9]=ua.x;i[Ba+10]=ua.y;i[Ba+11]=ua.z}Ba+=12}if(Xa.length){r=Xa[t.a];
+F=Xa[t.b];i=Xa[t.c];Ka=Xa[t.d];la[C]=r.x;la[C+1]=r.y;la[C+2]=r.z;la[C+3]=r.w;la[C+4]=F.x;la[C+5]=F.y;la[C+6]=F.z;la[C+7]=F.w;la[C+8]=i.x;la[C+9]=i.y;la[C+10]=i.z;la[C+11]=i.w;la[C+12]=Ka.x;la[C+13]=Ka.y;la[C+14]=Ka.z;la[C+15]=Ka.w;r=gb[t.a];F=gb[t.b];i=gb[t.c];Ka=gb[t.d];ka[C]=r.x;ka[C+1]=r.y;ka[C+2]=r.z;ka[C+3]=r.w;ka[C+4]=F.x;ka[C+5]=F.y;ka[C+6]=F.z;ka[C+7]=F.w;ka[C+8]=i.x;ka[C+9]=i.y;ka[C+10]=i.z;ka[C+11]=i.w;ka[C+12]=Ka.x;ka[C+13]=Ka.y;ka[C+14]=Ka.z;ka[C+15]=Ka.w;r=eb[t.a];F=eb[t.b];i=eb[t.c];
+Ka=eb[t.d];ia[C]=r.x;ia[C+1]=r.y;ia[C+2]=r.z;ia[C+3]=1;ia[C+4]=F.x;ia[C+5]=F.y;ia[C+6]=F.z;ia[C+7]=1;ia[C+8]=i.x;ia[C+9]=i.y;ia[C+10]=i.z;ia[C+11]=1;ia[C+12]=Ka.x;ia[C+13]=Ka.y;ia[C+14]=Ka.z;ia[C+15]=1;r=fb[t.a];F=fb[t.b];i=fb[t.c];t=fb[t.d];ja[C]=r.x;ja[C+1]=r.y;ja[C+2]=r.z;ja[C+3]=1;ja[C+4]=F.x;ja[C+5]=F.y;ja[C+6]=F.z;ja[C+7]=1;ja[C+8]=i.x;ja[C+9]=i.y;ja[C+10]=i.z;ja[C+11]=1;ja[C+12]=t.x;ja[C+13]=t.y;ja[C+14]=t.z;ja[C+15]=1;C+=16}if(pb&&W){if(z.length==4&&W==THREE.VertexColors){t=z[0];r=z[1];F=
+z[2];z=z[3]}else z=F=r=t=D;Da[xa]=t.r;Da[xa+1]=t.g;Da[xa+2]=t.b;Da[xa+3]=r.r;Da[xa+4]=r.g;Da[xa+5]=r.b;Da[xa+6]=F.r;Da[xa+7]=F.g;Da[xa+8]=F.b;Da[xa+9]=z.r;Da[xa+10]=z.g;Da[xa+11]=z.b;xa+=12}if(ob&&Ha.hasTangents){z=B[0];D=B[1];t=B[2];B=B[3];ha[ea]=z.x;ha[ea+1]=z.y;ha[ea+2]=z.z;ha[ea+3]=z.w;ha[ea+4]=D.x;ha[ea+5]=D.y;ha[ea+6]=D.z;ha[ea+7]=D.w;ha[ea+8]=t.x;ha[ea+9]=t.y;ha[ea+10]=t.z;ha[ea+11]=t.w;ha[ea+12]=B.x;ha[ea+13]=B.y;ha[ea+14]=B.z;ha[ea+15]=B.w;ea+=16}if(nb&&O)if(A.length==4&&tb)for(B=0;B<4;B++){y=
+A[B];Qa[La]=y.x;Qa[La+1]=y.y;Qa[La+2]=y.z;La+=3}else for(B=0;B<4;B++){Qa[La]=y.x;Qa[La+1]=y.y;Qa[La+2]=y.z;La+=3}if(hb&&X!==undefined&&N)for(B=0;B<4;B++){A=X[B];ib[bb]=A.u;ib[bb+1]=A.v;bb+=2}if(hb&&Ga!==undefined&&N)for(B=0;B<4;B++){A=Ga[B];jb[cb]=A.u;jb[cb+1]=A.v;cb+=2}if(mb){Na[Ja]=va;Na[Ja+1]=va+1;Na[Ja+2]=va+3;Na[Ja+3]=va+1;Na[Ja+4]=va+2;Na[Ja+5]=va+3;Ja+=6;Oa[Ma]=va;Oa[Ma+1]=va+1;Oa[Ma+2]=va;Oa[Ma+3]=va+3;Oa[Ma+4]=va+1;Oa[Ma+5]=va+2;Oa[Ma+6]=va+2;Oa[Ma+7]=va+3;Ma+=8;va+=4}}}if(ab){x=0;for(u=
+ab.length;x<u;x++){Na[Ja]=ab[x].a;Na[Ja+1]=ab[x].b;Na[Ja+2]=ab[x].c;Na[Ja+3]=ab[x].a;Na[Ja+4]=ab[x].c;Na[Ja+5]=ab[x].d;Ja+=6}}if(lb){c.bindBuffer(c.ARRAY_BUFFER,n.__webglVertexBuffer);c.bufferData(c.ARRAY_BUFFER,Ca,w)}if(Ra)for(Wa in Ra){i=Ra[Wa];if(i.needsUpdate){c.bindBuffer(c.ARRAY_BUFFER,i.buffer);c.bufferData(c.ARRAY_BUFFER,i.array,w);i.needsUpdate=!1}}if(qb){r=0;for(F=Ta.length;r<F;r++){c.bindBuffer(c.ARRAY_BUFFER,n.__webglMorphTargetsBuffers[r]);c.bufferData(c.ARRAY_BUFFER,kb[r],w)}}if(pb&&
+xa>0){c.bindBuffer(c.ARRAY_BUFFER,n.__webglColorBuffer);c.bufferData(c.ARRAY_BUFFER,Da,w)}if(nb){c.bindBuffer(c.ARRAY_BUFFER,n.__webglNormalBuffer);c.bufferData(c.ARRAY_BUFFER,Qa,w)}if(ob&&Ha.hasTangents){c.bindBuffer(c.ARRAY_BUFFER,n.__webglTangentBuffer);c.bufferData(c.ARRAY_BUFFER,ha,w)}if(hb&&bb>0){c.bindBuffer(c.ARRAY_BUFFER,n.__webglUVBuffer);c.bufferData(c.ARRAY_BUFFER,ib,w)}if(hb&&cb>0){c.bindBuffer(c.ARRAY_BUFFER,n.__webglUV2Buffer);c.bufferData(c.ARRAY_BUFFER,jb,w)}if(mb){c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,
+n.__webglFaceBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,Na,w);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,n.__webglLineBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,Oa,w)}if(C>0){c.bindBuffer(c.ARRAY_BUFFER,n.__webglSkinVertexABuffer);c.bufferData(c.ARRAY_BUFFER,ia,w);c.bindBuffer(c.ARRAY_BUFFER,n.__webglSkinVertexBBuffer);c.bufferData(c.ARRAY_BUFFER,ja,w);c.bindBuffer(c.ARRAY_BUFFER,n.__webglSkinIndicesBuffer);c.bufferData(c.ARRAY_BUFFER,ka,w);c.bindBuffer(c.ARRAY_BUFFER,n.__webglSkinWeightsBuffer);c.bufferData(c.ARRAY_BUFFER,
+la,w)}}}m.__dirtyVertices=!1;m.__dirtyMorphTargets=!1;m.__dirtyElements=!1;m.__dirtyUvs=!1;m.__dirtyNormals=!1;m.__dirtyTangents=!1;m.__dirtyColors=!1}else if(f instanceof THREE.Ribbon){m=f.geometry;if(m.__dirtyVertices||m.__dirtyColors){f=m;s=c.DYNAMIC_DRAW;W=f.vertices;n=f.colors;O=W.length;w=n.length;X=f.__vertexArray;x=f.__colorArray;Ga=f.__dirtyColors;if(f.__dirtyVertices){for(u=0;u<O;u++){N=W[u].position;o=u*3;X[o]=N.x;X[o+1]=N.y;X[o+2]=N.z}c.bindBuffer(c.ARRAY_BUFFER,f.__webglVertexBuffer);
+c.bufferData(c.ARRAY_BUFFER,X,s)}if(Ga){for(u=0;u<w;u++){color=n[u];o=u*3;x[o]=color.r;x[o+1]=color.g;x[o+2]=color.b}c.bindBuffer(c.ARRAY_BUFFER,f.__webglColorBuffer);c.bufferData(c.ARRAY_BUFFER,x,s)}}m.__dirtyVertices=!1;m.__dirtyColors=!1}else if(f instanceof THREE.Line){m=f.geometry;if(m.__dirtyVertices||m.__dirtyColors){f=m;s=c.DYNAMIC_DRAW;W=f.vertices;n=f.colors;O=W.length;w=n.length;X=f.__vertexArray;x=f.__colorArray;Ga=f.__dirtyColors;if(f.__dirtyVertices){for(u=0;u<O;u++){N=W[u].position;
+o=u*3;X[o]=N.x;X[o+1]=N.y;X[o+2]=N.z}c.bindBuffer(c.ARRAY_BUFFER,f.__webglVertexBuffer);c.bufferData(c.ARRAY_BUFFER,X,s)}if(Ga){for(u=0;u<w;u++){color=n[u];o=u*3;x[o]=color.r;x[o+1]=color.g;x[o+2]=color.b}c.bindBuffer(c.ARRAY_BUFFER,f.__webglColorBuffer);c.bufferData(c.ARRAY_BUFFER,x,s)}}m.__dirtyVertices=!1;m.__dirtyColors=!1}else if(f instanceof THREE.ParticleSystem){m=f.geometry;(m.__dirtyVertices||m.__dirtyColors||f.sortParticles)&&d(m,c.DYNAMIC_DRAW,f);m.__dirtyVertices=!1;m.__dirtyColors=!1}}
+function sa(f){function s(D){var B=[];m=0;for(n=D.length;m<n;m++)D[m]==undefined?B.push("undefined"):B.push(D[m].id);return B.join("_")}var m,n,o,w,x,u,A,t,y={},z=f.morphTargets!==undefined?f.morphTargets.length:0;f.geometryGroups={};o=0;for(w=f.faces.length;o<w;o++){x=f.faces[o];u=x.materials;A=s(u);y[A]==undefined&&(y[A]={hash:A,counter:0});t=y[A].hash+"_"+y[A].counter;f.geometryGroups[t]==undefined&&(f.geometryGroups[t]={faces:[],materials:u,vertices:0,numMorphTargets:z});x=x instanceof THREE.Face3?
+3:4;if(f.geometryGroups[t].vertices+x>65535){y[A].counter+=1;t=y[A].hash+"_"+y[A].counter;f.geometryGroups[t]==undefined&&(f.geometryGroups[t]={faces:[],materials:u,vertices:0,numMorphTargets:z})}f.geometryGroups[t].faces.push(o);f.geometryGroups[t].vertices+=x}}function da(f,s,m){f.push({buffer:s,object:m,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function oa(f){if(f!=ga){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)}ga=f}}function Z(f,s,m){if((m.width&m.width-1)==0&&(m.height&m.height-1)==0){c.texParameteri(f,c.TEXTURE_WRAP_S,fa(s.wrapS));c.texParameteri(f,c.TEXTURE_WRAP_T,fa(s.wrapT));c.texParameteri(f,c.TEXTURE_MAG_FILTER,fa(s.magFilter));
+c.texParameteri(f,c.TEXTURE_MIN_FILTER,fa(s.minFilter));c.generateMipmap(f)}else{c.texParameteri(f,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(f,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);c.texParameteri(f,c.TEXTURE_MAG_FILTER,Ea(s.magFilter));c.texParameteri(f,c.TEXTURE_MIN_FILTER,Ea(s.minFilter))}}function K(f,s){if(f.needsUpdate){if(f.__webglInit){c.bindTexture(c.TEXTURE_2D,f.__webglTexture);c.texSubImage2D(c.TEXTURE_2D,0,0,0,c.RGBA,c.UNSIGNED_BYTE,f.image)}else{f.__webglTexture=c.createTexture();
+c.bindTexture(c.TEXTURE_2D,f.__webglTexture);c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,f.image);f.__webglInit=!0}Z(c.TEXTURE_2D,f,f.image);c.bindTexture(c.TEXTURE_2D,null);f.needsUpdate=!1}c.activeTexture(c.TEXTURE0+s);c.bindTexture(c.TEXTURE_2D,f.__webglTexture)}function Ia(f){if(f&&!f.__webglFramebuffer){if(f.depthBuffer===undefined)f.depthBuffer=!0;if(f.stencilBuffer===undefined)f.stencilBuffer=!0;f.__webglFramebuffer=c.createFramebuffer();f.__webglRenderbuffer=c.createRenderbuffer();
+f.__webglTexture=c.createTexture();c.bindTexture(c.TEXTURE_2D,f.__webglTexture);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,fa(f.wrapS));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,fa(f.wrapT));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,fa(f.magFilter));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,fa(f.minFilter));c.texImage2D(c.TEXTURE_2D,0,fa(f.format),f.width,f.height,0,fa(f.format),fa(f.type),null);c.bindRenderbuffer(c.RENDERBUFFER,f.__webglRenderbuffer);c.bindFramebuffer(c.FRAMEBUFFER,
+f.__webglFramebuffer);c.framebufferTexture2D(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,c.TEXTURE_2D,f.__webglTexture,0);if(f.depthBuffer&&!f.stencilBuffer){c.renderbufferStorage(c.RENDERBUFFER,c.DEPTH_COMPONENT16,f.width,f.height);c.framebufferRenderbuffer(c.FRAMEBUFFER,c.DEPTH_ATTACHMENT,c.RENDERBUFFER,f.__webglRenderbuffer)}else if(f.depthBuffer&&f.stencilBuffer){c.renderbufferStorage(c.RENDERBUFFER,c.DEPTH_STENCIL,f.width,f.height);c.framebufferRenderbuffer(c.FRAMEBUFFER,c.DEPTH_STENCIL_ATTACHMENT,c.RENDERBUFFER,
+f.__webglRenderbuffer)}else c.renderbufferStorage(c.RENDERBUFFER,c.RGBA4,f.width,f.height);c.bindTexture(c.TEXTURE_2D,null);c.bindRenderbuffer(c.RENDERBUFFER,null);c.bindFramebuffer(c.FRAMEBUFFER,null)}var s,m;if(f){s=f.__webglFramebuffer;m=f.width;f=f.height}else{s=null;m=ya;f=za}if(s!=Fa){c.bindFramebuffer(c.FRAMEBUFFER,s);c.viewport(wa,qa,m,f);Fa=s}}function ca(f,s){var m;if(f=="fragment")m=c.createShader(c.FRAGMENT_SHADER);else f=="vertex"&&(m=c.createShader(c.VERTEX_SHADER));c.shaderSource(m,
+s);c.compileShader(m);if(!c.getShaderParameter(m,c.COMPILE_STATUS)){console.error(c.getShaderInfoLog(m));console.error(s);return null}return m}function Ea(f){switch(f){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return c.NEAREST;default:return c.LINEAR}}function fa(f){switch(f){case THREE.RepeatWrapping:return c.REPEAT;case THREE.ClampToEdgeWrapping:return c.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return c.MIRRORED_REPEAT;case THREE.NearestFilter:return c.NEAREST;
+case THREE.NearestMipMapNearestFilter:return c.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return c.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return c.LINEAR;case THREE.LinearMipMapNearestFilter:return c.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return c.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return c.BYTE;case THREE.UnsignedByteType:return c.UNSIGNED_BYTE;case THREE.ShortType:return c.SHORT;case THREE.UnsignedShortType:return c.UNSIGNED_SHORT;case THREE.IntType:return c.INT;
+case THREE.UnsignedShortType:return c.UNSIGNED_INT;case THREE.FloatType:return c.FLOAT;case THREE.AlphaFormat:return c.ALPHA;case THREE.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,R=document.createElement("canvas"),pa=[],ra=null,Fa=null,ta=!0,aa=this,ma=null,na=null,ga=null,Y=null,wa=0,qa=0,ya=0,za=0,$=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,
+new THREE.Vector4,new THREE.Vector4],Pa=new THREE.Matrix4,Ua=new Float32Array(16),Ya=new Float32Array(16),Va=new THREE.Vector4,Sa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},Za=!0,$a=!0,xb=new THREE.Color(0),yb=0;if(b){if(b.stencil!=undefined)Za=b.stencil;if(b.antialias!==undefined)$a=b.antialias;b.clearColor!==undefined&&xb.setHex(b.clearColor);if(b.clearAlpha!==undefined)yb=b.clearAlpha}this.maxMorphTargets=8;this.domElement=
+R;this.autoClear=!0;this.sortObjects=!0;(function(f,s,m,n){try{if(!(c=R.getContext("experimental-webgl",{antialias:f,stencil:n})))throw"Error creating WebGL context.";}catch(o){console.error(o)}console.log(navigator.userAgent+" | "+c.getParameter(c.VERSION)+" | "+c.getParameter(c.VENDOR)+" | "+c.getParameter(c.RENDERER)+" | "+c.getParameter(c.SHADING_LANGUAGE_VERSION));c.clearColor(0,0,0,1);c.clearDepth(1);c.enable(c.DEPTH_TEST);c.depthFunc(c.LEQUAL);c.frontFace(c.CCW);c.cullFace(c.BACK);c.enable(c.CULL_FACE);
+c.enable(c.BLEND);c.blendEquation(c.FUNC_ADD);c.blendFunc(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA);c.clearColor(s.r,s.g,s.b,m)})($a,xb,yb,Za);this.context=c;if(Za){var U={};U.vertices=new Float32Array(12);U.faces=new Uint16Array(6);U.darkness=0.5;U.vertices[0]=-20;U.vertices[1]=-20;U.vertices[2]=-1;U.vertices[3]=20;U.vertices[4]=-20;U.vertices[5]=-1;U.vertices[6]=20;U.vertices[7]=20;U.vertices[8]=-1;U.vertices[9]=-20;U.vertices[10]=20;U.vertices[11]=-1;U.faces[0]=0;U.faces[1]=1;U.faces[2]=2;U.faces[3]=
+0;U.faces[4]=2;U.faces[5]=3;U.vertexBuffer=c.createBuffer();U.elementBuffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,U.vertexBuffer);c.bufferData(c.ARRAY_BUFFER,U.vertices,c.STATIC_DRAW);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,U.elementBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,U.faces,c.STATIC_DRAW);U.program=c.createProgram();c.attachShader(U.program,ca("fragment",THREE.ShaderLib.shadowPost.fragmentShader));c.attachShader(U.program,ca("vertex",THREE.ShaderLib.shadowPost.vertexShader));c.linkProgram(U.program);
+U.vertexLocation=c.getAttribLocation(U.program,"position");U.projectionLocation=c.getUniformLocation(U.program,"projectionMatrix");U.darknessLocation=c.getUniformLocation(U.program,"darkness")}var J={};J.vertices=new Float32Array(16);J.faces=new Uint16Array(6);b=0;J.vertices[b++]=-1;J.vertices[b++]=-1;J.vertices[b++]=0;J.vertices[b++]=0;J.vertices[b++]=1;J.vertices[b++]=-1;J.vertices[b++]=1;J.vertices[b++]=0;J.vertices[b++]=1;J.vertices[b++]=1;J.vertices[b++]=1;J.vertices[b++]=1;J.vertices[b++]=-1;
+J.vertices[b++]=1;J.vertices[b++]=0;J.vertices[b++]=1;b=0;J.faces[b++]=0;J.faces[b++]=1;J.faces[b++]=2;J.faces[b++]=0;J.faces[b++]=2;J.faces[b++]=3;J.vertexBuffer=c.createBuffer();J.elementBuffer=c.createBuffer();J.tempTexture=c.createTexture();J.occlusionTexture=c.createTexture();c.bindBuffer(c.ARRAY_BUFFER,J.vertexBuffer);c.bufferData(c.ARRAY_BUFFER,J.vertices,c.STATIC_DRAW);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,J.elementBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,J.faces,c.STATIC_DRAW);c.bindTexture(c.TEXTURE_2D,
+J.tempTexture);c.texImage2D(c.TEXTURE_2D,0,c.RGB,16,16,0,c.RGB,c.UNSIGNED_BYTE,null);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,c.NEAREST);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,c.NEAREST);c.bindTexture(c.TEXTURE_2D,J.occlusionTexture);c.texImage2D(c.TEXTURE_2D,0,c.RGBA,16,16,0,c.RGBA,c.UNSIGNED_BYTE,null);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);
+c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,c.NEAREST);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,c.NEAREST);if(c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0){J.hasVertexTexture=!1;J.program=c.createProgram();c.attachShader(J.program,ca("fragment",THREE.ShaderLib.lensFlare.fragmentShader));c.attachShader(J.program,ca("vertex",THREE.ShaderLib.lensFlare.vertexShader))}else{J.hasVertexTexture=!0;J.program=c.createProgram();
+c.attachShader(J.program,ca("fragment",THREE.ShaderLib.lensFlareVertexTexture.fragmentShader));c.attachShader(J.program,ca("vertex",THREE.ShaderLib.lensFlareVertexTexture.vertexShader))}c.linkProgram(J.program);J.attributes={};J.uniforms={};J.attributes.vertex=c.getAttribLocation(J.program,"position");J.attributes.uv=c.getAttribLocation(J.program,"UV");J.uniforms.renderType=c.getUniformLocation(J.program,"renderType");J.uniforms.map=c.getUniformLocation(J.program,"map");J.uniforms.occlusionMap=c.getUniformLocation(J.program,
+"occlusionMap");J.uniforms.opacity=c.getUniformLocation(J.program,"opacity");J.uniforms.scale=c.getUniformLocation(J.program,"scale");J.uniforms.rotation=c.getUniformLocation(J.program,"rotation");J.uniforms.screenPosition=c.getUniformLocation(J.program,"screenPosition");var sb=!1;_sprite={};_sprite.vertices=new Float32Array(16);_sprite.faces=new Uint16Array(6);b=0;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=0;_sprite.vertices[b++]=0;_sprite.vertices[b++]=1;_sprite.vertices[b++]=
+-1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=0;_sprite.vertices[b++]=1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=0;_sprite.vertices[b++]=1;b=0;_sprite.faces[b++]=0;_sprite.faces[b++]=1;_sprite.faces[b++]=2;_sprite.faces[b++]=0;_sprite.faces[b++]=2;_sprite.faces[b++]=3;_sprite.vertexBuffer=c.createBuffer();_sprite.elementBuffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,_sprite.vertexBuffer);
+c.bufferData(c.ARRAY_BUFFER,_sprite.vertices,c.STATIC_DRAW);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,_sprite.elementBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,_sprite.faces,c.STATIC_DRAW);_sprite.program=c.createProgram();c.attachShader(_sprite.program,ca("fragment",THREE.ShaderLib.sprite.fragmentShader));c.attachShader(_sprite.program,ca("vertex",THREE.ShaderLib.sprite.vertexShader));c.linkProgram(_sprite.program);_sprite.attributes={};_sprite.uniforms={};_sprite.attributes.position=c.getAttribLocation(_sprite.program,
+"position");_sprite.attributes.uv=c.getAttribLocation(_sprite.program,"uv");_sprite.uniforms.uvOffset=c.getUniformLocation(_sprite.program,"uvOffset");_sprite.uniforms.uvScale=c.getUniformLocation(_sprite.program,"uvScale");_sprite.uniforms.rotation=c.getUniformLocation(_sprite.program,"rotation");_sprite.uniforms.scale=c.getUniformLocation(_sprite.program,"scale");_sprite.uniforms.alignment=c.getUniformLocation(_sprite.program,"alignment");_sprite.uniforms.map=c.getUniformLocation(_sprite.program,
+"map");_sprite.uniforms.opacity=c.getUniformLocation(_sprite.program,"opacity");_sprite.uniforms.useScreenCoordinates=c.getUniformLocation(_sprite.program,"useScreenCoordinates");_sprite.uniforms.affectedByDistance=c.getUniformLocation(_sprite.program,"affectedByDistance");_sprite.uniforms.screenPosition=c.getUniformLocation(_sprite.program,"screenPosition");_sprite.uniforms.modelViewMatrix=c.getUniformLocation(_sprite.program,"modelViewMatrix");_sprite.uniforms.projectionMatrix=c.getUniformLocation(_sprite.program,
+"projectionMatrix");var rb=!1;this.setSize=function(f,s){R.width=f;R.height=s;this.setViewport(0,0,R.width,R.height)};this.setViewport=function(f,s,m,n){wa=f;qa=s;ya=m;za=n;c.viewport(wa,qa,ya,za)};this.setScissor=function(f,s,m,n){c.scissor(f,s,m,n)};this.enableScissorTest=function(f){f?c.enable(c.SCISSOR_TEST):c.disable(c.SCISSOR_TEST)};this.enableDepthBufferWrite=function(f){ta=f;c.depthMask(f)};this.setClearColorHex=function(f,s){var m=new THREE.Color(f);c.clearColor(m.r,m.g,m.b,s)};this.setClearColor=
+function(f,s){c.clearColor(f.r,f.g,f.b,s)};this.clear=function(){c.clear(c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT|c.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(f){U.darkness=f};this.initMaterial=function(f,s,m,n){var o,w,x;if(f instanceof THREE.MeshDepthMaterial)x="depth";else if(f instanceof THREE.ShadowVolumeDynamicMaterial)x="shadowVolumeDynamic";else if(f instanceof THREE.MeshNormalMaterial)x="normal";else if(f instanceof THREE.MeshBasicMaterial)x="basic";else if(f instanceof THREE.MeshLambertMaterial)x=
+"lambert";else if(f instanceof THREE.MeshPhongMaterial)x="phong";else if(f instanceof THREE.LineBasicMaterial)x="basic";else f instanceof THREE.ParticleBasicMaterial&&(x="particle_basic");if(x){var u=THREE.ShaderLib[x];f.uniforms=Uniforms.clone(u.uniforms);f.vertexShader=u.vertexShader;f.fragmentShader=u.fragmentShader}var A,t,y;A=y=u=0;for(t=s.length;A<t;A++){w=s[A];w instanceof THREE.DirectionalLight&&y++;w instanceof THREE.PointLight&&u++}if(u+y<=4)s=y;else{s=Math.ceil(4*y/(u+y));u=4-s}w={directional:s,
+point:u};y=50;if(n!==undefined&&n instanceof THREE.SkinnedMesh)y=n.bones.length;var z;a:{A=f.fragmentShader;t=f.vertexShader;u=f.uniforms;s=f.attributes;m={map:!!f.map,envMap:!!f.envMap,lightMap:!!f.lightMap,vertexColors:f.vertexColors,fog:m,sizeAttenuation:f.sizeAttenuation,skinning:f.skinning,morphTargets:f.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:w.directional,maxPointLights:w.point,maxBones:y};var D;w=[];if(x)w.push(x);else{w.push(A);w.push(t)}for(D in m){w.push(D);w.push(m[D])}x=
+w.join();D=0;for(w=pa.length;D<w;D++)if(pa[D].code==x){z=pa[D].program;break a}D=c.createProgram();prefix_fragment=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+m.maxDirLights,"#define MAX_POINT_LIGHTS "+m.maxPointLights,m.fog?"#define USE_FOG":"",m.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",m.map?"#define USE_MAP":"",m.envMap?"#define USE_ENVMAP":"",m.lightMap?"#define USE_LIGHTMAP":"",m.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");
+prefix_vertex=[c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+m.maxDirLights,"#define MAX_POINT_LIGHTS "+m.maxPointLights,"#define MAX_BONES "+m.maxBones,m.map?"#define USE_MAP":"",m.envMap?"#define USE_ENVMAP":"",m.lightMap?"#define USE_LIGHTMAP":"",m.vertexColors?"#define USE_COLOR":"",m.skinning?"#define USE_SKINNING":"",m.morphTargets?"#define USE_MORPHTARGETS":"",m.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
+c.attachShader(D,ca("fragment",prefix_fragment+A));c.attachShader(D,ca("vertex",prefix_vertex+t));c.linkProgram(D);c.getProgramParameter(D,c.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+c.getProgramParameter(D,c.VALIDATE_STATUS)+", gl error ["+c.getError()+"]");D.uniforms={};D.attributes={};var B;A=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(B in u)A.push(B);
+B=A;u=0;for(A=B.length;u<A;u++){t=B[u];D.uniforms[t]=c.getUniformLocation(D,t)}A=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(B=0;B<m.maxMorphTargets;B++)A.push("morphTarget"+B);for(z in s)A.push(z);z=A;B=0;for(s=z.length;B<s;B++){m=z[B];D.attributes[m]=c.getAttribLocation(D,m)}pa.push({program:D,code:x});z=D}f.program=z;z=f.program.attributes;c.enableVertexAttribArray(z.position);z.color>=0&&c.enableVertexAttribArray(z.color);z.normal>=
 0&&c.enableVertexAttribArray(z.normal);z.tangent>=0&&c.enableVertexAttribArray(z.tangent);if(f.skinning&&z.skinVertexA>=0&&z.skinVertexB>=0&&z.skinIndex>=0&&z.skinWeight>=0){c.enableVertexAttribArray(z.skinVertexA);c.enableVertexAttribArray(z.skinVertexB);c.enableVertexAttribArray(z.skinIndex);c.enableVertexAttribArray(z.skinWeight)}for(o in f.attributes)z[o]>=0&&c.enableVertexAttribArray(z[o]);if(f.morphTargets){f.numSupportedMorphTargets=0;if(z.morphTarget0>=0){c.enableVertexAttribArray(z.morphTarget0);
 f.numSupportedMorphTargets++}if(z.morphTarget1>=0){c.enableVertexAttribArray(z.morphTarget1);f.numSupportedMorphTargets++}if(z.morphTarget2>=0){c.enableVertexAttribArray(z.morphTarget2);f.numSupportedMorphTargets++}if(z.morphTarget3>=0){c.enableVertexAttribArray(z.morphTarget3);f.numSupportedMorphTargets++}if(z.morphTarget4>=0){c.enableVertexAttribArray(z.morphTarget4);f.numSupportedMorphTargets++}if(z.morphTarget5>=0){c.enableVertexAttribArray(z.morphTarget5);f.numSupportedMorphTargets++}if(z.morphTarget6>=
-0){c.enableVertexAttribArray(z.morphTarget6);f.numSupportedMorphTargets++}if(z.morphTarget7>=0){c.enableVertexAttribArray(z.morphTarget7);f.numSupportedMorphTargets++}m.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);f=0;for(o=this.maxMorphTargets;f<o;f++)m.__webglMorphTargetInfluences[f]=0}};this.render=function(f,s,n,m){var o,w,x,v,A,t,y,z,G=f.lights,B=f.fog;s.matrixAutoUpdate&&s.updateMatrix();f.update(undefined,!1,s);s.matrixWorldInverse.flattenToArray(Xa);s.projectionMatrix.flattenToArray(Ta);
-Pa.multiply(s.projectionMatrix,s.matrixWorldInverse);p(Pa);this.initWebGLObjects(f);Ia(n);(this.autoClear||m)&&this.clear();A=f.__webglObjects.length;for(m=0;m<A;m++){o=f.__webglObjects[m];y=o.object;if(y.visible)if(!(y instanceof THREE.Mesh)||q(y)){y.matrixWorld.flattenToArray(y._objectMatrixArray);U(y,s);E(o);o.render=!0;if(this.sortObjects){Ua.copy(y.position);Pa.multiplyVector3(Ua);o.z=Ua.z}}else o.render=!1;else o.render=!1}this.sortObjects&&f.__webglObjects.sort(I);t=f.__webglObjectsImmediate.length;
-for(m=0;m<t;m++){o=f.__webglObjectsImmediate[m];y=o.object;if(y.visible){y.matrixAutoUpdate&&y.matrixWorld.flattenToArray(y._objectMatrixArray);U(y,s);D(o)}}oa(THREE.NormalBlending);for(m=0;m<A;m++){o=f.__webglObjects[m];if(o.render){y=o.object;z=o.buffer;x=o.opaque;k(y);for(o=0;o<x.count;o++){v=x.list[o];i(v.depthTest);h(s,G,B,v,z,y)}}}for(m=0;m<t;m++){o=f.__webglObjectsImmediate[m];y=o.object;if(y.visible){x=o.opaque;k(y);for(o=0;o<x.count;o++){v=x.list[o];i(v.depthTest);w=d(s,G,B,v,y);y.render(function(O){g(O,
-w,v.shading)})}}}for(m=0;m<A;m++){o=f.__webglObjects[m];if(o.render){y=o.object;z=o.buffer;x=o.transparent;k(y);for(o=0;o<x.count;o++){v=x.list[o];oa(v.blending);i(v.depthTest);h(s,G,B,v,z,y)}}}for(m=0;m<t;m++){o=f.__webglObjectsImmediate[m];y=o.object;if(y.visible){x=o.transparent;k(y);for(o=0;o<x.count;o++){v=x.list[o];oa(v.blending);i(v.depthTest);w=d(s,G,B,v,y);y.render(function(O){g(O,w,v.shading)})}}}f.__webglSprites.length&&M(f,s);Ya&&f.__webglShadowVolumes.length&&f.lights.length&&F(f);f.__webglLensFlares.length&&
-N(f,s);if(n&&n.minFilter!==THREE.NearestFilter&&n.minFilter!==THREE.LinearFilter){c.bindTexture(c.TEXTURE_2D,n.__webglTexture);c.generateMipmap(c.TEXTURE_2D);c.bindTexture(c.TEXTURE_2D,null)}};this.initWebGLObjects=function(f){if(!f.__webglObjects){f.__webglObjects=[];f.__webglObjectsImmediate=[];f.__webglShadowVolumes=[];f.__webglLensFlares=[];f.__webglSprites=[]}for(;f.__objectsAdded.length;){var s=f.__objectsAdded[0],n=f,m=void 0,o=void 0,w=void 0;if(s._modelViewMatrix==undefined){s._modelViewMatrix=
-new THREE.Matrix4;s._normalMatrixArray=new Float32Array(9);s._modelViewMatrixArray=new Float32Array(16);s._objectMatrixArray=new Float32Array(16);s.matrixWorld.flattenToArray(s._objectMatrixArray)}if(s instanceof THREE.Mesh){o=s.geometry;o.geometryGroups==undefined&&sa(o);for(m in o.geometryGroups){w=o.geometryGroups[m];if(!w.__webglVertexBuffer){var x=w;x.__webglVertexBuffer=c.createBuffer();x.__webglNormalBuffer=c.createBuffer();x.__webglTangentBuffer=c.createBuffer();x.__webglColorBuffer=c.createBuffer();
-x.__webglUVBuffer=c.createBuffer();x.__webglUV2Buffer=c.createBuffer();x.__webglSkinVertexABuffer=c.createBuffer();x.__webglSkinVertexBBuffer=c.createBuffer();x.__webglSkinIndicesBuffer=c.createBuffer();x.__webglSkinWeightsBuffer=c.createBuffer();x.__webglFaceBuffer=c.createBuffer();x.__webglLineBuffer=c.createBuffer();if(x.numMorphTargets){var v=void 0,A=void 0;x.__webglMorphTargetsBuffers=[];v=0;for(A=x.numMorphTargets;v<A;v++)x.__webglMorphTargetsBuffers.push(c.createBuffer())}x=w;v=s;var t=void 0,
-y=void 0,z=void 0;z=void 0;var G=void 0,B=void 0,O=void 0,W=O=A=0;y=void 0;z=void 0;var P=void 0;t=void 0;y=void 0;G=v.geometry;P=G.faces;B=x.faces;t=0;for(y=B.length;t<y;t++){z=B[t];z=P[z];if(z instanceof THREE.Face3){A+=3;O+=1;W+=3}else if(z instanceof THREE.Face4){A+=4;O+=2;W+=4}}t=x;y=v;P=void 0;B=void 0;var X=void 0,Ga=void 0;X=void 0;z=[];P=0;for(B=y.materials.length;P<B;P++){X=y.materials[P];if(X instanceof THREE.MeshFaceMaterial){X=0;for(l=t.materials.length;X<l;X++)(Ga=t.materials[X])&&z.push(Ga)}else(Ga=
-X)&&z.push(Ga)}t=z;a:{y=void 0;P=void 0;B=t.length;for(y=0;y<B;y++){P=t[y];if(P.map||P.lightMap||P instanceof THREE.MeshShaderMaterial){y=!0;break a}}y=!1}a:{P=void 0;B=void 0;z=t.length;for(P=0;P<z;P++){B=t[P];if(!(B instanceof THREE.MeshBasicMaterial&&!B.envMap||B instanceof THREE.MeshDepthMaterial)){P=B&&B.shading!=undefined&&B.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}}P=!1}a:{B=void 0;z=void 0;X=t.length;for(B=0;B<X;B++){z=t[B];if(z.vertexColors){z=z.vertexColors;
-break a}}z=!1}x.__vertexArray=new Float32Array(A*3);if(P)x.__normalArray=new Float32Array(A*3);if(G.hasTangents)x.__tangentArray=new Float32Array(A*4);if(z)x.__colorArray=new Float32Array(A*3);if(y){if(G.faceUvs.length>0||G.faceVertexUvs.length>0)x.__uvArray=new Float32Array(A*2);if(G.faceUvs.length>1||G.faceVertexUvs.length>1)x.__uv2Array=new Float32Array(A*2)}if(v.geometry.skinWeights.length&&v.geometry.skinIndices.length){x.__skinVertexAArray=new Float32Array(A*4);x.__skinVertexBArray=new Float32Array(A*
-4);x.__skinIndexArray=new Float32Array(A*4);x.__skinWeightArray=new Float32Array(A*4)}x.__faceArray=new Uint16Array(O*3+(v.geometry.edgeFaces?v.geometry.edgeFaces.length*6:0));x.__lineArray=new Uint16Array(W*2);if(x.numMorphTargets){x.__morphTargetsArrays=[];G=0;for(B=x.numMorphTargets;G<B;G++)x.__morphTargetsArrays.push(new Float32Array(A*3))}x.__needsSmoothNormals=P==THREE.SmoothShading;x.__uvType=y;x.__vertexColorType=z;x.__normalType=P;x.__webglFaceCount=O*3+(v.geometry.edgeFaces?v.geometry.edgeFaces.length*
-6:0);x.__webglLineCount=W*2;G=0;for(B=t.length;G<B;G++)if(t[G].attributes){x.__webglCustomAttributes={};for(a in t[G].attributes){y=t[G].attributes[a];O=1;if(y.type==="v2")O=2;else if(y.type==="v3")O=3;else if(y.type==="v4")O=4;else y.type==="c"&&(O=3);y.size=O;y.needsUpdate=!0;y.array=new Float32Array(A*O);y.buffer=c.createBuffer();x.__webglCustomAttributes[a]=y}}o.__dirtyVertices=!0;o.__dirtyMorphTargets=!0;o.__dirtyElements=!0;o.__dirtyUvs=!0;o.__dirtyNormals=!0;o.__dirtyTangents=!0;o.__dirtyColors=
-!0}s instanceof THREE.ShadowVolume?da(n.__webglShadowVolumes,w,s):da(n.__webglObjects,w,s)}}else if(s instanceof THREE.LensFlare)da(n.__webglLensFlares,undefined,s);else if(s instanceof THREE.Ribbon){o=s.geometry;if(!o.__webglVertexBuffer){m=o;m.__webglVertexBuffer=c.createBuffer();m.__webglColorBuffer=c.createBuffer();m=o;w=m.vertices.length;m.__vertexArray=new Float32Array(w*3);m.__colorArray=new Float32Array(w*3);m.__webglVertexCount=w;o.__dirtyVertices=!0;o.__dirtyColors=!0}da(n.__webglObjects,
-o,s)}else if(s instanceof THREE.Line){o=s.geometry;if(!o.__webglVertexBuffer){m=o;m.__webglVertexBuffer=c.createBuffer();m.__webglColorBuffer=c.createBuffer();m=o;w=m.vertices.length;m.__vertexArray=new Float32Array(w*3);m.__colorArray=new Float32Array(w*3);m.__webglLineCount=w;o.__dirtyVertices=!0;o.__dirtyColors=!0}da(n.__webglObjects,o,s)}else if(s instanceof THREE.ParticleSystem){o=s.geometry;if(!o.__webglVertexBuffer){m=o;m.__webglVertexBuffer=c.createBuffer();m.__webglColorBuffer=c.createBuffer();
-m=o;w=m.vertices.length;m.__vertexArray=new Float32Array(w*3);m.__colorArray=new Float32Array(w*3);m.__sortArray=[];m.__webglParticleCount=w;o.__dirtyVertices=!0;o.__dirtyColors=!0}da(n.__webglObjects,o,s)}else if(THREE.MarchingCubes!==undefined&&s instanceof THREE.MarchingCubes)n.__webglObjectsImmediate.push({object:s,opaque:{list:[],count:0},transparent:{list:[],count:0}});else s instanceof THREE.Sprite&&n.__webglSprites.push(s);f.__objectsAdded.splice(0,1)}for(;f.__objectsRemoved.length;){s=f.__objectsRemoved[0];
-n=f;o=void 0;m=void 0;for(o=n.__webglObjects.length-1;o>=0;o--){m=n.__webglObjects[o].object;if(s==m){n.__webglObjects.splice(o,1);break}}f.__objectsRemoved.splice(0,1)}s=0;for(n=f.__webglObjects.length;s<n;s++)L(f.__webglObjects[s].object,f);s=0;for(n=f.__webglShadowVolumes.length;s<n;s++)L(f.__webglShadowVolumes[s].object,f);s=0;for(n=f.__webglLensFlares.length;s<n;s++)L(f.__webglLensFlares[s].object,f)};this.setFaceCulling=function(f,s){if(f){!s||s=="ccw"?c.frontFace(c.CCW):c.frontFace(c.CW);if(f==
+0){c.enableVertexAttribArray(z.morphTarget6);f.numSupportedMorphTargets++}if(z.morphTarget7>=0){c.enableVertexAttribArray(z.morphTarget7);f.numSupportedMorphTargets++}n.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);f=0;for(o=this.maxMorphTargets;f<o;f++)n.__webglMorphTargetInfluences[f]=0}};this.render=function(f,s,m,n){var o,w,x,u,A,t,y,z,D=f.lights,B=f.fog;s.matrixAutoUpdate&&s.updateMatrix();f.update(undefined,!1,s);s.matrixWorldInverse.flattenToArray(Ya);s.projectionMatrix.flattenToArray(Ua);
+Pa.multiply(s.projectionMatrix,s.matrixWorldInverse);p(Pa);this.initWebGLObjects(f);Ia(m);(this.autoClear||n)&&this.clear();A=f.__webglObjects.length;for(n=0;n<A;n++){o=f.__webglObjects[n];y=o.object;if(y.visible)if(!(y instanceof THREE.Mesh)||q(y)){y.matrixWorld.flattenToArray(y._objectMatrixArray);V(y,s);G(o);o.render=!0;if(this.sortObjects){Va.copy(y.position);Pa.multiplyVector3(Va);o.z=Va.z}}else o.render=!1;else o.render=!1}this.sortObjects&&f.__webglObjects.sort(I);t=f.__webglObjectsImmediate.length;
+for(n=0;n<t;n++){o=f.__webglObjectsImmediate[n];y=o.object;if(y.visible){y.matrixAutoUpdate&&y.matrixWorld.flattenToArray(y._objectMatrixArray);V(y,s);E(o)}}oa(THREE.NormalBlending);for(n=0;n<A;n++){o=f.__webglObjects[n];if(o.render){y=o.object;z=o.buffer;x=o.opaque;k(y);for(o=0;o<x.count;o++){u=x.list[o];j(u.depthTest);h(s,D,B,u,z,y)}}}for(n=0;n<t;n++){o=f.__webglObjectsImmediate[n];y=o.object;if(y.visible){x=o.opaque;k(y);for(o=0;o<x.count;o++){u=x.list[o];j(u.depthTest);w=e(s,D,B,u,y);y.render(function(N){g(N,
+w,u.shading)})}}}for(n=0;n<A;n++){o=f.__webglObjects[n];if(o.render){y=o.object;z=o.buffer;x=o.transparent;k(y);for(o=0;o<x.count;o++){u=x.list[o];oa(u.blending);j(u.depthTest);h(s,D,B,u,z,y)}}}for(n=0;n<t;n++){o=f.__webglObjectsImmediate[n];y=o.object;if(y.visible){x=o.transparent;k(y);for(o=0;o<x.count;o++){u=x.list[o];oa(u.blending);j(u.depthTest);w=e(s,D,B,u,y);y.render(function(N){g(N,w,u.shading)})}}}f.__webglSprites.length&&L(f,s);Za&&f.__webglShadowVolumes.length&&f.lights.length&&H(f);f.__webglLensFlares.length&&
+M(f,s);if(m&&m.minFilter!==THREE.NearestFilter&&m.minFilter!==THREE.LinearFilter){c.bindTexture(c.TEXTURE_2D,m.__webglTexture);c.generateMipmap(c.TEXTURE_2D);c.bindTexture(c.TEXTURE_2D,null)}};this.initWebGLObjects=function(f){if(!f.__webglObjects){f.__webglObjects=[];f.__webglObjectsImmediate=[];f.__webglShadowVolumes=[];f.__webglLensFlares=[];f.__webglSprites=[]}for(;f.__objectsAdded.length;){var s=f.__objectsAdded[0],m=f,n=void 0,o=void 0,w=void 0;if(s._modelViewMatrix==undefined){s._modelViewMatrix=
+new THREE.Matrix4;s._normalMatrixArray=new Float32Array(9);s._modelViewMatrixArray=new Float32Array(16);s._objectMatrixArray=new Float32Array(16);s.matrixWorld.flattenToArray(s._objectMatrixArray)}if(s instanceof THREE.Mesh){o=s.geometry;o.geometryGroups==undefined&&sa(o);for(n in o.geometryGroups){w=o.geometryGroups[n];if(!w.__webglVertexBuffer){var x=w;x.__webglVertexBuffer=c.createBuffer();x.__webglNormalBuffer=c.createBuffer();x.__webglTangentBuffer=c.createBuffer();x.__webglColorBuffer=c.createBuffer();
+x.__webglUVBuffer=c.createBuffer();x.__webglUV2Buffer=c.createBuffer();x.__webglSkinVertexABuffer=c.createBuffer();x.__webglSkinVertexBBuffer=c.createBuffer();x.__webglSkinIndicesBuffer=c.createBuffer();x.__webglSkinWeightsBuffer=c.createBuffer();x.__webglFaceBuffer=c.createBuffer();x.__webglLineBuffer=c.createBuffer();if(x.numMorphTargets){var u=void 0,A=void 0;x.__webglMorphTargetsBuffers=[];u=0;for(A=x.numMorphTargets;u<A;u++)x.__webglMorphTargetsBuffers.push(c.createBuffer())}x=w;u=s;var t=void 0,
+y=void 0,z=void 0;z=void 0;var D=void 0,B=void 0,N=void 0,W=N=A=0;y=void 0;z=void 0;var O=void 0;t=void 0;y=void 0;D=u.geometry;O=D.faces;B=x.faces;t=0;for(y=B.length;t<y;t++){z=B[t];z=O[z];if(z instanceof THREE.Face3){A+=3;N+=1;W+=3}else if(z instanceof THREE.Face4){A+=4;N+=2;W+=4}}t=x;y=u;O=void 0;B=void 0;var X=void 0,Ga=void 0;X=void 0;z=[];O=0;for(B=y.materials.length;O<B;O++){X=y.materials[O];if(X instanceof THREE.MeshFaceMaterial){X=0;for(l=t.materials.length;X<l;X++)(Ga=t.materials[X])&&z.push(Ga)}else(Ga=
+X)&&z.push(Ga)}t=z;a:{y=void 0;O=void 0;B=t.length;for(y=0;y<B;y++){O=t[y];if(O.map||O.lightMap||O instanceof THREE.MeshShaderMaterial){y=!0;break a}}y=!1}a:{O=void 0;B=void 0;z=t.length;for(O=0;O<z;O++){B=t[O];if(!(B instanceof THREE.MeshBasicMaterial&&!B.envMap||B instanceof THREE.MeshDepthMaterial)){O=B&&B.shading!=undefined&&B.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}}O=!1}a:{B=void 0;z=void 0;X=t.length;for(B=0;B<X;B++){z=t[B];if(z.vertexColors){z=z.vertexColors;
+break a}}z=!1}x.__vertexArray=new Float32Array(A*3);if(O)x.__normalArray=new Float32Array(A*3);if(D.hasTangents)x.__tangentArray=new Float32Array(A*4);if(z)x.__colorArray=new Float32Array(A*3);if(y){if(D.faceUvs.length>0||D.faceVertexUvs.length>0)x.__uvArray=new Float32Array(A*2);if(D.faceUvs.length>1||D.faceVertexUvs.length>1)x.__uv2Array=new Float32Array(A*2)}if(u.geometry.skinWeights.length&&u.geometry.skinIndices.length){x.__skinVertexAArray=new Float32Array(A*4);x.__skinVertexBArray=new Float32Array(A*
+4);x.__skinIndexArray=new Float32Array(A*4);x.__skinWeightArray=new Float32Array(A*4)}x.__faceArray=new Uint16Array(N*3+(u.geometry.edgeFaces?u.geometry.edgeFaces.length*6:0));x.__lineArray=new Uint16Array(W*2);if(x.numMorphTargets){x.__morphTargetsArrays=[];D=0;for(B=x.numMorphTargets;D<B;D++)x.__morphTargetsArrays.push(new Float32Array(A*3))}x.__needsSmoothNormals=O==THREE.SmoothShading;x.__uvType=y;x.__vertexColorType=z;x.__normalType=O;x.__webglFaceCount=N*3+(u.geometry.edgeFaces?u.geometry.edgeFaces.length*
+6:0);x.__webglLineCount=W*2;D=0;for(B=t.length;D<B;D++)if(t[D].attributes){x.__webglCustomAttributes={};for(a in t[D].attributes){y=t[D].attributes[a];N=1;if(y.type==="v2")N=2;else if(y.type==="v3")N=3;else if(y.type==="v4")N=4;else y.type==="c"&&(N=3);y.size=N;y.needsUpdate=!0;y.array=new Float32Array(A*N);y.buffer=c.createBuffer();x.__webglCustomAttributes[a]=y}}o.__dirtyVertices=!0;o.__dirtyMorphTargets=!0;o.__dirtyElements=!0;o.__dirtyUvs=!0;o.__dirtyNormals=!0;o.__dirtyTangents=!0;o.__dirtyColors=
+!0}s instanceof THREE.ShadowVolume?da(m.__webglShadowVolumes,w,s):da(m.__webglObjects,w,s)}}else if(s instanceof THREE.LensFlare)da(m.__webglLensFlares,undefined,s);else if(s instanceof THREE.Ribbon){o=s.geometry;if(!o.__webglVertexBuffer){n=o;n.__webglVertexBuffer=c.createBuffer();n.__webglColorBuffer=c.createBuffer();n=o;w=n.vertices.length;n.__vertexArray=new Float32Array(w*3);n.__colorArray=new Float32Array(w*3);n.__webglVertexCount=w;o.__dirtyVertices=!0;o.__dirtyColors=!0}da(m.__webglObjects,
+o,s)}else if(s instanceof THREE.Line){o=s.geometry;if(!o.__webglVertexBuffer){n=o;n.__webglVertexBuffer=c.createBuffer();n.__webglColorBuffer=c.createBuffer();n=o;w=n.vertices.length;n.__vertexArray=new Float32Array(w*3);n.__colorArray=new Float32Array(w*3);n.__webglLineCount=w;o.__dirtyVertices=!0;o.__dirtyColors=!0}da(m.__webglObjects,o,s)}else if(s instanceof THREE.ParticleSystem){o=s.geometry;if(!o.__webglVertexBuffer){n=o;n.__webglVertexBuffer=c.createBuffer();n.__webglColorBuffer=c.createBuffer();
+n=o;w=n.vertices.length;n.__vertexArray=new Float32Array(w*3);n.__colorArray=new Float32Array(w*3);n.__sortArray=[];n.__webglParticleCount=w;o.__dirtyVertices=!0;o.__dirtyColors=!0}da(m.__webglObjects,o,s)}else if(THREE.MarchingCubes!==undefined&&s instanceof THREE.MarchingCubes)m.__webglObjectsImmediate.push({object:s,opaque:{list:[],count:0},transparent:{list:[],count:0}});else s instanceof THREE.Sprite&&m.__webglSprites.push(s);f.__objectsAdded.splice(0,1)}for(;f.__objectsRemoved.length;){s=f.__objectsRemoved[0];
+m=f;o=void 0;n=void 0;for(o=m.__webglObjects.length-1;o>=0;o--){n=m.__webglObjects[o].object;if(s==n){m.__webglObjects.splice(o,1);break}}f.__objectsRemoved.splice(0,1)}s=0;for(m=f.__webglObjects.length;s<m;s++)P(f.__webglObjects[s].object,f);s=0;for(m=f.__webglShadowVolumes.length;s<m;s++)P(f.__webglShadowVolumes[s].object,f);s=0;for(m=f.__webglLensFlares.length;s<m;s++)P(f.__webglLensFlares[s].object,f)};this.setFaceCulling=function(f,s){if(f){!s||s=="ccw"?c.frontFace(c.CCW):c.frontFace(c.CW);if(f==
 "back")c.cullFace(c.BACK);else f=="front"?c.cullFace(c.FRONT):c.cullFace(c.FRONT_AND_BACK);c.enable(c.CULL_FACE)}else c.disable(c.CULL_FACE)};this.supportsVertexTextures=function(){return c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};
-THREE.WebGLRenderTarget=function(b,e,d){this.width=b;this.height=e;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.RGBAFormat;this.type=d.type!==undefined?d.type:THREE.UnsignedByteType;this.depthBuffer=d.depthBuffer!==
-undefined?d.depthBuffer:!0;this.stencilBuffer=d.stencilBuffer!==undefined?d.stencilBuffer:!0};
+THREE.WebGLRenderTarget=function(b,d,e){this.width=b;this.height=d;e=e||{};this.wrapS=e.wrapS!==undefined?e.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=e.wrapT!==undefined?e.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=e.magFilter!==undefined?e.magFilter:THREE.LinearFilter;this.minFilter=e.minFilter!==undefined?e.minFilter:THREE.LinearMipMapLinearFilter;this.format=e.format!==undefined?e.format:THREE.RGBAFormat;this.type=e.type!==undefined?e.type:THREE.UnsignedByteType;this.depthBuffer=e.depthBuffer!==
+undefined?e.depthBuffer:!0;this.stencilBuffer=e.stencilBuffer!==undefined?e.stencilBuffer:!0};

+ 1 - 1
examples/misc_sound.html

@@ -160,7 +160,7 @@
 				postprocessing.camera.projectionMatrix = THREE.Matrix4.makeOrtho( window.innerWidth / - 2, window.innerWidth / 2,  window.innerHeight / 2, window.innerHeight / - 2, -10000, 10000 );
 				postprocessing.camera.position.z = 100;
 
-				var pars = { minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter };
+				var pars = { minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter, format: THREE.RGBFormat };
 				postprocessing.rtTexture1 = new THREE.WebGLRenderTarget( window.innerWidth, window.innerHeight, pars );
 				postprocessing.rtTexture2 = new THREE.WebGLRenderTarget( 512, 512, pars );
 				postprocessing.rtTexture3 = new THREE.WebGLRenderTarget( 512, 512, pars );

+ 1 - 1
examples/webgl_lines_colors.html

@@ -200,7 +200,7 @@
 				postprocessing.camera.projectionMatrix = THREE.Matrix4.makeOrtho( window.innerWidth / - 2, window.innerWidth / 2,  window.innerHeight / 2, window.innerHeight / - 2, -10000, 10000 );
 				postprocessing.camera.position.z = 100;
 
-				var pars = { minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter };
+				var pars = { minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter, format: THREE.RGBFormat };
 				postprocessing.rtTexture1 = new THREE.WebGLRenderTarget( window.innerWidth, window.innerHeight, pars );
 				postprocessing.rtTexture2 = new THREE.WebGLRenderTarget( 512, 512, pars );
 				postprocessing.rtTexture3 = new THREE.WebGLRenderTarget( 512, 512, pars );

+ 1 - 1
examples/webgl_materials_video.html

@@ -203,7 +203,7 @@
 				postprocessing.camera.projectionMatrix = THREE.Matrix4.makeOrtho( window.innerWidth / - 2, window.innerWidth / 2,  window.innerHeight / 2, window.innerHeight / - 2, -10000, 10000 );
 				postprocessing.camera.position.z = 100;
 
-				var pars = { minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter };
+				var pars = { minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter, format: THREE.RGBFormat };
 				postprocessing.rtTexture1 = new THREE.WebGLRenderTarget( window.innerWidth, window.innerHeight, pars );
 				postprocessing.rtTexture2 = new THREE.WebGLRenderTarget( 512, 512, pars );
 				postprocessing.rtTexture3 = new THREE.WebGLRenderTarget( 512, 512, pars );

+ 5 - 3
examples/webgl_postprocessing.html

@@ -107,9 +107,11 @@
 				directionalLight.position.normalize();
 				sceneModel.addLight( directionalLight );
 
-				rtTexture1 = new THREE.WebGLRenderTarget( window.innerWidth, window.innerHeight, { minFilter: THREE.LinearFilter, magFilter: THREE.NearestFilter } );
-				rtTexture2 = new THREE.WebGLRenderTarget( 256, 512, { minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter } );
-				rtTexture3 = new THREE.WebGLRenderTarget( 512, 256, { minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter } );
+				var pars1 = { minFilter: THREE.LinearFilter, magFilter: THREE.NearestFilter, format: THREE.RGBFormat },
+					pars2 = { minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter,  format: THREE.RGBFormat };
+				rtTexture1 = new THREE.WebGLRenderTarget( window.innerWidth, window.innerHeight, pars1 );
+				rtTexture2 = new THREE.WebGLRenderTarget( 256, 512, pars2 );
+				rtTexture3 = new THREE.WebGLRenderTarget( 512, 256, pars2 );
 
 				materialColor = new THREE.MeshShaderMaterial( {
 

+ 1 - 1
examples/webgl_postprocessing_dof.html

@@ -238,7 +238,7 @@
 				postprocessing.camera.projectionMatrix = THREE.Matrix4.makeOrtho( window.innerWidth / - 2, window.innerWidth / 2,  window.innerHeight / 2, window.innerHeight / - 2, -10000, 10000 );
 				postprocessing.camera.position.z = 100;
 
-				var pars = { minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter };
+				var pars = { minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter, format: THREE.RGBFormat };
 				postprocessing.rtTextureDepth = new THREE.WebGLRenderTarget( window.innerWidth, height, pars );
 				postprocessing.rtTextureColor = new THREE.WebGLRenderTarget( window.innerWidth, height, pars );
 

+ 1 - 1
examples/webgl_ribbons.html

@@ -231,7 +231,7 @@
 				postprocessing.camera.projectionMatrix = THREE.Matrix4.makeOrtho( window.innerWidth / - 2, window.innerWidth / 2,  window.innerHeight / 2, window.innerHeight / - 2, -10000, 10000 );
 				postprocessing.camera.position.z = 100;
 
-				var pars = { minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter };
+				var pars = { minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter, format: THREE.RGBFormat };
 				postprocessing.rtTexture1 = new THREE.WebGLRenderTarget( window.innerWidth, window.innerHeight, pars );
 				postprocessing.rtTexture2 = new THREE.WebGLRenderTarget( 512, 512, pars );
 				postprocessing.rtTexture3 = new THREE.WebGLRenderTarget( 512, 512, pars );

+ 1 - 1
examples/webgl_rtt.html

@@ -130,7 +130,7 @@
 				light.position.normalize();
 				sceneRTT.addLight( light );
 
-				rtTexture = new THREE.WebGLRenderTarget( window.innerWidth, window.innerHeight, { minFilter: THREE.LinearFilter, magFilter: THREE.NearestFilter } );
+				rtTexture = new THREE.WebGLRenderTarget( window.innerWidth, window.innerHeight, { minFilter: THREE.LinearFilter, magFilter: THREE.NearestFilter, format: THREE.RGBFormat } );
 
 				material = new THREE.MeshShaderMaterial( {
 

+ 1 - 1
examples/webgl_shader_lava.html

@@ -207,7 +207,7 @@
 				postprocessing.camera.projectionMatrix = THREE.Matrix4.makeOrtho( window.innerWidth / - 2, window.innerWidth / 2,  window.innerHeight / 2, window.innerHeight / - 2, -10000, 10000 );
 				postprocessing.camera.position.z = 100;
 
-				var pars = { minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter };
+				var pars = { minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter, format: THREE.RGBFormat };
 				postprocessing.rtTexture1 = new THREE.WebGLRenderTarget( window.innerWidth, window.innerHeight, pars );
 				postprocessing.rtTexture2 = new THREE.WebGLRenderTarget( 512, 512, pars );
 				postprocessing.rtTexture3 = new THREE.WebGLRenderTarget( 512, 512, pars );

+ 30 - 12
src/renderers/WebGLRenderer.js

@@ -215,9 +215,10 @@ THREE.WebGLRenderer = function ( parameters ) {
 	_lensFlare.uniforms.rotation       = _gl.getUniformLocation( _lensFlare.program, "rotation" );
 	_lensFlare.uniforms.screenPosition = _gl.getUniformLocation( _lensFlare.program, "screenPosition" );
 
-	_gl.enableVertexAttribArray( _lensFlare.attributes.vertex );
-	_gl.enableVertexAttribArray( _lensFlare.attributes.uv );
+	//_gl.enableVertexAttribArray( _lensFlare.attributes.vertex );
+	//_gl.enableVertexAttribArray( _lensFlare.attributes.uv );
 
+	var _lensFlareAttributesEnabled = false;
 
 	// prepare sprites
 	
@@ -272,9 +273,10 @@ THREE.WebGLRenderer = function ( parameters ) {
 	_sprite.uniforms.modelViewMatrix      = _gl.getUniformLocation( _sprite.program, "modelViewMatrix" );
 	_sprite.uniforms.projectionMatrix     = _gl.getUniformLocation( _sprite.program, "projectionMatrix" );
 
-	_gl.enableVertexAttribArray( _sprite.attributes.position );
-	_gl.enableVertexAttribArray( _sprite.attributes.uv );
+	//_gl.enableVertexAttribArray( _sprite.attributes.position );
+	//_gl.enableVertexAttribArray( _sprite.attributes.uv );
 
+	var _spriteAttributesEnabled = false;
 
 	this.setSize = function ( width, height ) {
 
@@ -2064,7 +2066,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 	function refreshUniformsCommon( uniforms, material ) {
 
-		uniforms.diffuse.value.setRGB( material.color.r, material.color.g, material.color.b );
+		uniforms.diffuse.value = material.color;
 		uniforms.opacity.value = material.opacity;
 		uniforms.map.texture = material.map;
 
@@ -2080,14 +2082,14 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 	function refreshUniformsLine( uniforms, material ) {
 
-		uniforms.diffuse.value.setRGB( material.color.r, material.color.g, material.color.b );
+		uniforms.diffuse.value = material.color;
 		uniforms.opacity.value = material.opacity;
 
 	};
 
 	function refreshUniformsParticle( uniforms, material ) {
 
-		uniforms.psColor.value.setRGB( material.color.r, material.color.g, material.color.b );
+		uniforms.psColor.value = material.color;
 		uniforms.opacity.value = material.opacity;
 		uniforms.size.value = material.size;
 		uniforms.scale.value = _canvas.height / 2.0; // TODO: Cache this.
@@ -2097,7 +2099,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 	function refreshUniformsFog( uniforms, fog ) {
 
-		uniforms.fogColor.value.setHex( fog.color.hex );
+		uniforms.fogColor.value = fog.color;
 
 		if ( fog instanceof THREE.Fog ) {
 
@@ -2114,10 +2116,8 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 	function refreshUniformsPhong( uniforms, material ) {
 
-		//uniforms.ambient.value.setHex( material.ambient.hex );
-		//uniforms.specular.value.setHex( material.specular.hex );
-		uniforms.ambient.value.setRGB( material.ambient.r, material.ambient.g, material.ambient.b );
-		uniforms.specular.value.setRGB( material.specular.r, material.specular.g, material.specular.b );
+		uniforms.ambient.value = material.ambient;
+		uniforms.specular.value = material.specular;
 		uniforms.shininess.value = material.shininess;
 
 	};
@@ -3335,6 +3335,15 @@ THREE.WebGLRenderer = function ( parameters ) {
 		_currentProgram = _sprite.program;
 		_oldBlending = "";
 
+		if ( !_spriteAttributesEnabled ) {
+	
+			_gl.enableVertexAttribArray( _sprite.attributes.position );
+			_gl.enableVertexAttribArray( _sprite.attributes.uv );
+			
+			_spriteAttributesEnabled = true;
+
+		}
+		
 		_gl.disable( _gl.CULL_FACE );
 		_gl.enable( _gl.BLEND );
 		_gl.depthMask( true );
@@ -3491,6 +3500,15 @@ THREE.WebGLRenderer = function ( parameters ) {
 		_oldBlending = "";
 
 
+		if ( ! _lensFlareAttributesEnabled ) {
+		
+			_gl.enableVertexAttribArray( _lensFlare.attributes.vertex );
+			_gl.enableVertexAttribArray( _lensFlare.attributes.uv );
+			
+			_lensFlareAttributesEnabled = true;
+
+		}
+
 		// loop through all lens flares to update their occlusion and positions
 		// setup gl and common used attribs/unforms
 

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно