Jelajahi Sumber

WebGLRenderer: Added internal cache for compiled shaders. Already compiled shaders get reused.

Mr.doob 14 tahun lalu
induk
melakukan
29da25e746

+ 2 - 1
README.md

@@ -141,7 +141,7 @@ This code creates a camera, then creates a scene, adds a cube on it, creates a &
 
 ### Change Log ###
 
-2011 03 31 - **r38** (225.720 KB, gzip: 55.881 KB)
+2011 03 31 - **r38** (225.442 KB, gzip: 55.908 KB)
 
 * Added `LensFlare` light. ([empaempa](http://github.com/empaempa))
 * Added `ShadowVolume` object (stencil shadows). ([empaempa](http://github.com/empaempa))
@@ -151,6 +151,7 @@ This code creates a camera, then creates a scene, adds a cube on it, creates a &
 * Minor WebGL blend mode clean up. ([mrdoob](http://github.com/mrdoob))
 * *Materials now extend Material ([mrdoob](http://github.com/mrdoob))
 * `material.transparent` define whether material is transparent or not (before we were guessing). ([mrdoob](http://github.com/mrdoob))
+* Added internal program cache to WebGLRenderer (reuse already available programs). ([mrdoob](http://github.com/mrdoob))
 
 
 2011 03 22 - **r37** (208.495 KB, gzip: 51.376 KB)

File diff ditekan karena terlalu besar
+ 203 - 202
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 f=Math.cos(c);c=Math.sin(c);var g=a*b,i=e*d;this.w=g*f-i*c;this.x=g*c+i*f;this.y=e*b*f+a*d*c;this.z=a*d*f-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,f=a.x,g=a.y,i=a.z;a=a.w;this.x=b*a+d*f+c*i-e*g;this.y=c*a+d*g+e*f-b*i;this.z=e*a+d*i+b*g-c*f;this.w=d*a-b*f-c*g-e*i;return this},
 multiplyVector3:function(a,b){b||(b=a);var c=a.x,e=a.y,d=a.z,f=this.x,g=this.y,i=this.z,h=this.w,j=h*c+g*d-i*e,k=h*e+i*c-f*d,n=h*d+f*e-g*c;c=-f*c-g*e-i*d;b.x=j*h+c*-f+k*-i-n*-g;b.y=k*h+c*-g+n*-f-j*-i;b.z=n*h+c*-i+j*-g-k*-f;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 f=Math.acos(d),g=Math.sqrt(1-d*d);if(Math.abs(g)<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)*f)/g;e=Math.sin(e*f)/g;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 f=Math.acos(d),g=Math.sqrt(1-d*d);if(Math.abs(g)<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)*f)/g;e=Math.sin(e*f)/g;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,f){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=f instanceof Array?f:[f];this.centroid=new THREE.Vector3};
 THREE.Face4=function(a,b,c,e,d,f,g){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=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];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.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];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,m=h*e+i*c-g*d,l=h*d+g*e-f*c;c=-g*c-f*e-i*d;b.x=j*h+c*-g+m*-i-l*-f;b.y=m*h+c*-f+l*-g-j*-i;b.z=l*h+c*-i+j*-f-m*-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.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.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.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}};

+ 3 - 3
build/custom/ThreeExtras.js

@@ -24,7 +24,7 @@ value:0,texture:null},uImageIncrement:{type:"v2",value:new THREE.Vector2(0.00195
 film:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},time:{type:"f",value:0},nIntensity:{type:"f",value:0.5},sIntensity:{type:"f",value:0.05},sCount:{type:"f",value:4096},grayscale:{type:"i",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float time;\nuniform bool grayscale;\nuniform float nIntensity;\nuniform float sIntensity;\nuniform float sCount;\nvoid main() {\nvec4 cTextureScreen = texture2D( tDiffuse, vUv );\nfloat x = vUv.x * vUv.y * time *  1000.0;\nx = mod( x, 13.0 ) * mod( x, 123.0 );\nfloat dx = mod( x, 0.01 );\nvec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx * 100.0, 0.0, 1.0 );\nvec2 sc = vec2( sin( vUv.y * sCount ), cos( vUv.y * sCount ) );\ncResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * sIntensity;\ncResult = cTextureScreen.rgb + clamp( nIntensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );\nif( grayscale ) {\ncResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );\n}\ngl_FragColor =  vec4( cResult, cTextureScreen.a );\n}"},
 screen:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},opacity:{type:"f",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float opacity;\nvoid main() {\nvec4 texel = texture2D( tDiffuse, vUv );\ngl_FragColor = opacity * texel;\n}"},basic:{uniforms:{},vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",
 fragmentShader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(a){var f,b,c,e,d=2*Math.ceil(a*3)+1;d>25&&(d=25);e=(d-1)*0.5;b=Array(d);for(f=c=0;f<d;++f){b[f]=Math.exp(-((f-e)*(f-e))/(2*a*a));c+=b[f]}for(f=0;f<d;++f)b[f]/=c;return b}};
-THREE.QuakeCamera=function(a){function f(b,c){return function(){c.apply(b,arguments)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.domElement=document;if(a){if(a.movementSpeed!==undefined)this.movementSpeed=a.movementSpeed;if(a.lookSpeed!==undefined)this.lookSpeed=a.lookSpeed;if(a.noFly!==undefined)this.noFly=
+THREE.QuakeCamera=function(a){function f(b,c){return function(){c.apply(b,arguments)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.movementSpeed=1;this.lookSpeed=0.005;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.domElement=document;if(a){if(a.movementSpeed!==undefined)this.movementSpeed=a.movementSpeed;if(a.lookSpeed!==undefined)this.lookSpeed=a.lookSpeed;if(a.noFly!==undefined)this.noFly=
 a.noFly;if(a.lookVertical!==undefined)this.lookVertical=a.lookVertical;if(a.autoForward!==undefined)this.autoForward=a.autoForward;if(a.activeLook!==undefined)this.activeLook=a.activeLook;if(a.heightSpeed!==undefined)this.heightSpeed=a.heightSpeed;if(a.heightCoef!==undefined)this.heightCoef=a.heightCoef;if(a.heightMin!==undefined)this.heightMin=a.heightMin;if(a.heightMax!==undefined)this.heightMax=a.heightMax;if(a.domElement!==undefined)this.domElement=a.domElement}this.theta=this.phi=this.lon=this.lat=
 this.mouseY=this.mouseX=this.autoSpeedFactor=0;this.moveForward=!1;this.moveBackward=!1;this.moveLeft=!1;this.moveRight=!1;this.mouseDragOn=!1;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;this.onMouseDown=function(b){b.preventDefault();b.stopPropagation();if(this.activeLook)switch(b.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(b){b.preventDefault();b.stopPropagation();if(this.activeLook)switch(b.button){case 0:this.moveForward=
 !1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(b){this.mouseX=b.clientX-this.windowHalfX;this.mouseY=b.clientY-this.windowHalfY};this.onKeyDown=function(b){switch(b.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:case 65:this.moveLeft=!0;break;case 40:case 83:this.moveBackward=!0;break;case 39:case 68:this.moveRight=!0}};this.onKeyUp=function(b){switch(b.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=!1;break;case 40:case 83:this.moveBackward=
@@ -34,7 +34,7 @@ var b=this.lookSpeed;this.activeLook||(b=0);this.lon+=this.mouseX*b;this.lookVer
 THREE.QuakeCamera.prototype.translate=function(a,f){this.matrix.rotateAxis(f);if(this.noFly)f.y=0;this.position.addSelf(f.multiplyScalar(a));this.target.position.addSelf(f.multiplyScalar(a))};
 THREE.PathCamera=function(a){function f(k,j,n,p){var t={name:n,fps:0.6,length:p,hierarchy:[]},x,w=j.getControlPointsArray(),u=j.getLength(),B=w.length,y=0;x=B-1;j={parent:-1,keys:[]};j.keys[0]={time:0,pos:w[0],rot:[0,0,0,1],scl:[1,1,1]};j.keys[x]={time:p,pos:w[x],rot:[0,0,0,1],scl:[1,1,1]};for(x=1;x<B-1;x++){y=p*u.chunks[x]/u.total;j.keys[x]={time:y,pos:w[x]}}t.hierarchy[0]=j;THREE.AnimationHandler.add(t);return new THREE.Animation(k,n,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function b(k,j){var n,
 p,t=new THREE.Geometry;for(n=0;n<k.points.length*j;n++){p=n/(k.points.length*j);p=k.getPoint(p);t.vertices[n]=new THREE.Vertex(new THREE.Vector3(p.x,p.y,p.z))}return t}function c(k,j){var n=b(j,10),p=b(j,10),t=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(n,t);particleObj=new THREE.ParticleSystem(p,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);k.addChild(lineObj);particleObj.scale.set(1,1,1);k.addChild(particleObj);p=new Sphere(1,
-16,8);t=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<j.points.length;i++){n=new THREE.Mesh(p,t);n.position.copy(j.points[i]);n.updateMatrix();k.addChild(n)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.id="PathCamera"+THREE.PathCameraIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookVertical=
+16,8);t=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<j.points.length;i++){n=new THREE.Mesh(p,t);n.position.copy(j.points[i]);n.updateMatrix();k.addChild(n)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.id="PathCamera"+THREE.PathCameraIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.005;this.lookVertical=
 !0;this.lookHorizontal=!0;this.verticalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.horizontalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.domElement=document;if(a){if(a.duration!==undefined)this.duration=a.duration*1E3;if(a.waypoints!==undefined)this.waypoints=a.waypoints;if(a.useConstantSpeed!==undefined)this.useConstantSpeed=a.useConstantSpeed;if(a.resamplingCoef!==undefined)this.resamplingCoef=a.resamplingCoef;if(a.createDebugPath!==undefined)this.createDebugPath=a.createDebugPath;
 if(a.createDebugDummy!==undefined)this.createDebugDummy=a.createDebugDummy;if(a.lookSpeed!==undefined)this.lookSpeed=a.lookSpeed;if(a.lookVertical!==undefined)this.lookVertical=a.lookVertical;if(a.lookHorizontal!==undefined)this.lookHorizontal=a.lookHorizontal;if(a.verticalAngleMap!==undefined)this.verticalAngleMap=a.verticalAngleMap;if(a.horizontalAngleMap!==undefined)this.horizontalAngleMap=a.horizontalAngleMap;if(a.domElement!==undefined)this.domElement=a.domElement}this.theta=this.phi=this.lon=
 this.lat=this.mouseY=this.mouseX=0;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;var e=Math.PI*2,d=Math.PI/180;this.update=function(k,j,n){var p,t;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*d;this.theta=this.lon*d;p=this.phi%e;this.phi=p>=0?p:p+e;p=this.verticalAngleMap.srcRange;t=this.verticalAngleMap.dstRange;
@@ -50,7 +50,7 @@ for(c=a+a/2;c<2*a;c++)h.faces.push(new THREE.Face4(2*a+1,(2*c-2*a+2)%a+a,(2*c-2*
 var Icosahedron=function(a){function f(n,p,t){var x=Math.sqrt(n*n+p*p+t*t);return e.vertices.push(new THREE.Vertex(new THREE.Vector3(n/x,p/x,t/x)))-1}function b(n,p,t,x){x.faces.push(new THREE.Face3(n,p,t))}function c(n,p){var t=e.vertices[n].position,x=e.vertices[p].position;return f((t.x+x.x)/2,(t.y+x.y)/2,(t.z+x.z)/2)}var e=this,d=new THREE.Geometry,g;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;f(-1,a,0);f(1,a,0);f(-1,-a,0);f(1,-a,0);f(0,-1,a);f(0,1,a);f(0,-1,-a);f(0,
 1,-a);f(a,0,-1);f(a,0,1);f(-a,0,-1);f(-a,0,1);b(0,11,5,d);b(0,5,1,d);b(0,1,7,d);b(0,7,10,d);b(0,10,11,d);b(1,5,9,d);b(5,11,4,d);b(11,10,2,d);b(10,7,6,d);b(7,1,8,d);b(3,9,4,d);b(3,4,2,d);b(3,2,6,d);b(3,6,8,d);b(3,8,9,d);b(4,9,5,d);b(2,4,11,d);b(6,2,10,d);b(8,6,7,d);b(9,8,1,d);for(a=0;a<this.subdivisions;a++){g=new THREE.Geometry;for(var h in d.faces){var m=c(d.faces[h].a,d.faces[h].b),k=c(d.faces[h].b,d.faces[h].c),j=c(d.faces[h].c,d.faces[h].a);b(d.faces[h].a,m,j,g);b(d.faces[h].b,k,m,g);b(d.faces[h].c,
 j,k,g);b(m,k,j,g)}d.faces=g.faces}e.faces=d.faces;delete d;delete g;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Icosahedron.prototype=new THREE.Geometry;Icosahedron.prototype.constructor=Icosahedron;
-function Lathe(a,f,b){THREE.Geometry.call(this);this.steps=f||12;this.angle=b||2*Math.PI;f=this.angle/this.steps;for(var c=[],e=[],d=[],g=[],h=0;h<a.length;h++){this.vertices.push(new THREE.Vertex(a[h]));c[h]=a[h].clone();e[h]=this.vertices.length-1}for(var m=(new THREE.Matrix4).setRotationZ(f),k=0;k<=this.angle+0.0010;k+=f){for(h=0;h<c.length;h++)if(k<this.angle){c[h]=m.multiplyVector3(c[h].clone());this.vertices.push(new THREE.Vertex(c[h]));d[h]=this.vertices.length-1}else d=g;k==0&&(g=e);for(h=
+function Lathe(a,f,b){THREE.Geometry.call(this);this.steps=f||12;this.angle=b||2*Math.PI;f=this.angle/this.steps;for(var c=[],e=[],d=[],g=[],h=0;h<a.length;h++){this.vertices.push(new THREE.Vertex(a[h]));c[h]=a[h].clone();e[h]=this.vertices.length-1}for(var m=(new THREE.Matrix4).setRotationZ(f),k=0;k<=this.angle+0.001;k+=f){for(h=0;h<c.length;h++)if(k<this.angle){c[h]=m.multiplyVector3(c[h].clone());this.vertices.push(new THREE.Vertex(c[h]));d[h]=this.vertices.length-1}else d=g;k==0&&(g=e);for(h=
 0;h<e.length-1;h++){this.faces.push(new THREE.Face4(d[h],d[h+1],e[h+1],e[h]));this.faceVertexUvs[0].push([new THREE.UV(k/b,h/a.length),new THREE.UV(k/b,(h+1)/a.length),new THREE.UV((k-f)/b,(h+1)/a.length),new THREE.UV((k-f)/b,h/a.length)])}e=d;d=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()}Lathe.prototype=new THREE.Geometry;Lathe.prototype.constructor=Lathe;
 var Plane=function(a,f,b,c){THREE.Geometry.call(this);var e,d=a/2,g=f/2;b=b||1;c=c||1;var h=b+1,m=c+1;a/=b;var k=f/c;for(e=0;e<m;e++)for(f=0;f<h;f++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(f*a-d,-(e*k-g),0)));for(e=0;e<c;e++)for(f=0;f<b;f++){this.faces.push(new THREE.Face4(f+h*e,f+h*(e+1),f+1+h*(e+1),f+1+h*e));this.faceVertexUvs[0].push([new THREE.UV(f/b,e/c),new THREE.UV(f/b,(e+1)/c),new THREE.UV((f+1)/b,(e+1)/c),new THREE.UV((f+1)/b,e/c)])}this.computeCentroids();this.computeFaceNormals()};
 Plane.prototype=new THREE.Geometry;Plane.prototype.constructor=Plane;

+ 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 f=Math.cos(c);c=Math.sin(c);var g=a*b,i=e*d;this.w=g*f-i*c;this.x=g*c+i*f;this.y=e*b*f+a*d*c;this.z=a*d*f-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,f=a.x,g=a.y,i=a.z;a=a.w;this.x=b*a+d*f+c*i-e*g;this.y=c*a+d*g+e*f-b*i;this.z=e*a+d*i+b*g-c*f;this.w=d*a-b*f-c*g-e*i;return this},
 multiplyVector3:function(a,b){b||(b=a);var c=a.x,e=a.y,d=a.z,f=this.x,g=this.y,i=this.z,h=this.w,j=h*c+g*d-i*e,m=h*e+i*c-f*d,l=h*d+f*e-g*c;c=-f*c-g*e-i*d;b.x=j*h+c*-f+m*-i-l*-g;b.y=m*h+c*-g+l*-f-j*-i;b.z=l*h+c*-i+j*-g-m*-f;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 f=Math.acos(d),g=Math.sqrt(1-d*d);if(Math.abs(g)<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)*f)/g;e=Math.sin(e*f)/g;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 f=Math.acos(d),g=Math.sqrt(1-d*d);if(Math.abs(g)<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)*f)/g;e=Math.sin(e*f)/g;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,f){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=f instanceof Array?f:[f];this.centroid=new THREE.Vector3};
 THREE.Face4=function(a,b,c,e,d,f,g){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=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];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.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};

+ 141 - 141
build/custom/ThreeWebGL.js

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

+ 31 - 1
src/renderers/WebGLRenderer.js

@@ -22,6 +22,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 	var _gl,
 	_canvas = document.createElement( 'canvas' ),
+	_programs = [],
 	_currentProgram = null,
 	_currentFramebuffer = null,
 	_currentDepthMask = true,
@@ -3761,7 +3762,34 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 	function buildProgram ( fragmentShader, vertexShader, parameters ) {
 
-		var program = _gl.createProgram(),
+		var p, pl, program, code;
+
+		// Generate code
+
+		code = fragmentShader + "\n\n" + vertexShader + "\n\n";
+
+		for ( p in parameters ) {
+
+			code += p + ": " + parameters[ p ] + ",\n";
+
+		}
+
+		// Check if code has been already compiled
+
+		for ( p = 0, pl = _programs.length; p < pl; p ++ ) {
+
+			if ( _programs[ p ].code == code ) {
+
+				// console.log( "Code already compiled." /*: \n\n" + code*/ );
+				return _programs[ p ].program;
+
+			}
+
+		}
+
+		//
+
+		program = _gl.createProgram(),
 
 		prefix_fragment = [
 			"#ifdef GL_ES",
@@ -3864,6 +3892,8 @@ THREE.WebGLRenderer = function ( parameters ) {
 		program.uniforms = {};
 		program.attributes = {};
 
+		_programs.push( { program: program, code: code } );
+
 		return program;
 
 	};

Beberapa file tidak ditampilkan karena terlalu banyak file yang berubah dalam diff ini