Browse Source

Added missing classes to custom builds.

Mr.doob 14 years ago
parent
commit
565f9221e3
7 changed files with 373 additions and 281 deletions
  1. 4 4
      build/Three.js
  2. 70 53
      build/custom/ThreeCanvas.js
  3. 69 51
      build/custom/ThreeDOM.js
  4. 3 3
      build/custom/ThreeExtras.js
  5. 63 46
      build/custom/ThreeSVG.js
  6. 153 122
      build/custom/ThreeWebGL.js
  7. 11 2
      utils/build.py

+ 4 - 4
build/Three.js

@@ -48,7 +48,7 @@ d;a++)this.children[a].update(this.matrixWorld,c,b)}}};THREE.Quaternion=function
 THREE.Quaternion.prototype={set:function(a,c,b,d){this.x=a;this.y=c;this.z=b;this.w=d;return this},setFromEuler:function(a){var c=0.5*Math.PI/360,b=a.x*c,d=a.y*c,e=a.z*c;a=Math.cos(d);d=Math.sin(d);c=Math.cos(-e);e=Math.sin(-e);var g=Math.cos(b);b=Math.sin(b);var h=a*c,j=d*e;this.w=h*g-j*b;this.x=h*b+j*g;this.y=d*c*g+a*e*b;this.z=a*e*g-d*c*b;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
 -1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var c=this.x,b=this.y,d=this.z,e=this.w,g=a.x,h=a.y,j=a.z;a=a.w;this.x=c*a+e*g+b*j-d*h;this.y=b*a+e*h+d*g-c*j;this.z=d*a+e*j+c*h-b*g;this.w=e*a-c*g-b*h-d*j;return this},
 multiplyVector3:function(a,c){c||(c=a);var b=a.x,d=a.y,e=a.z,g=this.x,h=this.y,j=this.z,k=this.w,m=k*b+h*e-j*d,t=k*d+j*b-g*e,w=k*e+g*d-h*b;b=-g*b-h*d-j*e;c.x=m*k+b*-g+t*-j-w*-h;c.y=t*k+b*-h+w*-g-m*-j;c.z=w*k+b*-j+m*-h-t*-g;return c}};
-THREE.Quaternion.slerp=function(a,c,b,d){var e=a.w*c.w+a.x*c.x+a.y*c.y+a.z*c.z;if(Math.abs(e)>=1){b.w=a.w;b.x=a.x;b.y=a.y;b.z=a.z;return b}var g=Math.acos(e),h=Math.sqrt(1-e*e);if(Math.abs(h)<0.0010){b.w=0.5*(a.w+c.w);b.x=0.5*(a.x+c.x);b.y=0.5*(a.y+c.y);b.z=0.5*(a.z+c.z);return b}e=Math.sin((1-d)*g)/h;d=Math.sin(d*g)/h;b.w=a.w*e+c.w*d;b.x=a.x*e+c.x*d;b.y=a.y*e+c.y*d;b.z=a.z*e+c.z*d;return b};
+THREE.Quaternion.slerp=function(a,c,b,d){var e=a.w*c.w+a.x*c.x+a.y*c.y+a.z*c.z;if(Math.abs(e)>=1){b.w=a.w;b.x=a.x;b.y=a.y;b.z=a.z;return b}var g=Math.acos(e),h=Math.sqrt(1-e*e);if(Math.abs(h)<0.001){b.w=0.5*(a.w+c.w);b.x=0.5*(a.x+c.x);b.y=0.5*(a.y+c.y);b.z=0.5*(a.z+c.z);return b}e=Math.sin((1-d)*g)/h;d=Math.sin(d*g)/h;b.w=a.w*e+c.w*d;b.x=a.x*e+c.x*d;b.y=a.y*e+c.y*d;b.z=a.z*e+c.z*d;return b};
 THREE.Vertex=function(a,c){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=c||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=!0};
 THREE.Face3=function(a,c,b,d,e){this.a=a;this.b=c;this.c=b;this.centroid=new THREE.Vector3;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.materials=e instanceof Array?e:[e]};THREE.Face4=function(a,c,b,d,e,g){this.a=a;this.b=c;this.c=b;this.d=d;this.centroid=new THREE.Vector3;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.materials=g instanceof Array?g:[g]};
 THREE.UV=function(a,c){this.set(a||0,c||0)};THREE.UV.prototype={set:function(a,c){this.u=a;this.v=c;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.faces=[];this.uvs=[];this.uvs2=[];this.colors=[];this.morphTargets=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
@@ -314,7 +314,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 c,b,d,e,g=2*Math.ceil(a*3)+1;g>25&&(g=25);e=(g-1)*0.5;b=Array(g);for(c=d=0;c<g;++c){b[c]=Math.exp(-((c-e)*(c-e))/(2*a*a));d+=b[c]}for(c=0;c<g;++c)b[c]/=d;return b}};
-THREE.QuakeCamera=function(a){function c(b,d){return function(){d.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.dragToLook=!1;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 c(b,d){return function(){d.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.dragToLook=!1;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.dragToLook!==undefined)this.dragToLook=a.dragToLook;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.dragToLook)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.dragToLook)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=
@@ -324,7 +324,7 @@ var b=this.lookSpeed;this.dragToLook&&!this.mouseDragOn&&(b=0);this.lon+=this.mo
 THREE.QuakeCamera.prototype.translate=function(a,c){this.matrix.rotateAxis(c);if(this.noFly)c.y=0;this.position.addSelf(c.multiplyScalar(a));this.target.position.addSelf(c.multiplyScalar(a))};
 THREE.PathCamera=function(a){function c(m,t,w,u){var o={name:w,fps:0.6,length:u,hierarchy:[]},v,B=t.getControlPointsArray(),F=t.getLength(),x=B.length,G=0;v=x-1;t={parent:-1,keys:[]};t.keys[0]={time:0,pos:B[0],rot:[0,0,0,1],scl:[1,1,1]};t.keys[v]={time:u,pos:B[v],rot:[0,0,0,1],scl:[1,1,1]};for(v=1;v<x-1;v++){G=u*F.chunks[v]/F.total;t.keys[v]={time:G,pos:B[v]}}o.hierarchy[0]=t;THREE.AnimationHandler.add(o);return new THREE.Animation(m,w,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function b(m,t){var w,
 u,o=new THREE.Geometry;for(w=0;w<m.points.length*t;w++){u=w/(m.points.length*t);u=m.getPoint(u);o.vertices[w]=new THREE.Vertex(new THREE.Vector3(u.x,u.y,u.z))}return o}function d(m,t){var w=b(t,10),u=b(t,10),o=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(w,o);particleObj=new THREE.ParticleSystem(u,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);m.addChild(lineObj);particleObj.scale.set(1,1,1);m.addChild(particleObj);u=new Sphere(1,
-16,8);o=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<t.points.length;i++){w=new THREE.Mesh(u,o);w.position.copy(t.points[i]);w.updateMatrix();m.addChild(w)}}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);o=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<t.points.length;i++){w=new THREE.Mesh(u,o);w.position.copy(t.points[i]);w.updateMatrix();m.addChild(w)}}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,g=Math.PI/180;this.update=function(m,t,w){var u,o;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)*g;this.theta=this.lon*g;u=this.phi%e;this.phi=u>=0?u:u+e;u=this.verticalAngleMap.srcRange;o=this.verticalAngleMap.dstRange;
@@ -340,7 +340,7 @@ for(d=a+a/2;d<2*a;d++)j.faces.push(new THREE.Face4((2*d-2*a+2)%a+a,(2*d-2*a+1)%a
 var Icosahedron=function(a){function c(w,u,o){var v=Math.sqrt(w*w+u*u+o*o);return e.vertices.push(new THREE.Vertex(new THREE.Vector3(w/v,u/v,o/v)))-1}function b(w,u,o,v){v.faces.push(new THREE.Face3(w,u,o))}function d(w,u){var o=e.vertices[w].position,v=e.vertices[u].position;return c((o.x+v.x)/2,(o.y+v.y)/2,(o.z+v.z)/2)}var e=this,g=new THREE.Geometry,h;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;c(-1,a,0);c(1,a,0);c(-1,-a,0);c(1,-a,0);c(0,-1,a);c(0,1,a);c(0,-1,-a);c(0,
 1,-a);c(a,0,-1);c(a,0,1);c(-a,0,-1);c(-a,0,1);b(0,11,5,g);b(0,5,1,g);b(0,1,7,g);b(0,7,10,g);b(0,10,11,g);b(1,5,9,g);b(5,11,4,g);b(11,10,2,g);b(10,7,6,g);b(7,1,8,g);b(3,9,4,g);b(3,4,2,g);b(3,2,6,g);b(3,6,8,g);b(3,8,9,g);b(4,9,5,g);b(2,4,11,g);b(6,2,10,g);b(8,6,7,g);b(9,8,1,g);for(a=0;a<this.subdivisions;a++){h=new THREE.Geometry;for(var j in g.faces){var k=d(g.faces[j].a,g.faces[j].b),m=d(g.faces[j].b,g.faces[j].c),t=d(g.faces[j].c,g.faces[j].a);b(g.faces[j].a,k,t,h);b(g.faces[j].b,m,k,h);b(g.faces[j].c,
 t,m,h);b(k,m,t,h)}g.faces=h.faces}e.faces=g.faces;delete g;delete h;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Icosahedron.prototype=new THREE.Geometry;Icosahedron.prototype.constructor=Icosahedron;
-function Lathe(a,c,b){THREE.Geometry.call(this);this.steps=c||12;this.angle=b||2*Math.PI;c=this.angle/this.steps;for(var d=[],e=[],g=[],h=[],j=0;j<a.length;j++){this.vertices.push(new THREE.Vertex(a[j]));d[j]=a[j].clone();e[j]=this.vertices.length-1}for(var k=(new THREE.Matrix4).setRotationZ(c),m=0;m<=this.angle+0.0010;m+=c){for(j=0;j<d.length;j++)if(m<this.angle){d[j]=k.multiplyVector3(d[j].clone());this.vertices.push(new THREE.Vertex(d[j]));g[j]=this.vertices.length-1}else g=h;m==0&&(h=e);for(j=
+function Lathe(a,c,b){THREE.Geometry.call(this);this.steps=c||12;this.angle=b||2*Math.PI;c=this.angle/this.steps;for(var d=[],e=[],g=[],h=[],j=0;j<a.length;j++){this.vertices.push(new THREE.Vertex(a[j]));d[j]=a[j].clone();e[j]=this.vertices.length-1}for(var k=(new THREE.Matrix4).setRotationZ(c),m=0;m<=this.angle+0.001;m+=c){for(j=0;j<d.length;j++)if(m<this.angle){d[j]=k.multiplyVector3(d[j].clone());this.vertices.push(new THREE.Vertex(d[j]));g[j]=this.vertices.length-1}else g=h;m==0&&(h=e);for(j=
 0;j<e.length-1;j++){this.faces.push(new THREE.Face4(g[j],g[j+1],e[j+1],e[j]));this.uvs.push([new THREE.UV(m/b,j/a.length),new THREE.UV(m/b,(j+1)/a.length),new THREE.UV((m-c)/b,(j+1)/a.length),new THREE.UV((m-c)/b,j/a.length)])}e=g;g=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()}Lathe.prototype=new THREE.Geometry;Lathe.prototype.constructor=Lathe;
 var Plane=function(a,c,b,d){THREE.Geometry.call(this);var e,g=a/2,h=c/2;b=b||1;d=d||1;var j=b+1,k=d+1;a/=b;var m=c/d;for(e=0;e<k;e++)for(c=0;c<j;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*a-g,-(e*m-h),0)));for(e=0;e<d;e++)for(c=0;c<b;c++){this.faces.push(new THREE.Face4(c+j*e,c+j*(e+1),c+1+j*(e+1),c+1+j*e));this.uvs.push([new THREE.UV(c/b,e/d),new THREE.UV(c/b,(e+1)/d),new THREE.UV((c+1)/b,(e+1)/d),new THREE.UV((c+1)/b,e/d)])}this.computeCentroids();this.computeFaceNormals()};
 Plane.prototype=new THREE.Geometry;Plane.prototype.constructor=Plane;

+ 70 - 53
build/custom/ThreeCanvas.js

@@ -1,6 +1,6 @@
 // ThreeCanvas.js r36 - http://github.com/mrdoob/three.js
 var THREE=THREE||{};THREE.Color=function(a){this.setHex(a)};
-THREE.Color.prototype={autoUpdate:!0,setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,b,c){var d,e,f,g,j,h;if(c==0)d=e=f=0;else{g=Math.floor(a*6);j=a*6-g;a=c*(1-b);h=c*(1-b*j);b=c*(1-b*(1-j));switch(g){case 1:d=h;e=c;f=a;break;case 2:d=a;e=c;f=b;break;case 3:d=a;e=h;f=c;break;case 4:d=b;e=a;f=c;break;case 5:d=c;e=a;f=h;break;case 6:case 0:d=c;e=b;f=a}}this.r=d;this.g=e;this.b=f;if(this.autoUpdate){this.updateHex();
+THREE.Color.prototype={autoUpdate:!0,setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,b,c){var d,e,f,g,i,h;if(c==0)d=e=f=0;else{g=Math.floor(a*6);i=a*6-g;a=c*(1-b);h=c*(1-b*i);b=c*(1-b*(1-i));switch(g){case 1:d=h;e=c;f=a;break;case 2:d=a;e=c;f=b;break;case 3:d=a;e=h;f=c;break;case 4:d=b;e=a;f=c;break;case 5:d=c;e=a;f=h;break;case 6:case 0:d=c;e=b;f=a}}this.r=d;this.g=e;this.b=f;if(this.autoUpdate){this.updateHex();
 this.updateStyleString()}},setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGB();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+","+~~(this.g*255)+","+~~(this.b*255)+")"},clone:function(){return new THREE.Color(this.hex)}};
 THREE.Vector2=function(a,b){this.set(a||0,b||0)};
 THREE.Vector2.prototype={set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.set(a.x,a.y);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a);return this},negate:function(){this.set(-this.x,-this.y);return this},unit:function(){this.multiplyScalar(1/
@@ -12,56 +12,73 @@ this.length();a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setPosit
 1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,b,c,d){this.set(a||0,b||0,c||0,d||1)};
 THREE.Vector4.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z,a.w+b.w);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z,this.w+a.w);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z,a.w-b.w);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z,this.w-a.w);return this},multiplyScalar:function(a){this.set(this.x*
 a,this.y*a,this.z*a,this.w*a);return this},divideScalar:function(a){this.set(this.x/a,this.y/a,this.z/a,this.w/a);return this},lerpSelf:function(a,b){this.set(this.x+(a.x-this.x)*b,this.y+(a.y-this.y)*b,this.z+(a.z-this.z)*b,this.w+(a.w-this.w)*b)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
-THREE.Ray.prototype={intersectScene:function(a){var b,c,d=a.objects,e=[];a=0;for(b=d.length;a<b;a++){c=d[a];c instanceof THREE.Mesh&&(e=e.concat(this.intersectObject(c)))}e.sort(function(f,g){return f.distance-g.distance});return e},intersectObject:function(a){function b(s,k,G,F){F=F.clone().subSelf(k);G=G.clone().subSelf(k);var K=s.clone().subSelf(k);s=F.dot(F);k=F.dot(G);F=F.dot(K);var I=G.dot(G);G=G.dot(K);K=1/(s*I-k*k);I=(I*F-k*G)*K;s=(s*G-k*F)*K;return I>0&&s>0&&I+s<1}var c,d,e,f,g,j,h,i,p,n,
-o,q=a.geometry,u=q.vertices,v=[];c=0;for(d=q.faces.length;c<d;c++){e=q.faces[c];n=this.origin.clone();o=this.direction.clone();h=a.matrixWorld;f=h.multiplyVector3(u[e.a].position.clone());g=h.multiplyVector3(u[e.b].position.clone());j=h.multiplyVector3(u[e.c].position.clone());h=e instanceof THREE.Face4?h.multiplyVector3(u[e.d].position.clone()):null;i=a.matrixRotationWorld.multiplyVector3(e.normal.clone());p=o.dot(i);if(p<0){i=i.dot((new THREE.Vector3).sub(f,n))/p;n=n.addSelf(o.multiplyScalar(i));
-if(e instanceof THREE.Face3){if(b(n,f,g,j)){e={distance:this.origin.distanceTo(n),point:n,face:e,object:a};v.push(e)}}else if(e instanceof THREE.Face4&&(b(n,f,g,h)||b(n,g,j,h))){e={distance:this.origin.distanceTo(n),point:n,face:e,object:a};v.push(e)}}}return v}};
-THREE.Rectangle=function(){function a(){f=d-b;g=e-c}var b,c,d,e,f,g,j=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return f};this.getHeight=function(){return g};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(h,i,p,n){j=!1;b=h;c=i;d=p;e=n;a()};this.addPoint=function(h,i){if(j){j=!1;b=h;c=i;d=h;e=i}else{b=b<h?b:h;c=c<i?c:i;d=d>h?d:h;e=e>i?e:i}a()};
-this.add3Points=function(h,i,p,n,o,q){if(j){j=!1;b=h<p?h<o?h:o:p<o?p:o;c=i<n?i<q?i:q:n<q?n:q;d=h>p?h>o?h:o:p>o?p:o;e=i>n?i>q?i:q:n>q?n:q}else{b=h<p?h<o?h<b?h:b:o<b?o:b:p<o?p<b?p:b:o<b?o:b;c=i<n?i<q?i<c?i:c:q<c?q:c:n<q?n<c?n:c:q<c?q:c;d=h>p?h>o?h>d?h:d:o>d?o:d:p>o?p>d?p:d:o>d?o:d;e=i>n?i>q?i>e?i:e:q>e?q:e:n>q?n>e?n:e:q>e?q:e}a()};this.addRectangle=function(h){if(j){j=!1;b=h.getLeft();c=h.getTop();d=h.getRight();e=h.getBottom()}else{b=b<h.getLeft()?b:h.getLeft();c=c<h.getTop()?c:h.getTop();d=d>h.getRight()?
-d:h.getRight();e=e>h.getBottom()?e:h.getBottom()}a()};this.inflate=function(h){b-=h;c-=h;d+=h;e+=h;a()};this.minSelf=function(h){b=b>h.getLeft()?b:h.getLeft();c=c>h.getTop()?c:h.getTop();d=d<h.getRight()?d:h.getRight();e=e<h.getBottom()?e:h.getBottom();a()};this.instersects=function(h){return Math.min(d,h.getRight())-Math.max(b,h.getLeft())>=0&&Math.min(e,h.getBottom())-Math.max(c,h.getTop())>=0};this.empty=function(){j=!0;e=d=c=b=0;a()};this.isEmpty=function(){return j}};
+THREE.Ray.prototype={intersectScene:function(a){var b,c,d=a.objects,e=[];a=0;for(b=d.length;a<b;a++){c=d[a];c instanceof THREE.Mesh&&(e=e.concat(this.intersectObject(c)))}e.sort(function(f,g){return f.distance-g.distance});return e},intersectObject:function(a){function b(s,k,G,F){F=F.clone().subSelf(k);G=G.clone().subSelf(k);var K=s.clone().subSelf(k);s=F.dot(F);k=F.dot(G);F=F.dot(K);var I=G.dot(G);G=G.dot(K);K=1/(s*I-k*k);I=(I*F-k*G)*K;s=(s*G-k*F)*K;return I>0&&s>0&&I+s<1}var c,d,e,f,g,i,h,j,o,n,
+p,m=a.geometry,v=m.vertices,t=[];c=0;for(d=m.faces.length;c<d;c++){e=m.faces[c];n=this.origin.clone();p=this.direction.clone();h=a.matrixWorld;f=h.multiplyVector3(v[e.a].position.clone());g=h.multiplyVector3(v[e.b].position.clone());i=h.multiplyVector3(v[e.c].position.clone());h=e instanceof THREE.Face4?h.multiplyVector3(v[e.d].position.clone()):null;j=a.matrixRotationWorld.multiplyVector3(e.normal.clone());o=p.dot(j);if(o<0){j=j.dot((new THREE.Vector3).sub(f,n))/o;n=n.addSelf(p.multiplyScalar(j));
+if(e instanceof THREE.Face3){if(b(n,f,g,i)){e={distance:this.origin.distanceTo(n),point:n,face:e,object:a};t.push(e)}}else if(e instanceof THREE.Face4&&(b(n,f,g,h)||b(n,g,i,h))){e={distance:this.origin.distanceTo(n),point:n,face:e,object:a};t.push(e)}}}return t}};
+THREE.Rectangle=function(){function a(){f=d-b;g=e-c}var b,c,d,e,f,g,i=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return f};this.getHeight=function(){return g};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(h,j,o,n){i=!1;b=h;c=j;d=o;e=n;a()};this.addPoint=function(h,j){if(i){i=!1;b=h;c=j;d=h;e=j}else{b=b<h?b:h;c=c<j?c:j;d=d>h?d:h;e=e>j?e:j}a()};
+this.add3Points=function(h,j,o,n,p,m){if(i){i=!1;b=h<o?h<p?h:p:o<p?o:p;c=j<n?j<m?j:m:n<m?n:m;d=h>o?h>p?h:p:o>p?o:p;e=j>n?j>m?j:m:n>m?n:m}else{b=h<o?h<p?h<b?h:b:p<b?p:b:o<p?o<b?o:b:p<b?p:b;c=j<n?j<m?j<c?j:c:m<c?m:c:n<m?n<c?n:c:m<c?m:c;d=h>o?h>p?h>d?h:d:p>d?p:d:o>p?o>d?o:d:p>d?p:d;e=j>n?j>m?j>e?j:e:m>e?m:e:n>m?n>e?n:e:m>e?m:e}a()};this.addRectangle=function(h){if(i){i=!1;b=h.getLeft();c=h.getTop();d=h.getRight();e=h.getBottom()}else{b=b<h.getLeft()?b:h.getLeft();c=c<h.getTop()?c:h.getTop();d=d>h.getRight()?
+d:h.getRight();e=e>h.getBottom()?e:h.getBottom()}a()};this.inflate=function(h){b-=h;c-=h;d+=h;e+=h;a()};this.minSelf=function(h){b=b>h.getLeft()?b:h.getLeft();c=c>h.getTop()?c:h.getTop();d=d<h.getRight()?d:h.getRight();e=e<h.getBottom()?e:h.getBottom();a()};this.instersects=function(h){return Math.min(d,h.getRight())-Math.max(b,h.getLeft())>=0&&Math.min(e,h.getBottom())-Math.max(c,h.getTop())>=0};this.empty=function(){i=!0;e=d=c=b=0;a()};this.isEmpty=function(){return i}};
 THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};
-THREE.Matrix4=function(a,b,c,d,e,f,g,j,h,i,p,n,o,q,u,v){this.set(a||1,b||0,c||0,d||0,e||0,f||1,g||0,j||0,h||0,i||0,p||1,n||0,o||0,q||0,u||0,v||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={set:function(a,b,c,d,e,f,g,j,h,i,p,n,o,q,u,v){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=e;this.n22=f;this.n23=g;this.n24=j;this.n31=h;this.n32=i;this.n33=p;this.n34=n;this.n41=o;this.n42=q;this.n43=u;this.n44=v;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,b,c){var d=THREE.Matrix4.__v1,
+THREE.Matrix4=function(a,b,c,d,e,f,g,i,h,j,o,n,p,m,v,t){this.set(a||1,b||0,c||0,d||0,e||0,f||1,g||0,i||0,h||0,j||0,o||1,n||0,p||0,m||0,v||0,t||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={set:function(a,b,c,d,e,f,g,i,h,j,o,n,p,m,v,t){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=e;this.n22=f;this.n23=g;this.n24=i;this.n31=h;this.n32=j;this.n33=o;this.n34=n;this.n41=p;this.n42=m;this.n43=v;this.n44=t;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,b,c){var d=THREE.Matrix4.__v1,
 e=THREE.Matrix4.__v2,f=THREE.Matrix4.__v3;f.sub(a,b).normalize();if(f.length()===0)f.z=1;d.cross(c,f).normalize();if(d.length()===0){f.x+=1.0E-4;d.cross(c,f).normalize()}e.cross(f,d).normalize();this.n11=d.x;this.n12=e.x;this.n13=f.x;this.n21=d.y;this.n22=e.y;this.n23=f.y;this.n31=d.z;this.n32=e.z;this.n33=f.z;return this},multiplyVector3:function(a){var b=a.x,c=a.y,d=a.z,e=1/(this.n41*b+this.n42*c+this.n43*d+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*d+this.n14)*e;a.y=(this.n21*b+this.n22*c+this.n23*
 d+this.n24)*e;a.z=(this.n31*b+this.n32*c+this.n33*d+this.n34)*e;return a},multiplyVector4:function(a){var b=a.x,c=a.y,d=a.z,e=a.w;a.x=this.n11*b+this.n12*c+this.n13*d+this.n14*e;a.y=this.n21*b+this.n22*c+this.n23*d+this.n24*e;a.z=this.n31*b+this.n32*c+this.n33*d+this.n34*e;a.w=this.n41*b+this.n42*c+this.n43*d+this.n44*e;return a},rotateAxis:function(a){var b=a.x,c=a.y,d=a.z;a.x=b*this.n11+c*this.n12+d*this.n13;a.y=b*this.n21+c*this.n22+d*this.n23;a.z=b*this.n31+c*this.n32+d*this.n33;a.normalize();
-return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var c=a.n11,d=a.n12,e=a.n13,f=a.n14,g=a.n21,j=a.n22,h=a.n23,i=a.n24,p=a.n31,n=a.n32,o=a.n33,q=a.n34,u=a.n41,v=a.n42,s=a.n43,k=a.n44,G=b.n11,F=b.n12,K=b.n13,I=b.n14,S=b.n21,C=b.n22,
-A=b.n23,L=b.n24,y=b.n31,M=b.n32,D=b.n33,x=b.n34;this.n11=c*G+d*S+e*y;this.n12=c*F+d*C+e*M;this.n13=c*K+d*A+e*D;this.n14=c*I+d*L+e*x+f;this.n21=g*G+j*S+h*y;this.n22=g*F+j*C+h*M;this.n23=g*K+j*A+h*D;this.n24=g*I+j*L+h*x+i;this.n31=p*G+n*S+o*y;this.n32=p*F+n*C+o*M;this.n33=p*K+n*A+o*D;this.n34=p*I+n*L+o*x+q;this.n41=u*G+v*S+s*y;this.n42=u*F+v*C+s*M;this.n43=u*K+v*A+s*D;this.n44=u*I+v*L+s*x+k;return this},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=
+return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var c=a.n11,d=a.n12,e=a.n13,f=a.n14,g=a.n21,i=a.n22,h=a.n23,j=a.n24,o=a.n31,n=a.n32,p=a.n33,m=a.n34,v=a.n41,t=a.n42,s=a.n43,k=a.n44,G=b.n11,F=b.n12,K=b.n13,I=b.n14,S=b.n21,C=b.n22,
+A=b.n23,L=b.n24,y=b.n31,M=b.n32,D=b.n33,x=b.n34;this.n11=c*G+d*S+e*y;this.n12=c*F+d*C+e*M;this.n13=c*K+d*A+e*D;this.n14=c*I+d*L+e*x+f;this.n21=g*G+i*S+h*y;this.n22=g*F+i*C+h*M;this.n23=g*K+i*A+h*D;this.n24=g*I+i*L+h*x+j;this.n31=o*G+n*S+p*y;this.n32=o*F+n*C+p*M;this.n33=o*K+n*A+p*D;this.n34=o*I+n*L+p*x+m;this.n41=v*G+t*S+s*y;this.n42=v*F+t*C+s*M;this.n43=v*K+t*A+s*D;this.n44=v*I+t*L+s*x+k;return this},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=
 this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplySelf:function(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=
-this.n11,b=this.n12,c=this.n13,d=this.n14,e=this.n21,f=this.n22,g=this.n23,j=this.n24,h=this.n31,i=this.n32,p=this.n33,n=this.n34,o=this.n41,q=this.n42,u=this.n43,v=this.n44;return d*g*i*o-c*j*i*o-d*f*p*o+b*j*p*o+c*f*n*o-b*g*n*o-d*g*h*q+c*j*h*q+d*e*p*q-a*j*p*q-c*e*n*q+a*g*n*q+d*f*h*u-b*j*h*u-d*e*i*u+a*j*i*u+b*e*n*u-a*f*n*u-c*f*h*v+b*g*h*v+c*e*i*v-a*g*i*v-b*e*p*v+a*f*p*v},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=
+this.n11,b=this.n12,c=this.n13,d=this.n14,e=this.n21,f=this.n22,g=this.n23,i=this.n24,h=this.n31,j=this.n32,o=this.n33,n=this.n34,p=this.n41,m=this.n42,v=this.n43,t=this.n44;return d*g*j*p-c*i*j*p-d*f*o*p+b*i*o*p+c*f*n*p-b*g*n*p-d*g*h*m+c*i*h*m+d*e*o*m-a*i*o*m-c*e*n*m+a*g*n*m+d*f*h*v-b*i*h*v-d*e*j*v+a*i*j*v+b*e*n*v-a*f*n*v-c*f*h*t+b*g*h*t+c*e*j*t-a*g*j*t-b*e*o*t+a*f*o*t},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=
 this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;
 this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=
 this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},setScale:function(a,
-b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotationX:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotationY:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotationZ:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,f=a.x,g=a.y,j=a.z,h=e*f,i=e*g;this.set(h*
-f+c,h*g-d*j,h*j+d*g,0,h*g+d*j,i*g+c,i*j-d*f,0,h*j-d*g,i*j+d*f,e*j*j+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var b=a.x,c=a.y,d=a.z;a=Math.cos(b);b=Math.sin(b);var e=Math.cos(c);c=Math.sin(c);var f=Math.cos(d);d=Math.sin(d);var g=a*c,j=b*c;this.n11=e*f;this.n12=-e*d;this.n13=c;this.n21=j*f+a*d;this.n22=-j*d+a*f;this.n23=-b*e;this.n31=-g*f+b*d;this.n32=g*d+b*f;this.n33=a*e;return this},setRotationFromQuaternion:function(a){var b=
-a.x,c=a.y,d=a.z,e=a.w,f=b+b,g=c+c,j=d+d;a=b*f;var h=b*g;b*=j;var i=c*g;c*=j;d*=j;f*=e;g*=e;e*=j;this.n11=1-(i+d);this.n12=h-e;this.n13=b+g;this.n21=h+e;this.n22=1-(a+d);this.n23=c-f;this.n31=b-g;this.n32=c+f;this.n33=1-(a+i);return this},scale:function(a){var b=a.x,c=a.y;a=a.z;this.n11*=b;this.n12*=c;this.n13*=a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=
+b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotationX:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotationY:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotationZ:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,f=a.x,g=a.y,i=a.z,h=e*f,j=e*g;this.set(h*
+f+c,h*g-d*i,h*i+d*g,0,h*g+d*i,j*g+c,j*i-d*f,0,h*i-d*g,j*i+d*f,e*i*i+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var b=a.x,c=a.y,d=a.z;a=Math.cos(b);b=Math.sin(b);var e=Math.cos(c);c=Math.sin(c);var f=Math.cos(d);d=Math.sin(d);var g=a*c,i=b*c;this.n11=e*f;this.n12=-e*d;this.n13=c;this.n21=i*f+a*d;this.n22=-i*d+a*f;this.n23=-b*e;this.n31=-g*f+b*d;this.n32=g*d+b*f;this.n33=a*e;return this},setRotationFromQuaternion:function(a){var b=
+a.x,c=a.y,d=a.z,e=a.w,f=b+b,g=c+c,i=d+d;a=b*f;var h=b*g;b*=i;var j=c*g;c*=i;d*=i;f*=e;g*=e;e*=i;this.n11=1-(j+d);this.n12=h-e;this.n13=b+g;this.n21=h+e;this.n22=1-(a+d);this.n23=c-f;this.n31=b-g;this.n32=c+f;this.n33=1-(a+j);return this},scale:function(a){var b=a.x,c=a.y;a=a.z;this.n11*=b;this.n12*=c;this.n13*=a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=
 a.n34},extractRotation:function(a,b){var c=1/b.x,d=1/b.y,e=1/b.z;this.n11=a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*d;this.n22=a.n22*d;this.n32=a.n32*d;this.n13=a.n13*e;this.n23=a.n23*e;this.n33=a.n33*e}};
-THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,d=a.n12,e=a.n13,f=a.n14,g=a.n21,j=a.n22,h=a.n23,i=a.n24,p=a.n31,n=a.n32,o=a.n33,q=a.n34,u=a.n41,v=a.n42,s=a.n43,k=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=h*q*v-i*o*v+i*n*s-j*q*s-h*n*k+j*o*k;b.n12=f*o*v-e*q*v-f*n*s+d*q*s+e*n*k-d*o*k;b.n13=e*i*v-f*h*v+f*j*s-d*i*s-e*j*k+d*h*k;b.n14=f*h*n-e*i*n-f*j*o+d*i*o+e*j*q-d*h*q;b.n21=i*o*u-h*q*u-i*p*s+g*q*s+h*p*k-g*o*k;b.n22=e*q*u-f*o*u+f*p*s-c*q*s-e*p*k+c*o*k;b.n23=f*h*u-e*i*u-f*g*s+c*i*s+e*g*k-c*h*k;
-b.n24=e*i*p-f*h*p+f*g*o-c*i*o-e*g*q+c*h*q;b.n31=j*q*u-i*n*u+i*p*v-g*q*v-j*p*k+g*n*k;b.n32=f*n*u-d*q*u-f*p*v+c*q*v+d*p*k-c*n*k;b.n33=e*i*u-f*j*u+f*g*v-c*i*v-d*g*k+c*j*k;b.n34=f*j*p-d*i*p-f*g*n+c*i*n+d*g*q-c*j*q;b.n41=h*n*u-j*o*u-h*p*v+g*o*v+j*p*s-g*n*s;b.n42=d*o*u-e*n*u+e*p*v-c*o*v-d*p*s+c*n*s;b.n43=e*j*u-d*h*u-e*g*v+c*h*v+d*g*s-c*j*s;b.n44=d*h*p-e*j*p+e*g*n-c*h*n-d*g*o+c*j*o;b.multiplyScalar(1/a.determinant());return b};
-THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,e=-a.n33*a.n21+a.n31*a.n23,f=a.n32*a.n21-a.n31*a.n22,g=-a.n33*a.n12+a.n32*a.n13,j=a.n33*a.n11-a.n31*a.n13,h=-a.n32*a.n11+a.n31*a.n12,i=a.n23*a.n12-a.n22*a.n13,p=-a.n23*a.n11+a.n21*a.n13,n=a.n22*a.n11-a.n21*a.n12;a=a.n11*d+a.n21*g+a.n31*i;if(a==0)throw"matrix not invertible";a=1/a;c[0]=a*d;c[1]=a*e;c[2]=a*f;c[3]=a*g;c[4]=a*j;c[5]=a*h;c[6]=a*i;c[7]=a*p;c[8]=a*n;return b};
+THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,d=a.n12,e=a.n13,f=a.n14,g=a.n21,i=a.n22,h=a.n23,j=a.n24,o=a.n31,n=a.n32,p=a.n33,m=a.n34,v=a.n41,t=a.n42,s=a.n43,k=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=h*m*t-j*p*t+j*n*s-i*m*s-h*n*k+i*p*k;b.n12=f*p*t-e*m*t-f*n*s+d*m*s+e*n*k-d*p*k;b.n13=e*j*t-f*h*t+f*i*s-d*j*s-e*i*k+d*h*k;b.n14=f*h*n-e*j*n-f*i*p+d*j*p+e*i*m-d*h*m;b.n21=j*p*v-h*m*v-j*o*s+g*m*s+h*o*k-g*p*k;b.n22=e*m*v-f*p*v+f*o*s-c*m*s-e*o*k+c*p*k;b.n23=f*h*v-e*j*v-f*g*s+c*j*s+e*g*k-c*h*k;
+b.n24=e*j*o-f*h*o+f*g*p-c*j*p-e*g*m+c*h*m;b.n31=i*m*v-j*n*v+j*o*t-g*m*t-i*o*k+g*n*k;b.n32=f*n*v-d*m*v-f*o*t+c*m*t+d*o*k-c*n*k;b.n33=e*j*v-f*i*v+f*g*t-c*j*t-d*g*k+c*i*k;b.n34=f*i*o-d*j*o-f*g*n+c*j*n+d*g*m-c*i*m;b.n41=h*n*v-i*p*v-h*o*t+g*p*t+i*o*s-g*n*s;b.n42=d*p*v-e*n*v+e*o*t-c*p*t-d*o*s+c*n*s;b.n43=e*i*v-d*h*v-e*g*t+c*h*t+d*g*s-c*i*s;b.n44=d*h*o-e*i*o+e*g*n-c*h*n-d*g*p+c*i*p;b.multiplyScalar(1/a.determinant());return b};
+THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,e=-a.n33*a.n21+a.n31*a.n23,f=a.n32*a.n21-a.n31*a.n22,g=-a.n33*a.n12+a.n32*a.n13,i=a.n33*a.n11-a.n31*a.n13,h=-a.n32*a.n11+a.n31*a.n12,j=a.n23*a.n12-a.n22*a.n13,o=-a.n23*a.n11+a.n21*a.n13,n=a.n22*a.n11-a.n21*a.n12;a=a.n11*d+a.n21*g+a.n31*j;if(a==0)throw"matrix not invertible";a=1/a;c[0]=a*d;c[1]=a*e;c[2]=a*f;c[3]=a*g;c[4]=a*i;c[5]=a*h;c[6]=a*j;c[7]=a*o;c[8]=a*n;return b};
 THREE.Matrix4.makeFrustum=function(a,b,c,d,e,f){var g;g=new THREE.Matrix4;g.n11=2*e/(b-a);g.n12=0;g.n13=(b+a)/(b-a);g.n14=0;g.n21=0;g.n22=2*e/(d-c);g.n23=(d+c)/(d-c);g.n24=0;g.n31=0;g.n32=0;g.n33=-(f+e)/(f-e);g.n34=-2*f*e/(f-e);g.n41=0;g.n42=0;g.n43=-1;g.n44=0;return g};THREE.Matrix4.makePerspective=function(a,b,c,d){var e;a=c*Math.tan(a*Math.PI/360);e=-a;return THREE.Matrix4.makeFrustum(e*b,a*b,e,a,c,d)};
-THREE.Matrix4.makeOrtho=function(a,b,c,d,e,f){var g,j,h,i;g=new THREE.Matrix4;j=b-a;h=c-d;i=f-e;g.n11=2/j;g.n12=0;g.n13=0;g.n14=-((b+a)/j);g.n21=0;g.n22=2/h;g.n23=0;g.n24=-((c+d)/h);g.n31=0;g.n32=0;g.n33=-2/i;g.n34=-((f+e)/i);g.n41=0;g.n42=0;g.n43=0;g.n44=1;return g};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
+THREE.Matrix4.makeOrtho=function(a,b,c,d,e,f){var g,i,h,j;g=new THREE.Matrix4;i=b-a;h=c-d;j=f-e;g.n11=2/i;g.n12=0;g.n13=0;g.n14=-((b+a)/i);g.n21=0;g.n22=2/h;g.n23=0;g.n24=-((c+d)/h);g.n31=0;g.n32=0;g.n33=-2/j;g.n34=-((f+e)/j);g.n41=0;g.n42=0;g.n43=0;g.n44=1;return g};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
 THREE.Object3D=function(){this.parent=undefined;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixAutoUpdate=!0;this.matrixWorldNeedsUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=
 !0;this._vector=new THREE.Vector3};
 THREE.Object3D.prototype={translate:function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(a){if(this.children.indexOf(a)===-1){a.parent!==
 undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);for(var b=this;b instanceof THREE.Scene===!1&&b!==undefined;)b=b.parent;b!==undefined&&b.addChildRecurse(a)}},removeChild:function(a){var b=this.children.indexOf(a);if(b!==-1){a.parent=undefined;this.children.splice(b,1)}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation);if(this.scale.x!==1||this.scale.y!==
 1||this.scale.z!==1){this.matrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}this.matrixWorldNeedsUpdate=!0},update:function(a,b,c){if(this.visible){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||b){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale);this.matrixWorldNeedsUpdate=!1;b=!0}a=0;for(var d=this.children.length;a<
 d;a++)this.children[a].update(this.matrixWorld,b,c)}}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==undefined?d:1)};
-THREE.Quaternion.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b;a=Math.cos(d);d=Math.sin(d);b=Math.cos(-e);e=Math.sin(-e);var f=Math.cos(c);c=Math.sin(c);var g=a*b,j=d*e;this.w=g*f-j*c;this.x=g*c+j*f;this.y=d*b*f+a*e*c;this.z=a*e*f-d*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,d=this.z,e=this.w,f=a.x,g=a.y,j=a.z;a=a.w;this.x=b*a+e*f+c*j-d*g;this.y=c*a+e*g+d*f-b*j;this.z=d*a+e*j+b*g-c*f;this.w=e*a-b*f-c*g-d*j;return this},
-multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,f=this.x,g=this.y,j=this.z,h=this.w,i=h*c+g*e-j*d,p=h*d+j*c-f*e,n=h*e+f*d-g*c;c=-f*c-g*d-j*e;b.x=i*h+c*-f+p*-j-n*-g;b.y=p*h+c*-g+n*-f-i*-j;b.z=n*h+c*-j+i*-g-p*-f;return b}};
-THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(e),g=Math.sqrt(1-e*e);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}e=Math.sin((1-d)*f)/g;d=Math.sin(d*f)/g;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c};
+THREE.Quaternion.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b;a=Math.cos(d);d=Math.sin(d);b=Math.cos(-e);e=Math.sin(-e);var f=Math.cos(c);c=Math.sin(c);var g=a*b,i=d*e;this.w=g*f-i*c;this.x=g*c+i*f;this.y=d*b*f+a*e*c;this.z=a*e*f-d*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,d=this.z,e=this.w,f=a.x,g=a.y,i=a.z;a=a.w;this.x=b*a+e*f+c*i-d*g;this.y=c*a+e*g+d*f-b*i;this.z=d*a+e*i+b*g-c*f;this.w=e*a-b*f-c*g-d*i;return this},
+multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,f=this.x,g=this.y,i=this.z,h=this.w,j=h*c+g*e-i*d,o=h*d+i*c-f*e,n=h*e+f*d-g*c;c=-f*c-g*d-i*e;b.x=j*h+c*-f+o*-i-n*-g;b.y=o*h+c*-g+n*-f-j*-i;b.z=n*h+c*-i+j*-g-o*-f;return b}};
+THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(e),g=Math.sqrt(1-e*e);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}e=Math.sin((1-d)*f)/g;d=Math.sin(d*f)/g;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c};
 THREE.Vertex=function(a,b){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=b||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=!0};
 THREE.Face3=function(a,b,c,d,e){this.a=a;this.b=b;this.c=c;this.centroid=new THREE.Vector3;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.materials=e instanceof Array?e:[e]};THREE.Face4=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.d=d;this.centroid=new THREE.Vector3;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.materials=f instanceof Array?f:[f]};
 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.faces=[];this.uvs=[];this.uvs2=[];this.colors=[];this.morphTargets=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
 THREE.Geometry.prototype={computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];c.centroid.set(0,0,0);if(c instanceof THREE.Face3){c.centroid.addSelf(this.vertices[c.a].position);c.centroid.addSelf(this.vertices[c.b].position);c.centroid.addSelf(this.vertices[c.c].position);c.centroid.divideScalar(3)}else if(c instanceof THREE.Face4){c.centroid.addSelf(this.vertices[c.a].position);c.centroid.addSelf(this.vertices[c.b].position);c.centroid.addSelf(this.vertices[c.c].position);
-c.centroid.addSelf(this.vertices[c.d].position);c.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var b,c,d,e,f,g,j=new THREE.Vector3,h=new THREE.Vector3;d=0;for(e=this.vertices.length;d<e;d++){f=this.vertices[d];f.normal.set(0,0,0)}d=0;for(e=this.faces.length;d<e;d++){f=this.faces[d];if(a&&f.vertexNormals.length){j.set(0,0,0);b=0;for(c=f.vertexNormals.length;b<c;b++)j.addSelf(f.vertexNormals[b]);j.divideScalar(3)}else{b=this.vertices[f.a];c=this.vertices[f.b];g=this.vertices[f.c];j.sub(g.position,
-c.position);h.sub(b.position,c.position);j.crossSelf(h)}j.isZero()||j.normalize();f.normal.copy(j)}},computeVertexNormals:function(){var a,b,c,d;if(this.__tmpVertices==undefined){d=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,
+c.centroid.addSelf(this.vertices[c.d].position);c.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var b,c,d,e,f,g,i=new THREE.Vector3,h=new THREE.Vector3;d=0;for(e=this.vertices.length;d<e;d++){f=this.vertices[d];f.normal.set(0,0,0)}d=0;for(e=this.faces.length;d<e;d++){f=this.faces[d];if(a&&f.vertexNormals.length){i.set(0,0,0);b=0;for(c=f.vertexNormals.length;b<c;b++)i.addSelf(f.vertexNormals[b]);i.divideScalar(3)}else{b=this.vertices[f.a];c=this.vertices[f.b];g=this.vertices[f.c];i.sub(g.position,
+c.position);h.sub(b.position,c.position);i.crossSelf(h)}i.isZero()||i.normalize();f.normal.copy(i)}},computeVertexNormals:function(){var a,b,c,d;if(this.__tmpVertices==undefined){d=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,
 new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{d=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal)}else if(c instanceof THREE.Face4){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal);d[c.d].addSelf(c.normal)}}a=0;for(b=this.vertices.length;a<b;a++)d[a].normalize();a=0;for(b=this.faces.length;a<
-b;a++){c=this.faces[a];if(c instanceof THREE.Face3){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c]);c.vertexNormals[3].copy(d[c.d])}}},computeTangents:function(){function a(x,z,W,w,O,Y,H){f=x.vertices[z].position;g=x.vertices[W].position;j=x.vertices[w].position;h=e[O];i=e[Y];p=e[H];n=g.x-f.x;o=j.x-f.x;q=g.y-f.y;u=j.y-f.y;
-v=g.z-f.z;s=j.z-f.z;k=i.u-h.u;G=p.u-h.u;F=i.v-h.v;K=p.v-h.v;I=1/(k*K-G*F);A.set((K*n-F*o)*I,(K*q-F*u)*I,(K*v-F*s)*I);L.set((k*o-G*n)*I,(k*u-G*q)*I,(k*s-G*v)*I);S[z].addSelf(A);S[W].addSelf(A);S[w].addSelf(A);C[z].addSelf(L);C[W].addSelf(L);C[w].addSelf(L)}var b,c,d,e,f,g,j,h,i,p,n,o,q,u,v,s,k,G,F,K,I,S=[],C=[],A=new THREE.Vector3,L=new THREE.Vector3,y=new THREE.Vector3,M=new THREE.Vector3,D=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++){S[b]=new THREE.Vector3;C[b]=new THREE.Vector3}b=0;
+b;a++){c=this.faces[a];if(c instanceof THREE.Face3){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c]);c.vertexNormals[3].copy(d[c.d])}}},computeTangents:function(){function a(x,z,W,w,O,Y,H){f=x.vertices[z].position;g=x.vertices[W].position;i=x.vertices[w].position;h=e[O];j=e[Y];o=e[H];n=g.x-f.x;p=i.x-f.x;m=g.y-f.y;v=i.y-f.y;
+t=g.z-f.z;s=i.z-f.z;k=j.u-h.u;G=o.u-h.u;F=j.v-h.v;K=o.v-h.v;I=1/(k*K-G*F);A.set((K*n-F*p)*I,(K*m-F*v)*I,(K*t-F*s)*I);L.set((k*p-G*n)*I,(k*v-G*m)*I,(k*s-G*t)*I);S[z].addSelf(A);S[W].addSelf(A);S[w].addSelf(A);C[z].addSelf(L);C[W].addSelf(L);C[w].addSelf(L)}var b,c,d,e,f,g,i,h,j,o,n,p,m,v,t,s,k,G,F,K,I,S=[],C=[],A=new THREE.Vector3,L=new THREE.Vector3,y=new THREE.Vector3,M=new THREE.Vector3,D=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++){S[b]=new THREE.Vector3;C[b]=new THREE.Vector3}b=0;
 for(c=this.faces.length;b<c;b++){d=this.faces[b];e=this.uvs[b];if(d instanceof THREE.Face3){a(this,d.a,d.b,d.c,0,1,2);this.vertices[d.a].normal.copy(d.vertexNormals[0]);this.vertices[d.b].normal.copy(d.vertexNormals[1]);this.vertices[d.c].normal.copy(d.vertexNormals[2])}else if(d instanceof THREE.Face4){a(this,d.a,d.b,d.c,0,1,2);a(this,d.a,d.b,d.d,0,1,3);this.vertices[d.a].normal.copy(d.vertexNormals[0]);this.vertices[d.b].normal.copy(d.vertexNormals[1]);this.vertices[d.c].normal.copy(d.vertexNormals[2]);
 this.vertices[d.d].normal.copy(d.vertexNormals[3])}}b=0;for(c=this.vertices.length;b<c;b++){D.copy(this.vertices[b].normal);d=S[b];y.copy(d);y.subSelf(D.multiplyScalar(D.dot(d))).normalize();M.cross(this.vertices[b].normal,d);d=M.dot(C[b]);d=d<0?-1:1;this.vertices[b].tangent.set(y.x,y.y,y.z,d)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],
 z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,c=this.vertices.length;b<c;b++){a=this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>
 this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,b=0,c=this.vertices.length;b<c;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}}};THREE.GeometryIdCounter=0;
+THREE.AnimationHandler=function(){var a=[],b={},c={};c.update=function(e){for(var f=0;f<a.length;f++)a[f].update(e)};c.addToUpdate=function(e){a.indexOf(e)===-1&&a.push(e)};c.removeFromUpdate=function(e){e=a.indexOf(e);e!==-1&&a.splice(e,1)};c.add=function(e){b[e.name]!==undefined&&console.log("THREE.AnimationHandler.add: Warning! "+e.name+" already exists in library. Overwriting.");b[e.name]=e;if(e.initialized!==!0){for(var f=0;f<e.hierarchy.length;f++){for(var g=0;g<e.hierarchy[f].keys.length;g++){if(e.hierarchy[f].keys[g].time<
+0)e.hierarchy[f].keys[g].time=0;if(e.hierarchy[f].keys[g].rot!==undefined&&!(e.hierarchy[f].keys[g].rot instanceof THREE.Quaternion)){var i=e.hierarchy[f].keys[g].rot;e.hierarchy[f].keys[g].rot=new THREE.Quaternion(i[0],i[1],i[2],i[3])}}if(e.hierarchy[f].keys[0].morphTargets!==undefined){i={};for(g=0;g<e.hierarchy[f].keys.length;g++)for(var h=0;h<e.hierarchy[f].keys[g].morphTargets.length;h++){var j=e.hierarchy[f].keys[g].morphTargets[h];i[j]=-1}e.hierarchy[f].usedMorphTargets=i;for(g=0;g<e.hierarchy[f].keys.length;g++){var o=
+{};for(j in i){for(h=0;h<e.hierarchy[f].keys[g].morphTargets.length;h++)if(e.hierarchy[f].keys[g].morphTargets[h]===j){o[j]=e.hierarchy[f].keys[g].morphTargetsInfluences[h];break}h===e.hierarchy[f].keys[g].morphTargets.length&&(o[j]=0)}e.hierarchy[f].keys[g].morphTargetsInfluences=o}}for(g=1;g<e.hierarchy[f].keys.length;g++)if(e.hierarchy[f].keys[g].time===e.hierarchy[f].keys[g-1].time){e.hierarchy[f].keys.splice(g,1);g--}for(g=1;g<e.hierarchy[f].keys.length;g++)e.hierarchy[f].keys[g].index=g}g=parseInt(e.length*
+e.fps,10);e.JIT={};e.JIT.hierarchy=[];for(f=0;f<e.hierarchy.length;f++)e.JIT.hierarchy.push(Array(g));e.initialized=!0}};c.get=function(e){if(typeof e==="string")if(b[e])return b[e];else{console.log("THREE.AnimationHandler.get: Couldn't find animation "+e);return null}};c.parse=function(e){var f=[];if(e instanceof THREE.SkinnedMesh)for(var g=0;g<e.bones.length;g++)f.push(e.bones[g]);else d(e,f);return f};var d=function(e,f){f.push(e);for(var g=0;g<e.children.length;g++)d(e.children[g],f)};c.LINEAR=
+0;c.CATMULLROM=1;c.CATMULLROM_FORWARD=2;return c}();THREE.Animation=function(a,b,c,d){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.isPaused=!0;this.loop=!0;this.interpolationType=c!==undefined?c:THREE.AnimationHandler.LINEAR;this.JITCompile=d!==undefined?d:!0;this.points=[];this.target=new THREE.Vector3};
+THREE.Animation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==undefined?a:!0;this.currentTime=b!==undefined?b:0;var c,d=this.hierarchy.length,e;for(c=0;c<d;c++){e=this.hierarchy[c];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)e.useQuaternion=!0;e.matrixAutoUpdate=!0;if(e.animationCache===undefined){e.animationCache={};e.animationCache.prevKey={pos:0,rot:0,scl:0};e.animationCache.nextKey={pos:0,rot:0,scl:0};e.animationCache.originalMatrix=
+e instanceof THREE.Bone?e.skinMatrix:e.matrix}var f=e.animationCache.prevKey;e=e.animationCache.nextKey;f.pos=this.data.hierarchy[c].keys[0];f.rot=this.data.hierarchy[c].keys[0];f.scl=this.data.hierarchy[c].keys[0];e.pos=this.getNextKeyWith("pos",c,1);e.rot=this.getNextKeyWith("rot",c,1);e.scl=this.getNextKeyWith("scl",c,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
+THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
+THREE.Animation.prototype.stop=function(){this.isPlaying=!1;this.isPaused=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==undefined){if(this.hierarchy[a]instanceof THREE.Bone)this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix;else this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix;delete this.hierarchy[a].animationCache}};
+THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,d,e,f,g,i,h,j,o=this.data.JIT.hierarchy,n,p;this.currentTime+=a*this.timeScale;p=this.currentTime;n=this.currentTime%=this.data.length;j=parseInt(Math.min(n*this.data.fps,this.data.length*this.data.fps),10);for(var m=0,v=this.hierarchy.length;m<v;m++){a=this.hierarchy[m];h=a.animationCache;if(this.JITCompile&&o[m][j]!==undefined)if(a instanceof THREE.Bone){a.skinMatrix=o[m][j];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=
+!1}else{a.matrix=o[m][j];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=!0}else{if(this.JITCompile)if(a instanceof THREE.Bone)a.skinMatrix=a.animationCache.originalMatrix;else a.matrix=a.animationCache.originalMatrix;for(var t=0;t<3;t++){c=b[t];g=h.prevKey[c];i=h.nextKey[c];if(i.time<=p){if(n<p)if(this.loop){g=this.data.hierarchy[m].keys[0];for(i=this.getNextKeyWith(c,m,1);i.time<n;){g=i;i=this.getNextKeyWith(c,m,i.index+1)}}else{this.stop();return}else{do{g=i;i=this.getNextKeyWith(c,m,i.index+1)}while(i.time<
+n)}h.prevKey[c]=g;h.nextKey[c]=i}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(n-g.time)/(i.time-g.time);e=g[c];f=i[c];if(d<0||d>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+m);d=d<0?0:1}if(c==="pos"){c=a.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){c.x=e[0]+(f[0]-e[0])*d;c.y=e[1]+(f[1]-e[1])*d;c.z=e[2]+(f[2]-e[2])*d}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=
+this.getPrevKeyWith("pos",m,g.index-1).pos;this.points[1]=e;this.points[2]=f;this.points[3]=this.getNextKeyWith("pos",m,i.index+1).pos;d=d*0.33+0.33;e=this.interpolateCatmullRom(this.points,d);c.x=e[0];c.y=e[1];c.z=e[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){d=this.interpolateCatmullRom(this.points,d*1.01);this.target.set(d[0],d[1],d[2]);this.target.subSelf(c);this.target.y=0;this.target.normalize();d=Math.atan2(this.target.x,this.target.z);a.rotation.set(0,d,0)}}}else if(c===
+"rot")THREE.Quaternion.slerp(e,f,a.quaternion,d);else if(c==="scl"){c=a.scale;c.x=e[0]+(f[0]-e[0])*d;c.y=e[1]+(f[1]-e[1])*d;c.z=e[2]+(f[2]-e[2])*d}}}}if(this.JITCompile&&o[0][j]===undefined){this.hierarchy[0].update(undefined,!0);for(m=0;m<this.hierarchy.length;m++)o[m][j]=this.hierarchy[m]instanceof THREE.Bone?this.hierarchy[m].skinMatrix.clone():this.hierarchy[m].matrix.clone()}}};
+THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],d=[],e,f,g,i,h,j;e=(a.length-1)*b;f=Math.floor(e);e-=f;c[0]=f==0?f:f-1;c[1]=f;c[2]=f>a.length-2?f:f+1;c[3]=f>a.length-3?f:f+2;f=a[c[0]];i=a[c[1]];h=a[c[2]];j=a[c[3]];c=e*e;g=e*c;d[0]=this.interpolate(f[0],i[0],h[0],j[0],e,c,g);d[1]=this.interpolate(f[1],i[1],h[1],j[1],e,c,g);d[2]=this.interpolate(f[2],i[2],h[2],j[2],e,c,g);return d};
+THREE.Animation.prototype.interpolate=function(a,b,c,d,e,f,g){a=(c-a)*0.5;d=(d-b)*0.5;return(2*(b-c)+a+d)*g+(-3*(b-c)-2*a-d)*f+a*e+b};THREE.Animation.prototype.getNextKeyWith=function(a,b,c){var d=this.data.hierarchy[b].keys;if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)c=c<d.length-1?c:d.length-1;else c%=d.length;for(;c<d.length;c++)if(d[c][a]!==undefined)return d[c];return this.data.hierarchy[b].keys[0]};
+THREE.Animation.prototype.getPrevKeyWith=function(a,b,c){var d=this.data.hierarchy[b].keys;for(c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c>0?c:0:c>=0?c:c+d.length;c>=0;c--)if(d[c][a]!==undefined)return d[c];return this.data.hierarchy[b].keys[d.length-1]};
 THREE.Camera=function(a,b,c,d,e){THREE.Object3D.call(this);this.fov=a||50;this.aspect=b||1;this.near=c||0.1;this.far=d||2E3;this.target=e||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
 THREE.Camera.prototype.translate=function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a));this.target.position.addSelf(b.multiplyScalar(a))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};THREE.Camera.prototype.updateMatrix=function(){this.update(undefined,!0)};
 THREE.Camera.prototype.update=function(a,b,c){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);this.matrix.setPosition(this.position);a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);b=!0}else{this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=
@@ -106,37 +123,37 @@ THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.f
 THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(a instanceof THREE.Sound)this.sounds.indexOf(a)===-1&&this.sounds.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a)}for(var b=0;b<a.children.length;b++)this.addChildRecurse(a.children[b])};
 THREE.Scene.prototype.removeChild=function(a){this.supr.removeChild.call(this,a);this.removeChildRecurse(a)};THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else if(a instanceof THREE.Sound){b=this.sounds.indexOf(a);b!==-1&&this.sounds.splice(b,1)}else if(!(a instanceof THREE.Camera)){b=this.objects.indexOf(a);if(b!==-1){this.objects.splice(b,1);this.__objectsRemoved.push(a)}}for(b=0;b<a.children.length;b++)this.removeChildRecurse(a.children[b])};
 THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;
-THREE.Projector=function(){function a(C,A){return A.z-C.z}function b(C,A){var L=0,y=1,M=C.z+C.w,D=A.z+A.w,x=-C.z+C.w,z=-A.z+A.w;if(M>=0&&D>=0&&x>=0&&z>=0)return!0;else if(M<0&&D<0||x<0&&z<0)return!1;else{if(M<0)L=Math.max(L,M/(M-D));else D<0&&(y=Math.min(y,M/(M-D)));if(x<0)L=Math.max(L,x/(x-z));else z<0&&(y=Math.min(y,x/(x-z)));if(y<L)return!1;else{C.lerpSelf(A,L);A.lerpSelf(C,1-y);return!0}}}var c,d,e=[],f,g,j,h=[],i,p,n=[],o,q,u=[],v=new THREE.Vector4,s=new THREE.Vector4,k=new THREE.Matrix4,G=new THREE.Matrix4,
+THREE.Projector=function(){function a(C,A){return A.z-C.z}function b(C,A){var L=0,y=1,M=C.z+C.w,D=A.z+A.w,x=-C.z+C.w,z=-A.z+A.w;if(M>=0&&D>=0&&x>=0&&z>=0)return!0;else if(M<0&&D<0||x<0&&z<0)return!1;else{if(M<0)L=Math.max(L,M/(M-D));else D<0&&(y=Math.min(y,M/(M-D)));if(x<0)L=Math.max(L,x/(x-z));else z<0&&(y=Math.min(y,x/(x-z)));if(y<L)return!1;else{C.lerpSelf(A,L);A.lerpSelf(C,1-y);return!0}}}var c,d,e=[],f,g,i,h=[],j,o,n=[],p,m,v=[],t=new THREE.Vector4,s=new THREE.Vector4,k=new THREE.Matrix4,G=new THREE.Matrix4,
 F=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],K=new THREE.Vector4,I=new THREE.Vector4,S;this.projectObjects=function(C,A,L){A=[];var y,M,D;d=0;M=C.objects;C=0;for(y=M.length;C<y;C++){D=M[C];var x;if(!(x=!D.visible))if(x=D instanceof THREE.Mesh){a:{x=void 0;for(var z=D.matrixWorld,W=-D.geometry.boundingSphere.radius*Math.max(D.scale.x,Math.max(D.scale.y,D.scale.z)),w=0;w<6;w++){x=F[w].x*z.n14+F[w].y*z.n24+F[w].z*z.n34+F[w].w;if(x<=W){x=
-!1;break a}}x=!0}x=!x}if(!x){c=e[d]=e[d]||new THREE.RenderableObject;v.copy(D.position);k.multiplyVector3(v);c.object=D;c.z=v.z;A.push(c);d++}}L&&A.sort(a);return A};this.projectScene=function(C,A,L){var y=[],M=A.near,D=A.far,x,z,W,w,O,Y,H,ja,ka,la,ma,$,N,E,T,P;j=p=q=0;A.matrixAutoUpdate&&A.updateMatrix();C.update(undefined,!1,A);k.multiply(A.projectionMatrix,A.matrixWorldInverse);F[0].set(k.n41-k.n11,k.n42-k.n12,k.n43-k.n13,k.n44-k.n14);F[1].set(k.n41+k.n11,k.n42+k.n12,k.n43+k.n13,k.n44+k.n14);F[2].set(k.n41+
+!1;break a}}x=!0}x=!x}if(!x){c=e[d]=e[d]||new THREE.RenderableObject;t.copy(D.position);k.multiplyVector3(t);c.object=D;c.z=t.z;A.push(c);d++}}L&&A.sort(a);return A};this.projectScene=function(C,A,L){var y=[],M=A.near,D=A.far,x,z,W,w,O,Y,H,ja,ka,la,ma,$,N,E,T,P;i=o=m=0;A.matrixAutoUpdate&&A.updateMatrix();C.update(undefined,!1,A);k.multiply(A.projectionMatrix,A.matrixWorldInverse);F[0].set(k.n41-k.n11,k.n42-k.n12,k.n43-k.n13,k.n44-k.n14);F[1].set(k.n41+k.n11,k.n42+k.n12,k.n43+k.n13,k.n44+k.n14);F[2].set(k.n41+
 k.n21,k.n42+k.n22,k.n43+k.n23,k.n44+k.n24);F[3].set(k.n41-k.n21,k.n42-k.n22,k.n43-k.n23,k.n44-k.n24);F[4].set(k.n41-k.n31,k.n42-k.n32,k.n43-k.n33,k.n44-k.n34);F[5].set(k.n41+k.n31,k.n42+k.n32,k.n43+k.n33,k.n44+k.n34);for(x=0;x<6;x++){Y=F[x];Y.divideScalar(Math.sqrt(Y.x*Y.x+Y.y*Y.y+Y.z*Y.z))}Y=this.projectObjects(C,A,!0);C=0;for(x=Y.length;C<x;C++){H=Y[C].object;if(H.visible){ja=H.matrixWorld;ma=H.matrixRotationWorld;ka=H.materials;la=H.overdraw;if(H instanceof THREE.Mesh){$=H.geometry;N=$.vertices;
 z=0;for(W=N.length;z<W;z++){E=N[z];E.positionWorld.copy(E.position);ja.multiplyVector3(E.positionWorld);w=E.positionScreen;w.copy(E.positionWorld);k.multiplyVector4(w);w.x/=w.w;w.y/=w.w;E.__visible=w.z>M&&w.z<D}$=$.faces;z=0;for(W=$.length;z<W;z++){E=$[z];if(E instanceof THREE.Face3){w=N[E.a];O=N[E.b];T=N[E.c];if(w.__visible&&O.__visible&&T.__visible&&(H.doubleSided||H.flipSided!=(T.positionScreen.x-w.positionScreen.x)*(O.positionScreen.y-w.positionScreen.y)-(T.positionScreen.y-w.positionScreen.y)*
-(O.positionScreen.x-w.positionScreen.x)<0)){f=h[j]=h[j]||new THREE.RenderableFace3;f.v1.positionWorld.copy(w.positionWorld);f.v2.positionWorld.copy(O.positionWorld);f.v3.positionWorld.copy(T.positionWorld);f.v1.positionScreen.copy(w.positionScreen);f.v2.positionScreen.copy(O.positionScreen);f.v3.positionScreen.copy(T.positionScreen);f.normalWorld.copy(E.normal);ma.multiplyVector3(f.normalWorld);f.centroidWorld.copy(E.centroid);ja.multiplyVector3(f.centroidWorld);f.centroidScreen.copy(f.centroidWorld);
-k.multiplyVector3(f.centroidScreen);T=E.vertexNormals;S=f.vertexNormalsWorld;w=0;for(O=T.length;w<O;w++){P=S[w]=S[w]||new THREE.Vector3;P.copy(T[w]);ma.multiplyVector3(P)}f.z=f.centroidScreen.z;f.meshMaterials=ka;f.faceMaterials=E.materials;f.overdraw=la;if(H.geometry.uvs[z]){f.uvs[0]=H.geometry.uvs[z][0];f.uvs[1]=H.geometry.uvs[z][1];f.uvs[2]=H.geometry.uvs[z][2]}y.push(f);j++}}else if(E instanceof THREE.Face4){w=N[E.a];O=N[E.b];T=N[E.c];P=N[E.d];if(w.__visible&&O.__visible&&T.__visible&&P.__visible&&
-(H.doubleSided||H.flipSided!=((P.positionScreen.x-w.positionScreen.x)*(O.positionScreen.y-w.positionScreen.y)-(P.positionScreen.y-w.positionScreen.y)*(O.positionScreen.x-w.positionScreen.x)<0||(O.positionScreen.x-T.positionScreen.x)*(P.positionScreen.y-T.positionScreen.y)-(O.positionScreen.y-T.positionScreen.y)*(P.positionScreen.x-T.positionScreen.x)<0))){f=h[j]=h[j]||new THREE.RenderableFace3;f.v1.positionWorld.copy(w.positionWorld);f.v2.positionWorld.copy(O.positionWorld);f.v3.positionWorld.copy(P.positionWorld);
+(O.positionScreen.x-w.positionScreen.x)<0)){f=h[i]=h[i]||new THREE.RenderableFace3;f.v1.positionWorld.copy(w.positionWorld);f.v2.positionWorld.copy(O.positionWorld);f.v3.positionWorld.copy(T.positionWorld);f.v1.positionScreen.copy(w.positionScreen);f.v2.positionScreen.copy(O.positionScreen);f.v3.positionScreen.copy(T.positionScreen);f.normalWorld.copy(E.normal);ma.multiplyVector3(f.normalWorld);f.centroidWorld.copy(E.centroid);ja.multiplyVector3(f.centroidWorld);f.centroidScreen.copy(f.centroidWorld);
+k.multiplyVector3(f.centroidScreen);T=E.vertexNormals;S=f.vertexNormalsWorld;w=0;for(O=T.length;w<O;w++){P=S[w]=S[w]||new THREE.Vector3;P.copy(T[w]);ma.multiplyVector3(P)}f.z=f.centroidScreen.z;f.meshMaterials=ka;f.faceMaterials=E.materials;f.overdraw=la;if(H.geometry.uvs[z]){f.uvs[0]=H.geometry.uvs[z][0];f.uvs[1]=H.geometry.uvs[z][1];f.uvs[2]=H.geometry.uvs[z][2]}y.push(f);i++}}else if(E instanceof THREE.Face4){w=N[E.a];O=N[E.b];T=N[E.c];P=N[E.d];if(w.__visible&&O.__visible&&T.__visible&&P.__visible&&
+(H.doubleSided||H.flipSided!=((P.positionScreen.x-w.positionScreen.x)*(O.positionScreen.y-w.positionScreen.y)-(P.positionScreen.y-w.positionScreen.y)*(O.positionScreen.x-w.positionScreen.x)<0||(O.positionScreen.x-T.positionScreen.x)*(P.positionScreen.y-T.positionScreen.y)-(O.positionScreen.y-T.positionScreen.y)*(P.positionScreen.x-T.positionScreen.x)<0))){f=h[i]=h[i]||new THREE.RenderableFace3;f.v1.positionWorld.copy(w.positionWorld);f.v2.positionWorld.copy(O.positionWorld);f.v3.positionWorld.copy(P.positionWorld);
 f.v1.positionScreen.copy(w.positionScreen);f.v2.positionScreen.copy(O.positionScreen);f.v3.positionScreen.copy(P.positionScreen);f.normalWorld.copy(E.normal);ma.multiplyVector3(f.normalWorld);f.centroidWorld.copy(E.centroid);ja.multiplyVector3(f.centroidWorld);f.centroidScreen.copy(f.centroidWorld);k.multiplyVector3(f.centroidScreen);f.z=f.centroidScreen.z;f.meshMaterials=ka;f.faceMaterials=E.materials;f.overdraw=la;if(H.geometry.uvs[z]){f.uvs[0]=H.geometry.uvs[z][0];f.uvs[1]=H.geometry.uvs[z][1];
-f.uvs[2]=H.geometry.uvs[z][3]}y.push(f);j++;g=h[j]=h[j]||new THREE.RenderableFace3;g.v1.positionWorld.copy(O.positionWorld);g.v2.positionWorld.copy(T.positionWorld);g.v3.positionWorld.copy(P.positionWorld);g.v1.positionScreen.copy(O.positionScreen);g.v2.positionScreen.copy(T.positionScreen);g.v3.positionScreen.copy(P.positionScreen);g.normalWorld.copy(f.normalWorld);g.centroidWorld.copy(f.centroidWorld);g.centroidScreen.copy(f.centroidScreen);g.z=g.centroidScreen.z;g.meshMaterials=ka;g.faceMaterials=
-E.materials;g.overdraw=la;if(H.geometry.uvs[z]){g.uvs[0]=H.geometry.uvs[z][1];g.uvs[1]=H.geometry.uvs[z][2];g.uvs[2]=H.geometry.uvs[z][3]}y.push(g);j++}}}}else if(H instanceof THREE.Line){G.multiply(k,ja);N=H.geometry.vertices;E=N[0];E.positionScreen.copy(E.position);G.multiplyVector4(E.positionScreen);z=1;for(W=N.length;z<W;z++){w=N[z];w.positionScreen.copy(w.position);G.multiplyVector4(w.positionScreen);O=N[z-1];K.copy(w.positionScreen);I.copy(O.positionScreen);if(b(K,I)){K.multiplyScalar(1/K.w);
-I.multiplyScalar(1/I.w);i=n[p]=n[p]||new THREE.RenderableLine;i.v1.positionScreen.copy(K);i.v2.positionScreen.copy(I);i.z=Math.max(K.z,I.z);i.materials=H.materials;y.push(i);p++}}}else if(H instanceof THREE.Particle){s.set(H.position.x,H.position.y,H.position.z,1);k.multiplyVector4(s);s.z/=s.w;if(s.z>0&&s.z<1){o=u[q]=u[q]||new THREE.RenderableParticle;o.x=s.x/s.w;o.y=s.y/s.w;o.z=s.z;o.rotation=H.rotation.z;o.scale.x=H.scale.x*Math.abs(o.x-(s.x+A.projectionMatrix.n11)/(s.w+A.projectionMatrix.n14));
-o.scale.y=H.scale.y*Math.abs(o.y-(s.y+A.projectionMatrix.n22)/(s.w+A.projectionMatrix.n24));o.materials=H.materials;y.push(o);q++}}}}L&&y.sort(a);return y};this.unprojectVector=function(C,A){var L=A.matrixWorld.clone();L.multiplySelf(THREE.Matrix4.makeInvert(A.projectionMatrix));L.multiplyVector3(C);return C}};
-THREE.CanvasRenderer=function(){function a(U){if(o!=U)i.globalAlpha=o=U}function b(U){if(q!=U){switch(U){case THREE.NormalBlending:i.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:i.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:i.globalCompositeOperation="darker"}q=U}}var c=null,d=new THREE.Projector,e=document.createElement("canvas"),f,g,j,h,i=e.getContext("2d"),p=new THREE.Color(0),n=0,o=1,q=0,u=null,v=null,s=1,k,G,F,K,I,S,C,A,L,y=new THREE.Color,
+f.uvs[2]=H.geometry.uvs[z][3]}y.push(f);i++;g=h[i]=h[i]||new THREE.RenderableFace3;g.v1.positionWorld.copy(O.positionWorld);g.v2.positionWorld.copy(T.positionWorld);g.v3.positionWorld.copy(P.positionWorld);g.v1.positionScreen.copy(O.positionScreen);g.v2.positionScreen.copy(T.positionScreen);g.v3.positionScreen.copy(P.positionScreen);g.normalWorld.copy(f.normalWorld);g.centroidWorld.copy(f.centroidWorld);g.centroidScreen.copy(f.centroidScreen);g.z=g.centroidScreen.z;g.meshMaterials=ka;g.faceMaterials=
+E.materials;g.overdraw=la;if(H.geometry.uvs[z]){g.uvs[0]=H.geometry.uvs[z][1];g.uvs[1]=H.geometry.uvs[z][2];g.uvs[2]=H.geometry.uvs[z][3]}y.push(g);i++}}}}else if(H instanceof THREE.Line){G.multiply(k,ja);N=H.geometry.vertices;E=N[0];E.positionScreen.copy(E.position);G.multiplyVector4(E.positionScreen);z=1;for(W=N.length;z<W;z++){w=N[z];w.positionScreen.copy(w.position);G.multiplyVector4(w.positionScreen);O=N[z-1];K.copy(w.positionScreen);I.copy(O.positionScreen);if(b(K,I)){K.multiplyScalar(1/K.w);
+I.multiplyScalar(1/I.w);j=n[o]=n[o]||new THREE.RenderableLine;j.v1.positionScreen.copy(K);j.v2.positionScreen.copy(I);j.z=Math.max(K.z,I.z);j.materials=H.materials;y.push(j);o++}}}else if(H instanceof THREE.Particle){s.set(H.position.x,H.position.y,H.position.z,1);k.multiplyVector4(s);s.z/=s.w;if(s.z>0&&s.z<1){p=v[m]=v[m]||new THREE.RenderableParticle;p.x=s.x/s.w;p.y=s.y/s.w;p.z=s.z;p.rotation=H.rotation.z;p.scale.x=H.scale.x*Math.abs(p.x-(s.x+A.projectionMatrix.n11)/(s.w+A.projectionMatrix.n14));
+p.scale.y=H.scale.y*Math.abs(p.y-(s.y+A.projectionMatrix.n22)/(s.w+A.projectionMatrix.n24));p.materials=H.materials;y.push(p);m++}}}}L&&y.sort(a);return y};this.unprojectVector=function(C,A){var L=A.matrixWorld.clone();L.multiplySelf(THREE.Matrix4.makeInvert(A.projectionMatrix));L.multiplyVector3(C);return C}};
+THREE.CanvasRenderer=function(){function a(U){if(p!=U)j.globalAlpha=p=U}function b(U){if(m!=U){switch(U){case THREE.NormalBlending:j.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:j.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:j.globalCompositeOperation="darker"}m=U}}var c=null,d=new THREE.Projector,e=document.createElement("canvas"),f,g,i,h,j=e.getContext("2d"),o=new THREE.Color(0),n=0,p=1,m=0,v=null,t=null,s=1,k,G,F,K,I,S,C,A,L,y=new THREE.Color,
 M=new THREE.Color,D=new THREE.Color,x=new THREE.Color,z=new THREE.Color,W,w,O,Y,H,ja,ka,la,ma,$=new THREE.Rectangle,N=new THREE.Rectangle,E=new THREE.Rectangle,T=!1,P=new THREE.Color,aa=new THREE.Color,na=new THREE.Color,oa=new THREE.Color,La=Math.PI*2,Q=new THREE.Vector3,ra,sa,Ca,ba,ta,xa,pa=16;ra=document.createElement("canvas");ra.width=ra.height=2;sa=ra.getContext("2d");sa.fillStyle="rgba(0,0,0,1)";sa.fillRect(0,0,2,2);Ca=sa.getImageData(0,0,2,2);ba=Ca.data;ta=document.createElement("canvas");
-ta.width=ta.height=pa;xa=ta.getContext("2d");xa.translate(-pa/2,-pa/2);xa.scale(pa,pa);pa--;this.domElement=e;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setSize=function(U,da){f=U;g=da;j=f/2;h=g/2;e.width=f;e.height=g;$.set(-j,-h,j,h);o=1;q=0;v=u=null;s=1};this.setClearColor=function(U,da){p=U;n=da};this.setClearColorHex=function(U,da){p.setHex(U);n=da};this.clear=function(){i.setTransform(1,0,0,-1,j,h);if(!N.isEmpty()){N.inflate(1);N.minSelf($);if(p.hex==0&&n==0)i.clearRect(N.getX(),
-N.getY(),N.getWidth(),N.getHeight());else{b(THREE.NormalBlending);a(1);i.fillStyle="rgba("+Math.floor(p.r*255)+","+Math.floor(p.g*255)+","+Math.floor(p.b*255)+","+n+")";i.fillRect(N.getX(),N.getY(),N.getWidth(),N.getHeight())}N.empty()}};this.render=function(U,da){function Ma(l){var B,t,m,r=l.lights;aa.setRGB(0,0,0);na.setRGB(0,0,0);oa.setRGB(0,0,0);l=0;for(B=r.length;l<B;l++){t=r[l];m=t.color;if(t instanceof THREE.AmbientLight){aa.r+=m.r;aa.g+=m.g;aa.b+=m.b}else if(t instanceof THREE.DirectionalLight){na.r+=
-m.r;na.g+=m.g;na.b+=m.b}else if(t instanceof THREE.PointLight){oa.r+=m.r;oa.g+=m.g;oa.b+=m.b}}}function ya(l,B,t,m){var r,J,V,X,Z=l.lights;l=0;for(r=Z.length;l<r;l++){J=Z[l];V=J.color;X=J.intensity;if(J instanceof THREE.DirectionalLight){J=t.dot(J.position)*X;if(J>0){m.r+=V.r*J;m.g+=V.g*J;m.b+=V.b*J}}else if(J instanceof THREE.PointLight){Q.sub(J.position,B);Q.normalize();J=t.dot(Q)*X;if(J>0){m.r+=V.r*J;m.g+=V.g*J;m.b+=V.b*J}}}}function Na(l,B,t){if(t.opacity!=0){a(t.opacity);b(t.blending);var m,
-r,J,V,X,Z;if(t instanceof THREE.ParticleBasicMaterial){if(t.map){V=t.map.image;X=V.width>>1;Z=V.height>>1;r=B.scale.x*j;J=B.scale.y*h;t=r*X;m=J*Z;E.set(l.x-t,l.y-m,l.x+t,l.y+m);if($.instersects(E)){i.save();i.translate(l.x,l.y);i.rotate(-B.rotation);i.scale(r,-J);i.translate(-X,-Z);i.drawImage(V,0,0);i.restore()}}}else if(t instanceof THREE.ParticleCircleMaterial){if(T){P.r=aa.r+na.r+oa.r;P.g=aa.g+na.g+oa.g;P.b=aa.b+na.b+oa.b;y.r=t.color.r*P.r;y.g=t.color.g*P.g;y.b=t.color.b*P.b;y.updateStyleString()}else y.__styleString=
-t.color.__styleString;t=B.scale.x*j;m=B.scale.y*h;E.set(l.x-t,l.y-m,l.x+t,l.y+m);if($.instersects(E)){r=y.__styleString;if(v!=r)i.fillStyle=v=r;i.save();i.translate(l.x,l.y);i.rotate(-B.rotation);i.scale(t,m);i.beginPath();i.arc(0,0,1,0,La,!0);i.closePath();i.fill();i.restore()}}}}function Oa(l,B,t,m){if(m.opacity!=0){a(m.opacity);b(m.blending);i.beginPath();i.moveTo(l.positionScreen.x,l.positionScreen.y);i.lineTo(B.positionScreen.x,B.positionScreen.y);i.closePath();if(m instanceof THREE.LineBasicMaterial){y.__styleString=
-m.color.__styleString;l=m.linewidth;if(s!=l)i.lineWidth=s=l;l=y.__styleString;if(u!=l)i.strokeStyle=u=l;i.stroke();E.inflate(m.linewidth*2)}}}function Ha(l,B,t,m,r,J){if(r.opacity!=0){a(r.opacity);b(r.blending);K=l.positionScreen.x;I=l.positionScreen.y;S=B.positionScreen.x;C=B.positionScreen.y;A=t.positionScreen.x;L=t.positionScreen.y;i.beginPath();i.moveTo(K,I);i.lineTo(S,C);i.lineTo(A,L);i.lineTo(K,I);i.closePath();if(r instanceof THREE.MeshBasicMaterial)if(r.map)r.map.mapping instanceof THREE.UVMapping&&
-ua(K,I,S,C,A,L,r.map.image,m.uvs[0].u,m.uvs[0].v,m.uvs[1].u,m.uvs[1].v,m.uvs[2].u,m.uvs[2].v);else if(r.envMap){if(r.envMap.mapping instanceof THREE.SphericalReflectionMapping){l=da.matrixWorldInverse;Q.copy(m.vertexNormalsWorld[0]);Y=(Q.x*l.n11+Q.y*l.n12+Q.z*l.n13)*0.5+0.5;H=-(Q.x*l.n21+Q.y*l.n22+Q.z*l.n23)*0.5+0.5;Q.copy(m.vertexNormalsWorld[1]);ja=(Q.x*l.n11+Q.y*l.n12+Q.z*l.n13)*0.5+0.5;ka=-(Q.x*l.n21+Q.y*l.n22+Q.z*l.n23)*0.5+0.5;Q.copy(m.vertexNormalsWorld[2]);la=(Q.x*l.n11+Q.y*l.n12+Q.z*l.n13)*
-0.5+0.5;ma=-(Q.x*l.n21+Q.y*l.n22+Q.z*l.n23)*0.5+0.5;ua(K,I,S,C,A,L,r.envMap.image,Y,H,ja,ka,la,ma)}}else r.wireframe?za(r.color.__styleString,r.wireframeLinewidth):Aa(r.color.__styleString);else if(r instanceof THREE.MeshLambertMaterial){if(r.map&&!r.wireframe){r.map.mapping instanceof THREE.UVMapping&&ua(K,I,S,C,A,L,r.map.image,m.uvs[0].u,m.uvs[0].v,m.uvs[1].u,m.uvs[1].v,m.uvs[2].u,m.uvs[2].v);b(THREE.SubtractiveBlending)}if(T)if(!r.wireframe&&r.shading==THREE.SmoothShading&&m.vertexNormalsWorld.length==
-3){M.r=D.r=x.r=aa.r;M.g=D.g=x.g=aa.g;M.b=D.b=x.b=aa.b;ya(J,m.v1.positionWorld,m.vertexNormalsWorld[0],M);ya(J,m.v2.positionWorld,m.vertexNormalsWorld[1],D);ya(J,m.v3.positionWorld,m.vertexNormalsWorld[2],x);z.r=(D.r+x.r)*0.5;z.g=(D.g+x.g)*0.5;z.b=(D.b+x.b)*0.5;O=Ia(M,D,x,z);ua(K,I,S,C,A,L,O,0,0,1,0,0,1)}else{P.r=aa.r;P.g=aa.g;P.b=aa.b;ya(J,m.centroidWorld,m.normalWorld,P);y.r=r.color.r*P.r;y.g=r.color.g*P.g;y.b=r.color.b*P.b;y.updateStyleString();r.wireframe?za(y.__styleString,r.wireframeLinewidth):
-Aa(y.__styleString)}else r.wireframe?za(r.color.__styleString,r.wireframeLinewidth):Aa(r.color.__styleString)}else if(r instanceof THREE.MeshDepthMaterial){W=da.near;w=da.far;M.r=M.g=M.b=1-Da(l.positionScreen.z,W,w);D.r=D.g=D.b=1-Da(B.positionScreen.z,W,w);x.r=x.g=x.b=1-Da(t.positionScreen.z,W,w);z.r=(D.r+x.r)*0.5;z.g=(D.g+x.g)*0.5;z.b=(D.b+x.b)*0.5;O=Ia(M,D,x,z);ua(K,I,S,C,A,L,O,0,0,1,0,0,1)}else if(r instanceof THREE.MeshNormalMaterial){y.r=Ea(m.normalWorld.x);y.g=Ea(m.normalWorld.y);y.b=Ea(m.normalWorld.z);
-y.updateStyleString();r.wireframe?za(y.__styleString,r.wireframeLinewidth):Aa(y.__styleString)}}}function za(l,B){if(u!=l)i.strokeStyle=u=l;if(s!=B)i.lineWidth=s=B;i.stroke();E.inflate(B*2)}function Aa(l){if(v!=l)i.fillStyle=v=l;i.fill()}function ua(l,B,t,m,r,J,V,X,Z,ga,ca,ha,va){var ea,ia;ea=V.width-1;ia=V.height-1;X*=ea;Z*=ia;ga*=ea;ca*=ia;ha*=ea;va*=ia;t-=l;m-=B;r-=l;J-=B;ga-=X;ca-=Z;ha-=X;va-=Z;ea=ga*va-ha*ca;if(ea!=0){ia=1/ea;ea=(va*t-ca*r)*ia;ca=(va*m-ca*J)*ia;t=(ga*r-ha*t)*ia;m=(ga*J-ha*m)*
-ia;l=l-ea*X-t*Z;B=B-ca*X-m*Z;i.save();i.transform(ea,ca,t,m,l,B);i.clip();i.drawImage(V,0,0);i.restore()}}function Ia(l,B,t,m){var r=~~(l.r*255),J=~~(l.g*255);l=~~(l.b*255);var V=~~(B.r*255),X=~~(B.g*255);B=~~(B.b*255);var Z=~~(t.r*255),ga=~~(t.g*255);t=~~(t.b*255);var ca=~~(m.r*255),ha=~~(m.g*255);m=~~(m.b*255);ba[0]=r<0?0:r>255?255:r;ba[1]=J<0?0:J>255?255:J;ba[2]=l<0?0:l>255?255:l;ba[4]=V<0?0:V>255?255:V;ba[5]=X<0?0:X>255?255:X;ba[6]=B<0?0:B>255?255:B;ba[8]=Z<0?0:Z>255?255:Z;ba[9]=ga<0?0:ga>255?
-255:ga;ba[10]=t<0?0:t>255?255:t;ba[12]=ca<0?0:ca>255?255:ca;ba[13]=ha<0?0:ha>255?255:ha;ba[14]=m<0?0:m>255?255:m;sa.putImageData(Ca,0,0);xa.drawImage(ra,0,0);return ta}function Da(l,B,t){l=(l-B)/(t-B);return l*l*(3-2*l)}function Ea(l){l=(l+1)*0.5;return l<0?0:l>1?1:l}function Fa(l,B){var t=B.x-l.x,m=B.y-l.y,r=1/Math.sqrt(t*t+m*m);t*=r;m*=r;B.x+=t;B.y+=m;l.x-=t;l.y-=m}var Ba,Ja,R,fa,qa,Ga,Ka,wa;this.autoClear?this.clear():i.setTransform(1,0,0,-1,j,h);c=d.projectScene(U,da,this.sortElements);(T=U.lights.length>
-0)&&Ma(U);Ba=0;for(Ja=c.length;Ba<Ja;Ba++){R=c[Ba];E.empty();if(R instanceof THREE.RenderableParticle){k=R;k.x*=j;k.y*=h;fa=0;for(qa=R.materials.length;fa<qa;fa++)Na(k,R,R.materials[fa],U)}else if(R instanceof THREE.RenderableLine){k=R.v1;G=R.v2;k.positionScreen.x*=j;k.positionScreen.y*=h;G.positionScreen.x*=j;G.positionScreen.y*=h;E.addPoint(k.positionScreen.x,k.positionScreen.y);E.addPoint(G.positionScreen.x,G.positionScreen.y);if($.instersects(E)){fa=0;for(qa=R.materials.length;fa<qa;)Oa(k,G,R,
-R.materials[fa++],U)}}else if(R instanceof THREE.RenderableFace3){k=R.v1;G=R.v2;F=R.v3;k.positionScreen.x*=j;k.positionScreen.y*=h;G.positionScreen.x*=j;G.positionScreen.y*=h;F.positionScreen.x*=j;F.positionScreen.y*=h;if(R.overdraw){Fa(k.positionScreen,G.positionScreen);Fa(G.positionScreen,F.positionScreen);Fa(F.positionScreen,k.positionScreen)}E.add3Points(k.positionScreen.x,k.positionScreen.y,G.positionScreen.x,G.positionScreen.y,F.positionScreen.x,F.positionScreen.y);if($.instersects(E)){fa=0;
-for(qa=R.meshMaterials.length;fa<qa;){wa=R.meshMaterials[fa++];if(wa instanceof THREE.MeshFaceMaterial){Ga=0;for(Ka=R.faceMaterials.length;Ga<Ka;)(wa=R.faceMaterials[Ga++])&&Ha(k,G,F,R,wa,U)}else Ha(k,G,F,R,wa,U)}}}N.addRectangle(E)}i.setTransform(1,0,0,1,0,0)}};
+ta.width=ta.height=pa;xa=ta.getContext("2d");xa.translate(-pa/2,-pa/2);xa.scale(pa,pa);pa--;this.domElement=e;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setSize=function(U,da){f=U;g=da;i=f/2;h=g/2;e.width=f;e.height=g;$.set(-i,-h,i,h);p=1;m=0;t=v=null;s=1};this.setClearColor=function(U,da){o=U;n=da};this.setClearColorHex=function(U,da){o.setHex(U);n=da};this.clear=function(){j.setTransform(1,0,0,-1,i,h);if(!N.isEmpty()){N.inflate(1);N.minSelf($);if(o.hex==0&&n==0)j.clearRect(N.getX(),
+N.getY(),N.getWidth(),N.getHeight());else{b(THREE.NormalBlending);a(1);j.fillStyle="rgba("+Math.floor(o.r*255)+","+Math.floor(o.g*255)+","+Math.floor(o.b*255)+","+n+")";j.fillRect(N.getX(),N.getY(),N.getWidth(),N.getHeight())}N.empty()}};this.render=function(U,da){function Ma(l){var B,u,q,r=l.lights;aa.setRGB(0,0,0);na.setRGB(0,0,0);oa.setRGB(0,0,0);l=0;for(B=r.length;l<B;l++){u=r[l];q=u.color;if(u instanceof THREE.AmbientLight){aa.r+=q.r;aa.g+=q.g;aa.b+=q.b}else if(u instanceof THREE.DirectionalLight){na.r+=
+q.r;na.g+=q.g;na.b+=q.b}else if(u instanceof THREE.PointLight){oa.r+=q.r;oa.g+=q.g;oa.b+=q.b}}}function ya(l,B,u,q){var r,J,V,X,Z=l.lights;l=0;for(r=Z.length;l<r;l++){J=Z[l];V=J.color;X=J.intensity;if(J instanceof THREE.DirectionalLight){J=u.dot(J.position)*X;if(J>0){q.r+=V.r*J;q.g+=V.g*J;q.b+=V.b*J}}else if(J instanceof THREE.PointLight){Q.sub(J.position,B);Q.normalize();J=u.dot(Q)*X;if(J>0){q.r+=V.r*J;q.g+=V.g*J;q.b+=V.b*J}}}}function Na(l,B,u){if(u.opacity!=0){a(u.opacity);b(u.blending);var q,
+r,J,V,X,Z;if(u instanceof THREE.ParticleBasicMaterial){if(u.map){V=u.map.image;X=V.width>>1;Z=V.height>>1;r=B.scale.x*i;J=B.scale.y*h;u=r*X;q=J*Z;E.set(l.x-u,l.y-q,l.x+u,l.y+q);if($.instersects(E)){j.save();j.translate(l.x,l.y);j.rotate(-B.rotation);j.scale(r,-J);j.translate(-X,-Z);j.drawImage(V,0,0);j.restore()}}}else if(u instanceof THREE.ParticleCircleMaterial){if(T){P.r=aa.r+na.r+oa.r;P.g=aa.g+na.g+oa.g;P.b=aa.b+na.b+oa.b;y.r=u.color.r*P.r;y.g=u.color.g*P.g;y.b=u.color.b*P.b;y.updateStyleString()}else y.__styleString=
+u.color.__styleString;u=B.scale.x*i;q=B.scale.y*h;E.set(l.x-u,l.y-q,l.x+u,l.y+q);if($.instersects(E)){r=y.__styleString;if(t!=r)j.fillStyle=t=r;j.save();j.translate(l.x,l.y);j.rotate(-B.rotation);j.scale(u,q);j.beginPath();j.arc(0,0,1,0,La,!0);j.closePath();j.fill();j.restore()}}}}function Oa(l,B,u,q){if(q.opacity!=0){a(q.opacity);b(q.blending);j.beginPath();j.moveTo(l.positionScreen.x,l.positionScreen.y);j.lineTo(B.positionScreen.x,B.positionScreen.y);j.closePath();if(q instanceof THREE.LineBasicMaterial){y.__styleString=
+q.color.__styleString;l=q.linewidth;if(s!=l)j.lineWidth=s=l;l=y.__styleString;if(v!=l)j.strokeStyle=v=l;j.stroke();E.inflate(q.linewidth*2)}}}function Ha(l,B,u,q,r,J){if(r.opacity!=0){a(r.opacity);b(r.blending);K=l.positionScreen.x;I=l.positionScreen.y;S=B.positionScreen.x;C=B.positionScreen.y;A=u.positionScreen.x;L=u.positionScreen.y;j.beginPath();j.moveTo(K,I);j.lineTo(S,C);j.lineTo(A,L);j.lineTo(K,I);j.closePath();if(r instanceof THREE.MeshBasicMaterial)if(r.map)r.map.mapping instanceof THREE.UVMapping&&
+ua(K,I,S,C,A,L,r.map.image,q.uvs[0].u,q.uvs[0].v,q.uvs[1].u,q.uvs[1].v,q.uvs[2].u,q.uvs[2].v);else if(r.envMap){if(r.envMap.mapping instanceof THREE.SphericalReflectionMapping){l=da.matrixWorldInverse;Q.copy(q.vertexNormalsWorld[0]);Y=(Q.x*l.n11+Q.y*l.n12+Q.z*l.n13)*0.5+0.5;H=-(Q.x*l.n21+Q.y*l.n22+Q.z*l.n23)*0.5+0.5;Q.copy(q.vertexNormalsWorld[1]);ja=(Q.x*l.n11+Q.y*l.n12+Q.z*l.n13)*0.5+0.5;ka=-(Q.x*l.n21+Q.y*l.n22+Q.z*l.n23)*0.5+0.5;Q.copy(q.vertexNormalsWorld[2]);la=(Q.x*l.n11+Q.y*l.n12+Q.z*l.n13)*
+0.5+0.5;ma=-(Q.x*l.n21+Q.y*l.n22+Q.z*l.n23)*0.5+0.5;ua(K,I,S,C,A,L,r.envMap.image,Y,H,ja,ka,la,ma)}}else r.wireframe?za(r.color.__styleString,r.wireframeLinewidth):Aa(r.color.__styleString);else if(r instanceof THREE.MeshLambertMaterial){if(r.map&&!r.wireframe){r.map.mapping instanceof THREE.UVMapping&&ua(K,I,S,C,A,L,r.map.image,q.uvs[0].u,q.uvs[0].v,q.uvs[1].u,q.uvs[1].v,q.uvs[2].u,q.uvs[2].v);b(THREE.SubtractiveBlending)}if(T)if(!r.wireframe&&r.shading==THREE.SmoothShading&&q.vertexNormalsWorld.length==
+3){M.r=D.r=x.r=aa.r;M.g=D.g=x.g=aa.g;M.b=D.b=x.b=aa.b;ya(J,q.v1.positionWorld,q.vertexNormalsWorld[0],M);ya(J,q.v2.positionWorld,q.vertexNormalsWorld[1],D);ya(J,q.v3.positionWorld,q.vertexNormalsWorld[2],x);z.r=(D.r+x.r)*0.5;z.g=(D.g+x.g)*0.5;z.b=(D.b+x.b)*0.5;O=Ia(M,D,x,z);ua(K,I,S,C,A,L,O,0,0,1,0,0,1)}else{P.r=aa.r;P.g=aa.g;P.b=aa.b;ya(J,q.centroidWorld,q.normalWorld,P);y.r=r.color.r*P.r;y.g=r.color.g*P.g;y.b=r.color.b*P.b;y.updateStyleString();r.wireframe?za(y.__styleString,r.wireframeLinewidth):
+Aa(y.__styleString)}else r.wireframe?za(r.color.__styleString,r.wireframeLinewidth):Aa(r.color.__styleString)}else if(r instanceof THREE.MeshDepthMaterial){W=da.near;w=da.far;M.r=M.g=M.b=1-Da(l.positionScreen.z,W,w);D.r=D.g=D.b=1-Da(B.positionScreen.z,W,w);x.r=x.g=x.b=1-Da(u.positionScreen.z,W,w);z.r=(D.r+x.r)*0.5;z.g=(D.g+x.g)*0.5;z.b=(D.b+x.b)*0.5;O=Ia(M,D,x,z);ua(K,I,S,C,A,L,O,0,0,1,0,0,1)}else if(r instanceof THREE.MeshNormalMaterial){y.r=Ea(q.normalWorld.x);y.g=Ea(q.normalWorld.y);y.b=Ea(q.normalWorld.z);
+y.updateStyleString();r.wireframe?za(y.__styleString,r.wireframeLinewidth):Aa(y.__styleString)}}}function za(l,B){if(v!=l)j.strokeStyle=v=l;if(s!=B)j.lineWidth=s=B;j.stroke();E.inflate(B*2)}function Aa(l){if(t!=l)j.fillStyle=t=l;j.fill()}function ua(l,B,u,q,r,J,V,X,Z,ga,ca,ha,va){var ea,ia;ea=V.width-1;ia=V.height-1;X*=ea;Z*=ia;ga*=ea;ca*=ia;ha*=ea;va*=ia;u-=l;q-=B;r-=l;J-=B;ga-=X;ca-=Z;ha-=X;va-=Z;ea=ga*va-ha*ca;if(ea!=0){ia=1/ea;ea=(va*u-ca*r)*ia;ca=(va*q-ca*J)*ia;u=(ga*r-ha*u)*ia;q=(ga*J-ha*q)*
+ia;l=l-ea*X-u*Z;B=B-ca*X-q*Z;j.save();j.transform(ea,ca,u,q,l,B);j.clip();j.drawImage(V,0,0);j.restore()}}function Ia(l,B,u,q){var r=~~(l.r*255),J=~~(l.g*255);l=~~(l.b*255);var V=~~(B.r*255),X=~~(B.g*255);B=~~(B.b*255);var Z=~~(u.r*255),ga=~~(u.g*255);u=~~(u.b*255);var ca=~~(q.r*255),ha=~~(q.g*255);q=~~(q.b*255);ba[0]=r<0?0:r>255?255:r;ba[1]=J<0?0:J>255?255:J;ba[2]=l<0?0:l>255?255:l;ba[4]=V<0?0:V>255?255:V;ba[5]=X<0?0:X>255?255:X;ba[6]=B<0?0:B>255?255:B;ba[8]=Z<0?0:Z>255?255:Z;ba[9]=ga<0?0:ga>255?
+255:ga;ba[10]=u<0?0:u>255?255:u;ba[12]=ca<0?0:ca>255?255:ca;ba[13]=ha<0?0:ha>255?255:ha;ba[14]=q<0?0:q>255?255:q;sa.putImageData(Ca,0,0);xa.drawImage(ra,0,0);return ta}function Da(l,B,u){l=(l-B)/(u-B);return l*l*(3-2*l)}function Ea(l){l=(l+1)*0.5;return l<0?0:l>1?1:l}function Fa(l,B){var u=B.x-l.x,q=B.y-l.y,r=1/Math.sqrt(u*u+q*q);u*=r;q*=r;B.x+=u;B.y+=q;l.x-=u;l.y-=q}var Ba,Ja,R,fa,qa,Ga,Ka,wa;this.autoClear?this.clear():j.setTransform(1,0,0,-1,i,h);c=d.projectScene(U,da,this.sortElements);(T=U.lights.length>
+0)&&Ma(U);Ba=0;for(Ja=c.length;Ba<Ja;Ba++){R=c[Ba];E.empty();if(R instanceof THREE.RenderableParticle){k=R;k.x*=i;k.y*=h;fa=0;for(qa=R.materials.length;fa<qa;fa++)Na(k,R,R.materials[fa],U)}else if(R instanceof THREE.RenderableLine){k=R.v1;G=R.v2;k.positionScreen.x*=i;k.positionScreen.y*=h;G.positionScreen.x*=i;G.positionScreen.y*=h;E.addPoint(k.positionScreen.x,k.positionScreen.y);E.addPoint(G.positionScreen.x,G.positionScreen.y);if($.instersects(E)){fa=0;for(qa=R.materials.length;fa<qa;)Oa(k,G,R,
+R.materials[fa++],U)}}else if(R instanceof THREE.RenderableFace3){k=R.v1;G=R.v2;F=R.v3;k.positionScreen.x*=i;k.positionScreen.y*=h;G.positionScreen.x*=i;G.positionScreen.y*=h;F.positionScreen.x*=i;F.positionScreen.y*=h;if(R.overdraw){Fa(k.positionScreen,G.positionScreen);Fa(G.positionScreen,F.positionScreen);Fa(F.positionScreen,k.positionScreen)}E.add3Points(k.positionScreen.x,k.positionScreen.y,G.positionScreen.x,G.positionScreen.y,F.positionScreen.x,F.positionScreen.y);if($.instersects(E)){fa=0;
+for(qa=R.meshMaterials.length;fa<qa;){wa=R.meshMaterials[fa++];if(wa instanceof THREE.MeshFaceMaterial){Ga=0;for(Ka=R.faceMaterials.length;Ga<Ka;)(wa=R.faceMaterials[Ga++])&&Ha(k,G,F,R,wa,U)}else Ha(k,G,F,R,wa,U)}}}N.addRectangle(E)}j.setTransform(1,0,0,1,0,0)}};
 THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(a,b,c){c&&a.update(undefined,!1,b);c=a.sounds;var d,e=c.length;for(d=0;d<e;d++){a=c[d];this.soundPosition.set(a.matrixWorld.n14,a.matrixWorld.n24,a.matrixWorld.n34);this.soundPosition.subSelf(b.position);if(a.isPlaying&&a.isLoaded){a.isAddedToDOM||a.addToDOM(this.domElement);a.calculateVolumeAndPan(this.soundPosition)}}}};
 THREE.RenderableObject=function(){this.z=this.object=null};THREE.RenderableFace3=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.v3=new THREE.Vertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[null,null,null]};
 THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.materials=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.materials=null};

+ 69 - 51
build/custom/ThreeDOM.js

@@ -1,85 +1,103 @@
 // ThreeDOM.js r36 - http://github.com/mrdoob/three.js
 var THREE=THREE||{};THREE.Color=function(a){this.setHex(a)};
-THREE.Color.prototype={autoUpdate:!0,setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,b,c){var d,e,f,g,i,h;if(c==0)d=e=f=0;else{g=Math.floor(a*6);i=a*6-g;a=c*(1-b);h=c*(1-b*i);b=c*(1-b*(1-i));switch(g){case 1:d=h;e=c;f=a;break;case 2:d=a;e=c;f=b;break;case 3:d=a;e=h;f=c;break;case 4:d=b;e=a;f=c;break;case 5:d=c;e=a;f=h;break;case 6:case 0:d=c;e=b;f=a}}this.r=d;this.g=e;this.b=f;if(this.autoUpdate){this.updateHex();
+THREE.Color.prototype={autoUpdate:!0,setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,b,c){var e,d,f,g,i,h;if(c==0)e=d=f=0;else{g=Math.floor(a*6);i=a*6-g;a=c*(1-b);h=c*(1-b*i);b=c*(1-b*(1-i));switch(g){case 1:e=h;d=c;f=a;break;case 2:e=a;d=c;f=b;break;case 3:e=a;d=h;f=c;break;case 4:e=b;d=a;f=c;break;case 5:e=c;d=a;f=h;break;case 6:case 0:e=c;d=b;f=a}}this.r=e;this.g=d;this.b=f;if(this.autoUpdate){this.updateHex();
 this.updateStyleString()}},setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGB();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+","+~~(this.g*255)+","+~~(this.b*255)+")"},clone:function(){return new THREE.Color(this.hex)}};
 THREE.Vector2=function(a,b){this.set(a||0,b||0)};
 THREE.Vector2.prototype={set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.set(a.x,a.y);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a);return this},negate:function(){this.set(-this.x,-this.y);return this},unit:function(){this.multiplyScalar(1/
 this.length());return this},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y},clone:function(){return new THREE.Vector2(this.x,this.y)}};THREE.Vector3=function(a,b,c){this.set(a||0,b||0,c||0)};
 THREE.Vector3.prototype={set:function(a,b,c){this.x=a;this.y=b;this.z=c;return this},copy:function(a){this.set(a.x,a.y,a.z);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z);return this},addScalar:function(a){this.set(this.x+a,this.y+a,this.z+a);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z);return this},cross:function(a,
-b){this.set(a.y*b.z-a.z*b.y,a.z*b.x-a.x*b.z,a.x*b.y-a.y*b.x);return this},crossSelf:function(a){var b=this.x,c=this.y,d=this.z;this.set(c*a.z-d*a.y,d*a.x-b*a.z,b*a.y-c*a.x);return this},multiply:function(a,b){this.set(a.x*b.x,a.y*b.y,a.z*b.z);return this},multiplySelf:function(a){this.set(this.x*a.x,this.y*a.y,this.z*a.z);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a,this.z*a);return this},divideSelf:function(a){this.set(this.x/a.x,this.y/a.y,this.z/a.z);return this},divideScalar:function(a){this.set(this.x/
+b){this.set(a.y*b.z-a.z*b.y,a.z*b.x-a.x*b.z,a.x*b.y-a.y*b.x);return this},crossSelf:function(a){var b=this.x,c=this.y,e=this.z;this.set(c*a.z-e*a.y,e*a.x-b*a.z,b*a.y-c*a.x);return this},multiply:function(a,b){this.set(a.x*b.x,a.y*b.y,a.z*b.z);return this},multiplySelf:function(a){this.set(this.x*a.x,this.y*a.y,this.z*a.z);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a,this.z*a);return this},divideSelf:function(a){this.set(this.x/a.x,this.y/a.y,this.z/a.z);return this},divideScalar:function(a){this.set(this.x/
 a,this.y/a,this.z/a);return this},negate:function(){this.set(-this.x,-this.y,-this.z);return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,c=this.y-a.y;a=this.z-a.z;return b*b+c*c+a*a},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},lengthManhattan:function(){return this.x+this.y+this.z},normalize:function(){var a=
 this.length();a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setPositionFromMatrix:function(a){this.x=a.n14;this.y=a.n24;this.z=a.n34},setRotationFromMatrix:function(a){this.y=Math.asin(a.n13);var b=Math.cos(this.y);if(Math.abs(b)>1.0E-5){this.x=Math.atan2(-a.n23/b,a.n33/b);this.z=Math.atan2(-a.n13/b,a.n11/b)}else{this.x=0;this.z=Math.atan2(a.n21,a.n22)}},setLength:function(a){return this.normalize().multiplyScalar(a)},isZero:function(){return Math.abs(this.x)<1.0E-4&&Math.abs(this.y)<
-1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,b,c,d){this.set(a||0,b||0,c||0,d||1)};
-THREE.Vector4.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z,a.w+b.w);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z,this.w+a.w);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z,a.w-b.w);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z,this.w-a.w);return this},multiplyScalar:function(a){this.set(this.x*
+1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,b,c,e){this.set(a||0,b||0,c||0,e||1)};
+THREE.Vector4.prototype={set:function(a,b,c,e){this.x=a;this.y=b;this.z=c;this.w=e;return this},copy:function(a){this.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z,a.w+b.w);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z,this.w+a.w);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z,a.w-b.w);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z,this.w-a.w);return this},multiplyScalar:function(a){this.set(this.x*
 a,this.y*a,this.z*a,this.w*a);return this},divideScalar:function(a){this.set(this.x/a,this.y/a,this.z/a,this.w/a);return this},lerpSelf:function(a,b){this.set(this.x+(a.x-this.x)*b,this.y+(a.y-this.y)*b,this.z+(a.z-this.z)*b,this.w+(a.w-this.w)*b)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
-THREE.Ray.prototype={intersectScene:function(a){var b,c,d=a.objects,e=[];a=0;for(b=d.length;a<b;a++){c=d[a];c instanceof THREE.Mesh&&(e=e.concat(this.intersectObject(c)))}e.sort(function(f,g){return f.distance-g.distance});return e},intersectObject:function(a){function b(p,k,D,z){z=z.clone().subSelf(k);D=D.clone().subSelf(k);var G=p.clone().subSelf(k);p=z.dot(z);k=z.dot(D);z=z.dot(G);var H=D.dot(D);D=D.dot(G);G=1/(p*H-k*k);H=(H*z-k*D)*G;p=(p*D-k*z)*G;return H>0&&p>0&&H+p<1}var c,d,e,f,g,i,h,j,n,m,
-l,o=a.geometry,q=o.vertices,r=[];c=0;for(d=o.faces.length;c<d;c++){e=o.faces[c];m=this.origin.clone();l=this.direction.clone();h=a.matrixWorld;f=h.multiplyVector3(q[e.a].position.clone());g=h.multiplyVector3(q[e.b].position.clone());i=h.multiplyVector3(q[e.c].position.clone());h=e instanceof THREE.Face4?h.multiplyVector3(q[e.d].position.clone()):null;j=a.matrixRotationWorld.multiplyVector3(e.normal.clone());n=l.dot(j);if(n<0){j=j.dot((new THREE.Vector3).sub(f,m))/n;m=m.addSelf(l.multiplyScalar(j));
-if(e instanceof THREE.Face3){if(b(m,f,g,i)){e={distance:this.origin.distanceTo(m),point:m,face:e,object:a};r.push(e)}}else if(e instanceof THREE.Face4&&(b(m,f,g,h)||b(m,g,i,h))){e={distance:this.origin.distanceTo(m),point:m,face:e,object:a};r.push(e)}}}return r}};
-THREE.Rectangle=function(){function a(){f=d-b;g=e-c}var b,c,d,e,f,g,i=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return f};this.getHeight=function(){return g};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(h,j,n,m){i=!1;b=h;c=j;d=n;e=m;a()};this.addPoint=function(h,j){if(i){i=!1;b=h;c=j;d=h;e=j}else{b=b<h?b:h;c=c<j?c:j;d=d>h?d:h;e=e>j?e:j}a()};
-this.add3Points=function(h,j,n,m,l,o){if(i){i=!1;b=h<n?h<l?h:l:n<l?n:l;c=j<m?j<o?j:o:m<o?m:o;d=h>n?h>l?h:l:n>l?n:l;e=j>m?j>o?j:o:m>o?m:o}else{b=h<n?h<l?h<b?h:b:l<b?l:b:n<l?n<b?n:b:l<b?l:b;c=j<m?j<o?j<c?j:c:o<c?o:c:m<o?m<c?m:c:o<c?o:c;d=h>n?h>l?h>d?h:d:l>d?l:d:n>l?n>d?n:d:l>d?l:d;e=j>m?j>o?j>e?j:e:o>e?o:e:m>o?m>e?m:e:o>e?o:e}a()};this.addRectangle=function(h){if(i){i=!1;b=h.getLeft();c=h.getTop();d=h.getRight();e=h.getBottom()}else{b=b<h.getLeft()?b:h.getLeft();c=c<h.getTop()?c:h.getTop();d=d>h.getRight()?
-d:h.getRight();e=e>h.getBottom()?e:h.getBottom()}a()};this.inflate=function(h){b-=h;c-=h;d+=h;e+=h;a()};this.minSelf=function(h){b=b>h.getLeft()?b:h.getLeft();c=c>h.getTop()?c:h.getTop();d=d<h.getRight()?d:h.getRight();e=e<h.getBottom()?e:h.getBottom();a()};this.instersects=function(h){return Math.min(d,h.getRight())-Math.max(b,h.getLeft())>=0&&Math.min(e,h.getBottom())-Math.max(c,h.getTop())>=0};this.empty=function(){i=!0;e=d=c=b=0;a()};this.isEmpty=function(){return i}};
+THREE.Ray.prototype={intersectScene:function(a){var b,c,e=a.objects,d=[];a=0;for(b=e.length;a<b;a++){c=e[a];c instanceof THREE.Mesh&&(d=d.concat(this.intersectObject(c)))}d.sort(function(f,g){return f.distance-g.distance});return d},intersectObject:function(a){function b(q,l,D,z){z=z.clone().subSelf(l);D=D.clone().subSelf(l);var G=q.clone().subSelf(l);q=z.dot(z);l=z.dot(D);z=z.dot(G);var H=D.dot(D);D=D.dot(G);G=1/(q*H-l*l);H=(H*z-l*D)*G;q=(q*D-l*z)*G;return H>0&&q>0&&H+q<1}var c,e,d,f,g,i,h,j,o,m,
+n,k=a.geometry,r=k.vertices,p=[];c=0;for(e=k.faces.length;c<e;c++){d=k.faces[c];m=this.origin.clone();n=this.direction.clone();h=a.matrixWorld;f=h.multiplyVector3(r[d.a].position.clone());g=h.multiplyVector3(r[d.b].position.clone());i=h.multiplyVector3(r[d.c].position.clone());h=d instanceof THREE.Face4?h.multiplyVector3(r[d.d].position.clone()):null;j=a.matrixRotationWorld.multiplyVector3(d.normal.clone());o=n.dot(j);if(o<0){j=j.dot((new THREE.Vector3).sub(f,m))/o;m=m.addSelf(n.multiplyScalar(j));
+if(d instanceof THREE.Face3){if(b(m,f,g,i)){d={distance:this.origin.distanceTo(m),point:m,face:d,object:a};p.push(d)}}else if(d instanceof THREE.Face4&&(b(m,f,g,h)||b(m,g,i,h))){d={distance:this.origin.distanceTo(m),point:m,face:d,object:a};p.push(d)}}}return p}};
+THREE.Rectangle=function(){function a(){f=e-b;g=d-c}var b,c,e,d,f,g,i=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return f};this.getHeight=function(){return g};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return e};this.getBottom=function(){return d};this.set=function(h,j,o,m){i=!1;b=h;c=j;e=o;d=m;a()};this.addPoint=function(h,j){if(i){i=!1;b=h;c=j;e=h;d=j}else{b=b<h?b:h;c=c<j?c:j;e=e>h?e:h;d=d>j?d:j}a()};
+this.add3Points=function(h,j,o,m,n,k){if(i){i=!1;b=h<o?h<n?h:n:o<n?o:n;c=j<m?j<k?j:k:m<k?m:k;e=h>o?h>n?h:n:o>n?o:n;d=j>m?j>k?j:k:m>k?m:k}else{b=h<o?h<n?h<b?h:b:n<b?n:b:o<n?o<b?o:b:n<b?n:b;c=j<m?j<k?j<c?j:c:k<c?k:c:m<k?m<c?m:c:k<c?k:c;e=h>o?h>n?h>e?h:e:n>e?n:e:o>n?o>e?o:e:n>e?n:e;d=j>m?j>k?j>d?j:d:k>d?k:d:m>k?m>d?m:d:k>d?k:d}a()};this.addRectangle=function(h){if(i){i=!1;b=h.getLeft();c=h.getTop();e=h.getRight();d=h.getBottom()}else{b=b<h.getLeft()?b:h.getLeft();c=c<h.getTop()?c:h.getTop();e=e>h.getRight()?
+e:h.getRight();d=d>h.getBottom()?d:h.getBottom()}a()};this.inflate=function(h){b-=h;c-=h;e+=h;d+=h;a()};this.minSelf=function(h){b=b>h.getLeft()?b:h.getLeft();c=c>h.getTop()?c:h.getTop();e=e<h.getRight()?e:h.getRight();d=d<h.getBottom()?d:h.getBottom();a()};this.instersects=function(h){return Math.min(e,h.getRight())-Math.max(b,h.getLeft())>=0&&Math.min(d,h.getBottom())-Math.max(c,h.getTop())>=0};this.empty=function(){i=!0;d=e=c=b=0;a()};this.isEmpty=function(){return i}};
 THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};
-THREE.Matrix4=function(a,b,c,d,e,f,g,i,h,j,n,m,l,o,q,r){this.set(a||1,b||0,c||0,d||0,e||0,f||1,g||0,i||0,h||0,j||0,n||1,m||0,l||0,o||0,q||0,r||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={set:function(a,b,c,d,e,f,g,i,h,j,n,m,l,o,q,r){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=e;this.n22=f;this.n23=g;this.n24=i;this.n31=h;this.n32=j;this.n33=n;this.n34=m;this.n41=l;this.n42=o;this.n43=q;this.n44=r;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,b,c){var d=THREE.Matrix4.__v1,
-e=THREE.Matrix4.__v2,f=THREE.Matrix4.__v3;f.sub(a,b).normalize();if(f.length()===0)f.z=1;d.cross(c,f).normalize();if(d.length()===0){f.x+=1.0E-4;d.cross(c,f).normalize()}e.cross(f,d).normalize();this.n11=d.x;this.n12=e.x;this.n13=f.x;this.n21=d.y;this.n22=e.y;this.n23=f.y;this.n31=d.z;this.n32=e.z;this.n33=f.z;return this},multiplyVector3:function(a){var b=a.x,c=a.y,d=a.z,e=1/(this.n41*b+this.n42*c+this.n43*d+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*d+this.n14)*e;a.y=(this.n21*b+this.n22*c+this.n23*
-d+this.n24)*e;a.z=(this.n31*b+this.n32*c+this.n33*d+this.n34)*e;return a},multiplyVector4:function(a){var b=a.x,c=a.y,d=a.z,e=a.w;a.x=this.n11*b+this.n12*c+this.n13*d+this.n14*e;a.y=this.n21*b+this.n22*c+this.n23*d+this.n24*e;a.z=this.n31*b+this.n32*c+this.n33*d+this.n34*e;a.w=this.n41*b+this.n42*c+this.n43*d+this.n44*e;return a},rotateAxis:function(a){var b=a.x,c=a.y,d=a.z;a.x=b*this.n11+c*this.n12+d*this.n13;a.y=b*this.n21+c*this.n22+d*this.n23;a.z=b*this.n31+c*this.n32+d*this.n33;a.normalize();
-return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var c=a.n11,d=a.n12,e=a.n13,f=a.n14,g=a.n21,i=a.n22,h=a.n23,j=a.n24,n=a.n31,m=a.n32,l=a.n33,o=a.n34,q=a.n41,r=a.n42,p=a.n43,k=a.n44,D=b.n11,z=b.n12,G=b.n13,H=b.n14,M=b.n21,x=b.n22,
-v=b.n23,E=b.n24,B=b.n31,F=b.n32,A=b.n33,w=b.n34;this.n11=c*D+d*M+e*B;this.n12=c*z+d*x+e*F;this.n13=c*G+d*v+e*A;this.n14=c*H+d*E+e*w+f;this.n21=g*D+i*M+h*B;this.n22=g*z+i*x+h*F;this.n23=g*G+i*v+h*A;this.n24=g*H+i*E+h*w+j;this.n31=n*D+m*M+l*B;this.n32=n*z+m*x+l*F;this.n33=n*G+m*v+l*A;this.n34=n*H+m*E+l*w+o;this.n41=q*D+r*M+p*B;this.n42=q*z+r*x+p*F;this.n43=q*G+r*v+p*A;this.n44=q*H+r*E+p*w+k;return this},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=
+THREE.Matrix4=function(a,b,c,e,d,f,g,i,h,j,o,m,n,k,r,p){this.set(a||1,b||0,c||0,e||0,d||0,f||1,g||0,i||0,h||0,j||0,o||1,m||0,n||0,k||0,r||0,p||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={set:function(a,b,c,e,d,f,g,i,h,j,o,m,n,k,r,p){this.n11=a;this.n12=b;this.n13=c;this.n14=e;this.n21=d;this.n22=f;this.n23=g;this.n24=i;this.n31=h;this.n32=j;this.n33=o;this.n34=m;this.n41=n;this.n42=k;this.n43=r;this.n44=p;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,b,c){var e=THREE.Matrix4.__v1,
+d=THREE.Matrix4.__v2,f=THREE.Matrix4.__v3;f.sub(a,b).normalize();if(f.length()===0)f.z=1;e.cross(c,f).normalize();if(e.length()===0){f.x+=1.0E-4;e.cross(c,f).normalize()}d.cross(f,e).normalize();this.n11=e.x;this.n12=d.x;this.n13=f.x;this.n21=e.y;this.n22=d.y;this.n23=f.y;this.n31=e.z;this.n32=d.z;this.n33=f.z;return this},multiplyVector3:function(a){var b=a.x,c=a.y,e=a.z,d=1/(this.n41*b+this.n42*c+this.n43*e+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*e+this.n14)*d;a.y=(this.n21*b+this.n22*c+this.n23*
+e+this.n24)*d;a.z=(this.n31*b+this.n32*c+this.n33*e+this.n34)*d;return a},multiplyVector4:function(a){var b=a.x,c=a.y,e=a.z,d=a.w;a.x=this.n11*b+this.n12*c+this.n13*e+this.n14*d;a.y=this.n21*b+this.n22*c+this.n23*e+this.n24*d;a.z=this.n31*b+this.n32*c+this.n33*e+this.n34*d;a.w=this.n41*b+this.n42*c+this.n43*e+this.n44*d;return a},rotateAxis:function(a){var b=a.x,c=a.y,e=a.z;a.x=b*this.n11+c*this.n12+e*this.n13;a.y=b*this.n21+c*this.n22+e*this.n23;a.z=b*this.n31+c*this.n32+e*this.n33;a.normalize();
+return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var c=a.n11,e=a.n12,d=a.n13,f=a.n14,g=a.n21,i=a.n22,h=a.n23,j=a.n24,o=a.n31,m=a.n32,n=a.n33,k=a.n34,r=a.n41,p=a.n42,q=a.n43,l=a.n44,D=b.n11,z=b.n12,G=b.n13,H=b.n14,M=b.n21,x=b.n22,
+v=b.n23,E=b.n24,B=b.n31,F=b.n32,A=b.n33,w=b.n34;this.n11=c*D+e*M+d*B;this.n12=c*z+e*x+d*F;this.n13=c*G+e*v+d*A;this.n14=c*H+e*E+d*w+f;this.n21=g*D+i*M+h*B;this.n22=g*z+i*x+h*F;this.n23=g*G+i*v+h*A;this.n24=g*H+i*E+h*w+j;this.n31=o*D+m*M+n*B;this.n32=o*z+m*x+n*F;this.n33=o*G+m*v+n*A;this.n34=o*H+m*E+n*w+k;this.n41=r*D+p*M+q*B;this.n42=r*z+p*x+q*F;this.n43=r*G+p*v+q*A;this.n44=r*H+p*E+q*w+l;return this},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=
 this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplySelf:function(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=
-this.n11,b=this.n12,c=this.n13,d=this.n14,e=this.n21,f=this.n22,g=this.n23,i=this.n24,h=this.n31,j=this.n32,n=this.n33,m=this.n34,l=this.n41,o=this.n42,q=this.n43,r=this.n44;return d*g*j*l-c*i*j*l-d*f*n*l+b*i*n*l+c*f*m*l-b*g*m*l-d*g*h*o+c*i*h*o+d*e*n*o-a*i*n*o-c*e*m*o+a*g*m*o+d*f*h*q-b*i*h*q-d*e*j*q+a*i*j*q+b*e*m*q-a*f*m*q-c*f*h*r+b*g*h*r+c*e*j*r-a*g*j*r-b*e*n*r+a*f*n*r},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=
+this.n11,b=this.n12,c=this.n13,e=this.n14,d=this.n21,f=this.n22,g=this.n23,i=this.n24,h=this.n31,j=this.n32,o=this.n33,m=this.n34,n=this.n41,k=this.n42,r=this.n43,p=this.n44;return e*g*j*n-c*i*j*n-e*f*o*n+b*i*o*n+c*f*m*n-b*g*m*n-e*g*h*k+c*i*h*k+e*d*o*k-a*i*o*k-c*d*m*k+a*g*m*k+e*f*h*r-b*i*h*r-e*d*j*r+a*i*j*r+b*d*m*r-a*f*m*r-c*f*h*p+b*g*h*p+c*d*j*p-a*g*j*p-b*d*o*p+a*f*o*p},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=
 this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;
 this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=
 this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},setScale:function(a,
-b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotationX:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotationY:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotationZ:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,f=a.x,g=a.y,i=a.z,h=e*f,j=e*g;this.set(h*
-f+c,h*g-d*i,h*i+d*g,0,h*g+d*i,j*g+c,j*i-d*f,0,h*i-d*g,j*i+d*f,e*i*i+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var b=a.x,c=a.y,d=a.z;a=Math.cos(b);b=Math.sin(b);var e=Math.cos(c);c=Math.sin(c);var f=Math.cos(d);d=Math.sin(d);var g=a*c,i=b*c;this.n11=e*f;this.n12=-e*d;this.n13=c;this.n21=i*f+a*d;this.n22=-i*d+a*f;this.n23=-b*e;this.n31=-g*f+b*d;this.n32=g*d+b*f;this.n33=a*e;return this},setRotationFromQuaternion:function(a){var b=
-a.x,c=a.y,d=a.z,e=a.w,f=b+b,g=c+c,i=d+d;a=b*f;var h=b*g;b*=i;var j=c*g;c*=i;d*=i;f*=e;g*=e;e*=i;this.n11=1-(j+d);this.n12=h-e;this.n13=b+g;this.n21=h+e;this.n22=1-(a+d);this.n23=c-f;this.n31=b-g;this.n32=c+f;this.n33=1-(a+j);return this},scale:function(a){var b=a.x,c=a.y;a=a.z;this.n11*=b;this.n12*=c;this.n13*=a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=
-a.n34},extractRotation:function(a,b){var c=1/b.x,d=1/b.y,e=1/b.z;this.n11=a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*d;this.n22=a.n22*d;this.n32=a.n32*d;this.n13=a.n13*e;this.n23=a.n23*e;this.n33=a.n33*e}};
-THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,d=a.n12,e=a.n13,f=a.n14,g=a.n21,i=a.n22,h=a.n23,j=a.n24,n=a.n31,m=a.n32,l=a.n33,o=a.n34,q=a.n41,r=a.n42,p=a.n43,k=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=h*o*r-j*l*r+j*m*p-i*o*p-h*m*k+i*l*k;b.n12=f*l*r-e*o*r-f*m*p+d*o*p+e*m*k-d*l*k;b.n13=e*j*r-f*h*r+f*i*p-d*j*p-e*i*k+d*h*k;b.n14=f*h*m-e*j*m-f*i*l+d*j*l+e*i*o-d*h*o;b.n21=j*l*q-h*o*q-j*n*p+g*o*p+h*n*k-g*l*k;b.n22=e*o*q-f*l*q+f*n*p-c*o*p-e*n*k+c*l*k;b.n23=f*h*q-e*j*q-f*g*p+c*j*p+e*g*k-c*h*k;
-b.n24=e*j*n-f*h*n+f*g*l-c*j*l-e*g*o+c*h*o;b.n31=i*o*q-j*m*q+j*n*r-g*o*r-i*n*k+g*m*k;b.n32=f*m*q-d*o*q-f*n*r+c*o*r+d*n*k-c*m*k;b.n33=e*j*q-f*i*q+f*g*r-c*j*r-d*g*k+c*i*k;b.n34=f*i*n-d*j*n-f*g*m+c*j*m+d*g*o-c*i*o;b.n41=h*m*q-i*l*q-h*n*r+g*l*r+i*n*p-g*m*p;b.n42=d*l*q-e*m*q+e*n*r-c*l*r-d*n*p+c*m*p;b.n43=e*i*q-d*h*q-e*g*r+c*h*r+d*g*p-c*i*p;b.n44=d*h*n-e*i*n+e*g*m-c*h*m-d*g*l+c*i*l;b.multiplyScalar(1/a.determinant());return b};
-THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,e=-a.n33*a.n21+a.n31*a.n23,f=a.n32*a.n21-a.n31*a.n22,g=-a.n33*a.n12+a.n32*a.n13,i=a.n33*a.n11-a.n31*a.n13,h=-a.n32*a.n11+a.n31*a.n12,j=a.n23*a.n12-a.n22*a.n13,n=-a.n23*a.n11+a.n21*a.n13,m=a.n22*a.n11-a.n21*a.n12;a=a.n11*d+a.n21*g+a.n31*j;if(a==0)throw"matrix not invertible";a=1/a;c[0]=a*d;c[1]=a*e;c[2]=a*f;c[3]=a*g;c[4]=a*i;c[5]=a*h;c[6]=a*j;c[7]=a*n;c[8]=a*m;return b};
-THREE.Matrix4.makeFrustum=function(a,b,c,d,e,f){var g;g=new THREE.Matrix4;g.n11=2*e/(b-a);g.n12=0;g.n13=(b+a)/(b-a);g.n14=0;g.n21=0;g.n22=2*e/(d-c);g.n23=(d+c)/(d-c);g.n24=0;g.n31=0;g.n32=0;g.n33=-(f+e)/(f-e);g.n34=-2*f*e/(f-e);g.n41=0;g.n42=0;g.n43=-1;g.n44=0;return g};THREE.Matrix4.makePerspective=function(a,b,c,d){var e;a=c*Math.tan(a*Math.PI/360);e=-a;return THREE.Matrix4.makeFrustum(e*b,a*b,e,a,c,d)};
-THREE.Matrix4.makeOrtho=function(a,b,c,d,e,f){var g,i,h,j;g=new THREE.Matrix4;i=b-a;h=c-d;j=f-e;g.n11=2/i;g.n12=0;g.n13=0;g.n14=-((b+a)/i);g.n21=0;g.n22=2/h;g.n23=0;g.n24=-((c+d)/h);g.n31=0;g.n32=0;g.n33=-2/j;g.n34=-((f+e)/j);g.n41=0;g.n42=0;g.n43=0;g.n44=1;return g};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
+b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotationX:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotationY:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotationZ:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,b){var c=Math.cos(b),e=Math.sin(b),d=1-c,f=a.x,g=a.y,i=a.z,h=d*f,j=d*g;this.set(h*
+f+c,h*g-e*i,h*i+e*g,0,h*g+e*i,j*g+c,j*i-e*f,0,h*i-e*g,j*i+e*f,d*i*i+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var b=a.x,c=a.y,e=a.z;a=Math.cos(b);b=Math.sin(b);var d=Math.cos(c);c=Math.sin(c);var f=Math.cos(e);e=Math.sin(e);var g=a*c,i=b*c;this.n11=d*f;this.n12=-d*e;this.n13=c;this.n21=i*f+a*e;this.n22=-i*e+a*f;this.n23=-b*d;this.n31=-g*f+b*e;this.n32=g*e+b*f;this.n33=a*d;return this},setRotationFromQuaternion:function(a){var b=
+a.x,c=a.y,e=a.z,d=a.w,f=b+b,g=c+c,i=e+e;a=b*f;var h=b*g;b*=i;var j=c*g;c*=i;e*=i;f*=d;g*=d;d*=i;this.n11=1-(j+e);this.n12=h-d;this.n13=b+g;this.n21=h+d;this.n22=1-(a+e);this.n23=c-f;this.n31=b-g;this.n32=c+f;this.n33=1-(a+j);return this},scale:function(a){var b=a.x,c=a.y;a=a.z;this.n11*=b;this.n12*=c;this.n13*=a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=
+a.n34},extractRotation:function(a,b){var c=1/b.x,e=1/b.y,d=1/b.z;this.n11=a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*e;this.n22=a.n22*e;this.n32=a.n32*e;this.n13=a.n13*d;this.n23=a.n23*d;this.n33=a.n33*d}};
+THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,e=a.n12,d=a.n13,f=a.n14,g=a.n21,i=a.n22,h=a.n23,j=a.n24,o=a.n31,m=a.n32,n=a.n33,k=a.n34,r=a.n41,p=a.n42,q=a.n43,l=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=h*k*p-j*n*p+j*m*q-i*k*q-h*m*l+i*n*l;b.n12=f*n*p-d*k*p-f*m*q+e*k*q+d*m*l-e*n*l;b.n13=d*j*p-f*h*p+f*i*q-e*j*q-d*i*l+e*h*l;b.n14=f*h*m-d*j*m-f*i*n+e*j*n+d*i*k-e*h*k;b.n21=j*n*r-h*k*r-j*o*q+g*k*q+h*o*l-g*n*l;b.n22=d*k*r-f*n*r+f*o*q-c*k*q-d*o*l+c*n*l;b.n23=f*h*r-d*j*r-f*g*q+c*j*q+d*g*l-c*h*l;
+b.n24=d*j*o-f*h*o+f*g*n-c*j*n-d*g*k+c*h*k;b.n31=i*k*r-j*m*r+j*o*p-g*k*p-i*o*l+g*m*l;b.n32=f*m*r-e*k*r-f*o*p+c*k*p+e*o*l-c*m*l;b.n33=d*j*r-f*i*r+f*g*p-c*j*p-e*g*l+c*i*l;b.n34=f*i*o-e*j*o-f*g*m+c*j*m+e*g*k-c*i*k;b.n41=h*m*r-i*n*r-h*o*p+g*n*p+i*o*q-g*m*q;b.n42=e*n*r-d*m*r+d*o*p-c*n*p-e*o*q+c*m*q;b.n43=d*i*r-e*h*r-d*g*p+c*h*p+e*g*q-c*i*q;b.n44=e*h*o-d*i*o+d*g*m-c*h*m-e*g*n+c*i*n;b.multiplyScalar(1/a.determinant());return b};
+THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,e=a.n33*a.n22-a.n32*a.n23,d=-a.n33*a.n21+a.n31*a.n23,f=a.n32*a.n21-a.n31*a.n22,g=-a.n33*a.n12+a.n32*a.n13,i=a.n33*a.n11-a.n31*a.n13,h=-a.n32*a.n11+a.n31*a.n12,j=a.n23*a.n12-a.n22*a.n13,o=-a.n23*a.n11+a.n21*a.n13,m=a.n22*a.n11-a.n21*a.n12;a=a.n11*e+a.n21*g+a.n31*j;if(a==0)throw"matrix not invertible";a=1/a;c[0]=a*e;c[1]=a*d;c[2]=a*f;c[3]=a*g;c[4]=a*i;c[5]=a*h;c[6]=a*j;c[7]=a*o;c[8]=a*m;return b};
+THREE.Matrix4.makeFrustum=function(a,b,c,e,d,f){var g;g=new THREE.Matrix4;g.n11=2*d/(b-a);g.n12=0;g.n13=(b+a)/(b-a);g.n14=0;g.n21=0;g.n22=2*d/(e-c);g.n23=(e+c)/(e-c);g.n24=0;g.n31=0;g.n32=0;g.n33=-(f+d)/(f-d);g.n34=-2*f*d/(f-d);g.n41=0;g.n42=0;g.n43=-1;g.n44=0;return g};THREE.Matrix4.makePerspective=function(a,b,c,e){var d;a=c*Math.tan(a*Math.PI/360);d=-a;return THREE.Matrix4.makeFrustum(d*b,a*b,d,a,c,e)};
+THREE.Matrix4.makeOrtho=function(a,b,c,e,d,f){var g,i,h,j;g=new THREE.Matrix4;i=b-a;h=c-e;j=f-d;g.n11=2/i;g.n12=0;g.n13=0;g.n14=-((b+a)/i);g.n21=0;g.n22=2/h;g.n23=0;g.n24=-((c+e)/h);g.n31=0;g.n32=0;g.n33=-2/j;g.n34=-((f+d)/j);g.n41=0;g.n42=0;g.n43=0;g.n44=1;return g};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
 THREE.Object3D=function(){this.parent=undefined;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixAutoUpdate=!0;this.matrixWorldNeedsUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=
 !0;this._vector=new THREE.Vector3};
 THREE.Object3D.prototype={translate:function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(a){if(this.children.indexOf(a)===-1){a.parent!==
 undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);for(var b=this;b instanceof THREE.Scene===!1&&b!==undefined;)b=b.parent;b!==undefined&&b.addChildRecurse(a)}},removeChild:function(a){var b=this.children.indexOf(a);if(b!==-1){a.parent=undefined;this.children.splice(b,1)}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation);if(this.scale.x!==1||this.scale.y!==
-1||this.scale.z!==1){this.matrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}this.matrixWorldNeedsUpdate=!0},update:function(a,b,c){if(this.visible){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||b){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale);this.matrixWorldNeedsUpdate=!1;b=!0}a=0;for(var d=this.children.length;a<
-d;a++)this.children[a].update(this.matrixWorld,b,c)}}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==undefined?d:1)};
-THREE.Quaternion.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b;a=Math.cos(d);d=Math.sin(d);b=Math.cos(-e);e=Math.sin(-e);var f=Math.cos(c);c=Math.sin(c);var g=a*b,i=d*e;this.w=g*f-i*c;this.x=g*c+i*f;this.y=d*b*f+a*e*c;this.z=a*e*f-d*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,d=this.z,e=this.w,f=a.x,g=a.y,i=a.z;a=a.w;this.x=b*a+e*f+c*i-d*g;this.y=c*a+e*g+d*f-b*i;this.z=d*a+e*i+b*g-c*f;this.w=e*a-b*f-c*g-d*i;return this},
-multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,f=this.x,g=this.y,i=this.z,h=this.w,j=h*c+g*e-i*d,n=h*d+i*c-f*e,m=h*e+f*d-g*c;c=-f*c-g*d-i*e;b.x=j*h+c*-f+n*-i-m*-g;b.y=n*h+c*-g+m*-f-j*-i;b.z=m*h+c*-i+j*-g-n*-f;return b}};
-THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(e),g=Math.sqrt(1-e*e);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}e=Math.sin((1-d)*f)/g;d=Math.sin(d*f)/g;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c};
+1||this.scale.z!==1){this.matrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}this.matrixWorldNeedsUpdate=!0},update:function(a,b,c){if(this.visible){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||b){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale);this.matrixWorldNeedsUpdate=!1;b=!0}a=0;for(var e=this.children.length;a<
+e;a++)this.children[a].update(this.matrixWorld,b,c)}}};THREE.Quaternion=function(a,b,c,e){this.set(a||0,b||0,c||0,e!==undefined?e:1)};
+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,o=h*e+i*c-f*d,m=h*d+f*e-g*c;c=-f*c-g*e-i*d;b.x=j*h+c*-f+o*-i-m*-g;b.y=o*h+c*-g+m*-f-j*-i;b.z=m*h+c*-i+j*-g-o*-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.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,b){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=b||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=!0};
-THREE.Face3=function(a,b,c,d,e){this.a=a;this.b=b;this.c=c;this.centroid=new THREE.Vector3;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.materials=e instanceof Array?e:[e]};THREE.Face4=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.d=d;this.centroid=new THREE.Vector3;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.materials=f instanceof Array?f:[f]};
-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.Camera=function(a,b,c,d,e){THREE.Object3D.call(this);this.fov=a||50;this.aspect=b||1;this.near=c||0.1;this.far=d||2E3;this.target=e||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;
-THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;THREE.Camera.prototype.translate=function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a));this.target.position.addSelf(b.multiplyScalar(a))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};THREE.Camera.prototype.updateMatrix=function(){this.update(undefined,!0)};
+THREE.Face3=function(a,b,c,e,d){this.a=a;this.b=b;this.c=c;this.centroid=new THREE.Vector3;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.materials=d instanceof Array?d:[d]};THREE.Face4=function(a,b,c,e,d,f){this.a=a;this.b=b;this.c=c;this.d=e;this.centroid=new THREE.Vector3;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.materials=f instanceof Array?f:[f]};
+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.AnimationHandler=function(){var a=[],b={},c={};c.update=function(d){for(var f=0;f<a.length;f++)a[f].update(d)};c.addToUpdate=function(d){a.indexOf(d)===-1&&a.push(d)};c.removeFromUpdate=function(d){d=a.indexOf(d);d!==-1&&a.splice(d,1)};c.add=function(d){b[d.name]!==undefined&&console.log("THREE.AnimationHandler.add: Warning! "+d.name+" already exists in library. Overwriting.");b[d.name]=d;if(d.initialized!==!0){for(var f=0;f<d.hierarchy.length;f++){for(var g=0;g<d.hierarchy[f].keys.length;g++){if(d.hierarchy[f].keys[g].time<
+0)d.hierarchy[f].keys[g].time=0;if(d.hierarchy[f].keys[g].rot!==undefined&&!(d.hierarchy[f].keys[g].rot instanceof THREE.Quaternion)){var i=d.hierarchy[f].keys[g].rot;d.hierarchy[f].keys[g].rot=new THREE.Quaternion(i[0],i[1],i[2],i[3])}}if(d.hierarchy[f].keys[0].morphTargets!==undefined){i={};for(g=0;g<d.hierarchy[f].keys.length;g++)for(var h=0;h<d.hierarchy[f].keys[g].morphTargets.length;h++){var j=d.hierarchy[f].keys[g].morphTargets[h];i[j]=-1}d.hierarchy[f].usedMorphTargets=i;for(g=0;g<d.hierarchy[f].keys.length;g++){var o=
+{};for(j in i){for(h=0;h<d.hierarchy[f].keys[g].morphTargets.length;h++)if(d.hierarchy[f].keys[g].morphTargets[h]===j){o[j]=d.hierarchy[f].keys[g].morphTargetsInfluences[h];break}h===d.hierarchy[f].keys[g].morphTargets.length&&(o[j]=0)}d.hierarchy[f].keys[g].morphTargetsInfluences=o}}for(g=1;g<d.hierarchy[f].keys.length;g++)if(d.hierarchy[f].keys[g].time===d.hierarchy[f].keys[g-1].time){d.hierarchy[f].keys.splice(g,1);g--}for(g=1;g<d.hierarchy[f].keys.length;g++)d.hierarchy[f].keys[g].index=g}g=parseInt(d.length*
+d.fps,10);d.JIT={};d.JIT.hierarchy=[];for(f=0;f<d.hierarchy.length;f++)d.JIT.hierarchy.push(Array(g));d.initialized=!0}};c.get=function(d){if(typeof d==="string")if(b[d])return b[d];else{console.log("THREE.AnimationHandler.get: Couldn't find animation "+d);return null}};c.parse=function(d){var f=[];if(d instanceof THREE.SkinnedMesh)for(var g=0;g<d.bones.length;g++)f.push(d.bones[g]);else e(d,f);return f};var e=function(d,f){f.push(d);for(var g=0;g<d.children.length;g++)e(d.children[g],f)};c.LINEAR=
+0;c.CATMULLROM=1;c.CATMULLROM_FORWARD=2;return c}();THREE.Animation=function(a,b,c,e){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.isPaused=!0;this.loop=!0;this.interpolationType=c!==undefined?c:THREE.AnimationHandler.LINEAR;this.JITCompile=e!==undefined?e:!0;this.points=[];this.target=new THREE.Vector3};
+THREE.Animation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==undefined?a:!0;this.currentTime=b!==undefined?b:0;var c,e=this.hierarchy.length,d;for(c=0;c<e;c++){d=this.hierarchy[c];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)d.useQuaternion=!0;d.matrixAutoUpdate=!0;if(d.animationCache===undefined){d.animationCache={};d.animationCache.prevKey={pos:0,rot:0,scl:0};d.animationCache.nextKey={pos:0,rot:0,scl:0};d.animationCache.originalMatrix=
+d instanceof THREE.Bone?d.skinMatrix:d.matrix}var f=d.animationCache.prevKey;d=d.animationCache.nextKey;f.pos=this.data.hierarchy[c].keys[0];f.rot=this.data.hierarchy[c].keys[0];f.scl=this.data.hierarchy[c].keys[0];d.pos=this.getNextKeyWith("pos",c,1);d.rot=this.getNextKeyWith("rot",c,1);d.scl=this.getNextKeyWith("scl",c,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
+THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
+THREE.Animation.prototype.stop=function(){this.isPlaying=!1;this.isPaused=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==undefined){if(this.hierarchy[a]instanceof THREE.Bone)this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix;else this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix;delete this.hierarchy[a].animationCache}};
+THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,e,d,f,g,i,h,j,o=this.data.JIT.hierarchy,m,n;this.currentTime+=a*this.timeScale;n=this.currentTime;m=this.currentTime%=this.data.length;j=parseInt(Math.min(m*this.data.fps,this.data.length*this.data.fps),10);for(var k=0,r=this.hierarchy.length;k<r;k++){a=this.hierarchy[k];h=a.animationCache;if(this.JITCompile&&o[k][j]!==undefined)if(a instanceof THREE.Bone){a.skinMatrix=o[k][j];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=
+!1}else{a.matrix=o[k][j];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=!0}else{if(this.JITCompile)if(a instanceof THREE.Bone)a.skinMatrix=a.animationCache.originalMatrix;else a.matrix=a.animationCache.originalMatrix;for(var p=0;p<3;p++){c=b[p];g=h.prevKey[c];i=h.nextKey[c];if(i.time<=n){if(m<n)if(this.loop){g=this.data.hierarchy[k].keys[0];for(i=this.getNextKeyWith(c,k,1);i.time<m;){g=i;i=this.getNextKeyWith(c,k,i.index+1)}}else{this.stop();return}else{do{g=i;i=this.getNextKeyWith(c,k,i.index+1)}while(i.time<
+m)}h.prevKey[c]=g;h.nextKey[c]=i}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;e=(m-g.time)/(i.time-g.time);d=g[c];f=i[c];if(e<0||e>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+e+" on bone "+k);e=e<0?0:1}if(c==="pos"){c=a.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){c.x=d[0]+(f[0]-d[0])*e;c.y=d[1]+(f[1]-d[1])*e;c.z=d[2]+(f[2]-d[2])*e}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=
+this.getPrevKeyWith("pos",k,g.index-1).pos;this.points[1]=d;this.points[2]=f;this.points[3]=this.getNextKeyWith("pos",k,i.index+1).pos;e=e*0.33+0.33;d=this.interpolateCatmullRom(this.points,e);c.x=d[0];c.y=d[1];c.z=d[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){e=this.interpolateCatmullRom(this.points,e*1.01);this.target.set(e[0],e[1],e[2]);this.target.subSelf(c);this.target.y=0;this.target.normalize();e=Math.atan2(this.target.x,this.target.z);a.rotation.set(0,e,0)}}}else if(c===
+"rot")THREE.Quaternion.slerp(d,f,a.quaternion,e);else if(c==="scl"){c=a.scale;c.x=d[0]+(f[0]-d[0])*e;c.y=d[1]+(f[1]-d[1])*e;c.z=d[2]+(f[2]-d[2])*e}}}}if(this.JITCompile&&o[0][j]===undefined){this.hierarchy[0].update(undefined,!0);for(k=0;k<this.hierarchy.length;k++)o[k][j]=this.hierarchy[k]instanceof THREE.Bone?this.hierarchy[k].skinMatrix.clone():this.hierarchy[k].matrix.clone()}}};
+THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],e=[],d,f,g,i,h,j;d=(a.length-1)*b;f=Math.floor(d);d-=f;c[0]=f==0?f:f-1;c[1]=f;c[2]=f>a.length-2?f:f+1;c[3]=f>a.length-3?f:f+2;f=a[c[0]];i=a[c[1]];h=a[c[2]];j=a[c[3]];c=d*d;g=d*c;e[0]=this.interpolate(f[0],i[0],h[0],j[0],d,c,g);e[1]=this.interpolate(f[1],i[1],h[1],j[1],d,c,g);e[2]=this.interpolate(f[2],i[2],h[2],j[2],d,c,g);return e};
+THREE.Animation.prototype.interpolate=function(a,b,c,e,d,f,g){a=(c-a)*0.5;e=(e-b)*0.5;return(2*(b-c)+a+e)*g+(-3*(b-c)-2*a-e)*f+a*d+b};THREE.Animation.prototype.getNextKeyWith=function(a,b,c){var e=this.data.hierarchy[b].keys;if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)c=c<e.length-1?c:e.length-1;else c%=e.length;for(;c<e.length;c++)if(e[c][a]!==undefined)return e[c];return this.data.hierarchy[b].keys[0]};
+THREE.Animation.prototype.getPrevKeyWith=function(a,b,c){var e=this.data.hierarchy[b].keys;for(c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c>0?c:0:c>=0?c:c+e.length;c>=0;c--)if(e[c][a]!==undefined)return e[c];return this.data.hierarchy[b].keys[e.length-1]};
+THREE.Camera=function(a,b,c,e,d){THREE.Object3D.call(this);this.fov=a||50;this.aspect=b||1;this.near=c||0.1;this.far=e||2E3;this.target=d||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
+THREE.Camera.prototype.translate=function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a));this.target.position.addSelf(b.multiplyScalar(a))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};THREE.Camera.prototype.updateMatrix=function(){this.update(undefined,!0)};
 THREE.Camera.prototype.update=function(a,b,c){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);this.matrix.setPosition(this.position);a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);b=!0}else{this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=
 !1;b=!0;THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,b,c)};THREE.ParticleDOMMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.domElement=a};THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.matrixAutoUpdate=!1};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;
 THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
-THREE.Bone.prototype.update=function(a,b,c){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;b=!0}var d,e=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(d=0;d<e;d++){a=this.children[d];a instanceof THREE.Bone?a.update(this.skinMatrix,b,c):a.update(this.matrixWorld,!0,c)}}else for(d=0;d<e;d++)this.children[d].update(this.skinMatrix,
+THREE.Bone.prototype.update=function(a,b,c){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;b=!0}var e,d=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(e=0;e<d;e++){a=this.children[e];a instanceof THREE.Bone?a.update(this.skinMatrix,b,c):a.update(this.matrixWorld,!0,c)}}else for(e=0;e<d;e++)this.children[e].update(this.skinMatrix,
 b,c)};THREE.Bone.prototype.addChild=function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);if(!(a instanceof THREE.Bone))this.hasNoneBoneChildren=!0}};
-THREE.Sound=function(a,b,c,d){THREE.Object3D.call(this);this.isLoaded=!1;this.isAddedToDOM=!1;this.isPlaying=!1;this.duration=-1;this.radius=b!==undefined?Math.abs(b):100;this.volume=Math.min(1,Math.max(0,c!==undefined?c:1));this.domElement=document.createElement("audio");this.domElement.volume=0;this.domElement.pan=0;this.domElement.loop=d!==undefined?d:!0;this.sources=a instanceof Array?a:[a];var e;c=this.sources.length;for(a=0;a<c;a++){b=this.sources[a];b.toLowerCase();if(b.indexOf(".mp3")!==-1)e=
-"audio/mpeg";else if(b.indexOf(".ogg")!==-1)e="audio/ogg";else b.indexOf(".wav")!==-1&&(e="audio/wav");if(this.domElement.canPlayType(e)){e=document.createElement("source");e.src=this.sources[a];this.domElement.THREESound=this;this.domElement.appendChild(e);this.domElement.addEventListener("canplay",this.onLoad,!0);this.domElement.load();break}}};THREE.Sound.prototype=new THREE.Object3D;THREE.Sound.prototype.constructor=THREE.Sound;THREE.Sound.prototype.supr=THREE.Object3D.prototype;
+THREE.Sound=function(a,b,c,e){THREE.Object3D.call(this);this.isLoaded=!1;this.isAddedToDOM=!1;this.isPlaying=!1;this.duration=-1;this.radius=b!==undefined?Math.abs(b):100;this.volume=Math.min(1,Math.max(0,c!==undefined?c:1));this.domElement=document.createElement("audio");this.domElement.volume=0;this.domElement.pan=0;this.domElement.loop=e!==undefined?e:!0;this.sources=a instanceof Array?a:[a];var d;c=this.sources.length;for(a=0;a<c;a++){b=this.sources[a];b.toLowerCase();if(b.indexOf(".mp3")!==-1)d=
+"audio/mpeg";else if(b.indexOf(".ogg")!==-1)d="audio/ogg";else b.indexOf(".wav")!==-1&&(d="audio/wav");if(this.domElement.canPlayType(d)){d=document.createElement("source");d.src=this.sources[a];this.domElement.THREESound=this;this.domElement.appendChild(d);this.domElement.addEventListener("canplay",this.onLoad,!0);this.domElement.load();break}}};THREE.Sound.prototype=new THREE.Object3D;THREE.Sound.prototype.constructor=THREE.Sound;THREE.Sound.prototype.supr=THREE.Object3D.prototype;
 THREE.Sound.prototype.onLoad=function(){var a=this.THREESound;if(!a.isLoaded){this.removeEventListener("canplay",this.onLoad,!0);a.isLoaded=!0;a.duration=this.duration;a.isPlaying&&a.play()}};THREE.Sound.prototype.addToDOM=function(a){this.isAddedToDOM=!0;a.appendChild(this.domElement)};THREE.Sound.prototype.play=function(a){this.isPlaying=!0;if(this.isLoaded){this.domElement.play();if(a)this.domElement.currentTime=a%this.duration}};THREE.Sound.prototype.pause=function(){this.isPlaying=!1;this.domElement.pause()};
 THREE.Sound.prototype.stop=function(){this.isPlaying=!1;this.domElement.pause();this.domElement.currentTime=0};THREE.Sound.prototype.calculateVolumeAndPan=function(a){a=a.length();this.domElement.volume=a<=this.radius?this.volume*(1-a/this.radius):0};
-THREE.Sound.prototype.update=function(a,b,c){if(this.matrixAutoUpdate){this.matrix.setPosition(this.position);b=!0}if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;b=!0}var d=this.children.length;for(a=0;a<d;a++)this.children[a].update(this.matrixWorld,b,c)};
+THREE.Sound.prototype.update=function(a,b,c){if(this.matrixAutoUpdate){this.matrix.setPosition(this.position);b=!0}if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;b=!0}var e=this.children.length;for(a=0;a<e;a++)this.children[a].update(this.matrixWorld,b,c)};
 THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.fog=null;this.objects=[];this.lights=[];this.sounds=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;THREE.Scene.prototype.addChild=function(a){this.supr.addChild.call(this,a);this.addChildRecurse(a)};
 THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(a instanceof THREE.Sound)this.sounds.indexOf(a)===-1&&this.sounds.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a)}for(var b=0;b<a.children.length;b++)this.addChildRecurse(a.children[b])};
 THREE.Scene.prototype.removeChild=function(a){this.supr.removeChild.call(this,a);this.removeChildRecurse(a)};THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else if(a instanceof THREE.Sound){b=this.sounds.indexOf(a);b!==-1&&this.sounds.splice(b,1)}else if(!(a instanceof THREE.Camera)){b=this.objects.indexOf(a);if(b!==-1){this.objects.splice(b,1);this.__objectsRemoved.push(a)}}for(b=0;b<a.children.length;b++)this.removeChildRecurse(a.children[b])};
 THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;
-THREE.Projector=function(){function a(x,v){return v.z-x.z}function b(x,v){var E=0,B=1,F=x.z+x.w,A=v.z+v.w,w=-x.z+x.w,t=-v.z+v.w;if(F>=0&&A>=0&&w>=0&&t>=0)return!0;else if(F<0&&A<0||w<0&&t<0)return!1;else{if(F<0)E=Math.max(E,F/(F-A));else A<0&&(B=Math.min(B,F/(F-A)));if(w<0)E=Math.max(E,w/(w-t));else t<0&&(B=Math.min(B,w/(w-t)));if(B<E)return!1;else{x.lerpSelf(v,E);v.lerpSelf(x,1-B);return!0}}}var c,d,e=[],f,g,i,h=[],j,n,m=[],l,o,q=[],r=new THREE.Vector4,p=new THREE.Vector4,k=new THREE.Matrix4,D=new THREE.Matrix4,
-z=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],G=new THREE.Vector4,H=new THREE.Vector4,M;this.projectObjects=function(x,v,E){v=[];var B,F,A;d=0;F=x.objects;x=0;for(B=F.length;x<B;x++){A=F[x];var w;if(!(w=!A.visible))if(w=A instanceof THREE.Mesh){a:{w=void 0;for(var t=A.matrixWorld,N=-A.geometry.boundingSphere.radius*Math.max(A.scale.x,Math.max(A.scale.y,A.scale.z)),s=0;s<6;s++){w=z[s].x*t.n14+z[s].y*t.n24+z[s].z*t.n34+z[s].w;if(w<=N){w=
-!1;break a}}w=!0}w=!w}if(!w){c=e[d]=e[d]||new THREE.RenderableObject;r.copy(A.position);k.multiplyVector3(r);c.object=A;c.z=r.z;v.push(c);d++}}E&&v.sort(a);return v};this.projectScene=function(x,v,E){var B=[],F=v.near,A=v.far,w,t,N,s,C,L,u,P,Q,R,S,O,J,y,I,K;i=n=o=0;v.matrixAutoUpdate&&v.updateMatrix();x.update(undefined,!1,v);k.multiply(v.projectionMatrix,v.matrixWorldInverse);z[0].set(k.n41-k.n11,k.n42-k.n12,k.n43-k.n13,k.n44-k.n14);z[1].set(k.n41+k.n11,k.n42+k.n12,k.n43+k.n13,k.n44+k.n14);z[2].set(k.n41+
-k.n21,k.n42+k.n22,k.n43+k.n23,k.n44+k.n24);z[3].set(k.n41-k.n21,k.n42-k.n22,k.n43-k.n23,k.n44-k.n24);z[4].set(k.n41-k.n31,k.n42-k.n32,k.n43-k.n33,k.n44-k.n34);z[5].set(k.n41+k.n31,k.n42+k.n32,k.n43+k.n33,k.n44+k.n34);for(w=0;w<6;w++){L=z[w];L.divideScalar(Math.sqrt(L.x*L.x+L.y*L.y+L.z*L.z))}L=this.projectObjects(x,v,!0);x=0;for(w=L.length;x<w;x++){u=L[x].object;if(u.visible){P=u.matrixWorld;S=u.matrixRotationWorld;Q=u.materials;R=u.overdraw;if(u instanceof THREE.Mesh){O=u.geometry;J=O.vertices;t=
-0;for(N=J.length;t<N;t++){y=J[t];y.positionWorld.copy(y.position);P.multiplyVector3(y.positionWorld);s=y.positionScreen;s.copy(y.positionWorld);k.multiplyVector4(s);s.x/=s.w;s.y/=s.w;y.__visible=s.z>F&&s.z<A}O=O.faces;t=0;for(N=O.length;t<N;t++){y=O[t];if(y instanceof THREE.Face3){s=J[y.a];C=J[y.b];I=J[y.c];if(s.__visible&&C.__visible&&I.__visible&&(u.doubleSided||u.flipSided!=(I.positionScreen.x-s.positionScreen.x)*(C.positionScreen.y-s.positionScreen.y)-(I.positionScreen.y-s.positionScreen.y)*(C.positionScreen.x-
-s.positionScreen.x)<0)){f=h[i]=h[i]||new THREE.RenderableFace3;f.v1.positionWorld.copy(s.positionWorld);f.v2.positionWorld.copy(C.positionWorld);f.v3.positionWorld.copy(I.positionWorld);f.v1.positionScreen.copy(s.positionScreen);f.v2.positionScreen.copy(C.positionScreen);f.v3.positionScreen.copy(I.positionScreen);f.normalWorld.copy(y.normal);S.multiplyVector3(f.normalWorld);f.centroidWorld.copy(y.centroid);P.multiplyVector3(f.centroidWorld);f.centroidScreen.copy(f.centroidWorld);k.multiplyVector3(f.centroidScreen);
+THREE.Projector=function(){function a(x,v){return v.z-x.z}function b(x,v){var E=0,B=1,F=x.z+x.w,A=v.z+v.w,w=-x.z+x.w,t=-v.z+v.w;if(F>=0&&A>=0&&w>=0&&t>=0)return!0;else if(F<0&&A<0||w<0&&t<0)return!1;else{if(F<0)E=Math.max(E,F/(F-A));else A<0&&(B=Math.min(B,F/(F-A)));if(w<0)E=Math.max(E,w/(w-t));else t<0&&(B=Math.min(B,w/(w-t)));if(B<E)return!1;else{x.lerpSelf(v,E);v.lerpSelf(x,1-B);return!0}}}var c,e,d=[],f,g,i,h=[],j,o,m=[],n,k,r=[],p=new THREE.Vector4,q=new THREE.Vector4,l=new THREE.Matrix4,D=new THREE.Matrix4,
+z=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],G=new THREE.Vector4,H=new THREE.Vector4,M;this.projectObjects=function(x,v,E){v=[];var B,F,A;e=0;F=x.objects;x=0;for(B=F.length;x<B;x++){A=F[x];var w;if(!(w=!A.visible))if(w=A instanceof THREE.Mesh){a:{w=void 0;for(var t=A.matrixWorld,N=-A.geometry.boundingSphere.radius*Math.max(A.scale.x,Math.max(A.scale.y,A.scale.z)),s=0;s<6;s++){w=z[s].x*t.n14+z[s].y*t.n24+z[s].z*t.n34+z[s].w;if(w<=N){w=
+!1;break a}}w=!0}w=!w}if(!w){c=d[e]=d[e]||new THREE.RenderableObject;p.copy(A.position);l.multiplyVector3(p);c.object=A;c.z=p.z;v.push(c);e++}}E&&v.sort(a);return v};this.projectScene=function(x,v,E){var B=[],F=v.near,A=v.far,w,t,N,s,C,L,u,P,Q,R,S,O,J,y,I,K;i=o=k=0;v.matrixAutoUpdate&&v.updateMatrix();x.update(undefined,!1,v);l.multiply(v.projectionMatrix,v.matrixWorldInverse);z[0].set(l.n41-l.n11,l.n42-l.n12,l.n43-l.n13,l.n44-l.n14);z[1].set(l.n41+l.n11,l.n42+l.n12,l.n43+l.n13,l.n44+l.n14);z[2].set(l.n41+
+l.n21,l.n42+l.n22,l.n43+l.n23,l.n44+l.n24);z[3].set(l.n41-l.n21,l.n42-l.n22,l.n43-l.n23,l.n44-l.n24);z[4].set(l.n41-l.n31,l.n42-l.n32,l.n43-l.n33,l.n44-l.n34);z[5].set(l.n41+l.n31,l.n42+l.n32,l.n43+l.n33,l.n44+l.n34);for(w=0;w<6;w++){L=z[w];L.divideScalar(Math.sqrt(L.x*L.x+L.y*L.y+L.z*L.z))}L=this.projectObjects(x,v,!0);x=0;for(w=L.length;x<w;x++){u=L[x].object;if(u.visible){P=u.matrixWorld;S=u.matrixRotationWorld;Q=u.materials;R=u.overdraw;if(u instanceof THREE.Mesh){O=u.geometry;J=O.vertices;t=
+0;for(N=J.length;t<N;t++){y=J[t];y.positionWorld.copy(y.position);P.multiplyVector3(y.positionWorld);s=y.positionScreen;s.copy(y.positionWorld);l.multiplyVector4(s);s.x/=s.w;s.y/=s.w;y.__visible=s.z>F&&s.z<A}O=O.faces;t=0;for(N=O.length;t<N;t++){y=O[t];if(y instanceof THREE.Face3){s=J[y.a];C=J[y.b];I=J[y.c];if(s.__visible&&C.__visible&&I.__visible&&(u.doubleSided||u.flipSided!=(I.positionScreen.x-s.positionScreen.x)*(C.positionScreen.y-s.positionScreen.y)-(I.positionScreen.y-s.positionScreen.y)*(C.positionScreen.x-
+s.positionScreen.x)<0)){f=h[i]=h[i]||new THREE.RenderableFace3;f.v1.positionWorld.copy(s.positionWorld);f.v2.positionWorld.copy(C.positionWorld);f.v3.positionWorld.copy(I.positionWorld);f.v1.positionScreen.copy(s.positionScreen);f.v2.positionScreen.copy(C.positionScreen);f.v3.positionScreen.copy(I.positionScreen);f.normalWorld.copy(y.normal);S.multiplyVector3(f.normalWorld);f.centroidWorld.copy(y.centroid);P.multiplyVector3(f.centroidWorld);f.centroidScreen.copy(f.centroidWorld);l.multiplyVector3(f.centroidScreen);
 I=y.vertexNormals;M=f.vertexNormalsWorld;s=0;for(C=I.length;s<C;s++){K=M[s]=M[s]||new THREE.Vector3;K.copy(I[s]);S.multiplyVector3(K)}f.z=f.centroidScreen.z;f.meshMaterials=Q;f.faceMaterials=y.materials;f.overdraw=R;if(u.geometry.uvs[t]){f.uvs[0]=u.geometry.uvs[t][0];f.uvs[1]=u.geometry.uvs[t][1];f.uvs[2]=u.geometry.uvs[t][2]}B.push(f);i++}}else if(y instanceof THREE.Face4){s=J[y.a];C=J[y.b];I=J[y.c];K=J[y.d];if(s.__visible&&C.__visible&&I.__visible&&K.__visible&&(u.doubleSided||u.flipSided!=((K.positionScreen.x-
 s.positionScreen.x)*(C.positionScreen.y-s.positionScreen.y)-(K.positionScreen.y-s.positionScreen.y)*(C.positionScreen.x-s.positionScreen.x)<0||(C.positionScreen.x-I.positionScreen.x)*(K.positionScreen.y-I.positionScreen.y)-(C.positionScreen.y-I.positionScreen.y)*(K.positionScreen.x-I.positionScreen.x)<0))){f=h[i]=h[i]||new THREE.RenderableFace3;f.v1.positionWorld.copy(s.positionWorld);f.v2.positionWorld.copy(C.positionWorld);f.v3.positionWorld.copy(K.positionWorld);f.v1.positionScreen.copy(s.positionScreen);
-f.v2.positionScreen.copy(C.positionScreen);f.v3.positionScreen.copy(K.positionScreen);f.normalWorld.copy(y.normal);S.multiplyVector3(f.normalWorld);f.centroidWorld.copy(y.centroid);P.multiplyVector3(f.centroidWorld);f.centroidScreen.copy(f.centroidWorld);k.multiplyVector3(f.centroidScreen);f.z=f.centroidScreen.z;f.meshMaterials=Q;f.faceMaterials=y.materials;f.overdraw=R;if(u.geometry.uvs[t]){f.uvs[0]=u.geometry.uvs[t][0];f.uvs[1]=u.geometry.uvs[t][1];f.uvs[2]=u.geometry.uvs[t][3]}B.push(f);i++;g=
+f.v2.positionScreen.copy(C.positionScreen);f.v3.positionScreen.copy(K.positionScreen);f.normalWorld.copy(y.normal);S.multiplyVector3(f.normalWorld);f.centroidWorld.copy(y.centroid);P.multiplyVector3(f.centroidWorld);f.centroidScreen.copy(f.centroidWorld);l.multiplyVector3(f.centroidScreen);f.z=f.centroidScreen.z;f.meshMaterials=Q;f.faceMaterials=y.materials;f.overdraw=R;if(u.geometry.uvs[t]){f.uvs[0]=u.geometry.uvs[t][0];f.uvs[1]=u.geometry.uvs[t][1];f.uvs[2]=u.geometry.uvs[t][3]}B.push(f);i++;g=
 h[i]=h[i]||new THREE.RenderableFace3;g.v1.positionWorld.copy(C.positionWorld);g.v2.positionWorld.copy(I.positionWorld);g.v3.positionWorld.copy(K.positionWorld);g.v1.positionScreen.copy(C.positionScreen);g.v2.positionScreen.copy(I.positionScreen);g.v3.positionScreen.copy(K.positionScreen);g.normalWorld.copy(f.normalWorld);g.centroidWorld.copy(f.centroidWorld);g.centroidScreen.copy(f.centroidScreen);g.z=g.centroidScreen.z;g.meshMaterials=Q;g.faceMaterials=y.materials;g.overdraw=R;if(u.geometry.uvs[t]){g.uvs[0]=
-u.geometry.uvs[t][1];g.uvs[1]=u.geometry.uvs[t][2];g.uvs[2]=u.geometry.uvs[t][3]}B.push(g);i++}}}}else if(u instanceof THREE.Line){D.multiply(k,P);J=u.geometry.vertices;y=J[0];y.positionScreen.copy(y.position);D.multiplyVector4(y.positionScreen);t=1;for(N=J.length;t<N;t++){s=J[t];s.positionScreen.copy(s.position);D.multiplyVector4(s.positionScreen);C=J[t-1];G.copy(s.positionScreen);H.copy(C.positionScreen);if(b(G,H)){G.multiplyScalar(1/G.w);H.multiplyScalar(1/H.w);j=m[n]=m[n]||new THREE.RenderableLine;
-j.v1.positionScreen.copy(G);j.v2.positionScreen.copy(H);j.z=Math.max(G.z,H.z);j.materials=u.materials;B.push(j);n++}}}else if(u instanceof THREE.Particle){p.set(u.position.x,u.position.y,u.position.z,1);k.multiplyVector4(p);p.z/=p.w;if(p.z>0&&p.z<1){l=q[o]=q[o]||new THREE.RenderableParticle;l.x=p.x/p.w;l.y=p.y/p.w;l.z=p.z;l.rotation=u.rotation.z;l.scale.x=u.scale.x*Math.abs(l.x-(p.x+v.projectionMatrix.n11)/(p.w+v.projectionMatrix.n14));l.scale.y=u.scale.y*Math.abs(l.y-(p.y+v.projectionMatrix.n22)/
-(p.w+v.projectionMatrix.n24));l.materials=u.materials;B.push(l);o++}}}}E&&B.sort(a);return B};this.unprojectVector=function(x,v){var E=v.matrixWorld.clone();E.multiplySelf(THREE.Matrix4.makeInvert(v.projectionMatrix));E.multiplyVector3(x);return x}};
-THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,c,d,e,f;this.domElement=document.createElement("div");this.setSize=function(g,i){c=g;d=i;e=c/2;f=d/2};this.render=function(g,i){var h,j,n,m,l,o,q,r;a=b.projectScene(g,i);h=0;for(j=a.length;h<j;h++){l=a[h];if(l instanceof THREE.RenderableParticle){q=l.x*e+e;r=l.y*f+f;n=0;for(m=l.material.length;n<m;n++){o=l.material[n];if(o instanceof THREE.ParticleDOMMaterial){o=o.domElement;o.style.left=q+"px";o.style.top=r+"px"}}}}}};
-THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(a,b,c){c&&a.update(undefined,!1,b);c=a.sounds;var d,e=c.length;for(d=0;d<e;d++){a=c[d];this.soundPosition.set(a.matrixWorld.n14,a.matrixWorld.n24,a.matrixWorld.n34);this.soundPosition.subSelf(b.position);if(a.isPlaying&&a.isLoaded){a.isAddedToDOM||a.addToDOM(this.domElement);a.calculateVolumeAndPan(this.soundPosition)}}}};
+u.geometry.uvs[t][1];g.uvs[1]=u.geometry.uvs[t][2];g.uvs[2]=u.geometry.uvs[t][3]}B.push(g);i++}}}}else if(u instanceof THREE.Line){D.multiply(l,P);J=u.geometry.vertices;y=J[0];y.positionScreen.copy(y.position);D.multiplyVector4(y.positionScreen);t=1;for(N=J.length;t<N;t++){s=J[t];s.positionScreen.copy(s.position);D.multiplyVector4(s.positionScreen);C=J[t-1];G.copy(s.positionScreen);H.copy(C.positionScreen);if(b(G,H)){G.multiplyScalar(1/G.w);H.multiplyScalar(1/H.w);j=m[o]=m[o]||new THREE.RenderableLine;
+j.v1.positionScreen.copy(G);j.v2.positionScreen.copy(H);j.z=Math.max(G.z,H.z);j.materials=u.materials;B.push(j);o++}}}else if(u instanceof THREE.Particle){q.set(u.position.x,u.position.y,u.position.z,1);l.multiplyVector4(q);q.z/=q.w;if(q.z>0&&q.z<1){n=r[k]=r[k]||new THREE.RenderableParticle;n.x=q.x/q.w;n.y=q.y/q.w;n.z=q.z;n.rotation=u.rotation.z;n.scale.x=u.scale.x*Math.abs(n.x-(q.x+v.projectionMatrix.n11)/(q.w+v.projectionMatrix.n14));n.scale.y=u.scale.y*Math.abs(n.y-(q.y+v.projectionMatrix.n22)/
+(q.w+v.projectionMatrix.n24));n.materials=u.materials;B.push(n);k++}}}}E&&B.sort(a);return B};this.unprojectVector=function(x,v){var E=v.matrixWorld.clone();E.multiplySelf(THREE.Matrix4.makeInvert(v.projectionMatrix));E.multiplyVector3(x);return x}};
+THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,c,e,d,f;this.domElement=document.createElement("div");this.setSize=function(g,i){c=g;e=i;d=c/2;f=e/2};this.render=function(g,i){var h,j,o,m,n,k,r,p;a=b.projectScene(g,i);h=0;for(j=a.length;h<j;h++){n=a[h];if(n instanceof THREE.RenderableParticle){r=n.x*d+d;p=n.y*f+f;o=0;for(m=n.material.length;o<m;o++){k=n.material[o];if(k instanceof THREE.ParticleDOMMaterial){k=k.domElement;k.style.left=r+"px";k.style.top=p+"px"}}}}}};
+THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(a,b,c){c&&a.update(undefined,!1,b);c=a.sounds;var e,d=c.length;for(e=0;e<d;e++){a=c[e];this.soundPosition.set(a.matrixWorld.n14,a.matrixWorld.n24,a.matrixWorld.n34);this.soundPosition.subSelf(b.position);if(a.isPlaying&&a.isLoaded){a.isAddedToDOM||a.addToDOM(this.domElement);a.calculateVolumeAndPan(this.soundPosition)}}}};
 THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.materials=null};

+ 3 - 3
build/custom/ThreeExtras.js

@@ -22,7 +22,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 d,b,c,g,e=2*Math.ceil(a*3)+1;e>25&&(e=25);g=(e-1)*0.5;b=Array(e);for(d=c=0;d<e;++d){b[d]=Math.exp(-((d-g)*(d-g))/(2*a*a));c+=b[d]}for(d=0;d<e;++d)b[d]/=c;return b}};
-THREE.QuakeCamera=function(a){function d(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.dragToLook=!1;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 d(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.dragToLook=!1;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.dragToLook!==undefined)this.dragToLook=a.dragToLook;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.dragToLook)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.dragToLook)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=
@@ -32,7 +32,7 @@ var b=this.lookSpeed;this.dragToLook&&!this.mouseDragOn&&(b=0);this.lon+=this.mo
 THREE.QuakeCamera.prototype.translate=function(a,d){this.matrix.rotateAxis(d);if(this.noFly)d.y=0;this.position.addSelf(d.multiplyScalar(a));this.target.position.addSelf(d.multiplyScalar(a))};
 THREE.PathCamera=function(a){function d(l,k,t,n){var m={name:t,fps:0.6,length:n,hierarchy:[]},p,u=k.getControlPointsArray(),z=k.getLength(),w=u.length,x=0;p=w-1;k={parent:-1,keys:[]};k.keys[0]={time:0,pos:u[0],rot:[0,0,0,1],scl:[1,1,1]};k.keys[p]={time:n,pos:u[p],rot:[0,0,0,1],scl:[1,1,1]};for(p=1;p<w-1;p++){x=n*z.chunks[p]/z.total;k.keys[p]={time:x,pos:u[p]}}m.hierarchy[0]=k;THREE.AnimationHandler.add(m);return new THREE.Animation(l,t,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function b(l,k){var t,
 n,m=new THREE.Geometry;for(t=0;t<l.points.length*k;t++){n=t/(l.points.length*k);n=l.getPoint(n);m.vertices[t]=new THREE.Vertex(new THREE.Vector3(n.x,n.y,n.z))}return m}function c(l,k){var t=b(k,10),n=b(k,10),m=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(t,m);particleObj=new THREE.ParticleSystem(n,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);l.addChild(lineObj);particleObj.scale.set(1,1,1);l.addChild(particleObj);n=new Sphere(1,
-16,8);m=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<k.points.length;i++){t=new THREE.Mesh(n,m);t.position.copy(k.points[i]);t.updateMatrix();l.addChild(t)}}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);m=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<k.points.length;i++){t=new THREE.Mesh(n,m);t.position.copy(k.points[i]);t.updateMatrix();l.addChild(t)}}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 g=Math.PI*2,e=Math.PI/180;this.update=function(l,k,t){var n,m;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)*e;this.theta=this.lon*e;n=this.phi%g;this.phi=n>=0?n:n+g;n=this.verticalAngleMap.srcRange;m=this.verticalAngleMap.dstRange;
@@ -48,7 +48,7 @@ for(c=a+a/2;c<2*a;c++)h.faces.push(new THREE.Face4((2*c-2*a+2)%a+a,(2*c-2*a+1)%a
 var Icosahedron=function(a){function d(t,n,m){var p=Math.sqrt(t*t+n*n+m*m);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(t/p,n/p,m/p)))-1}function b(t,n,m,p){p.faces.push(new THREE.Face3(t,n,m))}function c(t,n){var m=g.vertices[t].position,p=g.vertices[n].position;return d((m.x+p.x)/2,(m.y+p.y)/2,(m.z+p.z)/2)}var g=this,e=new THREE.Geometry,f;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;d(-1,a,0);d(1,a,0);d(-1,-a,0);d(1,-a,0);d(0,-1,a);d(0,1,a);d(0,-1,-a);d(0,
 1,-a);d(a,0,-1);d(a,0,1);d(-a,0,-1);d(-a,0,1);b(0,11,5,e);b(0,5,1,e);b(0,1,7,e);b(0,7,10,e);b(0,10,11,e);b(1,5,9,e);b(5,11,4,e);b(11,10,2,e);b(10,7,6,e);b(7,1,8,e);b(3,9,4,e);b(3,4,2,e);b(3,2,6,e);b(3,6,8,e);b(3,8,9,e);b(4,9,5,e);b(2,4,11,e);b(6,2,10,e);b(8,6,7,e);b(9,8,1,e);for(a=0;a<this.subdivisions;a++){f=new THREE.Geometry;for(var h in e.faces){var j=c(e.faces[h].a,e.faces[h].b),l=c(e.faces[h].b,e.faces[h].c),k=c(e.faces[h].c,e.faces[h].a);b(e.faces[h].a,j,k,f);b(e.faces[h].b,l,j,f);b(e.faces[h].c,
 k,l,f);b(j,l,k,f)}e.faces=f.faces}g.faces=e.faces;delete e;delete f;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Icosahedron.prototype=new THREE.Geometry;Icosahedron.prototype.constructor=Icosahedron;
-function Lathe(a,d,b){THREE.Geometry.call(this);this.steps=d||12;this.angle=b||2*Math.PI;d=this.angle/this.steps;for(var c=[],g=[],e=[],f=[],h=0;h<a.length;h++){this.vertices.push(new THREE.Vertex(a[h]));c[h]=a[h].clone();g[h]=this.vertices.length-1}for(var j=(new THREE.Matrix4).setRotationZ(d),l=0;l<=this.angle+0.0010;l+=d){for(h=0;h<c.length;h++)if(l<this.angle){c[h]=j.multiplyVector3(c[h].clone());this.vertices.push(new THREE.Vertex(c[h]));e[h]=this.vertices.length-1}else e=f;l==0&&(f=g);for(h=
+function Lathe(a,d,b){THREE.Geometry.call(this);this.steps=d||12;this.angle=b||2*Math.PI;d=this.angle/this.steps;for(var c=[],g=[],e=[],f=[],h=0;h<a.length;h++){this.vertices.push(new THREE.Vertex(a[h]));c[h]=a[h].clone();g[h]=this.vertices.length-1}for(var j=(new THREE.Matrix4).setRotationZ(d),l=0;l<=this.angle+0.001;l+=d){for(h=0;h<c.length;h++)if(l<this.angle){c[h]=j.multiplyVector3(c[h].clone());this.vertices.push(new THREE.Vertex(c[h]));e[h]=this.vertices.length-1}else e=f;l==0&&(f=g);for(h=
 0;h<g.length-1;h++){this.faces.push(new THREE.Face4(e[h],e[h+1],g[h+1],g[h]));this.uvs.push([new THREE.UV(l/b,h/a.length),new THREE.UV(l/b,(h+1)/a.length),new THREE.UV((l-d)/b,(h+1)/a.length),new THREE.UV((l-d)/b,h/a.length)])}g=e;e=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()}Lathe.prototype=new THREE.Geometry;Lathe.prototype.constructor=Lathe;
 var Plane=function(a,d,b,c){THREE.Geometry.call(this);var g,e=a/2,f=d/2;b=b||1;c=c||1;var h=b+1,j=c+1;a/=b;var l=d/c;for(g=0;g<j;g++)for(d=0;d<h;d++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(d*a-e,-(g*l-f),0)));for(g=0;g<c;g++)for(d=0;d<b;d++){this.faces.push(new THREE.Face4(d+h*g,d+h*(g+1),d+1+h*(g+1),d+1+h*g));this.uvs.push([new THREE.UV(d/b,g/c),new THREE.UV(d/b,(g+1)/c),new THREE.UV((d+1)/b,(g+1)/c),new THREE.UV((d+1)/b,g/c)])}this.computeCentroids();this.computeFaceNormals()};
 Plane.prototype=new THREE.Geometry;Plane.prototype.constructor=Plane;

+ 63 - 46
build/custom/ThreeSVG.js

@@ -12,33 +12,33 @@ this.length();a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setPosit
 1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,b,c,d){this.set(a||0,b||0,c||0,d||1)};
 THREE.Vector4.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z,a.w+b.w);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z,this.w+a.w);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z,a.w-b.w);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z,this.w-a.w);return this},multiplyScalar:function(a){this.set(this.x*
 a,this.y*a,this.z*a,this.w*a);return this},divideScalar:function(a){this.set(this.x/a,this.y/a,this.z/a,this.w/a);return this},lerpSelf:function(a,b){this.set(this.x+(a.x-this.x)*b,this.y+(a.y-this.y)*b,this.z+(a.z-this.z)*b,this.w+(a.w-this.w)*b)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
-THREE.Ray.prototype={intersectScene:function(a){var b,c,d=a.objects,e=[];a=0;for(b=d.length;a<b;a++){c=d[a];c instanceof THREE.Mesh&&(e=e.concat(this.intersectObject(c)))}e.sort(function(f,g){return f.distance-g.distance});return e},intersectObject:function(a){function b(u,j,J,q){q=q.clone().subSelf(j);J=J.clone().subSelf(j);var A=u.clone().subSelf(j);u=q.dot(q);j=q.dot(J);q=q.dot(A);var F=J.dot(J);J=J.dot(A);A=1/(u*F-j*j);F=(F*q-j*J)*A;u=(u*J-j*q)*A;return F>0&&u>0&&F+u<1}var c,d,e,f,g,i,h,l,n,m,
-k,o=a.geometry,r=o.vertices,v=[];c=0;for(d=o.faces.length;c<d;c++){e=o.faces[c];m=this.origin.clone();k=this.direction.clone();h=a.matrixWorld;f=h.multiplyVector3(r[e.a].position.clone());g=h.multiplyVector3(r[e.b].position.clone());i=h.multiplyVector3(r[e.c].position.clone());h=e instanceof THREE.Face4?h.multiplyVector3(r[e.d].position.clone()):null;l=a.matrixRotationWorld.multiplyVector3(e.normal.clone());n=k.dot(l);if(n<0){l=l.dot((new THREE.Vector3).sub(f,m))/n;m=m.addSelf(k.multiplyScalar(l));
-if(e instanceof THREE.Face3){if(b(m,f,g,i)){e={distance:this.origin.distanceTo(m),point:m,face:e,object:a};v.push(e)}}else if(e instanceof THREE.Face4&&(b(m,f,g,h)||b(m,g,i,h))){e={distance:this.origin.distanceTo(m),point:m,face:e,object:a};v.push(e)}}}return v}};
-THREE.Rectangle=function(){function a(){f=d-b;g=e-c}var b,c,d,e,f,g,i=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return f};this.getHeight=function(){return g};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(h,l,n,m){i=!1;b=h;c=l;d=n;e=m;a()};this.addPoint=function(h,l){if(i){i=!1;b=h;c=l;d=h;e=l}else{b=b<h?b:h;c=c<l?c:l;d=d>h?d:h;e=e>l?e:l}a()};
-this.add3Points=function(h,l,n,m,k,o){if(i){i=!1;b=h<n?h<k?h:k:n<k?n:k;c=l<m?l<o?l:o:m<o?m:o;d=h>n?h>k?h:k:n>k?n:k;e=l>m?l>o?l:o:m>o?m:o}else{b=h<n?h<k?h<b?h:b:k<b?k:b:n<k?n<b?n:b:k<b?k:b;c=l<m?l<o?l<c?l:c:o<c?o:c:m<o?m<c?m:c:o<c?o:c;d=h>n?h>k?h>d?h:d:k>d?k:d:n>k?n>d?n:d:k>d?k:d;e=l>m?l>o?l>e?l:e:o>e?o:e:m>o?m>e?m:e:o>e?o:e}a()};this.addRectangle=function(h){if(i){i=!1;b=h.getLeft();c=h.getTop();d=h.getRight();e=h.getBottom()}else{b=b<h.getLeft()?b:h.getLeft();c=c<h.getTop()?c:h.getTop();d=d>h.getRight()?
+THREE.Ray.prototype={intersectScene:function(a){var b,c,d=a.objects,e=[];a=0;for(b=d.length;a<b;a++){c=d[a];c instanceof THREE.Mesh&&(e=e.concat(this.intersectObject(c)))}e.sort(function(f,g){return f.distance-g.distance});return e},intersectObject:function(a){function b(v,l,J,r){r=r.clone().subSelf(l);J=J.clone().subSelf(l);var A=v.clone().subSelf(l);v=r.dot(r);l=r.dot(J);r=r.dot(A);var F=J.dot(J);J=J.dot(A);A=1/(v*F-l*l);F=(F*r-l*J)*A;v=(v*J-l*r)*A;return F>0&&v>0&&F+v<1}var c,d,e,f,g,i,h,j,o,n,
+m,k=a.geometry,q=k.vertices,s=[];c=0;for(d=k.faces.length;c<d;c++){e=k.faces[c];n=this.origin.clone();m=this.direction.clone();h=a.matrixWorld;f=h.multiplyVector3(q[e.a].position.clone());g=h.multiplyVector3(q[e.b].position.clone());i=h.multiplyVector3(q[e.c].position.clone());h=e instanceof THREE.Face4?h.multiplyVector3(q[e.d].position.clone()):null;j=a.matrixRotationWorld.multiplyVector3(e.normal.clone());o=m.dot(j);if(o<0){j=j.dot((new THREE.Vector3).sub(f,n))/o;n=n.addSelf(m.multiplyScalar(j));
+if(e instanceof THREE.Face3){if(b(n,f,g,i)){e={distance:this.origin.distanceTo(n),point:n,face:e,object:a};s.push(e)}}else if(e instanceof THREE.Face4&&(b(n,f,g,h)||b(n,g,i,h))){e={distance:this.origin.distanceTo(n),point:n,face:e,object:a};s.push(e)}}}return s}};
+THREE.Rectangle=function(){function a(){f=d-b;g=e-c}var b,c,d,e,f,g,i=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return f};this.getHeight=function(){return g};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(h,j,o,n){i=!1;b=h;c=j;d=o;e=n;a()};this.addPoint=function(h,j){if(i){i=!1;b=h;c=j;d=h;e=j}else{b=b<h?b:h;c=c<j?c:j;d=d>h?d:h;e=e>j?e:j}a()};
+this.add3Points=function(h,j,o,n,m,k){if(i){i=!1;b=h<o?h<m?h:m:o<m?o:m;c=j<n?j<k?j:k:n<k?n:k;d=h>o?h>m?h:m:o>m?o:m;e=j>n?j>k?j:k:n>k?n:k}else{b=h<o?h<m?h<b?h:b:m<b?m:b:o<m?o<b?o:b:m<b?m:b;c=j<n?j<k?j<c?j:c:k<c?k:c:n<k?n<c?n:c:k<c?k:c;d=h>o?h>m?h>d?h:d:m>d?m:d:o>m?o>d?o:d:m>d?m:d;e=j>n?j>k?j>e?j:e:k>e?k:e:n>k?n>e?n:e:k>e?k:e}a()};this.addRectangle=function(h){if(i){i=!1;b=h.getLeft();c=h.getTop();d=h.getRight();e=h.getBottom()}else{b=b<h.getLeft()?b:h.getLeft();c=c<h.getTop()?c:h.getTop();d=d>h.getRight()?
 d:h.getRight();e=e>h.getBottom()?e:h.getBottom()}a()};this.inflate=function(h){b-=h;c-=h;d+=h;e+=h;a()};this.minSelf=function(h){b=b>h.getLeft()?b:h.getLeft();c=c>h.getTop()?c:h.getTop();d=d<h.getRight()?d:h.getRight();e=e<h.getBottom()?e:h.getBottom();a()};this.instersects=function(h){return Math.min(d,h.getRight())-Math.max(b,h.getLeft())>=0&&Math.min(e,h.getBottom())-Math.max(c,h.getTop())>=0};this.empty=function(){i=!0;e=d=c=b=0;a()};this.isEmpty=function(){return i}};
 THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};
-THREE.Matrix4=function(a,b,c,d,e,f,g,i,h,l,n,m,k,o,r,v){this.set(a||1,b||0,c||0,d||0,e||0,f||1,g||0,i||0,h||0,l||0,n||1,m||0,k||0,o||0,r||0,v||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={set:function(a,b,c,d,e,f,g,i,h,l,n,m,k,o,r,v){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=e;this.n22=f;this.n23=g;this.n24=i;this.n31=h;this.n32=l;this.n33=n;this.n34=m;this.n41=k;this.n42=o;this.n43=r;this.n44=v;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,b,c){var d=THREE.Matrix4.__v1,
+THREE.Matrix4=function(a,b,c,d,e,f,g,i,h,j,o,n,m,k,q,s){this.set(a||1,b||0,c||0,d||0,e||0,f||1,g||0,i||0,h||0,j||0,o||1,n||0,m||0,k||0,q||0,s||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={set:function(a,b,c,d,e,f,g,i,h,j,o,n,m,k,q,s){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=e;this.n22=f;this.n23=g;this.n24=i;this.n31=h;this.n32=j;this.n33=o;this.n34=n;this.n41=m;this.n42=k;this.n43=q;this.n44=s;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,b,c){var d=THREE.Matrix4.__v1,
 e=THREE.Matrix4.__v2,f=THREE.Matrix4.__v3;f.sub(a,b).normalize();if(f.length()===0)f.z=1;d.cross(c,f).normalize();if(d.length()===0){f.x+=1.0E-4;d.cross(c,f).normalize()}e.cross(f,d).normalize();this.n11=d.x;this.n12=e.x;this.n13=f.x;this.n21=d.y;this.n22=e.y;this.n23=f.y;this.n31=d.z;this.n32=e.z;this.n33=f.z;return this},multiplyVector3:function(a){var b=a.x,c=a.y,d=a.z,e=1/(this.n41*b+this.n42*c+this.n43*d+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*d+this.n14)*e;a.y=(this.n21*b+this.n22*c+this.n23*
 d+this.n24)*e;a.z=(this.n31*b+this.n32*c+this.n33*d+this.n34)*e;return a},multiplyVector4:function(a){var b=a.x,c=a.y,d=a.z,e=a.w;a.x=this.n11*b+this.n12*c+this.n13*d+this.n14*e;a.y=this.n21*b+this.n22*c+this.n23*d+this.n24*e;a.z=this.n31*b+this.n32*c+this.n33*d+this.n34*e;a.w=this.n41*b+this.n42*c+this.n43*d+this.n44*e;return a},rotateAxis:function(a){var b=a.x,c=a.y,d=a.z;a.x=b*this.n11+c*this.n12+d*this.n13;a.y=b*this.n21+c*this.n22+d*this.n23;a.z=b*this.n31+c*this.n32+d*this.n33;a.normalize();
-return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var c=a.n11,d=a.n12,e=a.n13,f=a.n14,g=a.n21,i=a.n22,h=a.n23,l=a.n24,n=a.n31,m=a.n32,k=a.n33,o=a.n34,r=a.n41,v=a.n42,u=a.n43,j=a.n44,J=b.n11,q=b.n12,A=b.n13,F=b.n14,R=b.n21,B=b.n22,
-z=b.n23,L=b.n24,G=b.n31,N=b.n32,H=b.n33,s=b.n34;this.n11=c*J+d*R+e*G;this.n12=c*q+d*B+e*N;this.n13=c*A+d*z+e*H;this.n14=c*F+d*L+e*s+f;this.n21=g*J+i*R+h*G;this.n22=g*q+i*B+h*N;this.n23=g*A+i*z+h*H;this.n24=g*F+i*L+h*s+l;this.n31=n*J+m*R+k*G;this.n32=n*q+m*B+k*N;this.n33=n*A+m*z+k*H;this.n34=n*F+m*L+k*s+o;this.n41=r*J+v*R+u*G;this.n42=r*q+v*B+u*N;this.n43=r*A+v*z+u*H;this.n44=r*F+v*L+u*s+j;return this},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=
+return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var c=a.n11,d=a.n12,e=a.n13,f=a.n14,g=a.n21,i=a.n22,h=a.n23,j=a.n24,o=a.n31,n=a.n32,m=a.n33,k=a.n34,q=a.n41,s=a.n42,v=a.n43,l=a.n44,J=b.n11,r=b.n12,A=b.n13,F=b.n14,R=b.n21,B=b.n22,
+z=b.n23,L=b.n24,G=b.n31,N=b.n32,H=b.n33,t=b.n34;this.n11=c*J+d*R+e*G;this.n12=c*r+d*B+e*N;this.n13=c*A+d*z+e*H;this.n14=c*F+d*L+e*t+f;this.n21=g*J+i*R+h*G;this.n22=g*r+i*B+h*N;this.n23=g*A+i*z+h*H;this.n24=g*F+i*L+h*t+j;this.n31=o*J+n*R+m*G;this.n32=o*r+n*B+m*N;this.n33=o*A+n*z+m*H;this.n34=o*F+n*L+m*t+k;this.n41=q*J+s*R+v*G;this.n42=q*r+s*B+v*N;this.n43=q*A+s*z+v*H;this.n44=q*F+s*L+v*t+l;return this},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=
 this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplySelf:function(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=
-this.n11,b=this.n12,c=this.n13,d=this.n14,e=this.n21,f=this.n22,g=this.n23,i=this.n24,h=this.n31,l=this.n32,n=this.n33,m=this.n34,k=this.n41,o=this.n42,r=this.n43,v=this.n44;return d*g*l*k-c*i*l*k-d*f*n*k+b*i*n*k+c*f*m*k-b*g*m*k-d*g*h*o+c*i*h*o+d*e*n*o-a*i*n*o-c*e*m*o+a*g*m*o+d*f*h*r-b*i*h*r-d*e*l*r+a*i*l*r+b*e*m*r-a*f*m*r-c*f*h*v+b*g*h*v+c*e*l*v-a*g*l*v-b*e*n*v+a*f*n*v},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=
+this.n11,b=this.n12,c=this.n13,d=this.n14,e=this.n21,f=this.n22,g=this.n23,i=this.n24,h=this.n31,j=this.n32,o=this.n33,n=this.n34,m=this.n41,k=this.n42,q=this.n43,s=this.n44;return d*g*j*m-c*i*j*m-d*f*o*m+b*i*o*m+c*f*n*m-b*g*n*m-d*g*h*k+c*i*h*k+d*e*o*k-a*i*o*k-c*e*n*k+a*g*n*k+d*f*h*q-b*i*h*q-d*e*j*q+a*i*j*q+b*e*n*q-a*f*n*q-c*f*h*s+b*g*h*s+c*e*j*s-a*g*j*s-b*e*o*s+a*f*o*s},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=
 this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;
 this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=
 this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},setScale:function(a,
-b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotationX:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotationY:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotationZ:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,f=a.x,g=a.y,i=a.z,h=e*f,l=e*g;this.set(h*
-f+c,h*g-d*i,h*i+d*g,0,h*g+d*i,l*g+c,l*i-d*f,0,h*i-d*g,l*i+d*f,e*i*i+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var b=a.x,c=a.y,d=a.z;a=Math.cos(b);b=Math.sin(b);var e=Math.cos(c);c=Math.sin(c);var f=Math.cos(d);d=Math.sin(d);var g=a*c,i=b*c;this.n11=e*f;this.n12=-e*d;this.n13=c;this.n21=i*f+a*d;this.n22=-i*d+a*f;this.n23=-b*e;this.n31=-g*f+b*d;this.n32=g*d+b*f;this.n33=a*e;return this},setRotationFromQuaternion:function(a){var b=
-a.x,c=a.y,d=a.z,e=a.w,f=b+b,g=c+c,i=d+d;a=b*f;var h=b*g;b*=i;var l=c*g;c*=i;d*=i;f*=e;g*=e;e*=i;this.n11=1-(l+d);this.n12=h-e;this.n13=b+g;this.n21=h+e;this.n22=1-(a+d);this.n23=c-f;this.n31=b-g;this.n32=c+f;this.n33=1-(a+l);return this},scale:function(a){var b=a.x,c=a.y;a=a.z;this.n11*=b;this.n12*=c;this.n13*=a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=
+b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotationX:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotationY:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotationZ:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,f=a.x,g=a.y,i=a.z,h=e*f,j=e*g;this.set(h*
+f+c,h*g-d*i,h*i+d*g,0,h*g+d*i,j*g+c,j*i-d*f,0,h*i-d*g,j*i+d*f,e*i*i+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var b=a.x,c=a.y,d=a.z;a=Math.cos(b);b=Math.sin(b);var e=Math.cos(c);c=Math.sin(c);var f=Math.cos(d);d=Math.sin(d);var g=a*c,i=b*c;this.n11=e*f;this.n12=-e*d;this.n13=c;this.n21=i*f+a*d;this.n22=-i*d+a*f;this.n23=-b*e;this.n31=-g*f+b*d;this.n32=g*d+b*f;this.n33=a*e;return this},setRotationFromQuaternion:function(a){var b=
+a.x,c=a.y,d=a.z,e=a.w,f=b+b,g=c+c,i=d+d;a=b*f;var h=b*g;b*=i;var j=c*g;c*=i;d*=i;f*=e;g*=e;e*=i;this.n11=1-(j+d);this.n12=h-e;this.n13=b+g;this.n21=h+e;this.n22=1-(a+d);this.n23=c-f;this.n31=b-g;this.n32=c+f;this.n33=1-(a+j);return this},scale:function(a){var b=a.x,c=a.y;a=a.z;this.n11*=b;this.n12*=c;this.n13*=a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=
 a.n34},extractRotation:function(a,b){var c=1/b.x,d=1/b.y,e=1/b.z;this.n11=a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*d;this.n22=a.n22*d;this.n32=a.n32*d;this.n13=a.n13*e;this.n23=a.n23*e;this.n33=a.n33*e}};
-THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,d=a.n12,e=a.n13,f=a.n14,g=a.n21,i=a.n22,h=a.n23,l=a.n24,n=a.n31,m=a.n32,k=a.n33,o=a.n34,r=a.n41,v=a.n42,u=a.n43,j=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=h*o*v-l*k*v+l*m*u-i*o*u-h*m*j+i*k*j;b.n12=f*k*v-e*o*v-f*m*u+d*o*u+e*m*j-d*k*j;b.n13=e*l*v-f*h*v+f*i*u-d*l*u-e*i*j+d*h*j;b.n14=f*h*m-e*l*m-f*i*k+d*l*k+e*i*o-d*h*o;b.n21=l*k*r-h*o*r-l*n*u+g*o*u+h*n*j-g*k*j;b.n22=e*o*r-f*k*r+f*n*u-c*o*u-e*n*j+c*k*j;b.n23=f*h*r-e*l*r-f*g*u+c*l*u+e*g*j-c*h*j;
-b.n24=e*l*n-f*h*n+f*g*k-c*l*k-e*g*o+c*h*o;b.n31=i*o*r-l*m*r+l*n*v-g*o*v-i*n*j+g*m*j;b.n32=f*m*r-d*o*r-f*n*v+c*o*v+d*n*j-c*m*j;b.n33=e*l*r-f*i*r+f*g*v-c*l*v-d*g*j+c*i*j;b.n34=f*i*n-d*l*n-f*g*m+c*l*m+d*g*o-c*i*o;b.n41=h*m*r-i*k*r-h*n*v+g*k*v+i*n*u-g*m*u;b.n42=d*k*r-e*m*r+e*n*v-c*k*v-d*n*u+c*m*u;b.n43=e*i*r-d*h*r-e*g*v+c*h*v+d*g*u-c*i*u;b.n44=d*h*n-e*i*n+e*g*m-c*h*m-d*g*k+c*i*k;b.multiplyScalar(1/a.determinant());return b};
-THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,e=-a.n33*a.n21+a.n31*a.n23,f=a.n32*a.n21-a.n31*a.n22,g=-a.n33*a.n12+a.n32*a.n13,i=a.n33*a.n11-a.n31*a.n13,h=-a.n32*a.n11+a.n31*a.n12,l=a.n23*a.n12-a.n22*a.n13,n=-a.n23*a.n11+a.n21*a.n13,m=a.n22*a.n11-a.n21*a.n12;a=a.n11*d+a.n21*g+a.n31*l;if(a==0)throw"matrix not invertible";a=1/a;c[0]=a*d;c[1]=a*e;c[2]=a*f;c[3]=a*g;c[4]=a*i;c[5]=a*h;c[6]=a*l;c[7]=a*n;c[8]=a*m;return b};
+THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,d=a.n12,e=a.n13,f=a.n14,g=a.n21,i=a.n22,h=a.n23,j=a.n24,o=a.n31,n=a.n32,m=a.n33,k=a.n34,q=a.n41,s=a.n42,v=a.n43,l=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=h*k*s-j*m*s+j*n*v-i*k*v-h*n*l+i*m*l;b.n12=f*m*s-e*k*s-f*n*v+d*k*v+e*n*l-d*m*l;b.n13=e*j*s-f*h*s+f*i*v-d*j*v-e*i*l+d*h*l;b.n14=f*h*n-e*j*n-f*i*m+d*j*m+e*i*k-d*h*k;b.n21=j*m*q-h*k*q-j*o*v+g*k*v+h*o*l-g*m*l;b.n22=e*k*q-f*m*q+f*o*v-c*k*v-e*o*l+c*m*l;b.n23=f*h*q-e*j*q-f*g*v+c*j*v+e*g*l-c*h*l;
+b.n24=e*j*o-f*h*o+f*g*m-c*j*m-e*g*k+c*h*k;b.n31=i*k*q-j*n*q+j*o*s-g*k*s-i*o*l+g*n*l;b.n32=f*n*q-d*k*q-f*o*s+c*k*s+d*o*l-c*n*l;b.n33=e*j*q-f*i*q+f*g*s-c*j*s-d*g*l+c*i*l;b.n34=f*i*o-d*j*o-f*g*n+c*j*n+d*g*k-c*i*k;b.n41=h*n*q-i*m*q-h*o*s+g*m*s+i*o*v-g*n*v;b.n42=d*m*q-e*n*q+e*o*s-c*m*s-d*o*v+c*n*v;b.n43=e*i*q-d*h*q-e*g*s+c*h*s+d*g*v-c*i*v;b.n44=d*h*o-e*i*o+e*g*n-c*h*n-d*g*m+c*i*m;b.multiplyScalar(1/a.determinant());return b};
+THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,e=-a.n33*a.n21+a.n31*a.n23,f=a.n32*a.n21-a.n31*a.n22,g=-a.n33*a.n12+a.n32*a.n13,i=a.n33*a.n11-a.n31*a.n13,h=-a.n32*a.n11+a.n31*a.n12,j=a.n23*a.n12-a.n22*a.n13,o=-a.n23*a.n11+a.n21*a.n13,n=a.n22*a.n11-a.n21*a.n12;a=a.n11*d+a.n21*g+a.n31*j;if(a==0)throw"matrix not invertible";a=1/a;c[0]=a*d;c[1]=a*e;c[2]=a*f;c[3]=a*g;c[4]=a*i;c[5]=a*h;c[6]=a*j;c[7]=a*o;c[8]=a*n;return b};
 THREE.Matrix4.makeFrustum=function(a,b,c,d,e,f){var g;g=new THREE.Matrix4;g.n11=2*e/(b-a);g.n12=0;g.n13=(b+a)/(b-a);g.n14=0;g.n21=0;g.n22=2*e/(d-c);g.n23=(d+c)/(d-c);g.n24=0;g.n31=0;g.n32=0;g.n33=-(f+e)/(f-e);g.n34=-2*f*e/(f-e);g.n41=0;g.n42=0;g.n43=-1;g.n44=0;return g};THREE.Matrix4.makePerspective=function(a,b,c,d){var e;a=c*Math.tan(a*Math.PI/360);e=-a;return THREE.Matrix4.makeFrustum(e*b,a*b,e,a,c,d)};
-THREE.Matrix4.makeOrtho=function(a,b,c,d,e,f){var g,i,h,l;g=new THREE.Matrix4;i=b-a;h=c-d;l=f-e;g.n11=2/i;g.n12=0;g.n13=0;g.n14=-((b+a)/i);g.n21=0;g.n22=2/h;g.n23=0;g.n24=-((c+d)/h);g.n31=0;g.n32=0;g.n33=-2/l;g.n34=-((f+e)/l);g.n41=0;g.n42=0;g.n43=0;g.n44=1;return g};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
+THREE.Matrix4.makeOrtho=function(a,b,c,d,e,f){var g,i,h,j;g=new THREE.Matrix4;i=b-a;h=c-d;j=f-e;g.n11=2/i;g.n12=0;g.n13=0;g.n14=-((b+a)/i);g.n21=0;g.n22=2/h;g.n23=0;g.n24=-((c+d)/h);g.n31=0;g.n32=0;g.n33=-2/j;g.n34=-((f+e)/j);g.n41=0;g.n42=0;g.n43=0;g.n44=1;return g};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
 THREE.Object3D=function(){this.parent=undefined;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixAutoUpdate=!0;this.matrixWorldNeedsUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=
 !0;this._vector=new THREE.Vector3};
 THREE.Object3D.prototype={translate:function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(a){if(this.children.indexOf(a)===-1){a.parent!==
@@ -47,8 +47,8 @@ undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);for(var b
 d;a++)this.children[a].update(this.matrixWorld,b,c)}}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==undefined?d:1)};
 THREE.Quaternion.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b;a=Math.cos(d);d=Math.sin(d);b=Math.cos(-e);e=Math.sin(-e);var f=Math.cos(c);c=Math.sin(c);var g=a*b,i=d*e;this.w=g*f-i*c;this.x=g*c+i*f;this.y=d*b*f+a*e*c;this.z=a*e*f-d*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,d=this.z,e=this.w,f=a.x,g=a.y,i=a.z;a=a.w;this.x=b*a+e*f+c*i-d*g;this.y=c*a+e*g+d*f-b*i;this.z=d*a+e*i+b*g-c*f;this.w=e*a-b*f-c*g-d*i;return this},
-multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,f=this.x,g=this.y,i=this.z,h=this.w,l=h*c+g*e-i*d,n=h*d+i*c-f*e,m=h*e+f*d-g*c;c=-f*c-g*d-i*e;b.x=l*h+c*-f+n*-i-m*-g;b.y=n*h+c*-g+m*-f-l*-i;b.z=m*h+c*-i+l*-g-n*-f;return b}};
-THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(e),g=Math.sqrt(1-e*e);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}e=Math.sin((1-d)*f)/g;d=Math.sin(d*f)/g;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c};
+multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,f=this.x,g=this.y,i=this.z,h=this.w,j=h*c+g*e-i*d,o=h*d+i*c-f*e,n=h*e+f*d-g*c;c=-f*c-g*d-i*e;b.x=j*h+c*-f+o*-i-n*-g;b.y=o*h+c*-g+n*-f-j*-i;b.z=n*h+c*-i+j*-g-o*-f;return b}};
+THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(e),g=Math.sqrt(1-e*e);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}e=Math.sin((1-d)*f)/g;d=Math.sin(d*f)/g;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c};
 THREE.Vertex=function(a,b){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=b||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=!0};
 THREE.Face3=function(a,b,c,d,e){this.a=a;this.b=b;this.c=c;this.centroid=new THREE.Vector3;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.materials=e instanceof Array?e:[e]};THREE.Face4=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.d=d;this.centroid=new THREE.Vector3;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.materials=f instanceof Array?f:[f]};
 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.faces=[];this.uvs=[];this.uvs2=[];this.colors=[];this.morphTargets=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
@@ -56,12 +56,29 @@ THREE.Geometry.prototype={computeCentroids:function(){var a,b,c;a=0;for(b=this.f
 c.centroid.addSelf(this.vertices[c.d].position);c.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var b,c,d,e,f,g,i=new THREE.Vector3,h=new THREE.Vector3;d=0;for(e=this.vertices.length;d<e;d++){f=this.vertices[d];f.normal.set(0,0,0)}d=0;for(e=this.faces.length;d<e;d++){f=this.faces[d];if(a&&f.vertexNormals.length){i.set(0,0,0);b=0;for(c=f.vertexNormals.length;b<c;b++)i.addSelf(f.vertexNormals[b]);i.divideScalar(3)}else{b=this.vertices[f.a];c=this.vertices[f.b];g=this.vertices[f.c];i.sub(g.position,
 c.position);h.sub(b.position,c.position);i.crossSelf(h)}i.isZero()||i.normalize();f.normal.copy(i)}},computeVertexNormals:function(){var a,b,c,d;if(this.__tmpVertices==undefined){d=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,
 new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{d=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal)}else if(c instanceof THREE.Face4){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal);d[c.d].addSelf(c.normal)}}a=0;for(b=this.vertices.length;a<b;a++)d[a].normalize();a=0;for(b=this.faces.length;a<
-b;a++){c=this.faces[a];if(c instanceof THREE.Face3){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c]);c.vertexNormals[3].copy(d[c.d])}}},computeTangents:function(){function a(s,C,S,y,K,D,w){f=s.vertices[C].position;g=s.vertices[S].position;i=s.vertices[y].position;h=e[K];l=e[D];n=e[w];m=g.x-f.x;k=i.x-f.x;o=g.y-f.y;r=i.y-f.y;
-v=g.z-f.z;u=i.z-f.z;j=l.u-h.u;J=n.u-h.u;q=l.v-h.v;A=n.v-h.v;F=1/(j*A-J*q);z.set((A*m-q*k)*F,(A*o-q*r)*F,(A*v-q*u)*F);L.set((j*k-J*m)*F,(j*r-J*o)*F,(j*u-J*v)*F);R[C].addSelf(z);R[S].addSelf(z);R[y].addSelf(z);B[C].addSelf(L);B[S].addSelf(L);B[y].addSelf(L)}var b,c,d,e,f,g,i,h,l,n,m,k,o,r,v,u,j,J,q,A,F,R=[],B=[],z=new THREE.Vector3,L=new THREE.Vector3,G=new THREE.Vector3,N=new THREE.Vector3,H=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++){R[b]=new THREE.Vector3;B[b]=new THREE.Vector3}b=0;
+b;a++){c=this.faces[a];if(c instanceof THREE.Face3){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c]);c.vertexNormals[3].copy(d[c.d])}}},computeTangents:function(){function a(t,C,S,y,K,D,w){f=t.vertices[C].position;g=t.vertices[S].position;i=t.vertices[y].position;h=e[K];j=e[D];o=e[w];n=g.x-f.x;m=i.x-f.x;k=g.y-f.y;q=i.y-f.y;
+s=g.z-f.z;v=i.z-f.z;l=j.u-h.u;J=o.u-h.u;r=j.v-h.v;A=o.v-h.v;F=1/(l*A-J*r);z.set((A*n-r*m)*F,(A*k-r*q)*F,(A*s-r*v)*F);L.set((l*m-J*n)*F,(l*q-J*k)*F,(l*v-J*s)*F);R[C].addSelf(z);R[S].addSelf(z);R[y].addSelf(z);B[C].addSelf(L);B[S].addSelf(L);B[y].addSelf(L)}var b,c,d,e,f,g,i,h,j,o,n,m,k,q,s,v,l,J,r,A,F,R=[],B=[],z=new THREE.Vector3,L=new THREE.Vector3,G=new THREE.Vector3,N=new THREE.Vector3,H=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++){R[b]=new THREE.Vector3;B[b]=new THREE.Vector3}b=0;
 for(c=this.faces.length;b<c;b++){d=this.faces[b];e=this.uvs[b];if(d instanceof THREE.Face3){a(this,d.a,d.b,d.c,0,1,2);this.vertices[d.a].normal.copy(d.vertexNormals[0]);this.vertices[d.b].normal.copy(d.vertexNormals[1]);this.vertices[d.c].normal.copy(d.vertexNormals[2])}else if(d instanceof THREE.Face4){a(this,d.a,d.b,d.c,0,1,2);a(this,d.a,d.b,d.d,0,1,3);this.vertices[d.a].normal.copy(d.vertexNormals[0]);this.vertices[d.b].normal.copy(d.vertexNormals[1]);this.vertices[d.c].normal.copy(d.vertexNormals[2]);
 this.vertices[d.d].normal.copy(d.vertexNormals[3])}}b=0;for(c=this.vertices.length;b<c;b++){H.copy(this.vertices[b].normal);d=R[b];G.copy(d);G.subSelf(H.multiplyScalar(H.dot(d))).normalize();N.cross(this.vertices[b].normal,d);d=N.dot(B[b]);d=d<0?-1:1;this.vertices[b].tangent.set(G.x,G.y,G.z,d)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],
 z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,c=this.vertices.length;b<c;b++){a=this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>
 this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,b=0,c=this.vertices.length;b<c;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}}};THREE.GeometryIdCounter=0;
+THREE.AnimationHandler=function(){var a=[],b={},c={};c.update=function(e){for(var f=0;f<a.length;f++)a[f].update(e)};c.addToUpdate=function(e){a.indexOf(e)===-1&&a.push(e)};c.removeFromUpdate=function(e){e=a.indexOf(e);e!==-1&&a.splice(e,1)};c.add=function(e){b[e.name]!==undefined&&console.log("THREE.AnimationHandler.add: Warning! "+e.name+" already exists in library. Overwriting.");b[e.name]=e;if(e.initialized!==!0){for(var f=0;f<e.hierarchy.length;f++){for(var g=0;g<e.hierarchy[f].keys.length;g++){if(e.hierarchy[f].keys[g].time<
+0)e.hierarchy[f].keys[g].time=0;if(e.hierarchy[f].keys[g].rot!==undefined&&!(e.hierarchy[f].keys[g].rot instanceof THREE.Quaternion)){var i=e.hierarchy[f].keys[g].rot;e.hierarchy[f].keys[g].rot=new THREE.Quaternion(i[0],i[1],i[2],i[3])}}if(e.hierarchy[f].keys[0].morphTargets!==undefined){i={};for(g=0;g<e.hierarchy[f].keys.length;g++)for(var h=0;h<e.hierarchy[f].keys[g].morphTargets.length;h++){var j=e.hierarchy[f].keys[g].morphTargets[h];i[j]=-1}e.hierarchy[f].usedMorphTargets=i;for(g=0;g<e.hierarchy[f].keys.length;g++){var o=
+{};for(j in i){for(h=0;h<e.hierarchy[f].keys[g].morphTargets.length;h++)if(e.hierarchy[f].keys[g].morphTargets[h]===j){o[j]=e.hierarchy[f].keys[g].morphTargetsInfluences[h];break}h===e.hierarchy[f].keys[g].morphTargets.length&&(o[j]=0)}e.hierarchy[f].keys[g].morphTargetsInfluences=o}}for(g=1;g<e.hierarchy[f].keys.length;g++)if(e.hierarchy[f].keys[g].time===e.hierarchy[f].keys[g-1].time){e.hierarchy[f].keys.splice(g,1);g--}for(g=1;g<e.hierarchy[f].keys.length;g++)e.hierarchy[f].keys[g].index=g}g=parseInt(e.length*
+e.fps,10);e.JIT={};e.JIT.hierarchy=[];for(f=0;f<e.hierarchy.length;f++)e.JIT.hierarchy.push(Array(g));e.initialized=!0}};c.get=function(e){if(typeof e==="string")if(b[e])return b[e];else{console.log("THREE.AnimationHandler.get: Couldn't find animation "+e);return null}};c.parse=function(e){var f=[];if(e instanceof THREE.SkinnedMesh)for(var g=0;g<e.bones.length;g++)f.push(e.bones[g]);else d(e,f);return f};var d=function(e,f){f.push(e);for(var g=0;g<e.children.length;g++)d(e.children[g],f)};c.LINEAR=
+0;c.CATMULLROM=1;c.CATMULLROM_FORWARD=2;return c}();THREE.Animation=function(a,b,c,d){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.isPaused=!0;this.loop=!0;this.interpolationType=c!==undefined?c:THREE.AnimationHandler.LINEAR;this.JITCompile=d!==undefined?d:!0;this.points=[];this.target=new THREE.Vector3};
+THREE.Animation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==undefined?a:!0;this.currentTime=b!==undefined?b:0;var c,d=this.hierarchy.length,e;for(c=0;c<d;c++){e=this.hierarchy[c];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)e.useQuaternion=!0;e.matrixAutoUpdate=!0;if(e.animationCache===undefined){e.animationCache={};e.animationCache.prevKey={pos:0,rot:0,scl:0};e.animationCache.nextKey={pos:0,rot:0,scl:0};e.animationCache.originalMatrix=
+e instanceof THREE.Bone?e.skinMatrix:e.matrix}var f=e.animationCache.prevKey;e=e.animationCache.nextKey;f.pos=this.data.hierarchy[c].keys[0];f.rot=this.data.hierarchy[c].keys[0];f.scl=this.data.hierarchy[c].keys[0];e.pos=this.getNextKeyWith("pos",c,1);e.rot=this.getNextKeyWith("rot",c,1);e.scl=this.getNextKeyWith("scl",c,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
+THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
+THREE.Animation.prototype.stop=function(){this.isPlaying=!1;this.isPaused=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==undefined){if(this.hierarchy[a]instanceof THREE.Bone)this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix;else this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix;delete this.hierarchy[a].animationCache}};
+THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,d,e,f,g,i,h,j,o=this.data.JIT.hierarchy,n,m;this.currentTime+=a*this.timeScale;m=this.currentTime;n=this.currentTime%=this.data.length;j=parseInt(Math.min(n*this.data.fps,this.data.length*this.data.fps),10);for(var k=0,q=this.hierarchy.length;k<q;k++){a=this.hierarchy[k];h=a.animationCache;if(this.JITCompile&&o[k][j]!==undefined)if(a instanceof THREE.Bone){a.skinMatrix=o[k][j];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=
+!1}else{a.matrix=o[k][j];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=!0}else{if(this.JITCompile)if(a instanceof THREE.Bone)a.skinMatrix=a.animationCache.originalMatrix;else a.matrix=a.animationCache.originalMatrix;for(var s=0;s<3;s++){c=b[s];g=h.prevKey[c];i=h.nextKey[c];if(i.time<=m){if(n<m)if(this.loop){g=this.data.hierarchy[k].keys[0];for(i=this.getNextKeyWith(c,k,1);i.time<n;){g=i;i=this.getNextKeyWith(c,k,i.index+1)}}else{this.stop();return}else{do{g=i;i=this.getNextKeyWith(c,k,i.index+1)}while(i.time<
+n)}h.prevKey[c]=g;h.nextKey[c]=i}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(n-g.time)/(i.time-g.time);e=g[c];f=i[c];if(d<0||d>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+k);d=d<0?0:1}if(c==="pos"){c=a.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){c.x=e[0]+(f[0]-e[0])*d;c.y=e[1]+(f[1]-e[1])*d;c.z=e[2]+(f[2]-e[2])*d}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=
+this.getPrevKeyWith("pos",k,g.index-1).pos;this.points[1]=e;this.points[2]=f;this.points[3]=this.getNextKeyWith("pos",k,i.index+1).pos;d=d*0.33+0.33;e=this.interpolateCatmullRom(this.points,d);c.x=e[0];c.y=e[1];c.z=e[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){d=this.interpolateCatmullRom(this.points,d*1.01);this.target.set(d[0],d[1],d[2]);this.target.subSelf(c);this.target.y=0;this.target.normalize();d=Math.atan2(this.target.x,this.target.z);a.rotation.set(0,d,0)}}}else if(c===
+"rot")THREE.Quaternion.slerp(e,f,a.quaternion,d);else if(c==="scl"){c=a.scale;c.x=e[0]+(f[0]-e[0])*d;c.y=e[1]+(f[1]-e[1])*d;c.z=e[2]+(f[2]-e[2])*d}}}}if(this.JITCompile&&o[0][j]===undefined){this.hierarchy[0].update(undefined,!0);for(k=0;k<this.hierarchy.length;k++)o[k][j]=this.hierarchy[k]instanceof THREE.Bone?this.hierarchy[k].skinMatrix.clone():this.hierarchy[k].matrix.clone()}}};
+THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],d=[],e,f,g,i,h,j;e=(a.length-1)*b;f=Math.floor(e);e-=f;c[0]=f==0?f:f-1;c[1]=f;c[2]=f>a.length-2?f:f+1;c[3]=f>a.length-3?f:f+2;f=a[c[0]];i=a[c[1]];h=a[c[2]];j=a[c[3]];c=e*e;g=e*c;d[0]=this.interpolate(f[0],i[0],h[0],j[0],e,c,g);d[1]=this.interpolate(f[1],i[1],h[1],j[1],e,c,g);d[2]=this.interpolate(f[2],i[2],h[2],j[2],e,c,g);return d};
+THREE.Animation.prototype.interpolate=function(a,b,c,d,e,f,g){a=(c-a)*0.5;d=(d-b)*0.5;return(2*(b-c)+a+d)*g+(-3*(b-c)-2*a-d)*f+a*e+b};THREE.Animation.prototype.getNextKeyWith=function(a,b,c){var d=this.data.hierarchy[b].keys;if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)c=c<d.length-1?c:d.length-1;else c%=d.length;for(;c<d.length;c++)if(d[c][a]!==undefined)return d[c];return this.data.hierarchy[b].keys[0]};
+THREE.Animation.prototype.getPrevKeyWith=function(a,b,c){var d=this.data.hierarchy[b].keys;for(c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c>0?c:0:c>=0?c:c+d.length;c>=0;c--)if(d[c][a]!==undefined)return d[c];return this.data.hierarchy[b].keys[d.length-1]};
 THREE.Camera=function(a,b,c,d,e){THREE.Object3D.call(this);this.fov=a||50;this.aspect=b||1;this.near=c||0.1;this.far=d||2E3;this.target=e||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
 THREE.Camera.prototype.translate=function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a));this.target.position.addSelf(b.multiplyScalar(a))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};THREE.Camera.prototype.updateMatrix=function(){this.update(undefined,!0)};
 THREE.Camera.prototype.update=function(a,b,c){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);this.matrix.setPosition(this.position);a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);b=!0}else{this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=
@@ -103,33 +120,33 @@ THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.f
 THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(a instanceof THREE.Sound)this.sounds.indexOf(a)===-1&&this.sounds.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a)}for(var b=0;b<a.children.length;b++)this.addChildRecurse(a.children[b])};
 THREE.Scene.prototype.removeChild=function(a){this.supr.removeChild.call(this,a);this.removeChildRecurse(a)};THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else if(a instanceof THREE.Sound){b=this.sounds.indexOf(a);b!==-1&&this.sounds.splice(b,1)}else if(!(a instanceof THREE.Camera)){b=this.objects.indexOf(a);if(b!==-1){this.objects.splice(b,1);this.__objectsRemoved.push(a)}}for(b=0;b<a.children.length;b++)this.removeChildRecurse(a.children[b])};
 THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;
-THREE.Projector=function(){function a(B,z){return z.z-B.z}function b(B,z){var L=0,G=1,N=B.z+B.w,H=z.z+z.w,s=-B.z+B.w,C=-z.z+z.w;if(N>=0&&H>=0&&s>=0&&C>=0)return!0;else if(N<0&&H<0||s<0&&C<0)return!1;else{if(N<0)L=Math.max(L,N/(N-H));else H<0&&(G=Math.min(G,N/(N-H)));if(s<0)L=Math.max(L,s/(s-C));else C<0&&(G=Math.min(G,s/(s-C)));if(G<L)return!1;else{B.lerpSelf(z,L);z.lerpSelf(B,1-G);return!0}}}var c,d,e=[],f,g,i,h=[],l,n,m=[],k,o,r=[],v=new THREE.Vector4,u=new THREE.Vector4,j=new THREE.Matrix4,J=new THREE.Matrix4,
-q=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],A=new THREE.Vector4,F=new THREE.Vector4,R;this.projectObjects=function(B,z,L){z=[];var G,N,H;d=0;N=B.objects;B=0;for(G=N.length;B<G;B++){H=N[B];var s;if(!(s=!H.visible))if(s=H instanceof THREE.Mesh){a:{s=void 0;for(var C=H.matrixWorld,S=-H.geometry.boundingSphere.radius*Math.max(H.scale.x,Math.max(H.scale.y,H.scale.z)),y=0;y<6;y++){s=q[y].x*C.n14+q[y].y*C.n24+q[y].z*C.n34+q[y].w;if(s<=S){s=
-!1;break a}}s=!0}s=!s}if(!s){c=e[d]=e[d]||new THREE.RenderableObject;v.copy(H.position);j.multiplyVector3(v);c.object=H;c.z=v.z;z.push(c);d++}}L&&z.sort(a);return z};this.projectScene=function(B,z,L){var G=[],N=z.near,H=z.far,s,C,S,y,K,D,w,M,P,x,t,I,O,p,E,Q;i=n=o=0;z.matrixAutoUpdate&&z.updateMatrix();B.update(undefined,!1,z);j.multiply(z.projectionMatrix,z.matrixWorldInverse);q[0].set(j.n41-j.n11,j.n42-j.n12,j.n43-j.n13,j.n44-j.n14);q[1].set(j.n41+j.n11,j.n42+j.n12,j.n43+j.n13,j.n44+j.n14);q[2].set(j.n41+
-j.n21,j.n42+j.n22,j.n43+j.n23,j.n44+j.n24);q[3].set(j.n41-j.n21,j.n42-j.n22,j.n43-j.n23,j.n44-j.n24);q[4].set(j.n41-j.n31,j.n42-j.n32,j.n43-j.n33,j.n44-j.n34);q[5].set(j.n41+j.n31,j.n42+j.n32,j.n43+j.n33,j.n44+j.n34);for(s=0;s<6;s++){D=q[s];D.divideScalar(Math.sqrt(D.x*D.x+D.y*D.y+D.z*D.z))}D=this.projectObjects(B,z,!0);B=0;for(s=D.length;B<s;B++){w=D[B].object;if(w.visible){M=w.matrixWorld;t=w.matrixRotationWorld;P=w.materials;x=w.overdraw;if(w instanceof THREE.Mesh){I=w.geometry;O=I.vertices;C=
-0;for(S=O.length;C<S;C++){p=O[C];p.positionWorld.copy(p.position);M.multiplyVector3(p.positionWorld);y=p.positionScreen;y.copy(p.positionWorld);j.multiplyVector4(y);y.x/=y.w;y.y/=y.w;p.__visible=y.z>N&&y.z<H}I=I.faces;C=0;for(S=I.length;C<S;C++){p=I[C];if(p instanceof THREE.Face3){y=O[p.a];K=O[p.b];E=O[p.c];if(y.__visible&&K.__visible&&E.__visible&&(w.doubleSided||w.flipSided!=(E.positionScreen.x-y.positionScreen.x)*(K.positionScreen.y-y.positionScreen.y)-(E.positionScreen.y-y.positionScreen.y)*(K.positionScreen.x-
-y.positionScreen.x)<0)){f=h[i]=h[i]||new THREE.RenderableFace3;f.v1.positionWorld.copy(y.positionWorld);f.v2.positionWorld.copy(K.positionWorld);f.v3.positionWorld.copy(E.positionWorld);f.v1.positionScreen.copy(y.positionScreen);f.v2.positionScreen.copy(K.positionScreen);f.v3.positionScreen.copy(E.positionScreen);f.normalWorld.copy(p.normal);t.multiplyVector3(f.normalWorld);f.centroidWorld.copy(p.centroid);M.multiplyVector3(f.centroidWorld);f.centroidScreen.copy(f.centroidWorld);j.multiplyVector3(f.centroidScreen);
-E=p.vertexNormals;R=f.vertexNormalsWorld;y=0;for(K=E.length;y<K;y++){Q=R[y]=R[y]||new THREE.Vector3;Q.copy(E[y]);t.multiplyVector3(Q)}f.z=f.centroidScreen.z;f.meshMaterials=P;f.faceMaterials=p.materials;f.overdraw=x;if(w.geometry.uvs[C]){f.uvs[0]=w.geometry.uvs[C][0];f.uvs[1]=w.geometry.uvs[C][1];f.uvs[2]=w.geometry.uvs[C][2]}G.push(f);i++}}else if(p instanceof THREE.Face4){y=O[p.a];K=O[p.b];E=O[p.c];Q=O[p.d];if(y.__visible&&K.__visible&&E.__visible&&Q.__visible&&(w.doubleSided||w.flipSided!=((Q.positionScreen.x-
+THREE.Projector=function(){function a(B,z){return z.z-B.z}function b(B,z){var L=0,G=1,N=B.z+B.w,H=z.z+z.w,t=-B.z+B.w,C=-z.z+z.w;if(N>=0&&H>=0&&t>=0&&C>=0)return!0;else if(N<0&&H<0||t<0&&C<0)return!1;else{if(N<0)L=Math.max(L,N/(N-H));else H<0&&(G=Math.min(G,N/(N-H)));if(t<0)L=Math.max(L,t/(t-C));else C<0&&(G=Math.min(G,t/(t-C)));if(G<L)return!1;else{B.lerpSelf(z,L);z.lerpSelf(B,1-G);return!0}}}var c,d,e=[],f,g,i,h=[],j,o,n=[],m,k,q=[],s=new THREE.Vector4,v=new THREE.Vector4,l=new THREE.Matrix4,J=new THREE.Matrix4,
+r=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],A=new THREE.Vector4,F=new THREE.Vector4,R;this.projectObjects=function(B,z,L){z=[];var G,N,H;d=0;N=B.objects;B=0;for(G=N.length;B<G;B++){H=N[B];var t;if(!(t=!H.visible))if(t=H instanceof THREE.Mesh){a:{t=void 0;for(var C=H.matrixWorld,S=-H.geometry.boundingSphere.radius*Math.max(H.scale.x,Math.max(H.scale.y,H.scale.z)),y=0;y<6;y++){t=r[y].x*C.n14+r[y].y*C.n24+r[y].z*C.n34+r[y].w;if(t<=S){t=
+!1;break a}}t=!0}t=!t}if(!t){c=e[d]=e[d]||new THREE.RenderableObject;s.copy(H.position);l.multiplyVector3(s);c.object=H;c.z=s.z;z.push(c);d++}}L&&z.sort(a);return z};this.projectScene=function(B,z,L){var G=[],N=z.near,H=z.far,t,C,S,y,K,D,w,M,P,x,u,I,O,p,E,Q;i=o=k=0;z.matrixAutoUpdate&&z.updateMatrix();B.update(undefined,!1,z);l.multiply(z.projectionMatrix,z.matrixWorldInverse);r[0].set(l.n41-l.n11,l.n42-l.n12,l.n43-l.n13,l.n44-l.n14);r[1].set(l.n41+l.n11,l.n42+l.n12,l.n43+l.n13,l.n44+l.n14);r[2].set(l.n41+
+l.n21,l.n42+l.n22,l.n43+l.n23,l.n44+l.n24);r[3].set(l.n41-l.n21,l.n42-l.n22,l.n43-l.n23,l.n44-l.n24);r[4].set(l.n41-l.n31,l.n42-l.n32,l.n43-l.n33,l.n44-l.n34);r[5].set(l.n41+l.n31,l.n42+l.n32,l.n43+l.n33,l.n44+l.n34);for(t=0;t<6;t++){D=r[t];D.divideScalar(Math.sqrt(D.x*D.x+D.y*D.y+D.z*D.z))}D=this.projectObjects(B,z,!0);B=0;for(t=D.length;B<t;B++){w=D[B].object;if(w.visible){M=w.matrixWorld;u=w.matrixRotationWorld;P=w.materials;x=w.overdraw;if(w instanceof THREE.Mesh){I=w.geometry;O=I.vertices;C=
+0;for(S=O.length;C<S;C++){p=O[C];p.positionWorld.copy(p.position);M.multiplyVector3(p.positionWorld);y=p.positionScreen;y.copy(p.positionWorld);l.multiplyVector4(y);y.x/=y.w;y.y/=y.w;p.__visible=y.z>N&&y.z<H}I=I.faces;C=0;for(S=I.length;C<S;C++){p=I[C];if(p instanceof THREE.Face3){y=O[p.a];K=O[p.b];E=O[p.c];if(y.__visible&&K.__visible&&E.__visible&&(w.doubleSided||w.flipSided!=(E.positionScreen.x-y.positionScreen.x)*(K.positionScreen.y-y.positionScreen.y)-(E.positionScreen.y-y.positionScreen.y)*(K.positionScreen.x-
+y.positionScreen.x)<0)){f=h[i]=h[i]||new THREE.RenderableFace3;f.v1.positionWorld.copy(y.positionWorld);f.v2.positionWorld.copy(K.positionWorld);f.v3.positionWorld.copy(E.positionWorld);f.v1.positionScreen.copy(y.positionScreen);f.v2.positionScreen.copy(K.positionScreen);f.v3.positionScreen.copy(E.positionScreen);f.normalWorld.copy(p.normal);u.multiplyVector3(f.normalWorld);f.centroidWorld.copy(p.centroid);M.multiplyVector3(f.centroidWorld);f.centroidScreen.copy(f.centroidWorld);l.multiplyVector3(f.centroidScreen);
+E=p.vertexNormals;R=f.vertexNormalsWorld;y=0;for(K=E.length;y<K;y++){Q=R[y]=R[y]||new THREE.Vector3;Q.copy(E[y]);u.multiplyVector3(Q)}f.z=f.centroidScreen.z;f.meshMaterials=P;f.faceMaterials=p.materials;f.overdraw=x;if(w.geometry.uvs[C]){f.uvs[0]=w.geometry.uvs[C][0];f.uvs[1]=w.geometry.uvs[C][1];f.uvs[2]=w.geometry.uvs[C][2]}G.push(f);i++}}else if(p instanceof THREE.Face4){y=O[p.a];K=O[p.b];E=O[p.c];Q=O[p.d];if(y.__visible&&K.__visible&&E.__visible&&Q.__visible&&(w.doubleSided||w.flipSided!=((Q.positionScreen.x-
 y.positionScreen.x)*(K.positionScreen.y-y.positionScreen.y)-(Q.positionScreen.y-y.positionScreen.y)*(K.positionScreen.x-y.positionScreen.x)<0||(K.positionScreen.x-E.positionScreen.x)*(Q.positionScreen.y-E.positionScreen.y)-(K.positionScreen.y-E.positionScreen.y)*(Q.positionScreen.x-E.positionScreen.x)<0))){f=h[i]=h[i]||new THREE.RenderableFace3;f.v1.positionWorld.copy(y.positionWorld);f.v2.positionWorld.copy(K.positionWorld);f.v3.positionWorld.copy(Q.positionWorld);f.v1.positionScreen.copy(y.positionScreen);
-f.v2.positionScreen.copy(K.positionScreen);f.v3.positionScreen.copy(Q.positionScreen);f.normalWorld.copy(p.normal);t.multiplyVector3(f.normalWorld);f.centroidWorld.copy(p.centroid);M.multiplyVector3(f.centroidWorld);f.centroidScreen.copy(f.centroidWorld);j.multiplyVector3(f.centroidScreen);f.z=f.centroidScreen.z;f.meshMaterials=P;f.faceMaterials=p.materials;f.overdraw=x;if(w.geometry.uvs[C]){f.uvs[0]=w.geometry.uvs[C][0];f.uvs[1]=w.geometry.uvs[C][1];f.uvs[2]=w.geometry.uvs[C][3]}G.push(f);i++;g=
+f.v2.positionScreen.copy(K.positionScreen);f.v3.positionScreen.copy(Q.positionScreen);f.normalWorld.copy(p.normal);u.multiplyVector3(f.normalWorld);f.centroidWorld.copy(p.centroid);M.multiplyVector3(f.centroidWorld);f.centroidScreen.copy(f.centroidWorld);l.multiplyVector3(f.centroidScreen);f.z=f.centroidScreen.z;f.meshMaterials=P;f.faceMaterials=p.materials;f.overdraw=x;if(w.geometry.uvs[C]){f.uvs[0]=w.geometry.uvs[C][0];f.uvs[1]=w.geometry.uvs[C][1];f.uvs[2]=w.geometry.uvs[C][3]}G.push(f);i++;g=
 h[i]=h[i]||new THREE.RenderableFace3;g.v1.positionWorld.copy(K.positionWorld);g.v2.positionWorld.copy(E.positionWorld);g.v3.positionWorld.copy(Q.positionWorld);g.v1.positionScreen.copy(K.positionScreen);g.v2.positionScreen.copy(E.positionScreen);g.v3.positionScreen.copy(Q.positionScreen);g.normalWorld.copy(f.normalWorld);g.centroidWorld.copy(f.centroidWorld);g.centroidScreen.copy(f.centroidScreen);g.z=g.centroidScreen.z;g.meshMaterials=P;g.faceMaterials=p.materials;g.overdraw=x;if(w.geometry.uvs[C]){g.uvs[0]=
-w.geometry.uvs[C][1];g.uvs[1]=w.geometry.uvs[C][2];g.uvs[2]=w.geometry.uvs[C][3]}G.push(g);i++}}}}else if(w instanceof THREE.Line){J.multiply(j,M);O=w.geometry.vertices;p=O[0];p.positionScreen.copy(p.position);J.multiplyVector4(p.positionScreen);C=1;for(S=O.length;C<S;C++){y=O[C];y.positionScreen.copy(y.position);J.multiplyVector4(y.positionScreen);K=O[C-1];A.copy(y.positionScreen);F.copy(K.positionScreen);if(b(A,F)){A.multiplyScalar(1/A.w);F.multiplyScalar(1/F.w);l=m[n]=m[n]||new THREE.RenderableLine;
-l.v1.positionScreen.copy(A);l.v2.positionScreen.copy(F);l.z=Math.max(A.z,F.z);l.materials=w.materials;G.push(l);n++}}}else if(w instanceof THREE.Particle){u.set(w.position.x,w.position.y,w.position.z,1);j.multiplyVector4(u);u.z/=u.w;if(u.z>0&&u.z<1){k=r[o]=r[o]||new THREE.RenderableParticle;k.x=u.x/u.w;k.y=u.y/u.w;k.z=u.z;k.rotation=w.rotation.z;k.scale.x=w.scale.x*Math.abs(k.x-(u.x+z.projectionMatrix.n11)/(u.w+z.projectionMatrix.n14));k.scale.y=w.scale.y*Math.abs(k.y-(u.y+z.projectionMatrix.n22)/
-(u.w+z.projectionMatrix.n24));k.materials=w.materials;G.push(k);o++}}}}L&&G.sort(a);return G};this.unprojectVector=function(B,z){var L=z.matrixWorld.clone();L.multiplySelf(THREE.Matrix4.makeInvert(z.projectionMatrix));L.multiplyVector3(B);return B}};
-THREE.SVGRenderer=function(){function a(D,w,M){var P,x,t,I;P=0;for(x=D.lights.length;P<x;P++){t=D.lights[P];if(t instanceof THREE.DirectionalLight){I=w.normalWorld.dot(t.position)*t.intensity;if(I>0){M.r+=t.color.r*I;M.g+=t.color.g*I;M.b+=t.color.b*I}}else if(t instanceof THREE.PointLight){L.sub(t.position,w.centroidWorld);L.normalize();I=w.normalWorld.dot(L)*t.intensity;if(I>0){M.r+=t.color.r*I;M.g+=t.color.g*I;M.b+=t.color.b*I}}}}function b(D,w,M,P,x,t){s=d(C++);s.setAttribute("d","M "+D.positionScreen.x+
-" "+D.positionScreen.y+" L "+w.positionScreen.x+" "+w.positionScreen.y+" L "+M.positionScreen.x+","+M.positionScreen.y+"z");if(x instanceof THREE.MeshBasicMaterial)q.__styleString=x.color.__styleString;else if(x instanceof THREE.MeshLambertMaterial)if(J){A.r=F.r;A.g=F.g;A.b=F.b;a(t,P,A);q.r=x.color.r*A.r;q.g=x.color.g*A.g;q.b=x.color.b*A.b;q.updateStyleString()}else q.__styleString=x.color.__styleString;else if(x instanceof THREE.MeshDepthMaterial){z=1-x.__2near/(x.__farPlusNear-P.z*x.__farMinusNear);
-q.setRGB(z,z,z)}else x instanceof THREE.MeshNormalMaterial&&q.setRGB(e(P.normalWorld.x),e(P.normalWorld.y),e(P.normalWorld.z));x.wireframe?s.setAttribute("style","fill: none; stroke: "+q.__styleString+"; stroke-width: "+x.wireframeLinewidth+"; stroke-opacity: "+x.opacity+"; stroke-linecap: "+x.wireframeLinecap+"; stroke-linejoin: "+x.wireframeLinejoin):s.setAttribute("style","fill: "+q.__styleString+"; fill-opacity: "+x.opacity);i.appendChild(s)}function c(D,w,M,P,x,t,I){s=d(C++);s.setAttribute("d",
-"M "+D.positionScreen.x+" "+D.positionScreen.y+" L "+w.positionScreen.x+" "+w.positionScreen.y+" L "+M.positionScreen.x+","+M.positionScreen.y+" L "+P.positionScreen.x+","+P.positionScreen.y+"z");if(t instanceof THREE.MeshBasicMaterial)q.__styleString=t.color.__styleString;else if(t instanceof THREE.MeshLambertMaterial)if(J){A.r=F.r;A.g=F.g;A.b=F.b;a(I,x,A);q.r=t.color.r*A.r;q.g=t.color.g*A.g;q.b=t.color.b*A.b;q.updateStyleString()}else q.__styleString=t.color.__styleString;else if(t instanceof THREE.MeshDepthMaterial){z=
-1-t.__2near/(t.__farPlusNear-x.z*t.__farMinusNear);q.setRGB(z,z,z)}else t instanceof THREE.MeshNormalMaterial&&q.setRGB(e(x.normalWorld.x),e(x.normalWorld.y),e(x.normalWorld.z));t.wireframe?s.setAttribute("style","fill: none; stroke: "+q.__styleString+"; stroke-width: "+t.wireframeLinewidth+"; stroke-opacity: "+t.opacity+"; stroke-linecap: "+t.wireframeLinecap+"; stroke-linejoin: "+t.wireframeLinejoin):s.setAttribute("style","fill: "+q.__styleString+"; fill-opacity: "+t.opacity);i.appendChild(s)}
-function d(D){if(G[D]==null){G[D]=document.createElementNS("http://www.w3.org/2000/svg","path");K==0&&G[D].setAttribute("shape-rendering","crispEdges")}return G[D]}function e(D){return D<0?Math.min((1+D)*0.5,0.5):0.5+Math.min(D*0.5,0.5)}var f=null,g=new THREE.Projector,i=document.createElementNS("http://www.w3.org/2000/svg","svg"),h,l,n,m,k,o,r,v,u=new THREE.Rectangle,j=new THREE.Rectangle,J=!1,q=new THREE.Color(16777215),A=new THREE.Color(16777215),F=new THREE.Color(0),R=new THREE.Color(0),B=new THREE.Color(0),
-z,L=new THREE.Vector3,G=[],N=[],H=[],s,C,S,y,K=1;this.domElement=i;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(D){switch(D){case "high":K=1;break;case "low":K=0}};this.setSize=function(D,w){h=D;l=w;n=h/2;m=l/2;i.setAttribute("viewBox",-n+" "+-m+" "+h+" "+l);i.setAttribute("width",h);i.setAttribute("height",l);u.set(-n,-m,n,m)};this.clear=function(){for(;i.childNodes.length>0;)i.removeChild(i.childNodes[0])};this.render=function(D,w){var M,P,x,t,I,O,p,E;this.autoClear&&
-this.clear();f=g.projectScene(D,w,this.sortElements);y=S=C=0;if(J=D.lights.length>0){p=D.lights;F.setRGB(0,0,0);R.setRGB(0,0,0);B.setRGB(0,0,0);M=0;for(P=p.length;M<P;M++){x=p[M];t=x.color;if(x instanceof THREE.AmbientLight){F.r+=t.r;F.g+=t.g;F.b+=t.b}else if(x instanceof THREE.DirectionalLight){R.r+=t.r;R.g+=t.g;R.b+=t.b}else if(x instanceof THREE.PointLight){B.r+=t.r;B.g+=t.g;B.b+=t.b}}}M=0;for(P=f.length;M<P;M++){p=f[M];j.empty();if(p instanceof THREE.RenderableParticle){k=p;k.x*=n;k.y*=-m;x=0;
-for(t=p.materials.length;x<t;x++)if(E=p.materials[x]){I=k;O=p;var Q=S++;if(N[Q]==null){N[Q]=document.createElementNS("http://www.w3.org/2000/svg","circle");K==0&&N[Q].setAttribute("shape-rendering","crispEdges")}s=N[Q];s.setAttribute("cx",I.x);s.setAttribute("cy",I.y);s.setAttribute("r",O.scale.x*n);if(E instanceof THREE.ParticleCircleMaterial){if(J){A.r=F.r+R.r+B.r;A.g=F.g+R.g+B.g;A.b=F.b+R.b+B.b;q.r=E.color.r*A.r;q.g=E.color.g*A.g;q.b=E.color.b*A.b;q.updateStyleString()}else q=E.color;s.setAttribute("style",
-"fill: "+q.__styleString)}i.appendChild(s)}}else if(p instanceof THREE.RenderableLine){k=p.v1;o=p.v2;k.positionScreen.x*=n;k.positionScreen.y*=-m;o.positionScreen.x*=n;o.positionScreen.y*=-m;j.addPoint(k.positionScreen.x,k.positionScreen.y);j.addPoint(o.positionScreen.x,o.positionScreen.y);if(u.instersects(j)){x=0;for(t=p.materials.length;x<t;)if(E=p.materials[x++]){I=k;O=o;Q=y++;if(H[Q]==null){H[Q]=document.createElementNS("http://www.w3.org/2000/svg","line");K==0&&H[Q].setAttribute("shape-rendering",
-"crispEdges")}s=H[Q];s.setAttribute("x1",I.positionScreen.x);s.setAttribute("y1",I.positionScreen.y);s.setAttribute("x2",O.positionScreen.x);s.setAttribute("y2",O.positionScreen.y);if(E instanceof THREE.LineBasicMaterial){q.__styleString=E.color.__styleString;s.setAttribute("style","fill: none; stroke: "+q.__styleString+"; stroke-width: "+E.linewidth+"; stroke-opacity: "+E.opacity+"; stroke-linecap: "+E.linecap+"; stroke-linejoin: "+E.linejoin);i.appendChild(s)}}}}else if(p instanceof THREE.RenderableFace3){k=
-p.v1;o=p.v2;r=p.v3;k.positionScreen.x*=n;k.positionScreen.y*=-m;o.positionScreen.x*=n;o.positionScreen.y*=-m;r.positionScreen.x*=n;r.positionScreen.y*=-m;j.addPoint(k.positionScreen.x,k.positionScreen.y);j.addPoint(o.positionScreen.x,o.positionScreen.y);j.addPoint(r.positionScreen.x,r.positionScreen.y);if(u.instersects(j)){x=0;for(t=p.meshMaterials.length;x<t;){E=p.meshMaterials[x++];if(E instanceof THREE.MeshFaceMaterial){I=0;for(O=p.faceMaterials.length;I<O;)(E=p.faceMaterials[I++])&&b(k,o,r,p,
-E,D)}else E&&b(k,o,r,p,E,D)}}}else if(p instanceof THREE.RenderableFace4){k=p.v1;o=p.v2;r=p.v3;v=p.v4;k.positionScreen.x*=n;k.positionScreen.y*=-m;o.positionScreen.x*=n;o.positionScreen.y*=-m;r.positionScreen.x*=n;r.positionScreen.y*=-m;v.positionScreen.x*=n;v.positionScreen.y*=-m;j.addPoint(k.positionScreen.x,k.positionScreen.y);j.addPoint(o.positionScreen.x,o.positionScreen.y);j.addPoint(r.positionScreen.x,r.positionScreen.y);j.addPoint(v.positionScreen.x,v.positionScreen.y);if(u.instersects(j)){x=
-0;for(t=p.meshMaterials.length;x<t;){E=p.meshMaterials[x++];if(E instanceof THREE.MeshFaceMaterial){I=0;for(O=p.faceMaterials.length;I<O;)(E=p.faceMaterials[I++])&&c(k,o,r,v,p,E,D)}else E&&c(k,o,r,v,p,E,D)}}}}}};
+w.geometry.uvs[C][1];g.uvs[1]=w.geometry.uvs[C][2];g.uvs[2]=w.geometry.uvs[C][3]}G.push(g);i++}}}}else if(w instanceof THREE.Line){J.multiply(l,M);O=w.geometry.vertices;p=O[0];p.positionScreen.copy(p.position);J.multiplyVector4(p.positionScreen);C=1;for(S=O.length;C<S;C++){y=O[C];y.positionScreen.copy(y.position);J.multiplyVector4(y.positionScreen);K=O[C-1];A.copy(y.positionScreen);F.copy(K.positionScreen);if(b(A,F)){A.multiplyScalar(1/A.w);F.multiplyScalar(1/F.w);j=n[o]=n[o]||new THREE.RenderableLine;
+j.v1.positionScreen.copy(A);j.v2.positionScreen.copy(F);j.z=Math.max(A.z,F.z);j.materials=w.materials;G.push(j);o++}}}else if(w instanceof THREE.Particle){v.set(w.position.x,w.position.y,w.position.z,1);l.multiplyVector4(v);v.z/=v.w;if(v.z>0&&v.z<1){m=q[k]=q[k]||new THREE.RenderableParticle;m.x=v.x/v.w;m.y=v.y/v.w;m.z=v.z;m.rotation=w.rotation.z;m.scale.x=w.scale.x*Math.abs(m.x-(v.x+z.projectionMatrix.n11)/(v.w+z.projectionMatrix.n14));m.scale.y=w.scale.y*Math.abs(m.y-(v.y+z.projectionMatrix.n22)/
+(v.w+z.projectionMatrix.n24));m.materials=w.materials;G.push(m);k++}}}}L&&G.sort(a);return G};this.unprojectVector=function(B,z){var L=z.matrixWorld.clone();L.multiplySelf(THREE.Matrix4.makeInvert(z.projectionMatrix));L.multiplyVector3(B);return B}};
+THREE.SVGRenderer=function(){function a(D,w,M){var P,x,u,I;P=0;for(x=D.lights.length;P<x;P++){u=D.lights[P];if(u instanceof THREE.DirectionalLight){I=w.normalWorld.dot(u.position)*u.intensity;if(I>0){M.r+=u.color.r*I;M.g+=u.color.g*I;M.b+=u.color.b*I}}else if(u instanceof THREE.PointLight){L.sub(u.position,w.centroidWorld);L.normalize();I=w.normalWorld.dot(L)*u.intensity;if(I>0){M.r+=u.color.r*I;M.g+=u.color.g*I;M.b+=u.color.b*I}}}}function b(D,w,M,P,x,u){t=d(C++);t.setAttribute("d","M "+D.positionScreen.x+
+" "+D.positionScreen.y+" L "+w.positionScreen.x+" "+w.positionScreen.y+" L "+M.positionScreen.x+","+M.positionScreen.y+"z");if(x instanceof THREE.MeshBasicMaterial)r.__styleString=x.color.__styleString;else if(x instanceof THREE.MeshLambertMaterial)if(J){A.r=F.r;A.g=F.g;A.b=F.b;a(u,P,A);r.r=x.color.r*A.r;r.g=x.color.g*A.g;r.b=x.color.b*A.b;r.updateStyleString()}else r.__styleString=x.color.__styleString;else if(x instanceof THREE.MeshDepthMaterial){z=1-x.__2near/(x.__farPlusNear-P.z*x.__farMinusNear);
+r.setRGB(z,z,z)}else x instanceof THREE.MeshNormalMaterial&&r.setRGB(e(P.normalWorld.x),e(P.normalWorld.y),e(P.normalWorld.z));x.wireframe?t.setAttribute("style","fill: none; stroke: "+r.__styleString+"; stroke-width: "+x.wireframeLinewidth+"; stroke-opacity: "+x.opacity+"; stroke-linecap: "+x.wireframeLinecap+"; stroke-linejoin: "+x.wireframeLinejoin):t.setAttribute("style","fill: "+r.__styleString+"; fill-opacity: "+x.opacity);i.appendChild(t)}function c(D,w,M,P,x,u,I){t=d(C++);t.setAttribute("d",
+"M "+D.positionScreen.x+" "+D.positionScreen.y+" L "+w.positionScreen.x+" "+w.positionScreen.y+" L "+M.positionScreen.x+","+M.positionScreen.y+" L "+P.positionScreen.x+","+P.positionScreen.y+"z");if(u instanceof THREE.MeshBasicMaterial)r.__styleString=u.color.__styleString;else if(u instanceof THREE.MeshLambertMaterial)if(J){A.r=F.r;A.g=F.g;A.b=F.b;a(I,x,A);r.r=u.color.r*A.r;r.g=u.color.g*A.g;r.b=u.color.b*A.b;r.updateStyleString()}else r.__styleString=u.color.__styleString;else if(u instanceof THREE.MeshDepthMaterial){z=
+1-u.__2near/(u.__farPlusNear-x.z*u.__farMinusNear);r.setRGB(z,z,z)}else u instanceof THREE.MeshNormalMaterial&&r.setRGB(e(x.normalWorld.x),e(x.normalWorld.y),e(x.normalWorld.z));u.wireframe?t.setAttribute("style","fill: none; stroke: "+r.__styleString+"; stroke-width: "+u.wireframeLinewidth+"; stroke-opacity: "+u.opacity+"; stroke-linecap: "+u.wireframeLinecap+"; stroke-linejoin: "+u.wireframeLinejoin):t.setAttribute("style","fill: "+r.__styleString+"; fill-opacity: "+u.opacity);i.appendChild(t)}
+function d(D){if(G[D]==null){G[D]=document.createElementNS("http://www.w3.org/2000/svg","path");K==0&&G[D].setAttribute("shape-rendering","crispEdges")}return G[D]}function e(D){return D<0?Math.min((1+D)*0.5,0.5):0.5+Math.min(D*0.5,0.5)}var f=null,g=new THREE.Projector,i=document.createElementNS("http://www.w3.org/2000/svg","svg"),h,j,o,n,m,k,q,s,v=new THREE.Rectangle,l=new THREE.Rectangle,J=!1,r=new THREE.Color(16777215),A=new THREE.Color(16777215),F=new THREE.Color(0),R=new THREE.Color(0),B=new THREE.Color(0),
+z,L=new THREE.Vector3,G=[],N=[],H=[],t,C,S,y,K=1;this.domElement=i;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(D){switch(D){case "high":K=1;break;case "low":K=0}};this.setSize=function(D,w){h=D;j=w;o=h/2;n=j/2;i.setAttribute("viewBox",-o+" "+-n+" "+h+" "+j);i.setAttribute("width",h);i.setAttribute("height",j);v.set(-o,-n,o,n)};this.clear=function(){for(;i.childNodes.length>0;)i.removeChild(i.childNodes[0])};this.render=function(D,w){var M,P,x,u,I,O,p,E;this.autoClear&&
+this.clear();f=g.projectScene(D,w,this.sortElements);y=S=C=0;if(J=D.lights.length>0){p=D.lights;F.setRGB(0,0,0);R.setRGB(0,0,0);B.setRGB(0,0,0);M=0;for(P=p.length;M<P;M++){x=p[M];u=x.color;if(x instanceof THREE.AmbientLight){F.r+=u.r;F.g+=u.g;F.b+=u.b}else if(x instanceof THREE.DirectionalLight){R.r+=u.r;R.g+=u.g;R.b+=u.b}else if(x instanceof THREE.PointLight){B.r+=u.r;B.g+=u.g;B.b+=u.b}}}M=0;for(P=f.length;M<P;M++){p=f[M];l.empty();if(p instanceof THREE.RenderableParticle){m=p;m.x*=o;m.y*=-n;x=0;
+for(u=p.materials.length;x<u;x++)if(E=p.materials[x]){I=m;O=p;var Q=S++;if(N[Q]==null){N[Q]=document.createElementNS("http://www.w3.org/2000/svg","circle");K==0&&N[Q].setAttribute("shape-rendering","crispEdges")}t=N[Q];t.setAttribute("cx",I.x);t.setAttribute("cy",I.y);t.setAttribute("r",O.scale.x*o);if(E instanceof THREE.ParticleCircleMaterial){if(J){A.r=F.r+R.r+B.r;A.g=F.g+R.g+B.g;A.b=F.b+R.b+B.b;r.r=E.color.r*A.r;r.g=E.color.g*A.g;r.b=E.color.b*A.b;r.updateStyleString()}else r=E.color;t.setAttribute("style",
+"fill: "+r.__styleString)}i.appendChild(t)}}else if(p instanceof THREE.RenderableLine){m=p.v1;k=p.v2;m.positionScreen.x*=o;m.positionScreen.y*=-n;k.positionScreen.x*=o;k.positionScreen.y*=-n;l.addPoint(m.positionScreen.x,m.positionScreen.y);l.addPoint(k.positionScreen.x,k.positionScreen.y);if(v.instersects(l)){x=0;for(u=p.materials.length;x<u;)if(E=p.materials[x++]){I=m;O=k;Q=y++;if(H[Q]==null){H[Q]=document.createElementNS("http://www.w3.org/2000/svg","line");K==0&&H[Q].setAttribute("shape-rendering",
+"crispEdges")}t=H[Q];t.setAttribute("x1",I.positionScreen.x);t.setAttribute("y1",I.positionScreen.y);t.setAttribute("x2",O.positionScreen.x);t.setAttribute("y2",O.positionScreen.y);if(E instanceof THREE.LineBasicMaterial){r.__styleString=E.color.__styleString;t.setAttribute("style","fill: none; stroke: "+r.__styleString+"; stroke-width: "+E.linewidth+"; stroke-opacity: "+E.opacity+"; stroke-linecap: "+E.linecap+"; stroke-linejoin: "+E.linejoin);i.appendChild(t)}}}}else if(p instanceof THREE.RenderableFace3){m=
+p.v1;k=p.v2;q=p.v3;m.positionScreen.x*=o;m.positionScreen.y*=-n;k.positionScreen.x*=o;k.positionScreen.y*=-n;q.positionScreen.x*=o;q.positionScreen.y*=-n;l.addPoint(m.positionScreen.x,m.positionScreen.y);l.addPoint(k.positionScreen.x,k.positionScreen.y);l.addPoint(q.positionScreen.x,q.positionScreen.y);if(v.instersects(l)){x=0;for(u=p.meshMaterials.length;x<u;){E=p.meshMaterials[x++];if(E instanceof THREE.MeshFaceMaterial){I=0;for(O=p.faceMaterials.length;I<O;)(E=p.faceMaterials[I++])&&b(m,k,q,p,
+E,D)}else E&&b(m,k,q,p,E,D)}}}else if(p instanceof THREE.RenderableFace4){m=p.v1;k=p.v2;q=p.v3;s=p.v4;m.positionScreen.x*=o;m.positionScreen.y*=-n;k.positionScreen.x*=o;k.positionScreen.y*=-n;q.positionScreen.x*=o;q.positionScreen.y*=-n;s.positionScreen.x*=o;s.positionScreen.y*=-n;l.addPoint(m.positionScreen.x,m.positionScreen.y);l.addPoint(k.positionScreen.x,k.positionScreen.y);l.addPoint(q.positionScreen.x,q.positionScreen.y);l.addPoint(s.positionScreen.x,s.positionScreen.y);if(v.instersects(l)){x=
+0;for(u=p.meshMaterials.length;x<u;){E=p.meshMaterials[x++];if(E instanceof THREE.MeshFaceMaterial){I=0;for(O=p.faceMaterials.length;I<O;)(E=p.faceMaterials[I++])&&c(m,k,q,s,p,E,D)}else E&&c(m,k,q,s,p,E,D)}}}}}};
 THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(a,b,c){c&&a.update(undefined,!1,b);c=a.sounds;var d,e=c.length;for(d=0;d<e;d++){a=c[d];this.soundPosition.set(a.matrixWorld.n14,a.matrixWorld.n24,a.matrixWorld.n34);this.soundPosition.subSelf(b.position);if(a.isPlaying&&a.isLoaded){a.isAddedToDOM||a.addToDOM(this.domElement);a.calculateVolumeAndPan(this.soundPosition)}}}};
 THREE.RenderableObject=function(){this.z=this.object=null};THREE.RenderableFace3=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.v3=new THREE.Vertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[null,null,null]};
 THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.materials=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.materials=null};

+ 153 - 122
build/custom/ThreeWebGL.js

@@ -1,6 +1,6 @@
 // ThreeWebGL.js r36 - http://github.com/mrdoob/three.js
 var THREE=THREE||{};THREE.Color=function(a){this.setHex(a)};
-THREE.Color.prototype={autoUpdate:!0,setRGB:function(a,b,d){this.r=a;this.g=b;this.b=d;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,b,d){var e,g,l,m,s,o;if(d==0)e=g=l=0;else{m=Math.floor(a*6);s=a*6-m;a=d*(1-b);o=d*(1-b*s);b=d*(1-b*(1-s));switch(m){case 1:e=o;g=d;l=a;break;case 2:e=a;g=d;l=b;break;case 3:e=a;g=o;l=d;break;case 4:e=b;g=a;l=d;break;case 5:e=d;g=a;l=o;break;case 6:case 0:e=d;g=b;l=a}}this.r=e;this.g=g;this.b=l;if(this.autoUpdate){this.updateHex();
+THREE.Color.prototype={autoUpdate:!0,setRGB:function(a,b,d){this.r=a;this.g=b;this.b=d;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,b,d){var e,f,h,j,o,m;if(d==0)e=f=h=0;else{j=Math.floor(a*6);o=a*6-j;a=d*(1-b);m=d*(1-b*o);b=d*(1-b*(1-o));switch(j){case 1:e=m;f=d;h=a;break;case 2:e=a;f=d;h=b;break;case 3:e=a;f=m;h=d;break;case 4:e=b;f=a;h=d;break;case 5:e=d;f=a;h=m;break;case 6:case 0:e=d;f=b;h=a}}this.r=e;this.g=f;this.b=h;if(this.autoUpdate){this.updateHex();
 this.updateStyleString()}},setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGB();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+","+~~(this.g*255)+","+~~(this.b*255)+")"},clone:function(){return new THREE.Color(this.hex)}};
 THREE.Vector2=function(a,b){this.set(a||0,b||0)};
 THREE.Vector2.prototype={set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.set(a.x,a.y);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a);return this},negate:function(){this.set(-this.x,-this.y);return this},unit:function(){this.multiplyScalar(1/
@@ -12,57 +12,74 @@ this.length();a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setPosit
 1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,b,d,e){this.set(a||0,b||0,d||0,e||1)};
 THREE.Vector4.prototype={set:function(a,b,d,e){this.x=a;this.y=b;this.z=d;this.w=e;return this},copy:function(a){this.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z,a.w+b.w);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z,this.w+a.w);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z,a.w-b.w);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z,this.w-a.w);return this},multiplyScalar:function(a){this.set(this.x*
 a,this.y*a,this.z*a,this.w*a);return this},divideScalar:function(a){this.set(this.x/a,this.y/a,this.z/a,this.w/a);return this},lerpSelf:function(a,b){this.set(this.x+(a.x-this.x)*b,this.y+(a.y-this.y)*b,this.z+(a.z-this.z)*b,this.w+(a.w-this.w)*b)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
-THREE.Ray.prototype={intersectScene:function(a){var b,d,e=a.objects,g=[];a=0;for(b=e.length;a<b;a++){d=e[a];d instanceof THREE.Mesh&&(g=g.concat(this.intersectObject(d)))}g.sort(function(l,m){return l.distance-m.distance});return g},intersectObject:function(a){function b(L,M,W,$){$=$.clone().subSelf(M);W=W.clone().subSelf(M);var ia=L.clone().subSelf(M);L=$.dot($);M=$.dot(W);$=$.dot(ia);var ea=W.dot(W);W=W.dot(ia);ia=1/(L*ea-M*M);ea=(ea*$-M*W)*ia;L=(L*W-M*$)*ia;return ea>0&&L>0&&ea+L<1}var d,e,g,l,
-m,s,o,v,B,z,D,E=a.geometry,H=E.vertices,I=[];d=0;for(e=E.faces.length;d<e;d++){g=E.faces[d];z=this.origin.clone();D=this.direction.clone();o=a.matrixWorld;l=o.multiplyVector3(H[g.a].position.clone());m=o.multiplyVector3(H[g.b].position.clone());s=o.multiplyVector3(H[g.c].position.clone());o=g instanceof THREE.Face4?o.multiplyVector3(H[g.d].position.clone()):null;v=a.matrixRotationWorld.multiplyVector3(g.normal.clone());B=D.dot(v);if(B<0){v=v.dot((new THREE.Vector3).sub(l,z))/B;z=z.addSelf(D.multiplyScalar(v));
-if(g instanceof THREE.Face3){if(b(z,l,m,s)){g={distance:this.origin.distanceTo(z),point:z,face:g,object:a};I.push(g)}}else if(g instanceof THREE.Face4&&(b(z,l,m,o)||b(z,m,s,o))){g={distance:this.origin.distanceTo(z),point:z,face:g,object:a};I.push(g)}}}return I}};
-THREE.Rectangle=function(){function a(){l=e-b;m=g-d}var b,d,e,g,l,m,s=!0;this.getX=function(){return b};this.getY=function(){return d};this.getWidth=function(){return l};this.getHeight=function(){return m};this.getLeft=function(){return b};this.getTop=function(){return d};this.getRight=function(){return e};this.getBottom=function(){return g};this.set=function(o,v,B,z){s=!1;b=o;d=v;e=B;g=z;a()};this.addPoint=function(o,v){if(s){s=!1;b=o;d=v;e=o;g=v}else{b=b<o?b:o;d=d<v?d:v;e=e>o?e:o;g=g>v?g:v}a()};
-this.add3Points=function(o,v,B,z,D,E){if(s){s=!1;b=o<B?o<D?o:D:B<D?B:D;d=v<z?v<E?v:E:z<E?z:E;e=o>B?o>D?o:D:B>D?B:D;g=v>z?v>E?v:E:z>E?z:E}else{b=o<B?o<D?o<b?o:b:D<b?D:b:B<D?B<b?B:b:D<b?D:b;d=v<z?v<E?v<d?v:d:E<d?E:d:z<E?z<d?z:d:E<d?E:d;e=o>B?o>D?o>e?o:e:D>e?D:e:B>D?B>e?B:e:D>e?D:e;g=v>z?v>E?v>g?v:g:E>g?E:g:z>E?z>g?z:g:E>g?E:g}a()};this.addRectangle=function(o){if(s){s=!1;b=o.getLeft();d=o.getTop();e=o.getRight();g=o.getBottom()}else{b=b<o.getLeft()?b:o.getLeft();d=d<o.getTop()?d:o.getTop();e=e>o.getRight()?
-e:o.getRight();g=g>o.getBottom()?g:o.getBottom()}a()};this.inflate=function(o){b-=o;d-=o;e+=o;g+=o;a()};this.minSelf=function(o){b=b>o.getLeft()?b:o.getLeft();d=d>o.getTop()?d:o.getTop();e=e<o.getRight()?e:o.getRight();g=g<o.getBottom()?g:o.getBottom();a()};this.instersects=function(o){return Math.min(e,o.getRight())-Math.max(b,o.getLeft())>=0&&Math.min(g,o.getBottom())-Math.max(d,o.getTop())>=0};this.empty=function(){s=!0;g=e=d=b=0;a()};this.isEmpty=function(){return s}};
+THREE.Ray.prototype={intersectScene:function(a){var b,d,e=a.objects,f=[];a=0;for(b=e.length;a<b;a++){d=e[a];d instanceof THREE.Mesh&&(f=f.concat(this.intersectObject(d)))}f.sort(function(h,j){return h.distance-j.distance});return f},intersectObject:function(a){function b(H,w,ga,U){U=U.clone().subSelf(w);ga=ga.clone().subSelf(w);var ha=H.clone().subSelf(w);H=U.dot(U);w=U.dot(ga);U=U.dot(ha);var fa=ga.dot(ga);ga=ga.dot(ha);ha=1/(H*fa-w*w);fa=(fa*U-w*ga)*ha;H=(H*ga-w*U)*ha;return fa>0&&H>0&&fa+H<1}var d,
+e,f,h,j,o,m,u,y,z,A,x=a.geometry,K=x.vertices,J=[];d=0;for(e=x.faces.length;d<e;d++){f=x.faces[d];z=this.origin.clone();A=this.direction.clone();m=a.matrixWorld;h=m.multiplyVector3(K[f.a].position.clone());j=m.multiplyVector3(K[f.b].position.clone());o=m.multiplyVector3(K[f.c].position.clone());m=f instanceof THREE.Face4?m.multiplyVector3(K[f.d].position.clone()):null;u=a.matrixRotationWorld.multiplyVector3(f.normal.clone());y=A.dot(u);if(y<0){u=u.dot((new THREE.Vector3).sub(h,z))/y;z=z.addSelf(A.multiplyScalar(u));
+if(f instanceof THREE.Face3){if(b(z,h,j,o)){f={distance:this.origin.distanceTo(z),point:z,face:f,object:a};J.push(f)}}else if(f instanceof THREE.Face4&&(b(z,h,j,m)||b(z,j,o,m))){f={distance:this.origin.distanceTo(z),point:z,face:f,object:a};J.push(f)}}}return J}};
+THREE.Rectangle=function(){function a(){h=e-b;j=f-d}var b,d,e,f,h,j,o=!0;this.getX=function(){return b};this.getY=function(){return d};this.getWidth=function(){return h};this.getHeight=function(){return j};this.getLeft=function(){return b};this.getTop=function(){return d};this.getRight=function(){return e};this.getBottom=function(){return f};this.set=function(m,u,y,z){o=!1;b=m;d=u;e=y;f=z;a()};this.addPoint=function(m,u){if(o){o=!1;b=m;d=u;e=m;f=u}else{b=b<m?b:m;d=d<u?d:u;e=e>m?e:m;f=f>u?f:u}a()};
+this.add3Points=function(m,u,y,z,A,x){if(o){o=!1;b=m<y?m<A?m:A:y<A?y:A;d=u<z?u<x?u:x:z<x?z:x;e=m>y?m>A?m:A:y>A?y:A;f=u>z?u>x?u:x:z>x?z:x}else{b=m<y?m<A?m<b?m:b:A<b?A:b:y<A?y<b?y:b:A<b?A:b;d=u<z?u<x?u<d?u:d:x<d?x:d:z<x?z<d?z:d:x<d?x:d;e=m>y?m>A?m>e?m:e:A>e?A:e:y>A?y>e?y:e:A>e?A:e;f=u>z?u>x?u>f?u:f:x>f?x:f:z>x?z>f?z:f:x>f?x:f}a()};this.addRectangle=function(m){if(o){o=!1;b=m.getLeft();d=m.getTop();e=m.getRight();f=m.getBottom()}else{b=b<m.getLeft()?b:m.getLeft();d=d<m.getTop()?d:m.getTop();e=e>m.getRight()?
+e:m.getRight();f=f>m.getBottom()?f:m.getBottom()}a()};this.inflate=function(m){b-=m;d-=m;e+=m;f+=m;a()};this.minSelf=function(m){b=b>m.getLeft()?b:m.getLeft();d=d>m.getTop()?d:m.getTop();e=e<m.getRight()?e:m.getRight();f=f<m.getBottom()?f:m.getBottom();a()};this.instersects=function(m){return Math.min(e,m.getRight())-Math.max(b,m.getLeft())>=0&&Math.min(f,m.getBottom())-Math.max(d,m.getTop())>=0};this.empty=function(){o=!0;f=e=d=b=0;a()};this.isEmpty=function(){return o}};
 THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};
-THREE.Matrix4=function(a,b,d,e,g,l,m,s,o,v,B,z,D,E,H,I){this.set(a||1,b||0,d||0,e||0,g||0,l||1,m||0,s||0,o||0,v||0,B||1,z||0,D||0,E||0,H||0,I||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={set:function(a,b,d,e,g,l,m,s,o,v,B,z,D,E,H,I){this.n11=a;this.n12=b;this.n13=d;this.n14=e;this.n21=g;this.n22=l;this.n23=m;this.n24=s;this.n31=o;this.n32=v;this.n33=B;this.n34=z;this.n41=D;this.n42=E;this.n43=H;this.n44=I;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,b,d){var e=THREE.Matrix4.__v1,
-g=THREE.Matrix4.__v2,l=THREE.Matrix4.__v3;l.sub(a,b).normalize();if(l.length()===0)l.z=1;e.cross(d,l).normalize();if(e.length()===0){l.x+=1.0E-4;e.cross(d,l).normalize()}g.cross(l,e).normalize();this.n11=e.x;this.n12=g.x;this.n13=l.x;this.n21=e.y;this.n22=g.y;this.n23=l.y;this.n31=e.z;this.n32=g.z;this.n33=l.z;return this},multiplyVector3:function(a){var b=a.x,d=a.y,e=a.z,g=1/(this.n41*b+this.n42*d+this.n43*e+this.n44);a.x=(this.n11*b+this.n12*d+this.n13*e+this.n14)*g;a.y=(this.n21*b+this.n22*d+this.n23*
-e+this.n24)*g;a.z=(this.n31*b+this.n32*d+this.n33*e+this.n34)*g;return a},multiplyVector4:function(a){var b=a.x,d=a.y,e=a.z,g=a.w;a.x=this.n11*b+this.n12*d+this.n13*e+this.n14*g;a.y=this.n21*b+this.n22*d+this.n23*e+this.n24*g;a.z=this.n31*b+this.n32*d+this.n33*e+this.n34*g;a.w=this.n41*b+this.n42*d+this.n43*e+this.n44*g;return a},rotateAxis:function(a){var b=a.x,d=a.y,e=a.z;a.x=b*this.n11+d*this.n12+e*this.n13;a.y=b*this.n21+d*this.n22+e*this.n23;a.z=b*this.n31+d*this.n32+e*this.n33;a.normalize();
-return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var d=a.n11,e=a.n12,g=a.n13,l=a.n14,m=a.n21,s=a.n22,o=a.n23,v=a.n24,B=a.n31,z=a.n32,D=a.n33,E=a.n34,H=a.n41,I=a.n42,L=a.n43,M=a.n44,W=b.n11,$=b.n12,ia=b.n13,ea=b.n14,aa=b.n21,ja=b.n22,
-c=b.n23,ra=b.n24,pa=b.n31,ya=b.n32,sa=b.n33,ta=b.n34;this.n11=d*W+e*aa+g*pa;this.n12=d*$+e*ja+g*ya;this.n13=d*ia+e*c+g*sa;this.n14=d*ea+e*ra+g*ta+l;this.n21=m*W+s*aa+o*pa;this.n22=m*$+s*ja+o*ya;this.n23=m*ia+s*c+o*sa;this.n24=m*ea+s*ra+o*ta+v;this.n31=B*W+z*aa+D*pa;this.n32=B*$+z*ja+D*ya;this.n33=B*ia+z*c+D*sa;this.n34=B*ea+z*ra+D*ta+E;this.n41=H*W+I*aa+L*pa;this.n42=H*$+I*ja+L*ya;this.n43=H*ia+I*c+L*sa;this.n44=H*ea+I*ra+L*ta+M;return this},multiplyToArray:function(a,b,d){this.multiply(a,b);d[0]=
-this.n11;d[1]=this.n21;d[2]=this.n31;d[3]=this.n41;d[4]=this.n12;d[5]=this.n22;d[6]=this.n32;d[7]=this.n42;d[8]=this.n13;d[9]=this.n23;d[10]=this.n33;d[11]=this.n43;d[12]=this.n14;d[13]=this.n24;d[14]=this.n34;d[15]=this.n44;return this},multiplySelf:function(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=
-a;this.n44*=a;return this},determinant:function(){var a=this.n11,b=this.n12,d=this.n13,e=this.n14,g=this.n21,l=this.n22,m=this.n23,s=this.n24,o=this.n31,v=this.n32,B=this.n33,z=this.n34,D=this.n41,E=this.n42,H=this.n43,I=this.n44;return e*m*v*D-d*s*v*D-e*l*B*D+b*s*B*D+d*l*z*D-b*m*z*D-e*m*o*E+d*s*o*E+e*g*B*E-a*s*B*E-d*g*z*E+a*m*z*E+e*l*o*H-b*s*o*H-e*g*v*H+a*s*v*H+b*g*z*H-a*l*z*H-d*l*o*I+b*m*o*I+d*g*v*I-a*m*v*I-b*g*B*I+a*l*B*I},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;
-this.n31=this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=
+THREE.Matrix4=function(a,b,d,e,f,h,j,o,m,u,y,z,A,x,K,J){this.set(a||1,b||0,d||0,e||0,f||0,h||1,j||0,o||0,m||0,u||0,y||1,z||0,A||0,x||0,K||0,J||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={set:function(a,b,d,e,f,h,j,o,m,u,y,z,A,x,K,J){this.n11=a;this.n12=b;this.n13=d;this.n14=e;this.n21=f;this.n22=h;this.n23=j;this.n24=o;this.n31=m;this.n32=u;this.n33=y;this.n34=z;this.n41=A;this.n42=x;this.n43=K;this.n44=J;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,b,d){var e=THREE.Matrix4.__v1,
+f=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;h.sub(a,b).normalize();if(h.length()===0)h.z=1;e.cross(d,h).normalize();if(e.length()===0){h.x+=1.0E-4;e.cross(d,h).normalize()}f.cross(h,e).normalize();this.n11=e.x;this.n12=f.x;this.n13=h.x;this.n21=e.y;this.n22=f.y;this.n23=h.y;this.n31=e.z;this.n32=f.z;this.n33=h.z;return this},multiplyVector3:function(a){var b=a.x,d=a.y,e=a.z,f=1/(this.n41*b+this.n42*d+this.n43*e+this.n44);a.x=(this.n11*b+this.n12*d+this.n13*e+this.n14)*f;a.y=(this.n21*b+this.n22*d+this.n23*
+e+this.n24)*f;a.z=(this.n31*b+this.n32*d+this.n33*e+this.n34)*f;return a},multiplyVector4:function(a){var b=a.x,d=a.y,e=a.z,f=a.w;a.x=this.n11*b+this.n12*d+this.n13*e+this.n14*f;a.y=this.n21*b+this.n22*d+this.n23*e+this.n24*f;a.z=this.n31*b+this.n32*d+this.n33*e+this.n34*f;a.w=this.n41*b+this.n42*d+this.n43*e+this.n44*f;return a},rotateAxis:function(a){var b=a.x,d=a.y,e=a.z;a.x=b*this.n11+d*this.n12+e*this.n13;a.y=b*this.n21+d*this.n22+e*this.n23;a.z=b*this.n31+d*this.n32+e*this.n33;a.normalize();
+return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var d=a.n11,e=a.n12,f=a.n13,h=a.n14,j=a.n21,o=a.n22,m=a.n23,u=a.n24,y=a.n31,z=a.n32,A=a.n33,x=a.n34,K=a.n41,J=a.n42,H=a.n43,w=a.n44,ga=b.n11,U=b.n12,ha=b.n13,fa=b.n14,ia=b.n21,M=b.n22,
+c=b.n23,ja=b.n24,W=b.n31,la=b.n32,Z=b.n33,R=b.n34;this.n11=d*ga+e*ia+f*W;this.n12=d*U+e*M+f*la;this.n13=d*ha+e*c+f*Z;this.n14=d*fa+e*ja+f*R+h;this.n21=j*ga+o*ia+m*W;this.n22=j*U+o*M+m*la;this.n23=j*ha+o*c+m*Z;this.n24=j*fa+o*ja+m*R+u;this.n31=y*ga+z*ia+A*W;this.n32=y*U+z*M+A*la;this.n33=y*ha+z*c+A*Z;this.n34=y*fa+z*ja+A*R+x;this.n41=K*ga+J*ia+H*W;this.n42=K*U+J*M+H*la;this.n43=K*ha+J*c+H*Z;this.n44=K*fa+J*ja+H*R+w;return this},multiplyToArray:function(a,b,d){this.multiply(a,b);d[0]=this.n11;d[1]=
+this.n21;d[2]=this.n31;d[3]=this.n41;d[4]=this.n12;d[5]=this.n22;d[6]=this.n32;d[7]=this.n42;d[8]=this.n13;d[9]=this.n23;d[10]=this.n33;d[11]=this.n43;d[12]=this.n14;d[13]=this.n24;d[14]=this.n34;d[15]=this.n44;return this},multiplySelf:function(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=
+a;return this},determinant:function(){var a=this.n11,b=this.n12,d=this.n13,e=this.n14,f=this.n21,h=this.n22,j=this.n23,o=this.n24,m=this.n31,u=this.n32,y=this.n33,z=this.n34,A=this.n41,x=this.n42,K=this.n43,J=this.n44;return e*j*u*A-d*o*u*A-e*h*y*A+b*o*y*A+d*h*z*A-b*j*z*A-e*j*m*x+d*o*m*x+e*f*y*x-a*o*y*x-d*f*z*x+a*j*z*x+e*h*m*K-b*o*m*K-e*f*u*K+a*o*u*K+b*f*z*K-a*h*z*K-d*h*m*J+b*j*m*J+d*f*u*J-a*j*u*J-b*f*y*J+a*h*y*J},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=
+this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=
 this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;
 a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,d){this.set(1,0,0,a,0,1,0,b,0,0,1,d,0,0,
-0,1);return this},setScale:function(a,b,d){this.set(a,0,0,0,0,b,0,0,0,0,d,0,0,0,0,1);return this},setRotationX:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotationY:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotationZ:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,b){var d=Math.cos(b),e=Math.sin(b),g=
-1-d,l=a.x,m=a.y,s=a.z,o=g*l,v=g*m;this.set(o*l+d,o*m-e*s,o*s+e*m,0,o*m+e*s,v*m+d,v*s-e*l,0,o*s-e*m,v*s+e*l,g*s*s+d,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var b=a.x,d=a.y,e=a.z;a=Math.cos(b);b=Math.sin(b);var g=Math.cos(d);d=Math.sin(d);var l=Math.cos(e);e=Math.sin(e);var m=a*d,s=b*d;this.n11=g*l;this.n12=-g*e;this.n13=d;this.n21=s*l+a*e;this.n22=-s*e+a*l;this.n23=-b*g;this.n31=-m*l+b*e;this.n32=m*e+b*l;this.n33=
-a*g;return this},setRotationFromQuaternion:function(a){var b=a.x,d=a.y,e=a.z,g=a.w,l=b+b,m=d+d,s=e+e;a=b*l;var o=b*m;b*=s;var v=d*m;d*=s;e*=s;l*=g;m*=g;g*=s;this.n11=1-(v+e);this.n12=o-g;this.n13=b+m;this.n21=o+g;this.n22=1-(a+e);this.n23=d-l;this.n31=b-m;this.n32=d+l;this.n33=1-(a+v);return this},scale:function(a){var b=a.x,d=a.y;a=a.z;this.n11*=b;this.n12*=d;this.n13*=a;this.n21*=b;this.n22*=d;this.n23*=a;this.n31*=b;this.n32*=d;this.n33*=a;this.n41*=b;this.n42*=d;this.n43*=a;return this},extractPosition:function(a){this.n14=
-a.n14;this.n24=a.n24;this.n34=a.n34},extractRotation:function(a,b){var d=1/b.x,e=1/b.y,g=1/b.z;this.n11=a.n11*d;this.n21=a.n21*d;this.n31=a.n31*d;this.n12=a.n12*e;this.n22=a.n22*e;this.n32=a.n32*e;this.n13=a.n13*g;this.n23=a.n23*g;this.n33=a.n33*g}};
-THREE.Matrix4.makeInvert=function(a,b){var d=a.n11,e=a.n12,g=a.n13,l=a.n14,m=a.n21,s=a.n22,o=a.n23,v=a.n24,B=a.n31,z=a.n32,D=a.n33,E=a.n34,H=a.n41,I=a.n42,L=a.n43,M=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=o*E*I-v*D*I+v*z*L-s*E*L-o*z*M+s*D*M;b.n12=l*D*I-g*E*I-l*z*L+e*E*L+g*z*M-e*D*M;b.n13=g*v*I-l*o*I+l*s*L-e*v*L-g*s*M+e*o*M;b.n14=l*o*z-g*v*z-l*s*D+e*v*D+g*s*E-e*o*E;b.n21=v*D*H-o*E*H-v*B*L+m*E*L+o*B*M-m*D*M;b.n22=g*E*H-l*D*H+l*B*L-d*E*L-g*B*M+d*D*M;b.n23=l*o*H-g*v*H-l*m*L+d*v*L+g*m*M-d*o*M;
-b.n24=g*v*B-l*o*B+l*m*D-d*v*D-g*m*E+d*o*E;b.n31=s*E*H-v*z*H+v*B*I-m*E*I-s*B*M+m*z*M;b.n32=l*z*H-e*E*H-l*B*I+d*E*I+e*B*M-d*z*M;b.n33=g*v*H-l*s*H+l*m*I-d*v*I-e*m*M+d*s*M;b.n34=l*s*B-e*v*B-l*m*z+d*v*z+e*m*E-d*s*E;b.n41=o*z*H-s*D*H-o*B*I+m*D*I+s*B*L-m*z*L;b.n42=e*D*H-g*z*H+g*B*I-d*D*I-e*B*L+d*z*L;b.n43=g*s*H-e*o*H-g*m*I+d*o*I+e*m*L-d*s*L;b.n44=e*o*B-g*s*B+g*m*z-d*o*z-e*m*D+d*s*D;b.multiplyScalar(1/a.determinant());return b};
-THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,d=b.m,e=a.n33*a.n22-a.n32*a.n23,g=-a.n33*a.n21+a.n31*a.n23,l=a.n32*a.n21-a.n31*a.n22,m=-a.n33*a.n12+a.n32*a.n13,s=a.n33*a.n11-a.n31*a.n13,o=-a.n32*a.n11+a.n31*a.n12,v=a.n23*a.n12-a.n22*a.n13,B=-a.n23*a.n11+a.n21*a.n13,z=a.n22*a.n11-a.n21*a.n12;a=a.n11*e+a.n21*m+a.n31*v;if(a==0)throw"matrix not invertible";a=1/a;d[0]=a*e;d[1]=a*g;d[2]=a*l;d[3]=a*m;d[4]=a*s;d[5]=a*o;d[6]=a*v;d[7]=a*B;d[8]=a*z;return b};
-THREE.Matrix4.makeFrustum=function(a,b,d,e,g,l){var m;m=new THREE.Matrix4;m.n11=2*g/(b-a);m.n12=0;m.n13=(b+a)/(b-a);m.n14=0;m.n21=0;m.n22=2*g/(e-d);m.n23=(e+d)/(e-d);m.n24=0;m.n31=0;m.n32=0;m.n33=-(l+g)/(l-g);m.n34=-2*l*g/(l-g);m.n41=0;m.n42=0;m.n43=-1;m.n44=0;return m};THREE.Matrix4.makePerspective=function(a,b,d,e){var g;a=d*Math.tan(a*Math.PI/360);g=-a;return THREE.Matrix4.makeFrustum(g*b,a*b,g,a,d,e)};
-THREE.Matrix4.makeOrtho=function(a,b,d,e,g,l){var m,s,o,v;m=new THREE.Matrix4;s=b-a;o=d-e;v=l-g;m.n11=2/s;m.n12=0;m.n13=0;m.n14=-((b+a)/s);m.n21=0;m.n22=2/o;m.n23=0;m.n24=-((d+e)/o);m.n31=0;m.n32=0;m.n33=-2/v;m.n34=-((l+g)/v);m.n41=0;m.n42=0;m.n43=0;m.n44=1;return m};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
+0,1);return this},setScale:function(a,b,d){this.set(a,0,0,0,0,b,0,0,0,0,d,0,0,0,0,1);return this},setRotationX:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotationY:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotationZ:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,b){var d=Math.cos(b),e=Math.sin(b),f=
+1-d,h=a.x,j=a.y,o=a.z,m=f*h,u=f*j;this.set(m*h+d,m*j-e*o,m*o+e*j,0,m*j+e*o,u*j+d,u*o-e*h,0,m*o-e*j,u*o+e*h,f*o*o+d,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var b=a.x,d=a.y,e=a.z;a=Math.cos(b);b=Math.sin(b);var f=Math.cos(d);d=Math.sin(d);var h=Math.cos(e);e=Math.sin(e);var j=a*d,o=b*d;this.n11=f*h;this.n12=-f*e;this.n13=d;this.n21=o*h+a*e;this.n22=-o*e+a*h;this.n23=-b*f;this.n31=-j*h+b*e;this.n32=j*e+b*h;this.n33=
+a*f;return this},setRotationFromQuaternion:function(a){var b=a.x,d=a.y,e=a.z,f=a.w,h=b+b,j=d+d,o=e+e;a=b*h;var m=b*j;b*=o;var u=d*j;d*=o;e*=o;h*=f;j*=f;f*=o;this.n11=1-(u+e);this.n12=m-f;this.n13=b+j;this.n21=m+f;this.n22=1-(a+e);this.n23=d-h;this.n31=b-j;this.n32=d+h;this.n33=1-(a+u);return this},scale:function(a){var b=a.x,d=a.y;a=a.z;this.n11*=b;this.n12*=d;this.n13*=a;this.n21*=b;this.n22*=d;this.n23*=a;this.n31*=b;this.n32*=d;this.n33*=a;this.n41*=b;this.n42*=d;this.n43*=a;return this},extractPosition:function(a){this.n14=
+a.n14;this.n24=a.n24;this.n34=a.n34},extractRotation:function(a,b){var d=1/b.x,e=1/b.y,f=1/b.z;this.n11=a.n11*d;this.n21=a.n21*d;this.n31=a.n31*d;this.n12=a.n12*e;this.n22=a.n22*e;this.n32=a.n32*e;this.n13=a.n13*f;this.n23=a.n23*f;this.n33=a.n33*f}};
+THREE.Matrix4.makeInvert=function(a,b){var d=a.n11,e=a.n12,f=a.n13,h=a.n14,j=a.n21,o=a.n22,m=a.n23,u=a.n24,y=a.n31,z=a.n32,A=a.n33,x=a.n34,K=a.n41,J=a.n42,H=a.n43,w=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=m*x*J-u*A*J+u*z*H-o*x*H-m*z*w+o*A*w;b.n12=h*A*J-f*x*J-h*z*H+e*x*H+f*z*w-e*A*w;b.n13=f*u*J-h*m*J+h*o*H-e*u*H-f*o*w+e*m*w;b.n14=h*m*z-f*u*z-h*o*A+e*u*A+f*o*x-e*m*x;b.n21=u*A*K-m*x*K-u*y*H+j*x*H+m*y*w-j*A*w;b.n22=f*x*K-h*A*K+h*y*H-d*x*H-f*y*w+d*A*w;b.n23=h*m*K-f*u*K-h*j*H+d*u*H+f*j*w-d*m*w;
+b.n24=f*u*y-h*m*y+h*j*A-d*u*A-f*j*x+d*m*x;b.n31=o*x*K-u*z*K+u*y*J-j*x*J-o*y*w+j*z*w;b.n32=h*z*K-e*x*K-h*y*J+d*x*J+e*y*w-d*z*w;b.n33=f*u*K-h*o*K+h*j*J-d*u*J-e*j*w+d*o*w;b.n34=h*o*y-e*u*y-h*j*z+d*u*z+e*j*x-d*o*x;b.n41=m*z*K-o*A*K-m*y*J+j*A*J+o*y*H-j*z*H;b.n42=e*A*K-f*z*K+f*y*J-d*A*J-e*y*H+d*z*H;b.n43=f*o*K-e*m*K-f*j*J+d*m*J+e*j*H-d*o*H;b.n44=e*m*y-f*o*y+f*j*z-d*m*z-e*j*A+d*o*A;b.multiplyScalar(1/a.determinant());return b};
+THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,d=b.m,e=a.n33*a.n22-a.n32*a.n23,f=-a.n33*a.n21+a.n31*a.n23,h=a.n32*a.n21-a.n31*a.n22,j=-a.n33*a.n12+a.n32*a.n13,o=a.n33*a.n11-a.n31*a.n13,m=-a.n32*a.n11+a.n31*a.n12,u=a.n23*a.n12-a.n22*a.n13,y=-a.n23*a.n11+a.n21*a.n13,z=a.n22*a.n11-a.n21*a.n12;a=a.n11*e+a.n21*j+a.n31*u;if(a==0)throw"matrix not invertible";a=1/a;d[0]=a*e;d[1]=a*f;d[2]=a*h;d[3]=a*j;d[4]=a*o;d[5]=a*m;d[6]=a*u;d[7]=a*y;d[8]=a*z;return b};
+THREE.Matrix4.makeFrustum=function(a,b,d,e,f,h){var j;j=new THREE.Matrix4;j.n11=2*f/(b-a);j.n12=0;j.n13=(b+a)/(b-a);j.n14=0;j.n21=0;j.n22=2*f/(e-d);j.n23=(e+d)/(e-d);j.n24=0;j.n31=0;j.n32=0;j.n33=-(h+f)/(h-f);j.n34=-2*h*f/(h-f);j.n41=0;j.n42=0;j.n43=-1;j.n44=0;return j};THREE.Matrix4.makePerspective=function(a,b,d,e){var f;a=d*Math.tan(a*Math.PI/360);f=-a;return THREE.Matrix4.makeFrustum(f*b,a*b,f,a,d,e)};
+THREE.Matrix4.makeOrtho=function(a,b,d,e,f,h){var j,o,m,u;j=new THREE.Matrix4;o=b-a;m=d-e;u=h-f;j.n11=2/o;j.n12=0;j.n13=0;j.n14=-((b+a)/o);j.n21=0;j.n22=2/m;j.n23=0;j.n24=-((d+e)/m);j.n31=0;j.n32=0;j.n33=-2/u;j.n34=-((h+f)/u);j.n41=0;j.n42=0;j.n43=0;j.n44=1;return j};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
 THREE.Object3D=function(){this.parent=undefined;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixAutoUpdate=!0;this.matrixWorldNeedsUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=
 !0;this._vector=new THREE.Vector3};
 THREE.Object3D.prototype={translate:function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(a){if(this.children.indexOf(a)===-1){a.parent!==
 undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);for(var b=this;b instanceof THREE.Scene===!1&&b!==undefined;)b=b.parent;b!==undefined&&b.addChildRecurse(a)}},removeChild:function(a){var b=this.children.indexOf(a);if(b!==-1){a.parent=undefined;this.children.splice(b,1)}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation);if(this.scale.x!==1||this.scale.y!==
 1||this.scale.z!==1){this.matrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}this.matrixWorldNeedsUpdate=!0},update:function(a,b,d){if(this.visible){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||b){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale);this.matrixWorldNeedsUpdate=!1;b=!0}a=0;for(var e=this.children.length;a<
 e;a++)this.children[a].update(this.matrixWorld,b,d)}}};THREE.Quaternion=function(a,b,d,e){this.set(a||0,b||0,d||0,e!==undefined?e:1)};
-THREE.Quaternion.prototype={set:function(a,b,d,e){this.x=a;this.y=b;this.z=d;this.w=e;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,d=a.x*b,e=a.y*b,g=a.z*b;a=Math.cos(e);e=Math.sin(e);b=Math.cos(-g);g=Math.sin(-g);var l=Math.cos(d);d=Math.sin(d);var m=a*b,s=e*g;this.w=m*l-s*d;this.x=m*d+s*l;this.y=e*b*l+a*g*d;this.z=a*g*l-e*b*d;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
--1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var b=this.x,d=this.y,e=this.z,g=this.w,l=a.x,m=a.y,s=a.z;a=a.w;this.x=b*a+g*l+d*s-e*m;this.y=d*a+g*m+e*l-b*s;this.z=e*a+g*s+b*m-d*l;this.w=g*a-b*l-d*m-e*s;return this},
-multiplyVector3:function(a,b){b||(b=a);var d=a.x,e=a.y,g=a.z,l=this.x,m=this.y,s=this.z,o=this.w,v=o*d+m*g-s*e,B=o*e+s*d-l*g,z=o*g+l*e-m*d;d=-l*d-m*e-s*g;b.x=v*o+d*-l+B*-s-z*-m;b.y=B*o+d*-m+z*-l-v*-s;b.z=z*o+d*-s+v*-m-B*-l;return b}};
-THREE.Quaternion.slerp=function(a,b,d,e){var g=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(g)>=1){d.w=a.w;d.x=a.x;d.y=a.y;d.z=a.z;return d}var l=Math.acos(g),m=Math.sqrt(1-g*g);if(Math.abs(m)<0.0010){d.w=0.5*(a.w+b.w);d.x=0.5*(a.x+b.x);d.y=0.5*(a.y+b.y);d.z=0.5*(a.z+b.z);return d}g=Math.sin((1-e)*l)/m;e=Math.sin(e*l)/m;d.w=a.w*g+b.w*e;d.x=a.x*g+b.x*e;d.y=a.y*g+b.y*e;d.z=a.z*g+b.z*e;return d};
+THREE.Quaternion.prototype={set:function(a,b,d,e){this.x=a;this.y=b;this.z=d;this.w=e;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,d=a.x*b,e=a.y*b,f=a.z*b;a=Math.cos(e);e=Math.sin(e);b=Math.cos(-f);f=Math.sin(-f);var h=Math.cos(d);d=Math.sin(d);var j=a*b,o=e*f;this.w=j*h-o*d;this.x=j*d+o*h;this.y=e*b*h+a*f*d;this.z=a*f*h-e*b*d;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
+-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var b=this.x,d=this.y,e=this.z,f=this.w,h=a.x,j=a.y,o=a.z;a=a.w;this.x=b*a+f*h+d*o-e*j;this.y=d*a+f*j+e*h-b*o;this.z=e*a+f*o+b*j-d*h;this.w=f*a-b*h-d*j-e*o;return this},
+multiplyVector3:function(a,b){b||(b=a);var d=a.x,e=a.y,f=a.z,h=this.x,j=this.y,o=this.z,m=this.w,u=m*d+j*f-o*e,y=m*e+o*d-h*f,z=m*f+h*e-j*d;d=-h*d-j*e-o*f;b.x=u*m+d*-h+y*-o-z*-j;b.y=y*m+d*-j+z*-h-u*-o;b.z=z*m+d*-o+u*-j-y*-h;return b}};
+THREE.Quaternion.slerp=function(a,b,d,e){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(f)>=1){d.w=a.w;d.x=a.x;d.y=a.y;d.z=a.z;return d}var h=Math.acos(f),j=Math.sqrt(1-f*f);if(Math.abs(j)<0.001){d.w=0.5*(a.w+b.w);d.x=0.5*(a.x+b.x);d.y=0.5*(a.y+b.y);d.z=0.5*(a.z+b.z);return d}f=Math.sin((1-e)*h)/j;e=Math.sin(e*h)/j;d.w=a.w*f+b.w*e;d.x=a.x*f+b.x*e;d.y=a.y*f+b.y*e;d.z=a.z*f+b.z*e;return d};
 THREE.Vertex=function(a,b){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=b||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=!0};
-THREE.Face3=function(a,b,d,e,g){this.a=a;this.b=b;this.c=d;this.centroid=new THREE.Vector3;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.materials=g instanceof Array?g:[g]};THREE.Face4=function(a,b,d,e,g,l){this.a=a;this.b=b;this.c=d;this.d=e;this.centroid=new THREE.Vector3;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.materials=l instanceof Array?l:[l]};
+THREE.Face3=function(a,b,d,e,f){this.a=a;this.b=b;this.c=d;this.centroid=new THREE.Vector3;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.materials=f instanceof Array?f:[f]};THREE.Face4=function(a,b,d,e,f,h){this.a=a;this.b=b;this.c=d;this.d=e;this.centroid=new THREE.Vector3;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.materials=h instanceof Array?h:[h]};
 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.faces=[];this.uvs=[];this.uvs2=[];this.colors=[];this.morphTargets=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
 THREE.Geometry.prototype={computeCentroids:function(){var a,b,d;a=0;for(b=this.faces.length;a<b;a++){d=this.faces[a];d.centroid.set(0,0,0);if(d instanceof THREE.Face3){d.centroid.addSelf(this.vertices[d.a].position);d.centroid.addSelf(this.vertices[d.b].position);d.centroid.addSelf(this.vertices[d.c].position);d.centroid.divideScalar(3)}else if(d instanceof THREE.Face4){d.centroid.addSelf(this.vertices[d.a].position);d.centroid.addSelf(this.vertices[d.b].position);d.centroid.addSelf(this.vertices[d.c].position);
-d.centroid.addSelf(this.vertices[d.d].position);d.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var b,d,e,g,l,m,s=new THREE.Vector3,o=new THREE.Vector3;e=0;for(g=this.vertices.length;e<g;e++){l=this.vertices[e];l.normal.set(0,0,0)}e=0;for(g=this.faces.length;e<g;e++){l=this.faces[e];if(a&&l.vertexNormals.length){s.set(0,0,0);b=0;for(d=l.vertexNormals.length;b<d;b++)s.addSelf(l.vertexNormals[b]);s.divideScalar(3)}else{b=this.vertices[l.a];d=this.vertices[l.b];m=this.vertices[l.c];s.sub(m.position,
-d.position);o.sub(b.position,d.position);s.crossSelf(o)}s.isZero()||s.normalize();l.normal.copy(s)}},computeVertexNormals:function(){var a,b,d,e;if(this.__tmpVertices==undefined){e=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)e[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++){d=this.faces[a];if(d instanceof THREE.Face3)d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(d instanceof THREE.Face4)d.vertexNormals=[new THREE.Vector3,
+d.centroid.addSelf(this.vertices[d.d].position);d.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var b,d,e,f,h,j,o=new THREE.Vector3,m=new THREE.Vector3;e=0;for(f=this.vertices.length;e<f;e++){h=this.vertices[e];h.normal.set(0,0,0)}e=0;for(f=this.faces.length;e<f;e++){h=this.faces[e];if(a&&h.vertexNormals.length){o.set(0,0,0);b=0;for(d=h.vertexNormals.length;b<d;b++)o.addSelf(h.vertexNormals[b]);o.divideScalar(3)}else{b=this.vertices[h.a];d=this.vertices[h.b];j=this.vertices[h.c];o.sub(j.position,
+d.position);m.sub(b.position,d.position);o.crossSelf(m)}o.isZero()||o.normalize();h.normal.copy(o)}},computeVertexNormals:function(){var a,b,d,e;if(this.__tmpVertices==undefined){e=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)e[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++){d=this.faces[a];if(d instanceof THREE.Face3)d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(d instanceof THREE.Face4)d.vertexNormals=[new THREE.Vector3,
 new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{e=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)e[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++){d=this.faces[a];if(d instanceof THREE.Face3){e[d.a].addSelf(d.normal);e[d.b].addSelf(d.normal);e[d.c].addSelf(d.normal)}else if(d instanceof THREE.Face4){e[d.a].addSelf(d.normal);e[d.b].addSelf(d.normal);e[d.c].addSelf(d.normal);e[d.d].addSelf(d.normal)}}a=0;for(b=this.vertices.length;a<b;a++)e[a].normalize();a=0;for(b=this.faces.length;a<
-b;a++){d=this.faces[a];if(d instanceof THREE.Face3){d.vertexNormals[0].copy(e[d.a]);d.vertexNormals[1].copy(e[d.b]);d.vertexNormals[2].copy(e[d.c])}else if(d instanceof THREE.Face4){d.vertexNormals[0].copy(e[d.a]);d.vertexNormals[1].copy(e[d.b]);d.vertexNormals[2].copy(e[d.c]);d.vertexNormals[3].copy(e[d.d])}}},computeTangents:function(){function a(ta,Ea,Fa,Aa,Ja,Ka,La){l=ta.vertices[Ea].position;m=ta.vertices[Fa].position;s=ta.vertices[Aa].position;o=g[Ja];v=g[Ka];B=g[La];z=m.x-l.x;D=s.x-l.x;E=m.y-
-l.y;H=s.y-l.y;I=m.z-l.z;L=s.z-l.z;M=v.u-o.u;W=B.u-o.u;$=v.v-o.v;ia=B.v-o.v;ea=1/(M*ia-W*$);c.set((ia*z-$*D)*ea,(ia*E-$*H)*ea,(ia*I-$*L)*ea);ra.set((M*D-W*z)*ea,(M*H-W*E)*ea,(M*L-W*I)*ea);aa[Ea].addSelf(c);aa[Fa].addSelf(c);aa[Aa].addSelf(c);ja[Ea].addSelf(ra);ja[Fa].addSelf(ra);ja[Aa].addSelf(ra)}var b,d,e,g,l,m,s,o,v,B,z,D,E,H,I,L,M,W,$,ia,ea,aa=[],ja=[],c=new THREE.Vector3,ra=new THREE.Vector3,pa=new THREE.Vector3,ya=new THREE.Vector3,sa=new THREE.Vector3;b=0;for(d=this.vertices.length;b<d;b++){aa[b]=
-new THREE.Vector3;ja[b]=new THREE.Vector3}b=0;for(d=this.faces.length;b<d;b++){e=this.faces[b];g=this.uvs[b];if(e instanceof THREE.Face3){a(this,e.a,e.b,e.c,0,1,2);this.vertices[e.a].normal.copy(e.vertexNormals[0]);this.vertices[e.b].normal.copy(e.vertexNormals[1]);this.vertices[e.c].normal.copy(e.vertexNormals[2])}else if(e instanceof THREE.Face4){a(this,e.a,e.b,e.c,0,1,2);a(this,e.a,e.b,e.d,0,1,3);this.vertices[e.a].normal.copy(e.vertexNormals[0]);this.vertices[e.b].normal.copy(e.vertexNormals[1]);
-this.vertices[e.c].normal.copy(e.vertexNormals[2]);this.vertices[e.d].normal.copy(e.vertexNormals[3])}}b=0;for(d=this.vertices.length;b<d;b++){sa.copy(this.vertices[b].normal);e=aa[b];pa.copy(e);pa.subSelf(sa.multiplyScalar(sa.dot(e))).normalize();ya.cross(this.vertices[b].normal,e);e=ya.dot(ja[b]);e=e<0?-1:1;this.vertices[b].tangent.set(pa.x,pa.y,pa.z,e)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],
-y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,d=this.vertices.length;b<d;b++){a=this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<
-this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,b=0,d=this.vertices.length;b<d;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}}};THREE.GeometryIdCounter=0;
-THREE.Camera=function(a,b,d,e,g){THREE.Object3D.call(this);this.fov=a||50;this.aspect=b||1;this.near=d||0.1;this.far=e||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;
+b;a++){d=this.faces[a];if(d instanceof THREE.Face3){d.vertexNormals[0].copy(e[d.a]);d.vertexNormals[1].copy(e[d.b]);d.vertexNormals[2].copy(e[d.c])}else if(d instanceof THREE.Face4){d.vertexNormals[0].copy(e[d.a]);d.vertexNormals[1].copy(e[d.b]);d.vertexNormals[2].copy(e[d.c]);d.vertexNormals[3].copy(e[d.d])}}},computeTangents:function(){function a(R,N,Ba,L,ka,wa,P){h=R.vertices[N].position;j=R.vertices[Ba].position;o=R.vertices[L].position;m=f[ka];u=f[wa];y=f[P];z=j.x-h.x;A=o.x-h.x;x=j.y-h.y;K=o.y-
+h.y;J=j.z-h.z;H=o.z-h.z;w=u.u-m.u;ga=y.u-m.u;U=u.v-m.v;ha=y.v-m.v;fa=1/(w*ha-ga*U);c.set((ha*z-U*A)*fa,(ha*x-U*K)*fa,(ha*J-U*H)*fa);ja.set((w*A-ga*z)*fa,(w*K-ga*x)*fa,(w*H-ga*J)*fa);ia[N].addSelf(c);ia[Ba].addSelf(c);ia[L].addSelf(c);M[N].addSelf(ja);M[Ba].addSelf(ja);M[L].addSelf(ja)}var b,d,e,f,h,j,o,m,u,y,z,A,x,K,J,H,w,ga,U,ha,fa,ia=[],M=[],c=new THREE.Vector3,ja=new THREE.Vector3,W=new THREE.Vector3,la=new THREE.Vector3,Z=new THREE.Vector3;b=0;for(d=this.vertices.length;b<d;b++){ia[b]=new THREE.Vector3;
+M[b]=new THREE.Vector3}b=0;for(d=this.faces.length;b<d;b++){e=this.faces[b];f=this.uvs[b];if(e instanceof THREE.Face3){a(this,e.a,e.b,e.c,0,1,2);this.vertices[e.a].normal.copy(e.vertexNormals[0]);this.vertices[e.b].normal.copy(e.vertexNormals[1]);this.vertices[e.c].normal.copy(e.vertexNormals[2])}else if(e instanceof THREE.Face4){a(this,e.a,e.b,e.c,0,1,2);a(this,e.a,e.b,e.d,0,1,3);this.vertices[e.a].normal.copy(e.vertexNormals[0]);this.vertices[e.b].normal.copy(e.vertexNormals[1]);this.vertices[e.c].normal.copy(e.vertexNormals[2]);
+this.vertices[e.d].normal.copy(e.vertexNormals[3])}}b=0;for(d=this.vertices.length;b<d;b++){Z.copy(this.vertices[b].normal);e=ia[b];W.copy(e);W.subSelf(Z.multiplyScalar(Z.dot(e))).normalize();la.cross(this.vertices[b].normal,e);e=la.dot(M[b]);e=e<0?-1:1;this.vertices[b].tangent.set(W.x,W.y,W.z,e)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],
+z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,d=this.vertices.length;b<d;b++){a=this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>
+this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,b=0,d=this.vertices.length;b<d;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}}};THREE.GeometryIdCounter=0;
+THREE.AnimationHandler=function(){var a=[],b={},d={};d.update=function(f){for(var h=0;h<a.length;h++)a[h].update(f)};d.addToUpdate=function(f){a.indexOf(f)===-1&&a.push(f)};d.removeFromUpdate=function(f){f=a.indexOf(f);f!==-1&&a.splice(f,1)};d.add=function(f){b[f.name]!==undefined&&console.log("THREE.AnimationHandler.add: Warning! "+f.name+" already exists in library. Overwriting.");b[f.name]=f;if(f.initialized!==!0){for(var h=0;h<f.hierarchy.length;h++){for(var j=0;j<f.hierarchy[h].keys.length;j++){if(f.hierarchy[h].keys[j].time<
+0)f.hierarchy[h].keys[j].time=0;if(f.hierarchy[h].keys[j].rot!==undefined&&!(f.hierarchy[h].keys[j].rot instanceof THREE.Quaternion)){var o=f.hierarchy[h].keys[j].rot;f.hierarchy[h].keys[j].rot=new THREE.Quaternion(o[0],o[1],o[2],o[3])}}if(f.hierarchy[h].keys[0].morphTargets!==undefined){o={};for(j=0;j<f.hierarchy[h].keys.length;j++)for(var m=0;m<f.hierarchy[h].keys[j].morphTargets.length;m++){var u=f.hierarchy[h].keys[j].morphTargets[m];o[u]=-1}f.hierarchy[h].usedMorphTargets=o;for(j=0;j<f.hierarchy[h].keys.length;j++){var y=
+{};for(u in o){for(m=0;m<f.hierarchy[h].keys[j].morphTargets.length;m++)if(f.hierarchy[h].keys[j].morphTargets[m]===u){y[u]=f.hierarchy[h].keys[j].morphTargetsInfluences[m];break}m===f.hierarchy[h].keys[j].morphTargets.length&&(y[u]=0)}f.hierarchy[h].keys[j].morphTargetsInfluences=y}}for(j=1;j<f.hierarchy[h].keys.length;j++)if(f.hierarchy[h].keys[j].time===f.hierarchy[h].keys[j-1].time){f.hierarchy[h].keys.splice(j,1);j--}for(j=1;j<f.hierarchy[h].keys.length;j++)f.hierarchy[h].keys[j].index=j}j=parseInt(f.length*
+f.fps,10);f.JIT={};f.JIT.hierarchy=[];for(h=0;h<f.hierarchy.length;h++)f.JIT.hierarchy.push(Array(j));f.initialized=!0}};d.get=function(f){if(typeof f==="string")if(b[f])return b[f];else{console.log("THREE.AnimationHandler.get: Couldn't find animation "+f);return null}};d.parse=function(f){var h=[];if(f instanceof THREE.SkinnedMesh)for(var j=0;j<f.bones.length;j++)h.push(f.bones[j]);else e(f,h);return h};var e=function(f,h){h.push(f);for(var j=0;j<f.children.length;j++)e(f.children[j],h)};d.LINEAR=
+0;d.CATMULLROM=1;d.CATMULLROM_FORWARD=2;return d}();THREE.Animation=function(a,b,d,e){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.isPaused=!0;this.loop=!0;this.interpolationType=d!==undefined?d:THREE.AnimationHandler.LINEAR;this.JITCompile=e!==undefined?e:!0;this.points=[];this.target=new THREE.Vector3};
+THREE.Animation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==undefined?a:!0;this.currentTime=b!==undefined?b:0;var d,e=this.hierarchy.length,f;for(d=0;d<e;d++){f=this.hierarchy[d];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)f.useQuaternion=!0;f.matrixAutoUpdate=!0;if(f.animationCache===undefined){f.animationCache={};f.animationCache.prevKey={pos:0,rot:0,scl:0};f.animationCache.nextKey={pos:0,rot:0,scl:0};f.animationCache.originalMatrix=
+f instanceof THREE.Bone?f.skinMatrix:f.matrix}var h=f.animationCache.prevKey;f=f.animationCache.nextKey;h.pos=this.data.hierarchy[d].keys[0];h.rot=this.data.hierarchy[d].keys[0];h.scl=this.data.hierarchy[d].keys[0];f.pos=this.getNextKeyWith("pos",d,1);f.rot=this.getNextKeyWith("rot",d,1);f.scl=this.getNextKeyWith("scl",d,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
+THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
+THREE.Animation.prototype.stop=function(){this.isPlaying=!1;this.isPaused=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==undefined){if(this.hierarchy[a]instanceof THREE.Bone)this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix;else this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix;delete this.hierarchy[a].animationCache}};
+THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],d,e,f,h,j,o,m,u,y=this.data.JIT.hierarchy,z,A;this.currentTime+=a*this.timeScale;A=this.currentTime;z=this.currentTime%=this.data.length;u=parseInt(Math.min(z*this.data.fps,this.data.length*this.data.fps),10);for(var x=0,K=this.hierarchy.length;x<K;x++){a=this.hierarchy[x];m=a.animationCache;if(this.JITCompile&&y[x][u]!==undefined)if(a instanceof THREE.Bone){a.skinMatrix=y[x][u];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=
+!1}else{a.matrix=y[x][u];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=!0}else{if(this.JITCompile)if(a instanceof THREE.Bone)a.skinMatrix=a.animationCache.originalMatrix;else a.matrix=a.animationCache.originalMatrix;for(var J=0;J<3;J++){d=b[J];j=m.prevKey[d];o=m.nextKey[d];if(o.time<=A){if(z<A)if(this.loop){j=this.data.hierarchy[x].keys[0];for(o=this.getNextKeyWith(d,x,1);o.time<z;){j=o;o=this.getNextKeyWith(d,x,o.index+1)}}else{this.stop();return}else{do{j=o;o=this.getNextKeyWith(d,x,o.index+1)}while(o.time<
+z)}m.prevKey[d]=j;m.nextKey[d]=o}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;e=(z-j.time)/(o.time-j.time);f=j[d];h=o[d];if(e<0||e>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+e+" on bone "+x);e=e<0?0:1}if(d==="pos"){d=a.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){d.x=f[0]+(h[0]-f[0])*e;d.y=f[1]+(h[1]-f[1])*e;d.z=f[2]+(h[2]-f[2])*e}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=
+this.getPrevKeyWith("pos",x,j.index-1).pos;this.points[1]=f;this.points[2]=h;this.points[3]=this.getNextKeyWith("pos",x,o.index+1).pos;e=e*0.33+0.33;f=this.interpolateCatmullRom(this.points,e);d.x=f[0];d.y=f[1];d.z=f[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){e=this.interpolateCatmullRom(this.points,e*1.01);this.target.set(e[0],e[1],e[2]);this.target.subSelf(d);this.target.y=0;this.target.normalize();e=Math.atan2(this.target.x,this.target.z);a.rotation.set(0,e,0)}}}else if(d===
+"rot")THREE.Quaternion.slerp(f,h,a.quaternion,e);else if(d==="scl"){d=a.scale;d.x=f[0]+(h[0]-f[0])*e;d.y=f[1]+(h[1]-f[1])*e;d.z=f[2]+(h[2]-f[2])*e}}}}if(this.JITCompile&&y[0][u]===undefined){this.hierarchy[0].update(undefined,!0);for(x=0;x<this.hierarchy.length;x++)y[x][u]=this.hierarchy[x]instanceof THREE.Bone?this.hierarchy[x].skinMatrix.clone():this.hierarchy[x].matrix.clone()}}};
+THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var d=[],e=[],f,h,j,o,m,u;f=(a.length-1)*b;h=Math.floor(f);f-=h;d[0]=h==0?h:h-1;d[1]=h;d[2]=h>a.length-2?h:h+1;d[3]=h>a.length-3?h:h+2;h=a[d[0]];o=a[d[1]];m=a[d[2]];u=a[d[3]];d=f*f;j=f*d;e[0]=this.interpolate(h[0],o[0],m[0],u[0],f,d,j);e[1]=this.interpolate(h[1],o[1],m[1],u[1],f,d,j);e[2]=this.interpolate(h[2],o[2],m[2],u[2],f,d,j);return e};
+THREE.Animation.prototype.interpolate=function(a,b,d,e,f,h,j){a=(d-a)*0.5;e=(e-b)*0.5;return(2*(b-d)+a+e)*j+(-3*(b-d)-2*a-e)*h+a*f+b};THREE.Animation.prototype.getNextKeyWith=function(a,b,d){var e=this.data.hierarchy[b].keys;if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)d=d<e.length-1?d:e.length-1;else d%=e.length;for(;d<e.length;d++)if(e[d][a]!==undefined)return e[d];return this.data.hierarchy[b].keys[0]};
+THREE.Animation.prototype.getPrevKeyWith=function(a,b,d){var e=this.data.hierarchy[b].keys;for(d=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?d>0?d:0:d>=0?d:d+e.length;d>=0;d--)if(e[d][a]!==undefined)return e[d];return this.data.hierarchy[b].keys[e.length-1]};
+THREE.Camera=function(a,b,d,e,f){THREE.Object3D.call(this);this.fov=a||50;this.aspect=b||1;this.near=d||0.1;this.far=e||2E3;this.target=f||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
 THREE.Camera.prototype.translate=function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a));this.target.position.addSelf(b.multiplyScalar(a))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};THREE.Camera.prototype.updateMatrix=function(){this.update(undefined,!0)};
 THREE.Camera.prototype.update=function(a,b,d){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);this.matrix.setPosition(this.position);a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);b=!0}else{this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=
 !1;b=!0;THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,b,d)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;
@@ -91,27 +108,27 @@ undefined)this.vertexShader=a.vertexShader;if(a.uniforms!==undefined)this.unifor
 if(a.wireframeLinejoin!==undefined)this.wireframeLinejoin=a.wireframeLinejoin;if(a.lights!==undefined)this.lights=a.lights;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors;if(a.skinning!==undefined)this.skinning=a.skinning;if(a.morphTargets!==undefined)this.morphTargets=a.morphTargets}};
 THREE.ParticleBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.map=null;this.size=1;this.sizeAttenuation=!0;this.blending=THREE.NormalBlending;this.depthTest=!0;this.offset=new THREE.Vector2;this.vertexColors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.size!==undefined)this.size=a.size;if(a.sizeAttenuation!==undefined)this.sizeAttenuation=
 a.sizeAttenuation;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors}};THREE.ParticleCircleMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}};
-THREE.Texture=function(a,b,d,e,g,l){this.image=a;this.mapping=b!==undefined?b:new THREE.UVMapping;this.wrapS=d!==undefined?d:THREE.ClampToEdgeWrapping;this.wrapT=e!==undefined?e:THREE.ClampToEdgeWrapping;this.magFilter=g!==undefined?g:THREE.LinearFilter;this.minFilter=l!==undefined?l:THREE.LinearMipMapLinearFilter;this.needsUpdate=!1};THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter)}};
+THREE.Texture=function(a,b,d,e,f,h){this.image=a;this.mapping=b!==undefined?b:new THREE.UVMapping;this.wrapS=d!==undefined?d:THREE.ClampToEdgeWrapping;this.wrapT=e!==undefined?e:THREE.ClampToEdgeWrapping;this.magFilter=f!==undefined?f:THREE.LinearFilter;this.minFilter=h!==undefined?h:THREE.LinearMipMapLinearFilter;this.needsUpdate=!1};THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter)}};
 THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;
 THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;
 THREE.RenderTarget=function(a,b,d){this.width=a;this.height=b;d=d||{};this.wrapS=d.wrapS!==undefined?d.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=d.wrapT!==undefined?d.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=d.magFilter!==undefined?d.magFilter:THREE.LinearFilter;this.minFilter=d.minFilter!==undefined?d.minFilter:THREE.LinearMipMapLinearFilter;this.format=d.format!==undefined?d.format:THREE.RGBFormat;this.type=d.type!==undefined?d.type:THREE.UnsignedByteType};
-var Uniforms={clone:function(a){var b,d,e,g={};for(b in a){g[b]={};for(d in a[b]){e=a[b][d];g[b][d]=e instanceof THREE.Color||e instanceof THREE.Vector3||e instanceof THREE.Texture?e.clone():e}}return g},merge:function(a){var b,d,e,g={};for(b=0;b<a.length;b++){e=this.clone(a[b]);for(d in e)g[d]=e[d]}return g}};THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.matrixAutoUpdate=!1};THREE.Particle.prototype=new THREE.Object3D;
+var Uniforms={clone:function(a){var b,d,e,f={};for(b in a){f[b]={};for(d in a[b]){e=a[b][d];f[b][d]=e instanceof THREE.Color||e instanceof THREE.Vector3||e instanceof THREE.Texture?e.clone():e}}return f},merge:function(a){var b,d,e,f={};for(b=0;b<a.length;b++){e=this.clone(a[b]);for(d in e)f[d]=e[d]}return f}};THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.matrixAutoUpdate=!1};THREE.Particle.prototype=new THREE.Object3D;
 THREE.Particle.prototype.constructor=THREE.Particle;THREE.ParticleSystem=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.sortParticles=!1};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;THREE.Line=function(a,b,d){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.type=d!=undefined?d:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;
 THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;
 THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b&&b.length?b:[b];this.flipSided=!1;this.doubleSided=!1;this.overdraw=!1;if(this.geometry){this.geometry.boundingSphere||this.geometry.computeBoundingSphere();this.boundRadius=a.boundingSphere.radius;if(this.geometry.morphTargets.length){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var d=0;d<this.geometry.morphTargets.length;d++){this.morphTargetInfluences.push(0);
 this.morphTargetDictionary[this.geometry.morphTargets[d].name]=d}}}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;THREE.Mesh.prototype.getMorphTargetIndexByName=function(a){if(this.morphTargetDictionary[a]!==undefined)return this.morphTargetDictionary[a];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+a+" does not exist. Returning 0.");return 0};
 THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
-THREE.Bone.prototype.update=function(a,b,d){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;b=!0}var e,g=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(e=0;e<g;e++){a=this.children[e];a instanceof THREE.Bone?a.update(this.skinMatrix,b,d):a.update(this.matrixWorld,!0,d)}}else for(e=0;e<g;e++)this.children[e].update(this.skinMatrix,
+THREE.Bone.prototype.update=function(a,b,d){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;b=!0}var e,f=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(e=0;e<f;e++){a=this.children[e];a instanceof THREE.Bone?a.update(this.skinMatrix,b,d):a.update(this.matrixWorld,!0,d)}}else for(e=0;e<f;e++)this.children[e].update(this.skinMatrix,
 b,d)};THREE.Bone.prototype.addChild=function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);if(!(a instanceof THREE.Bone))this.hasNoneBoneChildren=!0}};if(!window.Float32Array)window.Float32Array=Array;
-THREE.SkinnedMesh=function(a,b){THREE.Mesh.call(this,a,b);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var d,e,g,l,m,s;if(this.geometry.bones!==undefined){for(d=0;d<this.geometry.bones.length;d++){g=this.geometry.bones[d];l=g.pos;m=g.rotq;s=g.scl;e=this.addBone();e.name=g.name;e.position.set(l[0],l[1],l[2]);e.quaternion.set(m[0],m[1],m[2],m[3]);e.useQuaternion=!0;s!==undefined?e.scale.set(s[0],s[1],s[2]):e.scale.set(1,1,1)}for(d=0;d<this.bones.length;d++){g=this.geometry.bones[d];
-e=this.bones[d];g.parent===-1?this.addChild(e):this.bones[g.parent].addChild(e)}this.boneMatrices=new Float32Array(16*this.bones.length);this.pose()}};THREE.SkinnedMesh.prototype=new THREE.Mesh;THREE.SkinnedMesh.prototype.constructor=THREE.SkinnedMesh;
-THREE.SkinnedMesh.prototype.update=function(a,b,d){if(this.visible){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;b=!0}var e,g=this.children.length;for(e=0;e<g;e++){a=this.children[e];a instanceof THREE.Bone?a.update(this.identityMatrix,!1,d):a.update(this.matrixWorld,b,d)}d=this.bones.length;ba=this.bones;bm=this.boneMatrices;for(b=0;b<d;b++)ba[b].skinMatrix.flattenToArrayOffset(bm,
+THREE.SkinnedMesh=function(a,b){THREE.Mesh.call(this,a,b);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var d,e,f,h,j,o;if(this.geometry.bones!==undefined){for(d=0;d<this.geometry.bones.length;d++){f=this.geometry.bones[d];h=f.pos;j=f.rotq;o=f.scl;e=this.addBone();e.name=f.name;e.position.set(h[0],h[1],h[2]);e.quaternion.set(j[0],j[1],j[2],j[3]);e.useQuaternion=!0;o!==undefined?e.scale.set(o[0],o[1],o[2]):e.scale.set(1,1,1)}for(d=0;d<this.bones.length;d++){f=this.geometry.bones[d];
+e=this.bones[d];f.parent===-1?this.addChild(e):this.bones[f.parent].addChild(e)}this.boneMatrices=new Float32Array(16*this.bones.length);this.pose()}};THREE.SkinnedMesh.prototype=new THREE.Mesh;THREE.SkinnedMesh.prototype.constructor=THREE.SkinnedMesh;
+THREE.SkinnedMesh.prototype.update=function(a,b,d){if(this.visible){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;b=!0}var e,f=this.children.length;for(e=0;e<f;e++){a=this.children[e];a instanceof THREE.Bone?a.update(this.identityMatrix,!1,d):a.update(this.matrixWorld,b,d)}d=this.bones.length;ba=this.bones;bm=this.boneMatrices;for(b=0;b<d;b++)ba[b].skinMatrix.flattenToArrayOffset(bm,
 b*16)}};THREE.SkinnedMesh.prototype.addBone=function(a){a===undefined&&(a=new THREE.Bone(this));this.bones.push(a);return a};
-THREE.SkinnedMesh.prototype.pose=function(){this.update(undefined,!0);for(var a,b=[],d=0;d<this.bones.length;d++){a=this.bones[d];b.push(THREE.Matrix4.makeInvert(a.skinMatrix));a.skinMatrix.flattenToArrayOffset(this.boneMatrices,d*16)}if(this.geometry.skinVerticesA===undefined){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];var e;for(a=0;a<this.geometry.skinIndices.length;a++){d=this.geometry.vertices[a].position;var g=this.geometry.skinIndices[a].x,l=this.geometry.skinIndices[a].y;
-e=new THREE.Vector3(d.x,d.y,d.z);this.geometry.skinVerticesA.push(b[g].multiplyVector3(e));e=new THREE.Vector3(d.x,d.y,d.z);this.geometry.skinVerticesB.push(b[l].multiplyVector3(e));if(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y!==1){d=(1-(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y))*0.5;this.geometry.skinWeights[a].x+=d;this.geometry.skinWeights[a].y+=d}}}};
+THREE.SkinnedMesh.prototype.pose=function(){this.update(undefined,!0);for(var a,b=[],d=0;d<this.bones.length;d++){a=this.bones[d];b.push(THREE.Matrix4.makeInvert(a.skinMatrix));a.skinMatrix.flattenToArrayOffset(this.boneMatrices,d*16)}if(this.geometry.skinVerticesA===undefined){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];var e;for(a=0;a<this.geometry.skinIndices.length;a++){d=this.geometry.vertices[a].position;var f=this.geometry.skinIndices[a].x,h=this.geometry.skinIndices[a].y;
+e=new THREE.Vector3(d.x,d.y,d.z);this.geometry.skinVerticesA.push(b[f].multiplyVector3(e));e=new THREE.Vector3(d.x,d.y,d.z);this.geometry.skinVerticesB.push(b[h].multiplyVector3(e));if(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y!==1){d=(1-(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y))*0.5;this.geometry.skinWeights[a].x+=d;this.geometry.skinWeights[a].y+=d}}}};
 THREE.Ribbon=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.flipSided=!1;this.doubleSided=!1};THREE.Ribbon.prototype=new THREE.Object3D;THREE.Ribbon.prototype.constructor=THREE.Ribbon;
-THREE.Sound=function(a,b,d,e){THREE.Object3D.call(this);this.isLoaded=!1;this.isAddedToDOM=!1;this.isPlaying=!1;this.duration=-1;this.radius=b!==undefined?Math.abs(b):100;this.volume=Math.min(1,Math.max(0,d!==undefined?d:1));this.domElement=document.createElement("audio");this.domElement.volume=0;this.domElement.pan=0;this.domElement.loop=e!==undefined?e:!0;this.sources=a instanceof Array?a:[a];var g;d=this.sources.length;for(a=0;a<d;a++){b=this.sources[a];b.toLowerCase();if(b.indexOf(".mp3")!==-1)g=
-"audio/mpeg";else if(b.indexOf(".ogg")!==-1)g="audio/ogg";else b.indexOf(".wav")!==-1&&(g="audio/wav");if(this.domElement.canPlayType(g)){g=document.createElement("source");g.src=this.sources[a];this.domElement.THREESound=this;this.domElement.appendChild(g);this.domElement.addEventListener("canplay",this.onLoad,!0);this.domElement.load();break}}};THREE.Sound.prototype=new THREE.Object3D;THREE.Sound.prototype.constructor=THREE.Sound;THREE.Sound.prototype.supr=THREE.Object3D.prototype;
+THREE.Sound=function(a,b,d,e){THREE.Object3D.call(this);this.isLoaded=!1;this.isAddedToDOM=!1;this.isPlaying=!1;this.duration=-1;this.radius=b!==undefined?Math.abs(b):100;this.volume=Math.min(1,Math.max(0,d!==undefined?d:1));this.domElement=document.createElement("audio");this.domElement.volume=0;this.domElement.pan=0;this.domElement.loop=e!==undefined?e:!0;this.sources=a instanceof Array?a:[a];var f;d=this.sources.length;for(a=0;a<d;a++){b=this.sources[a];b.toLowerCase();if(b.indexOf(".mp3")!==-1)f=
+"audio/mpeg";else if(b.indexOf(".ogg")!==-1)f="audio/ogg";else b.indexOf(".wav")!==-1&&(f="audio/wav");if(this.domElement.canPlayType(f)){f=document.createElement("source");f.src=this.sources[a];this.domElement.THREESound=this;this.domElement.appendChild(f);this.domElement.addEventListener("canplay",this.onLoad,!0);this.domElement.load();break}}};THREE.Sound.prototype=new THREE.Object3D;THREE.Sound.prototype.constructor=THREE.Sound;THREE.Sound.prototype.supr=THREE.Object3D.prototype;
 THREE.Sound.prototype.onLoad=function(){var a=this.THREESound;if(!a.isLoaded){this.removeEventListener("canplay",this.onLoad,!0);a.isLoaded=!0;a.duration=this.duration;a.isPlaying&&a.play()}};THREE.Sound.prototype.addToDOM=function(a){this.isAddedToDOM=!0;a.appendChild(this.domElement)};THREE.Sound.prototype.play=function(a){this.isPlaying=!0;if(this.isLoaded){this.domElement.play();if(a)this.domElement.currentTime=a%this.duration}};THREE.Sound.prototype.pause=function(){this.isPlaying=!1;this.domElement.pause()};
 THREE.Sound.prototype.stop=function(){this.isPlaying=!1;this.domElement.pause();this.domElement.currentTime=0};THREE.Sound.prototype.calculateVolumeAndPan=function(a){a=a.length();this.domElement.volume=a<=this.radius?this.volume*(1-a/this.radius):0};
 THREE.Sound.prototype.update=function(a,b,d){if(this.matrixAutoUpdate){this.matrix.setPosition(this.position);b=!0}if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;b=!0}var e=this.children.length;for(a=0;a<e;a++)this.children[a].update(this.matrixWorld,b,d)};THREE.LOD=function(){THREE.Object3D.call(this);this.LODs=[]};THREE.LOD.prototype=new THREE.Object3D;THREE.LOD.prototype.constructor=THREE.LOD;
@@ -121,7 +138,20 @@ THREE.LOD.prototype.update=function(a,b,d){this.matrixAutoUpdate&&(b|=this.updat
 THREE.Scene.prototype.addChild=function(a){this.supr.addChild.call(this,a);this.addChildRecurse(a)};THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(a instanceof THREE.Sound)this.sounds.indexOf(a)===-1&&this.sounds.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a)}for(var b=0;b<a.children.length;b++)this.addChildRecurse(a.children[b])};
 THREE.Scene.prototype.removeChild=function(a){this.supr.removeChild.call(this,a);this.removeChildRecurse(a)};THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else if(a instanceof THREE.Sound){b=this.sounds.indexOf(a);b!==-1&&this.sounds.splice(b,1)}else if(!(a instanceof THREE.Camera)){b=this.objects.indexOf(a);if(b!==-1){this.objects.splice(b,1);this.__objectsRemoved.push(a)}}for(b=0;b<a.children.length;b++)this.removeChildRecurse(a.children[b])};
 THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;THREE.Fog=function(a,b,d){this.color=new THREE.Color(a);this.near=b||1;this.far=d||1E3};THREE.FogExp2=function(a,b){this.color=new THREE.Color(a);this.density=b!==undefined?b:2.5E-4};
-THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(a,b,d){d&&a.update(undefined,!1,b);d=a.sounds;var e,g=d.length;for(e=0;e<g;e++){a=d[e];this.soundPosition.set(a.matrixWorld.n14,a.matrixWorld.n24,a.matrixWorld.n34);this.soundPosition.subSelf(b.position);if(a.isPlaying&&a.isLoaded){a.isAddedToDOM||a.addToDOM(this.domElement);a.calculateVolumeAndPan(this.soundPosition)}}}};
+THREE.Projector=function(){function a(M,c){return c.z-M.z}function b(M,c){var ja=0,W=1,la=M.z+M.w,Z=c.z+c.w,R=-M.z+M.w,N=-c.z+c.w;if(la>=0&&Z>=0&&R>=0&&N>=0)return!0;else if(la<0&&Z<0||R<0&&N<0)return!1;else{if(la<0)ja=Math.max(ja,la/(la-Z));else Z<0&&(W=Math.min(W,la/(la-Z)));if(R<0)ja=Math.max(ja,R/(R-N));else N<0&&(W=Math.min(W,R/(R-N)));if(W<ja)return!1;else{M.lerpSelf(c,ja);c.lerpSelf(M,1-W);return!0}}}var d,e,f=[],h,j,o,m=[],u,y,z=[],A,x,K=[],J=new THREE.Vector4,H=new THREE.Vector4,w=new THREE.Matrix4,
+ga=new THREE.Matrix4,U=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ha=new THREE.Vector4,fa=new THREE.Vector4,ia;this.projectObjects=function(M,c,ja){c=[];var W,la,Z;e=0;la=M.objects;M=0;for(W=la.length;M<W;M++){Z=la[M];var R;if(!(R=!Z.visible))if(R=Z instanceof THREE.Mesh){a:{R=void 0;for(var N=Z.matrixWorld,Ba=-Z.geometry.boundingSphere.radius*Math.max(Z.scale.x,Math.max(Z.scale.y,Z.scale.z)),L=0;L<6;L++){R=U[L].x*N.n14+U[L].y*N.n24+
+U[L].z*N.n34+U[L].w;if(R<=Ba){R=!1;break a}}R=!0}R=!R}if(!R){d=f[e]=f[e]||new THREE.RenderableObject;J.copy(Z.position);w.multiplyVector3(J);d.object=Z;d.z=J.z;c.push(d);e++}}ja&&c.sort(a);return c};this.projectScene=function(M,c,ja){var W=[],la=c.near,Z=c.far,R,N,Ba,L,ka,wa,P,xa,Ha,Na,Ma,Fa,va,V,sa,za;o=y=x=0;c.matrixAutoUpdate&&c.updateMatrix();M.update(undefined,!1,c);w.multiply(c.projectionMatrix,c.matrixWorldInverse);U[0].set(w.n41-w.n11,w.n42-w.n12,w.n43-w.n13,w.n44-w.n14);U[1].set(w.n41+w.n11,
+w.n42+w.n12,w.n43+w.n13,w.n44+w.n14);U[2].set(w.n41+w.n21,w.n42+w.n22,w.n43+w.n23,w.n44+w.n24);U[3].set(w.n41-w.n21,w.n42-w.n22,w.n43-w.n23,w.n44-w.n24);U[4].set(w.n41-w.n31,w.n42-w.n32,w.n43-w.n33,w.n44-w.n34);U[5].set(w.n41+w.n31,w.n42+w.n32,w.n43+w.n33,w.n44+w.n34);for(R=0;R<6;R++){wa=U[R];wa.divideScalar(Math.sqrt(wa.x*wa.x+wa.y*wa.y+wa.z*wa.z))}wa=this.projectObjects(M,c,!0);M=0;for(R=wa.length;M<R;M++){P=wa[M].object;if(P.visible){xa=P.matrixWorld;Ma=P.matrixRotationWorld;Ha=P.materials;Na=
+P.overdraw;if(P instanceof THREE.Mesh){Fa=P.geometry;va=Fa.vertices;N=0;for(Ba=va.length;N<Ba;N++){V=va[N];V.positionWorld.copy(V.position);xa.multiplyVector3(V.positionWorld);L=V.positionScreen;L.copy(V.positionWorld);w.multiplyVector4(L);L.x/=L.w;L.y/=L.w;V.__visible=L.z>la&&L.z<Z}Fa=Fa.faces;N=0;for(Ba=Fa.length;N<Ba;N++){V=Fa[N];if(V instanceof THREE.Face3){L=va[V.a];ka=va[V.b];sa=va[V.c];if(L.__visible&&ka.__visible&&sa.__visible&&(P.doubleSided||P.flipSided!=(sa.positionScreen.x-L.positionScreen.x)*
+(ka.positionScreen.y-L.positionScreen.y)-(sa.positionScreen.y-L.positionScreen.y)*(ka.positionScreen.x-L.positionScreen.x)<0)){h=m[o]=m[o]||new THREE.RenderableFace3;h.v1.positionWorld.copy(L.positionWorld);h.v2.positionWorld.copy(ka.positionWorld);h.v3.positionWorld.copy(sa.positionWorld);h.v1.positionScreen.copy(L.positionScreen);h.v2.positionScreen.copy(ka.positionScreen);h.v3.positionScreen.copy(sa.positionScreen);h.normalWorld.copy(V.normal);Ma.multiplyVector3(h.normalWorld);h.centroidWorld.copy(V.centroid);
+xa.multiplyVector3(h.centroidWorld);h.centroidScreen.copy(h.centroidWorld);w.multiplyVector3(h.centroidScreen);sa=V.vertexNormals;ia=h.vertexNormalsWorld;L=0;for(ka=sa.length;L<ka;L++){za=ia[L]=ia[L]||new THREE.Vector3;za.copy(sa[L]);Ma.multiplyVector3(za)}h.z=h.centroidScreen.z;h.meshMaterials=Ha;h.faceMaterials=V.materials;h.overdraw=Na;if(P.geometry.uvs[N]){h.uvs[0]=P.geometry.uvs[N][0];h.uvs[1]=P.geometry.uvs[N][1];h.uvs[2]=P.geometry.uvs[N][2]}W.push(h);o++}}else if(V instanceof THREE.Face4){L=
+va[V.a];ka=va[V.b];sa=va[V.c];za=va[V.d];if(L.__visible&&ka.__visible&&sa.__visible&&za.__visible&&(P.doubleSided||P.flipSided!=((za.positionScreen.x-L.positionScreen.x)*(ka.positionScreen.y-L.positionScreen.y)-(za.positionScreen.y-L.positionScreen.y)*(ka.positionScreen.x-L.positionScreen.x)<0||(ka.positionScreen.x-sa.positionScreen.x)*(za.positionScreen.y-sa.positionScreen.y)-(ka.positionScreen.y-sa.positionScreen.y)*(za.positionScreen.x-sa.positionScreen.x)<0))){h=m[o]=m[o]||new THREE.RenderableFace3;
+h.v1.positionWorld.copy(L.positionWorld);h.v2.positionWorld.copy(ka.positionWorld);h.v3.positionWorld.copy(za.positionWorld);h.v1.positionScreen.copy(L.positionScreen);h.v2.positionScreen.copy(ka.positionScreen);h.v3.positionScreen.copy(za.positionScreen);h.normalWorld.copy(V.normal);Ma.multiplyVector3(h.normalWorld);h.centroidWorld.copy(V.centroid);xa.multiplyVector3(h.centroidWorld);h.centroidScreen.copy(h.centroidWorld);w.multiplyVector3(h.centroidScreen);h.z=h.centroidScreen.z;h.meshMaterials=
+Ha;h.faceMaterials=V.materials;h.overdraw=Na;if(P.geometry.uvs[N]){h.uvs[0]=P.geometry.uvs[N][0];h.uvs[1]=P.geometry.uvs[N][1];h.uvs[2]=P.geometry.uvs[N][3]}W.push(h);o++;j=m[o]=m[o]||new THREE.RenderableFace3;j.v1.positionWorld.copy(ka.positionWorld);j.v2.positionWorld.copy(sa.positionWorld);j.v3.positionWorld.copy(za.positionWorld);j.v1.positionScreen.copy(ka.positionScreen);j.v2.positionScreen.copy(sa.positionScreen);j.v3.positionScreen.copy(za.positionScreen);j.normalWorld.copy(h.normalWorld);
+j.centroidWorld.copy(h.centroidWorld);j.centroidScreen.copy(h.centroidScreen);j.z=j.centroidScreen.z;j.meshMaterials=Ha;j.faceMaterials=V.materials;j.overdraw=Na;if(P.geometry.uvs[N]){j.uvs[0]=P.geometry.uvs[N][1];j.uvs[1]=P.geometry.uvs[N][2];j.uvs[2]=P.geometry.uvs[N][3]}W.push(j);o++}}}}else if(P instanceof THREE.Line){ga.multiply(w,xa);va=P.geometry.vertices;V=va[0];V.positionScreen.copy(V.position);ga.multiplyVector4(V.positionScreen);N=1;for(Ba=va.length;N<Ba;N++){L=va[N];L.positionScreen.copy(L.position);
+ga.multiplyVector4(L.positionScreen);ka=va[N-1];ha.copy(L.positionScreen);fa.copy(ka.positionScreen);if(b(ha,fa)){ha.multiplyScalar(1/ha.w);fa.multiplyScalar(1/fa.w);u=z[y]=z[y]||new THREE.RenderableLine;u.v1.positionScreen.copy(ha);u.v2.positionScreen.copy(fa);u.z=Math.max(ha.z,fa.z);u.materials=P.materials;W.push(u);y++}}}else if(P instanceof THREE.Particle){H.set(P.position.x,P.position.y,P.position.z,1);w.multiplyVector4(H);H.z/=H.w;if(H.z>0&&H.z<1){A=K[x]=K[x]||new THREE.RenderableParticle;A.x=
+H.x/H.w;A.y=H.y/H.w;A.z=H.z;A.rotation=P.rotation.z;A.scale.x=P.scale.x*Math.abs(A.x-(H.x+c.projectionMatrix.n11)/(H.w+c.projectionMatrix.n14));A.scale.y=P.scale.y*Math.abs(A.y-(H.y+c.projectionMatrix.n22)/(H.w+c.projectionMatrix.n24));A.materials=P.materials;W.push(A);x++}}}}ja&&W.sort(a);return W};this.unprojectVector=function(M,c){var ja=c.matrixWorld.clone();ja.multiplySelf(THREE.Matrix4.makeInvert(c.projectionMatrix));ja.multiplyVector3(M);return M}};
+THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(a,b,d){d&&a.update(undefined,!1,b);d=a.sounds;var e,f=d.length;for(e=0;e<f;e++){a=d[e];this.soundPosition.set(a.matrixWorld.n14,a.matrixWorld.n24,a.matrixWorld.n34);this.soundPosition.subSelf(b.position);if(a.isPlaying&&a.isLoaded){a.isAddedToDOM||a.addToDOM(this.domElement);a.calculateVolumeAndPan(this.soundPosition)}}}};
 THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",
 envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform int combine;\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",
 envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",
@@ -146,76 +176,77 @@ THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.
 vertexShader:["#define PHONG\nvarying vec3 vLightWeighting;\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.lights_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,
 THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.color_vertex,"#ifndef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\n#endif\nvViewPosition = cameraPosition - mPosition.xyz;\nvec3 transformedNormal = normalize( normalMatrix * normal );\nvNormal = transformedNormal;",THREE.ShaderChunk.lights_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsLib.particle,fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",
 THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["uniform float size;\nuniform float scale;",THREE.ShaderChunk.color_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;\n}"].join("\n")}};
-THREE.WebGLRenderer=function(a){function b(f,j,k){var h,i,r,n=f.vertices,q=n.length,A=f.colors,C=A.length,p=f.__vertexArray,F=f.__colorArray,N=f.__sortArray,K=f.__dirtyVertices,J=f.__dirtyColors;if(k.sortParticles){Ma.multiplySelf(k.matrixWorld);for(h=0;h<q;h++){i=n[h].position;Ga.copy(i);Ma.multiplyVector3(Ga);N[h]=[Ga.z,h]}N.sort(function(G,P){return P[0]-G[0]});for(h=0;h<q;h++){i=n[N[h][1]].position;r=h*3;p[r]=i.x;p[r+1]=i.y;p[r+2]=i.z}for(h=0;h<C;h++){r=h*3;color=A[N[h][1]];F[r]=color.r;F[r+1]=
-color.g;F[r+2]=color.b}}else{if(K)for(h=0;h<q;h++){i=n[h].position;r=h*3;p[r]=i.x;p[r+1]=i.y;p[r+2]=i.z}if(J)for(h=0;h<C;h++){color=A[h];r=h*3;F[r]=color.r;F[r+1]=color.g;F[r+2]=color.b}}if(K||k.sortParticles){c.bindBuffer(c.ARRAY_BUFFER,f.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,p,j)}if(J||k.sortParticles){c.bindBuffer(c.ARRAY_BUFFER,f.__webGLColorBuffer);c.bufferData(c.ARRAY_BUFFER,F,j)}}function d(f,j){f.fragmentShader=j.fragmentShader;f.vertexShader=j.vertexShader;f.uniforms=Uniforms.clone(j.uniforms)}
-function e(f,j,k,h,i){h.program||ya.initMaterial(h,j,k,i);var r=h.program,n=r.uniforms,q=h.uniforms;if(r!=ra){c.useProgram(r);ra=r}c.uniformMatrix4fv(n.projectionMatrix,!1,Xa);if(k&&(h instanceof THREE.MeshBasicMaterial||h instanceof THREE.MeshLambertMaterial||h instanceof THREE.MeshPhongMaterial||h instanceof THREE.LineBasicMaterial||h instanceof THREE.ParticleBasicMaterial)){q.fogColor.value.setHex(k.color.hex);if(k instanceof THREE.Fog){q.fogNear.value=k.near;q.fogFar.value=k.far}else if(k instanceof
-THREE.FogExp2)q.fogDensity.value=k.density}if(h instanceof THREE.MeshPhongMaterial||h instanceof THREE.MeshLambertMaterial||h.lights){var A,C,p=0,F=0,N=0,K,J,G,P=Ya,Q=P.directional.colors,na=P.directional.positions,u=P.point.colors,la=P.point.positions,fa=0,ka=0;k=C=C=0;for(A=j.length;k<A;k++){C=j[k];K=C.color;J=C.position;G=C.intensity;if(C instanceof THREE.AmbientLight){p+=K.r;F+=K.g;N+=K.b}else if(C instanceof THREE.DirectionalLight){C=fa*3;Q[C]=K.r*G;Q[C+1]=K.g*G;Q[C+2]=K.b*G;na[C]=J.x;na[C+1]=
-J.y;na[C+2]=J.z;fa+=1}else if(C instanceof THREE.PointLight){C=ka*3;u[C]=K.r*G;u[C+1]=K.g*G;u[C+2]=K.b*G;la[C]=J.x;la[C+1]=J.y;la[C+2]=J.z;ka+=1}}for(k=fa*3;k<Q.length;k++)Q[k]=0;for(k=ka*3;k<u.length;k++)u[k]=0;P.point.length=ka;P.directional.length=fa;P.ambient[0]=p;P.ambient[1]=F;P.ambient[2]=N;j=Ya;q.enableLighting.value=j.directional.length+j.point.length;q.ambientLightColor.value=j.ambient;q.directionalLightColor.value=j.directional.colors;q.directionalLightDirection.value=j.directional.positions;
-q.pointLightColor.value=j.point.colors;q.pointLightPosition.value=j.point.positions}if(h instanceof THREE.MeshBasicMaterial||h instanceof THREE.MeshLambertMaterial||h instanceof THREE.MeshPhongMaterial){q.diffuse.value.setRGB(h.color.r*h.opacity,h.color.g*h.opacity,h.color.b*h.opacity);q.opacity.value=h.opacity;q.map.texture=h.map;q.lightMap.texture=h.lightMap;q.envMap.texture=h.envMap;q.reflectivity.value=h.reflectivity;q.refractionRatio.value=h.refractionRatio;q.combine.value=h.combine;q.useRefract.value=
-h.envMap&&h.envMap.mapping instanceof THREE.CubeRefractionMapping}if(h instanceof THREE.LineBasicMaterial){q.diffuse.value.setRGB(h.color.r*h.opacity,h.color.g*h.opacity,h.color.b*h.opacity);q.opacity.value=h.opacity}else if(h instanceof THREE.ParticleBasicMaterial){q.psColor.value.setRGB(h.color.r*h.opacity,h.color.g*h.opacity,h.color.b*h.opacity);q.opacity.value=h.opacity;q.size.value=h.size;q.scale.value=ja.height/2;q.map.texture=h.map}else if(h instanceof THREE.MeshPhongMaterial){q.ambient.value.setRGB(h.ambient.r,
-h.ambient.g,h.ambient.b);q.specular.value.setRGB(h.specular.r,h.specular.g,h.specular.b);q.shininess.value=h.shininess}else if(h instanceof THREE.MeshDepthMaterial){q.mNear.value=f.near;q.mFar.value=f.far;q.opacity.value=h.opacity}else if(h instanceof THREE.MeshNormalMaterial)q.opacity.value=h.opacity;for(var w in q)if(p=r.uniforms[w]){k=q[w];A=k.type;j=k.value;if(A=="i")c.uniform1i(p,j);else if(A=="f")c.uniform1f(p,j);else if(A=="fv1")c.uniform1fv(p,j);else if(A=="fv")c.uniform3fv(p,j);else if(A==
-"v2")c.uniform2f(p,j.x,j.y);else if(A=="v3")c.uniform3f(p,j.x,j.y,j.z);else if(A=="c")c.uniform3f(p,j.r,j.g,j.b);else if(A=="t"){c.uniform1i(p,j);if(k=k.texture)if(k.image instanceof Array&&k.image.length==6){if(k.image.length==6){if(k.needsUpdate){if(k.__wasSetOnce){c.bindTexture(c.TEXTURE_CUBE_MAP,k.image.__webGLTextureCube);for(A=0;A<6;++A)c.texSubImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+A,0,0,0,c.RGBA,c.UNSIGNED_BYTE,k.image[A])}else{k.image.__webGLTextureCube=c.createTexture();c.bindTexture(c.TEXTURE_CUBE_MAP,
-k.image.__webGLTextureCube);for(A=0;A<6;++A)c.texImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+A,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,k.image[A]);k.__wasSetOnce=!0}W(c.TEXTURE_CUBE_MAP,k,k.image[0]);c.bindTexture(c.TEXTURE_CUBE_MAP,null);k.needsUpdate=!1}c.activeTexture(c.TEXTURE0+j);c.bindTexture(c.TEXTURE_CUBE_MAP,k.image.__webGLTextureCube)}}else{if(k.needsUpdate){if(k.__wasSetOnce){c.bindTexture(c.TEXTURE_2D,k.__webGLTexture);c.texSubImage2D(c.TEXTURE_2D,0,0,0,c.RGBA,c.UNSIGNED_BYTE,k.image)}else{k.__webGLTexture=
-c.createTexture();c.bindTexture(c.TEXTURE_2D,k.__webGLTexture);c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,k.image);k.__wasSetOnce=!0}W(c.TEXTURE_2D,k,k.image);c.bindTexture(c.TEXTURE_2D,null);k.needsUpdate=!1}c.activeTexture(c.TEXTURE0+j);c.bindTexture(c.TEXTURE_2D,k.__webGLTexture)}}}c.uniformMatrix4fv(n.modelViewMatrix,!1,i._modelViewMatrixArray);c.uniformMatrix3fv(n.normalMatrix,!1,i._normalMatrixArray);(h instanceof THREE.MeshShaderMaterial||h instanceof THREE.MeshPhongMaterial||
-h.envMap)&&c.uniform3f(n.cameraPosition,f.position.x,f.position.y,f.position.z);(h instanceof THREE.MeshShaderMaterial||h.envMap||h.skinning)&&c.uniformMatrix4fv(n.objectMatrix,!1,i._objectMatrixArray);(h instanceof THREE.MeshPhongMaterial||h instanceof THREE.MeshLambertMaterial||h instanceof THREE.MeshShaderMaterial||h.skinning)&&c.uniformMatrix4fv(n.viewMatrix,!1,Pa);if(h.skinning){c.uniformMatrix4fv(n.cameraInverseMatrix,!1,Pa);c.uniformMatrix4fv(n.boneGlobalMatrices,!1,i.boneMatrices)}return r}
-function g(f,j,k,h,i,r){if(h.opacity!=0){f=e(f,j,k,h,r).attributes;if(h.morphTargets){j=h.program.attributes;r.morphTargetBase!==-1?c.bindBuffer(c.ARRAY_BUFFER,i.__webGLMorphTargetsBuffers[r.morphTargetBase]):c.bindBuffer(c.ARRAY_BUFFER,i.__webGLVertexBuffer);c.vertexAttribPointer(j.position,3,c.FLOAT,!1,0,0);if(r.morphTargetForcedOrder.length){k=0;for(var n=r.morphTargetForcedOrder,q=r.morphTargetInfluences;k<h.numSupportedMorphTargets&&k<n.length;){c.bindBuffer(c.ARRAY_BUFFER,i.__webGLMorphTargetsBuffers[n[k]]);
-c.vertexAttribPointer(j["morphTarget"+k],3,c.FLOAT,!1,0,0);r.__webGLMorphTargetInfluences[k]=q[n[k]];k++}}else{n=[];var A=-1,C=0;q=r.morphTargetInfluences;var p,F=q.length;k=0;for(r.morphTargetBase!==-1&&(n[r.morphTargetBase]=!0);k<h.numSupportedMorphTargets;){for(p=0;p<F;p++)if(!n[p]&&q[p]>A){C=p;A=q[C]}c.bindBuffer(c.ARRAY_BUFFER,i.__webGLMorphTargetsBuffers[C]);c.vertexAttribPointer(j["morphTarget"+k],3,c.FLOAT,!1,0,0);r.__webGLMorphTargetInfluences[k]=A;n[C]=1;A=-1;k++}}c.uniform1fv(h.program.uniforms.morphTargetInfluences,
-r.__webGLMorphTargetInfluences)}else{c.bindBuffer(c.ARRAY_BUFFER,i.__webGLVertexBuffer);c.vertexAttribPointer(f.position,3,c.FLOAT,!1,0,0)}if(f.color>=0){c.bindBuffer(c.ARRAY_BUFFER,i.__webGLColorBuffer);c.vertexAttribPointer(f.color,3,c.FLOAT,!1,0,0)}if(f.normal>=0){c.bindBuffer(c.ARRAY_BUFFER,i.__webGLNormalBuffer);c.vertexAttribPointer(f.normal,3,c.FLOAT,!1,0,0)}if(f.tangent>=0){c.bindBuffer(c.ARRAY_BUFFER,i.__webGLTangentBuffer);c.vertexAttribPointer(f.tangent,4,c.FLOAT,!1,0,0)}if(f.uv>=0)if(i.__webGLUVBuffer){c.bindBuffer(c.ARRAY_BUFFER,
-i.__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(i.__webGLUV2Buffer){c.bindBuffer(c.ARRAY_BUFFER,i.__webGLUV2Buffer);c.vertexAttribPointer(f.uv2,2,c.FLOAT,!1,0,0);c.enableVertexAttribArray(f.uv2)}else c.disableVertexAttribArray(f.uv2);if(h.skinning&&f.skinVertexA>=0&&f.skinVertexB>=0&&f.skinIndex>=0&&f.skinWeight>=0){c.bindBuffer(c.ARRAY_BUFFER,i.__webGLSkinVertexABuffer);c.vertexAttribPointer(f.skinVertexA,
-4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,i.__webGLSkinVertexBBuffer);c.vertexAttribPointer(f.skinVertexB,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,i.__webGLSkinIndicesBuffer);c.vertexAttribPointer(f.skinIndex,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,i.__webGLSkinWeightsBuffer);c.vertexAttribPointer(f.skinWeight,4,c.FLOAT,!1,0,0)}if(r instanceof THREE.Mesh)if(h.wireframe){c.lineWidth(h.wireframeLinewidth);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,i.__webGLLineBuffer);c.drawElements(c.LINES,
-i.__webGLLineCount,c.UNSIGNED_SHORT,0)}else{c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,i.__webGLFaceBuffer);c.drawElements(c.TRIANGLES,i.__webGLFaceCount,c.UNSIGNED_SHORT,0)}else if(r instanceof THREE.Line){r=r.type==THREE.LineStrip?c.LINE_STRIP:c.LINES;c.lineWidth(h.linewidth);c.drawArrays(r,0,i.__webGLLineCount)}else if(r instanceof THREE.ParticleSystem)c.drawArrays(c.POINTS,0,i.__webGLParticleCount);else r instanceof THREE.Ribbon&&c.drawArrays(c.TRIANGLE_STRIP,0,i.__webGLVertexCount)}}function l(f,j){if(!f.__webGLVertexBuffer)f.__webGLVertexBuffer=
-c.createBuffer();if(!f.__webGLNormalBuffer)f.__webGLNormalBuffer=c.createBuffer();if(f.hasPos){c.bindBuffer(c.ARRAY_BUFFER,f.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,f.positionArray,c.DYNAMIC_DRAW);c.enableVertexAttribArray(j.attributes.position);c.vertexAttribPointer(j.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(j.attributes.normal);c.vertexAttribPointer(j.attributes.normal,
-3,c.FLOAT,!1,0,0)}c.drawArrays(c.TRIANGLES,0,f.count);f.count=0}function m(f){if(sa!=f.doubleSided){f.doubleSided?c.disable(c.CULL_FACE):c.enable(c.CULL_FACE);sa=f.doubleSided}if(ta!=f.flipSided){f.flipSided?c.frontFace(c.CW):c.frontFace(c.CCW);ta=f.flipSided}}function s(f){if(Fa!=f){f?c.enable(c.DEPTH_TEST):c.disable(c.DEPTH_TEST);Fa=f}}function o(f){ua[0].set(f.n41-f.n11,f.n42-f.n12,f.n43-f.n13,f.n44-f.n14);ua[1].set(f.n41+f.n11,f.n42+f.n12,f.n43+f.n13,f.n44+f.n14);ua[2].set(f.n41+f.n21,f.n42+f.n22,
-f.n43+f.n23,f.n44+f.n24);ua[3].set(f.n41-f.n21,f.n42-f.n22,f.n43-f.n23,f.n44-f.n24);ua[4].set(f.n41-f.n31,f.n42-f.n32,f.n43-f.n33,f.n44-f.n34);ua[5].set(f.n41+f.n31,f.n42+f.n32,f.n43+f.n33,f.n44+f.n34);var j;for(f=0;f<6;f++){j=ua[f];j.divideScalar(Math.sqrt(j.x*j.x+j.y*j.y+j.z*j.z))}}function v(f){for(var j=f.matrixWorld,k=-f.geometry.boundingSphere.radius*Math.max(f.scale.x,Math.max(f.scale.y,f.scale.z)),h=0;h<6;h++){f=ua[h].x*j.n14+ua[h].y*j.n24+ua[h].z*j.n34+ua[h].w;if(f<=k)return!1}return!0}function B(f,
-j){f.list[f.count]=j;f.count+=1}function z(f){var j,k,h=f.object,i=f.opaque,r=f.transparent;r.count=0;f=i.count=0;for(j=h.materials.length;f<j;f++){k=h.materials[f];k.opacity&&k.opacity<1||k.blending!=THREE.NormalBlending?B(r,k):B(i,k)}}function D(f){var j,k,h,i,r=f.object,n=f.buffer,q=f.opaque,A=f.transparent;A.count=0;f=q.count=0;for(h=r.materials.length;f<h;f++){j=r.materials[f];if(j instanceof THREE.MeshFaceMaterial){j=0;for(k=n.materials.length;j<k;j++)(i=n.materials[j])&&(i.opacity&&i.opacity<
-1||i.blending!=THREE.NormalBlending?B(A,i):B(q,i))}else{i=j;i.opacity&&i.opacity<1||i.blending!=THREE.NormalBlending?B(A,i):B(q,i)}}}function E(f,j){return j.z-f.z}function H(f,j){f._modelViewMatrix.multiplyToArray(j.matrixWorldInverse,f.matrixWorld,f._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(f._modelViewMatrix).transposeIntoArray(f._normalMatrixArray)}function I(f){function j(N){var K=[];k=0;for(h=N.length;k<h;k++)N[k]==undefined?K.push("undefined"):K.push(N[k].id);return K.join("_")}var k,
-h,i,r,n,q,A,C,p={},F=f.morphTargets!==undefined?f.morphTargets.length:0;f.geometryGroups={};i=0;for(r=f.faces.length;i<r;i++){n=f.faces[i];q=n.materials;A=j(q);p[A]==undefined&&(p[A]={hash:A,counter:0});C=p[A].hash+"_"+p[A].counter;f.geometryGroups[C]==undefined&&(f.geometryGroups[C]={faces:[],materials:q,vertices:0,numMorphTargets:F});n=n instanceof THREE.Face3?3:4;if(f.geometryGroups[C].vertices+n>65535){p[A].counter+=1;C=p[A].hash+"_"+p[A].counter;f.geometryGroups[C]==undefined&&(f.geometryGroups[C]=
-{faces:[],materials:q,vertices:0,numMorphTargets:F})}f.geometryGroups[C].faces.push(i);f.geometryGroups[C].vertices+=n}}function L(f,j,k){f.push({buffer:j,object:k,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function M(f){if(f!=Ea){switch(f){case THREE.AdditiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ONE,c.ONE);break;case THREE.SubtractiveBlending:c.blendFunc(c.DST_COLOR,c.ZERO);break;case THREE.BillboardBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA);
-break;case THREE.ReverseSubtractiveBlending:c.blendEquation(c.FUNC_REVERSE_SUBTRACT);c.blendFunc(c.ONE,c.ONE);break;default:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA)}Ea=f}}function W(f,j,k){if((k.width&k.width-1)==0&&(k.height&k.height-1)==0){c.texParameteri(f,c.TEXTURE_WRAP_S,aa(j.wrapS));c.texParameteri(f,c.TEXTURE_WRAP_T,aa(j.wrapT));c.texParameteri(f,c.TEXTURE_MAG_FILTER,aa(j.magFilter));c.texParameteri(f,c.TEXTURE_MIN_FILTER,aa(j.minFilter));c.generateMipmap(f)}else{c.texParameteri(f,
-c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(f,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);c.texParameteri(f,c.TEXTURE_MAG_FILTER,ea(j.magFilter));c.texParameteri(f,c.TEXTURE_MIN_FILTER,ea(j.minFilter))}}function $(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,aa(f.wrapS));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,aa(f.wrapT));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,aa(f.magFilter));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,aa(f.minFilter));c.texImage2D(c.TEXTURE_2D,0,aa(f.format),f.width,f.height,0,aa(f.format),aa(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 j,k;if(f){j=f.__webGLFramebuffer;k=f.width;f=f.height}else{j=null;k=Ka;f=La}if(j!=pa){c.bindFramebuffer(c.FRAMEBUFFER,j);c.viewport(Aa,Ja,k,f);pa=j}}function ia(f,j){var k;if(f=="fragment")k=c.createShader(c.FRAGMENT_SHADER);else f=="vertex"&&(k=c.createShader(c.VERTEX_SHADER));c.shaderSource(k,
-j);c.compileShader(k);if(!c.getShaderParameter(k,c.COMPILE_STATUS)){alert(c.getShaderInfoLog(k));return null}return k}function ea(f){switch(f){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return c.NEAREST;case THREE.LinearFilter:case THREE.LinearMipMapNearestFilter:case THREE.LinearMipMapLinearFilter:return c.LINEAR}}function aa(f){switch(f){case THREE.RepeatWrapping:return c.REPEAT;case THREE.ClampToEdgeWrapping:return c.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return c.MIRRORED_REPEAT;
+THREE.WebGLRenderer=function(a){function b(g,l,n){var i,k,s,p=g.vertices,r=p.length,E=g.colors,F=E.length,q=g.__vertexArray,G=g.__colorArray,S=g.__sortArray,Q=g.__dirtyVertices,O=g.__dirtyColors;if(n.sortParticles){Ha.multiplySelf(n.matrixWorld);for(i=0;i<r;i++){k=p[i].position;Fa.copy(k);Ha.multiplyVector3(Fa);S[i]=[Fa.z,i]}S.sort(function(I,X){return X[0]-I[0]});for(i=0;i<r;i++){k=p[S[i][1]].position;s=i*3;q[s]=k.x;q[s+1]=k.y;q[s+2]=k.z}for(i=0;i<F;i++){s=i*3;color=E[S[i][1]];G[s]=color.r;G[s+1]=
+color.g;G[s+2]=color.b}}else{if(Q)for(i=0;i<r;i++){k=p[i].position;s=i*3;q[s]=k.x;q[s+1]=k.y;q[s+2]=k.z}if(O)for(i=0;i<F;i++){color=E[i];s=i*3;G[s]=color.r;G[s+1]=color.g;G[s+2]=color.b}}if(Q||n.sortParticles){c.bindBuffer(c.ARRAY_BUFFER,g.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,q,l)}if(O||n.sortParticles){c.bindBuffer(c.ARRAY_BUFFER,g.__webGLColorBuffer);c.bufferData(c.ARRAY_BUFFER,G,l)}}function d(g,l){g.fragmentShader=l.fragmentShader;g.vertexShader=l.vertexShader;g.uniforms=Uniforms.clone(l.uniforms)}
+function e(g,l,n,i,k){i.program||la.initMaterial(i,l,n,k);var s=i.program,p=s.uniforms,r=i.uniforms;if(s!=ja){c.useProgram(s);ja=s}c.uniformMatrix4fv(p.projectionMatrix,!1,Na);if(n&&(i instanceof THREE.MeshBasicMaterial||i instanceof THREE.MeshLambertMaterial||i instanceof THREE.MeshPhongMaterial||i instanceof THREE.LineBasicMaterial||i instanceof THREE.ParticleBasicMaterial)){r.fogColor.value.setHex(n.color.hex);if(n instanceof THREE.Fog){r.fogNear.value=n.near;r.fogFar.value=n.far}else if(n instanceof
+THREE.FogExp2)r.fogDensity.value=n.density}if(i instanceof THREE.MeshPhongMaterial||i instanceof THREE.MeshLambertMaterial||i.lights){var E,F,q=0,G=0,S=0,Q,O,I,X=va,Y=X.directional.colors,Da=X.directional.positions,v=X.point.colors,Aa=X.point.positions,ra=0,ya=0;n=F=F=0;for(E=l.length;n<E;n++){F=l[n];Q=F.color;O=F.position;I=F.intensity;if(F instanceof THREE.AmbientLight){q+=Q.r;G+=Q.g;S+=Q.b}else if(F instanceof THREE.DirectionalLight){F=ra*3;Y[F]=Q.r*I;Y[F+1]=Q.g*I;Y[F+2]=Q.b*I;Da[F]=O.x;Da[F+1]=
+O.y;Da[F+2]=O.z;ra+=1}else if(F instanceof THREE.PointLight){F=ya*3;v[F]=Q.r*I;v[F+1]=Q.g*I;v[F+2]=Q.b*I;Aa[F]=O.x;Aa[F+1]=O.y;Aa[F+2]=O.z;ya+=1}}for(n=ra*3;n<Y.length;n++)Y[n]=0;for(n=ya*3;n<v.length;n++)v[n]=0;X.point.length=ya;X.directional.length=ra;X.ambient[0]=q;X.ambient[1]=G;X.ambient[2]=S;l=va;r.enableLighting.value=l.directional.length+l.point.length;r.ambientLightColor.value=l.ambient;r.directionalLightColor.value=l.directional.colors;r.directionalLightDirection.value=l.directional.positions;
+r.pointLightColor.value=l.point.colors;r.pointLightPosition.value=l.point.positions}if(i instanceof THREE.MeshBasicMaterial||i instanceof THREE.MeshLambertMaterial||i instanceof THREE.MeshPhongMaterial){r.diffuse.value.setRGB(i.color.r*i.opacity,i.color.g*i.opacity,i.color.b*i.opacity);r.opacity.value=i.opacity;r.map.texture=i.map;r.lightMap.texture=i.lightMap;r.envMap.texture=i.envMap;r.reflectivity.value=i.reflectivity;r.refractionRatio.value=i.refractionRatio;r.combine.value=i.combine;r.useRefract.value=
+i.envMap&&i.envMap.mapping instanceof THREE.CubeRefractionMapping}if(i instanceof THREE.LineBasicMaterial){r.diffuse.value.setRGB(i.color.r*i.opacity,i.color.g*i.opacity,i.color.b*i.opacity);r.opacity.value=i.opacity}else if(i instanceof THREE.ParticleBasicMaterial){r.psColor.value.setRGB(i.color.r*i.opacity,i.color.g*i.opacity,i.color.b*i.opacity);r.opacity.value=i.opacity;r.size.value=i.size;r.scale.value=M.height/2;r.map.texture=i.map}else if(i instanceof THREE.MeshPhongMaterial){r.ambient.value.setRGB(i.ambient.r,
+i.ambient.g,i.ambient.b);r.specular.value.setRGB(i.specular.r,i.specular.g,i.specular.b);r.shininess.value=i.shininess}else if(i instanceof THREE.MeshDepthMaterial){r.mNear.value=g.near;r.mFar.value=g.far;r.opacity.value=i.opacity}else if(i instanceof THREE.MeshNormalMaterial)r.opacity.value=i.opacity;for(var B in r)if(q=s.uniforms[B]){n=r[B];E=n.type;l=n.value;if(E=="i")c.uniform1i(q,l);else if(E=="f")c.uniform1f(q,l);else if(E=="fv1")c.uniform1fv(q,l);else if(E=="fv")c.uniform3fv(q,l);else if(E==
+"v2")c.uniform2f(q,l.x,l.y);else if(E=="v3")c.uniform3f(q,l.x,l.y,l.z);else if(E=="c")c.uniform3f(q,l.r,l.g,l.b);else if(E=="t"){c.uniform1i(q,l);if(n=n.texture)if(n.image instanceof Array&&n.image.length==6){if(n.image.length==6){if(n.needsUpdate){if(n.__wasSetOnce){c.bindTexture(c.TEXTURE_CUBE_MAP,n.image.__webGLTextureCube);for(E=0;E<6;++E)c.texSubImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+E,0,0,0,c.RGBA,c.UNSIGNED_BYTE,n.image[E])}else{n.image.__webGLTextureCube=c.createTexture();c.bindTexture(c.TEXTURE_CUBE_MAP,
+n.image.__webGLTextureCube);for(E=0;E<6;++E)c.texImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+E,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,n.image[E]);n.__wasSetOnce=!0}ga(c.TEXTURE_CUBE_MAP,n,n.image[0]);c.bindTexture(c.TEXTURE_CUBE_MAP,null);n.needsUpdate=!1}c.activeTexture(c.TEXTURE0+l);c.bindTexture(c.TEXTURE_CUBE_MAP,n.image.__webGLTextureCube)}}else{if(n.needsUpdate){if(n.__wasSetOnce){c.bindTexture(c.TEXTURE_2D,n.__webGLTexture);c.texSubImage2D(c.TEXTURE_2D,0,0,0,c.RGBA,c.UNSIGNED_BYTE,n.image)}else{n.__webGLTexture=
+c.createTexture();c.bindTexture(c.TEXTURE_2D,n.__webGLTexture);c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,n.image);n.__wasSetOnce=!0}ga(c.TEXTURE_2D,n,n.image);c.bindTexture(c.TEXTURE_2D,null);n.needsUpdate=!1}c.activeTexture(c.TEXTURE0+l);c.bindTexture(c.TEXTURE_2D,n.__webGLTexture)}}}c.uniformMatrix4fv(p.modelViewMatrix,!1,k._modelViewMatrixArray);c.uniformMatrix3fv(p.normalMatrix,!1,k._normalMatrixArray);(i instanceof THREE.MeshShaderMaterial||i instanceof THREE.MeshPhongMaterial||
+i.envMap)&&c.uniform3f(p.cameraPosition,g.position.x,g.position.y,g.position.z);(i instanceof THREE.MeshShaderMaterial||i.envMap||i.skinning)&&c.uniformMatrix4fv(p.objectMatrix,!1,k._objectMatrixArray);(i instanceof THREE.MeshPhongMaterial||i instanceof THREE.MeshLambertMaterial||i instanceof THREE.MeshShaderMaterial||i.skinning)&&c.uniformMatrix4fv(p.viewMatrix,!1,Ma);if(i.skinning){c.uniformMatrix4fv(p.cameraInverseMatrix,!1,Ma);c.uniformMatrix4fv(p.boneGlobalMatrices,!1,k.boneMatrices)}return s}
+function f(g,l,n,i,k,s){if(i.opacity!=0){g=e(g,l,n,i,s).attributes;if(i.morphTargets){l=i.program.attributes;s.morphTargetBase!==-1?c.bindBuffer(c.ARRAY_BUFFER,k.__webGLMorphTargetsBuffers[s.morphTargetBase]):c.bindBuffer(c.ARRAY_BUFFER,k.__webGLVertexBuffer);c.vertexAttribPointer(l.position,3,c.FLOAT,!1,0,0);if(s.morphTargetForcedOrder.length){n=0;for(var p=s.morphTargetForcedOrder,r=s.morphTargetInfluences;n<i.numSupportedMorphTargets&&n<p.length;){c.bindBuffer(c.ARRAY_BUFFER,k.__webGLMorphTargetsBuffers[p[n]]);
+c.vertexAttribPointer(l["morphTarget"+n],3,c.FLOAT,!1,0,0);s.__webGLMorphTargetInfluences[n]=r[p[n]];n++}}else{p=[];var E=-1,F=0;r=s.morphTargetInfluences;var q,G=r.length;n=0;for(s.morphTargetBase!==-1&&(p[s.morphTargetBase]=!0);n<i.numSupportedMorphTargets;){for(q=0;q<G;q++)if(!p[q]&&r[q]>E){F=q;E=r[F]}c.bindBuffer(c.ARRAY_BUFFER,k.__webGLMorphTargetsBuffers[F]);c.vertexAttribPointer(l["morphTarget"+n],3,c.FLOAT,!1,0,0);s.__webGLMorphTargetInfluences[n]=E;p[F]=1;E=-1;n++}}c.uniform1fv(i.program.uniforms.morphTargetInfluences,
+s.__webGLMorphTargetInfluences)}else{c.bindBuffer(c.ARRAY_BUFFER,k.__webGLVertexBuffer);c.vertexAttribPointer(g.position,3,c.FLOAT,!1,0,0)}if(g.color>=0){c.bindBuffer(c.ARRAY_BUFFER,k.__webGLColorBuffer);c.vertexAttribPointer(g.color,3,c.FLOAT,!1,0,0)}if(g.normal>=0){c.bindBuffer(c.ARRAY_BUFFER,k.__webGLNormalBuffer);c.vertexAttribPointer(g.normal,3,c.FLOAT,!1,0,0)}if(g.tangent>=0){c.bindBuffer(c.ARRAY_BUFFER,k.__webGLTangentBuffer);c.vertexAttribPointer(g.tangent,4,c.FLOAT,!1,0,0)}if(g.uv>=0)if(k.__webGLUVBuffer){c.bindBuffer(c.ARRAY_BUFFER,
+k.__webGLUVBuffer);c.vertexAttribPointer(g.uv,2,c.FLOAT,!1,0,0);c.enableVertexAttribArray(g.uv)}else c.disableVertexAttribArray(g.uv);if(g.uv2>=0)if(k.__webGLUV2Buffer){c.bindBuffer(c.ARRAY_BUFFER,k.__webGLUV2Buffer);c.vertexAttribPointer(g.uv2,2,c.FLOAT,!1,0,0);c.enableVertexAttribArray(g.uv2)}else c.disableVertexAttribArray(g.uv2);if(i.skinning&&g.skinVertexA>=0&&g.skinVertexB>=0&&g.skinIndex>=0&&g.skinWeight>=0){c.bindBuffer(c.ARRAY_BUFFER,k.__webGLSkinVertexABuffer);c.vertexAttribPointer(g.skinVertexA,
+4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,k.__webGLSkinVertexBBuffer);c.vertexAttribPointer(g.skinVertexB,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,k.__webGLSkinIndicesBuffer);c.vertexAttribPointer(g.skinIndex,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,k.__webGLSkinWeightsBuffer);c.vertexAttribPointer(g.skinWeight,4,c.FLOAT,!1,0,0)}if(s instanceof THREE.Mesh)if(i.wireframe){c.lineWidth(i.wireframeLinewidth);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,k.__webGLLineBuffer);c.drawElements(c.LINES,
+k.__webGLLineCount,c.UNSIGNED_SHORT,0)}else{c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,k.__webGLFaceBuffer);c.drawElements(c.TRIANGLES,k.__webGLFaceCount,c.UNSIGNED_SHORT,0)}else if(s instanceof THREE.Line){s=s.type==THREE.LineStrip?c.LINE_STRIP:c.LINES;c.lineWidth(i.linewidth);c.drawArrays(s,0,k.__webGLLineCount)}else if(s instanceof THREE.ParticleSystem)c.drawArrays(c.POINTS,0,k.__webGLParticleCount);else s instanceof THREE.Ribbon&&c.drawArrays(c.TRIANGLE_STRIP,0,k.__webGLVertexCount)}}function h(g,l){if(!g.__webGLVertexBuffer)g.__webGLVertexBuffer=
+c.createBuffer();if(!g.__webGLNormalBuffer)g.__webGLNormalBuffer=c.createBuffer();if(g.hasPos){c.bindBuffer(c.ARRAY_BUFFER,g.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,g.positionArray,c.DYNAMIC_DRAW);c.enableVertexAttribArray(l.attributes.position);c.vertexAttribPointer(l.attributes.position,3,c.FLOAT,!1,0,0)}if(g.hasNormal){c.bindBuffer(c.ARRAY_BUFFER,g.__webGLNormalBuffer);c.bufferData(c.ARRAY_BUFFER,g.normalArray,c.DYNAMIC_DRAW);c.enableVertexAttribArray(l.attributes.normal);c.vertexAttribPointer(l.attributes.normal,
+3,c.FLOAT,!1,0,0)}c.drawArrays(c.TRIANGLES,0,g.count);g.count=0}function j(g){if(Z!=g.doubleSided){g.doubleSided?c.disable(c.CULL_FACE):c.enable(c.CULL_FACE);Z=g.doubleSided}if(R!=g.flipSided){g.flipSided?c.frontFace(c.CW):c.frontFace(c.CCW);R=g.flipSided}}function o(g){if(Ba!=g){g?c.enable(c.DEPTH_TEST):c.disable(c.DEPTH_TEST);Ba=g}}function m(g){xa[0].set(g.n41-g.n11,g.n42-g.n12,g.n43-g.n13,g.n44-g.n14);xa[1].set(g.n41+g.n11,g.n42+g.n12,g.n43+g.n13,g.n44+g.n14);xa[2].set(g.n41+g.n21,g.n42+g.n22,
+g.n43+g.n23,g.n44+g.n24);xa[3].set(g.n41-g.n21,g.n42-g.n22,g.n43-g.n23,g.n44-g.n24);xa[4].set(g.n41-g.n31,g.n42-g.n32,g.n43-g.n33,g.n44-g.n34);xa[5].set(g.n41+g.n31,g.n42+g.n32,g.n43+g.n33,g.n44+g.n34);var l;for(g=0;g<6;g++){l=xa[g];l.divideScalar(Math.sqrt(l.x*l.x+l.y*l.y+l.z*l.z))}}function u(g){for(var l=g.matrixWorld,n=-g.geometry.boundingSphere.radius*Math.max(g.scale.x,Math.max(g.scale.y,g.scale.z)),i=0;i<6;i++){g=xa[i].x*l.n14+xa[i].y*l.n24+xa[i].z*l.n34+xa[i].w;if(g<=n)return!1}return!0}function y(g,
+l){g.list[g.count]=l;g.count+=1}function z(g){var l,n,i=g.object,k=g.opaque,s=g.transparent;s.count=0;g=k.count=0;for(l=i.materials.length;g<l;g++){n=i.materials[g];n.opacity&&n.opacity<1||n.blending!=THREE.NormalBlending?y(s,n):y(k,n)}}function A(g){var l,n,i,k,s=g.object,p=g.buffer,r=g.opaque,E=g.transparent;E.count=0;g=r.count=0;for(i=s.materials.length;g<i;g++){l=s.materials[g];if(l instanceof THREE.MeshFaceMaterial){l=0;for(n=p.materials.length;l<n;l++)(k=p.materials[l])&&(k.opacity&&k.opacity<
+1||k.blending!=THREE.NormalBlending?y(E,k):y(r,k))}else{k=l;k.opacity&&k.opacity<1||k.blending!=THREE.NormalBlending?y(E,k):y(r,k)}}}function x(g,l){return l.z-g.z}function K(g,l){g._modelViewMatrix.multiplyToArray(l.matrixWorldInverse,g.matrixWorld,g._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(g._modelViewMatrix).transposeIntoArray(g._normalMatrixArray)}function J(g){function l(S){var Q=[];n=0;for(i=S.length;n<i;n++)S[n]==undefined?Q.push("undefined"):Q.push(S[n].id);return Q.join("_")}var n,
+i,k,s,p,r,E,F,q={},G=g.morphTargets!==undefined?g.morphTargets.length:0;g.geometryGroups={};k=0;for(s=g.faces.length;k<s;k++){p=g.faces[k];r=p.materials;E=l(r);q[E]==undefined&&(q[E]={hash:E,counter:0});F=q[E].hash+"_"+q[E].counter;g.geometryGroups[F]==undefined&&(g.geometryGroups[F]={faces:[],materials:r,vertices:0,numMorphTargets:G});p=p instanceof THREE.Face3?3:4;if(g.geometryGroups[F].vertices+p>65535){q[E].counter+=1;F=q[E].hash+"_"+q[E].counter;g.geometryGroups[F]==undefined&&(g.geometryGroups[F]=
+{faces:[],materials:r,vertices:0,numMorphTargets:G})}g.geometryGroups[F].faces.push(k);g.geometryGroups[F].vertices+=p}}function H(g,l,n){g.push({buffer:l,object:n,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function w(g){if(g!=N){switch(g){case THREE.AdditiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ONE,c.ONE);break;case THREE.SubtractiveBlending:c.blendFunc(c.DST_COLOR,c.ZERO);break;case THREE.BillboardBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA);
+break;case THREE.ReverseSubtractiveBlending:c.blendEquation(c.FUNC_REVERSE_SUBTRACT);c.blendFunc(c.ONE,c.ONE);break;default:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA)}N=g}}function ga(g,l,n){if((n.width&n.width-1)==0&&(n.height&n.height-1)==0){c.texParameteri(g,c.TEXTURE_WRAP_S,ia(l.wrapS));c.texParameteri(g,c.TEXTURE_WRAP_T,ia(l.wrapT));c.texParameteri(g,c.TEXTURE_MAG_FILTER,ia(l.magFilter));c.texParameteri(g,c.TEXTURE_MIN_FILTER,ia(l.minFilter));c.generateMipmap(g)}else{c.texParameteri(g,
+c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(g,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);c.texParameteri(g,c.TEXTURE_MAG_FILTER,fa(l.magFilter));c.texParameteri(g,c.TEXTURE_MIN_FILTER,fa(l.minFilter))}}function U(g){if(g&&!g.__webGLFramebuffer){g.__webGLFramebuffer=c.createFramebuffer();g.__webGLRenderbuffer=c.createRenderbuffer();g.__webGLTexture=c.createTexture();c.bindRenderbuffer(c.RENDERBUFFER,g.__webGLRenderbuffer);c.renderbufferStorage(c.RENDERBUFFER,c.DEPTH_COMPONENT16,g.width,g.height);c.bindTexture(c.TEXTURE_2D,
+g.__webGLTexture);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,ia(g.wrapS));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,ia(g.wrapT));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,ia(g.magFilter));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,ia(g.minFilter));c.texImage2D(c.TEXTURE_2D,0,ia(g.format),g.width,g.height,0,ia(g.format),ia(g.type),null);c.bindFramebuffer(c.FRAMEBUFFER,g.__webGLFramebuffer);c.framebufferTexture2D(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,c.TEXTURE_2D,g.__webGLTexture,
+0);c.framebufferRenderbuffer(c.FRAMEBUFFER,c.DEPTH_ATTACHMENT,c.RENDERBUFFER,g.__webGLRenderbuffer);c.bindTexture(c.TEXTURE_2D,null);c.bindRenderbuffer(c.RENDERBUFFER,null);c.bindFramebuffer(c.FRAMEBUFFER,null)}var l,n;if(g){l=g.__webGLFramebuffer;n=g.width;g=g.height}else{l=null;n=wa;g=P}if(l!=W){c.bindFramebuffer(c.FRAMEBUFFER,l);c.viewport(L,ka,n,g);W=l}}function ha(g,l){var n;if(g=="fragment")n=c.createShader(c.FRAGMENT_SHADER);else g=="vertex"&&(n=c.createShader(c.VERTEX_SHADER));c.shaderSource(n,
+l);c.compileShader(n);if(!c.getShaderParameter(n,c.COMPILE_STATUS)){alert(c.getShaderInfoLog(n));return null}return n}function fa(g){switch(g){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return c.NEAREST;case THREE.LinearFilter:case THREE.LinearMipMapNearestFilter:case THREE.LinearMipMapLinearFilter:return c.LINEAR}}function ia(g){switch(g){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 ja=document.createElement("canvas"),c,ra=null,pa=null,ya=this,sa=null,ta=null,Ea=null,Fa=null,Aa=0,Ja=0,Ka=0,La=0,ua=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,
-new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Ma=new THREE.Matrix4,Xa=new Float32Array(16),Pa=new Float32Array(16),Ga=new THREE.Vector4,Ya={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}},Za=!0,$a=new THREE.Color(0),ab=0;if(a){if(a.antialias!==undefined)Za=a.antialias;a.clearColor!==undefined&&$a.setHex(a.clearColor);if(a.clearAlpha!==undefined)ab=a.clearAlpha}this.maxMorphTargets=8;this.domElement=ja;this.autoClear=!0;this.sortObjects=
-!0;(function(f,j,k){try{if(!(c=ja.getContext("experimental-webgl",{antialias:f})))throw"Error creating WebGL context.";}catch(h){console.error(h)}c.clearColor(0,0,0,1);c.clearDepth(1);c.enable(c.DEPTH_TEST);c.depthFunc(c.LEQUAL);c.frontFace(c.CCW);c.cullFace(c.BACK);c.enable(c.CULL_FACE);c.enable(c.BLEND);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA);c.clearColor(j.r,j.g,j.b,k);_cullEnabled=!0})(Za,$a,ab);this.context=c;this.setSize=function(f,j){ja.width=f;ja.height=j;this.setViewport(0,0,ja.width,ja.height)};
-this.setViewport=function(f,j,k,h){Aa=f;Ja=j;Ka=k;La=h;c.viewport(Aa,Ja,Ka,La)};this.setScissor=function(f,j,k,h){c.scissor(f,j,k,h)};this.enableScissorTest=function(f){f?c.enable(c.SCISSOR_TEST):c.disable(c.SCISSOR_TEST)};this.enableDepthBufferWrite=function(f){c.depthMask(f)};this.setClearColorHex=function(f,j){var k=new THREE.Color(f);c.clearColor(k.r,k.g,k.b,j)};this.setClearColor=function(f,j){c.clearColor(f.r,f.g,f.b,j)};this.clear=function(){c.clear(c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT)};
-this.initMaterial=function(f,j,k,h){var i,r,n;if(f instanceof THREE.MeshDepthMaterial)d(f,THREE.ShaderLib.depth);else if(f instanceof THREE.MeshNormalMaterial)d(f,THREE.ShaderLib.normal);else if(f instanceof THREE.MeshBasicMaterial)d(f,THREE.ShaderLib.basic);else if(f instanceof THREE.MeshLambertMaterial)d(f,THREE.ShaderLib.lambert);else if(f instanceof THREE.MeshPhongMaterial)d(f,THREE.ShaderLib.phong);else if(f instanceof THREE.LineBasicMaterial)d(f,THREE.ShaderLib.basic);else f instanceof THREE.ParticleBasicMaterial&&
-d(f,THREE.ShaderLib.particle_basic);var q,A,C,p;n=C=p=0;for(q=j.length;n<q;n++){A=j[n];A instanceof THREE.DirectionalLight&&C++;A instanceof THREE.PointLight&&p++}if(p+C<=4)j=C;else{j=Math.ceil(4*C/(p+C));p=4-j}n={directional:j,point:p};q=50;if(h!==undefined&&h instanceof THREE.SkinnedMesh)q=h.bones.length;p=f.fragmentShader;j=f.vertexShader;q={fog:k,map:f.map,envMap:f.envMap,lightMap:f.lightMap,vertexColors:f.vertexColors,sizeAttenuation:f.sizeAttenuation,skinning:f.skinning,morphTargets:f.morphTargets,
-maxDirLights:n.directional,maxPointLights:n.point,maxBones:q};k=c.createProgram();n=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+q.maxDirLights,"#define MAX_POINT_LIGHTS "+q.maxPointLights,q.fog?"#define USE_FOG":"",q.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",q.map?"#define USE_MAP":"",q.envMap?"#define USE_ENVMAP":"",q.lightMap?"#define USE_LIGHTMAP":"",q.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");
-q=[c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+q.maxDirLights,"#define MAX_POINT_LIGHTS "+q.maxPointLights,"#define MAX_BONES "+q.maxBones,q.map?"#define USE_MAP":"",q.envMap?"#define USE_ENVMAP":"",q.lightMap?"#define USE_LIGHTMAP":"",q.vertexColors?"#define USE_COLOR":"",q.skinning?"#define USE_SKINNING":"",q.morphTargets?"#define USE_MORPHTARGETS":"",q.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 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n");
-c.attachShader(k,ia("fragment",n+p));c.attachShader(k,ia("vertex",q+j));c.linkProgram(k);c.getProgramParameter(k,c.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+c.getProgramParameter(k,c.VALIDATE_STATUS)+", gl error ["+c.getError()+"]");k.uniforms={};k.attributes={};f.program=k;k=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(i in f.uniforms)k.push(i);
-i=f.program;p=0;for(j=k.length;p<j;p++){n=k[p];i.uniforms[n]=c.getUniformLocation(i,n)}k=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(i=0;i<this.maxMorphTargets;i++)k.push("morphTarget"+i);for(r in f.attributes)k.push(r);r=f.program;i=k;k=0;for(p=i.length;k<p;k++){j=i[k];r.attributes[j]=c.getAttribLocation(r,j)}r=f.program.attributes;c.enableVertexAttribArray(r.position);r.color>=0&&c.enableVertexAttribArray(r.color);r.normal>=0&&c.enableVertexAttribArray(r.normal);
-r.tangent>=0&&c.enableVertexAttribArray(r.tangent);if(f.skinning&&r.skinVertexA>=0&&r.skinVertexB>=0&&r.skinIndex>=0&&r.skinWeight>=0){c.enableVertexAttribArray(r.skinVertexA);c.enableVertexAttribArray(r.skinVertexB);c.enableVertexAttribArray(r.skinIndex);c.enableVertexAttribArray(r.skinWeight)}if(f.morphTargets){f.numSupportedMorphTargets=0;if(r.morphTarget0>=0){c.enableVertexAttribArray(r.morphTarget0);f.numSupportedMorphTargets++}if(r.morphTarget1>=0){c.enableVertexAttribArray(r.morphTarget1);
-f.numSupportedMorphTargets++}if(r.morphTarget2>=0){c.enableVertexAttribArray(r.morphTarget2);f.numSupportedMorphTargets++}if(r.morphTarget3>=0){c.enableVertexAttribArray(r.morphTarget3);f.numSupportedMorphTargets++}if(r.morphTarget4>=0){c.enableVertexAttribArray(r.morphTarget4);f.numSupportedMorphTargets++}if(r.morphTarget5>=0){c.enableVertexAttribArray(r.morphTarget5);f.numSupportedMorphTargets++}if(r.morphTarget6>=0){c.enableVertexAttribArray(r.morphTarget6);f.numSupportedMorphTargets++}if(r.morphTarget7>=
-0){c.enableVertexAttribArray(r.morphTarget7);f.numSupportedMorphTargets++}h.__webGLMorphTargetInfluences=new Float32Array(this.maxMorphTargets);for(i=0;i<this.maxMorphTargets;i++)h.__webGLMorphTargetInfluences[i]=0}};this.render=function(f,j,k,h){var i,r,n,q,A,C,p,F,N=f.lights,K=f.fog;j.matrixAutoUpdate&&j.updateMatrix();f.update(undefined,!1,j);j.matrixWorldInverse.flattenToArray(Pa);j.projectionMatrix.flattenToArray(Xa);Ma.multiply(j.projectionMatrix,j.matrixWorldInverse);o(Ma);this.initWebGLObjects(f);
-$(k);(this.autoClear||h)&&this.clear();A=f.__webglObjects.length;for(h=0;h<A;h++){i=f.__webglObjects[h];p=i.object;if(p.visible)if(!(p instanceof THREE.Mesh)||v(p)){p.matrixWorld.flattenToArray(p._objectMatrixArray);H(p,j);D(i);i.render=!0;if(this.sortObjects){Ga.copy(p.position);Ma.multiplyVector3(Ga);i.z=Ga.z}}else i.render=!1;else i.render=!1}this.sortObjects&&f.__webglObjects.sort(E);C=f.__webglObjectsImmediate.length;for(h=0;h<C;h++){i=f.__webglObjectsImmediate[h];p=i.object;if(p.visible){p.matrixAutoUpdate&&
-p.matrixWorld.flattenToArray(p._objectMatrixArray);H(p,j);z(i)}}M(THREE.NormalBlending);for(h=0;h<A;h++){i=f.__webglObjects[h];if(i.render){p=i.object;F=i.buffer;n=i.opaque;m(p);for(i=0;i<n.count;i++){q=n.list[i];s(q.depthTest);g(j,N,K,q,F,p)}}}for(h=0;h<C;h++){i=f.__webglObjectsImmediate[h];p=i.object;if(p.visible){n=i.opaque;m(p);for(i=0;i<n.count;i++){q=n.list[i];s(q.depthTest);r=e(j,N,K,q,p);p.render(function(J){l(J,r)})}}}for(h=0;h<A;h++){i=f.__webglObjects[h];if(i.render){p=i.object;F=i.buffer;
-n=i.transparent;m(p);for(i=0;i<n.count;i++){q=n.list[i];M(q.blending);s(q.depthTest);g(j,N,K,q,F,p)}}}for(h=0;h<C;h++){i=f.__webglObjectsImmediate[h];p=i.object;if(p.visible){n=i.transparent;m(p);for(i=0;i<n.count;i++){q=n.list[i];M(q.blending);s(q.depthTest);r=e(j,N,K,q,p);p.render(function(J){l(J,r)})}}}if(k&&k.minFilter!==THREE.NearestFilter&&k.minFilter!==THREE.LinearFilter){c.bindTexture(c.TEXTURE_2D,k.__webGLTexture);c.generateMipmap(c.TEXTURE_2D);c.bindTexture(c.TEXTURE_2D,null)}};this.initWebGLObjects=
-function(f){if(!f.__webglObjects){f.__webglObjects=[];f.__webglObjectsImmediate=[]}for(;f.__objectsAdded.length;){var j=f.__objectsAdded[0],k=f,h=void 0,i=void 0,r=void 0;if(j._modelViewMatrix==undefined){j._modelViewMatrix=new THREE.Matrix4;j._normalMatrixArray=new Float32Array(9);j._modelViewMatrixArray=new Float32Array(16);j._objectMatrixArray=new Float32Array(16);j.matrixWorld.flattenToArray(j._objectMatrixArray)}if(j instanceof THREE.Mesh){i=j.geometry;i.geometryGroups==undefined&&I(i);for(h in i.geometryGroups){r=
-i.geometryGroups[h];if(!r.__webGLVertexBuffer){var n=r;n.__webGLVertexBuffer=c.createBuffer();n.__webGLNormalBuffer=c.createBuffer();n.__webGLTangentBuffer=c.createBuffer();n.__webGLColorBuffer=c.createBuffer();n.__webGLUVBuffer=c.createBuffer();n.__webGLUV2Buffer=c.createBuffer();n.__webGLSkinVertexABuffer=c.createBuffer();n.__webGLSkinVertexBBuffer=c.createBuffer();n.__webGLSkinIndicesBuffer=c.createBuffer();n.__webGLSkinWeightsBuffer=c.createBuffer();n.__webGLFaceBuffer=c.createBuffer();n.__webGLLineBuffer=
-c.createBuffer();if(n.numMorphTargets){var q=void 0,A=void 0;n.__webGLMorphTargetsBuffers=[];q=0;for(A=n.numMorphTargets;q<A;q++)n.__webGLMorphTargetsBuffers.push(c.createBuffer())}n=r;var C=j,p=void 0,F=void 0,N=A=q=0,K=C.geometry.faces,J=n.faces;p=0;for(F=J.length;p<F;p++){fi=J[p];face=K[fi];if(face instanceof THREE.Face3){q+=3;A+=1;N+=3}else if(face instanceof THREE.Face4){q+=4;A+=2;N+=4}}n.__vertexArray=new Float32Array(q*3);n.__normalArray=new Float32Array(q*3);n.__tangentArray=new Float32Array(q*
-4);n.__colorArray=new Float32Array(q*3);n.__uvArray=new Float32Array(q*2);n.__uv2Array=new Float32Array(q*2);n.__skinVertexAArray=new Float32Array(q*4);n.__skinVertexBArray=new Float32Array(q*4);n.__skinIndexArray=new Float32Array(q*4);n.__skinWeightArray=new Float32Array(q*4);n.__faceArray=new Uint16Array(A*3);n.__lineArray=new Uint16Array(N*2);F=p=n;K=void 0;J=void 0;var G=void 0,P=void 0;G=void 0;var Q=!1;K=0;for(J=C.materials.length;K<J;K++){G=C.materials[K];if(G instanceof THREE.MeshFaceMaterial){G=
-0;for(P=F.materials.length;G<P;G++)if(F.materials[G]&&F.materials[G].shading!=undefined&&F.materials[G].shading==THREE.SmoothShading){Q=!0;break}}else if(G&&G.shading!=undefined&&G.shading==THREE.SmoothShading){Q=!0;break}if(Q)break}p.__needsSmoothNormals=Q;n.__webGLFaceCount=A*3;n.__webGLLineCount=N*2;if(n.numMorphTargets){A=void 0;N=void 0;n.__morphTargetsArrays=[];A=0;for(N=n.numMorphTargets;A<N;A++)n.__morphTargetsArrays.push(new Float32Array(q*3))}i.__dirtyVertices=!0;i.__dirtyMorphTargets=!0;
-i.__dirtyElements=!0;i.__dirtyUvs=!0;i.__dirtyNormals=!0;i.__dirtyTangents=!0;i.__dirtyColors=!0}L(k.__webglObjects,r,j)}}else if(j instanceof THREE.Ribbon){i=j.geometry;if(!i.__webGLVertexBuffer){h=i;h.__webGLVertexBuffer=c.createBuffer();h.__webGLColorBuffer=c.createBuffer();h=i;r=h.vertices.length;h.__vertexArray=new Float32Array(r*3);h.__colorArray=new Float32Array(r*3);h.__webGLVertexCount=r;i.__dirtyVertices=!0;i.__dirtyColors=!0}L(k.__webglObjects,i,j)}else if(j instanceof THREE.Line){i=j.geometry;
-if(!i.__webGLVertexBuffer){h=i;h.__webGLVertexBuffer=c.createBuffer();h.__webGLColorBuffer=c.createBuffer();h=i;r=h.vertices.length;h.__vertexArray=new Float32Array(r*3);h.__colorArray=new Float32Array(r*3);h.__webGLLineCount=r;i.__dirtyVertices=!0;i.__dirtyColors=!0}L(k.__webglObjects,i,j)}else if(j instanceof THREE.ParticleSystem){i=j.geometry;if(!i.__webGLVertexBuffer){h=i;h.__webGLVertexBuffer=c.createBuffer();h.__webGLColorBuffer=c.createBuffer();h=i;r=h.vertices.length;h.__vertexArray=new Float32Array(r*
-3);h.__colorArray=new Float32Array(r*3);h.__sortArray=[];h.__webGLParticleCount=r;i.__dirtyVertices=!0;i.__dirtyColors=!0}L(k.__webglObjects,i,j)}else THREE.MarchingCubes!==undefined&&j instanceof THREE.MarchingCubes&&k.__webglObjectsImmediate.push({object:j,opaque:{list:[],count:0},transparent:{list:[],count:0}});f.__objectsAdded.splice(0,1)}for(;f.__objectsRemoved.length;){j=f.__objectsRemoved[0];k=f;i=void 0;h=void 0;for(i=k.__webglObjects.length-1;i>=0;i--){h=k.__webglObjects[i].object;j==h&&
-k.__webglObjects.splice(i,1)}f.__objectsRemoved.splice(0,1)}j=0;for(k=f.__webglObjects.length;j<k;j++){h=f.__webglObjects[j].object;r=void 0;i=void 0;n=void 0;if(h instanceof THREE.Mesh){i=h.geometry;for(r in i.geometryGroups){n=i.geometryGroups[r];if(i.__dirtyVertices||i.__dirtyMorphTargets||i.__dirtyElements||i.__dirtyUvs||i.__dirtyNormals||i.__dirtyColors||i.__dirtyTangents){q=c.DYNAMIC_DRAW;A=void 0;N=void 0;var na=void 0,u=void 0,la=void 0,fa=void 0,ka=void 0;na=void 0;var w=void 0,x=void 0,
-y=void 0,O=void 0;w=void 0;x=void 0;y=void 0;u=void 0;w=void 0;x=void 0;y=void 0;O=void 0;w=void 0;x=void 0;y=void 0;O=void 0;w=void 0;x=void 0;y=void 0;O=void 0;w=void 0;x=void 0;y=void 0;O=void 0;w=void 0;x=void 0;y=void 0;O=void 0;u=void 0;fa=void 0;la=void 0;ka=void 0;var ga=void 0,Ha=void 0,X=void 0,Y=P=G=Q=J=K=C=F=p=0,t=0,Z=0,ca=n.__vertexArray,Na=n.__uvArray,Oa=n.__uv2Array,qa=n.__normalArray,R=n.__tangentArray,da=n.__colorArray,S=n.__skinVertexAArray,T=n.__skinVertexBArray,U=n.__skinIndexArray,
-V=n.__skinWeightArray,Qa=n.__morphTargetsArrays,va=n.__faceArray,ma=n.__lineArray,bb=n.__needsSmoothNormals,ha=h.geometry,Ra=ha.__dirtyVertices,Sa=ha.__dirtyElements,Ia=ha.__dirtyUvs,Ta=ha.__dirtyNormals,Ua=ha.__dirtyTangents,Va=ha.__dirtyColors,Wa=ha.__dirtyMorphTargets,oa=ha.vertices,cb=n.faces,db=ha.faces,eb=ha.uvs,fb=ha.uvs2,wa=ha.colors,Ba=ha.skinVerticesA,Ca=ha.skinVerticesB,Da=ha.skinIndices,za=ha.skinWeights,xa=ha.morphTargets;A=0;for(N=cb.length;A<N;A++){na=cb[A];u=db[na];ka=eb[na];na=fb[na];
-la=u.vertexNormals;fa=u.normal;if(u instanceof THREE.Face3){if(Ra){w=oa[u.a].position;x=oa[u.b].position;y=oa[u.c].position;ca[F]=w.x;ca[F+1]=w.y;ca[F+2]=w.z;ca[F+3]=x.x;ca[F+4]=x.y;ca[F+5]=x.z;ca[F+6]=y.x;ca[F+7]=y.y;ca[F+8]=y.z;F+=9}if(Wa){ga=0;for(Ha=xa.length;ga<Ha;ga++){w=xa[ga].vertices[u.a].position;x=xa[ga].vertices[u.b].position;y=xa[ga].vertices[u.c].position;X=Qa[ga];X[Z+0]=w.x;X[Z+1]=w.y;X[Z+2]=w.z;X[Z+3]=x.x;X[Z+4]=x.y;X[Z+5]=x.z;X[Z+6]=y.x;X[Z+7]=y.y;X[Z+8]=y.z}Z+=9}if(za.length){w=
-za[u.a];x=za[u.b];y=za[u.c];V[t]=w.x;V[t+1]=w.y;V[t+2]=w.z;V[t+3]=w.w;V[t+4]=x.x;V[t+5]=x.y;V[t+6]=x.z;V[t+7]=x.w;V[t+8]=y.x;V[t+9]=y.y;V[t+10]=y.z;V[t+11]=y.w;w=Da[u.a];x=Da[u.b];y=Da[u.c];U[t]=w.x;U[t+1]=w.y;U[t+2]=w.z;U[t+3]=w.w;U[t+4]=x.x;U[t+5]=x.y;U[t+6]=x.z;U[t+7]=x.w;U[t+8]=y.x;U[t+9]=y.y;U[t+10]=y.z;U[t+11]=y.w;w=Ba[u.a];x=Ba[u.b];y=Ba[u.c];S[t]=w.x;S[t+1]=w.y;S[t+2]=w.z;S[t+3]=1;S[t+4]=x.x;S[t+5]=x.y;S[t+6]=x.z;S[t+7]=1;S[t+8]=y.x;S[t+9]=y.y;S[t+10]=y.z;S[t+11]=1;w=Ca[u.a];x=Ca[u.b];y=Ca[u.c];
-T[t]=w.x;T[t+1]=w.y;T[t+2]=w.z;T[t+3]=1;T[t+4]=x.x;T[t+5]=x.y;T[t+6]=x.z;T[t+7]=1;T[t+8]=y.x;T[t+9]=y.y;T[t+10]=y.z;T[t+11]=1;t+=12}if(Va&&wa.length){w=wa[u.a];x=wa[u.b];y=wa[u.c];da[Y]=w.r;da[Y+1]=w.g;da[Y+2]=w.b;da[Y+3]=x.r;da[Y+4]=x.g;da[Y+5]=x.b;da[Y+6]=y.r;da[Y+7]=y.g;da[Y+8]=y.b;Y+=9}if(Ua&&ha.hasTangents){w=oa[u.a].tangent;x=oa[u.b].tangent;y=oa[u.c].tangent;R[G]=w.x;R[G+1]=w.y;R[G+2]=w.z;R[G+3]=w.w;R[G+4]=x.x;R[G+5]=x.y;R[G+6]=x.z;R[G+7]=x.w;R[G+8]=y.x;R[G+9]=y.y;R[G+10]=y.z;R[G+11]=y.w;G+=
-12}if(Ta)if(la.length==3&&bb)for(u=0;u<3;u++){fa=la[u];qa[Q]=fa.x;qa[Q+1]=fa.y;qa[Q+2]=fa.z;Q+=3}else for(u=0;u<3;u++){qa[Q]=fa.x;qa[Q+1]=fa.y;qa[Q+2]=fa.z;Q+=3}if(Ia&&ka)for(u=0;u<3;u++){la=ka[u];Na[C]=la.u;Na[C+1]=la.v;C+=2}if(Ia&&na)for(u=0;u<3;u++){ka=na[u];Oa[K]=ka.u;Oa[K+1]=ka.v;K+=2}if(Sa){va[J]=p;va[J+1]=p+1;va[J+2]=p+2;J+=3;ma[P]=p;ma[P+1]=p+1;ma[P+2]=p;ma[P+3]=p+2;ma[P+4]=p+1;ma[P+5]=p+2;P+=6;p+=3}}else if(u instanceof THREE.Face4){if(Ra){w=oa[u.a].position;x=oa[u.b].position;y=oa[u.c].position;
-O=oa[u.d].position;ca[F]=w.x;ca[F+1]=w.y;ca[F+2]=w.z;ca[F+3]=x.x;ca[F+4]=x.y;ca[F+5]=x.z;ca[F+6]=y.x;ca[F+7]=y.y;ca[F+8]=y.z;ca[F+9]=O.x;ca[F+10]=O.y;ca[F+11]=O.z;F+=12}if(Wa){ga=0;for(Ha=xa.length;ga<Ha;ga++){w=xa[ga].vertices[u.a].position;x=xa[ga].vertices[u.b].position;y=xa[ga].vertices[u.c].position;O=xa[ga].vertices[u.d].position;X=Qa[ga];X[Z+0]=w.x;X[Z+1]=w.y;X[Z+2]=w.z;X[Z+3]=x.x;X[Z+4]=x.y;X[Z+5]=x.z;X[Z+6]=y.x;X[Z+7]=y.y;X[Z+8]=y.z;X[Z+9]=O.x;X[Z+10]=O.y;X[Z+11]=O.z}Z+=12}if(za.length){w=
-za[u.a];x=za[u.b];y=za[u.c];O=za[u.d];V[t]=w.x;V[t+1]=w.y;V[t+2]=w.z;V[t+3]=w.w;V[t+4]=x.x;V[t+5]=x.y;V[t+6]=x.z;V[t+7]=x.w;V[t+8]=y.x;V[t+9]=y.y;V[t+10]=y.z;V[t+11]=y.w;V[t+12]=O.x;V[t+13]=O.y;V[t+14]=O.z;V[t+15]=O.w;w=Da[u.a];x=Da[u.b];y=Da[u.c];O=Da[u.d];U[t]=w.x;U[t+1]=w.y;U[t+2]=w.z;U[t+3]=w.w;U[t+4]=x.x;U[t+5]=x.y;U[t+6]=x.z;U[t+7]=x.w;U[t+8]=y.x;U[t+9]=y.y;U[t+10]=y.z;U[t+11]=y.w;U[t+12]=O.x;U[t+13]=O.y;U[t+14]=O.z;U[t+15]=O.w;w=Ba[u.a];x=Ba[u.b];y=Ba[u.c];O=Ba[u.d];S[t]=w.x;S[t+1]=w.y;S[t+
-2]=w.z;S[t+3]=1;S[t+4]=x.x;S[t+5]=x.y;S[t+6]=x.z;S[t+7]=1;S[t+8]=y.x;S[t+9]=y.y;S[t+10]=y.z;S[t+11]=1;S[t+12]=O.x;S[t+13]=O.y;S[t+14]=O.z;S[t+15]=1;w=Ca[u.a];x=Ca[u.b];y=Ca[u.c];O=Ca[u.d];T[t]=w.x;T[t+1]=w.y;T[t+2]=w.z;T[t+3]=1;T[t+4]=x.x;T[t+5]=x.y;T[t+6]=x.z;T[t+7]=1;T[t+8]=y.x;T[t+9]=y.y;T[t+10]=y.z;T[t+11]=1;T[t+12]=O.x;T[t+13]=O.y;T[t+14]=O.z;T[t+15]=1;t+=16}if(Va&&wa.length){w=wa[u.a];x=wa[u.b];y=wa[u.c];O=wa[u.d];da[Y]=w.r;da[Y+1]=w.g;da[Y+2]=w.b;da[Y+3]=x.r;da[Y+4]=x.g;da[Y+5]=x.b;da[Y+6]=
-y.r;da[Y+7]=y.g;da[Y+8]=y.b;da[Y+9]=O.r;da[Y+10]=O.g;da[Y+11]=O.b;Y+=12}if(Ua&&ha.hasTangents){w=oa[u.a].tangent;x=oa[u.b].tangent;y=oa[u.c].tangent;u=oa[u.d].tangent;R[G]=w.x;R[G+1]=w.y;R[G+2]=w.z;R[G+3]=w.w;R[G+4]=x.x;R[G+5]=x.y;R[G+6]=x.z;R[G+7]=x.w;R[G+8]=y.x;R[G+9]=y.y;R[G+10]=y.z;R[G+11]=y.w;R[G+12]=u.x;R[G+13]=u.y;R[G+14]=u.z;R[G+15]=u.w;G+=16}if(Ta)if(la.length==4&&bb)for(u=0;u<4;u++){fa=la[u];qa[Q]=fa.x;qa[Q+1]=fa.y;qa[Q+2]=fa.z;Q+=3}else for(u=0;u<4;u++){qa[Q]=fa.x;qa[Q+1]=fa.y;qa[Q+2]=
-fa.z;Q+=3}if(Ia&&ka)for(u=0;u<4;u++){la=ka[u];Na[C]=la.u;Na[C+1]=la.v;C+=2}if(Ia&&na)for(u=0;u<4;u++){ka=na[u];Oa[K]=ka.u;Oa[K+1]=ka.v;K+=2}if(Sa){va[J]=p;va[J+1]=p+1;va[J+2]=p+2;va[J+3]=p;va[J+4]=p+2;va[J+5]=p+3;J+=6;ma[P]=p;ma[P+1]=p+1;ma[P+2]=p;ma[P+3]=p+3;ma[P+4]=p+1;ma[P+5]=p+2;ma[P+6]=p+2;ma[P+7]=p+3;P+=8;p+=4}}}if(Ra){c.bindBuffer(c.ARRAY_BUFFER,n.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,ca,q)}if(Wa){ga=0;for(Ha=xa.length;ga<Ha;ga++){c.bindBuffer(c.ARRAY_BUFFER,n.__webGLMorphTargetsBuffers[ga]);
-c.bufferData(c.ARRAY_BUFFER,Qa[ga],q)}}if(Va&&wa.length){c.bindBuffer(c.ARRAY_BUFFER,n.__webGLColorBuffer);c.bufferData(c.ARRAY_BUFFER,da,q)}if(Ta){c.bindBuffer(c.ARRAY_BUFFER,n.__webGLNormalBuffer);c.bufferData(c.ARRAY_BUFFER,qa,q)}if(Ua&&ha.hasTangents){c.bindBuffer(c.ARRAY_BUFFER,n.__webGLTangentBuffer);c.bufferData(c.ARRAY_BUFFER,R,q)}if(Ia&&C>0){c.bindBuffer(c.ARRAY_BUFFER,n.__webGLUVBuffer);c.bufferData(c.ARRAY_BUFFER,Na,q)}if(Ia&&K>0){c.bindBuffer(c.ARRAY_BUFFER,n.__webGLUV2Buffer);c.bufferData(c.ARRAY_BUFFER,
-Oa,q)}if(Sa){c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,n.__webGLFaceBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,va,q);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,n.__webGLLineBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,ma,q)}if(t>0){c.bindBuffer(c.ARRAY_BUFFER,n.__webGLSkinVertexABuffer);c.bufferData(c.ARRAY_BUFFER,S,q);c.bindBuffer(c.ARRAY_BUFFER,n.__webGLSkinVertexBBuffer);c.bufferData(c.ARRAY_BUFFER,T,q);c.bindBuffer(c.ARRAY_BUFFER,n.__webGLSkinIndicesBuffer);c.bufferData(c.ARRAY_BUFFER,U,q);c.bindBuffer(c.ARRAY_BUFFER,
-n.__webGLSkinWeightsBuffer);c.bufferData(c.ARRAY_BUFFER,V,q)}}}i.__dirtyVertices=!1;i.__dirtyMorphTargets=!1;i.__dirtyElements=!1;i.__dirtyUvs=!1;i.__dirtyNormals=!1;i.__dirtyTangents=!1;i.__dirtyColors=!1}else if(h instanceof THREE.Ribbon){i=h.geometry;if(i.__dirtyVertices||i.__dirtyColors){h=i;r=c.DYNAMIC_DRAW;p=void 0;p=void 0;F=void 0;n=void 0;C=h.vertices;q=h.colors;K=C.length;A=q.length;J=h.__vertexArray;N=h.__colorArray;Q=h.__dirtyColors;if(h.__dirtyVertices){for(p=0;p<K;p++){F=C[p].position;
-n=p*3;J[n]=F.x;J[n+1]=F.y;J[n+2]=F.z}c.bindBuffer(c.ARRAY_BUFFER,h.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,J,r)}if(Q){for(p=0;p<A;p++){color=q[p];n=p*3;N[n]=color.r;N[n+1]=color.g;N[n+2]=color.b}c.bindBuffer(c.ARRAY_BUFFER,h.__webGLColorBuffer);c.bufferData(c.ARRAY_BUFFER,N,r)}}i.__dirtyVertices=!1;i.__dirtyColors=!1}else if(h instanceof THREE.Line){i=h.geometry;if(i.__dirtyVertices||i.__dirtyColors){h=i;r=c.DYNAMIC_DRAW;p=void 0;p=void 0;F=void 0;n=void 0;C=h.vertices;q=h.colors;K=C.length;
-A=q.length;J=h.__vertexArray;N=h.__colorArray;Q=h.__dirtyColors;if(h.__dirtyVertices){for(p=0;p<K;p++){F=C[p].position;n=p*3;J[n]=F.x;J[n+1]=F.y;J[n+2]=F.z}c.bindBuffer(c.ARRAY_BUFFER,h.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,J,r)}if(Q){for(p=0;p<A;p++){color=q[p];n=p*3;N[n]=color.r;N[n+1]=color.g;N[n+2]=color.b}c.bindBuffer(c.ARRAY_BUFFER,h.__webGLColorBuffer);c.bufferData(c.ARRAY_BUFFER,N,r)}}i.__dirtyVertices=!1;i.__dirtyColors=!1}else if(h instanceof THREE.ParticleSystem){i=h.geometry;
-(i.__dirtyVertices||i.__dirtyColors||h.sortParticles)&&b(i,c.DYNAMIC_DRAW,h);i.__dirtyVertices=!1;i.__dirtyColors=!1}}};this.setFaceCulling=function(f,j){if(f){!j||j=="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}};
+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 M=document.createElement("canvas"),c,ja=null,W=null,la=this,Z=null,R=null,N=null,Ba=null,L=0,ka=0,wa=0,P=0,xa=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,
+new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Ha=new THREE.Matrix4,Na=new Float32Array(16),Ma=new Float32Array(16),Fa=new THREE.Vector4,va={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}},V=!0,sa=new THREE.Color(0),za=0;if(a){if(a.antialias!==undefined)V=a.antialias;a.clearColor!==undefined&&sa.setHex(a.clearColor);if(a.clearAlpha!==undefined)za=a.clearAlpha}this.maxMorphTargets=8;this.domElement=M;this.autoClear=!0;this.sortObjects=
+!0;(function(g,l,n){try{if(!(c=M.getContext("experimental-webgl",{antialias:g})))throw"Error creating WebGL context.";}catch(i){console.error(i)}c.clearColor(0,0,0,1);c.clearDepth(1);c.enable(c.DEPTH_TEST);c.depthFunc(c.LEQUAL);c.frontFace(c.CCW);c.cullFace(c.BACK);c.enable(c.CULL_FACE);c.enable(c.BLEND);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA);c.clearColor(l.r,l.g,l.b,n);_cullEnabled=!0})(V,sa,za);this.context=c;this.setSize=function(g,l){M.width=g;M.height=l;this.setViewport(0,0,M.width,M.height)};
+this.setViewport=function(g,l,n,i){L=g;ka=l;wa=n;P=i;c.viewport(L,ka,wa,P)};this.setScissor=function(g,l,n,i){c.scissor(g,l,n,i)};this.enableScissorTest=function(g){g?c.enable(c.SCISSOR_TEST):c.disable(c.SCISSOR_TEST)};this.enableDepthBufferWrite=function(g){c.depthMask(g)};this.setClearColorHex=function(g,l){var n=new THREE.Color(g);c.clearColor(n.r,n.g,n.b,l)};this.setClearColor=function(g,l){c.clearColor(g.r,g.g,g.b,l)};this.clear=function(){c.clear(c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT)};this.initMaterial=
+function(g,l,n,i){var k,s,p;if(g instanceof THREE.MeshDepthMaterial)d(g,THREE.ShaderLib.depth);else if(g instanceof THREE.MeshNormalMaterial)d(g,THREE.ShaderLib.normal);else if(g instanceof THREE.MeshBasicMaterial)d(g,THREE.ShaderLib.basic);else if(g instanceof THREE.MeshLambertMaterial)d(g,THREE.ShaderLib.lambert);else if(g instanceof THREE.MeshPhongMaterial)d(g,THREE.ShaderLib.phong);else if(g instanceof THREE.LineBasicMaterial)d(g,THREE.ShaderLib.basic);else g instanceof THREE.ParticleBasicMaterial&&
+d(g,THREE.ShaderLib.particle_basic);var r,E,F,q;p=F=q=0;for(r=l.length;p<r;p++){E=l[p];E instanceof THREE.DirectionalLight&&F++;E instanceof THREE.PointLight&&q++}if(q+F<=4)l=F;else{l=Math.ceil(4*F/(q+F));q=4-l}p={directional:l,point:q};r=50;if(i!==undefined&&i instanceof THREE.SkinnedMesh)r=i.bones.length;q=g.fragmentShader;l=g.vertexShader;r={fog:n,map:g.map,envMap:g.envMap,lightMap:g.lightMap,vertexColors:g.vertexColors,sizeAttenuation:g.sizeAttenuation,skinning:g.skinning,morphTargets:g.morphTargets,
+maxDirLights:p.directional,maxPointLights:p.point,maxBones:r};n=c.createProgram();p=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+r.maxDirLights,"#define MAX_POINT_LIGHTS "+r.maxPointLights,r.fog?"#define USE_FOG":"",r.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",r.map?"#define USE_MAP":"",r.envMap?"#define USE_ENVMAP":"",r.lightMap?"#define USE_LIGHTMAP":"",r.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");
+r=[c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+r.maxDirLights,"#define MAX_POINT_LIGHTS "+r.maxPointLights,"#define MAX_BONES "+r.maxBones,r.map?"#define USE_MAP":"",r.envMap?"#define USE_ENVMAP":"",r.lightMap?"#define USE_LIGHTMAP":"",r.vertexColors?"#define USE_COLOR":"",r.skinning?"#define USE_SKINNING":"",r.morphTargets?"#define USE_MORPHTARGETS":"",r.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n");
+c.attachShader(n,ha("fragment",p+q));c.attachShader(n,ha("vertex",r+l));c.linkProgram(n);c.getProgramParameter(n,c.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+c.getProgramParameter(n,c.VALIDATE_STATUS)+", gl error ["+c.getError()+"]");n.uniforms={};n.attributes={};g.program=n;n=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(k in g.uniforms)n.push(k);
+k=g.program;q=0;for(l=n.length;q<l;q++){p=n[q];k.uniforms[p]=c.getUniformLocation(k,p)}n=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(k=0;k<this.maxMorphTargets;k++)n.push("morphTarget"+k);for(s in g.attributes)n.push(s);s=g.program;k=n;n=0;for(q=k.length;n<q;n++){l=k[n];s.attributes[l]=c.getAttribLocation(s,l)}s=g.program.attributes;c.enableVertexAttribArray(s.position);s.color>=0&&c.enableVertexAttribArray(s.color);s.normal>=0&&c.enableVertexAttribArray(s.normal);
+s.tangent>=0&&c.enableVertexAttribArray(s.tangent);if(g.skinning&&s.skinVertexA>=0&&s.skinVertexB>=0&&s.skinIndex>=0&&s.skinWeight>=0){c.enableVertexAttribArray(s.skinVertexA);c.enableVertexAttribArray(s.skinVertexB);c.enableVertexAttribArray(s.skinIndex);c.enableVertexAttribArray(s.skinWeight)}if(g.morphTargets){g.numSupportedMorphTargets=0;if(s.morphTarget0>=0){c.enableVertexAttribArray(s.morphTarget0);g.numSupportedMorphTargets++}if(s.morphTarget1>=0){c.enableVertexAttribArray(s.morphTarget1);
+g.numSupportedMorphTargets++}if(s.morphTarget2>=0){c.enableVertexAttribArray(s.morphTarget2);g.numSupportedMorphTargets++}if(s.morphTarget3>=0){c.enableVertexAttribArray(s.morphTarget3);g.numSupportedMorphTargets++}if(s.morphTarget4>=0){c.enableVertexAttribArray(s.morphTarget4);g.numSupportedMorphTargets++}if(s.morphTarget5>=0){c.enableVertexAttribArray(s.morphTarget5);g.numSupportedMorphTargets++}if(s.morphTarget6>=0){c.enableVertexAttribArray(s.morphTarget6);g.numSupportedMorphTargets++}if(s.morphTarget7>=
+0){c.enableVertexAttribArray(s.morphTarget7);g.numSupportedMorphTargets++}i.__webGLMorphTargetInfluences=new Float32Array(this.maxMorphTargets);for(k=0;k<this.maxMorphTargets;k++)i.__webGLMorphTargetInfluences[k]=0}};this.render=function(g,l,n,i){var k,s,p,r,E,F,q,G,S=g.lights,Q=g.fog;l.matrixAutoUpdate&&l.updateMatrix();g.update(undefined,!1,l);l.matrixWorldInverse.flattenToArray(Ma);l.projectionMatrix.flattenToArray(Na);Ha.multiply(l.projectionMatrix,l.matrixWorldInverse);m(Ha);this.initWebGLObjects(g);
+U(n);(this.autoClear||i)&&this.clear();E=g.__webglObjects.length;for(i=0;i<E;i++){k=g.__webglObjects[i];q=k.object;if(q.visible)if(!(q instanceof THREE.Mesh)||u(q)){q.matrixWorld.flattenToArray(q._objectMatrixArray);K(q,l);A(k);k.render=!0;if(this.sortObjects){Fa.copy(q.position);Ha.multiplyVector3(Fa);k.z=Fa.z}}else k.render=!1;else k.render=!1}this.sortObjects&&g.__webglObjects.sort(x);F=g.__webglObjectsImmediate.length;for(i=0;i<F;i++){k=g.__webglObjectsImmediate[i];q=k.object;if(q.visible){q.matrixAutoUpdate&&
+q.matrixWorld.flattenToArray(q._objectMatrixArray);K(q,l);z(k)}}w(THREE.NormalBlending);for(i=0;i<E;i++){k=g.__webglObjects[i];if(k.render){q=k.object;G=k.buffer;p=k.opaque;j(q);for(k=0;k<p.count;k++){r=p.list[k];o(r.depthTest);f(l,S,Q,r,G,q)}}}for(i=0;i<F;i++){k=g.__webglObjectsImmediate[i];q=k.object;if(q.visible){p=k.opaque;j(q);for(k=0;k<p.count;k++){r=p.list[k];o(r.depthTest);s=e(l,S,Q,r,q);q.render(function(O){h(O,s)})}}}for(i=0;i<E;i++){k=g.__webglObjects[i];if(k.render){q=k.object;G=k.buffer;
+p=k.transparent;j(q);for(k=0;k<p.count;k++){r=p.list[k];w(r.blending);o(r.depthTest);f(l,S,Q,r,G,q)}}}for(i=0;i<F;i++){k=g.__webglObjectsImmediate[i];q=k.object;if(q.visible){p=k.transparent;j(q);for(k=0;k<p.count;k++){r=p.list[k];w(r.blending);o(r.depthTest);s=e(l,S,Q,r,q);q.render(function(O){h(O,s)})}}}if(n&&n.minFilter!==THREE.NearestFilter&&n.minFilter!==THREE.LinearFilter){c.bindTexture(c.TEXTURE_2D,n.__webGLTexture);c.generateMipmap(c.TEXTURE_2D);c.bindTexture(c.TEXTURE_2D,null)}};this.initWebGLObjects=
+function(g){if(!g.__webglObjects){g.__webglObjects=[];g.__webglObjectsImmediate=[]}for(;g.__objectsAdded.length;){var l=g.__objectsAdded[0],n=g,i=void 0,k=void 0,s=void 0;if(l._modelViewMatrix==undefined){l._modelViewMatrix=new THREE.Matrix4;l._normalMatrixArray=new Float32Array(9);l._modelViewMatrixArray=new Float32Array(16);l._objectMatrixArray=new Float32Array(16);l.matrixWorld.flattenToArray(l._objectMatrixArray)}if(l instanceof THREE.Mesh){k=l.geometry;k.geometryGroups==undefined&&J(k);for(i in k.geometryGroups){s=
+k.geometryGroups[i];if(!s.__webGLVertexBuffer){var p=s;p.__webGLVertexBuffer=c.createBuffer();p.__webGLNormalBuffer=c.createBuffer();p.__webGLTangentBuffer=c.createBuffer();p.__webGLColorBuffer=c.createBuffer();p.__webGLUVBuffer=c.createBuffer();p.__webGLUV2Buffer=c.createBuffer();p.__webGLSkinVertexABuffer=c.createBuffer();p.__webGLSkinVertexBBuffer=c.createBuffer();p.__webGLSkinIndicesBuffer=c.createBuffer();p.__webGLSkinWeightsBuffer=c.createBuffer();p.__webGLFaceBuffer=c.createBuffer();p.__webGLLineBuffer=
+c.createBuffer();if(p.numMorphTargets){var r=void 0,E=void 0;p.__webGLMorphTargetsBuffers=[];r=0;for(E=p.numMorphTargets;r<E;r++)p.__webGLMorphTargetsBuffers.push(c.createBuffer())}p=s;var F=l,q=void 0,G=void 0,S=E=r=0,Q=F.geometry.faces,O=p.faces;q=0;for(G=O.length;q<G;q++){fi=O[q];face=Q[fi];if(face instanceof THREE.Face3){r+=3;E+=1;S+=3}else if(face instanceof THREE.Face4){r+=4;E+=2;S+=4}}p.__vertexArray=new Float32Array(r*3);p.__normalArray=new Float32Array(r*3);p.__tangentArray=new Float32Array(r*
+4);p.__colorArray=new Float32Array(r*3);p.__uvArray=new Float32Array(r*2);p.__uv2Array=new Float32Array(r*2);p.__skinVertexAArray=new Float32Array(r*4);p.__skinVertexBArray=new Float32Array(r*4);p.__skinIndexArray=new Float32Array(r*4);p.__skinWeightArray=new Float32Array(r*4);p.__faceArray=new Uint16Array(E*3);p.__lineArray=new Uint16Array(S*2);G=q=p;Q=void 0;O=void 0;var I=void 0,X=void 0;I=void 0;var Y=!1;Q=0;for(O=F.materials.length;Q<O;Q++){I=F.materials[Q];if(I instanceof THREE.MeshFaceMaterial){I=
+0;for(X=G.materials.length;I<X;I++)if(G.materials[I]&&G.materials[I].shading!=undefined&&G.materials[I].shading==THREE.SmoothShading){Y=!0;break}}else if(I&&I.shading!=undefined&&I.shading==THREE.SmoothShading){Y=!0;break}if(Y)break}q.__needsSmoothNormals=Y;p.__webGLFaceCount=E*3;p.__webGLLineCount=S*2;if(p.numMorphTargets){E=void 0;S=void 0;p.__morphTargetsArrays=[];E=0;for(S=p.numMorphTargets;E<S;E++)p.__morphTargetsArrays.push(new Float32Array(r*3))}k.__dirtyVertices=!0;k.__dirtyMorphTargets=!0;
+k.__dirtyElements=!0;k.__dirtyUvs=!0;k.__dirtyNormals=!0;k.__dirtyTangents=!0;k.__dirtyColors=!0}H(n.__webglObjects,s,l)}}else if(l instanceof THREE.Ribbon){k=l.geometry;if(!k.__webGLVertexBuffer){i=k;i.__webGLVertexBuffer=c.createBuffer();i.__webGLColorBuffer=c.createBuffer();i=k;s=i.vertices.length;i.__vertexArray=new Float32Array(s*3);i.__colorArray=new Float32Array(s*3);i.__webGLVertexCount=s;k.__dirtyVertices=!0;k.__dirtyColors=!0}H(n.__webglObjects,k,l)}else if(l instanceof THREE.Line){k=l.geometry;
+if(!k.__webGLVertexBuffer){i=k;i.__webGLVertexBuffer=c.createBuffer();i.__webGLColorBuffer=c.createBuffer();i=k;s=i.vertices.length;i.__vertexArray=new Float32Array(s*3);i.__colorArray=new Float32Array(s*3);i.__webGLLineCount=s;k.__dirtyVertices=!0;k.__dirtyColors=!0}H(n.__webglObjects,k,l)}else if(l instanceof THREE.ParticleSystem){k=l.geometry;if(!k.__webGLVertexBuffer){i=k;i.__webGLVertexBuffer=c.createBuffer();i.__webGLColorBuffer=c.createBuffer();i=k;s=i.vertices.length;i.__vertexArray=new Float32Array(s*
+3);i.__colorArray=new Float32Array(s*3);i.__sortArray=[];i.__webGLParticleCount=s;k.__dirtyVertices=!0;k.__dirtyColors=!0}H(n.__webglObjects,k,l)}else THREE.MarchingCubes!==undefined&&l instanceof THREE.MarchingCubes&&n.__webglObjectsImmediate.push({object:l,opaque:{list:[],count:0},transparent:{list:[],count:0}});g.__objectsAdded.splice(0,1)}for(;g.__objectsRemoved.length;){l=g.__objectsRemoved[0];n=g;k=void 0;i=void 0;for(k=n.__webglObjects.length-1;k>=0;k--){i=n.__webglObjects[k].object;l==i&&
+n.__webglObjects.splice(k,1)}g.__objectsRemoved.splice(0,1)}l=0;for(n=g.__webglObjects.length;l<n;l++){i=g.__webglObjects[l].object;s=void 0;k=void 0;p=void 0;if(i instanceof THREE.Mesh){k=i.geometry;for(s in k.geometryGroups){p=k.geometryGroups[s];if(k.__dirtyVertices||k.__dirtyMorphTargets||k.__dirtyElements||k.__dirtyUvs||k.__dirtyNormals||k.__dirtyColors||k.__dirtyTangents){r=c.DYNAMIC_DRAW;E=void 0;S=void 0;var Da=void 0,v=void 0,Aa=void 0,ra=void 0,ya=void 0;Da=void 0;var B=void 0,C=void 0,
+D=void 0,T=void 0;B=void 0;C=void 0;D=void 0;v=void 0;B=void 0;C=void 0;D=void 0;T=void 0;B=void 0;C=void 0;D=void 0;T=void 0;B=void 0;C=void 0;D=void 0;T=void 0;B=void 0;C=void 0;D=void 0;T=void 0;B=void 0;C=void 0;D=void 0;T=void 0;v=void 0;ra=void 0;Aa=void 0;ya=void 0;var ta=void 0,Ra=void 0,ma=void 0,na=X=I=Y=O=Q=F=G=q=0,t=0,oa=0,pa=p.__vertexArray,Ta=p.__uvArray,Ua=p.__uv2Array,Ga=p.__normalArray,$=p.__tangentArray,qa=p.__colorArray,aa=p.__skinVertexAArray,ca=p.__skinVertexBArray,da=p.__skinIndexArray,
+ea=p.__skinWeightArray,Va=p.__morphTargetsArrays,Ia=p.__faceArray,Ca=p.__lineArray,bb=p.__needsSmoothNormals,ua=i.geometry,Wa=ua.__dirtyVertices,Xa=ua.__dirtyElements,Sa=ua.__dirtyUvs,Ya=ua.__dirtyNormals,Za=ua.__dirtyTangents,$a=ua.__dirtyColors,ab=ua.__dirtyMorphTargets,Ea=ua.vertices,cb=p.faces,db=ua.faces,eb=ua.uvs,fb=ua.uvs2,Ja=ua.colors,Oa=ua.skinVerticesA,Pa=ua.skinVerticesB,Qa=ua.skinIndices,La=ua.skinWeights,Ka=ua.morphTargets;E=0;for(S=cb.length;E<S;E++){Da=cb[E];v=db[Da];ya=eb[Da];Da=fb[Da];
+Aa=v.vertexNormals;ra=v.normal;if(v instanceof THREE.Face3){if(Wa){B=Ea[v.a].position;C=Ea[v.b].position;D=Ea[v.c].position;pa[G]=B.x;pa[G+1]=B.y;pa[G+2]=B.z;pa[G+3]=C.x;pa[G+4]=C.y;pa[G+5]=C.z;pa[G+6]=D.x;pa[G+7]=D.y;pa[G+8]=D.z;G+=9}if(ab){ta=0;for(Ra=Ka.length;ta<Ra;ta++){B=Ka[ta].vertices[v.a].position;C=Ka[ta].vertices[v.b].position;D=Ka[ta].vertices[v.c].position;ma=Va[ta];ma[oa+0]=B.x;ma[oa+1]=B.y;ma[oa+2]=B.z;ma[oa+3]=C.x;ma[oa+4]=C.y;ma[oa+5]=C.z;ma[oa+6]=D.x;ma[oa+7]=D.y;ma[oa+8]=D.z}oa+=
+9}if(La.length){B=La[v.a];C=La[v.b];D=La[v.c];ea[t]=B.x;ea[t+1]=B.y;ea[t+2]=B.z;ea[t+3]=B.w;ea[t+4]=C.x;ea[t+5]=C.y;ea[t+6]=C.z;ea[t+7]=C.w;ea[t+8]=D.x;ea[t+9]=D.y;ea[t+10]=D.z;ea[t+11]=D.w;B=Qa[v.a];C=Qa[v.b];D=Qa[v.c];da[t]=B.x;da[t+1]=B.y;da[t+2]=B.z;da[t+3]=B.w;da[t+4]=C.x;da[t+5]=C.y;da[t+6]=C.z;da[t+7]=C.w;da[t+8]=D.x;da[t+9]=D.y;da[t+10]=D.z;da[t+11]=D.w;B=Oa[v.a];C=Oa[v.b];D=Oa[v.c];aa[t]=B.x;aa[t+1]=B.y;aa[t+2]=B.z;aa[t+3]=1;aa[t+4]=C.x;aa[t+5]=C.y;aa[t+6]=C.z;aa[t+7]=1;aa[t+8]=D.x;aa[t+
+9]=D.y;aa[t+10]=D.z;aa[t+11]=1;B=Pa[v.a];C=Pa[v.b];D=Pa[v.c];ca[t]=B.x;ca[t+1]=B.y;ca[t+2]=B.z;ca[t+3]=1;ca[t+4]=C.x;ca[t+5]=C.y;ca[t+6]=C.z;ca[t+7]=1;ca[t+8]=D.x;ca[t+9]=D.y;ca[t+10]=D.z;ca[t+11]=1;t+=12}if($a&&Ja.length){B=Ja[v.a];C=Ja[v.b];D=Ja[v.c];qa[na]=B.r;qa[na+1]=B.g;qa[na+2]=B.b;qa[na+3]=C.r;qa[na+4]=C.g;qa[na+5]=C.b;qa[na+6]=D.r;qa[na+7]=D.g;qa[na+8]=D.b;na+=9}if(Za&&ua.hasTangents){B=Ea[v.a].tangent;C=Ea[v.b].tangent;D=Ea[v.c].tangent;$[I]=B.x;$[I+1]=B.y;$[I+2]=B.z;$[I+3]=B.w;$[I+4]=C.x;
+$[I+5]=C.y;$[I+6]=C.z;$[I+7]=C.w;$[I+8]=D.x;$[I+9]=D.y;$[I+10]=D.z;$[I+11]=D.w;I+=12}if(Ya)if(Aa.length==3&&bb)for(v=0;v<3;v++){ra=Aa[v];Ga[Y]=ra.x;Ga[Y+1]=ra.y;Ga[Y+2]=ra.z;Y+=3}else for(v=0;v<3;v++){Ga[Y]=ra.x;Ga[Y+1]=ra.y;Ga[Y+2]=ra.z;Y+=3}if(Sa&&ya)for(v=0;v<3;v++){Aa=ya[v];Ta[F]=Aa.u;Ta[F+1]=Aa.v;F+=2}if(Sa&&Da)for(v=0;v<3;v++){ya=Da[v];Ua[Q]=ya.u;Ua[Q+1]=ya.v;Q+=2}if(Xa){Ia[O]=q;Ia[O+1]=q+1;Ia[O+2]=q+2;O+=3;Ca[X]=q;Ca[X+1]=q+1;Ca[X+2]=q;Ca[X+3]=q+2;Ca[X+4]=q+1;Ca[X+5]=q+2;X+=6;q+=3}}else if(v instanceof
+THREE.Face4){if(Wa){B=Ea[v.a].position;C=Ea[v.b].position;D=Ea[v.c].position;T=Ea[v.d].position;pa[G]=B.x;pa[G+1]=B.y;pa[G+2]=B.z;pa[G+3]=C.x;pa[G+4]=C.y;pa[G+5]=C.z;pa[G+6]=D.x;pa[G+7]=D.y;pa[G+8]=D.z;pa[G+9]=T.x;pa[G+10]=T.y;pa[G+11]=T.z;G+=12}if(ab){ta=0;for(Ra=Ka.length;ta<Ra;ta++){B=Ka[ta].vertices[v.a].position;C=Ka[ta].vertices[v.b].position;D=Ka[ta].vertices[v.c].position;T=Ka[ta].vertices[v.d].position;ma=Va[ta];ma[oa+0]=B.x;ma[oa+1]=B.y;ma[oa+2]=B.z;ma[oa+3]=C.x;ma[oa+4]=C.y;ma[oa+5]=C.z;
+ma[oa+6]=D.x;ma[oa+7]=D.y;ma[oa+8]=D.z;ma[oa+9]=T.x;ma[oa+10]=T.y;ma[oa+11]=T.z}oa+=12}if(La.length){B=La[v.a];C=La[v.b];D=La[v.c];T=La[v.d];ea[t]=B.x;ea[t+1]=B.y;ea[t+2]=B.z;ea[t+3]=B.w;ea[t+4]=C.x;ea[t+5]=C.y;ea[t+6]=C.z;ea[t+7]=C.w;ea[t+8]=D.x;ea[t+9]=D.y;ea[t+10]=D.z;ea[t+11]=D.w;ea[t+12]=T.x;ea[t+13]=T.y;ea[t+14]=T.z;ea[t+15]=T.w;B=Qa[v.a];C=Qa[v.b];D=Qa[v.c];T=Qa[v.d];da[t]=B.x;da[t+1]=B.y;da[t+2]=B.z;da[t+3]=B.w;da[t+4]=C.x;da[t+5]=C.y;da[t+6]=C.z;da[t+7]=C.w;da[t+8]=D.x;da[t+9]=D.y;da[t+10]=
+D.z;da[t+11]=D.w;da[t+12]=T.x;da[t+13]=T.y;da[t+14]=T.z;da[t+15]=T.w;B=Oa[v.a];C=Oa[v.b];D=Oa[v.c];T=Oa[v.d];aa[t]=B.x;aa[t+1]=B.y;aa[t+2]=B.z;aa[t+3]=1;aa[t+4]=C.x;aa[t+5]=C.y;aa[t+6]=C.z;aa[t+7]=1;aa[t+8]=D.x;aa[t+9]=D.y;aa[t+10]=D.z;aa[t+11]=1;aa[t+12]=T.x;aa[t+13]=T.y;aa[t+14]=T.z;aa[t+15]=1;B=Pa[v.a];C=Pa[v.b];D=Pa[v.c];T=Pa[v.d];ca[t]=B.x;ca[t+1]=B.y;ca[t+2]=B.z;ca[t+3]=1;ca[t+4]=C.x;ca[t+5]=C.y;ca[t+6]=C.z;ca[t+7]=1;ca[t+8]=D.x;ca[t+9]=D.y;ca[t+10]=D.z;ca[t+11]=1;ca[t+12]=T.x;ca[t+13]=T.y;
+ca[t+14]=T.z;ca[t+15]=1;t+=16}if($a&&Ja.length){B=Ja[v.a];C=Ja[v.b];D=Ja[v.c];T=Ja[v.d];qa[na]=B.r;qa[na+1]=B.g;qa[na+2]=B.b;qa[na+3]=C.r;qa[na+4]=C.g;qa[na+5]=C.b;qa[na+6]=D.r;qa[na+7]=D.g;qa[na+8]=D.b;qa[na+9]=T.r;qa[na+10]=T.g;qa[na+11]=T.b;na+=12}if(Za&&ua.hasTangents){B=Ea[v.a].tangent;C=Ea[v.b].tangent;D=Ea[v.c].tangent;v=Ea[v.d].tangent;$[I]=B.x;$[I+1]=B.y;$[I+2]=B.z;$[I+3]=B.w;$[I+4]=C.x;$[I+5]=C.y;$[I+6]=C.z;$[I+7]=C.w;$[I+8]=D.x;$[I+9]=D.y;$[I+10]=D.z;$[I+11]=D.w;$[I+12]=v.x;$[I+13]=v.y;
+$[I+14]=v.z;$[I+15]=v.w;I+=16}if(Ya)if(Aa.length==4&&bb)for(v=0;v<4;v++){ra=Aa[v];Ga[Y]=ra.x;Ga[Y+1]=ra.y;Ga[Y+2]=ra.z;Y+=3}else for(v=0;v<4;v++){Ga[Y]=ra.x;Ga[Y+1]=ra.y;Ga[Y+2]=ra.z;Y+=3}if(Sa&&ya)for(v=0;v<4;v++){Aa=ya[v];Ta[F]=Aa.u;Ta[F+1]=Aa.v;F+=2}if(Sa&&Da)for(v=0;v<4;v++){ya=Da[v];Ua[Q]=ya.u;Ua[Q+1]=ya.v;Q+=2}if(Xa){Ia[O]=q;Ia[O+1]=q+1;Ia[O+2]=q+2;Ia[O+3]=q;Ia[O+4]=q+2;Ia[O+5]=q+3;O+=6;Ca[X]=q;Ca[X+1]=q+1;Ca[X+2]=q;Ca[X+3]=q+3;Ca[X+4]=q+1;Ca[X+5]=q+2;Ca[X+6]=q+2;Ca[X+7]=q+3;X+=8;q+=4}}}if(Wa){c.bindBuffer(c.ARRAY_BUFFER,
+p.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,pa,r)}if(ab){ta=0;for(Ra=Ka.length;ta<Ra;ta++){c.bindBuffer(c.ARRAY_BUFFER,p.__webGLMorphTargetsBuffers[ta]);c.bufferData(c.ARRAY_BUFFER,Va[ta],r)}}if($a&&Ja.length){c.bindBuffer(c.ARRAY_BUFFER,p.__webGLColorBuffer);c.bufferData(c.ARRAY_BUFFER,qa,r)}if(Ya){c.bindBuffer(c.ARRAY_BUFFER,p.__webGLNormalBuffer);c.bufferData(c.ARRAY_BUFFER,Ga,r)}if(Za&&ua.hasTangents){c.bindBuffer(c.ARRAY_BUFFER,p.__webGLTangentBuffer);c.bufferData(c.ARRAY_BUFFER,$,r)}if(Sa&&
+F>0){c.bindBuffer(c.ARRAY_BUFFER,p.__webGLUVBuffer);c.bufferData(c.ARRAY_BUFFER,Ta,r)}if(Sa&&Q>0){c.bindBuffer(c.ARRAY_BUFFER,p.__webGLUV2Buffer);c.bufferData(c.ARRAY_BUFFER,Ua,r)}if(Xa){c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,p.__webGLFaceBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,Ia,r);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,p.__webGLLineBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,Ca,r)}if(t>0){c.bindBuffer(c.ARRAY_BUFFER,p.__webGLSkinVertexABuffer);c.bufferData(c.ARRAY_BUFFER,aa,r);c.bindBuffer(c.ARRAY_BUFFER,
+p.__webGLSkinVertexBBuffer);c.bufferData(c.ARRAY_BUFFER,ca,r);c.bindBuffer(c.ARRAY_BUFFER,p.__webGLSkinIndicesBuffer);c.bufferData(c.ARRAY_BUFFER,da,r);c.bindBuffer(c.ARRAY_BUFFER,p.__webGLSkinWeightsBuffer);c.bufferData(c.ARRAY_BUFFER,ea,r)}}}k.__dirtyVertices=!1;k.__dirtyMorphTargets=!1;k.__dirtyElements=!1;k.__dirtyUvs=!1;k.__dirtyNormals=!1;k.__dirtyTangents=!1;k.__dirtyColors=!1}else if(i instanceof THREE.Ribbon){k=i.geometry;if(k.__dirtyVertices||k.__dirtyColors){i=k;s=c.DYNAMIC_DRAW;q=void 0;
+q=void 0;G=void 0;p=void 0;F=i.vertices;r=i.colors;Q=F.length;E=r.length;O=i.__vertexArray;S=i.__colorArray;Y=i.__dirtyColors;if(i.__dirtyVertices){for(q=0;q<Q;q++){G=F[q].position;p=q*3;O[p]=G.x;O[p+1]=G.y;O[p+2]=G.z}c.bindBuffer(c.ARRAY_BUFFER,i.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,O,s)}if(Y){for(q=0;q<E;q++){color=r[q];p=q*3;S[p]=color.r;S[p+1]=color.g;S[p+2]=color.b}c.bindBuffer(c.ARRAY_BUFFER,i.__webGLColorBuffer);c.bufferData(c.ARRAY_BUFFER,S,s)}}k.__dirtyVertices=!1;k.__dirtyColors=
+!1}else if(i instanceof THREE.Line){k=i.geometry;if(k.__dirtyVertices||k.__dirtyColors){i=k;s=c.DYNAMIC_DRAW;q=void 0;q=void 0;G=void 0;p=void 0;F=i.vertices;r=i.colors;Q=F.length;E=r.length;O=i.__vertexArray;S=i.__colorArray;Y=i.__dirtyColors;if(i.__dirtyVertices){for(q=0;q<Q;q++){G=F[q].position;p=q*3;O[p]=G.x;O[p+1]=G.y;O[p+2]=G.z}c.bindBuffer(c.ARRAY_BUFFER,i.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,O,s)}if(Y){for(q=0;q<E;q++){color=r[q];p=q*3;S[p]=color.r;S[p+1]=color.g;S[p+2]=color.b}c.bindBuffer(c.ARRAY_BUFFER,
+i.__webGLColorBuffer);c.bufferData(c.ARRAY_BUFFER,S,s)}}k.__dirtyVertices=!1;k.__dirtyColors=!1}else if(i instanceof THREE.ParticleSystem){k=i.geometry;(k.__dirtyVertices||k.__dirtyColors||i.sortParticles)&&b(k,c.DYNAMIC_DRAW,i);k.__dirtyVertices=!1;k.__dirtyColors=!1}}};this.setFaceCulling=function(g,l){if(g){!l||l=="ccw"?c.frontFace(c.CCW):c.frontFace(c.CW);if(g=="back")c.cullFace(c.BACK);else g=="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}};

+ 11 - 2
utils/build.py

@@ -113,6 +113,8 @@ CANVAS_FILES = [
 'core/Face4.js',
 'core/UV.js',
 'core/Geometry.js',
+'animation/AnimationHandler.js',
+'animation/Animation.js',
 'cameras/Camera.js',
 'lights/Light.js',
 'lights/AmbientLight.js',
@@ -161,6 +163,8 @@ DOM_FILES = [
 'core/Face3.js',
 'core/Face4.js',
 'core/UV.js',
+'animation/AnimationHandler.js',
+'animation/Animation.js',
 'cameras/Camera.js',
 'materials/ParticleDOMMaterial.js',
 'objects/Particle.js',
@@ -170,7 +174,7 @@ DOM_FILES = [
 'renderers/Projector.js',
 'renderers/DOMRenderer.js',
 'renderers/SoundRenderer.js',
-'renderers/renderables/RenderableParticle.js',
+'renderers/renderables/RenderableParticle.js'
 ]
 
 SVG_FILES = [
@@ -190,6 +194,8 @@ SVG_FILES = [
 'core/Face4.js',
 'core/UV.js',
 'core/Geometry.js',
+'animation/AnimationHandler.js',
+'animation/Animation.js',
 'cameras/Camera.js',
 'lights/Light.js',
 'lights/AmbientLight.js',
@@ -237,6 +243,8 @@ WEBGL_FILES = [
 'core/Face4.js',
 'core/UV.js',
 'core/Geometry.js',
+'animation/AnimationHandler.js',
+'animation/Animation.js',
 'cameras/Camera.js',
 'lights/Light.js',
 'lights/AmbientLight.js',
@@ -269,9 +277,10 @@ WEBGL_FILES = [
 'scenes/Scene.js',
 'scenes/Fog.js',
 'scenes/FogExp2.js',
+'renderers/Projector.js',
 'renderers/SoundRenderer.js',
 'renderers/WebGLShaders.js',
-'renderers/WebGLRenderer.js',
+'renderers/WebGLRenderer.js'
 ]
 
 def merge(files):